@agentprojectcontext/apx 1.50.0 → 1.51.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.
- package/package.json +1 -1
- package/src/core/agent/prompt-builder.js +15 -4
- package/src/core/voice/emotions.js +106 -0
- package/src/core/voice/engines/index.js +39 -9
- package/src/core/voice/engines/openai.js +55 -19
- package/src/core/voice/tts.js +9 -2
- package/src/host/daemon/api/conversations.js +14 -1
- package/src/host/daemon/api/voice.js +1 -0
- package/src/interfaces/web/dist/assets/index-C1tm8nvc.js +651 -0
- package/src/interfaces/web/dist/assets/index-C1tm8nvc.js.map +1 -0
- package/src/interfaces/web/dist/assets/{index-C53eJujd.css → index-L1pXYFUg.css} +1 -1
- package/src/interfaces/web/dist/index.html +2 -2
- package/src/interfaces/web/package-lock.json +77 -77
- package/src/interfaces/web/src/components/UiSelect.tsx +2 -1
- package/src/interfaces/web/src/components/voice/VoiceProviderList.tsx +101 -147
- package/src/interfaces/web/src/components/voice/VoiceProviderModal.tsx +137 -6
- package/src/interfaces/web/src/components/voice/VoiceTestCard.tsx +17 -24
- package/src/interfaces/web/src/hooks/useChat.ts +1 -1
- package/src/interfaces/web/src/i18n/en.ts +34 -2
- package/src/interfaces/web/src/i18n/es.ts +34 -2
- package/src/interfaces/web/src/lib/api/voice.ts +36 -3
- package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +29 -37
- package/src/interfaces/web/dist/assets/index--24yvYc5.js +0 -656
- package/src/interfaces/web/dist/assets/index--24yvYc5.js.map +0 -1
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
function oT(e,t){for(var a=0;a<t.length;a++){const o=t[a];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 t=document.createElement("link").relList;if(t&&t.supports&&t.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 u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function a(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=a(l);fetch(l.href,c)}})();function Ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yg={exports:{}},Gi={};/**
|
|
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 g1;function lT(){if(g1)return Gi;g1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var p in l)p!=="key"&&(c[p]=l[p])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:u,ref:l!==void 0?l:null,props:c}}return Gi.Fragment=t,Gi.jsx=a,Gi.jsxs=a,Gi}var h1;function iT(){return h1||(h1=1,yg.exports=lT()),yg.exports}var r=iT(),jg={exports:{}},it={};/**
|
|
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 x1;function cT(){if(x1)return it;x1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function k(L){return L===null||typeof L!="object"?null:(L=v&&L[v]||L["@@iterator"],typeof L=="function"?L:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,y={};function S(L,G,Z){this.props=L,this.context=G,this.refs=y,this.updater=Z||N}S.prototype.isReactComponent={},S.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,G,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function C(){}C.prototype=S.prototype;function E(L,G,Z){this.props=L,this.context=G,this.refs=y,this.updater=Z||N}var R=E.prototype=new C;R.constructor=E,w(R,S.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function T(){}var M={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function I(L,G,Z){var ee=Z.ref;return{$$typeof:e,type:L,key:G,ref:ee!==void 0?ee:null,props:Z}}function P(L,G){return I(L.type,G,L.props)}function H(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function D(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(Z){return G[Z]})}var B=/\/+/g;function V(L,G){return typeof L=="object"&&L!==null&&L.key!=null?D(""+L.key):G.toString(36)}function $(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(T,T):(L.status="pending",L.then(function(G){L.status==="pending"&&(L.status="fulfilled",L.value=G)},function(G){L.status==="pending"&&(L.status="rejected",L.reason=G)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function q(L,G,Z,ee,de){var fe=typeof L;(fe==="undefined"||fe==="boolean")&&(L=null);var ae=!1;if(L===null)ae=!0;else switch(fe){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(L.$$typeof){case e:case t:ae=!0;break;case h:return ae=L._init,q(ae(L._payload),G,Z,ee,de)}}if(ae)return de=de(L),ae=ee===""?"."+V(L,0):ee,A(de)?(Z="",ae!=null&&(Z=ae.replace(B,"$&/")+"/"),q(de,G,Z,"",function(Te){return Te})):de!=null&&(H(de)&&(de=P(de,Z+(de.key==null||L&&L.key===de.key?"":(""+de.key).replace(B,"$&/")+"/")+ae)),G.push(de)),1;ae=0;var oe=ee===""?".":ee+":";if(A(L))for(var me=0;me<L.length;me++)ee=L[me],fe=oe+V(ee,me),ae+=q(ee,G,Z,fe,de);else if(me=k(L),typeof me=="function")for(L=me.call(L),me=0;!(ee=L.next()).done;)ee=ee.value,fe=oe+V(ee,me++),ae+=q(ee,G,Z,fe,de);else if(fe==="object"){if(typeof L.then=="function")return q($(L),G,Z,ee,de);throw G=String(L),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ae}function Y(L,G,Z){if(L==null)return L;var ee=[],de=0;return q(L,ee,"","",function(fe){return G.call(Z,fe,de++)}),ee}function K(L){if(L._status===-1){var G=L._result;G=G(),G.then(function(Z){(L._status===0||L._status===-1)&&(L._status=1,L._result=Z)},function(Z){(L._status===0||L._status===-1)&&(L._status=2,L._result=Z)}),L._status===-1&&(L._status=0,L._result=G)}if(L._status===1)return L._result.default;throw L._result}var F=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},X={map:Y,forEach:function(L,G,Z){Y(L,function(){G.apply(this,arguments)},Z)},count:function(L){var G=0;return Y(L,function(){G++}),G},toArray:function(L){return Y(L,function(G){return G})||[]},only:function(L){if(!H(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return it.Activity=b,it.Children=X,it.Component=S,it.Fragment=a,it.Profiler=l,it.PureComponent=E,it.StrictMode=o,it.Suspense=m,it.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,it.__COMPILER_RUNTIME={__proto__:null,c:function(L){return M.H.useMemoCache(L)}},it.cache=function(L){return function(){return L.apply(null,arguments)}},it.cacheSignal=function(){return null},it.cloneElement=function(L,G,Z){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ee=w({},L.props),de=L.key;if(G!=null)for(fe in G.key!==void 0&&(de=""+G.key),G)!z.call(G,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&G.ref===void 0||(ee[fe]=G[fe]);var fe=arguments.length-2;if(fe===1)ee.children=Z;else if(1<fe){for(var ae=Array(fe),oe=0;oe<fe;oe++)ae[oe]=arguments[oe+2];ee.children=ae}return I(L.type,de,ee)},it.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:c,_context:L},L},it.createElement=function(L,G,Z){var ee,de={},fe=null;if(G!=null)for(ee in G.key!==void 0&&(fe=""+G.key),G)z.call(G,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(de[ee]=G[ee]);var ae=arguments.length-2;if(ae===1)de.children=Z;else if(1<ae){for(var oe=Array(ae),me=0;me<ae;me++)oe[me]=arguments[me+2];de.children=oe}if(L&&L.defaultProps)for(ee in ae=L.defaultProps,ae)de[ee]===void 0&&(de[ee]=ae[ee]);return I(L,fe,de)},it.createRef=function(){return{current:null}},it.forwardRef=function(L){return{$$typeof:p,render:L}},it.isValidElement=H,it.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:K}},it.memo=function(L,G){return{$$typeof:g,type:L,compare:G===void 0?null:G}},it.startTransition=function(L){var G=M.T,Z={};M.T=Z;try{var ee=L(),de=M.S;de!==null&&de(Z,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(T,F)}catch(fe){F(fe)}finally{G!==null&&Z.types!==null&&(G.types=Z.types),M.T=G}},it.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},it.use=function(L){return M.H.use(L)},it.useActionState=function(L,G,Z){return M.H.useActionState(L,G,Z)},it.useCallback=function(L,G){return M.H.useCallback(L,G)},it.useContext=function(L){return M.H.useContext(L)},it.useDebugValue=function(){},it.useDeferredValue=function(L,G){return M.H.useDeferredValue(L,G)},it.useEffect=function(L,G){return M.H.useEffect(L,G)},it.useEffectEvent=function(L){return M.H.useEffectEvent(L)},it.useId=function(){return M.H.useId()},it.useImperativeHandle=function(L,G,Z){return M.H.useImperativeHandle(L,G,Z)},it.useInsertionEffect=function(L,G){return M.H.useInsertionEffect(L,G)},it.useLayoutEffect=function(L,G){return M.H.useLayoutEffect(L,G)},it.useMemo=function(L,G){return M.H.useMemo(L,G)},it.useOptimistic=function(L,G){return M.H.useOptimistic(L,G)},it.useReducer=function(L,G,Z){return M.H.useReducer(L,G,Z)},it.useRef=function(L){return M.H.useRef(L)},it.useState=function(L){return M.H.useState(L)},it.useSyncExternalStore=function(L,G,Z){return M.H.useSyncExternalStore(L,G,Z)},it.useTransition=function(){return M.H.useTransition()},it.version="19.2.7",it}var b1;function Bc(){return b1||(b1=1,jg.exports=cT()),jg.exports}var x=Bc();const Uc=Ex(x),uT=oT({__proto__:null,default:Uc},[x]);var wg={exports:{}},Yi={},kg={exports:{}},Sg={};/**
|
|
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 _1;function dT(){return _1||(_1=1,(function(e){function t(q,Y){var K=q.length;q.push(Y);e:for(;0<K;){var F=K-1>>>1,X=q[F];if(0<l(X,Y))q[F]=Y,q[K]=X,K=F;else break e}}function a(q){return q.length===0?null:q[0]}function o(q){if(q.length===0)return null;var Y=q[0],K=q.pop();if(K!==Y){q[0]=K;e:for(var F=0,X=q.length,L=X>>>1;F<L;){var G=2*(F+1)-1,Z=q[G],ee=G+1,de=q[ee];if(0>l(Z,K))ee<X&&0>l(de,Z)?(q[F]=de,q[ee]=K,F=ee):(q[F]=Z,q[G]=K,F=G);else if(ee<X&&0>l(de,K))q[F]=de,q[ee]=K,F=ee;else break e}}return Y}function l(q,Y){var K=q.sortIndex-Y.sortIndex;return K!==0?K:q.id-Y.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 u=Date,p=u.now();e.unstable_now=function(){return u.now()-p}}var m=[],g=[],h=1,b=null,v=3,k=!1,N=!1,w=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(q){for(var Y=a(g);Y!==null;){if(Y.callback===null)o(g);else if(Y.startTime<=q)o(g),Y.sortIndex=Y.expirationTime,t(m,Y);else break;Y=a(g)}}function A(q){if(w=!1,R(q),!N)if(a(m)!==null)N=!0,T||(T=!0,D());else{var Y=a(g);Y!==null&&$(A,Y.startTime-q)}}var T=!1,M=-1,z=5,I=-1;function P(){return y?!0:!(e.unstable_now()-I<z)}function H(){if(y=!1,T){var q=e.unstable_now();I=q;var Y=!0;try{e:{N=!1,w&&(w=!1,C(M),M=-1),k=!0;var K=v;try{t:{for(R(q),b=a(m);b!==null&&!(b.expirationTime>q&&P());){var F=b.callback;if(typeof F=="function"){b.callback=null,v=b.priorityLevel;var X=F(b.expirationTime<=q);if(q=e.unstable_now(),typeof X=="function"){b.callback=X,R(q),Y=!0;break t}b===a(m)&&o(m),R(q)}else o(m);b=a(m)}if(b!==null)Y=!0;else{var L=a(g);L!==null&&$(A,L.startTime-q),Y=!1}}break e}finally{b=null,v=K,k=!1}Y=void 0}}finally{Y?D():T=!1}}}var D;if(typeof E=="function")D=function(){E(H)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,V=B.port2;B.port1.onmessage=H,D=function(){V.postMessage(null)}}else D=function(){S(H,0)};function $(q,Y){M=S(function(){q(e.unstable_now())},Y)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(q){switch(v){case 1:case 2:case 3:var Y=3;break;default:Y=v}var K=v;v=Y;try{return q()}finally{v=K}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=v;v=q;try{return Y()}finally{v=K}},e.unstable_scheduleCallback=function(q,Y,K){var F=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?F+K:F):K=F,q){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=K+X,q={id:h++,callback:Y,priorityLevel:q,startTime:K,expirationTime:X,sortIndex:-1},K>F?(q.sortIndex=K,t(g,q),a(m)===null&&q===a(g)&&(w?(C(M),M=-1):w=!0,$(A,K-F))):(q.sortIndex=X,t(m,q),N||k||(N=!0,T||(T=!0,D()))),q},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(q){var Y=v;return function(){var K=v;v=Y;try{return q.apply(this,arguments)}finally{v=K}}}})(Sg)),Sg}var v1;function fT(){return v1||(v1=1,kg.exports=dT()),kg.exports}var Cg={exports:{}},Vn={};/**
|
|
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 y1;function pT(){if(y1)return Vn;y1=1;var e=Bc();function t(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)g+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var o={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,g,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:m,containerInfo:g,implementation:h}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Vn.createPortal=function(m,g){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return c(m,g,null,h)},Vn.flushSync=function(m){var g=u.T,h=o.p;try{if(u.T=null,o.p=2,m)return m()}finally{u.T=g,o.p=h,o.d.f()}},Vn.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,o.d.C(m,g))},Vn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Vn.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;h==="style"?o.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:k}):h==="script"&&o.d.X(m,{crossOrigin:b,integrity:v,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Vn.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var h=p(g.as,g.crossOrigin);o.d.M(m,{crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&o.d.M(m)},Vn.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin);o.d.L(m,h,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Vn.preloadModule=function(m,g){if(typeof m=="string")if(g){var h=p(g.as,g.crossOrigin);o.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else o.d.m(m)},Vn.requestFormReset=function(m){o.d.r(m)},Vn.unstable_batchedUpdates=function(m,g){return m(g)},Vn.useFormState=function(m,g,h){return u.H.useFormState(m,g,h)},Vn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Vn.version="19.2.7",Vn}var j1;function dk(){if(j1)return Cg.exports;j1=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(t){console.error(t)}}return e(),Cg.exports=pT(),Cg.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 w1;function mT(){if(w1)return Yi;w1=1;var e=fT(),t=Bc(),a=dk();function o(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){var s=n,i=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(i=s.return),n=s.return;while(n)}return s.tag===3?i:null}function u(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function p(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(o(188))}function g(n){var s=n.alternate;if(!s){if(s=c(n),s===null)throw Error(o(188));return s!==n?null:n}for(var i=n,d=s;;){var _=i.return;if(_===null)break;var j=_.alternate;if(j===null){if(d=_.return,d!==null){i=d;continue}break}if(_.child===j.child){for(j=_.child;j;){if(j===i)return m(_),n;if(j===d)return m(_),s;j=j.sibling}throw Error(o(188))}if(i.return!==d.return)i=_,d=j;else{for(var O=!1,U=_.child;U;){if(U===i){O=!0,i=_,d=j;break}if(U===d){O=!0,d=_,i=j;break}U=U.sibling}if(!O){for(U=j.child;U;){if(U===i){O=!0,i=j,d=_;break}if(U===d){O=!0,d=j,i=_;break}U=U.sibling}if(!O)throw Error(o(189))}}if(i.alternate!==d)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:s}function h(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=h(n),s!==null)return s;n=n.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function D(n){return n===null||typeof n!="object"?null:(n=H&&n[H]||n["@@iterator"],typeof n=="function"?n:null)}var B=Symbol.for("react.client.reference");function V(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===B?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case S:return"Profiler";case y:return"StrictMode";case A:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case E:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case R:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case M:return s=n.displayName||null,s!==null?s:V(n.type)||"Memo";case z:s=n._payload,n=n._init;try{return V(n(s))}catch{}}return null}var $=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},F=[],X=-1;function L(n){return{current:n}}function G(n){0>X||(n.current=F[X],F[X]=null,X--)}function Z(n,s){X++,F[X]=n.current,n.current=s}var ee=L(null),de=L(null),fe=L(null),ae=L(null);function oe(n,s){switch(Z(fe,s),Z(de,n),Z(ee,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?I0(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=I0(s),n=B0(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(ee),Z(ee,n)}function me(){G(ee),G(de),G(fe)}function Te(n){n.memoizedState!==null&&Z(ae,n);var s=ee.current,i=B0(s,n.type);s!==i&&(Z(de,n),Z(ee,i))}function ie(n){de.current===n&&(G(ee),G(de)),ae.current===n&&(G(ae),Vi._currentValue=K)}var pe,Se;function je(n){if(pe===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);pe=s&&s[1]||"",Se=-1<i.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+pe+n+Se}var Be=!1;function Ve(n,s){if(!n||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(ue){var re=ue}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(ue){re=ue}n.call(ye.prototype)}}else{try{throw Error()}catch(ue){re=ue}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ue){if(ue&&re&&typeof ue.stack=="string")return[ue.stack,re.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=d.DetermineComponentFrameRoot(),O=j[0],U=j[1];if(O&&U){var Q=O.split(`
|
|
44
|
+
`),ne=U.split(`
|
|
45
|
+
`);for(_=d=0;d<Q.length&&!Q[d].includes("DetermineComponentFrameRoot");)d++;for(;_<ne.length&&!ne[_].includes("DetermineComponentFrameRoot");)_++;if(d===Q.length||_===ne.length)for(d=Q.length-1,_=ne.length-1;1<=d&&0<=_&&Q[d]!==ne[_];)_--;for(;1<=d&&0<=_;d--,_--)if(Q[d]!==ne[_]){if(d!==1||_!==1)do if(d--,_--,0>_||Q[d]!==ne[_]){var he=`
|
|
46
|
+
`+Q[d].replace(" at new "," at ");return n.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",n.displayName)),he}while(1<=d&&0<=_);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?je(i):""}function we(n,s){switch(n.tag){case 26:case 27:case 5:return je(n.type);case 16:return je("Lazy");case 13:return n.child!==s&&s!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return Ve(n.type,!1);case 11:return Ve(n.type.render,!1);case 1:return Ve(n.type,!0);case 31:return je("Activity");default:return""}}function Ee(n){try{var s="",i=null;do s+=we(n,i),i=n,n=n.return;while(n);return s}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var ve=Object.prototype.hasOwnProperty,Ce=e.unstable_scheduleCallback,Pe=e.unstable_cancelCallback,Le=e.unstable_shouldYield,Ie=e.unstable_requestPaint,se=e.unstable_now,be=e.unstable_getCurrentPriorityLevel,$e=e.unstable_ImmediatePriority,Re=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,We=e.unstable_LowPriority,at=e.unstable_IdlePriority,yt=e.log,_e=e.unstable_setDisableYieldValue,Me=null,He=null;function Xe(n){if(typeof yt=="function"&&_e(n),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(Me,n)}catch{}}var ot=Math.clz32?Math.clz32:pt,sn=Math.log,dn=Math.LN2;function pt(n){return n>>>=0,n===0?32:31-(sn(n)/dn|0)|0}var Et=256,an=262144,Wt=4194304;function Zt(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Gt(n,s,i){var d=n.pendingLanes;if(d===0)return 0;var _=0,j=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var U=d&134217727;return U!==0?(d=U&~j,d!==0?_=Zt(d):(O&=U,O!==0?_=Zt(O):i||(i=U&~n,i!==0&&(_=Zt(i))))):(U=d&~j,U!==0?_=Zt(U):O!==0?_=Zt(O):i||(i=d&~n,i!==0&&(_=Zt(i)))),_===0?0:s!==0&&s!==_&&(s&j)===0&&(j=_&-_,i=s&-s,j>=i||j===32&&(i&4194048)!==0)?s:_}function fn(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function es(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 ds(){var n=Wt;return Wt<<=1,(Wt&62914560)===0&&(Wt=4194304),n}function js(n){for(var s=[],i=0;31>i;i++)s.push(n);return s}function pn(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ws(n,s,i,d,_,j){var O=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var U=n.entanglements,Q=n.expirationTimes,ne=n.hiddenUpdates;for(i=O&~i;0<i;){var he=31-ot(i),ye=1<<he;U[he]=0,Q[he]=-1;var re=ne[he];if(re!==null)for(ne[he]=null,he=0;he<re.length;he++){var ue=re[he];ue!==null&&(ue.lane&=-536870913)}i&=~ye}d!==0&&xa(n,d,0),j!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=j&~(O&~s))}function xa(n,s,i){n.pendingLanes|=s,n.suspendedLanes&=~s;var d=31-ot(s);n.entangledLanes|=s,n.entanglements[d]=n.entanglements[d]|1073741824|i&261930}function Ls(n,s){var i=n.entangledLanes|=s;for(n=n.entanglements;i;){var d=31-ot(i),_=1<<d;_&s|n[d]&s&&(n[d]|=s),i&=~_}}function ba(n,s){var i=s&-s;return i=(i&42)!==0?1:ct(i),(i&(n.suspendedLanes|s))!==0?0:i}function ct(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function zt(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function mn(){var n=Y.p;return n!==0?n:(n=window.event,n===void 0?32:i1(n.type))}function Sn(n,s){var i=Y.p;try{return Y.p=n,s()}finally{Y.p=i}}var yn=Math.random().toString(36).slice(2),Ht="__reactFiber$"+yn,zn="__reactProps$"+yn,Ks="__reactContainer$"+yn,ni="__reactEvents$"+yn,Zc="__reactListeners$"+yn,QN="__reactHandles$"+yn,S_="__reactResources$"+yn,si="__reactMarker$"+yn;function pp(n){delete n[Ht],delete n[zn],delete n[ni],delete n[Zc],delete n[QN]}function Do(n){var s=n[Ht];if(s)return s;for(var i=n.parentNode;i;){if(s=i[Ks]||i[Ht]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(n=G0(n);n!==null;){if(i=n[Ht])return i;n=G0(n)}return s}n=i,i=n.parentNode}return null}function Po(n){if(n=n[Ht]||n[Ks]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function ai(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(o(33))}function Lo(n){var s=n[S_];return s||(s=n[S_]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Cn(n){n[si]=!0}var C_=new Set,N_={};function qr(n,s){Io(n,s),Io(n+"Capture",s)}function Io(n,s){for(N_[n]=s,n=0;n<s.length;n++)C_.add(s[n])}var WN=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]*$"),E_={},R_={};function ZN(n){return ve.call(R_,n)?!0:ve.call(E_,n)?!1:WN.test(n)?R_[n]=!0:(E_[n]=!0,!1)}function Jc(n,s,i){if(ZN(s))if(i===null)n.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+i)}}function eu(n,s,i){if(i===null)n.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+i)}}function _a(n,s,i,d){if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(s,i,""+d)}}function ks(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function T_(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function JN(n,s,i){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var _=d.get,j=d.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return _.call(this)},set:function(O){i=""+O,j.call(this,O)}}),Object.defineProperty(n,s,{enumerable:d.enumerable}),{getValue:function(){return i},setValue:function(O){i=""+O},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function mp(n){if(!n._valueTracker){var s=T_(n)?"checked":"value";n._valueTracker=JN(n,s,""+n[s])}}function A_(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var i=s.getValue(),d="";return n&&(d=T_(n)?n.checked?"true":"false":n.value),n=d,n!==i?(s.setValue(n),!0):!1}function tu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var eE=/[\n"\\]/g;function Ss(n){return n.replace(eE,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function gp(n,s,i,d,_,j,O,U){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),s!=null?O==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+ks(s)):n.value!==""+ks(s)&&(n.value=""+ks(s)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),s!=null?hp(n,O,ks(s)):i!=null?hp(n,O,ks(i)):d!=null&&n.removeAttribute("value"),_==null&&j!=null&&(n.defaultChecked=!!j),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?n.name=""+ks(U):n.removeAttribute("name")}function M_(n,s,i,d,_,j,O,U){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(n.type=j),s!=null||i!=null){if(!(j!=="submit"&&j!=="reset"||s!=null)){mp(n);return}i=i!=null?""+ks(i):"",s=s!=null?""+ks(s):i,U||s===n.value||(n.value=s),n.defaultValue=s}d=d??_,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=U?n.checked:!!d,n.defaultChecked=!!d,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),mp(n)}function hp(n,s,i){s==="number"&&tu(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Bo(n,s,i,d){if(n=n.options,s){s={};for(var _=0;_<i.length;_++)s["$"+i[_]]=!0;for(i=0;i<n.length;i++)_=s.hasOwnProperty("$"+n[i].value),n[i].selected!==_&&(n[i].selected=_),_&&d&&(n[i].defaultSelected=!0)}else{for(i=""+ks(i),s=null,_=0;_<n.length;_++){if(n[_].value===i){n[_].selected=!0,d&&(n[_].defaultSelected=!0);return}s!==null||n[_].disabled||(s=n[_])}s!==null&&(s.selected=!0)}}function O_(n,s,i){if(s!=null&&(s=""+ks(s),s!==n.value&&(n.value=s),i==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=i!=null?""+ks(i):""}function z_(n,s,i,d){if(s==null){if(d!=null){if(i!=null)throw Error(o(92));if($(d)){if(1<d.length)throw Error(o(93));d=d[0]}i=d}i==null&&(i=""),s=i}i=ks(s),n.defaultValue=i,d=n.textContent,d===i&&d!==""&&d!==null&&(n.value=d),mp(n)}function Uo(n,s){if(s){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=s;return}}n.textContent=s}var tE=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 D_(n,s,i){var d=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?d?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":d?n.setProperty(s,i):typeof i!="number"||i===0||tE.has(s)?s==="float"?n.cssFloat=i:n[s]=(""+i).trim():n[s]=i+"px"}function P_(n,s,i){if(s!=null&&typeof s!="object")throw Error(o(62));if(n=n.style,i!=null){for(var d in i)!i.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="");for(var _ in s)d=s[_],s.hasOwnProperty(_)&&i[_]!==d&&D_(n,_,d)}else for(var j in s)s.hasOwnProperty(j)&&D_(n,j,s[j])}function xp(n){if(n.indexOf("-")===-1)return!1;switch(n){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 nE=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"]]),sE=/^[\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 nu(n){return sE.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function va(){}var bp=null;function _p(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ho=null,Vo=null;function L_(n){var s=Po(n);if(s&&(n=s.stateNode)){var i=n[zn]||null;e:switch(n=s.stateNode,s.type){case"input":if(gp(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Ss(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var d=i[s];if(d!==n&&d.form===n.form){var _=d[zn]||null;if(!_)throw Error(o(90));gp(d,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(s=0;s<i.length;s++)d=i[s],d.form===n.form&&A_(d)}break e;case"textarea":O_(n,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&Bo(n,!!i.multiple,s,!1)}}}var vp=!1;function I_(n,s,i){if(vp)return n(s,i);vp=!0;try{var d=n(s);return d}finally{if(vp=!1,(Ho!==null||Vo!==null)&&(qu(),Ho&&(s=Ho,n=Vo,Vo=Ho=null,L_(s),n)))for(s=0;s<n.length;s++)L_(n[s])}}function ri(n,s){var i=n.stateNode;if(i===null)return null;var d=i[zn]||null;if(d===null)return null;i=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,s,typeof i));return i}var ya=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yp=!1;if(ya)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){yp=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{yp=!1}var er=null,jp=null,su=null;function B_(){if(su)return su;var n,s=jp,i=s.length,d,_="value"in er?er.value:er.textContent,j=_.length;for(n=0;n<i&&s[n]===_[n];n++);var O=i-n;for(d=1;d<=O&&s[i-d]===_[j-d];d++);return su=_.slice(n,1<d?1-d:void 0)}function au(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function ru(){return!0}function U_(){return!1}function ts(n){function s(i,d,_,j,O){this._reactName=i,this._targetInst=_,this.type=d,this.nativeEvent=j,this.target=O,this.currentTarget=null;for(var U in n)n.hasOwnProperty(U)&&(i=n[U],this[U]=i?i(j):j[U]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?ru:U_,this.isPropagationStopped=U_,this}return b(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ru)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ru)},persist:function(){},isPersistent:ru}),s}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ou=ts($r),li=b({},$r,{view:0,detail:0}),aE=ts(li),wp,kp,ii,lu=b({},li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cp,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==ii&&(ii&&n.type==="mousemove"?(wp=n.screenX-ii.screenX,kp=n.screenY-ii.screenY):kp=wp=0,ii=n),wp)},movementY:function(n){return"movementY"in n?n.movementY:kp}}),H_=ts(lu),rE=b({},lu,{dataTransfer:0}),oE=ts(rE),lE=b({},li,{relatedTarget:0}),Sp=ts(lE),iE=b({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),cE=ts(iE),uE=b({},$r,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),dE=ts(uE),fE=b({},$r,{data:0}),V_=ts(fE),pE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mE={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"},gE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hE(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=gE[n])?!!s[n]:!1}function Cp(){return hE}var xE=b({},li,{key:function(n){if(n.key){var s=pE[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=au(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?mE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cp,charCode:function(n){return n.type==="keypress"?au(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?au(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),bE=ts(xE),_E=b({},lu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),q_=ts(_E),vE=b({},li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cp}),yE=ts(vE),jE=b({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),wE=ts(jE),kE=b({},lu,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),SE=ts(kE),CE=b({},$r,{newState:0,oldState:0}),NE=ts(CE),EE=[9,13,27,32],Np=ya&&"CompositionEvent"in window,ci=null;ya&&"documentMode"in document&&(ci=document.documentMode);var RE=ya&&"TextEvent"in window&&!ci,$_=ya&&(!Np||ci&&8<ci&&11>=ci),F_=" ",G_=!1;function Y_(n,s){switch(n){case"keyup":return EE.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function K_(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var qo=!1;function TE(n,s){switch(n){case"compositionend":return K_(s);case"keypress":return s.which!==32?null:(G_=!0,F_);case"textInput":return n=s.data,n===F_&&G_?null:n;default:return null}}function AE(n,s){if(qo)return n==="compositionend"||!Np&&Y_(n,s)?(n=B_(),su=jp=er=null,qo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return $_&&s.locale!=="ko"?null:s.data;default:return null}}var ME={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 X_(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!ME[n.type]:s==="textarea"}function Q_(n,s,i,d){Ho?Vo?Vo.push(d):Vo=[d]:Ho=d,s=Qu(s,"onChange"),0<s.length&&(i=new ou("onChange","change",null,i,d),n.push({event:i,listeners:s}))}var ui=null,di=null;function OE(n){M0(n,0)}function iu(n){var s=ai(n);if(A_(s))return n}function W_(n,s){if(n==="change")return s}var Z_=!1;if(ya){var Ep;if(ya){var Rp="oninput"in document;if(!Rp){var J_=document.createElement("div");J_.setAttribute("oninput","return;"),Rp=typeof J_.oninput=="function"}Ep=Rp}else Ep=!1;Z_=Ep&&(!document.documentMode||9<document.documentMode)}function ev(){ui&&(ui.detachEvent("onpropertychange",tv),di=ui=null)}function tv(n){if(n.propertyName==="value"&&iu(di)){var s=[];Q_(s,di,n,_p(n)),I_(OE,s)}}function zE(n,s,i){n==="focusin"?(ev(),ui=s,di=i,ui.attachEvent("onpropertychange",tv)):n==="focusout"&&ev()}function DE(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return iu(di)}function PE(n,s){if(n==="click")return iu(s)}function LE(n,s){if(n==="input"||n==="change")return iu(s)}function IE(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var fs=typeof Object.is=="function"?Object.is:IE;function fi(n,s){if(fs(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var i=Object.keys(n),d=Object.keys(s);if(i.length!==d.length)return!1;for(d=0;d<i.length;d++){var _=i[d];if(!ve.call(s,_)||!fs(n[_],s[_]))return!1}return!0}function nv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function sv(n,s){var i=nv(n);n=0;for(var d;i;){if(i.nodeType===3){if(d=n+i.textContent.length,n<=s&&d>=s)return{node:i,offset:s-n};n=d}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=nv(i)}}function av(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?av(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function rv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=tu(n.document);s instanceof n.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)n=s.contentWindow;else break;s=tu(n.document)}return s}function Tp(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var BE=ya&&"documentMode"in document&&11>=document.documentMode,$o=null,Ap=null,pi=null,Mp=!1;function ov(n,s,i){var d=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Mp||$o==null||$o!==tu(d)||(d=$o,"selectionStart"in d&&Tp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),pi&&fi(pi,d)||(pi=d,d=Qu(Ap,"onSelect"),0<d.length&&(s=new ou("onSelect","select",null,s,i),n.push({event:s,listeners:d}),s.target=$o)))}function Fr(n,s){var i={};return i[n.toLowerCase()]=s.toLowerCase(),i["Webkit"+n]="webkit"+s,i["Moz"+n]="moz"+s,i}var Fo={animationend:Fr("Animation","AnimationEnd"),animationiteration:Fr("Animation","AnimationIteration"),animationstart:Fr("Animation","AnimationStart"),transitionrun:Fr("Transition","TransitionRun"),transitionstart:Fr("Transition","TransitionStart"),transitioncancel:Fr("Transition","TransitionCancel"),transitionend:Fr("Transition","TransitionEnd")},Op={},lv={};ya&&(lv=document.createElement("div").style,"AnimationEvent"in window||(delete Fo.animationend.animation,delete Fo.animationiteration.animation,delete Fo.animationstart.animation),"TransitionEvent"in window||delete Fo.transitionend.transition);function Gr(n){if(Op[n])return Op[n];if(!Fo[n])return n;var s=Fo[n],i;for(i in s)if(s.hasOwnProperty(i)&&i in lv)return Op[n]=s[i];return n}var iv=Gr("animationend"),cv=Gr("animationiteration"),uv=Gr("animationstart"),UE=Gr("transitionrun"),HE=Gr("transitionstart"),VE=Gr("transitioncancel"),dv=Gr("transitionend"),fv=new Map,zp="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(" ");zp.push("scrollEnd");function Is(n,s){fv.set(n,s),qr(s,[n])}var cu=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Cs=[],Go=0,Dp=0;function uu(){for(var n=Go,s=Dp=Go=0;s<n;){var i=Cs[s];Cs[s++]=null;var d=Cs[s];Cs[s++]=null;var _=Cs[s];Cs[s++]=null;var j=Cs[s];if(Cs[s++]=null,d!==null&&_!==null){var O=d.pending;O===null?_.next=_:(_.next=O.next,O.next=_),d.pending=_}j!==0&&pv(i,_,j)}}function du(n,s,i,d){Cs[Go++]=n,Cs[Go++]=s,Cs[Go++]=i,Cs[Go++]=d,Dp|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function Pp(n,s,i,d){return du(n,s,i,d),fu(n)}function Yr(n,s){return du(n,null,null,s),fu(n)}function pv(n,s,i){n.lanes|=i;var d=n.alternate;d!==null&&(d.lanes|=i);for(var _=!1,j=n.return;j!==null;)j.childLanes|=i,d=j.alternate,d!==null&&(d.childLanes|=i),j.tag===22&&(n=j.stateNode,n===null||n._visibility&1||(_=!0)),n=j,j=j.return;return n.tag===3?(j=n.stateNode,_&&s!==null&&(_=31-ot(i),n=j.hiddenUpdates,d=n[_],d===null?n[_]=[s]:d.push(s),s.lane=i|536870912),j):null}function fu(n){if(50<Di)throw Di=0,Fm=null,Error(o(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var Yo={};function qE(n,s,i,d){this.tag=n,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=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ps(n,s,i,d){return new qE(n,s,i,d)}function Lp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ja(n,s){var i=n.alternate;return i===null?(i=ps(n.tag,s,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=s,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,s=n.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function mv(n,s){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,s=i.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function pu(n,s,i,d,_,j){var O=0;if(d=n,typeof n=="function")Lp(n)&&(O=1);else if(typeof n=="string")O=KR(n,i,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=ps(31,i,s,_),n.elementType=I,n.lanes=j,n;case w:return Kr(i.children,_,j,s);case y:O=8,_|=24;break;case S:return n=ps(12,i,s,_|2),n.elementType=S,n.lanes=j,n;case A:return n=ps(13,i,s,_),n.elementType=A,n.lanes=j,n;case T:return n=ps(19,i,s,_),n.elementType=T,n.lanes=j,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:O=10;break e;case C:O=9;break e;case R:O=11;break e;case M:O=14;break e;case z:O=16,d=null;break e}O=29,i=Error(o(130,n===null?"null":typeof n,"")),d=null}return s=ps(O,i,s,_),s.elementType=n,s.type=d,s.lanes=j,s}function Kr(n,s,i,d){return n=ps(7,n,d,s),n.lanes=i,n}function Ip(n,s,i){return n=ps(6,n,null,s),n.lanes=i,n}function gv(n){var s=ps(18,null,null,0);return s.stateNode=n,s}function Bp(n,s,i){return s=ps(4,n.children!==null?n.children:[],n.key,s),s.lanes=i,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var hv=new WeakMap;function Ns(n,s){if(typeof n=="object"&&n!==null){var i=hv.get(n);return i!==void 0?i:(s={value:n,source:s,stack:Ee(s)},hv.set(n,s),s)}return{value:n,source:s,stack:Ee(s)}}var Ko=[],Xo=0,mu=null,mi=0,Es=[],Rs=0,tr=null,Xs=1,Qs="";function wa(n,s){Ko[Xo++]=mi,Ko[Xo++]=mu,mu=n,mi=s}function xv(n,s,i){Es[Rs++]=Xs,Es[Rs++]=Qs,Es[Rs++]=tr,tr=n;var d=Xs;n=Qs;var _=32-ot(d)-1;d&=~(1<<_),i+=1;var j=32-ot(s)+_;if(30<j){var O=_-_%5;j=(d&(1<<O)-1).toString(32),d>>=O,_-=O,Xs=1<<32-ot(s)+_|i<<_|d,Qs=j+n}else Xs=1<<j|i<<_|d,Qs=n}function Up(n){n.return!==null&&(wa(n,1),xv(n,1,0))}function Hp(n){for(;n===mu;)mu=Ko[--Xo],Ko[Xo]=null,mi=Ko[--Xo],Ko[Xo]=null;for(;n===tr;)tr=Es[--Rs],Es[Rs]=null,Qs=Es[--Rs],Es[Rs]=null,Xs=Es[--Rs],Es[Rs]=null}function bv(n,s){Es[Rs++]=Xs,Es[Rs++]=Qs,Es[Rs++]=tr,Xs=s.id,Qs=s.overflow,tr=n}var Dn=null,Yt=null,Ct=!1,nr=null,Ts=!1,Vp=Error(o(519));function sr(n){var s=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gi(Ns(s,n)),Vp}function _v(n){var s=n.stateNode,i=n.type,d=n.memoizedProps;switch(s[Ht]=n,s[zn]=d,i){case"dialog":vt("cancel",s),vt("close",s);break;case"iframe":case"object":case"embed":vt("load",s);break;case"video":case"audio":for(i=0;i<Li.length;i++)vt(Li[i],s);break;case"source":vt("error",s);break;case"img":case"image":case"link":vt("error",s),vt("load",s);break;case"details":vt("toggle",s);break;case"input":vt("invalid",s),M_(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":vt("invalid",s);break;case"textarea":vt("invalid",s),z_(s,d.value,d.defaultValue,d.children)}i=d.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||d.suppressHydrationWarning===!0||P0(s.textContent,i)?(d.popover!=null&&(vt("beforetoggle",s),vt("toggle",s)),d.onScroll!=null&&vt("scroll",s),d.onScrollEnd!=null&&vt("scrollend",s),d.onClick!=null&&(s.onclick=va),s=!0):s=!1,s||sr(n,!0)}function vv(n){for(Dn=n.return;Dn;)switch(Dn.tag){case 5:case 31:case 13:Ts=!1;return;case 27:case 3:Ts=!0;return;default:Dn=Dn.return}}function Qo(n){if(n!==Dn)return!1;if(!Ct)return vv(n),Ct=!0,!1;var s=n.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||og(n.type,n.memoizedProps)),i=!i),i&&Yt&&sr(n),vv(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Yt=F0(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Yt=F0(n)}else s===27?(s=Yt,xr(n.type)?(n=dg,dg=null,Yt=n):Yt=s):Yt=Dn?Ms(n.stateNode.nextSibling):null;return!0}function Xr(){Yt=Dn=null,Ct=!1}function qp(){var n=nr;return n!==null&&(rs===null?rs=n:rs.push.apply(rs,n),nr=null),n}function gi(n){nr===null?nr=[n]:nr.push(n)}var $p=L(null),Qr=null,ka=null;function ar(n,s,i){Z($p,s._currentValue),s._currentValue=i}function Sa(n){n._currentValue=$p.current,G($p)}function Fp(n,s,i){for(;n!==null;){var d=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),n===i)break;n=n.return}}function Gp(n,s,i,d){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var j=_.dependencies;if(j!==null){var O=_.child;j=j.firstContext;e:for(;j!==null;){var U=j;j=_;for(var Q=0;Q<s.length;Q++)if(U.context===s[Q]){j.lanes|=i,U=j.alternate,U!==null&&(U.lanes|=i),Fp(j.return,i,n),d||(O=null);break e}j=U.next}}else if(_.tag===18){if(O=_.return,O===null)throw Error(o(341));O.lanes|=i,j=O.alternate,j!==null&&(j.lanes|=i),Fp(O,i,n),O=null}else O=_.child;if(O!==null)O.return=_;else for(O=_;O!==null;){if(O===n){O=null;break}if(_=O.sibling,_!==null){_.return=O.return,O=_;break}O=O.return}_=O}}function Wo(n,s,i,d){n=null;for(var _=s,j=!1;_!==null;){if(!j){if((_.flags&524288)!==0)j=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var O=_.alternate;if(O===null)throw Error(o(387));if(O=O.memoizedProps,O!==null){var U=_.type;fs(_.pendingProps.value,O.value)||(n!==null?n.push(U):n=[U])}}else if(_===ae.current){if(O=_.alternate,O===null)throw Error(o(387));O.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Vi):n=[Vi])}_=_.return}n!==null&&Gp(s,n,i,d),s.flags|=262144}function gu(n){for(n=n.firstContext;n!==null;){if(!fs(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Wr(n){Qr=n,ka=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Pn(n){return yv(Qr,n)}function hu(n,s){return Qr===null&&Wr(n),yv(n,s)}function yv(n,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},ka===null){if(n===null)throw Error(o(308));ka=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else ka=ka.next=s;return i}var $E=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(i,d){n.push(d)}};this.abort=function(){s.aborted=!0,n.forEach(function(i){return i()})}},FE=e.unstable_scheduleCallback,GE=e.unstable_NormalPriority,xn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yp(){return{controller:new $E,data:new Map,refCount:0}}function hi(n){n.refCount--,n.refCount===0&&FE(GE,function(){n.controller.abort()})}var xi=null,Kp=0,Zo=0,Jo=null;function YE(n,s){if(xi===null){var i=xi=[];Kp=0,Zo=Wm(),Jo={status:"pending",value:void 0,then:function(d){i.push(d)}}}return Kp++,s.then(jv,jv),s}function jv(){if(--Kp===0&&xi!==null){Jo!==null&&(Jo.status="fulfilled");var n=xi;xi=null,Zo=0,Jo=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function KE(n,s){var i=[],d={status:"pending",value:null,reason:null,then:function(_){i.push(_)}};return n.then(function(){d.status="fulfilled",d.value=s;for(var _=0;_<i.length;_++)(0,i[_])(s)},function(_){for(d.status="rejected",d.reason=_,_=0;_<i.length;_++)(0,i[_])(void 0)}),d}var wv=q.S;q.S=function(n,s){o0=se(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&YE(n,s),wv!==null&&wv(n,s)};var Zr=L(null);function Xp(){var n=Zr.current;return n!==null?n:Vt.pooledCache}function xu(n,s){s===null?Z(Zr,Zr.current):Z(Zr,s.pool)}function kv(){var n=Xp();return n===null?null:{parent:xn._currentValue,pool:n}}var el=Error(o(460)),Qp=Error(o(474)),bu=Error(o(542)),_u={then:function(){}};function Sv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Cv(n,s,i){switch(i=n[i],i===void 0?n.push(s):i!==s&&(s.then(va,va),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,Ev(n),n;default:if(typeof s.status=="string")s.then(va,va);else{if(n=Vt,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=s,n.status="pending",n.then(function(d){if(s.status==="pending"){var _=s;_.status="fulfilled",_.value=d}},function(d){if(s.status==="pending"){var _=s;_.status="rejected",_.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,Ev(n),n}throw eo=s,el}}function Jr(n){try{var s=n._init;return s(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(eo=i,el):i}}var eo=null;function Nv(){if(eo===null)throw Error(o(459));var n=eo;return eo=null,n}function Ev(n){if(n===el||n===bu)throw Error(o(483))}var tl=null,bi=0;function vu(n){var s=bi;return bi+=1,tl===null&&(tl=[]),Cv(tl,n,s)}function _i(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function yu(n,s){throw s.$$typeof===v?Error(o(525)):(n=Object.prototype.toString.call(s),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function Rv(n){function s(J,W){if(n){var te=J.deletions;te===null?(J.deletions=[W],J.flags|=16):te.push(W)}}function i(J,W){if(!n)return null;for(;W!==null;)s(J,W),W=W.sibling;return null}function d(J){for(var W=new Map;J!==null;)J.key!==null?W.set(J.key,J):W.set(J.index,J),J=J.sibling;return W}function _(J,W){return J=ja(J,W),J.index=0,J.sibling=null,J}function j(J,W,te){return J.index=te,n?(te=J.alternate,te!==null?(te=te.index,te<W?(J.flags|=67108866,W):te):(J.flags|=67108866,W)):(J.flags|=1048576,W)}function O(J){return n&&J.alternate===null&&(J.flags|=67108866),J}function U(J,W,te,xe){return W===null||W.tag!==6?(W=Ip(te,J.mode,xe),W.return=J,W):(W=_(W,te),W.return=J,W)}function Q(J,W,te,xe){var Ze=te.type;return Ze===w?he(J,W,te.props.children,xe,te.key):W!==null&&(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===z&&Jr(Ze)===W.type)?(W=_(W,te.props),_i(W,te),W.return=J,W):(W=pu(te.type,te.key,te.props,null,J.mode,xe),_i(W,te),W.return=J,W)}function ne(J,W,te,xe){return W===null||W.tag!==4||W.stateNode.containerInfo!==te.containerInfo||W.stateNode.implementation!==te.implementation?(W=Bp(te,J.mode,xe),W.return=J,W):(W=_(W,te.children||[]),W.return=J,W)}function he(J,W,te,xe,Ze){return W===null||W.tag!==7?(W=Kr(te,J.mode,xe,Ze),W.return=J,W):(W=_(W,te),W.return=J,W)}function ye(J,W,te){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=Ip(""+W,J.mode,te),W.return=J,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return te=pu(W.type,W.key,W.props,null,J.mode,te),_i(te,W),te.return=J,te;case N:return W=Bp(W,J.mode,te),W.return=J,W;case z:return W=Jr(W),ye(J,W,te)}if($(W)||D(W))return W=Kr(W,J.mode,te,null),W.return=J,W;if(typeof W.then=="function")return ye(J,vu(W),te);if(W.$$typeof===E)return ye(J,hu(J,W),te);yu(J,W)}return null}function re(J,W,te,xe){var Ze=W!==null?W.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ze!==null?null:U(J,W,""+te,xe);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case k:return te.key===Ze?Q(J,W,te,xe):null;case N:return te.key===Ze?ne(J,W,te,xe):null;case z:return te=Jr(te),re(J,W,te,xe)}if($(te)||D(te))return Ze!==null?null:he(J,W,te,xe,null);if(typeof te.then=="function")return re(J,W,vu(te),xe);if(te.$$typeof===E)return re(J,W,hu(J,te),xe);yu(J,te)}return null}function ue(J,W,te,xe,Ze){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return J=J.get(te)||null,U(W,J,""+xe,Ze);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case k:return J=J.get(xe.key===null?te:xe.key)||null,Q(W,J,xe,Ze);case N:return J=J.get(xe.key===null?te:xe.key)||null,ne(W,J,xe,Ze);case z:return xe=Jr(xe),ue(J,W,te,xe,Ze)}if($(xe)||D(xe))return J=J.get(te)||null,he(W,J,xe,Ze,null);if(typeof xe.then=="function")return ue(J,W,te,vu(xe),Ze);if(xe.$$typeof===E)return ue(J,W,te,hu(W,xe),Ze);yu(W,xe)}return null}function qe(J,W,te,xe){for(var Ze=null,Rt=null,Ge=W,dt=W=0,wt=null;Ge!==null&&dt<te.length;dt++){Ge.index>dt?(wt=Ge,Ge=null):wt=Ge.sibling;var Tt=re(J,Ge,te[dt],xe);if(Tt===null){Ge===null&&(Ge=wt);break}n&&Ge&&Tt.alternate===null&&s(J,Ge),W=j(Tt,W,dt),Rt===null?Ze=Tt:Rt.sibling=Tt,Rt=Tt,Ge=wt}if(dt===te.length)return i(J,Ge),Ct&&wa(J,dt),Ze;if(Ge===null){for(;dt<te.length;dt++)Ge=ye(J,te[dt],xe),Ge!==null&&(W=j(Ge,W,dt),Rt===null?Ze=Ge:Rt.sibling=Ge,Rt=Ge);return Ct&&wa(J,dt),Ze}for(Ge=d(Ge);dt<te.length;dt++)wt=ue(Ge,J,dt,te[dt],xe),wt!==null&&(n&&wt.alternate!==null&&Ge.delete(wt.key===null?dt:wt.key),W=j(wt,W,dt),Rt===null?Ze=wt:Rt.sibling=wt,Rt=wt);return n&&Ge.forEach(function(jr){return s(J,jr)}),Ct&&wa(J,dt),Ze}function st(J,W,te,xe){if(te==null)throw Error(o(151));for(var Ze=null,Rt=null,Ge=W,dt=W=0,wt=null,Tt=te.next();Ge!==null&&!Tt.done;dt++,Tt=te.next()){Ge.index>dt?(wt=Ge,Ge=null):wt=Ge.sibling;var jr=re(J,Ge,Tt.value,xe);if(jr===null){Ge===null&&(Ge=wt);break}n&&Ge&&jr.alternate===null&&s(J,Ge),W=j(jr,W,dt),Rt===null?Ze=jr:Rt.sibling=jr,Rt=jr,Ge=wt}if(Tt.done)return i(J,Ge),Ct&&wa(J,dt),Ze;if(Ge===null){for(;!Tt.done;dt++,Tt=te.next())Tt=ye(J,Tt.value,xe),Tt!==null&&(W=j(Tt,W,dt),Rt===null?Ze=Tt:Rt.sibling=Tt,Rt=Tt);return Ct&&wa(J,dt),Ze}for(Ge=d(Ge);!Tt.done;dt++,Tt=te.next())Tt=ue(Ge,J,dt,Tt.value,xe),Tt!==null&&(n&&Tt.alternate!==null&&Ge.delete(Tt.key===null?dt:Tt.key),W=j(Tt,W,dt),Rt===null?Ze=Tt:Rt.sibling=Tt,Rt=Tt);return n&&Ge.forEach(function(rT){return s(J,rT)}),Ct&&wa(J,dt),Ze}function Lt(J,W,te,xe){if(typeof te=="object"&&te!==null&&te.type===w&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case k:e:{for(var Ze=te.key;W!==null;){if(W.key===Ze){if(Ze=te.type,Ze===w){if(W.tag===7){i(J,W.sibling),xe=_(W,te.props.children),xe.return=J,J=xe;break e}}else if(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===z&&Jr(Ze)===W.type){i(J,W.sibling),xe=_(W,te.props),_i(xe,te),xe.return=J,J=xe;break e}i(J,W);break}else s(J,W);W=W.sibling}te.type===w?(xe=Kr(te.props.children,J.mode,xe,te.key),xe.return=J,J=xe):(xe=pu(te.type,te.key,te.props,null,J.mode,xe),_i(xe,te),xe.return=J,J=xe)}return O(J);case N:e:{for(Ze=te.key;W!==null;){if(W.key===Ze)if(W.tag===4&&W.stateNode.containerInfo===te.containerInfo&&W.stateNode.implementation===te.implementation){i(J,W.sibling),xe=_(W,te.children||[]),xe.return=J,J=xe;break e}else{i(J,W);break}else s(J,W);W=W.sibling}xe=Bp(te,J.mode,xe),xe.return=J,J=xe}return O(J);case z:return te=Jr(te),Lt(J,W,te,xe)}if($(te))return qe(J,W,te,xe);if(D(te)){if(Ze=D(te),typeof Ze!="function")throw Error(o(150));return te=Ze.call(te),st(J,W,te,xe)}if(typeof te.then=="function")return Lt(J,W,vu(te),xe);if(te.$$typeof===E)return Lt(J,W,hu(J,te),xe);yu(J,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,W!==null&&W.tag===6?(i(J,W.sibling),xe=_(W,te),xe.return=J,J=xe):(i(J,W),xe=Ip(te,J.mode,xe),xe.return=J,J=xe),O(J)):i(J,W)}return function(J,W,te,xe){try{bi=0;var Ze=Lt(J,W,te,xe);return tl=null,Ze}catch(Ge){if(Ge===el||Ge===bu)throw Ge;var Rt=ps(29,Ge,null,J.mode);return Rt.lanes=xe,Rt.return=J,Rt}finally{}}}var to=Rv(!0),Tv=Rv(!1),rr=!1;function Wp(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zp(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function or(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function lr(n,s,i){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(At&2)!==0){var _=d.pending;return _===null?s.next=s:(s.next=_.next,_.next=s),d.pending=s,s=fu(n),pv(n,null,i),s}return du(n,d,s,i),fu(n)}function vi(n,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var d=s.lanes;d&=n.pendingLanes,i|=d,s.lanes=i,Ls(n,i)}}function Jp(n,s){var i=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,i===d)){var _=null,j=null;if(i=i.firstBaseUpdate,i!==null){do{var O={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};j===null?_=j=O:j=j.next=O,i=i.next}while(i!==null);j===null?_=j=s:j=j.next=s}else _=j=s;i={baseState:d.baseState,firstBaseUpdate:_,lastBaseUpdate:j,shared:d.shared,callbacks:d.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=s:n.next=s,i.lastBaseUpdate=s}var em=!1;function yi(){if(em){var n=Jo;if(n!==null)throw n}}function ji(n,s,i,d){em=!1;var _=n.updateQueue;rr=!1;var j=_.firstBaseUpdate,O=_.lastBaseUpdate,U=_.shared.pending;if(U!==null){_.shared.pending=null;var Q=U,ne=Q.next;Q.next=null,O===null?j=ne:O.next=ne,O=Q;var he=n.alternate;he!==null&&(he=he.updateQueue,U=he.lastBaseUpdate,U!==O&&(U===null?he.firstBaseUpdate=ne:U.next=ne,he.lastBaseUpdate=Q))}if(j!==null){var ye=_.baseState;O=0,he=ne=Q=null,U=j;do{var re=U.lane&-536870913,ue=re!==U.lane;if(ue?(jt&re)===re:(d&re)===re){re!==0&&re===Zo&&(em=!0),he!==null&&(he=he.next={lane:0,tag:U.tag,payload:U.payload,callback:null,next:null});e:{var qe=n,st=U;re=s;var Lt=i;switch(st.tag){case 1:if(qe=st.payload,typeof qe=="function"){ye=qe.call(Lt,ye,re);break e}ye=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=st.payload,re=typeof qe=="function"?qe.call(Lt,ye,re):qe,re==null)break e;ye=b({},ye,re);break e;case 2:rr=!0}}re=U.callback,re!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[re]:ue.push(re))}else ue={lane:re,tag:U.tag,payload:U.payload,callback:U.callback,next:null},he===null?(ne=he=ue,Q=ye):he=he.next=ue,O|=re;if(U=U.next,U===null){if(U=_.shared.pending,U===null)break;ue=U,U=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);he===null&&(Q=ye),_.baseState=Q,_.firstBaseUpdate=ne,_.lastBaseUpdate=he,j===null&&(_.shared.lanes=0),fr|=O,n.lanes=O,n.memoizedState=ye}}function Av(n,s){if(typeof n!="function")throw Error(o(191,n));n.call(s)}function Mv(n,s){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Av(i[n],s)}var nl=L(null),ju=L(0);function Ov(n,s){n=za,Z(ju,n),Z(nl,s),za=n|s.baseLanes}function tm(){Z(ju,za),Z(nl,nl.current)}function nm(){za=ju.current,G(nl),G(ju)}var ms=L(null),As=null;function ir(n){var s=n.alternate;Z(gn,gn.current&1),Z(ms,n),As===null&&(s===null||nl.current!==null||s.memoizedState!==null)&&(As=n)}function sm(n){Z(gn,gn.current),Z(ms,n),As===null&&(As=n)}function zv(n){n.tag===22?(Z(gn,gn.current),Z(ms,n),As===null&&(As=n)):cr()}function cr(){Z(gn,gn.current),Z(ms,ms.current)}function gs(n){G(ms),As===n&&(As=null),G(gn)}var gn=L(0);function wu(n){for(var s=n;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||cg(i)||ug(i)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ca=0,ut=null,Dt=null,bn=null,ku=!1,sl=!1,no=!1,Su=0,wi=0,al=null,XE=0;function on(){throw Error(o(321))}function am(n,s){if(s===null)return!1;for(var i=0;i<s.length&&i<n.length;i++)if(!fs(n[i],s[i]))return!1;return!0}function rm(n,s,i,d,_,j){return Ca=j,ut=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,q.H=n===null||n.memoizedState===null?xy:vm,no=!1,j=i(d,_),no=!1,sl&&(j=Pv(s,i,d,_)),Dv(n),j}function Dv(n){q.H=Ci;var s=Dt!==null&&Dt.next!==null;if(Ca=0,bn=Dt=ut=null,ku=!1,wi=0,al=null,s)throw Error(o(300));n===null||_n||(n=n.dependencies,n!==null&&gu(n)&&(_n=!0))}function Pv(n,s,i,d){ut=n;var _=0;do{if(sl&&(al=null),wi=0,sl=!1,25<=_)throw Error(o(301));if(_+=1,bn=Dt=null,n.updateQueue!=null){var j=n.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}q.H=by,j=s(i,d)}while(sl);return j}function QE(){var n=q.H,s=n.useState()[0];return s=typeof s.then=="function"?ki(s):s,n=n.useState()[0],(Dt!==null?Dt.memoizedState:null)!==n&&(ut.flags|=1024),s}function om(){var n=Su!==0;return Su=0,n}function lm(n,s,i){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~i}function im(n){if(ku){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}ku=!1}Ca=0,bn=Dt=ut=null,sl=!1,wi=Su=0,al=null}function Gn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?ut.memoizedState=bn=n:bn=bn.next=n,bn}function hn(){if(Dt===null){var n=ut.alternate;n=n!==null?n.memoizedState:null}else n=Dt.next;var s=bn===null?ut.memoizedState:bn.next;if(s!==null)bn=s,Dt=n;else{if(n===null)throw ut.alternate===null?Error(o(467)):Error(o(310));Dt=n,n={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},bn===null?ut.memoizedState=bn=n:bn=bn.next=n}return bn}function Cu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ki(n){var s=wi;return wi+=1,al===null&&(al=[]),n=Cv(al,n,s),s=ut,(bn===null?s.memoizedState:bn.next)===null&&(s=s.alternate,q.H=s===null||s.memoizedState===null?xy:vm),n}function Nu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ki(n);if(n.$$typeof===E)return Pn(n)}throw Error(o(438,String(n)))}function cm(n){var s=null,i=ut.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var d=ut.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(_){return _.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=Cu(),ut.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(n),d=0;d<n;d++)i[d]=P;return s.index++,i}function Na(n,s){return typeof s=="function"?s(n):s}function Eu(n){var s=hn();return um(s,Dt,n)}function um(n,s,i){var d=n.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=i;var _=n.baseQueue,j=d.pending;if(j!==null){if(_!==null){var O=_.next;_.next=j.next,j.next=O}s.baseQueue=_=j,d.pending=null}if(j=n.baseState,_===null)n.memoizedState=j;else{s=_.next;var U=O=null,Q=null,ne=s,he=!1;do{var ye=ne.lane&-536870913;if(ye!==ne.lane?(jt&ye)===ye:(Ca&ye)===ye){var re=ne.revertLane;if(re===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ye===Zo&&(he=!0);else if((Ca&re)===re){ne=ne.next,re===Zo&&(he=!0);continue}else ye={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},Q===null?(U=Q=ye,O=j):Q=Q.next=ye,ut.lanes|=re,fr|=re;ye=ne.action,no&&i(j,ye),j=ne.hasEagerState?ne.eagerState:i(j,ye)}else re={lane:ye,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},Q===null?(U=Q=re,O=j):Q=Q.next=re,ut.lanes|=ye,fr|=ye;ne=ne.next}while(ne!==null&&ne!==s);if(Q===null?O=j:Q.next=U,!fs(j,n.memoizedState)&&(_n=!0,he&&(i=Jo,i!==null)))throw i;n.memoizedState=j,n.baseState=O,n.baseQueue=Q,d.lastRenderedState=j}return _===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function dm(n){var s=hn(),i=s.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var d=i.dispatch,_=i.pending,j=s.memoizedState;if(_!==null){i.pending=null;var O=_=_.next;do j=n(j,O.action),O=O.next;while(O!==_);fs(j,s.memoizedState)||(_n=!0),s.memoizedState=j,s.baseQueue===null&&(s.baseState=j),i.lastRenderedState=j}return[j,d]}function Lv(n,s,i){var d=ut,_=hn(),j=Ct;if(j){if(i===void 0)throw Error(o(407));i=i()}else i=s();var O=!fs((Dt||_).memoizedState,i);if(O&&(_.memoizedState=i,_n=!0),_=_.queue,mm(Uv.bind(null,d,_,n),[n]),_.getSnapshot!==s||O||bn!==null&&bn.memoizedState.tag&1){if(d.flags|=2048,rl(9,{destroy:void 0},Bv.bind(null,d,_,i,s),null),Vt===null)throw Error(o(349));j||(Ca&127)!==0||Iv(d,s,i)}return i}function Iv(n,s,i){n.flags|=16384,n={getSnapshot:s,value:i},s=ut.updateQueue,s===null?(s=Cu(),ut.updateQueue=s,s.stores=[n]):(i=s.stores,i===null?s.stores=[n]:i.push(n))}function Bv(n,s,i,d){s.value=i,s.getSnapshot=d,Hv(s)&&Vv(n)}function Uv(n,s,i){return i(function(){Hv(s)&&Vv(n)})}function Hv(n){var s=n.getSnapshot;n=n.value;try{var i=s();return!fs(n,i)}catch{return!0}}function Vv(n){var s=Yr(n,2);s!==null&&os(s,n,2)}function fm(n){var s=Gn();if(typeof n=="function"){var i=n;if(n=i(),no){Xe(!0);try{i()}finally{Xe(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:n},s}function qv(n,s,i,d){return n.baseState=i,um(n,Dt,typeof d=="function"?d:Na)}function WE(n,s,i,d,_){if(Au(n))throw Error(o(485));if(n=s.action,n!==null){var j={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){j.listeners.push(O)}};q.T!==null?i(!0):j.isTransition=!1,d(j),i=s.pending,i===null?(j.next=s.pending=j,$v(s,j)):(j.next=i.next,s.pending=i.next=j)}}function $v(n,s){var i=s.action,d=s.payload,_=n.state;if(s.isTransition){var j=q.T,O={};q.T=O;try{var U=i(_,d),Q=q.S;Q!==null&&Q(O,U),Fv(n,s,U)}catch(ne){pm(n,s,ne)}finally{j!==null&&O.types!==null&&(j.types=O.types),q.T=j}}else try{j=i(_,d),Fv(n,s,j)}catch(ne){pm(n,s,ne)}}function Fv(n,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(d){Gv(n,s,d)},function(d){return pm(n,s,d)}):Gv(n,s,i)}function Gv(n,s,i){s.status="fulfilled",s.value=i,Yv(s),n.state=i,s=n.pending,s!==null&&(i=s.next,i===s?n.pending=null:(i=i.next,s.next=i,$v(n,i)))}function pm(n,s,i){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=i,Yv(s),s=s.next;while(s!==d)}n.action=null}function Yv(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function Kv(n,s){return s}function Xv(n,s){if(Ct){var i=Vt.formState;if(i!==null){e:{var d=ut;if(Ct){if(Yt){t:{for(var _=Yt,j=Ts;_.nodeType!==8;){if(!j){_=null;break t}if(_=Ms(_.nextSibling),_===null){_=null;break t}}j=_.data,_=j==="F!"||j==="F"?_:null}if(_){Yt=Ms(_.nextSibling),d=_.data==="F!";break e}}sr(d)}d=!1}d&&(s=i[0])}}return i=Gn(),i.memoizedState=i.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kv,lastRenderedState:s},i.queue=d,i=my.bind(null,ut,d),d.dispatch=i,d=fm(!1),j=_m.bind(null,ut,!1,d.queue),d=Gn(),_={state:s,dispatch:null,action:n,pending:null},d.queue=_,i=WE.bind(null,ut,_,j,i),_.dispatch=i,d.memoizedState=n,[s,i,!1]}function Qv(n){var s=hn();return Wv(s,Dt,n)}function Wv(n,s,i){if(s=um(n,s,Kv)[0],n=Eu(Na)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=ki(s)}catch(O){throw O===el?bu:O}else d=s;s=hn();var _=s.queue,j=_.dispatch;return i!==s.memoizedState&&(ut.flags|=2048,rl(9,{destroy:void 0},ZE.bind(null,_,i),null)),[d,j,n]}function ZE(n,s){n.action=s}function Zv(n){var s=hn(),i=Dt;if(i!==null)return Wv(s,i,n);hn(),s=s.memoizedState,i=hn();var d=i.queue.dispatch;return i.memoizedState=n,[s,d,!1]}function rl(n,s,i,d){return n={tag:n,create:i,deps:d,inst:s,next:null},s=ut.updateQueue,s===null&&(s=Cu(),ut.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=n.next=n:(d=i.next,i.next=n,n.next=d,s.lastEffect=n),n}function Jv(){return hn().memoizedState}function Ru(n,s,i,d){var _=Gn();ut.flags|=n,_.memoizedState=rl(1|s,{destroy:void 0},i,d===void 0?null:d)}function Tu(n,s,i,d){var _=hn();d=d===void 0?null:d;var j=_.memoizedState.inst;Dt!==null&&d!==null&&am(d,Dt.memoizedState.deps)?_.memoizedState=rl(s,j,i,d):(ut.flags|=n,_.memoizedState=rl(1|s,j,i,d))}function ey(n,s){Ru(8390656,8,n,s)}function mm(n,s){Tu(2048,8,n,s)}function JE(n){ut.flags|=4;var s=ut.updateQueue;if(s===null)s=Cu(),ut.updateQueue=s,s.events=[n];else{var i=s.events;i===null?s.events=[n]:i.push(n)}}function ty(n){var s=hn().memoizedState;return JE({ref:s,nextImpl:n}),function(){if((At&2)!==0)throw Error(o(440));return s.impl.apply(void 0,arguments)}}function ny(n,s){return Tu(4,2,n,s)}function sy(n,s){return Tu(4,4,n,s)}function ay(n,s){if(typeof s=="function"){n=n();var i=s(n);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function ry(n,s,i){i=i!=null?i.concat([n]):null,Tu(4,4,ay.bind(null,s,n),i)}function gm(){}function oy(n,s){var i=hn();s=s===void 0?null:s;var d=i.memoizedState;return s!==null&&am(s,d[1])?d[0]:(i.memoizedState=[n,s],n)}function ly(n,s){var i=hn();s=s===void 0?null:s;var d=i.memoizedState;if(s!==null&&am(s,d[1]))return d[0];if(d=n(),no){Xe(!0);try{n()}finally{Xe(!1)}}return i.memoizedState=[d,s],d}function hm(n,s,i){return i===void 0||(Ca&1073741824)!==0&&(jt&261930)===0?n.memoizedState=s:(n.memoizedState=i,n=i0(),ut.lanes|=n,fr|=n,i)}function iy(n,s,i,d){return fs(i,s)?i:nl.current!==null?(n=hm(n,i,d),fs(n,s)||(_n=!0),n):(Ca&42)===0||(Ca&1073741824)!==0&&(jt&261930)===0?(_n=!0,n.memoizedState=i):(n=i0(),ut.lanes|=n,fr|=n,s)}function cy(n,s,i,d,_){var j=Y.p;Y.p=j!==0&&8>j?j:8;var O=q.T,U={};q.T=U,_m(n,!1,s,i);try{var Q=_(),ne=q.S;if(ne!==null&&ne(U,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var he=KE(Q,d);Si(n,s,he,bs(n))}else Si(n,s,d,bs(n))}catch(ye){Si(n,s,{then:function(){},status:"rejected",reason:ye},bs())}finally{Y.p=j,O!==null&&U.types!==null&&(O.types=U.types),q.T=O}}function eR(){}function xm(n,s,i,d){if(n.tag!==5)throw Error(o(476));var _=uy(n).queue;cy(n,_,s,K,i===null?eR:function(){return dy(n),i(d)})}function uy(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:K},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:i},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function dy(n){var s=uy(n);s.next===null&&(s=n.alternate.memoizedState),Si(n,s.next.queue,{},bs())}function bm(){return Pn(Vi)}function fy(){return hn().memoizedState}function py(){return hn().memoizedState}function tR(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var i=bs();n=or(i);var d=lr(s,n,i);d!==null&&(os(d,s,i),vi(d,s,i)),s={cache:Yp()},n.payload=s;return}s=s.return}}function nR(n,s,i){var d=bs();i={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Au(n)?gy(s,i):(i=Pp(n,s,i,d),i!==null&&(os(i,n,d),hy(i,s,d)))}function my(n,s,i){var d=bs();Si(n,s,i,d)}function Si(n,s,i,d){var _={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Au(n))gy(s,_);else{var j=n.alternate;if(n.lanes===0&&(j===null||j.lanes===0)&&(j=s.lastRenderedReducer,j!==null))try{var O=s.lastRenderedState,U=j(O,i);if(_.hasEagerState=!0,_.eagerState=U,fs(U,O))return du(n,s,_,0),Vt===null&&uu(),!1}catch{}finally{}if(i=Pp(n,s,_,d),i!==null)return os(i,n,d),hy(i,s,d),!0}return!1}function _m(n,s,i,d){if(d={lane:2,revertLane:Wm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Au(n)){if(s)throw Error(o(479))}else s=Pp(n,i,d,2),s!==null&&os(s,n,2)}function Au(n){var s=n.alternate;return n===ut||s!==null&&s===ut}function gy(n,s){sl=ku=!0;var i=n.pending;i===null?s.next=s:(s.next=i.next,i.next=s),n.pending=s}function hy(n,s,i){if((i&4194048)!==0){var d=s.lanes;d&=n.pendingLanes,i|=d,s.lanes=i,Ls(n,i)}}var Ci={readContext:Pn,use:Nu,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};Ci.useEffectEvent=on;var xy={readContext:Pn,use:Nu,useCallback:function(n,s){return Gn().memoizedState=[n,s===void 0?null:s],n},useContext:Pn,useEffect:ey,useImperativeHandle:function(n,s,i){i=i!=null?i.concat([n]):null,Ru(4194308,4,ay.bind(null,s,n),i)},useLayoutEffect:function(n,s){return Ru(4194308,4,n,s)},useInsertionEffect:function(n,s){Ru(4,2,n,s)},useMemo:function(n,s){var i=Gn();s=s===void 0?null:s;var d=n();if(no){Xe(!0);try{n()}finally{Xe(!1)}}return i.memoizedState=[d,s],d},useReducer:function(n,s,i){var d=Gn();if(i!==void 0){var _=i(s);if(no){Xe(!0);try{i(s)}finally{Xe(!1)}}}else _=s;return d.memoizedState=d.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},d.queue=n,n=n.dispatch=nR.bind(null,ut,n),[d.memoizedState,n]},useRef:function(n){var s=Gn();return n={current:n},s.memoizedState=n},useState:function(n){n=fm(n);var s=n.queue,i=my.bind(null,ut,s);return s.dispatch=i,[n.memoizedState,i]},useDebugValue:gm,useDeferredValue:function(n,s){var i=Gn();return hm(i,n,s)},useTransition:function(){var n=fm(!1);return n=cy.bind(null,ut,n.queue,!0,!1),Gn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,i){var d=ut,_=Gn();if(Ct){if(i===void 0)throw Error(o(407));i=i()}else{if(i=s(),Vt===null)throw Error(o(349));(jt&127)!==0||Iv(d,s,i)}_.memoizedState=i;var j={value:i,getSnapshot:s};return _.queue=j,ey(Uv.bind(null,d,j,n),[n]),d.flags|=2048,rl(9,{destroy:void 0},Bv.bind(null,d,j,i,s),null),i},useId:function(){var n=Gn(),s=Vt.identifierPrefix;if(Ct){var i=Qs,d=Xs;i=(d&~(1<<32-ot(d)-1)).toString(32)+i,s="_"+s+"R_"+i,i=Su++,0<i&&(s+="H"+i.toString(32)),s+="_"}else i=XE++,s="_"+s+"r_"+i.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:bm,useFormState:Xv,useActionState:Xv,useOptimistic:function(n){var s=Gn();s.memoizedState=s.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=_m.bind(null,ut,!0,i),i.dispatch=s,[n,s]},useMemoCache:cm,useCacheRefresh:function(){return Gn().memoizedState=tR.bind(null,ut)},useEffectEvent:function(n){var s=Gn(),i={impl:n};return s.memoizedState=i,function(){if((At&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},vm={readContext:Pn,use:Nu,useCallback:oy,useContext:Pn,useEffect:mm,useImperativeHandle:ry,useInsertionEffect:ny,useLayoutEffect:sy,useMemo:ly,useReducer:Eu,useRef:Jv,useState:function(){return Eu(Na)},useDebugValue:gm,useDeferredValue:function(n,s){var i=hn();return iy(i,Dt.memoizedState,n,s)},useTransition:function(){var n=Eu(Na)[0],s=hn().memoizedState;return[typeof n=="boolean"?n:ki(n),s]},useSyncExternalStore:Lv,useId:fy,useHostTransitionStatus:bm,useFormState:Qv,useActionState:Qv,useOptimistic:function(n,s){var i=hn();return qv(i,Dt,n,s)},useMemoCache:cm,useCacheRefresh:py};vm.useEffectEvent=ty;var by={readContext:Pn,use:Nu,useCallback:oy,useContext:Pn,useEffect:mm,useImperativeHandle:ry,useInsertionEffect:ny,useLayoutEffect:sy,useMemo:ly,useReducer:dm,useRef:Jv,useState:function(){return dm(Na)},useDebugValue:gm,useDeferredValue:function(n,s){var i=hn();return Dt===null?hm(i,n,s):iy(i,Dt.memoizedState,n,s)},useTransition:function(){var n=dm(Na)[0],s=hn().memoizedState;return[typeof n=="boolean"?n:ki(n),s]},useSyncExternalStore:Lv,useId:fy,useHostTransitionStatus:bm,useFormState:Zv,useActionState:Zv,useOptimistic:function(n,s){var i=hn();return Dt!==null?qv(i,Dt,n,s):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:cm,useCacheRefresh:py};by.useEffectEvent=ty;function ym(n,s,i,d){s=n.memoizedState,i=i(d,s),i=i==null?s:b({},s,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var jm={enqueueSetState:function(n,s,i){n=n._reactInternals;var d=bs(),_=or(d);_.payload=s,i!=null&&(_.callback=i),s=lr(n,_,d),s!==null&&(os(s,n,d),vi(s,n,d))},enqueueReplaceState:function(n,s,i){n=n._reactInternals;var d=bs(),_=or(d);_.tag=1,_.payload=s,i!=null&&(_.callback=i),s=lr(n,_,d),s!==null&&(os(s,n,d),vi(s,n,d))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var i=bs(),d=or(i);d.tag=2,s!=null&&(d.callback=s),s=lr(n,d,i),s!==null&&(os(s,n,i),vi(s,n,i))}};function _y(n,s,i,d,_,j,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,j,O):s.prototype&&s.prototype.isPureReactComponent?!fi(i,d)||!fi(_,j):!0}function vy(n,s,i,d){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,d),s.state!==n&&jm.enqueueReplaceState(s,s.state,null)}function so(n,s){var i=s;if("ref"in s){i={};for(var d in s)d!=="ref"&&(i[d]=s[d])}if(n=n.defaultProps){i===s&&(i=b({},i));for(var _ in n)i[_]===void 0&&(i[_]=n[_])}return i}function yy(n){cu(n)}function jy(n){console.error(n)}function wy(n){cu(n)}function Mu(n,s){try{var i=n.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function ky(n,s,i){try{var d=n.onCaughtError;d(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function wm(n,s,i){return i=or(i),i.tag=3,i.payload={element:null},i.callback=function(){Mu(n,s)},i}function Sy(n){return n=or(n),n.tag=3,n}function Cy(n,s,i,d){var _=i.type.getDerivedStateFromError;if(typeof _=="function"){var j=d.value;n.payload=function(){return _(j)},n.callback=function(){ky(s,i,d)}}var O=i.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){ky(s,i,d),typeof _!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var U=d.stack;this.componentDidCatch(d.value,{componentStack:U!==null?U:""})})}function sR(n,s,i,d,_){if(i.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=i.alternate,s!==null&&Wo(s,i,_,!0),i=ms.current,i!==null){switch(i.tag){case 31:case 13:return As===null?$u():i.alternate===null&&ln===0&&(ln=3),i.flags&=-257,i.flags|=65536,i.lanes=_,d===_u?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([d]):s.add(d),Km(n,d,_)),!1;case 22:return i.flags|=65536,d===_u?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([d]):i.add(d)),Km(n,d,_)),!1}throw Error(o(435,i.tag))}return Km(n,d,_),$u(),!1}if(Ct)return s=ms.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=_,d!==Vp&&(n=Error(o(422),{cause:d}),gi(Ns(n,i)))):(d!==Vp&&(s=Error(o(423),{cause:d}),gi(Ns(s,i))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,d=Ns(d,i),_=wm(n.stateNode,d,_),Jp(n,_),ln!==4&&(ln=2)),!1;var j=Error(o(520),{cause:d});if(j=Ns(j,i),zi===null?zi=[j]:zi.push(j),ln!==4&&(ln=2),s===null)return!0;d=Ns(d,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,n=_&-_,i.lanes|=n,n=wm(i.stateNode,d,n),Jp(i,n),!1;case 1:if(s=i.type,j=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(pr===null||!pr.has(j))))return i.flags|=65536,_&=-_,i.lanes|=_,_=Sy(_),Cy(_,n,i,d),Jp(i,_),!1}i=i.return}while(i!==null);return!1}var km=Error(o(461)),_n=!1;function Ln(n,s,i,d){s.child=n===null?Tv(s,null,i,d):to(s,n.child,i,d)}function Ny(n,s,i,d,_){i=i.render;var j=s.ref;if("ref"in d){var O={};for(var U in d)U!=="ref"&&(O[U]=d[U])}else O=d;return Wr(s),d=rm(n,s,i,O,j,_),U=om(),n!==null&&!_n?(lm(n,s,_),Ea(n,s,_)):(Ct&&U&&Up(s),s.flags|=1,Ln(n,s,d,_),s.child)}function Ey(n,s,i,d,_){if(n===null){var j=i.type;return typeof j=="function"&&!Lp(j)&&j.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=j,Ry(n,s,j,d,_)):(n=pu(i.type,null,d,s,s.mode,_),n.ref=s.ref,n.return=s,s.child=n)}if(j=n.child,!Mm(n,_)){var O=j.memoizedProps;if(i=i.compare,i=i!==null?i:fi,i(O,d)&&n.ref===s.ref)return Ea(n,s,_)}return s.flags|=1,n=ja(j,d),n.ref=s.ref,n.return=s,s.child=n}function Ry(n,s,i,d,_){if(n!==null){var j=n.memoizedProps;if(fi(j,d)&&n.ref===s.ref)if(_n=!1,s.pendingProps=d=j,Mm(n,_))(n.flags&131072)!==0&&(_n=!0);else return s.lanes=n.lanes,Ea(n,s,_)}return Sm(n,s,i,d,_)}function Ty(n,s,i,d){var _=d.children,j=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(j=j!==null?j.baseLanes|i:i,n!==null){for(d=s.child=n.child,_=0;d!==null;)_=_|d.lanes|d.childLanes,d=d.sibling;d=_&~j}else d=0,s.child=null;return Ay(n,s,j,i,d)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&xu(s,j!==null?j.cachePool:null),j!==null?Ov(s,j):tm(),zv(s);else return d=s.lanes=536870912,Ay(n,s,j!==null?j.baseLanes|i:i,i,d)}else j!==null?(xu(s,j.cachePool),Ov(s,j),cr(),s.memoizedState=null):(n!==null&&xu(s,null),tm(),cr());return Ln(n,s,_,i),s.child}function Ni(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Ay(n,s,i,d,_){var j=Xp();return j=j===null?null:{parent:xn._currentValue,pool:j},s.memoizedState={baseLanes:i,cachePool:j},n!==null&&xu(s,null),tm(),zv(s),n!==null&&Wo(n,s,d,!0),s.childLanes=_,null}function Ou(n,s){return s=Du({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function My(n,s,i){return to(s,n.child,null,i),n=Ou(s,s.pendingProps),n.flags|=2,gs(s),s.memoizedState=null,n}function aR(n,s,i){var d=s.pendingProps,_=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Ct){if(d.mode==="hidden")return n=Ou(s,d),s.lanes=536870912,Ni(null,n);if(sm(s),(n=Yt)?(n=$0(n,Ts),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:tr!==null?{id:Xs,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},i=gv(n),i.return=s,s.child=i,Dn=s,Yt=null)):n=null,n===null)throw sr(s);return s.lanes=536870912,null}return Ou(s,d)}var j=n.memoizedState;if(j!==null){var O=j.dehydrated;if(sm(s),_)if(s.flags&256)s.flags&=-257,s=My(n,s,i);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(o(558));else if(_n||Wo(n,s,i,!1),_=(i&n.childLanes)!==0,_n||_){if(d=Vt,d!==null&&(O=ba(d,i),O!==0&&O!==j.retryLane))throw j.retryLane=O,Yr(n,O),os(d,n,O),km;$u(),s=My(n,s,i)}else n=j.treeContext,Yt=Ms(O.nextSibling),Dn=s,Ct=!0,nr=null,Ts=!1,n!==null&&bv(s,n),s=Ou(s,d),s.flags|=4096;return s}return n=ja(n.child,{mode:d.mode,children:d.children}),n.ref=s.ref,s.child=n,n.return=s,n}function zu(n,s){var i=s.ref;if(i===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(s.flags|=4194816)}}function Sm(n,s,i,d,_){return Wr(s),i=rm(n,s,i,d,void 0,_),d=om(),n!==null&&!_n?(lm(n,s,_),Ea(n,s,_)):(Ct&&d&&Up(s),s.flags|=1,Ln(n,s,i,_),s.child)}function Oy(n,s,i,d,_,j){return Wr(s),s.updateQueue=null,i=Pv(s,d,i,_),Dv(n),d=om(),n!==null&&!_n?(lm(n,s,j),Ea(n,s,j)):(Ct&&d&&Up(s),s.flags|=1,Ln(n,s,i,j),s.child)}function zy(n,s,i,d,_){if(Wr(s),s.stateNode===null){var j=Yo,O=i.contextType;typeof O=="object"&&O!==null&&(j=Pn(O)),j=new i(d,j),s.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=jm,s.stateNode=j,j._reactInternals=s,j=s.stateNode,j.props=d,j.state=s.memoizedState,j.refs={},Wp(s),O=i.contextType,j.context=typeof O=="object"&&O!==null?Pn(O):Yo,j.state=s.memoizedState,O=i.getDerivedStateFromProps,typeof O=="function"&&(ym(s,i,O,d),j.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(O=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),O!==j.state&&jm.enqueueReplaceState(j,j.state,null),ji(s,d,j,_),yi(),j.state=s.memoizedState),typeof j.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(n===null){j=s.stateNode;var U=s.memoizedProps,Q=so(i,U);j.props=Q;var ne=j.context,he=i.contextType;O=Yo,typeof he=="object"&&he!==null&&(O=Pn(he));var ye=i.getDerivedStateFromProps;he=typeof ye=="function"||typeof j.getSnapshotBeforeUpdate=="function",U=s.pendingProps!==U,he||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(U||ne!==O)&&vy(s,j,d,O),rr=!1;var re=s.memoizedState;j.state=re,ji(s,d,j,_),yi(),ne=s.memoizedState,U||re!==ne||rr?(typeof ye=="function"&&(ym(s,i,ye,d),ne=s.memoizedState),(Q=rr||_y(s,i,Q,d,re,ne,O))?(he||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(s.flags|=4194308)):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ne),j.props=d,j.state=ne,j.context=O,d=Q):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{j=s.stateNode,Zp(n,s),O=s.memoizedProps,he=so(i,O),j.props=he,ye=s.pendingProps,re=j.context,ne=i.contextType,Q=Yo,typeof ne=="object"&&ne!==null&&(Q=Pn(ne)),U=i.getDerivedStateFromProps,(ne=typeof U=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(O!==ye||re!==Q)&&vy(s,j,d,Q),rr=!1,re=s.memoizedState,j.state=re,ji(s,d,j,_),yi();var ue=s.memoizedState;O!==ye||re!==ue||rr||n!==null&&n.dependencies!==null&&gu(n.dependencies)?(typeof U=="function"&&(ym(s,i,U,d),ue=s.memoizedState),(he=rr||_y(s,i,he,d,re,ue,Q)||n!==null&&n.dependencies!==null&&gu(n.dependencies))?(ne||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,ue,Q),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,ue,Q)),typeof j.componentDidUpdate=="function"&&(s.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof j.componentDidUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=ue),j.props=d,j.state=ue,j.context=Q,d=he):(typeof j.componentDidUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(s.flags|=1024),d=!1)}return j=d,zu(n,s),d=(s.flags&128)!==0,j||d?(j=s.stateNode,i=d&&typeof i.getDerivedStateFromError!="function"?null:j.render(),s.flags|=1,n!==null&&d?(s.child=to(s,n.child,null,_),s.child=to(s,null,i,_)):Ln(n,s,i,_),s.memoizedState=j.state,n=s.child):n=Ea(n,s,_),n}function Dy(n,s,i,d){return Xr(),s.flags|=256,Ln(n,s,i,d),s.child}var Cm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nm(n){return{baseLanes:n,cachePool:kv()}}function Em(n,s,i){return n=n!==null?n.childLanes&~i:0,s&&(n|=xs),n}function Py(n,s,i){var d=s.pendingProps,_=!1,j=(s.flags&128)!==0,O;if((O=j)||(O=n!==null&&n.memoizedState===null?!1:(gn.current&2)!==0),O&&(_=!0,s.flags&=-129),O=(s.flags&32)!==0,s.flags&=-33,n===null){if(Ct){if(_?ir(s):cr(),(n=Yt)?(n=$0(n,Ts),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:tr!==null?{id:Xs,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},i=gv(n),i.return=s,s.child=i,Dn=s,Yt=null)):n=null,n===null)throw sr(s);return ug(n)?s.lanes=32:s.lanes=536870912,null}var U=d.children;return d=d.fallback,_?(cr(),_=s.mode,U=Du({mode:"hidden",children:U},_),d=Kr(d,_,i,null),U.return=s,d.return=s,U.sibling=d,s.child=U,d=s.child,d.memoizedState=Nm(i),d.childLanes=Em(n,O,i),s.memoizedState=Cm,Ni(null,d)):(ir(s),Rm(s,U))}var Q=n.memoizedState;if(Q!==null&&(U=Q.dehydrated,U!==null)){if(j)s.flags&256?(ir(s),s.flags&=-257,s=Tm(n,s,i)):s.memoizedState!==null?(cr(),s.child=n.child,s.flags|=128,s=null):(cr(),U=d.fallback,_=s.mode,d=Du({mode:"visible",children:d.children},_),U=Kr(U,_,i,null),U.flags|=2,d.return=s,U.return=s,d.sibling=U,s.child=d,to(s,n.child,null,i),d=s.child,d.memoizedState=Nm(i),d.childLanes=Em(n,O,i),s.memoizedState=Cm,s=Ni(null,d));else if(ir(s),ug(U)){if(O=U.nextSibling&&U.nextSibling.dataset,O)var ne=O.dgst;O=ne,d=Error(o(419)),d.stack="",d.digest=O,gi({value:d,source:null,stack:null}),s=Tm(n,s,i)}else if(_n||Wo(n,s,i,!1),O=(i&n.childLanes)!==0,_n||O){if(O=Vt,O!==null&&(d=ba(O,i),d!==0&&d!==Q.retryLane))throw Q.retryLane=d,Yr(n,d),os(O,n,d),km;cg(U)||$u(),s=Tm(n,s,i)}else cg(U)?(s.flags|=192,s.child=n.child,s=null):(n=Q.treeContext,Yt=Ms(U.nextSibling),Dn=s,Ct=!0,nr=null,Ts=!1,n!==null&&bv(s,n),s=Rm(s,d.children),s.flags|=4096);return s}return _?(cr(),U=d.fallback,_=s.mode,Q=n.child,ne=Q.sibling,d=ja(Q,{mode:"hidden",children:d.children}),d.subtreeFlags=Q.subtreeFlags&65011712,ne!==null?U=ja(ne,U):(U=Kr(U,_,i,null),U.flags|=2),U.return=s,d.return=s,d.sibling=U,s.child=d,Ni(null,d),d=s.child,U=n.child.memoizedState,U===null?U=Nm(i):(_=U.cachePool,_!==null?(Q=xn._currentValue,_=_.parent!==Q?{parent:Q,pool:Q}:_):_=kv(),U={baseLanes:U.baseLanes|i,cachePool:_}),d.memoizedState=U,d.childLanes=Em(n,O,i),s.memoizedState=Cm,Ni(n.child,d)):(ir(s),i=n.child,n=i.sibling,i=ja(i,{mode:"visible",children:d.children}),i.return=s,i.sibling=null,n!==null&&(O=s.deletions,O===null?(s.deletions=[n],s.flags|=16):O.push(n)),s.child=i,s.memoizedState=null,i)}function Rm(n,s){return s=Du({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Du(n,s){return n=ps(22,n,null,s),n.lanes=0,n}function Tm(n,s,i){return to(s,n.child,null,i),n=Rm(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function Ly(n,s,i){n.lanes|=s;var d=n.alternate;d!==null&&(d.lanes|=s),Fp(n.return,s,i)}function Am(n,s,i,d,_,j){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:i,tailMode:_,treeForkCount:j}:(O.isBackwards=s,O.rendering=null,O.renderingStartTime=0,O.last=d,O.tail=i,O.tailMode=_,O.treeForkCount=j)}function Iy(n,s,i){var d=s.pendingProps,_=d.revealOrder,j=d.tail;d=d.children;var O=gn.current,U=(O&2)!==0;if(U?(O=O&1|2,s.flags|=128):O&=1,Z(gn,O),Ln(n,s,d,i),d=Ct?mi:0,!U&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ly(n,i,s);else if(n.tag===19)Ly(n,i,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(_){case"forwards":for(i=s.child,_=null;i!==null;)n=i.alternate,n!==null&&wu(n)===null&&(_=i),i=i.sibling;i=_,i===null?(_=s.child,s.child=null):(_=i.sibling,i.sibling=null),Am(s,!1,_,i,j,d);break;case"backwards":case"unstable_legacy-backwards":for(i=null,_=s.child,s.child=null;_!==null;){if(n=_.alternate,n!==null&&wu(n)===null){s.child=_;break}n=_.sibling,_.sibling=i,i=_,_=n}Am(s,!0,i,null,j,d);break;case"together":Am(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function Ea(n,s,i){if(n!==null&&(s.dependencies=n.dependencies),fr|=s.lanes,(i&s.childLanes)===0)if(n!==null){if(Wo(n,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(o(153));if(s.child!==null){for(n=s.child,i=ja(n,n.pendingProps),s.child=i,i.return=s;n.sibling!==null;)n=n.sibling,i=i.sibling=ja(n,n.pendingProps),i.return=s;i.sibling=null}return s.child}function Mm(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&gu(n)))}function rR(n,s,i){switch(s.tag){case 3:oe(s,s.stateNode.containerInfo),ar(s,xn,n.memoizedState.cache),Xr();break;case 27:case 5:Te(s);break;case 4:oe(s,s.stateNode.containerInfo);break;case 10:ar(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,sm(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(ir(s),s.flags|=128,null):(i&s.child.childLanes)!==0?Py(n,s,i):(ir(s),n=Ea(n,s,i),n!==null?n.sibling:null);ir(s);break;case 19:var _=(n.flags&128)!==0;if(d=(i&s.childLanes)!==0,d||(Wo(n,s,i,!1),d=(i&s.childLanes)!==0),_){if(d)return Iy(n,s,i);s.flags|=128}if(_=s.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Z(gn,gn.current),d)break;return null;case 22:return s.lanes=0,Ty(n,s,i,s.pendingProps);case 24:ar(s,xn,n.memoizedState.cache)}return Ea(n,s,i)}function By(n,s,i){if(n!==null)if(n.memoizedProps!==s.pendingProps)_n=!0;else{if(!Mm(n,i)&&(s.flags&128)===0)return _n=!1,rR(n,s,i);_n=(n.flags&131072)!==0}else _n=!1,Ct&&(s.flags&1048576)!==0&&xv(s,mi,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(n=Jr(s.elementType),s.type=n,typeof n=="function")Lp(n)?(d=so(n,d),s.tag=1,s=zy(null,s,n,d,i)):(s.tag=0,s=Sm(null,s,n,d,i));else{if(n!=null){var _=n.$$typeof;if(_===R){s.tag=11,s=Ny(null,s,n,d,i);break e}else if(_===M){s.tag=14,s=Ey(null,s,n,d,i);break e}}throw s=V(n)||n,Error(o(306,s,""))}}return s;case 0:return Sm(n,s,s.type,s.pendingProps,i);case 1:return d=s.type,_=so(d,s.pendingProps),zy(n,s,d,_,i);case 3:e:{if(oe(s,s.stateNode.containerInfo),n===null)throw Error(o(387));d=s.pendingProps;var j=s.memoizedState;_=j.element,Zp(n,s),ji(s,d,null,i);var O=s.memoizedState;if(d=O.cache,ar(s,xn,d),d!==j.cache&&Gp(s,[xn],i,!0),yi(),d=O.element,j.isDehydrated)if(j={element:d,isDehydrated:!1,cache:O.cache},s.updateQueue.baseState=j,s.memoizedState=j,s.flags&256){s=Dy(n,s,d,i);break e}else if(d!==_){_=Ns(Error(o(424)),s),gi(_),s=Dy(n,s,d,i);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Yt=Ms(n.firstChild),Dn=s,Ct=!0,nr=null,Ts=!0,i=Tv(s,null,d,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Xr(),d===_){s=Ea(n,s,i);break e}Ln(n,s,d,i)}s=s.child}return s;case 26:return zu(n,s),n===null?(i=Q0(s.type,null,s.pendingProps,null))?s.memoizedState=i:Ct||(i=s.type,n=s.pendingProps,d=Wu(fe.current).createElement(i),d[Ht]=s,d[zn]=n,In(d,i,n),Cn(d),s.stateNode=d):s.memoizedState=Q0(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Te(s),n===null&&Ct&&(d=s.stateNode=Y0(s.type,s.pendingProps,fe.current),Dn=s,Ts=!0,_=Yt,xr(s.type)?(dg=_,Yt=Ms(d.firstChild)):Yt=_),Ln(n,s,s.pendingProps.children,i),zu(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Ct&&((_=d=Yt)&&(d=DR(d,s.type,s.pendingProps,Ts),d!==null?(s.stateNode=d,Dn=s,Yt=Ms(d.firstChild),Ts=!1,_=!0):_=!1),_||sr(s)),Te(s),_=s.type,j=s.pendingProps,O=n!==null?n.memoizedProps:null,d=j.children,og(_,j)?d=null:O!==null&&og(_,O)&&(s.flags|=32),s.memoizedState!==null&&(_=rm(n,s,QE,null,null,i),Vi._currentValue=_),zu(n,s),Ln(n,s,d,i),s.child;case 6:return n===null&&Ct&&((n=i=Yt)&&(i=PR(i,s.pendingProps,Ts),i!==null?(s.stateNode=i,Dn=s,Yt=null,n=!0):n=!1),n||sr(s)),null;case 13:return Py(n,s,i);case 4:return oe(s,s.stateNode.containerInfo),d=s.pendingProps,n===null?s.child=to(s,null,d,i):Ln(n,s,d,i),s.child;case 11:return Ny(n,s,s.type,s.pendingProps,i);case 7:return Ln(n,s,s.pendingProps,i),s.child;case 8:return Ln(n,s,s.pendingProps.children,i),s.child;case 12:return Ln(n,s,s.pendingProps.children,i),s.child;case 10:return d=s.pendingProps,ar(s,s.type,d.value),Ln(n,s,d.children,i),s.child;case 9:return _=s.type._context,d=s.pendingProps.children,Wr(s),_=Pn(_),d=d(_),s.flags|=1,Ln(n,s,d,i),s.child;case 14:return Ey(n,s,s.type,s.pendingProps,i);case 15:return Ry(n,s,s.type,s.pendingProps,i);case 19:return Iy(n,s,i);case 31:return aR(n,s,i);case 22:return Ty(n,s,i,s.pendingProps);case 24:return Wr(s),d=Pn(xn),n===null?(_=Xp(),_===null&&(_=Vt,j=Yp(),_.pooledCache=j,j.refCount++,j!==null&&(_.pooledCacheLanes|=i),_=j),s.memoizedState={parent:d,cache:_},Wp(s),ar(s,xn,_)):((n.lanes&i)!==0&&(Zp(n,s),ji(s,null,null,i),yi()),_=n.memoizedState,j=s.memoizedState,_.parent!==d?(_={parent:d,cache:d},s.memoizedState=_,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=_),ar(s,xn,d)):(d=j.cache,ar(s,xn,d),d!==_.cache&&Gp(s,[xn],i,!0))),Ln(n,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(o(156,s.tag))}function Ra(n){n.flags|=4}function Om(n,s,i,d,_){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if(f0())n.flags|=8192;else throw eo=_u,Qp}else n.flags&=-16777217}function Uy(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!t1(s))if(f0())n.flags|=8192;else throw eo=_u,Qp}function Pu(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?ds():536870912,n.lanes|=s,cl|=s)}function Ei(n,s){if(!Ct)switch(n.tailMode){case"hidden":s=n.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function Kt(n){var s=n.alternate!==null&&n.alternate.child===n.child,i=0,d=0;if(s)for(var _=n.child;_!==null;)i|=_.lanes|_.childLanes,d|=_.subtreeFlags&65011712,d|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)i|=_.lanes|_.childLanes,d|=_.subtreeFlags,d|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=d,n.childLanes=i,s}function oR(n,s,i){var d=s.pendingProps;switch(Hp(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(s),null;case 1:return Kt(s),null;case 3:return i=s.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),Sa(xn),me(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Qo(s)?Ra(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,qp())),Kt(s),null;case 26:var _=s.type,j=s.memoizedState;return n===null?(Ra(s),j!==null?(Kt(s),Uy(s,j)):(Kt(s),Om(s,_,null,d,i))):j?j!==n.memoizedState?(Ra(s),Kt(s),Uy(s,j)):(Kt(s),s.flags&=-16777217):(n=n.memoizedProps,n!==d&&Ra(s),Kt(s),Om(s,_,n,d,i)),null;case 27:if(ie(s),i=fe.current,_=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==d&&Ra(s);else{if(!d){if(s.stateNode===null)throw Error(o(166));return Kt(s),null}n=ee.current,Qo(s)?_v(s):(n=Y0(_,d,i),s.stateNode=n,Ra(s))}return Kt(s),null;case 5:if(ie(s),_=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==d&&Ra(s);else{if(!d){if(s.stateNode===null)throw Error(o(166));return Kt(s),null}if(j=ee.current,Qo(s))_v(s);else{var O=Wu(fe.current);switch(j){case 1:j=O.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:j=O.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":j=O.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":j=O.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":j=O.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof d.is=="string"?O.createElement("select",{is:d.is}):O.createElement("select"),d.multiple?j.multiple=!0:d.size&&(j.size=d.size);break;default:j=typeof d.is=="string"?O.createElement(_,{is:d.is}):O.createElement(_)}}j[Ht]=s,j[zn]=d;e:for(O=s.child;O!==null;){if(O.tag===5||O.tag===6)j.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===s)break e;for(;O.sibling===null;){if(O.return===null||O.return===s)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}s.stateNode=j;e:switch(In(j,_,d),_){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ra(s)}}return Kt(s),Om(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,i),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==d&&Ra(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(o(166));if(n=fe.current,Qo(s)){if(n=s.stateNode,i=s.memoizedProps,d=null,_=Dn,_!==null)switch(_.tag){case 27:case 5:d=_.memoizedProps}n[Ht]=s,n=!!(n.nodeValue===i||d!==null&&d.suppressHydrationWarning===!0||P0(n.nodeValue,i)),n||sr(s,!0)}else n=Wu(n).createTextNode(d),n[Ht]=s,s.stateNode=n}return Kt(s),null;case 31:if(i=s.memoizedState,n===null||n.memoizedState!==null){if(d=Qo(s),i!==null){if(n===null){if(!d)throw Error(o(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Ht]=s}else Xr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Kt(s),n=!1}else i=qp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return s.flags&256?(gs(s),s):(gs(s),null);if((s.flags&128)!==0)throw Error(o(558))}return Kt(s),null;case 13:if(d=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=Qo(s),d!==null&&d.dehydrated!==null){if(n===null){if(!_)throw Error(o(318));if(_=s.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(o(317));_[Ht]=s}else Xr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Kt(s),_=!1}else _=qp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return s.flags&256?(gs(s),s):(gs(s),null)}return gs(s),(s.flags&128)!==0?(s.lanes=i,s):(i=d!==null,n=n!==null&&n.memoizedState!==null,i&&(d=s.child,_=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(_=d.alternate.memoizedState.cachePool.pool),j=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(j=d.memoizedState.cachePool.pool),j!==_&&(d.flags|=2048)),i!==n&&i&&(s.child.flags|=8192),Pu(s,s.updateQueue),Kt(s),null);case 4:return me(),n===null&&tg(s.stateNode.containerInfo),Kt(s),null;case 10:return Sa(s.type),Kt(s),null;case 19:if(G(gn),d=s.memoizedState,d===null)return Kt(s),null;if(_=(s.flags&128)!==0,j=d.rendering,j===null)if(_)Ei(d,!1);else{if(ln!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(j=wu(n),j!==null){for(s.flags|=128,Ei(d,!1),n=j.updateQueue,s.updateQueue=n,Pu(s,n),s.subtreeFlags=0,n=i,i=s.child;i!==null;)mv(i,n),i=i.sibling;return Z(gn,gn.current&1|2),Ct&&wa(s,d.treeForkCount),s.child}n=n.sibling}d.tail!==null&&se()>Hu&&(s.flags|=128,_=!0,Ei(d,!1),s.lanes=4194304)}else{if(!_)if(n=wu(j),n!==null){if(s.flags|=128,_=!0,n=n.updateQueue,s.updateQueue=n,Pu(s,n),Ei(d,!0),d.tail===null&&d.tailMode==="hidden"&&!j.alternate&&!Ct)return Kt(s),null}else 2*se()-d.renderingStartTime>Hu&&i!==536870912&&(s.flags|=128,_=!0,Ei(d,!1),s.lanes=4194304);d.isBackwards?(j.sibling=s.child,s.child=j):(n=d.last,n!==null?n.sibling=j:s.child=j,d.last=j)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=se(),n.sibling=null,i=gn.current,Z(gn,_?i&1|2:i&1),Ct&&wa(s,d.treeForkCount),n):(Kt(s),null);case 22:case 23:return gs(s),nm(),d=s.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(i&536870912)!==0&&(s.flags&128)===0&&(Kt(s),s.subtreeFlags&6&&(s.flags|=8192)):Kt(s),i=s.updateQueue,i!==null&&Pu(s,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==i&&(s.flags|=2048),n!==null&&G(Zr),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),Sa(xn),Kt(s),null;case 25:return null;case 30:return null}throw Error(o(156,s.tag))}function lR(n,s){switch(Hp(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Sa(xn),me(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return ie(s),null;case 31:if(s.memoizedState!==null){if(gs(s),s.alternate===null)throw Error(o(340));Xr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(gs(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(o(340));Xr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return G(gn),null;case 4:return me(),null;case 10:return Sa(s.type),null;case 22:case 23:return gs(s),nm(),n!==null&&G(Zr),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return Sa(xn),null;case 25:return null;default:return null}}function Hy(n,s){switch(Hp(s),s.tag){case 3:Sa(xn),me();break;case 26:case 27:case 5:ie(s);break;case 4:me();break;case 31:s.memoizedState!==null&&gs(s);break;case 13:gs(s);break;case 19:G(gn);break;case 10:Sa(s.type);break;case 22:case 23:gs(s),nm(),n!==null&&G(Zr);break;case 24:Sa(xn)}}function Ri(n,s){try{var i=s.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var _=d.next;i=_;do{if((i.tag&n)===n){d=void 0;var j=i.create,O=i.inst;d=j(),O.destroy=d}i=i.next}while(i!==_)}}catch(U){Ot(s,s.return,U)}}function ur(n,s,i){try{var d=s.updateQueue,_=d!==null?d.lastEffect:null;if(_!==null){var j=_.next;d=j;do{if((d.tag&n)===n){var O=d.inst,U=O.destroy;if(U!==void 0){O.destroy=void 0,_=s;var Q=i,ne=U;try{ne()}catch(he){Ot(_,Q,he)}}}d=d.next}while(d!==j)}}catch(he){Ot(s,s.return,he)}}function Vy(n){var s=n.updateQueue;if(s!==null){var i=n.stateNode;try{Mv(s,i)}catch(d){Ot(n,n.return,d)}}}function qy(n,s,i){i.props=so(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(d){Ot(n,s,d)}}function Ti(n,s){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:d=n.stateNode;break;default:d=n.stateNode}typeof i=="function"?n.refCleanup=i(d):i.current=d}}catch(_){Ot(n,s,_)}}function Ws(n,s){var i=n.ref,d=n.refCleanup;if(i!==null)if(typeof d=="function")try{d()}catch(_){Ot(n,s,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(_){Ot(n,s,_)}else i.current=null}function $y(n){var s=n.type,i=n.memoizedProps,d=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":i.autoFocus&&d.focus();break e;case"img":i.src?d.src=i.src:i.srcSet&&(d.srcset=i.srcSet)}}catch(_){Ot(n,n.return,_)}}function zm(n,s,i){try{var d=n.stateNode;RR(d,n.type,i,s),d[zn]=s}catch(_){Ot(n,n.return,_)}}function Fy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&xr(n.type)||n.tag===4}function Dm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Fy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&xr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Pm(n,s,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(n),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=va));else if(d!==4&&(d===27&&xr(n.type)&&(i=n.stateNode,s=null),n=n.child,n!==null))for(Pm(n,s,i),n=n.sibling;n!==null;)Pm(n,s,i),n=n.sibling}function Lu(n,s,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,s?i.insertBefore(n,s):i.appendChild(n);else if(d!==4&&(d===27&&xr(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Lu(n,s,i),n=n.sibling;n!==null;)Lu(n,s,i),n=n.sibling}function Gy(n){var s=n.stateNode,i=n.memoizedProps;try{for(var d=n.type,_=s.attributes;_.length;)s.removeAttributeNode(_[0]);In(s,d,i),s[Ht]=n,s[zn]=i}catch(j){Ot(n,n.return,j)}}var Ta=!1,vn=!1,Lm=!1,Yy=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function iR(n,s){if(n=n.containerInfo,ag=ad,n=rv(n),Tp(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var d=i.getSelection&&i.getSelection();if(d&&d.rangeCount!==0){i=d.anchorNode;var _=d.anchorOffset,j=d.focusNode;d=d.focusOffset;try{i.nodeType,j.nodeType}catch{i=null;break e}var O=0,U=-1,Q=-1,ne=0,he=0,ye=n,re=null;t:for(;;){for(var ue;ye!==i||_!==0&&ye.nodeType!==3||(U=O+_),ye!==j||d!==0&&ye.nodeType!==3||(Q=O+d),ye.nodeType===3&&(O+=ye.nodeValue.length),(ue=ye.firstChild)!==null;)re=ye,ye=ue;for(;;){if(ye===n)break t;if(re===i&&++ne===_&&(U=O),re===j&&++he===d&&(Q=O),(ue=ye.nextSibling)!==null)break;ye=re,re=ye.parentNode}ye=ue}i=U===-1||Q===-1?null:{start:U,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(rg={focusedElem:n,selectionRange:i},ad=!1,Nn=s;Nn!==null;)if(s=Nn,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,Nn=n;else for(;Nn!==null;){switch(s=Nn,j=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)_=n[i],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&j!==null){n=void 0,i=s,_=j.memoizedProps,j=j.memoizedState,d=i.stateNode;try{var qe=so(i.type,_);n=d.getSnapshotBeforeUpdate(qe,j),d.__reactInternalSnapshotBeforeUpdate=n}catch(st){Ot(i,i.return,st)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,i=n.nodeType,i===9)ig(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":ig(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(o(163))}if(n=s.sibling,n!==null){n.return=s.return,Nn=n;break}Nn=s.return}}function Ky(n,s,i){var d=i.flags;switch(i.tag){case 0:case 11:case 15:Ma(n,i),d&4&&Ri(5,i);break;case 1:if(Ma(n,i),d&4)if(n=i.stateNode,s===null)try{n.componentDidMount()}catch(O){Ot(i,i.return,O)}else{var _=so(i.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(_,s,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Ot(i,i.return,O)}}d&64&&Vy(i),d&512&&Ti(i,i.return);break;case 3:if(Ma(n,i),d&64&&(n=i.updateQueue,n!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{Mv(n,s)}catch(O){Ot(i,i.return,O)}}break;case 27:s===null&&d&4&&Gy(i);case 26:case 5:Ma(n,i),s===null&&d&4&&$y(i),d&512&&Ti(i,i.return);break;case 12:Ma(n,i);break;case 31:Ma(n,i),d&4&&Wy(n,i);break;case 13:Ma(n,i),d&4&&Zy(n,i),d&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=xR.bind(null,i),LR(n,i))));break;case 22:if(d=i.memoizedState!==null||Ta,!d){s=s!==null&&s.memoizedState!==null||vn,_=Ta;var j=vn;Ta=d,(vn=s)&&!j?Oa(n,i,(i.subtreeFlags&8772)!==0):Ma(n,i),Ta=_,vn=j}break;case 30:break;default:Ma(n,i)}}function Xy(n){var s=n.alternate;s!==null&&(n.alternate=null,Xy(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&pp(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Jt=null,ns=!1;function Aa(n,s,i){for(i=i.child;i!==null;)Qy(n,s,i),i=i.sibling}function Qy(n,s,i){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(Me,i)}catch{}switch(i.tag){case 26:vn||Ws(i,s),Aa(n,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:vn||Ws(i,s);var d=Jt,_=ns;xr(i.type)&&(Jt=i.stateNode,ns=!1),Aa(n,s,i),Bi(i.stateNode),Jt=d,ns=_;break;case 5:vn||Ws(i,s);case 6:if(d=Jt,_=ns,Jt=null,Aa(n,s,i),Jt=d,ns=_,Jt!==null)if(ns)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(i.stateNode)}catch(j){Ot(i,s,j)}else try{Jt.removeChild(i.stateNode)}catch(j){Ot(i,s,j)}break;case 18:Jt!==null&&(ns?(n=Jt,V0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),xl(n)):V0(Jt,i.stateNode));break;case 4:d=Jt,_=ns,Jt=i.stateNode.containerInfo,ns=!0,Aa(n,s,i),Jt=d,ns=_;break;case 0:case 11:case 14:case 15:ur(2,i,s),vn||ur(4,i,s),Aa(n,s,i);break;case 1:vn||(Ws(i,s),d=i.stateNode,typeof d.componentWillUnmount=="function"&&qy(i,s,d)),Aa(n,s,i);break;case 21:Aa(n,s,i);break;case 22:vn=(d=vn)||i.memoizedState!==null,Aa(n,s,i),vn=d;break;default:Aa(n,s,i)}}function Wy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{xl(n)}catch(i){Ot(s,s.return,i)}}}function Zy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{xl(n)}catch(i){Ot(s,s.return,i)}}function cR(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new Yy),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new Yy),s;default:throw Error(o(435,n.tag))}}function Iu(n,s){var i=cR(n);s.forEach(function(d){if(!i.has(d)){i.add(d);var _=bR.bind(null,n,d);d.then(_,_)}})}function ss(n,s){var i=s.deletions;if(i!==null)for(var d=0;d<i.length;d++){var _=i[d],j=n,O=s,U=O;e:for(;U!==null;){switch(U.tag){case 27:if(xr(U.type)){Jt=U.stateNode,ns=!1;break e}break;case 5:Jt=U.stateNode,ns=!1;break e;case 3:case 4:Jt=U.stateNode.containerInfo,ns=!0;break e}U=U.return}if(Jt===null)throw Error(o(160));Qy(j,O,_),Jt=null,ns=!1,j=_.alternate,j!==null&&(j.return=null),_.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Jy(s,n),s=s.sibling}var Bs=null;function Jy(n,s){var i=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ss(s,n),as(n),d&4&&(ur(3,n,n.return),Ri(3,n),ur(5,n,n.return));break;case 1:ss(s,n),as(n),d&512&&(vn||i===null||Ws(i,i.return)),d&64&&Ta&&(n=n.updateQueue,n!==null&&(d=n.callbacks,d!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?d:i.concat(d))));break;case 26:var _=Bs;if(ss(s,n),as(n),d&512&&(vn||i===null||Ws(i,i.return)),d&4){var j=i!==null?i.memoizedState:null;if(d=n.memoizedState,i===null)if(d===null)if(n.stateNode===null){e:{d=n.type,i=n.memoizedProps,_=_.ownerDocument||_;t:switch(d){case"title":j=_.getElementsByTagName("title")[0],(!j||j[si]||j[Ht]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=_.createElement(d),_.head.insertBefore(j,_.querySelector("head > title"))),In(j,d,i),j[Ht]=n,Cn(j),d=j;break e;case"link":var O=J0("link","href",_).get(d+(i.href||""));if(O){for(var U=0;U<O.length;U++)if(j=O[U],j.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&j.getAttribute("rel")===(i.rel==null?null:i.rel)&&j.getAttribute("title")===(i.title==null?null:i.title)&&j.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){O.splice(U,1);break t}}j=_.createElement(d),In(j,d,i),_.head.appendChild(j);break;case"meta":if(O=J0("meta","content",_).get(d+(i.content||""))){for(U=0;U<O.length;U++)if(j=O[U],j.getAttribute("content")===(i.content==null?null:""+i.content)&&j.getAttribute("name")===(i.name==null?null:i.name)&&j.getAttribute("property")===(i.property==null?null:i.property)&&j.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&j.getAttribute("charset")===(i.charSet==null?null:i.charSet)){O.splice(U,1);break t}}j=_.createElement(d),In(j,d,i),_.head.appendChild(j);break;default:throw Error(o(468,d))}j[Ht]=n,Cn(j),d=j}n.stateNode=d}else e1(_,n.type,n.stateNode);else n.stateNode=Z0(_,d,n.memoizedProps);else j!==d?(j===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):j.count--,d===null?e1(_,n.type,n.stateNode):Z0(_,d,n.memoizedProps)):d===null&&n.stateNode!==null&&zm(n,n.memoizedProps,i.memoizedProps)}break;case 27:ss(s,n),as(n),d&512&&(vn||i===null||Ws(i,i.return)),i!==null&&d&4&&zm(n,n.memoizedProps,i.memoizedProps);break;case 5:if(ss(s,n),as(n),d&512&&(vn||i===null||Ws(i,i.return)),n.flags&32){_=n.stateNode;try{Uo(_,"")}catch(qe){Ot(n,n.return,qe)}}d&4&&n.stateNode!=null&&(_=n.memoizedProps,zm(n,_,i!==null?i.memoizedProps:_)),d&1024&&(Lm=!0);break;case 6:if(ss(s,n),as(n),d&4){if(n.stateNode===null)throw Error(o(162));d=n.memoizedProps,i=n.stateNode;try{i.nodeValue=d}catch(qe){Ot(n,n.return,qe)}}break;case 3:if(ed=null,_=Bs,Bs=Zu(s.containerInfo),ss(s,n),Bs=_,as(n),d&4&&i!==null&&i.memoizedState.isDehydrated)try{xl(s.containerInfo)}catch(qe){Ot(n,n.return,qe)}Lm&&(Lm=!1,e0(n));break;case 4:d=Bs,Bs=Zu(n.stateNode.containerInfo),ss(s,n),as(n),Bs=d;break;case 12:ss(s,n),as(n);break;case 31:ss(s,n),as(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Iu(n,d)));break;case 13:ss(s,n),as(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Uu=se()),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Iu(n,d)));break;case 22:_=n.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ne=Ta,he=vn;if(Ta=ne||_,vn=he||Q,ss(s,n),vn=he,Ta=ne,as(n),d&8192)e:for(s=n.stateNode,s._visibility=_?s._visibility&-2:s._visibility|1,_&&(i===null||Q||Ta||vn||ao(n)),i=null,s=n;;){if(s.tag===5||s.tag===26){if(i===null){Q=i=s;try{if(j=Q.stateNode,_)O=j.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{U=Q.stateNode;var ye=Q.memoizedProps.style,re=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;U.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(qe){Ot(Q,Q.return,qe)}}}else if(s.tag===6){if(i===null){Q=s;try{Q.stateNode.nodeValue=_?"":Q.memoizedProps}catch(qe){Ot(Q,Q.return,qe)}}}else if(s.tag===18){if(i===null){Q=s;try{var ue=Q.stateNode;_?q0(ue,!0):q0(Q.stateNode,!1)}catch(qe){Ot(Q,Q.return,qe)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=n.updateQueue,d!==null&&(i=d.retryQueue,i!==null&&(d.retryQueue=null,Iu(n,i))));break;case 19:ss(s,n),as(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Iu(n,d)));break;case 30:break;case 21:break;default:ss(s,n),as(n)}}function as(n){var s=n.flags;if(s&2){try{for(var i,d=n.return;d!==null;){if(Fy(d)){i=d;break}d=d.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var _=i.stateNode,j=Dm(n);Lu(n,j,_);break;case 5:var O=i.stateNode;i.flags&32&&(Uo(O,""),i.flags&=-33);var U=Dm(n);Lu(n,U,O);break;case 3:case 4:var Q=i.stateNode.containerInfo,ne=Dm(n);Pm(n,ne,Q);break;default:throw Error(o(161))}}catch(he){Ot(n,n.return,he)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function e0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;e0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Ma(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ky(n,s.alternate,s),s=s.sibling}function ao(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:ur(4,s,s.return),ao(s);break;case 1:Ws(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&qy(s,s.return,i),ao(s);break;case 27:Bi(s.stateNode);case 26:case 5:Ws(s,s.return),ao(s);break;case 22:s.memoizedState===null&&ao(s);break;case 30:ao(s);break;default:ao(s)}n=n.sibling}}function Oa(n,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,_=n,j=s,O=j.flags;switch(j.tag){case 0:case 11:case 15:Oa(_,j,i),Ri(4,j);break;case 1:if(Oa(_,j,i),d=j,_=d.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ne){Ot(d,d.return,ne)}if(d=j,_=d.updateQueue,_!==null){var U=d.stateNode;try{var Q=_.shared.hiddenCallbacks;if(Q!==null)for(_.shared.hiddenCallbacks=null,_=0;_<Q.length;_++)Av(Q[_],U)}catch(ne){Ot(d,d.return,ne)}}i&&O&64&&Vy(j),Ti(j,j.return);break;case 27:Gy(j);case 26:case 5:Oa(_,j,i),i&&d===null&&O&4&&$y(j),Ti(j,j.return);break;case 12:Oa(_,j,i);break;case 31:Oa(_,j,i),i&&O&4&&Wy(_,j);break;case 13:Oa(_,j,i),i&&O&4&&Zy(_,j);break;case 22:j.memoizedState===null&&Oa(_,j,i),Ti(j,j.return);break;case 30:break;default:Oa(_,j,i)}s=s.sibling}}function Im(n,s){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&hi(i))}function Bm(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hi(n))}function Us(n,s,i,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)t0(n,s,i,d),s=s.sibling}function t0(n,s,i,d){var _=s.flags;switch(s.tag){case 0:case 11:case 15:Us(n,s,i,d),_&2048&&Ri(9,s);break;case 1:Us(n,s,i,d);break;case 3:Us(n,s,i,d),_&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hi(n)));break;case 12:if(_&2048){Us(n,s,i,d),n=s.stateNode;try{var j=s.memoizedProps,O=j.id,U=j.onPostCommit;typeof U=="function"&&U(O,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Ot(s,s.return,Q)}}else Us(n,s,i,d);break;case 31:Us(n,s,i,d);break;case 13:Us(n,s,i,d);break;case 23:break;case 22:j=s.stateNode,O=s.alternate,s.memoizedState!==null?j._visibility&2?Us(n,s,i,d):Ai(n,s):j._visibility&2?Us(n,s,i,d):(j._visibility|=2,ol(n,s,i,d,(s.subtreeFlags&10256)!==0||!1)),_&2048&&Im(O,s);break;case 24:Us(n,s,i,d),_&2048&&Bm(s.alternate,s);break;default:Us(n,s,i,d)}}function ol(n,s,i,d,_){for(_=_&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var j=n,O=s,U=i,Q=d,ne=O.flags;switch(O.tag){case 0:case 11:case 15:ol(j,O,U,Q,_),Ri(8,O);break;case 23:break;case 22:var he=O.stateNode;O.memoizedState!==null?he._visibility&2?ol(j,O,U,Q,_):Ai(j,O):(he._visibility|=2,ol(j,O,U,Q,_)),_&&ne&2048&&Im(O.alternate,O);break;case 24:ol(j,O,U,Q,_),_&&ne&2048&&Bm(O.alternate,O);break;default:ol(j,O,U,Q,_)}s=s.sibling}}function Ai(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=n,d=s,_=d.flags;switch(d.tag){case 22:Ai(i,d),_&2048&&Im(d.alternate,d);break;case 24:Ai(i,d),_&2048&&Bm(d.alternate,d);break;default:Ai(i,d)}s=s.sibling}}var Mi=8192;function ll(n,s,i){if(n.subtreeFlags&Mi)for(n=n.child;n!==null;)n0(n,s,i),n=n.sibling}function n0(n,s,i){switch(n.tag){case 26:ll(n,s,i),n.flags&Mi&&n.memoizedState!==null&&XR(i,Bs,n.memoizedState,n.memoizedProps);break;case 5:ll(n,s,i);break;case 3:case 4:var d=Bs;Bs=Zu(n.stateNode.containerInfo),ll(n,s,i),Bs=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=Mi,Mi=16777216,ll(n,s,i),Mi=d):ll(n,s,i));break;default:ll(n,s,i)}}function s0(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Oi(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var d=s[i];Nn=d,r0(d,n)}s0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)a0(n),n=n.sibling}function a0(n){switch(n.tag){case 0:case 11:case 15:Oi(n),n.flags&2048&&ur(9,n,n.return);break;case 3:Oi(n);break;case 12:Oi(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Bu(n)):Oi(n);break;default:Oi(n)}}function Bu(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var d=s[i];Nn=d,r0(d,n)}s0(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:ur(8,s,s.return),Bu(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,Bu(s));break;default:Bu(s)}n=n.sibling}}function r0(n,s){for(;Nn!==null;){var i=Nn;switch(i.tag){case 0:case 11:case 15:ur(8,i,s);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var d=i.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:hi(i.memoizedState.cache)}if(d=i.child,d!==null)d.return=i,Nn=d;else e:for(i=n;Nn!==null;){d=Nn;var _=d.sibling,j=d.return;if(Xy(d),d===i){Nn=null;break e}if(_!==null){_.return=j,Nn=_;break e}Nn=j}}}var uR={getCacheForType:function(n){var s=Pn(xn),i=s.data.get(n);return i===void 0&&(i=n(),s.data.set(n,i)),i},cacheSignal:function(){return Pn(xn).controller.signal}},dR=typeof WeakMap=="function"?WeakMap:Map,At=0,Vt=null,_t=null,jt=0,Mt=0,hs=null,dr=!1,il=!1,Um=!1,za=0,ln=0,fr=0,ro=0,Hm=0,xs=0,cl=0,zi=null,rs=null,Vm=!1,Uu=0,o0=0,Hu=1/0,Vu=null,pr=null,jn=0,mr=null,ul=null,Da=0,qm=0,$m=null,l0=null,Di=0,Fm=null;function bs(){return(At&2)!==0&&jt!==0?jt&-jt:q.T!==null?Wm():mn()}function i0(){if(xs===0)if((jt&536870912)===0||Ct){var n=an;an<<=1,(an&3932160)===0&&(an=262144),xs=n}else xs=536870912;return n=ms.current,n!==null&&(n.flags|=32),xs}function os(n,s,i){(n===Vt&&(Mt===2||Mt===9)||n.cancelPendingCommit!==null)&&(dl(n,0),gr(n,jt,xs,!1)),pn(n,i),((At&2)===0||n!==Vt)&&(n===Vt&&((At&2)===0&&(ro|=i),ln===4&&gr(n,jt,xs,!1)),Zs(n))}function c0(n,s,i){if((At&6)!==0)throw Error(o(327));var d=!i&&(s&127)===0&&(s&n.expiredLanes)===0||fn(n,s),_=d?mR(n,s):Ym(n,s,!0),j=d;do{if(_===0){il&&!d&&gr(n,s,0,!1);break}else{if(i=n.current.alternate,j&&!fR(i)){_=Ym(n,s,!1),j=!1;continue}if(_===2){if(j=s,n.errorRecoveryDisabledLanes&j)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){s=O;e:{var U=n;_=zi;var Q=U.current.memoizedState.isDehydrated;if(Q&&(dl(U,O).flags|=256),O=Ym(U,O,!1),O!==2){if(Um&&!Q){U.errorRecoveryDisabledLanes|=j,ro|=j,_=4;break e}j=rs,rs=_,j!==null&&(rs===null?rs=j:rs.push.apply(rs,j))}_=O}if(j=!1,_!==2)continue}}if(_===1){dl(n,0),gr(n,s,0,!0);break}e:{switch(d=n,j=_,j){case 0:case 1:throw Error(o(345));case 4:if((s&4194048)!==s)break;case 6:gr(d,s,xs,!dr);break e;case 2:rs=null;break;case 3:case 5:break;default:throw Error(o(329))}if((s&62914560)===s&&(_=Uu+300-se(),10<_)){if(gr(d,s,xs,!dr),Gt(d,0,!0)!==0)break e;Da=s,d.timeoutHandle=U0(u0.bind(null,d,i,rs,Vu,Vm,s,xs,ro,cl,dr,j,"Throttled",-0,0),_);break e}u0(d,i,rs,Vu,Vm,s,xs,ro,cl,dr,j,null,-0,0)}}break}while(!0);Zs(n)}function u0(n,s,i,d,_,j,O,U,Q,ne,he,ye,re,ue){if(n.timeoutHandle=-1,ye=s.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:va},n0(s,j,ye);var qe=(j&62914560)===j?Uu-se():(j&4194048)===j?o0-se():0;if(qe=QR(ye,qe),qe!==null){Da=j,n.cancelPendingCommit=qe(b0.bind(null,n,s,j,i,d,_,O,U,Q,he,ye,null,re,ue)),gr(n,j,O,!ne);return}}b0(n,s,j,i,d,_,O,U,Q)}function fR(n){for(var s=n;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var d=0;d<i.length;d++){var _=i[d],j=_.getSnapshot;_=_.value;try{if(!fs(j(),_))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gr(n,s,i,d){s&=~Hm,s&=~ro,n.suspendedLanes|=s,n.pingedLanes&=~s,d&&(n.warmLanes|=s),d=n.expirationTimes;for(var _=s;0<_;){var j=31-ot(_),O=1<<j;d[j]=-1,_&=~O}i!==0&&xa(n,i,s)}function qu(){return(At&6)===0?(Pi(0),!1):!0}function Gm(){if(_t!==null){if(Mt===0)var n=_t.return;else n=_t,ka=Qr=null,im(n),tl=null,bi=0,n=_t;for(;n!==null;)Hy(n.alternate,n),n=n.return;_t=null}}function dl(n,s){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,MR(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Da=0,Gm(),Vt=n,_t=i=ja(n.current,null),jt=s,Mt=0,hs=null,dr=!1,il=fn(n,s),Um=!1,cl=xs=Hm=ro=fr=ln=0,rs=zi=null,Vm=!1,(s&8)!==0&&(s|=s&32);var d=n.entangledLanes;if(d!==0)for(n=n.entanglements,d&=s;0<d;){var _=31-ot(d),j=1<<_;s|=n[_],d&=~j}return za=s,uu(),i}function d0(n,s){ut=null,q.H=Ci,s===el||s===bu?(s=Nv(),Mt=3):s===Qp?(s=Nv(),Mt=4):Mt=s===km?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,hs=s,_t===null&&(ln=1,Mu(n,Ns(s,n.current)))}function f0(){var n=ms.current;return n===null?!0:(jt&4194048)===jt?As===null:(jt&62914560)===jt||(jt&536870912)!==0?n===As:!1}function p0(){var n=q.H;return q.H=Ci,n===null?Ci:n}function m0(){var n=q.A;return q.A=uR,n}function $u(){ln=4,dr||(jt&4194048)!==jt&&ms.current!==null||(il=!0),(fr&134217727)===0&&(ro&134217727)===0||Vt===null||gr(Vt,jt,xs,!1)}function Ym(n,s,i){var d=At;At|=2;var _=p0(),j=m0();(Vt!==n||jt!==s)&&(Vu=null,dl(n,s)),s=!1;var O=ln;e:do try{if(Mt!==0&&_t!==null){var U=_t,Q=hs;switch(Mt){case 8:Gm(),O=6;break e;case 3:case 2:case 9:case 6:ms.current===null&&(s=!0);var ne=Mt;if(Mt=0,hs=null,fl(n,U,Q,ne),i&&il){O=0;break e}break;default:ne=Mt,Mt=0,hs=null,fl(n,U,Q,ne)}}pR(),O=ln;break}catch(he){d0(n,he)}while(!0);return s&&n.shellSuspendCounter++,ka=Qr=null,At=d,q.H=_,q.A=j,_t===null&&(Vt=null,jt=0,uu()),O}function pR(){for(;_t!==null;)g0(_t)}function mR(n,s){var i=At;At|=2;var d=p0(),_=m0();Vt!==n||jt!==s?(Vu=null,Hu=se()+500,dl(n,s)):il=fn(n,s);e:do try{if(Mt!==0&&_t!==null){s=_t;var j=hs;t:switch(Mt){case 1:Mt=0,hs=null,fl(n,s,j,1);break;case 2:case 9:if(Sv(j)){Mt=0,hs=null,h0(s);break}s=function(){Mt!==2&&Mt!==9||Vt!==n||(Mt=7),Zs(n)},j.then(s,s);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:Sv(j)?(Mt=0,hs=null,h0(s)):(Mt=0,hs=null,fl(n,s,j,7));break;case 5:var O=null;switch(_t.tag){case 26:O=_t.memoizedState;case 5:case 27:var U=_t;if(O?t1(O):U.stateNode.complete){Mt=0,hs=null;var Q=U.sibling;if(Q!==null)_t=Q;else{var ne=U.return;ne!==null?(_t=ne,Fu(ne)):_t=null}break t}}Mt=0,hs=null,fl(n,s,j,5);break;case 6:Mt=0,hs=null,fl(n,s,j,6);break;case 8:Gm(),ln=6;break e;default:throw Error(o(462))}}gR();break}catch(he){d0(n,he)}while(!0);return ka=Qr=null,q.H=d,q.A=_,At=i,_t!==null?0:(Vt=null,jt=0,uu(),ln)}function gR(){for(;_t!==null&&!Le();)g0(_t)}function g0(n){var s=By(n.alternate,n,za);n.memoizedProps=n.pendingProps,s===null?Fu(n):_t=s}function h0(n){var s=n,i=s.alternate;switch(s.tag){case 15:case 0:s=Oy(i,s,s.pendingProps,s.type,void 0,jt);break;case 11:s=Oy(i,s,s.pendingProps,s.type.render,s.ref,jt);break;case 5:im(s);default:Hy(i,s),s=_t=mv(s,za),s=By(i,s,za)}n.memoizedProps=n.pendingProps,s===null?Fu(n):_t=s}function fl(n,s,i,d){ka=Qr=null,im(s),tl=null,bi=0;var _=s.return;try{if(sR(n,_,s,i,jt)){ln=1,Mu(n,Ns(i,n.current)),_t=null;return}}catch(j){if(_!==null)throw _t=_,j;ln=1,Mu(n,Ns(i,n.current)),_t=null;return}s.flags&32768?(Ct||d===1?n=!0:il||(jt&536870912)!==0?n=!1:(dr=n=!0,(d===2||d===9||d===3||d===6)&&(d=ms.current,d!==null&&d.tag===13&&(d.flags|=16384))),x0(s,n)):Fu(s)}function Fu(n){var s=n;do{if((s.flags&32768)!==0){x0(s,dr);return}n=s.return;var i=oR(s.alternate,s,za);if(i!==null){_t=i;return}if(s=s.sibling,s!==null){_t=s;return}_t=s=n}while(s!==null);ln===0&&(ln=5)}function x0(n,s){do{var i=lR(n.alternate,n);if(i!==null){i.flags&=32767,_t=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(n=n.sibling,n!==null)){_t=n;return}_t=n=i}while(n!==null);ln=6,_t=null}function b0(n,s,i,d,_,j,O,U,Q){n.cancelPendingCommit=null;do Gu();while(jn!==0);if((At&6)!==0)throw Error(o(327));if(s!==null){if(s===n.current)throw Error(o(177));if(j=s.lanes|s.childLanes,j|=Dp,ws(n,i,j,O,U,Q),n===Vt&&(_t=Vt=null,jt=0),ul=s,mr=n,Da=i,qm=j,$m=_,l0=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,_R(Oe,function(){return w0(),null})):(n.callbackNode=null,n.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,_=Y.p,Y.p=2,O=At,At|=4;try{iR(n,s,i)}finally{At=O,Y.p=_,q.T=d}}jn=1,_0(),v0(),y0()}}function _0(){if(jn===1){jn=0;var n=mr,s=ul,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=q.T,q.T=null;var d=Y.p;Y.p=2;var _=At;At|=4;try{Jy(s,n);var j=rg,O=rv(n.containerInfo),U=j.focusedElem,Q=j.selectionRange;if(O!==U&&U&&U.ownerDocument&&av(U.ownerDocument.documentElement,U)){if(Q!==null&&Tp(U)){var ne=Q.start,he=Q.end;if(he===void 0&&(he=ne),"selectionStart"in U)U.selectionStart=ne,U.selectionEnd=Math.min(he,U.value.length);else{var ye=U.ownerDocument||document,re=ye&&ye.defaultView||window;if(re.getSelection){var ue=re.getSelection(),qe=U.textContent.length,st=Math.min(Q.start,qe),Lt=Q.end===void 0?st:Math.min(Q.end,qe);!ue.extend&&st>Lt&&(O=Lt,Lt=st,st=O);var J=sv(U,st),W=sv(U,Lt);if(J&&W&&(ue.rangeCount!==1||ue.anchorNode!==J.node||ue.anchorOffset!==J.offset||ue.focusNode!==W.node||ue.focusOffset!==W.offset)){var te=ye.createRange();te.setStart(J.node,J.offset),ue.removeAllRanges(),st>Lt?(ue.addRange(te),ue.extend(W.node,W.offset)):(te.setEnd(W.node,W.offset),ue.addRange(te))}}}}for(ye=[],ue=U;ue=ue.parentNode;)ue.nodeType===1&&ye.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof U.focus=="function"&&U.focus(),U=0;U<ye.length;U++){var xe=ye[U];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}ad=!!ag,rg=ag=null}finally{At=_,Y.p=d,q.T=i}}n.current=s,jn=2}}function v0(){if(jn===2){jn=0;var n=mr,s=ul,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=q.T,q.T=null;var d=Y.p;Y.p=2;var _=At;At|=4;try{Ky(n,s.alternate,s)}finally{At=_,Y.p=d,q.T=i}}jn=3}}function y0(){if(jn===4||jn===3){jn=0,Ie();var n=mr,s=ul,i=Da,d=l0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?jn=5:(jn=0,ul=mr=null,j0(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(pr=null),zt(i),s=s.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(Me,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=q.T,_=Y.p,Y.p=2,q.T=null;try{for(var j=n.onRecoverableError,O=0;O<d.length;O++){var U=d[O];j(U.value,{componentStack:U.stack})}}finally{q.T=s,Y.p=_}}(Da&3)!==0&&Gu(),Zs(n),_=n.pendingLanes,(i&261930)!==0&&(_&42)!==0?n===Fm?Di++:(Di=0,Fm=n):Di=0,Pi(0)}}function j0(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,hi(s)))}function Gu(){return _0(),v0(),y0(),w0()}function w0(){if(jn!==5)return!1;var n=mr,s=qm;qm=0;var i=zt(Da),d=q.T,_=Y.p;try{Y.p=32>i?32:i,q.T=null,i=$m,$m=null;var j=mr,O=Da;if(jn=0,ul=mr=null,Da=0,(At&6)!==0)throw Error(o(331));var U=At;if(At|=4,a0(j.current),t0(j,j.current,O,i),At=U,Pi(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(Me,j)}catch{}return!0}finally{Y.p=_,q.T=d,j0(n,s)}}function k0(n,s,i){s=Ns(i,s),s=wm(n.stateNode,s,2),n=lr(n,s,2),n!==null&&(pn(n,2),Zs(n))}function Ot(n,s,i){if(n.tag===3)k0(n,n,i);else for(;s!==null;){if(s.tag===3){k0(s,n,i);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(pr===null||!pr.has(d))){n=Ns(i,n),i=Sy(2),d=lr(s,i,2),d!==null&&(Cy(i,d,s,n),pn(d,2),Zs(d));break}}s=s.return}}function Km(n,s,i){var d=n.pingCache;if(d===null){d=n.pingCache=new dR;var _=new Set;d.set(s,_)}else _=d.get(s),_===void 0&&(_=new Set,d.set(s,_));_.has(i)||(Um=!0,_.add(i),n=hR.bind(null,n,s,i),s.then(n,n))}function hR(n,s,i){var d=n.pingCache;d!==null&&d.delete(s),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Vt===n&&(jt&i)===i&&(ln===4||ln===3&&(jt&62914560)===jt&&300>se()-Uu?(At&2)===0&&dl(n,0):Hm|=i,cl===jt&&(cl=0)),Zs(n)}function S0(n,s){s===0&&(s=ds()),n=Yr(n,s),n!==null&&(pn(n,s),Zs(n))}function xR(n){var s=n.memoizedState,i=0;s!==null&&(i=s.retryLane),S0(n,i)}function bR(n,s){var i=0;switch(n.tag){case 31:case 13:var d=n.stateNode,_=n.memoizedState;_!==null&&(i=_.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(o(314))}d!==null&&d.delete(s),S0(n,i)}function _R(n,s){return Ce(n,s)}var Yu=null,pl=null,Xm=!1,Ku=!1,Qm=!1,hr=0;function Zs(n){n!==pl&&n.next===null&&(pl===null?Yu=pl=n:pl=pl.next=n),Ku=!0,Xm||(Xm=!0,yR())}function Pi(n,s){if(!Qm&&Ku){Qm=!0;do for(var i=!1,d=Yu;d!==null;){if(n!==0){var _=d.pendingLanes;if(_===0)var j=0;else{var O=d.suspendedLanes,U=d.pingedLanes;j=(1<<31-ot(42|n)+1)-1,j&=_&~(O&~U),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(i=!0,R0(d,j))}else j=jt,j=Gt(d,d===Vt?j:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(j&3)===0||fn(d,j)||(i=!0,R0(d,j));d=d.next}while(i);Qm=!1}}function vR(){C0()}function C0(){Ku=Xm=!1;var n=0;hr!==0&&AR()&&(n=hr);for(var s=se(),i=null,d=Yu;d!==null;){var _=d.next,j=N0(d,s);j===0?(d.next=null,i===null?Yu=_:i.next=_,_===null&&(pl=i)):(i=d,(n!==0||(j&3)!==0)&&(Ku=!0)),d=_}jn!==0&&jn!==5||Pi(n),hr!==0&&(hr=0)}function N0(n,s){for(var i=n.suspendedLanes,d=n.pingedLanes,_=n.expirationTimes,j=n.pendingLanes&-62914561;0<j;){var O=31-ot(j),U=1<<O,Q=_[O];Q===-1?((U&i)===0||(U&d)!==0)&&(_[O]=es(U,s)):Q<=s&&(n.expiredLanes|=U),j&=~U}if(s=Vt,i=jt,i=Gt(n,n===s?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,i===0||n===s&&(Mt===2||Mt===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&Pe(d),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||fn(n,i)){if(s=i&-i,s===n.callbackPriority)return s;switch(d!==null&&Pe(d),zt(i)){case 2:case 8:i=Re;break;case 32:i=Oe;break;case 268435456:i=at;break;default:i=Oe}return d=E0.bind(null,n),i=Ce(i,d),n.callbackPriority=s,n.callbackNode=i,s}return d!==null&&d!==null&&Pe(d),n.callbackPriority=2,n.callbackNode=null,2}function E0(n,s){if(jn!==0&&jn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Gu()&&n.callbackNode!==i)return null;var d=jt;return d=Gt(n,n===Vt?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(c0(n,d,s),N0(n,se()),n.callbackNode!=null&&n.callbackNode===i?E0.bind(null,n):null)}function R0(n,s){if(Gu())return null;c0(n,s,!0)}function yR(){OR(function(){(At&6)!==0?Ce($e,vR):C0()})}function Wm(){if(hr===0){var n=Zo;n===0&&(n=Et,Et<<=1,(Et&261888)===0&&(Et=256)),hr=n}return hr}function T0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:nu(""+n)}function A0(n,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,n.id&&i.setAttribute("form",n.id),s.parentNode.insertBefore(i,s),n=new FormData(n),i.parentNode.removeChild(i),n}function jR(n,s,i,d,_){if(s==="submit"&&i&&i.stateNode===_){var j=T0((_[zn]||null).action),O=d.submitter;O&&(s=(s=O[zn]||null)?T0(s.formAction):O.getAttribute("formAction"),s!==null&&(j=s,O=null));var U=new ou("action","action",null,d,_);n.push({event:U,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(hr!==0){var Q=O?A0(_,O):new FormData(_);xm(i,{pending:!0,data:Q,method:_.method,action:j},null,Q)}}else typeof j=="function"&&(U.preventDefault(),Q=O?A0(_,O):new FormData(_),xm(i,{pending:!0,data:Q,method:_.method,action:j},j,Q))},currentTarget:_}]})}}for(var Zm=0;Zm<zp.length;Zm++){var Jm=zp[Zm],wR=Jm.toLowerCase(),kR=Jm[0].toUpperCase()+Jm.slice(1);Is(wR,"on"+kR)}Is(iv,"onAnimationEnd"),Is(cv,"onAnimationIteration"),Is(uv,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(UE,"onTransitionRun"),Is(HE,"onTransitionStart"),Is(VE,"onTransitionCancel"),Is(dv,"onTransitionEnd"),Io("onMouseEnter",["mouseout","mouseover"]),Io("onMouseLeave",["mouseout","mouseover"]),Io("onPointerEnter",["pointerout","pointerover"]),Io("onPointerLeave",["pointerout","pointerover"]),qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qr("onBeforeInput",["compositionend","keypress","textInput","paste"]),qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Li="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(" "),SR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Li));function M0(n,s){s=(s&4)!==0;for(var i=0;i<n.length;i++){var d=n[i],_=d.event;d=d.listeners;e:{var j=void 0;if(s)for(var O=d.length-1;0<=O;O--){var U=d[O],Q=U.instance,ne=U.currentTarget;if(U=U.listener,Q!==j&&_.isPropagationStopped())break e;j=U,_.currentTarget=ne;try{j(_)}catch(he){cu(he)}_.currentTarget=null,j=Q}else for(O=0;O<d.length;O++){if(U=d[O],Q=U.instance,ne=U.currentTarget,U=U.listener,Q!==j&&_.isPropagationStopped())break e;j=U,_.currentTarget=ne;try{j(_)}catch(he){cu(he)}_.currentTarget=null,j=Q}}}}function vt(n,s){var i=s[ni];i===void 0&&(i=s[ni]=new Set);var d=n+"__bubble";i.has(d)||(O0(s,n,2,!1),i.add(d))}function eg(n,s,i){var d=0;s&&(d|=4),O0(i,n,d,s)}var Xu="_reactListening"+Math.random().toString(36).slice(2);function tg(n){if(!n[Xu]){n[Xu]=!0,C_.forEach(function(i){i!=="selectionchange"&&(SR.has(i)||eg(i,!1,n),eg(i,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Xu]||(s[Xu]=!0,eg("selectionchange",!1,s))}}function O0(n,s,i,d){switch(i1(s)){case 2:var _=JR;break;case 8:_=eT;break;default:_=hg}i=_.bind(null,s,i,n),_=void 0,!yp||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(_=!0),d?_!==void 0?n.addEventListener(s,i,{capture:!0,passive:_}):n.addEventListener(s,i,!0):_!==void 0?n.addEventListener(s,i,{passive:_}):n.addEventListener(s,i,!1)}function ng(n,s,i,d,_){var j=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var O=d.tag;if(O===3||O===4){var U=d.stateNode.containerInfo;if(U===_)break;if(O===4)for(O=d.return;O!==null;){var Q=O.tag;if((Q===3||Q===4)&&O.stateNode.containerInfo===_)return;O=O.return}for(;U!==null;){if(O=Do(U),O===null)return;if(Q=O.tag,Q===5||Q===6||Q===26||Q===27){d=j=O;continue e}U=U.parentNode}}d=d.return}I_(function(){var ne=j,he=_p(i),ye=[];e:{var re=fv.get(n);if(re!==void 0){var ue=ou,qe=n;switch(n){case"keypress":if(au(i)===0)break e;case"keydown":case"keyup":ue=bE;break;case"focusin":qe="focus",ue=Sp;break;case"focusout":qe="blur",ue=Sp;break;case"beforeblur":case"afterblur":ue=Sp;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=H_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=oE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=yE;break;case iv:case cv:case uv:ue=cE;break;case dv:ue=wE;break;case"scroll":case"scrollend":ue=aE;break;case"wheel":ue=SE;break;case"copy":case"cut":case"paste":ue=dE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=q_;break;case"toggle":case"beforetoggle":ue=NE}var st=(s&4)!==0,Lt=!st&&(n==="scroll"||n==="scrollend"),J=st?re!==null?re+"Capture":null:re;st=[];for(var W=ne,te;W!==null;){var xe=W;if(te=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||te===null||J===null||(xe=ri(W,J),xe!=null&&st.push(Ii(W,xe,te))),Lt)break;W=W.return}0<st.length&&(re=new ue(re,qe,null,i,he),ye.push({event:re,listeners:st}))}}if((s&7)===0){e:{if(re=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",re&&i!==bp&&(qe=i.relatedTarget||i.fromElement)&&(Do(qe)||qe[Ks]))break e;if((ue||re)&&(re=he.window===he?he:(re=he.ownerDocument)?re.defaultView||re.parentWindow:window,ue?(qe=i.relatedTarget||i.toElement,ue=ne,qe=qe?Do(qe):null,qe!==null&&(Lt=c(qe),st=qe.tag,qe!==Lt||st!==5&&st!==27&&st!==6)&&(qe=null)):(ue=null,qe=ne),ue!==qe)){if(st=H_,xe="onMouseLeave",J="onMouseEnter",W="mouse",(n==="pointerout"||n==="pointerover")&&(st=q_,xe="onPointerLeave",J="onPointerEnter",W="pointer"),Lt=ue==null?re:ai(ue),te=qe==null?re:ai(qe),re=new st(xe,W+"leave",ue,i,he),re.target=Lt,re.relatedTarget=te,xe=null,Do(he)===ne&&(st=new st(J,W+"enter",qe,i,he),st.target=te,st.relatedTarget=Lt,xe=st),Lt=xe,ue&&qe)t:{for(st=CR,J=ue,W=qe,te=0,xe=J;xe;xe=st(xe))te++;xe=0;for(var Ze=W;Ze;Ze=st(Ze))xe++;for(;0<te-xe;)J=st(J),te--;for(;0<xe-te;)W=st(W),xe--;for(;te--;){if(J===W||W!==null&&J===W.alternate){st=J;break t}J=st(J),W=st(W)}st=null}else st=null;ue!==null&&z0(ye,re,ue,st,!1),qe!==null&&Lt!==null&&z0(ye,Lt,qe,st,!0)}}e:{if(re=ne?ai(ne):window,ue=re.nodeName&&re.nodeName.toLowerCase(),ue==="select"||ue==="input"&&re.type==="file")var Rt=W_;else if(X_(re))if(Z_)Rt=LE;else{Rt=DE;var Ge=zE}else ue=re.nodeName,!ue||ue.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ne&&xp(ne.elementType)&&(Rt=W_):Rt=PE;if(Rt&&(Rt=Rt(n,ne))){Q_(ye,Rt,i,he);break e}Ge&&Ge(n,re,ne),n==="focusout"&&ne&&re.type==="number"&&ne.memoizedProps.value!=null&&hp(re,"number",re.value)}switch(Ge=ne?ai(ne):window,n){case"focusin":(X_(Ge)||Ge.contentEditable==="true")&&($o=Ge,Ap=ne,pi=null);break;case"focusout":pi=Ap=$o=null;break;case"mousedown":Mp=!0;break;case"contextmenu":case"mouseup":case"dragend":Mp=!1,ov(ye,i,he);break;case"selectionchange":if(BE)break;case"keydown":case"keyup":ov(ye,i,he)}var dt;if(Np)e:{switch(n){case"compositionstart":var wt="onCompositionStart";break e;case"compositionend":wt="onCompositionEnd";break e;case"compositionupdate":wt="onCompositionUpdate";break e}wt=void 0}else qo?Y_(n,i)&&(wt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(wt="onCompositionStart");wt&&($_&&i.locale!=="ko"&&(qo||wt!=="onCompositionStart"?wt==="onCompositionEnd"&&qo&&(dt=B_()):(er=he,jp="value"in er?er.value:er.textContent,qo=!0)),Ge=Qu(ne,wt),0<Ge.length&&(wt=new V_(wt,n,null,i,he),ye.push({event:wt,listeners:Ge}),dt?wt.data=dt:(dt=K_(i),dt!==null&&(wt.data=dt)))),(dt=RE?TE(n,i):AE(n,i))&&(wt=Qu(ne,"onBeforeInput"),0<wt.length&&(Ge=new V_("onBeforeInput","beforeinput",null,i,he),ye.push({event:Ge,listeners:wt}),Ge.data=dt)),jR(ye,n,ne,i,he)}M0(ye,s)})}function Ii(n,s,i){return{instance:n,listener:s,currentTarget:i}}function Qu(n,s){for(var i=s+"Capture",d=[];n!==null;){var _=n,j=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||j===null||(_=ri(n,i),_!=null&&d.unshift(Ii(n,_,j)),_=ri(n,s),_!=null&&d.push(Ii(n,_,j))),n.tag===3)return d;n=n.return}return[]}function CR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function z0(n,s,i,d,_){for(var j=s._reactName,O=[];i!==null&&i!==d;){var U=i,Q=U.alternate,ne=U.stateNode;if(U=U.tag,Q!==null&&Q===d)break;U!==5&&U!==26&&U!==27||ne===null||(Q=ne,_?(ne=ri(i,j),ne!=null&&O.unshift(Ii(i,ne,Q))):_||(ne=ri(i,j),ne!=null&&O.push(Ii(i,ne,Q)))),i=i.return}O.length!==0&&n.push({event:s,listeners:O})}var NR=/\r\n?/g,ER=/\u0000|\uFFFD/g;function D0(n){return(typeof n=="string"?n:""+n).replace(NR,`
|
|
49
|
+
`).replace(ER,"")}function P0(n,s){return s=D0(s),D0(n)===s}function Pt(n,s,i,d,_,j){switch(i){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Uo(n,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Uo(n,""+d);break;case"className":eu(n,"class",d);break;case"tabIndex":eu(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":eu(n,i,d);break;case"style":P_(n,d,j);break;case"data":if(s!=="object"){eu(n,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||i!=="href")){n.removeAttribute(i);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=nu(""+d),n.setAttribute(i,d);break;case"action":case"formAction":if(typeof d=="function"){n.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 j=="function"&&(i==="formAction"?(s!=="input"&&Pt(n,s,"name",_.name,_,null),Pt(n,s,"formEncType",_.formEncType,_,null),Pt(n,s,"formMethod",_.formMethod,_,null),Pt(n,s,"formTarget",_.formTarget,_,null)):(Pt(n,s,"encType",_.encType,_,null),Pt(n,s,"method",_.method,_,null),Pt(n,s,"target",_.target,_,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=nu(""+d),n.setAttribute(i,d);break;case"onClick":d!=null&&(n.onclick=va);break;case"onScroll":d!=null&&vt("scroll",n);break;case"onScrollEnd":d!=null&&vt("scrollend",n);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){n.removeAttribute("xlink:href");break}i=nu(""+d),n.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":d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""+d):n.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":d&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":d===!0?n.setAttribute(i,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,d):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(i,d):n.removeAttribute(i);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(i):n.setAttribute(i,d);break;case"popover":vt("beforetoggle",n),vt("toggle",n),Jc(n,"popover",d);break;case"xlinkActuate":_a(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":_a(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":_a(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":_a(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":_a(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":_a(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":_a(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":_a(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":_a(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Jc(n,"is",d);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=nE.get(i)||i,Jc(n,i,d))}}function sg(n,s,i,d,_,j){switch(i){case"style":P_(n,d,j);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof d=="string"?Uo(n,d):(typeof d=="number"||typeof d=="bigint")&&Uo(n,""+d);break;case"onScroll":d!=null&&vt("scroll",n);break;case"onScrollEnd":d!=null&&vt("scrollend",n);break;case"onClick":d!=null&&(n.onclick=va);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!N_.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(_=i.endsWith("Capture"),s=i.slice(2,_?i.length-7:void 0),j=n[zn]||null,j=j!=null?j[i]:null,typeof j=="function"&&n.removeEventListener(s,j,_),typeof d=="function")){typeof j!="function"&&j!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(s,d,_);break e}i in n?n[i]=d:d===!0?n.setAttribute(i,""):Jc(n,i,d)}}}function In(n,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",n),vt("load",n);var d=!1,_=!1,j;for(j in i)if(i.hasOwnProperty(j)){var O=i[j];if(O!=null)switch(j){case"src":d=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:Pt(n,s,j,O,i,null)}}_&&Pt(n,s,"srcSet",i.srcSet,i,null),d&&Pt(n,s,"src",i.src,i,null);return;case"input":vt("invalid",n);var U=j=O=_=null,Q=null,ne=null;for(d in i)if(i.hasOwnProperty(d)){var he=i[d];if(he!=null)switch(d){case"name":_=he;break;case"type":O=he;break;case"checked":Q=he;break;case"defaultChecked":ne=he;break;case"value":j=he;break;case"defaultValue":U=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(o(137,s));break;default:Pt(n,s,d,he,i,null)}}M_(n,j,U,Q,ne,O,_,!1);return;case"select":vt("invalid",n),d=O=j=null;for(_ in i)if(i.hasOwnProperty(_)&&(U=i[_],U!=null))switch(_){case"value":j=U;break;case"defaultValue":O=U;break;case"multiple":d=U;default:Pt(n,s,_,U,i,null)}s=j,i=O,n.multiple=!!d,s!=null?Bo(n,!!d,s,!1):i!=null&&Bo(n,!!d,i,!0);return;case"textarea":vt("invalid",n),j=_=d=null;for(O in i)if(i.hasOwnProperty(O)&&(U=i[O],U!=null))switch(O){case"value":d=U;break;case"defaultValue":_=U;break;case"children":j=U;break;case"dangerouslySetInnerHTML":if(U!=null)throw Error(o(91));break;default:Pt(n,s,O,U,i,null)}z_(n,d,_,j);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(d=i[Q],d!=null))switch(Q){case"selected":n.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Pt(n,s,Q,d,i,null)}return;case"dialog":vt("beforetoggle",n),vt("toggle",n),vt("cancel",n),vt("close",n);break;case"iframe":case"object":vt("load",n);break;case"video":case"audio":for(d=0;d<Li.length;d++)vt(Li[d],n);break;case"image":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"embed":case"source":case"link":vt("error",n),vt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in i)if(i.hasOwnProperty(ne)&&(d=i[ne],d!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,s));default:Pt(n,s,ne,d,i,null)}return;default:if(xp(s)){for(he in i)i.hasOwnProperty(he)&&(d=i[he],d!==void 0&&sg(n,s,he,d,i,void 0));return}}for(U in i)i.hasOwnProperty(U)&&(d=i[U],d!=null&&Pt(n,s,U,d,i,null))}function RR(n,s,i,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,j=null,O=null,U=null,Q=null,ne=null,he=null;for(ue in i){var ye=i[ue];if(i.hasOwnProperty(ue)&&ye!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=ye;default:d.hasOwnProperty(ue)||Pt(n,s,ue,null,d,ye)}}for(var re in d){var ue=d[re];if(ye=i[re],d.hasOwnProperty(re)&&(ue!=null||ye!=null))switch(re){case"type":j=ue;break;case"name":_=ue;break;case"checked":ne=ue;break;case"defaultChecked":he=ue;break;case"value":O=ue;break;case"defaultValue":U=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(o(137,s));break;default:ue!==ye&&Pt(n,s,re,ue,d,ye)}}gp(n,O,U,Q,ne,he,j,_);return;case"select":ue=O=U=re=null;for(j in i)if(Q=i[j],i.hasOwnProperty(j)&&Q!=null)switch(j){case"value":break;case"multiple":ue=Q;default:d.hasOwnProperty(j)||Pt(n,s,j,null,d,Q)}for(_ in d)if(j=d[_],Q=i[_],d.hasOwnProperty(_)&&(j!=null||Q!=null))switch(_){case"value":re=j;break;case"defaultValue":U=j;break;case"multiple":O=j;default:j!==Q&&Pt(n,s,_,j,d,Q)}s=U,i=O,d=ue,re!=null?Bo(n,!!i,re,!1):!!d!=!!i&&(s!=null?Bo(n,!!i,s,!0):Bo(n,!!i,i?[]:"",!1));return;case"textarea":ue=re=null;for(U in i)if(_=i[U],i.hasOwnProperty(U)&&_!=null&&!d.hasOwnProperty(U))switch(U){case"value":break;case"children":break;default:Pt(n,s,U,null,d,_)}for(O in d)if(_=d[O],j=i[O],d.hasOwnProperty(O)&&(_!=null||j!=null))switch(O){case"value":re=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(o(91));break;default:_!==j&&Pt(n,s,O,_,d,j)}O_(n,re,ue);return;case"option":for(var qe in i)if(re=i[qe],i.hasOwnProperty(qe)&&re!=null&&!d.hasOwnProperty(qe))switch(qe){case"selected":n.selected=!1;break;default:Pt(n,s,qe,null,d,re)}for(Q in d)if(re=d[Q],ue=i[Q],d.hasOwnProperty(Q)&&re!==ue&&(re!=null||ue!=null))switch(Q){case"selected":n.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:Pt(n,s,Q,re,d,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 st in i)re=i[st],i.hasOwnProperty(st)&&re!=null&&!d.hasOwnProperty(st)&&Pt(n,s,st,null,d,re);for(ne in d)if(re=d[ne],ue=i[ne],d.hasOwnProperty(ne)&&re!==ue&&(re!=null||ue!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(o(137,s));break;default:Pt(n,s,ne,re,d,ue)}return;default:if(xp(s)){for(var Lt in i)re=i[Lt],i.hasOwnProperty(Lt)&&re!==void 0&&!d.hasOwnProperty(Lt)&&sg(n,s,Lt,void 0,d,re);for(he in d)re=d[he],ue=i[he],!d.hasOwnProperty(he)||re===ue||re===void 0&&ue===void 0||sg(n,s,he,re,d,ue);return}}for(var J in i)re=i[J],i.hasOwnProperty(J)&&re!=null&&!d.hasOwnProperty(J)&&Pt(n,s,J,null,d,re);for(ye in d)re=d[ye],ue=i[ye],!d.hasOwnProperty(ye)||re===ue||re==null&&ue==null||Pt(n,s,ye,re,d,ue)}function L0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function TR(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,i=performance.getEntriesByType("resource"),d=0;d<i.length;d++){var _=i[d],j=_.transferSize,O=_.initiatorType,U=_.duration;if(j&&U&&L0(O)){for(O=0,U=_.responseEnd,d+=1;d<i.length;d++){var Q=i[d],ne=Q.startTime;if(ne>U)break;var he=Q.transferSize,ye=Q.initiatorType;he&&L0(ye)&&(Q=Q.responseEnd,O+=he*(Q<U?1:(U-ne)/(Q-ne)))}if(--d,s+=8*(j+O)/(_.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var ag=null,rg=null;function Wu(n){return n.nodeType===9?n:n.ownerDocument}function I0(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function B0(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function og(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var lg=null;function AR(){var n=window.event;return n&&n.type==="popstate"?n===lg?!1:(lg=n,!0):(lg=null,!1)}var U0=typeof setTimeout=="function"?setTimeout:void 0,MR=typeof clearTimeout=="function"?clearTimeout:void 0,H0=typeof Promise=="function"?Promise:void 0,OR=typeof queueMicrotask=="function"?queueMicrotask:typeof H0<"u"?function(n){return H0.resolve(null).then(n).catch(zR)}:U0;function zR(n){setTimeout(function(){throw n})}function xr(n){return n==="head"}function V0(n,s){var i=s,d=0;do{var _=i.nextSibling;if(n.removeChild(i),_&&_.nodeType===8)if(i=_.data,i==="/$"||i==="/&"){if(d===0){n.removeChild(_),xl(s);return}d--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")d++;else if(i==="html")Bi(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Bi(i);for(var j=i.firstChild;j;){var O=j.nextSibling,U=j.nodeName;j[si]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&j.rel.toLowerCase()==="stylesheet"||i.removeChild(j),j=O}}else i==="body"&&Bi(n.ownerDocument.body);i=_}while(i);xl(s)}function q0(n,s){var i=n;n=0;do{var d=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=d}while(i)}function ig(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":ig(i),pp(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function DR(n,s,i,d){for(;n.nodeType===1;){var _=i;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[si])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(j=n.getAttribute("rel"),j==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(j!==_.rel||n.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||n.getAttribute("title")!==(_.title==null?null:_.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(j=n.getAttribute("src"),(j!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&j&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var j=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===j)return n}else return n;if(n=Ms(n.nextSibling),n===null)break}return null}function PR(n,s,i){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Ms(n.nextSibling),n===null))return null;return n}function $0(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Ms(n.nextSibling),n===null))return null;return n}function cg(n){return n.data==="$?"||n.data==="$~"}function ug(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function LR(n,s){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||i.readyState!=="loading")s();else{var d=function(){s(),i.removeEventListener("DOMContentLoaded",d)};i.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function Ms(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var dg=null;function F0(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(s===0)return Ms(n.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}n=n.nextSibling}return null}function G0(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return n;s--}else i!=="/$"&&i!=="/&"||s++}n=n.previousSibling}return null}function Y0(n,s,i){switch(s=Wu(i),n){case"html":if(n=s.documentElement,!n)throw Error(o(452));return n;case"head":if(n=s.head,!n)throw Error(o(453));return n;case"body":if(n=s.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function Bi(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);pp(n)}var Os=new Map,K0=new Set;function Zu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Pa=Y.d;Y.d={f:IR,r:BR,D:UR,C:HR,L:VR,m:qR,X:FR,S:$R,M:GR};function IR(){var n=Pa.f(),s=qu();return n||s}function BR(n){var s=Po(n);s!==null&&s.tag===5&&s.type==="form"?dy(s):Pa.r(n)}var ml=typeof document>"u"?null:document;function X0(n,s,i){var d=ml;if(d&&typeof s=="string"&&s){var _=Ss(s);_='link[rel="'+n+'"][href="'+_+'"]',typeof i=="string"&&(_+='[crossorigin="'+i+'"]'),K0.has(_)||(K0.add(_),n={rel:n,crossOrigin:i,href:s},d.querySelector(_)===null&&(s=d.createElement("link"),In(s,"link",n),Cn(s),d.head.appendChild(s)))}}function UR(n){Pa.D(n),X0("dns-prefetch",n,null)}function HR(n,s){Pa.C(n,s),X0("preconnect",n,s)}function VR(n,s,i){Pa.L(n,s,i);var d=ml;if(d&&n&&s){var _='link[rel="preload"][as="'+Ss(s)+'"]';s==="image"&&i&&i.imageSrcSet?(_+='[imagesrcset="'+Ss(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(_+='[imagesizes="'+Ss(i.imageSizes)+'"]')):_+='[href="'+Ss(n)+'"]';var j=_;switch(s){case"style":j=gl(n);break;case"script":j=hl(n)}Os.has(j)||(n=b({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:n,as:s},i),Os.set(j,n),d.querySelector(_)!==null||s==="style"&&d.querySelector(Ui(j))||s==="script"&&d.querySelector(Hi(j))||(s=d.createElement("link"),In(s,"link",n),Cn(s),d.head.appendChild(s)))}}function qR(n,s){Pa.m(n,s);var i=ml;if(i&&n){var d=s&&typeof s.as=="string"?s.as:"script",_='link[rel="modulepreload"][as="'+Ss(d)+'"][href="'+Ss(n)+'"]',j=_;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=hl(n)}if(!Os.has(j)&&(n=b({rel:"modulepreload",href:n},s),Os.set(j,n),i.querySelector(_)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Hi(j)))return}d=i.createElement("link"),In(d,"link",n),Cn(d),i.head.appendChild(d)}}}function $R(n,s,i){Pa.S(n,s,i);var d=ml;if(d&&n){var _=Lo(d).hoistableStyles,j=gl(n);s=s||"default";var O=_.get(j);if(!O){var U={loading:0,preload:null};if(O=d.querySelector(Ui(j)))U.loading=5;else{n=b({rel:"stylesheet",href:n,"data-precedence":s},i),(i=Os.get(j))&&fg(n,i);var Q=O=d.createElement("link");Cn(Q),In(Q,"link",n),Q._p=new Promise(function(ne,he){Q.onload=ne,Q.onerror=he}),Q.addEventListener("load",function(){U.loading|=1}),Q.addEventListener("error",function(){U.loading|=2}),U.loading|=4,Ju(O,s,d)}O={type:"stylesheet",instance:O,count:1,state:U},_.set(j,O)}}}function FR(n,s){Pa.X(n,s);var i=ml;if(i&&n){var d=Lo(i).hoistableScripts,_=hl(n),j=d.get(_);j||(j=i.querySelector(Hi(_)),j||(n=b({src:n,async:!0},s),(s=Os.get(_))&&pg(n,s),j=i.createElement("script"),Cn(j),In(j,"link",n),i.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(_,j))}}function GR(n,s){Pa.M(n,s);var i=ml;if(i&&n){var d=Lo(i).hoistableScripts,_=hl(n),j=d.get(_);j||(j=i.querySelector(Hi(_)),j||(n=b({src:n,async:!0,type:"module"},s),(s=Os.get(_))&&pg(n,s),j=i.createElement("script"),Cn(j),In(j,"link",n),i.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(_,j))}}function Q0(n,s,i,d){var _=(_=fe.current)?Zu(_):null;if(!_)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=gl(i.href),i=Lo(_).hoistableStyles,d=i.get(s),d||(d={type:"style",instance:null,count:0,state:null},i.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=gl(i.href);var j=Lo(_).hoistableStyles,O=j.get(n);if(O||(_=_.ownerDocument||_,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(n,O),(j=_.querySelector(Ui(n)))&&!j._p&&(O.instance=j,O.state.loading=5),Os.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Os.set(n,i),j||YR(_,n,i,O.state))),s&&d===null)throw Error(o(528,""));return O}if(s&&d!==null)throw Error(o(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=hl(i),i=Lo(_).hoistableScripts,d=i.get(s),d||(d={type:"script",instance:null,count:0,state:null},i.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function gl(n){return'href="'+Ss(n)+'"'}function Ui(n){return'link[rel="stylesheet"]['+n+"]"}function W0(n){return b({},n,{"data-precedence":n.precedence,precedence:null})}function YR(n,s,i,d){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=n.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),In(s,"link",i),Cn(s),n.head.appendChild(s))}function hl(n){return'[src="'+Ss(n)+'"]'}function Hi(n){return"script[async]"+n}function Z0(n,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var d=n.querySelector('style[data-href~="'+Ss(i.href)+'"]');if(d)return s.instance=d,Cn(d),d;var _=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),Cn(d),In(d,"style",_),Ju(d,i.precedence,n),s.instance=d;case"stylesheet":_=gl(i.href);var j=n.querySelector(Ui(_));if(j)return s.state.loading|=4,s.instance=j,Cn(j),j;d=W0(i),(_=Os.get(_))&&fg(d,_),j=(n.ownerDocument||n).createElement("link"),Cn(j);var O=j;return O._p=new Promise(function(U,Q){O.onload=U,O.onerror=Q}),In(j,"link",d),s.state.loading|=4,Ju(j,i.precedence,n),s.instance=j;case"script":return j=hl(i.src),(_=n.querySelector(Hi(j)))?(s.instance=_,Cn(_),_):(d=i,(_=Os.get(j))&&(d=b({},i),pg(d,_)),n=n.ownerDocument||n,_=n.createElement("script"),Cn(_),In(_,"link",d),n.head.appendChild(_),s.instance=_);case"void":return null;default:throw Error(o(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Ju(d,i.precedence,n));return s.instance}function Ju(n,s,i){for(var d=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=d.length?d[d.length-1]:null,j=_,O=0;O<d.length;O++){var U=d[O];if(U.dataset.precedence===s)j=U;else if(j!==_)break}j?j.parentNode.insertBefore(n,j.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(n,s.firstChild))}function fg(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function pg(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var ed=null;function J0(n,s,i){if(ed===null){var d=new Map,_=ed=new Map;_.set(i,d)}else _=ed,d=_.get(i),d||(d=new Map,_.set(i,d));if(d.has(n))return d;for(d.set(n,null),i=i.getElementsByTagName(n),_=0;_<i.length;_++){var j=i[_];if(!(j[si]||j[Ht]||n==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var O=j.getAttribute(s)||"";O=n+O;var U=d.get(O);U?U.push(j):d.set(O,[j])}}return d}function e1(n,s,i){n=n.ownerDocument||n,n.head.insertBefore(i,s==="title"?n.querySelector("head > title"):null)}function KR(n,s,i){if(i===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function t1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function XR(n,s,i,d){if(i.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var _=gl(d.href),j=s.querySelector(Ui(_));if(j){s=j._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=td.bind(n),s.then(n,n)),i.state.loading|=4,i.instance=j,Cn(j);return}j=s.ownerDocument||s,d=W0(d),(_=Os.get(_))&&fg(d,_),j=j.createElement("link"),Cn(j);var O=j;O._p=new Promise(function(U,Q){O.onload=U,O.onerror=Q}),In(j,"link",d),i.instance=j}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=td.bind(n),s.addEventListener("load",i),s.addEventListener("error",i))}}var mg=0;function QR(n,s){return n.stylesheets&&n.count===0&&sd(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var d=setTimeout(function(){if(n.stylesheets&&sd(n,n.stylesheets),n.unsuspend){var j=n.unsuspend;n.unsuspend=null,j()}},6e4+s);0<n.imgBytes&&mg===0&&(mg=62500*TR());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&sd(n,n.stylesheets),n.unsuspend)){var j=n.unsuspend;n.unsuspend=null,j()}},(n.imgBytes>mg?50:800)+s);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(_)}}:null}function td(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sd(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var nd=null;function sd(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,nd=new Map,s.forEach(WR,n),nd=null,td.call(n))}function WR(n,s){if(!(s.state.loading&4)){var i=nd.get(n);if(i)var d=i.get(null);else{i=new Map,nd.set(n,i);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<_.length;j++){var O=_[j];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(i.set(O.dataset.precedence,O),d=O)}d&&i.set(null,d)}_=s.instance,O=_.getAttribute("data-precedence"),j=i.get(O)||d,j===d&&i.set(null,_),i.set(O,_),this.count++,d=td.bind(this),_.addEventListener("load",d),_.addEventListener("error",d),j?j.parentNode.insertBefore(_,j.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),s.state.loading|=4}}var Vi={$$typeof:E,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function ZR(n,s,i,d,_,j,O,U,Q){this.tag=1,this.containerInfo=n,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=js(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=js(0),this.hiddenUpdates=js(null),this.identifierPrefix=d,this.onUncaughtError=_,this.onCaughtError=j,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function n1(n,s,i,d,_,j,O,U,Q,ne,he,ye){return n=new ZR(n,s,i,O,Q,ne,he,ye,U),s=1,j===!0&&(s|=24),j=ps(3,null,null,s),n.current=j,j.stateNode=n,s=Yp(),s.refCount++,n.pooledCache=s,s.refCount++,j.memoizedState={element:d,isDehydrated:i,cache:s},Wp(j),n}function s1(n){return n?(n=Yo,n):Yo}function a1(n,s,i,d,_,j){_=s1(_),d.context===null?d.context=_:d.pendingContext=_,d=or(s),d.payload={element:i},j=j===void 0?null:j,j!==null&&(d.callback=j),i=lr(n,d,s),i!==null&&(os(i,n,s),vi(i,n,s))}function r1(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<s?i:s}}function gg(n,s){r1(n,s),(n=n.alternate)&&r1(n,s)}function o1(n){if(n.tag===13||n.tag===31){var s=Yr(n,67108864);s!==null&&os(s,n,67108864),gg(n,67108864)}}function l1(n){if(n.tag===13||n.tag===31){var s=bs();s=ct(s);var i=Yr(n,s);i!==null&&os(i,n,s),gg(n,s)}}var ad=!0;function JR(n,s,i,d){var _=q.T;q.T=null;var j=Y.p;try{Y.p=2,hg(n,s,i,d)}finally{Y.p=j,q.T=_}}function eT(n,s,i,d){var _=q.T;q.T=null;var j=Y.p;try{Y.p=8,hg(n,s,i,d)}finally{Y.p=j,q.T=_}}function hg(n,s,i,d){if(ad){var _=xg(d);if(_===null)ng(n,s,d,rd,i),c1(n,d);else if(nT(_,n,s,i,d))d.stopPropagation();else if(c1(n,d),s&4&&-1<tT.indexOf(n)){for(;_!==null;){var j=Po(_);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var O=Zt(j.pendingLanes);if(O!==0){var U=j;for(U.pendingLanes|=2,U.entangledLanes|=2;O;){var Q=1<<31-ot(O);U.entanglements[1]|=Q,O&=~Q}Zs(j),(At&6)===0&&(Hu=se()+500,Pi(0))}}break;case 31:case 13:U=Yr(j,2),U!==null&&os(U,j,2),qu(),gg(j,2)}if(j=xg(d),j===null&&ng(n,s,d,rd,i),j===_)break;_=j}_!==null&&d.stopPropagation()}else ng(n,s,d,null,i)}}function xg(n){return n=_p(n),bg(n)}var rd=null;function bg(n){if(rd=null,n=Do(n),n!==null){var s=c(n);if(s===null)n=null;else{var i=s.tag;if(i===13){if(n=u(s),n!==null)return n;n=null}else if(i===31){if(n=p(s),n!==null)return n;n=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return rd=n,null}function i1(n){switch(n){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(be()){case $e:return 2;case Re:return 8;case Oe:case We:return 32;case at:return 268435456;default:return 32}default:return 32}}var _g=!1,br=null,_r=null,vr=null,qi=new Map,$i=new Map,yr=[],tT="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 c1(n,s){switch(n){case"focusin":case"focusout":br=null;break;case"dragenter":case"dragleave":_r=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":qi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$i.delete(s.pointerId)}}function Fi(n,s,i,d,_,j){return n===null||n.nativeEvent!==j?(n={blockedOn:s,domEventName:i,eventSystemFlags:d,nativeEvent:j,targetContainers:[_]},s!==null&&(s=Po(s),s!==null&&o1(s)),n):(n.eventSystemFlags|=d,s=n.targetContainers,_!==null&&s.indexOf(_)===-1&&s.push(_),n)}function nT(n,s,i,d,_){switch(s){case"focusin":return br=Fi(br,n,s,i,d,_),!0;case"dragenter":return _r=Fi(_r,n,s,i,d,_),!0;case"mouseover":return vr=Fi(vr,n,s,i,d,_),!0;case"pointerover":var j=_.pointerId;return qi.set(j,Fi(qi.get(j)||null,n,s,i,d,_)),!0;case"gotpointercapture":return j=_.pointerId,$i.set(j,Fi($i.get(j)||null,n,s,i,d,_)),!0}return!1}function u1(n){var s=Do(n.target);if(s!==null){var i=c(s);if(i!==null){if(s=i.tag,s===13){if(s=u(i),s!==null){n.blockedOn=s,Sn(n.priority,function(){l1(i)});return}}else if(s===31){if(s=p(i),s!==null){n.blockedOn=s,Sn(n.priority,function(){l1(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function od(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var i=xg(n.nativeEvent);if(i===null){i=n.nativeEvent;var d=new i.constructor(i.type,i);bp=d,i.target.dispatchEvent(d),bp=null}else return s=Po(i),s!==null&&o1(s),n.blockedOn=i,!1;s.shift()}return!0}function d1(n,s,i){od(n)&&i.delete(s)}function sT(){_g=!1,br!==null&&od(br)&&(br=null),_r!==null&&od(_r)&&(_r=null),vr!==null&&od(vr)&&(vr=null),qi.forEach(d1),$i.forEach(d1)}function ld(n,s){n.blockedOn===s&&(n.blockedOn=null,_g||(_g=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sT)))}var id=null;function f1(n){id!==n&&(id=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){id===n&&(id=null);for(var s=0;s<n.length;s+=3){var i=n[s],d=n[s+1],_=n[s+2];if(typeof d!="function"){if(bg(d||i)===null)continue;break}var j=Po(i);j!==null&&(n.splice(s,3),s-=3,xm(j,{pending:!0,data:_,method:i.method,action:d},d,_))}}))}function xl(n){function s(Q){return ld(Q,n)}br!==null&&ld(br,n),_r!==null&&ld(_r,n),vr!==null&&ld(vr,n),qi.forEach(s),$i.forEach(s);for(var i=0;i<yr.length;i++){var d=yr[i];d.blockedOn===n&&(d.blockedOn=null)}for(;0<yr.length&&(i=yr[0],i.blockedOn===null);)u1(i),i.blockedOn===null&&yr.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(d=0;d<i.length;d+=3){var _=i[d],j=i[d+1],O=_[zn]||null;if(typeof j=="function")O||f1(i);else if(O){var U=null;if(j&&j.hasAttribute("formAction")){if(_=j,O=j[zn]||null)U=O.formAction;else if(bg(_)!==null)continue}else U=O.action;typeof U=="function"?i[d+1]=U:(i.splice(d,3),d-=3),f1(i)}}}function p1(){function n(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(O){return _=O})},focusReset:"manual",scroll:"manual"})}function s(){_!==null&&(_(),_=null),d||setTimeout(i,20)}function i(){if(!d&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,_=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),_!==null&&(_(),_=null)}}}function vg(n){this._internalRoot=n}cd.prototype.render=vg.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(o(409));var i=s.current,d=bs();a1(i,d,n,s,null,null)},cd.prototype.unmount=vg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;a1(n.current,2,null,n,null,null),qu(),s[Ks]=null}};function cd(n){this._internalRoot=n}cd.prototype.unstable_scheduleHydration=function(n){if(n){var s=mn();n={blockedOn:null,target:n,priority:s};for(var i=0;i<yr.length&&s!==0&&s<yr[i].priority;i++);yr.splice(i,0,n),i===0&&u1(n)}};var m1=t.version;if(m1!=="19.2.7")throw Error(o(527,m1,"19.2.7"));Y.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=g(s),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var aT={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ud=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ud.isDisabled&&ud.supportsFiber)try{Me=ud.inject(aT),He=ud}catch{}}return Yi.createRoot=function(n,s){if(!l(n))throw Error(o(299));var i=!1,d="",_=yy,j=jy,O=wy;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(_=s.onUncaughtError),s.onCaughtError!==void 0&&(j=s.onCaughtError),s.onRecoverableError!==void 0&&(O=s.onRecoverableError)),s=n1(n,1,!1,null,null,i,d,null,_,j,O,p1),n[Ks]=s.current,tg(n),new vg(s)},Yi.hydrateRoot=function(n,s,i){if(!l(n))throw Error(o(299));var d=!1,_="",j=yy,O=jy,U=wy,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(_=i.identifierPrefix),i.onUncaughtError!==void 0&&(j=i.onUncaughtError),i.onCaughtError!==void 0&&(O=i.onCaughtError),i.onRecoverableError!==void 0&&(U=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),s=n1(n,1,!0,s,i??null,d,_,Q,j,O,U,p1),s.context=s1(null),i=s.current,d=bs(),d=ct(d),_=or(d),_.callback=null,lr(i,_,d),i=d,s.current.lanes=i,pn(s,i),Zs(s),n[Ks]=s.current,tg(n),new cd(s)},Yi.version="19.2.7",Yi}var k1;function gT(){if(k1)return wg.exports;k1=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(t){console.error(t)}}return e(),wg.exports=mT(),wg.exports}var hT=gT();const xT=Ex(hT);/**
|
|
50
|
+
* react-router v7.18.1
|
|
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 Rx=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,fk=/^[\\/]{2}/;function bT(e,t){return t+e.replace(/\\/g,"/")}var S1="popstate";function C1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _T(e={}){function t(o,l){let c=l.state?.masked,{pathname:u,search:p,hash:m}=c||o.location;return Lh("",{pathname:u,search:p,hash:m},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 a(o,l){return typeof l=="string"?l:Nc(l)}return yT(t,a,null,e)}function en(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ps(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vT(){return Math.random().toString(36).substring(2,10)}function N1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Lh(e,t,a=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Kl(t):t,state:a,key:t&&t.key||o||vT(),mask:l}}function Nc({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function Kl(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function yT(e,t,a,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,u=l.history,p="POP",m=null,g=h();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function h(){return(u.state||{idx:null}).idx}function b(){p="POP";let y=h(),S=y==null?null:y-g;g=y,m&&m({action:p,location:w.location,delta:S})}function v(y,S){p="PUSH";let C=C1(y)?y:Lh(w.location,y,S);g=h()+1;let E=N1(C,g),R=w.createHref(C.mask||C);try{u.pushState(E,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;l.location.assign(R)}c&&m&&m({action:p,location:w.location,delta:1})}function k(y,S){p="REPLACE";let C=C1(y)?y:Lh(w.location,y,S);g=h();let E=N1(C,g),R=w.createHref(C.mask||C);u.replaceState(E,"",R),c&&m&&m({action:p,location:w.location,delta:0})}function N(y){return jT(l,y)}let w={get action(){return p},get location(){return e(l,u)},listen(y){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(S1,b),m=y,()=>{l.removeEventListener(S1,b),m=null}},createHref(y){return t(l,y)},createURL:N,encodeLocation(y){let S=N(y);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:k,go(y){return u.go(y)}};return w}function jT(e,t,a=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),en(o,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Nc(t);return l=l.replace(/ $/,"%20"),!a&&fk.test(l)&&(l=o+l),new URL(l,o)}function pk(e,t,a="/"){return wT(e,t,a,!1)}function wT(e,t,a,o,l){let c=typeof t=="string"?Kl(t):t,u=$a(c.pathname||"/",a);if(u==null)return null;let p=kT(e),m=null,g=DT(u);for(let h=0;m==null&&h<p.length;++h)m=zT(p[h],g,o);return m}function kT(e){let t=mk(e);return ST(t),t}function mk(e,t=[],a=[],o="",l=!1){let c=(u,p,m=l,g)=>{let h={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(o)&&m)return;en(h.relativePath.startsWith(o),`Absolute route path "${h.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(o.length)}let b=Vs([o,h.relativePath]),v=a.concat(h);u.children&&u.children.length>0&&(en(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),mk(u.children,t,v,b,m)),!(u.path==null&&!u.index)&&t.push({path:b,score:MT(b,u.index),routesMeta:v.map((k,N)=>{let[w,y]=xk(k.relativePath,k.caseSensitive,N===v.length-1);return{...k,matcher:w,compiledParams:y}})})};return e.forEach((u,p)=>{if(u.path===""||!u.path?.includes("?"))c(u,p);else for(let m of gk(u.path))c(u,p,!0,m)}),t}function gk(e){let t=e.split("/");if(t.length===0)return[];let[a,...o]=t,l=a.endsWith("?"),c=a.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let u=gk(o.join("/")),p=[];return p.push(...u.map(m=>m===""?c:[c,m].join("/"))),l&&p.push(...u),p.map(m=>e.startsWith("/")&&m===""?"/":m)}function ST(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:OT(t.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var CT=/^:[\w-]+$/,NT=3,ET=2,RT=1,TT=10,AT=-2,E1=e=>e==="*";function MT(e,t){let a=e.split("/"),o=a.length;return a.some(E1)&&(o+=AT),t&&(o+=ET),a.filter(l=>!E1(l)).reduce((l,c)=>l+(CT.test(c)?NT:c===""?RT:TT),o)}function OT(e,t){return e.length===t.length&&e.slice(0,-1).every((o,l)=>o===t[l])?e[e.length-1]-t[t.length-1]:0}function zT(e,t,a=!1){let{routesMeta:o}=e,l={},c="/",u=[];for(let p=0;p<o.length;++p){let m=o[p],g=p===o.length-1,h=c==="/"?t:t.slice(c.length)||"/",b={path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v=m.matcher&&m.compiledParams?hk(b,h,m.matcher,m.compiledParams):$d(b,h),k=m.route;if(!v&&g&&a&&!o[o.length-1].route.index&&(v=$d({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},h)),!v)return null;Object.assign(l,v.params),u.push({params:l,pathname:Vs([c,v.pathname]),pathnameBase:IT(Vs([c,v.pathnameBase])),route:k}),v.pathnameBase!=="/"&&(c=Vs([c,v.pathnameBase]))}return u}function $d(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,o]=xk(e.path,e.caseSensitive,e.end);return hk(e,t,a,o)}function hk(e,t,a,o){let l=t.match(a);if(!l)return null;let c=l[0],u=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:o.reduce((g,{paramName:h,isOptional:b},v)=>{if(h==="*"){let N=p[v]||"";u=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const k=p[v];return b&&!k?g[h]=void 0:g[h]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:u,pattern:e}}function xk(e,t=!1,a=!0){Ps(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,(u,p,m,g,h)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let b=h.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),o]}function DT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ps(!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 (${t}).`),e}}function $a(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,o=e.charAt(a);return o&&o!=="/"?null:e.slice(a)||"/"}function PT(e,t="/"){let{pathname:a,search:o="",hash:l=""}=typeof e=="string"?Kl(e):e,c;return a?(a=bk(a),a.startsWith("/")?c=R1(a.substring(1),"/"):c=R1(a,t)):c=t,{pathname:c,search:BT(o),hash:UT(l)}}function R1(e,t){let a=Fd(t).split("/");return e.split("/").forEach(l=>{l===".."?a.length>1&&a.pop():l!=="."&&a.push(l)}),a.length>1?a.join("/"):"/"}function Ng(e,t,a,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function LT(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function Tx(e){let t=LT(e);return t.map((a,o)=>o===t.length-1?a.pathname:a.pathnameBase)}function yf(e,t,a,o=!1){let l;typeof e=="string"?l=Kl(e):(l={...e},en(!l.pathname||!l.pathname.includes("?"),Ng("?","pathname","search",l)),en(!l.pathname||!l.pathname.includes("#"),Ng("#","pathname","hash",l)),en(!l.search||!l.search.includes("#"),Ng("#","search","hash",l)));let c=e===""||l.pathname==="",u=c?"/":l.pathname,p;if(u==null)p=a;else{let b=t.length-1;if(!o&&u.startsWith("..")){let v=u.split("/");for(;v[0]==="..";)v.shift(),b-=1;l.pathname=v.join("/")}p=b>=0?t[b]:"/"}let m=PT(l,p),g=u&&u!=="/"&&u.endsWith("/"),h=(c||u===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(g||h)&&(m.pathname+="/"),m}var bk=e=>e.replace(/[\\/]{2,}/g,"/"),Vs=e=>bk(e.join("/")),Fd=e=>e.replace(/\/+$/,""),IT=e=>Fd(e).replace(/^\/*/,"/"),BT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HT=class{constructor(e,t,a,o=!1){this.status=e,this.statusText=t||"",this.internal=o,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function VT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qT(e){let t=e.map(a=>a.route.path).filter(Boolean);return Vs(t)||"/"}var _k=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vk(e,t){let a=e;if(typeof a!="string"||!Rx.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,l=!1;if(_k)try{let c=new URL(window.location.href),u=fk.test(a)?new URL(bT(a,c.protocol)):new URL(a),p=$a(u.pathname,t);u.origin===c.origin&&p!=null?a=p+u.search+u.hash:l=!0}catch{Ps(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yk=["POST","PUT","PATCH","DELETE"];new Set(yk);var $T=["GET",...yk];new Set($T);var FT=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function GT(e){try{return FT.includes(new URL(e).protocol)}catch{return!1}}var Xl=x.createContext(null);Xl.displayName="DataRouter";var jf=x.createContext(null);jf.displayName="DataRouterState";var jk=x.createContext(!1);function YT(){return x.useContext(jk)}var wk=x.createContext({isTransitioning:!1});wk.displayName="ViewTransition";var KT=x.createContext(new Map);KT.displayName="Fetchers";var XT=x.createContext(null);XT.displayName="Await";var ys=x.createContext(null);ys.displayName="Navigation";var Hc=x.createContext(null);Hc.displayName="Location";var $s=x.createContext({outlet:null,matches:[],isDataRoute:!1});$s.displayName="Route";var Ax=x.createContext(null);Ax.displayName="RouteError";var kk="REACT_ROUTER_ERROR",QT="REDIRECT",WT="ROUTE_ERROR_RESPONSE";function ZT(e){if(e.startsWith(`${kk}:${QT}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function JT(e){if(e.startsWith(`${kk}:${WT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HT(t.status,t.statusText,t.data)}catch{}}function eA(e,{relative:t}={}){en(Ql(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:o}=x.useContext(ys),{hash:l,pathname:c,search:u}=Vc(e,{relative:t}),p=c;return a!=="/"&&(p=c==="/"?a:Vs([a,c])),o.createHref({pathname:p,search:u,hash:l})}function Ql(){return x.useContext(Hc)!=null}function Qn(){return en(Ql(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Hc).location}var Sk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ck(e){x.useContext(ys).static||x.useLayoutEffect(e)}function Wn(){let{isDataRoute:e}=x.useContext($s);return e?pA():tA()}function tA(){en(Ql(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Xl),{basename:t,navigator:a}=x.useContext(ys),{matches:o}=x.useContext($s),{pathname:l}=Qn(),c=JSON.stringify(Tx(o)),u=x.useRef(!1);return Ck(()=>{u.current=!0}),x.useCallback((m,g={})=>{if(Ps(u.current,Sk),!u.current)return;if(typeof m=="number"){a.go(m);return}let h=yf(m,JSON.parse(c),l,g.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Vs([t,h.pathname])),(g.replace?a.replace:a.push)(h,g.state,g)},[t,a,c,l,e])}x.createContext(null);function Nk(){let{matches:e}=x.useContext($s);return e[e.length-1]?.params??{}}function Vc(e,{relative:t}={}){let{matches:a}=x.useContext($s),{pathname:o}=Qn(),l=JSON.stringify(Tx(a));return x.useMemo(()=>yf(e,JSON.parse(l),o,t==="path"),[e,l,o,t])}function nA(e,t){return Ek(e,t)}function Ek(e,t,a){en(Ql(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(ys),{matches:l}=x.useContext($s),c=l[l.length-1],u=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let y=g&&g.path||"";Tk(p,!g||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${y}">) 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="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let h=Qn(),b;if(t){let y=typeof t=="string"?Kl(t):t;en(m==="/"||y.pathname?.startsWith(m),`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 "${m}" but pathname "${y.pathname}" was given in the \`location\` prop.`),b=y}else b=h;let v=b.pathname||"/",k=v;if(m!=="/"){let y=m.replace(/^\//,"").split("/");k="/"+v.replace(/^\//,"").split("/").slice(y.length).join("/")}let N=a&&a.state.matches.length?a.state.matches.map(y=>Object.assign(y,{route:a.manifest[y.route.id]||y.route})):pk(e,{pathname:k});Ps(g||N!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Ps(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.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 w=lA(N&&N.map(y=>Object.assign({},y,{params:Object.assign({},u,y.params),pathname:Vs([m,o.encodeLocation?o.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?m:Vs([m,o.encodeLocation?o.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),l,a);return t&&w?x.createElement(Hc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},w):w}function sA(){let e=fA(),t=VT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=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},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=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"}},t),a?x.createElement("pre",{style:l},a):null,u)}var aA=x.createElement(sA,null),Rk=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,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):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 a=JT(e.digest);a&&(e=a)}let t=e!==void 0?x.createElement($s.Provider,{value:this.props.routeContext},x.createElement(Ax.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(rA,{error:e},t):t}};Rk.contextType=jk;var Eg=new WeakMap;function rA({children:e,error:t}){let{basename:a}=x.useContext(ys);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=ZT(t.digest);if(o){let l=Eg.get(t);if(l)throw l;let c=vk(o.location,a),u=c.absoluteURL||c.to;if(GT(u))throw new Error("Invalid redirect location");if(_k&&!Eg.get(t))if(c.isExternal||o.reloadDocument)window.location.href=u;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Eg.set(t,p),p}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function oA({routeContext:e,match:t,children:a}){let o=x.useContext(Xl);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement($s.Provider,{value:e},a)}function lA(e,t=[],a){let o=a?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(t.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let h=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);en(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,h+1))}let u=!1,p=-1;if(a&&o){u=o.renderFallback;for(let h=0;h<l.length;h++){let b=l[h];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=h),b.route.id){let{loaderData:v,errors:k}=o,N=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||N){a.isStatic&&(u=!0),p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}}let m=a?.onError,g=o&&m?(h,b)=>{m(h,{location:o.location,params:o.matches?.[0]?.params??{},pattern:qT(o.matches),errorInfo:b})}:void 0;return l.reduceRight((h,b,v)=>{let k,N=!1,w=null,y=null;o&&(k=c&&b.route.id?c[b.route.id]:void 0,w=b.route.errorElement||aA,u&&(p<0&&v===0?(Tk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,y=null):p===v&&(N=!0,y=b.route.hydrateFallbackElement||null)));let S=t.concat(l.slice(0,v+1)),C=()=>{let E;return k?E=w:N?E=y:b.route.Component?E=x.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=h,x.createElement(oA,{match:b,routeContext:{outlet:h,matches:S,isDataRoute:o!=null},children:E})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?x.createElement(Rk,{location:o.location,revalidation:o.revalidation,component:w,error:k,children:C(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:g}):C()},null)}function Mx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function iA(e){let t=x.useContext(Xl);return en(t,Mx(e)),t}function cA(e){let t=x.useContext(jf);return en(t,Mx(e)),t}function uA(e){let t=x.useContext($s);return en(t,Mx(e)),t}function Ox(e){let t=uA(e),a=t.matches[t.matches.length-1];return en(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function dA(){return Ox("useRouteId")}function fA(){let e=x.useContext(Ax),t=cA("useRouteError"),a=Ox("useRouteError");return e!==void 0?e:t.errors?.[a]}function pA(){let{router:e}=iA("useNavigate"),t=Ox("useNavigate"),a=x.useRef(!1);return Ck(()=>{a.current=!0}),x.useCallback(async(l,c={})=>{Ps(a.current,Sk),a.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var T1={};function Tk(e,t,a){!t&&!T1[e]&&(T1[e]=!0,Ps(!1,a))}x.memo(mA);function mA({routes:e,manifest:t,future:a,state:o,isStatic:l,onError:c}){return Ek(e,void 0,{manifest:t,state:o,isStatic:l,onError:c})}function gA({to:e,replace:t,state:a,relative:o}){en(Ql(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(ys);Ps(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=x.useContext($s),{pathname:u}=Qn(),p=Wn(),m=yf(e,Tx(c),u,o==="path"),g=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(g),{replace:t,state:a,relative:o})},[p,g,o,t,a]),null}function Qt(e){en(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hA({basename:e="/",children:t=null,location:a,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:u}){en(!Ql(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:p,navigator:l,static:c,useTransitions:u,future:{}}),[p,l,c,u]);typeof a=="string"&&(a=Kl(a));let{pathname:g="/",search:h="",hash:b="",state:v=null,key:k="default",mask:N}=a,w=x.useMemo(()=>{let y=$a(g,p);return y==null?null:{location:{pathname:y,search:h,hash:b,state:v,key:k,mask:N},navigationType:o}},[p,g,h,b,v,k,o,N]);return Ps(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${h}${b}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:x.createElement(ys.Provider,{value:m},x.createElement(Hc.Provider,{children:t,value:w}))}function Ak({children:e,location:t}){return nA(Ih(e),t)}function Ih(e,t=[]){let a=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...t,l];if(o.type===x.Fragment){a.push.apply(a,Ih(o.props.children,c));return}en(o.type===Qt,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),en(!o.props.index||!o.props.children,"An index route cannot have child routes.");let u={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&&(u.children=Ih(o.props.children,c)),a.push(u)}),a}var Pd="get",Ld="application/x-www-form-urlencoded";function wf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function xA(e){return wf(e)&&e.tagName.toLowerCase()==="button"}function bA(e){return wf(e)&&e.tagName.toLowerCase()==="form"}function _A(e){return wf(e)&&e.tagName.toLowerCase()==="input"}function vA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yA(e,t){return e.button===0&&(!t||t==="_self")&&!vA(e)}function Bh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let o=e[a];return t.concat(Array.isArray(o)?o.map(l=>[a,l]):[[a,o]])},[]))}function jA(e,t){let a=Bh(e);return t&&t.forEach((o,l)=>{a.has(l)||t.getAll(l).forEach(c=>{a.append(l,c)})}),a}var dd=null;function wA(){if(dd===null)try{new FormData(document.createElement("form"),0),dd=!1}catch{dd=!0}return dd}var kA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Rg(e){return e!=null&&!kA.has(e)?(Ps(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ld}"`),null):e}function SA(e,t){let a,o,l,c,u;if(bA(e)){let p=e.getAttribute("action");o=p?$a(p,t):null,a=e.getAttribute("method")||Pd,l=Rg(e.getAttribute("enctype"))||Ld,c=new FormData(e)}else if(xA(e)||_A(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||p.getAttribute("action");if(o=m?$a(m,t):null,a=e.getAttribute("formmethod")||p.getAttribute("method")||Pd,l=Rg(e.getAttribute("formenctype"))||Rg(p.getAttribute("enctype"))||Ld,c=new FormData(p,e),!wA()){let{name:g,type:h,value:b}=e;if(h==="image"){let v=g?`${g}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else g&&c.append(g,b)}}else{if(wf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Pd,o=null,l=Ld,u=e}return c&&l==="text/plain"&&(u=c,c=void 0),{action:o,method:a.toLowerCase(),encType:l,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function zx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Mk(e,t,a,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:t&&$a(l.pathname,t)==="/"?l.pathname=`${Fd(t)}/_root.${o}`:l.pathname=`${Fd(l.pathname)}.${o}`,l}async function CA(e,t){if(e.id in t)return t[e.id];try{let a=await import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function NA(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 EA(e,t,a){let o=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let u=await CA(c,a);return u.links?u.links():[]}return[]}));return MA(o.flat(1).filter(NA).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function A1(e,t,a,o,l,c){let u=(m,g)=>a[g]?m.route.id!==a[g].route.id:!0,p=(m,g)=>a[g].pathname!==m.pathname||a[g].route.path?.endsWith("*")&&a[g].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,g)=>u(m,g)||p(m,g)):c==="data"?t.filter((m,g)=>{let h=o.routes[m.route.id];if(!h||!h.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:a[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function RA(e,t,{includeHydrateFallback:a}={}){return TA(e.map(o=>{let l=t.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)),a&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function TA(e){return[...new Set(e)]}function AA(e){let t={},a=Object.keys(e).sort();for(let o of a)t[o]=e[o];return t}function MA(e,t){let a=new Set;return new Set(t),e.reduce((o,l)=>{let c=JSON.stringify(AA(l));return a.has(c)||(a.add(c),o.push({key:c,link:l})),o},[])}function Dx(){let e=x.useContext(Xl);return zx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function OA(){let e=x.useContext(jf);return zx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Px=x.createContext(void 0);Px.displayName="FrameworkContext";function kf(){let e=x.useContext(Px);return zx(e,"You must render this element inside a <HydratedRouter> element"),e}function zA(e,t){let a=x.useContext(Px),[o,l]=x.useState(!1),[c,u]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:h,onTouchStart:b}=t,v=x.useRef(null);x.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let w=S=>{S.forEach(C=>{u(C.isIntersecting)})},y=new IntersectionObserver(w,{threshold:.5});return v.current&&y.observe(v.current),()=>{y.disconnect()}}},[e]),x.useEffect(()=>{if(o){let w=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(w)}}},[o]);let k=()=>{l(!0)},N=()=>{l(!1),u(!1)};return a?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Ki(p,k),onBlur:Ki(m,N),onMouseEnter:Ki(g,k),onMouseLeave:Ki(h,N),onTouchStart:Ki(b,k)}]:[!1,v,{}]}function Ki(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function DA({page:e,...t}){let a=YT(),{nonce:o}=kf(),{router:l}=Dx(),c=x.useMemo(()=>pk(l.routes,e,l.basename),[l.routes,e,l.basename]);return c?(t.nonce==null&&o&&(t={...t,nonce:o}),a?x.createElement(LA,{page:e,matches:c,...t}):x.createElement(IA,{page:e,matches:c,...t})):null}function PA(e){let{manifest:t,routeModules:a}=kf(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return EA(e,t,a).then(u=>{c||l(u)}),()=>{c=!0}},[e,t,a]),o}function LA({page:e,matches:t,...a}){let o=Qn(),{future:l}=kf(),{basename:c}=Dx(),u=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=Mk(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,g=[];for(let h of t)typeof h.route.shouldRevalidate=="function"?m=!0:g.push(h.route.id);return m&&g.length>0&&p.searchParams.set("_routes",g.join(",")),[p.pathname+p.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,t]);return x.createElement(x.Fragment,null,u.map(p=>x.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...a})))}function IA({page:e,matches:t,...a}){let o=Qn(),{future:l,manifest:c,routeModules:u}=kf(),{basename:p}=Dx(),{loaderData:m,matches:g}=OA(),h=x.useMemo(()=>A1(e,t,g,c,o,"data"),[e,t,g,c,o]),b=x.useMemo(()=>A1(e,t,g,c,o,"assets"),[e,t,g,c,o]),v=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let w=new Set,y=!1;if(t.forEach(C=>{let E=c.routes[C.route.id];!E||!E.hasLoader||(!h.some(R=>R.route.id===C.route.id)&&C.route.id in m&&u[C.route.id]?.shouldRevalidate||E.hasClientLoader?y=!0:w.add(C.route.id))}),w.size===0)return[];let S=Mk(e,p,l.v8_trailingSlashAwareDataRequests,"data");return y&&w.size>0&&S.searchParams.set("_routes",t.filter(C=>w.has(C.route.id)).map(C=>C.route.id).join(",")),[S.pathname+S.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,h,t,e,u]),k=x.useMemo(()=>RA(b,c),[b,c]),N=PA(b);return x.createElement(x.Fragment,null,v.map(w=>x.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...a})),k.map(w=>x.createElement("link",{key:w,rel:"modulepreload",href:w,...a})),N.map(({key:w,link:y})=>x.createElement("link",{key:w,nonce:a.nonce,...y,crossOrigin:y.crossOrigin??a.crossOrigin})))}function BA(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var UA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{UA&&(window.__reactRouterVersion="7.18.1")}catch{}function HA({basename:e,children:t,useTransitions:a,window:o}){let l=x.useRef();l.current==null&&(l.current=_T({window:o,v5Compat:!0}));let c=l.current,[u,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(g=>{a===!1?p(g):x.startTransition(()=>p(g))},[a]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(hA,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:a})}var Sf=x.forwardRef(function({onClick:t,discover:a="render",prefetch:o="none",relative:l,reloadDocument:c,replace:u,mask:p,state:m,target:g,to:h,preventScrollReset:b,viewTransition:v,defaultShouldRevalidate:k,...N},w){let{basename:y,navigator:S,useTransitions:C}=x.useContext(ys),E=typeof h=="string"&&Rx.test(h),R=vk(h,y);h=R.to;let A=eA(h,{relative:l}),T=Qn(),M=null;if(p){let $=yf(p,[],T.mask?T.mask.pathname:"/",!0);y!=="/"&&($.pathname=$.pathname==="/"?y:Vs([y,$.pathname])),M=S.createHref($)}let[z,I,P]=zA(o,N),H=$A(h,{replace:u,mask:p,state:m,target:g,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:k,useTransitions:C});function D($){t&&t($),$.defaultPrevented||H($)}let B=!(R.isExternal||c),V=x.createElement("a",{...N,...P,href:(B?M:void 0)||R.absoluteURL||A,onClick:B?D:t,ref:BA(w,I),target:g,"data-discover":!E&&a==="render"?"true":void 0});return z&&!E?x.createElement(x.Fragment,null,V,x.createElement(DA,{page:A})):V});Sf.displayName="Link";var Ok=x.forwardRef(function({"aria-current":t="page",caseSensitive:a=!1,className:o="",end:l=!1,style:c,to:u,viewTransition:p,children:m,...g},h){let b=Vc(u,{relative:g.relative}),v=Qn(),k=x.useContext(jf),{navigator:N,basename:w}=x.useContext(ys),y=k!=null&&XA(b)&&p===!0,S=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,C=v.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;a||(C=C.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&w&&(E=$a(E,w)||E);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let A=C===S||!l&&C.startsWith(S)&&C.charAt(R)==="/",T=E!=null&&(E===S||!l&&E.startsWith(S)&&E.charAt(S.length)==="/"),M={isActive:A,isPending:T,isTransitioning:y},z=A?t:void 0,I;typeof o=="function"?I=o(M):I=[o,A?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let P=typeof c=="function"?c(M):c;return x.createElement(Sf,{...g,"aria-current":z,className:I,ref:h,style:P,to:u,viewTransition:p},typeof m=="function"?m(M):m)});Ok.displayName="NavLink";var VA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:a,reloadDocument:o,replace:l,state:c,method:u=Pd,action:p,onSubmit:m,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:v,...k},N)=>{let{useTransitions:w}=x.useContext(ys),y=YA(),S=KA(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&Rx.test(p),R=A=>{if(m&&m(A),A.defaultPrevented)return;A.preventDefault();let T=A.nativeEvent.submitter,M=T?.getAttribute("formmethod")||u,z=()=>y(T||A.currentTarget,{fetcherKey:t,method:M,navigate:a,replace:l,state:c,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:v});w&&a!==!1?x.startTransition(()=>z()):z()};return x.createElement("form",{ref:N,method:C,action:S,onSubmit:o?m:R,...k,"data-discover":!E&&e==="render"?"true":void 0})});VA.displayName="Form";function qA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zk(e){let t=x.useContext(Xl);return en(t,qA(e)),t}function $A(e,{target:t,replace:a,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m,useTransitions:g}={}){let h=Wn(),b=Qn(),v=Vc(e,{relative:u});return x.useCallback(k=>{if(yA(k,t)){k.preventDefault();let N=a!==void 0?a:Nc(b)===Nc(v),w=()=>h(e,{replace:N,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m});g?x.startTransition(()=>w()):w()}},[b,h,v,a,o,l,t,e,c,u,p,m,g])}function Cf(e){Ps(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 t=x.useRef(Bh(e)),a=x.useRef(!1),o=Qn(),l=x.useMemo(()=>jA(o.search,a.current?null:t.current),[o.search]),c=Wn(),u=x.useCallback((p,m)=>{const g=Bh(typeof p=="function"?p(new URLSearchParams(l)):p);a.current=!0,c("?"+g,m)},[c,l]);return[l,u]}var FA=0,GA=()=>`__${String(++FA)}__`;function YA(){let{router:e}=zk("useSubmit"),{basename:t}=x.useContext(ys),a=dA(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,u={})=>{let{action:p,method:m,encType:g,formData:h,body:b}=SA(c,t);if(u.navigate===!1){let v=u.fetcherKey||GA();await o(v,a,u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await l(u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:a,flushSync:u.flushSync,viewTransition:u.viewTransition})},[o,l,t,a])}function KA(e,{relative:t}={}){let{basename:a}=x.useContext(ys),o=x.useContext($s);en(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Vc(e||".",{relative:t})},u=Qn();if(e==null){c.search=u.search;let p=new URLSearchParams(c.search),m=p.getAll("index");if(m.some(h=>h==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let h=p.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:Vs([a,c.pathname])),Nc(c)}function XA(e,{relative:t}={}){let a=x.useContext(wk);en(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=zk("useViewTransitionState"),l=Vc(e,{relative:t});if(!a.isTransitioning)return!1;let c=$a(a.currentLocation.pathname,o)||a.currentLocation.pathname,u=$a(a.nextLocation.pathname,o)||a.nextLocation.pathname;return $d(l.pathname,u)!=null||$d(l.pathname,c)!=null}var ca=dk();/**
|
|
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 QA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dk=(...e)=>e.filter((t,a,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===a).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 WA={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 ZA=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:u,...p},m)=>x.createElement("svg",{ref:m,...WA,width:t,height:t,stroke:e,strokeWidth:o?Number(a)*24/Number(t):a,className:Dk("lucide",l),...p},[...u.map(([g,h])=>x.createElement(g,h)),...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 ke=(e,t)=>{const a=x.forwardRef(({className:o,...l},c)=>x.createElement(ZA,{ref:c,iconNode:t,className:Dk(`lucide-${QA(e)}`,o),...l}));return a.displayName=`${e}`,a};/**
|
|
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 Pk=ke("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 Lk=ke("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 JA=ke("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 Ik=ke("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 Bk=ke("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 eM=ke("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 tM=ke("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
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 nM=ke("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
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 un=ke("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"}]]);/**
|
|
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 sM=ke("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"}]]);/**
|
|
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 aM=ke("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"}]]);/**
|
|
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 Gd=ke("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"}]]);/**
|
|
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 ho=ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 Za=ke("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 rM=ke("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
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 Wl=ke("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 Uk=ke("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 oM=ke("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
|
|
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 Hk=ke("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 lM=ke("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"}]]);/**
|
|
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 iM=ke("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"}]]);/**
|
|
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 cM=ke("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
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 uM=ke("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 dM=ke("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
|
|
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 Ec=ke("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"}]]);/**
|
|
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 fM=ke("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
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 pM=ke("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
|
|
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 Lx=ke("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
|
|
221
|
+
* @license lucide-react v0.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 Fa=ke("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"}]]);/**
|
|
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 Vk=ke("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"}]]);/**
|
|
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 mM=ke("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"}]]);/**
|
|
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 gM=ke("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
241
|
+
* @license lucide-react v0.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 Nf=ke("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
246
|
+
* @license lucide-react v0.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 hM=ke("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"}]]);/**
|
|
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 Yd=ke("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"}]]);/**
|
|
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 xM=ke("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"}]]);/**
|
|
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 bM=ke("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"}]]);/**
|
|
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 _M=ke("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"}]]);/**
|
|
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 vM=ke("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"}]]);/**
|
|
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 yM=ke("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"}]]);/**
|
|
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 qk=ke("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"}]]);/**
|
|
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 jM=ke("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"}]]);/**
|
|
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 $k=ke("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"}]]);/**
|
|
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 Ef=ke("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"}]]);/**
|
|
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 Fk=ke("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"}]]);/**
|
|
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 wM=ke("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"}]]);/**
|
|
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 kM=ke("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/**
|
|
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 Rf=ke("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
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 SM=ke("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"}]]);/**
|
|
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 Ix=ke("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"}]]);/**
|
|
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 CM=ke("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"}]]);/**
|
|
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 NM=ke("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"}]]);/**
|
|
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 Dl=ke("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"}]]);/**
|
|
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 EM=ke("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"}]]);/**
|
|
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 RM=ke("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"}]]);/**
|
|
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 TM=ke("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 Uh=ke("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"}]]);/**
|
|
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 AM=ke("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
|
|
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 MM=ke("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"}]]);/**
|
|
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 OM=ke("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"}]]);/**
|
|
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 zM=ke("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"}]]);/**
|
|
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 DM=ke("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"}]]);/**
|
|
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 Tf=ke("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 Gk=ke("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"}]]);/**
|
|
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 Bx=ke("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"}]]);/**
|
|
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 Kd=ke("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"}]]);/**
|
|
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 Yk=ke("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"}]]);/**
|
|
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 Ux=ke("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"}]]);/**
|
|
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 PM=ke("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
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 LM=ke("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"}]]);/**
|
|
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 IM=ke("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"}]]);/**
|
|
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 Kk=ke("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
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 BM=ke("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
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 Eo=ke("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"}]]);/**
|
|
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 Hx=ke("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 UM=ke("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"}]]);/**
|
|
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 tn=ke("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 Hh=ke("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"}]]);/**
|
|
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 HM=ke("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"}]]);/**
|
|
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 ua=ke("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"}]]);/**
|
|
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 Vx=ke("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"}]]);/**
|
|
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 Af=ke("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"}]]);/**
|
|
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 Xd=ke("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"}]]);/**
|
|
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 _c=ke("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 Fs=ke("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"}]]);/**
|
|
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 Xk=ke("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"}]]);/**
|
|
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 VM=ke("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"}]]);/**
|
|
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 Rc=ke("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"}]]);/**
|
|
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 qM=ke("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
|
|
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 pa=ke("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"}]]);/**
|
|
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 $M=ke("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"}]]);/**
|
|
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 Qk=ke("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 FM=ke("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"}]]);/**
|
|
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 Ga=ke("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 GM=ke("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
|
|
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 Zn=ke("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"}]]);/**
|
|
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 Wk=ke("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"}]]);/**
|
|
566
|
+
* @license lucide-react v0.469.0 - ISC
|
|
567
|
+
*
|
|
568
|
+
* This source code is licensed under the ISC license.
|
|
569
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
570
|
+
*/const YM=ke("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"}]]);/**
|
|
571
|
+
* @license lucide-react v0.469.0 - ISC
|
|
572
|
+
*
|
|
573
|
+
* This source code is licensed under the ISC license.
|
|
574
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
575
|
+
*/const qx=ke("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"}]]);/**
|
|
576
|
+
* @license lucide-react v0.469.0 - ISC
|
|
577
|
+
*
|
|
578
|
+
* This source code is licensed under the ISC license.
|
|
579
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
580
|
+
*/const KM=ke("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"}]]);/**
|
|
581
|
+
* @license lucide-react v0.469.0 - ISC
|
|
582
|
+
*
|
|
583
|
+
* This source code is licensed under the ISC license.
|
|
584
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
585
|
+
*/const XM=ke("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"}]]);/**
|
|
586
|
+
* @license lucide-react v0.469.0 - ISC
|
|
587
|
+
*
|
|
588
|
+
* This source code is licensed under the ISC license.
|
|
589
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
590
|
+
*/const Zl=ke("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"}]]);/**
|
|
591
|
+
* @license lucide-react v0.469.0 - ISC
|
|
592
|
+
*
|
|
593
|
+
* This source code is licensed under the ISC license.
|
|
594
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
595
|
+
*/const Gs=ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
596
|
+
* @license lucide-react v0.469.0 - ISC
|
|
597
|
+
*
|
|
598
|
+
* This source code is licensed under the ISC license.
|
|
599
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
600
|
+
*/const Pl=ke("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"}]]),Mf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Tn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},$x=["total","automatico","permiso"],M1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],QM={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 WM(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Tn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const Zk=x.createContext(null);function ZM({children:e}){const[t,a]=x.useState(WM);x.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark");try{localStorage.setItem(Tn.theme,t)}catch{}},[t]);const o=x.useCallback(()=>{a(c=>c==="dark"?"light":"dark")},[]),l=x.useMemo(()=>({theme:t,toggle:o,set:a}),[t,o]);return r.jsx(Zk.Provider,{value:l,children:e})}function Fx(){const e=x.useContext(Zk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const JM=1367/458,e3=735/1016;function t3({size:e=32,title:t="APX",variant:a="icon"}){const{theme:o}=Fx(),l=QM[a][o];if(a==="full"){const c=e,u=Math.round(e*JM);return r.jsx("img",{src:l,alt:t,width:u,height:c,className:"block object-contain",draggable:!1})}if(a==="vertical"){const c=e,u=Math.round(e/e3);return r.jsx("img",{src:l,alt:t,width:c,height:u,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function Jk(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(a=Jk(e[t]))&&(o&&(o+=" "),o+=a)}else for(a in e)e[a]&&(o&&(o+=" "),o+=a);return o}function Tc(){for(var e,t,a=0,o="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=Jk(e))&&(o&&(o+=" "),o+=t);return o}const Gx="-",n3=e=>{const t=a3(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const p=u.split(Gx);return p[0]===""&&p.length!==1&&p.shift(),eS(p,t)||s3(u)},getConflictingClassGroupIds:(u,p)=>{const m=a[u]||[];return p&&o[u]?[...m,...o[u]]:m}}},eS=(e,t)=>{if(e.length===0)return t.classGroupId;const a=e[0],o=t.nextPart.get(a),l=o?eS(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const c=e.join(Gx);return t.validators.find(({validator:u})=>u(c))?.classGroupId},O1=/^\[(.+)\]$/,s3=e=>{if(O1.test(e)){const t=O1.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},a3=e=>{const{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return o3(Object.entries(e.classGroups),a).forEach(([c,u])=>{Vh(u,o,c,t)}),o},Vh=(e,t,a,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?t:z1(t,l);c.classGroupId=a;return}if(typeof l=="function"){if(r3(l)){Vh(l(o),t,a,o);return}t.validators.push({validator:l,classGroupId:a});return}Object.entries(l).forEach(([c,u])=>{Vh(u,z1(t,c),a,o)})})},z1=(e,t)=>{let a=e;return t.split(Gx).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},r3=e=>e.isThemeGetter,o3=(e,t)=>t?e.map(([a,o])=>{const l=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([u,p])=>[t+u,p])):c);return[a,l]}):e,l3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map;const l=(c,u)=>{a.set(c,u),t++,t>e&&(t=0,o=a,a=new Map)};return{get(c){let u=a.get(c);if(u!==void 0)return u;if((u=o.get(c))!==void 0)return l(c,u),u},set(c,u){a.has(c)?a.set(c,u):l(c,u)}}},tS="!",i3=e=>{const{separator:t,experimentalParseClassName:a}=e,o=t.length===1,l=t[0],c=t.length,u=p=>{const m=[];let g=0,h=0,b;for(let y=0;y<p.length;y++){let S=p[y];if(g===0){if(S===l&&(o||p.slice(y,y+c)===t)){m.push(p.slice(h,y)),h=y+c;continue}if(S==="/"){b=y;continue}}S==="["?g++:S==="]"&&g--}const v=m.length===0?p:p.substring(h),k=v.startsWith(tS),N=k?v.substring(1):v,w=b&&b>h?b-h:void 0;return{modifiers:m,hasImportantModifier:k,baseClassName:N,maybePostfixModifierPosition:w}};return a?p=>a({className:p,parseClassName:u}):u},c3=e=>{if(e.length<=1)return e;const t=[];let a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},u3=e=>({cache:l3(e.cacheSize),parseClassName:i3(e),...n3(e)}),d3=/\s+/,f3=(e,t)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:l}=t,c=[],u=e.trim().split(d3);let p="";for(let m=u.length-1;m>=0;m-=1){const g=u[m],{modifiers:h,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:k}=a(g);let N=!!k,w=o(N?v.substring(0,k):v);if(!w){if(!N){p=g+(p.length>0?" "+p:p);continue}if(w=o(v),!w){p=g+(p.length>0?" "+p:p);continue}N=!1}const y=c3(h).join(":"),S=b?y+tS:y,C=S+w;if(c.includes(C))continue;c.push(C);const E=l(w,N);for(let R=0;R<E.length;++R){const A=E[R];c.push(S+A)}p=g+(p.length>0?" "+p:p)}return p};function p3(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=nS(t))&&(o&&(o+=" "),o+=a);return o}const nS=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=nS(e[o]))&&(a&&(a+=" "),a+=t);return a};function m3(e,...t){let a,o,l,c=u;function u(m){const g=t.reduce((h,b)=>b(h),e());return a=u3(g),o=a.cache.get,l=a.cache.set,c=p,p(m)}function p(m){const g=o(m);if(g)return g;const h=f3(m,a);return l(m,h),h}return function(){return c(p3.apply(null,arguments))}}const Xt=e=>{const t=a=>a[e]||[];return t.isThemeGetter=!0,t},sS=/^\[(?:([a-z-]+):)?(.+)\]$/i,g3=/^\d+\/\d+$/,h3=new Set(["px","full","screen"]),x3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,b3=/\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$/,_3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,v3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,y3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,La=e=>Cl(e)||h3.has(e)||g3.test(e),wr=e=>Jl(e,"length",R3),Cl=e=>!!e&&!Number.isNaN(Number(e)),Tg=e=>Jl(e,"number",Cl),Xi=e=>!!e&&Number.isInteger(Number(e)),j3=e=>e.endsWith("%")&&Cl(e.slice(0,-1)),ft=e=>sS.test(e),kr=e=>x3.test(e),w3=new Set(["length","size","percentage"]),k3=e=>Jl(e,w3,aS),S3=e=>Jl(e,"position",aS),C3=new Set(["image","url"]),N3=e=>Jl(e,C3,A3),E3=e=>Jl(e,"",T3),Qi=()=>!0,Jl=(e,t,a)=>{const o=sS.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},R3=e=>b3.test(e)&&!_3.test(e),aS=()=>!1,T3=e=>v3.test(e),A3=e=>y3.test(e),M3=()=>{const e=Xt("colors"),t=Xt("spacing"),a=Xt("blur"),o=Xt("brightness"),l=Xt("borderColor"),c=Xt("borderRadius"),u=Xt("borderSpacing"),p=Xt("borderWidth"),m=Xt("contrast"),g=Xt("grayscale"),h=Xt("hueRotate"),b=Xt("invert"),v=Xt("gap"),k=Xt("gradientColorStops"),N=Xt("gradientColorStopPositions"),w=Xt("inset"),y=Xt("margin"),S=Xt("opacity"),C=Xt("padding"),E=Xt("saturate"),R=Xt("scale"),A=Xt("sepia"),T=Xt("skew"),M=Xt("space"),z=Xt("translate"),I=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",ft,t],D=()=>[ft,t],B=()=>["",La,wr],V=()=>["auto",Cl,ft],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",ft],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[Cl,ft];return{cacheSize:500,separator:":",theme:{colors:[Qi],spacing:[La,wr],blur:["none","",kr,ft],brightness:L(),borderColor:[e],borderRadius:["none","","full",kr,ft],borderSpacing:D(),borderWidth:B(),contrast:L(),grayscale:F(),hueRotate:L(),invert:F(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[j3,wr],inset:H(),margin:H(),opacity:L(),padding:D(),saturate:L(),scale:L(),sepia:F(),skew:L(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",ft]}],container:["container"],columns:[{columns:[kr]}],"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:[...$(),ft]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xi,ft]}],basis:[{basis:H()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ft]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Xi,ft]}],"grid-cols":[{"grid-cols":[Qi]}],"col-start-end":[{col:["auto",{span:["full",Xi,ft]},ft]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[Qi]}],"row-start-end":[{row:["auto",{span:[Xi,ft]},ft]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ft]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[M]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[M]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ft,t]}],"min-w":[{"min-w":[ft,t,"min","max","fit"]}],"max-w":[{"max-w":[ft,t,"none","full","min","max","fit","prose",{screen:[kr]},kr]}],h:[{h:[ft,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ft,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ft,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ft,t,"auto","min","max","fit"]}],"font-size":[{text:["base",kr,wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Tg]}],"font-family":[{font:[Qi]}],"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",ft]}],"line-clamp":[{"line-clamp":["none",Cl,Tg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",La,ft]}],"list-image":[{"list-image":["none",ft]}],"list-style-type":[{list:["none","disc","decimal",ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",La,wr]}],"underline-offset":[{"underline-offset":["auto",La,ft]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ft]}],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",ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),S3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",k3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},N3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],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:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[La,ft]}],"outline-w":[{outline:[La,wr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[La,wr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",kr,E3]}],"shadow-color":[{shadow:[Qi]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",kr,ft]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[E]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ft]}],duration:[{duration:L()}],ease:[{ease:["linear","in","out","in-out",ft]}],delay:[{delay:L()}],animate:[{animate:["none","spin","ping","pulse","bounce",ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Xi,ft]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ft]}],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",ft]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",ft]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[La,wr,Tg]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},rS=m3(M3);function ze(...e){return rS(Tc(e))}const D1={};function Xn(e,t){const a=x.useRef(D1);return a.current===D1&&(a.current=e(t)),a}const qh=[];let $h;function O3(){return $h}function z3(e){qh.push(e)}function Yx(e){const t=(a,o)=>{const l=Xn(D3).current;let c;try{$h=l;for(const u of qh)u.before(l);c=e(a,o);for(const u of qh)u.after(l);l.didInitialize=!0}finally{$h=void 0}return c};return t.displayName=e.displayName||e.name,t}function oS(e){return x.forwardRef(Yx(e))}function D3(){return{didInitialize:!1}}const P3=()=>{},De=typeof document<"u"?x.useLayoutEffect:P3;function L3(e,t){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${o}; visit ${c} for the full message.`}}const nn=L3("https://base-ui.com/production-error","Base UI"),lS=x.createContext(void 0);function qc(e){const t=x.useContext(lS);if(t===void 0&&!e)throw new Error(nn(72));return t}const I3=[];function Kx(e){x.useEffect(e,I3)}const Wi=0;class qs{static create(){return new qs}currentId=Wi;start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Wi,a()},t)}isStarted(){return this.currentId!==Wi}clear=()=>{this.currentId!==Wi&&(clearTimeout(this.currentId),this.currentId=Wi)};disposeEffect=()=>this.clear}function kn(){const e=Xn(qs.create).current;return Kx(e.disposeEffect),e}function B3(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:U3,platform:H3,maxTouchPoints:V3}=B3(),Of=U3.toLowerCase(),Ac=H3.toLowerCase(),zf=/^i(os$|p)/.test(Ac)||Ac==="macintel"&&V3>1,P1="android",Fh=Ac===P1||Of.includes(P1),Xx=!zf&&Ac.startsWith("mac");Ac.startsWith("win");const q3=Xx||zf,Dr=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Dr&&Of.includes("firefox");!Dr&&Of.includes("chrom");const $3=q3,Qx=/jsdom|happydom/.test(Of);function ea(e){e.preventDefault(),e.stopPropagation()}function F3(e){return"nativeEvent"in e}function Wx(e){return e.pointerType===""&&e.isTrusted?!0:Fh&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function iS(e){return Qx?!1:!Fh&&e.width===0&&e.height===0||Fh&&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 xo(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function G3(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Df(){return typeof window<"u"}function Hn(e){return Zx(e)?(e.nodeName||"").toLowerCase():"#document"}function $t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ma(e){var t;return(t=(Zx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zx(e){return Df()?e instanceof Node||e instanceof $t(e).Node:!1}function gt(e){return Df()?e instanceof Element||e instanceof $t(e).Element:!1}function Ut(e){return Df()?e instanceof HTMLElement||e instanceof $t(e).HTMLElement:!1}function Ll(e){return!Df()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $t(e).ShadowRoot}function Pr(e){const{overflow:t,overflowX:a,overflowY:o,display:l}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&l!=="inline"&&l!=="contents"}function Y3(e){return/^(table|td|th)$/.test(Hn(e))}function Pf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const K3=/transform|translate|scale|rotate|perspective|filter/,X3=/paint|layout|strict|content/,oo=e=>!!e&&e!=="none";let Ag;function Jx(e){const t=gt(e)?us(e):e;return oo(t.transform)||oo(t.translate)||oo(t.scale)||oo(t.rotate)||oo(t.perspective)||!eb()&&(oo(t.backdropFilter)||oo(t.filter))||K3.test(t.willChange||"")||X3.test(t.contain||"")}function Q3(e){let t=da(e);for(;Ut(t)&&!oa(t);){if(Jx(t))return t;if(Pf(t))return null;t=da(t)}return null}function eb(){return Ag==null&&(Ag=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ag}function oa(e){return/^(html|body|#document)$/.test(Hn(e))}function us(e){return $t(e).getComputedStyle(e)}function Lf(e){return gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function da(e){if(Hn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ll(e)&&e.host||ma(e);return Ll(t)?t.host:t}function cS(e){const t=da(e);return oa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(t)&&Pr(t)?t:cS(t)}function Mc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const l=cS(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),u=$t(l);if(c){const p=Gh(u);return t.concat(u,u.visualViewport||[],Pr(l)?l:[],p&&a?Mc(p):[])}else return t.concat(l,Mc(l,[],a))}function Gh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Yh="data-base-ui-focusable",uS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",If="ArrowLeft",Bf="ArrowRight",dS="ArrowUp",tb="ArrowDown";function qn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Ll(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Un(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Qd(e,t){if(!gt(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(Qe(o,a))return!o.hasAttribute("data-trigger-disabled");return!1}function Mg(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function W3(e){return e.matches("html,body")}function Uf(e){return Ut(e)&&e.matches(uS)}function Z3(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${uS}`)!=null}function Kh(e){return e?e.getAttribute("role")==="combobox"&&Uf(e):!1}function J3(e){if(!e||Qx)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Wd(e){return e?e.hasAttribute(Yh)?e:e.querySelector(`[${Yh}]`)||e:null}function e5(e,t){return t!=null&&!xo(t)?0:typeof e=="function"?e():e}function Il(e,t,a){const o=e5(e,a);return typeof o=="number"?o:o?.[t]}function L1(e){return typeof e=="function"?e():e}function fS(e,t){return t||e==="click"||e==="mousedown"}function t5(e){return e?.includes("mouse")&&e!=="mousedown"}function En(){}const Ya=Object.freeze([]),qt=Object.freeze({}),fa="none",ei="trigger-press",Rn="trigger-hover",Nl="trigger-focus",Hf="outside-press",El="item-press",n5="close-press",bo="focus-out",Vf="escape-key",Xh="list-navigation",pS="cancel-open",uc="sibling-open",mS="disabled",I1="missing",B1="initial",nb="imperative-action",s5="window-resize";function nt(e,t,a,o){let l=!1,c=!1;const u=o??qt;return{reason:e,event:t??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:a,...u}}const gS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new qs,currentIdRef:{current:null},currentContextRef:{current:null}});function a5(e,t){e.current=t.current}function r5(e){const{children:t,delay:a,timeoutMs:o=0}=e,l=x.useRef(a),c=x.useRef(a),u=x.useRef(null),p=x.useRef(null),m=kn();return De(()=>{if(c.current=a,!u.current){l.current=a;return}l.current={open:Il(l.current,"open"),close:Il(a,"close")}},[a,u,l,c]),r.jsx(gS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:u,timeoutMs:o,currentContextRef:p,timeout:m}),[o,m]),children:t})}function o5(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(gS),{currentIdRef:u,delayRef:p,timeoutMs:m,initialDelayRef:g,currentContextRef:h,hasProvider:b,timeout:v}=c,[k,N]=x.useState(!1),w=x.useRef(a),y=x.useRef(!1);return De(()=>{w.current=a},[a]),De(()=>()=>{y.current=!0},[]),De(()=>{function S(){y.current||N(!1),h.current?.setIsInstantPhase(!1),u.current=null,h.current=null,p.current=g.current,v.clear()}if(u.current&&!a&&u.current===l){if(N(!1),m){const C=l;return v.start(m,()=>{o.select("open")||u.current&&u.current!==C||S()}),()=>{(w.current||u.current!==C)&&v.clear()}}S()}},[a,l,u,p,m,g,h,v,o]),De(()=>{if(!a)return;const S=h.current,C=u.current;v.clear(),h.current={onOpenChange:o.setOpen,setIsInstantPhase:N},u.current=l,p.current={open:0,close:Il(g.current,"close")},C!==null&&C!==l?(N(!0),S?.setIsInstantPhase(!0),S?.onOpenChange(!1,nt(fa))):(N(!1),S?.setIsInstantPhase(!1))},[a,l,o,u,p,g,h,v]),De(()=>()=>{if(u.current===l){if(h.current=null,!w.current)return;u.current=null,a5(p,g),v.clear()}},[h,u,p,l,g,v]),x.useMemo(()=>({hasProvider:b,delayRef:p,isInstantPhase:k}),[b,p,k])}function ht(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function la(...e){return()=>{for(let t=0;t<e.length;t+=1){const a=e[t];a&&a()}}}function Ka(e,t,a,o){const l=Xn(hS).current;return i5(l,e,t,a,o)&&xS(l,[e,t,a,o]),l.callback}function l5(e){const t=Xn(hS).current;return c5(t,e)&&xS(t,e),t.callback}function hS(){return{callback:null,cleanup:null,refs:[]}}function i5(e,t,a,o,l){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==l}function c5(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function xS(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=c(a);typeof u=="function"&&(o[l]=u);break}case"object":{c.current=a;break}}}e.cleanup=()=>{for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=o[l];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}function cn(e){const t=Xn(u5,e).current;return t.next=e,De(t.effect),t}function u5(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const sb={...uT},Og=sb.useInsertionEffect,d5=Og&&Og!==sb.useLayoutEffect?Og:e=>e();function Ue(e){const t=Xn(f5).current;return t.next=e,d5(t.effect),t.trampoline}function f5(){const e={next:void 0,callback:p5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function p5(){}const fd=null;class m5{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<a.length;l+=1)a[l]?.(t)};request(t){const a=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),a}cancel(t){const a=t-this.startId;a<0||a>=this.callbacks.length||(this.callbacks[a]=null,this.callbacksCount-=1)}}const pd=new m5;class na{static create(){return new na}static request(t){return pd.request(t)}static cancel(t){return pd.cancel(t)}currentId=fd;request(t){this.cancel(),this.currentId=pd.request(()=>{this.currentId=fd,t()})}cancel=()=>{this.currentId!==fd&&(pd.cancel(this.currentId),this.currentId=fd)};disposeEffect=()=>this.cancel}function Bl(){const e=Xn(na.create).current;return Kx(e.disposeEffect),e}function mt(e){return e?.ownerDocument||document}const bS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ab={...bS,position:"fixed",top:0,left:0},_S={...bS,position:"absolute"},Ul=x.forwardRef(function(t,a){const[o,l]=x.useState();De(()=>{$3&&Dr&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...t,ref:a,style:ab,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),g5=["top","right","bottom","left"],Hl=Math.min,_s=Math.max,Zd=Math.round,md=Math.floor,ia=e=>({x:e,y:e}),h5={left:"right",right:"left",bottom:"top",top:"bottom"};function Qh(e,t,a){return _s(e,Hl(t,a))}function Xa(e,t){return typeof e=="function"?e(t):e}function cs(e){return e.split("-")[0]}function Lr(e){return e.split("-")[1]}function rb(e){return e==="x"?"y":"x"}function ob(e){return e==="y"?"height":"width"}function zs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function lb(e){return rb(zs(e))}function x5(e,t,a){a===void 0&&(a=!1);const o=Lr(e),l=lb(e),c=ob(l);let u=l==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Jd(u)),[u,Jd(u)]}function b5(e){const t=Jd(e);return[Wh(e),t,Wh(t)]}function Wh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const U1=["left","right"],H1=["right","left"],_5=["top","bottom"],v5=["bottom","top"];function y5(e,t,a){switch(e){case"top":case"bottom":return a?t?H1:U1:t?U1:H1;case"left":case"right":return t?_5:v5;default:return[]}}function j5(e,t,a,o){const l=Lr(e);let c=y5(cs(e),a==="start",o);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map(Wh)))),c}function Jd(e){const t=cs(e);return h5[t]+e.slice(t.length)}function w5(e){return{top:0,right:0,bottom:0,left:0,...e}}function vS(e){return typeof e!="number"?w5(e):{top:e,right:e,bottom:e,left:e}}function Oc(e){const{x:t,y:a,width:o,height:l}=e;return{width:o,height:l,top:a,left:t,right:t+o,bottom:a+l,x:t,y:a}}function vc(e,t){return t<0||t>=e.length}function Id(e,t){return Va(e.current,{disabledIndices:t})}function Zh(e,t){return Va(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Va(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:l=1}={}){let c=t;do c+=a?-l:l;while(c>=0&&c<=e.length-1&&ef(e,c,o));return c}function ef(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const l=e[t];return l?qf(l)?!a&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function k5(e){return e.visibility==="hidden"||e.visibility==="collapse"}function qf(e,t=e?us(e):null){return!e||!e.isConnected||!t||k5(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const S5='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function C5(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Ll(a)?a.host:null}function Jh(e){for(const t of Array.from(e.children))if(Hn(t)==="summary")return t;return null}function N5(e,t){const a=Jh(t);return!!a&&(e===a||Qe(a,e))}function yS(e){const t=e?Hn(e):"";return e!=null&&e.matches(S5)&&(t!=="summary"||e.parentElement!=null&&Hn(e.parentElement)==="details"&&Jh(e.parentElement)===e)&&(t!=="details"||Jh(e)==null)&&(t!=="input"||e.type!=="hidden")}function jS(e){if(!yS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=C5(t)){const a=t!==e,o=Hn(t)==="slot";if(t.hasAttribute("inert")||a&&Hn(t)==="details"&&!t.open&&!N5(e,t)||t.hasAttribute("hidden")||!o&&!E5(t,a))return!1}return!0}function E5(e,t){const a=us(e);return t?a.display!=="none":qf(e,a)}function wS(e){const t=e.tabIndex;if(t<0){const a=Hn(e);if(a==="details"||a==="audio"||a==="video"||Ut(e)&&e.isContentEditable)return 0}return t}function zg(e){if(Hn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function R5(e,t){const a=zg(e);if(!a)return!0;const o=t.find(l=>{const c=zg(l);return c?.name===a.name&&c.form===a.form&&c.checked});return o?o===a:t.find(l=>{const c=zg(l);return c?.name===a.name&&c.form===a.form})===a}function kS(e){if(Ut(e)&&Hn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ut(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function SS(e,t){kS(e).forEach(a=>{yS(a)&&t.push(a),SS(a,t)})}function CS(e,t,a){kS(e).forEach(o=>{Ut(o)&&o.matches(t)&&a.push(o),CS(o,t,a)})}function ib(e){return jS(e)&&wS(e)>=0}function NS(e){const t=[];return SS(e,t),t.filter(jS)}function $c(e){const t=NS(e);return t.filter(a=>wS(a)>=0&&R5(a,t))}function ES(e,t){const a=$c(e),o=a.length;if(o===0)return;const l=qn(mt(e)),c=a.indexOf(l),u=c===-1?t===1?0:o-1:c+t;return a[u]}function cb(e){return ES(mt(e).body,1)||e}function RS(e){return ES(mt(e).body,-1)||e}function TS(e,t){if(!e)return null;const a=$c(mt(e).body),o=a.length;if(o===0)return null;const l=a.indexOf(e);if(l===-1)return null;const c=(l+t+o)%o;return a[c]}function T5(e){return TS(e,1)}function A5(e){return TS(e,-1)}function Rl(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(a,o)}function M5(e){$c(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function V1(e){const t=[];CS(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function Or(e,t,a=!0){return e.filter(l=>l.parentId===t).flatMap(l=>[...!a||l.context?.open?[l]:[],...Or(e,l.id,a)])}function q1(e,t){let a=[],o=e.find(l=>l.id===t)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(a=a.concat(l))}return a}function zc(e){return`data-base-ui-${e}`}let gd=0;function Bd(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:l}=t;cancelAnimationFrame(gd);function c(){l&&!l()||e?.focus({preventScroll:a})}if(o)return c(),En;const u=requestAnimationFrame(c);return gd=u,()=>{gd===u&&(cancelAnimationFrame(u),gd=0)}}const Dg={inert:new WeakMap,"aria-hidden":new WeakMap},$1="data-base-ui-inert",ex={inert:new WeakSet,"aria-hidden":new WeakSet};let Zi=new WeakMap,Pg=0;function O5(e){return ex[e]}function AS(e){return e?Ll(e)?e.host:AS(e.parentNode):null}const F1=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=AS(a);return e.contains(o)?o:null}).filter(a=>a!=null),G1=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},Y1=(e,t,a)=>{const o=[],l=c=>{!c||a.has(c)||Array.from(c.children).forEach(u=>{Hn(u)!=="script"&&(t.has(u)?l(u):o.push(u))})};return l(e),o};function z5(e,t,a,o,{mark:l=!0}){let c=null;o?c="inert":a&&(c="aria-hidden");let u=null,p=null;const m=F1(t,e),g=l?Y1(t,G1(m),new Set(m)):[],h=[],b=[];if(c){const v=Dg[c],k=O5(c);p=k,u=v;const N=F1(t,Array.from(t.querySelectorAll("[aria-live]"))),w=m.concat(N);Y1(t,G1(w),new Set(w)).forEach(S=>{const C=S.getAttribute(c),E=C!==null&&C!=="false",R=(v.get(S)||0)+1;v.set(S,R),h.push(S),R===1&&E&&k.add(S),E||S.setAttribute(c,c==="inert"?"":"true")})}return l&&g.forEach(v=>{const k=(Zi.get(v)||0)+1;Zi.set(v,k),b.push(v),k===1&&v.setAttribute($1,"")}),Pg+=1,()=>{u&&h.forEach(v=>{const N=(u.get(v)||0)-1;u.set(v,N),N||(!p?.has(v)&&c&&v.removeAttribute(c),p?.delete(v))}),l&&b.forEach(v=>{const k=(Zi.get(v)||0)-1;Zi.set(v,k),k||v.removeAttribute($1)}),Pg-=1,Pg||(Dg.inert=new WeakMap,Dg["aria-hidden"]=new WeakMap,ex.inert=new WeakSet,ex["aria-hidden"]=new WeakSet,Zi=new WeakMap)}}function K1(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:l=!0}=t,c=mt(e[0]).body;return z5(e,c,a,o,{mark:l})}let X1=0;function D5(e,t="mui"){const[a,o]=x.useState(e),l=e||a;return x.useEffect(()=>{a==null&&(X1+=1,o(`${t}-${X1}`))},[a,t]),l}const Q1=sb.useId;function _o(e,t){if(Q1!==void 0){const a=Q1();return e??(t?`${t}-${a}`:a)}return D5(e,t)}const P5=parseInt(x.version,10);function ub(e){return P5>=e}function W1(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(ub(19)?a?.ref:t.ref)??null}function tx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function L5(e,t){const a={};for(const o in e){const l=e[o];if(t?.hasOwnProperty(o)){const c=t[o](l);c!=null&&Object.assign(a,c);continue}l===!0?a[`data-${o.toLowerCase()}`]="":l&&(a[`data-${o.toLowerCase()}`]=l.toString())}return a}function I5(e,t){return typeof e=="function"?e(t):e}function B5(e,t){return typeof e=="function"?e(t):e}const db={};function Fn(e,t,a,o,l){if(!a&&!o&&!l&&!e)return tf(t);let c=tf(e);return t&&(c=dc(c,t)),a&&(c=dc(c,a)),o&&(c=dc(c,o)),l&&(c=dc(c,l)),c}function U5(e){if(e.length===0)return db;if(e.length===1)return tf(e[0]);let t=tf(e[0]);for(let a=1;a<e.length;a+=1)t=dc(t,e[a]);return t}function tf(e){return fb(e)?{...OS(e,db)}:H5(e)}function dc(e,t){return fb(t)?OS(t,e):V5(e,t)}function H5(e){const t={...e};for(const a in t){const o=t[a];MS(a,o)&&(t[a]=zS(o))}return t}function V5(e,t){if(!t)return e;for(const a in t){const o=t[a];switch(a){case"style":{e[a]=tx(e.style,o);break}case"className":{e[a]=DS(e.className,o);break}default:MS(a,o)?e[a]=q5(e[a],o):e[a]=o}}return e}function MS(e,t){const a=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return a===111&&o===110&&l>=65&&l<=90&&(typeof t=="function"||typeof t>"u")}function fb(e){return typeof e=="function"}function OS(e,t){return fb(e)?e(t):e??db}function q5(e,t){return t?e?(...a)=>{const o=a[0];if(PS(o)){const c=o;nf(c);const u=t(...a);return c.baseUIHandlerPrevented||e?.(...a),u}const l=t(...a);return e?.(...a),l}:zS(t):e}function zS(e){return e&&((...t)=>{const a=t[0];return PS(a)&&nf(a),e(...t)})}function nf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function DS(e,t){return t?e?t+" "+e:t:e}function PS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Nt(e,t,a={}){const o=t.render,l=$5(t,a);if(a.enabled===!1)return null;const c=a.state??qt;return Y5(e,o,l,c)}function $5(e,t={}){const{className:a,style:o,render:l}=e,{state:c=qt,ref:u,props:p,stateAttributesMapping:m,enabled:g=!0}=t,h=g?I5(a,c):void 0,b=g?B5(o,c):void 0,v=g?L5(c,m):qt,k=g&&p?F5(p):void 0,N=g?tx(v,k)??{}:qt;return typeof document<"u"&&(g?Array.isArray(u)?N.ref=l5([N.ref,W1(l),...u]):N.ref=Ka(N.ref,W1(l),u):Ka(null,null)),g?(h!==void 0&&(N.className=DS(N.className,h)),b!==void 0&&(N.style=tx(N.style,b)),N):qt}function F5(e){return Array.isArray(e)?U5(e):Fn(void 0,e)}const G5=Symbol.for("react.lazy");function Y5(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const l=Fn(a,t.props);l.ref=a.ref;let c=t;return c?.$$typeof===G5&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return K5(e,a);throw new Error(nn(8))}function K5(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const X5=500,Q5=500,W5={style:{transition:"none"}},Z5="data-base-ui-click-trigger",LS={fallbackAxisSide:"none"},IS={fallbackAxisSide:"end"},J5={clipPath:"inset(50%)",position:"fixed",top:0,left:0},BS=x.createContext(null),US=()=>x.useContext(BS),eO=zc("portal");function HS(e={}){const{ref:t,container:a,componentProps:o=qt,elementProps:l}=e,c=_o(),p=US()?.portalNode,[m,g]=x.useState(null),[h,b]=x.useState(null),v=Ue(y=>{y!==null&&b(y)}),k=x.useRef(null);De(()=>{if(a===null){k.current&&(k.current=null,b(null),g(null));return}if(c==null)return;const y=(a&&(Zx(a)?a:a.current))??p??document.body;if(y==null){k.current&&(k.current=null,b(null),g(null));return}k.current!==y&&(k.current=y,b(null),g(y))},[a,p,c]);const N=Nt("div",o,{ref:[t,v],props:[{id:c,[eO]:""},l]});return{portalNode:h,portalSubtree:m&&N?ca.createPortal(N,m):null}}const pb=x.forwardRef(function(t,a){const{render:o,className:l,style:c,children:u,container:p,renderGuards:m,...g}=t,{portalNode:h,portalSubtree:b}=HS({container:p,ref:a,componentProps:t,elementProps:g}),v=x.useRef(null),k=x.useRef(null),N=x.useRef(null),w=x.useRef(null),[y,S]=x.useState(null),C=x.useRef(!1),E=y?.modal,R=y?.open,A=typeof m=="boolean"?m:!!y&&!y.modal&&y.open&&!!h;x.useEffect(()=>{if(!h||E)return;function M(z){h&&z.relatedTarget&&Rl(z)&&(z.type==="focusin"?C.current&&(V1(h),C.current=!1):(M5(h),C.current=!0))}return la(ht(h,"focusin",M,!0),ht(h,"focusout",M,!0))},[h,E]),De(()=>{!h||R!==!0||!C.current||(V1(h),C.current=!1)},[R,h]);const T=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:k,beforeInsideRef:N,afterInsideRef:w,portalNode:h,setFocusManagerState:S}),[h]);return r.jsxs(x.Fragment,{children:[b,r.jsxs(BS.Provider,{value:T,children:[A&&h&&r.jsx(Ul,{"data-type":"outside",ref:v,onFocus:M=>{if(Rl(M,h))N.current?.focus();else{const z=y?y.domReference:null;RS(z)?.focus()}}}),A&&h&&r.jsx("span",{"aria-owns":h.id,style:J5}),h&&ca.createPortal(u,h),A&&h&&r.jsx(Ul,{"data-type":"outside",ref:k,onFocus:M=>{if(Rl(M,h))w.current?.focus();else{const z=y?y.domReference:null;cb(z)?.focus(),y?.closeOnFocusOut&&y?.onOpenChange(!1,nt(bo,M.nativeEvent))}}})]})]})});function VS(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class mb{nodesRef={current:[]};events=VS();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const qS=x.createContext(null),$S=x.createContext(null),Ir=()=>x.useContext(qS)?.id||null,Br=e=>{const t=x.useContext($S);return e??t};function FS(e){const t=_o(),a=Br(e),o=Ir();return De(()=>{if(!t)return;const l={id:t,parentId:o};return a?.addNode(l),()=>{a?.removeNode(l)}},[a,t,o]),t}function tO(e){const{children:t,id:a}=e,o=Ir();return r.jsx(qS.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function nO(e){const{children:t,externalTree:a}=e,o=Xn(()=>a??new mb).current;return r.jsx($S.Provider,{value:o,children:t})}function Ua(e){return e==null?e:"current"in e?e.current:e}function sO(e,t){const a=$t(Un(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Z1=20;let Rr=[];function gb(){Rr=Rr.filter(e=>e.deref()?.isConnected)}function J1(e){gb(),e&&Hn(e)!=="body"&&(Rr.push(new WeakRef(e)),Rr.length>Z1&&(Rr=Rr.slice(-Z1)))}function ej(){return gb(),Rr[Rr.length-1]?.deref()}function aO(e){return e?ib(e)?e:$c(e)[0]||e:null}function tj(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=NS(e).filter(l=>{const c=l.getAttribute("data-tabindex")||"";return ib(l)||l.hasAttribute("data-tabindex")&&!c.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function hb(e){const{context:t,children:a,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:p=!0,closeOnFocusOut:m=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:b,beforeContentFocusGuardRef:v,externalTree:k,getInsideElements:N}=e,w="rootStore"in t?t.rootStore:t,y=w.useState("open"),S=w.useState("domReferenceElement"),C=w.useState("floatingElement"),{events:E,dataRef:R}=w.context,A=Ue(()=>R.current.floatingContext?.nodeId),T=l===!1,M=Kh(S)&&T,z=cn(l),I=cn(c),P=cn(g),H=cn(y),D=Br(k),B=US(),V=x.useRef(!1),$=x.useRef(!1),q=x.useRef(!1),Y=x.useRef(null),K=x.useRef(""),F=x.useRef(""),X=x.useRef(null),L=x.useRef(null),G=Ka(X,v,B?.beforeInsideRef),Z=Ka(L,B?.afterInsideRef),ee=kn(),de=kn(),fe=Bl(),ae=B!=null,oe=Wd(C),me=Ue((pe=oe)=>pe?$c(pe):[]),Te=Ue(()=>N?.().filter(pe=>pe!=null)??[]);x.useEffect(()=>{if(o||!p)return;function pe(je){je.key==="Tab"&&Qe(oe,qn(mt(oe)))&&me().length===0&&!M&&ea(je)}const Se=mt(oe);return ht(Se,"keydown",pe)},[o,oe,p,M,me]),x.useEffect(()=>{if(o||!y)return;const pe=mt(oe);function Se(){q.current=!1}function je(Ve){const we=Un(Ve),Ee=Te(),ve=Qe(C,we)||Qe(S,we)||Qe(B?.portalNode,we)||Ee.some(Ce=>Ce===we||Qe(Ce,we));q.current=!ve,F.current=Ve.pointerType||"keyboard",we?.closest(`[${Z5}]`)&&($.current=!0,de.start(0,()=>{$.current=!1}))}function Be(){F.current="keyboard"}return la(ht(pe,"pointerdown",je,!0),ht(pe,"pointerup",Se,!0),ht(pe,"pointercancel",Se,!0),ht(pe,"keydown",Be,!0),Se)},[o,C,S,oe,y,B,de,Te]),x.useEffect(()=>{if(o||!m)return;const pe=mt(oe);function Se(){$.current=!0,de.start(0,()=>{$.current=!1})}function je(Ee){const ve=Un(Ee);ib(ve)&&(Y.current=ve)}function Be(Ee){const ve=Ee.relatedTarget,Ce=Ee.currentTarget,Pe=Un(Ee);p&&ve==null&&Pe!=null&&Qe(C,Pe)&&J1(Pe),queueMicrotask(()=>{const Le=A(),Ie=w.context.triggerElements,se=Te(),be=ve?.hasAttribute(zc("focus-guard"))&&[X.current,L.current,B?.beforeInsideRef.current,B?.afterInsideRef.current,B?.beforeOutsideRef.current,B?.afterOutsideRef.current,Ua(b),Ua(h)].includes(ve),$e=!(Qe(S,ve)||Qe(C,ve)||Qe(ve,C)||Qe(B?.portalNode,ve)||se.some(Re=>Re===ve||Qe(Re,ve))||ve!=null&&Ie.hasElement(ve)||Ie.hasMatchingElement(Re=>Qe(Re,ve))||be||D&&(Or(D.nodesRef.current,Le).find(Re=>Qe(Re.context?.elements.floating,ve)||Qe(Re.context?.elements.domReference,ve))||q1(D.nodesRef.current,Le).find(Re=>[Re.context?.elements.floating,Wd(Re.context?.elements.floating)].includes(ve)||Re.context?.elements.domReference===ve)));if(Ce===S&&oe&&tj(oe),u&&Ce!==S&&!qf(Pe)&&qn(pe)===pe.body){if(Ut(oe)&&(oe.focus(),u==="popup")){fe.request(()=>{oe.focus()});return}const Re=me(),Oe=Y.current,We=(Oe&&Re.includes(Oe)?Oe:null)||Re[Re.length-1]||oe;Ut(We)&&We.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(M||!p)&&ve&&$e&&!$.current&&(M||ve!==ej())&&(V.current=!0,w.setOpen(!1,nt(bo,Ee)))})}function Ve(){q.current||(R.current.insideReactTree=!0,ee.start(0,()=>{R.current.insideReactTree=!1}))}const we=Ut(S)?S:null;if(!(!C&&!we))return la(we&&ht(we,"focusout",Be),we&&ht(we,"pointerdown",Se),C&&ht(C,"focusin",je),C&&ht(C,"focusout",Be),C&&B&&ht(C,"focusout",Ve,!0))},[o,S,C,oe,p,D,B,w,m,u,me,M,A,R,ee,de,fe,h,b,Te]),x.useEffect(()=>{if(o||!C||!y)return;const pe=Array.from(B?.portalNode?.querySelectorAll(`[${zc("portal")}]`)||[]),je=(D?q1(D.nodesRef.current,A()):[]).find(Ce=>Kh(Ce.context?.elements.domReference||null))?.context?.elements.domReference,Ve=[...[C,...pe,X.current,L.current,B?.beforeOutsideRef.current,B?.afterOutsideRef.current,...Te()],je,Ua(b),Ua(h),M?S:null].filter(Ce=>Ce!=null),we=K1(Ve,{ariaHidden:p||M,mark:!1}),Ee=[C,...pe].filter(Ce=>Ce!=null),ve=K1(Ee);return()=>{ve(),we()}},[y,o,S,C,p,B,M,D,A,h,b,Te]),De(()=>{if(!y||o||!Ut(oe))return;const pe=mt(oe),Se=qn(pe);queueMicrotask(()=>{const je=z.current,Be=typeof je=="function"?je(P.current||""):je;if(Be===void 0||Be===!1||Qe(oe,Se))return;let we=null;const Ee=()=>(we==null&&(we=me(oe)),we[0]||oe);let ve;Be===!0||Be===null?ve=Ee():ve=Ua(Be),ve=ve||Ee();const Ce=Qe(oe,qn(pe));Bd(ve,{preventScroll:ve===oe,shouldFocus(){if(!H.current)return!1;if(Ce)return!0;const Pe=qn(pe);return!(Pe!==ve&&Qe(oe,Pe))}})})},[o,y,oe,me,z,P,H]),De(()=>{if(o||!oe)return;const pe=mt(oe),Se=qn(pe),je=P.current==null;J1(Se);function Be(we){if(we.open||(K.current=sO(we.nativeEvent,F.current)),we.reason===Rn&&we.nativeEvent.type==="mouseleave"&&(V.current=!0),we.reason===Hf)if(we.nested)V.current=!1;else if(Wx(we.nativeEvent)||iS(we.nativeEvent))V.current=!1;else{let Ee=!1;mt(oe).createElement("div").focus({get preventScroll(){return Ee=!0,!1}}),Ee?V.current=!1:V.current=!0}}E.on("openchange",Be);function Ve(){const we=I.current;let Ee=typeof we=="function"?we(K.current):we;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const ve=S?.isConnected?S:null,Ce=Se?.isConnected&&Hn(Se)!=="body"?Se:null;let Pe=je?Ce||ve:ve||Ce;return Pe||(Pe=ej()||null),typeof Ee=="boolean"?Pe:Ua(Ee)||Pe||null}return()=>{E.off("openchange",Be);const we=qn(pe),Ee=Te(),ve=Qe(C,we)||Ee.some(Le=>Le===we||Qe(Le,we))||D&&Or(D.nodesRef.current,A(),!1).some(Le=>Qe(Le.context?.elements.floating,we)),Ce=I.current,Pe=Ve();queueMicrotask(()=>{const Le=aO(Pe),Ie=typeof Ce!="boolean";Ce&&!V.current&&Ut(Le)&&(!(!Ie&&Le!==we&&we!==pe.body)||ve)&&Le.focus({preventScroll:!0}),V.current=!1})}},[o,C,oe,I,P,E,D,S,A,Te]),De(()=>{if(!Dr||y||!C)return;const pe=qn(mt(C));!Ut(pe)||!Uf(pe)||Qe(C,pe)&&pe.blur()},[y,C]),De(()=>{if(!(o||!B))return B.setFocusManagerState({modal:p,closeOnFocusOut:m,open:y,onOpenChange:w.setOpen,domReference:S}),()=>{B.setFocusManagerState(null)}},[o,B,p,y,w,m,S]),De(()=>{if(!(o||!oe))return tj(oe),()=>{queueMicrotask(gb)}},[o,oe]);const ie=!o&&(p?!M:!0)&&(ae||p);return r.jsxs(x.Fragment,{children:[ie&&r.jsx(Ul,{"data-type":"inside",ref:G,onFocus:pe=>{if(p){const Se=me();Bd(Se[Se.length-1])}else B?.portalNode&&(V.current=!1,Rl(pe,B.portalNode)?cb(S)?.focus():Ua(b??B.beforeOutsideRef)?.focus())}}),a,ie&&r.jsx(Ul,{"data-type":"inside",ref:Z,onFocus:pe=>{p?Bd(me()[0]):B?.portalNode&&(m&&(V.current=!0),Rl(pe,B.portalNode)?RS(S)?.focus():Ua(h??B.afterOutsideRef)?.focus())}})]})}function GS(e,t={}){const{enabled:a=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:p=0,reason:m=ei}=t,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,b=x.useRef(void 0),v=Bl(),k=kn(),N=x.useMemo(()=>{function w(S,C,E,R){const A=nt(m,C,E);S&&R==="touch"&&p>0?k.start(p,()=>{g.setOpen(!0,A)}):g.setOpen(S,A)}function y(S,C,E){const R=h.current.openEvent,A=g.select("domReferenceElement")!==C;return S&&A||!S||!l?!0:R&&u?!E(R.type):!1}return{onPointerDown(S){b.current=S.pointerType},onMouseDown(S){const C=b.current,E=S.nativeEvent,R=g.select("open");if(S.button!==0||o==="click"||xo(C,!0)&&c)return;const A=y(R,S.currentTarget,z=>z==="click"||z==="mousedown"),T=Un(E);if(Uf(T)){w(A,E,T,C);return}const M=S.currentTarget;v.request(()=>{w(A,E,M,C)})},onClick(S){if(o==="mousedown-only")return;const C=b.current;if(o==="mousedown"&&C){b.current=void 0;return}if(xo(C,!0)&&c)return;const E=g.select("open"),R=y(E,S.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");w(R,S.nativeEvent,S.currentTarget,C)},onKeyDown(){b.current=void 0}}},[h,o,c,m,g,u,l,v,k,p]);return x.useMemo(()=>a?{reference:N}:qt,[a,N])}function rO(e,t){let a=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let g=c.width,h=c.height,b=c.x,v=c.y;return a==null&&t.x&&u&&(a=c.x-t.x),o==null&&t.y&&p&&(o=c.y-t.y),b-=a||0,v-=o||0,g=0,h=0,!l||m?(g=t.axis==="y"?c.width:0,h=t.axis==="x"?c.height:0,b=u&&t.x!=null?t.x:b,v=p&&t.y!=null?t.y:v):l&&!m&&(h=t.axis==="x"?c.height:h,g=t.axis==="y"?c.width:g),l=!0,{width:g,height:h,x:b,y:v,top:v,right:b+g,bottom:v+h,left:b}}}}function nj(e){return e!=null&&e.clientX!=null}function oO(e,t={}){const{enabled:a=!0,axis:o="both"}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.context.dataRef,g=x.useRef(!1),h=x.useRef(null),[b,v]=x.useState(),[k,N]=x.useState([]),w=Ue(R=>{l.set("positionReference",R)}),y=Ue((R,A,T)=>{g.current||m.current.openEvent&&!nj(m.current.openEvent)||l.set("positionReference",rO(T??p,{x:R,y:A,axis:o,dataRef:m,pointerType:b}))}),S=Ue(R=>{c?h.current||(y(R.clientX,R.clientY,R.currentTarget),N([])):y(R.clientX,R.clientY,R.currentTarget)}),C=xo(b)?u:c;x.useEffect(()=>{if(!a){w(p);return}if(!C)return;function R(){h.current?.(),h.current=null}const A=$t(u);function T(M){const z=Un(M);Qe(u,z)?R():y(M.clientX,M.clientY)}return!m.current.openEvent||nj(m.current.openEvent)?h.current=ht(A,"mousemove",T):w(p),R},[C,a,u,m,p,l,y,w,k]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{a&&!u&&(g.current=!1)},[a,u]),x.useEffect(()=>{!a&&c&&(g.current=!0)},[a,c]);const E=x.useMemo(()=>{function R(A){v(A.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:S,onMouseEnter:S}},[S]);return x.useMemo(()=>a?{reference:E,trigger:E}:{},[a,E])}function lO(){return!1}function iO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function $f(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=lO,bubbles:p,externalTree:m}=t,g="rootStore"in e?e.rootStore:e,h=g.useState("open"),b=g.useState("floatingElement"),{dataRef:v}=g.context,k=Br(m),N=Ue(typeof l=="function"?l:()=>!1),w=typeof l=="function"?N:l,y=w!==!1,S=Ue(()=>c),{escapeKey:C,outsidePress:E}=iO(p),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(!1),M=x.useRef(!1),z=x.useRef(""),I=x.useRef(null),P=kn(),H=kn(),D=Ue(()=>{H.clear(),v.current.insideReactTree=!1}),B=Ue(G=>{const Z=v.current.floatingContext?.nodeId;return(k?Or(k.nodesRef.current,Z):[]).some(de=>de.context?.open&&!de.context.dataRef.current[G])}),V=Ue(G=>Mg(G,g.select("floatingElement"))||Mg(G,g.select("domReferenceElement"))),$=Ue(G=>{u()&&g.setOpen(!1,nt(ei,G.nativeEvent))}),q=Ue(G=>{if(!h||!a||!o||G.key!=="Escape"||M.current||!C&&B("__escapeKeyBubbles"))return;const Z=F3(G)?G.nativeEvent:G,ee=nt(Vf,Z);g.setOpen(!1,ee),ee.isCanceled||G.preventDefault(),!C&&!ee.isPropagationAllowed&&G.stopPropagation()}),Y=Ue(()=>{v.current.insideReactTree=!0,H.start(0,D)}),K=Ue(G=>{if(!h||!a||G.button!==0)return;const Z=Un(G.nativeEvent);Qe(g.select("floatingElement"),Z)&&(R.current||(R.current=!0,A.current=!1))}),F=Ue(G=>{!h||!a||(G.defaultPrevented||G.nativeEvent.defaultPrevented)&&R.current&&(A.current=!0)});x.useEffect(()=>{if(!h||!a)return;v.current.__escapeKeyBubbles=C,v.current.__outsidePressBubbles=E;const G=new qs,Z=new qs;function ee(){G.clear(),M.current=!0}function de(){G.start(Dr?5:0,()=>{M.current=!1})}function fe(){T.current=!0,Z.start(0,()=>{T.current=!1})}function ae(){R.current=!1,A.current=!1}function oe(){const se=z.current,be=se==="pen"||!se?"mouse":se,$e=S(),Re=typeof $e=="function"?$e():$e;return typeof Re=="string"?Re:Re[be]}function me(se){const be=oe();return be==="intentional"&&se.type!=="click"||be==="sloppy"&&se.type==="click"}function Te(se){const be=v.current.floatingContext?.nodeId,$e=k&&Or(k.nodesRef.current,be).some(Re=>Mg(se,Re.context?.elements.floating));return V(se)||$e}function ie(se){if(me(se)){se.type!=="click"&&!V(se)&&(Z.clear(),T.current=!1),D();return}if(v.current.insideReactTree){D();return}const be=Un(se),$e=`[${zc("inert")}]`,Re=gt(be)?be.getRootNode():null,Oe=Array.from((Ll(Re)?Re:mt(g.select("floatingElement"))).querySelectorAll($e)),We=g.context.triggerElements;if(be&&(We.hasElement(be)||We.hasMatchingElement(yt=>Qe(yt,be))))return;let at=gt(be)?be:null;for(;at&&!oa(at);){const yt=da(at);if(oa(yt)||!gt(yt))break;at=yt}if(!(Oe.length&>(be)&&!W3(be)&&!Qe(be,g.select("floatingElement"))&&Oe.every(yt=>!Qe(at,yt)))){if(Ut(be)&&!("touches"in se)){const yt=oa(be),_e=us(be),Me=/auto|scroll/,He=yt||Me.test(_e.overflowX),Xe=yt||Me.test(_e.overflowY),ot=He&&be.clientWidth>0&&be.scrollWidth>be.clientWidth,sn=Xe&&be.clientHeight>0&&be.scrollHeight>be.clientHeight,dn=_e.direction==="rtl",pt=sn&&(dn?se.offsetX<=be.offsetWidth-be.clientWidth:se.offsetX>be.clientWidth),Et=ot&&se.offsetY>be.clientHeight;if(pt||Et)return}if(!Te(se)){if(oe()==="intentional"&&T.current){Z.clear(),T.current=!1;return}typeof w=="function"&&!w(se)||B("__outsidePressBubbles")||(g.setOpen(!1,nt(Hf,se)),D())}}}function pe(se){oe()!=="sloppy"||se.pointerType==="touch"||!g.select("open")||!a||V(se)||ie(se)}function Se(se){if(oe()!=="sloppy"||!g.select("open")||!a||V(se))return;const be=se.touches[0];be&&(I.current={startTime:Date.now(),startX:be.clientX,startY:be.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}function je(se,be){const $e=Un(se);if(!$e)return;const Re=ht($e,se.type,()=>{be(se),Re()})}function Be(se){z.current="touch",je(se,Se)}function Ve(se){P.clear(),se.type==="pointerdown"&&(z.current=se.pointerType),!(se.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)&&je(se,be=>{be.type==="pointerdown"?pe(be):ie(be)})}function we(se){if(!R.current)return;const be=A.current;if(ae(),oe()==="intentional"){if(se.type==="pointercancel"){be&&fe();return}if(!Te(se)){if(be){fe();return}typeof w=="function"&&!w(se)||(Z.clear(),T.current=!0,D())}}}function Ee(se){if(oe()!=="sloppy"||!I.current||V(se))return;const be=se.touches[0];if(!be)return;const $e=Math.abs(be.clientX-I.current.startX),Re=Math.abs(be.clientY-I.current.startY),Oe=Math.sqrt($e*$e+Re*Re);Oe>5&&(I.current.dismissOnTouchEnd=!0),Oe>10&&(ie(se),P.clear(),I.current=null)}function ve(se){je(se,Ee)}function Ce(se){oe()!=="sloppy"||!I.current||V(se)||(I.current.dismissOnTouchEnd&&ie(se),P.clear(),I.current=null)}function Pe(se){je(se,Ce)}const Le=mt(b),Ie=la(o&&la(ht(Le,"keydown",q),ht(Le,"compositionstart",ee),ht(Le,"compositionend",de)),y&&la(ht(Le,"click",Ve,!0),ht(Le,"pointerdown",Ve,!0),ht(Le,"pointerup",we,!0),ht(Le,"pointercancel",we,!0),ht(Le,"mousedown",Ve,!0),ht(Le,"mouseup",we,!0),ht(Le,"touchstart",Be,!0),ht(Le,"touchmove",ve,!0),ht(Le,"touchend",Pe,!0)));return()=>{Ie(),G.clear(),Z.clear(),ae(),T.current=!1}},[v,b,o,y,w,h,a,C,E,q,D,S,B,V,k,g,P]),x.useEffect(D,[w,D]);const X=x.useMemo(()=>({onKeyDown:q,onPointerDown:$,onClick:$}),[q,$]),L=x.useMemo(()=>({onKeyDown:q,onPointerDown:F,onMouseDown:F,onClickCapture:Y,onMouseDownCapture(G){Y(),K(G)},onPointerDownCapture(G){Y(),K(G)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[q,Y,K,F]);return x.useMemo(()=>a?{reference:X,floating:L,trigger:X}:{},[a,X,L])}function sj(e,t,a){let{reference:o,floating:l}=e;const c=zs(t),u=lb(t),p=ob(u),m=cs(t),g=c==="y",h=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,v=o[p]/2-l[p]/2;let k;switch(m){case"top":k={x:h,y:o.y-l.height};break;case"bottom":k={x:h,y:o.y+o.height};break;case"right":k={x:o.x+o.width,y:b};break;case"left":k={x:o.x-l.width,y:b};break;default:k={x:o.x,y:o.y}}switch(Lr(t)){case"start":k[u]-=v*(a&&g?-1:1);break;case"end":k[u]+=v*(a&&g?-1:1);break}return k}async function cO(e,t){var a;t===void 0&&(t={});const{x:o,y:l,platform:c,rects:u,elements:p,strategy:m}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:v=!1,padding:k=0}=Xa(t,e),N=vS(k),y=p[v?b==="floating"?"reference":"floating":b],S=Oc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(y)))==null||a?y:y.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:g,rootBoundary:h,strategy:m})),C=b==="floating"?{x:o,y:l,width:u.floating.width,height:u.floating.height}:u.reference,E=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(E))?await(c.getScale==null?void 0:c.getScale(E))||{x:1,y:1}:{x:1,y:1},A=Oc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:C,offsetParent:E,strategy:m}):C);return{top:(S.top-A.top+N.top)/R.y,bottom:(A.bottom-S.bottom+N.bottom)/R.y,left:(S.left-A.left+N.left)/R.x,right:(A.right-S.right+N.right)/R.x}}const uO=50,dO=async(e,t,a)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:u}=a,p=u.detectOverflow?u:{...u,detectOverflow:cO},m=await(u.isRTL==null?void 0:u.isRTL(t));let g=await u.getElementRects({reference:e,floating:t,strategy:l}),{x:h,y:b}=sj(g,o,m),v=o,k=0;const N={};for(let w=0;w<c.length;w++){const y=c[w];if(!y)continue;const{name:S,fn:C}=y,{x:E,y:R,data:A,reset:T}=await C({x:h,y:b,initialPlacement:o,placement:v,strategy:l,middlewareData:N,rects:g,platform:p,elements:{reference:e,floating:t}});h=E??h,b=R??b,N[S]={...N[S],...A},T&&k<uO&&(k++,typeof T=="object"&&(T.placement&&(v=T.placement),T.rects&&(g=T.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):T.rects),{x:h,y:b}=sj(g,v,m)),w=-1)}return{x:h,y:b,placement:v,strategy:l,middlewareData:N}},fO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,o;const{placement:l,middlewareData:c,rects:u,initialPlacement:p,platform:m,elements:g}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:v,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:w=!0,...y}=Xa(e,t);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const S=cs(l),C=zs(p),E=cs(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(g.floating)),A=v||(E||!w?[Jd(p)]:b5(p)),T=N!=="none";!v&&T&&A.push(...j5(p,w,N,R));const M=[p,...A],z=await m.detectOverflow(t,y),I=[];let P=((o=c.flip)==null?void 0:o.overflows)||[];if(h&&I.push(z[S]),b){const V=x5(l,u,R);I.push(z[V[0]],z[V[1]])}if(P=[...P,{placement:l,overflows:I}],!I.every(V=>V<=0)){var H,D;const V=(((H=c.flip)==null?void 0:H.index)||0)+1,$=M[V];if($&&(!(b==="alignment"?C!==zs($):!1)||P.every(K=>zs(K.placement)===C?K.overflows[0]>0:!0)))return{data:{index:V,overflows:P},reset:{placement:$}};let q=(D=P.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:D.placement;if(!q)switch(k){case"bestFit":{var B;const Y=(B=P.filter(K=>{if(T){const F=zs(K.placement);return F===C||F==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(F=>F>0).reduce((F,X)=>F+X,0)]).sort((K,F)=>K[1]-F[1])[0])==null?void 0:B[0];Y&&(q=Y);break}case"initialPlacement":q=p;break}if(l!==q)return{reset:{placement:q}}}return{}}}};function aj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rj(e){return g5.some(t=>e[t]>=0)}const pO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:a,platform:o}=t,{strategy:l="referenceHidden",...c}=Xa(e,t);switch(l){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),p=aj(u,a.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:rj(p)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),p=aj(u,a.floating);return{data:{escapedOffsets:p,escaped:rj(p)}}}default:return{}}}}},YS=new Set(["left","top"]);async function mO(e,t){const{placement:a,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),u=cs(a),p=Lr(a),m=zs(a)==="y",g=YS.has(u)?-1:1,h=c&&m?-1:1,b=Xa(t,e);let{mainAxis:v,crossAxis:k,alignmentAxis:N}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return p&&typeof N=="number"&&(k=p==="end"?N*-1:N),m?{x:k*h,y:v*g}:{x:v*g,y:k*h}}const gO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:l,y:c,placement:u,middlewareData:p}=t,m=await mO(t,e);return u===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:u}}}}},hO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:l,platform:c}=t,{mainAxis:u=!0,crossAxis:p=!1,limiter:m={fn:S=>{let{x:C,y:E}=S;return{x:C,y:E}}},...g}=Xa(e,t),h={x:a,y:o},b=await c.detectOverflow(t,g),v=zs(cs(l)),k=rb(v);let N=h[k],w=h[v];if(u){const S=k==="y"?"top":"left",C=k==="y"?"bottom":"right",E=N+b[S],R=N-b[C];N=Qh(E,N,R)}if(p){const S=v==="y"?"top":"left",C=v==="y"?"bottom":"right",E=w+b[S],R=w-b[C];w=Qh(E,w,R)}const y=m.fn({...t,[k]:N,[v]:w});return{...y,data:{x:y.x-a,y:y.y-o,enabled:{[k]:u,[v]:p}}}}}},xO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:a,y:o,placement:l,rects:c,middlewareData:u}=t,{offset:p=0,mainAxis:m=!0,crossAxis:g=!0}=Xa(e,t),h={x:a,y:o},b=zs(l),v=rb(b);let k=h[v],N=h[b];const w=Xa(p,t),y=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(m){const E=v==="y"?"height":"width",R=c.reference[v]-c.floating[E]+y.mainAxis,A=c.reference[v]+c.reference[E]-y.mainAxis;k<R?k=R:k>A&&(k=A)}if(g){var S,C;const E=v==="y"?"width":"height",R=YS.has(cs(l)),A=c.reference[b]-c.floating[E]+(R&&((S=u.offset)==null?void 0:S[b])||0)+(R?0:y.crossAxis),T=c.reference[b]+c.reference[E]+(R?0:((C=u.offset)==null?void 0:C[b])||0)-(R?y.crossAxis:0);N<A?N=A:N>T&&(N=T)}return{[v]:k,[b]:N}}}},bO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var a,o;const{placement:l,rects:c,platform:u,elements:p}=t,{apply:m=()=>{},...g}=Xa(e,t),h=await u.detectOverflow(t,g),b=cs(l),v=Lr(l),k=zs(l)==="y",{width:N,height:w}=c.floating;let y,S;b==="top"||b==="bottom"?(y=b,S=v===(await(u.isRTL==null?void 0:u.isRTL(p.floating))?"start":"end")?"left":"right"):(S=b,y=v==="end"?"top":"bottom");const C=w-h.top-h.bottom,E=N-h.left-h.right,R=Hl(w-h[y],C),A=Hl(N-h[S],E),T=!t.middlewareData.shift;let M=R,z=A;if((a=t.middlewareData.shift)!=null&&a.enabled.x&&(z=E),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(M=C),T&&!v){const P=_s(h.left,0),H=_s(h.right,0),D=_s(h.top,0),B=_s(h.bottom,0);k?z=N-2*(P!==0||H!==0?P+H:_s(h.left,h.right)):M=w-2*(D!==0||B!==0?D+B:_s(h.top,h.bottom))}await m({...t,availableWidth:z,availableHeight:M});const I=await u.getDimensions(p.floating);return N!==I.width||w!==I.height?{reset:{rects:!0}}:{}}}};function KS(e){const t=us(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=Ut(e),c=l?e.offsetWidth:a,u=l?e.offsetHeight:o,p=Zd(a)!==c||Zd(o)!==u;return p&&(a=c,o=u),{width:a,height:o,$:p}}function xb(e){return gt(e)?e:e.contextElement}function Tl(e){const t=xb(e);if(!Ut(t))return ia(1);const a=t.getBoundingClientRect(),{width:o,height:l,$:c}=KS(t);let u=(c?Zd(a.width):a.width)/o,p=(c?Zd(a.height):a.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!p||!Number.isFinite(p))&&(p=1),{x:u,y:p}}const _O=ia(0);function XS(e){const t=$t(e);return!eb()||!t.visualViewport?_O:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vO(e,t,a){return t===void 0&&(t=!1),!a||t&&a!==$t(e)?!1:t}function vo(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const l=e.getBoundingClientRect(),c=xb(e);let u=ia(1);t&&(o?gt(o)&&(u=Tl(o)):u=Tl(e));const p=vO(c,a,o)?XS(c):ia(0);let m=(l.left+p.x)/u.x,g=(l.top+p.y)/u.y,h=l.width/u.x,b=l.height/u.y;if(c){const v=$t(c),k=o&>(o)?$t(o):o;let N=v,w=Gh(N);for(;w&&o&&k!==N;){const y=Tl(w),S=w.getBoundingClientRect(),C=us(w),E=S.left+(w.clientLeft+parseFloat(C.paddingLeft))*y.x,R=S.top+(w.clientTop+parseFloat(C.paddingTop))*y.y;m*=y.x,g*=y.y,h*=y.x,b*=y.y,m+=E,g+=R,N=$t(w),w=Gh(N)}}return Oc({width:h,height:b,x:m,y:g})}function Ff(e,t){const a=Lf(e).scrollLeft;return t?t.left+a:vo(ma(e)).left+a}function QS(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-Ff(e,a),l=a.top+t.scrollTop;return{x:o,y:l}}function yO(e){let{elements:t,rect:a,offsetParent:o,strategy:l}=e;const c=l==="fixed",u=ma(o),p=t?Pf(t.floating):!1;if(o===u||p&&c)return a;let m={scrollLeft:0,scrollTop:0},g=ia(1);const h=ia(0),b=Ut(o);if((b||!b&&!c)&&((Hn(o)!=="body"||Pr(u))&&(m=Lf(o)),b)){const k=vo(o);g=Tl(o),h.x=k.x+o.clientLeft,h.y=k.y+o.clientTop}const v=u&&!b&&!c?QS(u,m):ia(0);return{width:a.width*g.x,height:a.height*g.y,x:a.x*g.x-m.scrollLeft*g.x+h.x+v.x,y:a.y*g.y-m.scrollTop*g.y+h.y+v.y}}function jO(e){return Array.from(e.getClientRects())}function wO(e){const t=ma(e),a=Lf(e),o=e.ownerDocument.body,l=_s(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=_s(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-a.scrollLeft+Ff(e);const p=-a.scrollTop;return us(o).direction==="rtl"&&(u+=_s(t.clientWidth,o.clientWidth)-l),{width:l,height:c,x:u,y:p}}const oj=25;function kO(e,t){const a=$t(e),o=ma(e),l=a.visualViewport;let c=o.clientWidth,u=o.clientHeight,p=0,m=0;if(l){c=l.width,u=l.height;const h=eb();(!h||h&&t==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const g=Ff(o);if(g<=0){const h=o.ownerDocument,b=h.body,v=getComputedStyle(b),k=h.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,N=Math.abs(o.clientWidth-b.clientWidth-k);N<=oj&&(c-=N)}else g<=oj&&(c+=g);return{width:c,height:u,x:p,y:m}}function SO(e,t){const a=vo(e,!0,t==="fixed"),o=a.top+e.clientTop,l=a.left+e.clientLeft,c=Ut(e)?Tl(e):ia(1),u=e.clientWidth*c.x,p=e.clientHeight*c.y,m=l*c.x,g=o*c.y;return{width:u,height:p,x:m,y:g}}function lj(e,t,a){let o;if(t==="viewport")o=kO(e,a);else if(t==="document")o=wO(ma(e));else if(gt(t))o=SO(t,a);else{const l=XS(e);o={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return Oc(o)}function WS(e,t){const a=da(e);return a===t||!gt(a)||oa(a)?!1:us(a).position==="fixed"||WS(a,t)}function CO(e,t){const a=t.get(e);if(a)return a;let o=Mc(e,[],!1).filter(p=>gt(p)&&Hn(p)!=="body"),l=null;const c=us(e).position==="fixed";let u=c?da(e):e;for(;gt(u)&&!oa(u);){const p=us(u),m=Jx(u);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Pr(u)&&!m&&WS(e,u))?o=o.filter(h=>h!==u):l=p,u=da(u)}return t.set(e,o),o}function NO(e){let{element:t,boundary:a,rootBoundary:o,strategy:l}=e;const u=[...a==="clippingAncestors"?Pf(t)?[]:CO(t,this._c):[].concat(a),o],p=lj(t,u[0],l);let m=p.top,g=p.right,h=p.bottom,b=p.left;for(let v=1;v<u.length;v++){const k=lj(t,u[v],l);m=_s(k.top,m),g=Hl(k.right,g),h=Hl(k.bottom,h),b=_s(k.left,b)}return{width:g-b,height:h-m,x:b,y:m}}function EO(e){const{width:t,height:a}=KS(e);return{width:t,height:a}}function RO(e,t,a){const o=Ut(t),l=ma(t),c=a==="fixed",u=vo(e,!0,c,t);let p={scrollLeft:0,scrollTop:0};const m=ia(0);function g(){m.x=Ff(l)}if(o||!o&&!c)if((Hn(t)!=="body"||Pr(l))&&(p=Lf(t)),o){const k=vo(t,!0,c,t);m.x=k.x+t.clientLeft,m.y=k.y+t.clientTop}else l&&g();c&&!o&&l&&g();const h=l&&!o&&!c?QS(l,p):ia(0),b=u.left+p.scrollLeft-m.x-h.x,v=u.top+p.scrollTop-m.y-h.y;return{x:b,y:v,width:u.width,height:u.height}}function Lg(e){return us(e).position==="static"}function ij(e,t){if(!Ut(e)||us(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return ma(e)===a&&(a=a.ownerDocument.body),a}function ZS(e,t){const a=$t(e);if(Pf(e))return a;if(!Ut(e)){let l=da(e);for(;l&&!oa(l);){if(gt(l)&&!Lg(l))return l;l=da(l)}return a}let o=ij(e,t);for(;o&&Y3(o)&&Lg(o);)o=ij(o,t);return o&&oa(o)&&Lg(o)&&!Jx(o)?a:o||Q3(e)||a}const TO=async function(e){const t=this.getOffsetParent||ZS,a=this.getDimensions,o=await a(e.floating);return{reference:RO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function AO(e){return us(e).direction==="rtl"}const JS={convertOffsetParentRelativeRectToViewportRelativeRect:yO,getDocumentElement:ma,getClippingRect:NO,getOffsetParent:ZS,getElementRects:TO,getClientRects:jO,getDimensions:EO,getScale:Tl,isElement:gt,isRTL:AO};function e2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function MO(e,t){let a=null,o;const l=ma(e);function c(){var p;clearTimeout(o),(p=a)==null||p.disconnect(),a=null}function u(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),c();const g=e.getBoundingClientRect(),{left:h,top:b,width:v,height:k}=g;if(p||t(),!v||!k)return;const N=md(b),w=md(l.clientWidth-(h+v)),y=md(l.clientHeight-(b+k)),S=md(h),E={rootMargin:-N+"px "+-w+"px "+-y+"px "+-S+"px",threshold:_s(0,Hl(1,m))||1};let R=!0;function A(T){const M=T[0].intersectionRatio;if(M!==m){if(!R)return u();M?u(!1,M):o=setTimeout(()=>{u(!1,1e-7)},1e3)}M===1&&!e2(g,e.getBoundingClientRect())&&u(),R=!1}try{a=new IntersectionObserver(A,{...E,root:l.ownerDocument})}catch{a=new IntersectionObserver(A,E)}a.observe(e)}return u(!0),c}function cj(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,g=xb(e),h=l||c?[...g?Mc(g):[],...t?Mc(t):[]]:[];h.forEach(S=>{l&&S.addEventListener("scroll",a,{passive:!0}),c&&S.addEventListener("resize",a)});const b=g&&p?MO(g,a):null;let v=-1,k=null;u&&(k=new ResizeObserver(S=>{let[C]=S;C&&C.target===g&&k&&t&&(k.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var E;(E=k)==null||E.observe(t)})),a()}),g&&!m&&k.observe(g),t&&k.observe(t));let N,w=m?vo(e):null;m&&y();function y(){const S=vo(e);w&&!e2(w,S)&&a(),w=S,N=requestAnimationFrame(y)}return a(),()=>{var S;h.forEach(C=>{l&&C.removeEventListener("scroll",a),c&&C.removeEventListener("resize",a)}),b?.(),(S=k)==null||S.disconnect(),k=null,m&&cancelAnimationFrame(N)}}const OO=gO,zO=hO,DO=fO,PO=bO,LO=pO,IO=xO,BO=(e,t,a)=>{const o=new Map,l={platform:JS,...a},c={...l.platform,_c:o};return dO(e,t,{...l,platform:c})};var UO=typeof document<"u",HO=function(){},Ud=UO?x.useLayoutEffect:HO;function sf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!sf(e[o],t[o]))return!1;return!0}if(l=Object.keys(e),a=l.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,l[o]))return!1;for(o=a;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!sf(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function t2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uj(e,t){const a=t2(e);return Math.round(t*a)/a}function Ig(e){const t=x.useRef(e);return Ud(()=>{t.current=e}),t}function VO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:u}={},transform:p=!0,whileElementsMounted:m,open:g}=e,[h,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[v,k]=x.useState(o);sf(v,o)||k(o);const[N,w]=x.useState(null),[y,S]=x.useState(null),C=x.useCallback(K=>{K!==T.current&&(T.current=K,w(K))},[]),E=x.useCallback(K=>{K!==M.current&&(M.current=K,S(K))},[]),R=c||N,A=u||y,T=x.useRef(null),M=x.useRef(null),z=x.useRef(h),I=m!=null,P=Ig(m),H=Ig(l),D=Ig(g),B=x.useCallback(()=>{if(!T.current||!M.current)return;const K={placement:t,strategy:a,middleware:v};H.current&&(K.platform=H.current),BO(T.current,M.current,K).then(F=>{const X={...F,isPositioned:D.current!==!1};V.current&&!sf(z.current,X)&&(z.current=X,ca.flushSync(()=>{b(X)}))})},[v,t,a,H,D]);Ud(()=>{g===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,b(K=>({...K,isPositioned:!1})))},[g]);const V=x.useRef(!1);Ud(()=>(V.current=!0,()=>{V.current=!1}),[]),Ud(()=>{if(R&&(T.current=R),A&&(M.current=A),R&&A){if(P.current)return P.current(R,A,B);B()}},[R,A,B,P,I]);const $=x.useMemo(()=>({reference:T,floating:M,setReference:C,setFloating:E}),[C,E]),q=x.useMemo(()=>({reference:R,floating:A}),[R,A]),Y=x.useMemo(()=>{const K={position:a,left:0,top:0};if(!q.floating)return K;const F=uj(q.floating,h.x),X=uj(q.floating,h.y);return p?{...K,transform:"translate("+F+"px, "+X+"px)",...t2(q.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:F,top:X}},[a,p,q.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:B,refs:$,elements:q,floatingStyles:Y}),[h,B,$,q,Y])}const qO=(e,t)=>{const a=OO(e);return{name:a.name,fn:a.fn,options:[e,t]}},$O=(e,t)=>{const a=zO(e);return{name:a.name,fn:a.fn,options:[e,t]}},FO=(e,t)=>({fn:IO(e).fn,options:[e,t]}),GO=(e,t)=>{const a=DO(e);return{name:a.name,fn:a.fn,options:[e,t]}},YO=(e,t)=>{const a=PO(e);return{name:a.name,fn:a.fn,options:[e,t]}},KO=(e,t)=>{const a=LO(e);return{name:a.name,fn:a.fn,options:[e,t]}};function bb(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const Ae=(e,t,a,o,l,c,...u)=>{if(u.length>0)throw new Error(nn(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var Bg={exports:{}},Ug={};/**
|
|
601
|
+
* @license React
|
|
602
|
+
* use-sync-external-store-shim.production.js
|
|
603
|
+
*
|
|
604
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
605
|
+
*
|
|
606
|
+
* This source code is licensed under the MIT license found in the
|
|
607
|
+
* LICENSE file in the root directory of this source tree.
|
|
608
|
+
*/var dj;function XO(){if(dj)return Ug;dj=1;var e=Bc();function t(b,v){return b===v&&(b!==0||1/b===1/v)||b!==b&&v!==v}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function p(b,v){var k=v(),N=o({inst:{value:k,getSnapshot:v}}),w=N[0].inst,y=N[1];return c(function(){w.value=k,w.getSnapshot=v,m(w)&&y({inst:w})},[b,k,v]),l(function(){return m(w)&&y({inst:w}),b(function(){m(w)&&y({inst:w})})},[b]),u(k),k}function m(b){var v=b.getSnapshot;b=b.value;try{var k=v();return!a(b,k)}catch{return!0}}function g(b,v){return v()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:p;return Ug.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Ug}var fj;function n2(){return fj||(fj=1,Bg.exports=XO()),Bg.exports}var af=n2(),Hg={exports:{}},Vg={};/**
|
|
609
|
+
* @license React
|
|
610
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
611
|
+
*
|
|
612
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
613
|
+
*
|
|
614
|
+
* This source code is licensed under the MIT license found in the
|
|
615
|
+
* LICENSE file in the root directory of this source tree.
|
|
616
|
+
*/var pj;function QO(){if(pj)return Vg;pj=1;var e=Bc(),t=n2();function a(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var o=typeof Object.is=="function"?Object.is:a,l=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,p=e.useMemo,m=e.useDebugValue;return Vg.useSyncExternalStoreWithSelector=function(g,h,b,v,k){var N=c(null);if(N.current===null){var w={hasValue:!1,value:null};N.current=w}else w=N.current;N=p(function(){function S(T){if(!C){if(C=!0,E=T,T=v(T),k!==void 0&&w.hasValue){var M=w.value;if(k(M,T))return R=M}return R=T}if(M=R,o(E,T))return M;var z=v(T);return k!==void 0&&k(M,z)?(E=T,M):(E=T,R=z)}var C=!1,E,R,A=b===void 0?null:b;return[function(){return S(h())},A===null?void 0:function(){return S(A())}]},[h,b,v,k]);var y=l(g,N[0],N[1]);return u(function(){w.hasValue=!0,w.value=y},[y]),m(y),y},Vg}var mj;function WO(){return mj||(mj=1,Hg.exports=QO()),Hg.exports}var ZO=WO();const JO=ub(19),e4=JO?n4:s4;function tt(e,t,a,o,l){return e4(e,t,a,o,l)}function t4(e,t,a,o,l){const c=x.useCallback(()=>t(e.getSnapshot(),a,o,l),[e,t,a,o,l]);return af.useSyncExternalStore(e.subscribe,c,c)}z3({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a<e.syncHooks.length;a+=1){const o=e.syncHooks[a],l=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,l)||(t=!0,o.value=l)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const l of e.syncHooks)a.add(l.store);const o=[];for(const l of a)o.push(l.subscribe(t));return()=>{for(const l of o)l()}}),af.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function n4(e,t,a,o,l){const c=O3();if(!c)return t4(e,t,a,o,l);const u=c.syncIndex;c.syncIndex+=1;let p;return c.didInitialize?(p=c.syncHooks[u],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,l))&&(p.store!==e&&(c.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=l,p.value=t(e.getSnapshot(),a,o,l))):(p={store:e,selector:t,a1:a,a2:o,a3:l,value:t(e.getSnapshot(),a,o,l)},c.syncHooks.push(p)),p.value}function s4(e,t,a,o,l){return ZO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,a,o,l))}class s2{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,l){return tt(this,t,a,o,l)}}class Gf extends s2{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;De(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;De(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);De(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,l=a!==void 0;De(()=>{l&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,l])}select(t,a,o,l){const c=this.selectors[t];return c(this.state,a,o,l)}useState(t,a,o,l){return x.useDebugValue(t),tt(this,this.selectors[t],a,o,l)}useContextCallback(t,a){x.useDebugValue(t);const o=Ue(a??En);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let l=o(this.state);return a(l,l,this),this.subscribe(c=>{const u=o(c);if(!Object.is(l,u)){const p=l;l=u,a(u,p,this)}})}}const a4={open:Ae(e=>e.open),transitionStatus:Ae(e=>e.transitionStatus),domReferenceElement:Ae(e=>e.domReferenceElement),referenceElement:Ae(e=>e.positionReference??e.referenceElement),floatingElement:Ae(e=>e.floatingElement),floatingId:Ae(e=>e.floatingId)};class Yf extends Gf{constructor(t){const{syncOnly:a,nested:o,onOpenChange:l,triggerElements:c,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:VS(),nested:o,triggerElements:c},a4),this.syncOnly=a}syncOpenEvent=(t,a)=>{(!t||!this.state.open||a!=null&&G3(a))&&(this.context.dataRef.current.openEvent=t?a:void 0)};dispatchOpenChange=(t,a)=>{this.syncOpenEvent(t,a.event);const o={open:t,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",o)};setOpen=(t,a)=>{if(this.syncOnly){this.context.onOpenChange?.(t,a);return}this.dispatchOpenChange(t,a),this.context.onOpenChange?.(t,a)}}function a2(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:u}=e,p=t.useState("open"),m=t.useState("activeTriggerElement"),g=t.useState(a?"popupElement":"positionerElement"),h=t.context.triggerElements,b=u,v=x.useRef(null);o===void 0&&v.current===null&&(v.current=new Yf({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:g,triggerElements:h,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const k=o??v.current;return t.useSyncedValue("floatingId",l),De(()=>{const N={open:p,floatingId:l,referenceElement:m,floatingElement:g};gt(m)&&(N.domReferenceElement=m),k.state.positionReference===k.state.referenceElement&&(N.positionReference=m),k.update(N)},[p,l,m,g,k]),k.context.onOpenChange=b,k.context.nested=c,k}function ti(e,t=!1,a=!1){const[o,l]=x.useState(e&&t?"idle":void 0),[c,u]=x.useState(e);return e&&!c&&(u(!0),l("starting")),!e&&c&&o!=="ending"&&!a&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),De(()=>{if(!e&&c&&o!=="ending"&&a){const p=na.request(()=>{l("ending")});return()=>{na.cancel(p)}}},[e,c,o,a]),De(()=>{if(!e||t)return;const p=na.request(()=>{l(void 0)});return()=>{na.cancel(p)}},[t,e]),De(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&l("starting");const p=na.request(()=>{l("idle")});return()=>{na.cancel(p)}},[t,e,c,o]),{mounted:c,setMounted:u,transitionStatus:o}}let yo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const r4={[yo.startingStyle]:""},o4={[yo.endingStyle]:""},Ja={transitionStatus(e){return e==="starting"?r4:e==="ending"?o4:null}};function r2(e,t=!1,a=!0){const o=Bl();return Ue((l,c=null)=>{o.cancel();const u=Ua(e);if(u==null)return;const p=u,m=()=>{ca.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function g(){Promise.all(p.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(a){c?.aborted||m();return}const h=p.getAnimations();!c?.aborted&&h.length>0&&h.some(b=>b.pending||b.playState!=="finished")&&g()})}if(t){const h=yo.startingStyle;if(!p.hasAttribute(h)){o.request(g);return}const b=new MutationObserver(()=>{p.hasAttribute(h)||(b.disconnect(),g())});b.observe(p,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(g)})}function ga(e){const{enabled:t=!0,open:a,ref:o,onComplete:l}=e,c=Ue(l),u=r2(o,a,!1);x.useEffect(()=>{if(!t)return;const p=new AbortController;return u(c,p.signal),()=>{p.abort()}},[t,a,c,u])}const Kf={tabIndex:-1,[Yh]:""};function l4(e){return t=>t==="touch"?e.current:!0}function o2(e,t,a=!1){const o=_o(),l=Ir()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=t(o,l));const u=e??c.current;return a2({popupStore:u,treatPopupAsFloatingElement:a,floatingRootContext:u.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:u.setOpen}),{store:u,internalStore:c.current}}function i4(e,t){const a=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(a.current!==null){const u=a.current,p=o.current,m=t.context.triggerElements.getById(u);p&&m===p&&(t.context.triggerElements.delete(u),c=!0),a.current=null,o.current=null}if(l!==null&&(a.current=e,o.current=l,t.context.triggerElements.add(e,l),c=!0),c){const u=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==u&&t.set("triggerCount",u)}},[t,e])}function _b(e,t,a,o=!1){t?e.preventUnmountingOnClose=!1:o&&(e.preventUnmountingOnClose=!0);const l=a?.id??null;(l||t)&&(e.activeTriggerId=l,e.activeTriggerElement=a??null)}function l2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function c4(e,t,a,o={}){const l=a.reason,c=l===Rn,u=t&&l===Nl,p=!t&&(l===ei||l===Vf),m=l2(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const g=()=>{const h={...o.extraState,open:t};u?h.instantType="focus":p?h.instantType="dismiss":c&&(h.instantType=void 0),_b(h,t,a.trigger,m()),e.update(h)};c?ca.flushSync(g):g()}function i2(e,t,a,o){bb(()=>{t===void 0&&e.state.open===!1&&a&&(e.state={...e.state,open:!0,activeTriggerId:o,preventUnmountingOnClose:!1})})}function c2(e,t,a,o){const l=a.useState("isMountedByTrigger",e),c=i4(e,a),u=Ue(p=>{if(c(p),!p)return;const m=a.select("open"),g=a.select("activeTriggerId");if(g===e){a.update({activeTriggerElement:p,...m?o:null});return}g==null&&m&&a.update({activeTriggerId:e,activeTriggerElement:p,...o})});return De(()=>{l&&a.update({activeTriggerElement:t.current,...o})},[l,a,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:l}}function vb(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=e.useState("open"),l=e.useState("triggerCount");De(()=>{if(!o){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const p=e.select("activeTriggerId");let m=null;if(p){const g=e.context.triggerElements.getById(p);g?g!==e.state.activeTriggerElement&&(u.activeTriggerElement=g):m=p}if(!m&&!p&&c===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[h,b]=g.value;u.activeTriggerId=h,u.activeTriggerElement=b}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),m&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===m&&!e.context.triggerElements.getById(m)){const g=nt(fa);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,l,a])}function yb(e,t,a){const{mounted:o,setMounted:l,transitionStatus:c}=ti(e),u=t.useState("preventUnmountingOnClose"),p=e?!1:u;t.useSyncedValues({mounted:o,transitionStatus:c,preventUnmountingOnClose:p});const m=Ue(()=>{l(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ga({enabled:o&&!e&&!p,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:c}}function jb(e,t){e.useSyncedValues(t),De(()=>()=>{e.update({activeTriggerProps:qt,inactiveTriggerProps:qt,popupProps:qt})},[e])}function u4(e,t){De(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),De(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Fc{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,a){const o=this.idMap.get(t);o!==a&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(a),this.idMap.set(t,a))}delete(t){const a=this.idMap.get(t);a&&(this.elementsSet.delete(a),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const a of this.elementsSet)if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function d4(){return new Yf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Fc,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function wb(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:d4(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:qt,inactiveTriggerProps:qt,popupProps:qt}}function u2(e,t,a=!1){return new Yf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0})}const yc=Ae(e=>e.triggerIdProp??e.activeTriggerId),kb=Ae(e=>e.openProp??e.open),gj=Ae(e=>(e.popupElement?.id??e.floatingId)||void 0);function d2(e,t){return t!==void 0&&kb(e)&&yc(e)===t}function f4(e,t){return d2(e,t)?!0:t!==void 0&&kb(e)&&yc(e)==null&&e.triggerCount===1}const Sb={open:kb,mounted:Ae(e=>e.mounted),transitionStatus:Ae(e=>e.transitionStatus),floatingRootContext:Ae(e=>e.floatingRootContext),triggerCount:Ae(e=>e.triggerCount),preventUnmountingOnClose:Ae(e=>e.preventUnmountingOnClose),payload:Ae(e=>e.payload),activeTriggerId:yc,activeTriggerElement:Ae(e=>e.mounted?e.activeTriggerElement:null),popupId:gj,isTriggerActive:Ae((e,t)=>t!==void 0&&yc(e)===t),isOpenedByTrigger:Ae((e,t)=>d2(e,t)),isMountedByTrigger:Ae((e,t)=>t!==void 0&&yc(e)===t&&e.mounted),triggerProps:Ae((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Ae((e,t)=>f4(e,t)?gj(e):void 0),popupProps:Ae(e=>e.popupProps),popupElement:Ae(e=>e.popupElement),positionerElement:Ae(e=>e.positionerElement)};function f2(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,l=_o(),c=Ir()!=null,u=Xn(()=>new Yf({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Fc,floatingId:l,syncOnly:!1,nested:c})).current;return De(()=>{const p={open:t,floatingId:l};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=gt(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),u.update(p)},[t,l,o.reference,o.floating,u]),u.context.onOpenChange=a,u.context.nested=c,u}function p4(e={}){const{nodeId:t,externalTree:a}=e,o=f2(e),l=e.rootContext||o,c=l.useState("referenceElement"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.useState("open"),g=l.useState("floatingId"),[h,b]=x.useState(null),[v,k]=x.useState(void 0),[N,w]=x.useState(void 0),y=x.useRef(null),S=Br(a),C=x.useMemo(()=>({reference:c,floating:u,domReference:p}),[c,u,p]),E=VO({...e,elements:{...C,...h&&{reference:h}}}),R=gt(v)?v:null,A=N===void 0?l.state.floatingElement:N;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?p:R),l.useSyncedValue("floatingElement",A);const T=x.useCallback(D=>{const B=gt(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;b(B),E.refs.setReference(B)},[E.refs]),M=x.useCallback(D=>{(gt(D)||D===null)&&(y.current=D,k(D)),(gt(E.refs.reference.current)||E.refs.reference.current===null||D!==null&&!gt(D))&&E.refs.setReference(D)},[E.refs,k]),z=x.useCallback(D=>{w(D),E.refs.setFloating(D)},[E.refs]),I=x.useMemo(()=>({...E.refs,setReference:M,setFloating:z,setPositionReference:T,domReference:y}),[E.refs,M,z,T]),P=x.useMemo(()=>({...E.elements,domReference:p}),[E.elements,p]),H=x.useMemo(()=>({...E,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:g,refs:I,elements:P,nodeId:t,rootStore:l}),[E,I,P,t,l,m,g]);return De(()=>{p&&(y.current=p)},[p]),De(()=>{l.context.dataRef.current.floatingContext=H;const D=S?.nodesRef.current.find(B=>B.id===t);D&&(D.context=H)}),x.useMemo(()=>({...E,context:H,refs:I,elements:P,rootStore:l}),[E,I,P,H,l])}const qg=Xx&&Dr;function p2(e,t={}){const{enabled:a=!0,delay:o}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=l.context,p=x.useRef(!1),m=x.useRef(null),g=x.useRef(!0),h=kn();x.useEffect(()=>{const v=l.select("domReferenceElement");if(!a)return;const k=$t(v);function N(){const S=l.select("domReferenceElement");!l.select("open")&&Ut(S)&&S===qn(mt(S))&&(p.current=!0)}function w(){g.current=!0}function y(){g.current=!1}return la(ht(k,"blur",N),qg&&ht(k,"keydown",w,!0),qg&&ht(k,"pointerdown",y,!0))},[l,a]),x.useEffect(()=>{if(!a)return;function v(k){if(k.reason===ei||k.reason===Vf){const N=l.select("domReferenceElement");gt(N)&&(m.current=N,p.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,a,l]);const b=x.useMemo(()=>{function v(){p.current=!1,m.current=null}return{onMouseLeave(){v()},onFocus(k){const N=k.currentTarget;if(p.current){if(m.current===N)return;v()}const w=Un(k.nativeEvent);if(gt(w)){if(qg&&!k.relatedTarget){if(!g.current&&!Uf(w))return}else if(!J3(w))return}const y=Qd(k.relatedTarget,l.context.triggerElements),{nativeEvent:S,currentTarget:C}=k,E=typeof o=="function"?o():o;if(l.select("open")&&y||E===0||E===void 0){l.setOpen(!0,nt(Nl,S,C));return}h.start(E,()=>{p.current||l.setOpen(!0,nt(Nl,S,C))})},onBlur(k){v();const N=k.relatedTarget,w=k.nativeEvent,y=gt(N)&&N.hasAttribute(zc("focus-guard"))&&N.getAttribute("data-type")==="outside";h.start(0,()=>{const S=l.select("domReferenceElement"),C=qn(mt(S));!N&&C===S||Qe(u.current.floatingContext?.refs.floating.current,C)||Qe(S,C)||y||Qd(N??C,l.context.triggerElements)||l.setOpen(!1,nt(Nl,w))})}}},[u,o,l,h]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class Cb{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 qs,this.restTimeout=new qs,this.handleCloseOptions=void 0}static create(){return new Cb}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const rf=new WeakMap;function of(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&rf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),rf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function m2(e,t){const{scopeElement:a,referenceElement:o,floatingElement:l}=t,c=rf.get(a);c&&c!==e&&of(c),of(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,rf.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Nb(e){const t=e.context.dataRef.current,a=Xn(()=>t.hoverInteractionState??Cb.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),Kx(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function g2(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:l}=t,c="rootStore"in e?e.rootStore:e,u=c.useState("open"),p=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:g}=c.context,h=Br(),b=Ir(),v=Nb(c),k=kn(),N=Ue(()=>fS(g.current.openEvent?.type,v.interactedInside)),w=Ue(()=>t5(g.current.openEvent?.type)),y=Ue(()=>{of(v)});De(()=>{u||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,y())},[u,v,y]),x.useEffect(()=>y,[y]),De(()=>{if(a&&u&&v.handleCloseOptions?.blockPointerEvents&&w()&>(m)&&p){const S=m,C=p,E=mt(p),R=h?.nodesRef.current.find(z=>z.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const A=v.pointerEventsScopeElement!==C?v.pointerEventsScopeElement:null,T=R!==C?R:null,M=v.handleCloseOptions?.getScope?.()??A??T??S.closest("[data-rootownerid]")??E.body;return m2(v,{scopeElement:M,referenceElement:S,floatingElement:C}),()=>{y()}}},[a,u,m,p,v,w,h,b,y]),x.useEffect(()=>{if(!a)return;function S(){return!!(h&&b&&Or(h.nodesRef.current,b).length>0)}function C(z){const I=Il(o,"close",v.pointerType),P=()=>{c.setOpen(!1,nt(Rn,z)),h?.events.emit("floating.closed",z)};I?v.openChangeTimeout.start(I,P):(v.openChangeTimeout.clear(),P())}function E(z){const I=Un(z);if(!Z3(I)){v.interactedInside=!1;return}v.interactedInside=I?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),k.clear(),h?.events.off("floating.closed",T),y()}function A(z){if(S()&&h){h.events.on("floating.closed",T);return}if(Qd(z.relatedTarget,c.context.triggerElements))return;const I=g.current.floatingContext?.nodeId??l,P=z.relatedTarget;if(!(h&&I&>(P)&&Or(h.nodesRef.current,I,!1).some(D=>Qe(D.context?.elements.floating,P)))){if(v.handler){v.handler(z);return}y(),w()&&!N()&&C(z)}}function T(z){!h||!b||S()||k.start(0,()=>{h.events.off("floating.closed",T),c.setOpen(!1,nt(Rn,z)),h.events.emit("floating.closed",z)})}const M=p;return la(M&&ht(M,"mouseenter",R),M&&ht(M,"mouseleave",A),M&&ht(M,"pointerdown",E,!0),()=>{h?.events.off("floating.closed",T)})},[a,p,c,g,o,l,w,N,y,v,h,b,k])}const m4={current:null};function h2(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:p=!0,triggerElementRef:m=m4,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:b,isClosing:v,shouldOpen:k}=t,N="rootStore"in e?e.rootStore:e,{dataRef:w,events:y}=N.context,S=Br(g),C=Nb(N),E=x.useRef(!1),R=cn(l),A=cn(o),T=cn(u),M=cn(a),z=cn(k),I=cn(v),P=Ue(()=>fS(w.current.openEvent?.type,C.interactedInside)),H=Ue(()=>z.current?.()!==!1),D=Ue(($,q,Y)=>{const K=N.context.triggerElements;if(K.hasElement(q))return!$||!Qe($,q);if(!gt(Y))return!1;const F=Y;return K.hasMatchingElement(X=>Qe(X,F))&&(!$||!Qe($,F))}),B=Ue(()=>{if(!C.handler)return;mt(N.select("domReferenceElement")).removeEventListener("mousemove",C.handler),C.handler=void 0}),V=Ue(()=>{of(C)});return h&&(C.handleCloseOptions=R.current?.__options),x.useEffect(()=>B,[B]),x.useEffect(()=>{if(!a)return;function $(q){q.open?E.current=!1:(E.current=q.reason===Rn,B(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return y.on("openchange",$),()=>{y.off("openchange",$)}},[a,y,C,B]),x.useEffect(()=>{if(!a)return;function $(F,X=!0){const L=Il(A.current,"close",C.pointerType);L?C.openChangeTimeout.start(L,()=>{N.setOpen(!1,nt(Rn,F)),S?.events.emit("floating.closed",F)}):X&&(C.openChangeTimeout.clear(),N.setOpen(!1,nt(Rn,F)),S?.events.emit("floating.closed",F))}const q=m.current??(h?N.select("domReferenceElement"):null);if(!gt(q))return;function Y(F){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,c&&!xo(C.pointerType))return;const X=L1(T.current),L=Il(A.current,"open",C.pointerType),G=Un(F),Z=F.currentTarget??null,ee=N.select("domReferenceElement");let de=Z;if(gt(G)&&!N.context.triggerElements.hasElement(G)){for(const je of N.context.triggerElements.elements())if(Qe(je,G)){de=je;break}}gt(Z)&>(ee)&&!N.context.triggerElements.hasElement(Z)&&Qe(Z,ee)&&(de=ee);const fe=de==null?!1:D(ee,de,G),ae=N.select("open"),oe=I.current?.()??N.select("transitionStatus")==="ending",me=!ae&&oe&&E.current,Te=!fe&>(de)&>(ee)&&Qe(ee,de)&&me,ie=X>0&&!L,pe=fe&&(ae||me)||Te,Se=!ae||fe;if(pe){H()&&N.setOpen(!0,nt(Rn,F,de));return}ie||(L?C.openChangeTimeout.start(L,()=>{Se&&H()&&N.setOpen(!0,nt(Rn,F,de))}):Se&&H()&&N.setOpen(!0,nt(Rn,F,de)))}function K(F){if(P()){V();return}B();const X=N.select("domReferenceElement"),L=mt(X);C.restTimeout.clear(),C.restTimeoutPending=!1;const G=w.current.floatingContext??b?.();if(Qd(F.relatedTarget,N.context.triggerElements))return;if(R.current&&G){N.select("open")||C.openChangeTimeout.clear();const ee=m.current;C.handler=R.current({...G,tree:S,x:F.clientX,y:F.clientY,onClose(){V(),B(),M.current&&!P()&&ee===N.select("domReferenceElement")&&$(F,!0)}}),L.addEventListener("mousemove",C.handler),C.handler(F);return}(C.pointerType==="touch"?!Qe(N.select("floatingElement"),F.relatedTarget):!0)&&$(F)}return p?la(ht(q,"mousemove",Y,{once:!0}),ht(q,"mouseenter",Y),ht(q,"mouseleave",K)):la(ht(q,"mouseenter",Y),ht(q,"mouseleave",K))},[B,V,w,A,N,a,R,C,h,D,P,c,p,T,m,S,M,b,I,H]),x.useMemo(()=>{if(!a)return;function $(q){C.pointerType=q.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(q){const{nativeEvent:Y}=q,K=q.currentTarget,F=N.select("domReferenceElement"),X=N.select("open"),L=D(F,K,q.target);if(c&&!xo(C.pointerType))return;if(X&&L&&C.handleCloseOptions?.blockPointerEvents){const ee=N.select("floatingElement");if(ee){const de=C.handleCloseOptions?.getScope?.()??K.ownerDocument.body;m2(C,{scopeElement:de,referenceElement:K,floatingElement:ee})}}const G=L1(T.current);if(X&&!L||G===0||!L&&C.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;C.restTimeout.clear();function Z(){if(C.restTimeoutPending=!1,P())return;const ee=N.select("open");!C.blockMouseMove&&(!ee||L)&&H()&&N.setOpen(!0,nt(Rn,Y,K))}C.pointerType==="touch"?ca.flushSync(()=>{Z()}):L&&X?Z():(C.restTimeoutPending=!0,C.restTimeout.start(G,Z))}}},[a,C,P,D,c,N,T,H])}const g4="Escape";function Xf(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function hd(e,t){return Xf(t,e===dS||e===tb,e===If||e===Bf)}function $g(e,t,a){return Xf(t,e===tb,a?e===If:e===Bf)||e==="Enter"||e===" "||e===""}function h4(e,t,a){return Xf(t,a?e===If:e===Bf,e===tb)}function x4(e,t,a,o){const l=a?e===Bf:e===If,c=e===dS;return t==="both"||t==="horizontal"&&o?e===g4:Xf(t,l,c)}function x2(e,t){const{listRef:a,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:v="auto",focusItemOnHover:k=!0,openOnArrowKeyDown:N=!0,disabledIndices:w=void 0,orientation:y="vertical",parentOrientation:S,id:C,resetOnPointerLeave:E=!0,externalTree:R,grid:A}=t,T=A!=null,M="rootStore"in e?e.rootStore:e,z=M.useState("open"),I=M.useState("floatingElement"),P=M.useState("domReferenceElement"),H=M.context.dataRef,D=Wd(I),B=Kh(P),V=cn(D),$=Ir(),q=Br(R),Y=x.useRef(v),K=x.useRef(u??-1),F=x.useRef(null),X=x.useRef(!0),L=Ue(se=>{l(K.current===-1?null:K.current,se)}),G=x.useRef(!!I),Z=x.useRef(z),ee=x.useRef(!1),de=x.useRef(!1),fe=x.useRef(null),ae=cn(w),oe=cn(z),me=cn(u),Te=cn(E),ie=Bl(),pe=Bl(),Se=Ue(()=>{function se(Oe){b?q?.events.emit("virtualfocus",Oe):fe.current=Bd(Oe,{sync:ee.current,preventScroll:!0})}const be=a.current[K.current],$e=de.current;be&&se(be),(ee.current?Oe=>Oe():Oe=>ie.request(Oe))(()=>{const Oe=a.current[K.current]||be;if(!Oe)return;be||se(Oe),ve&&($e||!X.current)&&Oe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});De(()=>{H.current.orientation=y},[H,y]),De(()=>{c&&(z&&I?(K.current=u??-1,Y.current&&u!=null&&(de.current=!0,L())):G.current&&(K.current=-1,L()))},[c,z,I,u,L]),De(()=>{if(c){if(!z){ee.current=!1;return}if(I)if(o==null){if(ee.current=!1,me.current!=null)return;if(G.current&&(K.current=-1,Se()),(!Z.current||!G.current)&&Y.current&&(F.current!=null||Y.current===!0&&F.current==null)){let se=0;const be=()=>{a.current[0]==null?(se<2&&(se?Re=>pe.request(Re):queueMicrotask)(be),se+=1):(K.current=F.current==null||$g(F.current,y,h)||g?Id(a):Zh(a),F.current=null,L())};be()}}else vc(a.current,o)||(K.current=o,Se(),de.current=!1)}},[c,z,I,o,me,g,a,y,h,L,Se,pe]),De(()=>{if(!c||I||!q||b||!G.current)return;const se=q.nodesRef.current,be=se.find(Oe=>Oe.id===$)?.context?.elements.floating,$e=qn(mt(P??be??null)),Re=se.some(Oe=>Oe.context&&Qe(Oe.context.elements.floating,$e));be&&!Re&&X.current&&be.focus({preventScroll:!0})},[c,I,P,q,$,b]),De(()=>{Z.current=z,G.current=!!I}),De(()=>{z||(F.current=null,Y.current=v)},[z,v]);const je=o!=null,Be=Ue(se=>{if(!oe.current)return;const be=a.current.indexOf(se.currentTarget);be!==-1&&(K.current!==be||o!==be)&&(K.current=be,L(se))}),Ve=Ue(()=>S??q?.nodesRef.current.find(se=>se.id===$)?.context?.dataRef?.current.orientation),we=Ue(()=>Id(a,ae.current)),Ee=Ue(se=>{if(X.current=!1,ee.current=!0,se.which===229||!oe.current&&se.currentTarget===V.current)return;if(g&&x4(se.key,y,h,T)){hd(se.key,Ve())||ea(se),M.setOpen(!1,nt(Xh,se.nativeEvent)),Ut(P)&&(b?q?.events.emit("virtualfocus",P):P.focus());return}const be=K.current,$e=Id(a,w),Re=Zh(a,w);if(B||(se.key==="Home"&&(ea(se),K.current=$e,L(se)),se.key==="End"&&(ea(se),K.current=Re,L(se))),A!=null){const Oe=A(se,K.current,a,y,m,h,w,$e,Re);if(Oe!=null&&(K.current=Oe,L(se)),y==="both")return}if(hd(se.key,y)){if(ea(se),z&&!b&&qn(se.currentTarget.ownerDocument)===se.currentTarget){K.current=$g(se.key,y,h)?$e:Re,L(se);return}$g(se.key,y,h)?m?be>=Re?p&&be!==a.current.length?K.current=-1:(ee.current=!1,K.current=$e):K.current=Va(a.current,{startingIndex:be,disabledIndices:w}):K.current=Math.min(Re,Va(a.current,{startingIndex:be,disabledIndices:w})):m?be<=$e?p&&be!==-1?K.current=a.current.length:(ee.current=!1,K.current=Re):K.current=Va(a.current,{startingIndex:be,decrement:!0,disabledIndices:w}):K.current=Math.max($e,Va(a.current,{startingIndex:be,decrement:!0,disabledIndices:w})),vc(a.current,K.current)&&(K.current=-1),L(se)}}),ve=x.useMemo(()=>({onFocus(be){ee.current=!0,Be(be)},onClick:({currentTarget:be})=>be.focus({preventScroll:!0}),onMouseMove(be){ee.current=!0,de.current=!1,k&&Be(be)},onPointerLeave(be){if(!oe.current||!X.current||be.pointerType==="touch")return;ee.current=!0;const $e=be.relatedTarget;if(!(!k||a.current.includes($e))&&Te.current&&(fe.current?.(),fe.current=null,K.current=-1,L(be),!b)){const Re=V.current,Oe=qn(mt(Re));Re&&Qe(Re,Oe)&&Re.focus({preventScroll:!0})}}}),[Be,oe,V,k,a,L,Te,b]),Ce=x.useMemo(()=>b&&z&&je&&{"aria-activedescendant":`${C}-${o}`},[b,z,je,C,o]),Pe=x.useMemo(()=>({"aria-orientation":y==="both"?void 0:y,...B?{}:Ce,onKeyDown(se){if(se.key==="Tab"&&se.shiftKey&&z&&!b){const be=Un(se.nativeEvent);if(be&&!Qe(V.current,be))return;ea(se),M.setOpen(!1,nt(bo,se.nativeEvent)),Ut(P)&&P.focus();return}Ee(se)},onPointerMove(){X.current=!0}}),[Ce,Ee,V,y,B,M,z,b,P]),Le=x.useMemo(()=>{function se(Re){M.setOpen(!0,nt(Xh,Re.nativeEvent,Re.currentTarget))}function be(Re){v==="auto"&&Wx(Re.nativeEvent)&&(Y.current=!b)}function $e(Re){Y.current=v,v==="auto"&&iS(Re.nativeEvent)&&(Y.current=!0)}return{onKeyDown(Re){const Oe=M.select("open");X.current=!1;const We=Re.key.startsWith("Arrow"),at=h4(Re.key,Ve(),h),yt=hd(Re.key,y),_e=(g?at:yt)||Re.key==="Enter"||Re.key.trim()==="";if(b&&Oe)return Ee(Re);if(!(!Oe&&!N&&We)){if(_e){const Me=hd(Re.key,Ve());F.current=g&&Me?null:Re.key}if(g){at&&(ea(Re),Oe?(K.current=we(),L(Re)):se(Re));return}yt&&(me.current!=null&&(K.current=me.current),ea(Re),!Oe&&N?se(Re):Ee(Re),Oe&&L(Re))}},onFocus(Re){M.select("open")&&!b&&(K.current=-1,L(Re))},onPointerDown:$e,onPointerEnter:$e,onMouseDown:be,onClick:be}},[Ee,v,we,g,L,M,N,y,Ve,h,me,b]),Ie=x.useMemo(()=>({...Ce,...Le}),[Ce,Le]);return x.useMemo(()=>c?{reference:Ie,floating:Pe,item:ve,trigger:Le}:{},[c,Ie,Pe,Le,ve])}function b2(e,t){const{listRef:a,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:u,onTyping:p,enabled:m=!0,resetMs:g=750,selectedIndex:h=null}=t,b="rootStore"in e?e.rootStore:e,v=b.useState("open"),k=kn(),N=x.useRef(""),w=x.useRef(h??l??-1),y=x.useRef(null),S=Ue(R=>{function A(V){const $=o?.current[V];return!$||qf($)}function T(V){return A(V)?u==null||!ef(Ya,V,u):!1}function M(V,$,q=0){if(V.length===0)return-1;const Y=(q%V.length+V.length)%V.length,K=$.toLowerCase();for(let F=0;F<V.length;F+=1){const X=(Y+F)%V.length;if(!(!V[X]?.toLowerCase().startsWith(K)||!T(X)))return X}return-1}const z=a.current;if(N.current.length>0&&R.key===" "&&(ea(R),p?.(!0)),N.current.length>0&&N.current[0]!==" "&&M(z,N.current)===-1&&R.key!==" "&&p?.(!1),z==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;v&&R.key!==" "&&(ea(R),p?.(!0));const I=N.current==="";I&&(w.current=h??l??-1),z.every((V,$)=>V&&T($)?V[0]?.toLowerCase()!==V[1]?.toLowerCase():!0)&&N.current===R.key&&(N.current="",w.current=y.current),N.current+=R.key,k.start(g,()=>{N.current="",w.current=y.current,p?.(!1)});const D=((I?h??l??-1:w.current)??0)+1,B=M(z,N.current,D);B!==-1?(c?.(B),y.current=B):R.key!==" "&&(N.current="",p?.(!1))}),C=Ue(R=>{const A=R.relatedTarget,T=b.select("domReferenceElement"),M=b.select("floatingElement");Qe(T,A)||Qe(M,A)||(k.clear(),N.current="",w.current=y.current,p?.(!1))});De(()=>{!v&&h!==null||(k.clear(),y.current=null,N.current!==""&&(N.current=""))},[v,h,k]),De(()=>{v&&N.current===""&&(w.current=h??l??-1)},[v,h,l]);const E=x.useMemo(()=>({onKeyDown:S,onBlur:C}),[S,C]);return x.useMemo(()=>m?{reference:E,floating:E}:{},[m,E])}const hj=.1,b4=hj*hj,It=.5;function xd(e,t,a,o,l,c){return o>=t!=c>=t&&e<=(l-a)*(t-o)/(c-o)+a}function bd(e,t,a,o,l,c,u,p,m,g){let h=!1;return xd(e,t,a,o,l,c)&&(h=!h),xd(e,t,l,c,u,p)&&(h=!h),xd(e,t,u,p,m,g)&&(h=!h),xd(e,t,m,g,a,o)&&(h=!h),h}function _4(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function _d(e,t,a,o,l,c){const u=Math.min(a,l),p=Math.max(a,l),m=Math.min(o,c),g=Math.max(o,c);return e>=u&&e<=p&&t>=m&&t<=g}function _2(e={}){const{blockPointerEvents:t=!1}=e,a=new qs,o=({x:l,y:c,placement:u,elements:p,onClose:m,nodeId:g,tree:h})=>{const b=u?.split("-")[0];let v=!1,k=null,N=null,w=typeof performance<"u"?performance.now():0;function y(C,E){const R=performance.now(),A=R-w;if(k===null||N===null||A===0)return k=C,N=E,w=R,!1;const T=C-k,M=E-N,z=T*T+M*M,I=A*A*b4;return k=C,N=E,w=R,z<I}function S(){a.clear(),m()}return function(E){a.clear();const R=p.domReference,A=p.floating;if(!R||!A||b==null||l==null||c==null)return;const{clientX:T,clientY:M}=E,z=Un(E),I=E.type==="mouseleave",P=Qe(A,z),H=Qe(R,z);if(P&&(v=!0,!I))return;if(H&&(v=!1,!I)){v=!0;return}if(I&>(E.relatedTarget)&&Qe(A,E.relatedTarget))return;function D(){return!!(h&&Or(h.nodesRef.current,g).length>0)}function B(){D()||S()}if(D())return;const V=R.getBoundingClientRect(),$=A.getBoundingClientRect(),q=l>$.right-$.width/2,Y=c>$.bottom-$.height/2,K=$.width>V.width,F=$.height>V.height,X=(K?V:$).left,L=(K?V:$).right,G=(F?V:$).top,Z=(F?V:$).bottom;if(b==="top"&&c>=V.bottom-1||b==="bottom"&&c<=V.top+1||b==="left"&&l>=V.right-1||b==="right"&&l<=V.left+1){B();return}let ee=!1;switch(b){case"top":ee=_d(T,M,X,V.top+1,L,$.bottom-1);break;case"bottom":ee=_d(T,M,X,$.top+1,L,V.bottom-1);break;case"left":ee=_d(T,M,$.right-1,Z,V.left+1,G);break;case"right":ee=_d(T,M,V.right-1,Z,$.left+1,G);break}if(ee)return;if(v&&!_4(T,M,V)){B();return}if(!I&&y(T,M)){B();return}let de=!1;switch(b){case"top":{const fe=K?It/2:It*4,ae=K||q?l+fe:l-fe,oe=K?l-fe:q?l+fe:l-fe,me=c+It+1,Te=q||K?$.bottom-It:$.top,ie=q?K?$.bottom-It:$.top:$.bottom-It;de=bd(T,M,ae,me,oe,me,$.left,Te,$.right,ie);break}case"bottom":{const fe=K?It/2:It*4,ae=K||q?l+fe:l-fe,oe=K?l-fe:q?l+fe:l-fe,me=c-It,Te=q||K?$.top+It:$.bottom,ie=q?K?$.top+It:$.bottom:$.top+It;de=bd(T,M,ae,me,oe,me,$.left,Te,$.right,ie);break}case"left":{const fe=F?It/2:It*4,ae=F||Y?c+fe:c-fe,oe=F?c-fe:Y?c+fe:c-fe,me=l+It+1,Te=Y||F?$.right-It:$.left,ie=Y?F?$.right-It:$.left:$.right-It;de=bd(T,M,Te,$.top,ie,$.bottom,me,ae,me,oe);break}case"right":{const fe=F?It/2:It*4,ae=F||Y?c+fe:c-fe,oe=F?c-fe:Y?c+fe:c-fe,me=l-It,Te=Y||F?$.left+It:$.right,ie=Y?F?$.left+It:$.right:$.left+It;de=bd(T,M,me,ae,me,oe,Te,$.top,ie,$.bottom);break}}de?v||a.start(40,B):B()}};return o.__options={...e,blockPointerEvents:t},o}const v4={...Sb,disabled:Ae(e=>e.disabled),instantType:Ae(e=>e.instantType),isInstantPhase:Ae(e=>e.isInstantPhase),trackCursorAxis:Ae(e=>e.trackCursorAxis),disableHoverablePopup:Ae(e=>e.disableHoverablePopup),lastOpenChangeReason:Ae(e=>e.openChangeReason),closeOnClick:Ae(e=>e.closeOnClick),closeDelay:Ae(e=>e.closeDelay),hasViewport:Ae(e=>e.hasViewport)};class Eb extends Gf{constructor(t,a,o=!1){const l=new Fc,c={...y4(),...t};c.floatingRootContext=u2(l,a,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},v4)}setOpen=(t,a)=>{c4(this,t,a,{extraState:{openChangeReason:a.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,nt(ei,t))}static useStore(t,a){return o2(t,(l,c)=>new Eb(a,l,c)).store}}function y4(){return{...wb(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const j4=Yx(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:g,handle:h,triggerId:b,defaultTriggerId:v=null,children:k}=t,N=Eb.useStore(h?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});i2(N,l,o,v),N.useControlledProp("openProp",l),N.useControlledProp("triggerIdProp",b),N.useContextCallback("onOpenChange",m),N.useContextCallback("onOpenChangeComplete",g);const w=N.useState("open"),y=!a&&w,S=N.useState("activeTriggerId"),C=N.useState("mounted"),E=N.useState("payload");N.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c}),N.useSyncedValue("disabled",a),vb(N,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:A}=yb(y,N),T=N.useState("isInstantPhase"),M=N.useState("instantType"),z=N.useState("lastOpenChangeReason"),I=x.useRef(null);De(()=>{w&&a&&N.setOpen(!1,nt(mS))},[w,a,N]),De(()=>{A==="ending"&&z===fa||A!=="ending"&&T?(M!=="delay"&&(I.current=M),N.set("instantType","delay")):I.current!==null&&(N.set("instantType",I.current),I.current=null)},[A,T,z,M,N]),De(()=>{y&&S==null&&N.set("payload",void 0)},[N,S,y]);const P=x.useCallback(()=>{N.setOpen(!1,nt(nb))},[N]);x.useImperativeHandle(p,()=>({unmount:R,close:P}),[R,P]);const H=y||C||!a&&u!=="none";return r.jsxs(lS.Provider,{value:N,children:[H&&r.jsx(w4,{store:N,disabled:a,trackCursorAxis:u}),typeof k=="function"?k({payload:E}):k]})});function w4({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),l=$f(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=oO(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),u=x.useMemo(()=>Fn(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Fn(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Fn(Kf,c.floating,l.floating),[c.floating,l.floating]);return jb(e,{activeTriggerProps:u,inactiveTriggerProps:p,popupProps:m}),null}let po=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=yo.startingStyle]="startingStyle",e[e.endingStyle=yo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),lf=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const k4={[lf.popupOpen]:""},S4={[lf.popupOpen]:"",[lf.pressed]:""},C4={[po.open]:""},N4={[po.closed]:""},E4={[po.anchorHidden]:""},v2={open(e){return e?k4:null}},nx={open(e){return e?S4:null}},Ro={open(e){return e?C4:N4},anchorHidden(e){return e?E4:null}};function Ys(e){return _o(e,"base-ui")}const y2=x.createContext(void 0);function R4(){return x.useContext(y2)}let T4=(function(e){return e[e.popupOpen=lf.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const A4=600,j2="data-base-ui-tooltip-trigger";function xj(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;o<a.length;o+=1){const l=a[o];if(gt(l))return l}}const t=e.target;return gt(t)?t:null}function M4(e){let t=e;for(;t;){if(t.hasAttribute(j2))return t;const a=t.parentElement;if(a){t=a;continue}const o=t.getRootNode();t="host"in o&>(o.host)?o.host:null}return null}const O4=oS(function(t,a){const{render:o,className:l,style:c,handle:u,payload:p,disabled:m,delay:g,closeOnClick:h=!0,closeDelay:b,id:v,...k}=t,N=qc(!0),w=u?.store??N;if(!w)throw new Error(nn(82));const y=Ys(v),S=w.useState("isTriggerActive",y),C=w.useState("isOpenedByTrigger",y),E=w.useState("floatingRootContext"),R=x.useRef(null),A=g??A4,T=b??0,{registerTrigger:M,isMountedByThisTrigger:z}=c2(y,R,w,{payload:p,closeOnClick:h,closeDelay:T}),I=R4(),{delayRef:P,isInstantPhase:H,hasProvider:D}=o5(E,{open:C}),B=Nb(E);w.useSyncedValue("isInstantPhase",H);const V=w.useState("disabled"),$=m??V,q=cn($),Y=w.useState("trackCursorAxis"),K=w.useState("disableHoverablePopup"),F=x.useRef(!1),X=kn(),L=x.useRef(void 0);function G(){const pe=I?.delay,Se=typeof P.current=="object"?P.current.open:void 0;let je=A;return D&&(Se!==0?je=g??pe??A:je=0),je}function Z(pe){const Se=R.current;if(!Se||!pe)return!1;const je=M4(pe);return je!==null&&je!==Se&&Qe(Se,je)}function ee(pe){const Se=Z(pe);return F.current=Se,Se&&(B.openChangeTimeout.clear(),B.restTimeout.clear(),B.restTimeoutPending=!1,X.clear()),Se}const de=h2(E,{enabled:!$,mouseOnly:!0,move:!1,handleClose:!K&&Y!=="both"?_2():null,restMs:G,delay(){const pe=typeof P.current=="object"?P.current.close:void 0;let Se=T;return b==null&&D&&(Se=pe),{close:Se}},triggerElementRef:R,isActiveTrigger:S,isClosing:()=>w.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),fe=p2(E,{enabled:!$}).reference,ae=pe=>{const Se=F.current,je=xj(pe),Be=ee(je),Ve=R.current,we=Ve&&je&&Qe(Ve,je);if(Be&&w.select("open")&&w.select("lastOpenChangeReason")===Rn){w.setOpen(!1,nt(Rn,pe));return}if(Se&&!Be&&we&&!q.current&&!w.select("open")&&Ve&&xo(L.current)){const Ee=()=>{!F.current&&!q.current&&!w.select("open")&&w.setOpen(!0,nt(Rn,pe,Ve))},ve=G();ve===0?(X.clear(),Ee()):X.start(ve,Ee)}},oe=w.useState("triggerProps",z);return Nt("button",t,{state:{open:C},ref:[a,M,R],props:[de,fe,z||Y!=="none"?oe:void 0,{onMouseOver(pe){ae(pe.nativeEvent)},onFocus(pe){Z(xj(pe.nativeEvent))&&pe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,X.clear(),L.current=void 0},onPointerEnter(pe){L.current=pe.pointerType},onPointerDown(pe){L.current=pe.pointerType,w.set("closeOnClick",h),h&&!w.select("open")&&w.cancelPendingOpen(pe.nativeEvent)},onClick(pe){h&&!w.select("open")&&w.cancelPendingOpen(pe.nativeEvent)},id:y,[T4.triggerDisabled]:$?"":void 0,[j2]:$?void 0:""},k],stateAttributesMapping:v2})}),w2=x.createContext(void 0);function z4(){const e=x.useContext(w2);if(e===void 0)throw new Error(nn(70));return e}const D4=x.forwardRef(function(t,a){const{children:o,container:l,className:c,render:u,style:p,...m}=t,{portalNode:g,portalSubtree:h}=HS({container:l,ref:a,componentProps:t,elementProps:m});return!h&&!g?null:r.jsxs(x.Fragment,{children:[h,g&&ca.createPortal(o,g)]})}),P4=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t;return qc().useState("mounted")||o?r.jsx(w2.Provider,{value:o,children:r.jsx(D4,{ref:a,...l})}):null}),k2=x.createContext(void 0);function S2(){const e=x.useContext(k2);if(e===void 0)throw new Error(nn(71));return e}const L4=x.createContext(void 0);function Qf(){return x.useContext(L4)?.direction??"ltr"}const I4=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:l,rects:c,platform:u,elements:p,middlewareData:m}=t,{element:g,padding:h=0,offsetParent:b="real"}=Xa(e,t)||{};if(g==null)return{};const v=vS(h),k={x:a,y:o},N=lb(l),w=ob(N),y=await u.getDimensions(g),S=N==="y",C=S?"top":"left",E=S?"bottom":"right",R=S?"clientHeight":"clientWidth",A=c.reference[w]+c.reference[N]-k[N]-c.floating[w],T=k[N]-c.reference[N],M=b==="real"?await u.getOffsetParent?.(g):p.floating;let z=p.floating[R]||c.floating[w];(!z||!await u.isElement?.(M))&&(z=p.floating[R]||c.floating[w]);const I=A/2-T/2,P=z/2-y[w]/2-1,H=Math.min(v[C],P),D=Math.min(v[E],P),B=H,V=z-y[w]-D,$=z/2-y[w]/2+I,q=Qh(B,$,V),Y=!m.arrow&&Lr(l)!=null&&$!==q&&c.reference[w]/2-($<B?H:D)-y[w]/2<0,K=Y?$<B?$-B:$-V:0;return{[N]:k[N]+K,data:{[N]:q,centerOffset:$-q-K,...Y&&{alignmentOffset:K}},reset:Y}}}),B4=(e,t)=>({...I4(e),options:[e,t]}),U4=KO().fn,H4={name:"hide",async fn(e){const{width:t,height:a,x:o,y:l}=e.rects.reference,c=t===0&&a===0&&o===0&&l===0;return{data:{referenceHidden:(await U4(e)).data?.referenceHidden||c}}}},Hd={sideX:"left",sideY:"top"},C2={name:"adaptiveOrigin",async fn(e){const{x:t,y:a,rects:{floating:o},elements:{floating:l},platform:c,strategy:u,placement:p}=e,m=$t(l),g=m.getComputedStyle(l);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:a,data:Hd};const b=await c.getOffsetParent?.(l);let v={width:0,height:0};if(u==="fixed"&&m?.visualViewport)v={width:m.visualViewport.width,height:m.visualViewport.height};else if(b===m){const C=mt(l);v={width:C.documentElement.clientWidth,height:C.documentElement.clientHeight}}else await c.isElement?.(b)&&(v=await c.getDimensions(b));const k=cs(p);let N=t,w=a;k==="left"&&(N=v.width-(t+o.width)),k==="top"&&(w=v.height-(a+o.height));const y=k==="left"?"right":Hd.sideX,S=k==="top"?"bottom":Hd.sideY;return{x:N,y:w,data:{sideX:y,sideY:S}}}};function N2(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function bj(e,t,a){const{rects:o,placement:l}=e;return{side:N2(t,cs(l),a),align:Lr(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Rb(e){const{anchor:t,positionMethod:a="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:u=0,collisionBoundary:p,collisionPadding:m=5,sticky:g=!1,arrowPadding:h=5,disableAnchorTracking:b=!1,inline:v,keepMounted:k=!1,floatingRootContext:N,mounted:w,collisionAvoidance:y,shiftCrossAxis:S=!1,nodeId:C,adaptiveOrigin:E,lazyFlip:R=!1,externalTree:A}=e,[T,M]=x.useState(null);!w&&T!==null&&M(null);const z=y.side||"flip",I=y.align||"flip",P=y.fallbackAxisSide||"end",H=typeof t=="function"?t:void 0,D=Ue(H),B=H?D:t,V=cn(t),$=cn(w),Y=Qf()==="rtl",K=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":Y?"left":"right","inline-start":Y?"right":"left"}[o],F=c==="center"?K:`${K}-${c}`;let X=m;const L=1,G=o==="bottom"?L:0,Z=o==="top"?L:0,ee=o==="right"?L:0,de=o==="left"?L:0;typeof X=="number"?X={top:X+G,right:X+de,bottom:X+Z,left:X+ee}:X&&(X={top:(X.top||0)+G,right:(X.right||0)+de,bottom:(X.bottom||0)+Z,left:(X.left||0)+ee});const fe={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:X},ae=x.useRef(null),oe=cn(l),me=cn(u),Te=typeof l!="function"?l:0,ie=typeof u!="function"?u:0,pe=[];v&&pe.push(v),pe.push(qO(pt=>{const Et=bj(pt,o,Y),an=typeof oe.current=="function"?oe.current(Et):oe.current,Wt=typeof me.current=="function"?me.current(Et):me.current;return{mainAxis:an,crossAxis:Wt,alignmentAxis:Wt}},[Te,ie,Y,o]));const Se=I==="none"&&z!=="shift",je=!Se&&(g||S||z==="shift"),Be=z==="none"?null:GO({...fe,padding:{top:X.top+L,right:X.right+L,bottom:X.bottom+L,left:X.left+L},mainAxis:!S&&z==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),Ve=Se?null:$O(pt=>{const Et=mt(pt.elements.floating).documentElement;return{...fe,rootBoundary:S?{x:0,y:0,width:Et.clientWidth,height:Et.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:je,limiter:g||S?void 0:FO(an=>{if(!ae.current)return{};const{width:Wt,height:Zt}=ae.current.getBoundingClientRect(),Gt=zs(cs(an.placement)),fn=Gt==="y"?Wt:Zt,es=Gt==="y"?X.left+X.right:X.top+X.bottom;return{offset:fn/2+es/2}})}},[fe,g,S,X,I]);z==="shift"||I==="shift"||c==="center"?pe.push(Ve,Be):pe.push(Be,Ve),pe.push(YO({...fe,apply({elements:{floating:pt},availableWidth:Et,availableHeight:an,rects:Wt}){if(!$.current)return;const Zt=pt.style;Zt.setProperty("--available-width",`${Et}px`),Zt.setProperty("--available-height",`${an}px`);const Gt=$t(pt).devicePixelRatio||1,{x:fn,y:es,width:ds,height:js}=Wt.reference,pn=(Math.round((fn+ds)*Gt)-Math.round(fn*Gt))/Gt,ws=(Math.round((es+js)*Gt)-Math.round(es*Gt))/Gt;Zt.setProperty("--anchor-width",`${pn}px`),Zt.setProperty("--anchor-height",`${ws}px`)}}),B4(pt=>({element:ae.current||mt(pt.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(pt){const{elements:Et,middlewareData:an,placement:Wt,rects:Zt,y:Gt}=pt,fn=cs(Wt),es=zs(fn),ds=ae.current,js=an.arrow?.x||0,pn=an.arrow?.y||0,ws=ds?.clientWidth||0,xa=ds?.clientHeight||0,Ls=js+ws/2,ba=pn+xa/2,ct=Math.abs(an.shift?.y||0),zt=Zt.reference.height/2,mn=typeof l=="function"?l(bj(pt,o,Y)):l,Sn=ct>mn,yn={top:`${Ls}px calc(100% + ${mn}px)`,bottom:`${Ls}px ${-mn}px`,left:`calc(100% + ${mn}px) ${ba}px`,right:`${-mn}px ${ba}px`}[fn],Ht=`${Ls}px ${Zt.reference.y+zt-Gt}px`;return Et.floating.style.setProperty("--transform-origin",je&&es==="y"&&Sn?Ht:yn),{}}},H4,E),De(()=>{!w&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[w,N]);const we=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Ee,elements:ve,x:Ce,y:Pe,middlewareData:Le,update:Ie,placement:se,context:be,isPositioned:$e,floatingStyles:Re}=p4({rootContext:N,open:k?w:void 0,placement:F,middleware:pe,strategy:a,whileElementsMounted:k?void 0:(...pt)=>cj(...pt,we),nodeId:C,externalTree:A}),{sideX:Oe,sideY:We}=Le.adaptiveOrigin||Hd,at=$e?a:"fixed",yt=x.useMemo(()=>{const pt=E?{position:at,[Oe]:Ce,[We]:Pe}:{position:at,...Re};return $e||(pt.opacity=0),pt},[E,at,Oe,Ce,We,Pe,Re,$e]),_e=x.useRef(null);De(()=>{if(!w)return;const pt=V.current,Et=typeof pt=="function"?pt():pt,Wt=(_j(Et)?Et.current:Et)||null||null;Wt!==_e.current&&(Ee.setPositionReference(Wt),_e.current=Wt)},[w,Ee,B,V]),x.useEffect(()=>{if(!w)return;const pt=V.current;typeof pt!="function"&&_j(pt)&&pt.current!==_e.current&&(Ee.setPositionReference(pt.current),_e.current=pt.current)},[w,Ee,B,V]),x.useEffect(()=>{if(k&&w&&ve.reference&&ve.floating)return cj(ve.reference,ve.floating,Ie,we)},[k,w,ve,Ie,we]);const Me=cs(se),He=N2(o,Me,Y),Xe=Lr(se)||"center",ot=!!Le.hide?.referenceHidden;De(()=>{R&&w&&$e&&M(Me)},[R,w,$e,Me]);const sn=x.useMemo(()=>({position:"absolute",top:Le.arrow?.y,left:Le.arrow?.x}),[Le.arrow]),dn=Le.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:yt,arrowStyles:sn,arrowRef:ae,arrowUncentered:dn,side:He,align:Xe,physicalSide:Me,anchorHidden:ot,refs:Ee,context:be,isPositioned:$e,update:Ie}),[yt,sn,ae,dn,He,Xe,Me,ot,Ee,be,$e,Ie])}function _j(e){return e!=null&&"current"in e}function Wf(e){return e==="starting"?W5:qt}function Tb(e,t,{styles:a,transitionStatus:o,props:l,refs:c,hidden:u,inert:p=!1}){const m={...a};return p&&(m.pointerEvents="none"),Nt("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},Wf(o),l],stateAttributesMapping:Ro})}const V4=x.forwardRef(function(t,a){const{render:o,className:l,anchor:c,positionMethod:u="absolute",side:p="top",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:k=5,sticky:N=!1,disableAnchorTracking:w=!1,collisionAvoidance:y=IS,style:S,...C}=t,E=qc(),R=z4(),A=E.useState("open"),T=E.useState("mounted"),M=E.useState("trackCursorAxis"),z=E.useState("disableHoverablePopup"),I=E.useState("floatingRootContext"),P=E.useState("instantType"),H=E.useState("transitionStatus"),D=E.useState("hasViewport"),B=Rb({anchor:c,positionMethod:u,floatingRootContext:I,mounted:T,side:p,sideOffset:g,align:m,alignOffset:h,collisionBoundary:b,collisionPadding:v,sticky:N,arrowPadding:k,disableAnchorTracking:w,keepMounted:R,collisionAvoidance:y,adaptiveOrigin:D?C2:void 0}),V=x.useMemo(()=>({open:A,side:B.side,align:B.align,anchorHidden:B.anchorHidden,instant:M!=="none"?"tracking-cursor":P}),[A,B.side,B.align,B.anchorHidden,M,P]),$=Tb(t,V,{styles:B.positionerStyles,transitionStatus:H,props:C,refs:[a,E.useStateSetter("positionerElement")],hidden:!T,inert:!A||M==="both"||z});return r.jsx(k2.Provider,{value:B,children:$})}),q4={...Ro,...Ja},$4=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=qc(),{side:m,align:g}=S2(),h=p.useState("open"),b=p.useState("instantType"),v=p.useState("transitionStatus"),k=p.useState("popupProps"),N=p.useState("floatingRootContext"),w=p.useState("disabled"),y=p.useState("closeDelay");ga({open:h,ref:p.context.popupRef,onComplete(){h&&p.context.onOpenChangeComplete?.(!0)}}),g2(N,{enabled:!w,closeDelay:y});const S=p.useStateSetter("popupElement");return Nt("div",t,{state:{open:h,side:m,align:g,instant:b,transitionStatus:v},ref:[a,p.context.popupRef,S],props:[k,Wf(v),u],stateAttributesMapping:q4})}),F4=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=qc(),{arrowRef:m,side:g,align:h,arrowUncentered:b,arrowStyles:v}=S2(),k=p.useState("open"),N=p.useState("instantType");return Nt("div",t,{state:{open:k,side:g,align:h,uncentered:b,instant:N},ref:[a,m],props:[{style:v,"aria-hidden":!0},u],stateAttributesMapping:Ro})}),G4=function(t){const{delay:a,closeDelay:o,timeout:l=400}=t,c=x.useMemo(()=>({delay:a,closeDelay:o}),[a,o]),u=x.useMemo(()=>({open:a,close:o}),[a,o]);return r.jsx(y2.Provider,{value:c,children:r.jsx(r5,{delay:u,timeoutMs:l,children:t.children})})};function Zf(e){return ub(19)?e:e?"true":void 0}function Y4(e){const[t,a]=x.useState({current:e,previous:null});return e!==t.current&&a({current:e,previous:t.current}),t.previous}function St(...e){return rS(Tc(e))}function K4({delay:e=0,...t}){return r.jsx(G4,{"data-slot":"tooltip-provider",delay:e,...t})}function Ab({...e}){return r.jsx(j4,{"data-slot":"tooltip",...e})}function Mb({...e}){return r.jsx(O4,{"data-slot":"tooltip-trigger",...e})}function Ob({className:e,side:t="top",sideOffset:a=4,align:o="center",alignOffset:l=0,children:c,...u}){return r.jsx(P4,{children:r.jsx(V4,{align:o,alignOffset:l,side:t,sideOffset:a,className:"isolate z-50",children:r.jsxs($4,{"data-slot":"tooltip-content",className:St("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),...u,children:[c,r.jsx(F4,{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 bl({label:e,active:t,onClick:a,isAdd:o,isSettings:l,isDefault:c,icon:u,title:p,testId:m}){const g=e.trim()||"·",{initials:h,subLabel:b}=E2(g),v=o||l?"indigo":R2(g),k=b&&!o&&!l&&!c;return r.jsxs(Ab,{children:[r.jsx(Mb,{render:r.jsxs("button",{type:"button",onClick:a,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:ze("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",t&&"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&&t&&Z4(v),!o&&!l&&!c&&!t&&W4(v)),children:u??h}),k&&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(Ob,{side:"right",children:p||e})]})}function E2(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const a=t.split(" ");if(a.length>=2)return{initials:(a[0][0]+a[1][0]).toUpperCase(),subLabel:X4(t)};const o=a[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function X4(e){return e.length>6?e.slice(0,5)+"…":e}function R2(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)|0;return M1[Math.abs(t)%M1.length]}const T2={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"},Q4={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 W4(e){return T2[e]}function Z4(e){return Q4[e]}function J4(e){const{initials:t}=E2(e);return{initials:t,idleClass:T2[R2(e)]}}function Ye({content:e,side:t="top",children:a}){return e?r.jsxs(Ab,{children:[r.jsx(Mb,{render:a}),r.jsx(Ob,{side:t,children:e})]}):a}const A2=x.createContext(void 0);function zb(e){const t=x.useContext(A2);if(t===void 0&&!e)throw new Error(nn(33));return t}const M2=x.createContext(void 0);function Ur(e){const t=x.useContext(M2);if(t===void 0&&!e)throw new Error(nn(36));return t}const ez=x.createContext(void 0);function Jf(e=!0){const t=x.useContext(ez);if(t===void 0&&!e)throw new Error(nn(25));return t}function Vl({controlled:e,default:t,name:a,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,u]=x.useState(t),p=l?e:c,m=x.useCallback(g=>{l||u(g)},[]);return[p,m]}const O2=x.createContext(void 0);function Db(e=!1){const t=x.useContext(O2);if(t===void 0&&!e)throw new Error(nn(16));return t}function tz(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,u=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){a&&t&&h.key!=="Tab"&&h.preventDefault()}};return o||(g.tabIndex=l,!c&&a&&(g.tabIndex=t?l:-1)),(c&&(t||u)||!c&&a)&&(g["aria-disabled"]=a),c&&(!t||p)&&(g.disabled=a),g},[o,a,t,u,p,c,l])}}function Hr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:l=!0,composite:c}=e,u=x.useRef(null),p=Db(!0),m=c??p!==void 0,{props:g}=tz({focusableWhenDisabled:a,disabled:t,composite:m,tabIndex:o,isNativeButton:l}),h=x.useCallback(()=>{const k=u.current;Fg(k)&&m&&t&&g.disabled===void 0&&k.disabled&&(k.disabled=!1)},[t,g.disabled,m]);De(h,[h]);const b=x.useCallback((k={})=>{const{onClick:N,onMouseDown:w,onKeyUp:y,onKeyDown:S,onPointerDown:C,...E}=k;return Fn({onClick(R){if(t){R.preventDefault();return}N?.(R)},onMouseDown(R){t||w?.(R)},onKeyDown(R){if(t||(nf(R),S?.(R),R.baseUIHandlerPrevented))return;const A=R.target===R.currentTarget,T=R.currentTarget,M=Fg(T),z=!l&&nz(T),I=A&&(l?M:!z),P=R.key==="Enter",H=R.key===" ",D=T.getAttribute("role"),B=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(A&&m&&H){if(R.defaultPrevented&&B)return;R.preventDefault(),z||l&&M?(T.click(),R.preventBaseUIHandler()):I&&(N?.(R),R.preventBaseUIHandler());return}I&&(!l&&(H||P)&&R.preventDefault(),!l&&P&&N?.(R))},onKeyUp(R){if(!t){if(nf(R),y?.(R),R.target===R.currentTarget&&l&&m&&Fg(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!m&&R.key===" "&&N?.(R)}},onPointerDown(R){if(t){R.preventDefault();return}C?.(R)}},l?{type:"button"}:{role:"button"},g,E)},[t,g,m,l]),v=Ue(k=>{u.current=k,h()});return{getButtonProps:b,buttonRef:v}}function Fg(e){return Ut(e)&&e.tagName==="BUTTON"}function nz(e){return!!(e?.tagName==="A"&&e?.href)}function sz(e){const{closeOnClick:t,highlighted:a,id:o,nodeId:l,store:c,typingRef:u,itemRef:p,itemMetadata:m}=e,{events:g}=c.useState("floatingTreeRoot"),h=c.useState("open"),b=Jf(!0),v=b!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:h&&a?0:-1,onKeyDown(k){k.key===" "&&u?.current&&k.preventDefault()},onMouseMove(k){l&&g.emit("itemhover",{nodeId:l,target:k.currentTarget})},onClick(k){t&&g.emit("close",{domEvent:k,reason:El})},onMouseUp(k){if(b){const N=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,v&&N&&Math.abs(k.clientX-N.x)<=1&&Math.abs(k.clientY-N.y)<=1||v&&!Xx&&k.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!v||k.button===2)&&(!m||m.type==="regular-item")&&p.current.click()}}),[t,a,o,g,l,h,c,u,p,b,v,m])}const z2={type:"regular-item"};function D2(e){const{closeOnClick:t,disabled:a=!1,highlighted:o,id:l,store:c,typingRef:u=c.context.typingRef,nativeButton:p,itemMetadata:m,nodeId:g}=e,h=c.useState("disabled"),b=a||h,v=x.useRef(null),{getButtonProps:k,buttonRef:N}=Hr({disabled:b,focusableWhenDisabled:!0,native:p,composite:!0}),w=sz({closeOnClick:t,highlighted:o,id:l,nodeId:g,store:c,typingRef:u,itemRef:v,itemMetadata:m}),y=x.useCallback(C=>Fn(w,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},C,k),[w,k,m]),S=Ka(v,N);return x.useMemo(()=>({getItemProps:y,itemRef:S}),[y,S])}const P2=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function az(){return x.useContext(P2)}let L2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Gc(e={}){const{label:t,metadata:a,textRef:o,indexGuessBehavior:l,index:c}=e,{register:u,unregister:p,subscribeMapChange:m,elementsRef:g,labelsRef:h,nextIndexRef:b}=az(),v=x.useRef(-1),[k,N]=x.useState(c??(l===L2.GuessFromOrder?()=>{if(v.current===-1){const S=b.current;b.current+=1,v.current=S}return v.current}:-1)),w=x.useRef(null),y=x.useCallback(S=>{if(w.current=S,k!==-1&&S!==null&&(g.current[k]=S,h)){const C=t!==void 0;h.current[k]=C?t:o?.current?.textContent??S.textContent}},[k,g,h,t,o]);return De(()=>{if(c!=null)return;const S=w.current;if(S)return u(S,a),()=>{p(S)}},[c,u,p,a]),De(()=>{if(c==null)return m(S=>{const C=w.current?S.get(w.current)?.index:null;C!=null&&N(C)})},[c,m,N]),{ref:y,index:k}}let vj=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const I2={checked(e){return e?{[vj.checked]:""}:{[vj.unchecked]:""}},...Ja},rz=x.createContext(void 0),oz=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!0,style:h,...b}=t,v=Gc({label:u}),k=zb(!0),N=Ys(c),{store:w}=Ur(),y=w.useState("isActive",v.index),S=w.useState("itemProps"),{getItemProps:C,itemRef:E}=D2({closeOnClick:g,disabled:m,highlighted:y,id:N,store:w,nativeButton:p,nodeId:k?.context.nodeId,itemMetadata:z2});return Nt("div",t,{state:{disabled:m,highlighted:y},props:[S,b,C],ref:[E,a,v.ref]})}),lz=x.createContext(void 0);function B2(e){return x.useContext(lz)}const jc="ArrowUp",wc="ArrowDown",cf="ArrowLeft",uf="ArrowRight",ep="Home",tp="End",U2=new Set([cf,uf]),iz=new Set([cf,uf,ep,tp]),H2=new Set([jc,wc]),cz=new Set([jc,wc,ep,tp]),V2=new Set([...U2,...H2]),np=new Set([...V2,ep,tp]),uz="Shift",dz="Control",fz="Alt",pz="Meta",mz=new Set([uz,dz,fz,pz]);function gz(e){return Ut(e)&&e.tagName==="INPUT"}function yj(e){return!!(gz(e)&&e.selectionStart!=null||Ut(e)&&e.tagName==="TEXTAREA")}function jj(e,t,a,o){if(!e||!t||!t.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,p=e.clientHeight<e.scrollHeight;if(u&&o!=="vertical"){const m=wj(e,t,"left"),g=vd(e),h=vd(t);a==="ltr"&&(m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(l=m-h.scrollMarginLeft-g.scrollPaddingLeft)),a==="rtl"&&(m-h.scrollMarginRight<e.scrollLeft+g.scrollPaddingLeft?l=m-h.scrollMarginLeft-g.scrollPaddingLeft:m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=wj(e,t,"top"),g=vd(e),h=vd(t);m-h.scrollMarginTop<e.scrollTop+g.scrollPaddingTop?c=m-h.scrollMarginTop-g.scrollPaddingTop:m+t.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-g.scrollPaddingBottom&&(c=m+t.offsetHeight+h.scrollMarginBottom-e.clientHeight+g.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function wj(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let l=0;for(;t.offsetParent&&(l+=t[o],t.offsetParent!==e);)t=t.offsetParent;return l}function vd(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const hz={...Ro,...Ja},xz=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m}=Ur(),{side:g,align:h}=zb(),b=B2()!=null,v=m.useState("open"),k=m.useState("transitionStatus"),N=m.useState("popupProps"),w=m.useState("mounted"),y=m.useState("instantType"),S=m.useState("activeTriggerElement"),C=m.useState("parent"),E=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),A=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),M=m.useState("closeDelay"),z=m.useState("activeTriggerElement"),I=m.useState("hoverEnabled"),P=m.useState("disabled"),H=m.useState("openMethod"),D=C.type==="context-menu";ga({open:v,ref:m.context.popupRef,onComplete(){v&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function Y(K){m.setOpen(!1,nt(K.reason,K.domEvent))}return T.events.on("close",Y),()=>{T.events.off("close",Y)}},[T.events,m]),g2(A,{enabled:I&&!P&&!D&&C.type!=="menubar",closeDelay:M});const B=x.useCallback(Y=>{m.set("popupElement",Y)},[m]),V={transitionStatus:k,side:g,align:h,open:v,nested:C.type==="menu",instant:y},$=Nt("div",t,{state:V,ref:[a,m.context.popupRef,B],stateAttributesMapping:hz,props:[N,{onKeyDown(Y){b&&np.has(Y.key)&&Y.stopPropagation()}},Wf(k),p,{"data-rootownerid":R}]});let q=C.type===void 0||D;return(S||C.type==="menubar"&&E!==Hf)&&(q=!0),r.jsx(hb,{context:A,openInteractionType:H,modal:D,disabled:!w,returnFocus:u===void 0?q:u,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?T:void 0,previousFocusableElement:z,nextFocusableElement:C.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:$})}),q2=x.createContext(void 0);function bz(){const e=x.useContext(q2);if(e===void 0)throw new Error(nn(32));return e}const _z=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=Ur();return c.useState("mounted")||o?r.jsx(q2.Provider,{value:o,children:r.jsx(pb,{ref:a,...l})}):null});function sp(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:l}=e,c=Ue(l),u=x.useRef(0),p=Xn(yz).current,m=Xn(vz).current,[g,h]=x.useState(0),b=x.useRef(g),v=Ue((S,C)=>{m.set(S,C??null),b.current+=1,h(b.current)}),k=Ue(S=>{m.delete(S),b.current+=1,h(b.current)}),N=x.useMemo(()=>{const S=new Map;return Array.from(m.keys()).filter(E=>E.isConnected).sort(jz).forEach((E,R)=>{const A=m.get(E)??{};S.set(E,{...A,index:R})}),S},[m,g]);De(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const S=new MutationObserver(C=>{const E=new Set,R=A=>E.has(A)?E.delete(A):E.add(A);C.forEach(A=>{A.removedNodes.forEach(R),A.addedNodes.forEach(R)}),E.size===0&&(b.current+=1,h(b.current))});return N.forEach((C,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[N]),De(()=>{b.current===g&&(a.current.length!==N.size&&(a.current.length=N.size),o&&o.current.length!==N.size&&(o.current.length=N.size),u.current=N.size),c(N)},[c,N,a,o,g]),De(()=>()=>{a.current=[]},[a]),De(()=>()=>{o&&(o.current=[])},[o]);const w=Ue(S=>(p.add(S),()=>{p.delete(S)}));De(()=>{p.forEach(S=>S(N))},[p,N]);const y=x.useMemo(()=>({register:v,unregister:k,subscribeMapChange:w,elementsRef:a,labelsRef:o,nextIndexRef:u}),[v,k,w,a,o,u]);return r.jsx(P2.Provider,{value:y,children:t})}function vz(){return new Map}function yz(){return new Set}function jz(e,t){const a=e.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_FOLLOWING||a&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:a&Node.DOCUMENT_POSITION_PRECEDING||a&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pb=x.forwardRef(function(t,a){const{cutout:o,...l}=t;let c;if(o){const u=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${u.left}px ${u.top}px,${u.left}px ${u.bottom}px,${u.right}px ${u.bottom}px,${u.right}px ${u.top}px,${u.left}px ${u.top}px)`}return r.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let kj={},Sj={},Cj="";function wz(e){if(typeof document>"u")return!1;const t=mt(e);return $t(t).innerWidth-t.documentElement.clientWidth>0}function kz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=mt(e),o=a.documentElement,l=a.body,c=Pr(o)?o:l,u=c.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const g=c.offsetWidth;return c.style.overflowY=u,o.style.scrollbarGutter=p,m===g}function Sz(e){const t=mt(e),a=t.documentElement,o=t.body,l=Pr(a)?a: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 Cz(e){const t=mt(e),a=t.documentElement,o=t.body,l=$t(a);let c=0,u=0,p=!1;const m=na.create();if(Dr&&(l.visualViewport?.scale??1)!==1)return()=>{};function g(){const k=l.getComputedStyle(a),N=l.getComputedStyle(o),S=(k.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=a.scrollTop,u=a.scrollLeft,kj={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},Cj=a.style.scrollBehavior,Sj={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 C=a.scrollHeight>a.clientHeight,E=a.scrollWidth>a.clientWidth,R=k.overflowY==="scroll"||N.overflowY==="scroll",A=k.overflowX==="scroll"||N.overflowX==="scroll",T=Math.max(0,l.innerWidth-o.clientWidth),M=Math.max(0,l.innerHeight-o.clientHeight),z=parseFloat(N.marginTop)+parseFloat(N.marginBottom),I=parseFloat(N.marginLeft)+parseFloat(N.marginRight),P=Pr(a)?a:o;if(p=kz(e),p){a.style.scrollbarGutter=S,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(C||R)&&(a.style.overflowY="scroll"),(E||A)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:z||M?`calc(100dvh - ${z+M}px)`:"100dvh",width:I||T?`calc(100vw - ${I+T}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=u,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function h(){Object.assign(a.style,kj),Object.assign(o.style,Sj),p||(a.scrollTop=c,a.scrollLeft=u,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=Cj)}function b(){h(),m.request(g)}g();const v=ht(l,"resize",b);return()=>{m.cancel(),h(),typeof l.removeEventListener=="function"&&v()}}class Nz{lockCount=0;restore=null;timeoutLock=qs.create();timeoutUnlock=qs.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),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(t){if(this.lockCount===0||this.restore!==null)return;const o=mt(t).documentElement,l=$t(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=En;return}const c=zf||!wz(t);this.restore=c?Sz(t):Cz(t)}}const Ez=new Nz;function $2(e=!0,t=null){De(()=>{if(e)return Ez.acquire(t)},[e,t])}const Rz=20;function F2(e,t,a,o){const[l,c]=x.useState(!1);De(()=>{if(!e||!t||a==null){c(!1);return}const u=mt(a).documentElement.clientWidth,p=a.offsetWidth;c(u>0&&p>0&&p>=u-Rz)},[e,t,a]),$2(e&&(!t||l),o)}const Tz=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p,align:m,sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:k=5,sticky:N=!1,disableAnchorTracking:w=!1,collisionAvoidance:y=LS,style:S,...C}=t,{store:E}=Ur(),R=bz(),A=Jf(!0),T=E.useState("parent"),M=E.useState("floatingRootContext"),z=E.useState("floatingTreeRoot"),I=E.useState("mounted"),P=E.useState("open"),H=E.useState("modal"),D=E.useState("openMethod"),B=E.useState("activeTriggerElement"),V=E.useState("transitionStatus"),$=E.useState("positionerElement"),q=E.useState("instantType"),Y=E.useState("hasViewport"),K=E.useState("lastOpenChangeReason"),F=E.useState("floatingNodeId"),X=E.useState("floatingParentNodeId"),L=M.useState("domReferenceElement"),G=x.useRef(null),Z=r2($,!1,!1);let ee=o,de=g,fe=h,ae=m,oe=y;T.type==="context-menu"&&(ee=o??T.context?.anchor,ae=ae??"start",!p&&ae!=="center"&&(fe=t.alignOffset??2,de=t.sideOffset??-5));let me=p,Te=ae;T.type==="menu"?(me=me??"inline-end",Te=Te??"start",oe=t.collisionAvoidance??IS):T.type==="menubar"&&(me=me??(T.context.orientation==="vertical"?"inline-end":"bottom"),Te=Te??"start");const ie=T.type==="context-menu",pe=Rb({anchor:ee,floatingRootContext:M,positionMethod:A?"fixed":l,mounted:I,side:me,sideOffset:de,align:Te,alignOffset:fe,arrowPadding:ie?0:k,collisionBoundary:b,collisionPadding:v,sticky:N,nodeId:F,keepMounted:R,disableAnchorTracking:w,collisionAvoidance:oe,shiftCrossAxis:ie&&!("side"in oe&&oe.side==="flip"),externalTree:z,adaptiveOrigin:Y?C2:void 0});x.useEffect(()=>{function Ce(Pe){Pe.open&&(Pe.parentNodeId===F&&E.set("hoverEnabled",!1),Pe.nodeId!==F&&Pe.parentNodeId===E.select("floatingParentNodeId")&&E.setOpen(!1,nt(uc)))}return z.events.on("menuopenchange",Ce),()=>{z.events.off("menuopenchange",Ce)}},[E,z.events,F]),x.useEffect(()=>{if(E.select("floatingParentNodeId")==null)return;function Ce(Pe){if(Pe.open||Pe.nodeId!==E.select("floatingParentNodeId"))return;const Le=Pe.reason??uc;E.setOpen(!1,nt(Le))}return z.events.on("menuopenchange",Ce),()=>{z.events.off("menuopenchange",Ce)}},[z.events,E]);const Se=kn();x.useEffect(()=>{P||Se.clear()},[P,Se]),x.useEffect(()=>{function Ce(Pe){if(!(!P||Pe.nodeId!==E.select("floatingParentNodeId")))if(Pe.target&&B&&B!==Pe.target){const Le=E.select("closeDelay");Le>0?Se.isStarted()||Se.start(Le,()=>{E.setOpen(!1,nt(uc))}):E.setOpen(!1,nt(uc))}else Se.clear()}return z.events.on("itemhover",Ce),()=>{z.events.off("itemhover",Ce)}},[z.events,P,B,E,Se]),x.useEffect(()=>{const Ce={open:P,nodeId:F,parentNodeId:X,reason:E.select("lastOpenChangeReason")};z.events.emit("menuopenchange",Ce)},[z.events,P,E,F,X]),De(()=>{const Ce=L,Pe=G.current;if(Ce&&(G.current=Ce),Pe&&Ce&&Ce!==Pe){E.set("instantType",void 0);const Le=new AbortController;return Z(()=>{E.set("instantType","trigger-change")},Le.signal),()=>{Le.abort()}}},[L,Z,E]);const je={open:P,side:pe.side,align:pe.align,anchorHidden:pe.anchorHidden,nested:T.type==="menu",instant:q},Be=T.type==="menubar"&&T.context.modal;F2(P&&(Be||H&&K!==Rn),D==="touch",$,B);const we=Tb(t,je,{styles:pe.positionerStyles,transitionStatus:V,props:C,refs:[a,E.useStateSetter("positionerElement")],hidden:!I,inert:!P}),Ee=I&&T.type!=="menu"&&(T.type!=="menubar"&&H&&K!==Rn||T.type==="menubar"&&T.context.modal);let ve=null;return T.type==="menubar"?ve=T.context.contentElement:T.type===void 0&&(ve=B),r.jsxs(A2.Provider,{value:pe,children:[Ee&&r.jsx(Pb,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:Zf(!P),cutout:ve}),r.jsx(tO,{id:F,children:r.jsx(sp,{elementsRef:E.context.itemDomElements,labelsRef:E.context.itemLabels,children:we})})]})}),G2=x.createContext(void 0);function Az(){const e=x.useContext(G2);if(e===void 0)throw new Error(nn(34));return e}const Mz=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,value:c,defaultValue:u,onValueChange:p,disabled:m=!1,style:g,"aria-labelledby":h,...b}=t,[v,k]=x.useState(void 0),[N,w]=Vl({controlled:c,default:u,name:"MenuRadioGroup"}),y=Ue((R,A)=>{p?.(R,A),!A.isCanceled&&w(R)}),C=Nt("div",t,{state:{disabled:m},ref:a,props:{role:"group","aria-labelledby":h??v,"aria-disabled":m||void 0,...b}}),E=x.useMemo(()=>({value:N,setValue:y,disabled:m}),[N,y,m]);return r.jsx(rz.Provider,{value:k,children:r.jsx(G2.Provider,{value:E,children:C})})})),Y2=x.createContext(void 0);function Oz(){const e=x.useContext(Y2);if(e===void 0)throw new Error(nn(35));return e}const zz=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!1,value:h,style:b,...v}=t,k=Gc({label:u}),N=zb(!0),w=Ys(c),{store:y}=Ur(),S=y.useState("isActive",k.index),C=y.useState("itemProps"),{value:E,setValue:R,disabled:A}=Az(),T=A||m,M=E===h,{getItemProps:z,itemRef:I}=D2({closeOnClick:g,disabled:T,highlighted:S,id:w,store:y,nativeButton:p,nodeId:N?.context.nodeId,itemMetadata:z2}),P=x.useMemo(()=>({disabled:T,highlighted:S,checked:M}),[T,S,M]);function H(B){const V=nt(El,B.nativeEvent,void 0,{preventUnmountOnClose(){}});R(h,V)}const D=Nt("div",t,{state:P,stateAttributesMapping:I2,props:[C,{role:"menuitemradio","aria-checked":M,onClick:H},v,z],ref:[I,a,k.ref]});return r.jsx(Y2.Provider,{value:P,children:D})}),Dz=x.forwardRef(function(t,a){const{render:o,className:l,style:c,keepMounted:u=!1,...p}=t,m=Oz(),g=x.useRef(null),{transitionStatus:h,setMounted:b}=ti(m.checked);ga({open:m.checked,ref:g,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:h};return Nt("span",t,{state:v,stateAttributesMapping:I2,ref:[a,g],props:{"aria-hidden":!0,...p},enabled:u||m.checked})}),Pz=x.createContext(null);function K2(e){return x.useContext(Pz)}function Lz(e){const t=x.useRef(""),a=x.useCallback(l=>{l.defaultPrevented||(t.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,t.current),t.current=""},[e]),onPointerDown:a}}function Lb(e,t){const a=x.useRef(e),o=Ue(t);De(()=>{a.current!==e&&o(a.current)},[e,o]),De(()=>{a.current=e},[e])}function Iz(e,t){const a=Ue((c,u)=>{(typeof e=="function"?e():e)||t(u||(zf?"touch":""))}),{onClick:o,onPointerDown:l}=Lz(a);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function X2(e){const[t,a]=x.useState(null),o=Iz(e,a);return Lb(e,l=>{l&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const Bz={...Sb,disabled:Ae(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ae(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),openMethod:Ae(e=>e.openMethod),allowMouseEnter:Ae(e=>e.allowMouseEnter),highlightItemOnHover:Ae(e=>e.highlightItemOnHover),stickIfOpen:Ae(e=>e.stickIfOpen),parent:Ae(e=>e.parent),rootId:Ae(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ae(e=>e.activeIndex),isActive:Ae((e,t)=>e.activeIndex===t),hoverEnabled:Ae(e=>e.hoverEnabled),instantType:Ae(e=>e.instantType),lastOpenChangeReason:Ae(e=>e.openChangeReason),floatingTreeRoot:Ae(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ae(e=>e.floatingNodeId),floatingParentNodeId:Ae(e=>e.floatingParentNodeId),itemProps:Ae(e=>e.itemProps),closeDelay:Ae(e=>e.closeDelay),hasViewport:Ae(e=>e.hasViewport),keyboardEventRelay:Ae(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Ib extends Gf{constructor(t){super({...Uz(),...t},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new Fc},Bz),this.unsubscribeParentListener=this.observe("parent",a=>{if(this.unsubscribeParentListener?.(),a.type==="menu"){let o=a.store.select("rootId"),l=a.store.select("floatingTreeRoot"),c=a.store.select("keyboardEventRelay");this.unsubscribeParentListener=a.store.subscribe(()=>{const u=a.store.select("rootId"),p=a.store.select("floatingTreeRoot"),m=a.store.select("keyboardEventRelay");o===u&&l===p&&c===m||(o=u,l=p,c=m,this.notifyAll())}),this.context.allowMouseUpTriggerRef=a.store.context.allowMouseUpTriggerRef;return}a.type!==void 0&&(this.context.allowMouseUpTriggerRef=a.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:a})}static useStore(t,a){const o=Xn(()=>new Ib(a)).current;return t??o}unsubscribeParentListener=null}function Uz(){return{...wb(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new mb,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:qt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const Hz=x.createContext(void 0);function Vz(){return x.useContext(Hz)}const qz=Yx(function(t){const{children:a,open:o,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:p=!1,modal:m,loopFocus:g=!0,orientation:h="vertical",actionsRef:b,closeParentOnEsc:v=!1,handle:k,triggerId:N,defaultTriggerId:w=null,highlightItemOnHover:y=!0}=t,S=Jf(!0),C=Ur(!0),E=K2(!0),R=Vz(),A=x.useMemo(()=>R&&C?{type:"menu",store:C.store}:E?{type:"menubar",context:E}:S&&!C?{type:"context-menu",context:S}:{type:void 0},[S,C,E,R]),T=Ib.useStore(k?.store,{open:u,openProp:o,activeTriggerId:w,triggerIdProp:N,parent:A});i2(T,o,u,w),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",N),T.useContextCallback("onOpenChangeComplete",c);const M=_o(),z=_o(),I=T.useState("floatingTreeRoot"),P=FS(I),H=Ir(),D=T.useState("open"),B=T.useState("activeTriggerElement"),V=T.useState("positionerElement"),$=T.useState("hoverEnabled"),q=T.useState("disabled"),Y=T.useState("lastOpenChangeReason"),K=T.useState("parent"),F=T.useState("activeIndex"),X=T.useState("payload"),L=T.useState("floatingParentNodeId"),G=x.useRef(null),Z=x.useRef(K.type!=="context-menu"),ee=kn(),de=x.useRef(!0),fe=kn(),ae=L!=null,{openMethod:oe,triggerProps:me}=X2(D);T.useSyncedValues({disabled:p,highlightItemOnHover:y,modal:K.type===void 0?m:void 0,openMethod:oe,rootId:M}),vb(T);const{forceUnmount:Te}=yb(D,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})});De(()=>{S&&!C?T.update({parent:{type:"context-menu",context:S},floatingNodeId:P,floatingParentNodeId:H}):C&&T.update({floatingNodeId:P,floatingParentNodeId:H})},[S,C,P,H,T]),x.useEffect(()=>{if(D||(G.current=null),K.type==="context-menu"){if(!D){ee.clear(),Z.current=!1;return}ee.start(500,()=>{Z.current=!0})}},[ee,D,K.type]),De(()=>{!D&&!$&&T.set("hoverEnabled",!0)},[D,$,T]);const ie=Ue((Oe,We)=>{const at=We.reason;if(D===Oe&&We.trigger===B&&Y===at)return;const yt=l2(We);if(!Oe&&We.trigger==null&&(We.trigger=B??void 0),l?.(Oe,We),We.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(Oe,We);const _e=We.event;if(Oe===!1&&_e?.type==="click"&&_e.pointerType==="touch"&&!de.current)return;Oe&&at===Nl?(de.current=!1,fe.start(300,()=>{de.current=!0})):(de.current=!0,fe.clear());const Me=(at===ei||at===El)&&_e.detail===0&&_e?.isTrusted,He=!Oe&&(at===Vf||at==null),Xe={open:Oe,openChangeReason:at};G.current=We.event??null,_b(Xe,Oe,We.trigger,yt()),T.update(Xe),K.type==="menubar"&&(at===Nl||at===bo||at===Rn||at===Xh||at===uc)?T.set("instantType","group"):Me||He?T.set("instantType",Me?"click":"dismiss"):T.set("instantType",void 0)}),pe=a2({popupStore:T,floatingId:z,nested:H!=null,onOpenChange:ie}),Se=pe.context.events;x.useEffect(()=>{const Oe=({open:We,eventDetails:at})=>ie(We,at);return Se.on("setOpen",Oe),()=>{Se?.off("setOpen",Oe)}},[Se,ie]);const je=x.useCallback(()=>{T.setOpen(!1,nt(nb))},[T]);x.useImperativeHandle(b,()=>({unmount:Te,close:je}),[Te,je]);let Be;K.type==="context-menu"&&(Be=K.context),x.useImperativeHandle(Be?.positionerRef,()=>V,[V]),x.useImperativeHandle(Be?.actionsRef,()=>({setOpen:ie}),[ie]);const Ve=$f(pe,{enabled:!q,bubbles:{escapeKey:v&&K.type==="menu"},outsidePress(){return K.type!=="context-menu"||G.current?.type==="contextmenu"?!0:Z.current},externalTree:ae?I:void 0}),we=Qf(),Ee=x.useCallback(Oe=>{T.select("activeIndex")!==Oe&&T.set("activeIndex",Oe)},[T]),ve=x2(pe,{enabled:!q,listRef:T.context.itemDomElements,activeIndex:F,nested:K.type!==void 0,loopFocus:g,orientation:h,parentOrientation:K.type==="menubar"?K.context.orientation:void 0,rtl:we==="rtl",disabledIndices:Ya,onNavigate:Ee,openOnArrowKeyDown:K.type!=="context-menu",externalTree:ae?I:void 0,focusItemOnHover:y}),Ce=x.useCallback(Oe=>{T.context.typingRef.current=Oe},[T]),Pe=b2(pe,{enabled:!q,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:F,resetMs:X5,onMatch:Oe=>{D&&Oe!==F&&T.set("activeIndex",Oe)},onTyping:Ce}),Le=x.useMemo(()=>{const Oe=Fn(Pe.reference,ve.reference,Ve.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=D,Oe},[T,Pe.reference,ve.reference,Ve.reference,me,D]),Ie=x.useMemo(()=>{const Oe=Fn(ve.trigger,Ve.trigger,me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=!1,Oe},[ve.trigger,Ve.trigger,me]),se=x.useMemo(()=>Fn(Kf,{id:z,role:"menu","aria-labelledby":B?.id,onMouseMove(){T.set("allowMouseEnter",!0),K.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Oe){const We=T.select("keyboardEventRelay");We&&!Oe.isPropagationStopped()&&We(Oe)}},Pe.floating,ve.floating,Ve.floating),[B,z,K.type,T,Pe.floating,ve.floating,Ve.floating]),be=ve.item??qt;jb(T,{floatingRootContext:pe,activeTriggerProps:Le,inactiveTriggerProps:Ie,popupProps:se,itemProps:be});const $e=x.useMemo(()=>({store:T,parent:A}),[T,A]),Re=r.jsx(M2.Provider,{value:$e,children:typeof a=="function"?a({payload:X}):a});return K.type===void 0||K.type==="context-menu"?r.jsx(nO,{externalTree:I,children:Re}):Re});function Q2(e){const t=e.getBoundingClientRect(),a=$t(e);if(Qx)return t;const o=a.getComputedStyle(e,"::before"),l=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const u=parseFloat(o.width)||0,p=parseFloat(o.height)||0,m=parseFloat(l.width)||0,g=parseFloat(l.height)||0,h=Math.max(t.width,u,m),b=Math.max(t.height,p,g),v=h-t.width,k=b-t.height;return{left:t.left-v/2,right:t.right+v/2,top:t.top-k/2,bottom:t.bottom+k/2}}function W2(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=Db(),{ref:l,index:c}=Gc(e),u=a===c,p=x.useRef(null),m=Ka(l,p);return{compositeProps:{tabIndex:u?0:-1,onFocus(){o(c)},onMouseMove(){const h=p.current;if(!t||!h)return;const b=h.hasAttribute("disabled")||h.ariaDisabled==="true";!u&&!b&&h.focus()}},compositeRef:m,index:c}}function $z(e){const{render:t,className:a,style:o,state:l=qt,props:c=Ya,refs:u=Ya,metadata:p,stateAttributesMapping:m,tag:g="div",...h}=e,{compositeProps:b,compositeRef:v}=W2({metadata:p});return Nt(g,e,{state:l,ref:[...u,v],props:[b,...c,h],stateAttributesMapping:m})}function Z2(e){if(Ut(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!oa(e))return Z2(da(e))}function Fz(e,t){const a=x.useRef(null);function o(c){ca.flushSync(()=>{e.setOpen(!1,nt(bo,c.nativeEvent,c.currentTarget))}),A5(a.current)?.focus()}function l(c){const u=e.select("positionerElement");if(u&&Rl(c,u))e.context.beforeContentFocusGuardRef.current?.focus();else{ca.flushSync(()=>{e.setOpen(!1,nt(bo,c.nativeEvent,c.currentTarget))});let p=T5(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(u,p);){const m=p;if(p=cb(p),p===m)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:l}}function Gz(e){const{enabled:t=!0,mouseDownAction:a,open:o}=e,l=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(a==="open"&&!o||a==="close"&&o)&&(l.current=!0,mt(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:qt,[t,a,o])}const yd=2,Yz=oS(function(t,a){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,id:m,openOnHover:g,delay:h=100,closeDelay:b=0,handle:v,payload:k,...N}=t,w=Ur(!0),y=v?.store??w?.store;if(!y)throw new Error(nn(85));const S=Ys(m),C=y.useState("isTriggerActive",S),E=y.useState("floatingRootContext"),R=y.useState("isOpenedByTrigger",S),A=y.useState("triggerPopupId",S),T=x.useRef(null),M=Xz(),z=Db(!0),I=Br(),P=x.useMemo(()=>I??new mb,[I]),H=FS(P),D=Ir(),{registerTrigger:B,isMountedByThisTrigger:V}=c2(S,T,y,{payload:k,closeDelay:b,parent:M,floatingTreeRoot:P,floatingNodeId:H,floatingParentNodeId:D,keyboardEventRelay:z?.relayKeyboardEvent}),$=M.type==="menubar",q=y.useState("disabled"),Y=u||q||$&&M.context.disabled,{getButtonProps:K,buttonRef:F}=Hr({disabled:Y,native:p});x.useEffect(()=>{!R&&M.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,R,M.type]);const X=x.useRef(null),L=kn(),G=Ue(ve=>{if(!X.current)return;L.clear(),y.context.allowMouseUpTriggerRef.current=!1;const Ce=ve.target;if(Qe(X.current,Ce)||Qe(y.select("positionerElement"),Ce)||Ce===X.current||Ce!=null&&Z2(Ce)===y.select("rootId"))return;const Pe=Q2(X.current);ve.clientX>=Pe.left-yd&&ve.clientX<=Pe.right+yd&&ve.clientY>=Pe.top-yd&&ve.clientY<=Pe.bottom+yd||P.events.emit("close",{domEvent:ve,reason:pS})});x.useEffect(()=>{R&&y.select("lastOpenChangeReason")===Rn&&mt(X.current).addEventListener("mouseup",G,{once:!0})},[R,G,y]);const Z=$&&M.context.hasSubmenuOpen,de=h2(E,{enabled:(g??Z)&&!Y&&M.type!=="context-menu"&&(!$||Z&&!V),handleClose:_2({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:M.type===void 0?h:void 0,delay:{close:b},triggerElementRef:T,externalTree:P,isActiveTrigger:C,isClosing:()=>y.select("transitionStatus")==="ending"}),fe=Kz(R,y.select("lastOpenChangeReason")),ae=GS(E,{enabled:!Y&&M.type!=="context-menu",event:R&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:M.type===void 0?fe:!1}),oe=p2(E,{enabled:!Y&&Z}),me=Gz({open:R,enabled:$,mouseDownAction:"open"}),Te=x.useMemo(()=>Fn(oe.reference,ae.reference),[oe.reference,ae.reference]),ie=y.useState("triggerProps",V),{preFocusGuardRef:pe,handlePreFocusGuardFocus:Se,handleFocusTargetFocus:je}=Fz(y,T),Be={disabled:Y,open:R},Ve=[X,a,F,B,T],we=[Te,de??qt,ie,{"aria-haspopup":"menu","aria-controls":A,id:S,onMouseDown:ve=>{if(y.select("open"))return;L.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),mt(ve.currentTarget).addEventListener("mouseup",G,{once:!0})}},$?{role:"menuitem"}:{},me,N,K],Ee=Nt("button",t,{enabled:!$,stateAttributesMapping:nx,state:Be,ref:Ve,props:we});return $?r.jsx($z,{tag:"button",render:o,className:l,style:c,state:Be,refs:Ve,props:we,stateAttributesMapping:nx}):R?r.jsxs(x.Fragment,{children:[r.jsx(Ul,{ref:pe,onFocus:Se},`${S}-pre-focus-guard`),r.jsx(x.Fragment,{children:Ee},S),r.jsx(Ul,{ref:y.context.triggerFocusTargetRef,onFocus:je},`${S}-post-focus-guard`)]}):r.jsx(x.Fragment,{children:Ee},S)});function Kz(e,t){const a=kn(),[o,l]=x.useState(!1);return De(()=>{e&&t==="trigger-hover"?(l(!0),a.start(Q5,()=>{l(!1)})):e||(a.clear(),l(!1))},[e,t,a]),o}function Xz(){const e=Jf(!0),t=Ur(!0),a=K2();return x.useMemo(()=>a?{type:"menubar",context:a}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,a])}function J2(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function eC({...e}){return r.jsx(qz,{"data-slot":"dropdown-menu",...e})}function tC({...e}){return r.jsx(Yz,{"data-slot":"dropdown-menu-trigger",...e})}function nC({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:o=4,className:l,...c}){return r.jsx(_z,{children:r.jsx(Tz,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:o,children:r.jsx(xz,{"data-slot":"dropdown-menu-content",className:St("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-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:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...c})})})}function Qz({className:e,inset:t,variant:a="default",...o}){return r.jsx(oz,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:St("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...o})}function Wz({...e}){return r.jsx(Mz,{"data-slot":"dropdown-menu-radio-group",...e})}function Zz({className:e,children:t,inset:a,...o}){return r.jsxs(zz,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:St("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[r.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:r.jsx(Dz,{children:r.jsx(ho,{})})}),t]})}const Jz={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",pager_prev:"Anterior",pager_next:"Siguiente",pager_page:"Página {page} de {total}",pager_range:"{from}–{to} de {total}",pager_per_page:"Por página"},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",all_projects:"Todos los proyectos",more_projects:"{count} más",collapse_projects:"Ocultar proyectos",expand_projects:"Mostrar proyectos",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code",web:"Web"}},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",picker_prompt:"Elegí la carpeta del proyecto",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",system_mode:"Sistema",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",modules_section:"Módulos",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:"Detectado automáticamente — buscá para cambiar.",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.",system_ph:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)",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:"Roby no encontró el proyecto {pid}: quizás se desregistró o el ID es incorrecto.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",loaded_subtitle:"Conversación cargada con {slug}. Lo que mandes se agrega a este chat.",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",clear:"Limpiar",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master",list:{title:"Chats",new:"Nuevo",search:"Buscar chats…",all_agents:"Todos los agentes",empty:"No hay conversaciones todavía. Arrancá una desde la derecha.",count:"{n} en total",live_with:"Live · {slug}",live_subtitle:"Sesión en memoria"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",delete_confirm_body:"Esta acción no se puede deshacer.",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",list_title:"Rutinas",detail_empty:"Elegí una rutina de la lista.",edit_btn:"Editar",edit_hint:"Abrir el editor: tipo, intervalo, prompt, pre/post y variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Texto",block_command:"Comando",block_empty:"(vacío)",runs_title:"Ejecuciones",runs_empty:"Sin ejecuciones todavía.",runs_close:"Cerrar",runs_no_detail:"Sin más detalle.",runs_output:"Salida",status_ok:"ok",status_error:"error",status_skipped:"salteada",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:"Mensaje de Telegram (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.",run_confirm:"¿Ejecutar la rutina {name} ahora?",run_confirm_body:"Corre la acción una vez, sin esperar al horario.",running:"Ejecutando…",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en .apc/agents/<slug>.md.",subtitle_full:"Definidos en .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
|
|
617
|
+
|
|
618
|
+
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}",sessions_search_ph:"Buscar sesiones…",sessions_deep:"Profundo",sessions_deep_tip:"También busca dentro de los transcripts (más lento)",sessions_clear:"Limpiar filtros",sessions_refresh:"Refrescar lista",sessions_no_match:"Ninguna sesión coincide con «{q}».",sessions_act_cmd:"Copiar comando apx",sessions_act_ask:"Pedir a {name} que continúe",sessions_act_folder:"Abrir carpeta",sessions_act_path:"Copiar ruta",sessions_cmd_copied:"Comando copiado — pegalo en tu terminal",sessions_path_copied:"Ruta copiada",sessions_copy_failed:"No se pudo copiar",sessions_no_folder:"Esta sesión no tiene carpeta",sessions_no_path:"Esta sesión no tiene ruta",sessions_folder_failed:"No se pudo abrir la carpeta: {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:"Roby se perdió: esta página no existe o se movió.",home:"Volver al inicio"},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",open_config:"Configuració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",preview_badge:"Vista previa",preview_title:"Deck — Próximamente",preview_body:"El módulo Deck todavía está en desarrollo y no fue lanzado aún. Lo volveremos a activar cuando Deck salga en una versión estable. Por ahora todo acá es de solo lectura y no se guardará ningún cambio."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí un proveedor y un modelo. 'Automático' prueba local primero y cae a offline si no hay nada disponible.",provider_label:"Proveedor",provider_hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de abajo).",mode_label:"Modo de selección",mode_hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",available:"disponible",unavailable:"no disp.",test_btn:"Probar embedding",reindex_btn:"Reindexar memoria",test_ok:"Embedding OK con {embedder}",test_failed:"Test falló: {msg}",reindexed:"Reindexado: {indexed} chunks (limpiados {cleared}).",reindex_failed:"Reindex falló: {msg}",save_failed:"No se pudo guardar: {msg}",provider_auto:"Automático (cadena: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, sin API key (nomic-embed-text)",provider_gemini:"Gemini — free tier con key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, sin modelo — degradado)",mode_chain:"Cadena (fallback automático)",mode_single:"Único (usa solo el elegido)",ollama_title:"Ollama (local)",ollama_desc:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",model_label:"Modelo",base_url_label:"Base URL",ollama_base_url_hint:"Vacío usa engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) u otro modelo compatible.",api_key_label:"API key",openai_key_hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para mantener la guardada.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier con API key de Google.",gemini_key_hint:"Vacío reusa engines.gemini.api_key.",compaction_title:"Compactación de historial",compaction_desc:"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.",threshold_label:"Umbral de compactación",threshold_hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",keep_recent_label:"Turnos recientes a preservar",keep_recent_hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",compact_model_label:"Modelo de compactación",compact_model_hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",compact_fallback_label:"Modelo de fallback",compact_fallback_hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",compact_fallback_ph:"(vacío → modelo del super-agente)"},router_panel:{title:"Router de modelos",description:"Un único router general (sin casos por tarea). Elegí un proveedor y un modelo; si el activo falla, prueba la cadena de fallback en orden.",badge_default:"default",no_providers:"Agregá un proveedor abajo para poder elegir modelos.",active_model_label:"Modelo activo (default)",active_model_hint:"Proveedor + modelo. Se guarda como proveedor:modelo.",fallback_title:"Cadena de fallback",fallback_desc:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo.",fallback_empty:"Sin fallback configurado.",add_to_chain:"Agregar a la cadena",done:"listo",save:"Guardar router",saved:"Guardado",saved_toast:"Router guardado.",provider_ph:"— proveedor —",provider_not_found:"⚠ {name} (no encontrado)",provider_not_configured:'El proveedor "{name}" no está configurado.'},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},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"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",base_url_label:"Base URL (opcional)",base_url_hint:"Endpoint compatible con OpenAI. Vacío = OpenAI. Apuntalo a un servidor local (ej. un daemon QVox / Qwen3-TTS) para usar ese en su lugar.",openai_model_hint:"tts-1 / tts-1-hd para OpenAI. Dejalo vacío para que un servidor custom elija.",openai_voice_hint:"Preset de OpenAI (alloy…) o preset de tu servidor custom (ej. custom). Vacío = default del servidor.",openai_style_hint:"Voz base / instruct, usada por endpoints custom (la persona que se mantiene en todo el audio). El tts-1 de OpenAI la ignora.",style_label:"Estilo (cómo debería hablar)",style_hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej.: 'hablá en un tono alegre y pausado'.",style_ph:"hablá en un tono alegre y enérgico",temperature_label:"Temperatura (opcional)",temperature_hint:"Temperatura de sampleo para endpoints custom. Vacío = default del servidor.",emotions_label:"Tags de emoción inline",emotions_hint:"Cuando hable este motor, deja que el agente meta tags tipo [happy]/[whisper] en las respuestas de voz para darles color. Activalo solo si este motor entiende los tags (ej. un endpoint QVox/Qwen3-TTS) — si no, se quitan antes de sintetizar.",emotions_tags_label:"Tags permitidos",emotions_tags_hint:"Separados por coma. Vacío = el set por defecto.",piper_bin_label:"Binario (bin)",piper_bin_hint:"Ruta o nombre del CLI de piper (PATH).",piper_model_label:"Modelo (.onnx)",piper_model_hint:"Ruta absoluta al modelo de voz de piper.",piper_speaker_label:"Speaker (opcional)",piper_speaker_hint:"Speaker id para modelos multi-voz.",mock_desc:"El engine mock genera un WAV de prueba en silencio. No tiene parámetros: sirve como fallback garantizado cuando no hay ningún otro engine configurado.",selection_mode:"Modo de selección",mode_chain_desc:"Cadena con fallback: usa el primer engine disponible siguiendo el orden de abajo.",mode_single_desc:"Solo engine default: siempre usa el elegido; el resto queda configurado para otros usos.",mode_chain_btn:"Cadena (router)",mode_single_btn:"Solo engine default",move_up:"Subir",move_down:"Bajar",badge_local:"local",badge_available:"disponible",badge_unavailable:"configurado, no disponible",badge_not_configured:"sin configurar",badge_default:"default",badge_custom:"custom",set_as_default:"Usar como default",configure:"Configurar",remove:"Quitar",remove_confirm:"¿Quitar este proveedor custom?",add_provider:"Agregar proveedor",new_provider:"Nuevo proveedor",custom_note:"Endpoint custom compatible con OpenAI.",custom_desc:"Cualquier endpoint de voz compatible con OpenAI (ej. un servidor local QVox / Qwen3-TTS).",label_label:"Nombre",label_hint:"Nombre para mostrar de este proveedor.",base_url_req_label:"Base URL",base_url_req_hint:"Requerido. El endpoint compatible con OpenAI, ej. http://127.0.0.1:5111/v1",api_key_optional_hint:"Opcional — solo si tu servidor pide key.",advanced:"Avanzado",custom_model_hint:"Opcional. La mayoría de los servidores locales lo ignoran (ej. QVox).",custom_voice_hint:"Opcional. Un preset que entienda tu servidor (ej. custom). Vacío = default del servidor.",custom_optional_ph:"(opcional)",stt_engine_label:"Engine de transcripción",stt_engine_hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",stt_model_label:"Modelo local (whisper)",stt_model_hint:"Más grande = más preciso y más lento.",stt_language_label:"Idioma",stt_language_hint:'Para español, elegir "Español" mejora la precisión.',stt_provider_auto:"Automático (local, después remoto)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — server OpenAI-compatible",stt_openai_model_label:"Modelo OpenAI",stt_openai_model_hint:"Por defecto whisper-1.",stt_custom_baseurl_label:"URL base (OpenAI-compatible)",stt_custom_baseurl_hint:"Ej: http://localhost:8000/v1 (mlx-audio en Metal) o http://192.168.1.50:9000/v1 (Radeon/NVIDIA en la red).",stt_custom_model_label:"Modelo",stt_custom_model_hint:"Ej: mlx-community/whisper-large-v3-turbo o large-v3.",stt_custom_key_hint:"Opcional — la mayoría de los servers locales no requieren key.",stt_hw_label:"Hardware detectado",stt_hw_recommended:"Recomendado",stt_hw_limited:"aceleración GPU limitada, se usa CPU",stt_backend_label:"Aceleración / Motor",stt_backend_hint:"Auto elige según tu hardware. Metal corre en la GPU (mlx); CPU usa faster-whisper.",stt_backend_auto:"Automático (recomendado)",stt_model_needs_download:"Falta descargar (~{size}). Hay que bajar el modelo para usar este motor.",lang_auto:"Detección automática",lang_es:"Español",lang_en:"Inglés",lang_pt:"Portugués",lang_fr:"Francés",lang_it:"Italiano",lang_de:"Alemán",test_default_text:"Hola, soy APX. Esto es una prueba de voz.",test_default_engine:"Default ({name})",test_default_chain:"Default (cadena)",test_unavailable_suffix:" · no disponible",test_empty_error:"Escribí algo para decir.",test_synth_error:"No se pudo sintetizar.",test_engine_label:"Engine",test_engine_hint:"Override del default para probar.",test_style_label:"Estilo (solo Gemini)",test_style_hint:"Cómo debería hablar. Vacío = sin estilo.",test_text_label:"Texto a decir",test_text_ph:"Escribí lo que querés que diga…",say_this:"Decir esto",stop:"Detener",replay:"Repetir",engine_result:"Engine",providers_desc:"Engines de síntesis, en orden de fallback. El estado lo reporta el daemon en vivo. Agregá tus propios endpoints compatibles con OpenAI.",providers_load_error:"No pude cargar los proveedores: {msg}",test_desc:"Elegí con qué engine sintetizar y, si aplica, cómo debería hablar.",stt_desc:"Engine de speech-to-text que usan el deck, Telegram y la CLI al escuchar.",toast_default_engine:"Engine default: {id}.",toast_mode_chain:"Modo: cadena con fallback.",toast_mode_single:"Modo: solo engine default.",toast_config_saved:"Configuración de voz guardada.",toast_provider_removed:"Proveedor eliminado.",err_label_required:"Falta el nombre.",err_base_url_required:"Falta la base URL.",toast_transcription_updated:"Transcripción actualizada."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",bot_token_hint:"Token de BotFather. Se guarda en ~/.apx/config.json.",bot_token_hint_short:"Token de BotFather.",secret_set_replace:"(seteado — escribí para reemplazar)",secret_already_set:"(ya seteado)",empty_keep:"— vacío = mantener",message_sent:"Mensaje enviado.",message_label:"Texto",send_chat_id:"chat_id: {id}",default_apx:"APX por defecto",yes:"sí",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_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.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de texto de los pre-commands. Se reemplaza dentro del prompt/texto antes de enviarlo. Útil para inyectar datos frescos (clima, una API) en la instrucción.",var_llm_output:"Respuesta final del agente o super-agente. Disponible en los post-commands como variable de entorno. Ej: reenviarla por Telegram.",var_status:"Resultado de la acción: ok o error. Disponible en los post-commands para decidir qué hacer después.",var_skipped:"Vale 1 si la acción se salteó (por skip_prompt_on), 0 si corrió. Disponible en los post-commands.",var_pre_output:"Salida completa de los pre-commands, como variable de entorno en los post-commands (hasta 32k).",var_pre_output_file:"Ruta a un archivo temporal con la salida de los pre-commands. Para salidas grandes que no convienen como variable.",var_pre_exit:"Código de salida del último pre-command (0 = ok). Disponible en los post-commands.",var_routine:"Nombre de esta rutina. Disponible como variable de entorno en los comandos.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_system:"Sistema",desktop_theme_light:"Claro",desktop_theme_dark:"Oscuro",desktop_status_desc:"La ventana se abre desde la terminal o por arranque automático.",desktop_running:"Corriendo",desktop_stopped:"Detenida",desktop_refresh:"refrescar",desktop_start:"Iniciar",desktop_stop:"Detener",desktop_restart:"Reiniciar",desktop_restart_hint:"Recarga la ventana abierta para aplicar ya los cambios de config (tema, posición).",desktop_restart_done:"Reiniciando la ventana — aplicando la última config.",desktop_restart_none:"No hay ninguna ventana de desktop conectada.",desktop_start_done:"Ventana de desktop iniciada.",desktop_start_already:"La ventana de desktop ya estaba corriendo.",desktop_stop_done:"Ventana de desktop detenida.",desktop_stop_none:"No había ninguna ventana de desktop corriendo.",desktop_from_terminal:"Desde la terminal:",desktop_autostart_desc:"Abre la ventana al iniciar sesión. Equivale a `apx desktop install` (no requiere sudo).",desktop_platform:"plataforma: {platform}",desktop_shortcut_desc:"Atajo global que muestra/oculta la ventana y empieza a escuchar.",desktop_accelerator:"Acelerador",desktop_accelerator_hint:"Hacé clic en el campo y apretá tu combinación de teclas. Reiniciá la ventana para aplicar.",desktop_shortcut_record:"Hacé clic para definir un atajo",desktop_shortcut_recording:"Apretá tu combinación…",desktop_shortcut_change:"clic para cambiar",desktop_shortcut_esc:"Esc para cancelar",desktop_shortcut_saved:"Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.",desktop_autostart_on:"Arranque automático habilitado para el próximo inicio de sesión.",desktop_autostart_off:"Arranque automático deshabilitado.",desktop_appearance_desc:"Tema de la ventana y posición en la pantalla.",desktop_theme:"Tema",desktop_restart_apply:"Reiniciá la ventana para aplicar.",desktop_theme_set:"Tema: {value}.",desktop_position:"Posición",desktop_position_hint:'"izquierda" / "centro" / "derecha" del borde superior.',desktop_position_set:"Posición: {value}.",desktop_activation_desc:"El plugin del daemon procesa los mensajes. El STT se configura en Voces.",desktop_enabled_toast:"Escritorio habilitado.",desktop_disabled_toast:"Escritorio deshabilitado.",desktop_plugin_on:"Plugin habilitado (responde mensajes)",desktop_plugin_off:"Plugin deshabilitado",desktop_stt_engine:"Motor de speech-to-text:",desktop_stt_engine_suffix:"(whisper local, idioma, modelo).",desktop_last_conv_desc:"El último intercambio con el agente desde la ventana flotante.",desktop_no_messages:"Todavía no hay mensajes. Mandá algo a la ventana de escritorio para que aparezca acá.",desktop_you:"Vos",desktop_roby:"Roby",desktop_empty_msg:"(vacío)",deck_widget_enabled:"Widget {id} habilitado.",deck_widget_disabled:"Widget {id} deshabilitado.",deck_save_error:"Error al guardar",deck_loading_manifest:"Cargando manifest…",deck_manifest_error:"Error al cargar el manifest.",deck_widgets_summary:"{count} widgets · {enabled} externos habilitados",deck_loading_manifest_full:"Cargando el manifest del Deck…",deck_manifest_load_failed:"No se pudo cargar el manifest del Deck.",deck_retry:"Reintentar",deck_no_widgets:"No hay widgets en el manifest.",deck_context_desc:"Información que el Deck ve desde el daemon.",deck_active_project:"Proyecto activo:",deck_none:"ninguno",deck_registered_projects:"Proyectos registrados:",deck_active_plugins:"Plugins activos:",deck_daemon_active:"activo · {uptime}",deck_daemon_started:"iniciado",deck_safety_no_shell:"sin shell directo",deck_safety_no_arbitrary:"comandos arbitrarios bloqueados",deck_safety_confirm:"las acciones peligrosas requieren confirmación",code_copied:"Copiado.",code_saved:"Guardado.",code_file_empty:"(vacío)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Agente principal con todas las tools",code_chat_tab:"Chat",code_panel_sessions:"Lista de sesiones",code_panel_tree:"Árbol de archivos",code_panel_terminal:"Terminal",code_panel_context:"Panel de contexto",code_ctx_auto:"auto",code_ctx_mode:"Modo",code_ctx_agent:"Agente",code_ctx_msgs_value:"{user} usuario · {assistant} asistente",code_ctx_tokens_total:"Tokens Total",code_ctx_created:"Creado",code_ctx_activity:"Actividad",code_project_fallback:"proyecto {id}",code_pick_project_ph:"Elegí un proyecto…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"Ver",code_artifact_edit_short:"Editar",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncado"},settings_ui:{bearer_label:"Bearer",global_config_desc:"Config general en ~/.apx/config.json. Editable por tabs; el JSON queda separado.",global_json_desc:"Los secretos redacted no se sobrescriben.",save_json:"Guardar JSON",expand_menu:"Expandir menú",collapse_menu:"Colapsar menú",documentation:"Documentación",kind_personal:"Personal",kind_company:"Empresa",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Otro",base_menu_view:"Vista del menú Base (workspace general).",coming_soon:"Próximamente",inspector_title:"Skill Inspector (RAG por turno)",inspector_desc:"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 es medio, nada si no aplica. Se reevalúa en cada turno: una skill que dejó de ser relevante desaparece del contexto.",enable_inspector:"Habilitar inspector",enable_inspector_hint:"Off = comportamiento clásico (lista de slugs + sugerencia pasiva). On = el RAG decide por turno.",on:"On",off:"Off",index_count:"Índice: {n} skills",not_indexed:"sin indexar",dim:"dim {dim}",updated_at:"actualizado {date}",reindex:"Reindexar",reindex_forced:"Reindexar (forzado)",embedder_source:"El embedder viene de Memoria (RAG). Local con Ollama, u offline si no hay proveedor configurado.",thresholds_title:"Umbrales y límites",thresholds_desc:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderte una skill; bajarlos = al revés.",test_title:"Probar (dry-run)",test_desc:"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 aunque esté apagado arriba.",test_placeholder:"ej.: necesito crear un video promocional con voz en off",test_btn:"Probar",jit_empty_index:"JIT (índice vacío)",loaded_label:"Cargadas:",suggested_label:"Sugeridas:",could_not_save:"No se pudo guardar: {msg}",indexed_with:"Indexado con {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Falló el indexado: {msg}",dry_run_failed:"Falló el dry-run: {msg}",knob_load_threshold:"Umbral de carga",knob_load_threshold_hint:"Similaridad mínima para inyectar el CUERPO de la skill (alto = más estricto).",knob_hint_threshold:"Umbral de sugerencia",knob_hint_threshold_hint:"Similaridad mínima para solo SUGERIR la skill (así el agente la carga si quiere).",knob_margin:"Margen sobre la 2da",knob_margin_hint:"La primera tiene que superar a la segunda por este margen para cargar su cuerpo (evita empates flojos).",knob_max_loaded:"Máx. cuerpos cargados",knob_max_loaded_hint:"Cuántas skills se inyectan completas por turno.",knob_max_hints:"Máx. sugerencias",knob_max_hints_hint:"Cuántas skills extra se nombran como sugerencia.",knob_prompt_floor:"Largo mínimo del prompt",knob_prompt_floor_hint:"Los mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",knob_body_char_cap:"Tope de chars del cuerpo",knob_body_char_cap_hint:"Recorta los cuerpos largos para que no inflen el contexto.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Solo valores específicos del proyecto; vacío hereda del global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Modelo del super-agente",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Prompt extra",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Responder con engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Proyecto",cfg_project_desc:".apc/project.json. Metadata APC portable; sin secretos, sin runtime.",cfg_name:"Nombre",cfg_version:"Versión",cfg_apc_spec:"APC spec",cfg_apx_install:"Estado de instalación APX",cfg_apx_storage_id:"ID de storage APX"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) eligió estas skills para este turno",tools_count:"{n} tools",tool_read_file:"Leer archivo",tool_write_file:"Escribir archivo",tool_edit_file:"Editar archivo",tool_list_files:"Listar archivos",tool_search_files:"Buscar en archivos",tool_search_messages:"Buscar mensajes",tool_tail_messages:"Últimos mensajes",tool_run_shell:"Correr shell",tool_send_telegram:"Enviar Telegram",tool_call_agent:"Llamar agente",tool_call_mcp:"Llamar MCP",tool_call_runtime:"Llamar runtime",tool_create_task:"Crear task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (decide el router)",model_filter_ph:"filtrar o escribir modelo…",loading_models:"cargando modelos…",use_value:"usar “{value}”",model_combobox_ph:"elegí o escribí un modelo…",search_variable_ph:"buscar variable…",no_matches:"sin coincidencias",create_variable:"Crear nueva variable…",kv_key_ph:"CLAVE",kv_value_ph:"valor",remove_row:"quitar fila",add_row:"Agregar fila",err_chat_failed:"Falló el chat.",err_stream_failed:"Falló el stream.",err_load_conversation:"No se pudo cargar la conversación.",err_stream:"Error de stream."}},eD={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",pager_prev:"Previous",pager_next:"Next",pager_page:"Page {page} of {total}",pager_range:"{from}–{to} of {total}",pager_per_page:"Per page"},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",all_projects:"All projects",more_projects:"{count} more",collapse_projects:"Hide projects",expand_projects:"Show projects",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code",web:"Web"}},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",picker_prompt:"Pick the project folder",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",system_mode:"System",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",modules_section:"Modules",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:"Auto-detected — search to change.",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.",system_ph:"(Empty = the base prompt from core/agent/prompts/super-agent-base.md is used)",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:"Roby couldn't find project {pid}: it may have been unregistered, or the ID is wrong.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",loaded_subtitle:"Loaded conversation with {slug}. Sending will append to this thread.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent",list:{title:"Chats",new:"New",search:"Search chats…",all_agents:"All agents",empty:"No conversations yet. Start one from the right.",count:"{n} total",live_with:"Live · {slug}",live_subtitle:"In-memory session"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",delete_confirm_body:"This can't be undone.",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",list_title:"Routines",detail_empty:"Pick a routine from the list.",edit_btn:"Edit",edit_hint:"Open the editor: kind, schedule, prompt, pre/post and variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Text",block_command:"Command",block_empty:"(empty)",runs_title:"Executions",runs_empty:"No executions yet.",runs_close:"Close",runs_no_detail:"No further detail.",runs_output:"Output",status_ok:"ok",status_error:"error",status_skipped:"skipped",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:"Telegram Message (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.",run_confirm:"Run routine {name} now?",run_confirm_body:"Runs the action once, regardless of the schedule.",running:"Running…",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in .apc/agents/<slug>.md.",subtitle_full:"Defined in .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
|
|
619
|
+
|
|
620
|
+
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}",sessions_search_ph:"Search sessions…",sessions_deep:"Deep",sessions_deep_tip:"Also search inside transcripts (slower)",sessions_clear:"Clear filters",sessions_refresh:"Refresh list",sessions_no_match:"No sessions match “{q}”.",sessions_act_cmd:"Copy apx command",sessions_act_ask:"Ask {name} to continue",sessions_act_folder:"Open folder",sessions_act_path:"Copy path",sessions_cmd_copied:"Command copied — paste it in your terminal",sessions_path_copied:"Path copied",sessions_copy_failed:"Could not copy",sessions_no_folder:"This session has no folder",sessions_no_path:"This session has no path",sessions_folder_failed:"Could not open folder: {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:"Roby got lost: this page doesn't exist or has moved.",home:"Back to home"},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",open_config:"Configuration"},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",preview_badge:"Preview",preview_title:"Deck — Coming soon",preview_body:"The Deck module is still in development and not released yet. We'll re-enable it once Deck ships in a stable release. For now everything here is read-only and no changes will be saved."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Model that vectorizes the history of all channels for relevant memory. Just like TTS/STT: pick a provider and model. 'Automatic' tries local first and falls back to offline if nothing is available.",provider_label:"Provider",provider_hint:"Ollama is local and free. Gemini/OpenAI use the API key from their section in Models (or the one below).",mode_label:"Selection mode",mode_hint:"Chain falls back to the next if one fails; Single uses exactly the chosen provider.",available:"available",unavailable:"unavail.",test_btn:"Test embedding",reindex_btn:"Reindex memory",test_ok:"Embedding OK with {embedder}",test_failed:"Test failed: {msg}",reindexed:"Reindexed: {indexed} chunks (cleared {cleared}).",reindex_failed:"Reindex failed: {msg}",save_failed:"Could not save: {msg}",provider_auto:"Automatic (chain: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, no API key (nomic-embed-text)",provider_gemini:"Gemini — free tier with key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, no model — degraded)",mode_chain:"Chain (automatic fallback)",mode_single:"Single (uses only the chosen one)",ollama_title:"Ollama (local)",ollama_desc:"No API key. Runs nomic-embed-text on your local or cloud Ollama.",model_label:"Model",base_url_label:"Base URL",ollama_base_url_hint:"Empty uses engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) or another compatible model.",api_key_label:"API key",openai_key_hint:"Empty reuses engines.openai.api_key. Leave it blank to keep the saved one.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier with a Google API key.",gemini_key_hint:"Empty reuses engines.gemini.api_key.",compaction_title:"History compaction",compaction_desc:"When a chat exceeds the turn threshold, the oldest turns are summarized with a lightweight (local) LLM and saved as [COMPACTED SUMMARY], keeping context bounded. Runs off the hot-path: the current turn uses whatever summary already exists.",threshold_label:"Compaction threshold",threshold_hint:"Compact once the chat exceeds these turns (default 60).",keep_recent_label:"Recent turns to preserve",keep_recent_hint:"Verbatim turns that are NEVER compacted (default 40). Must be lower than the threshold.",compact_model_label:"Compaction model",compact_model_hint:"Lightweight LLM for summarizing. Ideally a local one (Ollama) to avoid cost. Format provider:model.",compact_fallback_label:"Fallback model",compact_fallback_hint:"Used if the compaction one fails. Empty falls back to the super-agent model.",compact_fallback_ph:"(empty → super-agent model)"},router_panel:{title:"Model router",description:"A single general router (no per-task cases). Pick a provider and model; if the active one fails, it tries the fallback chain in order.",badge_default:"default",no_providers:"Add a provider below to be able to pick models.",active_model_label:"Active model (default)",active_model_hint:"Provider + model. Saved as provider:model.",fallback_title:"Fallback chain",fallback_desc:"If the active model fails, it tries these in order. Click one to edit it.",fallback_empty:"No fallback configured.",add_to_chain:"Add to the chain",done:"done",save:"Save router",saved:"Saved",saved_toast:"Router saved.",provider_ph:"— provider —",provider_not_found:"⚠ {name} (not found)",provider_not_configured:'The provider "{name}" is not configured.'},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},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"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",base_url_label:"Base URL (optional)",base_url_hint:"OpenAI-compatible endpoint. Empty = OpenAI. Point it at a local server (e.g. a QVox / Qwen3-TTS daemon) to use that instead.",openai_model_hint:"tts-1 / tts-1-hd for OpenAI. Leave blank to let a custom server pick.",openai_voice_hint:"OpenAI preset (alloy…) or a custom server's preset (e.g. custom). Empty = server default.",openai_style_hint:"Base voice / instruct, used by custom endpoints (the persona kept across the audio). Ignored by stock OpenAI tts-1.",style_label:"Style (how it should speak)",style_hint:"Natural-language instruction. Empty = no style. E.g.: 'speak in a cheerful, unhurried tone'.",style_ph:"speak in a cheerful, energetic tone",temperature_label:"Temperature (optional)",temperature_hint:"Sampling temperature for custom endpoints. Empty = server default.",emotions_label:"Inline emotion tags",emotions_hint:"When this engine speaks, let the agent drop [happy]/[whisper]-style tags into voice replies to color the delivery. Only enable it if this engine understands the tags (e.g. a QVox/Qwen3-TTS endpoint) — otherwise they're stripped before synthesis.",emotions_tags_label:"Allowed tags",emotions_tags_hint:"Comma-separated. Empty = the default set.",piper_bin_label:"Binary (bin)",piper_bin_hint:"Path or name of the piper CLI (PATH).",piper_model_label:"Model (.onnx)",piper_model_hint:"Absolute path to the piper voice model.",piper_speaker_label:"Speaker (optional)",piper_speaker_hint:"Speaker id for multi-voice models.",mock_desc:"The mock engine generates a silent test WAV. It has no parameters: it serves as a guaranteed fallback when no other engine is configured.",selection_mode:"Selection mode",mode_chain_desc:"Chain with fallback: uses the first available engine following the order below.",mode_single_desc:"Default engine only: always uses the chosen one; the rest stay configured for other purposes.",mode_chain_btn:"Chain (router)",mode_single_btn:"Default engine only",move_up:"Move up",move_down:"Move down",badge_local:"local",badge_available:"available",badge_unavailable:"configured, unavailable",badge_not_configured:"not configured",badge_default:"default",badge_custom:"custom",set_as_default:"Set as default",configure:"Configure",remove:"Remove",remove_confirm:"Remove this custom provider?",add_provider:"Add provider",new_provider:"New provider",custom_note:"Custom OpenAI-compatible endpoint.",custom_desc:"Any OpenAI-compatible speech endpoint (e.g. a local QVox / Qwen3-TTS server).",label_label:"Name",label_hint:"Display name for this provider.",base_url_req_label:"Base URL",base_url_req_hint:"Required. The OpenAI-compatible endpoint, e.g. http://127.0.0.1:5111/v1",api_key_optional_hint:"Optional — only if your server requires a key.",advanced:"Advanced",custom_model_hint:"Optional. Most local servers ignore it (e.g. QVox).",custom_voice_hint:"Optional. A preset your server understands (e.g. custom). Empty = server default.",custom_optional_ph:"(optional)",stt_engine_label:"Transcription engine",stt_engine_hint:"Local uses faster-whisper (requires python3 + faster-whisper). OpenAI uses the engines.openai key.",stt_model_label:"Local model (whisper)",stt_model_hint:"Bigger = more accurate and slower.",stt_language_label:"Language",stt_language_hint:'For Spanish, setting "Spanish" improves accuracy.',stt_provider_auto:"Automatic (local, then remote)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — OpenAI-compatible server",stt_openai_model_label:"OpenAI model",stt_openai_model_hint:"Defaults to whisper-1.",stt_custom_baseurl_label:"Base URL (OpenAI-compatible)",stt_custom_baseurl_hint:"e.g. http://localhost:8000/v1 (mlx-audio on Metal) or http://192.168.1.50:9000/v1 (Radeon/NVIDIA on the LAN).",stt_custom_model_label:"Model",stt_custom_model_hint:"e.g. mlx-community/whisper-large-v3-turbo or large-v3.",stt_custom_key_hint:"Optional — most local servers need no key.",stt_hw_label:"Detected hardware",stt_hw_recommended:"Recommended",stt_hw_limited:"limited GPU acceleration, using CPU",stt_backend_label:"Acceleration / Engine",stt_backend_hint:"Auto adapts to your hardware. Metal runs on the GPU (mlx); CPU uses faster-whisper.",stt_backend_auto:"Automatic (recommended)",stt_model_needs_download:"Not downloaded (~{size}). The model must be downloaded to use this engine.",lang_auto:"Auto-detect",lang_es:"Spanish",lang_en:"English",lang_pt:"Portuguese",lang_fr:"French",lang_it:"Italian",lang_de:"German",test_default_text:"Hi, I'm APX. This is a voice test.",test_default_engine:"Default ({name})",test_default_chain:"Default (chain)",test_unavailable_suffix:" · unavailable",test_empty_error:"Type something to say.",test_synth_error:"Could not synthesize.",test_engine_label:"Engine",test_engine_hint:"Override the default for testing.",test_style_label:"Style (Gemini only)",test_style_hint:"How it should speak. Empty = no style.",test_text_label:"Text to say",test_text_ph:"Type what you want it to say…",say_this:"Say this",stop:"Stop",replay:"Replay",engine_result:"Engine",providers_desc:"Synthesis engines, in fallback order. Status is reported live by the daemon. Add your own OpenAI-compatible endpoints.",providers_load_error:"Could not load providers: {msg}",test_desc:"Pick which engine to synthesize with and, if applicable, how it should speak.",stt_desc:"Speech-to-text engine used by the deck, Telegram, and the CLI when listening.",toast_default_engine:"Default engine: {id}.",toast_mode_chain:"Mode: chain with fallback.",toast_mode_single:"Mode: default engine only.",toast_config_saved:"Voice configuration saved.",toast_provider_removed:"Provider removed.",err_label_required:"A name is required.",err_base_url_required:"A base URL is required.",toast_transcription_updated:"Transcription updated."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (partial).",bot_token_hint:"BotFather token. Stored in ~/.apx/config.json.",bot_token_hint_short:"BotFather token.",secret_set_replace:"(set — type to replace)",secret_already_set:"(already set)",empty_keep:"— empty = keep",message_sent:"Message sent.",message_label:"Text",send_chat_id:"chat_id: {id}",default_apx:"default APX",yes:"yes",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Text output of the pre-commands. Replaced inside the prompt/text before it is sent. Use it to inject fresh data (weather, an API) into the instruction.",var_llm_output:"Final answer from the agent or super-agent. Available in the post-commands as an env var — e.g. forward it via Telegram.",var_status:"Action result: ok or error. Available in the post-commands to branch on what happened.",var_skipped:"1 if the action was skipped (via skip_prompt_on), 0 if it ran. Available in the post-commands.",var_pre_output:"Full pre-commands output, as an env var in the post-commands (up to 32k).",var_pre_output_file:"Path to a temp file with the pre-commands output. For large outputs not suited to an env var.",var_pre_exit:"Exit code of the last pre-command (0 = ok). Available in the post-commands.",var_routine:"Name of this routine. Available as an env var in the commands.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_system:"System",desktop_theme_light:"Light",desktop_theme_dark:"Dark",desktop_status_desc:"The window launches from the terminal or via autostart.",desktop_running:"Running",desktop_stopped:"Stopped",desktop_refresh:"refresh",desktop_start:"Start",desktop_stop:"Stop",desktop_restart:"Restart",desktop_restart_hint:"Reload the open window so config changes (theme, position) apply now.",desktop_restart_done:"Restarting the window — applying the latest config.",desktop_restart_none:"No desktop window is connected.",desktop_start_done:"Desktop window launched.",desktop_start_already:"Desktop window is already running.",desktop_stop_done:"Desktop window stopped.",desktop_stop_none:"No desktop window was running.",desktop_from_terminal:"From terminal:",desktop_autostart_desc:"Launches the window at user login. Equivalent to `apx desktop install` (no sudo required).",desktop_platform:"platform: {platform}",desktop_shortcut_desc:"Global hotkey that shows/hides the window and starts listening.",desktop_accelerator:"Accelerator",desktop_accelerator_hint:"Click the field and press your key combo. Restart the window to apply.",desktop_shortcut_record:"Click to set a shortcut",desktop_shortcut_recording:"Press your combo…",desktop_shortcut_change:"click to change",desktop_shortcut_esc:"Esc to cancel",desktop_shortcut_saved:"Shortcut saved. Restart the window (apx desktop stop && start) to apply it.",desktop_autostart_on:"Autostart enabled for the next login.",desktop_autostart_off:"Autostart disabled.",desktop_appearance_desc:"Window theme and position on the screen.",desktop_theme:"Theme",desktop_restart_apply:"Restart the window to apply.",desktop_theme_set:"Theme: {value}.",desktop_position:"Position",desktop_position_hint:'"left" / "center" / "right" of the top edge.',desktop_position_set:"Position: {value}.",desktop_activation_desc:"The daemon plugin processes the messages. STT is configured in Voices.",desktop_enabled_toast:"Desktop enabled.",desktop_disabled_toast:"Desktop disabled.",desktop_plugin_on:"Plugin enabled (replies to messages)",desktop_plugin_off:"Plugin disabled",desktop_stt_engine:"Speech-to-text engine:",desktop_stt_engine_suffix:"(local whisper, language, model).",desktop_last_conv_desc:"The latest exchange with the agent from the floating window.",desktop_no_messages:"No messages yet. Send something to the desktop window for it to appear here.",desktop_you:"You",desktop_roby:"Roby",desktop_empty_msg:"(empty)",deck_widget_enabled:"Widget {id} enabled.",deck_widget_disabled:"Widget {id} disabled.",deck_save_error:"Error while saving",deck_loading_manifest:"Loading manifest…",deck_manifest_error:"Error loading the manifest.",deck_widgets_summary:"{count} widgets · {enabled} external enabled",deck_loading_manifest_full:"Loading the Deck manifest…",deck_manifest_load_failed:"Could not load the Deck manifest.",deck_retry:"Retry",deck_no_widgets:"No widgets in the manifest.",deck_context_desc:"Information the Deck sees from the daemon.",deck_active_project:"Active project:",deck_none:"none",deck_registered_projects:"Registered projects:",deck_active_plugins:"Active plugins:",deck_daemon_active:"active · {uptime}",deck_daemon_started:"started",deck_safety_no_shell:"no direct shell",deck_safety_no_arbitrary:"arbitrary commands blocked",deck_safety_confirm:"dangerous actions require confirmation",code_copied:"Copied.",code_saved:"Saved.",code_file_empty:"(empty)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Main agent with all tools",code_chat_tab:"Chat",code_panel_sessions:"Session list",code_panel_tree:"File tree",code_panel_terminal:"Terminal",code_panel_context:"Context panel",code_ctx_auto:"auto",code_ctx_mode:"Mode",code_ctx_agent:"Agent",code_ctx_msgs_value:"{user} user · {assistant} assistant",code_ctx_tokens_total:"Total Tokens",code_ctx_created:"Created",code_ctx_activity:"Activity",code_project_fallback:"project {id}",code_pick_project_ph:"Pick a project…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"View",code_artifact_edit_short:"Edit",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncated"},settings_ui:{bearer_label:"Bearer",global_config_desc:"General config in ~/.apx/config.json. Editable by tabs; JSON stays separate.",global_json_desc:"Redacted secrets are not overwritten.",save_json:"Save JSON",expand_menu:"Expand menu",collapse_menu:"Collapse menu",documentation:"Documentation",kind_personal:"Personal",kind_company:"Company",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Other",base_menu_view:"Base menu view (general workspace).",coming_soon:"Coming soon",inspector_title:"Skill Inspector (per-turn RAG)",inspector_desc:"Experimental feature. When active, the agent does NOT receive the full skill list in its prompt; on each message a local RAG decides which skill(s) to load — the full body on a strong match, a suggestion on a medium match, nothing if it doesn't apply. It is re-evaluated every turn: a skill that stopped being relevant disappears from the context.",enable_inspector:"Enable inspector",enable_inspector_hint:"Off = classic behavior (slug list + passive suggestion). On = the RAG decides per turn.",on:"On",off:"Off",index_count:"Index: {n} skills",not_indexed:"not indexed",dim:"dim {dim}",updated_at:"updated {date}",reindex:"Reindex",reindex_forced:"Reindex (forced)",embedder_source:"The embedder comes from Memory (RAG). Local with Ollama, or offline if no provider is set.",thresholds_title:"Thresholds and limits",thresholds_desc:"Tune how aggressive the inspector is. Raising the thresholds = fewer false positives but more risk of missing a skill; lowering them = the opposite.",test_title:"Test (dry-run)",test_desc:"Type a message the way a user would and see which skills the inspector would load/suggest — without calling the model. Forces the inspector on even if it's off above.",test_placeholder:"e.g.: I need to create a promo video with voiceover",test_btn:"Test",jit_empty_index:"JIT (empty index)",loaded_label:"Loaded:",suggested_label:"Suggested:",could_not_save:"Could not save: {msg}",indexed_with:"Indexed with {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Index failed: {msg}",dry_run_failed:"Dry-run failed: {msg}",knob_load_threshold:"Load threshold",knob_load_threshold_hint:"Minimum similarity to inject the skill's BODY (high = stricter).",knob_hint_threshold:"Hint threshold",knob_hint_threshold_hint:"Minimum similarity to only SUGGEST the skill (so the agent loads it if it wants).",knob_margin:"Margin over the 2nd",knob_margin_hint:"The top must beat the second by this margin to load its body (avoids weak ties).",knob_max_loaded:"Max. loaded bodies",knob_max_loaded_hint:"How many skills are injected in full per turn.",knob_max_hints:"Max. hints",knob_max_hints_hint:"How many extra skills are named as a suggestion.",knob_prompt_floor:"Minimum prompt length",knob_prompt_floor_hint:"Messages shorter than this are ignored (avoids 'ok', 'hi').",knob_body_char_cap:"Body char cap",knob_body_char_cap_hint:"Trims long skill bodies so they don't bloat the context.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Only project-specific values; empty inherits global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Super-agent model",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Extra prompt",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Respond with engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Project",cfg_project_desc:".apc/project.json. Portable APC metadata; no secrets, no runtime.",cfg_name:"Name",cfg_version:"Version",cfg_apc_spec:"APC spec",cfg_apx_install:"APX install state",cfg_apx_storage_id:"APX storage id"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) chose these skills for this turn",tools_count:"{n} tools",tool_read_file:"Read file",tool_write_file:"Write file",tool_edit_file:"Edit file",tool_list_files:"List files",tool_search_files:"Search in files",tool_search_messages:"Search messages",tool_tail_messages:"Latest messages",tool_run_shell:"Run shell",tool_send_telegram:"Send Telegram",tool_call_agent:"Call agent",tool_call_mcp:"Call MCP",tool_call_runtime:"Call runtime",tool_create_task:"Create task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (router decides)",model_filter_ph:"filter or type a model…",loading_models:"loading models…",use_value:"use “{value}”",model_combobox_ph:"pick or type a model…",search_variable_ph:"search variable…",no_matches:"no matches",create_variable:"Create new variable…",kv_key_ph:"KEY",kv_value_ph:"value",remove_row:"remove row",add_row:"Add row",err_chat_failed:"Chat failed.",err_stream_failed:"Stream failed.",err_load_conversation:"Could not load conversation.",err_stream:"Stream error."}},Bb={es:Jz,en:eD};function tD(){try{const e=localStorage.getItem(Tn.language);if(e&&e in Bb)return e}catch{}return"en"}let ap=tD();function sC(e){ap=e;try{localStorage.setItem(Tn.language,e)}catch{}}const aC=[{value:"es",label:"Español"},{value:"en",label:"English"}];function rC(){return ap}function nD(e){const t=Bb[ap],a=e.split(".");let o=t;for(const l of a)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function sD(e,t){return t?e.replace(/\{(\w+)\}/g,(a,o)=>o in t?String(t[o]):`{${o}}`):e}function aD(e){const t=nD(e);if(t!==void 0)return t;if(ap!=="es"){const a=Bb.es,o=e.split(".");let l=a;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 f(e,t){const a=aD(e);return a===void 0?e:sD(a,t)}function Ub(e){const[t,a]=x.useState(!1);x.useEffect(()=>{try{a(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>a(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:t,toggle:o}}function rD({collapsed:e,onToggle:t}){return r.jsx(Ye,{content:f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:r.jsx("button",{type:"button",onClick:t,"aria-label":f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),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(Kk,{className:ze("size-4 transition-transform",e&&"rotate-180")})})})}function oD({sections:e,active:t,onChange:a,collapsed:o=!1}){return r.jsx("nav",{className:ze("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:ze("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:u,label:p,icon:m,badge:g})=>{const h=t===u,b=r.jsxs("button",{type:"button",onClick:()=>a(u),"data-testid":`tabnav-${u||"index"}`,className:ze("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",h?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(m,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),g!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return o?r.jsx(Ye,{content:p,side:"right",children:b},u):r.jsx(x.Fragment,{children:b},u)})})]},c))})}const oC=0,lC=1,iC=2,Nj=3;var Ej=Object.prototype.hasOwnProperty;function sx(e,t){var a,o;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((o=e.length)===t.length)for(;o--&&sx(e[o],t[o]););return o===-1}if(!a||typeof e=="object"){o=0;for(a in e)if(Ej.call(e,a)&&++o&&!Ej.call(t,a)||!(a in t)||!sx(e[a],t[a]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const Ha=new WeakMap,qa=()=>{},Bn=qa(),ax=Object,kt=e=>e===Bn,sa=e=>typeof e=="function",zr=(e,t)=>({...e,...t}),cC=e=>sa(e.then),Gg={},jd={},Hb="undefined",Yc=typeof window!=Hb,rx=typeof document!=Hb,lD=Yc&&"Deno"in window,iD=()=>Yc&&typeof window.requestAnimationFrame!=Hb,uC=(e,t)=>{const a=Ha.get(e);return[()=>!kt(t)&&e.get(t)||Gg,o=>{if(!kt(t)){const l=e.get(t);t in jd||(jd[t]=l),a[5](t,zr(l,o),l||Gg)}},a[6],()=>!kt(t)&&t in jd?jd[t]:!kt(t)&&e.get(t)||Gg]};let ox=!0;const cD=()=>ox,[lx,ix]=Yc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[qa,qa],uD=()=>{const e=rx&&document.visibilityState;return kt(e)||e!=="hidden"},dD=e=>(rx&&document.addEventListener("visibilitychange",e),lx("focus",e),()=>{rx&&document.removeEventListener("visibilitychange",e),ix("focus",e)}),fD=e=>{const t=()=>{ox=!0,e()},a=()=>{ox=!1};return lx("online",t),lx("offline",a),()=>{ix("online",t),ix("offline",a)}},pD={isOnline:cD,isVisible:uD},mD={initFocus:dD,initReconnect:fD},Rj=!Uc.useId,Al=!Yc||lD,gD=e=>iD()?window.requestAnimationFrame(e):setTimeout(e,1),Yg=Al?x.useEffect:x.useLayoutEffect,Kg=typeof navigator<"u"&&navigator.connection,Tj=!Al&&Kg&&(["slow-2g","2g"].includes(Kg.effectiveType)||Kg.saveData),wd=new WeakMap,hD=e=>ax.prototype.toString.call(e),Xg=(e,t)=>e===`[object ${t}]`;let xD=0;const cx=e=>{const t=typeof e,a=hD(e),o=Xg(a,"Date"),l=Xg(a,"RegExp"),c=Xg(a,"Object");let u,p;if(ax(e)===e&&!o&&!l){if(u=wd.get(e),u)return u;if(u=++xD+"~",wd.set(e,u),Array.isArray(e)){for(u="@",p=0;p<e.length;p++)u+=cx(e[p])+",";wd.set(e,u)}if(c){u="#";const m=ax.keys(e).sort();for(;!kt(p=m.pop());)kt(e[p])||(u+=p+":"+cx(e[p])+",");wd.set(e,u)}}else u=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},Vb=e=>{if(sa(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?cx(e):"",[e,t]};let bD=0;const ux=()=>++bD;async function dC(...e){const[t,a,o,l]=e,c=zr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let u=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const g=v=>typeof p=="function"?p(v):p!==!1,h=c.throwOnError;if(sa(a)){const v=a,k=[],N=t.keys();for(const w of N)!/^\$(inf|sub)\$/.test(w)&&v(t.get(w)._k)&&k.push(w);return Promise.all(k.map(b))}return b(a);async function b(v){const[k]=Vb(v);if(!k)return;const[N,w]=uC(t,k),[y,S,C,E]=Ha.get(t),R=()=>{const V=y[k];return(sa(c.revalidate)?c.revalidate(N().data,v):c.revalidate!==!1)&&(delete C[k],delete E[k],V&&V[0])?V[0](iC).then(()=>N().data):N().data};if(e.length<3)return R();let A=o,T,M=!1;const z=ux();S[k]=[z,0];const I=!kt(m),P=N(),H=P.data,D=P._c,B=kt(D)?H:D;if(I&&(m=sa(m)?m(B,H):m,w({data:m,_c:B})),sa(A))try{A=A(B)}catch(V){T=V,M=!0}if(A&&cC(A))if(A=await A.catch(V=>{T=V,M=!0}),z!==S[k][0]){if(M)throw T;return A}else M&&I&&g(T)&&(u=!0,w({data:B,_c:Bn}));if(u&&!M)if(sa(u)){const V=u(A,B);w({data:V,error:Bn,_c:Bn})}else w({data:A,error:Bn,_c:Bn});if(S[k][1]=ux(),Promise.resolve(R()).then(()=>{w({_c:Bn})}),M){if(h)throw T;return}return A}}const Aj=(e,t)=>{for(const a in e)e[a][0]&&e[a][0](t)},_D=(e,t)=>{if(!Ha.has(e)){const a=zr(mD,t),o=Object.create(null),l=dC.bind(Bn,e);let c=qa;const u=Object.create(null),p=(h,b)=>{const v=u[h]||[];return u[h]=v,v.push(b),()=>{const k=v.indexOf(b);k>=0&&(v[k]=v[v.length-1],v.pop())}},m=(h,b,v)=>{e.set(h,b);const k=u[h];if(k)for(const N of k)N(b,v)},g=()=>{if(!Ha.has(e)&&(Ha.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!Al)){const h=a.initFocus(setTimeout.bind(Bn,Aj.bind(Bn,o,oC))),b=a.initReconnect(setTimeout.bind(Bn,Aj.bind(Bn,o,lC)));c=()=>{h&&h(),b&&b(),Ha.delete(e)}}};return g(),[e,l,g,c]}return[e,Ha.get(e)[4]]},vD=(e,t,a,o,l)=>{const c=a.errorRetryCount,u=l.retryCount,p=~~((Math.random()+.5)*(1<<(u<8?u:8)))*a.errorRetryInterval;!kt(c)&&u>c||setTimeout(o,p,l)},yD=sx,[fC,pC]=_D(new Map),jD=zr({onLoadingSlow:qa,onSuccess:qa,onError:qa,onErrorRetry:vD,onDiscarded:qa,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Tj?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Tj?5e3:3e3,compare:yD,isPaused:()=>!1,cache:fC,mutate:pC,fallback:{}},pD),wD=(e,t)=>{const a=zr(e,t);if(t){const{use:o,fallback:l}=e,{use:c,fallback:u}=t;o&&c&&(a.use=o.concat(c)),l&&u&&(a.fallback=zr(l,u))}return a},kD=x.createContext({}),SD="$inf$",mC=Yc&&window.__SWR_DEVTOOLS_USE__,CD=mC?window.__SWR_DEVTOOLS_USE__:[],ND=()=>{mC&&(window.__SWR_DEVTOOLS_REACT__=Uc)},ED=e=>sa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],gC=()=>{const e=x.useContext(kD);return x.useMemo(()=>zr(jD,e),[e])},RD=e=>(t,a,o)=>e(t,a&&((...c)=>{const[u]=Vb(t),[,,,p]=Ha.get(fC);if(u.startsWith(SD))return a(...c);const m=p[u];return kt(m)?a(...c):(delete p[u],m)}),o),TD=CD.concat(RD),AD=e=>function(...a){const o=gC(),[l,c,u]=ED(a),p=wD(o,u);let m=e;const{use:g}=p,h=(g||[]).concat(TD);for(let b=h.length;b--;)m=h[b](m);return m(l,c||p.fetcher||null,p)},MD=(e,t,a)=>{const o=t[e]||(t[e]=[]);return o.push(a),()=>{const l=o.indexOf(a);l>=0&&(o[l]=o[o.length-1],o.pop())}};ND();const Qg=Uc.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(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Wg={dedupe:!0},df=Promise.resolve(Bn);df.status="fulfilled";df.value=Bn;const OD=()=>qa,zD=(e,t,a)=>{const{cache:o,compare:l,suspense:c,fallbackData:u,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:v,strictServerPrefetchWarning:k}=a,[N,w,y,S]=Ha.get(o),[C,E]=Vb(e),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(C),M=x.useRef(t),z=x.useRef(a),I=()=>z.current,P=()=>I().isVisible()&&I().isOnline(),[H,D,B,V]=uC(o,C),$=x.useRef({}).current,q=kt(u)?kt(a.fallback)?Bn:a.fallback[C]:u,Y=(we,Ee)=>{for(const ve in $){const Ce=ve;if(Ce==="data"){if(!l(we[Ce],Ee[Ce])&&(!kt(we[Ce])||!l(fe,Ee[Ce])))return!1}else if(Ee[Ce]!==we[Ce])return!1}return!0},K=!R.current,F=x.useMemo(()=>{const we=H(),Ee=V(),ve=Ie=>{const se=zr(Ie);return delete se._k,(()=>{if(!C||!t||I().isPaused())return!1;if(K&&!kt(p))return p;const $e=kt(q)?se.data:q;return kt($e)||m})()?{isValidating:!0,isLoading:!0,...se}:se},Ce=ve(we),Pe=we===Ee?Ce:ve(Ee);let Le=Ce;return[()=>{const Ie=ve(H());return Y(Ie,Le)?(Le.data=Ie.data,Le.isLoading=Ie.isLoading,Le.isValidating=Ie.isValidating,Le.error=Ie.error,Le):(Le=Ie,Ie)},()=>Pe]},[o,C]),X=af.useSyncExternalStore(x.useCallback(we=>B(C,(Ee,ve)=>{Y(ve,Ee)||we()}),[o,C]),F[0],F[1]),L=N[C]&&N[C].length>0,G=X.data,Z=kt(G)?q&&cC(q)?Qg(q):q:G,ee=X.error,de=x.useRef(Z),fe=v?kt(G)?kt(de.current)?Z:de.current:G:Z,ae=C&&kt(Z),oe=x.useRef(null);!Al&&af.useSyncExternalStore(OD,()=>(oe.current=!1,oe),()=>(oe.current=!0,oe));const me=oe.current;k&&me&&!c&&ae&&console.warn(`Missing pre-initiated data for serialized key "${C}" 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=!C||!t||I().isPaused()||L&&!kt(ee)?!1:K&&!kt(p)?p:c?kt(Z)?!1:m:kt(Z)||m,ie=K&&Te,pe=kt(X.isValidating)?ie:X.isValidating,Se=kt(X.isLoading)?ie:X.isLoading,je=x.useCallback(async we=>{const Ee=M.current;if(!C||!Ee||A.current||I().isPaused())return!1;let ve,Ce,Pe=!0;const Le=we||{},Ie=!y[C]||!Le.dedupe,se=()=>Rj?!A.current&&C===T.current&&R.current:C===T.current,be={isValidating:!1,isLoading:!1},$e=()=>{D(be)},Re=()=>{const We=y[C];We&&We[1]===Ce&&delete y[C]},Oe={isValidating:!0};kt(H().data)&&(Oe.isLoading=!0);try{if(Ie&&(D(Oe),a.loadingTimeout&&kt(H().data)&&setTimeout(()=>{Pe&&se()&&I().onLoadingSlow(C,a)},a.loadingTimeout),y[C]=[Ee(E),ux()]),[ve,Ce]=y[C],ve=await ve,Ie&&setTimeout(Re,a.dedupingInterval),!y[C]||y[C][1]!==Ce)return Ie&&se()&&I().onDiscarded(C),!1;be.error=Bn;const We=w[C];if(!kt(We)&&(Ce<=We[0]||Ce<=We[1]||We[1]===0))return $e(),Ie&&se()&&I().onDiscarded(C),!1;const at=H().data;be.data=l(at,ve)?at:ve,Ie&&se()&&I().onSuccess(ve,C,a)}catch(We){Re();const at=I(),{shouldRetryOnError:yt}=at;at.isPaused()||(be.error=We,Ie&&se()&&(at.onError(We,C,at),(yt===!0||sa(yt)&&yt(We))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||P())&&at.onErrorRetry(We,C,at,_e=>{const Me=N[C];Me&&Me[0]&&Me[0](Nj,_e)},{retryCount:(Le.retryCount||0)+1,dedupe:!0})))}return Pe=!1,$e(),!0},[C,o]),Be=x.useCallback((...we)=>dC(o,T.current,...we),[]);if(Yg(()=>{M.current=t,z.current=a,kt(G)||(de.current=G)}),Yg(()=>{if(!C)return;const we=je.bind(Bn,Wg);let Ee=0;I().revalidateOnFocus&&(Ee=Date.now()+I().focusThrottleInterval);const Ce=MD(C,N,(Pe,Le={})=>{if(Pe==oC){const Ie=Date.now();I().revalidateOnFocus&&Ie>Ee&&P()&&(Ee=Ie+I().focusThrottleInterval,we())}else if(Pe==lC)I().revalidateOnReconnect&&P()&&we();else{if(Pe==iC)return je();if(Pe==Nj)return je(Le)}});return A.current=!1,T.current=C,R.current=!0,D({_k:E}),Te&&(y[C]||(kt(Z)||Al?we():gD(we))),()=>{A.current=!0,Ce()}},[C]),Yg(()=>{let we;function Ee(){const Ce=sa(g)?g(H().data):g;Ce&&we!==-1&&(we=setTimeout(ve,Ce))}function ve(){!H().error&&(h||I().isVisible())&&(b||I().isOnline())?je(Wg).then(Ee):Ee()}return Ee(),()=>{we&&(clearTimeout(we),we=-1)}},[g,h,b,C]),x.useDebugValue(fe),c){if(!Rj&&Al&&ae)throw new Error("Fallback data is required when using Suspense in SSR.");ae&&(M.current=t,z.current=a,A.current=!1);const we=S[C],Ee=!kt(we)&&ae?Be(we):df;if(Qg(Ee),!kt(ee)&&ae)throw ee;const ve=ae?je(Wg):df;!kt(fe)&&ae&&(ve.status="fulfilled",ve.value=!0),Qg(ve)}return{mutate:Be,get data(){return $.data=!0,fe},get error(){return $.error=!0,ee},get isValidating(){return $.isValidating=!0,pe},get isLoading(){return $.isLoading=!0,Se}}},et=AD(zD);let ql=null;function fo(e){ql=e}function qb(){return ql}class Kc extends Error{status;body;constructor(t,a,o){super(a),this.status=t,this.body=o}}async function Ji(e,t,a,o={}){const l={"content-type":"application/json",...ql?{authorization:`Bearer ${ql}`}:{},...o.headers||{}},c=await fetch(t,{...o,method:e,headers:l,body:a!==void 0?JSON.stringify(a):void 0});if(!c.ok){let u="",p=null;try{p=await c.json(),u=p?.error||JSON.stringify(p)}catch{u=await c.text()}throw new Kc(c.status,`${e} ${t} → ${c.status}: ${u}`,p)}if(c.status!==204)return await c.json()}function wl(e){const t=e;if(Array.isArray(e))return{items:e,total:e.length};if(t&&Array.isArray(t.data)){const a=t.data;return{items:a,total:typeof t.meta?.total=="number"?t.meta.total:a.length}}if(t&&Array.isArray(t.sessions)){const a=t.sessions;return{items:a,total:a.length}}return{items:[],total:0}}const ge={get:e=>Ji("GET",e),post:(e,t)=>Ji("POST",e,t),put:(e,t)=>Ji("PUT",e,t),patch:(e,t)=>Ji("PATCH",e,t),del:e=>Ji("DELETE",e)};async function hC(e,t,a,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...ql?{authorization:`Bearer ${ql}`}:{}},body:JSON.stringify(t)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new Kc(l.status,`POST ${e} → ${l.status}: ${m||"stream failed"}`)}const c=l.body.getReader(),u=new TextDecoder("utf-8");let p="";for(;;){const{value:m,done:g}=await c.read();if(g)break;p+=u.decode(m,{stream:!0});let h=p.indexOf(`
|
|
621
|
+
`);for(;h>=0;){const b=p.slice(0,h).trim();if(p=p.slice(h+1),b)try{a(JSON.parse(b))}catch{}h=p.indexOf(`
|
|
622
|
+
`)}}if(p.trim())try{a(JSON.parse(p.trim()))}catch{}}const DD={get:()=>ge.get("/health")},ls={list:()=>ge.get("/projects"),register:e=>ge.post("/projects",{path:e}),remove:e=>ge.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ge.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ge.get(`/projects/${e}/config`),set:(e,t)=>ge.patch(`/projects/${e}/config`,{set:t}),unset:(e,t)=>ge.patch(`/projects/${e}/config`,{unset:t}),put:(e,t)=>ge.put(`/projects/${e}/config`,t)},apcProject:{set:(e,t,a)=>ge.patch(`/projects/${e}/apc-project`,{set:t,unset:a}),put:(e,t)=>ge.put(`/projects/${e}/apc-project`,t)},memory:{get:e=>ge.get(`/projects/${e}/memory`),put:(e,t)=>ge.put(`/projects/${e}/memory`,{body:t})}},rn={list:e=>ge.get(`/projects/${e}/agents`),get:(e,t)=>ge.get(`/projects/${e}/agents/${t}`),create:(e,t)=>ge.post(`/projects/${e}/agents`,t),update:(e,t,a)=>ge.patch(`/projects/${e}/agents/${encodeURIComponent(t)}`,a),remove:(e,t)=>ge.del(`/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,a)=>ge.post(`/projects/${e}/agents/${encodeURIComponent(t)}/chat`,a),memory:{get:(e,t)=>ge.get(`/projects/${e}/agents/${t}/memory`),put:(e,t,a)=>ge.put(`/projects/${e}/agents/${t}/memory`,{body:a})},vault:e=>ge.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,t={},a="")=>ge.post("/agents/vault",{slug:e,fields:t,body:a}),vaultPatch:(e,t)=>ge.patch(`/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>ge.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ge.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>ge.post(`/projects/${e}/agents/import`,{slug:t})},$b={list:(e,t)=>ge.get(`/projects/${e}/agents/${t}/conversations`),get:(e,t,a)=>ge.get(`/projects/${e}/agents/${t}/conversations/${a}`),compact:(e,t,a)=>ge.post(a?`/projects/${e}/agents/${t}/conversations/${a}/compact`:`/projects/${e}/agents/${t}/compact`,{})},Cr={list:e=>ge.get(`/projects/${e}/routines`),get:(e,t)=>ge.get(`/projects/${e}/routines/${t}`),run:(e,t)=>ge.post(`/projects/${e}/routines/${t}/run`),enable:(e,t)=>ge.post(`/projects/${e}/routines/${t}/enable`),disable:(e,t)=>ge.post(`/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>ge.post(`/projects/${e}/routines`,t),remove:(e,t)=>ge.del(`/projects/${e}/routines/${encodeURIComponent(t)}`)},Nr={list:(e,t="open")=>ge.get(`/projects/${e}/tasks?state=${t}`).then(a=>wl(a).items),global:(e="open")=>ge.get(`/tasks?state=${e}`).then(t=>wl(t).items),listPage:(e,{state:t,limit:a,offset:o})=>ge.get(`/projects/${e}/tasks?state=${t}&limit=${a}&offset=${o}`).then(l=>wl(l)),globalPage:({state:e,limit:t,offset:a})=>ge.get(`/tasks?state=${e}&limit=${t}&offset=${a}`).then(o=>wl(o)),add:(e,t)=>ge.post(`/projects/${e}/tasks`,t),done:(e,t)=>ge.post(`/projects/${e}/tasks/${t}/done`),drop:(e,t)=>ge.post(`/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>ge.post(`/projects/${e}/tasks/${t}/reopen`)},Er={list:e=>ge.get(`/projects/${e}/mcps`),check:e=>ge.get(`/projects/${e}/mcps/check`),add:(e,t,a)=>ge.post(`/projects/${e}/mcps?scope=${t}`,a),remove:(e,t,a="shared")=>ge.del(`/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${a}`),test:(e,t)=>ge.post(`/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>ge.get(`/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},Dc={list:(e,t={})=>ge.get(`/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,a={})=>ge.get(`/projects/${e}/vars/${encodeURIComponent(t)}${a.reveal?"?reveal=1":""}`),upsert:(e,t)=>ge.post(`/projects/${e}/vars`,t),remove:(e,t,a="project")=>ge.del(`/projects/${e}/vars/${encodeURIComponent(t)}?scope=${a}`)},Zg=e=>{const t=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&t.set(o,String(l));const a=t.toString();return a?`?${a}`:""},ff={global:(e={})=>ge.get(`/messages/global${Zg(e)}`),project:(e,t={})=>ge.get(`/projects/${e}/messages${Zg(t)}`),search:(e,t,a=50)=>ge.get(`/projects/${e}/messages/search${Zg({q:t,limit:a})}`)},PD={global:e=>ge.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:wl(t).items})),page:({engine:e,q:t,deep:a,limit:o,offset:l})=>{const c=new URLSearchParams({limit:String(o),offset:String(l)});return e&&c.set("engine",e),t?.trim()&&c.set("q",t.trim()),a&&c.set("deep","1"),ge.get(`/sessions?${c.toString()}`).then(u=>wl(u))}},LD={list:()=>ge.get("/tools")},An={channels:{list:()=>ge.get("/telegram/channels"),upsert:e=>ge.post("/telegram/channels",e),patch:(e,t)=>ge.patch(`/telegram/channels/${e}`,t),remove:e=>ge.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ge.get("/telegram/contacts"),patch:(e,t)=>ge.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>ge.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ge.get("/telegram/roles"),set:(e,t)=>ge.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>ge.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ge.get("/telegram/status"),start:()=>ge.post("/telegram/start"),stop:()=>ge.post("/telegram/stop"),send:e=>ge.post("/telegram/send",e)},pf={list:()=>ge.get("/engines"),models:e=>ge.post("/engines/models",e)},$l={reload:()=>ge.post("/admin/reload"),shutdown:()=>ge.post("/admin/shutdown"),config:{get:()=>ge.get("/admin/config"),patch:e=>ge.patch("/admin/config",e)},superAgent:()=>ge.get("/admin/super-agent"),logs:(e="errors",t=200)=>ge.get(`/admin/logs?file=${e}&limit=${t}`)},Fl={list:()=>ge.get("/pair/list"),revoke:e=>ge.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ge.post("/pair/init",{}),status:e=>ge.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ge.post("/pair/confirm",e)},Mj={get:()=>ge.get("/identity"),patch:e=>ge.patch("/identity",e)},xC={send:(e,t)=>ge.post(`/projects/${e}/super-agent/chat`,t),stream:(e,t,a,o)=>hC(`/projects/${e}/super-agent/chat/stream`,t,a,o),summarize:e=>ge.post("/super-agent/summarize",e)},Oj={dirs:e=>ge.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>ge.get(`/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},ID=["alloy","echo","fable","onyx","nova","shimmer"],BD=["Kore","Puck","Charon","Fenrir","Aoede"],UD=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],HD=["tts-1","tts-1-hd"],VD=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],qD=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],mf={piper:{name:"Piper",note:"Local, offline (CLI + .onnx model). No API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingual. Requires an API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd) or any OpenAI-compatible endpoint (set a base URL for a local server, e.g. QVox)."},gemini:{name:"Gemini",note:"Cloud (preview). Uses your Gemini key."},mock:{name:"Mock",note:"Silent test engine. Always available as a fallback.",local:!0}};async function $D(e){const t=qb(),a=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!a.ok){const l=await a.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${a.status}): ${l.slice(0,160)}`)}const o=await a.blob();return URL.createObjectURL(o)}const gf={providers:()=>ge.get("/tts/providers"),sttHardware:()=>ge.get("/transcribe/hardware"),sttModels:e=>ge.get(`/transcribe/models?backend=${e}`),say:e=>ge.post("/tts/say",e),turn:e=>ge.post("/voice/turn",e)},bC={manifest:()=>ge.get("/deck/manifest"),setWidget:(e,t)=>ge.patch(`/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>ge.post("/deck/exec",e)},lo=e=>`/projects/${e}/code/sessions`,Ia={sessions:{list:e=>ge.get(lo(e)).then(t=>t.sessions),get:(e,t)=>ge.get(`${lo(e)}/${t}`),create:(e,t={})=>ge.post(lo(e),t),update:(e,t,a)=>ge.patch(`${lo(e)}/${t}`,a),remove:(e,t)=>ge.del(`${lo(e)}/${t}`)},changes:(e,t)=>ge.get(`${lo(e)}/${t}/changes`),stream:(e,t,a,o,l)=>hC(`${lo(e)}/${t}/chat/stream`,a,o,l)},Ml={list:e=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,a=[])=>ge.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:a}),remove:(e,t)=>ge.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,a)=>ge.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:a}),rename:(e,t,a)=>ge.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:a})},fc={list:e=>ge.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>ge.get("/skills/inspector"),updateInspector:e=>ge.put("/skills/inspector",e),index:(e={})=>ge.post("/skills/index",e),inspect:(e,t)=>ge.post("/skills/inspect",{prompt:e,project_path:t})};function Xc(){const{data:e,error:t,isLoading:a,mutate:o}=et("/projects",()=>ls.list(),{refreshInterval:Mf.projects});return{projects:(e||[]).slice().sort((c,u)=>{const p=Number(c.id),m=Number(u.id);return p===0&&m!==0?-1:m===0&&p!==0?1:p-m}),error:t,isLoading:a,mutate:o}}function Fb(e){const{projects:t,isLoading:a,mutate:o}=Xc();return{project:t.find(c=>String(c.id)===e)??null,isLoading:a,mutate:o}}function Gb(){const{data:e,error:t,isLoading:a,mutate:o}=et("/identity",()=>Mj.get());return{identity:e||{},error:t,isLoading:a,mutate:o,save:async c=>{const u=await Mj.patch(c);return await o(u,{revalidate:!1}),u}}}function rp(){const{identity:e}=Gb();return e?.agent_name?.trim()||"APX"}function FD(){return[{id:"desktop",label:f("nav.modules.desktop"),href:"/m/desktop",icon:Ux},{id:"code",label:f("nav.modules.code"),href:"/m/code",icon:Ga}]}function GD(e,t,a){const[o,l]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!a)return;const u=()=>{const m=c.clientHeight;if(!m)return;const g=parseFloat(getComputedStyle(c).rowGap)||12,b=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+g,k=Math.max(0,Math.floor((m+g)/b))-1;l(k>=t?t:Math.max(0,k-1))};u();const p=new ResizeObserver(u);return p.observe(c),()=>p.disconnect()},[e,t,a]),a?Math.min(o,t):t}function zj({projects:e,label:t,sublabel:a,icon:o,tooltip:l,header:c,active:u,testId:p,onSelect:m,isActive:g}){return r.jsxs(eC,{children:[r.jsxs(tC,{"data-testid":p,title:l,"aria-label":l,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:ze("flex size-10 items-center justify-center rounded-xl text-xs font-bold transition-all","bg-muted/40 text-muted-fg hover:bg-accent hover:text-foreground",u&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:o??t}),a&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:a})]}),r.jsxs(nC,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[r.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:c}),e.map(h=>{const b=h.name||h.path.split("/").pop()||String(h.id),v=`/p/${h.id}`,{initials:k,idleClass:N}=J4(b);return r.jsxs(Qz,{"data-testid":`project-menu-item-${h.id}`,onClick:()=>m(v),className:ze(g(v)&&"bg-accent/60 text-foreground"),children:[r.jsx("span",{className:ze("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",N),children:k}),r.jsx("span",{className:"truncate",children:b})]},h.id)})]})]})}function YD({onSelect:e,onOpenRoby:t,onOpenAddProject:a}){const{projects:o,isLoading:l}=Xc(),c=Qn(),u=FD(),p=rp(),m=x.useRef(null),{collapsed:g,toggle:h}=Ub(Tn.sidebarCollapsed+".projects"),b=C=>c.pathname===C||c.pathname.startsWith(`${C}/`),v=o.find(C=>String(C.id)==="0"),k=o.filter(C=>String(C.id)!=="0").sort((C,E)=>Number(E.id)-Number(C.id)),N=GD(m,k.length,!g&&k.length>0),w=k.slice(0,N),y=k.slice(N),S=y.some(C=>b(`/p/${C.id}`));return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[r.jsx(Ye,{content:f("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(t3,{size:36})})}),l&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),v&&r.jsx(bl,{label:f("base.title"),testId:"project-avatar-0",title:f("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:f("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),u.map(C=>r.jsx(bl,{label:C.label,testId:`module-avatar-${C.id}`,title:C.label,active:b(C.href),icon:r.jsx(C.icon,{size:18}),onClick:()=>e(C.href)},C.id)),r.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),r.jsx(Ye,{content:f(g?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:r.jsx("button",{type:"button",onClick:h,"data-testid":"nav-toggle-projects","aria-label":f(g?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!g,className:"flex h-5 w-8 cursor-pointer items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(Za,{className:ze("size-3.5 transition-transform",g&&"-rotate-90")})})})]}),r.jsxs("div",{ref:m,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden",children:[k.length>0&&g&&r.jsx(zj,{projects:k,icon:r.jsx(kM,{size:18}),sublabel:String(k.length),tooltip:f("nav.all_projects"),header:f("nav.all_projects"),active:k.some(C=>b(`/p/${C.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),k.length>0&&!g&&r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:r.jsx(bl,{label:"Ag",active:!1,onClick:()=>{}})}),w.map(C=>{const E=C.name||C.path.split("/").pop()||String(C.id),R=`/p/${C.id}`;return r.jsx("div",{"data-rail-item":!0,className:"w-full",children:r.jsx(bl,{label:E,testId:`project-avatar-${C.id}`,title:`${E} — ${C.path}`,active:b(R),onClick:()=>e(R)})},C.id)}),y.length>0&&r.jsx(zj,{projects:y,label:`+${y.length}`,tooltip:f("nav.more_projects",{count:y.length}),header:f("nav.more_projects",{count:y.length}),active:S,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),r.jsx(bl,{label:f("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:r.jsx(tn,{size:18}),active:!1,onClick:()=>a?a():e("/?action=add-project"),title:f("nav.add_project")})]})]}),r.jsx(bl,{label:f("nav.settings"),isSettings:!0,testId:"nav-settings",icon:r.jsx(Rc,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:f("nav.settings")}),r.jsx(Ye,{content:f("settings_ui.documentation"),side:"right",children:r.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":f("settings_ui.documentation"),className:"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(nM,{size:18})})}),r.jsx(Ye,{content:f("superagent.talk",{persona:p}),side:"right",children:r.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":f("superagent.talk",{persona:p}),className:"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(un,{size:18})})})]})}function _C(e){switch(e){case"personal":return f("settings_ui.kind_personal");case"company":return f("settings_ui.kind_company");case"app":return f("settings_ui.kind_app");case"software":return f("settings_ui.kind_software");case"default":return f("settings_ui.kind_default");case"other":return f("settings_ui.kind_other");default:return f("nav.project")}}function Ke({title:e,description:t,action:a,className:o,children:l,fullHeight:c}){return r.jsxs("section",{className:ze("rounded-xl border border-border bg-card p-5",c&&"flex h-full min-h-0 flex-col",o),children:[r.jsxs("header",{className:ze("mb-4 flex items-start justify-between gap-4",c&&"shrink-0"),children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),a]}),r.jsx("div",{className:ze(c&&"flex min-h-0 flex-1 flex-col"),children:l})]})}function Dj({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 Qc({ok:e}){return r.jsx("span",{className:ze("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const KD=x.forwardRef(function(t,a){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:p=!0,style:m,...g}=t,{getButtonProps:h,buttonRef:b}=Hr({disabled:c,focusableWhenDisabled:u,native:p});return Nt("button",t,{state:{disabled:c},ref:[a,b],props:[g,h]})}),Pj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lj=Tc,Yb=(e,t)=>a=>{var o;if(t?.variants==null)return Lj(e,a?.class,a?.className);const{variants:l,defaultVariants:c}=t,u=Object.keys(l).map(g=>{const h=a?.[g],b=c?.[g];if(h===null)return null;const v=Pj(h)||Pj(b);return l[g][v]}),p=a&&Object.entries(a).reduce((g,h)=>{let[b,v]=h;return v===void 0||(g[b]=v),g},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((g,h)=>{let{class:b,className:v,...k}=h;return Object.entries(k).every(N=>{let[w,y]=N;return Array.isArray(y)?y.includes({...c,...p}[w]):{...c,...p}[w]===y})?[...g,b,v]:g},[]);return Lj(e,u,m,a?.class,a?.className)},XD=Yb("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 Qa({className:e,variant:t="default",size:a="default",...o}){return r.jsx(KD,{"data-slot":"button",className:St(XD({variant:t,size:a,className:e})),...o})}let Ij=(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 QD={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},pc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},WD={disabled:!1,...pc},Kb={valid(e){return e===null?null:e?{[Ij.valid]:""}:{[Ij.invalid]:""}}},ZD={invalid:void 0,name:void 0,validityData:{state:QD,errors:[],error:"",value:"",initialValue:null},setValidityData:En,disabled:void 0,touched:pc.touched,setTouched:En,dirty:pc.dirty,setDirty:En,filled:pc.filled,setFilled:En,focused:pc.focused,setFocused:En,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:WD,markedDirtyRef:{current:!1},registerFieldControl:En,validation:{getValidationProps:(e,t=qt)=>t,inputRef:{current:null},registerInput:En,commit:async()=>{},change:En}},JD=x.createContext(ZD);function Wc(e=!0){const t=x.useContext(JD);if(t.setValidityData===En&&!e)throw new Error(nn(28));return t}const eP=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:En,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Xb(){return x.useContext(eP)}const tP=x.createContext({controlId:void 0,registerControlId:En,labelId:void 0,setLabelId:En,messageIds:[],setMessageIds:En,getDescriptionProps:e=>e});function op(){return x.useContext(tP)}function nP(e,t,a,o=!0,l){const[c,u]=x.useState(),p=Ys(l?`${l}-label`:void 0),m=e??t??c;return De(()=>{const g=e||t||!o?void 0:sP(a.current,p);c!==g&&u(g)}),m}function sP(e,t){const a=aP(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function aP(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const l=e.nextElementSibling;if(l&&l.htmlFor===a)return l}const o=e.labels;return o&&o[0]}function lp(e={}){const{id:t,implicit:a=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=op(),u=Ys(t),p=a?l:void 0,m=Xn(()=>Symbol("labelable-control")),g=x.useRef(!1),h=x.useRef(t!=null),b=Ue(()=>{!g.current||c===En||(g.current=!1,c(m.current,void 0))});return De(()=>{if(c===En)return;let v;if(a){const k=o?.current;gt(k)&&k.closest("label")!=null?v=t??null:v=p??u}else if(t!=null)h.current=!0,v=t;else if(h.current)v=u;else{b();return}if(v===void 0){b();return}g.current=!0,c(m.current,v)},[t,o,p,c,a,u,m,b]),x.useEffect(()=>b,[b]),l??u}function Qb(e,t,a,o,l=!0,c){const{registerFieldControl:u}=Wc(),p=x.useRef(null);p.current||(p.current=Symbol()),De(()=>{const m=p.current;return!m||!l?void 0:(u(m,{controlRef:e,getValue:o,id:t,name:c,value:a}),()=>{u(m,void 0)})},[e,l,o,t,c,u,a])}const rP=x.forwardRef(function(t,a){const{render:o,className:l,id:c,name:u,value:p,disabled:m=!1,onValueChange:g,defaultValue:h,autoFocus:b=!1,style:v,...k}=t,{state:N,name:w,disabled:y,setTouched:S,setDirty:C,validityData:E,setFocused:R,setFilled:A,validationMode:T,validation:M}=Wc(),{clearErrors:z}=Xb(),I=y||m,P=w??u,H={...N,disabled:I},{labelId:D}=op(),B=lp({id:c});De(()=>{const X=p!=null;M.inputRef.current?.value||X&&p!==""?A(!0):X&&p===""&&A(!1)},[M.inputRef,A,p]);const V=x.useRef(null);De(()=>{b&&V.current===qn(mt(V.current))&&R(!0)},[b,R]);const[$]=Vl({controlled:p,default:h,name:"FieldControl",state:"value"}),q=p!==void 0,Y=q?$:void 0,K=Ue(()=>M.inputRef.current?.value);return Qb(M.inputRef,B,Y,K,!I,u),Nt("input",t,{ref:[a,V],state:H,props:[{id:B,disabled:I,name:P,ref:M.inputRef,"aria-labelledby":D,autoFocus:b,...q?{value:Y}:{defaultValue:h},onChange(X){const L=X.currentTarget.value;g?.(L,nt(fa,X.nativeEvent)),C(L!==E.initialValue),A(L!==""),X.nativeEvent.defaultPrevented||(z(P),M.change(L))},onFocus(){R(!0)},onBlur(X){S(!0),R(!1),T==="onBlur"&&M.commit(X.currentTarget.value)},onKeyDown(X){X.currentTarget.tagName==="INPUT"&&X.key==="Enter"&&(S(!0),M.commit(X.currentTarget.value))}},k,X=>M.getValidationProps(I,X)],stateAttributesMapping:Kb})}),oP=x.forwardRef(function(t,a){return r.jsx(rP,{ref:a,...t})});function lP({className:e,type:t,...a}){return r.jsx(oP,{type:t,"data-slot":"input",className:St("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),...a})}function iP({className:e,...t}){return r.jsx("textarea",{"data-slot":"textarea",className:St("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),...t})}function cP(e){return Nt(e.defaultTagName??"div",e,e)}const uP=Yb("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 dP({className:e,variant:t="default",render:a,...o}){return cP({defaultTagName:"span",props:Fn({className:St(uP({variant:t}),e)},o),render:a,state:{slot:"badge",variant:t}})}const vC=x.createContext(void 0);function fP(){const e=x.useContext(vC);if(e===void 0)throw new Error(nn(63));return e}let Bj=(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 yC={...Kb,checked(e){return e?{[Bj.checked]:""}:{[Bj.unchecked]:""}}},pP=x.forwardRef(function(t,a){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":u,form:p,id:m,inputRef:g,name:h,nativeButton:b=!1,onCheckedChange:v,readOnly:k=!1,required:N=!1,disabled:w=!1,render:y,uncheckedValue:S,value:C,style:E,...R}=t,{clearErrors:A}=Xb(),{state:T,setTouched:M,setDirty:z,validityData:I,setFilled:P,setFocused:H,validationMode:D,disabled:B,name:V,validation:$}=Wc(),{labelId:q}=op(),Y=B||w,K=V??h,F=x.useRef(null),X=Ka(F,g,$.inputRef),L=x.useRef(null),G=Ys(),Z=lp({id:m,implicit:!1,controlRef:L}),ee=b?void 0:Z,[de,fe]=Vl({controlled:o,default:!!c,name:"Switch",state:"checked"});Qb(L,G,de,void 0,!Y,h),De(()=>{F.current&&P(F.current.checked)},[F,P]),Lb(de,()=>{A(K),z(de!==I.initialValue),P(de),$.change(de)});const{getButtonProps:ae,buttonRef:oe}=Hr({disabled:Y,native:b}),me=nP(u,q,F,!b,ee),Te={id:b?Z:G,role:"switch","aria-checked":de,"aria-readonly":k||void 0,"aria-required":N||void 0,"aria-labelledby":me,onFocus(){Y||H(!0)},onBlur(){const je=F.current;!je||Y||(M(!0),H(!1),D==="onBlur"&&$.commit(je.checked))},onClick(je){if(k||Y)return;je.preventDefault();const Be=F.current;Be&&Be.dispatchEvent(new($t(Be)).PointerEvent("click",{bubbles:!0,shiftKey:je.shiftKey,ctrlKey:je.ctrlKey,altKey:je.altKey,metaKey:je.metaKey}))}},ie=Fn({checked:de,disabled:Y,form:p,id:ee,name:K,required:N,style:K?_S:ab,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:X,onChange(je){if(je.nativeEvent.defaultPrevented)return;if(k){je.preventDefault();return}const Be=je.currentTarget.checked,Ve=nt(fa,je.nativeEvent);v?.(Be,Ve),!Ve.isCanceled&&fe(Be)},onFocus(){L.current?.focus()}},je=>$.getValidationProps(Y,je),C!==void 0?{value:C}:qt),pe=x.useMemo(()=>({...T,checked:de,disabled:Y,readOnly:k,required:N}),[T,de,Y,k,N]),Se=Nt("span",t,{state:pe,ref:[a,L,oe],props:[Te,R,ae,je=>$.getValidationProps(Y,je)],stateAttributesMapping:yC});return r.jsxs(vC.Provider,{value:pe,children:[Se,!de&&K&&S!==void 0&&r.jsx("input",{type:"hidden",form:p,name:K,value:S,disabled:Y}),r.jsx("input",{...ie,suppressHydrationWarning:!0})]})}),mP=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=fP();return Nt("span",t,{state:p,ref:a,stateAttributesMapping:yC,props:u})});function gP({className:e,size:t="default",...a}){return r.jsx(pP,{"data-slot":"switch","data-size":t,className:St("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),...a,children:r.jsx(mP,{"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 hP({className:e,...t}){return r.jsx(Tf,{role:"status","aria-label":"Loading",className:St("size-4 animate-spin",e),...t})}const jC=x.createContext(!1),wC=x.createContext(void 0);function To(e){const t=x.useContext(wC);if(e===!1&&t===void 0)throw new Error(nn(27));return t}const xP={...Ro,...Ja},kC=x.forwardRef(function(t,a){const{render:o,className:l,style:c,forceRender:u=!1,...p}=t,{store:m}=To(),g=m.useState("open"),h=m.useState("nested"),b=m.useState("mounted"),v=m.useState("transitionStatus");return Nt("div",t,{state:{open:g,transitionStatus:v},ref:[m.context.backdropRef,a],stateAttributesMapping:xP,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:u||!h})}),ip=x.forwardRef(function(t,a){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,...m}=t,{store:g}=To(),h=g.useState("open"),{getButtonProps:b,buttonRef:v}=Hr({disabled:u,native:p}),k={disabled:u};function N(w){h&&g.setOpen(!1,nt(n5,w.nativeEvent))}return Nt("button",t,{state:k,ref:[a,v],props:[{onClick:N},m,b]})}),SC=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=To(),g=Ys(u);return m.useSyncedValueWithCleanup("descriptionElementId",g),Nt("p",t,{ref:a,props:[{id:g},p]})});let bP=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),_P=(function(e){return e[e.open=po.open]="open",e[e.closed=po.closed]="closed",e[e.startingStyle=po.startingStyle]="startingStyle",e[e.endingStyle=po.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const CC=x.createContext(void 0);function vP(){const e=x.useContext(CC);if(e===void 0)throw new Error(nn(26));return e}const yP={...Ro,...Ja,nestedDialogOpen(e){return e?{[_P.nestedDialogOpen]:""}:null}},NC=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,initialFocus:p,...m}=t,{store:g}=To(),h=g.useState("descriptionElementId"),b=g.useState("disablePointerDismissal"),v=g.useState("floatingRootContext"),k=g.useState("popupProps"),N=g.useState("modal"),w=g.useState("mounted"),y=g.useState("nested"),S=g.useState("nestedOpenDialogCount"),C=g.useState("open"),E=g.useState("openMethod"),R=g.useState("titleElementId"),A=g.useState("transitionStatus"),T=g.useState("role"),M=v.useState("floatingId"),z=m.id??M;vP(),ga({open:C,ref:g.context.popupRef,onComplete(){C&&g.context.onOpenChangeComplete?.(!0)}});const I=p===void 0?l4(g.context.popupRef):p,P=S>0,H=g.useStateSetter("popupElement"),B=Nt("div",t,{state:{open:C,nested:y,transitionStatus:A,nestedDialogOpen:P},props:[k,{id:z,"aria-labelledby":R??void 0,"aria-describedby":h??void 0,role:T,...Kf,hidden:!w,onKeyDown(V){np.has(V.key)&&V.stopPropagation()},style:{[bP.nestedDialogs]:S}},m],ref:[a,g.context.popupRef,H],stateAttributesMapping:yP});return r.jsx(hb,{context:v,openInteractionType:E,disabled:!w,closeOnFocusOut:!b,initialFocus:I,returnFocus:u,modal:N!==!1,restoreFocus:"popup",children:B})}),EC=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=To(),u=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return u||o?r.jsx(CC.Provider,{value:o,children:r.jsxs(pb,{ref:a,...l,children:[u&&p===!0&&r.jsx(Pb,{ref:c.context.internalBackdropRef,inert:Zf(!m)}),t.children]})}):null});function jP(e){const{store:t,actionsRef:a}=e,o=t.useState("open");u4(t,o),vb(t);const{forceUnmount:l}=yb(o,t),c=x.useCallback(()=>{t.setOpen(!1,nt(nb))},[t]);x.useImperativeHandle(a,()=>({unmount:l,close:c}),[l,c])}function wP({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),l=e.useState("disablePointerDismissal"),c=e.useState("modal"),u=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,g]=x.useState(0),[h,b]=x.useState(0),v=m===0,k=$f(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0||"touches"in S&&S.touches.length!==1)return!1;const C=Un(S);return v&&!l?c&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===C||e.context.backdropRef.current===C||Qe(C,u)&&!C?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:v});$2(o&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(S,C)=>{g(S),b(C)}),e.useContextCallback("onNestedDialogClose",()=>{g(0),b(0)}),x.useEffect(()=>(t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(m+1,h+(a?1:0)),t?.onNestedDialogClose&&!o&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&o&&t.onNestedDialogClose()}),[a,o,m,h,t]);const N=k.reference??qt,w=k.trigger??qt,y=k.floating??qt;return jb(e,{activeTriggerProps:N,inactiveTriggerProps:w,popupProps:y,nestedOpenDialogCount:m,nestedOpenDrawerCount:h}),null}const kP={...Sb,modal:Ae(e=>e.modal),nested:Ae(e=>e.nested),nestedOpenDialogCount:Ae(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Ae(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Ae(e=>e.disablePointerDismissal),openMethod:Ae(e=>e.openMethod),descriptionElementId:Ae(e=>e.descriptionElementId),titleElementId:Ae(e=>e.titleElementId),viewportElement:Ae(e=>e.viewportElement),role:Ae(e=>e.role)};class Wb extends Gf{constructor(t,a,o=!1){const l=new Fc,c=SP(t);c.floatingRootContext=u2(l,a,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},kP)}setOpen=(t,a)=>{if(a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,a);const o={open:t};_b(o,t,a.trigger),this.update(o)};static useStore(t,a){return o2(t,(l,c)=>new Wb(a,l,c),!0).store}}function SP(e={}){return{...wb(),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 CP(e,t="dialog"){const{children:a,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:g,handle:h,triggerId:b,defaultTriggerId:v=null}=e,k=t==="drawer",N=t==="alert-dialog",w=N?!0:m,y=N||p,S=N?"alertdialog":"dialog",C=To(!0),R={modal:w,disablePointerDismissal:y,nested:!!C,role:S},A=Wb.useStore(h?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...R});bb(()=>{const H=o===void 0&&A.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;N?A.update(H?{...R,...H}:R):H&&A.update(H)}),A.useControlledProp("openProp",o),A.useControlledProp("triggerIdProp",b),A.useSyncedValues(R),A.useContextCallback("onOpenChange",c),A.useContextCallback("onOpenChangeComplete",u);const T=A.useState("open"),M=A.useState("mounted"),z=A.useState("payload");jP({store:A,actionsRef:g});const I=T||M,P=x.useMemo(()=>({store:A}),[A]);return r.jsx(jC.Provider,{value:!1,children:r.jsxs(wC.Provider,{value:P,children:[I&&r.jsx(wP,{store:A,parentContext:C?.store.context,isDrawer:k}),typeof a=="function"?a({payload:z}):a]})})}function RC(e){const t=x.useContext(jC)?"drawer":"dialog";return CP(e,t)}const TC=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=To(),g=Ys(u);return m.useSyncedValueWithCleanup("titleElementId",g),Nt("h2",t,{ref:a,props:[{id:g},p]})});function dx({...e}){return r.jsx(RC,{"data-slot":"dialog",...e})}function NP({...e}){return r.jsx(EC,{"data-slot":"dialog-portal",...e})}function EP({...e}){return r.jsx(ip,{"data-slot":"dialog-close",...e})}function RP({className:e,...t}){return r.jsx(kC,{"data-slot":"dialog-overlay",className:St("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),...t})}function fx({className:e,children:t,showCloseButton:a=!0,...o}){return r.jsxs(NP,{children:[r.jsx(RP,{}),r.jsxs(NC,{"data-slot":"dialog-content",className:St("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:[t,a&&r.jsxs(ip,{"data-slot":"dialog-close",render:r.jsx(Qa,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(Gs,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function px({className:e,...t}){return r.jsx("div",{"data-slot":"dialog-header",className:St("flex flex-col gap-2",e),...t})}function Uj({className:e,showCloseButton:t=!1,children:a,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:St("-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:[a,t&&r.jsx(ip,{render:r.jsx(Qa,{variant:"outline"}),children:"Close"})]})}function mx({className:e,...t}){return r.jsx(TC,{"data-slot":"dialog-title",className:St("font-heading text-base leading-none font-medium",e),...t})}function TP({className:e,...t}){return r.jsx(SC,{"data-slot":"dialog-description",className:St("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const AP={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},MP={sm:"sm",md:"default"};function ce({variant:e="secondary",size:t="md",loading:a,className:o,children:l,disabled:c,type:u="button",...p}){return r.jsxs(Qa,{type:u,variant:AP[e],size:MP[t],disabled:c||a,className:o,...p,children:[a?r.jsx(vs,{size:14}):null,l]})}function Ne(e){return r.jsx(lP,{...e})}function Mn(e){return r.jsx(iP,{...e})}function OP(e){return r.jsx("select",{...e,className:ze("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 le({label:e,hint:t,badge:a,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,a&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:a})]}),o,t&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Ft({checked:e,onChange:t,label:a,disabled:o}){return r.jsxs("label",{className:ze("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(gP,{checked:e,onCheckedChange:t,disabled:o}),a&&r.jsx("span",{className:"text-sm",children:a})]})}function Fe({children:e,tone:t="muted",className:a}){const o=t==="danger"?"destructive":t==="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(dP,{variant:o,className:ze("rounded-md",l[t],a),children:e})}function On({open:e,onClose:t,title:a,description:o,children:l,footer:c,size:u="md"}){const p={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return r.jsx(dx,{open:e,onOpenChange:m=>{m||t()},children:r.jsxs(fx,{className:ze("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[u]),children:[(a||o)&&r.jsxs(px,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a&&r.jsx(mx,{children:a}),o&&r.jsx(TP,{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 vs({size:e=14}){return r.jsx(hP,{style:{width:e,height:e}})}function xt({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 lt({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(vs,{})," ",e]})}const AC=x.createContext(null);let zP=1;function DP({children:e}){const[t,a]=x.useState([]),o=x.useCallback((c,u)=>{const p=zP++;a(m=>[...m,{id:p,kind:c,message:u}]),setTimeout(()=>{a(m=>m.filter(g=>g.id!==p))},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(AC.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:t.map(c=>r.jsx("div",{className:ze("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:ze("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 rt(){const e=x.useContext(AC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function MC(){const{data:e,error:t,isLoading:a}=et("/health",()=>DD.get(),{refreshInterval:Mf.health});return{health:e,error:t,isLoading:a,isUp:!t&&!!e}}function PP(){const{data:e,error:t,isLoading:a,mutate:o}=et("/engines",()=>pf.list());return{engines:e?.engines||[],error:t,isLoading:a,mutate:o}}function LP(){const{data:e,error:t,isLoading:a,mutate:o}=et("/telegram/status",()=>An.status(),{refreshInterval:Mf.telegramStatus});return{status:e,error:t,isLoading:a,mutate:o}}function Zb(){const{data:e,error:t,isLoading:a,mutate:o}=et("/telegram/channels",()=>An.channels.list());return{channels:e?.channels||[],error:t,isLoading:a,mutate:o}}function Jb(){const{data:e,error:t,isLoading:a,mutate:o}=et("/telegram/contacts",()=>An.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:a,mutate:o}}function is(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Ar(e,t="(no seteada)"){return is(e)?e:t}function jo(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function OC({channel:e,onClose:t,onSaved:a}){const o=rt(),[l,c]=x.useState(!1),[u,p]=x.useState({name:""});x.useEffect(()=>{p(e?{...e,bot_token:""}:{name:""})},[e?.name]);const m=async()=>{if(!u.name?.trim()){o.error(f("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===u.name?await An.channels.patch(e.name,u):await An.channels.upsert(u),o.success(f("telegram_channel_dialog.saved")),a()}catch(g){o.error(g.message)}finally{c(!1)}};return r.jsx(On,{open:!!e,onClose:t,title:e?.name?f("telegram_channel_dialog.edit_title",{name:e.name}):f("telegram_channel_dialog.new_title"),description:f("telegram_ui.channel_dialog_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:m,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("telegram_channel_dialog.name_label"),children:r.jsx(Ne,{value:u.name,onChange:g=>p({...u,name:g.target.value}),disabled:!!e?.name})}),r.jsx(le,{label:f("telegram_channel_dialog.token_label"),hint:e?.bot_token?Ar(e.bot_token):f("telegram_ui.bot_token_hint"),children:r.jsx(Ne,{type:"password",value:u.bot_token||"",onChange:g=>p({...u,bot_token:g.target.value}),placeholder:e?.bot_token?Ar(e.bot_token):""})}),r.jsx(le,{label:f("telegram_channel_dialog.chat_id"),children:r.jsx(Ne,{value:u.chat_id||"",onChange:g=>p({...u,chat_id:g.target.value})})}),r.jsx(le,{label:f("telegram_channel_dialog.project_label"),hint:f("telegram_channel_dialog.project_hint"),children:r.jsx(Ne,{value:u.project||"",onChange:g=>p({...u,project:g.target.value})})}),r.jsx(le,{label:f("telegram_channel_dialog.route_label"),hint:f("telegram_channel_dialog.route_hint"),children:r.jsx(Ne,{value:u.route_to_agent||"",onChange:g=>p({...u,route_to_agent:g.target.value})})}),r.jsx(le,{label:f("telegram_channel_dialog.owner_label"),hint:f("telegram_channel_dialog.owner_hint"),children:r.jsx(Ne,{value:u.owner_user_id!=null?String(u.owner_user_id):"",onChange:g=>{const h=g.target.value.trim();p({...u,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),r.jsx(Ft,{checked:!!u.respond_with_engine,onChange:g=>p({...u,respond_with_engine:g}),label:f("telegram_channel_dialog.respond_label")})]})})}function zC({channel:e,onClose:t}){const a=rt(),[o,l]=x.useState(f("admin.telegram_default_message")),[c,u]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){u(!0);try{await An.send({text:o,channel:e.name}),a.success(f("telegram_ui.message_sent")),t()}catch(m){a.error(m.message)}finally{u(!1)}}};return r.jsx(On,{open:!!e,onClose:t,title:e?f("telegram_send_dialog.title",{name:e.name}):"",description:e?f("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:c,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:p,loading:c,children:f("chat_ui.send")})]}),children:r.jsx(le,{label:f("telegram_ui.message_label"),children:r.jsx(Mn,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function DC({bare:e=!1}){const t=rt(),{contacts:a,roles:o,channelOwners:l,isLoading:c,mutate:u}=Jb(),p=new Set(l.filter(v=>v.owner_user_id!=null).map(v=>String(v.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),g=async(v,k)=>{try{await An.contacts.patch(v.user_id,{role:k}),t.success(f("telegram_ui.role_assigned",{name:v.name||v.user_id,role:k})),u()}catch(N){t.error(N.message)}},h=async v=>{if(confirm(f("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await An.contacts.remove(v.user_id),t.success(f("telegram_contacts.removed")),u()}catch(k){t.error(k.message)}},b=r.jsxs(r.Fragment,{children:[c&&r.jsx(lt,{}),!c&&a.length===0&&r.jsx(xt,{children:f("telegram_contacts.empty")}),a.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:a.map(v=>{const k=p.has(String(v.user_id)),N=k?"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]}),k&&r.jsx(Fe,{tone:"success",children:f("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ye,{content:f(k?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:r.jsx(OP,{value:N,disabled:k,onChange:w=>g(v,w.target.value),children:m.map(w=>r.jsx("option",{value:w,children:w},w))})}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>h(v),children:f("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:[f("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:IP(o[N])})]})]},String(v.user_id))})})]});return e?b:r.jsx(Ke,{title:f("telegram_contacts.title"),description:f("telegram_contacts.desc"),children:b})}function IP(e){return!e||e.tools===void 0?"":e.tools==="*"?f("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${f("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:f("telegram_contacts.tools_none"):""}function BP(){const e=Wn(),[t,a]=Cf(),o=rt(),{health:l,isUp:c}=MC(),{projects:u,isLoading:p,mutate:m}=Xc(),{engines:g,isLoading:h}=PP(),{status:b,mutate:v}=LP(),{channels:k,isLoading:N,mutate:w}=Zb(),[y,S]=x.useState(null),[C,E]=x.useState(null),R=async()=>{try{await $l.reload(),o.success(f("admin.reload_success"))}catch(z){o.error(z.message)}},A=async()=>{try{b?.enabled?(await An.stop(),o.info(f("admin.telegram_polling_stopped"))):(await An.start(),o.success(f("admin.telegram_polling_started"))),v()}catch(z){o.error(z.message)}},T=async z=>{if(confirm(f("telegram_channels.delete_confirm",{name:z})))try{await An.channels.remove(z),o.success(f("admin.telegram_channel_removed")),w()}catch(I){o.error(I.message)}},M=async(z,I)=>{if(confirm(f("admin.unregister_confirm",{label:I})))try{await ls.remove(z),o.success(f("project.unregistered")),m()}catch(P){o.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:f("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:f("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ye,{content:f("daemon.reload_hint"),children:r.jsxs(ce,{size:"sm",onClick:R,children:[f("common.reload")," config"]})}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>{const z=new URLSearchParams(t);z.set("action","add-project"),a(z)},children:[r.jsx(tn,{size:14})," ",f("nav.project")]})]})]}),r.jsx(Ke,{title:f("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Jg,{label:f("daemon.version"),value:l?.version||"—"}),r.jsx(Jg,{label:f("daemon.uptime"),value:l?`${l.uptime_s}s`:"—"}),r.jsx(Jg,{label:f("daemon.status"),value:f(c?"daemon.running":"daemon.down"),ok:c})]})}),r.jsxs(Ke,{title:f("admin.engines_title"),description:f("admin.engines_subtitle"),children:[h&&r.jsx(lt,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(z=>r.jsx(Fe,{tone:"info",children:z},z))})]}),r.jsxs(Ke,{title:f("admin.telegram_title"),description:f("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ft,{checked:!!b?.enabled,onChange:A,label:b?.enabled?f("admin.telegram_polling_on"):f("admin.telegram_polling_off")}),r.jsxs(ce,{size:"sm",onClick:()=>S({name:""}),children:[r.jsx(tn,{size:14})," ",f("admin.telegram_add_channel")]})]}),children:[N&&r.jsx(lt,{}),k.length===0&&r.jsx(xt,{children:f("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:k.map(z=>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:z.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[z.project&&r.jsxs(Fe,{tone:"success",children:["project = ",z.project]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>E(z),children:[r.jsx(Fs,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>S(z),children:f("common.edit")}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>T(z.name),children:f("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: ",z.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",z.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",z.respond_with_engine?f("admin.engine_badge"):f("admin.engine_badge_no")]})]})]},z.name))})]}),r.jsx(DC,{}),r.jsxs(Ke,{title:f("admin.projects_title"),description:f("admin.projects_subtitle"),children:[p&&r.jsx(lt,{}),r.jsx("ul",{className:"divide-y divide-border",children:u.map(z=>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:["#",z.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${z.id}`),children:[r.jsx("span",{className:"font-medium",children:z.name||z.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:z.path})]}),r.jsxs(Fe,{children:[z.agents??0," ",f("admin.agents_badge")]}),Number(z.id)!==0&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>M(String(z.id),z.name||z.path),children:f("admin.unregister")})]},z.id))})]}),r.jsx(OC,{channel:y,onClose:()=>S(null),onSaved:()=>{S(null),w()}}),r.jsx(zC,{channel:C,onClose:()=>E(null)})]})}function Jg({label:e,value:t,ok:a}){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:[a!==void 0&&r.jsx(Qc,{ok:a}),r.jsx("span",{children:t})]})]})}const PC=x.createContext(null),LC=x.createContext(null),IC=x.createContext(""),BC=x.createContext(null),UC=x.createContext(null),HC=x.createContext(null);function UP({children:e}){const[t,a]=x.useState(null),[o,l]=x.useState(""),[c,u]=x.useState(null);return r.jsx(LC.Provider,{value:a,children:r.jsx(PC.Provider,{value:t,children:r.jsx(BC.Provider,{value:l,children:r.jsx(IC.Provider,{value:o,children:r.jsx(HC.Provider,{value:u,children:r.jsx(UC.Provider,{value:c,children:e})})})})})})}function HP(){return x.useContext(PC)}function VP(e,t){const a=x.useContext(LC);x.useEffect(()=>(a?.({collapsed:e,toggle:t}),()=>a?.(null)),[e,t,a])}function qP(){return x.useContext(IC)}function $P(e){const t=x.useContext(BC);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function FP(){return x.useContext(UC)}function GP(e){const t=x.useContext(HC);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function VC({sections:e,active:t,onChange:a,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:u,testId:p,children:m}){return VP(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(oD,{sections:e,active:t,onChange:a,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:ze("flex-1 min-h-0 overflow-y-auto",u),"data-testid":p,children:m})]})]})}const Hj={happy:{eyes:["◕","◕"],mouth:"‿"},wave:{eyes:["◕","◕"],mouth:"▽",top:"·"},confused:{eyes:["◑","◐"],mouth:"o",top:"?"},sad:{eyes:["╥","╥"],mouth:"◠"},excited:{eyes:["★","★"],mouth:"▽",top:"✦"},sleeping:{eyes:["−","−"],mouth:"‿",top:"z z"}};function qC({mood:e="happy",className:t}){const a=Hj[e]??Hj.happy,[o,l]=a.eyes,c="text-emerald-700 dark:text-emerald-600/70";return r.jsxs("div",{"aria-hidden":!0,className:St("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[a.top&&r.jsx("div",{children:r.jsx("span",{className:c,children:` ${a.top}`})}),r.jsx("div",{children:" ▄███████▄"}),r.jsxs("div",{children:[" █ ",r.jsx("span",{className:c,children:"██"})," ",r.jsx("span",{className:c,children:"██"})," █"]}),r.jsx("div",{children:` █ ${o} ${l} █`}),r.jsx("div",{children:` █ ${a.mouth} █`}),r.jsx("div",{children:" ▀███████▀"})]})}function $C({mood:e="confused",title:t,titleClassName:a,message:o,action:l,className:c,testId:u}){return r.jsx("div",{className:St("grid h-full place-items-center p-8",c),"data-testid":u,children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(qC,{mood:e,className:"mb-6 text-sm"}),t!=null&&r.jsx("div",{className:St("font-mono font-semibold leading-none tracking-tight text-foreground",a),children:t}),o!=null&&r.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&r.jsx("div",{className:"mt-6",children:l})]})})}function Vj({pid:e}){const t=et(`/projects/${e}/tasks?state=open`,()=>Nr.list(e)),a=et(`/projects/${e}/routines`,()=>Cr.list(e)),o=et(`/projects/${e}/agents`,()=>rn.list(e)),l=et(`/projects/${e}/mcps`,()=>Er.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(ec,{title:f("project.overview.tasks_open"),value:t.data?.length??"…",href:`/p/${e}/tasks`,icon:Pl}),r.jsx(ec,{title:f("project.overview.routines"),value:a.data?.length??"…",href:`/p/${e}/routines`,icon:Dl}),r.jsx(ec,{title:f("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:un}),r.jsx(ec,{title:f("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:Hh}),r.jsx(ec,{title:f("project.overview.chat"),value:f("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Kd})]})}function ec({title:e,value:t,href:a,icon:o}){return r.jsxs(Ok,{to:a,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:t})]})]})}function YP(){const e=Wn(),{projects:t,isLoading:a}=Xc();return r.jsxs(Ke,{title:f("base.workspaces_title"),description:f("base.workspaces_desc"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(tn,{size:14})," ",f("base.workspaces_new")]}),children:[a&&r.jsx(lt,{}),!a&&t.length===0&&r.jsx(xt,{children:f("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(o=>{const l=String(o.id)==="0",c=l?f("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($k,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx(Fe,{tone:l?"success":"info",children:l?f("base.title"):_C(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const FC=x.createContext(null),GC=x.createContext(null);function ha(){const e=x.useContext(FC);if(e===null)throw new Error(nn(60));return e}function YC(){const e=x.useContext(GC);if(e===null)throw new Error(nn(61));return e}const KP=(e,t)=>Object.is(e,t);function wo(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function XP(e,t,a){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:wo(t,o,a))}function kc(e,t,a){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:wo(o,t,a))}function QP(e,t,a){return e.filter(o=>!wo(t,o,a))}function gx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function KC(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function WP(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(KC(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function XC(e,t){if(t&&e!=null)return t(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 gx(e)}function co(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?gx(e.value):gx(e)}function QC(e,t,a){function o(){return XC(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=KC(l)?l.flatMap(u=>u.items):l;if(e==null||typeof e!="object"){const u=c.find(p=>p.value===e);return u&&u.label!=null?u.label:o()}if("value"in e){const u=c.find(p=>p&&p.value===e.value);if(u&&u.label!=null)return u.label}}return o()}function ZP(e,t,a){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:QC(l,t,a)},c)),o),[])}const Je={id:Ae(e=>e.id),labelId:Ae(e=>e.labelId),modal:Ae(e=>e.modal),multiple:Ae(e=>e.multiple),items:Ae(e=>e.items),itemToStringLabel:Ae(e=>e.itemToStringLabel),itemToStringValue:Ae(e=>e.itemToStringValue),isItemEqualToValue:Ae(e=>e.isItemEqualToValue),value:Ae(e=>e.value),hasSelectedValue:Ae(e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:co(t,o)!==""}),hasNullItemLabel:Ae((e,t)=>t?WP(e.items):!1),open:Ae(e=>e.open),mounted:Ae(e=>e.mounted),forceMount:Ae(e=>e.forceMount),transitionStatus:Ae(e=>e.transitionStatus),openMethod:Ae(e=>e.openMethod),activeIndex:Ae(e=>e.activeIndex),selectedIndex:Ae(e=>e.selectedIndex),isActive:Ae((e,t)=>e.activeIndex===t),isSelected:Ae((e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>wo(t,l,a)):wo(t,o,a)}),isSelectedByFocus:Ae((e,t)=>e.selectedIndex===t),popupProps:Ae(e=>e.popupProps),triggerProps:Ae(e=>e.triggerProps),triggerElement:Ae(e=>e.triggerElement),positionerElement:Ae(e=>e.positionerElement),listElement:Ae(e=>e.listElement),popupSide:Ae(e=>e.popupSide),scrollUpArrowVisible:Ae(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ae(e=>e.scrollDownArrowVisible),hasScrollArrows:Ae(e=>e.hasScrollArrows)};function JP(e,t,a=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>a(o,t[l]))}function mc(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Hs=1;function e_(e,t){return Math.max(0,e-t)}function hf(e,t){if(t<=0)return 0;const a=mc(e,0,t),o=a,l=t-a,c=o<=Hs,u=l<=Hs;return c&&u?o<=l?0:t:c?0:u?t:a}function eL(e){const{id:t,value:a,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:u=!1,onOpenChange:p,name:m,form:g,autoComplete:h,disabled:b=!1,readOnly:v=!1,required:k=!1,modal:N=!0,actionsRef:w,inputRef:y,onOpenChangeComplete:S,items:C,multiple:E=!1,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T=KP,highlightItemOnHover:M=!0,children:z}=e,{clearErrors:I}=Xb(),{setDirty:P,setTouched:H,setFocused:D,validityData:B,setFilled:V,name:$,disabled:q,validation:Y,validationMode:K}=Wc(),F=lp({id:t}),X=q||b,L=$??m,[G,Z]=Vl({controlled:a,default:E?o??Ya:o,name:"Select",state:"value"}),[ee,de]=Vl({controlled:c,default:u,name:"Select",state:"open"}),fe=x.useRef([]),ae=x.useRef([]),oe=x.useRef(null),me=x.useRef(null),Te=x.useRef(0),ie=x.useRef(null),pe=x.useRef([]),Se=x.useRef(!1),je=x.useRef(null),Be=x.useRef(null),Ve=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=x.useRef(!1),{mounted:Ee,setMounted:ve,transitionStatus:Ce}=ti(ee),{openMethod:Pe,triggerProps:Le}=X2(ee),Ie=Xn(()=>new s2({id:F,labelId:void 0,modal:N,multiple:E,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,value:G,open:ee,mounted:Ee,transitionStatus:Ce,items:C,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,se=tt(Ie,Je.activeIndex),be=tt(Ie,Je.selectedIndex),$e=tt(Ie,Je.triggerElement),Re=tt(Ie,Je.positionerElement),Oe=Y4(Pe),We=Pe??Oe??null,at=x.useMemo(()=>E?"":co(G,A),[E,G,A]),yt=x.useMemo(()=>E&&Array.isArray(G)?G.map(ct=>co(ct,A)):co(G,A),[E,G,A]),_e=cn(Ie.state.triggerElement),Me=Ue(()=>yt);Qb(_e,F,G,Me,!X,m);const He=x.useRef(G),Xe=E?Array.isArray(G)&&G.length>0:G!=null&&co(G,A)!=="";De(()=>{G!==He.current&&Ie.set("forceMount",!0)},[Ie,G]),De(()=>{V(Xe)},[Xe,V]),De(function(){const zt=pe.current;let mn;if(E){const Sn=Array.isArray(G)?G:[];if(Sn.length===0)mn=null;else{const yn=Sn[Sn.length-1],Ht=kc(zt,yn,T);mn=Ht===-1?null:Ht}}else{const Sn=kc(zt,G,T);mn=Sn===-1?null:Sn}mn===null&&(Be.current=null),!ee&&Ie.set("selectedIndex",mn)},[Xe,E,ee,G,pe,T,Ie,Be]);function ot(ct){const zt=B.initialValue;return Array.isArray(ct)&&Array.isArray(zt)?!JP(ct,zt,(mn,Sn)=>wo(mn,Sn,T)):ct!==zt}Lb(G,()=>{I(L),P(ot(G)),Y.change(G)});const sn=Ue((ct,zt)=>{p?.(ct,zt),!zt.isCanceled&&(de(ct),!ct&&(zt.reason===bo||zt.reason===Hf)&&(H(!0),D(!1),K==="onBlur"&&Y.commit(G)))}),dn=Ue(()=>{ve(!1),Ie.update({activeIndex:null,openMethod:null}),S?.(!1)});ga({enabled:!w,open:ee,ref:oe,onComplete(){ee||dn()}}),x.useImperativeHandle(w,()=>({unmount:dn}),[dn]);const pt=Ue((ct,zt)=>{l?.(ct,zt),!zt.isCanceled&&Z(ct)}),Et=Ue(()=>{const ct=Ie.state.listElement||oe.current;if(!ct)return;const zt=e_(ct.scrollHeight,ct.clientHeight),mn=hf(ct.scrollTop,zt),Sn=mn>0,yn=mn<zt;Ie.state.scrollUpArrowVisible!==Sn&&Ie.set("scrollUpArrowVisible",Sn),Ie.state.scrollDownArrowVisible!==yn&&Ie.set("scrollDownArrowVisible",yn)}),an=f2({open:ee,onOpenChange:sn,elements:{reference:$e,floating:Re}}),Wt=GS(an,{enabled:!v&&!X,event:"mousedown"}),Zt=$f(an),Gt=x2(an,{enabled:!v&&!X,listRef:fe,activeIndex:se,selectedIndex:be,disabledIndices:Ya,onNavigate(ct){ct===null&&!ee||Ie.set("activeIndex",ct)},focusItemOnHover:M}),fn=b2(an,{enabled:!v&&!X&&(ee||!E),listRef:ae,activeIndex:se,selectedIndex:be,disabledIndices:ct=>J2(fe.current[ct]),onMatch(ct){ee?Ie.set("activeIndex",ct):pt(pe.current[ct],nt("none"))},onTyping(ct){Se.current=ct}}),es=x.useMemo(()=>{const ct=Fn(fn.reference,Gt.reference,Zt.reference,Wt.reference,Le);return F&&(ct.id=F),ct},[Wt.reference,fn.reference,Gt.reference,Zt.reference,Le,F]),ds=x.useMemo(()=>Fn(Kf,fn.floating,Gt.floating,Zt.floating),[fn.floating,Gt.floating,Zt.floating]),js=Gt.item??qt;bb(()=>{Ie.update({popupProps:ds,triggerProps:es})}),De(()=>{Ie.update({id:F,modal:N,multiple:E,value:G,open:ee,mounted:Ee,transitionStatus:Ce,popupProps:ds,triggerProps:es,items:C,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,openMethod:We})},[Ie,F,N,E,G,ee,Ee,Ce,ds,es,C,R,A,T,We]);const pn=x.useMemo(()=>({store:Ie,name:L,required:k,disabled:X,readOnly:v,multiple:E,highlightItemOnHover:M,setValue:pt,setOpen:sn,listRef:fe,popupRef:oe,scrollHandlerRef:me,handleScrollArrowVisibility:Et,scrollArrowsMountedCountRef:Te,itemProps:js,valueRef:ie,valuesRef:pe,labelsRef:ae,typingRef:Se,selectionRef:Ve,firstItemTextRef:je,selectedItemTextRef:Be,validation:Y,onOpenChangeComplete:S,alignItemWithTriggerActiveRef:we,initialValueRef:He}),[Ie,L,k,X,v,E,M,pt,sn,js,Y,S,Et]),ws=Ka(y,Y.inputRef),xa=E&&Array.isArray(G)&&G.length>0,Ls=E?void 0:L,ba=x.useMemo(()=>!E||!Array.isArray(G)||!L?null:G.map(ct=>{const zt=co(ct,A);return r.jsx("input",{type:"hidden",form:g,name:L,value:zt,disabled:X},zt)}),[E,G,g,L,A,X]);return r.jsx(FC.Provider,{value:pn,children:r.jsxs(GC.Provider,{value:an,children:[z,r.jsx("input",{...Y.getValidationProps(X,{onFocus(){Ie.state.triggerElement?.focus({focusVisible:!0})},onChange(ct){if(ct.nativeEvent.defaultPrevented||X||v)return;const zt=ct.currentTarget.value,mn=nt(fa,ct.nativeEvent);function Sn(){if(E)return;const yn=zt.toLowerCase();let Ht=pe.current.findIndex(Ks=>co(Ks,A).toLowerCase()===yn||XC(Ks,R).toLowerCase()===yn);Ht===-1&&(Ht=pe.current.findIndex((Ks,ni)=>{const Zc=ae.current[ni];return Zc!=null&&Zc.toLowerCase()===yn}));const zn=Ht===-1?void 0:pe.current[Ht];zn!=null&&pt(zn,mn)}Ie.set("forceMount",!0),queueMicrotask(Sn)}}),id:F&&Ls==null?`${F}-hidden-input`:void 0,form:g,name:Ls,autoComplete:h,value:at,disabled:X,required:k&&!xa,readOnly:v,ref:ws,style:L?_S:ab,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ba]})})}function tL(e,t){return e??t}const kd=2,nL=400,sL={...nx,...Kb,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},aL=x.forwardRef(function(t,a){const{render:o,className:l,id:c,disabled:u=!1,nativeButton:p=!0,style:m,...g}=t,{setTouched:h,setFocused:b,validationMode:v,state:k,disabled:N}=Wc(),{labelId:w}=op(),{store:y,setOpen:S,selectionRef:C,validation:E,readOnly:R,required:A,alignItemWithTriggerActiveRef:T,disabled:M}=ha(),z=N||M||u,I=tt(y,Je.open),P=tt(y,Je.mounted),H=tt(y,Je.value),D=tt(y,Je.triggerProps),B=tt(y,Je.positionerElement),V=tt(y,Je.listElement),$=tt(y,Je.popupSide),q=tt(y,Je.id),Y=tt(y,Je.labelId),K=tt(y,Je.hasSelectedValue),F=P&&B?$:null,X=c??q,L=tL(w,Y);lp({id:X});const G=cn(B),Z=x.useRef(null),{getButtonProps:ee,buttonRef:de}=Hr({disabled:z,native:p}),fe=Ue(Se=>{y.set("triggerElement",Se)}),ae=kn(),oe=kn(),me=kn();x.useEffect(()=>{if(I)return me.start(nL,()=>{C.current.allowUnselectedMouseUp=!0,C.current.allowSelectedMouseUp=!0}),()=>{me.clear()};C.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},oe.clear()},[I,C,oe,me]);const Te=Fn(D,{id:X,role:"combobox","aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?V?.id??Wd(B)?.id:void 0,"aria-labelledby":L,"aria-readonly":R||void 0,"aria-required":A||void 0,tabIndex:z?-1:0,onFocus(Se){b(!0),I&&T.current&&S(!1,nt(fa,Se.nativeEvent)),ae.start(0,()=>{y.set("forceMount",!0)})},onBlur(Se){Qe(B,Se.relatedTarget)||(h(!0),b(!1),v==="onBlur"&&E.commit(H))},onMouseDown(Se){if(I)return;const je=mt(Se.currentTarget);function Be(Ve){if(!Z.current)return;const we=Ve.target;if(Qe(Z.current,we)||Qe(G.current,we))return;const Ee=Q2(Z.current);Ve.clientX>=Ee.left-kd&&Ve.clientX<=Ee.right+kd&&Ve.clientY>=Ee.top-kd&&Ve.clientY<=Ee.bottom+kd||S(!1,nt(pS,Ve))}oe.start(0,()=>{je.addEventListener("mouseup",Be,{once:!0})})}},g,ee),ie=E.getValidationProps(z,Te);ie.role="combobox";const pe={...k,open:I,disabled:z,value:H,readOnly:R,popupSide:F,placeholder:!K};return Nt("button",t,{ref:[a,Z,de,fe],state:pe,stateAttributesMapping:sL,props:ie})}),rL={value:()=>null},oL=x.forwardRef(function(t,a){const{className:o,render:l,children:c,placeholder:u,style:p,...m}=t,{store:g,valueRef:h}=ha(),b=tt(g,Je.value),v=tt(g,Je.items),k=tt(g,Je.itemToStringLabel),N=tt(g,Je.hasSelectedValue),w=!N&&u!=null&&c==null,y=tt(g,Je.hasNullItemLabel,w),S={value:b,placeholder:!N};let C=null;return typeof c=="function"?C=c(b):c!=null?C=c:!N&&u!=null&&!y?C=u:Array.isArray(b)?C=ZP(b,v,k):C=QC(b,v,k),Nt("span",t,{state:S,ref:[a,h],props:[{children:C},m],stateAttributesMapping:rL})}),lL=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,{store:p}=ha(),g={open:tt(p,Je.open)};return Nt("span",t,{state:g,ref:a,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:v2})}),iL=x.createContext(void 0),cL=x.forwardRef(function(t,a){const{store:o}=ha(),l=tt(o,Je.mounted),c=tt(o,Je.forceMount);return l||c?r.jsx(iL.Provider,{value:!0,children:r.jsx(pb,{ref:a,...t})}):null}),WC=x.createContext(void 0);function t_(){const e=x.useContext(WC);if(!e)throw new Error(nn(59));return e}function xf(e,t){e&&Object.assign(e.style,t)}const ZC={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},uL={position:"fixed"},dL=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p="bottom",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:k=5,sticky:N=!1,disableAnchorTracking:w,alignItemWithTrigger:y=!0,collisionAvoidance:S=LS,style:C,...E}=t,{store:R,listRef:A,labelsRef:T,alignItemWithTriggerActiveRef:M,selectedItemTextRef:z,valuesRef:I,initialValueRef:P,popupRef:H,setValue:D}=ha(),B=YC(),V=tt(R,Je.open),$=tt(R,Je.mounted),q=tt(R,Je.modal),Y=tt(R,Je.value),K=tt(R,Je.openMethod),F=tt(R,Je.positionerElement),X=tt(R,Je.triggerElement),L=tt(R,Je.isItemEqualToValue),G=tt(R,Je.transitionStatus),Z=x.useRef(null),ee=x.useRef(null),[de,fe]=x.useState(y),ae=$&&de&&K!=="touch";!$&&de!==y&&fe(y),De(()=>{$||(Je.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),Je.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,$]),x.useImperativeHandle(M,()=>ae),F2((ae||q)&&V,K==="touch",F,X);const oe=Rb({anchor:o,floatingRootContext:B,positionMethod:l,mounted:$,side:p,sideOffset:g,align:m,alignOffset:h,arrowPadding:k,collisionBoundary:b,collisionPadding:v,sticky:N,disableAnchorTracking:w??ae,collisionAvoidance:S,keepMounted:!0}),me=ae?"none":oe.side,Te=ae?uL:oe.positionerStyles,ie={open:V,side:me,align:oe.align,anchorHidden:oe.anchorHidden};De(()=>{R.set("popupSide",oe.side)},[R,oe.side]);const pe=Ue(we=>{R.set("positionerElement",we)}),Se=Tb(t,ie,{styles:Te,transitionStatus:G,props:E,refs:[a,pe],hidden:!$,inert:!V}),je=x.useRef(0),Be=Ue(we=>{if(we.size===0&&je.current===0||I.current.length===0)return;const Ee=je.current;if(je.current=we.size,we.size===Ee)return;const ve=nt(fa);if(Ee!==0&&!R.state.multiple&&Y!==null&&kc(I.current,Y,L)===-1){const Pe=P.current,Ie=Pe!=null&&kc(I.current,Pe,L)!==-1?Pe:null;D(Ie,ve),Ie===null&&(R.set("selectedIndex",null),z.current=null)}if(Ee!==0&&R.state.multiple&&Array.isArray(Y)){const Ce=Le=>kc(I.current,Le,L)!==-1,Pe=Y.filter(Le=>Ce(Le));(Pe.length!==Y.length||Pe.some(Le=>!XP(Y,Le,L)))&&(D(Pe,ve),Pe.length===0&&(R.set("selectedIndex",null),z.current=null))}if(V&&ae){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ce={height:""};xf(F,Ce),xf(H.current,Ce)}}),Ve=x.useMemo(()=>({...oe,side:me,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:fe,scrollUpArrowRef:Z,scrollDownArrowRef:ee}),[oe,me,ae,fe]);return r.jsx(sp,{elementsRef:A,labelsRef:T,onMapChange:Be,children:r.jsxs(WC.Provider,{value:Ve,children:[$&&q&&r.jsx(Pb,{inert:Zf(!V),cutout:X}),Se]})})}),Sd="base-ui-disable-scrollbar",hx={className:Sd,getElement(e){return r.jsx("style",{nonce:e,href:Sd,precedence:"base-ui:low",children:`.${Sd}{scrollbar-width:none}.${Sd}::-webkit-scrollbar{display:none}`})}},fL=x.createContext(void 0),pL={disableStyleElements:!1};function mL(){return x.useContext(fL)??pL}const gL={...Ro,...Ja},hL=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m,popupRef:g,onOpenChangeComplete:h,setOpen:b,valueRef:v,firstItemTextRef:k,selectedItemTextRef:N,multiple:w,handleScrollArrowVisibility:y,scrollHandlerRef:S,listRef:C,highlightItemOnHover:E}=ha(),{side:R,align:A,alignItemWithTriggerActive:T,isPositioned:M,setControlledAlignItemWithTrigger:z}=t_(),I=B2()!=null,P=YC(),H=Qf(),{nonce:D,disableStyleElements:B}=mL(),V=tt(m,Je.id),$=tt(m,Je.open),q=tt(m,Je.openMethod),Y=tt(m,Je.mounted),K=tt(m,Je.popupProps),F=tt(m,Je.transitionStatus),X=tt(m,Je.triggerElement),L=tt(m,Je.positionerElement),G=tt(m,Je.listElement),Z=x.useRef(!1),ee=x.useRef(!1),de=x.useRef({}),fe=Bl(),ae=Ue(ie=>{if(!L||!g.current||!ee.current)return;if(Z.current||!T){y();return}const pe=L.style.top==="0px",Se=L.style.bottom==="0px";if(!pe&&!Se){y();return}const je=$j(L),Be=gc(L.getBoundingClientRect().height,"y",je),Ve=mt(L),we=$t(L),Ee=we.getComputedStyle(L),ve=parseFloat(Ee.marginTop),Ce=parseFloat(Ee.marginBottom),Pe=qj(we.getComputedStyle(g.current)),Le=Math.min(Ve.documentElement.clientHeight-ve-Ce,Pe),Ie=ie.scrollTop,se=Cd(ie);let be=0,$e=null,Re=!1,Oe=!1;const We=Me=>{L.style.height=`${Me}px`},at=(Me,He)=>{const Xe=mc(Me,0,Le-Be);Xe>0&&We(Be+Xe),ie.scrollTop=He,Le-(Be+Xe)<=Hs&&(Z.current=!0),y()},yt=pe?se-Ie:Ie,_e=Math.min(Be+yt,Le);if(be=_e,yt<=Hs){at(yt,pe?se:0);return}if(Le-_e>Hs)pe?Oe=!0:$e=0;else if(Re=!0,Se&&Ie<se){const Me=Be+yt-Le;$e=Ie-(yt-Me)}if(be=Math.ceil(be),be!==0&&We(be),Oe||$e!=null){const Me=Cd(ie),He=Oe?Me:mc($e,0,Me);Math.abs(ie.scrollTop-He)>Hs&&(ie.scrollTop=He)}(Re||be>=Le-Hs)&&(Z.current=!0),y()});x.useImperativeHandle(S,()=>ae,[ae]),ga({open:$,ref:g,onComplete(){$&&h?.(!0)}});const oe={open:$,transitionStatus:F,side:R,align:A};De(()=>{!L||!g.current||Object.keys(de.current).length||(de.current={top:L.style.top||"0",left:L.style.left||"0",right:L.style.right,height:L.style.height,bottom:L.style.bottom,minHeight:L.style.minHeight,maxHeight:L.style.maxHeight,marginTop:L.style.marginTop,marginBottom:L.style.marginBottom})},[g,L]),De(()=>{$||T||(ee.current=!1,Z.current=!1,xf(L,de.current))},[$,T,L,g]),De(()=>{const ie=g.current;if(!$||!X||!L||!ie||T&&!M||m.state.transitionStatus==="ending")return;if(!T){ee.current=!0,fe.request(y),ie.style.removeProperty("--transform-origin");return}const pe=xL(ie);ie.style.removeProperty("--transform-origin");try{let Se=N.current;Se?.isConnected||(Se=!Je.hasSelectedValue(m.state)&&k.current?.isConnected?k.current:null);const je=v.current,Be=$t(L),Ve=Be.getComputedStyle(L),we=Be.getComputedStyle(ie),Ee=mt(X),ve=$j(X),Ce=Nd(X.getBoundingClientRect(),ve),Pe=Nd(L.getBoundingClientRect(),ve),Le=Ce.height,Ie=G||ie,se=Ie.scrollHeight,be=parseFloat(we.borderBottomWidth),$e=parseFloat(Ve.marginTop)||10,Re=parseFloat(Ve.marginBottom)||10,Oe=parseFloat(Ve.minHeight)||100,We=qj(we),at=5,yt=5,_e=20,Me=Ee.documentElement.clientHeight-$e-Re,He=Ee.documentElement.clientWidth,Xe=Me-Ce.bottom+Le;let ot,sn=H==="rtl"?Ce.right-Pe.width:Ce.left,dn=0;if(Se&&je){const pn=Nd(je.getBoundingClientRect(),ve);ot=Nd(Se.getBoundingClientRect(),ve),sn=Pe.left+(H==="rtl"?pn.right-ot.right:pn.left-ot.left);const ws=pn.top-Ce.top+pn.height/2;dn=ot.top-Pe.top+ot.height/2-ws}const pt=Xe+dn+Re+be;let Et=Math.min(Me,pt);const an=Me-$e-Re,Wt=pt-Et,Zt=He-yt;L.style.left=`${mc(sn,at,Zt-Pe.width)}px`,L.style.height=`${Et}px`,L.style.maxHeight="none",L.style.marginTop=`${$e}px`,L.style.marginBottom=`${Re}px`,ie.style.height="100%";const Gt=Cd(Ie),fn=Wt>=Gt-Hs;fn&&(Et=Math.min(Me,Pe.height)-(Wt-Gt));const es=Ce.top<_e||Ce.bottom>Me-_e||Math.ceil(Et)+Hs<Math.min(se,Oe),ds=(Be.visualViewport?.scale??1)!==1&&Dr;if(es||ds){ee.current=!0,xf(L,de.current),z(!1);return}const js=Math.max(Oe,Et);if(fn){const pn=Math.max(0,Me-pt);L.style.top=Pe.height>=an?"0":`${pn}px`,L.style.height=`${Et}px`,Ie.scrollTop=Cd(Ie)}else L.style.bottom="0",Ie.scrollTop=Wt;if(ot){const pn=Pe.top,ws=Pe.height,xa=ot.top+ot.height/2,Ls=ws>0?(xa-pn)/ws*100:50,ba=mc(Ls,0,100);ie.style.setProperty("--transform-origin",`50% ${ba}%`)}(js===Me||Et>=We)&&(Z.current=!0),y(),E&&m.state.selectedIndex===null&&m.state.activeIndex===null&&C.current[0]!=null&&m.set("activeIndex",0),ee.current=!0}finally{pe()}},[m,$,L,X,v,k,N,g,y,T,z,fe,G,C,E,H,M]),x.useEffect(()=>{if(!T||!L||!$)return;const ie=$t(L);function pe(Se){b(!1,nt(s5,Se))}return ht(ie,"resize",pe)},[b,T,L,$]);const me={...G?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${V}-list`},onKeyDown(ie){I&&np.has(ie.key)&&ie.stopPropagation()},onScroll(ie){G||ae(ie.currentTarget)},...T&&{style:G?{height:"100%"}:ZC}},Te=Nt("div",t,{ref:[a,g],state:oe,stateAttributesMapping:gL,props:[K,me,Wf(F),{className:!G&&T?hx.className:void 0},p]});return r.jsxs(x.Fragment,{children:[!B&&hx.getElement(D),r.jsx(hb,{context:P,modal:!1,disabled:!Y,openInteractionType:q,returnFocus:u,restoreFocus:!0,children:Te})]})});function qj(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Cd(e){return e_(e.scrollHeight,e.clientHeight)}function $j(e){return JS.getScale(e)}function gc(e,t,a){return e/a[t]}function Nd(e,t){return Oc({x:gc(e.x,"x",t),y:gc(e.y,"y",t),width:gc(e.width,"x",t),height:gc(e.height,"y",t)})}const Fj=[["transform","none"],["scale","1"],["translate","0 0"]];function xL(e){const{style:t}=e,a={};for(const[o,l]of Fj)a[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Fj){const l=a[o];l?t.setProperty(o,l):t.removeProperty(o)}}}const bL=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,{store:p,scrollHandlerRef:m}=ha(),{alignItemWithTriggerActive:g}=t_(),h=tt(p,Je.hasScrollArrows),b=tt(p,Je.openMethod),v=tt(p,Je.multiple),N={id:`${tt(p,Je.id)}-list`,role:"listbox","aria-multiselectable":v||void 0,onScroll(y){m.current?.(y.currentTarget)},...g&&{style:ZC},className:h&&b!=="touch"?hx.className:void 0},w=Ue(y=>{p.set("listElement",y)});return Nt("div",t,{ref:[a,w],props:[N,u]})}),JC=x.createContext(void 0);function n_(){const e=x.useContext(JC);if(!e)throw new Error(nn(57));return e}const _L=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,style:c,value:u=null,label:p,disabled:m=!1,nativeButton:g=!1,...h}=t,b=x.useRef(null),v=Gc({label:p,textRef:b,indexGuessBehavior:L2.GuessFromOrder}),{store:k,itemProps:N,setOpen:w,setValue:y,selectionRef:S,typingRef:C,valuesRef:E,multiple:R,selectedItemTextRef:A,disabled:T,readOnly:M}=ha(),z=tt(k,Je.isActive,v.index),I=tt(k,Je.open),P=tt(k,Je.isSelected,u),H=tt(k,Je.isSelectedByFocus,v.index),D=tt(k,Je.isItemEqualToValue),B=v.index,V=B!==-1,$=x.useRef(null);De(()=>{if(!V)return;const ae=E.current;return ae[B]=u,()=>{delete ae[B]}},[V,B,u,E]),De(()=>{if(!V)return;const ae=k.state.value;let oe=ae;R&&Array.isArray(ae)&&(oe=ae.length>0?ae[ae.length-1]:void 0),oe!==void 0&&wo(u,oe,D)&&(k.set("selectedIndex",B),b.current&&(A.current=b.current))},[V,B,R,D,k,u,A]);const q=x.useRef(null),Y=x.useRef("mouse"),K=x.useRef(!1),{getButtonProps:F,buttonRef:X}=Hr({disabled:m,focusableWhenDisabled:!0,native:g,composite:!0}),L={disabled:m,selected:P,highlighted:z};function G(ae){if(T||M)return;const oe=k.state.value;if(R){const me=Array.isArray(oe)?oe:[],Te=P?QP(me,u,D):[...me,u];y(Te,nt(El,ae))}else y(u,nt(El,ae)),w(!1,nt(El,ae))}function Z(){S.current.dragY=0}const ee={role:"option","aria-selected":P,tabIndex:I&&z?0:-1,onKeyDown(ae){q.current=ae.key,k.set("activeIndex",B),ae.key===" "&&C.current&&ae.preventDefault()},onClick(ae){const oe=ae.type==="click"&&Y.current!=="touch",me=ae.nativeEvent.pointerType,Te=oe&&Wx(ae.nativeEvent)&&(me!==void 0||z),ie=oe&&!Te&&!K.current;K.current=!1,!(ae.type==="keydown"&&q.current===null)&&(m||ae.type==="keydown"&&q.current===" "&&C.current||ie||(q.current=null,G(ae.nativeEvent)))},onPointerEnter(ae){Y.current=ae.pointerType},onPointerMove(ae){if(ae.pointerType==="mouse"&&ae.buttons===1){const oe=S.current;oe.dragY+=ae.movementY,oe.dragY**2>=64&&(oe.allowUnselectedMouseUp=!0)}},onPointerDown(ae){Y.current=ae.pointerType,K.current=!0,Z()},onMouseUp(){if(Z(),m||Y.current==="touch"||K.current)return;const ae=!S.current.allowSelectedMouseUp&&P,oe=!S.current.allowUnselectedMouseUp&&!P;ae||oe||(K.current=!0,$.current?.click(),K.current=!1)}},de=Nt("div",t,{ref:[X,a,v.ref,$],state:L,props:[N,ee,h,F]}),fe=x.useMemo(()=>({selected:P,index:B,textRef:b,selectedByFocus:H,hasRegistered:V}),[P,B,b,H,V]);return r.jsx(JC.Provider,{value:fe,children:de})})),vL=x.forwardRef(function(t,a){const o=t.keepMounted??!1,{selected:l}=n_();return o||l?r.jsx(yL,{...t,ref:a}):null}),yL=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:l,keepMounted:c,...u}=e,{selected:p}=n_(),m=x.useRef(null),{transitionStatus:g,setMounted:h}=ti(p),v=Nt("span",e,{ref:[t,m],state:{selected:p,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Ja});return ga({open:p,ref:m,onComplete(){p||h(!1)}}),v})),jL=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:u}=n_(),{firstItemTextRef:p,selectedItemTextRef:m}=ha(),{render:g,className:h,style:b,...v}=t,k=x.useCallback(w=>{w&&(u&&o===0&&(p.current=w),u&&c&&(m.current=w))},[p,m,o,c,u]);return Nt("div",t,{ref:[k,a,l],props:v})})),eN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,direction:u,keepMounted:p=!1,...m}=t,g=u==="up",{store:h,popupRef:b,listRef:v,handleScrollArrowVisibility:k,scrollArrowsMountedCountRef:N}=ha(),{side:w,scrollDownArrowRef:y,scrollUpArrowRef:S}=t_(),C=g?Je.scrollUpArrowVisible:Je.scrollDownArrowVisible,E=tt(h,C),R=tt(h,Je.openMethod),A=E&&R!=="touch",T=kn(),M=g?S:y,{mounted:z,transitionStatus:I,setMounted:P}=ti(A);De(()=>(N.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{N.current=Math.max(0,N.current-1),N.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,N]),ga({open:A,ref:M,onComplete(){A||P(!1)}});const B=Nt("div",t,{ref:[a,M],state:{direction:u,visible:A,side:w,transitionStatus:I},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove($){if($.movementX===0&&$.movementY===0||T.isStarted())return;h.set("activeIndex",null);function q(){const Y=h.state.listElement??b.current;if(!Y)return;h.set("activeIndex",null),k();const K=e_(Y.scrollHeight,Y.clientHeight),F=hf(Y.scrollTop,K),X=F===(g?0:K),L=v.current;if(F!==Y.scrollTop&&(Y.scrollTop=F),L.length===0&&h.set(g?"scrollUpArrowVisible":"scrollDownArrowVisible",!X),X){T.clear();return}if(L.length>0){const G=M.current?.offsetHeight||0;Y.scrollTop=wL(L,g,F,Y.clientHeight,G,K)}T.start(40,q)}T.start(40,q)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:Ja});return z||p?B:null});function wL(e,t,a,o,l,c){if(t){let h=0;const b=a+l-Hs;for(let N=0;N<e.length;N+=1){const w=e[N];if(w&&w.offsetTop>=b){h=N;break}}const v=Math.max(0,h-1),k=e[v];return v<h&&k?hf(k.offsetTop-l,c):0}let u=e.length-1;const p=a+o-l+Hs;for(let h=0;h<e.length;h+=1){const b=e[h];if(b&&b.offsetTop+b.offsetHeight>p){u=Math.max(0,h-1);break}}const m=Math.min(e.length-1,u+1),g=e[m];return m>u&&g?hf(g.offsetTop+g.offsetHeight-o+l,c):c}const kL=x.forwardRef(function(t,a){return r.jsx(eN,{...t,ref:a,direction:"down"})}),SL=x.forwardRef(function(t,a){return r.jsx(eN,{...t,ref:a,direction:"up"})}),CL=eL;function NL({className:e,...t}){return r.jsx(oL,{"data-slot":"select-value",className:St("flex flex-1 text-left",e),...t})}function EL({className:e,size:t="default",children:a,...o}){return r.jsxs(aL,{"data-slot":"select-trigger","data-size":t,className:St("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:[a,r.jsx(lL,{render:r.jsx(Za,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function RL({className:e,children:t,side:a="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...p}){return r.jsx(cL,{children:r.jsx(dL,{side:a,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:r.jsxs(hL,{"data-slot":"select-content","data-align-trigger":u,className:St("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),...p,children:[r.jsx(AL,{}),r.jsx(bL,{children:t}),r.jsx(ML,{})]})})})}function TL({className:e,children:t,...a}){return r.jsxs(_L,{"data-slot":"select-item",className:St("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),...a,children:[r.jsx(jL,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),r.jsx(vL,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(ho,{className:"pointer-events-none"})})]})}function AL({className:e,...t}){return r.jsx(SL,{"data-slot":"select-scroll-up-button",className:St("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(Uk,{})})}function ML({className:e,...t}){return r.jsx(kL,{"data-slot":"select-scroll-down-button",className:St("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(Za,{})})}function bt({value:e,onChange:t,options:a,placeholder:o="— elegir —",disabled:l,className:c,showIcon:u=!1}){return r.jsxs(CL,{value:e,onValueChange:p=>t(p??""),disabled:l,children:[r.jsx(EL,{className:ze("h-9 w-full",c),children:r.jsx(NL,{placeholder:o,children:p=>{const m=a.find(h=>h.value===p),g=u?m?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&r.jsx(g,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),r.jsx(RL,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:a.map(p=>{const m=p.icon;return r.jsx(TL,{value:p.value,disabled:p.disabled,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?r.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:p.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):r.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const Gj=320;function OL(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function zL(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function DL({m:e}){const[t,a]=x.useState(!1),o=(e.body?.length||0)>Gj,l=!o||t?e.body:`${e.body.slice(0,Gj)}…`;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(Lk,{size:14,className:"text-blue-400"}):r.jsx(Bk,{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:OL(e.ts)}),r.jsx(Fe,{tone:"info",children:e.channel}),e.type&&r.jsx(Fe,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:zL(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:()=>a(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:f(t?"logs.show_less":"logs.show_more")})]})]})}function PL(){const[e,t]=x.useState(!1),a=et(e?"/admin/logs?errors":null,()=>$l.logs("errors",200)),o=a.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>t(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[f("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[a.isLoading&&r.jsx(lt,{}),e&&!a.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("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 LL({pid:e}){const t=!e||String(e)==="0",[a,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState(""),h=a.trim()||void 0,b=t?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,v=et(b,()=>t?ff.global({channel:h,limit:300}):ff.project(e,{channel:h,limit:300})),k=x.useMemo(()=>[...v.data||[]].sort((y,S)=>(S.ts||"").localeCompare(y.ts||"")),[v.data]),N=x.useMemo(()=>Array.from(new Set(k.map(y=>y.type).filter(Boolean))),[k]),w=x.useMemo(()=>k.filter(y=>!(l&&y.direction!==l||u&&y.type!==u||m&&!(y.body||"").toLowerCase().includes(m.toLowerCase()))),[k,l,u,m]);return r.jsxs(Ke,{title:f("logs.title"),description:f(t?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ne,{placeholder:f("logs.filter_channel"),value:a,onChange:y=>o(y.target.value),className:"w-44"}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:r.jsx(ua,{size:13})})]}),children:[t&&r.jsx(PL,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(bt,{value:l,onChange:c,placeholder:f("logs.filter_dir"),options:[{value:"",label:f("logs.all_directions")},{value:"in",label:f("logs.in")},{value:"out",label:f("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(bt,{value:u,onChange:p,placeholder:f("logs.filter_type"),options:[{value:"",label:f("logs.all_types")},...N.map(y=>({value:y,label:y}))]})}),r.jsx(Ne,{placeholder:f("logs.search_text"),value:m,onChange:y=>g(y.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[w.length," ",f("logs.count_of")," ",k.length]})]}),v.isLoading&&r.jsx(lt,{}),v.error&&r.jsx(xt,{children:f("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&w.length===0&&r.jsx(xt,{children:h?f("logs.no_activity_ch",{ch:h}):f("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:w.map((y,S)=>r.jsx(DL,{m:y},`${y.ts}-${S}`))})]})}function tN({value:e,onChange:t,options:a,placeholder:o=f("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:u}){const[p,m]=x.useState(!1),[g,h]=x.useState(e),b=x.useRef(null),v=x.useRef(null),[k,N]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const E=()=>{const R=b.current;if(!R)return;const A=R.getBoundingClientRect();N({top:A.bottom+4,left:A.left,width:A.width})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[p]),x.useEffect(()=>{if(!p)return;const E=R=>{const A=R.target;b.current?.contains(A)||v.current?.contains(A)||m(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);const w=g.trim().toLowerCase(),S=w&&!(g===e)?a.filter(E=>E.toLowerCase().includes(w)):a,C=E=>{t(E),h(E),m(!1)};return r.jsxs("div",{ref:b,className:ze("relative",u),children:[r.jsxs("div",{className:ze("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(Ye,{content:c||f("models_ui.invalid_hint"),children:r.jsx("span",{children:r.jsx(Wk,{className:"size-3.5 shrink-0 text-amber-400"})})}),r.jsx("input",{value:g,placeholder:o,onChange:E=>{h(E.target.value),t(E.target.value),m(!0)},onFocus:()=>m(!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:()=>m(E=>!E),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(Za,{className:"size-4"})})]}),p&&S.length>0&&k&&ca.createPortal(r.jsx("ul",{ref:v,style:{position:"fixed",top:k.top,left:k.left,width:k.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:S.map(E=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),C(E)},className:ze("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",E===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:E})})},E))}),document.body)]})}function Vr(){const{data:e,error:t,isLoading:a,mutate:o}=et("/admin/config",()=>$l.config.get()),l=async(c,u)=>{const p=await $l.config.patch({set:c,unset:u});return await o({config:p.config},{revalidate:!1}),p.config};return{config:e?.config||{},error:t,isLoading:a,mutate:o,patch:l}}function nN(){const{data:e,error:t,isLoading:a,mutate:o}=et("/admin/super-agent",()=>$l.superAgent());return{superAgent:e,error:t,isLoading:a,mutate:o}}const IL={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"},BL={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"},Sc=[{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 eh(e,t){return t&&t in e?e[t]:e.custom}const bf={anthropic:pa,openai:un,gemini:SM,groq:Pl,openrouter:Ix,ollama:Xk,azure:uM,mock:qk,custom:Zl},mo={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 sN(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function th({value:e,onChange:t,providers:a}){const{provider:o,model:l}=sN(e),c=a.find(h=>h.slug===o),u=!!o&&!c,p=x.useMemo(()=>{const h=c?mo[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),m=h=>{const b=a.find(k=>k.slug===h),v=b?.default_model||mo[b?.engine]?.default_model||"";t(v?`${h}:${v}`:`${h}:`)},g=h=>t(`${o}:${h}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(bt,{value:o,onChange:m,placeholder:u?f("router_panel.provider_not_found",{name:o}):f("router_panel.provider_ph"),options:a.map(h=>({value:h.slug,label:h.slug,icon:bf[h.engine]}))}),r.jsx(tN,{value:l,onChange:g,options:p,invalid:u,invalidHint:f("router_panel.provider_not_configured",{name:o})})]})}function UL(){const e=rt(),{superAgent:t,isLoading:a,mutate:o}=nN(),{config:l,patch:c}=Vr(),[u,p]=x.useState(""),[m,g]=x.useState([]),[h,b]=x.useState(""),[v,k]=x.useState(null),[N,w]=x.useState(!1),[y,S]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const P=t.model_fallback?.models||[],H=Array.isArray(P)?P:[];p(t.model||""),g(H),S({model:t.model||"",fallback:H})},[t]);const C=x.useMemo(()=>{const P=l.engines||{};return Object.entries(P).map(([H,D])=>({slug:H,engine:D?.engine||H,default_model:D?.default_model||mo[D?.engine||H]?.default_model}))},[l.engines]),E=P=>{const{provider:H}=sN(P);return C.some(D=>D.slug===H)};if(a||!t)return r.jsx(lt,{});const R=u!==y.model||JSON.stringify(m)!==JSON.stringify(y.fallback),A=async()=>{w(!0);try{await c({"super_agent.model":u,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(f("router_panel.saved_toast")),S({model:u,fallback:m}),o()}catch(P){e.error(P.message)}finally{w(!1)}},T=()=>{const P=h.trim().replace(/:$/,"");!P||!P.includes(":")||m.includes(P)||(g([...m,P]),b(""))},M=(P,H)=>{const D=[...m];D[P]=H,g(D)},z=P=>{g(m.filter((H,D)=>D!==P)),v===P&&k(null)},I=(P,H)=>{const D=P+H;if(D<0||D>=m.length)return;const B=[...m];[B[P],B[D]]=[B[D],B[P]],g(B)};return r.jsx(Ke,{title:f("router_panel.title"),description:f("router_panel.description"),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(Fe,{tone:"success",children:[r.jsx(Ix,{size:11})," ",f("router_panel.badge_default")]}),r.jsx("span",{className:`font-mono text-xs ${!E(u)&&u?"text-amber-400":""}`,children:u||"—"}),m.map(P=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx(Ik,{size:12}),r.jsx("span",{className:`font-mono text-xs ${E(P)?"":"text-amber-400"}`,children:P})]},P))]}),C.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("router_panel.no_providers")}):r.jsx(le,{label:f("router_panel.active_model_label"),hint:f("router_panel.active_model_hint"),children:r.jsx(th,{value:u,onChange:p,providers:C})}),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:f("router_panel.fallback_title")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_desc")})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((P,H)=>{const D=!E(P),B=v===H;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:["#",H+1]}),B?r.jsx("div",{className:"flex-1",children:r.jsx(th,{value:P,onChange:V=>M(H,V),providers:C})}):r.jsxs("button",{type:"button",onClick:()=>k(H),className:"flex flex-1 items-center gap-1.5 text-left",children:[D&&r.jsx(Wk,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${D?"text-amber-400":""}`,children:P})]}),B?r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>k(null),children:f("router_panel.done")}):r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>k(H),children:r.jsx(Eo,{size:12})}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>I(H,-1),disabled:H===0,children:"↑"}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>I(H,1),disabled:H===m.length-1,children:"↓"}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>z(H),children:r.jsx(Zn,{size:12})})]})},`${H}-${P}`)}),m.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_empty")})]}),C.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.add_to_chain")}),r.jsx(th,{value:h,onChange:b,providers:C}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:T,disabled:!h.includes(":")||h.endsWith(":"),children:[r.jsx(tn,{size:13})," ",f("router_panel.add_to_chain")]})]})]}),r.jsx(ce,{variant:"primary",loading:N,disabled:!R,onClick:A,children:f(R?"router_panel.save":"router_panel.saved")})]})})}function HL({provider:e,onEdit:t,onDelete:a,onToggle:o}){const l=eh(IL,e.engine),c=eh(BL,e.engine),u=eh(bf,e.engine),p=Sc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,g=jo(e.api_key),h=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:t,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:ze("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(u,{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:ze("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(u,{className:"size-3"})," ",p]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Ye,{content:f(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:ze("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",h?"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:ze("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),f(h?"providers_card.active":"providers_card.off")]})}),r.jsx(Ye,{content:f("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),a()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(Zn,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(tc,{label:f("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(tc,{label:f("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),r.jsx(tc,{label:f("providers_card.api_key"),value:m?g?`…${g}`:f("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&r.jsx(tc,{label:f("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(tc,{label:f("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function tc({label:e,value:t,mono:a,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:ze("text-foreground",a&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const Yj={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:""},VL=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function nc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ed(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function qL(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:Ed(e.pricing?.input_per_million),p_output:Ed(e.pricing?.output_per_million),p_cache_read:Ed(e.pricing?.cache_read_per_million),p_cache_write:Ed(e.pricing?.cache_write_per_million)}}function $L({open:e,initial:t,existingSlugs:a,onClose:o,onSave:l}){const c=!!t,[u,p]=x.useState(Yj),[m,g]=x.useState(!1),[h,b]=x.useState(null),[v,k]=x.useState([]),[N,w]=x.useState(!1),[y,S]=x.useState(null),[C,E]=x.useState(!1),[R,A]=x.useState("");x.useEffect(()=>{if(!e)return;const F=t?qL(t):Yj;p(F),b(null),S(null),E(!1);const X=mo[F.engine];k(X?.known_models||[])},[e,t]);const T=F=>p(X=>({...X,...F})),M=F=>{const X=mo[F];T({engine:F,name:F==="custom"?u.name:Sc.find(L=>L.value===F)?.label||F,slug:F==="custom"?u.slug:F,base_url:X.base_url,default_model:X.default_model}),k(X.known_models),S(null)},z=F=>{const X=mo[F];T({engine:F,base_url:u.base_url||X.base_url,default_model:u.default_model||X.default_model}),k(X.known_models)},I=async()=>{w(!0),S(null);try{const F=await pf.models({engine:u.engine,slug:u.slug||nc(u.name),base_url:u.base_url||void 0,api_key:u.api_key_value||void 0});if(F.error){S(F.error);return}k(F.models),F.models.length===0&&S(f("providers_modal.err_no_models"))}catch(F){S(F.message||f("providers_modal.err_list_models"))}finally{w(!1)}},P=x.useMemo(()=>u.default_model&&!v.includes(u.default_model)?[u.default_model,...v]:v,[v,u.default_model]),H=()=>{const F=(u.slug||nc(u.name)).trim();if(!F)return b(f("providers_modal.err_slug_required")),null;if(!c&&a.includes(F))return b(f("providers_modal.err_slug_exists",{slug:F})),null;let X;if(u.model_context_limits_json.trim())try{const Z=JSON.parse(u.model_context_limits_json);if(!Z||typeof Z!="object"||Array.isArray(Z))throw new Error;X=Z}catch{return b(f("providers_modal.err_model_limits_json")),null}const G=[u.p_input,u.p_output,u.p_cache_read,u.p_cache_write].map(Z=>Z.trim()).some(Boolean)?{input_per_million:Number(u.p_input||0),output_per_million:Number(u.p_output||0),cache_read_per_million:Number(u.p_cache_read||0),cache_write_per_million:Number(u.p_cache_write||0)}:void 0;return{provider:{slug:F,name:u.name.trim()||F,engine:u.engine,base_url:u.base_url.trim()||void 0,default_model:u.default_model.trim()||void 0,default_temperature:u.default_temperature,default_max_tokens:u.default_max_tokens,is_active:u.is_active,context_limit_tokens:u.context_limit_tokens||void 0,model_context_limits:X,pricing:G},modelLimits:X}},D=()=>{const F=H();if(!F)return;const{provider:X}=F,L={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&&(L.base_url=X.base_url),X.default_model&&(L.default_model=X.default_model),X.context_limit_tokens&&(L.context_limit_tokens=X.context_limit_tokens),X.model_context_limits&&(L.model_context_limits=X.model_context_limits),X.pricing&&(L.pricing=X.pricing),u.api_key_value.trim()&&(L.api_key=u.api_key_value.trim()),A(JSON.stringify(L,null,2)),b(null),E(!0)},B=async()=>{g(!0),b(null);try{if(C){const X=(u.slug||nc(u.name)).trim();if(!X){b(f("providers_modal.err_slug_required_form"));return}let L;try{L=JSON.parse(R)}catch{b(f("providers_modal.err_json_invalid"));return}if(!L||typeof L!="object"||Array.isArray(L)){b(f("providers_modal.err_json_object"));return}const G=L;if(!G.engine||typeof G.engine!="string"){b(f("providers_modal.err_engine_missing"));return}const Z={slug:X,name:typeof G.name=="string"?G.name:X,engine:String(G.engine),base_url:typeof G.base_url=="string"?G.base_url:void 0,default_model:typeof G.default_model=="string"?G.default_model:void 0,is_active:G.is_active!==!1};await l({provider:Z,raw:G,originalSlug:t?.slug}),o();return}const F=H();if(!F)return;await l({provider:F.provider,apiKeyValue:u.api_key_value.trim()||void 0,originalSlug:t?.slug}),o()}catch(F){b(F.message||f("providers_modal.err_save"))}finally{g(!1)}},V=c&&is(t?.api_key),$=jo(t?.api_key),q=V?f("providers_modal.api_key_set",{suffix:$??""}):"sk-…",Y=u.engine==="ollama",K=mo[u.engine]?.api_key_env;return r.jsx(On,{open:e,onClose:o,title:c?f("providers_modal.edit_title",{name:t?.name||t?.slug||""}):f("providers_modal.new_title"),description:f("providers_modal.description"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:m,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:B,loading:m,children:f(c?"common.save":"common.create")})]}),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:VL.map(F=>{const X=bf[F],L=F==="custom"?f("providers_modal.custom"):Sc.find(Z=>Z.value===F)?.label||F,G=u.engine===F;return r.jsxs("button",{type:"button",onClick:()=>M(F),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${G?"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"})," ",L]},F)})}),r.jsxs("button",{type:"button",onClick:()=>C?E(!1):D(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${C?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(aM,{className:"size-3.5"})," ",f(C?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),C?r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{label:f("providers_modal.json_label"),hint:f("providers_modal.json_hint",{slug:u.slug||nc(u.name)||"<slug>"}),children:r.jsx(Mn,{rows:14,className:"font-mono text-xs",value:R,onChange:F=>A(F.target.value),spellCheck:!1})}),r.jsx("p",{className:"text-[11px] text-muted-fg",children:f("providers_modal.json_help")})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("providers_modal.name_label"),children:r.jsx(Ne,{value:u.name,onChange:F=>T({name:F.target.value,slug:c?u.slug:nc(F.target.value)}),placeholder:f("providers_modal.name_ph")})}),r.jsx(le,{label:f("providers_modal.engine_label"),children:r.jsx(bt,{value:u.engine,onChange:F=>z(F),options:Sc.map(F=>({value:F.value,label:F.label,icon:bf[F.value]}))})})]}),r.jsx(le,{label:f("providers_modal.base_url_label"),hint:f("providers_modal.base_url_hint"),children:r.jsx(Ne,{value:u.base_url,onChange:F=>T({base_url:F.target.value}),placeholder:f("providers_modal.base_url_ph")})}),!Y&&r.jsx(le,{label:f("providers_modal.api_key_label"),hint:V?f("providers_modal.api_key_hint_existing"):K?f("providers_modal.api_key_hint_env",{env:K}):f("providers_modal.api_key_hint"),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",value:u.api_key_value,onChange:F=>T({api_key_value:F.target.value}),placeholder:q})}),r.jsx(le,{label:f("providers_modal.model_label"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(tN,{value:u.default_model,onChange:F=>T({default_model:F}),options:P,className:"flex-1"}),r.jsx(Ye,{content:f("providers_modal.list_models_hint"),children:r.jsxs(ce,{size:"sm",variant:"secondary",onClick:I,disabled:N,"aria-label":f("providers_modal.list_models_hint"),children:[N?r.jsx(Tf,{className:"size-3.5 animate-spin"}):r.jsx(ua,{className:"size-3.5"}),f("providers_modal.load_models")]})})]}),y&&r.jsx("p",{className:"text-[11px] text-amber-400",children:y})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("providers_modal.max_tokens_label"),children:r.jsx(Ne,{type:"number",min:256,step:256,value:u.default_max_tokens,onChange:F=>T({default_max_tokens:parseInt(F.target.value)||4096})})}),r.jsx(le,{label:f("providers_modal.temperature_label",{value:u.default_temperature.toFixed(1)}),children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:u.default_temperature,onChange:F=>T({default_temperature:parseFloat(F.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:f("providers_modal.pricing_summary")}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(le,{label:f("providers_modal.context_limit_label"),children:r.jsx(Ne,{type:"number",min:0,step:1024,value:u.context_limit_tokens,onChange:F=>T({context_limit_tokens:parseInt(F.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("providers_modal.price_input"),children:r.jsx(Ne,{type:"number",min:0,step:1e-4,value:u.p_input,onChange:F=>T({p_input:F.target.value}),placeholder:"0.15"})}),r.jsx(le,{label:f("providers_modal.price_output"),children:r.jsx(Ne,{type:"number",min:0,step:1e-4,value:u.p_output,onChange:F=>T({p_output:F.target.value}),placeholder:"0.60"})}),r.jsx(le,{label:f("providers_modal.price_cache_read"),children:r.jsx(Ne,{type:"number",min:0,step:1e-4,value:u.p_cache_read,onChange:F=>T({p_cache_read:F.target.value}),placeholder:"0.03"})}),r.jsx(le,{label:f("providers_modal.price_cache_write"),children:r.jsx(Ne,{type:"number",min:0,step:1e-4,value:u.p_cache_write,onChange:F=>T({p_cache_write:F.target.value}),placeholder:"0.00"})})]}),r.jsx(le,{label:f("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:r.jsx(Mn,{rows:3,className:"font-mono text-xs",value:u.model_context_limits_json,onChange:F=>T({model_context_limits_json:F.target.value})})})]})]}),r.jsx(Ft,{checked:u.is_active,onChange:F=>T({is_active:F}),label:f("providers_modal.active_label")})]}),h&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const FL=new Set(Sc.map(e=>e.value));function GL(e,t){const a=typeof t.engine=="string"&&t.engine||(FL.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:a,base_url:typeof t.base_url=="string"?t.base_url:void 0,api_key:typeof t.api_key=="string"?t.api_key:void 0,default_model:typeof t.default_model=="string"?t.default_model:void 0,default_temperature:typeof t.default_temperature=="number"?t.default_temperature:void 0,default_max_tokens:typeof t.default_max_tokens=="number"?t.default_max_tokens:void 0,is_active:typeof t.is_active=="boolean"?t.is_active:void 0,context_limit_tokens:typeof t.context_limit_tokens=="number"?t.context_limit_tokens:void 0,model_context_limits:t.model_context_limits||void 0,pricing:t.pricing||void 0}}function YL(){const e=rt(),{config:t,isLoading:a,patch:o,mutate:l}=Vr(),[c,u]=x.useState(!1),[p,m]=x.useState(null);if(a)return r.jsx(lt,{});const g=t.engines||{},h=Object.entries(g).map(([S,C])=>GL(S,C||{})),b=h.map(S=>S.slug),v=()=>{m(null),u(!0)},k=S=>{m(S),u(!0)},N=async({provider:S,apiKeyValue:C,raw:E})=>{if(E){await o({[`engines.${S.slug}`]:E}),e.success(f("engines_panel.saved_json")),l();return}const R=`engines.${S.slug}`,A={[`${R}.name`]:S.name,[`${R}.engine`]:S.engine,[`${R}.is_active`]:S.is_active!==!1,[`${R}.default_temperature`]:S.default_temperature,[`${R}.default_max_tokens`]:S.default_max_tokens},T=[],M=(z,I)=>{I===void 0||I===""?T.push(`${R}.${z}`):A[`${R}.${z}`]=I};M("base_url",S.base_url),M("default_model",S.default_model),M("context_limit_tokens",S.context_limit_tokens),M("pricing",S.pricing),M("model_context_limits",S.model_context_limits),C&&(A[`${R}.api_key`]=C),await o(A,T),e.success(f("engines_panel.saved")),l()},w=async S=>{try{await o({[`engines.${S.slug}.is_active`]:S.is_active===!1}),l()}catch(C){e.error(C.message)}},y=async S=>{if(confirm(f("engines_panel.delete_confirm",{name:S.name||S.slug})))try{await o(void 0,[`engines.${S.slug}`]),e.success(f("engines_panel.deleted")),l()}catch(C){e.error(C.message)}};return r.jsxs(Ke,{title:f("engines_panel.title"),description:f("engines_panel.description"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:v,children:[r.jsx(tn,{size:14})," ",f("engines_panel.new_btn")]}),children:[h.length===0?r.jsx(xt,{children:f("engines_panel.empty")}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(S=>r.jsx(HL,{provider:S,onEdit:()=>k(S),onDelete:()=>y(S),onToggle:()=>w(S)},S.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(tn,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:f("engines_panel.add_card")})]})]}),r.jsx($L,{open:c,initial:p,existingSlugs:b,onClose:()=>{u(!1),m(null)},onSave:N})]})}function aN(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(UL,{}),r.jsx(YL,{})]})}function KL(){const e=rt(),[t,a]=x.useState(!1),l=et(t?"/agents/vault?include_removed=1":"/agents/vault",()=>rn.vault({includeRemoved:t})),c=l.data||[],[u,p]=x.useState(null),m=async h=>{const b=h.source!=="user",v=b?f("base.defaults_tombstone_msg",{slug:h.slug}):f("base.defaults_delete_msg",{slug:h.slug});if(confirm(v))try{await rn.vaultRemove(h.slug),e.success(f(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(k){e.error(k.message)}},g=async h=>{try{await rn.vaultRestore(h),e.success(f("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs(Ke,{title:f("base.defaults_title"),description:f("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ft,{checked:t,onChange:a,label:f("base.defaults_show_removed")}),r.jsxs(ce,{size:"sm",onClick:()=>p("new"),children:[r.jsx(tn,{size:14})," ",f("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(lt,{}),!l.isLoading&&c.length===0&&r.jsx(xt,{children:f("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const b=t&&h.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:h.is_master?r.jsx(Fa,{className:"size-4 text-white"}):r.jsx(un,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),r.jsx(XL,{source:h.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(nh,{label:f("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:r.jsx(Vx,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(nh,{label:f("base.defaults_edit"),onClick:()=>p(h),variant:"ghost",children:r.jsx(Eo,{size:13})}),r.jsx(nh,{label:h.source==="user"?f("base.defaults_delete"):f("base.defaults_hide"),onClick:()=>m(h),variant:"ghost-destructive",children:r.jsx(Zn,{size:13})})]})})]}),h.model?r.jsx(Fe,{tone:"info",children:h.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:f("agents_ui.model_router_default")}),h.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&r.jsx(Fe,{children:h.role}),h.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(pa,{size:9})," ",v]},v)),h.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))]})]},h.slug)})}),u!==null&&r.jsx(QL,{agent:u==="new"?null:u,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function XL({source:e}){return e==="user"?r.jsx(Fe,{tone:"success",children:f("agents_ui.source_user")}):e==="user-override"?r.jsx(Fe,{tone:"warning",children:f("agents_ui.source_override")}):r.jsx(Fe,{tone:"muted",children:f("agents_ui.source_bundled")})}function nh({label:e,onClick:t,variant:a="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(Ab,{children:[r.jsx(Mb,{render:r.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${l} ${c[a]}`,children:o})}),r.jsx(Ob,{children:e})]})}function QL({agent:e,onClose:t,onSaved:a}){const o=rt(),[l,c]=x.useState(!1),u=!e,[p,m]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[b,v]=x.useState(e?.model??""),[k,N]=x.useState(e?.description??""),[w,y]=x.useState(e?.language??"es"),[S,C]=x.useState((e?.skills??[]).join(", ")),[E,R]=x.useState((e?.tools??[]).join(", ")),[A,T]=x.useState(!!e?.is_master),[M,z]=x.useState(e?.body??""),I=async()=>{const P={role:g||void 0,model:b||void 0,description:k||void 0,language:w||void 0,skills:S,tools:E,is_master:A};c(!0);try{if(u){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(f("base.defaults_slug_invalid"));await rn.vaultCreate(p,P,M),o.success(f("base.defaults_created",{slug:p}))}else await rn.vaultPatch(e.slug,{fields:P,body:M}),o.success(f("base.defaults_saved",{slug:e.slug}));a()}catch(H){o.error(H.message)}finally{c(!1)}};return r.jsx(On,{open:!0,onClose:t,title:u?f("base.defaults_new_title"):f("base.defaults_edit_title",{slug:e.slug}),description:u?f("base.defaults_new_desc"):e.source==="bundled"?f("base.defaults_bundled_desc"):f("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:I,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[u&&r.jsx(le,{label:"slug",hint:f("agents_ui.slug_kebab_hint"),children:r.jsx(Ne,{autoFocus:!0,value:p,onChange:P=>m(P.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:"role",children:r.jsx(Ne,{value:g,onChange:P=>h(P.target.value),placeholder:"Code reviewer"})}),r.jsx(le,{label:"model",children:r.jsx(Ne,{value:b,onChange:P=>v(P.target.value),placeholder:"openrouter:..."})}),r.jsx(le,{label:"language",children:r.jsx(Ne,{value:w,onChange:P=>y(P.target.value),placeholder:"es"})}),r.jsx(le,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(Ft,{checked:A,onChange:T,label:f("base.defaults_master_label")})})})]}),r.jsx(le,{label:"description",children:r.jsx(Ne,{value:k,onChange:P=>N(P.target.value)})}),r.jsx(le,{label:"skills",hint:f("agents_ui.comma_separated"),children:r.jsx(Ne,{value:S,onChange:P=>C(P.target.value),placeholder:"code-review, git"})}),r.jsx(le,{label:"tools",hint:f("agents_ui.comma_separated"),children:r.jsx(Ne,{value:E,onChange:P=>R(P.target.value),placeholder:"read, write, run"})}),r.jsx(le,{label:"body",hint:f("agents_ui.body_hint"),children:r.jsx(Mn,{value:M,onChange:P=>z(P.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const WL=20,Kj=[10,20,50,100];function s_({key:e,fetchPage:t,resetKey:a,initialPageSize:o=WL,swr:l}){const[c,u]=x.useState(1),[p,m]=x.useState(o);x.useEffect(()=>{u(1)},[a]);const g=(c-1)*p,h=et(e==null?null:[e,p,g],()=>t(p,g),{keepPreviousData:!0,...l}),b=h.data?.total??0,v=Math.max(1,Math.ceil(b/p)),k=Math.min(c,v);x.useEffect(()=>{c!==k&&u(k)},[c,k]);const N=b===0?0:g,w=Math.min(g+p,b);return{items:h.data?.items??[],isLoading:h.isLoading,error:h.error,mutate:h.mutate,page:k,pageCount:v,total:b,start:N,end:w,pageSize:p,setPage:u,setPageSize:y=>{m(y),u(1)}}}function ZL({page:e,pageCount:t,total:a,start:o,end:l,pageSize:c,onPage:u,onPageSize:p}){return a<=Kj[0]?null:r.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"tabular-nums",children:f("common.pager_range",{from:o+1,to:l,total:a})}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{children:f("common.pager_per_page")}),r.jsx("div",{className:"w-[4.5rem]",children:r.jsx(bt,{value:String(c),onChange:m=>p(Number(m)),options:Kj.map(m=>({value:String(m),label:String(m)}))})})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ce,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>u(e-1),"aria-label":f("common.pager_prev"),children:r.jsx(rM,{size:14})}),r.jsx("span",{className:"px-1 tabular-nums",children:f("common.pager_page",{page:e,total:t})}),r.jsx(ce,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>u(e+1),"aria-label":f("common.pager_next"),children:r.jsx(Wl,{size:14})})]})]})}function a_({paged:e,fullHeight:t,className:a,children:o}){const l=r.jsx(ZL,{page:e.page,pageCount:e.pageCount,total:e.total,start:e.start,end:e.end,pageSize:e.pageSize,onPage:e.setPage,onPageSize:e.setPageSize});return t?r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsx("div",{className:ze("min-h-0 flex-1 overflow-y-auto",a),children:o}),r.jsx("div",{className:"shrink-0",children:l})]}):r.jsxs("div",{className:a,children:[o,l]})}const JL={apx:"success",claude:"info",codex:"warning"};function e6(){const e=rt(),t=rp(),[a,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState(!1);x.useEffect(()=>{const y=setTimeout(()=>p(l.trim()),350);return()=>clearTimeout(y)},[l]);const h=s_({key:`/sessions?engine=${a}&q=${u}&deep=${m?1:0}`,fetchPage:(y,S)=>PD.page({engine:a||void 0,q:u||void 0,deep:m,limit:y,offset:S}),resetKey:`${a}|${u}|${m?1:0}`}),b=()=>{c(""),p(""),o(""),g(!1)},v=async y=>{try{await navigator.clipboard.writeText(`apx session resume ${y.id} --continue`),e.success(f("base.sessions_cmd_copied"))}catch{e.error(f("base.sessions_copy_failed"))}},k=y=>{const S=`Continue this session: ${y.id} (engine: ${y.engine}${y.title?`, title: "${y.title}"`:""}${y.cwd?`, folder: ${y.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:S}}))},N=async y=>{if(!y.cwd){e.error(f("base.sessions_no_folder"));return}try{await bC.exec({kind:"open_path",target:y.cwd})}catch(S){e.error(f("base.sessions_folder_failed",{msg:S.message}))}},w=async y=>{const S=y.path||y.cwd;if(!S){e.error(f("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(S),e.success(f("base.sessions_path_copied"))}catch{e.error(f("base.sessions_copy_failed"))}};return r.jsxs(Ke,{fullHeight:!0,title:f("base.sessions_title"),description:f("base.sessions_desc"),action:r.jsx(Ye,{content:f("base.sessions_refresh"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>h.mutate(),children:r.jsx(ua,{size:13})})}),children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_c,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),r.jsx(Ne,{className:"pl-8",placeholder:f("base.sessions_search_ph"),value:l,onChange:y=>c(y.target.value)})]}),r.jsx(Ye,{content:f("base.sessions_deep_tip"),children:r.jsx(ce,{size:"sm",variant:m?"primary":"secondary",onClick:()=>g(y=>!y),children:f("base.sessions_deep")})}),r.jsx("div",{className:"w-36",children:r.jsx(bt,{value:a,onChange:o,options:[{value:"",label:f("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(Ye,{content:f("base.sessions_clear"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:b,children:r.jsx(Gs,{size:14})})})]}),h.isLoading&&r.jsx(lt,{}),h.error&&r.jsx(xt,{children:f("base.sessions_error",{msg:h.error.message})}),!h.isLoading&&!h.error&&h.total===0&&r.jsx(xt,{children:u?f("base.sessions_no_match",{q:u}):f("base.sessions_empty")}),r.jsx(a_,{paged:h,fullHeight:!0,children:r.jsx("ul",{className:"space-y-1 text-sm",children:h.items.map((y,S)=>r.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx(Fe,{tone:JL[y.engine]||"muted",children:y.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:y.title||y.id}),r.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[r.jsx("span",{className:"shrink-0",children:y.id}),y.cwd&&r.jsxs("span",{className:"truncate",children:["· ",y.cwd]})]})]}),y.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(y.mtime).toLocaleString()}),r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[r.jsx(Ye,{content:f("base.sessions_act_cmd"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_cmd"),onClick:()=>v(y),children:r.jsx(Ga,{size:13})})}),r.jsx(Ye,{content:f("base.sessions_act_ask",{name:t}),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_ask",{name:t}),onClick:()=>k(y),children:r.jsx(un,{size:13})})}),r.jsx(Ye,{content:f("base.sessions_act_folder"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_folder"),onClick:()=>N(y),children:r.jsx(Ef,{size:13})})}),r.jsx(Ye,{content:f("base.sessions_act_path"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_path"),onClick:()=>w(y),children:r.jsx(Ec,{size:13})})})]})]},`${y.engine}-${y.id}-${S}`))})})]})}function t6(){const e=Wn(),[t,a]=x.useState("open"),o=s_({key:`/tasks?state=${t}`,fetchPage:(l,c)=>Nr.globalPage({state:t,limit:l,offset:c}),resetKey:t});return r.jsxs(Ke,{fullHeight:!0,title:f("project.global_tasks.title"),description:f("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(ce,{size:"sm",variant:t===l?"primary":"ghost",onClick:()=>a(l),children:l},l))}),children:[o.isLoading&&r.jsx(lt,{}),!o.isLoading&&o.total===0&&r.jsx(xt,{children:f("project.global_tasks.empty")}),r.jsx(a_,{paged:o,fullHeight:!0,children:r.jsx("ul",{className:"space-y-2 text-sm",children:o.items.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:f("project.global_tasks.go_project"),children:r.jsx(Fe,{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(Fe,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[f("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})})]})}const rN=x.createContext(void 0);function r_(){const e=x.useContext(rN);if(e===void 0)throw new Error(nn(64));return e}let n6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const cp={tabActivationDirection:e=>({[n6.activationDirection]:e})},s6=x.forwardRef(function(t,a){const{className:o,defaultValue:l=0,onValueChange:c,orientation:u="horizontal",render:p,value:m,style:g,...h}=t,b=t.defaultValue!==void 0,v=x.useRef([]),[k,N]=x.useState(()=>new Map),[w,y]=Vl({controlled:m,default:l,name:"Tabs",state:"value"}),S=m!==void 0,[C,E]=x.useState(()=>new Map),R=x.useRef(void 0),A=x.useCallback(me=>{if(me===void 0)return null;for(const[Te,ie]of C.entries())if(ie!=null&&me===(ie.value??ie.index))return Te;return null},[C]),[T,M]=x.useState(()=>({previousValue:w,tabActivationDirection:"none"})),{previousValue:z,tabActivationDirection:I}=T;let P=I,H=!1;z!==w&&(P=Xj(z,w,u,C),H=z!=null&&w!=null&&A(w)==null);const D=H?z:w,B=z!==D||I!==P;De(()=>{B&&M({previousValue:D,tabActivationDirection:P})},[D,B,P]);const V=Ue((me,Te)=>{const ie=Xj(w,me,u,C);Te.activationDirection=ie,c?.(me,Te),!Te.isCanceled&&y(me)}),$=Ue((me,Te)=>{c?.(me,nt(Te,void 0,void 0,{activationDirection:"none"}))}),q=Ue((me,Te)=>{N(ie=>{if(ie.get(me)===Te)return ie;const pe=new Map(ie);return pe.set(me,Te),pe})}),Y=Ue((me,Te)=>{N(ie=>{if(!ie.has(me)||ie.get(me)!==Te)return ie;const pe=new Map(ie);return pe.delete(me),pe})}),K=x.useCallback(me=>k.get(me),[k]),F=x.useCallback(me=>{for(const Te of C.values())if(me===Te?.value)return Te?.id},[C]),X=x.useMemo(()=>({getTabElementBySelectedValue:A,getTabIdByPanelValue:F,getTabPanelIdByValue:K,onValueChange:V,orientation:u,registerMountedTabPanel:q,setTabMap:E,unregisterMountedTabPanel:Y,tabActivationDirection:P,value:w}),[A,F,K,V,u,q,E,Y,P,w]),L=x.useMemo(()=>{for(const me of C.values())if(me!=null&&me.value===w)return me},[C,w]),G=x.useMemo(()=>{for(const me of C.values())if(me!=null&&!me.disabled)return me.value},[C]),Z=x.useRef(!b),ee=x.useRef(l),de=x.useRef(b),fe=x.useRef(!1);De(()=>{if(S)return;function me(Se,je){y(Se),M(Be=>Be.previousValue===Se&&Be.tabActivationDirection==="none"?Be:{previousValue:Se,tabActivationDirection:"none"}),$(Se,je),Z.current=!1}if(C.size===0){fe.current&&w!==null&&!R.current?.isConnected&&me(null,I1);return}fe.current=!0,R.current=C.keys().next().value;const Te=L?.disabled,ie=L==null&&w!==null;if(!Te&&w===ee.current&&(de.current=!1),de.current&&Te&&w===ee.current)return;const pe=Z.current;if(Te||ie){const Se=G??null;if(w===Se){Z.current=!1;return}let je=I1;pe?je=B1:Te&&(je=mS),me(Se,je);return}pe&&L!=null&&($(w,B1),Z.current=!1)},[G,S,$,L,y,C,w]);const oe=Nt("div",t,{state:{orientation:u,tabActivationDirection:P},ref:a,props:h,stateAttributesMapping:cp});return r.jsx(rN.Provider,{value:X,children:r.jsx(sp,{elementsRef:v,children:oe})})});function Xj(e,t,a,o){if(e==null||t==null)return"none";let l=null,c=null;for(const[m,g]of o.entries()){if(g==null)continue;const h=g.value??g.index;if(e===h&&(l=m),t===h&&(c=m),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?a==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const u=l.getBoundingClientRect(),p=c.getBoundingClientRect();if(a==="horizontal"){if(p.left<u.left)return"left";if(p.left>u.left)return"right"}else{if(p.top<u.top)return"up";if(p.top>u.top)return"down"}return"none"}const oN="data-composite-item-active",lN=x.createContext(void 0);function a6(){const e=x.useContext(lN);if(e===void 0)throw new Error(nn(65));return e}const r6=x.forwardRef(function(t,a){const{className:o,disabled:l=!1,render:c,value:u,id:p,nativeButton:m=!0,style:g,...h}=t,{value:b,getTabPanelIdByValue:v,orientation:k,tabActivationDirection:N}=r_(),{activateOnFocus:w,highlightedTabIndex:y,onTabActivation:S,registerTabResizeObserverElement:C,setHighlightedTabIndex:E,tabsListElement:R}=a6(),A=Ys(p),T=x.useMemo(()=>({disabled:l,id:A,value:u}),[l,A,u]),{compositeProps:M,compositeRef:z,index:I}=W2({metadata:T}),P=u===b,H=x.useRef(!1),D=x.useRef(null);De(()=>{const Z=D.current;if(Z)return C(Z)},[C]),De(()=>{if(H.current){H.current=!1;return}if(!(P&&I>-1&&y!==I))return;const Z=R;if(Z!=null){const ee=qn(mt(Z));if(ee&&Qe(Z,ee))return}l||E(I)},[P,I,y,E,l,R]);const{getButtonProps:B,buttonRef:V}=Hr({disabled:l,native:m,focusableWhenDisabled:!0}),$=v(u),q=x.useRef(!1),Y=x.useRef(!1);function K(Z){P||l||S(u,nt(fa,Z.nativeEvent,void 0,{activationDirection:"none"}))}function F(Z){P||(I>-1&&!l&&E(I),!l&&w&&(!q.current||q.current&&Y.current)&&S(u,nt(fa,Z.nativeEvent,void 0,{activationDirection:"none"})))}function X(Z){if(P||l)return;q.current=!0;function ee(){q.current=!1,Y.current=!1}(!Z.button||Z.button===0)&&(Y.current=!0,mt(Z.currentTarget).addEventListener("pointerup",ee,{once:!0}))}return Nt("button",t,{state:{disabled:l,active:P,orientation:k,tabActivationDirection:N},ref:[a,V,z,D],props:[M,{role:"tab","aria-controls":$,"aria-selected":P,id:A,onClick:K,onFocus:F,onPointerDown:X,[oN]:P?"":void 0,onKeyDownCapture(){H.current=!0}},h,B],stateAttributesMapping:cp})});let o6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=yo.startingStyle]="startingStyle",e[e.endingStyle=yo.endingStyle]="endingStyle",e})({});const l6={...cp,...Ja},i6=x.forwardRef(function(t,a){const{className:o,value:l,render:c,keepMounted:u=!1,style:p,...m}=t,{value:g,getTabIdByPanelValue:h,orientation:b,tabActivationDirection:v,registerMountedTabPanel:k,unregisterMountedTabPanel:N}=r_(),w=Ys(),y=x.useMemo(()=>({id:w,value:l}),[w,l]),{ref:S,index:C}=Gc({metadata:y}),E=l===g,{mounted:R,transitionStatus:A,setMounted:T}=ti(E),M=!R,z=h(l),I={hidden:M,orientation:b,tabActivationDirection:v,transitionStatus:A},P=x.useRef(null),H=Nt("div",t,{state:I,ref:[a,S,P],props:[{"aria-labelledby":z,hidden:M,id:w,role:"tabpanel",tabIndex:E?0:-1,inert:Zf(!E),[o6.index]:C},m],stateAttributesMapping:l6});return ga({open:E,ref:P,onComplete(){E||T(!1)}}),De(()=>{if(!(M&&!u)&&w!=null)return k(l,w),()=>{N(l,w)}},[M,u,l,w,k,N]),u||R?H:null}),c6=[];function u6(e){const{loopFocus:t=!0,orientation:a="both",grid:o,onLoop:l,direction:c,highlightedIndex:u,onHighlightedIndexChange:p,rootRef:m,enableHomeAndEndKeys:g=!1,stopEventPropagation:h=!1,disabledIndices:b,modifierKeys:v=c6}=e,[k,N]=x.useState(0),w=o!=null,y=x.useRef(null),S=Ka(y,m),C=x.useRef([]),E=x.useRef(!1),R=u??k,A=Ue((P,H=!1)=>{if((p??N)(P),H){const D=C.current[P];jj(y.current,D,c,a)}}),T=Ue(P=>{if(P.size===0||E.current)return;E.current=!0;const H=Array.from(P.keys()),D=H.find(V=>V?.hasAttribute(oN))??null,B=D?H.indexOf(D):-1;if(B!==-1)A(B);else if(ef(H,R,b)){const V=Va(H,{disabledIndices:b});vc(H,V)||A(V)}jj(y.current,D,c,a)});De(()=>{if(b==null||u!=null||!E.current)return;const P=C.current;if(ef(P,R,b)){const H=Va(P,{disabledIndices:b});vc(P,H)||A(H)}},[b,u,R,C,A]);const M=Ue((P,H,D)=>l?l(P,H,D,C):D),z=Ue(P=>{const H=g?np:V2;if(!H.has(P.key)||d6(P,v)||!y.current)return;const B=c==="rtl",V=B?cf:uf,$={horizontal:V,vertical:wc,both:V}[a],q=B?uf:cf,Y={horizontal:q,vertical:jc,both:q}[a],K=Un(P.nativeEvent);if(K!=null&&yj(K)&&!J2(K)){const de=K.selectionStart,fe=K.selectionEnd,ae=K.value??"";if(de==null||P.shiftKey||de!==fe||P.key!==Y&&de<ae.length||P.key!==$&&de>0)return}let F=R;const X=Id(C,b),L=Zh(C,b);o!=null&&(F=o({disabledIndices:b,elementsRef:C,event:P,highlightedIndex:R,loopFocus:t,maxIndex:L,minIndex:X,onLoop:M,orientation:a,rtl:B}));const G={horizontal:[V],vertical:[wc],both:[V,wc]}[a],Z={horizontal:[q],vertical:[jc],both:[q,jc]}[a],ee=w?H:{horizontal:g?iz:U2,vertical:g?cz:H2,both:H}[a];g&&(P.key===ep?F=X:P.key===tp&&(F=L)),F===R&&(G.includes(P.key)||Z.includes(P.key))&&(t&&F===L&&G.includes(P.key)?(F=X,l&&(F=l(P,R,F,C))):t&&F===X&&Z.includes(P.key)?(F=L,l&&(F=l(P,R,F,C))):F=Va(C.current,{startingIndex:F,decrement:Z.includes(P.key),disabledIndices:b})),F!==R&&!vc(C.current,F)&&(h&&P.stopPropagation(),ee.has(P.key)&&P.preventDefault(),A(F,!0),queueMicrotask(()=>{C.current[F]?.focus()}))});return{props:{ref:S,onFocus(P){const H=y.current,D=Un(P.nativeEvent);!H||D==null||!yj(D)||D.setSelectionRange(0,D.value.length??0)},onKeyDown:z},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:C,disabledIndices:b,onMapChange:T,relayKeyboardEvent:z}}function d6(e,t){for(const a of mz.values())if(!t.includes(a)&&e.getModifierState(a))return!0;return!1}function f6(e){const{render:t,className:a,style:o,refs:l=Ya,props:c=Ya,state:u=qt,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:g,orientation:h,grid:b,loopFocus:v,onLoop:k,enableHomeAndEndKeys:N,onMapChange:w,stopEventPropagation:y=!0,rootRef:S,disabledIndices:C,modifierKeys:E,highlightItemOnHover:R=!1,tag:A="div",...T}=e,M=Qf(),{props:z,highlightedIndex:I,onHighlightedIndexChange:P,elementsRef:H,onMapChange:D,relayKeyboardEvent:B}=u6({grid:b,loopFocus:v,onLoop:k,orientation:h,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:S,stopEventPropagation:y,enableHomeAndEndKeys:N,direction:M,disabledIndices:C,modifierKeys:E}),V=Nt(A,e,{state:u,ref:l,props:[z,...c,T],stateAttributesMapping:p}),$=x.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:P,highlightItemOnHover:R,relayKeyboardEvent:B}),[I,P,R,B]);return r.jsx(O2.Provider,{value:$,children:r.jsx(sp,{elementsRef:H,onMapChange:q=>{w?.(q),D(q)},children:V})})}const p6=x.forwardRef(function(t,a){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:u,style:p,...m}=t,{onValueChange:g,orientation:h,value:b,setTabMap:v,tabActivationDirection:k}=r_(),[N,w]=x.useState(0),[y,S]=x.useState(null),C=x.useRef(new Set),E=x.useRef(new Set),R=x.useRef(null);De(()=>{if(typeof ResizeObserver>"u")return;const H=new ResizeObserver(()=>{C.current.forEach(D=>{D()})});return R.current=H,y&&H.observe(y),E.current.forEach(D=>{H.observe(D)}),()=>{H.disconnect(),R.current=null}},[y]);const A=Ue(H=>(C.current.add(H),()=>{C.current.delete(H)})),T=Ue(H=>(E.current.add(H),R.current?.observe(H),()=>{E.current.delete(H),R.current?.unobserve(H)})),M=Ue((H,D)=>{H!==b&&g(H,D)}),z={orientation:h,tabActivationDirection:k},I={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},P=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:N,registerIndicatorUpdateListener:A,registerTabResizeObserverElement:T,onTabActivation:M,setHighlightedTabIndex:w,tabsListElement:y}),[o,N,A,T,M,w,y]);return r.jsx(lN.Provider,{value:P,children:r.jsx(f6,{render:u,className:l,style:p,state:z,refs:[a,S],props:[I,m],stateAttributesMapping:cp,highlightedIndex:N,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:w,onMapChange:v,disabledIndices:Ya})})});function up({className:e,...t}){return r.jsx(s6,{"data-slot":"tabs",className:St("flex flex-col gap-4",e),...t})}const m6=Yb("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 dp({className:e,variant:t="default",...a}){return r.jsx(p6,{"data-slot":"tabs-list","data-variant":t,className:St(m6({variant:t}),e),...a})}function aa({className:e,...t}){return r.jsx(r6,{"data-slot":"tabs-trigger",className:St("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),...t})}function Ds({className:e,...t}){return r.jsx(i6,{"data-slot":"tabs-content",className:St("text-sm outline-none",e),...t})}function Qj(e,t){let a=e;for(const o of t.split(".")){if(!a||typeof a!="object"||Array.isArray(a))return;a=a[o]}return a}function o_(e,t=""){const a={};for(const[o,l]of Object.entries(e)){const c=t?`${t}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(a,o_(l,c)):a[c]=l}return a}function g6(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function xx({sections:e,source:t,placeholderSource:a,jsonTitle:o,jsonDescription:l,saveLabel:c=f("common.save"),onSaveFields:u,onSaveJson:p,busy:m}){const g=e[0]?.key||"json",[h,b]=x.useState({}),[v,k]=x.useState(""),[N,w]=x.useState("");x.useEffect(()=>{const E={};for(const R of e.flatMap(A=>A.fields))E[R.path]=Qj(t,R.path)??"";b(E),k(JSON.stringify(t||{},null,2)),w("")},[t,e]);const y=x.useMemo(()=>new Set(e.flatMap(E=>E.fields.map(R=>R.path))),[e]),S=async()=>{const E={},R=[];for(const A of e.flatMap(T=>T.fields)){const T=h[A.path];if(!is(T)){if(T===""||T===void 0||T===null){R.push(A.path);continue}if(A.kind==="number"){const M=Number(T);Number.isFinite(M)&&(E[A.path]=M)}else E[A.path]=T}}await u(E,R.filter(A=>y.has(A)))},C=async()=>{w("");try{await p(g6(v))}catch(E){w(E.message)}};return r.jsxs(up,{defaultValue:g,className:"space-y-4",children:[r.jsxs(dp,{className:"flex flex-wrap",children:[e.map(E=>r.jsx(aa,{value:E.key,children:E.label},E.key)),r.jsx(aa,{value:"json",children:"JSON"})]}),e.map(E=>r.jsx(Ds,{value:E.key,children:r.jsxs("div",{className:"space-y-4",children:[E.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:E.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:E.fields.map(R=>r.jsx(h6,{field:R,value:h[R.path],inherited:Qj(a,R.path),onChange:A=>b(T=>({...T,[R.path]:A}))},R.path))}),r.jsx(ce,{variant:"primary",loading:m,onClick:S,children:c})]})},E.key)),r.jsx(Ds,{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(Mn,{rows:18,className:"font-mono text-xs",value:v,onChange:E=>k(E.target.value)}),N&&r.jsx("p",{className:"text-xs text-destructive",children:N}),r.jsx(ce,{variant:"primary",loading:m,onClick:C,children:f("settings_ui.save_json")})]})})]})}function h6({field:e,value:t,inherited:a,onChange:o}){const l=e.placeholder||Wj(a)||(is(t)?Ar(t):""),c=e.hint||(a!==void 0?`Heredado: ${Wj(a)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(Ft,{checked:t===!0,onChange:o,label:e.label})}):r.jsx(le,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(bt,{value:String(t||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(u=>({value:String(u.value),label:u.label}))]}):e.kind==="textarea"?r.jsx(Mn,{rows:4,value:String(t||""),placeholder:l,onChange:u=>o(u.target.value)}):r.jsx(Ne,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(is(t)?"":t||""),placeholder:e.kind==="password"&&is(t)?Ar(t):e.kind==="password"&&is(a)?Ar(a):l,onChange:u=>o(u.target.value)})})}function Wj(e){return e==null||e===""?"":is(e)?Ar(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function x6(){return[{key:"routing",label:f("settings_ui.cfg_overrides_label"),description:f("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:f("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:f("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:f("settings_ui.cfg_permission_mode"),kind:"select",options:$x.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:f("settings_ui.cfg_extra_prompt"),kind:"textarea"}]},{key:"telegram",label:f("settings_ui.cfg_telegram_label"),fields:[{path:"telegram.route_to_agent",label:f("settings_ui.cfg_route_to_agent")},{path:"telegram.chat_id",label:f("settings_ui.cfg_chat_id")},{path:"telegram.bot_token",label:f("settings_ui.cfg_bot_token"),kind:"password"},{path:"telegram.respond_with_engine",label:f("settings_ui.cfg_respond_with_engine"),kind:"boolean"}]},{key:"engines",label:f("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:f("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:f("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:f("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:f("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:f("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:f("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function b6(){return[{key:"identity",label:f("settings_ui.cfg_project_label"),description:f("settings_ui.cfg_project_desc"),fields:[{path:"name",label:f("settings_ui.cfg_name")},{path:"version",label:f("settings_ui.cfg_version")},{path:"apf",label:f("settings_ui.cfg_apc_spec")},{path:"apx",label:f("settings_ui.cfg_apx_install")},{path:"apx_id",label:f("settings_ui.cfg_apx_storage_id")}]}]}function _6({pid:e}){const t=rt(),a=Wn(),{project:o,mutate:l}=Fb(e),c=et(`/projects/${e}/config`,()=>ls.config.show(e)),u=String(e)==="0";if(c.isLoading)return r.jsx(lt,{});if(!c.data)return r.jsx(xt,{children:f("project.config.no_data")});const p=async g=>{await ls.apcProject.put(e,g),t.success(f("project.config.save_project")),c.mutate()},m=async g=>{await ls.config.put(e,g),t.success(f("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("project.config.section_title"),description:f("project.config.section_desc"),children:r.jsxs(up,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(dp,{children:[r.jsx(aa,{value:"override",children:"Override"}),r.jsx(aa,{value:"project",children:"APC project"}),r.jsx(aa,{value:"effective",children:"Effective"})]}),r.jsx(Ds,{value:"override",children:r.jsx(xx,{sections:x6(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(g,h)=>{await ls.config.set(e,g),h.length&&await ls.config.unset(e,h),t.success(f("project.config.save_fields_success")),c.mutate()},onSaveJson:m})}),r.jsx(Ds,{value:"project",children:r.jsx(xx,{sections:b6(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(g,h)=>{await ls.apcProject.set(e,y6(g),h),t.success(f("project.config.save_meta_success")),c.mutate()},onSaveJson:p})}),r.jsx(Ds,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("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)})]})})]})}),!u&&o?r.jsx(v6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),a("/")}}):null]})}function v6({pid:e,label:t,onRebuilt:a,onUnregistered:o}){const l=rt(),[c,u]=x.useState(null),[p,m]=x.useState(null),g=async()=>{u("rebuild");try{await ls.rebuild(e),l.success(f("project.rebuild_done")),a()}catch(b){l.error(b.message)}finally{u(null),m(null)}},h=async()=>{u("unregister");try{await ls.remove(e),l.success(f("project.unregistered")),o()}catch(b){l.error(b.message)}finally{u(null),m(null)}};return r.jsxs(r.Fragment,{children:[r.jsx(Ke,{title:f("project.danger.title"),description:f("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:f("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.rebuild_desc")})]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[r.jsx(ua,{size:13})," ",f("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:f("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.unregister_desc")})]}),r.jsxs(ce,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[r.jsx(Zn,{size:13})," ",f("admin.unregister")]})]})]})}),r.jsx(On,{open:p==="rebuild",onClose:()=>c?null:m(null),title:f("project.danger.rebuild_confirm_title"),description:f("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:g,loading:c==="rebuild",children:f("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.rebuild_long")})}),r.jsx(On,{open:p==="unregister",onClose:()=>c?null:m(null),title:f("project.danger.unregister_confirm_title"),description:f("project.unregister_confirm",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ce,{variant:"destructive",onClick:h,loading:c==="unregister",children:f("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.unregister_long")})})]})}function y6(e){const t={};for(const[a,o]of Object.entries(o_(e)))is(o)||(t[a]=o);return t}const j6=["","es","en","pt","fr","it","de"],Zj=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function iN(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Fa}:{gradient:"from-slate-600 to-gray-600",Icon:un}}function w6(e){const t=e.filter(u=>u.is_master),a=t.length===1?t[0]:null,o=u=>u.parent?u.parent:a&&!u.is_master&&u.slug!==a.slug?a.slug:null,l=new Map,c=[];for(const u of e){const p=o(u);p&&e.some(m=>m.slug===p)?(l.has(p)||l.set(p,[]),l.get(p).push(u)):c.push(u)}return{roots:c,childrenByParent:l}}function k6({pid:e}){const t=Wn();rt();const a=et(`/projects/${e}/agents`,()=>rn.list(e)),[o,l]=x.useState("hierarchy"),[c,u]=x.useState(!1),[p,m]=x.useState(!1),g=a.data||[],h=N=>t(`/p/${e}/agents/${N}`),b=N=>t(N?`/p/${e}/chat?agent=${N}`:`/p/${e}/chat`),{roots:v,childrenByParent:k}=x.useMemo(()=>w6(g),[g]);return r.jsxs(Ke,{title:f("project.agents.title"),description:f("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:ze("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(Ix,{size:13})," ",f("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:ze("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(DM,{size:13})," ",f("project.agents.list_view")]})]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[r.jsx(YM,{size:13})," ",f("project.agents.import")]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(Fs,{size:13})," ",f("project.agents.chat")]}),r.jsxs(ce,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>u(!0),children:[r.jsx(tn,{size:14})," ",f("project.agents.new")]})]}),children:[a.isLoading&&r.jsx(lt,{}),!a.isLoading&&g.length===0&&r.jsx(xt,{children:f("project.agents.empty_text")}),!a.isLoading&&g.length>0&&(o==="hierarchy"?r.jsx(C6,{roots:v,childrenByParent:k,onOpen:h,onChat:b}):r.jsx(N6,{agents:g,onOpen:h,onChat:b})),r.jsx(E6,{open:c,pid:e,agents:g,onClose:()=>u(!1),onCreated:()=>{u(!1),a.mutate()}}),r.jsx(S6,{open:p,pid:e,existing:g.map(N=>N.slug),onClose:()=>m(!1),onImported:()=>a.mutate()})]})}function S6({open:e,onClose:t,onImported:a,pid:o,existing:l}){const c=rt(),u=et(e?"/agents/vault":null,()=>rn.vault()),[p,m]=x.useState(""),g=u.data||[],h=async b=>{m(b);try{await rn.import(o,b),c.success(f("project.agents.import_success",{slug:b})),a()}catch(v){c.error(v.message)}finally{m("")}};return r.jsxs(On,{open:e,onClose:t,title:f("project.agents.import_title"),description:f("project.agents.import_desc"),size:"lg",footer:r.jsx(ce,{variant:"ghost",onClick:t,children:f("common.close")}),children:[u.isLoading&&r.jsx(lt,{}),!u.isLoading&&g.length===0&&r.jsx(xt,{children:f("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:g.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(un,{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(Fe,{tone:"success",children:[r.jsx(Fa,{size:9})," ",f("project.agents.orchestrator")]}),b.model&&r.jsx(Fe,{tone:"info",children:b.model})]}),b.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),r.jsx(ce,{size:"sm",variant:"primary",disabled:v||p===b.slug,loading:p===b.slug,onClick:()=>h(b.slug),children:f(v?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function C6({roots:e,childrenByParent:t,onOpen:a,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=t.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(sh,{agent:l,onOpen:a,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(u=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(sh,{agent:u,onOpen:a,onChat:o}),(t.get(u.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:(t.get(u.slug)||[]).map(p=>r.jsx(sh,{agent:p,onOpen:a,onChat:o,compact:!0},p.slug))})]})]},u.slug))})]})]},l.slug)})})}function sh({agent:e,onOpen:t,onChat:a,wide:o,compact:l}){const{gradient:c,Icon:u}=iN(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:ze("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:()=>t(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:ze("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(u,{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(Fe,{tone:"success",children:[r.jsx(Fa,{size:9})," ",f("project.agents.orchestrator")]}),e.role&&r.jsx(Fe,{children:e.role}),e.model&&!l&&r.jsx(Fe,{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:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(Nf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>a(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Fs,{size:12})," ",f("project.agents.chat")]})]})]})}function N6({agents:e,onOpen:t,onChat:a}){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:u}=iN(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:()=>t(l.slug),children:[r.jsx("div",{className:ze("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(u,{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(Fe,{tone:"success",children:[r.jsx(Fa,{size:10})," ",f("project.agents.orchestrator")]}),l.role&&r.jsx(Fe,{children:l.role}),l.model&&r.jsx(Fe,{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(p=>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(pa,{size:9})," ",p]},p)),l.tools?.map(p=>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})," ",p]},p))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(Nf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>a(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Fs,{size:12})," ",f("project.agents.chat")]})]})]},l.slug)})})}function E6({open:e,onClose:t,onCreated:a,pid:o,agents:l}){const c=rt(),[u,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[v,k]=x.useState(""),[N,w]=x.useState(""),[y,S]=x.useState(""),[C,E]=x.useState(""),[R,A]=x.useState(!1),[T,M]=x.useState(""),[z,I]=x.useState(!1),P=()=>{p(""),g(""),b(""),k(""),w(""),S(""),E(""),A(!1),M("")},H=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(u)){c.error(f("project.agents.slug_invalid"));return}I(!0);try{await rn.create(o,{slug:u,role:m||void 0,model:h||void 0,language:v||void 0,description:N||void 0,skills:Zj(y),tools:Zj(C),is_master:R,parent:T||void 0}),c.success(f("project.agents.create_success",{slug:u})),a(),P()}catch(D){c.error(D?.message||f("project.agents.create_error"))}finally{I(!1)}};return r.jsx(On,{open:e,onClose:t,title:f("project.agents.new_title"),description:f("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:z,children:f("common.cancel")}),r.jsx(ce,{variant:"primary","data-testid":"agent-create-submit",onClick:H,loading:z,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.agents.slug_label"),children:r.jsx(Ne,{autoFocus:!0,"data-testid":"agent-slug",value:u,onChange:D=>p(D.target.value),placeholder:f("project.agents.slug_ph")})}),r.jsx(le,{label:f("project.agents.role_label"),children:r.jsx(Ne,{value:m,onChange:D=>g(D.target.value),placeholder:f("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.agents.model_label"),hint:f("project.agents.model_hint"),children:r.jsx(Ne,{value:h,onChange:D=>b(D.target.value)})}),r.jsx(le,{label:f("project.agents.lang_label"),children:r.jsx(bt,{value:v,onChange:k,options:j6.map(D=>({value:D,label:D||"—"}))})})]}),r.jsx(le,{label:f("project.agents.desc_label"),children:r.jsx(Mn,{rows:2,value:N,onChange:D=>w(D.target.value),placeholder:f("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.agents.skills_label"),children:r.jsx(Ne,{value:y,onChange:D=>S(D.target.value),placeholder:f("project.agents.skills_ph")})}),r.jsx(le,{label:f("project.agents.tools_label"),children:r.jsx(Ne,{value:C,onChange:D=>E(D.target.value),placeholder:f("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(le,{label:f("project.agents.parent_label"),hint:f("project.agents.parent_hint"),children:r.jsx(bt,{value:T,onChange:M,placeholder:f("project.agents.none_parent"),options:[{value:"",label:f("project.agents.none_parent")},...l.filter(D=>D.slug!==u).map(D=>({value:D.slug,label:D.slug}))]})}),r.jsx(Ft,{checked:R,onChange:A,label:f("project.agents.master_label")})]})]})})}function Rd(e){return e.split(`
|
|
623
|
+
`).map(t=>t.trim()).filter(Boolean)}function Pc(){return{exec_agent:{label:f("agents_ui.kind_exec_agent"),desc:f("agents_ui.kind_exec_agent_desc"),icon:un},super_agent:{label:f("agents_ui.kind_super_agent"),desc:f("agents_ui.kind_super_agent_desc"),icon:Fa},telegram:{label:f("agents_ui.kind_telegram"),desc:f("agents_ui.kind_telegram_desc"),icon:Fs},shell:{label:f("agents_ui.kind_shell"),desc:f("agents_ui.kind_shell_desc"),icon:Ga},heartbeat:{label:f("agents_ui.kind_heartbeat"),desc:f("agents_ui.kind_heartbeat_desc"),icon:Dl}}}function R6(e){const t=Pc();return Object.keys(t).filter(a=>a!=="heartbeat"||e==="heartbeat").map(a=>({value:a,label:t[a].label,description:t[a].desc,icon:t[a].icon}))}function l_(e){if(!e)return"—";if(e.startsWith("every:")){const t=e.slice(6),a=t.match(/^(\d+)(s|m|h|d)$/);if(a){const o=a[1],l={s:f("agents_ui.unit_seconds"),m:f("agents_ui.unit_minutes"),h:f("agents_ui.unit_hours"),d:f("agents_ui.unit_days")}[a[2]]||a[2];return f("agents_ui.every_n_unit",{n:o,unit:l})}return f("agents_ui.every_v",{v:t})}return e.startsWith("once:")?`once · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}function T6(){return[{label:f("agents_ui.preset_every_10m"),value:"every:10m"},{label:f("agents_ui.preset_hourly"),value:"every:1h"},{label:f("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:f("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function cN(){return[{v:"{{pre_output}}",where:"prompt",desc:f("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:f("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:f("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:f("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:f("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:f("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:f("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:f("agents_ui.var_routine")}]}function sc(e){return cN().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function A6({routines:e,selectedName:t,onSelect:a}){return r.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[r.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.list_title")}),r.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const l=Pc()[o.kind],c=l?.icon||Pl,u=o.name===t;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>a(o.name),"aria-current":u,className:ze("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",u?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:ze("flex size-6 shrink-0 items-center justify-center rounded-md",o.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(c,{size:13})}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&r.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:f("project.routines.paused")}),r.jsx(Qc,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),r.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:l?.label||o.kind}),r.jsxs("span",{className:"shrink-0",children:["⏱ ",l_(o.schedule)]})]})]})},o.name)})})]})}function M6({title:e,body:t,mono:a}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:ze("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",a&&"font-mono"),children:t.trim()?t:r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")})})]})}function uN(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function dN(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function fN({st:e}){return e==="ok"?r.jsx(ho,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?r.jsx(Gs,{size:13,className:"shrink-0 text-destructive"}):r.jsx(tM,{size:13,className:"shrink-0 text-amber-500"})}function pN(e){return f(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function ah({title:e,children:t}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const rh="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function O6({m:e,onClose:t}){const a=uN(e),o=e.meta||{},l=o.result||{},c=o.flow||null,u=String(l.reply??l.text??l.stdout??""),p=String(l.error??l.stderr??""),m=String(l.note??""),g=r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")});return r.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx(fN,{st:a}),r.jsx("span",{className:ze("font-medium",a==="ok"&&"text-emerald-500",a==="error"&&"text-destructive",a==="skipped"&&"text-amber-500"),children:pN(a)}),r.jsx("span",{className:"font-mono text-muted-fg",children:dN(e.ts)})]}),r.jsx("button",{type:"button",onClick:t,"aria-label":f("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:r.jsx(Gs,{size:14})})]}),r.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&r.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&r.jsx(ah,{title:f("project.routines.block_pre"),children:c.pre.output?.trim()?r.jsx("pre",{className:rh,children:c.pre.output}):g}),r.jsx(ah,{title:f("project.routines.runs_output"),children:u?r.jsx("pre",{className:rh,children:u}):p?r.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg bg-destructive/10 px-3 py-2 font-mono text-[11px] text-destructive",children:p}):m?r.jsx("div",{className:"text-muted-fg",children:m}):g}),c?.post&&c.post.length>0&&r.jsx(ah,{title:f("project.routines.block_post"),children:r.jsx("div",{className:"space-y-1.5",children:c.post.map((h,b)=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",h.cmd," ",r.jsxs("span",{className:"opacity-70",children:["· exit ",h.exit]})]}),(h.stdout||h.stderr)&&r.jsx("pre",{className:rh,children:h.stdout||h.stderr})]},b))})})]})]})}function z6({pid:e,name:t,running:a}){const o=et(`/projects/${e}/routines/${t}/runs`,async()=>(await ff.project(e,{channel:"routine",limit:200})).filter(g=>g.meta?.routine===t&&(g.actor_id==="apx:routine"||g.type==="system"))),l=(o.data||[]).slice(0,50),[c,u]=x.useState(null),p=c&&l.find(m=>m.ts===c)||null;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[r.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.runs_title")}),r.jsxs("div",{className:ze("grid min-h-0 flex-1 overflow-hidden",p?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[r.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&r.jsx(lt,{}),!o.isLoading&&l.length===0&&r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.routines.runs_empty")}),r.jsxs("ul",{className:"space-y-1",children:[a&&r.jsx("li",{children:r.jsxs("div",{className:"flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs",children:[r.jsx(vs,{size:12}),r.jsx("span",{className:"text-muted-fg",children:f("project.routines.running")})]})}),l.map((m,g)=>{const h=uN(m),b=c===m.ts;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>u(b?null:m.ts),"aria-current":b,className:ze("flex w-full items-center gap-2 rounded-md border px-3 py-1.5 text-left text-xs transition-colors",b?"border-primary/50 bg-primary/10":"border-border bg-muted/30 hover:border-muted-fg/40"),children:[r.jsx(fN,{st:h}),r.jsx("span",{className:"font-mono text-muted-fg",children:dN(m.ts)}),r.jsx("span",{className:ze("font-medium",h==="ok"&&"text-emerald-500",h==="error"&&"text-destructive",h==="skipped"&&"text-amber-500"),children:pN(h)})]})},`${m.ts}-${g}`)})]})]}),p&&r.jsx(O6,{m:p,onClose:()=>u(null)})]})]})}function D6({pid:e,routine:t,onEdit:a,onRun:o,onToggle:l,onDelete:c,running:u}){const p=Pc()[t.kind],m=p?.icon||Pl,g=t.spec||{},h=t.pre_commands||[],b=t.post_commands||[],v=[];return h.length&&v.push({title:f("project.routines.block_pre"),body:h.join(`
|
|
624
|
+
`),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?v.push({title:f("project.routines.block_prompt"),body:String(g.prompt||"")}):t.kind==="telegram"?v.push({title:f("project.routines.block_text"),body:String(g.text||"")}):t.kind==="shell"?v.push({title:f("project.routines.block_command"),body:String(g.command||""),mono:!0}):t.kind==="heartbeat"&&v.push({title:f("project.routines.block_text"),body:String(g.message||"")}),b.length&&v.push({title:f("project.routines.block_post"),body:b.join(`
|
|
625
|
+
`),mono:!0}),r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:ze("flex size-7 shrink-0 items-center justify-center rounded-lg",t.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(m,{size:14})}),r.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),r.jsx(Fe,{tone:t.kind==="shell"?"warning":"info",children:p?.label||t.kind})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(Ft,{checked:t.enabled,onChange:l}),r.jsx(Ye,{content:f("common.run"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:o,loading:u,children:r.jsx(Hx,{size:13})})}),r.jsx(Ye,{content:f("project.routines.edit_hint"),children:r.jsxs(ce,{size:"sm",variant:"secondary",onClick:a,children:[r.jsx(Eo,{size:13})," ",f("project.routines.edit_btn")]})}),r.jsx(Ye,{content:f("common.delete"),children:r.jsx(ce,{size:"sm",variant:"destructive",onClick:c,children:r.jsx(Zn,{size:13})})})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",l_(t.schedule)]}),t.next_run_at&&r.jsxs("span",{children:[f("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&r.jsxs("span",{children:[f("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),r.jsxs("span",{className:ze(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[f("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&r.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),r.jsx("div",{className:"space-y-3",children:v.map(k=>r.jsx(M6,{title:k.title,body:k.body,mono:k.mono},k.title))})]}),r.jsx(z6,{pid:e,name:t.name,running:u})]})}function _l({label:e,hint:t,value:a,onChange:o,vars:l,rows:c=3,mono:u,placeholder:p}){const m=x.useRef(null),g=h=>{const b=m.current?.querySelector("textarea");if(!b){o(a?`${a}${h}`:h);return}const v=b.selectionStart??a.length,k=b.selectionEnd??a.length,N=a.slice(0,v)+h+a.slice(k);o(N),requestAnimationFrame(()=>{b.focus();const w=v+h.length;b.setSelectionRange(w,w)})};return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&r.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),r.jsxs("div",{ref:m,className:"space-y-1.5",children:[r.jsx(Mn,{rows:c,className:ze(u&&"font-mono text-xs"),value:a,onChange:h=>o(h.target.value),placeholder:p}),l.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(h=>r.jsx("button",{type:"button",onClick:()=>g(h.v),className:"inline-flex items-center rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px] text-muted-fg transition-colors hover:border-muted-fg/50 hover:text-foreground",children:h.v},h.v))})]})]})}function P6(){return 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:f("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:cN().map(e=>r.jsx(Ye,{content:r.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:r.jsxs("span",{className:"inline-flex cursor-help items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[e.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function L6({draft:e,onClose:t,onSaved:a,pid:o}){const l=rt(),c=et(e?`/projects/${o}/agents`:null,()=>rn.list(o)),[u,p]=x.useState(!1),[m,g]=x.useState(""),[h,b]=x.useState("super_agent"),[v,k]=x.useState("every:10m"),[N,w]=x.useState(!0),[y,S]=x.useState(""),[C,E]=x.useState(""),[R,A]=x.useState("default"),[T,M]=x.useState(""),[z,I]=x.useState(""),[P,H]=x.useState(""),[D,B]=x.useState("heartbeat"),[V,$]=x.useState(""),[q,Y]=x.useState(""),[K,F]=x.useState(""),X=et(e&&h==="telegram"?"/telegram/channels":null,()=>An.channels.list());x.useEffect(()=>{if(!e)return;const ie=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),b(e.kind||"super_agent"),k(e.schedule||"every:10m"),w(e.enabled??!0),S(ie.agent||""),E(ie.prompt||""),A(ie.channel||"default"),M(ie.chat_id?String(ie.chat_id):""),I(ie.text||""),H(ie.command||""),B(ie.channel||"heartbeat"),$(ie.message||""),Y((e.pre_commands||[]).join(`
|
|
626
|
+
`)),F((e.post_commands||[]).join(`
|
|
627
|
+
`))},[e]);const L=h==="exec_agent"||h==="super_agent"||h==="telegram",G=()=>{switch(h){case"exec_agent":return{agent:y,prompt:C};case"super_agent":return{prompt:C};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:z};case"shell":return{command:P};case"heartbeat":return{channel:D,message:V}}},Z=async()=>{if(!m){l.error(f("project.routines.name_required"));return}p(!0);try{await Cr.upsert(o,{name:m,kind:h,schedule:v,enabled:N,spec:G(),pre_commands:L?Rd(q):[],post_commands:L?Rd(K):[]}),l.success(f("project.routines.saved")),a()}catch(ie){l.error(ie?.message||f("project.routines.save_error"))}finally{p(!1)}},ee=(()=>{const ie=X.data?.channels||[],pe=["default",...ie.map(je=>je.name)];R&&!pe.includes(R)&&pe.push(R);const Se=new Set;return pe.filter(je=>Se.has(je)?!1:(Se.add(je),!0)).map(je=>{const Be=ie.find(we=>we.name===je),Ve=Be?.project?`proyecto ${Be.project}`:Be?.chat_id?`chat ${Be.chat_id}`:void 0;return{value:je,label:je,description:Ve}})})(),de=L?Rd(q):[],fe=L?Rd(K):[],ae=(()=>{switch(h){case"exec_agent":return y?f("agents_ui.action_agent_answers",{agent:y}):f("agents_ui.action_agent_pick_answers");case"super_agent":return f("agents_ui.action_super_answers");case"telegram":return f("agents_ui.action_telegram_channel",{channel:R});case"shell":return P?f("agents_ui.summary_runs_cmd",{cmd:P.slice(0,48)}):f("agents_ui.action_runs_shell");case"heartbeat":return f("agents_ui.summary_heartbeat")}})(),oe=h==="telegram"?z:h==="shell"?P:h==="heartbeat"?V:C,me=Pc()[h].icon,Te=[...de.map((ie,pe)=>({id:`pre-${pe}`,icon:Ga,label:f("agents_ui.step_pre"),detail:ie,action:!1})),{id:"action",icon:me,label:ae,detail:oe?oe.slice(0,90):f("project.routines.block_empty"),action:!0},...fe.map((ie,pe)=>({id:`post-${pe}`,icon:Ga,label:f("agents_ui.step_post"),detail:ie,action:!1}))];return r.jsx(On,{open:!!e,onClose:t,title:e?.name?f("project.routines.edit_title",{name:e.name}):f("project.routines.new_title"),description:f("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:u,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:Z,loading:u,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",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(Ft,{checked:N,onChange:w,label:f("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:f(N?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsx(le,{label:f("project.routines.name_field"),hint:e?.name?f("project.routines.name_no_edit"):void 0,children:r.jsx(Ne,{value:m,disabled:!!e?.name,onChange:ie=>g(ie.target.value),placeholder:"resumen-diario"})}),r.jsx(le,{label:f("project.routines.kind_field"),children:r.jsx(bt,{value:h,onChange:ie=>b(ie),options:R6(h)})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Pc()[h].desc}),h==="exec_agent"&&r.jsx(le,{label:f("project.routines.agent_field"),hint:f("project.routines.agent_hint"),children:r.jsx(bt,{value:y,onChange:S,placeholder:c.isLoading?f("project.routines.agent_loading"):f("project.routines.agent_pick"),options:(c.data||[]).map(ie=>({value:ie.slug,label:ie.slug,description:[ie.role,ie.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(le,{label:f("project.routines.schedule_field"),hint:f("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[T6().map(ie=>r.jsx("button",{type:"button",onClick:()=>k(ie.value),className:ze("rounded-md border px-2 py-0.5 text-[11px]",v===ie.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ie.label},ie.value)),r.jsx("button",{type:"button",onClick:()=>k("manual"),className:ze("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:f("agents_ui.preset_manual")})]}),r.jsx(Ne,{value:v,onChange:ie=>k(ie.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),r.jsx(P6,{})]}),r.jsxs("div",{className:"space-y-3",children:[L&&r.jsx(_l,{label:f("project.routines.pre_field"),hint:f("project.routines.pre_hint"),rows:2,mono:!0,value:q,onChange:Y,vars:sc("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),h==="exec_agent"&&r.jsx(_l,{label:f("project.routines.prompt_exec"),rows:4,value:C,onChange:E,vars:sc("prompt"),placeholder:f("project.routines.prompt_exec_ph")}),h==="super_agent"&&r.jsx(_l,{label:f("project.routines.prompt_super"),rows:4,value:C,onChange:E,vars:sc("prompt"),placeholder:f("project.routines.prompt_super_ph")}),h==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.routines.tg_channel"),children:r.jsx(bt,{value:R,onChange:A,options:ee})}),r.jsx(le,{label:f("project.routines.tg_chat_id"),children:r.jsx(Ne,{value:T,onChange:ie=>M(ie.target.value),placeholder:f("agents_ui.tg_chat_id_ph")})})]}),r.jsx(_l,{label:f("project.routines.tg_text"),hint:f("project.routines.tg_text_hint"),rows:6,value:z,onChange:I,vars:sc("prompt"),placeholder:f("agents_ui.tg_text_ph")})]}),h==="shell"&&r.jsx(_l,{label:f("project.routines.shell_field"),hint:f("project.routines.shell_hint"),rows:11,mono:!0,value:P,onChange:H,vars:[],placeholder:"cd /repo && git pull && npm test"}),h==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.routines.hb_channel"),children:r.jsx(Ne,{value:D,onChange:ie=>B(ie.target.value),placeholder:"heartbeat"})}),r.jsx(le,{label:f("project.routines.hb_message"),children:r.jsx(Ne,{value:V,onChange:ie=>$(ie.target.value),placeholder:f("agents_ui.hb_message_ph")})})]}),L&&r.jsx(_l,{label:f("project.routines.post_field"),hint:f("project.routines.post_hint"),rows:2,mono:!0,value:K,onChange:F,vars:sc("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),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:[f("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",l_(v)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:Te.map((ie,pe)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:ze("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ie.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:ze("flex items-center gap-1.5 text-[11px] font-medium",ie.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(ie.icon,{size:12})," ",ie.label]}),ie.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ie.detail})]}),pe<Te.length-1&&r.jsx(Ik,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ie.id))})]})]})})}function I6({pid:e}){const t=rt(),a=et(`/projects/${e}/routines`,()=>Cr.list(e)),[o,l]=Cf(),[c,u]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(!1),[b,v]=x.useState(null),[k,N]=x.useState(null),w=a.data||[],y=o.get("r_id"),S=w.find(T=>T.name===y)||null,C=T=>l(M=>{const z=new URLSearchParams(M);return T?z.set("r_id",T):z.delete("r_id"),z},{replace:!0});x.useEffect(()=>{w.length!==0&&(y&&w.some(T=>T.name===y)||C(w[0].name))},[w,y]);const E=async T=>{try{await(T.enabled?Cr.disable:Cr.enable)(e,T.name),a.mutate()}catch(M){t.error(M?.message||f("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;v(null),N(T.name);try{await Cr.run(e,T.name),t.success(f("project.routines.run_success",{name:T.name})),await Promise.all([a.mutate(),pC(`/projects/${e}/routines/${T.name}/runs`)])}catch(M){t.error(M?.message||f("project.routines.run_error"))}finally{N(null)}},A=async()=>{if(p){h(!0);try{await Cr.remove(e,p.name),t.success(f("project.routines.delete_success")),y===p.name&&C(null),m(null),a.mutate()}catch(T){t.error(T?.message||f("project.routines.delete_error"))}finally{h(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[r.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:f("project.routines.title")}),r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:f("project.routines.subtitle")})]}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>u({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(tn,{size:14})," ",f("project.routines.new_btn")]})]}),a.isLoading&&r.jsx(lt,{}),!a.isLoading&&w.length===0&&r.jsx(xt,{children:f("project.routines.empty")}),w.length>0&&r.jsxs("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] grid-cols-[minmax(200px,260px)_1fr] overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(A6,{routines:w,selectedName:S?.name??null,onSelect:C}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:S?r.jsx(D6,{pid:e,routine:S,onEdit:()=>u({...S}),onRun:()=>v(S),onToggle:()=>E(S),onDelete:()=>m(S),running:k===S.name},S.name):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.detail_empty")})})})]}),r.jsx(L6,{draft:c,onClose:()=>u(null),onSaved:()=>{u(null),a.mutate()},pid:e}),r.jsx(On,{open:!!p,onClose:()=>g?null:m(null),title:f("project.routines.delete_confirm",{name:p?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:g,children:f("common.cancel")}),r.jsx(ce,{variant:"destructive",onClick:A,loading:g,children:f("common.delete")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.delete_confirm_body")})}),r.jsx(On,{open:!!b,onClose:()=>v(null),title:f("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>v(null),children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:R,children:f("common.run")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.run_confirm_body")})})]})}function B6({pid:e}){const[t,a]=x.useState("open"),o=rt(),l=s_({key:`/projects/${e}/tasks?state=${t}`,fetchPage:(b,v)=>Nr.listPage(e,{state:t,limit:b,offset:v}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[c,u]=x.useState(""),[p,m]=x.useState(!1),g=async()=>{if(c.trim()){m(!0);try{await Nr.add(e,{title:c.trim()}),u(""),o.success(f("project.tasks.created")),l.mutate()}catch(b){o.error(b?.message||f("project.tasks.create_error"))}finally{m(!1)}}},h=async(b,v)=>{try{await b(),o.success(v),l.mutate()}catch(k){o.error(k?.message||f("common.error_generic"))}};return r.jsxs(Ke,{fullHeight:!0,title:f("project.tasks.title"),description:f("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(b=>r.jsx(ce,{size:"sm","data-testid":`task-filter-${b}`,variant:t===b?"primary":"ghost",onClick:()=>a(b),children:b},b))}),children:[r.jsxs("div",{className:"mb-4 flex shrink-0 items-end gap-2",children:[r.jsx(le,{label:f("project.tasks.add_label"),children:r.jsx(Ne,{"data-testid":"task-input",placeholder:f("project.tasks.add_placeholder"),value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"&&g()}})}),r.jsxs(ce,{variant:"primary","data-testid":"task-add",onClick:g,loading:p,children:[r.jsx(tn,{size:14})," ",f("project.tasks.add")]})]}),l.isLoading&&r.jsx(lt,{}),!l.isLoading&&l.total===0&&r.jsxs(xt,{children:[t==="open"?f("project.tasks.empty_open"):f("project.tasks.empty",{state:t})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx(a_,{paged:l,fullHeight:!0,children:r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:l.items.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(Fe,{children:["#",v]},v)),b.agent&&r.jsxs(Fe,{tone:"info",children:["@",b.agent]}),b.source&&r.jsxs("span",{children:[f("project.tasks.via")," ",b.source]}),b.due&&r.jsxs("span",{children:[f("project.tasks.due")," ",b.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[t==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(ce,{size:"sm",variant:"secondary","aria-label":f("project.tasks.aria_done"),"data-testid":`task-done-${b.id}`,onClick:()=>h(()=>Nr.done(e,b.id),f("project.tasks.done")),children:r.jsx(ho,{size:13})}),r.jsx(ce,{size:"sm",variant:"destructive","aria-label":f("project.tasks.aria_drop"),"data-testid":`task-drop-${b.id}`,onClick:()=>h(()=>Nr.drop(e,b.id),f("project.tasks.drop")),children:r.jsx(Zn,{size:13})})]}),t!=="open"&&r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("project.tasks.aria_reopen"),"data-testid":`task-reopen-${b.id}`,onClick:()=>h(()=>Nr.reopen(e,b.id),f("project.tasks.reopen")),children:r.jsx(Vx,{size:13})})]})]},b.id))})})]})}const U6="\\$\\{var\\.([^}\\s]+)\\}";function mN(e="g"){return new RegExp(U6,e)}function gN(e){return mN("").test(e)}function H6(e){const t=[];let a=0;for(const o of e.matchAll(mN("g"))){const l=o.index??0;l>a&&t.push({type:"text",value:e.slice(a,l)}),t.push({type:"var",value:o[1]}),a=l+o[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}function oh(e){let t="";for(const a of Array.from(e.childNodes))if(a.nodeType===Node.TEXT_NODE)t+=a.textContent??"";else if(a instanceof HTMLElement){const o=a.dataset.varName;o?t+=`\${var.${o}}`:a.tagName==="BR"?t+="":t+=a.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function Jj(e,t){e.replaceChildren();const a=H6(t);for(const o of a)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(hN(o.value));(a.length===0||a[a.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function hN(e){const t=document.createElement("span");return t.contentEditable="false",t.dataset.varName=e,t.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",t.textContent=`$${e}`,t.title=`\${var.${e}}`,t}function V6(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(e)}function q6(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(t)}const i_=x.forwardRef(function({value:t,onChange:a,placeholder:o,className:l,varNames:c=[],onCreateVar:u},p){const m=x.useRef(null),g=x.useRef(null),[h,b]=x.useState(!1),[v,k]=x.useState(""),N=x.useRef(t);x.useEffect(()=>{const A=m.current;A&&(t===N.current&&A.childNodes.length>0||(Jj(A,t),N.current=t))},[t]);const w=x.useCallback(()=>{const A=m.current;if(!A)return;const T=oh(A);N.current=T,T!==t&&a(T)},[a,t]),y=x.useCallback(()=>{const A=m.current;if(!A)return;const T=oh(A);if(gN(T)&&F6(A)){const M=G6(A);Jj(A,T),M!=null&&Y6(A,M)}N.current=oh(A),N.current!==t&&a(N.current)},[a,t]),S=x.useCallback(()=>{const A=window.getSelection();if(!A||A.rangeCount===0)return;const T=A.getRangeAt(0),M=m.current;M&&M.contains(T.startContainer)&&(g.current=T.cloneRange())},[]),C=x.useCallback(A=>{if(A.key==="Enter"){A.preventDefault(),A.currentTarget.blur();return}if(A.key==="Backspace"){const T=window.getSelection();if(!T||T.rangeCount===0)return;const M=T.getRangeAt(0);if(!M.collapsed)return;const{startContainer:z,startOffset:I}=M;if(z.nodeType===Node.TEXT_NODE&&I===0){const P=z.previousSibling;if(P instanceof HTMLElement&&P.dataset.varName){A.preventDefault(),P.remove(),w();return}}else if(z===m.current){const P=z.childNodes[I-1];if(P instanceof HTMLElement&&P.dataset.varName){A.preventDefault(),P.remove(),w();return}}}},[w]),E=x.useCallback(A=>{const T=m.current;if(!T)return;const M=g.current;T.focus();let z;M&&T.contains(M.startContainer)?z=M:(z=document.createRange(),z.selectNodeContents(T),z.collapse(!1)),V6(z,hN(A)),g.current=null,w()},[w]);x.useImperativeHandle(p,()=>({insertVar:E,focus:()=>m.current?.focus()}),[E]);const R=c.filter(A=>A.toLowerCase().includes(v.toLowerCase()));return r.jsxs("div",{className:ze("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:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:y,onKeyDown:C,onBlur:w,onFocus:S,onMouseUp:S,onKeyUp:S,className:ze("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"}}),t===""&&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(Ye,{content:f("chat_ui.insert_variable"),children:r.jsx("button",{type:"button",onMouseDown:A=>{A.preventDefault(),S()},onClick:()=>b(A=>!A),"aria-label":f("chat_ui.insert_variable"),className:ze("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",h&&"bg-muted/60 text-foreground"),children:r.jsx(tn,{size:14})})}),h&&r.jsx($6,{query:v,onQuery:k,varNames:R,onPick:A=>{E(A),b(!1),k("")},onClose:()=>{b(!1),k("")},onCreateVar:u})]})]})});function $6({query:e,onQuery:t,varNames:a,onPick:o,onClose:l,onCreateVar:c}){const u=x.useRef(null),p=x.useRef(null);return x.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function m(g){u.current&&!u.current.contains(g.target)&&l()}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[l]),r.jsxs("div",{ref:u,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:p,value:e,onChange:m=>t(m.target.value),placeholder:f("shared_ui.search_variable_ph"),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:[a.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:f("shared_ui.no_matches")}),a.map(m=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:g=>g.preventDefault(),onClick:()=>o(m),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:m})},m))]}),c&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:m=>m.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(tn,{size:12})," ",f("shared_ui.create_variable")]})})]})}function F6(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&gN(t.textContent??""))return!0;return!1}function G6(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);if(!e.contains(a.startContainer))return null;const o=a.cloneRange();return o.selectNodeContents(e),o.setEnd(a.startContainer,a.startOffset),o.toString().length}function Y6(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=t,l=a.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const u=document.createRange();u.setStart(l,o),u.collapse(!0);const p=window.getSelection();p?.removeAllRanges(),p?.addRange(u);return}o-=c,l=a.nextNode()}q6(e)}function ew(e){return e?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[]}function tw(e){const t={};for(const a of e)a.key.trim()&&(t[a.key.trim()]=a.value);return t}function nw({rows:e,onChange:t,keyPlaceholder:a=f("shared_ui.kv_key_ph"),valuePlaceholder:o=f("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:u}){const p=(h,b)=>{const v=e.slice();v[h]={...v[h],...b},t(v)},m=h=>t(e.filter((b,v)=>v!==h)),g=()=>t([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&u&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:u}),e.map((h,b)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ne,{value:h.key,onChange:v=>p(b,{key:v.target.value}),placeholder:a,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(i_,{value:h.value,onChange:v=>p(b,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":f("shared_ui.remove_row"),children:r.jsx(Zn,{size:13})})]},b)),r.jsxs(ce,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[r.jsx(tn,{size:12})," ",f("shared_ui.add_row")]})]})}const K6={apc:"info",runtime:"success",global:"muted"};function bx(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function X6(e){return e==="apc"?f("project.mcps.scope_shared"):e==="runtime"?f("project.mcps.scope_runtime"):e==="global"?f("project.mcps.scope_global"):e}function Q6({pid:e}){const t=rt(),a=et(`/projects/${e}/mcps`,()=>Er.list(e)),o=et(`/projects/${e}/mcps/check`,()=>Er.check(e)),l=et(`/projects/${e}/vars`,()=>Dc.list(e)),[c,u]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(null),b=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(w,y)=>{if(confirm(f("project.mcps.delete_confirm",{name:w,scope:y})))try{await Er.remove(e,w,y),t.success(f("project.mcps.removed")),a.mutate(),p===w&&m(null)}catch(S){t.error(S?.message||f("common.error_generic"))}},k=async w=>{try{await Er.add(e,bx(w.source),{name:w.name,enabled:!w.enabled}),a.mutate()}catch(y){t.error(y?.message||f("common.error_generic"))}},N=async w=>{m(w),h({name:w,busy:!0});try{const y=await Er.test(e,w);h({name:w,result:y})}catch(y){h({name:w,result:{ok:!1,error:y?.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(Ke,{title:f("project.mcps.title"),description:f("project.mcps.subtitle"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>u({kind:"new"}),children:[r.jsx(tn,{size:14})," ",f("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:f("project.mcps.conflicts",{names:o.data.conflicts.map(w=>w.name).join(", ")})}):null,a.isLoading&&r.jsx(lt,{}),!a.isLoading&&(a.data?.length??0)===0&&r.jsx(xt,{children:f("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(a.data||[]).map(w=>{const y=w.source==="apc"||w.source==="runtime"||w.source==="global",S=bx(w.source),C=p===w.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(C?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(w.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:w.name}),r.jsx(Fe,{tone:K6[w.source]??"muted",children:X6(w.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(w.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:E=>E.stopPropagation(),children:r.jsx(Ft,{checked:w.enabled!==!1,onChange:()=>k(w),label:""})}),r.jsx(Ye,{content:f("project.mcps.test_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),N(w.name)},"aria-label":f("project.mcps.test_btn"),children:r.jsx(qk,{size:13})})}),r.jsx(Ye,{content:f("project.mcps.logs_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),m(w.name)},"aria-label":f("project.mcps.logs_btn"),children:r.jsx(Xd,{size:13})})}),y&&r.jsx(Ye,{content:f("project.mcps.edit_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),u({kind:"edit",entry:w})},"aria-label":f("project.mcps.edit_btn"),children:r.jsx(Eo,{size:13})})}),y&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:E=>{E.stopPropagation(),v(w.name,S)},children:r.jsx(Zn,{size:13})})]}),g?.name===w.name&&r.jsx(W6,{result:g.result,busy:!!g.busy,onClose:()=>h(null)})]},`${w.source}-${w.name}`)})}),c&&r.jsx(J6,{mode:c,pid:e,varNames:b,onClose:()=>u(null),onSaved:()=>{u(null),a.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(Z6,{pid:e,mcpName:p,runningTest:!!g?.busy})})]})}function W6({result:e,busy:t,onClose:a}){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:[t&&r.jsx("span",{className:"text-muted-fg",children:f("project.mcps.testing")}),!t&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(Hk,{size:12})," ",f("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!t&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(lM,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:a,children:"×"})]}),!t&&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 Z6({pid:e,mcpName:t,runningTest:a}){const[o,l]=x.useState(null),[c,u]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!t){l(null),u(null);return}p.current!==t&&(l(null),u(null),p.current=t);let g=!1;const h=async()=>{try{const k=await Er.logs(e,t);g||(l(k),u(null))}catch(k){g||u(k?.message||"error")}};h();const v=setInterval(h,a?1200:4e3);return()=>{g=!0,clearInterval(v)}},[e,t,a]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.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(Ga,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:f("project.mcps.logs_panel_title")}),t?r.jsx(Fe,{tone:"info",children:t}):r.jsxs("span",{className:"text-muted-fg",children:["— ",f("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_hint")}),t&&c&&r.jsx("p",{className:"text-red-400",children:c}),t&&!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:f("project.mcps.logs_panel_idle")}),o.events?.map((g,h)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),r.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),r.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),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 J6({mode:e,pid:t,varNames:a,onClose:o,onSaved:l,onVarsChanged:c}){const u=rt(),p=e.kind==="edit",m=p?e.entry:null,[g,h]=x.useState(!1),[b,v]=x.useState(m?bx(m.source):"runtime"),[k,N]=x.useState(m?.name||""),[w,y]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[S,C]=x.useState(m?.command||""),[E,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[A,T]=x.useState(ew(m?.env)),[M,z]=x.useState(m?.url||""),[I,P]=x.useState(ew(m?.headers)),[H,D]=x.useState(m?.enabled!==!1),[B,V]=x.useState(!1),$=async()=>{if(!k.trim()){u.error(f("project.mcps.name_required"));return}h(!0);try{const q=E.map(K=>K.trim()).filter(Boolean),Y=w==="stdio"?{name:k.trim(),command:S.trim(),args:q.length?q:void 0,env:A.length?tw(A):void 0,enabled:H}:{name:k.trim(),url:M.trim(),headers:I.length?tw(I):void 0,enabled:H};await Er.add(t,b,Y),u.success(f(p?"project.mcps.updated":"project.mcps.added")),l()}catch(q){u.error(q?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(On,{open:!0,onClose:()=>g?null:o(),title:f(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:f("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:g,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:$,loading:g,children:f(p?"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(le,{label:f("project.mcps.scope_label"),children:r.jsx(bt,{value:b,onChange:q=>v(q),options:[{value:"runtime",label:f("project.mcps.scope_runtime"),description:f("project.mcps.scope_runtime_desc")},{value:"shared",label:f("project.mcps.scope_shared"),description:f("project.mcps.scope_shared_desc")},{value:"global",label:f("project.mcps.scope_global"),description:f("project.mcps.scope_global_desc")}]})}),r.jsx(le,{label:f("project.mcps.transport_label"),children:r.jsx(bt,{value:w,onChange:q=>y(q),options:[{value:"stdio",label:f("project.mcps.transport_stdio"),description:f("project.mcps.transport_stdio_desc")},{value:"http",label:f("project.mcps.transport_http"),description:f("project.mcps.transport_http_desc")}]})})]}),r.jsx(le,{label:f("project.mcps.name_label"),children:r.jsx(Ne,{value:k,onChange:q=>N(q.target.value),placeholder:f("project.mcps.name_ph"),disabled:p})}),w==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("project.mcps.cmd_label"),children:r.jsx(Ne,{value:S,onChange:q=>C(q.target.value),placeholder:f("project.mcps.cmd_ph")})}),r.jsx(le,{label:f("project.mcps.args_label"),hint:f("project.mcps.args_hint_tokens"),children:r.jsx(eI,{args:E,onChange:R,varNames:a,onCreateVar:()=>V(!0)})}),r.jsx(le,{label:f("project.mcps.env_label"),hint:f("project.mcps.env_hint_tokens"),children:r.jsx(nw,{rows:A,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:a,onCreateVar:()=>V(!0),emptyLabel:f("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("project.mcps.url_label"),children:r.jsx(i_,{value:M,onChange:z,placeholder:f("project.mcps.url_ph"),varNames:a,onCreateVar:()=>V(!0)})}),r.jsx(le,{label:f("project.mcps.headers_label"),hint:f("project.mcps.headers_hint"),children:r.jsx(nw,{rows:I,onChange:P,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:a,onCreateVar:()=>V(!0),emptyLabel:f("project.mcps.headers_empty")})})]}),r.jsx(Ft,{checked:H,onChange:D,label:f("project.mcps.enabled_label")})]})}),B&&r.jsx(tI,{pid:t,onClose:()=>V(!1),onCreated:()=>{V(!1),c()}})]})}function eI({args:e,onChange:t,varNames:a,onCreateVar:o}){const l=(p,m)=>{const g=e.slice();g[p]=m,t(g)},c=p=>t(e.filter((m,g)=>g!==p)),u=()=>t([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(i_,{value:p,onChange:g=>l(m,g),placeholder:f("agents_ui.arg_placeholder"),varNames:a,onCreateVar:o})}),r.jsx(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":f("agents_ui.remove_arg"),children:r.jsx(Zn,{size:13})})]},m)),r.jsxs(ce,{type:"button",size:"sm",variant:"ghost",onClick:u,children:[r.jsx(tn,{size:12})," ",f("project.mcps.add_arg")]})]})}function tI({pid:e,onClose:t,onCreated:a}){const o=rt(),l=String(e)==="0",[c,u]=x.useState(""),[p,m]=x.useState(""),[g,h]=x.useState(!1),[b,v]=x.useState(l?"global":"project"),k=async()=>{if(!c.trim()){o.error(f("project.vars.name_required"));return}if(!p){o.error(f("project.vars.value_required"));return}h(!0);try{await Dc.upsert(e,{name:c.trim(),value:p,scope:b}),o.success(f("project.vars.added")),a()}catch(N){o.error(N?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsx(On,{open:!0,onClose:()=>g?null:t(),title:f("project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:g,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:k,loading:g,children:f("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("project.vars.scope_label"),children:r.jsx(bt,{value:b,onChange:N=>v(N),options:[...l?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(le,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ne,{value:c,onChange:N=>u(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(le,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsx(Ne,{type:"password",value:p,onChange:N=>m(N.target.value),className:"font-mono text-xs"})})]})})}function nI({pid:e}){const t=rt(),a=String(e)==="0",[o,l]=x.useState(a?"global":"all"),[c,u]=x.useState(!1),p=et(`/projects/${e}/vars?reveal=${c?1:0}`,()=>Dc.list(e,{reveal:c})),[m,g]=x.useState(null),h=x.useMemo(()=>{if(!p.data)return[];const v=[],k=p.data.project||{},N=p.data.global||{};for(const[w,y]of Object.entries(k))v.push({name:w,scope:"project",masked:y});for(const[w,y]of Object.entries(N))k[w]===void 0&&v.push({name:w,scope:"global",masked:y});return v.filter(w=>o==="all"?!0:w.scope===o).sort((w,y)=>w.name.localeCompare(y.name))},[p.data,o]),b=async(v,k)=>{if(confirm(f("project.vars.delete_confirm",{name:v,scope:k})))try{await Dc.remove(e,v,k),t.success(f("project.vars.removed")),p.mutate()}catch(N){t.error(N?.message||f("common.error_generic"))}};return r.jsxs(Ke,{title:f("project.vars.title"),description:f(a?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ft,{checked:c,onChange:u,label:f("project.vars.reveal_all")}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>g({}),children:[r.jsx(tn,{size:14})," ",f("project.vars.new")]})]}),children:[!a&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:f("project.vars.filter_label")}),r.jsx(lh,{active:o==="all",onClick:()=>l("all"),children:f("project.vars.filter_all")}),r.jsx(lh,{active:o==="project",onClick:()=>l("project"),children:f("project.vars.filter_project")}),r.jsx(lh,{active:o==="global",onClick:()=>l("global"),children:f("project.vars.filter_global")})]}),p.isLoading&&r.jsx(lt,{}),!p.isLoading&&h.length===0&&r.jsx(xt,{children:f("project.vars.empty")}),h.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:h.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(Fe,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?f("project.vars.scope_project"):f("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(ce,{size:"sm",variant:"ghost",onClick:()=>g({name:v.name,scope:v.scope}),"aria-label":f("project.vars.edit_btn"),children:r.jsx(Eo,{size:13})}),!(a&&v.scope==="project")&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>b(v.name,v.scope),"aria-label":f("project.vars.delete_btn"),children:r.jsx(Zn,{size:13})})]})]},`${v.scope}-${v.name}`))}),r.jsx(sI,{open:m!==null,initial:m||void 0,onClose:()=>g(null),pid:e,isBase:a,onSaved:()=>{g(null),p.mutate()}})]})}function lh({active:e,onClick:t,children:a}){return r.jsx("button",{type:"button",onClick:t,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:a})}function sI({open:e,onClose:t,pid:a,isBase:o,initial:l,onSaved:c}){const u=rt(),[p,m]=x.useState(!1),[g,h]=x.useState(!1),[b,v]=x.useState(l?.name||""),[k,N]=x.useState(l?.value||""),[w,y]=x.useState(l?.scope||(o?"global":"project")),S=!!l?.name;x.useEffect(()=>{e&&(v(l?.name||""),N(l?.value||""),y(l?.scope||(o?"global":"project")),h(!1))},[e,l?.name,l?.scope,l?.value,o]);const C=async()=>{if(!b.trim()){u.error(f("project.vars.name_required"));return}if(!k){u.error(f("project.vars.value_required"));return}m(!0);try{await Dc.upsert(a,{name:b.trim(),value:k,scope:w}),u.success(f(S?"project.vars.updated":"project.vars.added")),c()}catch(E){u.error(E?.message||f("common.error_generic"))}finally{m(!1)}};return r.jsx(On,{open:e,onClose:()=>p?null:t(),title:f(S?"project.vars.edit_title":"project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:p,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:C,loading:p,children:f(S?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("project.vars.scope_label"),children:r.jsx(bt,{value:w,onChange:E=>y(E),options:[...o?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(le,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ne,{value:b,onChange:E=>v(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:S,autoFocus:!S})}),r.jsx(le,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ne,{type:g?"text":"password",value:k,onChange:E=>N(E.target.value),placeholder:S?f("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:S}),r.jsx("button",{type:"button",onClick:()=>h(E=>!E),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":f(g?"project.vars.hide":"project.vars.reveal"),children:g?r.jsx(gM,{size:14}):r.jsx(Nf,{size:14})})]})})]})})}function c_({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l=!1,disabled:c=!1,placeholder:u,autoFocus:p,minRows:m=2,maxRows:g=8,footer:h,className:b}){const v=x.useRef(null);x.useLayoutEffect(()=>{const N=v.current;if(!N)return;const w=()=>{N.style.height="auto",N.offsetHeight;const S=parseFloat(getComputedStyle(N).lineHeight)||20,C=S*m,E=S*g;N.style.height=`${Math.min(Math.max(N.scrollHeight,C),E)}px`,N.style.overflowY=N.scrollHeight>E?"auto":"hidden"};w();const y=requestAnimationFrame(w);return()=>cancelAnimationFrame(y)},[e,m,g]);const k=e.trim().length>0&&!c;return r.jsxs("div",{className:St("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:m,value:e,autoFocus:p,disabled:c,placeholder:u,onChange:N=>t(N.target.value),onKeyDown:N=>{if(N.key==="Enter"&&!N.shiftKey){if(N.preventDefault(),l||!k)return;a()}},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:h}),l&&o?r.jsx(Ye,{content:f("chat_ui.stop"),children:r.jsx(Qa,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":f("chat_ui.stop"),children:r.jsx(Qk,{className:"size-3.5",fill:"currentColor"})})}):r.jsx(Ye,{content:f("chat_ui.send"),children:r.jsx(Qa,{type:"button",size:"icon-sm",variant:"default",onClick:a,disabled:!k,"aria-label":f("chat_ui.send"),children:r.jsx(eM,{className:"size-4"})})})]})]})}function u_({value:e,onChange:t,disabled:a}){const[o,l]=x.useState(!1),[c,u]=x.useState(""),[p,m]=x.useState([]),[g,h]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const y=S=>{b.current&&!b.current.contains(S.target)&&l(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),x.useEffect(()=>{if(!o||g)return;let y=!1;return(async()=>{try{const{engines:S}=await pf.list(),C=await Promise.all(S.map(E=>pf.models({engine:E}).then(R=>(R.models||[]).map(A=>A.includes(":")?A:`${E}:${A}`)).catch(()=>[])));if(!y){const E=Array.from(new Set(C.flat())).sort();m(E),h(!0)}}catch{y||h(!0)}})(),()=>{y=!0}},[o,g]);const v=c.trim().toLowerCase(),k=v?p.filter(y=>y.toLowerCase().includes(v)):p,N=e||f("shared_ui.auto"),w=y=>{t(y),l(!1),u("")};return r.jsxs("div",{ref:b,className:"relative",children:[r.jsx(Ye,{content:f("chat_ui.pick_model"),children:r.jsxs("button",{type:"button",disabled:a,onClick:()=>l(y=>!y),"data-testid":"chat-model-picker",className:ze("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"),"aria-label":f("chat_ui.pick_model"),children:[r.jsx(Xk,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:N}),r.jsx(Za,{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:f("shared_ui.model_filter_ph"),onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.trim()&&w(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:y=>{y.preventDefault(),w("")},className:ze("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(Gs,{className:"size-3"})," ",f("shared_ui.auto_router")]}),!e&&r.jsx(ho,{className:"size-3"})]})}),!g&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:f("shared_ui.loading_models")}),g&&k.length===0&&c.trim()&&r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:y=>{y.preventDefault(),w(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:f("shared_ui.use_value",{value:c.trim()})})}),k.map(y=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:S=>{S.preventDefault(),w(y)},className:ze("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",y===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:y}),y===e&&r.jsx(ho,{className:"size-3 shrink-0"})]})},y))]})]})]})}function aI({onSend:e,onStop:t,streaming:a,model:o,onModelChange:l}){const[c,u]=x.useState(""),p=()=>{const m=c.trim();m&&(u(""),e(m))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(c_,{value:c,onValueChange:u,onSubmit:p,onStop:t,busy:a,placeholder:f("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(u_,{value:o||"",onChange:l,disabled:a}):void 0})})}function rI(){return{read_file:{icon:_M,label:f("shared_ui.tool_read_file")},write_file:{icon:bM,label:f("shared_ui.tool_write_file")},edit_file:{icon:Yd,label:f("shared_ui.tool_edit_file")},list_files:{icon:Fk,label:f("shared_ui.tool_list_files")},search_files:{icon:_c,label:f("shared_ui.tool_search_files")},search_messages:{icon:_c,label:f("shared_ui.tool_search_messages")},tail_messages:{icon:_c,label:f("shared_ui.tool_tail_messages")},run_shell:{icon:Ga,label:f("shared_ui.tool_run_shell")},send_telegram:{icon:Fs,label:f("shared_ui.tool_send_telegram")},call_agent:{icon:un,label:f("shared_ui.tool_call_agent")},call_mcp:{icon:UM,label:f("shared_ui.tool_call_mcp")},call_runtime:{icon:un,label:f("shared_ui.tool_call_runtime")},create_task:{icon:zM,label:f("shared_ui.tool_create_task")}}}const xN=new Set(["write_file","edit_file"]);function oI(e){return rI()[e]||{icon:Zl,label:e}}function lI(e,t){if(!t)return"";const a=l=>typeof t[l]=="string"?t[l]:void 0,o=a("path")||a("file")||a("pattern")||a("query")||a("command")||a("slug")||a("name")||a("agent");return o?String(o):""}function sw(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function iI({status:e}){return e==="running"?r.jsx(Tf,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(Gs,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(pM,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(ho,{className:"size-3 shrink-0 text-emerald-400"})}function cI({part:e}){const[t,a]=x.useState(!1),{icon:o,label:l}=oI(e.tool),c=lI(e.tool,e.args),u=xN.has(e.tool),p=!!e.args||e.result!==void 0;return r.jsxs("div",{className:ze("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>p&&a(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[p?r.jsx(Wl,{className:ze("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:ze("size-3.5 shrink-0",u?"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:f("shared_ui.dedup")}),r.jsx(iI,{status:e.status})]})]}),t&&p&&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:f("shared_ui.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:sw(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:f("shared_ui.result")}),r.jsx("pre",{className:ze("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:sw(e.result)})]})]})]})}function uI(e){const t=e.args;return(t&&Array.isArray(t.questions)?t.questions:[]).map(o=>typeof o=="string"?o:o&&typeof o=="object"&&typeof o.question=="string"?o.question:null).filter(o=>!!o)}function dI({part:e,pending:t}){const a=uI(e),o=f(t?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:ze("rounded-2xl border px-3 py-2 text-sm shadow-sm",t?"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":t?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[t?r.jsx(Tf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(Hk,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Gk,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),a.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length," preguntas"]})]}),a.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:a.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function bN(e){const t=e.split(`
|
|
628
|
+
`),a=[];let o=null;for(const l of t)if(l.startsWith("- "))o&&a.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&&a.push(o),a.length>0?a:null}function fI({text:e}){const t=bN(e);return t?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(Gk,{className:"size-3.5"}),r.jsx("span",{children:f("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:t.map((a,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:a.question}),r.jsx("div",{className:ze("whitespace-pre-wrap text-[13px] leading-snug",a.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:a.answer})]},o))})]})}):null}function _x(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
|
|
629
|
+
|
|
630
|
+
`).trim()}function pI(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const a=t.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 u=(Array.isArray(l.options)?l.options:[]).map(p=>typeof p=="string"?p:p&&typeof p=="object"&&typeof p.label=="string"?p.label:"").filter(p=>p).join(", ");return u?`- ${l.question} (opciones: ${u})`:`- ${l.question}`}).filter(o=>!!o);return a.length===0?null:`[ask_questions]
|
|
631
|
+
${a.join(`
|
|
632
|
+
`)}`}function mI(e){const t=[];for(const a of e.parts)if(a.kind==="text"&&a.text)t.push(a.text);else if(a.kind==="tool"&&a.tool==="ask_questions"){const o=pI(a);o&&t.push(o)}return t.join(`
|
|
633
|
+
|
|
634
|
+
`).trim()}const gI=e=>[{kind:"text",text:e}];function hI(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function d_(e,t){const a=o=>({...e,notes:[...e.notes||[],o]});switch(t.type){case"model_start":return t.model?{...e,model:t.model}:e;case"model_routed":{const o=t.model?{...e,model:t.model}:e;return t.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${t.model}`]}:o}case"engine_failed":return a(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return a(`retry (${t.reason||"?"})`);case"tools_suppressed":return a(`tools suppressed: ${(t.tools||[]).join(", ")}`);case"skill_inspector":{const o=t.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 t.text?{...e,parts:[...e.parts,{kind:"text",text:t.text}]}:e;case"tool_start":return t.trace?{...e,parts:[...e.parts,{kind:"tool",id:t.trace.id,tool:t.trace.tool,args:t.trace.args,status:"running"}]}:e;case"tool_deduped":return t.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===t.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!t.trace)return e;{const o=hI(t.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===t.trace.id?{...l,result:t.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:t.result?.usage??e.usage,model:e.model??t.result?.name,parts:t.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:t.result.text}]:e.parts};default:{const o=t.delta||t.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 xI(e,t){const[a,o]=x.useState([]),[l,c]=x.useState(!1),[u,p]=x.useState(void 0),m=x.useRef(null),g=x.useRef(void 0),h=x.useCallback(y=>{o(S=>{const C=[...S],E=C[C.length-1];return E&&E.role==="assistant"&&(C[C.length-1]=y(E)),C})},[]),b=x.useCallback(y=>{if(y.type==="error"){t?.(y.error||f("shared_ui.err_stream"));return}h(S=>d_(S,y))},[h,t]),v=x.useCallback(async(y,S={})=>{const C=y.trim();if(!C||l)return;const E=()=>new Date().toISOString(),R=a.map(T=>({role:T.role,content:mI(T)}));if(o(T=>[...T,{role:"user",parts:gI(C),ts:E()},{role:"assistant",parts:[],ts:E(),pending:!0}]),c(!0),S.agentSlug){try{const T=await rn.chat(e,S.agentSlug,{prompt:C,conversation_id:g.current,model:S.model||void 0,channel:"web"});g.current=T.conversation_id,p(T.conversation_id),h(M=>({...M,pending:!1,model:T.engine,parts:[{kind:"text",text:T.text}]}))}catch(T){t?.(T?.message||f("shared_ui.err_chat_failed")),o(M=>M.filter((z,I)=>I!==M.length-1))}finally{c(!1)}return}const A=new AbortController;m.current=A;try{await xC.stream(e,{prompt:C,previousMessages:R,model:S.model||void 0,channel:"web"},b,A.signal),h(T=>({...T,pending:!1}))}catch(T){A.signal.aborted?h(M=>({...M,pending:!1,parts:[...M.parts,{kind:"text",text:f("code_module.stopped")}]})):(t?.(T?.message||f("shared_ui.err_stream_failed")),o(M=>M.filter((z,I)=>I!==M.length-1)))}finally{c(!1),m.current=null}},[e,a,l,b,h,t]),k=x.useCallback(()=>m.current?.abort(),[]),N=x.useCallback(()=>{l||(g.current=void 0,p(void 0),o([]))},[l]),w=x.useCallback(async(y,S)=>{if(!l)try{const E=((await $b.get(e,y,S)).messages??[]).filter(R=>R.role==="user"||R.role==="assistant").map(R=>({role:R.role,parts:[{kind:"text",text:R.content}],ts:R.ts||new Date().toISOString()}));g.current=S,p(S),o(E)}catch(C){t?.(C?.message||f("shared_ui.err_load_conversation"))}},[e,l,t]);return{msgs:a,send:v,stop:k,clear:N,load:w,streaming:l,conversationId:u}}function bI({msg:e,isLast:t,isAskAnswer:a,onCopy:o}){const l=e.role==="user",c=_x(e),u=e.parts.some(p=>p.kind==="tool");if(l&&a){const p=_x(e);if(bN(p))return r.jsx(fI,{text:p})}return r.jsxs("div",{className:ze("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(un,{size:14})}),r.jsxs("div",{className:ze("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((p,m)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(TM,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?r.jsx(Ye,{content:f("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[r.jsx(pa,{size:10}),e.inspector.loaded?.map(p=>r.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>r.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[p,"?"]},`h-${p}`))]})}):null,e.parts.map((p,m)=>p.kind==="tool"?p.tool==="ask_questions"&&!l?r.jsx(dI,{part:p,pending:!!t},`${p.id}-${m}`):r.jsx(cI,{part:p},`${p.id}-${m}`):p.text?r.jsx("div",{className:ze("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:p.text},m):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:_I(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&u&&r.jsxs("span",{children:["· ",f("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&r.jsx(Ye,{content:f("chat_ui.copy"),children:r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":f("chat_ui.copy"),children:[r.jsx(Ec,{size:10})," ",f("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(qx,{size:14})})]})}function _I(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function f_({msgs:e,onCopy:t}){const a=x.useRef(null);if(x.useEffect(()=>{a.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(xt,{children:f("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(bI,{msg:l,isLast:c===o,isAskAnswer:vI(e,c),onCopy:t},c)),r.jsx("div",{ref:a})]})}function vI(e,t){const a=e[t];if(!a||a.role!=="user")return!1;const o=e[t-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 yI(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function _N({msgs:e}){const[t,a]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:u,model:p}=x.useMemo(()=>{let g=0,h=0,b=0,v;const k=new Set,N=[];for(const w of e)if(w.role==="assistant"){w.usage&&(g+=w.usage.input_tokens||0,h+=w.usage.output_tokens||0),w.model&&(v=w.model);for(const y of w.parts)if(y.kind==="tool"&&(b+=1,xN.has(y.tool)&&y.status!=="error")){const S=yI(y.args);S&&!k.has(S)&&(k.add(S),N.push({path:S,tool:y.tool}))}}return{inTok:g,outTok:h,toolCount:b,changed:N,model:v}},[e]),m=o+l;return m===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:()=>u.length>0&&a(g=>!g),className:ze("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",u.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Rf,{size:12})," ",ih(m)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",ih(o),"↑ / ",ih(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{size:12})," ",c," tools"]}),u.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Yd,{size:12})," ",u.length," archivos"]}),p&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),u.length>0&&r.jsx(Za,{className:ze("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&u.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:u.map(g=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Yd,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:g.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:g.tool==="write_file"?"write":"edit"})]},g.path))})]})}function ih(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function jl(){return{picked:new Set,text:"",skipped:!1}}function aw(e,t){const a=[];return e.forEach((o,l)=>{const c=t[l]||jl();if(c.skipped){a.push(`- ${o.question}
|
|
635
|
+
→ (omitido)`);return}const u=[];if(o.options&&o.options.length>0){const g=[...c.picked].sort((h,b)=>h-b).map(h=>o.options[h]?.label).filter(Boolean);g.length>0&&u.push(g.join(", "))}const p=c.text.trim();p&&u.push(o.options&&o.options.length>0?`(Otro: ${p})`:p);const m=u.length>0?u.join(" "):"(sin respuesta)";a.push(`- ${o.question}
|
|
636
|
+
→ ${m}`)}),a.join(`
|
|
637
|
+
`)}function vN({turnKey:e,questions:t,onSubmit:a,onDismiss:o,disabled:l}){const c=t.length,[u,p]=x.useState(0),[m,g]=x.useState(()=>t.map(()=>jl()));x.useEffect(()=>{p(0),g(t.map(()=>jl()))},[e,t]);const h=t[u],b=m[u]||jl(),v=!!h?.options&&h.options.length>0,k=!!h?.multiSelect,N=h?.allowText!==!1,w=T=>{g(M=>{const z=[...M],I=z[u]||jl();return z[u]={...I,...T,skipped:!1},z})},y=T=>{g(M=>{const z=[...M],I=z[u]||jl(),P=new Set(I.picked);return k?P.has(T)?P.delete(T):P.add(T):(P.clear(),P.add(T)),z[u]={...I,picked:P,skipped:!1},z})},S=x.useMemo(()=>!0,[]),C=u===c-1,E=()=>p(T=>Math.max(0,T-1)),R=()=>{if(C){a(aw(t,m));return}p(T=>Math.min(c-1,T+1))},A=()=>{if(g(T=>{const M=[...T];return M[u]={picked:new Set,text:"",skipped:!0},M}),C){const T=m.map((M,z)=>z===u?{picked:new Set,text:"",skipped:!0}:M);a(aw(t,T))}else p(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=M=>{if(l)return;const z=M.target?.tagName?.toLowerCase(),I=z==="input"||z==="textarea";if(M.key==="Enter"&&(M.metaKey||M.ctrlKey)){M.preventDefault(),R();return}if(!I&&v&&/^[1-9]$/.test(M.key)){const P=parseInt(M.key,10)-1;P<(h?.options?.length||0)&&(M.preventDefault(),y(P))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!h||c===0?null:r.jsxs("div",{className:ze("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:[u+1,"/",c]}),h.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:h.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":f("common.close"),children:r.jsx(Gs,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&h.options.map((T,M)=>{const z=b.picked.has(M);return r.jsxs("button",{type:"button",onClick:()=>y(M),className:ze("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",z?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),k?r.jsx("span",{className:ze("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:z&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:ze("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:M+1})]},`${M}:${T.label}`)}),(N||!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:f("ask_panel.other")}),r.jsx("input",{type:"text",value:b.text,onChange:T=>w({text:T.target.value}),placeholder:f(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:E,disabled:u===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:f("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:A,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:f("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:R,disabled:!S,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:[f(C?"ask_panel.submit":"ask_panel.next"),r.jsx(fM,{className:"size-3 opacity-60"})]})]})]})]})}function jI(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,a=typeof t.question=="string"?t.question:"";if(!a)return null;const l=(Array.isArray(t.options)?t.options:[]).map(c=>{if(typeof c=="string")return{label:c};if(c&&typeof c=="object"&&typeof c.label=="string"){const u=c;return{label:u.label,description:typeof u.description=="string"?u.description:void 0}}return null}).filter(c=>c!==null);return{question:a,header:typeof t.header=="string"?t.header:void 0,options:l,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function yN(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let a=null,o=-1;for(let g=t.parts.length-1;g>=0;g--){const h=t.parts[g];if(h.kind==="tool"&&h.tool==="ask_questions"){a=h,o=g;break}}if(!a||o<0)return null;let l=null;if(typeof a.result=="string")try{l=JSON.parse(a.result)}catch{l=null}else a.result&&typeof a.result=="object"&&(l=a.result);const c=[];Array.isArray(a.args?.questions)&&c.push(a.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let u=[];for(const g of c)if(u=g.map(jI).filter(h=>!!h),u.length>0)break;return u.length?{turnKey:`${t.ts||""}#${o}`,questions:u}:null}const vx={live:{label:"Live",icon:pa,order:0},telegram:{label:"Telegram",icon:Fs,order:1},voice:{label:"Voice",icon:Yk,order:2},desktop:{label:"Desktop",icon:Ux,order:3},web:{label:"Web",icon:Bx,order:4},a2a:{label:"Agent ↔ Agent",icon:un,order:5},schedule:{label:"Schedule",icon:GM,order:6},other:{label:"Other",icon:Ef,order:7}};function wI(e){if(!e)return"web";const t=e.toLowerCase();return t==="telegram"?"telegram":t==="voice"||t==="overlay"?"voice":t==="desktop"?"desktop":t==="web"||t==="sidebar"||t==="web-sidebar"?"web":t==="a2a"||t.startsWith("agent")?"a2a":t==="schedule"||t==="cron"||t==="routine"?"schedule":"other"}function kI({pid:e,slug:t,onLoaded:a}){const{data:o}=et(`/projects/${e}/agents/${t}/conversations`,()=>$b.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{a(t,o)},[t,o]),null}function SI({pid:e,agents:t,superAgentSlug:a,superAgentLabel:o,selected:l,onSelect:c,onNewChat:u}){const[p,m]=x.useState(""),[g,h]=x.useState(""),[b,v]=x.useState({}),[k,N]=x.useState({}),w=(M,z)=>{z&&N(I=>{const P=I[M];return P&&P.length===z.length&&P===z?I:{...I,[M]:z}})},y=x.useMemo(()=>{const M=[];for(const z of t)for(const I of k[z.slug]||[])M.push({...I,agent_slug:I.agent_slug||z.slug});return M},[t,k]),S=x.useMemo(()=>{const M=p.trim().toLowerCase();return y.filter(z=>!(g&&z.agent_slug!==g||M&&!`${z.title||""} ${z.id} ${z.agent_slug}`.toLowerCase().includes(M)))},[y,p,g]),C=x.useMemo(()=>{const M=new Map;for(const z of S){const I=wI(z.channel),P=M.get(I);P?P.push(z):M.set(I,[z])}return Array.from(M.entries()).map(([z,I])=>({key:z,items:I.sort((P,H)=>new Date(H.started_at||0).getTime()-new Date(P.started_at||0).getTime())})).sort((z,I)=>vx[z.key].order-vx[I.key].order)},[S]),E=x.useMemo(()=>{if(g===a)return[{slug:a,label:o}];const M=[];g||M.push({slug:a,label:o});for(const z of t)g&&z.slug!==g||M.push({slug:z.slug,label:z.slug});return M},[t,g,a,o]),R=x.useMemo(()=>[{value:"",label:f("project.chat.list.all_agents")},{value:a,label:o},...t.map(M=>({value:M.slug,label:M.slug}))],[t,a,o]),A=y.length+E.length,T=Object.keys(k).length>0||t.length===0;return r.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(M=>r.jsx(kI,{pid:e,slug:M.slug,onLoaded:w},M.slug)),r.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-sm font-semibold",children:f("project.chat.list.title")}),r.jsx("p",{className:"text-[10px] text-muted-fg",children:f("project.chat.list.count",{n:A})})]}),r.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[r.jsx(tn,{className:"size-3"})," ",f("project.chat.list.new")]})]}),r.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[r.jsx(Ne,{value:p,onChange:M=>m(M.target.value),placeholder:f("project.chat.list.search")}),r.jsx(bt,{value:g,onChange:h,options:R})]}),r.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!T&&r.jsx("div",{className:"px-2 py-1",children:r.jsx(lt,{})}),E.length>0&&r.jsx(rw,{keyName:"live",count:E.length,collapsed:!!b.live,onToggle:()=>v(M=>({...M,live:!M.live})),children:E.map(M=>{const z=M.slug===a,I=l.kind==="live"&&l.agentSlug===M.slug;return r.jsx(ow,{title:z?M.label:f("project.chat.list.live_with",{slug:M.slug}),subtitle:f("project.chat.list.live_subtitle"),badge:z?"super":M.slug,selected:I,onClick:()=>c({kind:"live",agentSlug:M.slug})},`live-${M.slug}`)})}),C.map(M=>r.jsx(rw,{keyName:M.key,count:M.items.length,collapsed:!!b[M.key],onToggle:()=>v(z=>({...z,[M.key]:!z[M.key]})),children:M.items.map(z=>{const I=l.kind==="conv"&&l.agentSlug===z.agent_slug&&l.convId===z.id;return r.jsx(ow,{title:z.title||z.id,subtitle:[z.agent_slug,`${z.messages??0} msg`].filter(Boolean).join(" · "),badge:z.agent_slug,timeAgo:z.started_at,selected:I,onClick:()=>c({kind:"conv",agentSlug:z.agent_slug,convId:z.id})},`${z.agent_slug}-${z.id}`)})},M.key)),T&&y.length===0&&r.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:f("project.chat.list.empty")})]})]})}function rw({keyName:e,count:t,collapsed:a,onToggle:o,children:l}){const c=vx[e],u=c.icon;return r.jsxs("section",{className:"space-y-1",children:[r.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a?r.jsx(Wl,{className:"size-3"}):r.jsx(Za,{className:"size-3"}),r.jsx(u,{className:"size-3"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),r.jsx("span",{className:"text-[10px]",children:t})]}),!a&&r.jsx("div",{className:"space-y-0.5",children:l})]})}function ow({title:e,subtitle:t,badge:a,timeAgo:o,selected:l,onClick:c}){return r.jsxs("button",{type:"button",onClick:c,className:Tc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",l?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:Tc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[r.jsx(cM,{className:"size-2.5"}),CI(o)]})]}),r.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:t}),a&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[r.jsx(qx,{className:"size-2.5"}),a]})]})]})}function CI(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const a=Date.now()-t,o=Math.floor(a/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const Td="__super_agent__";function NI({pid:e}){const t=rt(),[a]=Cf(),o=et(`/projects/${e}/agents`,()=>rn.list(e)),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,g]=x.useState(null),{msgs:h,send:b,stop:v,clear:k,load:N,streaming:w,conversationId:y}=xI(e,V=>t.error(V)),S=rp(),C=a.get("agent"),[E,R]=x.useState(C?{kind:"live",agentSlug:C}:{kind:"live",agentSlug:Td}),A=o.data||[],T=V=>V===Td,M=x.useMemo(()=>E.kind==="live"?A.find(V=>V.slug===E.agentSlug):A.find(V=>V.slug===E.agentSlug),[A,E]),z=T(E.agentSlug);x.useEffect(()=>{E.kind==="conv"?N(E.agentSlug,E.convId):y&&k()},[E.kind,E.kind==="conv"?E.convId:E.agentSlug]);const I=async V=>{if(z){await b(V,{model:u||void 0});return}M&&await b(V,{model:u||void 0,agentSlug:M.slug})},P=async V=>{try{await navigator.clipboard.writeText(V),t.info(f("project.chat.copied"))}catch{}},H=()=>{R({kind:"live",agentSlug:Td}),k()},D=z?f("project.chat.superagent_title",{persona:S}):E.kind==="conv"?E.convId:f("project.chat.title"),B=z?f("project.chat.superagent_subtitle",{persona:S}):E.kind==="conv"?f("project.chat.loaded_subtitle",{slug:E.agentSlug}):f("project.chat.subtitle");return o.isLoading?r.jsx(lt,{}):r.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(SI,{pid:e,agents:A,superAgentSlug:Td,superAgentLabel:f("agents_ui.super_agent_label",{persona:S}),selected:E,onSelect:R,onNewChat:H}),r.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:D}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:B})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[z?r.jsx(Fe,{tone:"success",children:f("agents_ui.super_agent_badge")}):M?.model&&r.jsx(Fe,{tone:"info",children:M.model}),E.kind==="conv"&&r.jsx(Fe,{tone:"info",children:y||"…"}),!A.length&&!z&&r.jsxs(ce,{variant:"primary",size:"sm",onClick:()=>c(!0),children:[r.jsx(tn,{size:14})," ",f("project.chat.create_agent")]}),r.jsxs(ce,{variant:"ghost",size:"sm",disabled:w||h.length===0,onClick:H,children:[r.jsx(Zn,{size:13})," ",f("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length?r.jsx(f_,{msgs:h,onCopy:P}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.chat.empty")})})}),r.jsx(_N,{msgs:h}),(()=>{const V=w?null:yN(h);return!V||V.turnKey===m?null:r.jsx(vN,{turnKey:V.turnKey,questions:V.questions,onSubmit:$=>void I($),onDismiss:()=>g(V.turnKey),disabled:w})})(),r.jsx(aI,{onSend:I,onStop:v,streaming:w,model:u,onModelChange:p})]}),r.jsx(EI,{open:l,pid:e,onClose:()=>c(!1),onCreated:()=>{c(!1),o.mutate()}})]})}function EI({open:e,onClose:t,onCreated:a,pid:o}){const l=rt(),[c,u]=x.useState(""),[p,m]=x.useState("master"),[g,h]=x.useState(""),[b,v]=x.useState(!0),[k,N]=x.useState(!1),w=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(f("project.agents.slug_invalid"));return}N(!0);try{await rn.create(o,{slug:c,role:p,model:g||void 0,is_master:b}),l.success(f("project.agents.created",{slug:c})),u(""),m("master"),h(""),v(!0),a()}catch(y){l.error(y.message)}finally{N(!1)}};return r.jsx(On,{open:e,onClose:t,title:f("project.chat.create_agent_title"),description:f("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:k,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:w,loading:k,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:"slug",children:r.jsx(Ne,{autoFocus:!0,value:c,onChange:y=>u(y.target.value),placeholder:"master"})}),r.jsx(le,{label:f("project.chat.role_label"),children:r.jsx(Ne,{value:p,onChange:y=>m(y.target.value),placeholder:"master"})}),r.jsx(le,{label:f("project.chat.model_label"),hint:f("project.chat.model_hint"),children:r.jsx(Ne,{value:g,onChange:y=>h(y.target.value)})}),r.jsx(Ft,{checked:b,onChange:v,label:f("project.chat.master_label")})]})})}function RI({pid:e}){const t=rt(),{project:a}=Fb(e),{channels:o,isLoading:l,mutate:c}=Zb(),u=String(e),p=a?.name||a?.path?.split("/").pop()||u,m=`proj-${u}`,g=o.find(M=>M.project===u||M.project===p||M.name===m),[h,b]=x.useState(!!g),[v,k]=x.useState(""),[N,w]=x.useState(""),[y,S]=x.useState(""),[C,E]=x.useState(!0),[R,A]=x.useState(!1);if(x.useEffect(()=>{g?(b(!0),k(""),w(g.chat_id||""),S(g.route_to_agent||""),E(g.respond_with_engine??!0)):(b(!1),k(""),w(""),S(""),E(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),l)return r.jsx(lt,{});const T=async()=>{A(!0);try{if(!h){g&&(await An.channels.remove(g.name),t.success(f("project.telegram.cleared"))),await c();return}const M={name:g?.name||m,project:u,chat_id:N,route_to_agent:y,respond_with_engine:C,...v?{bot_token:v}:{}};g?await An.channels.patch(g.name,M):await An.channels.upsert(M),t.success(f("project.telegram.saved")),await c(),k("")}catch(M){t.error(M.message)}finally{A(!1)}};return r.jsx(Ke,{title:f("project.telegram.title"),description:f("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ft,{checked:h,onChange:b,label:f(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&r.jsx(Fe,{tone:"success",children:f("project.telegram.channel_badge",{name:g.name})})]}),h&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.telegram.bot_token"),hint:g?.bot_token?`${Ar(g.bot_token)} ${f("telegram_ui.empty_keep")}`:f("project.telegram.bot_hint_none"),children:r.jsx(Ne,{type:"password",value:v,onChange:M=>k(M.target.value),placeholder:g?.bot_token?Ar(g.bot_token):""})}),r.jsx(le,{label:f("project.telegram.chat_id"),children:r.jsx(Ne,{value:N,onChange:M=>w(M.target.value)})}),r.jsx(le,{label:f("project.telegram.route_agent"),hint:f("project.telegram.route_hint"),children:r.jsx(Ne,{value:y,onChange:M=>S(M.target.value)})})]}),r.jsx(Ft,{checked:C,onChange:E,label:f("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(ce,{variant:"primary",loading:R,onClick:T,children:f("common.save")})}),!h&&!g&&r.jsx(xt,{children:f("project.telegram.no_override")})]})})}function jN({load:e,save:t,rows:a=10,placeholder:o}){const l=rt(),[c,u]=x.useState(null),[p,m]=x.useState(""),[g,h]=x.useState(!1);if(x.useEffect(()=>{let k=!0;return e().then(N=>{k&&(u(N),m(N))}).catch(()=>{k&&(u(""),m(""))}),()=>{k=!1}},[e]),c===null)return r.jsx(lt,{});const b=p!==c,v=async()=>{h(!0);try{await t(p),u(p),l.success(f("project.memories.saved"))}catch(k){l.error(k.message)}finally{h(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Mn,{rows:a,className:"font-mono text-xs",value:p,onChange:k=>m(k.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[p.length," ",f("project.memories.chars")]}),r.jsxs(ce,{size:"sm",variant:"primary",loading:g,disabled:!b,onClick:v,children:[r.jsx(Af,{size:12})," ",f("project.memories.save_btn")]})]})]})}function TI({pid:e,agent:t}){const[a,o]=x.useState(!1),l=t.is_master?Fa:un;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:[a?r.jsx(Za,{size:14,className:"text-muted-fg"}):r.jsx(Wl,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:t.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:t.slug}),t.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",t.role]})]}),a&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(jN,{rows:8,load:()=>rn.memory.get(e,t.slug).then(c=>c.body),save:c=>rn.memory.put(e,t.slug,c).then(()=>{})})})]})}function AI({pid:e}){const t=et(`/projects/${e}/agents`,()=>rn.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("project.memories.project_title"),description:f("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(Gd,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(jN,{rows:12,load:()=>ls.memory.get(e).then(a=>a.body),save:a=>ls.memory.put(e,a).then(()=>{}),placeholder:f("project.memories.project_ph")})})]})}),r.jsxs(Ke,{title:f("project.memories.agents_title"),description:f("project.memories.agents_desc"),children:[t.isLoading&&r.jsx(lt,{}),!t.isLoading&&(t.data?.length??0)===0&&r.jsx(xt,{children:f("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(t.data||[]).map(a=>r.jsx(TI,{pid:e,agent:a},a.slug))})]})]})}function MI(e,t){var a,o=1;e==null&&(e=0),t==null&&(t=0);function l(){var c,u=a.length,p,m=0,g=0;for(c=0;c<u;++c)p=a[c],m+=p.x,g+=p.y;for(m=(m/u-e)*o,g=(g/u-t)*o,c=0;c<u;++c)p=a[c],p.x-=m,p.y-=g}return l.initialize=function(c){a=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(t=+c,l):t},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function OI(e){const t=+this._x.call(null,e),a=+this._y.call(null,e);return wN(this.cover(t,a),t,a,e)}function wN(e,t,a,o){if(isNaN(t)||isNaN(a))return e;var l,c=e._root,u={data:o},p=e._x0,m=e._y0,g=e._x1,h=e._y1,b,v,k,N,w,y,S,C;if(!c)return e._root=u,e;for(;c.length;)if((w=t>=(b=(p+g)/2))?p=b:g=b,(y=a>=(v=(m+h)/2))?m=v:h=v,l=c,!(c=c[S=y<<1|w]))return l[S]=u,e;if(k=+e._x.call(null,c.data),N=+e._y.call(null,c.data),t===k&&a===N)return u.next=c,l?l[S]=u:e._root=u,e;do l=l?l[S]=new Array(4):e._root=new Array(4),(w=t>=(b=(p+g)/2))?p=b:g=b,(y=a>=(v=(m+h)/2))?m=v:h=v;while((S=y<<1|w)===(C=(N>=v)<<1|k>=b));return l[C]=c,l[S]=u,e}function zI(e){var t,a,o=e.length,l,c,u=new Array(o),p=new Array(o),m=1/0,g=1/0,h=-1/0,b=-1/0;for(a=0;a<o;++a)isNaN(l=+this._x.call(null,t=e[a]))||isNaN(c=+this._y.call(null,t))||(u[a]=l,p[a]=c,l<m&&(m=l),l>h&&(h=l),c<g&&(g=c),c>b&&(b=c));if(m>h||g>b)return this;for(this.cover(m,g).cover(h,b),a=0;a<o;++a)wN(this,u[a],p[a],e[a]);return this}function DI(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var a=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(a))l=(a=Math.floor(e))+1,c=(o=Math.floor(t))+1;else{for(var u=l-a||1,p=this._root,m,g;a>e||e>=l||o>t||t>=c;)switch(g=(t<o)<<1|e<a,m=new Array(4),m[g]=p,p=m,u*=2,g){case 0:l=a+u,c=o+u;break;case 1:a=l-u,c=o+u;break;case 2:l=a+u,o=c-u;break;case 3:a=l-u,o=c-u;break}this._root&&this._root.length&&(this._root=p)}return this._x0=a,this._y0=o,this._x1=l,this._y1=c,this}function PI(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function LI(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 Yn(e,t,a,o,l){this.node=e,this.x0=t,this.y0=a,this.x1=o,this.y1=l}function II(e,t,a){var o,l=this._x0,c=this._y0,u,p,m,g,h=this._x1,b=this._y1,v=[],k=this._root,N,w;for(k&&v.push(new Yn(k,l,c,h,b)),a==null?a=1/0:(l=e-a,c=t-a,h=e+a,b=t+a,a*=a);N=v.pop();)if(!(!(k=N.node)||(u=N.x0)>h||(p=N.y0)>b||(m=N.x1)<l||(g=N.y1)<c))if(k.length){var y=(u+m)/2,S=(p+g)/2;v.push(new Yn(k[3],y,S,m,g),new Yn(k[2],u,S,y,g),new Yn(k[1],y,p,m,S),new Yn(k[0],u,p,y,S)),(w=(t>=S)<<1|e>=y)&&(N=v[v.length-1],v[v.length-1]=v[v.length-1-w],v[v.length-1-w]=N)}else{var C=e-+this._x.call(null,k.data),E=t-+this._y.call(null,k.data),R=C*C+E*E;if(R<a){var A=Math.sqrt(a=R);l=e-A,c=t-A,h=e+A,b=t+A,o=k.data}}return o}function BI(e){if(isNaN(h=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,a=this._root,o,l,c,u=this._x0,p=this._y0,m=this._x1,g=this._y1,h,b,v,k,N,w,y,S;if(!a)return this;if(a.length)for(;;){if((N=h>=(v=(u+m)/2))?u=v:m=v,(w=b>=(k=(p+g)/2))?p=k:g=k,t=a,!(a=a[y=w<<1|N]))return this;if(!a.length)break;(t[y+1&3]||t[y+2&3]||t[y+3&3])&&(o=t,S=y)}for(;a.data!==e;)if(l=a,!(a=a.next))return this;return(c=a.next)&&delete a.next,l?(c?l.next=c:delete l.next,this):t?(c?t[y]=c:delete t[y],(a=t[0]||t[1]||t[2]||t[3])&&a===(t[3]||t[2]||t[1]||t[0])&&!a.length&&(o?o[S]=a:this._root=a),this):(this._root=c,this)}function UI(e){for(var t=0,a=e.length;t<a;++t)this.remove(e[t]);return this}function HI(){return this._root}function VI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function qI(e){var t=[],a,o=this._root,l,c,u,p,m;for(o&&t.push(new Yn(o,this._x0,this._y0,this._x1,this._y1));a=t.pop();)if(!e(o=a.node,c=a.x0,u=a.y0,p=a.x1,m=a.y1)&&o.length){var g=(c+p)/2,h=(u+m)/2;(l=o[3])&&t.push(new Yn(l,g,h,p,m)),(l=o[2])&&t.push(new Yn(l,c,h,g,m)),(l=o[1])&&t.push(new Yn(l,g,u,p,h)),(l=o[0])&&t.push(new Yn(l,c,u,g,h))}return this}function $I(e){var t=[],a=[],o;for(this._root&&t.push(new Yn(this._root,this._x0,this._y0,this._x1,this._y1));o=t.pop();){var l=o.node;if(l.length){var c,u=o.x0,p=o.y0,m=o.x1,g=o.y1,h=(u+m)/2,b=(p+g)/2;(c=l[0])&&t.push(new Yn(c,u,p,h,b)),(c=l[1])&&t.push(new Yn(c,h,p,m,b)),(c=l[2])&&t.push(new Yn(c,u,b,h,g)),(c=l[3])&&t.push(new Yn(c,h,b,m,g))}a.push(o)}for(;o=a.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function FI(e){return e[0]}function GI(e){return arguments.length?(this._x=e,this):this._x}function YI(e){return e[1]}function KI(e){return arguments.length?(this._y=e,this):this._y}function p_(e,t,a){var o=new m_(t??FI,a??YI,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function m_(e,t,a,o,l,c){this._x=e,this._y=t,this._x0=a,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function lw(e){for(var t={data:e.data},a=t;e=e.next;)a=a.next={data:e.data};return t}var Jn=p_.prototype=m_.prototype;Jn.copy=function(){var e=new m_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,a,o;if(!t)return e;if(!t.length)return e._root=lw(t),e;for(a=[{source:t,target:e._root=new Array(4)}];t=a.pop();)for(var l=0;l<4;++l)(o=t.source[l])&&(o.length?a.push({source:o,target:t.target[l]=new Array(4)}):t.target[l]=lw(o));return e};Jn.add=OI;Jn.addAll=zI;Jn.cover=DI;Jn.data=PI;Jn.extent=LI;Jn.find=II;Jn.remove=BI;Jn.removeAll=UI;Jn.root=HI;Jn.size=VI;Jn.visit=qI;Jn.visitAfter=$I;Jn.x=GI;Jn.y=KI;function go(e){return function(){return e}}function Tr(e){return(e()-.5)*1e-6}function XI(e){return e.x+e.vx}function QI(e){return e.y+e.vy}function WI(e){var t,a,o,l=1,c=1;typeof e!="function"&&(e=go(e==null?1:+e));function u(){for(var g,h=t.length,b,v,k,N,w,y,S=0;S<c;++S)for(b=p_(t,XI,QI).visitAfter(p),g=0;g<h;++g)v=t[g],w=a[v.index],y=w*w,k=v.x+v.vx,N=v.y+v.vy,b.visit(C);function C(E,R,A,T,M){var z=E.data,I=E.r,P=w+I;if(z){if(z.index>v.index){var H=k-z.x-z.vx,D=N-z.y-z.vy,B=H*H+D*D;B<P*P&&(H===0&&(H=Tr(o),B+=H*H),D===0&&(D=Tr(o),B+=D*D),B=(P-(B=Math.sqrt(B)))/B*l,v.vx+=(H*=B)*(P=(I*=I)/(y+I)),v.vy+=(D*=B)*P,z.vx-=H*(P=1-P),z.vy-=D*P)}return}return R>k+P||T<k-P||A>N+P||M<N-P}}function p(g){if(g.data)return g.r=a[g.data.index];for(var h=g.r=0;h<4;++h)g[h]&&g[h].r>g.r&&(g.r=g[h].r)}function m(){if(t){var g,h=t.length,b;for(a=new Array(h),g=0;g<h;++g)b=t[g],a[b.index]=+e(b,g,t)}}return u.initialize=function(g,h){t=g,o=h,m()},u.iterations=function(g){return arguments.length?(c=+g,u):c},u.strength=function(g){return arguments.length?(l=+g,u):l},u.radius=function(g){return arguments.length?(e=typeof g=="function"?g:go(+g),m(),u):e},u}function ZI(e){return e.index}function iw(e,t){var a=e.get(t);if(!a)throw new Error("node not found: "+t);return a}function JI(e){var t=ZI,a=b,o,l=go(30),c,u,p,m,g,h=1;e==null&&(e=[]);function b(y){return 1/Math.min(p[y.source.index],p[y.target.index])}function v(y){for(var S=0,C=e.length;S<h;++S)for(var E=0,R,A,T,M,z,I,P;E<C;++E)R=e[E],A=R.source,T=R.target,M=T.x+T.vx-A.x-A.vx||Tr(g),z=T.y+T.vy-A.y-A.vy||Tr(g),I=Math.sqrt(M*M+z*z),I=(I-c[E])/I*y*o[E],M*=I,z*=I,T.vx-=M*(P=m[E]),T.vy-=z*P,A.vx+=M*(P=1-P),A.vy+=z*P}function k(){if(u){var y,S=u.length,C=e.length,E=new Map(u.map((A,T)=>[t(A,T,u),A])),R;for(y=0,p=new Array(S);y<C;++y)R=e[y],R.index=y,typeof R.source!="object"&&(R.source=iw(E,R.source)),typeof R.target!="object"&&(R.target=iw(E,R.target)),p[R.source.index]=(p[R.source.index]||0)+1,p[R.target.index]=(p[R.target.index]||0)+1;for(y=0,m=new Array(C);y<C;++y)R=e[y],m[y]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(C),N(),c=new Array(C),w()}}function N(){if(u)for(var y=0,S=e.length;y<S;++y)o[y]=+a(e[y],y,e)}function w(){if(u)for(var y=0,S=e.length;y<S;++y)c[y]=+l(e[y],y,e)}return v.initialize=function(y,S){u=y,g=S,k()},v.links=function(y){return arguments.length?(e=y,k(),v):e},v.id=function(y){return arguments.length?(t=y,v):t},v.iterations=function(y){return arguments.length?(h=+y,v):h},v.strength=function(y){return arguments.length?(a=typeof y=="function"?y:go(+y),N(),v):a},v.distance=function(y){return arguments.length?(l=typeof y=="function"?y:go(+y),w(),v):l},v}var e8={value:()=>{}};function kN(){for(var e=0,t=arguments.length,a={},o;e<t;++e){if(!(o=arguments[e]+"")||o in a||/[\s.]/.test(o))throw new Error("illegal type: "+o);a[o]=[]}return new Vd(a)}function Vd(e){this._=e}function t8(e,t){return e.trim().split(/^|\s+/).map(function(a){var o="",l=a.indexOf(".");if(l>=0&&(o=a.slice(l+1),a=a.slice(0,l)),a&&!t.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:o}})}Vd.prototype=kN.prototype={constructor:Vd,on:function(e,t){var a=this._,o=t8(e+"",a),l,c=-1,u=o.length;if(arguments.length<2){for(;++c<u;)if((l=(e=o[c]).type)&&(l=n8(a[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++c<u;)if(l=(e=o[c]).type)a[l]=cw(a[l],e.name,t);else if(t==null)for(l in a)a[l]=cw(a[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var a in t)e[a]=t[a].slice();return new Vd(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var a=new Array(l),o=0,l,c;o<l;++o)a[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(t,a)},apply:function(e,t,a){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(t,a)}};function n8(e,t){for(var a=0,o=e.length,l;a<o;++a)if((l=e[a]).name===t)return l.value}function cw(e,t,a){for(var o=0,l=e.length;o<l;++o)if(e[o].name===t){e[o]=e8,e=e.slice(0,o).concat(e.slice(o+1));break}return a!=null&&e.push({name:t,value:a}),e}var Gl=0,hc=0,ac=0,SN=1e3,_f,xc,vf=0,ko=0,fp=0,Lc=typeof performance=="object"&&performance.now?performance:Date,CN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function NN(){return ko||(CN(s8),ko=Lc.now()+fp)}function s8(){ko=0}function yx(){this._call=this._time=this._next=null}yx.prototype=EN.prototype={constructor:yx,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?NN():+a)+(t==null?0:+t),!this._next&&xc!==this&&(xc?xc._next=this:_f=this,xc=this),this._call=e,this._time=a,jx()},stop:function(){this._call&&(this._call=null,this._time=1/0,jx())}};function EN(e,t,a){var o=new yx;return o.restart(e,t,a),o}function a8(){NN(),++Gl;for(var e=_f,t;e;)(t=ko-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gl}function uw(){ko=(vf=Lc.now())+fp,Gl=hc=0;try{a8()}finally{Gl=0,o8(),ko=0}}function r8(){var e=Lc.now(),t=e-vf;t>SN&&(fp-=t,vf=e)}function o8(){for(var e,t=_f,a,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(a=t._next,t._next=null,t=e?e._next=a:_f=a);xc=e,jx(o)}function jx(e){if(!Gl){hc&&(hc=clearTimeout(hc));var t=e-ko;t>24?(e<1/0&&(hc=setTimeout(uw,e-Lc.now()-fp)),ac&&(ac=clearInterval(ac))):(ac||(vf=Lc.now(),ac=setInterval(r8,SN)),Gl=1,CN(uw))}}const l8=1664525,i8=1013904223,dw=4294967296;function c8(){let e=1;return()=>(e=(l8*e+i8)%dw)/dw}function u8(e){return e.x}function d8(e){return e.y}var f8=10,p8=Math.PI*(3-Math.sqrt(5));function m8(e){var t,a=1,o=.001,l=1-Math.pow(o,1/300),c=0,u=.6,p=new Map,m=EN(b),g=kN("tick","end"),h=c8();e==null&&(e=[]);function b(){v(),g.call("tick",t),a<o&&(m.stop(),g.call("end",t))}function v(w){var y,S=e.length,C;w===void 0&&(w=1);for(var E=0;E<w;++E)for(a+=(c-a)*l,p.forEach(function(R){R(a)}),y=0;y<S;++y)C=e[y],C.fx==null?C.x+=C.vx*=u:(C.x=C.fx,C.vx=0),C.fy==null?C.y+=C.vy*=u:(C.y=C.fy,C.vy=0);return t}function k(){for(var w=0,y=e.length,S;w<y;++w){if(S=e[w],S.index=w,S.fx!=null&&(S.x=S.fx),S.fy!=null&&(S.y=S.fy),isNaN(S.x)||isNaN(S.y)){var C=f8*Math.sqrt(.5+w),E=w*p8;S.x=C*Math.cos(E),S.y=C*Math.sin(E)}(isNaN(S.vx)||isNaN(S.vy))&&(S.vx=S.vy=0)}}function N(w){return w.initialize&&w.initialize(e,h),w}return k(),t={tick:v,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(w){return arguments.length?(e=w,k(),p.forEach(N),t):e},alpha:function(w){return arguments.length?(a=+w,t):a},alphaMin:function(w){return arguments.length?(o=+w,t):o},alphaDecay:function(w){return arguments.length?(l=+w,t):+l},alphaTarget:function(w){return arguments.length?(c=+w,t):c},velocityDecay:function(w){return arguments.length?(u=1-w,t):1-u},randomSource:function(w){return arguments.length?(h=w,p.forEach(N),t):h},force:function(w,y){return arguments.length>1?(y==null?p.delete(w):p.set(w,N(y)),t):p.get(w)},find:function(w,y,S){var C=0,E=e.length,R,A,T,M,z;for(S==null?S=1/0:S*=S,C=0;C<E;++C)M=e[C],R=w-M.x,A=y-M.y,T=R*R+A*A,T<S&&(z=M,S=T);return z},on:function(w,y){return arguments.length>1?(g.on(w,y),t):g.on(w)}}}function g8(){var e,t,a,o,l=go(-30),c,u=1,p=1/0,m=.81;function g(k){var N,w=e.length,y=p_(e,u8,d8).visitAfter(b);for(o=k,N=0;N<w;++N)t=e[N],y.visit(v)}function h(){if(e){var k,N=e.length,w;for(c=new Array(N),k=0;k<N;++k)w=e[k],c[w.index]=+l(w,k,e)}}function b(k){var N=0,w,y,S=0,C,E,R;if(k.length){for(C=E=R=0;R<4;++R)(w=k[R])&&(y=Math.abs(w.value))&&(N+=w.value,S+=y,C+=y*w.x,E+=y*w.y);k.x=C/S,k.y=E/S}else{w=k,w.x=w.data.x,w.y=w.data.y;do N+=c[w.data.index];while(w=w.next)}k.value=N}function v(k,N,w,y){if(!k.value)return!0;var S=k.x-t.x,C=k.y-t.y,E=y-N,R=S*S+C*C;if(E*E/m<R)return R<p&&(S===0&&(S=Tr(a),R+=S*S),C===0&&(C=Tr(a),R+=C*C),R<u&&(R=Math.sqrt(u*R)),t.vx+=S*k.value*o/R,t.vy+=C*k.value*o/R),!0;if(k.length||R>=p)return;(k.data!==t||k.next)&&(S===0&&(S=Tr(a),R+=S*S),C===0&&(C=Tr(a),R+=C*C),R<u&&(R=Math.sqrt(u*R)));do k.data!==t&&(E=c[k.data.index]*o/R,t.vx+=S*E,t.vy+=C*E);while(k=k.next)}return g.initialize=function(k,N){e=k,a=N,h()},g.strength=function(k){return arguments.length?(l=typeof k=="function"?k:go(+k),h(),g):l},g.distanceMin=function(k){return arguments.length?(u=k*k,g):Math.sqrt(u)},g.distanceMax=function(k){return arguments.length?(p=k*k,g):Math.sqrt(p)},g.theta=function(k){return arguments.length?(m=k*k,g):Math.sqrt(m)},g}const rc={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function h8(){return{agent:f("agents_ui.kind_agent"),memory:f("agents_ui.kind_memory"),thread:f("agents_ui.kind_thread"),task:f("agents_ui.kind_task"),routine:f("agents_ui.kind_routine"),agentlink:f("agents_ui.kind_hierarchy")}}const oc=760,lc=460;function x8({center:e,nodes:t}){const a=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),u=x.useRef(null),[,p]=x.useState(0),[m,g]=x.useState(null);x.useEffect(()=>{const y={id:"__center",label:e,kind:"agent",relation:"self",x:oc/2,y:lc/2,fx:oc/2,fy:lc/2},S=[y,...t.map(R=>({...R}))],C=S.slice(1).map(R=>({source:y,target:R}));l.current=S,c.current=C;const E=m8(S).force("link",JI(C).distance(120).strength(.5)).force("charge",g8().strength(-220)).force("center",MI(oc/2,lc/2).strength(.05)).force("collide",WI(26)).on("tick",()=>p(R=>R+1));return o.current=E,()=>{E.stop()}},[e,t]);const h=y=>{const S=a.current.getBoundingClientRect();return{x:(y.clientX-S.left)/S.width*oc,y:(y.clientY-S.top)/S.height*lc}},b=y=>S=>{y.id!=="__center"&&(u.current=y,S.target.setPointerCapture?.(S.pointerId),o.current?.alphaTarget(.3).restart())},v=y=>{const S=u.current;if(!S)return;const{x:C,y:E}=h(y);S.fx=C,S.fy=E},k=()=>{const y=u.current;y&&(y.fx=null,y.fy=null),u.current=null,o.current?.alphaTarget(0)},N=l.current,w=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:a,viewBox:`0 0 ${oc} ${lc}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:k,onPointerLeave:k,children:[w.map((y,S)=>r.jsx("line",{x1:y.source.x,y1:y.source.y,x2:y.target.x,y2:y.target.y,stroke:rc[y.target.kind],strokeOpacity:.22,strokeWidth:1.5},S)),N.map(y=>{if(y.id==="__center")return r.jsxs("g",{transform:`translate(${y.x},${y.y})`,children:[r.jsx("circle",{r:22,fill:rc.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},y.id);const S=m?.id===y.id;return r.jsxs("g",{transform:`translate(${y.x},${y.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(y),onClick:()=>g(y),children:[r.jsx("circle",{r:S?9:6,fill:rc[y.kind],fillOpacity:S?1:.9,stroke:S?"#fff":"none",strokeWidth:S?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:y.label.length>22?`${y.label.slice(0,22)}…`:y.label})]},y.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const y=h8();return Object.keys(y).filter(S=>S!=="agent").map(S=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:rc[S]}})," ",y[S]]},S))})(),r.jsx("span",{className:"ml-auto",children:f("agents_ui.nodes_drag_hint",{n:String(t.length)})})]}),m&&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:rc[m.kind]}}),r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function b8(){return[{key:"overview",label:f("agents_ui.tab_explorer"),icon:Rf},{key:"memories",label:f("project.nav.memories"),icon:Gd},{key:"records",label:f("project.agent_detail.records_title"),icon:Pk},{key:"sleep",label:f("project.agent_detail.sleep_title"),icon:Dl},{key:"brain",label:f("project.agent_detail.brain_title"),icon:pa},{key:"config",label:f("settings.tabs.advanced"),icon:Rc}]}function _8(){return[{value:"",label:f("agents_ui.type_none")},{value:"orchestrator",label:f("agents_ui.type_orchestrator"),description:f("agents_ui.type_orchestrator_desc")},{value:"specialist",label:f("agents_ui.type_specialist"),description:f("agents_ui.type_specialist_desc")},{value:"assistant",label:f("agents_ui.type_assistant"),description:f("agents_ui.type_assistant_desc")},{value:"worker",label:f("agents_ui.type_worker"),description:f("agents_ui.type_worker_desc")},{value:"monitor",label:f("agents_ui.type_monitor"),description:f("agents_ui.type_monitor_desc")}]}const wx=e=>e.split(",").map(t=>t.trim()).filter(Boolean),v8=(e,t)=>e.filter(a=>a.spec?.agent===t||t==="super-agent"&&a.kind==="super_agent");function y8(e){return e.split(`
|
|
638
|
+
`).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function j8({pid:e}){const{slug:t=""}=Nk(),a=Wn(),[o,l]=x.useState("overview"),c=b8(),u=et(`/projects/${e}/agents/${t}`,()=>rn.get(e,t)),p=et(`/projects/${e}/agents`,()=>rn.list(e)),m=et(`/projects/${e}/routines`,()=>Cr.list(e)),g=et(`/projects/${e}/messages?agent=${t}`,()=>ff.project(e,{agent:t,limit:200})),h=et(`/projects/${e}/agents/${t}/conversations`,()=>$b.list(e,t)),b=et(`/projects/${e}/tasks?all`,()=>Nr.list(e,"all")),v=u.data,k=v8(m.data||[],t),N=(b.data||[]).filter(S=>S.agent===t),w=(p.data||[]).filter(S=>S.parent===t);if(u.isLoading)return r.jsx(lt,{});if(!v)return r.jsx("div",{className:"text-sm text-muted-fg",children:f("project.agent_detail.not_found")});const y=v.is_master?Fa:un;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:()=>a(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(JA,{size:16})}),r.jsx("div",{className:ze("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(y,{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(Fe,{tone:"success",children:[r.jsx(Fa,{size:10})," ",f("project.agents.orchestrator")]}),v.role&&r.jsx(Fe,{children:v.role}),v.model&&r.jsx(Fe,{tone:"info",children:v.model}),v.parent&&r.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[f("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(ce,{size:"sm",variant:"primary",onClick:()=>a(`/p/${e}/chat?agent=${t}`),children:[r.jsx(Fs,{size:13})," ",f("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:S,label:C,icon:E})=>r.jsxs("button",{onClick:()=>l(S),className:ze("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===S?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(E,{size:14})," ",C]},S))}),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(Ad,{label:f("agents_ui.stat_threads"),value:h.data?.length??0,icon:Kd}),r.jsx(Ad,{label:f("agents_ui.stat_records"),value:g.data?.length??0,icon:Pk}),r.jsx(Ad,{label:f("agents_ui.stat_tasks"),value:N.length,icon:Rf}),r.jsx(Ad,{label:f("agents_ui.stat_heartbeats"),value:k.length,icon:Dl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(Ke,{title:f("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(S=>r.jsxs(Fe,{tone:"info",children:[r.jsx(pa,{size:10})," ",S]},S)),v.tools?.map(S=>r.jsxs(Fe,{children:[r.jsx(Zl,{size:10})," ",S]},S)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx(Ke,{title:f("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(S=>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:S.title||S.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[S.messages??0," ",f("project.agent_detail.msgs_count")]})]},S.id)),!h.data?.length&&r.jsx("li",{className:"text-muted-fg",children:f("project.agent_detail.no_threads")})]})})]}),w.length>0&&r.jsx(Ke,{title:f("project.agent_detail.subagents"),description:f("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(S=>r.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${S.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(un,{size:14,className:"text-muted-fg"})," ",S.slug]},S.slug))})})]}),o==="memories"&&r.jsx(k8,{pid:e,slug:t,initial:v.memory||"",onSaved:()=>u.mutate()}),o==="records"&&r.jsx(S8,{records:g.data||[],loading:g.isLoading}),o==="sleep"&&r.jsx(C8,{routines:k}),o==="brain"&&r.jsx(E8,{slug:t,memory:v.memory||"",threads:(h.data||[]).map(S=>({id:S.id,label:S.title||S.filename})),tasks:N.map(S=>({id:S.id,label:S.title,detail:S.body||void 0})),routines:k,parent:v.parent||null,children:w.map(S=>S.slug)}),o==="config"&&r.jsx(w8,{pid:e,agent:v,agents:p.data||[],onSaved:()=>{u.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),a(`/p/${e}/agents`)}})]})}function w8({pid:e,agent:t,agents:a,onSaved:o,onDeleted:l}){const c=rt(),[u,p]=x.useState(t.type||""),[m,g]=x.useState(t.area||""),[h,b]=x.useState(t.role||""),[v,k]=x.useState(t.model||""),[N,w]=x.useState(t.parent||""),[y,S]=x.useState(!!t.is_master),[C,E]=x.useState((t.skills||[]).join(", ")),[R,A]=x.useState((t.tools||[]).join(", ")),[T,M]=x.useState(t.description||""),[z,I]=x.useState(t.system||""),[P,H]=x.useState(!1),D=async()=>{H(!0);try{await rn.update(e,t.slug,{type:u||null,area:m||null,role:h||null,model:v||null,parent:N||null,is_master:y||u==="orchestrator",skills:wx(C),tools:wx(R),description:T||null,system:z}),c.success(f("project.agent_detail.update_success")),o()}catch(V){c.error(V.message)}finally{H(!1)}},B=async()=>{if(confirm(f("project.agent_detail.delete_confirm",{slug:t.slug})))try{await rn.remove(e,t.slug),c.success(f("project.agent_detail.delete_success")),l()}catch(V){c.error(V.message)}};return r.jsx(Ke,{title:f("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${f("agents_ui.config_def_desc")}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.agent_detail.type_label"),children:r.jsx(bt,{value:u,onChange:p,options:_8()})}),r.jsx(le,{label:f("project.agent_detail.area_label"),hint:f("project.agent_detail.area_hint"),children:r.jsx(Ne,{value:m,onChange:V=>g(V.target.value),placeholder:f("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("project.agent_detail.role_label"),children:r.jsx(Ne,{value:h,onChange:V=>b(V.target.value),placeholder:"Operations Lead"})}),r.jsx(le,{label:f("project.agent_detail.parent_label"),children:r.jsx(bt,{value:N,onChange:w,placeholder:f("project.agent_detail.none_parent"),options:[{value:"",label:f("project.agent_detail.none_parent")},...a.filter(V=>V.slug!==t.slug).map(V=>({value:V.slug,label:V.slug}))]})})]}),r.jsx(le,{label:f("project.agent_detail.model_label"),hint:f("project.agent_detail.model_hint"),children:r.jsx(Ne,{value:v,onChange:V=>k(V.target.value),placeholder:f("project.agent_detail.model_ph")})}),r.jsx(le,{label:f("project.agent_detail.skills_label"),children:r.jsx(Ne,{value:C,onChange:V=>E(V.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(N8,{value:R,onChange:A}),r.jsx(le,{label:f("project.agent_detail.bio_label"),children:r.jsx(Mn,{rows:2,value:T,onChange:V=>M(V.target.value)})}),r.jsx(le,{label:f("project.agent_detail.system_label"),hint:f("project.agent_detail.system_hint"),children:r.jsx(Mn,{rows:10,className:"font-mono text-xs",value:z,onChange:V=>I(V.target.value),placeholder:"You are…"})}),r.jsx(Ft,{checked:y,onChange:S,label:f("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(ce,{variant:"destructive",onClick:B,children:[r.jsx(Zn,{size:13})," ",f("project.agent_detail.delete_btn")]}),r.jsxs(ce,{variant:"primary",loading:P,onClick:D,children:[r.jsx(Af,{size:13})," ",f("project.agent_detail.save_btn")]})]})]})})}function Ad({label:e,value:t,icon:a}){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(a,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function k8({pid:e,slug:t,initial:a,onSaved:o}){const l=rt(),[c,u]=x.useState(a),[p,m]=x.useState(!1);x.useEffect(()=>{u(a)},[a]);const g=c!==a,h=async()=>{m(!0);try{await rn.memory.put(e,t,c),l.success(f("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{m(!1)}};return r.jsxs(Ke,{title:f("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${t}/memory.md — ${f("agents_ui.memory_durable_desc")}`,children:[r.jsx(Mn,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>u(b.target.value),placeholder:f("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," ",f("project.memories.chars")]}),r.jsxs(ce,{size:"sm",variant:"primary",loading:p,disabled:!g,onClick:h,children:[r.jsx(Af,{size:12})," ",f("project.memories.save_btn")]})]})]})}function S8({records:e,loading:t}){const a=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs(Ke,{title:f("project.agent_detail.records_title"),description:f("project.agent_detail.records_desc"),children:[t&&r.jsx(lt,{}),!t&&a.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:a.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(Lk,{size:13,className:"text-blue-400"}):r.jsx(Bk,{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(Fe,{tone:"info",children:o.channel}),o.type&&r.jsx(Fe,{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 C8({routines:e}){return e.length===0?r.jsx(Ke,{title:f("project.agent_detail.sleep_title"),description:f("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:f("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:f("project.agent_detail.sleep_deep_desc")})]})}):r.jsx(Ke,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(t=>{const a=t.enabled,o=t.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:ze("size-2 rounded-full",o?"bg-destructive":a?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:t.name}),r.jsx(Fe,{tone:a?"success":"muted",children:f(a?"agents_ui.running":"agents_ui.paused")}),o&&r.jsx(Fe,{tone:"danger",children:f("agents_ui.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:f("agents_ui.field_tick"),value:t.schedule}),r.jsx(Md,{label:f("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),r.jsx(Md,{label:f("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),r.jsx(Md,{label:f("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:t.last_error})]},t.name)})})})}function Md({label:e,value:t}){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:t})]})}function N8({value:e,onChange:t}){const a=et("/tools",()=>LD.list()),o=wx(e),l=a.data||[],c=p=>{const m=new Set(o);m.has(p)?m.delete(p):m.add(p),t([...m].join(", "))},u=o.filter(p=>!l.some(m=>m.name===p));return r.jsxs(le,{label:f("agents_ui.tools_label"),hint:f("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return r.jsx(Ye,{content:p.description||p.name,children:r.jsx("button",{type:"button",onClick:()=>c(p.name),className:ze("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",m?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:p.name})},p.name)}),u.map(p=>r.jsxs("button",{type:"button",onClick:()=>c(p),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:[p," ✕"]},p))]}),r.jsx(Ne,{className:"mt-2",value:e,onChange:p=>t(p.target.value),placeholder:f("project.agent_detail.tools_custom_ph")})]})}function E8({slug:e,memory:t,threads:a,tasks:o,routines:l,parent:c,children:u}){const p=x.useMemo(()=>{const m=[];return y8(t).forEach((g,h)=>m.push({id:`m${h}`,label:g,kind:"memory",relation:"knows",detail:g})),a.slice(0,8).forEach(g=>m.push({id:`th-${g.id}`,label:g.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(g=>m.push({id:`ts-${g.id}`,label:g.label,kind:"task",relation:"handles_task",detail:g.detail})),l.forEach(g=>m.push({id:`rt-${g.name}`,label:g.name,kind:"routine",relation:"ticks",detail:`schedule: ${g.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),u.forEach(g=>m.push({id:`c-${g}`,label:g,kind:"agentlink",relation:"orchestrates"})),m},[t,a,o,l,c,u]);return r.jsx(Ke,{title:f("project.agent_detail.brain_title"),description:f("project.agent_detail.brain_desc"),children:p.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.brain_empty")}):r.jsx(x8,{center:e,nodes:p})})}function R8(){const e=Wn(),t=Qn(),{pid:a=""}=Nk(),{project:o}=Fb(a),{collapsed:l,toggle:c}=Ub(Tn.sidebarCollapsed+".project"),u=String(a)==="0",p=x.useMemo(()=>u?[{title:f("base.nav_general"),items:[{key:"",label:"Dashboard",icon:MM},{key:"workspaces",label:f("base.workspaces_title"),icon:sM},{key:"models",label:f("settings.tabs.engines"),icon:Lx},{key:"agent-defaults",label:f("base.defaults_title"),icon:un}]},{title:f("base.nav_activity"),items:[{key:"chat",label:f("project.nav.chat"),icon:Kd},{key:"sessions",label:f("base.sessions_title"),icon:EM},{key:"tasks",label:f("project.nav.tasks"),icon:Pl},{key:"logs",label:f("project.nav.logs"),icon:Xd}]},{title:f("base.nav_system"),items:[{key:"agents",label:f("project.nav.agents"),icon:un},{key:"memories",label:f("project.nav.memories"),icon:Gd},{key:"routines",label:f("project.nav.routines"),icon:Dl},{key:"mcps",label:f("project.nav.mcps"),icon:Hh},{key:"vars",label:f("project.nav.vars"),icon:Uh},{key:"config",label:f("project.nav.config"),icon:Rc}]}]:[{title:f("project.sections.workspace"),items:[{key:"",label:f("project.nav.overview"),icon:$k},{key:"telegram",label:f("project.nav.telegram"),icon:Fs},{key:"chat",label:f("project.nav.chat"),icon:Kd},{key:"agents",label:f("project.nav.agents"),icon:un},{key:"memories",label:f("project.nav.memories"),icon:Gd}]},{title:f("project.sections.automation"),items:[{key:"routines",label:f("project.nav.routines"),icon:Dl},{key:"tasks",label:f("project.nav.tasks"),icon:Pl},{key:"mcps",label:f("project.nav.mcps"),icon:Hh},{key:"vars",label:f("project.nav.vars"),icon:Uh},{key:"logs",label:f("project.nav.logs"),icon:Xd}]},{title:f("project.sections.config"),items:[{key:"config",label:f("project.nav.config"),icon:Rc}]}],[u]),m=t.pathname.replace(`/p/${a}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx($C,{testId:"screen-project-not-found",mood:"confused",message:f("project.not_found",{pid:a}),action:r.jsx(Qa,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})});const g=h=>{const b=h?`/p/${a}/${h}`:`/p/${a}`;e(b)};return r.jsx(VC,{sections:p,active:m,onChange:g,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${m||"overview"}`,children:r.jsxs(Ak,{children:[r.jsx(Qt,{index:!0,element:r.jsx(Vj,{pid:a})}),r.jsx(Qt,{path:"workspaces",element:r.jsx(YP,{})}),r.jsx(Qt,{path:"models",element:r.jsx(aN,{})}),r.jsx(Qt,{path:"agent-defaults",element:r.jsx(KL,{})}),r.jsx(Qt,{path:"sessions",element:r.jsx(e6,{})}),r.jsx(Qt,{path:"logs",element:r.jsx(LL,{pid:a})}),r.jsx(Qt,{path:"config",element:r.jsx(_6,{pid:a})}),r.jsx(Qt,{path:"telegram",element:r.jsx(RI,{pid:a})}),r.jsx(Qt,{path:"agents",element:r.jsx(k6,{pid:a})}),r.jsx(Qt,{path:"agents/:slug",element:r.jsx(j8,{pid:a})}),r.jsx(Qt,{path:"memories",element:r.jsx(AI,{pid:a})}),r.jsx(Qt,{path:"routines",element:r.jsx(I6,{pid:a})}),r.jsx(Qt,{path:"tasks",element:u?r.jsx(t6,{}):r.jsx(B6,{pid:a})}),r.jsx(Qt,{path:"mcps",element:r.jsx(Q6,{pid:a})}),r.jsx(Qt,{path:"vars",element:r.jsx(nI,{pid:a})}),r.jsx(Qt,{path:"threads",element:r.jsx(gA,{to:`/p/${a}/chat`,replace:!0})}),r.jsx(Qt,{path:"chat",element:r.jsx(NI,{pid:a})}),r.jsx(Qt,{path:"*",element:r.jsx(Vj,{pid:a})})]})})}const T8=["es","en","pt","fr","it","de"];function A8(){const e=rt(),{identity:t,isLoading:a,save:o}=Gb(),[l,c]=x.useState({}),[u,p]=x.useState(!1);if(x.useEffect(()=>{c(t)},[t]),a)return r.jsx(lt,{});const m=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(f("settings.identity.saved"))}catch(g){e.error(g.message)}finally{p(!1)}};return r.jsxs(Ke,{title:f("settings.identity.title"),description:f("settings.identity.subtitle"),children:[t?null:r.jsx(xt,{children:f("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("settings.identity.owner_name"),children:r.jsx(Ne,{value:l.owner_name||"",onChange:g=>c({...l,owner_name:g.target.value})})}),r.jsx(le,{label:f("settings.identity.language"),children:r.jsx(bt,{value:l.language||"es",onChange:g=>c({...l,language:g}),options:T8.map(g=>({value:g,label:g}))})}),r.jsx(le,{label:f("settings.identity.timezone"),hint:f("settings.identity.timezone_hint"),children:r.jsx(Ne,{value:l.timezone||"",onChange:g=>c({...l,timezone:g.target.value})})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(le,{label:f("settings.identity.owner_context"),hint:f("settings.identity.owner_context_hint"),children:r.jsx(Mn,{rows:3,value:l.owner_context||"",onChange:g=>c({...l,owner_context:g.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(ce,{variant:"primary",loading:u,onClick:m,children:f("common.save")})})]})}function M8(){const e=rt(),t=Wn(),{superAgent:a,isLoading:o,mutate:l}=nN(),{patch:c}=Vr(),{identity:u,save:p}=Gb(),[m,g]=x.useState(!0),[h,b]=x.useState(""),[v,k]=x.useState(""),[N,w]=x.useState("permiso"),[y,S]=x.useState(!1);if(x.useEffect(()=>{a&&(g(!!a.enabled),b(a.system||""),w(a.permission_mode||"permiso"))},[a]),x.useEffect(()=>{k(u.personality||"")},[u.personality]),o||!a)return r.jsx(lt,{});const C=async()=>{S(!0);try{await c({"super_agent.enabled":m,"super_agent.system":h,"super_agent.permission_mode":N},["super_agent.name"]),await p({personality:v}),e.success(f("settings.super_agent.saved")),l()}catch(E){e.error(E.message)}finally{S(!1)}};return r.jsx(Ke,{title:f("settings.super_agent.title"),description:f("settings.super_agent.behavior_subtitle"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(Ft,{checked:m,onChange:g,label:f("settings.super_agent.enabled_label")})}),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:f("settings.super_agent.model_active")}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:a.model||"—"})]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[r.jsx(Lx,{size:13})," ",f("settings.super_agent.model_configure")]})]}),r.jsx(le,{label:f("settings.super_agent.permission_mode"),children:r.jsx(bt,{value:N,onChange:w,options:$x.map(E=>({value:E,label:E}))})}),r.jsx(le,{label:f("settings.super_agent.personality"),children:r.jsx(Mn,{rows:2,value:v,onChange:E=>k(E.target.value)})}),r.jsx(le,{label:f("settings.super_agent.system"),hint:f("settings.super_agent.system_hint"),children:r.jsx(Mn,{rows:6,className:"font-mono text-xs",value:h,onChange:E=>b(E.target.value),placeholder:f("settings.super_agent.system_ph")})}),r.jsx(ce,{variant:"primary",loading:y,onClick:C,children:f("common.save")})]})})}const ch={providers:()=>ge.get("/embeddings/providers"),test:(e={})=>ge.post("/embeddings/test",e),reindex:()=>ge.post("/embeddings/reindex",{})},O8=()=>[{value:"auto",label:f("memory_panel.provider_auto")},{value:"ollama",label:f("memory_panel.provider_ollama")},{value:"gemini",label:f("memory_panel.provider_gemini")},{value:"openai",label:f("memory_panel.provider_openai")},{value:"tf",label:f("memory_panel.provider_tf")}],z8=()=>[{value:"chain",label:f("memory_panel.mode_chain")},{value:"single",label:f("memory_panel.mode_single")}],fw=e=>e.startsWith("***");function D8(){const e=rt(),{config:t,isLoading:a,patch:o}=Vr(),{data:l,mutate:c}=et("/embeddings/providers",()=>ch.providers()),[u,p]=x.useState(!1),[m,g]=x.useState(null);if(a)return r.jsx(lt,{});const h=t.memory||{},b=h.embeddings||{},v=l?.configured_provider||b.provider||"auto",k=l?.mode||b.mode||"chain",N=l?.engines||[],w=async C=>{p(!0);try{await o(C),await c()}catch(E){e.error(f("memory_panel.save_failed",{msg:E.message}))}finally{p(!1)}},y=async()=>{p(!0),g(null);try{const C=await ch.test({});g(`${C.embedder} · dim ${C.dim} · ${C.ms}ms`),e.success(f("memory_panel.test_ok",{embedder:C.embedder}))}catch(C){e.error(f("memory_panel.test_failed",{msg:C.message}))}finally{p(!1)}},S=async()=>{p(!0);try{const C=await ch.reindex();e.success(f("memory_panel.reindexed",{indexed:C.indexed,cleared:C.cleared}))}catch(C){e.error(f("memory_panel.reindex_failed",{msg:C.message}))}finally{p(!1)}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("memory_panel.embeddings_title"),description:f("memory_panel.embeddings_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("memory_panel.provider_label"),hint:f("memory_panel.provider_hint"),children:r.jsx(bt,{value:v,onChange:C=>w({"memory.embeddings.provider":C}),options:O8(),disabled:u,className:"max-w-xl"})}),r.jsx(le,{label:f("memory_panel.mode_label"),hint:f("memory_panel.mode_hint"),children:r.jsx(bt,{value:k,onChange:C=>w({"memory.embeddings.mode":C}),options:z8(),disabled:u,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:N.map(C=>r.jsxs(Fe,{tone:C.available?"success":"muted",children:[C.id,": ",C.available?f("memory_panel.available"):f("memory_panel.unavailable")]},C.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ce,{variant:"secondary",onClick:y,loading:u,children:[r.jsx(pa,{size:14})," ",f("memory_panel.test_btn")]}),r.jsxs(ce,{variant:"secondary",onClick:S,loading:u,children:[r.jsx(Vk,{size:14})," ",f("memory_panel.reindex_btn")]}),m&&r.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),r.jsxs(Ke,{title:f("memory_panel.ollama_title"),description:f("memory_panel.ollama_desc"),children:[r.jsx(le,{label:f("memory_panel.model_label"),children:r.jsx(Ne,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:u,onBlur:C=>{const E=C.target.value.trim();E&&E!==b.ollama?.model&&w({"memory.embeddings.ollama.model":E})},className:"max-w-md"})}),r.jsx(le,{label:f("memory_panel.base_url_label"),hint:f("memory_panel.ollama_base_url_hint"),children:r.jsx(Ne,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:u,onBlur:C=>w({"memory.embeddings.ollama.base_url":C.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.openai_title"),description:f("memory_panel.openai_desc"),children:[r.jsx(le,{label:f("memory_panel.model_label"),children:r.jsx(Ne,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:u,onBlur:C=>{const E=C.target.value.trim();E&&E!==b.openai?.model&&w({"memory.embeddings.openai.model":E})},className:"max-w-md"})}),r.jsx(le,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.openai_key_hint"),children:r.jsx(Ne,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:u,onBlur:C=>{const E=C.target.value;E&&!fw(E)&&w({"memory.embeddings.openai.api_key":E})},className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.gemini_title"),description:f("memory_panel.gemini_desc"),children:[r.jsx(le,{label:f("memory_panel.model_label"),children:r.jsx(Ne,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:u,onBlur:C=>{const E=C.target.value.trim();E&&E!==b.gemini?.model&&w({"memory.embeddings.gemini.model":E})},className:"max-w-md"})}),r.jsx(le,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.gemini_key_hint"),children:r.jsx(Ne,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:u,onBlur:C=>{const E=C.target.value;E&&!fw(E)&&w({"memory.embeddings.gemini.api_key":E})},className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.compaction_title"),description:f("memory_panel.compaction_desc"),children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(le,{label:f("memory_panel.threshold_label"),hint:f("memory_panel.threshold_hint"),children:r.jsx(Ne,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:u,onBlur:C=>{const E=parseInt(C.target.value,10);Number.isFinite(E)&&E>0&&E!==h.compact_threshold&&w({"memory.compact_threshold":E})},className:"max-w-[10rem]"})}),r.jsx(le,{label:f("memory_panel.keep_recent_label"),hint:f("memory_panel.keep_recent_hint"),children:r.jsx(Ne,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:u,onBlur:C=>{const E=parseInt(C.target.value,10);Number.isFinite(E)&&E>0&&E!==h.keep_recent&&w({"memory.keep_recent":E})},className:"max-w-[10rem]"})})]}),r.jsx(le,{label:f("memory_panel.compact_model_label"),hint:f("memory_panel.compact_model_hint"),children:r.jsx(Ne,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:u,onBlur:C=>{const E=C.target.value.trim();E&&E!==h.compact_model&&w({"memory.compact_model":E})},className:"max-w-md"})}),r.jsx(le,{label:f("memory_panel.compact_fallback_label"),hint:f("memory_panel.compact_fallback_hint"),children:r.jsx(Ne,{defaultValue:h.compact_fallback_model||"",placeholder:f("memory_panel.compact_fallback_ph"),disabled:u,onBlur:C=>{const E=C.target.value.trim();E!==(h.compact_fallback_model||"")&&w({"memory.compact_fallback_model":E})},className:"max-w-md"})})]})]})}function P8(){return[{key:"load_threshold",label:f("settings_ui.knob_load_threshold"),hint:f("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:f("settings_ui.knob_hint_threshold"),hint:f("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:f("settings_ui.knob_margin"),hint:f("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:f("settings_ui.knob_max_loaded"),hint:f("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:f("settings_ui.knob_max_hints"),hint:f("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:f("settings_ui.knob_prompt_floor"),hint:f("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:f("settings_ui.knob_body_char_cap"),hint:f("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function L8(){const e=rt(),{data:t,mutate:a,isLoading:o}=et("/skills/inspector",()=>fc.inspector()),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,g]=x.useState(null);if(o||!t)return r.jsx(lt,{});const h=t.config,b=t.index,v=async w=>{c(!0);try{await fc.updateInspector(w),await a()}catch(y){e.error(f("settings_ui.could_not_save",{msg:y.message}))}finally{c(!1)}},k=async(w=!1)=>{c(!0);try{const y=await fc.index({force:w});e.success(f("settings_ui.indexed_with",{embedder:y.embedder,dim:y.dim,added:y.changed.added,refreshed:y.changed.refreshed,removed:y.changed.removed})),await a()}catch(y){e.error(f("settings_ui.index_failed",{msg:y.message}))}finally{c(!1)}},N=async()=>{if(u.trim()){c(!0),g(null);try{const w=await fc.inspect(u.trim());g(w.trace)}catch(w){e.error(f("settings_ui.dry_run_failed",{msg:w.message}))}finally{c(!1)}}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("settings_ui.inspector_title"),description:f("settings_ui.inspector_desc"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(le,{label:f("settings_ui.enable_inspector"),hint:f("settings_ui.enable_inspector_hint"),children:r.jsx(Ft,{checked:h.enabled,disabled:l,onChange:w=>v({enabled:w}),label:h.enabled?f("settings_ui.on"):f("settings_ui.off")})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsx(Fe,{tone:b.count>0?"success":"warning",children:f("settings_ui.index_count",{n:b.count})}),r.jsx(Fe,{tone:"muted",children:b.embedder||f("settings_ui.not_indexed")}),b.dim?r.jsx(Fe,{tone:"muted",children:f("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ce,{variant:"secondary",onClick:()=>k(!1),loading:l,children:[r.jsx(ua,{size:14})," ",f("settings_ui.reindex")]}),r.jsxs(ce,{variant:"secondary",onClick:()=>k(!0),loading:l,children:[r.jsx(ua,{size:14})," ",f("settings_ui.reindex_forced")]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.embedder_source")})]})]})}),r.jsx(Ke,{title:f("settings_ui.thresholds_title"),description:f("settings_ui.thresholds_desc"),children:r.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:P8().map(w=>r.jsx(le,{label:w.label,hint:w.hint,children:r.jsx(Ne,{type:"number",step:w.step,min:w.min,max:w.max,defaultValue:String(h[w.key]),disabled:l,onBlur:y=>{const S=Number(y.target.value);Number.isFinite(S)&&S!==h[w.key]&&v({[w.key]:S})},className:"max-w-[12rem]"})},w.key))})}),r.jsx(Ke,{title:f("settings_ui.test_title"),description:f("settings_ui.test_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Ne,{value:u,placeholder:f("settings_ui.test_placeholder"),disabled:l,onChange:w=>p(w.target.value),onKeyDown:w=>{w.key==="Enter"&&N()},className:"max-w-xl flex-1"}),r.jsxs(ce,{variant:"primary",onClick:N,loading:l,children:[r.jsx(XM,{size:14})," ",f("settings_ui.test_btn")]})]}),m&&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(pa,{size:14,className:"text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?r.jsx(Fe,{tone:"warning",children:f("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?r.jsx(Fe,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.loaded_label")," "]}),m.loaded.map(w=>r.jsx(Fe,{tone:"success",className:"mr-1",children:w},w))]}):null,m.hinted?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.suggested_label")," "]}),m.hinted.map(w=>r.jsx(Fe,{tone:"info",className:"mr-1",children:w},w))]}):null,m.scored?.length?r.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(w=>r.jsxs("div",{children:[w.sim.toFixed(3)," ",w.slug]},w.slug))}):null]})]})})]})}function I8(){const e=rt(),{config:t,isLoading:a,patch:o,mutate:l}=Vr(),c=t.telegram?.channels||[],u=Math.max(0,c.findIndex(A=>A.name==="default")),p=c[u],[m,g]=x.useState(!0),[h,b]=x.useState(1500),[v,k]=x.useState(!0),[N,w]=x.useState(""),[y,S]=x.useState(""),[C,E]=x.useState(!1);if(x.useEffect(()=>{g(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),k(!!t.telegram?.respond_with_engine),w(""),S(p?.chat_id||"")},[t,p?.chat_id]),a)return r.jsx(lt,{});const R=async()=>{E(!0);try{const A=c.slice(),T={name:"default",chat_id:y,respond_with_engine:v,...N?{bot_token:N}:{}};c.length===0?A.push(T):A[u]={...p,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":v,"telegram.channels":A}),e.success(f("settings.telegram_global.saved")),l(),w("")}catch(A){e.error(A.message)}finally{E(!1)}};return r.jsx(Ke,{title:f("settings.telegram_global.title"),description:f("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(Ft,{checked:m,onChange:g,label:f("settings.telegram_global.enabled")}),r.jsx(Ft,{checked:v,onChange:k,label:f("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${jo(p.bot_token)??""} ${f("telegram_ui.secret_set_replace")}`:f("telegram_ui.bot_token_hint_short"),children:r.jsx(Ne,{type:"password",value:N,onChange:A=>w(A.target.value),placeholder:p?.bot_token?`…${jo(p.bot_token)??""} ${f("telegram_ui.secret_already_set")}`:""})}),r.jsx(le,{label:f("settings.telegram_global.chat_id"),children:r.jsx(Ne,{value:y,onChange:A=>S(A.target.value),placeholder:"889721252"})}),r.jsx(le,{label:f("settings.telegram_global.poll_interval"),children:r.jsx(Ne,{type:"number",value:String(h),onChange:A=>b(Number(A.target.value)||1500)})})]}),r.jsx(ce,{variant:"primary",loading:C,onClick:R,children:f("common.save")})]})})}function B8(){const e=rt(),{channels:t,isLoading:a,mutate:o}=Zb(),{contacts:l}=Jb(),[c,u]=x.useState(null),[p,m]=x.useState(null),g=new Map;for(const b of l)g.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const h=async b=>{if(confirm(f("telegram_channels.delete_confirm",{name:b})))try{await An.channels.remove(b),e.success(f("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return r.jsxs(Ke,{title:f("telegram_channels.title"),description:f("telegram_channels.desc"),action:r.jsxs(ce,{size:"sm",onClick:()=>u({name:""}),children:[r.jsx(tn,{size:14})," ",f("telegram_channels.new_btn")]}),children:[a&&r.jsx(lt,{}),!a&&t.length===0&&r.jsx(xt,{children:f("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const v=b.owner_user_id!=null?g.get(String(b.owner_user_id))||f("telegram_ui.user_id_fallback",{id:b.owner_user_id}):f("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(Fe,{tone:"success",children:["project = ",b.project]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[r.jsx(Fs,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>u(b),children:f("common.edit")}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>h(b.name),children:f("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?`…${jo(b.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||f("telegram_ui.default_apx")]}),r.jsxs("span",{children:["engine: ",b.respond_with_engine?f("telegram_ui.yes"):f("telegram_ui.no")]}),r.jsxs("span",{className:"col-span-2",children:[f("telegram_channels.owner_label")," ",v]})]})]},b.name)})}),r.jsx(OC,{channel:c,onClose:()=>u(null),onSaved:()=>{u(null),o()}}),r.jsx(zC,{channel:p,onClose:()=>m(null)})]})}const pw=new Set(["owner","guest"]);function U8(){const e=rt(),{roles:t,mutate:a,isLoading:o}=Jb(),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(!1),v=async()=>{const w=l.trim();if(!w){e.error(f("telegram_roles.name_required"));return}if(pw.has(w)){e.error(f("telegram_roles.builtin_error",{name:w}));return}b(!0);try{const y=m?"*":u.split(",").map(S=>S.trim()).filter(Boolean);await An.roles.set(w,y),e.success(f("telegram_roles.saved",{name:w})),c(""),p(""),g(!1),a()}catch(y){e.error(y.message)}finally{b(!1)}},k=async w=>{if(confirm(f("telegram_roles.delete_confirm",{name:w})))try{await An.roles.remove(w),e.success(f("telegram_roles.removed")),a()}catch(y){e.error(y.message)}},N=Object.entries(t);return r.jsxs(Ke,{title:f("telegram_roles.title"),description:f("telegram_roles.desc"),children:[o&&r.jsx(lt,{}),N.length===0&&!o&&r.jsx(xt,{children:f("telegram_roles.empty")}),N.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:N.map(([w,y])=>{const S=pw.has(w),C=y?.tools==="*"?f("telegram_roles.tools_all"):Array.isArray(y?.tools)&&y.tools.length>0?y.tools.join(", "):f("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:w}),S&&r.jsx(Fe,{tone:"info",children:f("telegram_roles.builtin")})]}),!S&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>k(w),children:f("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("telegram_contacts.tools_label")," ",C]})]},w)})}),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(tn,{size:14})," ",f("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(le,{label:f("telegram_roles.name_label"),children:r.jsx(Ne,{value:l,onChange:w=>c(w.target.value),placeholder:f("telegram_roles.name_ph")})}),r.jsx(le,{label:f("telegram_roles.tools_label"),hint:f("telegram_roles.tools_hint"),children:r.jsx(Ne,{value:u,onChange:w=>p(w.target.value),disabled:m,placeholder:f("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ft,{checked:m,onChange:g,label:f("telegram_roles.full_access")}),r.jsx(ce,{variant:"primary",loading:h,onClick:v,children:f("telegram_roles.save_btn")})]})]})]})}const RN="apx.settings.telegramTab";function H8(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(RN);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function V8(){const[e,t]=x.useState("default");x.useEffect(()=>{t(H8())},[]);const a=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(l);try{window.localStorage.setItem(RN,l)}catch{}};return r.jsxs(up,{value:e,onValueChange:a,className:"w-full",children:[r.jsxs(dp,{children:[r.jsx(aa,{value:"default",children:f("settings.telegram_global.title")}),r.jsx(aa,{value:"channels",children:f("telegram_channels.title")}),r.jsx(aa,{value:"contacts",children:f("telegram_contacts.title")}),r.jsx(aa,{value:"roles",children:f("telegram_roles.title")})]}),r.jsx(Ds,{value:"default",className:"mt-4",children:r.jsx(I8,{})}),r.jsx(Ds,{value:"channels",className:"mt-4",children:r.jsx(B8,{})}),r.jsx(Ds,{value:"contacts",className:"mt-4",children:r.jsx(DC,{})}),r.jsx(Ds,{value:"roles",className:"mt-4",children:r.jsx(U8,{})})]})}function q8(){const{data:e,error:t,isLoading:a,mutate:o}=et("/pair/list",()=>Fl.list(),{refreshInterval:Mf.pairList});return{clients:e?.clients||[],error:t,isLoading:a,mutate:o}}var vl={},uh,mw;function $8(){return mw||(mw=1,uh=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),uh}var dh={},Sr={},gw;function Ao(){if(gw)return Sr;gw=1;let e;const t=[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 Sr.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},Sr.getSymbolTotalCodewords=function(o){return t[o]},Sr.getBCHDigit=function(a){let o=0;for(;a!==0;)o++,a>>>=1;return o},Sr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},Sr.isKanjiModeEnabled=function(){return typeof e<"u"},Sr.toSJIS=function(o){return e(o)},Sr}var fh={},hw;function g_(){return hw||(hw=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.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: "+a)}}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 t(o)}catch{return l}}})(fh)),fh}var ph,xw;function F8(){if(xw)return ph;xw=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const a=Math.floor(t/8);return(this.buffer[a]>>>7-t%8&1)===1},put:function(t,a){for(let o=0;o<a;o++)this.putBit((t>>>a-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),t&&(this.buffer[a]|=128>>>this.length%8),this.length++}},ph=e,ph}var mh,bw;function G8(){if(bw)return mh;bw=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,a,o,l){const c=t*this.size+a;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(t,a){return this.data[t*this.size+a]},e.prototype.xor=function(t,a,o){this.data[t*this.size+a]^=o},e.prototype.isReserved=function(t,a){return this.reservedBit[t*this.size+a]},mh=e,mh}var gh={},_w;function Y8(){return _w||(_w=1,(function(e){const t=Ao().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=t(o),u=c===145?26:Math.ceil((c-13)/(2*l-2))*2,p=[c-7];for(let m=1;m<l-1;m++)p[m]=p[m-1]-u;return p.push(6),p.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),u=c.length;for(let p=0;p<u;p++)for(let m=0;m<u;m++)p===0&&m===0||p===0&&m===u-1||p===u-1&&m===0||l.push([c[p],c[m]]);return l}})(gh)),gh}var hh={},vw;function K8(){if(vw)return hh;vw=1;const e=Ao().getSymbolSize,t=7;return hh.getPositions=function(o){const l=e(o);return[[0,0],[l-t,0],[0,l-t]]},hh}var xh={},yw;function X8(){return yw||(yw=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={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 u=0,p=0,m=0,g=null,h=null;for(let b=0;b<c;b++){p=m=0,g=h=null;for(let v=0;v<c;v++){let k=l.get(b,v);k===g?p++:(p>=5&&(u+=t.N1+(p-5)),g=k,p=1),k=l.get(v,b),k===h?m++:(m>=5&&(u+=t.N1+(m-5)),h=k,m=1)}p>=5&&(u+=t.N1+(p-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(l){const c=l.size;let u=0;for(let p=0;p<c-1;p++)for(let m=0;m<c-1;m++){const g=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(g===4||g===0)&&u++}return u*t.N2},e.getPenaltyN3=function(l){const c=l.size;let u=0,p=0,m=0;for(let g=0;g<c;g++){p=m=0;for(let h=0;h<c;h++)p=p<<1&2047|l.get(g,h),h>=10&&(p===1488||p===93)&&u++,m=m<<1&2047|l.get(h,g),h>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(l){let c=0;const u=l.data.length;for(let m=0;m<u;m++)c+=l.data[m];return Math.abs(Math.ceil(c*100/u/5)-10)*t.N4};function a(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 u=c.size;for(let p=0;p<u;p++)for(let m=0;m<u;m++)c.isReserved(m,p)||c.xor(m,p,a(l,m,p))},e.getBestMask=function(l,c){const u=Object.keys(e.Patterns).length;let p=0,m=1/0;for(let g=0;g<u;g++){c(g),e.applyMask(g,l);const h=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(g,l),h<m&&(m=h,p=g)}return p}})(xh)),xh}var Od={},jw;function TN(){if(jw)return Od;jw=1;const e=g_(),t=[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],a=[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 Od.getBlocksCount=function(l,c){switch(c){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},Od.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return a[(l-1)*4+0];case e.M:return a[(l-1)*4+1];case e.Q:return a[(l-1)*4+2];case e.H:return a[(l-1)*4+3];default:return}},Od}var bh={},ic={},ww;function Q8(){if(ww)return ic;ww=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,t[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),ic.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},ic.exp=function(o){return e[o]},ic.mul=function(o,l){return o===0||l===0?0:e[t[o]+t[l]]},ic}var kw;function W8(){return kw||(kw=1,(function(e){const t=Q8();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let u=0;u<o.length;u++)for(let p=0;p<l.length;p++)c[u+p]^=t.mul(o[u],l[p]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const u=c[0];for(let m=0;m<l.length;m++)c[m]^=t.mul(l[m],u);let p=0;for(;p<c.length&&c[p]===0;)p++;c=c.slice(p)}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,t.exp(c)]));return l}})(bh)),bh}var _h,Sw;function Z8(){if(Sw)return _h;Sw=1;const e=W8();function t(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},t.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),u=this.degree-c.length;if(u>0){const p=new Uint8Array(this.degree);return p.set(c,u),p}return c},_h=t,_h}var vh={},yh={},jh={},Cw;function AN(){return Cw||(Cw=1,jh.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),jh}var Js={},Nw;function MN(){if(Nw)return Js;Nw=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
|
|
639
|
+
]))+`;Js.KANJI=new RegExp(a,"g"),Js.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Js.BYTE=new RegExp(o,"g"),Js.NUMERIC=new RegExp(e,"g"),Js.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+a+"$"),c=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Js.testKanji=function(m){return l.test(m)},Js.testNumeric=function(m){return c.test(m)},Js.testAlphanumeric=function(m){return u.test(m)},Js}var Ew;function Mo(){return Ew||(Ew=1,(function(e){const t=AN(),a=MN();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,u){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?c.ccBits[0]:u<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return a.testNumeric(c)?e.NUMERIC:a.testAlphanumeric(c)?e.ALPHANUMERIC:a.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,u){if(e.isValid(c))return c;try{return o(c)}catch{return u}}})(yh)),yh}var Rw;function J8(){return Rw||(Rw=1,(function(e){const t=Ao(),a=TN(),o=g_(),l=Mo(),c=AN(),u=7973,p=t.getBCHDigit(u);function m(v,k,N){for(let w=1;w<=40;w++)if(k<=e.getCapacity(w,N,v))return w}function g(v,k){return l.getCharCountIndicator(v,k)+4}function h(v,k){let N=0;return v.forEach(function(w){const y=g(w.mode,k);N+=y+w.getBitsLength()}),N}function b(v,k){for(let N=1;N<=40;N++)if(h(v,N)<=e.getCapacity(N,k,l.MIXED))return N}e.from=function(k,N){return c.isValid(k)?parseInt(k,10):N},e.getCapacity=function(k,N,w){if(!c.isValid(k))throw new Error("Invalid QR Code version");typeof w>"u"&&(w=l.BYTE);const y=t.getSymbolTotalCodewords(k),S=a.getTotalCodewordsCount(k,N),C=(y-S)*8;if(w===l.MIXED)return C;const E=C-g(w,k);switch(w){case l.NUMERIC:return Math.floor(E/10*3);case l.ALPHANUMERIC:return Math.floor(E/11*2);case l.KANJI:return Math.floor(E/13);case l.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(k,N){let w;const y=o.from(N,o.M);if(Array.isArray(k)){if(k.length>1)return b(k,y);if(k.length===0)return 1;w=k[0]}else w=k;return m(w.mode,w.getLength(),y)},e.getEncodedBits=function(k){if(!c.isValid(k)||k<7)throw new Error("Invalid QR Code version");let N=k<<12;for(;t.getBCHDigit(N)-p>=0;)N^=u<<t.getBCHDigit(N)-p;return k<<12|N}})(vh)),vh}var wh={},Tw;function e7(){if(Tw)return wh;Tw=1;const e=Ao(),t=1335,a=21522,o=e.getBCHDigit(t);return wh.getEncodedBits=function(c,u){const p=c.bit<<3|u;let m=p<<10;for(;e.getBCHDigit(m)-o>=0;)m^=t<<e.getBCHDigit(m)-o;return(p<<10|m)^a},wh}var kh={},Sh,Aw;function t7(){if(Aw)return Sh;Aw=1;const e=Mo();function t(a){this.mode=e.NUMERIC,this.data=a.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let l,c,u;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),u=parseInt(c,10),o.put(u,10);const p=this.data.length-l;p>0&&(c=this.data.substr(l),u=parseInt(c,10),o.put(u,p*3+1))},Sh=t,Sh}var Ch,Mw;function n7(){if(Mw)return Ch;Mw=1;const e=Mo(),t=["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 a(o){this.mode=e.ALPHANUMERIC,this.data=o}return a.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let u=t.indexOf(this.data[c])*45;u+=t.indexOf(this.data[c+1]),l.put(u,11)}this.data.length%2&&l.put(t.indexOf(this.data[c]),6)},Ch=a,Ch}var Nh,Ow;function s7(){if(Ow)return Nh;Ow=1;const e=Mo();function t(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return t.getBitsLength=function(o){return o*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(a){for(let o=0,l=this.data.length;o<l;o++)a.put(this.data[o],8)},Nh=t,Nh}var Eh,zw;function a7(){if(zw)return Eh;zw=1;const e=Mo(),t=Ao();function a(o){this.mode=e.KANJI,this.data=o}return a.getBitsLength=function(l){return l*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=t.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]+`
|
|
640
|
+
Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Eh=a,Eh}var Rh={exports:{}},Dw;function r7(){return Dw||(Dw=1,(function(e){var t={single_source_shortest_paths:function(a,o,l){var c={},u={};u[o]=0;var p=t.PriorityQueue.make();p.push(o,0);for(var m,g,h,b,v,k,N,w,y;!p.empty();){m=p.pop(),g=m.value,b=m.cost,v=a[g]||{};for(h in v)v.hasOwnProperty(h)&&(k=v[h],N=b+k,w=u[h],y=typeof u[h]>"u",(y||w>N)&&(u[h]=N,p.push(h,N),c[h]=g))}if(typeof l<"u"&&typeof u[l]>"u"){var S=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(S)}return c},extract_shortest_path_from_predecessor_list:function(a,o){for(var l=[],c=o;c;)l.push(c),a[c],c=a[c];return l.reverse(),l},find_path:function(a,o,l){var c=t.single_source_shortest_paths(a,o,l);return t.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(a){var o=t.PriorityQueue,l={},c;a=a||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=a.sorter||o.default_sorter,l},default_sorter:function(a,o){return a.cost-o.cost},push:function(a,o){var l={value:a,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=t})(Rh)),Rh.exports}var Pw;function o7(){return Pw||(Pw=1,(function(e){const t=Mo(),a=t7(),o=n7(),l=s7(),c=a7(),u=MN(),p=Ao(),m=r7();function g(S){return unescape(encodeURIComponent(S)).length}function h(S,C,E){const R=[];let A;for(;(A=S.exec(E))!==null;)R.push({data:A[0],index:A.index,mode:C,length:A[0].length});return R}function b(S){const C=h(u.NUMERIC,t.NUMERIC,S),E=h(u.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,A;return p.isKanjiModeEnabled()?(R=h(u.BYTE,t.BYTE,S),A=h(u.KANJI,t.KANJI,S)):(R=h(u.BYTE_KANJI,t.BYTE,S),A=[]),C.concat(E,R,A).sort(function(M,z){return M.index-z.index}).map(function(M){return{data:M.data,mode:M.mode,length:M.length}})}function v(S,C){switch(C){case t.NUMERIC:return a.getBitsLength(S);case t.ALPHANUMERIC:return o.getBitsLength(S);case t.KANJI:return c.getBitsLength(S);case t.BYTE:return l.getBitsLength(S)}}function k(S){return S.reduce(function(C,E){const R=C.length-1>=0?C[C.length-1]:null;return R&&R.mode===E.mode?(C[C.length-1].data+=E.data,C):(C.push(E),C)},[])}function N(S){const C=[];for(let E=0;E<S.length;E++){const R=S[E];switch(R.mode){case t.NUMERIC:C.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:C.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:C.push([R,{data:R.data,mode:t.BYTE,length:g(R.data)}]);break;case t.BYTE:C.push([{data:R.data,mode:t.BYTE,length:g(R.data)}])}}return C}function w(S,C){const E={},R={start:{}};let A=["start"];for(let T=0;T<S.length;T++){const M=S[T],z=[];for(let I=0;I<M.length;I++){const P=M[I],H=""+T+I;z.push(H),E[H]={node:P,lastCount:0},R[H]={};for(let D=0;D<A.length;D++){const B=A[D];E[B]&&E[B].node.mode===P.mode?(R[B][H]=v(E[B].lastCount+P.length,P.mode)-v(E[B].lastCount,P.mode),E[B].lastCount+=P.length):(E[B]&&(E[B].lastCount=P.length),R[B][H]=v(P.length,P.mode)+4+t.getCharCountIndicator(P.mode,C))}}A=z}for(let T=0;T<A.length;T++)R[A[T]].end=0;return{map:R,table:E}}function y(S,C){let E;const R=t.getBestModeForData(S);if(E=t.from(C,R),E!==t.BYTE&&E.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(E)+`.
|
|
641
|
+
Suggested mode is: `+t.toString(R));switch(E===t.KANJI&&!p.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new a(S);case t.ALPHANUMERIC:return new o(S);case t.KANJI:return new c(S);case t.BYTE:return new l(S)}}e.fromArray=function(C){return C.reduce(function(E,R){return typeof R=="string"?E.push(y(R,null)):R.data&&E.push(y(R.data,R.mode)),E},[])},e.fromString=function(C,E){const R=b(C,p.isKanjiModeEnabled()),A=N(R),T=w(A,E),M=m.find_path(T.map,"start","end"),z=[];for(let I=1;I<M.length-1;I++)z.push(T.table[M[I]].node);return e.fromArray(k(z))},e.rawSplit=function(C){return e.fromArray(b(C,p.isKanjiModeEnabled()))}})(kh)),kh}var Lw;function l7(){if(Lw)return dh;Lw=1;const e=Ao(),t=g_(),a=F8(),o=G8(),l=Y8(),c=K8(),u=X8(),p=TN(),m=Z8(),g=J8(),h=e7(),b=Mo(),v=o7();function k(T,M){const z=T.size,I=c.getPositions(M);for(let P=0;P<I.length;P++){const H=I[P][0],D=I[P][1];for(let B=-1;B<=7;B++)if(!(H+B<=-1||z<=H+B))for(let V=-1;V<=7;V++)D+V<=-1||z<=D+V||(B>=0&&B<=6&&(V===0||V===6)||V>=0&&V<=6&&(B===0||B===6)||B>=2&&B<=4&&V>=2&&V<=4?T.set(H+B,D+V,!0,!0):T.set(H+B,D+V,!1,!0))}}function N(T){const M=T.size;for(let z=8;z<M-8;z++){const I=z%2===0;T.set(z,6,I,!0),T.set(6,z,I,!0)}}function w(T,M){const z=l.getPositions(M);for(let I=0;I<z.length;I++){const P=z[I][0],H=z[I][1];for(let D=-2;D<=2;D++)for(let B=-2;B<=2;B++)D===-2||D===2||B===-2||B===2||D===0&&B===0?T.set(P+D,H+B,!0,!0):T.set(P+D,H+B,!1,!0)}}function y(T,M){const z=T.size,I=g.getEncodedBits(M);let P,H,D;for(let B=0;B<18;B++)P=Math.floor(B/3),H=B%3+z-8-3,D=(I>>B&1)===1,T.set(P,H,D,!0),T.set(H,P,D,!0)}function S(T,M,z){const I=T.size,P=h.getEncodedBits(M,z);let H,D;for(H=0;H<15;H++)D=(P>>H&1)===1,H<6?T.set(H,8,D,!0):H<8?T.set(H+1,8,D,!0):T.set(I-15+H,8,D,!0),H<8?T.set(8,I-H-1,D,!0):H<9?T.set(8,15-H-1+1,D,!0):T.set(8,15-H-1,D,!0);T.set(I-8,8,1,!0)}function C(T,M){const z=T.size;let I=-1,P=z-1,H=7,D=0;for(let B=z-1;B>0;B-=2)for(B===6&&B--;;){for(let V=0;V<2;V++)if(!T.isReserved(P,B-V)){let $=!1;D<M.length&&($=(M[D]>>>H&1)===1),T.set(P,B-V,$),H--,H===-1&&(D++,H=7)}if(P+=I,P<0||z<=P){P-=I,I=-I;break}}}function E(T,M,z){const I=new a;z.forEach(function(V){I.put(V.mode.bit,4),I.put(V.getLength(),b.getCharCountIndicator(V.mode,T)),V.write(I)});const P=e.getSymbolTotalCodewords(T),H=p.getTotalCodewordsCount(T,M),D=(P-H)*8;for(I.getLengthInBits()+4<=D&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const B=(D-I.getLengthInBits())/8;for(let V=0;V<B;V++)I.put(V%2?17:236,8);return R(I,T,M)}function R(T,M,z){const I=e.getSymbolTotalCodewords(M),P=p.getTotalCodewordsCount(M,z),H=I-P,D=p.getBlocksCount(M,z),B=I%D,V=D-B,$=Math.floor(I/D),q=Math.floor(H/D),Y=q+1,K=$-q,F=new m(K);let X=0;const L=new Array(D),G=new Array(D);let Z=0;const ee=new Uint8Array(T.buffer);for(let me=0;me<D;me++){const Te=me<V?q:Y;L[me]=ee.slice(X,X+Te),G[me]=F.encode(L[me]),X+=Te,Z=Math.max(Z,Te)}const de=new Uint8Array(I);let fe=0,ae,oe;for(ae=0;ae<Z;ae++)for(oe=0;oe<D;oe++)ae<L[oe].length&&(de[fe++]=L[oe][ae]);for(ae=0;ae<K;ae++)for(oe=0;oe<D;oe++)de[fe++]=G[oe][ae];return de}function A(T,M,z,I){let P;if(Array.isArray(T))P=v.fromArray(T);else if(typeof T=="string"){let $=M;if(!$){const q=v.rawSplit(T);$=g.getBestVersionForData(q,z)}P=v.fromString(T,$||40)}else throw new Error("Invalid data");const H=g.getBestVersionForData(P,z);if(!H)throw new Error("The amount of data is too big to be stored in a QR Code");if(!M)M=H;else if(M<H)throw new Error(`
|
|
642
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
643
|
+
Minimum version required to store current data is: `+H+`.
|
|
644
|
+
`);const D=E(M,z,P),B=e.getSymbolSize(M),V=new o(B);return k(V,M),N(V),w(V,M),S(V,z,0),M>=7&&y(V,M),C(V,D),isNaN(I)&&(I=u.getBestMask(V,S.bind(null,V,z))),u.applyMask(I,V),S(V,z,I),{modules:V,version:M,errorCorrectionLevel:z,maskPattern:I,segments:P}}return dh.create=function(M,z){if(typeof M>"u"||M==="")throw new Error("No input text");let I=t.M,P,H;return typeof z<"u"&&(I=t.from(z.errorCorrectionLevel,t.M),P=g.from(z.version),H=u.from(z.maskPattern),z.toSJISFunc&&e.setToSJISFunction(z.toSJISFunc)),A(M,P,I,H)},dh}var Th={},Ah={},Iw;function ON(){return Iw||(Iw=1,(function(e){function t(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let o=a.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+a);(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,u=o.scale||4;return{width:c,scale:c?4:u,margin:l,color:{dark:t(o.color.dark||"#000000ff"),light:t(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 u=l.modules.size,p=l.modules.data,m=e.getScale(u,c),g=Math.floor((u+c.margin*2)*m),h=c.margin*m,b=[c.color.light,c.color.dark];for(let v=0;v<g;v++)for(let k=0;k<g;k++){let N=(v*g+k)*4,w=c.color.light;if(v>=h&&k>=h&&v<g-h&&k<g-h){const y=Math.floor((v-h)/m),S=Math.floor((k-h)/m);w=b[p[y*u+S]?1:0]}o[N++]=w.r,o[N++]=w.g,o[N++]=w.b,o[N]=w.a}}})(Ah)),Ah}var Bw;function i7(){return Bw||(Bw=1,(function(e){const t=ON();function a(l,c,u){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=u,c.width=u,c.style.height=u+"px",c.style.width=u+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,u,p){let m=p,g=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(g=o()),m=t.getOptions(m);const h=t.getImageWidth(c.modules.size,m),b=g.getContext("2d"),v=b.createImageData(h,h);return t.qrToImageData(v.data,c,m),a(b,g,h),b.putImageData(v,0,0),g},e.renderToDataURL=function(c,u,p){let m=p;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const g=e.render(c,u,m),h=m.type||"image/png",b=m.rendererOpts||{};return g.toDataURL(h,b.quality)}})(Th)),Th}var Mh={},Uw;function c7(){if(Uw)return Mh;Uw=1;const e=ON();function t(l,c){const u=l.a/255,p=c+'="'+l.hex+'"';return u<1?p+" "+c+'-opacity="'+u.toFixed(2).slice(1)+'"':p}function a(l,c,u){let p=l+c;return typeof u<"u"&&(p+=" "+u),p}function o(l,c,u){let p="",m=0,g=!1,h=0;for(let b=0;b<l.length;b++){const v=Math.floor(b%c),k=Math.floor(b/c);!v&&!g&&(g=!0),l[b]?(h++,b>0&&v>0&&l[b-1]||(p+=g?a("M",v+u,.5+k+u):a("m",m,0),m=0,g=!1),v+1<c&&l[b+1]||(p+=a("h",h),h=0)):m++}return p}return Mh.render=function(c,u,p){const m=e.getOptions(u),g=c.modules.size,h=c.modules.data,b=g+m.margin*2,v=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",k="<path "+t(m.color.dark,"stroke")+' d="'+o(h,g,m.margin)+'"/>',N='viewBox="0 0 '+b+" "+b+'"',y='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+N+' shape-rendering="crispEdges">'+v+k+`</svg>
|
|
645
|
+
`;return typeof p=="function"&&p(null,y),y},Mh}var Hw;function u7(){if(Hw)return vl;Hw=1;const e=$8(),t=l7(),a=i7(),o=c7();function l(c,u,p,m,g){const h=[].slice.call(arguments,1),b=h.length,v=typeof h[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?(g=p,p=u,u=m=void 0):b===3&&(u.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=p,p=u,u=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(p=u,u=m=void 0):b===2&&!u.getContext&&(m=p,p=u,u=void 0),new Promise(function(k,N){try{const w=t.create(p,m);k(c(w,u,m))}catch(w){N(w)}})}try{const k=t.create(p,m);g(null,c(k,u,m))}catch(k){g(k)}}return vl.create=t.create,vl.toCanvas=l.bind(null,a.render),vl.toDataURL=l.bind(null,a.renderToDataURL),vl.toString=l.bind(null,function(c,u,p){return o.render(c,p)}),vl}var d7=u7();const f7=Ex(d7);function p7({value:e,size:t=200}){const[a,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return f7.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,t]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:a?r.jsx("img",{src:a,width:t,height:t,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function m7(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function g7({open:e,onClose:t,onPaired:a}){const o=rt(),[l,c]=x.useState(null),[u,p]=x.useState(null),[m,g]=x.useState(0),[h,b]=x.useState(!1),v=x.useRef(null),k=x.useCallback(async()=>{c(null),p(null),b(!1);try{const C=await Fl.init();c(C),g(Math.round((C.ttl_ms||9e4)/1e3))}catch(C){C instanceof Kc&&C.status===403?p(f("settings.devices_pair_localhost_only")):p(C.message)}},[]);x.useEffect(()=>{e?k():(c(null),p(null),b(!1))},[e,k]),x.useEffect(()=>{if(!l||h||m<=0)return;const C=window.setTimeout(()=>g(E=>E-1),1e3);return()=>window.clearTimeout(C)},[l,m,h]),x.useEffect(()=>{if(!e||!l||h)return;let C=!0;const E=async()=>{try{const R=await Fl.status(l.pairing_id);if(!C)return;if(R.status==="confirmed"){b(!0),o.success(f("settings.devices_pair_done")),a(),window.setTimeout(()=>{C&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}v.current=window.setTimeout(E,1500)};return v.current=window.setTimeout(E,1500),()=>{C=!1,v.current&&window.clearTimeout(v.current)}},[e,l,h,t,a,o]);const N=!!l&&!h&&m<=0,w=l?m7(l.lan_urls):"",y=l?`${w}/#pair=${l.pairing_id}`:"",S=async(C,E)=>{try{await navigator.clipboard.writeText(C),o.success(E)}catch{o.error(C)}};return r.jsxs(On,{open:e,onClose:t,title:f("settings.devices_pair_title"),description:f("settings.devices_pair_desc"),footer:r.jsx(ce,{variant:"secondary",onClick:t,children:f("common.close")}),children:[u&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),!u&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(vs,{})," ",f("common.loading")]}),!u&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:N?"opacity-40":"",children:r.jsx(p7,{value:y,size:196})}),h?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:f("settings.devices_pair_done")}):N?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:f("settings.devices_pair_expired")}),r.jsx(ce,{variant:"primary",onClick:()=>void k(),children:f("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:f("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(vs,{size:12}),r.jsx("span",{children:f("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",f("settings.devices_pair_expires",{s:m})]})]}),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:f("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:y}),r.jsx(Ye,{content:f("settings.devices_pair_copy"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>S(y,f("settings.devices_pair_copied")),children:r.jsx(Ec,{size:14})})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("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(Ye,{content:f("settings.devices_pair_copy"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>S(l.pairing_id,f("settings.devices_pair_copied_code")),children:r.jsx(Ec,{size:14})})})]})]})]})]})]})]})}function h7(){const e=rt(),{clients:t,isLoading:a,mutate:o}=q8(),[l,c]=x.useState(!1),u=async p=>{if(confirm(f("settings.devices_revoke_confirm",{id:p})))try{await Fl.revoke(p),e.success(f("settings.devices_revoke_success")),o()}catch(m){e.error(m.message)}};return r.jsxs(Ke,{title:f("settings.devices"),description:f("settings.devices_sub"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(HM,{size:14})," ",f("settings.devices_pair_btn")]}),children:[a&&r.jsx(lt,{}),!a&&t.length===0&&r.jsx(xt,{children:f("settings.devices_empty")}),t.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(p=>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:p.label||p.id}),r.jsx(Fe,{tone:p.kind==="web"?"info":p.kind==="deck"?"success":"muted",children:p.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",p.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f("settings.devices_last_seen")," ",p.last_seen?new Date(p.last_seen).toLocaleString():f("settings.devices_never")]}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>u(p.id),children:f("settings.devices_revoke")})]},p.id))}),r.jsx(g7,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const x7=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. General APX config.",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:"Language",placeholder:"en"},{path:"user.locale",label:"Locale",placeholder:"en-US"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agent",fields:[{path:"super_agent.enabled",label:"Super-agent enabled",kind:"boolean"},{path:"super_agent.model",label:"Model",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:$x.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Extra prompt",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling enabled",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Respond with 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 b7(){const{config:e,isLoading:t,patch:a,mutate:o}=Vr();if(t)return r.jsx(lt,{});const l=async c=>{const u={};for(const[p,m]of Object.entries(o_(c)))is(m)||(u[p]=m);await a(u),o()};return r.jsx(Ke,{title:f("global_config.title"),description:f("settings_ui.global_config_desc"),children:r.jsx(xx,{sections:x7,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:f("settings_ui.global_json_desc"),onSaveFields:async(c,u)=>{await a(c,u),o()},onSaveJson:l})})}function _7(){const e=rt(),{health:t,isUp:a}=MC(),o=async()=>{try{await $l.reload(),e.success(f("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("daemon.version"),action:r.jsx(ce,{size:"sm",onClick:o,children:f("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Oh,{label:f("daemon.version"),value:t?.version||"—"}),r.jsx(Oh,{label:f("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),r.jsx(Oh,{label:f("daemon.status"),value:f(a?"daemon.running":"daemon.down"),ok:a})]})}),r.jsx(b7,{})]})}function Oh({label:e,value:t,ok:a}){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:[a!==void 0&&r.jsx(Qc,{ok:a}),r.jsx("span",{children:t})]})]})}function v7(){const e=rt(),{theme:t,set:a}=Fx(),[o,l]=x.useState(""),[c,u]=x.useState(rC()),p=()=>{const g=o.trim();if(g){fo(g);try{localStorage.setItem(Tn.token,g)}catch{}l(""),e.success(f("settings.token_saved"))}},m=g=>{sC(g),u(g),window.location.reload()};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ce,{variant:t==="light"?"primary":"secondary",onClick:()=>a("light"),children:f("settings.light_mode")}),r.jsx(ce,{variant:t==="dark"?"primary":"secondary",onClick:()=>a("dark"),children:f("settings.dark_mode")})]})}),r.jsx(Ke,{title:f("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:aC.map(g=>r.jsx(ce,{variant:c===g.value?"primary":"secondary",onClick:()=>m(g.value),children:g.label},g.value))})}),r.jsxs(Ke,{title:f("settings.token"),description:f("settings.token_sub"),children:[r.jsx(le,{label:f("settings_ui.bearer_label"),children:r.jsx(Ne,{type:"password",placeholder:qb()?f("settings.token_active"):f("settings.token_paste"),value:o,onChange:g=>l(g.target.value),className:"font-mono",onKeyDown:g=>{g.key==="Enter"&&p()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(ce,{variant:"primary",onClick:p,children:f("common.save")})})]})]})}function y7({className:e,...t}){return r.jsx("kbd",{"data-slot":"kbd",className:St("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}const kx=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function j7(e){return(kx?{CommandOrControl:"⌘ Cmd",CmdOrCtrl:"⌘ Cmd",Command:"⌘ Cmd",Cmd:"⌘ Cmd",Super:"⌘ Cmd",Meta:"⌘ Cmd",Control:"⌃ Ctrl",Ctrl:"⌃ Ctrl",Option:"⌥ Opt",Alt:"⌥ Opt",Shift:"⇧ Shift"}:{CommandOrControl:"Ctrl",CmdOrCtrl:"Ctrl",Control:"Ctrl",Ctrl:"Ctrl",Command:"Win",Cmd:"Win",Super:"Win",Meta:"Win",Option:"Alt",Alt:"Alt",Shift:"Shift"})[e]??e}function w7(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function k7(e){const t=e.code;if(/^(Shift|Control|Alt|Meta|OS)(Left|Right)?$/.test(t))return null;let a;if((a=t.match(/^Key([A-Z])$/))||(a=t.match(/^Digit(\d)$/))||(a=t.match(/^Numpad(\d)$/))||(a=t.match(/^(F\d{1,2})$/))||(a=t.match(/^Arrow(Up|Down|Left|Right)$/)))return a[1];const o={Space:"Space",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",Insert:"Insert",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Semicolon:";",Quote:"'",Comma:",",Period:".",Slash:"/",Backquote:"`"};return o[t]?o[t]:e.key&&e.key.length===1?e.key.toUpperCase():null}function S7(e){const t=k7(e);if(!t)return null;const a=[];(kx?e.metaKey:e.ctrlKey)&&a.push("CommandOrControl"),kx&&e.ctrlKey&&a.push("Control"),e.altKey&&a.push("Alt"),e.shiftKey&&a.push("Shift");const o=a.length>0,l=/^F\d{1,2}$/.test(t);return!o&&!l?null:(a.push(t),a.join("+"))}function C7({value:e,onChange:t,disabled:a,className:o,trailing:l}){const[c,u]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!c)return;const g=h=>{if(h.preventDefault(),h.stopPropagation(),h.key==="Escape"){u(!1);return}const b=S7(h);b&&(t(b),u(!1))};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[c,t]);const m=w7(e);return r.jsxs("div",{className:ze("flex h-9 w-full max-w-md items-center rounded-md border border-border bg-transparent transition",c&&"ring-2 ring-ring",a&&"opacity-50",o),children:[r.jsxs("button",{ref:p,type:"button",disabled:a,onClick:()=>u(g=>!g),onBlur:()=>u(!1),"aria-label":f("modules_ui.desktop_shortcut_record"),className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-l-md px-3 text-sm outline-none hover:bg-muted/40 focus-visible:bg-muted/40",children:[c?r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.desktop_shortcut_recording")}):m.length?r.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:m.map((g,h)=>r.jsxs("span",{className:"flex items-center gap-1",children:[h>0&&r.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),r.jsx(y7,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:j7(g)})]},h))}):r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.desktop_shortcut_record")}),r.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:f(c?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),l?r.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:l}):null]})}const kl={status:()=>ge.get("/desktop/status"),start:()=>ge.post("/desktop/start",{}),stop:()=>ge.post("/desktop/stop",{}),restart:()=>ge.post("/desktop/restart",{}),autostartGet:()=>ge.get("/desktop/autostart"),autostartSet:e=>ge.post("/desktop/autostart",{enable:e})};function N7(e=30){return ge.get(`/messages/global?channel=desktop&limit=${e}`)}function zN({showConfigLink:e=!1}){const t=rt(),{data:a,isLoading:o,mutate:l}=et("/desktop/status",()=>kl.status(),{refreshInterval:5e3}),c=!!a?.running,[u,p]=x.useState(null),m=async(v,k)=>{p(v);try{await k()}catch(N){t.error(N.message)}finally{p(null),setTimeout(()=>l(),1200)}},g=()=>m("start",async()=>{const v=await kl.start();t.success(v.already?f("modules_ui.desktop_start_already"):f("modules_ui.desktop_start_done"))}),h=()=>m("stop",async()=>{const v=await kl.stop();t.success(v.stopped?f("modules_ui.desktop_stop_done"):f("modules_ui.desktop_stop_none"))}),b=()=>m("restart",async()=>{(await kl.restart()).reloaded>0?t.success(f("modules_ui.desktop_restart_done")):t.info(f("modules_ui.desktop_restart_none"))});return r.jsx(Ke,{title:f("desktop_screen.status_title"),description:f("modules_ui.desktop_status_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ce,{variant:"primary",size:"sm",onClick:g,loading:u==="start",disabled:c||u!==null&&u!=="start",children:f("modules_ui.desktop_start")}),r.jsx(ce,{variant:"secondary",size:"sm",onClick:h,loading:u==="stop",disabled:!c||u!==null&&u!=="stop",children:f("modules_ui.desktop_stop")}),r.jsx(ce,{variant:"secondary",size:"sm",onClick:b,loading:u==="restart",disabled:!c||u!==null&&u!=="restart",title:f("modules_ui.desktop_restart_hint"),children:f("modules_ui.desktop_restart")}),e&&r.jsx(Sf,{to:"/settings/desktop",children:r.jsxs(ce,{size:"sm",variant:"ghost",children:[r.jsx(Rc,{size:14})," ",f("desktop_screen.open_config")]})})]}),children:o?r.jsx(lt,{}):r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsx(Qc,{ok:c}),r.jsx("span",{className:"font-medium",children:f(c?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),r.jsx("button",{type:"button",onClick:()=>l(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),r.jsxs("span",{className:"text-xs text-muted-fg",children:["(",f("modules_ui.desktop_from_terminal")," ",r.jsx(Dj,{children:"apx desktop start"})," · ",r.jsx(Dj,{children:"apx desktop --debug"}),")"]})]})})}const E7="CommandOrControl+G",R7=()=>[{value:"left",label:f("modules_ui.desktop_pos_left")},{value:"center",label:f("modules_ui.desktop_pos_center")},{value:"right",label:f("modules_ui.desktop_pos_right")}],T7=()=>[{value:"system",label:f("modules_ui.desktop_theme_system")},{value:"light",label:f("modules_ui.desktop_theme_light")},{value:"dark",label:f("modules_ui.desktop_theme_dark")}];function A7(){const e=rt(),{config:t,isLoading:a,patch:o}=Vr(),l=t,c=l.desktop?.shortcut||l.overlay?.shortcut||E7,u=l.desktop?.enabled!==!1,p=l.desktop?.theme||"system",m=l.desktop?.position||"right",{data:g,mutate:h}=et("/desktop/autostart",()=>kl.autostartGet()),[b,v]=x.useState(c),[k,N]=x.useState(!1),[w,y]=x.useState(!1);x.useEffect(()=>v(c),[c]);const S=async()=>{const R=b.trim();if(!(!R||R===c)){N(!0);try{await o({"desktop.shortcut":R}),e.success(f("modules_ui.desktop_shortcut_saved"))}catch(A){e.error(A.message)}finally{N(!1)}}},C=async(R,A,T)=>{N(!0);try{await o({[R]:A}),e.success(T)}catch(M){e.error(M.message)}finally{N(!1)}},E=async R=>{y(!0);try{await kl.autostartSet(R),await h(),e.success(f(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(A){e.error(A.message)}finally{y(!1)}};return r.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[r.jsx(zN,{}),r.jsx(Ke,{title:f("desktop_screen.autostart_title"),description:f("modules_ui.desktop_autostart_desc"),children:g?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ft,{checked:g.enabled,onChange:E,disabled:w,label:g.enabled?f("common.enabled"):f("common.disabled")}),r.jsx("span",{className:"text-xs text-muted-fg",children:f("modules_ui.desktop_platform",{platform:g.platform})})]}):r.jsx(lt,{})}),r.jsx(Ke,{title:f("desktop_screen.shortcut_title"),description:f("modules_ui.desktop_shortcut_desc"),children:a?r.jsx(lt,{}):r.jsx(le,{label:f("modules_ui.desktop_accelerator"),hint:f("modules_ui.desktop_accelerator_hint"),children:r.jsx(C7,{value:b,onChange:v,disabled:k,trailing:r.jsx(ce,{variant:"primary",size:"sm",onClick:S,loading:k,disabled:!b.trim()||b.trim()===c,children:f("common.save")})})})}),r.jsx(Ke,{title:f("desktop_screen.appearance_title"),description:f("modules_ui.desktop_appearance_desc"),children:a?r.jsx(lt,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(le,{label:f("modules_ui.desktop_theme"),hint:f("modules_ui.desktop_restart_apply"),children:r.jsx(bt,{value:p,onChange:R=>C("desktop.theme",R,f("modules_ui.desktop_theme_set",{value:R})),options:T7(),disabled:k})}),r.jsx(le,{label:f("modules_ui.desktop_position"),hint:f("modules_ui.desktop_position_hint"),children:r.jsx(bt,{value:m,onChange:R=>C("desktop.position",R,f("modules_ui.desktop_position_set",{value:R})),options:R7(),disabled:k})})]})}),r.jsx(Ke,{title:f("desktop_screen.activation_title"),description:f("modules_ui.desktop_activation_desc"),children:a?r.jsx(lt,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ft,{checked:u,onChange:R=>C("desktop.enabled",R,f(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:k,label:f(u?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),r.jsxs("p",{className:"text-xs text-muted-fg",children:[f("modules_ui.desktop_stt_engine")," ",r.jsx(Sf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:f("nav.modules.voice")})," ",f("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function M7({engines:e,order:t,onToggleEnabled:a,onReorder:o,onConfigure:l,onRemove:c,onAddNew:u,busy:p}){const m=e.filter(v=>v.id!=="mock"),g=new Map(m.map(v=>[v.id,v])),h=[...t.filter(v=>g.has(v)),...m.map(v=>v.id).filter(v=>!t.includes(v))],b=(v,k)=>{const N=h.indexOf(v),w=N+k;if(N<0||w<0||w>=h.length)return;const y=[...h];[y[N],y[w]]=[y[w],y[N]],o(y)};return r.jsxs("div",{className:"space-y-2",children:[h.map((v,k)=>{const N=g.get(v),w=mf[v],y=N.custom?N.label||v:w?.name||v,S=N.custom?N.note||f("voice_ui.custom_note"):w?.note||"";return r.jsxs("div",{"data-testid":`voice-provider-${v}`,className:ze("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!N.enabled&&"opacity-60"),children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>b(v,-1),disabled:p||k===0,"aria-label":f("voice_ui.move_up"),"data-testid":`voice-provider-${v}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Uk,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>b(v,1),disabled:p||k===h.length-1,"aria-label":f("voice_ui.move_down"),"data-testid":`voice-provider-${v}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Za,{className:"size-3.5"})})]}),r.jsx(Qc,{ok:N.available?!0:N.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:y}),N.custom&&r.jsx(Fe,{tone:"info",children:f("voice_ui.badge_custom")}),w?.local&&r.jsx(Fe,{tone:"info",children:f("voice_ui.badge_local")}),N.available?r.jsx(Fe,{tone:"success",children:f("voice_ui.badge_available")}):N.configured?r.jsx(Fe,{tone:"warning",children:f("voice_ui.badge_unavailable")}):r.jsx(Fe,{tone:"muted",children:f("voice_ui.badge_not_configured")})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:S})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(Ft,{checked:N.enabled,onChange:C=>a(v,C),disabled:p}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>l(v),"data-testid":`voice-provider-${v}-config`,children:[r.jsx(VM,{className:"size-3.5"})," ",f("voice_ui.configure")]}),N.custom&&r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>c(v),disabled:p,"aria-label":f("voice_ui.remove"),"data-testid":`voice-provider-${v}-remove`,children:r.jsx(Zn,{className:"size-3.5"})})]})]},v)}),r.jsxs("button",{type:"button",onClick:u,disabled:p,"data-testid":"voice-provider-add",className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border px-3 py-2.5 text-sm text-muted-fg transition-colors hover:border-emerald-500/50 hover:text-fg disabled:opacity-50",children:[r.jsx(tn,{className:"size-4"})," ",f("voice_ui.add_provider")]})]})}function wn(e){return typeof e=="string"?e:e==null?"":String(e)}function O7(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Vw({on:e,setOn:t,tags:a,setTags:o}){return r.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[r.jsx(Ft,{checked:e,onChange:t,label:f("voice_ui.emotions_label")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("voice_ui.emotions_hint")}),e&&r.jsx(le,{label:f("voice_ui.emotions_tags_label"),hint:f("voice_ui.emotions_tags_hint"),children:r.jsx(Ne,{value:a,onChange:l=>o(l.target.value),placeholder:VD.join(", ")})})]})}function z7({open:e,providerId:t,config:a,onClose:o,onSave:l}){const[c,u]=x.useState(!1),[p,m]=x.useState(null),[g,h]=x.useState(""),[b,v]=x.useState({}),[k,N]=x.useState(!1),[w,y]=x.useState(""),[S,C]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;m(null),h("");const D=a||{},B=D.emotions;if(N(!!B?.enabled),y(Array.isArray(B?.tags)?B.tags.join(", "):""),C(!1),t==="__new__"||t.startsWith("custom:")){const $=D;v({label:wn($.label),base_url:wn($.base_url),model:wn($.model),voice:wn($.voice),format:wn($.format),style:wn($.style),temperature:wn($.temperature)})}else if(t==="piper"){const $=D;v({bin:wn($.bin),model:wn($.model),speaker:wn($.speaker)})}else if(t==="elevenlabs"){const $=D;v({model:wn($.model),voice_id:wn($.voice_id),output_format:wn($.output_format)})}else if(t==="openai"){const $=D;v({model:wn($.model)||"tts-1",voice:wn($.voice)||"alloy",format:wn($.format)||"mp3"})}else if(t==="gemini"){const $=D;v({model:wn($.model),voice:wn($.voice)||"Kore",style:wn($.style)})}else v({})},[e,t,a]),!t)return null;const E=t==="__new__",R=E||t.startsWith("custom:"),A=mf[t],T=D=>v(B=>({...B,...D})),M=t!=="piper"&&t!=="mock",z=M&&is(a?.api_key),I=z?f("voice_ui.api_key_set",{suffix:jo(a?.api_key)??""}):f("voice_ui.api_key_label"),P=E?f("voice_ui.new_provider"):R?b.label||t.slice(7):A?.name||t,H=async()=>{u(!0),m(null);try{const D=E?O7(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(f("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(f("voice_ui.err_base_url_required"));if(!D)throw new Error(f("voice_ui.err_label_required"))}const B=R?`voice.tts.custom.${D}`:`voice.tts.${t}`,V={},$=[],q=(Y,K)=>{K.trim()?V[`${B}.${Y}`]=K.trim():$.push(`${B}.${Y}`)};if(R?(V[`${B}.label`]=b.label.trim(),V[`${B}.base_url`]=b.base_url.trim(),q("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?V[`${B}.temperature`]=Number(b.temperature):$.push(`${B}.temperature`),q("model",b.model),q("voice",b.voice)):t==="piper"?(q("bin",b.bin),q("model",b.model),b.speaker.trim()?V[`${B}.speaker`]=b.speaker.trim():$.push(`${B}.speaker`)):t==="elevenlabs"?(q("model",b.model),q("voice_id",b.voice_id),q("output_format",b.output_format)):t==="openai"?(q("model",b.model),q("voice",b.voice),q("format",b.format)):t==="gemini"&&(q("model",b.model),q("voice",b.voice),q("style",b.style)),R||t==="gemini"){V[`${B}.emotions.enabled`]=k;const Y=w.split(",").map(K=>K.trim().toLowerCase()).filter(Boolean);Y.length?V[`${B}.emotions.tags`]=Y:$.push(`${B}.emotions.tags`)}M&&g.trim()&&(V[`${B}.api_key`]=g.trim()),await l({set:V,unset:$}),o()}catch(D){m(D.message||f("voice_ui.err_save"))}finally{u(!1)}};return r.jsx(On,{open:e,onClose:o,title:f("voice_screen.configure_provider",{name:P}),description:R?f("voice_ui.custom_desc"):A?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:c,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:H,loading:c,"data-testid":"voice-provider-save",children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[t==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("voice_ui.piper_bin_label"),hint:f("voice_ui.piper_bin_hint"),children:r.jsx(Ne,{value:b.bin,onChange:D=>T({bin:D.target.value}),placeholder:"piper"})}),r.jsx(le,{label:f("voice_ui.piper_model_label"),hint:f("voice_ui.piper_model_hint"),children:r.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"/abs/path/voice.onnx"})}),r.jsx(le,{label:f("voice_ui.piper_speaker_label"),hint:f("voice_ui.piper_speaker_hint"),children:r.jsx(Ne,{value:b.speaker,onChange:D=>T({speaker:D.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("voice_ui.api_key_label"),hint:z?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:I})}),r.jsx(le,{label:f("voice_ui.model_label"),children:r.jsx(bt,{value:b.model||"",onChange:D=>T({model:D}),options:UD.map(D=>({value:D,label:D})),placeholder:"eleven_multilingual_v2"})}),r.jsx(le,{label:f("voice_ui.voice_id_label"),hint:f("voice_ui.voice_id_hint"),children:r.jsx(Ne,{value:b.voice_id,onChange:D=>T({voice_id:D.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(le,{label:f("voice_ui.output_format_label"),children:r.jsx(Ne,{value:b.output_format,onChange:D=>T({output_format:D.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("voice_ui.api_key_label"),hint:z?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:I})}),r.jsx(le,{label:f("voice_ui.model_label"),children:r.jsx(bt,{value:b.model||"tts-1",onChange:D=>T({model:D}),options:HD.map(D=>({value:D,label:D}))})}),r.jsx(le,{label:f("voice_ui.voice_label"),children:r.jsx(bt,{value:b.voice||"alloy",onChange:D=>T({voice:D}),options:ID.map(D=>({value:D,label:D}))})}),r.jsx(le,{label:f("voice_ui.format_label"),children:r.jsx(bt,{value:b.format||"mp3",onChange:D=>T({format:D}),options:["mp3","opus","aac","flac","wav"].map(D=>({value:D,label:D}))})})]}),R&&r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("voice_ui.label_label"),hint:f("voice_ui.label_hint"),children:r.jsx(Ne,{value:b.label,onChange:D=>T({label:D.target.value}),placeholder:"QVox"})}),r.jsx(le,{label:f("voice_ui.base_url_req_label"),hint:f("voice_ui.base_url_req_hint"),children:r.jsx(Ne,{value:b.base_url,onChange:D=>T({base_url:D.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),r.jsx(le,{label:f("voice_ui.api_key_label"),hint:f(z?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:I})}),r.jsx(le,{label:f("voice_ui.style_label"),hint:f("voice_ui.openai_style_hint"),children:r.jsx(Mn,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:f("voice_ui.style_ph")})}),r.jsx(le,{label:f("voice_ui.temperature_label"),hint:f("voice_ui.temperature_hint"),children:r.jsx(Ne,{value:b.temperature,onChange:D=>T({temperature:D.target.value}),inputMode:"decimal",placeholder:"0.7"})}),r.jsx(Vw,{on:k,setOn:N,tags:w,setTags:y}),r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>C(D=>!D),className:"text-xs text-muted-fg hover:text-fg",children:[S?"▾ ":"▸ ",f("voice_ui.advanced")]}),S&&r.jsxs("div",{className:"mt-2 space-y-3",children:[r.jsx(le,{label:f("voice_ui.model_label"),hint:f("voice_ui.custom_model_hint"),children:r.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:f("voice_ui.custom_optional_ph")})}),r.jsx(le,{label:f("voice_ui.voice_label"),hint:f("voice_ui.custom_voice_hint"),children:r.jsx(Ne,{value:b.voice,onChange:D=>T({voice:D.target.value}),placeholder:f("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(le,{label:f("voice_ui.api_key_label"),hint:z?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:I})}),r.jsx(le,{label:f("voice_ui.model_label"),hint:f("voice_ui.gemini_model_hint"),children:r.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(le,{label:f("voice_ui.voice_label"),children:r.jsx(bt,{value:b.voice||"Kore",onChange:D=>T({voice:D}),options:BD.map(D=>({value:D,label:D}))})}),r.jsx(le,{label:f("voice_ui.style_label"),hint:f("voice_ui.style_hint"),children:r.jsx(Mn,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:f("voice_ui.style_ph")})}),r.jsx(Vw,{on:k,setOn:N,tags:w,setTags:y})]}),t==="mock"&&r.jsx("p",{className:"text-sm text-muted-fg",children:f("voice_ui.mock_desc")}),p&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function D7(){const e=x.useRef(null),t=x.useRef(null),[a,o]=x.useState(!1),[l,c]=x.useState(!1),u=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),u()},[u]);const p=x.useCallback(async g=>{c(!0);try{u();const h=await $D(g);t.current=h,e.current||(e.current=new Audio);const b=e.current;b.src=h,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[u]),m=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:p,stop:m,playing:a,loading:l}}function P7({engines:e,defaultProvider:t,mode:a}){const o=rt(),{play:l,stop:c,playing:u,loading:p}=D7(),[m,g]=x.useState(f("voice_ui.test_default_text")),[h,b]=x.useState(""),[v,k]=x.useState(!1),[N,w]=x.useState(null),S=[{value:"",label:a==="single"&&t&&t!=="auto"?f("voice_ui.test_default_engine",{name:mf[t]?.name||t}):f("voice_ui.test_default_chain")},...e.filter(E=>E.id!=="mock").map(E=>({value:E.id,label:E.custom?E.label||E.id:mf[E.id]?.name||E.id,disabled:!E.available}))],C=async()=>{const E=m.trim();if(!E){o.error(f("voice_ui.test_empty_error"));return}k(!0);try{const R=await gf.say({text:E,provider:h||void 0});w(R),await l(R.audio_path)}catch(R){o.error(R.message||f("voice_ui.test_synth_error"))}finally{k(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("voice_ui.test_engine_label"),hint:f("voice_ui.test_engine_hint"),children:r.jsx(bt,{value:h,onChange:b,options:S})}),r.jsx(le,{label:f("voice_ui.test_text_label"),children:r.jsx(Mn,{rows:2,value:m,onChange:E=>g(E.target.value),placeholder:f("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ce,{variant:"primary",onClick:C,loading:v,disabled:p,"data-testid":"voice-test-say",children:[r.jsx(KM,{className:"size-4"})," ",f("voice_ui.say_this")]}),u?r.jsxs(ce,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(Qk,{className:"size-4"})," ",f("voice_ui.stop")]}):N?r.jsxs(ce,{variant:"secondary",onClick:()=>l(N.audio_path),loading:p,"data-testid":"voice-test-replay",children:[r.jsx(Hx,{className:"size-4"})," ",f("voice_ui.replay")]}):null,N&&r.jsxs("span",{className:"text-xs text-muted-fg",children:[f("voice_ui.engine_result"),": ",r.jsx("strong",{children:N.provider}),N.duration_s?` · ${N.duration_s.toFixed(1)}s`:""]})]})]})}const qw={metal:{label:"Metal",cls:"text-emerald-400 border-emerald-500/40 bg-emerald-500/10"},cuda:{label:"CUDA",cls:"text-lime-400 border-lime-500/40 bg-lime-500/10"},rocm:{label:"Vulkan / ROCm",cls:"text-orange-400 border-orange-500/40 bg-orange-500/10"},none:{label:"CPU",cls:"text-muted-fg border-border bg-muted"}};function $w({gpu:e}){const t=qw[e]??qw.none;return r.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium ${t.cls}`,children:t.label})}function L7(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const I7=()=>[{value:"auto",label:f("voice_ui.stt_provider_auto")},{value:"local",label:f("voice_ui.stt_provider_local")},{value:"openai",label:f("voice_ui.stt_provider_openai")},{value:"custom",label:f("voice_ui.stt_provider_custom")}],Fw=()=>[{value:"auto",label:f("voice_ui.lang_auto")},{value:"es",label:f("voice_ui.lang_es")},{value:"en",label:f("voice_ui.lang_en")},{value:"pt",label:f("voice_ui.lang_pt")},{value:"fr",label:f("voice_ui.lang_fr")},{value:"it",label:f("voice_ui.lang_it")},{value:"de",label:f("voice_ui.lang_de")}];function B7({config:e,onPatch:t,busy:a}){const[o,l]=x.useState(null);x.useEffect(()=>{let B=!0;return gf.sttHardware().then(V=>{B&&l(V)}).catch(()=>{}),()=>{B=!1}},[]);const c=e.provider||"auto",u=e.local||{},p=e.openai||{},m=e.custom||{},g=u.model||"small",h=u.language||"auto",b=c==="auto"||c==="local",v=(B,V,$)=>{const q=$.trim();q!==(V||"").trim()&&t({[B]:q})},k=(B,V)=>{const $=V.trim();!$||is($)||t({[B]:$})},N=B=>is(B)?f("voice_ui.api_key_set",{suffix:jo(B)??""}):f("voice_ui.api_key_label"),w=u.backend||"auto",y=o?.hardware.gpu||"none",S=w==="auto"?o?.recommended.backend||"faster":w,C=S==="mlx",E=C?"metal":S==="faster"&&y==="cuda"?"cuda":"none",R=()=>{const B=[{value:"auto",label:f("voice_ui.stt_backend_auto")}];return y==="metal"&&B.push({value:"mlx",label:"Metal — mlx-whisper"}),B.push({value:"faster",label:y==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),B},[A,T]=x.useState([]);x.useEffect(()=>{let B=!0;return gf.sttModels(S).then(V=>{B&&T(V.models)}).catch(()=>{B&&T([])}),()=>{B=!1}},[S]);const M=B=>`${B.id} · ${B.downloaded?"✓ "+B.size:B.size}`,z=()=>A.length?A.map(B=>({value:C?B.repo:B.id,label:M(B)})):qD.map(B=>({value:B,label:B})),I=C?u.mlx_model||o?.recommended.model||"":g,P=C?"transcription.local.mlx_model":"transcription.local.model",H=A.find(B=>(C?B.repo:B.id)===I),D=!!H&&!H.downloaded;return r.jsxs("div",{className:"space-y-3",children:[o&&r.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[f("voice_ui.stt_hw_label"),":"]}),r.jsx($w,{gpu:o.hardware.gpu}),r.jsx("span",{className:"font-medium text-fg",children:o.hardware.gpuName||o.hardware.platform}),o.hardware.mem_gb?r.jsxs("span",{className:"text-muted-fg",children:["· ",o.hardware.mem_gb," GB",o.hardware.unified_memory?" unified":""]}):null]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("voice_ui.stt_hw_recommended"),":"," ",r.jsx("span",{className:"text-fg",children:o.recommended.model})," ","(",L7(o.recommended),")",o.recommended.limited?` — ${f("voice_ui.stt_hw_limited")}`:""]})]}),r.jsx(le,{label:f("voice_ui.stt_engine_label"),hint:f("voice_ui.stt_engine_hint"),children:r.jsx(bt,{value:c,onChange:B=>t({"transcription.provider":B}),options:I7(),disabled:a,className:"max-w-md"})}),b&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("voice_ui.stt_backend_label"),hint:f("voice_ui.stt_backend_hint"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bt,{value:w,onChange:B=>t({"transcription.local.backend":B}),options:R(),disabled:a,className:"max-w-xs"}),r.jsx($w,{gpu:E})]})}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(le,{label:f("voice_ui.stt_model_label"),hint:D?f("voice_ui.stt_model_needs_download",{size:H.size}):f("voice_ui.stt_model_hint"),children:r.jsx(bt,{value:I,onChange:B=>t({[P]:B}),options:z(),disabled:a})}),r.jsx(le,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(bt,{value:h,onChange:B=>t({"transcription.local.language":B}),options:Fw(),disabled:a})})]})]}),c==="openai"&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(le,{label:f("voice_ui.api_key_label"),hint:is(p.api_key)?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(p.api_key),onBlur:B=>k("transcription.openai.api_key",B.target.value),disabled:a})}),r.jsx(le,{label:f("voice_ui.stt_openai_model_label"),hint:f("voice_ui.stt_openai_model_hint"),children:r.jsx(Ne,{defaultValue:p.model||"",placeholder:"whisper-1",onBlur:B=>v("transcription.openai.model",p.model,B.target.value),disabled:a})})]}),c==="custom"&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("voice_ui.stt_custom_baseurl_label"),hint:f("voice_ui.stt_custom_baseurl_hint"),children:r.jsx(Ne,{defaultValue:m.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:B=>v("transcription.custom.base_url",m.base_url,B.target.value),disabled:a})}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(le,{label:f("voice_ui.stt_custom_model_label"),hint:f("voice_ui.stt_custom_model_hint"),children:r.jsx(Ne,{defaultValue:m.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:B=>v("transcription.custom.model",m.model,B.target.value),disabled:a})}),r.jsx(le,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(bt,{value:m.language||"auto",onChange:B=>t({"transcription.custom.language":B}),options:Fw(),disabled:a})})]}),r.jsx(le,{label:f("voice_ui.api_key_label"),hint:f("voice_ui.stt_custom_key_hint"),children:r.jsx(Ne,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(m.api_key),onBlur:B=>k("transcription.custom.api_key",B.target.value),disabled:a})})]})]})}function U7(){const e=rt(),{config:t,isLoading:a,patch:o,mutate:l}=Vr(),{data:c,isLoading:u,error:p,mutate:m}=et("/tts/providers",()=>gf.providers()),[g,h]=x.useState(null),[b,v]=x.useState(!1),k=t,N=k.voice?.tts||{},w=k.transcription||{},y=c?.configured_provider||N.provider||"auto",S=c?.mode||N.mode||"chain",C=c?.engines||[],E=c?.order||[],R=x.useMemo(()=>!g||g==="__new__"?{}:g.startsWith("custom:")?N.custom?.[g.slice(7)]||{}:N[g]||{},[g,N]),A=async(P,H)=>{v(!0);try{const D=P.startsWith("custom:")?`voice.tts.custom.${P.slice(7)}.enabled`:`voice.tts.${P}.enabled`;await o({[D]:H}),await m()}catch(D){e.error(D.message)}finally{v(!1)}},T=async P=>{v(!0);try{await o({"voice.tts.order":P}),await m()}catch(H){e.error(H.message)}finally{v(!1)}},M=async({set:P,unset:H})=>{await o(P,H.length?H:void 0),await m(),await l(),e.success(f("voice_ui.toast_config_saved"))},z=async P=>{if(P.startsWith("custom:")&&window.confirm(f("voice_ui.remove_confirm"))){v(!0);try{const H=P.slice(7);await o({"voice.tts.order":E.filter(D=>D!==P)},[`voice.tts.custom.${H}`]),await m(),await l(),e.success(f("voice_ui.toast_provider_removed"))}catch(H){e.error(H.message)}finally{v(!1)}}},I=async(P,H)=>{try{await o(P,H),e.success(f("voice_ui.toast_transcription_updated"))}catch(D){e.error(D.message)}};return r.jsxs("div",{"data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx(Ke,{title:f("voice_screen.providers_title"),description:f("voice_ui.providers_desc"),children:u||a?r.jsx(lt,{}):p?r.jsx(xt,{children:f("voice_ui.providers_load_error",{msg:p.message})}):r.jsx(M7,{engines:C,order:E,onToggleEnabled:A,onReorder:T,onConfigure:P=>h(P),onRemove:z,onAddNew:()=>h("__new__"),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("voice_screen.test_title"),description:f("voice_ui.test_desc"),children:r.jsx(P7,{engines:C,defaultProvider:y,mode:S})}),r.jsx(Ke,{title:f("voice_screen.stt_title"),description:f("voice_ui.stt_desc"),children:a?r.jsx(lt,{}):r.jsx(B7,{config:w,onPatch:I})})]})]}),r.jsx(z7,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:M})]})}function H7(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 V7({manifest:e}){const t=e.daemon,a=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:[t.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_daemon_active",{uptime:H7(t.uptime_s)})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:[f("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[a.direct_shell===!1&&r.jsx(Fe,{tone:"success",children:f("modules_ui.deck_safety_no_shell")}),a.arbitrary_commands===!1&&r.jsx(Fe,{tone:"success",children:f("modules_ui.deck_safety_no_arbitrary")}),a.dangerous_actions_require_confirmation&&r.jsx(Fe,{tone:"info",children:f("modules_ui.deck_safety_confirm")})]})]})}function q7(e){return e==="available"?"success":e==="configured"?"info":"muted"}function $7(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function F7(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function G7({widget:e,onToggle:t}){const a=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,u=async p=>{if(!(!t||o)){l(!0);try{await t(p)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:ze("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",a?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx(Ye,{content:e.source==="apx"?f("deck_screen.widget_native"):f("deck_screen.widget_external"),children:r.jsx("span",{className:ze("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(Fe,{tone:F7(e.kind),children:e.kind}),r.jsx(Fe,{tone:q7(e.status),children:$7(e.status)}),a?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(Ft,{checked:c,onChange:u,disabled:o||!t})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function Y7({desktop:e,widgets:t,onToggle:a}){return t.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:t.map(o=>r.jsx(G7,{widget:o,onToggle:o.source==="external"?l=>a(o.id,l):void 0},o.id))})]})}function K7(){rt();const{data:e,error:t,isLoading:a,mutate:o}=et("/deck/manifest",()=>bC.manifest(),{refreshInterval:3e4}),l=async(h,b)=>{},c=e?.deck.desktops??[],u=e?.deck.widgets??[],p=c.map(h=>({desktop:h,widgets:u.filter(b=>b.desktop===h.id)})),g=u.filter(h=>h.source==="external").filter(h=>h.user_enabled===!0).length;return r.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[r.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6 pointer-events-none select-none blur-[2px] opacity-60","aria-hidden":!0,inert:!0,children:[e&&r.jsx(V7,{manifest:e}),r.jsxs(Ke,{title:f("deck_screen.widgets_title"),description:a?f("modules_ui.deck_loading_manifest"):t?f("modules_ui.deck_manifest_error"):f("modules_ui.deck_widgets_summary",{count:u.length,enabled:g}),action:r.jsx(Ye,{content:f("deck_screen.reload_manifest"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>o(),disabled:a,"aria-label":f("deck_screen.reload_manifest"),children:r.jsx(ua,{size:14,className:a?"animate-spin":""})})}),children:[a&&r.jsx(lt,{label:f("modules_ui.deck_loading_manifest_full")}),!a&&t&&r.jsxs(xt,{children:[f("modules_ui.deck_manifest_load_failed")," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>o(),children:f("modules_ui.deck_retry")})]}),!a&&!t&&u.length===0&&r.jsx(xt,{children:f("modules_ui.deck_no_widgets")}),!a&&!t&&u.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(h=>h.widgets.length>0).map(h=>r.jsx(Y7,{desktop:h.desktop,widgets:h.widgets,onToggle:l},h.desktop.id))})]}),e?.apx&&r.jsx(Ke,{title:f("deck_screen.context_title"),description:f("modules_ui.deck_context_desc"),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:f("modules_ui.deck_active_project")}),r.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:f("modules_ui.deck_none")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_registered_projects")}),r.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_plugins")}),r.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),r.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-6 backdrop-blur-[1px]",role:"dialog","aria-modal":"true","aria-labelledby":"deck-coming-soon-title","data-testid":"deck-coming-soon",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[r.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(dM,{className:"size-6 text-muted-fg"})}),r.jsx("span",{className:"inline-block rounded-full bg-muted px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:f("deck_screen.preview_badge")}),r.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:f("deck_screen.preview_title")}),r.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:f("deck_screen.preview_body")})]})})]})}const X7=[{title:f("settings.account_section"),items:[{key:"identity",label:f("settings.tabs.identity"),icon:qx},{key:"appearance",label:f("settings.appearance"),icon:IM}]},{title:f("settings.agents_section"),items:[{key:"super_agent",label:f("settings.tabs.super_agent"),icon:un},{key:"engines",label:f("settings.tabs.engines"),icon:Lx},{key:"memory",label:"Memory (RAG)",icon:Vk},{key:"skills",label:"Skills (RAG)",icon:pa}]},{title:f("settings.channels_section"),items:[{key:"telegram",label:f("settings.tabs.telegram"),icon:Fs},{key:"devices",label:f("settings.tabs.devices"),icon:qM}]},{title:f("settings.modules_section"),items:[{key:"voice",label:f("nav.modules.voice"),icon:Yk},{key:"desktop",label:f("nav.modules.desktop"),icon:Ux},{key:"deck",label:f("nav.modules.deck"),icon:OM}]},{title:f("settings.advanced_section"),items:[{key:"advanced",label:f("settings.tabs.advanced"),icon:Xd}]}],Q7=new Set(["engines","telegram","memory","skills","appearance","voice"]),W7={identity:()=>r.jsx(A8,{}),super_agent:()=>r.jsx(M8,{}),engines:()=>r.jsx(aN,{}),memory:()=>r.jsx(D8,{}),skills:()=>r.jsx(L8,{}),telegram:()=>r.jsx(V8,{}),devices:()=>r.jsx(h7,{}),voice:()=>r.jsx(U7,{}),deck:()=>r.jsx(K7,{}),desktop:()=>r.jsx(A7,{}),appearance:()=>r.jsx(v7,{}),advanced:()=>r.jsx(_7,{})};function Z7(){const e=Wn(),t=Qn(),a=J7(t.pathname),o=W7[a],{collapsed:l,toggle:c}=Ub(Tn.sidebarCollapsed+".settings");return r.jsx(VC,{sections:X7,active:a,onChange:u=>e(u==="identity"?"/settings":`/settings/${eB(u)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${Q7.has(a)?"":"mx-auto max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${a}`,children:r.jsx(o,{})})}function J7(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"voice":return"voice";case"deck":return"deck";case"desktop":return"desktop";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function eB(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function tB(){const{data:e,isLoading:t,mutate:a}=et("/messages/global?channel=desktop",()=>N7(40),{refreshInterval:8e3});return r.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx(zN,{showConfigLink:!0})}),r.jsx("div",{children:r.jsx(Ke,{title:f("desktop_screen.last_conv_title"),description:f("modules_ui.desktop_last_conv_desc"),action:r.jsx("button",{type:"button",onClick:()=>a(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),children:r.jsx(nB,{messages:e||[],loading:t})})})]})})}function nB({messages:e,loading:t}){const a=x.useMemo(()=>aB(e),[e]);return t?r.jsx(lt,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:a.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,u)=>r.jsx(sB,{m:c},u))},l))}):r.jsx(xt,{children:f("modules_ui.desktop_no_messages")})}function sB({m:e}){const t=e.direction==="in",a=rB(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:f(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),r.jsx("span",{children:a})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:f("modules_ui.desktop_empty_msg")})})]})}function aB(e){const t=[];for(const a of e)a.direction==="in"||!t.length?t.push([a]):t[t.length-1].push(a);return t}function rB(e){try{const t=new Date(e);return t.toDateString()===new Date().toDateString()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function oB(e,t){const a=getComputedStyle(e),o=parseFloat(a.fontSize);return t*o}function lB(e,t){const a=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(a.fontSize);return t*o}function iB(e){return e/100*window.innerHeight}function cB(e){return e/100*window.innerWidth}function uB(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function bc({groupSize:e,panelElement:t,styleProp:a}){let o;const[l,c]=uB(a);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=lB(t,l);break}case"em":{o=oB(t,l);break}case"vh":{o=iB(l);break}case"vw":{o=cB(l);break}}return o}function Kn(e){return parseFloat(e.toFixed(3))}function Yl({group:e}){const{orientation:t,panels:a}=e;return a.reduce((o,l)=>(o+=t==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Sx(e){const{panels:t}=e,a=Yl({group:e});return a===0?t.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})):t.map(o=>{const{element:l,panelConstraints:c}=o;let u=0;if(c.collapsedSize!==void 0){const h=bc({groupSize:a,panelElement:l,styleProp:c.collapsedSize});u=Kn(h/a*100)}let p;if(c.defaultSize!==void 0){const h=bc({groupSize:a,panelElement:l,styleProp:c.defaultSize});p=Kn(h/a*100)}let m=0;if(c.minSize!==void 0){const h=bc({groupSize:a,panelElement:l,styleProp:c.minSize});m=Kn(h/a*100)}let g=100;if(c.maxSize!==void 0){const h=bc({groupSize:a,panelElement:l,styleProp:c.maxSize});g=Kn(h/a*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:u,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:g,panelId:o.id}})}function Bt(e,t="Assertion error"){if(!e)throw Error(t)}function Cx(e,t){return Array.from(t).sort(e==="horizontal"?dB:fB)}function dB(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return a!==0?a:e.element.offsetWidth-t.element.offsetWidth}function fB(e,t){const a=e.element.offsetTop-t.element.offsetTop;return a!==0?a:e.element.offsetHeight-t.element.offsetHeight}function DN(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function PN(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function pB({orientation:e,rects:t,targetRect:a}){const o={x:a.x+a.width/2,y:a.y+a.height/2};let l,c=Number.MAX_VALUE;for(const u of t){const{x:p,y:m}=PN(o,u),g=e==="horizontal"?p:m;g<c&&(c=g,l=u)}return Bt(l,"No rect found"),l}let zd;function mB(){return zd===void 0&&(typeof matchMedia=="function"?zd=!!matchMedia("(pointer:coarse)").matches:zd=!1),zd}function LN(e){const{element:t,orientation:a,panels:o,separators:l}=e,c=Cx(a,Array.from(t.children).filter(DN).map(N=>({element:N}))).map(({element:N})=>N),u=[];let p=!1,m=!1,g=-1,h=-1,b=0,v,k=[];{let N=-1;for(const w of c)w.hasAttribute("data-panel")&&(N++,w.hasAttribute("data-disabled")||(b++,g===-1&&(g=N),h=N))}if(b>1){let N=-1;for(const w of c)if(w.hasAttribute("data-panel")){N++;const y=o.find(S=>S.element===w);if(y){if(v){const S=v.element.getBoundingClientRect(),C=w.getBoundingClientRect();let E;if(m){const R=a==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),A=a==="horizontal"?new DOMRect(C.left,C.top,0,C.height):new DOMRect(C.left,C.top,C.width,0);switch(k.length){case 0:{E=[R,A];break}case 1:{const T=k[0],M=pB({orientation:a,rects:[S,C],targetRect:T.element.getBoundingClientRect()});E=[T,M===S?A:R];break}default:{E=k;break}}}else k.length?E=k:E=[a==="horizontal"?new DOMRect(S.right,C.top,C.left-S.right,C.height):new DOMRect(C.left,S.bottom,C.width,C.top-S.bottom)];for(const R of E){let A="width"in R?R:R.element.getBoundingClientRect();const T=mB()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(A.width<T){const z=T-A.width;A=new DOMRect(A.x-z/2,A.y,A.width+z,A.height)}if(A.height<T){const z=T-A.height;A=new DOMRect(A.x,A.y-z/2,A.width,A.height+z)}const M=N<=g||N>h;!p&&!M&&u.push({group:e,groupSize:Yl({group:e}),panels:[v,y],separator:"width"in R?void 0:R,rect:A}),p=!1}}m=!1,v=y,k=[]}}else if(w.hasAttribute("data-separator")){w.ariaDisabled!==null&&(p=!0);const y=l.find(S=>S.element===w);y?k.push(y):(v=void 0,k=[])}else m=!0}return u}class IN{#e={};addListener(t,a){const o=this.#e[t];return o===void 0?this.#e[t]=[a]:o.includes(a)||o.push(a),()=>{this.removeListener(t,a)}}emit(t,a){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,a);else{let l=!1,c=null;const u=Array.from(o);for(let p=0;p<u.length;p++){const m=u[p];try{m.call(null,a)}catch(g){c===null&&(l=!0,c=g)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(t,a){const o=this.#e[t];if(o!==void 0){const l=o.indexOf(a);l>=0&&o.splice(l,1)}}}let ra=new Map;const BN=new IN;function gB(e){ra=new Map(ra),ra.delete(e)}function Gw(e,t){for(const[a]of ra)if(a.id===e)return a}function Mr(e,t){for(const[a,o]of ra)if(a.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Oo(){return ra}function h_(e,t){return BN.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function Wa(e,t,a){const o=ra.get(e);ra=new Map(ra),ra.set(e,t),BN.emit("groupChange",{group:e,isUserInteraction:a?.isUserInteraction===!0,prev:o,next:t})}function hB(e,t,a){let o,l={x:1/0,y:1/0};for(const c of t){const u=PN(a,c.rect);switch(e){case"horizontal":{u.x<=l.x&&(o=c,l=u);break}case"vertical":{u.y<=l.y&&(o=c,l=u);break}}}return o?{distance:l,hitRegion:o}:void 0}function xB(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function bB(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:Xw(e),b:Xw(t)};let o;for(;a.a.at(-1)===a.b.at(-1);)o=a.a.pop(),a.b.pop();Bt(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:Kw(Yw(a.a)),b:Kw(Yw(a.b))};if(l.a===l.b){const c=o.childNodes,u={a:a.a.at(-1),b:a.b.at(-1)};let p=c.length;for(;p--;){const m=c[p];if(m===u.a)return 1;if(m===u.b)return-1}}return Math.sign(l.a-l.b)}const _B=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function vB(e){const t=getComputedStyle(UN(e)??e).display;return t==="flex"||t==="inline-flex"}function yB(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||vB(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||_B.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Yw(e){let t=e.length;for(;t--;){const a=e[t];if(Bt(a,"Missing node"),yB(a))return a}return null}function Kw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Xw(e){const t=[];for(;e;)t.push(e),e=UN(e);return t}function UN(e){const{parentNode:t}=e;return xB(t)?t.host:t}function jB(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function wB({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!DN(a)||a.contains(e)||e.contains(a))return!0;if(bB(a,e)>0){let o=a;for(;o;){if(o.contains(e))return!0;if(jB(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function x_(e,t){const a=[];return t.forEach((o,l)=>{if(l.disabled)return;const c=LN(l),u=hB(l.orientation,c,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&wB({groupElement:l.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&a.push(u.hitRegion)}),a}function kB(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0}function $n(e,t,a=0){return Math.abs(Kn(e)-Kn(t))<=a}function ta(e,t){return $n(e,t)?0:e>t?1:-1}function Sl({overrideDisabledPanels:e,panelConstraints:t,prevSize:a,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:u,maxSize:p=100,minSize:m=0}=t;if(u&&!e)return a;if(ta(o,m)<0)if(c){const g=(l+m)/2;ta(o,g)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Kn(o),o}function Ic({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:o,prevLayout:l,trigger:c}){if($n(e,0))return t;const u=c==="imperative-api",p=Object.values(t),m=Object.values(l),g=[...p],[h,b]=o;Bt(h!=null,"Invalid first pivot index"),Bt(b!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const w=e<0?b:h,y=a[w];Bt(y,`Panel constraints not found for index ${w}`);const{collapsedSize:S=0,collapsible:C,minSize:E=0}=y;if(C){const R=p[w];if(Bt(R!=null,`Previous layout not found for panel index ${w}`),$n(R,S)){const A=E-R;ta(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}{const w=e<0?h:b,y=a[w];Bt(y,`No panel constraints found for index ${w}`);const{collapsedSize:S=0,collapsible:C,minSize:E=0}=y;if(C){const R=p[w];if(Bt(R!=null,`Previous layout not found for panel index ${w}`),$n(R,E)){const A=R-S;ta(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}break}default:{const w=e<0?b:h,y=a[w];Bt(y,`Panel constraints not found for index ${w}`);const S=p[w],{collapsible:C,collapsedSize:E,minSize:R}=y;if(C&&ta(S,R)<0)if(e>0){const A=R-E,T=A/2,M=S+e;ta(M,R)<0&&(e=ta(e,T)<=0?0:A)}else{const A=R-E,T=100-A/2,M=S-e;ta(M,R)<0&&(e=ta(100+e,T)>0?0:-A)}break}}{const w=e<0?1:-1;let y=e<0?b:h,S=0;for(;;){const E=p[y];Bt(E!=null,`Previous layout not found for panel index ${y}`);const R=Sl({overrideDisabledPanels:u,panelConstraints:a[y],prevSize:E,size:100})-E;if(S+=R,y+=w,y<0||y>=a.length)break}const C=Math.min(Math.abs(e),Math.abs(S));e=e<0?0-C:C}{let w=e<0?h:b;for(;w>=0&&w<a.length;){const y=Math.abs(e)-Math.abs(v),S=p[w];Bt(S!=null,`Previous layout not found for panel index ${w}`);const C=S-y,E=Sl({overrideDisabledPanels:u,panelConstraints:a[w],prevSize:S,size:C});if(!$n(S,E)&&(v+=S-E,g[w]=E,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?w--:w++}}if(kB(m,g))return l;{const w=e<0?b:h,y=p[w];Bt(y!=null,`Previous layout not found for panel index ${w}`);const S=y+v,C=Sl({overrideDisabledPanels:u,panelConstraints:a[w],prevSize:y,size:S});if(g[w]=C,!$n(C,S)){let E=S-C,R=e<0?b:h;for(;R>=0&&R<a.length;){const A=g[R];Bt(A!=null,`Previous layout not found for panel index ${R}`);const T=A+E,M=Sl({overrideDisabledPanels:u,panelConstraints:a[R],prevSize:A,size:T});if($n(A,M)||(E-=M-A,g[R]=M),$n(E,0))break;e>0?R--:R++}}}const k=Object.values(g).reduce((w,y)=>y+w,0);if(!$n(k,100,.1))return l;const N=Object.keys(l);return g.reduce((w,y,S)=>(w[N[S]]=y,w),{})}function So(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(t[a]===void 0||ta(e[a],t[a])!==0)return!1;return!0}function Co({layout:e,panelConstraints:t}){const a=Object.values(e),o=[...a],l=o.reduce((p,m)=>p+m,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(p=>`${p}%`).join(", ")}`);if(!$n(l,100)&&o.length>0)for(let p=0;p<t.length;p++){const m=o[p];Bt(m!=null,`No layout data found for index ${p}`);const g=100/l*m;o[p]=g}let c=0;for(let p=0;p<t.length;p++){const m=a[p];Bt(m!=null,`No layout data found for index ${p}`);const g=o[p];Bt(g!=null,`No layout data found for index ${p}`);const h=Sl({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});g!=h&&(c+=g-h,o[p]=h)}if(!$n(c,0))for(let p=0;p<t.length;p++){const m=o[p];Bt(m!=null,`No layout data found for index ${p}`);const g=m+c,h=Sl({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});if(m!==h&&(c-=h-m,o[p]=h,$n(c,0)))break}const u=Object.keys(e);return o.reduce((p,m,g)=>(p[u[g]]=m,p),{})}function HN({groupId:e,panelId:t}){const a=()=>{const m=Oo();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:b,layout:v,groupSize:k,separatorToPanels:N}]of m)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:g,groupSize:k,layout:v,separatorToPanels:N};throw Error(`Group ${e} not found`)},o=()=>{const m=a().derivedPanelConstraints.find(g=>g.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{const m=a().group.panels.find(g=>g.id===t);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},c=()=>{const m=a().layout[t];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:m,panels:g,prevLayout:h,derivedPanelConstraints:b})=>{const v=c(),k=g.findIndex(y=>y.id===t),N=k===0,w=k===g.length-1;if(w&&m<v&&(N||g.slice(0,k).every((y,S)=>{const C=b[S];return C?.collapsible&&$n(C.collapsedSize,h[C.panelId])}))){const y=g.slice(0,k).reduce((S,C)=>S+h[C.id],0);return{...h,[t]:Kn(100-y)}}return Ic({delta:w?v-m:m-v,initialLayout:h,panelConstraints:b,pivotIndices:w?[k-1,k]:[k,k+1],prevLayout:h,trigger:"imperative-api"})},p=m=>{const g=c();if(m===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:v,groupSize:k,layout:N,separatorToPanels:w}=a(),y=u({nextSize:m,panels:v.panels,prevLayout:N,derivedPanelConstraints:b}),S=Co({layout:y,panelConstraints:b});So(N,S)||Wa(v,{defaultLayoutDeferred:h,derivedPanelConstraints:b,groupSize:k,layout:S,separatorToPanels:w})};return{collapse:()=>{const{collapsible:m,collapsedSize:g}=o(),{mutableValues:h}=l(),b=c();m&&b!==g&&(h.expandToSize=b,p(g))},expand:()=>{const{collapsible:m,collapsedSize:g,minSize:h}=o(),{mutableValues:b}=l(),v=c();if(m&&v===g){let k=b.expandToSize??h;k===0&&(k=1),p(k)}},getSize:()=>{const{group:m}=a(),g=c(),{element:h}=l(),b=m.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:g}=o(),h=c();return m&&$n(g,h)},resize:m=>{const{group:g}=a(),{element:h}=l(),b=Yl({group:g}),v=bc({groupSize:b,panelElement:h,styleProp:m}),k=Kn(v/b*100);p(k)}}}function Qw(e){if(e.defaultPrevented)return;const t=Oo();x_(e,t).forEach(a=>{if(a.separator&&!a.separator.disableDoubleClick){const o=a.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=HN({groupId:a.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function qd(e){const t=Oo();for(const[a]of t)if(a.separators.some(o=>o.element===e))return a;throw Error("Could not find parent Group for separator element")}function VN({groupId:e}){const t=()=>{const a=Oo();for(const[o,l]of a)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:a,layout:o}=t();return a?{}:o},setLayout(a){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:u,layout:p,separatorToPanels:m}=t(),g=Co({layout:a,panelConstraints:l});return o?p:(So(p,g)||Wa(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:u,layout:g,separatorToPanels:m}),g)}}}function io(e,t){const a=qd(e),o=Mr(a.id,!0),l=a.separators.find(h=>h.element===e);Bt(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Bt(c,"Matching panels not found");const u=c.map(h=>a.panels.indexOf(h)),p=VN({groupId:a.id}).getLayout(),m=Ic({delta:t,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:p,trigger:"keyboard"}),g=Co({layout:m,panelConstraints:o.derivedPanelConstraints});So(p,g)||Wa(a,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:g,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ww(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=qd(t);if(!a.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),a.orientation==="vertical"&&io(t,5);break}case"ArrowLeft":{e.preventDefault(),a.orientation==="horizontal"&&io(t,-5);break}case"ArrowRight":{e.preventDefault(),a.orientation==="horizontal"&&io(t,5);break}case"ArrowUp":{e.preventDefault(),a.orientation==="vertical"&&io(t,-5);break}case"End":{e.preventDefault(),io(t,100);break}case"Enter":{e.preventDefault();const o=qd(t),l=Mr(o.id,!0),{derivedPanelConstraints:c,layout:u,separatorToPanels:p}=l,m=o.separators.find(v=>v.element===t);Bt(m,"Matching separator not found");const g=p.get(m);Bt(g,"Matching panels not found");const h=g[0],b=c.find(v=>v.panelId===h.id);if(Bt(b,"Panel metadata not found"),b.collapsible){const v=u[h.id],k=b.collapsedSize===v?o.mutableState.expandedPanelSizes[h.id]??b.minSize:b.collapsedSize;io(t,k-v)}break}case"F6":{e.preventDefault();const o=qd(t).separators.map(u=>u.element),l=Array.from(o).findIndex(u=>u===e.currentTarget);Bt(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(),io(t,-100);break}}}let Ol={cursorFlags:0,state:"inactive"};const b_=new IN;function No(){return Ol}function SB(e){return b_.addListener("change",e)}function CB(e){const t=Ol,a={...Ol};a.cursorFlags=e,Ol=a,b_.emit("change",{prev:t,next:a})}function zl(e){const t=Ol;Ol=e,b_.emit("change",{prev:t,next:e})}function Zw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Oo(),a=x_(e,t),o=new Map;let l=!1;a.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(c.group);u&&o.set(c.group,u.layout)}),zl({cursorFlags:0,hitRegions:a,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}const NB=e=>e,zh=()=>{},qN=1,$N=2,FN=4,GN=8,Jw=3,ek=12;let Dd;function tk(){return Dd===void 0&&(Dd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Dd=!0)),Dd}function EB({cursorFlags:e,groups:t,state:a}){let o=0,l=0;switch(a){case"active":case"hover":t.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(a){case"active":{if(e&&tk()){const c=(e&qN)!==0,u=(e&$N)!==0,p=(e&FN)!==0,m=(e&GN)!==0;if(c)return p?"se-resize":m?"ne-resize":"e-resize";if(u)return p?"sw-resize":m?"nw-resize":"w-resize";if(p)return"s-resize";if(m)return"n-resize"}break}}return tk()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const nk=new WeakMap;function __(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:a}=nk.get(e)??{};a===void 0&&(a=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(a):e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]));const o=No();switch(o.state){case"active":case"hover":{const l=EB({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(t===c)return;t=c,l?a.cssRules.length===0?a.insertRule(c):a.replaceSync(c):a.cssRules.length===1&&a.deleteRule(0);break}case"inactive":{t=void 0,a.cssRules.length===1&&a.deleteRule(0);break}}nk.set(e,{prevStyle:t,styleSheet:a})}function YN({document:e,event:t,hitRegions:a,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:u}){let p=0;a.forEach(g=>{const{group:h,groupSize:b}=g,{orientation:v,panels:k}=h,{disableCursor:N}=h.mutableState;let w=0;c?v==="horizontal"?w=(t.clientX-c.x)/b*100:w=(t.clientY-c.y)/b*100:v==="horizontal"?w=t.clientX<0?-100:100:w=t.clientY<0?-100:100;const y=o.get(h),S=l.get(h);if(!y||!S)return;const{defaultLayoutDeferred:C,derivedPanelConstraints:E,groupSize:R,layout:A,separatorToPanels:T}=S;if(E&&A&&T){const M=Ic({delta:w,initialLayout:y,panelConstraints:E,pivotIndices:g.panels.map(z=>k.indexOf(z)),prevLayout:A,trigger:"mouse-or-touch"});if(So(M,A)){if(w!==0&&!N)switch(v){case"horizontal":{p|=w<0?qN:$N;break}case"vertical":{p|=w<0?FN:GN;break}}}else Wa(g.group,{defaultLayoutDeferred:C,derivedPanelConstraints:E,groupSize:R,layout:M,separatorToPanels:T})}});let m=0;t.movementX===0?m|=u&Jw:m|=p&Jw,t.movementY===0?m|=u&ek:m|=p&ek,CB(m),__(e)}function sk(e){const t=Oo(),a=No();switch(a.state){case"active":YN({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}}function ak(e){if(e.defaultPrevented)return;const t=No(),a=Oo();switch(t.state){case"active":{if(e.buttons===0){zl({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=Mr(o.group.id,!0);Wa(o.group,l,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}YN({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=x_(e,a);o.length===0?t.state!=="inactive"&&zl({cursorFlags:0,state:"inactive"}):zl({cursorFlags:0,hitRegions:o,state:"hover"}),__(e.currentTarget);break}}}function rk(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(No().state){case"hover":zl({cursorFlags:0,state:"inactive"})}}function ok(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=No();switch(t.state){case"active":zl({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(__(e.currentTarget),t.hitRegions.forEach(a=>{const o=Mr(a.group.id,!0);Wa(a.group,o,{isUserInteraction:!0})}),e.preventDefault())}}function lk(e){let t=0,a=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const u=Kn(c.defaultSize);a+=u,o[c.panelId]=u}else o[c.panelId]=void 0;const l=e.length-t;if(l!==0){const c=Kn((100-a)/l);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=c)}return o}function RB(e,t,a){if(!a[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const l=Yl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,p={asPercentage:Kn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,u)}function TB(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function AB({group:e,nextGroupSize:t,prevGroupSize:a,prevLayout:o}){if(a<=0||t<=0||a===t)return o;let l=0,c=0,u=!1;const p=new Map,m=[];for(const b of e.panels){const v=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const k=v/100*a,N=Kn(k/t*100);p.set(b.id,N),l+=N;break}case"preserve-relative-size":default:{m.push(b.id),c+=v;break}}}if(!u||m.length===0)return o;const g=100-l,h={...o};if(p.forEach((b,v)=>{h[v]=b}),c>0)for(const b of m){const v=o[b]??0;h[b]=Kn(v/c*g)}else{const b=Kn(g/m.length);for(const v of m)h[v]=b}return h}function MB(e,t){const a=e.map(l=>l.id),o=Object.keys(t);if(a.length!==o.length)return!1;for(const l of a)if(!o.includes(l))return!1;return!0}const yl=new Map;function OB(e){let t=!0;Bt(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const a=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new a(N=>{for(const w of N){const{borderBoxSize:y,target:S}=w;if(S===e.element){if(t){const C=Yl({group:e});if(C===0)return;const E=Mr(e.id);if(!E)return;const R=Sx(e),A=E.defaultLayoutDeferred?lk(R):E.layout,T=AB({group:e,nextGroupSize:C,prevGroupSize:E.groupSize,prevLayout:A}),M=Co({layout:T,panelConstraints:R});if(!E.defaultLayoutDeferred&&So(E.layout,M)&&TB(E.derivedPanelConstraints,R)&&E.groupSize===C)return;Wa(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:C,layout:M,separatorToPanels:E.separatorToPanels})}}else RB(e,S,y)}});c.observe(e.element),e.panels.forEach(N=>{Bt(!o.has(N.id),`Panel ids must be unique; id "${N.id}" was used more than once`),o.add(N.id),N.onResize&&c.observe(N.element)});const u=Yl({group:e}),p=Sx(e),m=e.panels.map(({id:N})=>N).join(",");let g=e.mutableState.defaultLayout;g&&(MB(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[m]??g??lk(p),b=Co({layout:h,panelConstraints:p}),v=e.element.ownerDocument;yl.set(v,(yl.get(v)??0)+1);const k=new Map;return LN(e).forEach(N=>{N.separator&&k.set(N.separator,N.panels)}),Wa(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:p,groupSize:u,layout:b,separatorToPanels:k}),e.separators.forEach(N=>{Bt(!l.has(N.id),`Separator ids must be unique; id "${N.id}" was used more than once`),l.add(N.id),N.element.addEventListener("keydown",Ww)}),yl.get(v)===1&&(v.addEventListener("dblclick",Qw,!0),v.addEventListener("pointerdown",Zw,!0),v.addEventListener("pointerleave",sk),v.addEventListener("pointermove",ak),v.addEventListener("pointerout",rk),v.addEventListener("pointerup",ok,!0)),function(){t=!1,yl.set(v,Math.max(0,(yl.get(v)??0)-1)),gB(e),e.separators.forEach(N=>{N.element.removeEventListener("keydown",Ww)}),yl.get(v)||(v.removeEventListener("dblclick",Qw,!0),v.removeEventListener("pointerdown",Zw,!0),v.removeEventListener("pointerleave",sk),v.removeEventListener("pointermove",ak),v.removeEventListener("pointerout",rk),v.removeEventListener("pointerup",ok,!0)),c.disconnect()}}function zB(){const[e,t]=x.useState({}),a=x.useCallback(()=>t({}),[]);return[e,a]}function v_(e){const t=x.useId();return`${e??t}`}const zo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Cc(e){const t=x.useRef(e);return zo(()=>{t.current=e},[e]),x.useCallback((...a)=>t.current?.(...a),[t])}function y_(...e){return Cc(t=>{e.forEach(a=>{if(a)switch(typeof a){case"function":{a(t);break}case"object":{a.current=t;break}}})})}function j_(e){const t=x.useRef({...e});return zo(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const KN=x.createContext(null);function DB(e,t){const a=x.useRef({getLayout:()=>({}),setLayout:NB});x.useImperativeHandle(t,()=>a.current,[]),zo(()=>{Object.assign(a.current,VN({groupId:e}))})}function Nx({children:e,className:t,defaultLayout:a,disableCursor:o,disabled:l,elementRef:c,groupRef:u,id:p,onLayoutChange:m,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:v,...k}){const N=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),w=Cc(H=>{So(N.current.onLayoutChange,H)||(N.current.onLayoutChange=H,m?.(H))}),y=Cc((H,D)=>{So(N.current.onLayoutChanged,H)||(N.current.onLayoutChanged=H,g?.(H,{isUserInteraction:D}))}),S=v_(p),C=x.useRef(null),[E,R]=zB(),A=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=y_(C,c);DB(S,u);const M=Cc((H,D)=>{const B=No(),V=Gw(H),$=Mr(H);if($){let q=!1;switch(B.state){case"active":{q=B.hitRegions.some(Y=>Y.group===V);break}}return{flexGrow:$.layout[D]??1,pointerEvents:q?"none":void 0}}if(a?.[D])return{flexGrow:a?.[D]}}),z=j_({defaultLayout:a,disableCursor:o}),I=x.useMemo(()=>({get disableCursor(){return!!z.disableCursor},getPanelStyles:M,id:S,orientation:h,registerPanel:H=>{const D=A.current;return D.panels=Cx(h,[...D.panels,H]),R(),()=>{D.panels=D.panels.filter(B=>B!==H),R()}},registerSeparator:H=>{const D=A.current;return D.separators=Cx(h,[...D.separators,H]),R(),()=>{D.separators=D.separators.filter(B=>B!==H),R()}},updatePanelProps:(H,{disabled:D})=>{const B=A.current.panels.find(q=>q.id===H);B&&(B.panelConstraints.disabled=D);const V=Gw(S),$=Mr(S);V&&$&&Wa(V,{...$,derivedPanelConstraints:Sx(V)})},updateSeparatorProps:(H,{disabled:D,disableDoubleClick:B})=>{const V=A.current.separators.find($=>$.id===H);V&&(V.disabled=D,V.disableDoubleClick=B)}}),[M,S,R,h,z]),P=x.useRef(null);return zo(()=>{const H=C.current;if(H===null)return;const D=A.current;let B;if(z.defaultLayout!==void 0&&Object.keys(z.defaultLayout).length===D.panels.length){B={};for(const X of D.panels){const L=z.defaultLayout[X.id];L!==void 0&&(B[X.id]=L)}}const V={disabled:!!l,element:H,id:S,mutableState:{defaultLayout:B,disableCursor:!!z.disableCursor,expandedPanelSizes:A.current.lastExpandedPanelSizes,layouts:A.current.layouts},orientation:h,panels:D.panels,resizeTargetMinimumSize:D.resizeTargetMinimumSize,separators:D.separators};P.current=V;const $=OB(V),{defaultLayoutDeferred:q,derivedPanelConstraints:Y,layout:K}=Mr(V.id,!0);!q&&Y.length>0&&(w(K),y(K,!1));const F=h_(S,X=>{const{defaultLayoutDeferred:L,derivedPanelConstraints:G,layout:Z}=X.next;if(L||G.length===0)return;const ee=V.panels.map(({id:fe})=>fe).join(",");V.mutableState.layouts[ee]=Z,G.forEach(fe=>{if(fe.collapsible){const{layout:ae}=X.prev??{};if(ae){const oe=$n(fe.collapsedSize,Z[fe.panelId]),me=$n(fe.collapsedSize,ae[fe.panelId]);oe&&!me&&(V.mutableState.expandedPanelSizes[fe.panelId]=ae[fe.panelId])}}});const de=No().state!=="active";w(Z),de&&y(Z,X.isUserInteraction)});return()=>{P.current=null,$(),F()}},[l,S,y,w,h,E,z]),x.useEffect(()=>{const H=P.current;H&&(H.mutableState.defaultLayout=a,H.mutableState.disableCursor=!!o)}),r.jsx(KN.Provider,{value:I,children:r.jsx("div",{...k,className:t,"data-group":!0,"data-testid":S,id:S,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:e})})}Nx.displayName="Group";function w_(){const e=x.useContext(KN);return Bt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function PB(e,t){const{id:a}=w_(),o=x.useRef({collapse:zh,expand:zh,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:zh});x.useImperativeHandle(t,()=>o.current,[]),zo(()=>{Object.assign(o.current,HN({groupId:a,panelId:e}))})}function uo({children:e,className:t,collapsedSize:a="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:u,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:g="100%",minSize:h="0%",onResize:b,panelRef:v,style:k,...N}){const w=!!m,y=v_(m),S=j_({disabled:c}),C=x.useRef(null),E=y_(C,u),{getPanelStyles:R,id:A,orientation:T,registerPanel:M,updatePanelProps:z}=w_(),I=b!==null,P=Cc((V,$,q)=>{b?.(V,m,q)});zo(()=>{const V=C.current;if(V!==null){const $={element:V,id:y,idIsStable:w,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?P:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:a,collapsible:o,defaultSize:l,disabled:S.disabled,maxSize:g,minSize:h}};return M($)}},[p,a,o,l,I,y,w,g,h,P,M,S]),x.useEffect(()=>{z(y,{disabled:c})},[c,y,z]),PB(y,v);const H=()=>{const V=R(A,y);if(V)return JSON.stringify(V)},D=x.useSyncExternalStore(V=>h_(A,V),H,H);let B;return D?B=JSON.parse(D):l!==void 0?B={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:B={flexGrow:1},r.jsx("div",{...N,"data-disabled":c||void 0,"data-panel":!0,"data-testid":y,id:y,ref:E,style:{...LB,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...B},children:r.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...k,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}uo.displayName="Panel";const LB={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function IB({layout:e,panelConstraints:t,panelId:a,panelIndex:o}){let l,c;const u=e[a],p=t.find(m=>m.panelId===a);if(p){const m=p.maxSize,g=p.collapsible?p.collapsedSize:p.minSize,h=[o,o+1];c=Co({layout:Ic({delta:g-u,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a],l=Co({layout:Ic({delta:m-u,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:l,valueMin:c,valueNow:u}}function k_({children:e,className:t,disabled:a,disableDoubleClick:o,elementRef:l,id:c,style:u,...p}){const m=v_(c),g=j_({disabled:a,disableDoubleClick:o}),[h,b]=x.useState({}),[v,k]=x.useState("inactive"),[N,w]=x.useState(!1),y=x.useRef(null),S=y_(y,l),{disableCursor:C,id:E,orientation:R,registerSeparator:A,updateSeparatorProps:T}=w_(),M=R==="horizontal"?"vertical":"horizontal";zo(()=>{const P=y.current;if(P!==null){const H={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:P,id:m},D=A(H),B=SB($=>{k($.next.state!=="inactive"&&$.next.hitRegions.some(q=>q.separator===H)?$.next.state:"inactive")}),V=h_(E,$=>{const{derivedPanelConstraints:q,layout:Y,separatorToPanels:K}=$.next,F=K.get(H);if(F){const X=F[0],L=F.indexOf(X);b(IB({layout:Y,panelConstraints:q,panelId:X.id,panelIndex:L}))}});return()=>{B(),V(),D()}}},[E,m,A,g]),x.useEffect(()=>{T(m,{disabled:a,disableDoubleClick:o})},[a,o,m,T]);let z;a&&!C&&(z="not-allowed");let I;if(a)I="disabled";else switch(v){case"active":{I="active";break}default:N?I="focus":I=v}return r.jsx("div",{...p,"aria-controls":h.valueControls,"aria-disabled":a||void 0,"aria-orientation":M,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":I,"data-testid":m,id:m,onBlur:()=>w(!1),onFocus:()=>w(!0),ref:S,role:"separator",style:{flexBasis:"auto",cursor:z,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:a?void 0:0})}k_.displayName="Separator";function BB({projects:e,value:t,onChange:a,disabled:o}){const l=e.map(c=>{const u=c.path?.split("/").filter(Boolean).pop()||f("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||u,icon:jM,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(bt,{value:t,onChange:a,options:l,placeholder:f("modules_ui.code_pick_project_ph"),disabled:o})})}function UB({sessions:e,activeId:t,busy:a,onSelect:o,onCreate:l,onRename:c,onDelete:u}){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:f("code_module.sessions")}),r.jsx(Ye,{content:f("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:a,"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(tn,{className:"size-3"})," ",f("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(xt,{children:f("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(p=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(p.id),className:ze("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",p.id===t?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(Bx,{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:p.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Ye,{content:f("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(Eo,{className:"size-3"})})}),r.jsx(Ye,{content:f("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>u(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(Zn,{className:"size-3"})})})]})]},p.id))})})]})}function HB({mode:e,onChange:t,disabled:a}){const o=(l,c,u,p)=>r.jsx(Ye,{content:u,children:r.jsxs("button",{type:"button",disabled:a,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>t(l),className:ze("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(p,{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",f("code_module.mode_build"),f("code_module.mode_build_hint"),NM),o("plan",f("code_module.mode_plan"),f("code_module.mode_plan_hint"),iM)]})}function VB({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,mode:u,onModeChange:p,model:m,onModelChange:g}){return r.jsx(c_,{value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,placeholder:f("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(HB,{mode:u,onChange:p,disabled:l}),r.jsx(u_,{value:m,onChange:g,disabled:l})]})})}function Dh(e,t){let a=0;for(const o of e.parts||[])o.kind==="text"&&t.text&&(a+=o.text.length),o.kind==="tool"&&t.tool&&(o.args&&(a+=JSON.stringify(o.args).length),o.result!==void 0&&(a+=JSON.stringify(o.result).length));return Math.ceil(a/4)}function qB(e){let t=null,a=0,o=0;for(const u of e)u.role==="user"?a++:o++,u.role==="assistant"&&u.usage&&(t={input:u.usage.input_tokens,output:u.usage.output_tokens,model:u.model});const l=t?.input??0,c=t?.output??0;return{model:t?.model??null,input:l,output:c,total:l+c,hasUsage:!!t,messages:e.length,userMsgs:a,assistantMsgs:o}}function $B(e){let t=0,a=0,o=0;for(const u of e)u.role==="user"?t+=Dh(u,{text:!0}):a+=Dh(u,{text:!0}),o+=Dh(u,{tool:!0});const l=t+a+o||1,c=(u,p)=>({key:u,tokens:p,percent:Math.round(p/l*100)});return[c("user",t),c("assistant",a),c("tool",o)].filter(u=>u.tokens>0)}const ik={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ba({label:e,value:t}){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:t})]})}function ck(e){if(!e)return"";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${a(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${a(t.getHours())}:${a(t.getMinutes())}`}function FB({turns:e,session:t}){const a=x.useMemo(()=>qB(e),[e]),o=x.useMemo(()=>$B(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(xt,{children:f("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Ba,{label:f("code_module.ctx_model"),value:a.model||f("modules_ui.code_ctx_auto")}),t?.mode&&r.jsx(Ba,{label:f("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&r.jsx(Ba,{label:f("modules_ui.code_ctx_agent"),value:t.agentSlug}),r.jsx(Ba,{label:f("code_module.ctx_messages"),value:f("modules_ui.code_ctx_msgs_value",{user:a.userMsgs,assistant:a.assistantMsgs})}),r.jsx(Ba,{label:f("code_module.ctx_input"),value:a.input.toLocaleString()}),r.jsx(Ba,{label:f("code_module.ctx_output"),value:a.output.toLocaleString()}),r.jsx(Ba,{label:f("modules_ui.code_ctx_tokens_total"),value:(a.input+a.output).toLocaleString()}),t?.createdAt&&r.jsx(Ba,{label:f("modules_ui.code_ctx_created"),value:ck(t.createdAt)}),t?.updatedAt&&r.jsx(Ba,{label:f("modules_ui.code_ctx_activity"),value:ck(t.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:f("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(Ye,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:ik[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 ${ik[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:f(`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:f("code_module.ctx_none")})]})]})}function GB(e){const t=[];for(const a of(e||"").split(`
|
|
646
|
+
`))a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("new file")||a.startsWith("deleted file")||a.startsWith("similarity index")||a.startsWith("rename ")||(a.startsWith("@@")?t.push({kind:"hunk",text:a}):a.startsWith("+")?t.push({kind:"add",text:a.slice(1)}):a.startsWith("-")?t.push({kind:"del",text:a.slice(1)}):t.push({kind:"ctx",text:a.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function YB({patch:e}){const t=x.useMemo(()=>GB(e),[e]);return t.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:t.map((a,o)=>r.jsxs("div",{className:ze("px-2 whitespace-pre",a.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",a.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",a.kind==="hunk"&&"bg-muted/60 text-muted-foreground",a.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:a.kind==="add"?"+":a.kind==="del"?"-":" "}),a.text]},o))})}):null}const KB={added:xM,modified:Yd,deleted:vM},XB={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 QB({file:e}){const[t,a]=x.useState(!1),o=KB[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>a(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(Wl,{className:ze("size-3 shrink-0 transition-transform",t&&"rotate-90")}),r.jsx(o,{className:ze("size-3.5 shrink-0",XB[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]})]})]}),t&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(YB,{patch:e.patch})})]})}function WB({changes:e,loading:t,onRefresh:a}){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?f("code_module.changes_files",{n:o.length}):""}),r.jsx(Ye,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:a,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?r.jsx(vs,{size:12}):r.jsx(ua,{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(xt,{children:f("code_module.changes_no_git")}):o.length===0?r.jsx(xt,{children:f("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(QB,{file:l},l.path))})})]})}function ZB({pid:e,entry:t,onDeleted:a,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[u,p]=x.useState(!1),[m,g]=x.useState(null),h=rt(),[b,v]=x.useState(!1),[k,N]=x.useState(t.name),w=x.useRef(null),[y,S]=x.useState(!1),[C,E]=x.useState(!1),[R,A]=x.useState(!1),T=y?["artifact",e,t.name]:null,M=et(T,()=>Ml.read(e,t.name),{revalidateOnFocus:!1}),z=!M.data?.content||M.data.content.startsWith("#!"),I=async B=>{try{await navigator.clipboard.writeText(B),h.info(f("modules_ui.code_copied"))}catch{}},P=async()=>{A(!0);try{await Ml.remove(e,t.name),E(!1),a()}catch(B){h.error(B.message)}finally{A(!1)}},H=()=>{N(t.name),v(!0),requestAnimationFrame(()=>w.current?.select())},D=async()=>{const B=k.trim();if(v(!1),!(!B||B===t.name))try{await Ml.rename(e,t.name,B),o()}catch(V){h.error(V.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(hM,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?r.jsx("input",{ref:w,value:k,onChange:B=>N(B.target.value),onBlur:()=>void D(),onKeyDown:B=>{B.key==="Enter"&&D(),B.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:t.name}),r.jsx(Ye,{content:f("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:H,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Eo,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.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:t.path}),r.jsx(Ye,{content:f("code_module.artifacts_copy_path"),children:r.jsx("button",{type:"button",onClick:()=>void I(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Ec,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(dx,{open:y,onOpenChange:S,children:[r.jsx(Ye,{content:f("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>S(!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(Nf,{className:"size-3"}),f("modules_ui.code_artifact_view_short")]})}),r.jsxs(fx,{className:"sm:max-w-lg",children:[r.jsx(px,{children:r.jsx(mx,{className:"font-mono text-sm",children:t.name})}),M.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(vs,{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:M.data?.content??""}),r.jsx(Uj,{showCloseButton:!0})]})]}),r.jsx(Ye,{content:f("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c?.(t.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($M,{className:"size-3"}),f("modules_ui.code_artifact_edit_short")]})}),z&&r.jsx(Ye,{content:f("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",onClick:()=>l?.(`apx artifact run ${t.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(Hx,{className:"size-3"}),f("code_module.artifacts_run")]})}),r.jsxs(dx,{open:C,onOpenChange:E,children:[r.jsx(Ye,{content:f("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>E(!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(Zn,{className:"size-3"})})}),r.jsxs(fx,{className:"sm:max-w-sm",children:[r.jsx(px,{children:r.jsxs(mx,{className:"font-mono text-sm",children:[f("code_module.artifacts_delete")," — ",t.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:f("code_module.artifacts_delete_confirm")}),r.jsxs(Uj,{children:[r.jsx(EP,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:f("common.cancel")}),r.jsxs("button",{type:"button",onClick:()=>void P(),disabled:R,className:ze("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(vs,{size:10}),f("code_module.delete")]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[f("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),m&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsx("span",{className:ze("rounded px-1.5 py-0.5 font-mono",m.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:f("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.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:f("modules_ui.code_artifact_timeout")}),m.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:f("modules_ui.code_artifact_truncated")}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.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:m.stderr})]})]})]})}function JB({pid:e,onRunInTerminal:t,onEditArtifact:a}){const o=et(e?["artifacts",e]:null,()=>Ml.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?f("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Ye,{content:f("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(vs,{size:12}):r.jsx(ua,{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(xt,{children:f("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(ZB,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:a},c.name))})})]})}const e9=[{value:"context",icon:Rf,label:"tab_context"},{value:"changes",icon:CM,label:"tab_changes"},{value:"artifacts",icon:LM,label:"tab_artifacts"}];function t9({pid:e,turns:t,changes:a,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:u,onEditArtifact:p}){const[m,g]=x.useState("context"),h=a?.files.length||0;return r.jsxs(up,{value:m,onValueChange:g,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(dp,{variant:"line",className:"w-full",children:e9.map(({value:b,icon:v,label:k})=>{const N=m===b,w=f(`code_module.${k}`);return r.jsx(Ye,{content:w,children:r.jsxs(aa,{value:b,className:N?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(v,{className:"size-3.5 shrink-0"}),N&&r.jsx("span",{className:"truncate text-xs",children:w}),b==="changes"&&h>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:h})]})},b)})})}),r.jsx(Ds,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(FB,{turns:t,session:c})}),r.jsx(Ds,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(WB,{changes:a,loading:o,onRefresh:l})}),r.jsx(Ds,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(JB,{pid:e,onRunInTerminal:u,onEditArtifact:p})})]})}function n9(e){const t=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=t,u="";for(let p=0;p<l.length;p++){u=u?`${u}/${l[p]}`:l[p];const m=p===l.length-1;let g=c.find(h=>h.name===l[p]);g||(g={name:l[p],path:u,type:m?"file":"dir",children:m?void 0:[]},c.push(g)),m||(c=g.children)}}const a=o=>(o.forEach(l=>{l.children&&(l.children=a(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return a(t)}function XN({node:e,depth:t,onOpenFile:a,openDirs:o,toggleDir:l}){const c=e.type==="dir",u=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):a(e.path),style:{paddingLeft:`${t*12+6}px`},className:ze("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(Wl,{className:ze("size-3 shrink-0 transition-transform",u&&"rotate-90")}),u?r.jsx(Ef,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(wM,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(yM,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&u&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(p=>r.jsx(XN,{node:p,depth:t+1,onOpenFile:a,openDirs:o,toggleDir:l},p.path))})]})}function s9({pid:e,projectPath:t,className:a,onOpenFile:o}){const[l,c]=x.useState([]),[u,p]=x.useState(!1),[m,g]=x.useState(!1),[h,b]=x.useState(()=>new Set),v=x.useCallback(async()=>{p(!0);try{const C=(await ge.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(`
|
|
647
|
+
`).map(E=>E.trim()).filter(Boolean);c(C),g(!0)}catch{g(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{b(new Set),v()},[v]);const k=x.useCallback(S=>{b(C=>{const E=new Set(C);return E.has(S)?E.delete(S):E.add(S),E})},[]),N=x.useCallback(()=>{b(new Set)},[]),w=n9(l),y=h.size>0;return r.jsxs("div",{className:ze("flex h-full flex-col",a),"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(Ye,{content:f("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:N,disabled:!y,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(oM,{className:"size-3"})})}),r.jsx(Ye,{content:f("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:u?r.jsx(vs,{size:12}):r.jsx(ua,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?w.length===0?r.jsx("div",{className:"p-3",children:r.jsx(xt,{children:"Sin archivos"})}):r.jsx("ul",{children:w.map(S=>r.jsx(XN,{node:S,depth:0,onOpenFile:o??(()=>{}),openDirs:h,toggleDir:k},S.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(vs,{size:14})})})]})}function a9({path:e,content:t,loading:a,onSave:o}){const l=typeof o=="function",[c,u]=x.useState(t),[p,m]=x.useState(!1);x.useEffect(()=>{u(t)},[t]);const g=l&&c!==t,h=async()=>{if(!(!o||!g)){m(!0);try{await o(c)}finally{m(!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,g&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Ye,{content:f("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>u(t),disabled:!g||p,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(Vx,{className:"size-3"}),"Descartar"]})}),r.jsx(Ye,{content:f("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||p,className:ze("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?r.jsx(vs,{size:10}):r.jsx(Af,{className:"size-3"}),"Guardar"]})})]})]}),a?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(vs,{size:16})}):l?r.jsx("textarea",{value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),h())},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:t.split(`
|
|
648
|
+
`).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 r9({pid:e,className:t,initCmd:a,onClose:o}){const[l,c]=x.useState([]),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState([]),[v,k]=x.useState(-1),N=x.useRef(null),w=x.useRef(null);x.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{a&&(p(a),setTimeout(()=>w.current?.focus(),50))},[a]);const y=async C=>{const E=C.trim();if(E){b(R=>[E,...R.slice(0,49)]),k(-1),c(R=>[...R,{type:"cmd",text:`$ ${E}`}]),g(!0);try{const R=await ge.post("/run",{cmd:E,project:e});R.stdout&&c(A=>[...A,{type:"out",text:R.stdout}]),R.stderr&&c(A=>[...A,{type:"err",text:R.stderr}])}catch(R){c(A=>[...A,{type:"err",text:String(R.message)}])}finally{g(!1)}}},S=C=>{if(C.key==="Enter")y(u),p("");else if(C.key==="ArrowUp"){C.preventDefault();const E=Math.min(v+1,h.length-1);k(E),p(h[E]??"")}else if(C.key==="ArrowDown"){C.preventDefault();const E=Math.max(v-1,-1);k(E),p(E===-1?"":h[E]??"")}};return r.jsxs("div",{className:ze("flex h-full min-h-0 flex-col bg-card/60",t),"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(Ga,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Ye,{content:f("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(mM,{className:"size-3"})})}),r.jsx(Ye,{content:f("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(Gs,{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:()=>w.current?.focus(),children:[l.map((C,E)=>r.jsx("div",{className:ze("whitespace-pre-wrap break-all",C.type==="cmd"&&"text-emerald-400",C.type==="err"&&"text-rose-400",C.type==="out"&&"text-foreground/90"),children:C.text},E)),r.jsx("div",{ref:N})]}),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:w,value:u,onChange:C=>p(C.target.value),onKeyDown:S,disabled:m,placeholder:m?"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 cc="super-agent";function Ph(){return r.jsx(k_,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function o9(){return r.jsx(k_,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function l9(){const e=rt(),t=et("/projects",()=>ls.list()),a=x.useMemo(()=>t.data||[],[t.data]),[o,l]=x.useState(""),[c,u]=x.useState(null),[p,m]=x.useState(cc),[g,h]=x.useState([]),[b,v]=x.useState(""),[k,N]=x.useState(!1),[w,y]=x.useState(!0),[S,C]=x.useState(!0),[E,R]=x.useState(!1),[A,T]=x.useState(""),[M,z]=x.useState(!1),I=x.useRef(null),[P,H]=x.useState([]),[D,B]=x.useState("chat"),V=x.useCallback(_e=>{R(!0),T(_e)},[]);x.useEffect(()=>{!o&&a.length&&l(String(a[0].id))},[o,a]);const $=et(o?["code-sessions",o]:null,()=>Ia.sessions.list(o)),q=et(o?["agents",o]:null,()=>rn.list(o)),Y=et(o&&c?["code-session",o,c]:null,()=>Ia.sessions.get(o,c)),K=et(o&&c?["code-changes",o,c]:null,()=>Ia.changes(o,c));x.useEffect(()=>{const _e=$.data||[];!c&&_e.length&&u(_e[0].id),c&&_e.length&&!_e.some(Me=>Me.id===c)&&u(_e[0]?.id??null)},[$.data,c]),x.useEffect(()=>{Y.data&&m(Y.data.agentSlug||cc)},[Y.data]),x.useEffect(()=>{k||(Y.data?h(Y.data.messages||[]):c||h([]))},[Y.data,c,k]),x.useEffect(()=>()=>I.current?.abort(),[]);const F=Y.data,X=F?.mode==="plan"?"plan":"build",L=F?.model||"",G=_e=>{_e===o||k||(l(_e),u(null),h([]))},Z=_e=>{k||_e===c||(u(_e),h([]))},ee=async()=>{if(!(!o||k))try{const _e=await Ia.sessions.create(o,{title:f("code_module.untitled"),agentSlug:p!==cc?p:null});await $.mutate(),u(_e.id),h([])}catch(_e){e.error(_e.message)}},de=async(_e,Me)=>{const He=window.prompt(f("code_module.rename"),Me);if(!(!He||He===Me))try{await Ia.sessions.update(o,_e,{title:He}),await $.mutate(),_e===c&&await Y.mutate()}catch(Xe){e.error(Xe.message)}},fe=async _e=>{if(!k&&window.confirm(f("code_module.delete_confirm")))try{await Ia.sessions.remove(o,_e),_e===c&&(u(null),h([])),await $.mutate()}catch(Me){e.error(Me.message)}},ae=async _e=>{if(m(_e),!!c)try{await Ia.sessions.update(o,c,{agentSlug:_e!==cc?_e:null}),await Promise.all([Y.mutate(),$.mutate()])}catch(Me){e.error(Me.message)}},oe=x.useCallback(async _e=>{if(c)try{await Ia.sessions.update(o,c,_e),await Promise.all([Y.mutate(),$.mutate()])}catch(Me){e.error(Me.message)}},[o,c,Y,$,e]),me=()=>{I.current?.abort(),N(!1)},Te=_e=>h(Me=>{const He=[...Me],Xe=He[He.length-1];return Xe&&Xe.role==="assistant"&&(He[He.length-1]=_e(Xe)),He}),ie=async _e=>{const Me=(_e??b).trim();if(!Me||k||!o||!c)return;const He=new Date().toISOString();h(sn=>[...sn,{role:"user",parts:[{kind:"text",text:Me}],ts:He},{role:"assistant",parts:[],ts:He,pending:!0}]),v(""),N(!0);const Xe=new AbortController;I.current=Xe;const ot=sn=>{if(sn.type==="error"){e.error(sn.error||f("modules_ui.code_stream_error"));return}Te(dn=>d_(dn,sn))};try{await Ia.stream(o,c,{prompt:Me},ot,Xe.signal),Te(sn=>({...sn,pending:!1}))}catch(sn){Xe.signal.aborted?Te(dn=>({...dn,pending:!1,parts:[...dn.parts,{kind:"text",text:f("code_module.stopped")}]})):(e.error(sn.message),h(dn=>dn.filter((pt,Et)=>Et!==dn.length-1)))}finally{I.current===Xe&&(I.current=null),N(!1),Y.mutate(),$.mutate(),K.mutate()}},pe=async _e=>{try{await navigator.clipboard.writeText(_e),e.info(f("modules_ui.code_copied"))}catch{}},Se=x.useCallback(_e=>{B(_e),H(Me=>Me.some(He=>He.path===_e)?Me:[...Me,{path:_e,content:"",loading:!0}]),ge.post("/run",{cmd:`cat "${_e}"`,project:o}).then(Me=>{const He=Me.stdout||Me.stderr||f("modules_ui.code_file_empty");H(Xe=>Xe.map(ot=>ot.path===_e?{...ot,content:He,loading:!1}:ot))}).catch(Me=>{H(He=>He.map(Xe=>Xe.path===_e?{...Xe,content:f("modules_ui.code_file_error",{msg:Me.message}),loading:!1}:Xe))})},[o]),je=x.useCallback(_e=>{H(Me=>Me.filter(He=>He.path!==_e)),B(Me=>Me===_e?"chat":Me)},[]),Be=x.useCallback(_e=>{const Me=`artifacts/${_e}`;B(Me),H(He=>He.some(Xe=>Xe.path===Me)?He:[...He,{path:Me,content:"",loading:!0,artifactName:_e}]),Ml.read(o,_e).then(He=>{H(Xe=>Xe.map(ot=>ot.path===Me?{...ot,content:He.content,loading:!1}:ot))}).catch(He=>{H(Xe=>Xe.map(ot=>ot.path===Me?{...ot,content:f("modules_ui.code_file_error",{msg:He.message}),loading:!1}:ot))})},[o]),Ve=x.useCallback(async(_e,Me)=>{const He=P.find(Xe=>Xe.path===_e);if(He?.artifactName)try{await Ml.write(o,He.artifactName,Me),H(Xe=>Xe.map(ot=>ot.path===_e?{...ot,content:Me}:ot)),e.info(f("modules_ui.code_saved"))}catch(Xe){e.error(Xe.message)}},[P,o,e]),we=!t.isLoading&&a.length>0,Ee=x.useMemo(()=>{const _e=[{value:cc,label:f("modules_ui.code_super_agent"),icon:un,description:f("modules_ui.code_super_agent_desc")}],Me=(q.data||[]).map(He=>({value:He.slug,label:He.slug,icon:un,description:He.description||He.role||void 0}));return[..._e,...Me]},[q.data]),ve=x.useMemo(()=>g,[g]),Ce=x.useMemo(()=>$.data?.find(_e=>_e.id===c)?.title||"",[$.data,c]),Pe=x.useMemo(()=>a.find(_e=>String(_e.id)===o),[a,o]);$P(Ce);const[Le,Ie]=x.useState(null),se=k?null:yN(g),be=se&&se.turnKey!==Le,$e=_e=>{ie(_e)},Re=x.useCallback(()=>y(_e=>!_e),[]),Oe=x.useCallback(()=>z(_e=>!_e),[]),We=x.useCallback(()=>R(_e=>!_e),[]),at=x.useCallback(()=>C(_e=>!_e),[]),yt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:Kk,open:w,toggle:Re,title:f("modules_ui.code_panel_sessions")},{Icon:Fk,open:M,toggle:Oe,title:f("modules_ui.code_panel_tree")},{Icon:Ga,open:E,toggle:We,title:f("modules_ui.code_panel_terminal")},{Icon:BM,open:S,toggle:at,title:f("modules_ui.code_panel_context")}].map(({Icon:_e,open:Me,toggle:He,title:Xe})=>r.jsx(Ye,{content:Xe,children:r.jsx("button",{type:"button",onClick:He,"data-active":Me,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(_e,{className:"size-3.5"})})},Xe))}):null,[c,w,M,E,S,Re,Oe,We,at]);return GP(yt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?r.jsx(lt,{}):we?r.jsxs(Nx,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(uo,{id:"top",defaultSize:E?"55%":"100%",minSize:"20%",children:r.jsxs(Nx,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[w&&r.jsxs(r.Fragment,{children:[r.jsx(uo,{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(BB,{projects:a,value:o,onChange:G,disabled:k})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(UB,{sessions:$.data||[],activeId:c,busy:k,onSelect:Z,onCreate:ee,onRename:de,onDelete:fe})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(bt,{value:p,onChange:ae,options:Ee,disabled:k,showIcon:!0})})]})}),r.jsx(Ph,{})]}),M&&r.jsxs(r.Fragment,{children:[r.jsx(uo,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(s9,{pid:o,projectPath:Pe?.path,onOpenFile:Se})})}),r.jsx(Ph,{})]}),r.jsx(uo,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[P.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:()=>B("chat"),"data-active":D==="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(Bx,{className:"size-3 shrink-0"}),f("modules_ui.code_chat_tab")]}),P.map(_e=>{const Me=_e.path.split("/").pop()??_e.path,He=D===_e.path;return r.jsxs("div",{"data-active":He,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(Ye,{content:_e.path,children:r.jsx("button",{type:"button",onClick:()=>B(_e.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Me})}),r.jsx(Ye,{content:f("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>je(_e.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(Gs,{className:"size-2.5"})})})]},_e.path)})]}),D==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?g.length?r.jsx(f_,{msgs:g,onCopy:pe}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(xt,{children:f("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(xt,{children:f("code_module.pick_project")})})}),be&&se&&r.jsx(vN,{turnKey:se.turnKey,questions:se.questions,onSubmit:$e,onDismiss:()=>Ie(se.turnKey),disabled:k})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const _e=P.find(Me=>Me.path===D);return _e?r.jsx(a9,{path:_e.path,content:_e.content,loading:_e.loading,onSave:_e.artifactName?Me=>Ve(_e.path,Me):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(VB,{value:b,onValueChange:v,onSubmit:()=>void ie(),onStop:me,busy:k,disabled:!c,mode:X,onModeChange:_e=>void oe({mode:_e}),model:L,onModelChange:_e=>void oe({model:_e||null})})})]})}),S&&r.jsxs(r.Fragment,{children:[r.jsx(Ph,{}),r.jsx(uo,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(t9,{pid:o,turns:ve,changes:K.data,changesLoading:K.isLoading,onRefreshChanges:()=>void K.mutate(),session:Y.data?{title:Y.data.title,mode:Y.data.mode,createdAt:Y.data.createdAt,updatedAt:Y.data.updatedAt,agentSlug:Y.data.agentSlug??null}:null,onRunInTerminal:V,onEditArtifact:Be})})})]})]})}),E&&o&&r.jsxs(r.Fragment,{children:[r.jsx(o9,{}),r.jsx(uo,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(r9,{pid:o,initCmd:A,onClose:We,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(xt,{children:f("code_module.no_projects")})})})}function i9({open:e,onClose:t}){const{mutate:a}=gC(),o=Wn(),l=rt(),[c,u]=x.useState(""),[p,m]=x.useState(!1),[g,h]=x.useState(""),[b,v]=x.useState([]),[k,N]=x.useState(null),[w,y]=x.useState(""),[S,C]=x.useState(!1),[E,R]=x.useState(!1),A=async(z,I=!1)=>{C(!0),y("");try{const P=await Oj.dirs(z||"~");h(P.path),u(P.path),N(P.parent),v(P.entries)}catch(P){const H=P.message;y(H),I||l.error(H)}finally{C(!1)}};x.useEffect(()=>{e||(u(""),m(!1),h(""),v([]),N(null),y(""))},[e]);const T=async()=>{C(!0);try{const z=await Oj.pickDir(f("add_project.picker_prompt"));if("cancelled"in z)return;u(z.path);return}catch{m(!0),await A(c||"~")}finally{C(!1)}},M=async()=>{const z=c.trim();if(!z){l.error(f("add_project.path_required"));return}R(!0);try{const I=await ls.register(z);l.success(f("add_project.registered",{id:I.id})),await a("/projects"),t(),o(`/p/${I.id}`)}catch(I){l.error(I.message)}finally{R(!1)}};return r.jsx(On,{open:e,onClose:t,title:f("add_project.title"),description:f("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:E,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:M,loading:E,children:f("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{label:f("add_project.path_label"),hint:f("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ne,{autoFocus:!0,placeholder:f("add_project.path_placeholder"),value:c,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&M()}}),r.jsxs(ce,{onClick:T,disabled:S,children:[r.jsx(_c,{size:14})," ",f("add_project.search_btn")]})]})}),p&&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:g||c||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>A("~"),disabled:S,children:r.jsx(RM,{size:13})}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>k&&A(k),disabled:!k||S,children:".."}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:S,children:r.jsx(Gs,{size:13})})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[S&&r.jsx(lt,{}),!S&&w&&r.jsx(xt,{children:f("add_project.browser_unavailable")}),!S&&!w&&b.length===0&&r.jsx(xt,{children:f("add_project.no_folders")}),!S&&!w&&b.map(z=>r.jsxs("button",{type:"button",onClick:()=>A(z),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(Ef,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:z.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:z})]},z))]})]})]})})}function c9({onPaired:e}){const[t,a]=x.useState(""),[o,l]=x.useState(u9()),[c,u]=x.useState(!1),[p,m]=x.useState(null);async function g(){const h=t.trim();if(!h){m(f("pairing.err_required"));return}u(!0),m(null);try{const b=await Fl.confirm({pairing_id:h,label:o.trim()||void 0});fo(b.token);try{localStorage.setItem(Tn.token,b.token)}catch{}e()}catch(b){m(d9(b)),u(!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(Uh,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:f("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("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:f("pairing.steps_title")}),r.jsxs("li",{children:["1. ",f("pairing.step_1")]}),r.jsxs("li",{children:["2. ",f("pairing.step_2")]}),r.jsxs("li",{children:["3. ",f("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[r.jsx(le,{label:f("pairing.code_label"),children:r.jsx(Ne,{value:t,onChange:h=>a(h.target.value),placeholder:f("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(le,{label:f("pairing.label_label"),hint:f("pairing.revoke_hint"),children:r.jsx(Ne,{value:o,onChange:h=>l(h.target.value),placeholder:f("pairing.label_ph")})}),p&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),r.jsx(ce,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:f(c?"pairing.linking":"pairing.submit")})]})]})})}function u9(){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 d9(e){if(e instanceof Kc){if(e.status===410)return f("pairing.err_expired");if(e.status===404||e.status===409)return f("pairing.err_unknown")}return f("pairing.err_generic")}function f9({...e}){return r.jsx(RC,{"data-slot":"sheet",...e})}function p9({...e}){return r.jsx(EC,{"data-slot":"sheet-portal",...e})}function m9({className:e,...t}){return r.jsx(kC,{"data-slot":"sheet-overlay",className:St("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),...t})}function g9({className:e,children:t,side:a="right",showCloseButton:o=!0,...l}){return r.jsxs(p9,{children:[r.jsx(m9,{}),r.jsxs(NC,{"data-slot":"sheet-content","data-side":a,className:St("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:[t,o&&r.jsxs(ip,{"data-slot":"sheet-close",render:r.jsx(Qa,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(Gs,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function h9({className:e,...t}){return r.jsx("div",{"data-slot":"sheet-header",className:St("flex flex-col gap-0.5 p-4",e),...t})}function x9({className:e,...t}){return r.jsx(TC,{"data-slot":"sheet-title",className:St("font-heading text-base font-medium text-foreground",e),...t})}function b9({className:e,...t}){return r.jsx(SC,{"data-slot":"sheet-description",className:St("text-sm text-muted-foreground",e),...t})}function _9({value:e,projectPath:t,onPick:a}){const o=v9(e),l=o?y9(e):"",{data:c}=et(o?["/skills",t||""]:null,()=>fc.list(t)),u=c?.skills||[],p=x.useMemo(()=>{const m=l.toLowerCase();return m?u.filter(g=>g.slug.toLowerCase().includes(m)).slice(0,8):u.slice(0,8)},[u,l]);return!o||p.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:p.map(m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>a(m.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:["/",m.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.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 v9(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function y9(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function j9(){try{const e=localStorage.getItem(Tn.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>a&&Array.isArray(a.parts)&&!a.pending):[]}catch{return[]}}function w9({open:e,onOpenChange:t}){const a=rp(),o=rt(),[l,c]=x.useState(j9),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(""),v=x.useRef(null);x.useEffect(()=>{const C=l.filter(E=>!E.pending);try{C.length?localStorage.setItem(Tn.robyChat,JSON.stringify(C)):localStorage.removeItem(Tn.robyChat)}catch{}},[l]);const k=()=>{if(!m){c([]),p("");try{localStorage.removeItem(Tn.robyChat)}catch{}}};x.useEffect(()=>()=>v.current?.abort(),[]),x.useEffect(()=>{const C=E=>{const R=E.detail?.prompt;typeof R=="string"&&(t(!0),p(R))};return window.addEventListener("apx:roby-prompt",C),()=>window.removeEventListener("apx:roby-prompt",C)},[t]);const N=()=>{v.current?.abort(),g(!1)},w=C=>c(E=>{const R=[...E],A=R[R.length-1];return A?.role==="assistant"&&(R[R.length-1]=C(A)),R}),y=async()=>{const C=u.trim();if(!C||m)return;const E=new Date().toISOString(),R=l.filter(z=>!z.pending).map(z=>({role:z.role,content:_x(z)}));c(z=>[...z,{role:"user",parts:[{kind:"text",text:C}],ts:E},{role:"assistant",parts:[],ts:E,pending:!0}]),p(""),g(!0);const A=new AbortController;v.current=A;let T=!1;const M=z=>{if(z?.type==="error"){T=!0,o.error(z.error||"error"),c(I=>{const P=[...I],H=P[P.length-1];return H?.role==="assistant"&&H.pending&&P.pop(),P});return}w(I=>d_(I,z))};try{await xC.stream(0,{prompt:C,previousMessages:R,model:h||void 0,channel:"web_sidebar"},M,A.signal),w(z=>({...z,pending:!1}))}catch(z){A.signal.aborted?w(I=>({...I,pending:!1,parts:[...I.parts,{kind:"text",text:f("project.chat.stopped_marker")}]})):T||(o.error(z.message),c(I=>{const P=[...I],H=P[P.length-1];return H?.role==="assistant"&&H.pending&&P.pop(),P}))}finally{v.current===A&&(v.current=null),g(!1)}},S=async C=>{try{await navigator.clipboard.writeText(C),o.info(f("project.chat.copied"))}catch{}};return r.jsx(f9,{open:e,onOpenChange:t,children:r.jsxs(g9,{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(h9,{className:"pr-12",children:[r.jsxs(x9,{className:"flex items-center gap-2",children:[r.jsx(un,{size:18})," ",f("superagent.title",{persona:a}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:f("superagent.badge")})]}),r.jsx(b9,{children:f("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:f("superagent.empty",{persona:a})}):r.jsx(f_,{msgs:l,onCopy:S})}),r.jsx(_N,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(_9,{value:u,onPick:C=>p(`/${C} `)})}),r.jsx(c_,{value:u,onValueChange:p,onSubmit:()=>void y(),onStop:N,busy:m,placeholder:f("superagent.placeholder"),footer:r.jsx(u_,{value:h,onChange:b,disabled:m})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(Qa,{size:"xs",variant:"ghost",onClick:k,disabled:m||l.length===0,children:[r.jsx(tn,{className:"size-3"})," ",f("superagent.new_chat")]})})]})]})})}function k9(){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 S9(){const[e,t]=x.useState({status:"loading"}),[a,o]=x.useState(0),l=x.useCallback(()=>{t({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const h=await fetch("/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){c||t({status:"error",reason:String(h)});return}const u=window.location.hash.replace(/^#/,""),p=new URLSearchParams(u),m=p.get("pair");if(m){history.replaceState(null,"",window.location.pathname+window.location.search);try{const h=await Fl.confirm({pairing_id:m,label:k9(),kind:"web"});fo(h.token);try{localStorage.setItem(Tn.token,h.token)}catch{}c||t({status:"ok"});return}catch{}}const g=p.get("token");if(g){fo(g);try{localStorage.setItem(Tn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Tn.token);h&&fo(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const b=await h.json();if(b?.token){fo(b.token);try{localStorage.setItem(Tn.token,b.token)}catch{}}}}catch{}if(!qb()){c||t({status:"unpaired"});return}try{await ge.get("/projects"),c||t({status:"ok"})}catch(h){if(h instanceof Kc&&(h.status===401||h.status===403)){fo(null);try{localStorage.removeItem(Tn.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(h)})}})(),()=>{c=!0}},[a]),{...e,reload:l}}function C9(){const e=S9();return e.status==="loading"?r.jsx(uk,{text:f("daemon.connecting")}):e.status==="error"?r.jsx(uk,{mood:"sad",text:f("daemon.unreachable"),sub:`${f("daemon.unreachable_hint")}
|
|
649
|
+
|
|
650
|
+
${e.reason}`}):e.status==="unpaired"?r.jsx(c9,{onPaired:e.reload}):r.jsx(DP,{children:r.jsx(K4,{delay:0,children:r.jsx(N9,{})})})}function N9(){const e=Wn(),t=Qn(),[a,o]=Cf(),{theme:l,toggle:c}=Fx(),u=a.get("action")==="add-project",[p,m]=x.useState(!1),g=()=>{const b=new URLSearchParams(a);b.delete("action"),o(b,{replace:!0})},h=()=>{const b=new URLSearchParams(a);b.set("action","add-project"),o(b)};return r.jsx(UP,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(YD,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:h}),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(E9,{onToggleTheme:c,isDark:l==="dark",pathname:t.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Ak,{children:[r.jsx(Qt,{path:"/",element:r.jsx(BP,{})}),r.jsx(Qt,{path:"/settings/*",element:r.jsx(Z7,{})}),r.jsx(Qt,{path:"/m/desktop/*",element:r.jsx(tB,{})}),r.jsx(Qt,{path:"/m/code/*",element:r.jsx(l9,{})}),r.jsx(Qt,{path:"/p/:pid/*",element:r.jsx(R8,{})}),r.jsx(Qt,{path:"*",element:r.jsx(O9,{})})]})})]}),r.jsx(i9,{open:u,onClose:g}),r.jsx(w9,{open:p,onOpenChange:m})]})})}function E9({onToggleTheme:e,isDark:t,pathname:a}){const{projects:o}=Xc(),l=qP(),c=a.split("/").filter(Boolean),u=c[0]==="p"?o.find(N=>String(N.id)===c[1]):void 0,p=c[0]==="settings"?A9(c[1]):c[0]==="p"?M9(c[2]):"",m=c[0]==="p"&&c[1]==="0",g=u?.name||u?.path?.split("/").pop()||f("nav.project"),h=a==="/"?f("topbar.breadcrumb_root"):c[0]==="settings"?[f("topbar.breadcrumb_root"),f("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[f("topbar.breadcrumb_root"),T9(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_projects"),g,p].filter(Boolean).join(" › "):f("topbar.breadcrumb_root"),b=a==="/"?"":c[0]==="settings"?f("settings.subtitle"):c[0]==="p"?m?f("base.subtitle"):u?`${_C(u.kind)} · ${u.path}`:"":"",v=HP(),k=FP();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(rD,{collapsed:v.collapsed,onToggle:v.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,b&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),k,r.jsx(R9,{}),r.jsx(Ye,{content:f(t?"topbar.light":"topbar.dark"),children:r.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:t?r.jsx(FM,{size:14}):r.jsx(PM,{size:14})})})]})}function R9(){const e=rC(),t=a=>{a!==e&&(sC(a),window.location.reload())};return r.jsxs(eC,{children:[r.jsxs(tC,{"data-testid":"lang-menu",title:f("topbar.lang_toggle"),className:"flex shrink-0 items-center gap-1 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:[r.jsx(AM,{size:14}),r.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),r.jsx(nC,{align:"end",children:r.jsx(Wz,{value:e,onValueChange:a=>t(a),children:aC.map(a=>r.jsx(Zz,{value:a.value,children:a.label},a.value))})})]})}function T9(e){switch(e){case"desktop":return f("nav.modules.desktop");case"code":return f("nav.modules.code");default:return e||""}}function A9(e){switch(e){case"super-agent":return f("settings.tabs.super_agent");case"engines":return f("settings.tabs.engines");case"telegram":return f("settings.tabs.telegram");case"devices":return f("settings.tabs.devices");case"voice":return f("nav.modules.voice");case"deck":return f("nav.modules.deck");case"desktop":return f("nav.modules.desktop");case"appearance":return f("settings.appearance");case"config":case"advanced":return f("settings.tabs.advanced");case"identity":default:return e||""}}function M9(e){switch(e){case"chat":return f("project.nav.chat");case"telegram":return f("project.nav.telegram");case"agents":return f("project.nav.agents");case"routines":return f("project.nav.routines");case"tasks":return f("project.nav.tasks");case"mcps":return f("project.nav.mcps");case"config":return f("project.nav.config");case"workspaces":return f("base.workspaces_title");case"models":return f("settings.tabs.engines");case"agent-defaults":return f("base.defaults_title");case"sessions":return f("base.sessions_title");case"logs":return f("project.nav.logs");case"memories":return f("project.nav.memories");default:return""}}function uk({text:e,sub:t,mood:a="happy"}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(qC,{mood:a,className:"mb-4 text-xs"}),r.jsx("div",{className:"text-foreground",children:e}),t&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function O9(){const e=Wn();return r.jsx($C,{testId:"screen-not-found",mood:"confused",title:f("not_found.title"),titleClassName:"text-7xl",message:f("not_found.message"),action:r.jsx(Qa,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})})}xT.createRoot(document.getElementById("root")).render(r.jsx(Uc.StrictMode,{children:r.jsx(HA,{children:r.jsx(ZM,{children:r.jsx(C9,{})})})}));
|
|
651
|
+
//# sourceMappingURL=index-C1tm8nvc.js.map
|