@agentprojectcontext/apx 1.57.0 → 1.58.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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/src/core/apc/paths.js +7 -0
  3. package/src/core/stores/organization.js +152 -0
  4. package/src/core/stores/project-files.js +199 -0
  5. package/src/core/stores/tasks.js +36 -3
  6. package/src/host/daemon/api/agents.js +22 -2
  7. package/src/host/daemon/api/files-project.js +99 -0
  8. package/src/host/daemon/api/organization.js +88 -0
  9. package/src/host/daemon/api/shared.js +7 -0
  10. package/src/host/daemon/api/tasks.js +14 -0
  11. package/src/host/daemon/api.js +4 -0
  12. package/src/interfaces/cli/commands/org.js +77 -0
  13. package/src/interfaces/cli/index.js +48 -0
  14. package/src/interfaces/web/dist/assets/index-Cl0WXtxF.css +1 -0
  15. package/src/interfaces/web/dist/assets/index-DPAuXATr.js +705 -0
  16. package/src/interfaces/web/dist/assets/index-DPAuXATr.js.map +1 -0
  17. package/src/interfaces/web/dist/index.html +2 -2
  18. package/src/interfaces/web/src/components/agents/AgentFormFields.tsx +123 -0
  19. package/src/interfaces/web/src/components/common/ConfirmDialog.tsx +51 -0
  20. package/src/interfaces/web/src/components/files/FileBrowser.tsx +138 -0
  21. package/src/interfaces/web/src/components/files/FileTree.tsx +133 -0
  22. package/src/interfaces/web/src/components/files/FileViewer.tsx +167 -0
  23. package/src/interfaces/web/src/components/files/MarkdownEditor.tsx +48 -0
  24. package/src/interfaces/web/src/components/files/MarkdownPreview.tsx +146 -0
  25. package/src/interfaces/web/src/components/files/NewFileDialog.tsx +66 -0
  26. package/src/interfaces/web/src/components/structure/StructureDialogs.tsx +172 -0
  27. package/src/interfaces/web/src/components/tasks/TaskDetailPanel.tsx +142 -0
  28. package/src/interfaces/web/src/components/tasks/taskStatus.tsx +57 -0
  29. package/src/interfaces/web/src/i18n/en.ts +104 -0
  30. package/src/interfaces/web/src/i18n/es.ts +104 -0
  31. package/src/interfaces/web/src/lib/api/organization.ts +18 -0
  32. package/src/interfaces/web/src/lib/api/projectFiles.ts +19 -0
  33. package/src/interfaces/web/src/lib/api/tasks.ts +16 -1
  34. package/src/interfaces/web/src/lib/api.ts +2 -0
  35. package/src/interfaces/web/src/lib/slug.ts +11 -0
  36. package/src/interfaces/web/src/screens/ProjectScreen.tsx +21 -2
  37. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +31 -11
  38. package/src/interfaces/web/src/screens/project/AgentsTab.tsx +24 -7
  39. package/src/interfaces/web/src/screens/project/DocsTab.tsx +13 -0
  40. package/src/interfaces/web/src/screens/project/FilesTab.tsx +12 -0
  41. package/src/interfaces/web/src/screens/project/Overview.tsx +122 -10
  42. package/src/interfaces/web/src/screens/project/StructureTab.tsx +147 -0
  43. package/src/interfaces/web/src/screens/project/TasksTab.tsx +101 -62
  44. package/src/interfaces/web/src/types/daemon.ts +63 -0
  45. package/src/interfaces/web/dist/assets/index-CEI8DfVg.css +0 -1
  46. package/src/interfaces/web/dist/assets/index-DJ-ocXOR.js +0 -651
  47. package/src/interfaces/web/dist/assets/index-DJ-ocXOR.js.map +0 -1
@@ -0,0 +1,705 @@
1
+ function QT(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 Fx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dh={exports:{}},tc={};/**
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 U1;function WT(){if(U1)return tc;U1=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 tc.Fragment=t,tc.jsx=a,tc.jsxs=a,tc}var $1;function ZT(){return $1||($1=1,Dh.exports=WT()),Dh.exports}var s=ZT(),Lh={exports:{}},ct={};/**
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 H1;function JT(){if(H1)return ct;H1=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"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,j={};function E(I,Y,Z){this.props=I,this.context=Y,this.refs=j,this.updater=Z||N}E.prototype.isReactComponent={},E.prototype.setState=function(I,Y){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,Y,"setState")},E.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=E.prototype;function C(I,Y,Z){this.props=I,this.context=Y,this.refs=j,this.updater=Z||N}var R=C.prototype=new S;R.constructor=C,y(R,E.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function T(){}var O={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function B(I,Y,Z){var te=Z.ref;return{$$typeof:e,type:I,key:Y,ref:te!==void 0?te:null,props:Z}}function L(I,Y){return B(I.type,Y,I.props)}function U(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function z(I){var Y={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(Z){return Y[Z]})}var P=/\/+/g;function $(I,Y){return typeof I=="object"&&I!==null&&I.key!=null?z(""+I.key):Y.toString(36)}function V(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(T,T):(I.status="pending",I.then(function(Y){I.status==="pending"&&(I.status="fulfilled",I.value=Y)},function(Y){I.status==="pending"&&(I.status="rejected",I.reason=Y)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function q(I,Y,Z,te,fe){var ee=typeof I;(ee==="undefined"||ee==="boolean")&&(I=null);var se=!1;if(I===null)se=!0;else switch(ee){case"bigint":case"string":case"number":se=!0;break;case"object":switch(I.$$typeof){case e:case t:se=!0;break;case g:return se=I._init,q(se(I._payload),Y,Z,te,fe)}}if(se)return fe=fe(I),se=te===""?"."+$(I,0):te,M(fe)?(Z="",se!=null&&(Z=se.replace(P,"$&/")+"/"),q(fe,Y,Z,"",function(Me){return Me})):fe!=null&&(U(fe)&&(fe=L(fe,Z+(fe.key==null||I&&I.key===fe.key?"":(""+fe.key).replace(P,"$&/")+"/")+se)),Y.push(fe)),1;se=0;var re=te===""?".":te+":";if(M(I))for(var me=0;me<I.length;me++)te=I[me],ee=re+$(te,me),se+=q(te,Y,Z,ee,fe);else if(me=w(I),typeof me=="function")for(I=me.call(I),me=0;!(te=I.next()).done;)te=te.value,ee=re+$(te,me++),se+=q(te,Y,Z,ee,fe);else if(ee==="object"){if(typeof I.then=="function")return q(V(I),Y,Z,te,fe);throw Y=String(I),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return se}function X(I,Y,Z){if(I==null)return I;var te=[],fe=0;return q(I,te,"","",function(ee){return Y.call(Z,ee,fe++)}),te}function K(I){if(I._status===-1){var Y=I._result;Y=Y(),Y.then(function(Z){(I._status===0||I._status===-1)&&(I._status=1,I._result=Z)},function(Z){(I._status===0||I._status===-1)&&(I._status=2,I._result=Z)}),I._status===-1&&(I._status=0,I._result=Y)}if(I._status===1)return I._result.default;throw I._result}var F=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},G={map:X,forEach:function(I,Y,Z){X(I,function(){Y.apply(this,arguments)},Z)},count:function(I){var Y=0;return X(I,function(){Y++}),Y},toArray:function(I){return X(I,function(Y){return Y})||[]},only:function(I){if(!U(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ct.Activity=b,ct.Children=G,ct.Component=E,ct.Fragment=a,ct.Profiler=l,ct.PureComponent=C,ct.StrictMode=o,ct.Suspense=m,ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,ct.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},ct.cache=function(I){return function(){return I.apply(null,arguments)}},ct.cacheSignal=function(){return null},ct.cloneElement=function(I,Y,Z){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var te=y({},I.props),fe=I.key;if(Y!=null)for(ee in Y.key!==void 0&&(fe=""+Y.key),Y)!D.call(Y,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&Y.ref===void 0||(te[ee]=Y[ee]);var ee=arguments.length-2;if(ee===1)te.children=Z;else if(1<ee){for(var se=Array(ee),re=0;re<ee;re++)se[re]=arguments[re+2];te.children=se}return B(I.type,fe,te)},ct.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ct.createElement=function(I,Y,Z){var te,fe={},ee=null;if(Y!=null)for(te in Y.key!==void 0&&(ee=""+Y.key),Y)D.call(Y,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(fe[te]=Y[te]);var se=arguments.length-2;if(se===1)fe.children=Z;else if(1<se){for(var re=Array(se),me=0;me<se;me++)re[me]=arguments[me+2];fe.children=re}if(I&&I.defaultProps)for(te in se=I.defaultProps,se)fe[te]===void 0&&(fe[te]=se[te]);return B(I,ee,fe)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(I){return{$$typeof:p,render:I}},ct.isValidElement=U,ct.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:K}},ct.memo=function(I,Y){return{$$typeof:h,type:I,compare:Y===void 0?null:Y}},ct.startTransition=function(I){var Y=O.T,Z={};O.T=Z;try{var te=I(),fe=O.S;fe!==null&&fe(Z,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(T,F)}catch(ee){F(ee)}finally{Y!==null&&Z.types!==null&&(Y.types=Z.types),O.T=Y}},ct.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ct.use=function(I){return O.H.use(I)},ct.useActionState=function(I,Y,Z){return O.H.useActionState(I,Y,Z)},ct.useCallback=function(I,Y){return O.H.useCallback(I,Y)},ct.useContext=function(I){return O.H.useContext(I)},ct.useDebugValue=function(){},ct.useDeferredValue=function(I,Y){return O.H.useDeferredValue(I,Y)},ct.useEffect=function(I,Y){return O.H.useEffect(I,Y)},ct.useEffectEvent=function(I){return O.H.useEffectEvent(I)},ct.useId=function(){return O.H.useId()},ct.useImperativeHandle=function(I,Y,Z){return O.H.useImperativeHandle(I,Y,Z)},ct.useInsertionEffect=function(I,Y){return O.H.useInsertionEffect(I,Y)},ct.useLayoutEffect=function(I,Y){return O.H.useLayoutEffect(I,Y)},ct.useMemo=function(I,Y){return O.H.useMemo(I,Y)},ct.useOptimistic=function(I,Y){return O.H.useOptimistic(I,Y)},ct.useReducer=function(I,Y,Z){return O.H.useReducer(I,Y,Z)},ct.useRef=function(I){return O.H.useRef(I)},ct.useState=function(I){return O.H.useState(I)},ct.useSyncExternalStore=function(I,Y,Z){return O.H.useSyncExternalStore(I,Y,Z)},ct.useTransition=function(){return O.H.useTransition()},ct.version="19.2.7",ct}var q1;function Kc(){return q1||(q1=1,Lh.exports=JT()),Lh.exports}var x=Kc();const Xc=Fx(x),eA=QT({__proto__:null,default:Xc},[x]);var Ph={exports:{}},nc={},Ih={exports:{}},Bh={};/**
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 V1;function tA(){return V1||(V1=1,(function(e){function t(q,X){var K=q.length;q.push(X);e:for(;0<K;){var F=K-1>>>1,G=q[F];if(0<l(G,X))q[F]=X,q[K]=G,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 X=q[0],K=q.pop();if(K!==X){q[0]=K;e:for(var F=0,G=q.length,I=G>>>1;F<I;){var Y=2*(F+1)-1,Z=q[Y],te=Y+1,fe=q[te];if(0>l(Z,K))te<G&&0>l(fe,Z)?(q[F]=fe,q[te]=K,F=te):(q[F]=Z,q[Y]=K,F=Y);else if(te<G&&0>l(fe,K))q[F]=fe,q[te]=K,F=te;else break e}}return X}function l(q,X){var K=q.sortIndex-X.sortIndex;return K!==0?K:q.id-X.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=[],h=[],g=1,b=null,v=3,w=!1,N=!1,y=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function R(q){for(var X=a(h);X!==null;){if(X.callback===null)o(h);else if(X.startTime<=q)o(h),X.sortIndex=X.expirationTime,t(m,X);else break;X=a(h)}}function M(q){if(y=!1,R(q),!N)if(a(m)!==null)N=!0,T||(T=!0,z());else{var X=a(h);X!==null&&V(M,X.startTime-q)}}var T=!1,O=-1,D=5,B=-1;function L(){return j?!0:!(e.unstable_now()-B<D)}function U(){if(j=!1,T){var q=e.unstable_now();B=q;var X=!0;try{e:{N=!1,y&&(y=!1,S(O),O=-1),w=!0;var K=v;try{t:{for(R(q),b=a(m);b!==null&&!(b.expirationTime>q&&L());){var F=b.callback;if(typeof F=="function"){b.callback=null,v=b.priorityLevel;var G=F(b.expirationTime<=q);if(q=e.unstable_now(),typeof G=="function"){b.callback=G,R(q),X=!0;break t}b===a(m)&&o(m),R(q)}else o(m);b=a(m)}if(b!==null)X=!0;else{var I=a(h);I!==null&&V(M,I.startTime-q),X=!1}}break e}finally{b=null,v=K,w=!1}X=void 0}}finally{X?z():T=!1}}}var z;if(typeof C=="function")z=function(){C(U)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,$=P.port2;P.port1.onmessage=U,z=function(){$.postMessage(null)}}else z=function(){E(U,0)};function V(q,X){O=E(function(){q(e.unstable_now())},X)}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"):D=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 X=3;break;default:X=v}var K=v;v=X;try{return q()}finally{v=K}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=v;v=q;try{return X()}finally{v=K}},e.unstable_scheduleCallback=function(q,X,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 G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=K+G,q={id:g++,callback:X,priorityLevel:q,startTime:K,expirationTime:G,sortIndex:-1},K>F?(q.sortIndex=K,t(h,q),a(m)===null&&q===a(h)&&(y?(S(O),O=-1):y=!0,V(M,K-F))):(q.sortIndex=G,t(m,q),N||w||(N=!0,T||(T=!0,z()))),q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(q){var X=v;return function(){var K=v;v=X;try{return q.apply(this,arguments)}finally{v=K}}}})(Bh)),Bh}var F1;function nA(){return F1||(F1=1,Ih.exports=tA()),Ih.exports}var Uh={exports:{}},Fn={};/**
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 G1;function sA(){if(G1)return Fn;G1=1;var e=Kc();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" 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,h,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:m,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Fn.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return c(m,h,null,g)},Fn.flushSync=function(m){var h=u.T,g=o.p;try{if(u.T=null,o.p=2,m)return m()}finally{u.T=h,o.p=g,o.d.f()}},Fn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,o.d.C(m,h))},Fn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Fn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,b=p(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?o.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:w}):g==="script"&&o.d.X(m,{crossOrigin:b,integrity:v,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Fn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=p(h.as,h.crossOrigin);o.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&o.d.M(m)},Fn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,b=p(g,h.crossOrigin);o.d.L(m,g,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Fn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=p(h.as,h.crossOrigin);o.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else o.d.m(m)},Fn.requestFormReset=function(m){o.d.r(m)},Fn.unstable_batchedUpdates=function(m,h){return m(h)},Fn.useFormState=function(m,h,g){return u.H.useFormState(m,h,g)},Fn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var Y1;function Hk(){if(Y1)return Uh.exports;Y1=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(),Uh.exports=sA(),Uh.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 K1;function aA(){if(K1)return nc;K1=1;var e=nA(),t=Kc(),a=Hk();function o(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+r+" 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 r=n,i=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(i=r.return),n=r.return;while(n)}return r.tag===3?i:null}function u(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function p(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(o(188))}function h(n){var r=n.alternate;if(!r){if(r=c(n),r===null)throw Error(o(188));return r!==n?null:n}for(var i=n,f=r;;){var _=i.return;if(_===null)break;var k=_.alternate;if(k===null){if(f=_.return,f!==null){i=f;continue}break}if(_.child===k.child){for(k=_.child;k;){if(k===i)return m(_),n;if(k===f)return m(_),r;k=k.sibling}throw Error(o(188))}if(i.return!==f.return)i=_,f=k;else{for(var A=!1,H=_.child;H;){if(H===i){A=!0,i=_,f=k;break}if(H===f){A=!0,f=_,i=k;break}H=H.sibling}if(!A){for(H=k.child;H;){if(H===i){A=!0,i=k,f=_;break}if(H===f){A=!0,f=k,i=_;break}H=H.sibling}if(!A)throw Error(o(189))}}if(i.alternate!==f)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:r}function g(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=g(n),r!==null)return r;n=n.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),C=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function z(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var P=Symbol.for("react.client.reference");function $(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===P?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case y:return"Fragment";case E:return"Profiler";case j:return"StrictMode";case M:return"Suspense";case T:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case C:return n.displayName||"Context";case S:return(n._context.displayName||"Context")+".Consumer";case R:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case O:return r=n.displayName||null,r!==null?r:$(n.type)||"Memo";case D:r=n._payload,n=n._init;try{return $(n(r))}catch{}}return null}var V=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},F=[],G=-1;function I(n){return{current:n}}function Y(n){0>G||(n.current=F[G],F[G]=null,G--)}function Z(n,r){G++,F[G]=n.current,n.current=r}var te=I(null),fe=I(null),ee=I(null),se=I(null);function re(n,r){switch(Z(ee,r),Z(fe,n),Z(te,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?c1(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=c1(r),n=u1(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Y(te),Z(te,n)}function me(){Y(te),Y(fe),Y(ee)}function Me(n){n.memoizedState!==null&&Z(se,n);var r=te.current,i=u1(r,n.type);r!==i&&(Z(fe,n),Z(te,i))}function de(n){fe.current===n&&(Y(te),Y(fe)),se.current===n&&(Y(se),Wi._currentValue=K)}var he,Ce;function we(n){if(he===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);he=r&&r[1]||"",Ce=-1<i.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+he+n+Ce}var Be=!1;function $e(n,r){if(!n||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(r){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(pe){var ce=pe}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(pe){ce=pe}n.call(ye.prototype)}}else{try{throw Error()}catch(pe){ce=pe}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(pe){if(pe&&ce&&typeof pe.stack=="string")return[pe.stack,ce.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=f.DetermineComponentFrameRoot(),A=k[0],H=k[1];if(A&&H){var Q=A.split(`
44
+ `),oe=H.split(`
45
+ `);for(_=f=0;f<Q.length&&!Q[f].includes("DetermineComponentFrameRoot");)f++;for(;_<oe.length&&!oe[_].includes("DetermineComponentFrameRoot");)_++;if(f===Q.length||_===oe.length)for(f=Q.length-1,_=oe.length-1;1<=f&&0<=_&&Q[f]!==oe[_];)_--;for(;1<=f&&0<=_;f--,_--)if(Q[f]!==oe[_]){if(f!==1||_!==1)do if(f--,_--,0>_||Q[f]!==oe[_]){var ge=`
46
+ `+Q[f].replace(" at new "," at ");return n.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",n.displayName)),ge}while(1<=f&&0<=_);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?we(i):""}function Se(n,r){switch(n.tag){case 26:case 27:case 5:return we(n.type);case 16:return we("Lazy");case 13:return n.child!==r&&r!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return $e(n.type,!1);case 11:return $e(n.type.render,!1);case 1:return $e(n.type,!0);case 31:return we("Activity");default:return""}}function Te(n){try{var r="",i=null;do r+=Se(n,i),i=n,n=n.return;while(n);return r}catch(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var ve=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,Pe=e.unstable_shouldYield,Ie=e.unstable_requestPaint,ue=e.unstable_now,_e=e.unstable_getCurrentPriorityLevel,qe=e.unstable_ImmediatePriority,Re=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,et=e.unstable_LowPriority,rt=e.unstable_IdlePriority,vt=e.log,Mt=e.unstable_setDisableYieldValue,lt=null,Rt=null;function xe(n){if(typeof vt=="function"&&Mt(n),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(lt,n)}catch{}}var Le=Math.clz32?Math.clz32:Qe,Xe=Math.log,it=Math.LN2;function Qe(n){return n>>>=0,n===0?32:31-(Xe(n)/it|0)|0}var pt=256,Ot=262144,Zt=4194304;function Xt(n){var r=n&42;if(r!==0)return r;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 Jt(n,r,i){var f=n.pendingLanes;if(f===0)return 0;var _=0,k=n.suspendedLanes,A=n.pingedLanes;n=n.warmLanes;var H=f&134217727;return H!==0?(f=H&~k,f!==0?_=Xt(f):(A&=H,A!==0?_=Xt(A):i||(i=H&~n,i!==0&&(_=Xt(i))))):(H=f&~k,H!==0?_=Xt(H):A!==0?_=Xt(A):i||(i=f&~n,i!==0&&(_=Xt(i)))),_===0?0:r!==0&&r!==_&&(r&k)===0&&(k=_&-_,i=r&-r,k>=i||k===32&&(i&4194048)!==0)?r:_}function mn(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function ns(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 ps(){var n=Zt;return Zt<<=1,(Zt&62914560)===0&&(Zt=4194304),n}function ws(n){for(var r=[],i=0;31>i;i++)r.push(n);return r}function hn(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ks(n,r,i,f,_,k){var A=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 H=n.entanglements,Q=n.expirationTimes,oe=n.hiddenUpdates;for(i=A&~i;0<i;){var ge=31-Le(i),ye=1<<ge;H[ge]=0,Q[ge]=-1;var ce=oe[ge];if(ce!==null)for(oe[ge]=null,ge=0;ge<ce.length;ge++){var pe=ce[ge];pe!==null&&(pe.lane&=-536870913)}i&=~ye}f!==0&&va(n,f,0),k!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=k&~(A&~r))}function va(n,r,i){n.pendingLanes|=r,n.suspendedLanes&=~r;var f=31-Le(r);n.entangledLanes|=r,n.entanglements[f]=n.entanglements[f]|1073741824|i&261930}function $s(n,r){var i=n.entangledLanes|=r;for(n=n.entanglements;i;){var f=31-Le(i),_=1<<f;_&r|n[f]&r&&(n[f]|=r),i&=~_}}function ya(n,r){var i=r&-r;return i=(i&42)!==0?1:ut(i),(i&(n.suspendedLanes|r))!==0?0:i}function ut(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 It(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function gn(){var n=X.p;return n!==0?n:(n=window.event,n===void 0?32:O1(n.type))}function En(n,r){var i=X.p;try{return X.p=n,r()}finally{X.p=i}}var kn=Math.random().toString(36).slice(2),Ft="__reactFiber$"+kn,Pn="__reactProps$"+kn,Zs="__reactContainer$"+kn,di="__reactEvents$"+kn,iu="__reactListeners$"+kn,UE="__reactHandles$"+kn,Q_="__reactResources$"+kn,fi="__reactMarker$"+kn;function Np(n){delete n[Ft],delete n[Pn],delete n[di],delete n[iu],delete n[UE]}function Ho(n){var r=n[Ft];if(r)return r;for(var i=n.parentNode;i;){if(r=i[Zs]||i[Ft]){if(i=r.alternate,r.child!==null||i!==null&&i.child!==null)for(n=x1(n);n!==null;){if(i=n[Ft])return i;n=x1(n)}return r}n=i,i=n.parentNode}return null}function qo(n){if(n=n[Ft]||n[Zs]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function pi(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(o(33))}function Vo(n){var r=n[Q_];return r||(r=n[Q_]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Rn(n){n[fi]=!0}var W_=new Set,Z_={};function Yr(n,r){Fo(n,r),Fo(n+"Capture",r)}function Fo(n,r){for(Z_[n]=r,n=0;n<r.length;n++)W_.add(r[n])}var $E=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]*$"),J_={},ev={};function HE(n){return ve.call(ev,n)?!0:ve.call(J_,n)?!1:$E.test(n)?ev[n]=!0:(J_[n]=!0,!1)}function cu(n,r,i){if(HE(r))if(i===null)n.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+i)}}function uu(n,r,i){if(i===null)n.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+i)}}function ja(n,r,i,f){if(f===null)n.removeAttribute(i);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(r,i,""+f)}}function Ss(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function tv(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function qE(n,r,i){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var _=f.get,k=f.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return _.call(this)},set:function(A){i=""+A,k.call(this,A)}}),Object.defineProperty(n,r,{enumerable:f.enumerable}),{getValue:function(){return i},setValue:function(A){i=""+A},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function Ep(n){if(!n._valueTracker){var r=tv(n)?"checked":"value";n._valueTracker=qE(n,r,""+n[r])}}function nv(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var i=r.getValue(),f="";return n&&(f=tv(n)?n.checked?"true":"false":n.value),n=f,n!==i?(r.setValue(n),!0):!1}function du(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 VE=/[\n"\\]/g;function Cs(n){return n.replace(VE,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Rp(n,r,i,f,_,k,A,H){n.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.type=A:n.removeAttribute("type"),r!=null?A==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Ss(r)):n.value!==""+Ss(r)&&(n.value=""+Ss(r)):A!=="submit"&&A!=="reset"||n.removeAttribute("value"),r!=null?Tp(n,A,Ss(r)):i!=null?Tp(n,A,Ss(i)):f!=null&&n.removeAttribute("value"),_==null&&k!=null&&(n.defaultChecked=!!k),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?n.name=""+Ss(H):n.removeAttribute("name")}function sv(n,r,i,f,_,k,A,H){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(n.type=k),r!=null||i!=null){if(!(k!=="submit"&&k!=="reset"||r!=null)){Ep(n);return}i=i!=null?""+Ss(i):"",r=r!=null?""+Ss(r):i,H||r===n.value||(n.value=r),n.defaultValue=r}f=f??_,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=H?n.checked:!!f,n.defaultChecked=!!f,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(n.name=A),Ep(n)}function Tp(n,r,i){r==="number"&&du(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Go(n,r,i,f){if(n=n.options,r){r={};for(var _=0;_<i.length;_++)r["$"+i[_]]=!0;for(i=0;i<n.length;i++)_=r.hasOwnProperty("$"+n[i].value),n[i].selected!==_&&(n[i].selected=_),_&&f&&(n[i].defaultSelected=!0)}else{for(i=""+Ss(i),r=null,_=0;_<n.length;_++){if(n[_].value===i){n[_].selected=!0,f&&(n[_].defaultSelected=!0);return}r!==null||n[_].disabled||(r=n[_])}r!==null&&(r.selected=!0)}}function av(n,r,i){if(r!=null&&(r=""+Ss(r),r!==n.value&&(n.value=r),i==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=i!=null?""+Ss(i):""}function rv(n,r,i,f){if(r==null){if(f!=null){if(i!=null)throw Error(o(92));if(V(f)){if(1<f.length)throw Error(o(93));f=f[0]}i=f}i==null&&(i=""),r=i}i=Ss(r),n.defaultValue=i,f=n.textContent,f===i&&f!==""&&f!==null&&(n.value=f),Ep(n)}function Yo(n,r){if(r){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=r;return}}n.textContent=r}var FE=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 ov(n,r,i){var f=r.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?f?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":f?n.setProperty(r,i):typeof i!="number"||i===0||FE.has(r)?r==="float"?n.cssFloat=i:n[r]=(""+i).trim():n[r]=i+"px"}function lv(n,r,i){if(r!=null&&typeof r!="object")throw Error(o(62));if(n=n.style,i!=null){for(var f in i)!i.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var _ in r)f=r[_],r.hasOwnProperty(_)&&i[_]!==f&&ov(n,_,f)}else for(var k in r)r.hasOwnProperty(k)&&ov(n,k,r[k])}function Ap(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 GE=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"]]),YE=/^[\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 fu(n){return YE.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function wa(){}var Mp=null;function Op(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ko=null,Xo=null;function iv(n){var r=qo(n);if(r&&(n=r.stateNode)){var i=n[Pn]||null;e:switch(n=r.stateNode,r.type){case"input":if(Rp(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),r=i.name,i.type==="radio"&&r!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Cs(""+r)+'"][type="radio"]'),r=0;r<i.length;r++){var f=i[r];if(f!==n&&f.form===n.form){var _=f[Pn]||null;if(!_)throw Error(o(90));Rp(f,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(r=0;r<i.length;r++)f=i[r],f.form===n.form&&nv(f)}break e;case"textarea":av(n,i.value,i.defaultValue);break e;case"select":r=i.value,r!=null&&Go(n,!!i.multiple,r,!1)}}}var zp=!1;function cv(n,r,i){if(zp)return n(r,i);zp=!0;try{var f=n(r);return f}finally{if(zp=!1,(Ko!==null||Xo!==null)&&(Ju(),Ko&&(r=Ko,n=Xo,Xo=Ko=null,iv(r),n)))for(r=0;r<n.length;r++)iv(n[r])}}function mi(n,r){var i=n.stateNode;if(i===null)return null;var f=i[Pn]||null;if(f===null)return null;i=f[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,r,typeof i));return i}var ka=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dp=!1;if(ka)try{var hi={};Object.defineProperty(hi,"passive",{get:function(){Dp=!0}}),window.addEventListener("test",hi,hi),window.removeEventListener("test",hi,hi)}catch{Dp=!1}var nr=null,Lp=null,pu=null;function uv(){if(pu)return pu;var n,r=Lp,i=r.length,f,_="value"in nr?nr.value:nr.textContent,k=_.length;for(n=0;n<i&&r[n]===_[n];n++);var A=i-n;for(f=1;f<=A&&r[i-f]===_[k-f];f++);return pu=_.slice(n,1<f?1-f:void 0)}function mu(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function hu(){return!0}function dv(){return!1}function ss(n){function r(i,f,_,k,A){this._reactName=i,this._targetInst=_,this.type=f,this.nativeEvent=k,this.target=A,this.currentTarget=null;for(var H in n)n.hasOwnProperty(H)&&(i=n[H],this[H]=i?i(k):k[H]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?hu:dv,this.isPropagationStopped=dv,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=hu)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=hu)},persist:function(){},isPersistent:hu}),r}var Kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gu=ss(Kr),gi=b({},Kr,{view:0,detail:0}),KE=ss(gi),Pp,Ip,xi,xu=b({},gi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Up,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!==xi&&(xi&&n.type==="mousemove"?(Pp=n.screenX-xi.screenX,Ip=n.screenY-xi.screenY):Ip=Pp=0,xi=n),Pp)},movementY:function(n){return"movementY"in n?n.movementY:Ip}}),fv=ss(xu),XE=b({},xu,{dataTransfer:0}),QE=ss(XE),WE=b({},gi,{relatedTarget:0}),Bp=ss(WE),ZE=b({},Kr,{animationName:0,elapsedTime:0,pseudoElement:0}),JE=ss(ZE),eR=b({},Kr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),tR=ss(eR),nR=b({},Kr,{data:0}),pv=ss(nR),sR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aR={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"},rR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oR(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=rR[n])?!!r[n]:!1}function Up(){return oR}var lR=b({},gi,{key:function(n){if(n.key){var r=sR[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=mu(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?aR[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Up,charCode:function(n){return n.type==="keypress"?mu(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?mu(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),iR=ss(lR),cR=b({},xu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mv=ss(cR),uR=b({},gi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Up}),dR=ss(uR),fR=b({},Kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),pR=ss(fR),mR=b({},xu,{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}),hR=ss(mR),gR=b({},Kr,{newState:0,oldState:0}),xR=ss(gR),bR=[9,13,27,32],$p=ka&&"CompositionEvent"in window,bi=null;ka&&"documentMode"in document&&(bi=document.documentMode);var _R=ka&&"TextEvent"in window&&!bi,hv=ka&&(!$p||bi&&8<bi&&11>=bi),gv=" ",xv=!1;function bv(n,r){switch(n){case"keyup":return bR.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _v(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Qo=!1;function vR(n,r){switch(n){case"compositionend":return _v(r);case"keypress":return r.which!==32?null:(xv=!0,gv);case"textInput":return n=r.data,n===gv&&xv?null:n;default:return null}}function yR(n,r){if(Qo)return n==="compositionend"||!$p&&bv(n,r)?(n=uv(),pu=Lp=nr=null,Qo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return hv&&r.locale!=="ko"?null:r.data;default:return null}}var jR={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 vv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!jR[n.type]:r==="textarea"}function yv(n,r,i,f){Ko?Xo?Xo.push(f):Xo=[f]:Ko=f,r=od(r,"onChange"),0<r.length&&(i=new gu("onChange","change",null,i,f),n.push({event:i,listeners:r}))}var _i=null,vi=null;function wR(n){s1(n,0)}function bu(n){var r=pi(n);if(nv(r))return n}function jv(n,r){if(n==="change")return r}var wv=!1;if(ka){var Hp;if(ka){var qp="oninput"in document;if(!qp){var kv=document.createElement("div");kv.setAttribute("oninput","return;"),qp=typeof kv.oninput=="function"}Hp=qp}else Hp=!1;wv=Hp&&(!document.documentMode||9<document.documentMode)}function Sv(){_i&&(_i.detachEvent("onpropertychange",Cv),vi=_i=null)}function Cv(n){if(n.propertyName==="value"&&bu(vi)){var r=[];yv(r,vi,n,Op(n)),cv(wR,r)}}function kR(n,r,i){n==="focusin"?(Sv(),_i=r,vi=i,_i.attachEvent("onpropertychange",Cv)):n==="focusout"&&Sv()}function SR(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return bu(vi)}function CR(n,r){if(n==="click")return bu(r)}function NR(n,r){if(n==="input"||n==="change")return bu(r)}function ER(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var ms=typeof Object.is=="function"?Object.is:ER;function yi(n,r){if(ms(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var i=Object.keys(n),f=Object.keys(r);if(i.length!==f.length)return!1;for(f=0;f<i.length;f++){var _=i[f];if(!ve.call(r,_)||!ms(n[_],r[_]))return!1}return!0}function Nv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Ev(n,r){var i=Nv(n);n=0;for(var f;i;){if(i.nodeType===3){if(f=n+i.textContent.length,n<=r&&f>=r)return{node:i,offset:r-n};n=f}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Nv(i)}}function Rv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Rv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Tv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=du(n.document);r instanceof n.HTMLIFrameElement;){try{var i=typeof r.contentWindow.location.href=="string"}catch{i=!1}if(i)n=r.contentWindow;else break;r=du(n.document)}return r}function Vp(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var RR=ka&&"documentMode"in document&&11>=document.documentMode,Wo=null,Fp=null,ji=null,Gp=!1;function Av(n,r,i){var f=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Gp||Wo==null||Wo!==du(f)||(f=Wo,"selectionStart"in f&&Vp(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),ji&&yi(ji,f)||(ji=f,f=od(Fp,"onSelect"),0<f.length&&(r=new gu("onSelect","select",null,r,i),n.push({event:r,listeners:f}),r.target=Wo)))}function Xr(n,r){var i={};return i[n.toLowerCase()]=r.toLowerCase(),i["Webkit"+n]="webkit"+r,i["Moz"+n]="moz"+r,i}var Zo={animationend:Xr("Animation","AnimationEnd"),animationiteration:Xr("Animation","AnimationIteration"),animationstart:Xr("Animation","AnimationStart"),transitionrun:Xr("Transition","TransitionRun"),transitionstart:Xr("Transition","TransitionStart"),transitioncancel:Xr("Transition","TransitionCancel"),transitionend:Xr("Transition","TransitionEnd")},Yp={},Mv={};ka&&(Mv=document.createElement("div").style,"AnimationEvent"in window||(delete Zo.animationend.animation,delete Zo.animationiteration.animation,delete Zo.animationstart.animation),"TransitionEvent"in window||delete Zo.transitionend.transition);function Qr(n){if(Yp[n])return Yp[n];if(!Zo[n])return n;var r=Zo[n],i;for(i in r)if(r.hasOwnProperty(i)&&i in Mv)return Yp[n]=r[i];return n}var Ov=Qr("animationend"),zv=Qr("animationiteration"),Dv=Qr("animationstart"),TR=Qr("transitionrun"),AR=Qr("transitionstart"),MR=Qr("transitioncancel"),Lv=Qr("transitionend"),Pv=new Map,Kp="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(" ");Kp.push("scrollEnd");function Hs(n,r){Pv.set(n,r),Yr(r,[n])}var _u=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ns=[],Jo=0,Xp=0;function vu(){for(var n=Jo,r=Xp=Jo=0;r<n;){var i=Ns[r];Ns[r++]=null;var f=Ns[r];Ns[r++]=null;var _=Ns[r];Ns[r++]=null;var k=Ns[r];if(Ns[r++]=null,f!==null&&_!==null){var A=f.pending;A===null?_.next=_:(_.next=A.next,A.next=_),f.pending=_}k!==0&&Iv(i,_,k)}}function yu(n,r,i,f){Ns[Jo++]=n,Ns[Jo++]=r,Ns[Jo++]=i,Ns[Jo++]=f,Xp|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function Qp(n,r,i,f){return yu(n,r,i,f),ju(n)}function Wr(n,r){return yu(n,null,null,r),ju(n)}function Iv(n,r,i){n.lanes|=i;var f=n.alternate;f!==null&&(f.lanes|=i);for(var _=!1,k=n.return;k!==null;)k.childLanes|=i,f=k.alternate,f!==null&&(f.childLanes|=i),k.tag===22&&(n=k.stateNode,n===null||n._visibility&1||(_=!0)),n=k,k=k.return;return n.tag===3?(k=n.stateNode,_&&r!==null&&(_=31-Le(i),n=k.hiddenUpdates,f=n[_],f===null?n[_]=[r]:f.push(r),r.lane=i|536870912),k):null}function ju(n){if(50<Vi)throw Vi=0,rh=null,Error(o(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var el={};function OR(n,r,i,f){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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hs(n,r,i,f){return new OR(n,r,i,f)}function Wp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Sa(n,r){var i=n.alternate;return i===null?(i=hs(n.tag,r,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=r,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,r=n.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function Bv(n,r){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=r,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,r=i.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function wu(n,r,i,f,_,k){var A=0;if(f=n,typeof n=="function")Wp(n)&&(A=1);else if(typeof n=="string")A=IT(n,i,te.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=hs(31,i,r,_),n.elementType=B,n.lanes=k,n;case y:return Zr(i.children,_,k,r);case j:A=8,_|=24;break;case E:return n=hs(12,i,r,_|2),n.elementType=E,n.lanes=k,n;case M:return n=hs(13,i,r,_),n.elementType=M,n.lanes=k,n;case T:return n=hs(19,i,r,_),n.elementType=T,n.lanes=k,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case C:A=10;break e;case S:A=9;break e;case R:A=11;break e;case O:A=14;break e;case D:A=16,f=null;break e}A=29,i=Error(o(130,n===null?"null":typeof n,"")),f=null}return r=hs(A,i,r,_),r.elementType=n,r.type=f,r.lanes=k,r}function Zr(n,r,i,f){return n=hs(7,n,f,r),n.lanes=i,n}function Zp(n,r,i){return n=hs(6,n,null,r),n.lanes=i,n}function Uv(n){var r=hs(18,null,null,0);return r.stateNode=n,r}function Jp(n,r,i){return r=hs(4,n.children!==null?n.children:[],n.key,r),r.lanes=i,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var $v=new WeakMap;function Es(n,r){if(typeof n=="object"&&n!==null){var i=$v.get(n);return i!==void 0?i:(r={value:n,source:r,stack:Te(r)},$v.set(n,r),r)}return{value:n,source:r,stack:Te(r)}}var tl=[],nl=0,ku=null,wi=0,Rs=[],Ts=0,sr=null,Js=1,ea="";function Ca(n,r){tl[nl++]=wi,tl[nl++]=ku,ku=n,wi=r}function Hv(n,r,i){Rs[Ts++]=Js,Rs[Ts++]=ea,Rs[Ts++]=sr,sr=n;var f=Js;n=ea;var _=32-Le(f)-1;f&=~(1<<_),i+=1;var k=32-Le(r)+_;if(30<k){var A=_-_%5;k=(f&(1<<A)-1).toString(32),f>>=A,_-=A,Js=1<<32-Le(r)+_|i<<_|f,ea=k+n}else Js=1<<k|i<<_|f,ea=n}function em(n){n.return!==null&&(Ca(n,1),Hv(n,1,0))}function tm(n){for(;n===ku;)ku=tl[--nl],tl[nl]=null,wi=tl[--nl],tl[nl]=null;for(;n===sr;)sr=Rs[--Ts],Rs[Ts]=null,ea=Rs[--Ts],Rs[Ts]=null,Js=Rs[--Ts],Rs[Ts]=null}function qv(n,r){Rs[Ts++]=Js,Rs[Ts++]=ea,Rs[Ts++]=sr,Js=r.id,ea=r.overflow,sr=n}var In=null,en=null,Nt=!1,ar=null,As=!1,nm=Error(o(519));function rr(n){var r=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ki(Es(r,n)),nm}function Vv(n){var r=n.stateNode,i=n.type,f=n.memoizedProps;switch(r[Ft]=n,r[Pn]=f,i){case"dialog":jt("cancel",r),jt("close",r);break;case"iframe":case"object":case"embed":jt("load",r);break;case"video":case"audio":for(i=0;i<Gi.length;i++)jt(Gi[i],r);break;case"source":jt("error",r);break;case"img":case"image":case"link":jt("error",r),jt("load",r);break;case"details":jt("toggle",r);break;case"input":jt("invalid",r),sv(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":jt("invalid",r);break;case"textarea":jt("invalid",r),rv(r,f.value,f.defaultValue,f.children)}i=f.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||r.textContent===""+i||f.suppressHydrationWarning===!0||l1(r.textContent,i)?(f.popover!=null&&(jt("beforetoggle",r),jt("toggle",r)),f.onScroll!=null&&jt("scroll",r),f.onScrollEnd!=null&&jt("scrollend",r),f.onClick!=null&&(r.onclick=wa),r=!0):r=!1,r||rr(n,!0)}function Fv(n){for(In=n.return;In;)switch(In.tag){case 5:case 31:case 13:As=!1;return;case 27:case 3:As=!0;return;default:In=In.return}}function sl(n){if(n!==In)return!1;if(!Nt)return Fv(n),Nt=!0,!1;var r=n.tag,i;if((i=r!==3&&r!==27)&&((i=r===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||vh(n.type,n.memoizedProps)),i=!i),i&&en&&rr(n),Fv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));en=g1(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));en=g1(n)}else r===27?(r=en,_r(n.type)?(n=Sh,Sh=null,en=n):en=r):en=In?Os(n.stateNode.nextSibling):null;return!0}function Jr(){en=In=null,Nt=!1}function sm(){var n=ar;return n!==null&&(ls===null?ls=n:ls.push.apply(ls,n),ar=null),n}function ki(n){ar===null?ar=[n]:ar.push(n)}var am=I(null),eo=null,Na=null;function or(n,r,i){Z(am,r._currentValue),r._currentValue=i}function Ea(n){n._currentValue=am.current,Y(am)}function rm(n,r,i){for(;n!==null;){var f=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),n===i)break;n=n.return}}function om(n,r,i,f){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var k=_.dependencies;if(k!==null){var A=_.child;k=k.firstContext;e:for(;k!==null;){var H=k;k=_;for(var Q=0;Q<r.length;Q++)if(H.context===r[Q]){k.lanes|=i,H=k.alternate,H!==null&&(H.lanes|=i),rm(k.return,i,n),f||(A=null);break e}k=H.next}}else if(_.tag===18){if(A=_.return,A===null)throw Error(o(341));A.lanes|=i,k=A.alternate,k!==null&&(k.lanes|=i),rm(A,i,n),A=null}else A=_.child;if(A!==null)A.return=_;else for(A=_;A!==null;){if(A===n){A=null;break}if(_=A.sibling,_!==null){_.return=A.return,A=_;break}A=A.return}_=A}}function al(n,r,i,f){n=null;for(var _=r,k=!1;_!==null;){if(!k){if((_.flags&524288)!==0)k=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var A=_.alternate;if(A===null)throw Error(o(387));if(A=A.memoizedProps,A!==null){var H=_.type;ms(_.pendingProps.value,A.value)||(n!==null?n.push(H):n=[H])}}else if(_===se.current){if(A=_.alternate,A===null)throw Error(o(387));A.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Wi):n=[Wi])}_=_.return}n!==null&&om(r,n,i,f),r.flags|=262144}function Su(n){for(n=n.firstContext;n!==null;){if(!ms(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function to(n){eo=n,Na=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Bn(n){return Gv(eo,n)}function Cu(n,r){return eo===null&&to(n),Gv(n,r)}function Gv(n,r){var i=r._currentValue;if(r={context:r,memoizedValue:i,next:null},Na===null){if(n===null)throw Error(o(308));Na=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Na=Na.next=r;return i}var zR=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(i,f){n.push(f)}};this.abort=function(){r.aborted=!0,n.forEach(function(i){return i()})}},DR=e.unstable_scheduleCallback,LR=e.unstable_NormalPriority,_n={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lm(){return{controller:new zR,data:new Map,refCount:0}}function Si(n){n.refCount--,n.refCount===0&&DR(LR,function(){n.controller.abort()})}var Ci=null,im=0,rl=0,ol=null;function PR(n,r){if(Ci===null){var i=Ci=[];im=0,rl=dh(),ol={status:"pending",value:void 0,then:function(f){i.push(f)}}}return im++,r.then(Yv,Yv),r}function Yv(){if(--im===0&&Ci!==null){ol!==null&&(ol.status="fulfilled");var n=Ci;Ci=null,rl=0,ol=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function IR(n,r){var i=[],f={status:"pending",value:null,reason:null,then:function(_){i.push(_)}};return n.then(function(){f.status="fulfilled",f.value=r;for(var _=0;_<i.length;_++)(0,i[_])(r)},function(_){for(f.status="rejected",f.reason=_,_=0;_<i.length;_++)(0,i[_])(void 0)}),f}var Kv=q.S;q.S=function(n,r){A0=ue(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&PR(n,r),Kv!==null&&Kv(n,r)};var no=I(null);function cm(){var n=no.current;return n!==null?n:Gt.pooledCache}function Nu(n,r){r===null?Z(no,no.current):Z(no,r.pool)}function Xv(){var n=cm();return n===null?null:{parent:_n._currentValue,pool:n}}var ll=Error(o(460)),um=Error(o(474)),Eu=Error(o(542)),Ru={then:function(){}};function Qv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Wv(n,r,i){switch(i=n[i],i===void 0?n.push(r):i!==r&&(r.then(wa,wa),r=i),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Jv(n),n;default:if(typeof r.status=="string")r.then(wa,wa);else{if(n=Gt,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=r,n.status="pending",n.then(function(f){if(r.status==="pending"){var _=r;_.status="fulfilled",_.value=f}},function(f){if(r.status==="pending"){var _=r;_.status="rejected",_.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Jv(n),n}throw ao=r,ll}}function so(n){try{var r=n._init;return r(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(ao=i,ll):i}}var ao=null;function Zv(){if(ao===null)throw Error(o(459));var n=ao;return ao=null,n}function Jv(n){if(n===ll||n===Eu)throw Error(o(483))}var il=null,Ni=0;function Tu(n){var r=Ni;return Ni+=1,il===null&&(il=[]),Wv(il,n,r)}function Ei(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function Au(n,r){throw r.$$typeof===v?Error(o(525)):(n=Object.prototype.toString.call(r),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function ey(n){function r(J,W){if(n){var ae=J.deletions;ae===null?(J.deletions=[W],J.flags|=16):ae.push(W)}}function i(J,W){if(!n)return null;for(;W!==null;)r(J,W),W=W.sibling;return null}function f(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=Sa(J,W),J.index=0,J.sibling=null,J}function k(J,W,ae){return J.index=ae,n?(ae=J.alternate,ae!==null?(ae=ae.index,ae<W?(J.flags|=67108866,W):ae):(J.flags|=67108866,W)):(J.flags|=1048576,W)}function A(J){return n&&J.alternate===null&&(J.flags|=67108866),J}function H(J,W,ae,be){return W===null||W.tag!==6?(W=Zp(ae,J.mode,be),W.return=J,W):(W=_(W,ae),W.return=J,W)}function Q(J,W,ae,be){var Ze=ae.type;return Ze===y?ge(J,W,ae.props.children,be,ae.key):W!==null&&(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===D&&so(Ze)===W.type)?(W=_(W,ae.props),Ei(W,ae),W.return=J,W):(W=wu(ae.type,ae.key,ae.props,null,J.mode,be),Ei(W,ae),W.return=J,W)}function oe(J,W,ae,be){return W===null||W.tag!==4||W.stateNode.containerInfo!==ae.containerInfo||W.stateNode.implementation!==ae.implementation?(W=Jp(ae,J.mode,be),W.return=J,W):(W=_(W,ae.children||[]),W.return=J,W)}function ge(J,W,ae,be,Ze){return W===null||W.tag!==7?(W=Zr(ae,J.mode,be,Ze),W.return=J,W):(W=_(W,ae),W.return=J,W)}function ye(J,W,ae){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=Zp(""+W,J.mode,ae),W.return=J,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return ae=wu(W.type,W.key,W.props,null,J.mode,ae),Ei(ae,W),ae.return=J,ae;case N:return W=Jp(W,J.mode,ae),W.return=J,W;case D:return W=so(W),ye(J,W,ae)}if(V(W)||z(W))return W=Zr(W,J.mode,ae,null),W.return=J,W;if(typeof W.then=="function")return ye(J,Tu(W),ae);if(W.$$typeof===C)return ye(J,Cu(J,W),ae);Au(J,W)}return null}function ce(J,W,ae,be){var Ze=W!==null?W.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return Ze!==null?null:H(J,W,""+ae,be);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case w:return ae.key===Ze?Q(J,W,ae,be):null;case N:return ae.key===Ze?oe(J,W,ae,be):null;case D:return ae=so(ae),ce(J,W,ae,be)}if(V(ae)||z(ae))return Ze!==null?null:ge(J,W,ae,be,null);if(typeof ae.then=="function")return ce(J,W,Tu(ae),be);if(ae.$$typeof===C)return ce(J,W,Cu(J,ae),be);Au(J,ae)}return null}function pe(J,W,ae,be,Ze){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return J=J.get(ae)||null,H(W,J,""+be,Ze);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case w:return J=J.get(be.key===null?ae:be.key)||null,Q(W,J,be,Ze);case N:return J=J.get(be.key===null?ae:be.key)||null,oe(W,J,be,Ze);case D:return be=so(be),pe(J,W,ae,be,Ze)}if(V(be)||z(be))return J=J.get(ae)||null,ge(W,J,be,Ze,null);if(typeof be.then=="function")return pe(J,W,ae,Tu(be),Ze);if(be.$$typeof===C)return pe(J,W,ae,Cu(W,be),Ze);Au(W,be)}return null}function He(J,W,ae,be){for(var Ze=null,Tt=null,Ye=W,mt=W=0,kt=null;Ye!==null&&mt<ae.length;mt++){Ye.index>mt?(kt=Ye,Ye=null):kt=Ye.sibling;var At=ce(J,Ye,ae[mt],be);if(At===null){Ye===null&&(Ye=kt);break}n&&Ye&&At.alternate===null&&r(J,Ye),W=k(At,W,mt),Tt===null?Ze=At:Tt.sibling=At,Tt=At,Ye=kt}if(mt===ae.length)return i(J,Ye),Nt&&Ca(J,mt),Ze;if(Ye===null){for(;mt<ae.length;mt++)Ye=ye(J,ae[mt],be),Ye!==null&&(W=k(Ye,W,mt),Tt===null?Ze=Ye:Tt.sibling=Ye,Tt=Ye);return Nt&&Ca(J,mt),Ze}for(Ye=f(Ye);mt<ae.length;mt++)kt=pe(Ye,J,mt,ae[mt],be),kt!==null&&(n&&kt.alternate!==null&&Ye.delete(kt.key===null?mt:kt.key),W=k(kt,W,mt),Tt===null?Ze=kt:Tt.sibling=kt,Tt=kt);return n&&Ye.forEach(function(kr){return r(J,kr)}),Nt&&Ca(J,mt),Ze}function at(J,W,ae,be){if(ae==null)throw Error(o(151));for(var Ze=null,Tt=null,Ye=W,mt=W=0,kt=null,At=ae.next();Ye!==null&&!At.done;mt++,At=ae.next()){Ye.index>mt?(kt=Ye,Ye=null):kt=Ye.sibling;var kr=ce(J,Ye,At.value,be);if(kr===null){Ye===null&&(Ye=kt);break}n&&Ye&&kr.alternate===null&&r(J,Ye),W=k(kr,W,mt),Tt===null?Ze=kr:Tt.sibling=kr,Tt=kr,Ye=kt}if(At.done)return i(J,Ye),Nt&&Ca(J,mt),Ze;if(Ye===null){for(;!At.done;mt++,At=ae.next())At=ye(J,At.value,be),At!==null&&(W=k(At,W,mt),Tt===null?Ze=At:Tt.sibling=At,Tt=At);return Nt&&Ca(J,mt),Ze}for(Ye=f(Ye);!At.done;mt++,At=ae.next())At=pe(Ye,J,mt,At.value,be),At!==null&&(n&&At.alternate!==null&&Ye.delete(At.key===null?mt:At.key),W=k(At,W,mt),Tt===null?Ze=At:Tt.sibling=At,Tt=At);return n&&Ye.forEach(function(XT){return r(J,XT)}),Nt&&Ca(J,mt),Ze}function $t(J,W,ae,be){if(typeof ae=="object"&&ae!==null&&ae.type===y&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case w:e:{for(var Ze=ae.key;W!==null;){if(W.key===Ze){if(Ze=ae.type,Ze===y){if(W.tag===7){i(J,W.sibling),be=_(W,ae.props.children),be.return=J,J=be;break e}}else if(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===D&&so(Ze)===W.type){i(J,W.sibling),be=_(W,ae.props),Ei(be,ae),be.return=J,J=be;break e}i(J,W);break}else r(J,W);W=W.sibling}ae.type===y?(be=Zr(ae.props.children,J.mode,be,ae.key),be.return=J,J=be):(be=wu(ae.type,ae.key,ae.props,null,J.mode,be),Ei(be,ae),be.return=J,J=be)}return A(J);case N:e:{for(Ze=ae.key;W!==null;){if(W.key===Ze)if(W.tag===4&&W.stateNode.containerInfo===ae.containerInfo&&W.stateNode.implementation===ae.implementation){i(J,W.sibling),be=_(W,ae.children||[]),be.return=J,J=be;break e}else{i(J,W);break}else r(J,W);W=W.sibling}be=Jp(ae,J.mode,be),be.return=J,J=be}return A(J);case D:return ae=so(ae),$t(J,W,ae,be)}if(V(ae))return He(J,W,ae,be);if(z(ae)){if(Ze=z(ae),typeof Ze!="function")throw Error(o(150));return ae=Ze.call(ae),at(J,W,ae,be)}if(typeof ae.then=="function")return $t(J,W,Tu(ae),be);if(ae.$$typeof===C)return $t(J,W,Cu(J,ae),be);Au(J,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,W!==null&&W.tag===6?(i(J,W.sibling),be=_(W,ae),be.return=J,J=be):(i(J,W),be=Zp(ae,J.mode,be),be.return=J,J=be),A(J)):i(J,W)}return function(J,W,ae,be){try{Ni=0;var Ze=$t(J,W,ae,be);return il=null,Ze}catch(Ye){if(Ye===ll||Ye===Eu)throw Ye;var Tt=hs(29,Ye,null,J.mode);return Tt.lanes=be,Tt.return=J,Tt}finally{}}}var ro=ey(!0),ty=ey(!1),lr=!1;function dm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fm(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ir(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function cr(n,r,i){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(zt&2)!==0){var _=f.pending;return _===null?r.next=r:(r.next=_.next,_.next=r),f.pending=r,r=ju(n),Iv(n,null,i),r}return yu(n,f,r,i),ju(n)}function Ri(n,r,i){if(r=r.updateQueue,r!==null&&(r=r.shared,(i&4194048)!==0)){var f=r.lanes;f&=n.pendingLanes,i|=f,r.lanes=i,$s(n,i)}}function pm(n,r){var i=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,i===f)){var _=null,k=null;if(i=i.firstBaseUpdate,i!==null){do{var A={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};k===null?_=k=A:k=k.next=A,i=i.next}while(i!==null);k===null?_=k=r:k=k.next=r}else _=k=r;i={baseState:f.baseState,firstBaseUpdate:_,lastBaseUpdate:k,shared:f.shared,callbacks:f.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=r:n.next=r,i.lastBaseUpdate=r}var mm=!1;function Ti(){if(mm){var n=ol;if(n!==null)throw n}}function Ai(n,r,i,f){mm=!1;var _=n.updateQueue;lr=!1;var k=_.firstBaseUpdate,A=_.lastBaseUpdate,H=_.shared.pending;if(H!==null){_.shared.pending=null;var Q=H,oe=Q.next;Q.next=null,A===null?k=oe:A.next=oe,A=Q;var ge=n.alternate;ge!==null&&(ge=ge.updateQueue,H=ge.lastBaseUpdate,H!==A&&(H===null?ge.firstBaseUpdate=oe:H.next=oe,ge.lastBaseUpdate=Q))}if(k!==null){var ye=_.baseState;A=0,ge=oe=Q=null,H=k;do{var ce=H.lane&-536870913,pe=ce!==H.lane;if(pe?(wt&ce)===ce:(f&ce)===ce){ce!==0&&ce===rl&&(mm=!0),ge!==null&&(ge=ge.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var He=n,at=H;ce=r;var $t=i;switch(at.tag){case 1:if(He=at.payload,typeof He=="function"){ye=He.call($t,ye,ce);break e}ye=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=at.payload,ce=typeof He=="function"?He.call($t,ye,ce):He,ce==null)break e;ye=b({},ye,ce);break e;case 2:lr=!0}}ce=H.callback,ce!==null&&(n.flags|=64,pe&&(n.flags|=8192),pe=_.callbacks,pe===null?_.callbacks=[ce]:pe.push(ce))}else pe={lane:ce,tag:H.tag,payload:H.payload,callback:H.callback,next:null},ge===null?(oe=ge=pe,Q=ye):ge=ge.next=pe,A|=ce;if(H=H.next,H===null){if(H=_.shared.pending,H===null)break;pe=H,H=pe.next,pe.next=null,_.lastBaseUpdate=pe,_.shared.pending=null}}while(!0);ge===null&&(Q=ye),_.baseState=Q,_.firstBaseUpdate=oe,_.lastBaseUpdate=ge,k===null&&(_.shared.lanes=0),mr|=A,n.lanes=A,n.memoizedState=ye}}function ny(n,r){if(typeof n!="function")throw Error(o(191,n));n.call(r)}function sy(n,r){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)ny(i[n],r)}var cl=I(null),Mu=I(0);function ay(n,r){n=Pa,Z(Mu,n),Z(cl,r),Pa=n|r.baseLanes}function hm(){Z(Mu,Pa),Z(cl,cl.current)}function gm(){Pa=Mu.current,Y(cl),Y(Mu)}var gs=I(null),Ms=null;function ur(n){var r=n.alternate;Z(xn,xn.current&1),Z(gs,n),Ms===null&&(r===null||cl.current!==null||r.memoizedState!==null)&&(Ms=n)}function xm(n){Z(xn,xn.current),Z(gs,n),Ms===null&&(Ms=n)}function ry(n){n.tag===22?(Z(xn,xn.current),Z(gs,n),Ms===null&&(Ms=n)):dr()}function dr(){Z(xn,xn.current),Z(gs,gs.current)}function xs(n){Y(gs),Ms===n&&(Ms=null),Y(xn)}var xn=I(0);function Ou(n){for(var r=n;r!==null;){if(r.tag===13){var i=r.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||wh(i)||kh(i)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Ra=0,ft=null,Bt=null,vn=null,zu=!1,ul=!1,oo=!1,Du=0,Mi=0,dl=null,BR=0;function un(){throw Error(o(321))}function bm(n,r){if(r===null)return!1;for(var i=0;i<r.length&&i<n.length;i++)if(!ms(n[i],r[i]))return!1;return!0}function _m(n,r,i,f,_,k){return Ra=k,ft=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,q.H=n===null||n.memoizedState===null?Hy:zm,oo=!1,k=i(f,_),oo=!1,ul&&(k=ly(r,i,f,_)),oy(n),k}function oy(n){q.H=Di;var r=Bt!==null&&Bt.next!==null;if(Ra=0,vn=Bt=ft=null,zu=!1,Mi=0,dl=null,r)throw Error(o(300));n===null||yn||(n=n.dependencies,n!==null&&Su(n)&&(yn=!0))}function ly(n,r,i,f){ft=n;var _=0;do{if(ul&&(dl=null),Mi=0,ul=!1,25<=_)throw Error(o(301));if(_+=1,vn=Bt=null,n.updateQueue!=null){var k=n.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}q.H=qy,k=r(i,f)}while(ul);return k}function UR(){var n=q.H,r=n.useState()[0];return r=typeof r.then=="function"?Oi(r):r,n=n.useState()[0],(Bt!==null?Bt.memoizedState:null)!==n&&(ft.flags|=1024),r}function vm(){var n=Du!==0;return Du=0,n}function ym(n,r,i){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~i}function jm(n){if(zu){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}zu=!1}Ra=0,vn=Bt=ft=null,ul=!1,Mi=Du=0,dl=null}function Xn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?ft.memoizedState=vn=n:vn=vn.next=n,vn}function bn(){if(Bt===null){var n=ft.alternate;n=n!==null?n.memoizedState:null}else n=Bt.next;var r=vn===null?ft.memoizedState:vn.next;if(r!==null)vn=r,Bt=n;else{if(n===null)throw ft.alternate===null?Error(o(467)):Error(o(310));Bt=n,n={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},vn===null?ft.memoizedState=vn=n:vn=vn.next=n}return vn}function Lu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oi(n){var r=Mi;return Mi+=1,dl===null&&(dl=[]),n=Wv(dl,n,r),r=ft,(vn===null?r.memoizedState:vn.next)===null&&(r=r.alternate,q.H=r===null||r.memoizedState===null?Hy:zm),n}function Pu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Oi(n);if(n.$$typeof===C)return Bn(n)}throw Error(o(438,String(n)))}function wm(n){var r=null,i=ft.updateQueue;if(i!==null&&(r=i.memoCache),r==null){var f=ft.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(_){return _.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),i===null&&(i=Lu(),ft.updateQueue=i),i.memoCache=r,i=r.data[r.index],i===void 0)for(i=r.data[r.index]=Array(n),f=0;f<n;f++)i[f]=L;return r.index++,i}function Ta(n,r){return typeof r=="function"?r(n):r}function Iu(n){var r=bn();return km(r,Bt,n)}function km(n,r,i){var f=n.queue;if(f===null)throw Error(o(311));f.lastRenderedReducer=i;var _=n.baseQueue,k=f.pending;if(k!==null){if(_!==null){var A=_.next;_.next=k.next,k.next=A}r.baseQueue=_=k,f.pending=null}if(k=n.baseState,_===null)n.memoizedState=k;else{r=_.next;var H=A=null,Q=null,oe=r,ge=!1;do{var ye=oe.lane&-536870913;if(ye!==oe.lane?(wt&ye)===ye:(Ra&ye)===ye){var ce=oe.revertLane;if(ce===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),ye===rl&&(ge=!0);else if((Ra&ce)===ce){oe=oe.next,ce===rl&&(ge=!0);continue}else ye={lane:0,revertLane:oe.revertLane,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},Q===null?(H=Q=ye,A=k):Q=Q.next=ye,ft.lanes|=ce,mr|=ce;ye=oe.action,oo&&i(k,ye),k=oe.hasEagerState?oe.eagerState:i(k,ye)}else ce={lane:ye,revertLane:oe.revertLane,gesture:oe.gesture,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},Q===null?(H=Q=ce,A=k):Q=Q.next=ce,ft.lanes|=ye,mr|=ye;oe=oe.next}while(oe!==null&&oe!==r);if(Q===null?A=k:Q.next=H,!ms(k,n.memoizedState)&&(yn=!0,ge&&(i=ol,i!==null)))throw i;n.memoizedState=k,n.baseState=A,n.baseQueue=Q,f.lastRenderedState=k}return _===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function Sm(n){var r=bn(),i=r.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var f=i.dispatch,_=i.pending,k=r.memoizedState;if(_!==null){i.pending=null;var A=_=_.next;do k=n(k,A.action),A=A.next;while(A!==_);ms(k,r.memoizedState)||(yn=!0),r.memoizedState=k,r.baseQueue===null&&(r.baseState=k),i.lastRenderedState=k}return[k,f]}function iy(n,r,i){var f=ft,_=bn(),k=Nt;if(k){if(i===void 0)throw Error(o(407));i=i()}else i=r();var A=!ms((Bt||_).memoizedState,i);if(A&&(_.memoizedState=i,yn=!0),_=_.queue,Em(dy.bind(null,f,_,n),[n]),_.getSnapshot!==r||A||vn!==null&&vn.memoizedState.tag&1){if(f.flags|=2048,fl(9,{destroy:void 0},uy.bind(null,f,_,i,r),null),Gt===null)throw Error(o(349));k||(Ra&127)!==0||cy(f,r,i)}return i}function cy(n,r,i){n.flags|=16384,n={getSnapshot:r,value:i},r=ft.updateQueue,r===null?(r=Lu(),ft.updateQueue=r,r.stores=[n]):(i=r.stores,i===null?r.stores=[n]:i.push(n))}function uy(n,r,i,f){r.value=i,r.getSnapshot=f,fy(r)&&py(n)}function dy(n,r,i){return i(function(){fy(r)&&py(n)})}function fy(n){var r=n.getSnapshot;n=n.value;try{var i=r();return!ms(n,i)}catch{return!0}}function py(n){var r=Wr(n,2);r!==null&&is(r,n,2)}function Cm(n){var r=Xn();if(typeof n=="function"){var i=n;if(n=i(),oo){xe(!0);try{i()}finally{xe(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:n},r}function my(n,r,i,f){return n.baseState=i,km(n,Bt,typeof f=="function"?f:Ta)}function $R(n,r,i,f,_){if($u(n))throw Error(o(485));if(n=r.action,n!==null){var k={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){k.listeners.push(A)}};q.T!==null?i(!0):k.isTransition=!1,f(k),i=r.pending,i===null?(k.next=r.pending=k,hy(r,k)):(k.next=i.next,r.pending=i.next=k)}}function hy(n,r){var i=r.action,f=r.payload,_=n.state;if(r.isTransition){var k=q.T,A={};q.T=A;try{var H=i(_,f),Q=q.S;Q!==null&&Q(A,H),gy(n,r,H)}catch(oe){Nm(n,r,oe)}finally{k!==null&&A.types!==null&&(k.types=A.types),q.T=k}}else try{k=i(_,f),gy(n,r,k)}catch(oe){Nm(n,r,oe)}}function gy(n,r,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(f){xy(n,r,f)},function(f){return Nm(n,r,f)}):xy(n,r,i)}function xy(n,r,i){r.status="fulfilled",r.value=i,by(r),n.state=i,r=n.pending,r!==null&&(i=r.next,i===r?n.pending=null:(i=i.next,r.next=i,hy(n,i)))}function Nm(n,r,i){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=i,by(r),r=r.next;while(r!==f)}n.action=null}function by(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function _y(n,r){return r}function vy(n,r){if(Nt){var i=Gt.formState;if(i!==null){e:{var f=ft;if(Nt){if(en){t:{for(var _=en,k=As;_.nodeType!==8;){if(!k){_=null;break t}if(_=Os(_.nextSibling),_===null){_=null;break t}}k=_.data,_=k==="F!"||k==="F"?_:null}if(_){en=Os(_.nextSibling),f=_.data==="F!";break e}}rr(f)}f=!1}f&&(r=i[0])}}return i=Xn(),i.memoizedState=i.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_y,lastRenderedState:r},i.queue=f,i=By.bind(null,ft,f),f.dispatch=i,f=Cm(!1),k=Om.bind(null,ft,!1,f.queue),f=Xn(),_={state:r,dispatch:null,action:n,pending:null},f.queue=_,i=$R.bind(null,ft,_,k,i),_.dispatch=i,f.memoizedState=n,[r,i,!1]}function yy(n){var r=bn();return jy(r,Bt,n)}function jy(n,r,i){if(r=km(n,r,_y)[0],n=Iu(Ta)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=Oi(r)}catch(A){throw A===ll?Eu:A}else f=r;r=bn();var _=r.queue,k=_.dispatch;return i!==r.memoizedState&&(ft.flags|=2048,fl(9,{destroy:void 0},HR.bind(null,_,i),null)),[f,k,n]}function HR(n,r){n.action=r}function wy(n){var r=bn(),i=Bt;if(i!==null)return jy(r,i,n);bn(),r=r.memoizedState,i=bn();var f=i.queue.dispatch;return i.memoizedState=n,[r,f,!1]}function fl(n,r,i,f){return n={tag:n,create:i,deps:f,inst:r,next:null},r=ft.updateQueue,r===null&&(r=Lu(),ft.updateQueue=r),i=r.lastEffect,i===null?r.lastEffect=n.next=n:(f=i.next,i.next=n,n.next=f,r.lastEffect=n),n}function ky(){return bn().memoizedState}function Bu(n,r,i,f){var _=Xn();ft.flags|=n,_.memoizedState=fl(1|r,{destroy:void 0},i,f===void 0?null:f)}function Uu(n,r,i,f){var _=bn();f=f===void 0?null:f;var k=_.memoizedState.inst;Bt!==null&&f!==null&&bm(f,Bt.memoizedState.deps)?_.memoizedState=fl(r,k,i,f):(ft.flags|=n,_.memoizedState=fl(1|r,k,i,f))}function Sy(n,r){Bu(8390656,8,n,r)}function Em(n,r){Uu(2048,8,n,r)}function qR(n){ft.flags|=4;var r=ft.updateQueue;if(r===null)r=Lu(),ft.updateQueue=r,r.events=[n];else{var i=r.events;i===null?r.events=[n]:i.push(n)}}function Cy(n){var r=bn().memoizedState;return qR({ref:r,nextImpl:n}),function(){if((zt&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}function Ny(n,r){return Uu(4,2,n,r)}function Ey(n,r){return Uu(4,4,n,r)}function Ry(n,r){if(typeof r=="function"){n=n();var i=r(n);return function(){typeof i=="function"?i():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function Ty(n,r,i){i=i!=null?i.concat([n]):null,Uu(4,4,Ry.bind(null,r,n),i)}function Rm(){}function Ay(n,r){var i=bn();r=r===void 0?null:r;var f=i.memoizedState;return r!==null&&bm(r,f[1])?f[0]:(i.memoizedState=[n,r],n)}function My(n,r){var i=bn();r=r===void 0?null:r;var f=i.memoizedState;if(r!==null&&bm(r,f[1]))return f[0];if(f=n(),oo){xe(!0);try{n()}finally{xe(!1)}}return i.memoizedState=[f,r],f}function Tm(n,r,i){return i===void 0||(Ra&1073741824)!==0&&(wt&261930)===0?n.memoizedState=r:(n.memoizedState=i,n=O0(),ft.lanes|=n,mr|=n,i)}function Oy(n,r,i,f){return ms(i,r)?i:cl.current!==null?(n=Tm(n,i,f),ms(n,r)||(yn=!0),n):(Ra&42)===0||(Ra&1073741824)!==0&&(wt&261930)===0?(yn=!0,n.memoizedState=i):(n=O0(),ft.lanes|=n,mr|=n,r)}function zy(n,r,i,f,_){var k=X.p;X.p=k!==0&&8>k?k:8;var A=q.T,H={};q.T=H,Om(n,!1,r,i);try{var Q=_(),oe=q.S;if(oe!==null&&oe(H,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ge=IR(Q,f);zi(n,r,ge,vs(n))}else zi(n,r,f,vs(n))}catch(ye){zi(n,r,{then:function(){},status:"rejected",reason:ye},vs())}finally{X.p=k,A!==null&&H.types!==null&&(A.types=H.types),q.T=A}}function VR(){}function Am(n,r,i,f){if(n.tag!==5)throw Error(o(476));var _=Dy(n).queue;zy(n,_,r,K,i===null?VR:function(){return Ly(n),i(f)})}function Dy(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:K},next:null};var i={};return r.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:i},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Ly(n){var r=Dy(n);r.next===null&&(r=n.alternate.memoizedState),zi(n,r.next.queue,{},vs())}function Mm(){return Bn(Wi)}function Py(){return bn().memoizedState}function Iy(){return bn().memoizedState}function FR(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var i=vs();n=ir(i);var f=cr(r,n,i);f!==null&&(is(f,r,i),Ri(f,r,i)),r={cache:lm()},n.payload=r;return}r=r.return}}function GR(n,r,i){var f=vs();i={lane:f,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},$u(n)?Uy(r,i):(i=Qp(n,r,i,f),i!==null&&(is(i,n,f),$y(i,r,f)))}function By(n,r,i){var f=vs();zi(n,r,i,f)}function zi(n,r,i,f){var _={lane:f,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if($u(n))Uy(r,_);else{var k=n.alternate;if(n.lanes===0&&(k===null||k.lanes===0)&&(k=r.lastRenderedReducer,k!==null))try{var A=r.lastRenderedState,H=k(A,i);if(_.hasEagerState=!0,_.eagerState=H,ms(H,A))return yu(n,r,_,0),Gt===null&&vu(),!1}catch{}finally{}if(i=Qp(n,r,_,f),i!==null)return is(i,n,f),$y(i,r,f),!0}return!1}function Om(n,r,i,f){if(f={lane:2,revertLane:dh(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},$u(n)){if(r)throw Error(o(479))}else r=Qp(n,i,f,2),r!==null&&is(r,n,2)}function $u(n){var r=n.alternate;return n===ft||r!==null&&r===ft}function Uy(n,r){ul=zu=!0;var i=n.pending;i===null?r.next=r:(r.next=i.next,i.next=r),n.pending=r}function $y(n,r,i){if((i&4194048)!==0){var f=r.lanes;f&=n.pendingLanes,i|=f,r.lanes=i,$s(n,i)}}var Di={readContext:Bn,use:Pu,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useLayoutEffect:un,useInsertionEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useSyncExternalStore:un,useId:un,useHostTransitionStatus:un,useFormState:un,useActionState:un,useOptimistic:un,useMemoCache:un,useCacheRefresh:un};Di.useEffectEvent=un;var Hy={readContext:Bn,use:Pu,useCallback:function(n,r){return Xn().memoizedState=[n,r===void 0?null:r],n},useContext:Bn,useEffect:Sy,useImperativeHandle:function(n,r,i){i=i!=null?i.concat([n]):null,Bu(4194308,4,Ry.bind(null,r,n),i)},useLayoutEffect:function(n,r){return Bu(4194308,4,n,r)},useInsertionEffect:function(n,r){Bu(4,2,n,r)},useMemo:function(n,r){var i=Xn();r=r===void 0?null:r;var f=n();if(oo){xe(!0);try{n()}finally{xe(!1)}}return i.memoizedState=[f,r],f},useReducer:function(n,r,i){var f=Xn();if(i!==void 0){var _=i(r);if(oo){xe(!0);try{i(r)}finally{xe(!1)}}}else _=r;return f.memoizedState=f.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},f.queue=n,n=n.dispatch=GR.bind(null,ft,n),[f.memoizedState,n]},useRef:function(n){var r=Xn();return n={current:n},r.memoizedState=n},useState:function(n){n=Cm(n);var r=n.queue,i=By.bind(null,ft,r);return r.dispatch=i,[n.memoizedState,i]},useDebugValue:Rm,useDeferredValue:function(n,r){var i=Xn();return Tm(i,n,r)},useTransition:function(){var n=Cm(!1);return n=zy.bind(null,ft,n.queue,!0,!1),Xn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,i){var f=ft,_=Xn();if(Nt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=r(),Gt===null)throw Error(o(349));(wt&127)!==0||cy(f,r,i)}_.memoizedState=i;var k={value:i,getSnapshot:r};return _.queue=k,Sy(dy.bind(null,f,k,n),[n]),f.flags|=2048,fl(9,{destroy:void 0},uy.bind(null,f,k,i,r),null),i},useId:function(){var n=Xn(),r=Gt.identifierPrefix;if(Nt){var i=ea,f=Js;i=(f&~(1<<32-Le(f)-1)).toString(32)+i,r="_"+r+"R_"+i,i=Du++,0<i&&(r+="H"+i.toString(32)),r+="_"}else i=BR++,r="_"+r+"r_"+i.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Mm,useFormState:vy,useActionState:vy,useOptimistic:function(n){var r=Xn();r.memoizedState=r.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=i,r=Om.bind(null,ft,!0,i),i.dispatch=r,[n,r]},useMemoCache:wm,useCacheRefresh:function(){return Xn().memoizedState=FR.bind(null,ft)},useEffectEvent:function(n){var r=Xn(),i={impl:n};return r.memoizedState=i,function(){if((zt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},zm={readContext:Bn,use:Pu,useCallback:Ay,useContext:Bn,useEffect:Em,useImperativeHandle:Ty,useInsertionEffect:Ny,useLayoutEffect:Ey,useMemo:My,useReducer:Iu,useRef:ky,useState:function(){return Iu(Ta)},useDebugValue:Rm,useDeferredValue:function(n,r){var i=bn();return Oy(i,Bt.memoizedState,n,r)},useTransition:function(){var n=Iu(Ta)[0],r=bn().memoizedState;return[typeof n=="boolean"?n:Oi(n),r]},useSyncExternalStore:iy,useId:Py,useHostTransitionStatus:Mm,useFormState:yy,useActionState:yy,useOptimistic:function(n,r){var i=bn();return my(i,Bt,n,r)},useMemoCache:wm,useCacheRefresh:Iy};zm.useEffectEvent=Cy;var qy={readContext:Bn,use:Pu,useCallback:Ay,useContext:Bn,useEffect:Em,useImperativeHandle:Ty,useInsertionEffect:Ny,useLayoutEffect:Ey,useMemo:My,useReducer:Sm,useRef:ky,useState:function(){return Sm(Ta)},useDebugValue:Rm,useDeferredValue:function(n,r){var i=bn();return Bt===null?Tm(i,n,r):Oy(i,Bt.memoizedState,n,r)},useTransition:function(){var n=Sm(Ta)[0],r=bn().memoizedState;return[typeof n=="boolean"?n:Oi(n),r]},useSyncExternalStore:iy,useId:Py,useHostTransitionStatus:Mm,useFormState:wy,useActionState:wy,useOptimistic:function(n,r){var i=bn();return Bt!==null?my(i,Bt,n,r):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:wm,useCacheRefresh:Iy};qy.useEffectEvent=Cy;function Dm(n,r,i,f){r=n.memoizedState,i=i(f,r),i=i==null?r:b({},r,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Lm={enqueueSetState:function(n,r,i){n=n._reactInternals;var f=vs(),_=ir(f);_.payload=r,i!=null&&(_.callback=i),r=cr(n,_,f),r!==null&&(is(r,n,f),Ri(r,n,f))},enqueueReplaceState:function(n,r,i){n=n._reactInternals;var f=vs(),_=ir(f);_.tag=1,_.payload=r,i!=null&&(_.callback=i),r=cr(n,_,f),r!==null&&(is(r,n,f),Ri(r,n,f))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var i=vs(),f=ir(i);f.tag=2,r!=null&&(f.callback=r),r=cr(n,f,i),r!==null&&(is(r,n,i),Ri(r,n,i))}};function Vy(n,r,i,f,_,k,A){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,k,A):r.prototype&&r.prototype.isPureReactComponent?!yi(i,f)||!yi(_,k):!0}function Fy(n,r,i,f){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(i,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(i,f),r.state!==n&&Lm.enqueueReplaceState(r,r.state,null)}function lo(n,r){var i=r;if("ref"in r){i={};for(var f in r)f!=="ref"&&(i[f]=r[f])}if(n=n.defaultProps){i===r&&(i=b({},i));for(var _ in n)i[_]===void 0&&(i[_]=n[_])}return i}function Gy(n){_u(n)}function Yy(n){console.error(n)}function Ky(n){_u(n)}function Hu(n,r){try{var i=n.onUncaughtError;i(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function Xy(n,r,i){try{var f=n.onCaughtError;f(i.value,{componentStack:i.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function Pm(n,r,i){return i=ir(i),i.tag=3,i.payload={element:null},i.callback=function(){Hu(n,r)},i}function Qy(n){return n=ir(n),n.tag=3,n}function Wy(n,r,i,f){var _=i.type.getDerivedStateFromError;if(typeof _=="function"){var k=f.value;n.payload=function(){return _(k)},n.callback=function(){Xy(r,i,f)}}var A=i.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(n.callback=function(){Xy(r,i,f),typeof _!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var H=f.stack;this.componentDidCatch(f.value,{componentStack:H!==null?H:""})})}function YR(n,r,i,f,_){if(i.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=i.alternate,r!==null&&al(r,i,_,!0),i=gs.current,i!==null){switch(i.tag){case 31:case 13:return Ms===null?ed():i.alternate===null&&dn===0&&(dn=3),i.flags&=-257,i.flags|=65536,i.lanes=_,f===Ru?i.flags|=16384:(r=i.updateQueue,r===null?i.updateQueue=new Set([f]):r.add(f),ih(n,f,_)),!1;case 22:return i.flags|=65536,f===Ru?i.flags|=16384:(r=i.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},i.updateQueue=r):(i=r.retryQueue,i===null?r.retryQueue=new Set([f]):i.add(f)),ih(n,f,_)),!1}throw Error(o(435,i.tag))}return ih(n,f,_),ed(),!1}if(Nt)return r=gs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=_,f!==nm&&(n=Error(o(422),{cause:f}),ki(Es(n,i)))):(f!==nm&&(r=Error(o(423),{cause:f}),ki(Es(r,i))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,f=Es(f,i),_=Pm(n.stateNode,f,_),pm(n,_),dn!==4&&(dn=2)),!1;var k=Error(o(520),{cause:f});if(k=Es(k,i),qi===null?qi=[k]:qi.push(k),dn!==4&&(dn=2),r===null)return!0;f=Es(f,i),i=r;do{switch(i.tag){case 3:return i.flags|=65536,n=_&-_,i.lanes|=n,n=Pm(i.stateNode,f,n),pm(i,n),!1;case 1:if(r=i.type,k=i.stateNode,(i.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(hr===null||!hr.has(k))))return i.flags|=65536,_&=-_,i.lanes|=_,_=Qy(_),Wy(_,n,i,f),pm(i,_),!1}i=i.return}while(i!==null);return!1}var Im=Error(o(461)),yn=!1;function Un(n,r,i,f){r.child=n===null?ty(r,null,i,f):ro(r,n.child,i,f)}function Zy(n,r,i,f,_){i=i.render;var k=r.ref;if("ref"in f){var A={};for(var H in f)H!=="ref"&&(A[H]=f[H])}else A=f;return to(r),f=_m(n,r,i,A,k,_),H=vm(),n!==null&&!yn?(ym(n,r,_),Aa(n,r,_)):(Nt&&H&&em(r),r.flags|=1,Un(n,r,f,_),r.child)}function Jy(n,r,i,f,_){if(n===null){var k=i.type;return typeof k=="function"&&!Wp(k)&&k.defaultProps===void 0&&i.compare===null?(r.tag=15,r.type=k,e0(n,r,k,f,_)):(n=wu(i.type,null,f,r,r.mode,_),n.ref=r.ref,n.return=r,r.child=n)}if(k=n.child,!Gm(n,_)){var A=k.memoizedProps;if(i=i.compare,i=i!==null?i:yi,i(A,f)&&n.ref===r.ref)return Aa(n,r,_)}return r.flags|=1,n=Sa(k,f),n.ref=r.ref,n.return=r,r.child=n}function e0(n,r,i,f,_){if(n!==null){var k=n.memoizedProps;if(yi(k,f)&&n.ref===r.ref)if(yn=!1,r.pendingProps=f=k,Gm(n,_))(n.flags&131072)!==0&&(yn=!0);else return r.lanes=n.lanes,Aa(n,r,_)}return Bm(n,r,i,f,_)}function t0(n,r,i,f){var _=f.children,k=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(k=k!==null?k.baseLanes|i:i,n!==null){for(f=r.child=n.child,_=0;f!==null;)_=_|f.lanes|f.childLanes,f=f.sibling;f=_&~k}else f=0,r.child=null;return n0(n,r,k,i,f)}if((i&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Nu(r,k!==null?k.cachePool:null),k!==null?ay(r,k):hm(),ry(r);else return f=r.lanes=536870912,n0(n,r,k!==null?k.baseLanes|i:i,i,f)}else k!==null?(Nu(r,k.cachePool),ay(r,k),dr(),r.memoizedState=null):(n!==null&&Nu(r,null),hm(),dr());return Un(n,r,_,i),r.child}function Li(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function n0(n,r,i,f,_){var k=cm();return k=k===null?null:{parent:_n._currentValue,pool:k},r.memoizedState={baseLanes:i,cachePool:k},n!==null&&Nu(r,null),hm(),ry(r),n!==null&&al(n,r,f,!0),r.childLanes=_,null}function qu(n,r){return r=Fu({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function s0(n,r,i){return ro(r,n.child,null,i),n=qu(r,r.pendingProps),n.flags|=2,xs(r),r.memoizedState=null,n}function KR(n,r,i){var f=r.pendingProps,_=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(Nt){if(f.mode==="hidden")return n=qu(r,f),r.lanes=536870912,Li(null,n);if(xm(r),(n=en)?(n=h1(n,As),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:sr!==null?{id:Js,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},i=Uv(n),i.return=r,r.child=i,In=r,en=null)):n=null,n===null)throw rr(r);return r.lanes=536870912,null}return qu(r,f)}var k=n.memoizedState;if(k!==null){var A=k.dehydrated;if(xm(r),_)if(r.flags&256)r.flags&=-257,r=s0(n,r,i);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(o(558));else if(yn||al(n,r,i,!1),_=(i&n.childLanes)!==0,yn||_){if(f=Gt,f!==null&&(A=ya(f,i),A!==0&&A!==k.retryLane))throw k.retryLane=A,Wr(n,A),is(f,n,A),Im;ed(),r=s0(n,r,i)}else n=k.treeContext,en=Os(A.nextSibling),In=r,Nt=!0,ar=null,As=!1,n!==null&&qv(r,n),r=qu(r,f),r.flags|=4096;return r}return n=Sa(n.child,{mode:f.mode,children:f.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Vu(n,r){var i=r.ref;if(i===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(r.flags|=4194816)}}function Bm(n,r,i,f,_){return to(r),i=_m(n,r,i,f,void 0,_),f=vm(),n!==null&&!yn?(ym(n,r,_),Aa(n,r,_)):(Nt&&f&&em(r),r.flags|=1,Un(n,r,i,_),r.child)}function a0(n,r,i,f,_,k){return to(r),r.updateQueue=null,i=ly(r,f,i,_),oy(n),f=vm(),n!==null&&!yn?(ym(n,r,k),Aa(n,r,k)):(Nt&&f&&em(r),r.flags|=1,Un(n,r,i,k),r.child)}function r0(n,r,i,f,_){if(to(r),r.stateNode===null){var k=el,A=i.contextType;typeof A=="object"&&A!==null&&(k=Bn(A)),k=new i(f,k),r.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=Lm,r.stateNode=k,k._reactInternals=r,k=r.stateNode,k.props=f,k.state=r.memoizedState,k.refs={},dm(r),A=i.contextType,k.context=typeof A=="object"&&A!==null?Bn(A):el,k.state=r.memoizedState,A=i.getDerivedStateFromProps,typeof A=="function"&&(Dm(r,i,A,f),k.state=r.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(A=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),A!==k.state&&Lm.enqueueReplaceState(k,k.state,null),Ai(r,f,k,_),Ti(),k.state=r.memoizedState),typeof k.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(n===null){k=r.stateNode;var H=r.memoizedProps,Q=lo(i,H);k.props=Q;var oe=k.context,ge=i.contextType;A=el,typeof ge=="object"&&ge!==null&&(A=Bn(ge));var ye=i.getDerivedStateFromProps;ge=typeof ye=="function"||typeof k.getSnapshotBeforeUpdate=="function",H=r.pendingProps!==H,ge||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(H||oe!==A)&&Fy(r,k,f,A),lr=!1;var ce=r.memoizedState;k.state=ce,Ai(r,f,k,_),Ti(),oe=r.memoizedState,H||ce!==oe||lr?(typeof ye=="function"&&(Dm(r,i,ye,f),oe=r.memoizedState),(Q=lr||Vy(r,i,Q,f,ce,oe,A))?(ge||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(r.flags|=4194308)):(typeof k.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=oe),k.props=f,k.state=oe,k.context=A,f=Q):(typeof k.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{k=r.stateNode,fm(n,r),A=r.memoizedProps,ge=lo(i,A),k.props=ge,ye=r.pendingProps,ce=k.context,oe=i.contextType,Q=el,typeof oe=="object"&&oe!==null&&(Q=Bn(oe)),H=i.getDerivedStateFromProps,(oe=typeof H=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(A!==ye||ce!==Q)&&Fy(r,k,f,Q),lr=!1,ce=r.memoizedState,k.state=ce,Ai(r,f,k,_),Ti();var pe=r.memoizedState;A!==ye||ce!==pe||lr||n!==null&&n.dependencies!==null&&Su(n.dependencies)?(typeof H=="function"&&(Dm(r,i,H,f),pe=r.memoizedState),(ge=lr||Vy(r,i,ge,f,ce,pe,Q)||n!==null&&n.dependencies!==null&&Su(n.dependencies))?(oe||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(f,pe,Q),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(f,pe,Q)),typeof k.componentDidUpdate=="function"&&(r.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof k.componentDidUpdate!="function"||A===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=pe),k.props=f,k.state=pe,k.context=Q,f=ge):(typeof k.componentDidUpdate!="function"||A===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),f=!1)}return k=f,Vu(n,r),f=(r.flags&128)!==0,k||f?(k=r.stateNode,i=f&&typeof i.getDerivedStateFromError!="function"?null:k.render(),r.flags|=1,n!==null&&f?(r.child=ro(r,n.child,null,_),r.child=ro(r,null,i,_)):Un(n,r,i,_),r.memoizedState=k.state,n=r.child):n=Aa(n,r,_),n}function o0(n,r,i,f){return Jr(),r.flags|=256,Un(n,r,i,f),r.child}var Um={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $m(n){return{baseLanes:n,cachePool:Xv()}}function Hm(n,r,i){return n=n!==null?n.childLanes&~i:0,r&&(n|=_s),n}function l0(n,r,i){var f=r.pendingProps,_=!1,k=(r.flags&128)!==0,A;if((A=k)||(A=n!==null&&n.memoizedState===null?!1:(xn.current&2)!==0),A&&(_=!0,r.flags&=-129),A=(r.flags&32)!==0,r.flags&=-33,n===null){if(Nt){if(_?ur(r):dr(),(n=en)?(n=h1(n,As),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:sr!==null?{id:Js,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},i=Uv(n),i.return=r,r.child=i,In=r,en=null)):n=null,n===null)throw rr(r);return kh(n)?r.lanes=32:r.lanes=536870912,null}var H=f.children;return f=f.fallback,_?(dr(),_=r.mode,H=Fu({mode:"hidden",children:H},_),f=Zr(f,_,i,null),H.return=r,f.return=r,H.sibling=f,r.child=H,f=r.child,f.memoizedState=$m(i),f.childLanes=Hm(n,A,i),r.memoizedState=Um,Li(null,f)):(ur(r),qm(r,H))}var Q=n.memoizedState;if(Q!==null&&(H=Q.dehydrated,H!==null)){if(k)r.flags&256?(ur(r),r.flags&=-257,r=Vm(n,r,i)):r.memoizedState!==null?(dr(),r.child=n.child,r.flags|=128,r=null):(dr(),H=f.fallback,_=r.mode,f=Fu({mode:"visible",children:f.children},_),H=Zr(H,_,i,null),H.flags|=2,f.return=r,H.return=r,f.sibling=H,r.child=f,ro(r,n.child,null,i),f=r.child,f.memoizedState=$m(i),f.childLanes=Hm(n,A,i),r.memoizedState=Um,r=Li(null,f));else if(ur(r),kh(H)){if(A=H.nextSibling&&H.nextSibling.dataset,A)var oe=A.dgst;A=oe,f=Error(o(419)),f.stack="",f.digest=A,ki({value:f,source:null,stack:null}),r=Vm(n,r,i)}else if(yn||al(n,r,i,!1),A=(i&n.childLanes)!==0,yn||A){if(A=Gt,A!==null&&(f=ya(A,i),f!==0&&f!==Q.retryLane))throw Q.retryLane=f,Wr(n,f),is(A,n,f),Im;wh(H)||ed(),r=Vm(n,r,i)}else wh(H)?(r.flags|=192,r.child=n.child,r=null):(n=Q.treeContext,en=Os(H.nextSibling),In=r,Nt=!0,ar=null,As=!1,n!==null&&qv(r,n),r=qm(r,f.children),r.flags|=4096);return r}return _?(dr(),H=f.fallback,_=r.mode,Q=n.child,oe=Q.sibling,f=Sa(Q,{mode:"hidden",children:f.children}),f.subtreeFlags=Q.subtreeFlags&65011712,oe!==null?H=Sa(oe,H):(H=Zr(H,_,i,null),H.flags|=2),H.return=r,f.return=r,f.sibling=H,r.child=f,Li(null,f),f=r.child,H=n.child.memoizedState,H===null?H=$m(i):(_=H.cachePool,_!==null?(Q=_n._currentValue,_=_.parent!==Q?{parent:Q,pool:Q}:_):_=Xv(),H={baseLanes:H.baseLanes|i,cachePool:_}),f.memoizedState=H,f.childLanes=Hm(n,A,i),r.memoizedState=Um,Li(n.child,f)):(ur(r),i=n.child,n=i.sibling,i=Sa(i,{mode:"visible",children:f.children}),i.return=r,i.sibling=null,n!==null&&(A=r.deletions,A===null?(r.deletions=[n],r.flags|=16):A.push(n)),r.child=i,r.memoizedState=null,i)}function qm(n,r){return r=Fu({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Fu(n,r){return n=hs(22,n,null,r),n.lanes=0,n}function Vm(n,r,i){return ro(r,n.child,null,i),n=qm(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function i0(n,r,i){n.lanes|=r;var f=n.alternate;f!==null&&(f.lanes|=r),rm(n.return,r,i)}function Fm(n,r,i,f,_,k){var A=n.memoizedState;A===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:i,tailMode:_,treeForkCount:k}:(A.isBackwards=r,A.rendering=null,A.renderingStartTime=0,A.last=f,A.tail=i,A.tailMode=_,A.treeForkCount=k)}function c0(n,r,i){var f=r.pendingProps,_=f.revealOrder,k=f.tail;f=f.children;var A=xn.current,H=(A&2)!==0;if(H?(A=A&1|2,r.flags|=128):A&=1,Z(xn,A),Un(n,r,f,i),f=Nt?wi:0,!H&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&i0(n,i,r);else if(n.tag===19)i0(n,i,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(_){case"forwards":for(i=r.child,_=null;i!==null;)n=i.alternate,n!==null&&Ou(n)===null&&(_=i),i=i.sibling;i=_,i===null?(_=r.child,r.child=null):(_=i.sibling,i.sibling=null),Fm(r,!1,_,i,k,f);break;case"backwards":case"unstable_legacy-backwards":for(i=null,_=r.child,r.child=null;_!==null;){if(n=_.alternate,n!==null&&Ou(n)===null){r.child=_;break}n=_.sibling,_.sibling=i,i=_,_=n}Fm(r,!0,i,null,k,f);break;case"together":Fm(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function Aa(n,r,i){if(n!==null&&(r.dependencies=n.dependencies),mr|=r.lanes,(i&r.childLanes)===0)if(n!==null){if(al(n,r,i,!1),(i&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(o(153));if(r.child!==null){for(n=r.child,i=Sa(n,n.pendingProps),r.child=i,i.return=r;n.sibling!==null;)n=n.sibling,i=i.sibling=Sa(n,n.pendingProps),i.return=r;i.sibling=null}return r.child}function Gm(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Su(n)))}function XR(n,r,i){switch(r.tag){case 3:re(r,r.stateNode.containerInfo),or(r,_n,n.memoizedState.cache),Jr();break;case 27:case 5:Me(r);break;case 4:re(r,r.stateNode.containerInfo);break;case 10:or(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,xm(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(ur(r),r.flags|=128,null):(i&r.child.childLanes)!==0?l0(n,r,i):(ur(r),n=Aa(n,r,i),n!==null?n.sibling:null);ur(r);break;case 19:var _=(n.flags&128)!==0;if(f=(i&r.childLanes)!==0,f||(al(n,r,i,!1),f=(i&r.childLanes)!==0),_){if(f)return c0(n,r,i);r.flags|=128}if(_=r.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Z(xn,xn.current),f)break;return null;case 22:return r.lanes=0,t0(n,r,i,r.pendingProps);case 24:or(r,_n,n.memoizedState.cache)}return Aa(n,r,i)}function u0(n,r,i){if(n!==null)if(n.memoizedProps!==r.pendingProps)yn=!0;else{if(!Gm(n,i)&&(r.flags&128)===0)return yn=!1,XR(n,r,i);yn=(n.flags&131072)!==0}else yn=!1,Nt&&(r.flags&1048576)!==0&&Hv(r,wi,r.index);switch(r.lanes=0,r.tag){case 16:e:{var f=r.pendingProps;if(n=so(r.elementType),r.type=n,typeof n=="function")Wp(n)?(f=lo(n,f),r.tag=1,r=r0(null,r,n,f,i)):(r.tag=0,r=Bm(null,r,n,f,i));else{if(n!=null){var _=n.$$typeof;if(_===R){r.tag=11,r=Zy(null,r,n,f,i);break e}else if(_===O){r.tag=14,r=Jy(null,r,n,f,i);break e}}throw r=$(n)||n,Error(o(306,r,""))}}return r;case 0:return Bm(n,r,r.type,r.pendingProps,i);case 1:return f=r.type,_=lo(f,r.pendingProps),r0(n,r,f,_,i);case 3:e:{if(re(r,r.stateNode.containerInfo),n===null)throw Error(o(387));f=r.pendingProps;var k=r.memoizedState;_=k.element,fm(n,r),Ai(r,f,null,i);var A=r.memoizedState;if(f=A.cache,or(r,_n,f),f!==k.cache&&om(r,[_n],i,!0),Ti(),f=A.element,k.isDehydrated)if(k={element:f,isDehydrated:!1,cache:A.cache},r.updateQueue.baseState=k,r.memoizedState=k,r.flags&256){r=o0(n,r,f,i);break e}else if(f!==_){_=Es(Error(o(424)),r),ki(_),r=o0(n,r,f,i);break e}else{switch(n=r.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(en=Os(n.firstChild),In=r,Nt=!0,ar=null,As=!0,i=ty(r,null,f,i),r.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Jr(),f===_){r=Aa(n,r,i);break e}Un(n,r,f,i)}r=r.child}return r;case 26:return Vu(n,r),n===null?(i=y1(r.type,null,r.pendingProps,null))?r.memoizedState=i:Nt||(i=r.type,n=r.pendingProps,f=ld(ee.current).createElement(i),f[Ft]=r,f[Pn]=n,$n(f,i,n),Rn(f),r.stateNode=f):r.memoizedState=y1(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return Me(r),n===null&&Nt&&(f=r.stateNode=b1(r.type,r.pendingProps,ee.current),In=r,As=!0,_=en,_r(r.type)?(Sh=_,en=Os(f.firstChild)):en=_),Un(n,r,r.pendingProps.children,i),Vu(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&Nt&&((_=f=en)&&(f=ST(f,r.type,r.pendingProps,As),f!==null?(r.stateNode=f,In=r,en=Os(f.firstChild),As=!1,_=!0):_=!1),_||rr(r)),Me(r),_=r.type,k=r.pendingProps,A=n!==null?n.memoizedProps:null,f=k.children,vh(_,k)?f=null:A!==null&&vh(_,A)&&(r.flags|=32),r.memoizedState!==null&&(_=_m(n,r,UR,null,null,i),Wi._currentValue=_),Vu(n,r),Un(n,r,f,i),r.child;case 6:return n===null&&Nt&&((n=i=en)&&(i=CT(i,r.pendingProps,As),i!==null?(r.stateNode=i,In=r,en=null,n=!0):n=!1),n||rr(r)),null;case 13:return l0(n,r,i);case 4:return re(r,r.stateNode.containerInfo),f=r.pendingProps,n===null?r.child=ro(r,null,f,i):Un(n,r,f,i),r.child;case 11:return Zy(n,r,r.type,r.pendingProps,i);case 7:return Un(n,r,r.pendingProps,i),r.child;case 8:return Un(n,r,r.pendingProps.children,i),r.child;case 12:return Un(n,r,r.pendingProps.children,i),r.child;case 10:return f=r.pendingProps,or(r,r.type,f.value),Un(n,r,f.children,i),r.child;case 9:return _=r.type._context,f=r.pendingProps.children,to(r),_=Bn(_),f=f(_),r.flags|=1,Un(n,r,f,i),r.child;case 14:return Jy(n,r,r.type,r.pendingProps,i);case 15:return e0(n,r,r.type,r.pendingProps,i);case 19:return c0(n,r,i);case 31:return KR(n,r,i);case 22:return t0(n,r,i,r.pendingProps);case 24:return to(r),f=Bn(_n),n===null?(_=cm(),_===null&&(_=Gt,k=lm(),_.pooledCache=k,k.refCount++,k!==null&&(_.pooledCacheLanes|=i),_=k),r.memoizedState={parent:f,cache:_},dm(r),or(r,_n,_)):((n.lanes&i)!==0&&(fm(n,r),Ai(r,null,null,i),Ti()),_=n.memoizedState,k=r.memoizedState,_.parent!==f?(_={parent:f,cache:f},r.memoizedState=_,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=_),or(r,_n,f)):(f=k.cache,or(r,_n,f),f!==_.cache&&om(r,[_n],i,!0))),Un(n,r,r.pendingProps.children,i),r.child;case 29:throw r.pendingProps}throw Error(o(156,r.tag))}function Ma(n){n.flags|=4}function Ym(n,r,i,f,_){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if(P0())n.flags|=8192;else throw ao=Ru,um}else n.flags&=-16777217}function d0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!C1(r))if(P0())n.flags|=8192;else throw ao=Ru,um}function Gu(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?ps():536870912,n.lanes|=r,gl|=r)}function Pi(n,r){if(!Nt)switch(n.tailMode){case"hidden":r=n.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var f=null;i!==null;)i.alternate!==null&&(f=i),i=i.sibling;f===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function tn(n){var r=n.alternate!==null&&n.alternate.child===n.child,i=0,f=0;if(r)for(var _=n.child;_!==null;)i|=_.lanes|_.childLanes,f|=_.subtreeFlags&65011712,f|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)i|=_.lanes|_.childLanes,f|=_.subtreeFlags,f|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=f,n.childLanes=i,r}function QR(n,r,i){var f=r.pendingProps;switch(tm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(r),null;case 1:return tn(r),null;case 3:return i=r.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),Ea(_n),me(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(sl(r)?Ma(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,sm())),tn(r),null;case 26:var _=r.type,k=r.memoizedState;return n===null?(Ma(r),k!==null?(tn(r),d0(r,k)):(tn(r),Ym(r,_,null,f,i))):k?k!==n.memoizedState?(Ma(r),tn(r),d0(r,k)):(tn(r),r.flags&=-16777217):(n=n.memoizedProps,n!==f&&Ma(r),tn(r),Ym(r,_,n,f,i)),null;case 27:if(de(r),i=ee.current,_=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&Ma(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return tn(r),null}n=te.current,sl(r)?Vv(r):(n=b1(_,f,i),r.stateNode=n,Ma(r))}return tn(r),null;case 5:if(de(r),_=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&Ma(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return tn(r),null}if(k=te.current,sl(r))Vv(r);else{var A=ld(ee.current);switch(k){case 1:k=A.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:k=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":k=A.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":k=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":k=A.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof f.is=="string"?A.createElement("select",{is:f.is}):A.createElement("select"),f.multiple?k.multiple=!0:f.size&&(k.size=f.size);break;default:k=typeof f.is=="string"?A.createElement(_,{is:f.is}):A.createElement(_)}}k[Ft]=r,k[Pn]=f;e:for(A=r.child;A!==null;){if(A.tag===5||A.tag===6)k.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===r)break e;for(;A.sibling===null;){if(A.return===null||A.return===r)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}r.stateNode=k;e:switch($n(k,_,f),_){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ma(r)}}return tn(r),Ym(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,i),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==f&&Ma(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(o(166));if(n=ee.current,sl(r)){if(n=r.stateNode,i=r.memoizedProps,f=null,_=In,_!==null)switch(_.tag){case 27:case 5:f=_.memoizedProps}n[Ft]=r,n=!!(n.nodeValue===i||f!==null&&f.suppressHydrationWarning===!0||l1(n.nodeValue,i)),n||rr(r,!0)}else n=ld(n).createTextNode(f),n[Ft]=r,r.stateNode=n}return tn(r),null;case 31:if(i=r.memoizedState,n===null||n.memoizedState!==null){if(f=sl(r),i!==null){if(n===null){if(!f)throw Error(o(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Ft]=r}else Jr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tn(r),n=!1}else i=sm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return r.flags&256?(xs(r),r):(xs(r),null);if((r.flags&128)!==0)throw Error(o(558))}return tn(r),null;case 13:if(f=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=sl(r),f!==null&&f.dehydrated!==null){if(n===null){if(!_)throw Error(o(318));if(_=r.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(o(317));_[Ft]=r}else Jr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tn(r),_=!1}else _=sm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return r.flags&256?(xs(r),r):(xs(r),null)}return xs(r),(r.flags&128)!==0?(r.lanes=i,r):(i=f!==null,n=n!==null&&n.memoizedState!==null,i&&(f=r.child,_=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(_=f.alternate.memoizedState.cachePool.pool),k=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(k=f.memoizedState.cachePool.pool),k!==_&&(f.flags|=2048)),i!==n&&i&&(r.child.flags|=8192),Gu(r,r.updateQueue),tn(r),null);case 4:return me(),n===null&&hh(r.stateNode.containerInfo),tn(r),null;case 10:return Ea(r.type),tn(r),null;case 19:if(Y(xn),f=r.memoizedState,f===null)return tn(r),null;if(_=(r.flags&128)!==0,k=f.rendering,k===null)if(_)Pi(f,!1);else{if(dn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(k=Ou(n),k!==null){for(r.flags|=128,Pi(f,!1),n=k.updateQueue,r.updateQueue=n,Gu(r,n),r.subtreeFlags=0,n=i,i=r.child;i!==null;)Bv(i,n),i=i.sibling;return Z(xn,xn.current&1|2),Nt&&Ca(r,f.treeForkCount),r.child}n=n.sibling}f.tail!==null&&ue()>Wu&&(r.flags|=128,_=!0,Pi(f,!1),r.lanes=4194304)}else{if(!_)if(n=Ou(k),n!==null){if(r.flags|=128,_=!0,n=n.updateQueue,r.updateQueue=n,Gu(r,n),Pi(f,!0),f.tail===null&&f.tailMode==="hidden"&&!k.alternate&&!Nt)return tn(r),null}else 2*ue()-f.renderingStartTime>Wu&&i!==536870912&&(r.flags|=128,_=!0,Pi(f,!1),r.lanes=4194304);f.isBackwards?(k.sibling=r.child,r.child=k):(n=f.last,n!==null?n.sibling=k:r.child=k,f.last=k)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=ue(),n.sibling=null,i=xn.current,Z(xn,_?i&1|2:i&1),Nt&&Ca(r,f.treeForkCount),n):(tn(r),null);case 22:case 23:return xs(r),gm(),f=r.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(i&536870912)!==0&&(r.flags&128)===0&&(tn(r),r.subtreeFlags&6&&(r.flags|=8192)):tn(r),i=r.updateQueue,i!==null&&Gu(r,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==i&&(r.flags|=2048),n!==null&&Y(no),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),r.memoizedState.cache!==i&&(r.flags|=2048),Ea(_n),tn(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function WR(n,r){switch(tm(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ea(_n),me(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return de(r),null;case 31:if(r.memoizedState!==null){if(xs(r),r.alternate===null)throw Error(o(340));Jr()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(xs(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(o(340));Jr()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Y(xn),null;case 4:return me(),null;case 10:return Ea(r.type),null;case 22:case 23:return xs(r),gm(),n!==null&&Y(no),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Ea(_n),null;case 25:return null;default:return null}}function f0(n,r){switch(tm(r),r.tag){case 3:Ea(_n),me();break;case 26:case 27:case 5:de(r);break;case 4:me();break;case 31:r.memoizedState!==null&&xs(r);break;case 13:xs(r);break;case 19:Y(xn);break;case 10:Ea(r.type);break;case 22:case 23:xs(r),gm(),n!==null&&Y(no);break;case 24:Ea(_n)}}function Ii(n,r){try{var i=r.updateQueue,f=i!==null?i.lastEffect:null;if(f!==null){var _=f.next;i=_;do{if((i.tag&n)===n){f=void 0;var k=i.create,A=i.inst;f=k(),A.destroy=f}i=i.next}while(i!==_)}}catch(H){Lt(r,r.return,H)}}function fr(n,r,i){try{var f=r.updateQueue,_=f!==null?f.lastEffect:null;if(_!==null){var k=_.next;f=k;do{if((f.tag&n)===n){var A=f.inst,H=A.destroy;if(H!==void 0){A.destroy=void 0,_=r;var Q=i,oe=H;try{oe()}catch(ge){Lt(_,Q,ge)}}}f=f.next}while(f!==k)}}catch(ge){Lt(r,r.return,ge)}}function p0(n){var r=n.updateQueue;if(r!==null){var i=n.stateNode;try{sy(r,i)}catch(f){Lt(n,n.return,f)}}}function m0(n,r,i){i.props=lo(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(f){Lt(n,r,f)}}function Bi(n,r){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof i=="function"?n.refCleanup=i(f):i.current=f}}catch(_){Lt(n,r,_)}}function ta(n,r){var i=n.ref,f=n.refCleanup;if(i!==null)if(typeof f=="function")try{f()}catch(_){Lt(n,r,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(_){Lt(n,r,_)}else i.current=null}function h0(n){var r=n.type,i=n.memoizedProps,f=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":i.autoFocus&&f.focus();break e;case"img":i.src?f.src=i.src:i.srcSet&&(f.srcset=i.srcSet)}}catch(_){Lt(n,n.return,_)}}function Km(n,r,i){try{var f=n.stateNode;_T(f,n.type,i,r),f[Pn]=r}catch(_){Lt(n,n.return,_)}}function g0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&_r(n.type)||n.tag===4}function Xm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||g0(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&&_r(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 Qm(n,r,i){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,r):(r=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.appendChild(n),i=i._reactRootContainer,i!=null||r.onclick!==null||(r.onclick=wa));else if(f!==4&&(f===27&&_r(n.type)&&(i=n.stateNode,r=null),n=n.child,n!==null))for(Qm(n,r,i),n=n.sibling;n!==null;)Qm(n,r,i),n=n.sibling}function Yu(n,r,i){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?i.insertBefore(n,r):i.appendChild(n);else if(f!==4&&(f===27&&_r(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Yu(n,r,i),n=n.sibling;n!==null;)Yu(n,r,i),n=n.sibling}function x0(n){var r=n.stateNode,i=n.memoizedProps;try{for(var f=n.type,_=r.attributes;_.length;)r.removeAttributeNode(_[0]);$n(r,f,i),r[Ft]=n,r[Pn]=i}catch(k){Lt(n,n.return,k)}}var Oa=!1,jn=!1,Wm=!1,b0=typeof WeakSet=="function"?WeakSet:Set,Tn=null;function ZR(n,r){if(n=n.containerInfo,bh=md,n=Tv(n),Vp(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var f=i.getSelection&&i.getSelection();if(f&&f.rangeCount!==0){i=f.anchorNode;var _=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{i.nodeType,k.nodeType}catch{i=null;break e}var A=0,H=-1,Q=-1,oe=0,ge=0,ye=n,ce=null;t:for(;;){for(var pe;ye!==i||_!==0&&ye.nodeType!==3||(H=A+_),ye!==k||f!==0&&ye.nodeType!==3||(Q=A+f),ye.nodeType===3&&(A+=ye.nodeValue.length),(pe=ye.firstChild)!==null;)ce=ye,ye=pe;for(;;){if(ye===n)break t;if(ce===i&&++oe===_&&(H=A),ce===k&&++ge===f&&(Q=A),(pe=ye.nextSibling)!==null)break;ye=ce,ce=ye.parentNode}ye=pe}i=H===-1||Q===-1?null:{start:H,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(_h={focusedElem:n,selectionRange:i},md=!1,Tn=r;Tn!==null;)if(r=Tn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Tn=n;else for(;Tn!==null;){switch(r=Tn,k=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.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&&k!==null){n=void 0,i=r,_=k.memoizedProps,k=k.memoizedState,f=i.stateNode;try{var He=lo(i.type,_);n=f.getSnapshotBeforeUpdate(He,k),f.__reactInternalSnapshotBeforeUpdate=n}catch(at){Lt(i,i.return,at)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,i=n.nodeType,i===9)jh(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":jh(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=r.sibling,n!==null){n.return=r.return,Tn=n;break}Tn=r.return}}function _0(n,r,i){var f=i.flags;switch(i.tag){case 0:case 11:case 15:Da(n,i),f&4&&Ii(5,i);break;case 1:if(Da(n,i),f&4)if(n=i.stateNode,r===null)try{n.componentDidMount()}catch(A){Lt(i,i.return,A)}else{var _=lo(i.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(_,r,n.__reactInternalSnapshotBeforeUpdate)}catch(A){Lt(i,i.return,A)}}f&64&&p0(i),f&512&&Bi(i,i.return);break;case 3:if(Da(n,i),f&64&&(n=i.updateQueue,n!==null)){if(r=null,i.child!==null)switch(i.child.tag){case 27:case 5:r=i.child.stateNode;break;case 1:r=i.child.stateNode}try{sy(n,r)}catch(A){Lt(i,i.return,A)}}break;case 27:r===null&&f&4&&x0(i);case 26:case 5:Da(n,i),r===null&&f&4&&h0(i),f&512&&Bi(i,i.return);break;case 12:Da(n,i);break;case 31:Da(n,i),f&4&&j0(n,i);break;case 13:Da(n,i),f&4&&w0(n,i),f&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=lT.bind(null,i),NT(n,i))));break;case 22:if(f=i.memoizedState!==null||Oa,!f){r=r!==null&&r.memoizedState!==null||jn,_=Oa;var k=jn;Oa=f,(jn=r)&&!k?La(n,i,(i.subtreeFlags&8772)!==0):Da(n,i),Oa=_,jn=k}break;case 30:break;default:Da(n,i)}}function v0(n){var r=n.alternate;r!==null&&(n.alternate=null,v0(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&Np(r)),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 sn=null,as=!1;function za(n,r,i){for(i=i.child;i!==null;)y0(n,r,i),i=i.sibling}function y0(n,r,i){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(lt,i)}catch{}switch(i.tag){case 26:jn||ta(i,r),za(n,r,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:jn||ta(i,r);var f=sn,_=as;_r(i.type)&&(sn=i.stateNode,as=!1),za(n,r,i),Ki(i.stateNode),sn=f,as=_;break;case 5:jn||ta(i,r);case 6:if(f=sn,_=as,sn=null,za(n,r,i),sn=f,as=_,sn!==null)if(as)try{(sn.nodeType===9?sn.body:sn.nodeName==="HTML"?sn.ownerDocument.body:sn).removeChild(i.stateNode)}catch(k){Lt(i,r,k)}else try{sn.removeChild(i.stateNode)}catch(k){Lt(i,r,k)}break;case 18:sn!==null&&(as?(n=sn,p1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),kl(n)):p1(sn,i.stateNode));break;case 4:f=sn,_=as,sn=i.stateNode.containerInfo,as=!0,za(n,r,i),sn=f,as=_;break;case 0:case 11:case 14:case 15:fr(2,i,r),jn||fr(4,i,r),za(n,r,i);break;case 1:jn||(ta(i,r),f=i.stateNode,typeof f.componentWillUnmount=="function"&&m0(i,r,f)),za(n,r,i);break;case 21:za(n,r,i);break;case 22:jn=(f=jn)||i.memoizedState!==null,za(n,r,i),jn=f;break;default:za(n,r,i)}}function j0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{kl(n)}catch(i){Lt(r,r.return,i)}}}function w0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{kl(n)}catch(i){Lt(r,r.return,i)}}function JR(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new b0),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new b0),r;default:throw Error(o(435,n.tag))}}function Ku(n,r){var i=JR(n);r.forEach(function(f){if(!i.has(f)){i.add(f);var _=iT.bind(null,n,f);f.then(_,_)}})}function rs(n,r){var i=r.deletions;if(i!==null)for(var f=0;f<i.length;f++){var _=i[f],k=n,A=r,H=A;e:for(;H!==null;){switch(H.tag){case 27:if(_r(H.type)){sn=H.stateNode,as=!1;break e}break;case 5:sn=H.stateNode,as=!1;break e;case 3:case 4:sn=H.stateNode.containerInfo,as=!0;break e}H=H.return}if(sn===null)throw Error(o(160));y0(k,A,_),sn=null,as=!1,k=_.alternate,k!==null&&(k.return=null),_.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)k0(r,n),r=r.sibling}var qs=null;function k0(n,r){var i=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:rs(r,n),os(n),f&4&&(fr(3,n,n.return),Ii(3,n),fr(5,n,n.return));break;case 1:rs(r,n),os(n),f&512&&(jn||i===null||ta(i,i.return)),f&64&&Oa&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?f:i.concat(f))));break;case 26:var _=qs;if(rs(r,n),os(n),f&512&&(jn||i===null||ta(i,i.return)),f&4){var k=i!==null?i.memoizedState:null;if(f=n.memoizedState,i===null)if(f===null)if(n.stateNode===null){e:{f=n.type,i=n.memoizedProps,_=_.ownerDocument||_;t:switch(f){case"title":k=_.getElementsByTagName("title")[0],(!k||k[fi]||k[Ft]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=_.createElement(f),_.head.insertBefore(k,_.querySelector("head > title"))),$n(k,f,i),k[Ft]=n,Rn(k),f=k;break e;case"link":var A=k1("link","href",_).get(f+(i.href||""));if(A){for(var H=0;H<A.length;H++)if(k=A[H],k.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&k.getAttribute("rel")===(i.rel==null?null:i.rel)&&k.getAttribute("title")===(i.title==null?null:i.title)&&k.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){A.splice(H,1);break t}}k=_.createElement(f),$n(k,f,i),_.head.appendChild(k);break;case"meta":if(A=k1("meta","content",_).get(f+(i.content||""))){for(H=0;H<A.length;H++)if(k=A[H],k.getAttribute("content")===(i.content==null?null:""+i.content)&&k.getAttribute("name")===(i.name==null?null:i.name)&&k.getAttribute("property")===(i.property==null?null:i.property)&&k.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&k.getAttribute("charset")===(i.charSet==null?null:i.charSet)){A.splice(H,1);break t}}k=_.createElement(f),$n(k,f,i),_.head.appendChild(k);break;default:throw Error(o(468,f))}k[Ft]=n,Rn(k),f=k}n.stateNode=f}else S1(_,n.type,n.stateNode);else n.stateNode=w1(_,f,n.memoizedProps);else k!==f?(k===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):k.count--,f===null?S1(_,n.type,n.stateNode):w1(_,f,n.memoizedProps)):f===null&&n.stateNode!==null&&Km(n,n.memoizedProps,i.memoizedProps)}break;case 27:rs(r,n),os(n),f&512&&(jn||i===null||ta(i,i.return)),i!==null&&f&4&&Km(n,n.memoizedProps,i.memoizedProps);break;case 5:if(rs(r,n),os(n),f&512&&(jn||i===null||ta(i,i.return)),n.flags&32){_=n.stateNode;try{Yo(_,"")}catch(He){Lt(n,n.return,He)}}f&4&&n.stateNode!=null&&(_=n.memoizedProps,Km(n,_,i!==null?i.memoizedProps:_)),f&1024&&(Wm=!0);break;case 6:if(rs(r,n),os(n),f&4){if(n.stateNode===null)throw Error(o(162));f=n.memoizedProps,i=n.stateNode;try{i.nodeValue=f}catch(He){Lt(n,n.return,He)}}break;case 3:if(ud=null,_=qs,qs=id(r.containerInfo),rs(r,n),qs=_,os(n),f&4&&i!==null&&i.memoizedState.isDehydrated)try{kl(r.containerInfo)}catch(He){Lt(n,n.return,He)}Wm&&(Wm=!1,S0(n));break;case 4:f=qs,qs=id(n.stateNode.containerInfo),rs(r,n),os(n),qs=f;break;case 12:rs(r,n),os(n);break;case 31:rs(r,n),os(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Ku(n,f)));break;case 13:rs(r,n),os(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Qu=ue()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Ku(n,f)));break;case 22:_=n.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,oe=Oa,ge=jn;if(Oa=oe||_,jn=ge||Q,rs(r,n),jn=ge,Oa=oe,os(n),f&8192)e:for(r=n.stateNode,r._visibility=_?r._visibility&-2:r._visibility|1,_&&(i===null||Q||Oa||jn||io(n)),i=null,r=n;;){if(r.tag===5||r.tag===26){if(i===null){Q=i=r;try{if(k=Q.stateNode,_)A=k.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{H=Q.stateNode;var ye=Q.memoizedProps.style,ce=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;H.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(He){Lt(Q,Q.return,He)}}}else if(r.tag===6){if(i===null){Q=r;try{Q.stateNode.nodeValue=_?"":Q.memoizedProps}catch(He){Lt(Q,Q.return,He)}}}else if(r.tag===18){if(i===null){Q=r;try{var pe=Q.stateNode;_?m1(pe,!0):m1(Q.stateNode,!1)}catch(He){Lt(Q,Q.return,He)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;i===r&&(i=null),r=r.return}i===r&&(i=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=n.updateQueue,f!==null&&(i=f.retryQueue,i!==null&&(f.retryQueue=null,Ku(n,i))));break;case 19:rs(r,n),os(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,Ku(n,f)));break;case 30:break;case 21:break;default:rs(r,n),os(n)}}function os(n){var r=n.flags;if(r&2){try{for(var i,f=n.return;f!==null;){if(g0(f)){i=f;break}f=f.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var _=i.stateNode,k=Xm(n);Yu(n,k,_);break;case 5:var A=i.stateNode;i.flags&32&&(Yo(A,""),i.flags&=-33);var H=Xm(n);Yu(n,H,A);break;case 3:case 4:var Q=i.stateNode.containerInfo,oe=Xm(n);Qm(n,oe,Q);break;default:throw Error(o(161))}}catch(ge){Lt(n,n.return,ge)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function S0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;S0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function Da(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)_0(n,r.alternate,r),r=r.sibling}function io(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:fr(4,r,r.return),io(r);break;case 1:ta(r,r.return);var i=r.stateNode;typeof i.componentWillUnmount=="function"&&m0(r,r.return,i),io(r);break;case 27:Ki(r.stateNode);case 26:case 5:ta(r,r.return),io(r);break;case 22:r.memoizedState===null&&io(r);break;case 30:io(r);break;default:io(r)}n=n.sibling}}function La(n,r,i){for(i=i&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,_=n,k=r,A=k.flags;switch(k.tag){case 0:case 11:case 15:La(_,k,i),Ii(4,k);break;case 1:if(La(_,k,i),f=k,_=f.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(oe){Lt(f,f.return,oe)}if(f=k,_=f.updateQueue,_!==null){var H=f.stateNode;try{var Q=_.shared.hiddenCallbacks;if(Q!==null)for(_.shared.hiddenCallbacks=null,_=0;_<Q.length;_++)ny(Q[_],H)}catch(oe){Lt(f,f.return,oe)}}i&&A&64&&p0(k),Bi(k,k.return);break;case 27:x0(k);case 26:case 5:La(_,k,i),i&&f===null&&A&4&&h0(k),Bi(k,k.return);break;case 12:La(_,k,i);break;case 31:La(_,k,i),i&&A&4&&j0(_,k);break;case 13:La(_,k,i),i&&A&4&&w0(_,k);break;case 22:k.memoizedState===null&&La(_,k,i),Bi(k,k.return);break;case 30:break;default:La(_,k,i)}r=r.sibling}}function Zm(n,r){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&Si(i))}function Jm(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Si(n))}function Vs(n,r,i,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)C0(n,r,i,f),r=r.sibling}function C0(n,r,i,f){var _=r.flags;switch(r.tag){case 0:case 11:case 15:Vs(n,r,i,f),_&2048&&Ii(9,r);break;case 1:Vs(n,r,i,f);break;case 3:Vs(n,r,i,f),_&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Si(n)));break;case 12:if(_&2048){Vs(n,r,i,f),n=r.stateNode;try{var k=r.memoizedProps,A=k.id,H=k.onPostCommit;typeof H=="function"&&H(A,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Lt(r,r.return,Q)}}else Vs(n,r,i,f);break;case 31:Vs(n,r,i,f);break;case 13:Vs(n,r,i,f);break;case 23:break;case 22:k=r.stateNode,A=r.alternate,r.memoizedState!==null?k._visibility&2?Vs(n,r,i,f):Ui(n,r):k._visibility&2?Vs(n,r,i,f):(k._visibility|=2,pl(n,r,i,f,(r.subtreeFlags&10256)!==0||!1)),_&2048&&Zm(A,r);break;case 24:Vs(n,r,i,f),_&2048&&Jm(r.alternate,r);break;default:Vs(n,r,i,f)}}function pl(n,r,i,f,_){for(_=_&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var k=n,A=r,H=i,Q=f,oe=A.flags;switch(A.tag){case 0:case 11:case 15:pl(k,A,H,Q,_),Ii(8,A);break;case 23:break;case 22:var ge=A.stateNode;A.memoizedState!==null?ge._visibility&2?pl(k,A,H,Q,_):Ui(k,A):(ge._visibility|=2,pl(k,A,H,Q,_)),_&&oe&2048&&Zm(A.alternate,A);break;case 24:pl(k,A,H,Q,_),_&&oe&2048&&Jm(A.alternate,A);break;default:pl(k,A,H,Q,_)}r=r.sibling}}function Ui(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var i=n,f=r,_=f.flags;switch(f.tag){case 22:Ui(i,f),_&2048&&Zm(f.alternate,f);break;case 24:Ui(i,f),_&2048&&Jm(f.alternate,f);break;default:Ui(i,f)}r=r.sibling}}var $i=8192;function ml(n,r,i){if(n.subtreeFlags&$i)for(n=n.child;n!==null;)N0(n,r,i),n=n.sibling}function N0(n,r,i){switch(n.tag){case 26:ml(n,r,i),n.flags&$i&&n.memoizedState!==null&&BT(i,qs,n.memoizedState,n.memoizedProps);break;case 5:ml(n,r,i);break;case 3:case 4:var f=qs;qs=id(n.stateNode.containerInfo),ml(n,r,i),qs=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=$i,$i=16777216,ml(n,r,i),$i=f):ml(n,r,i));break;default:ml(n,r,i)}}function E0(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function Hi(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var i=0;i<r.length;i++){var f=r[i];Tn=f,T0(f,n)}E0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)R0(n),n=n.sibling}function R0(n){switch(n.tag){case 0:case 11:case 15:Hi(n),n.flags&2048&&fr(9,n,n.return);break;case 3:Hi(n);break;case 12:Hi(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,Xu(n)):Hi(n);break;default:Hi(n)}}function Xu(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var i=0;i<r.length;i++){var f=r[i];Tn=f,T0(f,n)}E0(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:fr(8,r,r.return),Xu(r);break;case 22:i=r.stateNode,i._visibility&2&&(i._visibility&=-3,Xu(r));break;default:Xu(r)}n=n.sibling}}function T0(n,r){for(;Tn!==null;){var i=Tn;switch(i.tag){case 0:case 11:case 15:fr(8,i,r);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var f=i.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Si(i.memoizedState.cache)}if(f=i.child,f!==null)f.return=i,Tn=f;else e:for(i=n;Tn!==null;){f=Tn;var _=f.sibling,k=f.return;if(v0(f),f===i){Tn=null;break e}if(_!==null){_.return=k,Tn=_;break e}Tn=k}}}var eT={getCacheForType:function(n){var r=Bn(_n),i=r.data.get(n);return i===void 0&&(i=n(),r.data.set(n,i)),i},cacheSignal:function(){return Bn(_n).controller.signal}},tT=typeof WeakMap=="function"?WeakMap:Map,zt=0,Gt=null,yt=null,wt=0,Dt=0,bs=null,pr=!1,hl=!1,eh=!1,Pa=0,dn=0,mr=0,co=0,th=0,_s=0,gl=0,qi=null,ls=null,nh=!1,Qu=0,A0=0,Wu=1/0,Zu=null,hr=null,Sn=0,gr=null,xl=null,Ia=0,sh=0,ah=null,M0=null,Vi=0,rh=null;function vs(){return(zt&2)!==0&&wt!==0?wt&-wt:q.T!==null?dh():gn()}function O0(){if(_s===0)if((wt&536870912)===0||Nt){var n=Ot;Ot<<=1,(Ot&3932160)===0&&(Ot=262144),_s=n}else _s=536870912;return n=gs.current,n!==null&&(n.flags|=32),_s}function is(n,r,i){(n===Gt&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)&&(bl(n,0),xr(n,wt,_s,!1)),hn(n,i),((zt&2)===0||n!==Gt)&&(n===Gt&&((zt&2)===0&&(co|=i),dn===4&&xr(n,wt,_s,!1)),na(n))}function z0(n,r,i){if((zt&6)!==0)throw Error(o(327));var f=!i&&(r&127)===0&&(r&n.expiredLanes)===0||mn(n,r),_=f?aT(n,r):lh(n,r,!0),k=f;do{if(_===0){hl&&!f&&xr(n,r,0,!1);break}else{if(i=n.current.alternate,k&&!nT(i)){_=lh(n,r,!1),k=!1;continue}if(_===2){if(k=r,n.errorRecoveryDisabledLanes&k)var A=0;else A=n.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){r=A;e:{var H=n;_=qi;var Q=H.current.memoizedState.isDehydrated;if(Q&&(bl(H,A).flags|=256),A=lh(H,A,!1),A!==2){if(eh&&!Q){H.errorRecoveryDisabledLanes|=k,co|=k,_=4;break e}k=ls,ls=_,k!==null&&(ls===null?ls=k:ls.push.apply(ls,k))}_=A}if(k=!1,_!==2)continue}}if(_===1){bl(n,0),xr(n,r,0,!0);break}e:{switch(f=n,k=_,k){case 0:case 1:throw Error(o(345));case 4:if((r&4194048)!==r)break;case 6:xr(f,r,_s,!pr);break e;case 2:ls=null;break;case 3:case 5:break;default:throw Error(o(329))}if((r&62914560)===r&&(_=Qu+300-ue(),10<_)){if(xr(f,r,_s,!pr),Jt(f,0,!0)!==0)break e;Ia=r,f.timeoutHandle=d1(D0.bind(null,f,i,ls,Zu,nh,r,_s,co,gl,pr,k,"Throttled",-0,0),_);break e}D0(f,i,ls,Zu,nh,r,_s,co,gl,pr,k,null,-0,0)}}break}while(!0);na(n)}function D0(n,r,i,f,_,k,A,H,Q,oe,ge,ye,ce,pe){if(n.timeoutHandle=-1,ye=r.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wa},N0(r,k,ye);var He=(k&62914560)===k?Qu-ue():(k&4194048)===k?A0-ue():0;if(He=UT(ye,He),He!==null){Ia=k,n.cancelPendingCommit=He(q0.bind(null,n,r,k,i,f,_,A,H,Q,ge,ye,null,ce,pe)),xr(n,k,A,!oe);return}}q0(n,r,k,i,f,_,A,H,Q)}function nT(n){for(var r=n;;){var i=r.tag;if((i===0||i===11||i===15)&&r.flags&16384&&(i=r.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var f=0;f<i.length;f++){var _=i[f],k=_.getSnapshot;_=_.value;try{if(!ms(k(),_))return!1}catch{return!1}}if(i=r.child,r.subtreeFlags&16384&&i!==null)i.return=r,r=i;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function xr(n,r,i,f){r&=~th,r&=~co,n.suspendedLanes|=r,n.pingedLanes&=~r,f&&(n.warmLanes|=r),f=n.expirationTimes;for(var _=r;0<_;){var k=31-Le(_),A=1<<k;f[k]=-1,_&=~A}i!==0&&va(n,i,r)}function Ju(){return(zt&6)===0?(Fi(0),!1):!0}function oh(){if(yt!==null){if(Dt===0)var n=yt.return;else n=yt,Na=eo=null,jm(n),il=null,Ni=0,n=yt;for(;n!==null;)f0(n.alternate,n),n=n.return;yt=null}}function bl(n,r){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,jT(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Ia=0,oh(),Gt=n,yt=i=Sa(n.current,null),wt=r,Dt=0,bs=null,pr=!1,hl=mn(n,r),eh=!1,gl=_s=th=co=mr=dn=0,ls=qi=null,nh=!1,(r&8)!==0&&(r|=r&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=r;0<f;){var _=31-Le(f),k=1<<_;r|=n[_],f&=~k}return Pa=r,vu(),i}function L0(n,r){ft=null,q.H=Di,r===ll||r===Eu?(r=Zv(),Dt=3):r===um?(r=Zv(),Dt=4):Dt=r===Im?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,bs=r,yt===null&&(dn=1,Hu(n,Es(r,n.current)))}function P0(){var n=gs.current;return n===null?!0:(wt&4194048)===wt?Ms===null:(wt&62914560)===wt||(wt&536870912)!==0?n===Ms:!1}function I0(){var n=q.H;return q.H=Di,n===null?Di:n}function B0(){var n=q.A;return q.A=eT,n}function ed(){dn=4,pr||(wt&4194048)!==wt&&gs.current!==null||(hl=!0),(mr&134217727)===0&&(co&134217727)===0||Gt===null||xr(Gt,wt,_s,!1)}function lh(n,r,i){var f=zt;zt|=2;var _=I0(),k=B0();(Gt!==n||wt!==r)&&(Zu=null,bl(n,r)),r=!1;var A=dn;e:do try{if(Dt!==0&&yt!==null){var H=yt,Q=bs;switch(Dt){case 8:oh(),A=6;break e;case 3:case 2:case 9:case 6:gs.current===null&&(r=!0);var oe=Dt;if(Dt=0,bs=null,_l(n,H,Q,oe),i&&hl){A=0;break e}break;default:oe=Dt,Dt=0,bs=null,_l(n,H,Q,oe)}}sT(),A=dn;break}catch(ge){L0(n,ge)}while(!0);return r&&n.shellSuspendCounter++,Na=eo=null,zt=f,q.H=_,q.A=k,yt===null&&(Gt=null,wt=0,vu()),A}function sT(){for(;yt!==null;)U0(yt)}function aT(n,r){var i=zt;zt|=2;var f=I0(),_=B0();Gt!==n||wt!==r?(Zu=null,Wu=ue()+500,bl(n,r)):hl=mn(n,r);e:do try{if(Dt!==0&&yt!==null){r=yt;var k=bs;t:switch(Dt){case 1:Dt=0,bs=null,_l(n,r,k,1);break;case 2:case 9:if(Qv(k)){Dt=0,bs=null,$0(r);break}r=function(){Dt!==2&&Dt!==9||Gt!==n||(Dt=7),na(n)},k.then(r,r);break e;case 3:Dt=7;break e;case 4:Dt=5;break e;case 7:Qv(k)?(Dt=0,bs=null,$0(r)):(Dt=0,bs=null,_l(n,r,k,7));break;case 5:var A=null;switch(yt.tag){case 26:A=yt.memoizedState;case 5:case 27:var H=yt;if(A?C1(A):H.stateNode.complete){Dt=0,bs=null;var Q=H.sibling;if(Q!==null)yt=Q;else{var oe=H.return;oe!==null?(yt=oe,td(oe)):yt=null}break t}}Dt=0,bs=null,_l(n,r,k,5);break;case 6:Dt=0,bs=null,_l(n,r,k,6);break;case 8:oh(),dn=6;break e;default:throw Error(o(462))}}rT();break}catch(ge){L0(n,ge)}while(!0);return Na=eo=null,q.H=f,q.A=_,zt=i,yt!==null?0:(Gt=null,wt=0,vu(),dn)}function rT(){for(;yt!==null&&!Pe();)U0(yt)}function U0(n){var r=u0(n.alternate,n,Pa);n.memoizedProps=n.pendingProps,r===null?td(n):yt=r}function $0(n){var r=n,i=r.alternate;switch(r.tag){case 15:case 0:r=a0(i,r,r.pendingProps,r.type,void 0,wt);break;case 11:r=a0(i,r,r.pendingProps,r.type.render,r.ref,wt);break;case 5:jm(r);default:f0(i,r),r=yt=Bv(r,Pa),r=u0(i,r,Pa)}n.memoizedProps=n.pendingProps,r===null?td(n):yt=r}function _l(n,r,i,f){Na=eo=null,jm(r),il=null,Ni=0;var _=r.return;try{if(YR(n,_,r,i,wt)){dn=1,Hu(n,Es(i,n.current)),yt=null;return}}catch(k){if(_!==null)throw yt=_,k;dn=1,Hu(n,Es(i,n.current)),yt=null;return}r.flags&32768?(Nt||f===1?n=!0:hl||(wt&536870912)!==0?n=!1:(pr=n=!0,(f===2||f===9||f===3||f===6)&&(f=gs.current,f!==null&&f.tag===13&&(f.flags|=16384))),H0(r,n)):td(r)}function td(n){var r=n;do{if((r.flags&32768)!==0){H0(r,pr);return}n=r.return;var i=QR(r.alternate,r,Pa);if(i!==null){yt=i;return}if(r=r.sibling,r!==null){yt=r;return}yt=r=n}while(r!==null);dn===0&&(dn=5)}function H0(n,r){do{var i=WR(n.alternate,n);if(i!==null){i.flags&=32767,yt=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!r&&(n=n.sibling,n!==null)){yt=n;return}yt=n=i}while(n!==null);dn=6,yt=null}function q0(n,r,i,f,_,k,A,H,Q){n.cancelPendingCommit=null;do nd();while(Sn!==0);if((zt&6)!==0)throw Error(o(327));if(r!==null){if(r===n.current)throw Error(o(177));if(k=r.lanes|r.childLanes,k|=Xp,ks(n,i,k,A,H,Q),n===Gt&&(yt=Gt=null,wt=0),xl=r,gr=n,Ia=i,sh=k,ah=_,M0=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,cT(Oe,function(){return K0(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,_=X.p,X.p=2,A=zt,zt|=4;try{ZR(n,r,i)}finally{zt=A,X.p=_,q.T=f}}Sn=1,V0(),F0(),G0()}}function V0(){if(Sn===1){Sn=0;var n=gr,r=xl,i=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||i){i=q.T,q.T=null;var f=X.p;X.p=2;var _=zt;zt|=4;try{k0(r,n);var k=_h,A=Tv(n.containerInfo),H=k.focusedElem,Q=k.selectionRange;if(A!==H&&H&&H.ownerDocument&&Rv(H.ownerDocument.documentElement,H)){if(Q!==null&&Vp(H)){var oe=Q.start,ge=Q.end;if(ge===void 0&&(ge=oe),"selectionStart"in H)H.selectionStart=oe,H.selectionEnd=Math.min(ge,H.value.length);else{var ye=H.ownerDocument||document,ce=ye&&ye.defaultView||window;if(ce.getSelection){var pe=ce.getSelection(),He=H.textContent.length,at=Math.min(Q.start,He),$t=Q.end===void 0?at:Math.min(Q.end,He);!pe.extend&&at>$t&&(A=$t,$t=at,at=A);var J=Ev(H,at),W=Ev(H,$t);if(J&&W&&(pe.rangeCount!==1||pe.anchorNode!==J.node||pe.anchorOffset!==J.offset||pe.focusNode!==W.node||pe.focusOffset!==W.offset)){var ae=ye.createRange();ae.setStart(J.node,J.offset),pe.removeAllRanges(),at>$t?(pe.addRange(ae),pe.extend(W.node,W.offset)):(ae.setEnd(W.node,W.offset),pe.addRange(ae))}}}}for(ye=[],pe=H;pe=pe.parentNode;)pe.nodeType===1&&ye.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<ye.length;H++){var be=ye[H];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}md=!!bh,_h=bh=null}finally{zt=_,X.p=f,q.T=i}}n.current=r,Sn=2}}function F0(){if(Sn===2){Sn=0;var n=gr,r=xl,i=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||i){i=q.T,q.T=null;var f=X.p;X.p=2;var _=zt;zt|=4;try{_0(n,r.alternate,r)}finally{zt=_,X.p=f,q.T=i}}Sn=3}}function G0(){if(Sn===4||Sn===3){Sn=0,Ie();var n=gr,r=xl,i=Ia,f=M0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Sn=5:(Sn=0,xl=gr=null,Y0(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(hr=null),It(i),r=r.stateNode,Rt&&typeof Rt.onCommitFiberRoot=="function")try{Rt.onCommitFiberRoot(lt,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=q.T,_=X.p,X.p=2,q.T=null;try{for(var k=n.onRecoverableError,A=0;A<f.length;A++){var H=f[A];k(H.value,{componentStack:H.stack})}}finally{q.T=r,X.p=_}}(Ia&3)!==0&&nd(),na(n),_=n.pendingLanes,(i&261930)!==0&&(_&42)!==0?n===rh?Vi++:(Vi=0,rh=n):Vi=0,Fi(0)}}function Y0(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Si(r)))}function nd(){return V0(),F0(),G0(),K0()}function K0(){if(Sn!==5)return!1;var n=gr,r=sh;sh=0;var i=It(Ia),f=q.T,_=X.p;try{X.p=32>i?32:i,q.T=null,i=ah,ah=null;var k=gr,A=Ia;if(Sn=0,xl=gr=null,Ia=0,(zt&6)!==0)throw Error(o(331));var H=zt;if(zt|=4,R0(k.current),C0(k,k.current,A,i),zt=H,Fi(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(lt,k)}catch{}return!0}finally{X.p=_,q.T=f,Y0(n,r)}}function X0(n,r,i){r=Es(i,r),r=Pm(n.stateNode,r,2),n=cr(n,r,2),n!==null&&(hn(n,2),na(n))}function Lt(n,r,i){if(n.tag===3)X0(n,n,i);else for(;r!==null;){if(r.tag===3){X0(r,n,i);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(hr===null||!hr.has(f))){n=Es(i,n),i=Qy(2),f=cr(r,i,2),f!==null&&(Wy(i,f,r,n),hn(f,2),na(f));break}}r=r.return}}function ih(n,r,i){var f=n.pingCache;if(f===null){f=n.pingCache=new tT;var _=new Set;f.set(r,_)}else _=f.get(r),_===void 0&&(_=new Set,f.set(r,_));_.has(i)||(eh=!0,_.add(i),n=oT.bind(null,n,r,i),r.then(n,n))}function oT(n,r,i){var f=n.pingCache;f!==null&&f.delete(r),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Gt===n&&(wt&i)===i&&(dn===4||dn===3&&(wt&62914560)===wt&&300>ue()-Qu?(zt&2)===0&&bl(n,0):th|=i,gl===wt&&(gl=0)),na(n)}function Q0(n,r){r===0&&(r=ps()),n=Wr(n,r),n!==null&&(hn(n,r),na(n))}function lT(n){var r=n.memoizedState,i=0;r!==null&&(i=r.retryLane),Q0(n,i)}function iT(n,r){var i=0;switch(n.tag){case 31:case 13:var f=n.stateNode,_=n.memoizedState;_!==null&&(i=_.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(o(314))}f!==null&&f.delete(r),Q0(n,i)}function cT(n,r){return Ne(n,r)}var sd=null,vl=null,ch=!1,ad=!1,uh=!1,br=0;function na(n){n!==vl&&n.next===null&&(vl===null?sd=vl=n:vl=vl.next=n),ad=!0,ch||(ch=!0,dT())}function Fi(n,r){if(!uh&&ad){uh=!0;do for(var i=!1,f=sd;f!==null;){if(n!==0){var _=f.pendingLanes;if(_===0)var k=0;else{var A=f.suspendedLanes,H=f.pingedLanes;k=(1<<31-Le(42|n)+1)-1,k&=_&~(A&~H),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(i=!0,e1(f,k))}else k=wt,k=Jt(f,f===Gt?k:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(k&3)===0||mn(f,k)||(i=!0,e1(f,k));f=f.next}while(i);uh=!1}}function uT(){W0()}function W0(){ad=ch=!1;var n=0;br!==0&&yT()&&(n=br);for(var r=ue(),i=null,f=sd;f!==null;){var _=f.next,k=Z0(f,r);k===0?(f.next=null,i===null?sd=_:i.next=_,_===null&&(vl=i)):(i=f,(n!==0||(k&3)!==0)&&(ad=!0)),f=_}Sn!==0&&Sn!==5||Fi(n),br!==0&&(br=0)}function Z0(n,r){for(var i=n.suspendedLanes,f=n.pingedLanes,_=n.expirationTimes,k=n.pendingLanes&-62914561;0<k;){var A=31-Le(k),H=1<<A,Q=_[A];Q===-1?((H&i)===0||(H&f)!==0)&&(_[A]=ns(H,r)):Q<=r&&(n.expiredLanes|=H),k&=~H}if(r=Gt,i=wt,i=Jt(n,n===r?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,i===0||n===r&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&De(f),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||mn(n,i)){if(r=i&-i,r===n.callbackPriority)return r;switch(f!==null&&De(f),It(i)){case 2:case 8:i=Re;break;case 32:i=Oe;break;case 268435456:i=rt;break;default:i=Oe}return f=J0.bind(null,n),i=Ne(i,f),n.callbackPriority=r,n.callbackNode=i,r}return f!==null&&f!==null&&De(f),n.callbackPriority=2,n.callbackNode=null,2}function J0(n,r){if(Sn!==0&&Sn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(nd()&&n.callbackNode!==i)return null;var f=wt;return f=Jt(n,n===Gt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(z0(n,f,r),Z0(n,ue()),n.callbackNode!=null&&n.callbackNode===i?J0.bind(null,n):null)}function e1(n,r){if(nd())return null;z0(n,r,!0)}function dT(){wT(function(){(zt&6)!==0?Ne(qe,uT):W0()})}function dh(){if(br===0){var n=rl;n===0&&(n=pt,pt<<=1,(pt&261888)===0&&(pt=256)),br=n}return br}function t1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:fu(""+n)}function n1(n,r){var i=r.ownerDocument.createElement("input");return i.name=r.name,i.value=r.value,n.id&&i.setAttribute("form",n.id),r.parentNode.insertBefore(i,r),n=new FormData(n),i.parentNode.removeChild(i),n}function fT(n,r,i,f,_){if(r==="submit"&&i&&i.stateNode===_){var k=t1((_[Pn]||null).action),A=f.submitter;A&&(r=(r=A[Pn]||null)?t1(r.formAction):A.getAttribute("formAction"),r!==null&&(k=r,A=null));var H=new gu("action","action",null,f,_);n.push({event:H,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(br!==0){var Q=A?n1(_,A):new FormData(_);Am(i,{pending:!0,data:Q,method:_.method,action:k},null,Q)}}else typeof k=="function"&&(H.preventDefault(),Q=A?n1(_,A):new FormData(_),Am(i,{pending:!0,data:Q,method:_.method,action:k},k,Q))},currentTarget:_}]})}}for(var fh=0;fh<Kp.length;fh++){var ph=Kp[fh],pT=ph.toLowerCase(),mT=ph[0].toUpperCase()+ph.slice(1);Hs(pT,"on"+mT)}Hs(Ov,"onAnimationEnd"),Hs(zv,"onAnimationIteration"),Hs(Dv,"onAnimationStart"),Hs("dblclick","onDoubleClick"),Hs("focusin","onFocus"),Hs("focusout","onBlur"),Hs(TR,"onTransitionRun"),Hs(AR,"onTransitionStart"),Hs(MR,"onTransitionCancel"),Hs(Lv,"onTransitionEnd"),Fo("onMouseEnter",["mouseout","mouseover"]),Fo("onMouseLeave",["mouseout","mouseover"]),Fo("onPointerEnter",["pointerout","pointerover"]),Fo("onPointerLeave",["pointerout","pointerover"]),Yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gi="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(" "),hT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gi));function s1(n,r){r=(r&4)!==0;for(var i=0;i<n.length;i++){var f=n[i],_=f.event;f=f.listeners;e:{var k=void 0;if(r)for(var A=f.length-1;0<=A;A--){var H=f[A],Q=H.instance,oe=H.currentTarget;if(H=H.listener,Q!==k&&_.isPropagationStopped())break e;k=H,_.currentTarget=oe;try{k(_)}catch(ge){_u(ge)}_.currentTarget=null,k=Q}else for(A=0;A<f.length;A++){if(H=f[A],Q=H.instance,oe=H.currentTarget,H=H.listener,Q!==k&&_.isPropagationStopped())break e;k=H,_.currentTarget=oe;try{k(_)}catch(ge){_u(ge)}_.currentTarget=null,k=Q}}}}function jt(n,r){var i=r[di];i===void 0&&(i=r[di]=new Set);var f=n+"__bubble";i.has(f)||(a1(r,n,2,!1),i.add(f))}function mh(n,r,i){var f=0;r&&(f|=4),a1(i,n,f,r)}var rd="_reactListening"+Math.random().toString(36).slice(2);function hh(n){if(!n[rd]){n[rd]=!0,W_.forEach(function(i){i!=="selectionchange"&&(hT.has(i)||mh(i,!1,n),mh(i,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[rd]||(r[rd]=!0,mh("selectionchange",!1,r))}}function a1(n,r,i,f){switch(O1(r)){case 2:var _=qT;break;case 8:_=VT;break;default:_=Th}i=_.bind(null,r,i,n),_=void 0,!Dp||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(_=!0),f?_!==void 0?n.addEventListener(r,i,{capture:!0,passive:_}):n.addEventListener(r,i,!0):_!==void 0?n.addEventListener(r,i,{passive:_}):n.addEventListener(r,i,!1)}function gh(n,r,i,f,_){var k=f;if((r&1)===0&&(r&2)===0&&f!==null)e:for(;;){if(f===null)return;var A=f.tag;if(A===3||A===4){var H=f.stateNode.containerInfo;if(H===_)break;if(A===4)for(A=f.return;A!==null;){var Q=A.tag;if((Q===3||Q===4)&&A.stateNode.containerInfo===_)return;A=A.return}for(;H!==null;){if(A=Ho(H),A===null)return;if(Q=A.tag,Q===5||Q===6||Q===26||Q===27){f=k=A;continue e}H=H.parentNode}}f=f.return}cv(function(){var oe=k,ge=Op(i),ye=[];e:{var ce=Pv.get(n);if(ce!==void 0){var pe=gu,He=n;switch(n){case"keypress":if(mu(i)===0)break e;case"keydown":case"keyup":pe=iR;break;case"focusin":He="focus",pe=Bp;break;case"focusout":He="blur",pe=Bp;break;case"beforeblur":case"afterblur":pe=Bp;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":pe=fv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=QE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=dR;break;case Ov:case zv:case Dv:pe=JE;break;case Lv:pe=pR;break;case"scroll":case"scrollend":pe=KE;break;case"wheel":pe=hR;break;case"copy":case"cut":case"paste":pe=tR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=mv;break;case"toggle":case"beforetoggle":pe=xR}var at=(r&4)!==0,$t=!at&&(n==="scroll"||n==="scrollend"),J=at?ce!==null?ce+"Capture":null:ce;at=[];for(var W=oe,ae;W!==null;){var be=W;if(ae=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||ae===null||J===null||(be=mi(W,J),be!=null&&at.push(Yi(W,be,ae))),$t)break;W=W.return}0<at.length&&(ce=new pe(ce,He,null,i,ge),ye.push({event:ce,listeners:at}))}}if((r&7)===0){e:{if(ce=n==="mouseover"||n==="pointerover",pe=n==="mouseout"||n==="pointerout",ce&&i!==Mp&&(He=i.relatedTarget||i.fromElement)&&(Ho(He)||He[Zs]))break e;if((pe||ce)&&(ce=ge.window===ge?ge:(ce=ge.ownerDocument)?ce.defaultView||ce.parentWindow:window,pe?(He=i.relatedTarget||i.toElement,pe=oe,He=He?Ho(He):null,He!==null&&($t=c(He),at=He.tag,He!==$t||at!==5&&at!==27&&at!==6)&&(He=null)):(pe=null,He=oe),pe!==He)){if(at=fv,be="onMouseLeave",J="onMouseEnter",W="mouse",(n==="pointerout"||n==="pointerover")&&(at=mv,be="onPointerLeave",J="onPointerEnter",W="pointer"),$t=pe==null?ce:pi(pe),ae=He==null?ce:pi(He),ce=new at(be,W+"leave",pe,i,ge),ce.target=$t,ce.relatedTarget=ae,be=null,Ho(ge)===oe&&(at=new at(J,W+"enter",He,i,ge),at.target=ae,at.relatedTarget=$t,be=at),$t=be,pe&&He)t:{for(at=gT,J=pe,W=He,ae=0,be=J;be;be=at(be))ae++;be=0;for(var Ze=W;Ze;Ze=at(Ze))be++;for(;0<ae-be;)J=at(J),ae--;for(;0<be-ae;)W=at(W),be--;for(;ae--;){if(J===W||W!==null&&J===W.alternate){at=J;break t}J=at(J),W=at(W)}at=null}else at=null;pe!==null&&r1(ye,ce,pe,at,!1),He!==null&&$t!==null&&r1(ye,$t,He,at,!0)}}e:{if(ce=oe?pi(oe):window,pe=ce.nodeName&&ce.nodeName.toLowerCase(),pe==="select"||pe==="input"&&ce.type==="file")var Tt=jv;else if(vv(ce))if(wv)Tt=NR;else{Tt=SR;var Ye=kR}else pe=ce.nodeName,!pe||pe.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?oe&&Ap(oe.elementType)&&(Tt=jv):Tt=CR;if(Tt&&(Tt=Tt(n,oe))){yv(ye,Tt,i,ge);break e}Ye&&Ye(n,ce,oe),n==="focusout"&&oe&&ce.type==="number"&&oe.memoizedProps.value!=null&&Tp(ce,"number",ce.value)}switch(Ye=oe?pi(oe):window,n){case"focusin":(vv(Ye)||Ye.contentEditable==="true")&&(Wo=Ye,Fp=oe,ji=null);break;case"focusout":ji=Fp=Wo=null;break;case"mousedown":Gp=!0;break;case"contextmenu":case"mouseup":case"dragend":Gp=!1,Av(ye,i,ge);break;case"selectionchange":if(RR)break;case"keydown":case"keyup":Av(ye,i,ge)}var mt;if($p)e:{switch(n){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else Qo?bv(n,i)&&(kt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(kt="onCompositionStart");kt&&(hv&&i.locale!=="ko"&&(Qo||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&Qo&&(mt=uv()):(nr=ge,Lp="value"in nr?nr.value:nr.textContent,Qo=!0)),Ye=od(oe,kt),0<Ye.length&&(kt=new pv(kt,n,null,i,ge),ye.push({event:kt,listeners:Ye}),mt?kt.data=mt:(mt=_v(i),mt!==null&&(kt.data=mt)))),(mt=_R?vR(n,i):yR(n,i))&&(kt=od(oe,"onBeforeInput"),0<kt.length&&(Ye=new pv("onBeforeInput","beforeinput",null,i,ge),ye.push({event:Ye,listeners:kt}),Ye.data=mt)),fT(ye,n,oe,i,ge)}s1(ye,r)})}function Yi(n,r,i){return{instance:n,listener:r,currentTarget:i}}function od(n,r){for(var i=r+"Capture",f=[];n!==null;){var _=n,k=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||k===null||(_=mi(n,i),_!=null&&f.unshift(Yi(n,_,k)),_=mi(n,r),_!=null&&f.push(Yi(n,_,k))),n.tag===3)return f;n=n.return}return[]}function gT(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function r1(n,r,i,f,_){for(var k=r._reactName,A=[];i!==null&&i!==f;){var H=i,Q=H.alternate,oe=H.stateNode;if(H=H.tag,Q!==null&&Q===f)break;H!==5&&H!==26&&H!==27||oe===null||(Q=oe,_?(oe=mi(i,k),oe!=null&&A.unshift(Yi(i,oe,Q))):_||(oe=mi(i,k),oe!=null&&A.push(Yi(i,oe,Q)))),i=i.return}A.length!==0&&n.push({event:r,listeners:A})}var xT=/\r\n?/g,bT=/\u0000|\uFFFD/g;function o1(n){return(typeof n=="string"?n:""+n).replace(xT,`
49
+ `).replace(bT,"")}function l1(n,r){return r=o1(r),o1(n)===r}function Ut(n,r,i,f,_,k){switch(i){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||Yo(n,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&Yo(n,""+f);break;case"className":uu(n,"class",f);break;case"tabIndex":uu(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":uu(n,i,f);break;case"style":lv(n,f,k);break;case"data":if(r!=="object"){uu(n,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||i!=="href")){n.removeAttribute(i);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(i);break}f=fu(""+f),n.setAttribute(i,f);break;case"action":case"formAction":if(typeof f=="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 k=="function"&&(i==="formAction"?(r!=="input"&&Ut(n,r,"name",_.name,_,null),Ut(n,r,"formEncType",_.formEncType,_,null),Ut(n,r,"formMethod",_.formMethod,_,null),Ut(n,r,"formTarget",_.formTarget,_,null)):(Ut(n,r,"encType",_.encType,_,null),Ut(n,r,"method",_.method,_,null),Ut(n,r,"target",_.target,_,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(i);break}f=fu(""+f),n.setAttribute(i,f);break;case"onClick":f!=null&&(n.onclick=wa);break;case"onScroll":f!=null&&jt("scroll",n);break;case"onScrollEnd":f!=null&&jt("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(i=f.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}i=fu(""+f),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":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,""+f):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":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":f===!0?n.setAttribute(i,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,f):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(i,f):n.removeAttribute(i);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(i):n.setAttribute(i,f);break;case"popover":jt("beforetoggle",n),jt("toggle",n),cu(n,"popover",f);break;case"xlinkActuate":ja(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":ja(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":ja(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":ja(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":ja(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":ja(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":ja(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":ja(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":ja(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":cu(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=GE.get(i)||i,cu(n,i,f))}}function xh(n,r,i,f,_,k){switch(i){case"style":lv(n,f,k);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(i=f.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof f=="string"?Yo(n,f):(typeof f=="number"||typeof f=="bigint")&&Yo(n,""+f);break;case"onScroll":f!=null&&jt("scroll",n);break;case"onScrollEnd":f!=null&&jt("scrollend",n);break;case"onClick":f!=null&&(n.onclick=wa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Z_.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(_=i.endsWith("Capture"),r=i.slice(2,_?i.length-7:void 0),k=n[Pn]||null,k=k!=null?k[i]:null,typeof k=="function"&&n.removeEventListener(r,k,_),typeof f=="function")){typeof k!="function"&&k!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(r,f,_);break e}i in n?n[i]=f:f===!0?n.setAttribute(i,""):cu(n,i,f)}}}function $n(n,r,i){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":jt("error",n),jt("load",n);var f=!1,_=!1,k;for(k in i)if(i.hasOwnProperty(k)){var A=i[k];if(A!=null)switch(k){case"src":f=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:Ut(n,r,k,A,i,null)}}_&&Ut(n,r,"srcSet",i.srcSet,i,null),f&&Ut(n,r,"src",i.src,i,null);return;case"input":jt("invalid",n);var H=k=A=_=null,Q=null,oe=null;for(f in i)if(i.hasOwnProperty(f)){var ge=i[f];if(ge!=null)switch(f){case"name":_=ge;break;case"type":A=ge;break;case"checked":Q=ge;break;case"defaultChecked":oe=ge;break;case"value":k=ge;break;case"defaultValue":H=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(o(137,r));break;default:Ut(n,r,f,ge,i,null)}}sv(n,k,H,Q,oe,A,_,!1);return;case"select":jt("invalid",n),f=A=k=null;for(_ in i)if(i.hasOwnProperty(_)&&(H=i[_],H!=null))switch(_){case"value":k=H;break;case"defaultValue":A=H;break;case"multiple":f=H;default:Ut(n,r,_,H,i,null)}r=k,i=A,n.multiple=!!f,r!=null?Go(n,!!f,r,!1):i!=null&&Go(n,!!f,i,!0);return;case"textarea":jt("invalid",n),k=_=f=null;for(A in i)if(i.hasOwnProperty(A)&&(H=i[A],H!=null))switch(A){case"value":f=H;break;case"defaultValue":_=H;break;case"children":k=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(91));break;default:Ut(n,r,A,H,i,null)}rv(n,f,_,k);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(f=i[Q],f!=null))switch(Q){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Ut(n,r,Q,f,i,null)}return;case"dialog":jt("beforetoggle",n),jt("toggle",n),jt("cancel",n),jt("close",n);break;case"iframe":case"object":jt("load",n);break;case"video":case"audio":for(f=0;f<Gi.length;f++)jt(Gi[f],n);break;case"image":jt("error",n),jt("load",n);break;case"details":jt("toggle",n);break;case"embed":case"source":case"link":jt("error",n),jt("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(oe in i)if(i.hasOwnProperty(oe)&&(f=i[oe],f!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:Ut(n,r,oe,f,i,null)}return;default:if(Ap(r)){for(ge in i)i.hasOwnProperty(ge)&&(f=i[ge],f!==void 0&&xh(n,r,ge,f,i,void 0));return}}for(H in i)i.hasOwnProperty(H)&&(f=i[H],f!=null&&Ut(n,r,H,f,i,null))}function _T(n,r,i,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,k=null,A=null,H=null,Q=null,oe=null,ge=null;for(pe in i){var ye=i[pe];if(i.hasOwnProperty(pe)&&ye!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":Q=ye;default:f.hasOwnProperty(pe)||Ut(n,r,pe,null,f,ye)}}for(var ce in f){var pe=f[ce];if(ye=i[ce],f.hasOwnProperty(ce)&&(pe!=null||ye!=null))switch(ce){case"type":k=pe;break;case"name":_=pe;break;case"checked":oe=pe;break;case"defaultChecked":ge=pe;break;case"value":A=pe;break;case"defaultValue":H=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(o(137,r));break;default:pe!==ye&&Ut(n,r,ce,pe,f,ye)}}Rp(n,A,H,Q,oe,ge,k,_);return;case"select":pe=A=H=ce=null;for(k in i)if(Q=i[k],i.hasOwnProperty(k)&&Q!=null)switch(k){case"value":break;case"multiple":pe=Q;default:f.hasOwnProperty(k)||Ut(n,r,k,null,f,Q)}for(_ in f)if(k=f[_],Q=i[_],f.hasOwnProperty(_)&&(k!=null||Q!=null))switch(_){case"value":ce=k;break;case"defaultValue":H=k;break;case"multiple":A=k;default:k!==Q&&Ut(n,r,_,k,f,Q)}r=H,i=A,f=pe,ce!=null?Go(n,!!i,ce,!1):!!f!=!!i&&(r!=null?Go(n,!!i,r,!0):Go(n,!!i,i?[]:"",!1));return;case"textarea":pe=ce=null;for(H in i)if(_=i[H],i.hasOwnProperty(H)&&_!=null&&!f.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Ut(n,r,H,null,f,_)}for(A in f)if(_=f[A],k=i[A],f.hasOwnProperty(A)&&(_!=null||k!=null))switch(A){case"value":ce=_;break;case"defaultValue":pe=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(o(91));break;default:_!==k&&Ut(n,r,A,_,f,k)}av(n,ce,pe);return;case"option":for(var He in i)if(ce=i[He],i.hasOwnProperty(He)&&ce!=null&&!f.hasOwnProperty(He))switch(He){case"selected":n.selected=!1;break;default:Ut(n,r,He,null,f,ce)}for(Q in f)if(ce=f[Q],pe=i[Q],f.hasOwnProperty(Q)&&ce!==pe&&(ce!=null||pe!=null))switch(Q){case"selected":n.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:Ut(n,r,Q,ce,f,pe)}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 at in i)ce=i[at],i.hasOwnProperty(at)&&ce!=null&&!f.hasOwnProperty(at)&&Ut(n,r,at,null,f,ce);for(oe in f)if(ce=f[oe],pe=i[oe],f.hasOwnProperty(oe)&&ce!==pe&&(ce!=null||pe!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(o(137,r));break;default:Ut(n,r,oe,ce,f,pe)}return;default:if(Ap(r)){for(var $t in i)ce=i[$t],i.hasOwnProperty($t)&&ce!==void 0&&!f.hasOwnProperty($t)&&xh(n,r,$t,void 0,f,ce);for(ge in f)ce=f[ge],pe=i[ge],!f.hasOwnProperty(ge)||ce===pe||ce===void 0&&pe===void 0||xh(n,r,ge,ce,f,pe);return}}for(var J in i)ce=i[J],i.hasOwnProperty(J)&&ce!=null&&!f.hasOwnProperty(J)&&Ut(n,r,J,null,f,ce);for(ye in f)ce=f[ye],pe=i[ye],!f.hasOwnProperty(ye)||ce===pe||ce==null&&pe==null||Ut(n,r,ye,ce,f,pe)}function i1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function vT(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,i=performance.getEntriesByType("resource"),f=0;f<i.length;f++){var _=i[f],k=_.transferSize,A=_.initiatorType,H=_.duration;if(k&&H&&i1(A)){for(A=0,H=_.responseEnd,f+=1;f<i.length;f++){var Q=i[f],oe=Q.startTime;if(oe>H)break;var ge=Q.transferSize,ye=Q.initiatorType;ge&&i1(ye)&&(Q=Q.responseEnd,A+=ge*(Q<H?1:(H-oe)/(Q-oe)))}if(--f,r+=8*(k+A)/(_.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var bh=null,_h=null;function ld(n){return n.nodeType===9?n:n.ownerDocument}function c1(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 u1(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function vh(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var yh=null;function yT(){var n=window.event;return n&&n.type==="popstate"?n===yh?!1:(yh=n,!0):(yh=null,!1)}var d1=typeof setTimeout=="function"?setTimeout:void 0,jT=typeof clearTimeout=="function"?clearTimeout:void 0,f1=typeof Promise=="function"?Promise:void 0,wT=typeof queueMicrotask=="function"?queueMicrotask:typeof f1<"u"?function(n){return f1.resolve(null).then(n).catch(kT)}:d1;function kT(n){setTimeout(function(){throw n})}function _r(n){return n==="head"}function p1(n,r){var i=r,f=0;do{var _=i.nextSibling;if(n.removeChild(i),_&&_.nodeType===8)if(i=_.data,i==="/$"||i==="/&"){if(f===0){n.removeChild(_),kl(r);return}f--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")f++;else if(i==="html")Ki(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Ki(i);for(var k=i.firstChild;k;){var A=k.nextSibling,H=k.nodeName;k[fi]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&k.rel.toLowerCase()==="stylesheet"||i.removeChild(k),k=A}}else i==="body"&&Ki(n.ownerDocument.body);i=_}while(i);kl(r)}function m1(n,r){var i=n;n=0;do{var f=i.nextSibling;if(i.nodeType===1?r?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(r?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),f&&f.nodeType===8)if(i=f.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=f}while(i)}function jh(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var i=r;switch(r=r.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":jh(i),Np(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function ST(n,r,i,f){for(;n.nodeType===1;){var _=i;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[fi])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(k=n.getAttribute("rel"),k==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(k!==_.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(k=n.getAttribute("src"),(k!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&k&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var k=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===k)return n}else return n;if(n=Os(n.nextSibling),n===null)break}return null}function CT(n,r,i){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Os(n.nextSibling),n===null))return null;return n}function h1(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Os(n.nextSibling),n===null))return null;return n}function wh(n){return n.data==="$?"||n.data==="$~"}function kh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function NT(n,r){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||i.readyState!=="loading")r();else{var f=function(){r(),i.removeEventListener("DOMContentLoaded",f)};i.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function Os(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var Sh=null;function g1(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(r===0)return Os(n.nextSibling);r--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||r++}n=n.nextSibling}return null}function x1(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(r===0)return n;r--}else i!=="/$"&&i!=="/&"||r++}n=n.previousSibling}return null}function b1(n,r,i){switch(r=ld(i),n){case"html":if(n=r.documentElement,!n)throw Error(o(452));return n;case"head":if(n=r.head,!n)throw Error(o(453));return n;case"body":if(n=r.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function Ki(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);Np(n)}var zs=new Map,_1=new Set;function id(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ba=X.d;X.d={f:ET,r:RT,D:TT,C:AT,L:MT,m:OT,X:DT,S:zT,M:LT};function ET(){var n=Ba.f(),r=Ju();return n||r}function RT(n){var r=qo(n);r!==null&&r.tag===5&&r.type==="form"?Ly(r):Ba.r(n)}var yl=typeof document>"u"?null:document;function v1(n,r,i){var f=yl;if(f&&typeof r=="string"&&r){var _=Cs(r);_='link[rel="'+n+'"][href="'+_+'"]',typeof i=="string"&&(_+='[crossorigin="'+i+'"]'),_1.has(_)||(_1.add(_),n={rel:n,crossOrigin:i,href:r},f.querySelector(_)===null&&(r=f.createElement("link"),$n(r,"link",n),Rn(r),f.head.appendChild(r)))}}function TT(n){Ba.D(n),v1("dns-prefetch",n,null)}function AT(n,r){Ba.C(n,r),v1("preconnect",n,r)}function MT(n,r,i){Ba.L(n,r,i);var f=yl;if(f&&n&&r){var _='link[rel="preload"][as="'+Cs(r)+'"]';r==="image"&&i&&i.imageSrcSet?(_+='[imagesrcset="'+Cs(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(_+='[imagesizes="'+Cs(i.imageSizes)+'"]')):_+='[href="'+Cs(n)+'"]';var k=_;switch(r){case"style":k=jl(n);break;case"script":k=wl(n)}zs.has(k)||(n=b({rel:"preload",href:r==="image"&&i&&i.imageSrcSet?void 0:n,as:r},i),zs.set(k,n),f.querySelector(_)!==null||r==="style"&&f.querySelector(Xi(k))||r==="script"&&f.querySelector(Qi(k))||(r=f.createElement("link"),$n(r,"link",n),Rn(r),f.head.appendChild(r)))}}function OT(n,r){Ba.m(n,r);var i=yl;if(i&&n){var f=r&&typeof r.as=="string"?r.as:"script",_='link[rel="modulepreload"][as="'+Cs(f)+'"][href="'+Cs(n)+'"]',k=_;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=wl(n)}if(!zs.has(k)&&(n=b({rel:"modulepreload",href:n},r),zs.set(k,n),i.querySelector(_)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Qi(k)))return}f=i.createElement("link"),$n(f,"link",n),Rn(f),i.head.appendChild(f)}}}function zT(n,r,i){Ba.S(n,r,i);var f=yl;if(f&&n){var _=Vo(f).hoistableStyles,k=jl(n);r=r||"default";var A=_.get(k);if(!A){var H={loading:0,preload:null};if(A=f.querySelector(Xi(k)))H.loading=5;else{n=b({rel:"stylesheet",href:n,"data-precedence":r},i),(i=zs.get(k))&&Ch(n,i);var Q=A=f.createElement("link");Rn(Q),$n(Q,"link",n),Q._p=new Promise(function(oe,ge){Q.onload=oe,Q.onerror=ge}),Q.addEventListener("load",function(){H.loading|=1}),Q.addEventListener("error",function(){H.loading|=2}),H.loading|=4,cd(A,r,f)}A={type:"stylesheet",instance:A,count:1,state:H},_.set(k,A)}}}function DT(n,r){Ba.X(n,r);var i=yl;if(i&&n){var f=Vo(i).hoistableScripts,_=wl(n),k=f.get(_);k||(k=i.querySelector(Qi(_)),k||(n=b({src:n,async:!0},r),(r=zs.get(_))&&Nh(n,r),k=i.createElement("script"),Rn(k),$n(k,"link",n),i.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},f.set(_,k))}}function LT(n,r){Ba.M(n,r);var i=yl;if(i&&n){var f=Vo(i).hoistableScripts,_=wl(n),k=f.get(_);k||(k=i.querySelector(Qi(_)),k||(n=b({src:n,async:!0,type:"module"},r),(r=zs.get(_))&&Nh(n,r),k=i.createElement("script"),Rn(k),$n(k,"link",n),i.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},f.set(_,k))}}function y1(n,r,i,f){var _=(_=ee.current)?id(_):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"?(r=jl(i.href),i=Vo(_).hoistableStyles,f=i.get(r),f||(f={type:"style",instance:null,count:0,state:null},i.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=jl(i.href);var k=Vo(_).hoistableStyles,A=k.get(n);if(A||(_=_.ownerDocument||_,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(n,A),(k=_.querySelector(Xi(n)))&&!k._p&&(A.instance=k,A.state.loading=5),zs.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},zs.set(n,i),k||PT(_,n,i,A.state))),r&&f===null)throw Error(o(528,""));return A}if(r&&f!==null)throw Error(o(529,""));return null;case"script":return r=i.async,i=i.src,typeof i=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=wl(i),i=Vo(_).hoistableScripts,f=i.get(r),f||(f={type:"script",instance:null,count:0,state:null},i.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function jl(n){return'href="'+Cs(n)+'"'}function Xi(n){return'link[rel="stylesheet"]['+n+"]"}function j1(n){return b({},n,{"data-precedence":n.precedence,precedence:null})}function PT(n,r,i,f){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=n.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),$n(r,"link",i),Rn(r),n.head.appendChild(r))}function wl(n){return'[src="'+Cs(n)+'"]'}function Qi(n){return"script[async]"+n}function w1(n,r,i){if(r.count++,r.instance===null)switch(r.type){case"style":var f=n.querySelector('style[data-href~="'+Cs(i.href)+'"]');if(f)return r.instance=f,Rn(f),f;var _=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),Rn(f),$n(f,"style",_),cd(f,i.precedence,n),r.instance=f;case"stylesheet":_=jl(i.href);var k=n.querySelector(Xi(_));if(k)return r.state.loading|=4,r.instance=k,Rn(k),k;f=j1(i),(_=zs.get(_))&&Ch(f,_),k=(n.ownerDocument||n).createElement("link"),Rn(k);var A=k;return A._p=new Promise(function(H,Q){A.onload=H,A.onerror=Q}),$n(k,"link",f),r.state.loading|=4,cd(k,i.precedence,n),r.instance=k;case"script":return k=wl(i.src),(_=n.querySelector(Qi(k)))?(r.instance=_,Rn(_),_):(f=i,(_=zs.get(k))&&(f=b({},i),Nh(f,_)),n=n.ownerDocument||n,_=n.createElement("script"),Rn(_),$n(_,"link",f),n.head.appendChild(_),r.instance=_);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,cd(f,i.precedence,n));return r.instance}function cd(n,r,i){for(var f=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=f.length?f[f.length-1]:null,k=_,A=0;A<f.length;A++){var H=f[A];if(H.dataset.precedence===r)k=H;else if(k!==_)break}k?k.parentNode.insertBefore(n,k.nextSibling):(r=i.nodeType===9?i.head:i,r.insertBefore(n,r.firstChild))}function Ch(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function Nh(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var ud=null;function k1(n,r,i){if(ud===null){var f=new Map,_=ud=new Map;_.set(i,f)}else _=ud,f=_.get(i),f||(f=new Map,_.set(i,f));if(f.has(n))return f;for(f.set(n,null),i=i.getElementsByTagName(n),_=0;_<i.length;_++){var k=i[_];if(!(k[fi]||k[Ft]||n==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var A=k.getAttribute(r)||"";A=n+A;var H=f.get(A);H?H.push(k):f.set(A,[k])}}return f}function S1(n,r,i){n=n.ownerDocument||n,n.head.insertBefore(i,r==="title"?n.querySelector("head > title"):null)}function IT(n,r,i){if(i===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return n=r.disabled,typeof r.precedence=="string"&&n==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function C1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function BT(n,r,i,f){if(i.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var _=jl(f.href),k=r.querySelector(Xi(_));if(k){r=k._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=dd.bind(n),r.then(n,n)),i.state.loading|=4,i.instance=k,Rn(k);return}k=r.ownerDocument||r,f=j1(f),(_=zs.get(_))&&Ch(f,_),k=k.createElement("link"),Rn(k);var A=k;A._p=new Promise(function(H,Q){A.onload=H,A.onerror=Q}),$n(k,"link",f),i.instance=k}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,r),(r=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=dd.bind(n),r.addEventListener("load",i),r.addEventListener("error",i))}}var Eh=0;function UT(n,r){return n.stylesheets&&n.count===0&&pd(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var f=setTimeout(function(){if(n.stylesheets&&pd(n,n.stylesheets),n.unsuspend){var k=n.unsuspend;n.unsuspend=null,k()}},6e4+r);0<n.imgBytes&&Eh===0&&(Eh=62500*vT());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&pd(n,n.stylesheets),n.unsuspend)){var k=n.unsuspend;n.unsuspend=null,k()}},(n.imgBytes>Eh?50:800)+r);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(_)}}:null}function dd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pd(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var fd=null;function pd(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,fd=new Map,r.forEach($T,n),fd=null,dd.call(n))}function $T(n,r){if(!(r.state.loading&4)){var i=fd.get(n);if(i)var f=i.get(null);else{i=new Map,fd.set(n,i);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<_.length;k++){var A=_[k];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(i.set(A.dataset.precedence,A),f=A)}f&&i.set(null,f)}_=r.instance,A=_.getAttribute("data-precedence"),k=i.get(A)||f,k===f&&i.set(null,_),i.set(A,_),this.count++,f=dd.bind(this),_.addEventListener("load",f),_.addEventListener("error",f),k?k.parentNode.insertBefore(_,k.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),r.state.loading|=4}}var Wi={$$typeof:C,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function HT(n,r,i,f,_,k,A,H,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=ws(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ws(0),this.hiddenUpdates=ws(null),this.identifierPrefix=f,this.onUncaughtError=_,this.onCaughtError=k,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function N1(n,r,i,f,_,k,A,H,Q,oe,ge,ye){return n=new HT(n,r,i,A,Q,oe,ge,ye,H),r=1,k===!0&&(r|=24),k=hs(3,null,null,r),n.current=k,k.stateNode=n,r=lm(),r.refCount++,n.pooledCache=r,r.refCount++,k.memoizedState={element:f,isDehydrated:i,cache:r},dm(k),n}function E1(n){return n?(n=el,n):el}function R1(n,r,i,f,_,k){_=E1(_),f.context===null?f.context=_:f.pendingContext=_,f=ir(r),f.payload={element:i},k=k===void 0?null:k,k!==null&&(f.callback=k),i=cr(n,f,r),i!==null&&(is(i,n,r),Ri(i,n,r))}function T1(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<r?i:r}}function Rh(n,r){T1(n,r),(n=n.alternate)&&T1(n,r)}function A1(n){if(n.tag===13||n.tag===31){var r=Wr(n,67108864);r!==null&&is(r,n,67108864),Rh(n,67108864)}}function M1(n){if(n.tag===13||n.tag===31){var r=vs();r=ut(r);var i=Wr(n,r);i!==null&&is(i,n,r),Rh(n,r)}}var md=!0;function qT(n,r,i,f){var _=q.T;q.T=null;var k=X.p;try{X.p=2,Th(n,r,i,f)}finally{X.p=k,q.T=_}}function VT(n,r,i,f){var _=q.T;q.T=null;var k=X.p;try{X.p=8,Th(n,r,i,f)}finally{X.p=k,q.T=_}}function Th(n,r,i,f){if(md){var _=Ah(f);if(_===null)gh(n,r,f,hd,i),z1(n,f);else if(GT(_,n,r,i,f))f.stopPropagation();else if(z1(n,f),r&4&&-1<FT.indexOf(n)){for(;_!==null;){var k=qo(_);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var A=Xt(k.pendingLanes);if(A!==0){var H=k;for(H.pendingLanes|=2,H.entangledLanes|=2;A;){var Q=1<<31-Le(A);H.entanglements[1]|=Q,A&=~Q}na(k),(zt&6)===0&&(Wu=ue()+500,Fi(0))}}break;case 31:case 13:H=Wr(k,2),H!==null&&is(H,k,2),Ju(),Rh(k,2)}if(k=Ah(f),k===null&&gh(n,r,f,hd,i),k===_)break;_=k}_!==null&&f.stopPropagation()}else gh(n,r,f,null,i)}}function Ah(n){return n=Op(n),Mh(n)}var hd=null;function Mh(n){if(hd=null,n=Ho(n),n!==null){var r=c(n);if(r===null)n=null;else{var i=r.tag;if(i===13){if(n=u(r),n!==null)return n;n=null}else if(i===31){if(n=p(r),n!==null)return n;n=null}else if(i===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return hd=n,null}function O1(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(_e()){case qe:return 2;case Re:return 8;case Oe:case et:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Oh=!1,vr=null,yr=null,jr=null,Zi=new Map,Ji=new Map,wr=[],FT="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 z1(n,r){switch(n){case"focusin":case"focusout":vr=null;break;case"dragenter":case"dragleave":yr=null;break;case"mouseover":case"mouseout":jr=null;break;case"pointerover":case"pointerout":Zi.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ji.delete(r.pointerId)}}function ec(n,r,i,f,_,k){return n===null||n.nativeEvent!==k?(n={blockedOn:r,domEventName:i,eventSystemFlags:f,nativeEvent:k,targetContainers:[_]},r!==null&&(r=qo(r),r!==null&&A1(r)),n):(n.eventSystemFlags|=f,r=n.targetContainers,_!==null&&r.indexOf(_)===-1&&r.push(_),n)}function GT(n,r,i,f,_){switch(r){case"focusin":return vr=ec(vr,n,r,i,f,_),!0;case"dragenter":return yr=ec(yr,n,r,i,f,_),!0;case"mouseover":return jr=ec(jr,n,r,i,f,_),!0;case"pointerover":var k=_.pointerId;return Zi.set(k,ec(Zi.get(k)||null,n,r,i,f,_)),!0;case"gotpointercapture":return k=_.pointerId,Ji.set(k,ec(Ji.get(k)||null,n,r,i,f,_)),!0}return!1}function D1(n){var r=Ho(n.target);if(r!==null){var i=c(r);if(i!==null){if(r=i.tag,r===13){if(r=u(i),r!==null){n.blockedOn=r,En(n.priority,function(){M1(i)});return}}else if(r===31){if(r=p(i),r!==null){n.blockedOn=r,En(n.priority,function(){M1(i)});return}}else if(r===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function gd(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var i=Ah(n.nativeEvent);if(i===null){i=n.nativeEvent;var f=new i.constructor(i.type,i);Mp=f,i.target.dispatchEvent(f),Mp=null}else return r=qo(i),r!==null&&A1(r),n.blockedOn=i,!1;r.shift()}return!0}function L1(n,r,i){gd(n)&&i.delete(r)}function YT(){Oh=!1,vr!==null&&gd(vr)&&(vr=null),yr!==null&&gd(yr)&&(yr=null),jr!==null&&gd(jr)&&(jr=null),Zi.forEach(L1),Ji.forEach(L1)}function xd(n,r){n.blockedOn===r&&(n.blockedOn=null,Oh||(Oh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YT)))}var bd=null;function P1(n){bd!==n&&(bd=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){bd===n&&(bd=null);for(var r=0;r<n.length;r+=3){var i=n[r],f=n[r+1],_=n[r+2];if(typeof f!="function"){if(Mh(f||i)===null)continue;break}var k=qo(i);k!==null&&(n.splice(r,3),r-=3,Am(k,{pending:!0,data:_,method:i.method,action:f},f,_))}}))}function kl(n){function r(Q){return xd(Q,n)}vr!==null&&xd(vr,n),yr!==null&&xd(yr,n),jr!==null&&xd(jr,n),Zi.forEach(r),Ji.forEach(r);for(var i=0;i<wr.length;i++){var f=wr[i];f.blockedOn===n&&(f.blockedOn=null)}for(;0<wr.length&&(i=wr[0],i.blockedOn===null);)D1(i),i.blockedOn===null&&wr.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(f=0;f<i.length;f+=3){var _=i[f],k=i[f+1],A=_[Pn]||null;if(typeof k=="function")A||P1(i);else if(A){var H=null;if(k&&k.hasAttribute("formAction")){if(_=k,A=k[Pn]||null)H=A.formAction;else if(Mh(_)!==null)continue}else H=A.action;typeof H=="function"?i[f+1]=H:(i.splice(f,3),f-=3),P1(i)}}}function I1(){function n(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(A){return _=A})},focusReset:"manual",scroll:"manual"})}function r(){_!==null&&(_(),_=null),f||setTimeout(i,20)}function i(){if(!f&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,_=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(i,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),_!==null&&(_(),_=null)}}}function zh(n){this._internalRoot=n}_d.prototype.render=zh.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(o(409));var i=r.current,f=vs();R1(i,f,n,r,null,null)},_d.prototype.unmount=zh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;R1(n.current,2,null,n,null,null),Ju(),r[Zs]=null}};function _d(n){this._internalRoot=n}_d.prototype.unstable_scheduleHydration=function(n){if(n){var r=gn();n={blockedOn:null,target:n,priority:r};for(var i=0;i<wr.length&&r!==0&&r<wr[i].priority;i++);wr.splice(i,0,n),i===0&&D1(n)}};var B1=t.version;if(B1!=="19.2.7")throw Error(o(527,B1,"19.2.7"));X.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=h(r),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var KT={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vd.isDisabled&&vd.supportsFiber)try{lt=vd.inject(KT),Rt=vd}catch{}}return nc.createRoot=function(n,r){if(!l(n))throw Error(o(299));var i=!1,f="",_=Gy,k=Yy,A=Ky;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(_=r.onUncaughtError),r.onCaughtError!==void 0&&(k=r.onCaughtError),r.onRecoverableError!==void 0&&(A=r.onRecoverableError)),r=N1(n,1,!1,null,null,i,f,null,_,k,A,I1),n[Zs]=r.current,hh(n),new zh(r)},nc.hydrateRoot=function(n,r,i){if(!l(n))throw Error(o(299));var f=!1,_="",k=Gy,A=Yy,H=Ky,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(f=!0),i.identifierPrefix!==void 0&&(_=i.identifierPrefix),i.onUncaughtError!==void 0&&(k=i.onUncaughtError),i.onCaughtError!==void 0&&(A=i.onCaughtError),i.onRecoverableError!==void 0&&(H=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),r=N1(n,1,!0,r,i??null,f,_,Q,k,A,H,I1),r.context=E1(null),i=r.current,f=vs(),f=ut(f),_=ir(f),_.callback=null,cr(i,_,f),i=f,r.current.lanes=i,hn(r,i),na(r),n[Zs]=r.current,hh(n),new _d(r)},nc.version="19.2.7",nc}var X1;function rA(){if(X1)return Ph.exports;X1=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(),Ph.exports=aA(),Ph.exports}var oA=rA();const lA=Fx(oA);/**
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 Gx=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,qk=/^[\\/]{2}/;function iA(e,t){return t+e.replace(/\\/g,"/")}var Q1="popstate";function W1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cA(e={}){function t(o,l){let c=l.state?.masked,{pathname:u,search:p,hash:m}=c||o.location;return Jg("",{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:Lc(l)}return dA(t,a,null,e)}function an(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 uA(){return Math.random().toString(36).substring(2,10)}function Z1(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 Jg(e,t,a=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ei(t):t,state:a,key:t&&t.key||o||uA(),mask:l}}function Lc({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 ei(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 dA(e,t,a,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,u=l.history,p="POP",m=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function b(){p="POP";let j=g(),E=j==null?null:j-h;h=j,m&&m({action:p,location:y.location,delta:E})}function v(j,E){p="PUSH";let S=W1(j)?j:Jg(y.location,j,E);h=g()+1;let C=Z1(S,h),R=y.createHref(S.mask||S);try{u.pushState(C,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;l.location.assign(R)}c&&m&&m({action:p,location:y.location,delta:1})}function w(j,E){p="REPLACE";let S=W1(j)?j:Jg(y.location,j,E);h=g();let C=Z1(S,h),R=y.createHref(S.mask||S);u.replaceState(C,"",R),c&&m&&m({action:p,location:y.location,delta:0})}function N(j){return fA(l,j)}let y={get action(){return p},get location(){return e(l,u)},listen(j){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Q1,b),m=j,()=>{l.removeEventListener(Q1,b),m=null}},createHref(j){return t(l,j)},createURL:N,encodeLocation(j){let E=N(j);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:v,replace:w,go(j){return u.go(j)}};return y}function fA(e,t,a=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),an(o,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Lc(t);return l=l.replace(/ $/,"%20"),!a&&qk.test(l)&&(l=o+l),new URL(l,o)}function Vk(e,t,a="/"){return pA(e,t,a,!1)}function pA(e,t,a,o,l){let c=typeof t=="string"?ei(t):t,u=Ya(c.pathname||"/",a);if(u==null)return null;let p=mA(e),m=null,h=SA(u);for(let g=0;m==null&&g<p.length;++g)m=kA(p[g],h,o);return m}function mA(e){let t=Fk(e);return hA(t),t}function Fk(e,t=[],a=[],o="",l=!1){let c=(u,p,m=l,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(o)&&m)return;an(g.relativePath.startsWith(o),`Absolute route path "${g.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(o.length)}let b=Gs([o,g.relativePath]),v=a.concat(g);u.children&&u.children.length>0&&(an(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Fk(u.children,t,v,b,m)),!(u.path==null&&!u.index)&&t.push({path:b,score:jA(b,u.index),routesMeta:v.map((w,N)=>{let[y,j]=Kk(w.relativePath,w.caseSensitive,N===v.length-1);return{...w,matcher:y,compiledParams:j}})})};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 hA(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:wA(t.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var gA=/^:[\w-]+$/,xA=3,bA=2,_A=1,vA=10,yA=-2,J1=e=>e==="*";function jA(e,t){let a=e.split("/"),o=a.length;return a.some(J1)&&(o+=yA),t&&(o+=bA),a.filter(l=>!J1(l)).reduce((l,c)=>l+(gA.test(c)?xA:c===""?_A:vA),o)}function wA(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 kA(e,t,a=!1){let{routesMeta:o}=e,l={},c="/",u=[];for(let p=0;p<o.length;++p){let m=o[p],h=p===o.length-1,g=c==="/"?t:t.slice(c.length)||"/",b={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},v=m.matcher&&m.compiledParams?Yk(b,g,m.matcher,m.compiledParams):sf(b,g),w=m.route;if(!v&&h&&a&&!o[o.length-1].route.index&&(v=sf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!v)return null;Object.assign(l,v.params),u.push({params:l,pathname:Gs([c,v.pathname]),pathnameBase:EA(Gs([c,v.pathnameBase])),route:w}),v.pathnameBase!=="/"&&(c=Gs([c,v.pathnameBase]))}return u}function sf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,o]=Kk(e.path,e.caseSensitive,e.end);return Yk(e,t,a,o)}function Yk(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((h,{paramName:g,isOptional:b},v)=>{if(g==="*"){let N=p[v]||"";u=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const w=p[v];return b&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:u,pattern:e}}function Kk(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,h,g)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let b=g.charAt(h+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 SA(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 Ya(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 CA(e,t="/"){let{pathname:a,search:o="",hash:l=""}=typeof e=="string"?ei(e):e,c;return a?(a=Xk(a),a.startsWith("/")?c=ej(a.substring(1),"/"):c=ej(a,t)):c=t,{pathname:c,search:RA(o),hash:TA(l)}}function ej(e,t){let a=af(t).split("/");return e.split("/").forEach(l=>{l===".."?a.length>1&&a.pop():l!=="."&&a.push(l)}),a.length>1?a.join("/"):"/"}function $h(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 NA(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function Yx(e){let t=NA(e);return t.map((a,o)=>o===t.length-1?a.pathname:a.pathnameBase)}function Bf(e,t,a,o=!1){let l;typeof e=="string"?l=ei(e):(l={...e},an(!l.pathname||!l.pathname.includes("?"),$h("?","pathname","search",l)),an(!l.pathname||!l.pathname.includes("#"),$h("#","pathname","hash",l)),an(!l.search||!l.search.includes("#"),$h("#","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=CA(l,p),h=u&&u!=="/"&&u.endsWith("/"),g=(c||u===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Xk=e=>e.replace(/[\\/]{2,}/g,"/"),Gs=e=>Xk(e.join("/")),af=e=>e.replace(/\/+$/,""),EA=e=>af(e).replace(/^\/*/,"/"),RA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,AA=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 MA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function OA(e){let t=e.map(a=>a.route.path).filter(Boolean);return Gs(t)||"/"}var Qk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wk(e,t){let a=e;if(typeof a!="string"||!Gx.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,l=!1;if(Qk)try{let c=new URL(window.location.href),u=qk.test(a)?new URL(iA(a,c.protocol)):new URL(a),p=Ya(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 Zk=["POST","PUT","PATCH","DELETE"];new Set(Zk);var zA=["GET",...Zk];new Set(zA);var DA=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function LA(e){try{return DA.includes(new URL(e).protocol)}catch{return!1}}var ti=x.createContext(null);ti.displayName="DataRouter";var Uf=x.createContext(null);Uf.displayName="DataRouterState";var Jk=x.createContext(!1);function PA(){return x.useContext(Jk)}var eS=x.createContext({isTransitioning:!1});eS.displayName="ViewTransition";var IA=x.createContext(new Map);IA.displayName="Fetchers";var BA=x.createContext(null);BA.displayName="Await";var js=x.createContext(null);js.displayName="Navigation";var Qc=x.createContext(null);Qc.displayName="Location";var Xs=x.createContext({outlet:null,matches:[],isDataRoute:!1});Xs.displayName="Route";var Kx=x.createContext(null);Kx.displayName="RouteError";var tS="REACT_ROUTER_ERROR",UA="REDIRECT",$A="ROUTE_ERROR_RESPONSE";function HA(e){if(e.startsWith(`${tS}:${UA}:{`))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 qA(e){if(e.startsWith(`${tS}:${$A}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new AA(t.status,t.statusText,t.data)}catch{}}function VA(e,{relative:t}={}){an(ni(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:o}=x.useContext(js),{hash:l,pathname:c,search:u}=Wc(e,{relative:t}),p=c;return a!=="/"&&(p=c==="/"?a:Gs([a,c])),o.createHref({pathname:p,search:u,hash:l})}function ni(){return x.useContext(Qc)!=null}function es(){return an(ni(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Qc).location}var nS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function sS(e){x.useContext(js).static||x.useLayoutEffect(e)}function Ln(){let{isDataRoute:e}=x.useContext(Xs);return e?sM():FA()}function FA(){an(ni(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(ti),{basename:t,navigator:a}=x.useContext(js),{matches:o}=x.useContext(Xs),{pathname:l}=es(),c=JSON.stringify(Yx(o)),u=x.useRef(!1);return sS(()=>{u.current=!0}),x.useCallback((m,h={})=>{if(Ps(u.current,nS),!u.current)return;if(typeof m=="number"){a.go(m);return}let g=Bf(m,JSON.parse(c),l,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Gs([t,g.pathname])),(h.replace?a.replace:a.push)(g,h.state,h)},[t,a,c,l,e])}x.createContext(null);function aS(){let{matches:e}=x.useContext(Xs);return e[e.length-1]?.params??{}}function Wc(e,{relative:t}={}){let{matches:a}=x.useContext(Xs),{pathname:o}=es(),l=JSON.stringify(Yx(a));return x.useMemo(()=>Bf(e,JSON.parse(l),o,t==="path"),[e,l,o,t])}function GA(e,t){return rS(e,t)}function rS(e,t,a){an(ni(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(js),{matches:l}=x.useContext(Xs),c=l[l.length-1],u=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",h=c&&c.route;{let j=h&&h.path||"";lS(p,!h||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let g=es(),b;if(t){let j=typeof t=="string"?ei(t):t;an(m==="/"||j.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 "${j.pathname}" was given in the \`location\` prop.`),b=j}else b=g;let v=b.pathname||"/",w=v;if(m!=="/"){let j=m.replace(/^\//,"").split("/");w="/"+v.replace(/^\//,"").split("/").slice(j.length).join("/")}let N=a&&a.state.matches.length?a.state.matches.map(j=>Object.assign(j,{route:a.manifest[j.route.id]||j.route})):Vk(e,{pathname:w});Ps(h||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 y=WA(N&&N.map(j=>Object.assign({},j,{params:Object.assign({},u,j.params),pathname:Gs([m,o.encodeLocation?o.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?m:Gs([m,o.encodeLocation?o.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),l,a);return t&&y?x.createElement(Qc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},y):y}function YA(){let e=nM(),t=MA(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 KA=x.createElement(YA,null),oS=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=qA(e.digest);a&&(e=a)}let t=e!==void 0?x.createElement(Xs.Provider,{value:this.props.routeContext},x.createElement(Kx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(XA,{error:e},t):t}};oS.contextType=Jk;var Hh=new WeakMap;function XA({children:e,error:t}){let{basename:a}=x.useContext(js);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=HA(t.digest);if(o){let l=Hh.get(t);if(l)throw l;let c=Wk(o.location,a),u=c.absoluteURL||c.to;if(LA(u))throw new Error("Invalid redirect location");if(Qk&&!Hh.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 Hh.set(t,p),p}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function QA({routeContext:e,match:t,children:a}){let o=x.useContext(ti);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Xs.Provider,{value:e},a)}function WA(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 g=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);an(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,g+1))}let u=!1,p=-1;if(a&&o){u=o.renderFallback;for(let g=0;g<l.length;g++){let b=l[g];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=g),b.route.id){let{loaderData:v,errors:w}=o,N=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!w||w[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,h=o&&m?(g,b)=>{m(g,{location:o.location,params:o.matches?.[0]?.params??{},pattern:OA(o.matches),errorInfo:b})}:void 0;return l.reduceRight((g,b,v)=>{let w,N=!1,y=null,j=null;o&&(w=c&&b.route.id?c[b.route.id]:void 0,y=b.route.errorElement||KA,u&&(p<0&&v===0?(lS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,j=null):p===v&&(N=!0,j=b.route.hydrateFallbackElement||null)));let E=t.concat(l.slice(0,v+1)),S=()=>{let C;return w?C=y:N?C=j:b.route.Component?C=x.createElement(b.route.Component,null):b.route.element?C=b.route.element:C=g,x.createElement(QA,{match:b,routeContext:{outlet:g,matches:E,isDataRoute:o!=null},children:C})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?x.createElement(oS,{location:o.location,revalidation:o.revalidation,component:y,error:w,children:S(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):S()},null)}function Xx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZA(e){let t=x.useContext(ti);return an(t,Xx(e)),t}function JA(e){let t=x.useContext(Uf);return an(t,Xx(e)),t}function eM(e){let t=x.useContext(Xs);return an(t,Xx(e)),t}function Qx(e){let t=eM(e),a=t.matches[t.matches.length-1];return an(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function tM(){return Qx("useRouteId")}function nM(){let e=x.useContext(Kx),t=JA("useRouteError"),a=Qx("useRouteError");return e!==void 0?e:t.errors?.[a]}function sM(){let{router:e}=ZA("useNavigate"),t=Qx("useNavigate"),a=x.useRef(!1);return sS(()=>{a.current=!0}),x.useCallback(async(l,c={})=>{Ps(a.current,nS),a.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var tj={};function lS(e,t,a){!t&&!tj[e]&&(tj[e]=!0,Ps(!1,a))}x.memo(aM);function aM({routes:e,manifest:t,future:a,state:o,isStatic:l,onError:c}){return rS(e,void 0,{manifest:t,state:o,isStatic:l,onError:c})}function rM({to:e,replace:t,state:a,relative:o}){an(ni(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(js);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(Xs),{pathname:u}=es(),p=Ln(),m=Bf(e,Yx(c),u,o==="path"),h=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(h),{replace:t,state:a,relative:o})},[p,h,o,t,a]),null}function Pt(e){an(!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 oM({basename:e="/",children:t=null,location:a,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:u}){an(!ni(),"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=ei(a));let{pathname:h="/",search:g="",hash:b="",state:v=null,key:w="default",mask:N}=a,y=x.useMemo(()=>{let j=Ya(h,p);return j==null?null:{location:{pathname:j,search:g,hash:b,state:v,key:w,mask:N},navigationType:o}},[p,h,g,b,v,w,o,N]);return Ps(y!=null,`<Router basename="${p}"> is not able to match the URL "${h}${g}${b}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:x.createElement(js.Provider,{value:m},x.createElement(Qc.Provider,{children:t,value:y}))}function iS({children:e,location:t}){return GA(ex(e),t)}function ex(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,ex(o.props.children,c));return}an(o.type===Pt,`[${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>`),an(!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=ex(o.props.children,c)),a.push(u)}),a}var Xd="get",Qd="application/x-www-form-urlencoded";function $f(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lM(e){return $f(e)&&e.tagName.toLowerCase()==="button"}function iM(e){return $f(e)&&e.tagName.toLowerCase()==="form"}function cM(e){return $f(e)&&e.tagName.toLowerCase()==="input"}function uM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function dM(e,t){return e.button===0&&(!t||t==="_self")&&!uM(e)}function tx(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 fM(e,t){let a=tx(e);return t&&t.forEach((o,l)=>{a.has(l)||t.getAll(l).forEach(c=>{a.append(l,c)})}),a}var yd=null;function pM(){if(yd===null)try{new FormData(document.createElement("form"),0),yd=!1}catch{yd=!0}return yd}var mM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qh(e){return e!=null&&!mM.has(e)?(Ps(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qd}"`),null):e}function hM(e,t){let a,o,l,c,u;if(iM(e)){let p=e.getAttribute("action");o=p?Ya(p,t):null,a=e.getAttribute("method")||Xd,l=qh(e.getAttribute("enctype"))||Qd,c=new FormData(e)}else if(lM(e)||cM(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?Ya(m,t):null,a=e.getAttribute("formmethod")||p.getAttribute("method")||Xd,l=qh(e.getAttribute("formenctype"))||qh(p.getAttribute("enctype"))||Qd,c=new FormData(p,e),!pM()){let{name:h,type:g,value:b}=e;if(g==="image"){let v=h?`${h}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else h&&c.append(h,b)}}else{if($f(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Xd,o=null,l=Qd,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 Wx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function cS(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&&Ya(l.pathname,t)==="/"?l.pathname=`${af(t)}/_root.${o}`:l.pathname=`${af(l.pathname)}.${o}`,l}async function gM(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 xM(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 bM(e,t,a){let o=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let u=await gM(c,a);return u.links?u.links():[]}return[]}));return jM(o.flat(1).filter(xM).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function nj(e,t,a,o,l,c){let u=(m,h)=>a[h]?m.route.id!==a[h].route.id:!0,p=(m,h)=>a[h].pathname!==m.pathname||a[h].route.path?.endsWith("*")&&a[h].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,h)=>u(m,h)||p(m,h)):c==="data"?t.filter((m,h)=>{let g=o.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(u(m,h)||p(m,h))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 _M(e,t,{includeHydrateFallback:a}={}){return vM(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 vM(e){return[...new Set(e)]}function yM(e){let t={},a=Object.keys(e).sort();for(let o of a)t[o]=e[o];return t}function jM(e,t){let a=new Set;return new Set(t),e.reduce((o,l)=>{let c=JSON.stringify(yM(l));return a.has(c)||(a.add(c),o.push({key:c,link:l})),o},[])}function Zx(){let e=x.useContext(ti);return Wx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function wM(){let e=x.useContext(Uf);return Wx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Jx=x.createContext(void 0);Jx.displayName="FrameworkContext";function Hf(){let e=x.useContext(Jx);return Wx(e,"You must render this element inside a <HydratedRouter> element"),e}function kM(e,t){let a=x.useContext(Jx),[o,l]=x.useState(!1),[c,u]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:b}=t,v=x.useRef(null);x.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let y=E=>{E.forEach(S=>{u(S.isIntersecting)})},j=new IntersectionObserver(y,{threshold:.5});return v.current&&j.observe(v.current),()=>{j.disconnect()}}},[e]),x.useEffect(()=>{if(o){let y=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(y)}}},[o]);let w=()=>{l(!0)},N=()=>{l(!1),u(!1)};return a?e!=="intent"?[c,v,{}]:[c,v,{onFocus:sc(p,w),onBlur:sc(m,N),onMouseEnter:sc(h,w),onMouseLeave:sc(g,N),onTouchStart:sc(b,w)}]:[!1,v,{}]}function sc(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function SM({page:e,...t}){let a=PA(),{nonce:o}=Hf(),{router:l}=Zx(),c=x.useMemo(()=>Vk(l.routes,e,l.basename),[l.routes,e,l.basename]);return c?(t.nonce==null&&o&&(t={...t,nonce:o}),a?x.createElement(NM,{page:e,matches:c,...t}):x.createElement(EM,{page:e,matches:c,...t})):null}function CM(e){let{manifest:t,routeModules:a}=Hf(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return bM(e,t,a).then(u=>{c||l(u)}),()=>{c=!0}},[e,t,a]),o}function NM({page:e,matches:t,...a}){let o=es(),{future:l}=Hf(),{basename:c}=Zx(),u=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=cS(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?m=!0:h.push(g.route.id);return m&&h.length>0&&p.searchParams.set("_routes",h.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 EM({page:e,matches:t,...a}){let o=es(),{future:l,manifest:c,routeModules:u}=Hf(),{basename:p}=Zx(),{loaderData:m,matches:h}=wM(),g=x.useMemo(()=>nj(e,t,h,c,o,"data"),[e,t,h,c,o]),b=x.useMemo(()=>nj(e,t,h,c,o,"assets"),[e,t,h,c,o]),v=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let y=new Set,j=!1;if(t.forEach(S=>{let C=c.routes[S.route.id];!C||!C.hasLoader||(!g.some(R=>R.route.id===S.route.id)&&S.route.id in m&&u[S.route.id]?.shouldRevalidate||C.hasClientLoader?j=!0:y.add(S.route.id))}),y.size===0)return[];let E=cS(e,p,l.v8_trailingSlashAwareDataRequests,"data");return j&&y.size>0&&E.searchParams.set("_routes",t.filter(S=>y.has(S.route.id)).map(S=>S.route.id).join(",")),[E.pathname+E.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,g,t,e,u]),w=x.useMemo(()=>_M(b,c),[b,c]),N=CM(b);return x.createElement(x.Fragment,null,v.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...a})),w.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...a})),N.map(({key:y,link:j})=>x.createElement("link",{key:y,nonce:a.nonce,...j,crossOrigin:j.crossOrigin??a.crossOrigin})))}function RM(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var TM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{TM&&(window.__reactRouterVersion="7.18.1")}catch{}function AM({basename:e,children:t,useTransitions:a,window:o}){let l=x.useRef();l.current==null&&(l.current=cA({window:o,v5Compat:!0}));let c=l.current,[u,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(h=>{a===!1?p(h):x.startTransition(()=>p(h))},[a]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(oM,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:a})}var qf=x.forwardRef(function({onClick:t,discover:a="render",prefetch:o="none",relative:l,reloadDocument:c,replace:u,mask:p,state:m,target:h,to:g,preventScrollReset:b,viewTransition:v,defaultShouldRevalidate:w,...N},y){let{basename:j,navigator:E,useTransitions:S}=x.useContext(js),C=typeof g=="string"&&Gx.test(g),R=Wk(g,j);g=R.to;let M=VA(g,{relative:l}),T=es(),O=null;if(p){let V=Bf(p,[],T.mask?T.mask.pathname:"/",!0);j!=="/"&&(V.pathname=V.pathname==="/"?j:Gs([j,V.pathname])),O=E.createHref(V)}let[D,B,L]=kM(o,N),U=zM(g,{replace:u,mask:p,state:m,target:h,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:w,useTransitions:S});function z(V){t&&t(V),V.defaultPrevented||U(V)}let P=!(R.isExternal||c),$=x.createElement("a",{...N,...L,href:(P?O:void 0)||R.absoluteURL||M,onClick:P?z:t,ref:RM(y,B),target:h,"data-discover":!C&&a==="render"?"true":void 0});return D&&!C?x.createElement(x.Fragment,null,$,x.createElement(SM,{page:M})):$});qf.displayName="Link";var rf=x.forwardRef(function({"aria-current":t="page",caseSensitive:a=!1,className:o="",end:l=!1,style:c,to:u,viewTransition:p,children:m,...h},g){let b=Wc(u,{relative:h.relative}),v=es(),w=x.useContext(Uf),{navigator:N,basename:y}=x.useContext(js),j=w!=null&&BM(b)&&p===!0,E=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,S=v.pathname,C=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;a||(S=S.toLowerCase(),C=C?C.toLowerCase():null,E=E.toLowerCase()),C&&y&&(C=Ya(C,y)||C);const R=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let M=S===E||!l&&S.startsWith(E)&&S.charAt(R)==="/",T=C!=null&&(C===E||!l&&C.startsWith(E)&&C.charAt(E.length)==="/"),O={isActive:M,isPending:T,isTransitioning:j},D=M?t:void 0,B;typeof o=="function"?B=o(O):B=[o,M?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(O):c;return x.createElement(qf,{...h,"aria-current":D,className:B,ref:g,style:L,to:u,viewTransition:p},typeof m=="function"?m(O):m)});rf.displayName="NavLink";var MM=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:a,reloadDocument:o,replace:l,state:c,method:u=Xd,action:p,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v,...w},N)=>{let{useTransitions:y}=x.useContext(js),j=PM(),E=IM(p,{relative:h}),S=u.toLowerCase()==="get"?"get":"post",C=typeof p=="string"&&Gx.test(p),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let T=M.nativeEvent.submitter,O=T?.getAttribute("formmethod")||u,D=()=>j(T||M.currentTarget,{fetcherKey:t,method:O,navigate:a,replace:l,state:c,relative:h,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v});y&&a!==!1?x.startTransition(()=>D()):D()};return x.createElement("form",{ref:N,method:S,action:E,onSubmit:o?m:R,...w,"data-discover":!C&&e==="render"?"true":void 0})});MM.displayName="Form";function OM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uS(e){let t=x.useContext(ti);return an(t,OM(e)),t}function zM(e,{target:t,replace:a,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m,useTransitions:h}={}){let g=Ln(),b=es(),v=Wc(e,{relative:u});return x.useCallback(w=>{if(dM(w,t)){w.preventDefault();let N=a!==void 0?a:Lc(b)===Lc(v),y=()=>g(e,{replace:N,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m});h?x.startTransition(()=>y()):y()}},[b,g,v,a,o,l,t,e,c,u,p,m,h])}function si(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(tx(e)),a=x.useRef(!1),o=es(),l=x.useMemo(()=>fM(o.search,a.current?null:t.current),[o.search]),c=Ln(),u=x.useCallback((p,m)=>{const h=tx(typeof p=="function"?p(new URLSearchParams(l)):p);a.current=!0,c("?"+h,m)},[c,l]);return[l,u]}var DM=0,LM=()=>`__${String(++DM)}__`;function PM(){let{router:e}=uS("useSubmit"),{basename:t}=x.useContext(js),a=tM(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,u={})=>{let{action:p,method:m,encType:h,formData:g,body:b}=hM(c,t);if(u.navigate===!1){let v=u.fetcherKey||LM();await o(v,a,u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:b,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await l(u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:b,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:a,flushSync:u.flushSync,viewTransition:u.viewTransition})},[o,l,t,a])}function IM(e,{relative:t}={}){let{basename:a}=x.useContext(js),o=x.useContext(Xs);an(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Wc(e||".",{relative:t})},u=es();if(e==null){c.search=u.search;let p=new URLSearchParams(c.search),m=p.getAll("index");if(m.some(g=>g==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let g=p.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:Gs([a,c.pathname])),Lc(c)}function BM(e,{relative:t}={}){let a=x.useContext(eS);an(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=uS("useViewTransitionState"),l=Wc(e,{relative:t});if(!a.isTransitioning)return!1;let c=Ya(a.currentLocation.pathname,o)||a.currentLocation.pathname,u=Ya(a.nextLocation.pathname,o)||a.nextLocation.pathname;return sf(l.pathname,u)!=null||sf(l.pathname,c)!=null}var Is=Hk();/**
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 UM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dS=(...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 $M={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 HM=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,...$M,width:t,height:t,stroke:e,strokeWidth:o?Number(a)*24/Number(t):a,className:dS("lucide",l),...p},[...u.map(([h,g])=>x.createElement(h,g)),...Array.isArray(c)?c:[c]]));/**
76
+ * @license lucide-react v0.469.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const je=(e,t)=>{const a=x.forwardRef(({className:o,...l},c)=>x.createElement(HM,{ref:c,iconNode:t,className:dS(`lucide-${UM(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 eb=je("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.469.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const fS=je("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
91
+ * @license lucide-react v0.469.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const qM=je("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.469.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const pS=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.469.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const mS=je("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
106
+ * @license lucide-react v0.469.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const VM=je("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
+ * @license lucide-react v0.469.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const FM=je("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 GM=je("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 rn=je("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
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 YM=je("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
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 KM=je("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
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 of=je("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
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 hS=je("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
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 XM=je("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
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 Lr=je("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 Bs=je("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 QM=je("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 Do=je("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 tb=je("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 WM=je("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
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 nb=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 ZM=je("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
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 JM=je("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["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"}]]);/**
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 gS=je("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
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 e3=je("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
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 xS=je("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
211
+ * @license lucide-react v0.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 t3=je("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 n3=je("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
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 s3=je("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"}]]);/**
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 Pc=je("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
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 a3=je("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 r3=je("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 sb=je("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
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 pa=je("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
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 bS=je("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
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 o3=je("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
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 l3=je("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
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 i3=je("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
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 c3=je("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
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 Vf=je("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 lf=je("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
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 u3=je("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
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 cf=je("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
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 nx=je("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
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 d3=je("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
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 f3=je("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
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 ab=je("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
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 p3=je("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
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 _S=je("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
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 vS=je("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
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 m3=je("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
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 rb=je("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
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 ai=je("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
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 ob=je("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
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 yS=je("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
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 h3=je("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"}]]);/**
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 Ff=je("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 g3=je("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
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 lb=je("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
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 x3=je("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
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 b3=je("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
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 _3=je("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
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 jo=je("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
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 v3=je("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
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 y3=je("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
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 j3=je("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
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 jS=je("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 sx=je("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
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 w3=je("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"}]]);/**
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 k3=je("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
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 S3=je("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
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 C3=je("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
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 N3=je("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
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 Zc=je("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 wS=je("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
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 ib=je("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
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 uf=je("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
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 kS=je("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
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 cb=je("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
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 E3=je("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 R3=je("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
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 SS=je("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 T3=je("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 ga=je("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
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 ub=je("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 A3=je("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
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 Kt=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 ax=je("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
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 M3=je("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
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 Ys=je("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
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 ri=je("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
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 oi=je("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
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 df=je("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
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 Ec=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Qs=je("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
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 CS=je("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
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 O3=je("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
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 Ic=je("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 z3=je("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 er=je("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
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 D3=je("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
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 NS=je("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 L3=je("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
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 Ka=je("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
601
+ * @license lucide-react v0.469.0 - ISC
602
+ *
603
+ * This source code is licensed under the ISC license.
604
+ * See the LICENSE file in the root directory of this source tree.
605
+ */const P3=je("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"}]]);/**
606
+ * @license lucide-react v0.469.0 - ISC
607
+ *
608
+ * This source code is licensed under the ISC license.
609
+ * See the LICENSE file in the root directory of this source tree.
610
+ */const wn=je("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
611
+ * @license lucide-react v0.469.0 - ISC
612
+ *
613
+ * This source code is licensed under the ISC license.
614
+ * See the LICENSE file in the root directory of this source tree.
615
+ */const ES=je("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
616
+ * @license lucide-react v0.469.0 - ISC
617
+ *
618
+ * This source code is licensed under the ISC license.
619
+ * See the LICENSE file in the root directory of this source tree.
620
+ */const I3=je("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
621
+ * @license lucide-react v0.469.0 - ISC
622
+ *
623
+ * This source code is licensed under the ISC license.
624
+ * See the LICENSE file in the root directory of this source tree.
625
+ */const db=je("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
626
+ * @license lucide-react v0.469.0 - ISC
627
+ *
628
+ * This source code is licensed under the ISC license.
629
+ * See the LICENSE file in the root directory of this source tree.
630
+ */const B3=je("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
631
+ * @license lucide-react v0.469.0 - ISC
632
+ *
633
+ * This source code is licensed under the ISC license.
634
+ * See the LICENSE file in the root directory of this source tree.
635
+ */const U3=je("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
636
+ * @license lucide-react v0.469.0 - ISC
637
+ *
638
+ * This source code is licensed under the ISC license.
639
+ * See the LICENSE file in the root directory of this source tree.
640
+ */const li=je("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
641
+ * @license lucide-react v0.469.0 - ISC
642
+ *
643
+ * This source code is licensed under the ISC license.
644
+ * See the LICENSE file in the root directory of this source tree.
645
+ */const Us=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
646
+ * @license lucide-react v0.469.0 - ISC
647
+ *
648
+ * This source code is licensed under the ISC license.
649
+ * See the LICENSE file in the root directory of this source tree.
650
+ */const Hl=je("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Gf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},On={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},fb=["total","automatico","permiso"],sj=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],$3={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 H3(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Vh(e){return e==="system"?H3()?"dark":"light":e}function aj(){if(typeof window>"u")return"dark";const e=localStorage.getItem(On.theme);return e==="light"||e==="dark"||e==="system"?e:"dark"}const RS=x.createContext(null);function q3({children:e}){const[t,a]=x.useState(aj),[o,l]=x.useState(()=>Vh(aj()));x.useEffect(()=>{const p=()=>{const m=Vh(t);l(m),document.documentElement.classList.toggle("dark",m==="dark")};p();try{localStorage.setItem(On.theme,t)}catch{}if(t==="system"&&typeof window.matchMedia=="function"){const m=window.matchMedia("(prefers-color-scheme: dark)");return m.addEventListener("change",p),()=>m.removeEventListener("change",p)}},[t]);const c=x.useCallback(()=>{a(p=>Vh(p)==="dark"?"light":"dark")},[]),u=x.useMemo(()=>({theme:o,preference:t,toggle:c,set:a}),[o,t,c]);return s.jsx(RS.Provider,{value:u,children:e})}function pb(){const e=x.useContext(RS);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const V3=1367/458,F3=735/1016;function G3({size:e=32,title:t="APX",variant:a="icon"}){const{theme:o}=pb(),l=$3[a][o];if(a==="full"){const c=e,u=Math.round(e*V3);return s.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/F3);return s.jsx("img",{src:l,alt:t,width:c,height:u,className:"block object-contain",draggable:!1})}return s.jsx("img",{src:l,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function TS(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=TS(e[t]))&&(o&&(o+=" "),o+=a)}else for(a in e)e[a]&&(o&&(o+=" "),o+=a);return o}function Bc(){for(var e,t,a=0,o="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=TS(e))&&(o&&(o+=" "),o+=t);return o}const mb="-",Y3=e=>{const t=X3(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const p=u.split(mb);return p[0]===""&&p.length!==1&&p.shift(),AS(p,t)||K3(u)},getConflictingClassGroupIds:(u,p)=>{const m=a[u]||[];return p&&o[u]?[...m,...o[u]]:m}}},AS=(e,t)=>{if(e.length===0)return t.classGroupId;const a=e[0],o=t.nextPart.get(a),l=o?AS(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const c=e.join(mb);return t.validators.find(({validator:u})=>u(c))?.classGroupId},rj=/^\[(.+)\]$/,K3=e=>{if(rj.test(e)){const t=rj.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},X3=e=>{const{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return W3(Object.entries(e.classGroups),a).forEach(([c,u])=>{rx(u,o,c,t)}),o},rx=(e,t,a,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?t:oj(t,l);c.classGroupId=a;return}if(typeof l=="function"){if(Q3(l)){rx(l(o),t,a,o);return}t.validators.push({validator:l,classGroupId:a});return}Object.entries(l).forEach(([c,u])=>{rx(u,oj(t,c),a,o)})})},oj=(e,t)=>{let a=e;return t.split(mb).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Q3=e=>e.isThemeGetter,W3=(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,Z3=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)}}},MS="!",J3=e=>{const{separator:t,experimentalParseClassName:a}=e,o=t.length===1,l=t[0],c=t.length,u=p=>{const m=[];let h=0,g=0,b;for(let j=0;j<p.length;j++){let E=p[j];if(h===0){if(E===l&&(o||p.slice(j,j+c)===t)){m.push(p.slice(g,j)),g=j+c;continue}if(E==="/"){b=j;continue}}E==="["?h++:E==="]"&&h--}const v=m.length===0?p:p.substring(g),w=v.startsWith(MS),N=w?v.substring(1):v,y=b&&b>g?b-g:void 0;return{modifiers:m,hasImportantModifier:w,baseClassName:N,maybePostfixModifierPosition:y}};return a?p=>a({className:p,parseClassName:u}):u},e5=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},t5=e=>({cache:Z3(e.cacheSize),parseClassName:J3(e),...Y3(e)}),n5=/\s+/,s5=(e,t)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:l}=t,c=[],u=e.trim().split(n5);let p="";for(let m=u.length-1;m>=0;m-=1){const h=u[m],{modifiers:g,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:w}=a(h);let N=!!w,y=o(N?v.substring(0,w):v);if(!y){if(!N){p=h+(p.length>0?" "+p:p);continue}if(y=o(v),!y){p=h+(p.length>0?" "+p:p);continue}N=!1}const j=e5(g).join(":"),E=b?j+MS:j,S=E+y;if(c.includes(S))continue;c.push(S);const C=l(y,N);for(let R=0;R<C.length;++R){const M=C[R];c.push(E+M)}p=h+(p.length>0?" "+p:p)}return p};function a5(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=OS(t))&&(o&&(o+=" "),o+=a);return o}const OS=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=OS(e[o]))&&(a&&(a+=" "),a+=t);return a};function r5(e,...t){let a,o,l,c=u;function u(m){const h=t.reduce((g,b)=>b(g),e());return a=t5(h),o=a.cache.get,l=a.cache.set,c=p,p(m)}function p(m){const h=o(m);if(h)return h;const g=s5(m,a);return l(m,g),g}return function(){return c(a5.apply(null,arguments))}}const nn=e=>{const t=a=>a[e]||[];return t.isThemeGetter=!0,t},zS=/^\[(?:([a-z-]+):)?(.+)\]$/i,o5=/^\d+\/\d+$/,l5=new Set(["px","full","screen"]),i5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,c5=/\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$/,u5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,d5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,f5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>Ol(e)||l5.has(e)||o5.test(e),Sr=e=>ii(e,"length",v5),Ol=e=>!!e&&!Number.isNaN(Number(e)),Fh=e=>ii(e,"number",Ol),ac=e=>!!e&&Number.isInteger(Number(e)),p5=e=>e.endsWith("%")&&Ol(e.slice(0,-1)),ht=e=>zS.test(e),Cr=e=>i5.test(e),m5=new Set(["length","size","percentage"]),h5=e=>ii(e,m5,DS),g5=e=>ii(e,"position",DS),x5=new Set(["image","url"]),b5=e=>ii(e,x5,j5),_5=e=>ii(e,"",y5),rc=()=>!0,ii=(e,t,a)=>{const o=zS.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},v5=e=>c5.test(e)&&!u5.test(e),DS=()=>!1,y5=e=>d5.test(e),j5=e=>f5.test(e),w5=()=>{const e=nn("colors"),t=nn("spacing"),a=nn("blur"),o=nn("brightness"),l=nn("borderColor"),c=nn("borderRadius"),u=nn("borderSpacing"),p=nn("borderWidth"),m=nn("contrast"),h=nn("grayscale"),g=nn("hueRotate"),b=nn("invert"),v=nn("gap"),w=nn("gradientColorStops"),N=nn("gradientColorStopPositions"),y=nn("inset"),j=nn("margin"),E=nn("opacity"),S=nn("padding"),C=nn("saturate"),R=nn("scale"),M=nn("sepia"),T=nn("skew"),O=nn("space"),D=nn("translate"),B=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",ht,t],z=()=>[ht,t],P=()=>["",Ua,Sr],$=()=>["auto",Ol,ht],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],X=()=>["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",ht],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Ol,ht];return{cacheSize:500,separator:":",theme:{colors:[rc],spacing:[Ua,Sr],blur:["none","",Cr,ht],brightness:I(),borderColor:[e],borderRadius:["none","","full",Cr,ht],borderSpacing:z(),borderWidth:P(),contrast:I(),grayscale:F(),hueRotate:I(),invert:F(),gap:z(),gradientColorStops:[e],gradientColorStopPositions:[p5,Sr],inset:U(),margin:U(),opacity:I(),padding:z(),saturate:I(),scale:I(),sepia:F(),skew:I(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",ht]}],container:["container"],columns:[{columns:[Cr]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"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:[...V(),ht]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ac,ht]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ht]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",ac,ht]}],"grid-cols":[{"grid-cols":[rc]}],"col-start-end":[{col:["auto",{span:["full",ac,ht]},ht]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[rc]}],"row-start-end":[{row:["auto",{span:[ac,ht]},ht]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ht]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ht]}],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:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ht,t]}],"min-w":[{"min-w":[ht,t,"min","max","fit"]}],"max-w":[{"max-w":[ht,t,"none","full","min","max","fit","prose",{screen:[Cr]},Cr]}],h:[{h:[ht,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ht,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ht,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ht,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Cr,Sr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Fh]}],"font-family":[{font:[rc]}],"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",ht]}],"line-clamp":[{"line-clamp":["none",Ol,Fh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ua,ht]}],"list-image":[{"list-image":["none",ht]}],"list-style-type":[{list:["none","disc","decimal",ht]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ua,Sr]}],"underline-offset":[{"underline-offset":["auto",Ua,ht]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ht]}],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",ht]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),g5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",h5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},b5]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],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":[E]}],"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":[E]}],"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":[Ua,ht]}],"outline-w":[{outline:[Ua,Sr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Ua,Sr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Cr,_5]}],"shadow-color":[{shadow:[rc]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Cr,ht]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[b]}],saturate:[{saturate:[C]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"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",ht]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",ht]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",ht]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[ac,ht]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"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",ht]}],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",ht]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ht]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ua,Sr,Fh]}],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"]}}},LS=r5(w5);function ke(...e){return LS(Bc(e))}const lj={};function Jn(e,t){const a=x.useRef(lj);return a.current===lj&&(a.current=e(t)),a}const ox=[];let lx;function k5(){return lx}function S5(e){ox.push(e)}function hb(e){const t=(a,o)=>{const l=Jn(C5).current;let c;try{lx=l;for(const u of ox)u.before(l);c=e(a,o);for(const u of ox)u.after(l);l.didInitialize=!0}finally{lx=void 0}return c};return t.displayName=e.displayName||e.name,t}function PS(e){return x.forwardRef(hb(e))}function C5(){return{didInitialize:!1}}const N5=()=>{},ze=typeof document<"u"?x.useLayoutEffect:N5;function E5(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 on=E5("https://base-ui.com/production-error","Base UI"),IS=x.createContext(void 0);function Jc(e){const t=x.useContext(IS);if(t===void 0&&!e)throw new Error(on(72));return t}const R5=[];function gb(e){x.useEffect(e,R5)}const oc=0;class Ks{static create(){return new Ks}currentId=oc;start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=oc,a()},t)}isStarted(){return this.currentId!==oc}clear=()=>{this.currentId!==oc&&(clearTimeout(this.currentId),this.currentId=oc)};disposeEffect=()=>this.clear}function Nn(){const e=Jn(Ks.create).current;return gb(e.disposeEffect),e}function T5(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:A5,platform:M5,maxTouchPoints:O5}=T5(),Yf=A5.toLowerCase(),Uc=M5.toLowerCase(),Kf=/^i(os$|p)/.test(Uc)||Uc==="macintel"&&O5>1,ij="android",ix=Uc===ij||Yf.includes(ij),xb=!Kf&&Uc.startsWith("mac");Uc.startsWith("win");const z5=xb||Kf,Br=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Br&&Yf.includes("firefox");!Br&&Yf.includes("chrom");const D5=z5,bb=/jsdom|happydom/.test(Yf);function aa(e){e.preventDefault(),e.stopPropagation()}function L5(e){return"nativeEvent"in e}function _b(e){return e.pointerType===""&&e.isTrusted?!0:ix&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function BS(e){return bb?!1:!ix&&e.width===0&&e.height===0||ix&&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 wo(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function P5(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Xf(){return typeof window<"u"}function Vn(e){return vb(e)?(e.nodeName||"").toLowerCase():"#document"}function Qt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xa(e){var t;return(t=(vb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vb(e){return Xf()?e instanceof Node||e instanceof Qt(e).Node:!1}function bt(e){return Xf()?e instanceof Element||e instanceof Qt(e).Element:!1}function Vt(e){return Xf()?e instanceof HTMLElement||e instanceof Qt(e).HTMLElement:!1}function ql(e){return!Xf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qt(e).ShadowRoot}function Ur(e){const{overflow:t,overflowX:a,overflowY:o,display:l}=fs(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&l!=="inline"&&l!=="contents"}function I5(e){return/^(table|td|th)$/.test(Vn(e))}function Qf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const B5=/transform|translate|scale|rotate|perspective|filter/,U5=/paint|layout|strict|content/,uo=e=>!!e&&e!=="none";let Gh;function yb(e){const t=bt(e)?fs(e):e;return uo(t.transform)||uo(t.translate)||uo(t.scale)||uo(t.rotate)||uo(t.perspective)||!jb()&&(uo(t.backdropFilter)||uo(t.filter))||B5.test(t.willChange||"")||U5.test(t.contain||"")}function $5(e){let t=ma(e);for(;Vt(t)&&!ua(t);){if(yb(t))return t;if(Qf(t))return null;t=ma(t)}return null}function jb(){return Gh==null&&(Gh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gh}function ua(e){return/^(html|body|#document)$/.test(Vn(e))}function fs(e){return Qt(e).getComputedStyle(e)}function Wf(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ma(e){if(Vn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ql(e)&&e.host||xa(e);return ql(t)?t.host:t}function US(e){const t=ma(e);return ua(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Ur(t)?t:US(t)}function $c(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const l=US(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),u=Qt(l);if(c){const p=cx(u);return t.concat(u,u.visualViewport||[],Ur(l)?l:[],p&&a?$c(p):[])}else return t.concat(l,$c(l,[],a))}function cx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const ux="data-base-ui-focusable",$S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Zf="ArrowLeft",Jf="ArrowRight",HS="ArrowUp",wb="ArrowDown";function Gn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function We(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&ql(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function qn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ff(e,t){if(!bt(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(We(o,a))return!o.hasAttribute("data-trigger-disabled");return!1}function Yh(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 H5(e){return e.matches("html,body")}function ep(e){return Vt(e)&&e.matches($S)}function q5(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${$S}`)!=null}function dx(e){return e?e.getAttribute("role")==="combobox"&&ep(e):!1}function V5(e){if(!e||bb)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function pf(e){return e?e.hasAttribute(ux)?e:e.querySelector(`[${ux}]`)||e:null}function F5(e,t){return t!=null&&!wo(t)?0:typeof e=="function"?e():e}function Vl(e,t,a){const o=F5(e,a);return typeof o=="number"?o:o?.[t]}function cj(e){return typeof e=="function"?e():e}function qS(e,t){return t||e==="click"||e==="mousedown"}function G5(e){return e?.includes("mouse")&&e!=="mousedown"}function An(){}const Xa=Object.freeze([]),Yt=Object.freeze({}),ha="none",ci="trigger-press",Mn="trigger-hover",zl="trigger-focus",tp="outside-press",Dl="item-press",Y5="close-press",ko="focus-out",np="escape-key",fx="list-navigation",VS="cancel-open",bc="sibling-open",FS="disabled",uj="missing",dj="initial",kb="imperative-action",K5="window-resize";function st(e,t,a,o){let l=!1,c=!1;const u=o??Yt;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 Ks,currentIdRef:{current:null},currentContextRef:{current:null}});function X5(e,t){e.current=t.current}function Q5(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=Nn();return ze(()=>{if(c.current=a,!u.current){l.current=a;return}l.current={open:Vl(l.current,"open"),close:Vl(a,"close")}},[a,u,l,c]),s.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 W5(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:h,currentContextRef:g,hasProvider:b,timeout:v}=c,[w,N]=x.useState(!1),y=x.useRef(a),j=x.useRef(!1);return ze(()=>{y.current=a},[a]),ze(()=>()=>{j.current=!0},[]),ze(()=>{function E(){j.current||N(!1),g.current?.setIsInstantPhase(!1),u.current=null,g.current=null,p.current=h.current,v.clear()}if(u.current&&!a&&u.current===l){if(N(!1),m){const S=l;return v.start(m,()=>{o.select("open")||u.current&&u.current!==S||E()}),()=>{(y.current||u.current!==S)&&v.clear()}}E()}},[a,l,u,p,m,h,g,v,o]),ze(()=>{if(!a)return;const E=g.current,S=u.current;v.clear(),g.current={onOpenChange:o.setOpen,setIsInstantPhase:N},u.current=l,p.current={open:0,close:Vl(h.current,"close")},S!==null&&S!==l?(N(!0),E?.setIsInstantPhase(!0),E?.onOpenChange(!1,st(ha))):(N(!1),E?.setIsInstantPhase(!1))},[a,l,o,u,p,h,g,v]),ze(()=>()=>{if(u.current===l){if(g.current=null,!y.current)return;u.current=null,X5(p,h),v.clear()}},[g,u,p,l,h,v]),x.useMemo(()=>({hasProvider:b,delayRef:p,isInstantPhase:w}),[b,p,w])}function _t(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function da(...e){return()=>{for(let t=0;t<e.length;t+=1){const a=e[t];a&&a()}}}function Qa(e,t,a,o){const l=Jn(YS).current;return J5(l,e,t,a,o)&&KS(l,[e,t,a,o]),l.callback}function Z5(e){const t=Jn(YS).current;return eO(t,e)&&KS(t,e),t.callback}function YS(){return{callback:null,cleanup:null,refs:[]}}function J5(e,t,a,o,l){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==l}function eO(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function KS(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 fn(e){const t=Jn(tO,e).current;return t.next=e,ze(t.effect),t}function tO(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Sb={...eA},Kh=Sb.useInsertionEffect,nO=Kh&&Kh!==Sb.useLayoutEffect?Kh:e=>e();function Ue(e){const t=Jn(sO).current;return t.next=e,nO(t.effect),t.trampoline}function sO(){const e={next:void 0,callback:aO,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function aO(){}const jd=null;class rO{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 wd=new rO;class oa{static create(){return new oa}static request(t){return wd.request(t)}static cancel(t){return wd.cancel(t)}currentId=jd;request(t){this.cancel(),this.currentId=wd.request(()=>{this.currentId=jd,t()})}cancel=()=>{this.currentId!==jd&&(wd.cancel(this.currentId),this.currentId=jd)};disposeEffect=()=>this.cancel}function Fl(){const e=Jn(oa.create).current;return gb(e.disposeEffect),e}function xt(e){return e?.ownerDocument||document}const XS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Cb={...XS,position:"fixed",top:0,left:0},QS={...XS,position:"absolute"},Gl=x.forwardRef(function(t,a){const[o,l]=x.useState();ze(()=>{D5&&Br&&l("button")},[]);const c={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Cb,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),oO=["top","right","bottom","left"],Yl=Math.min,ys=Math.max,mf=Math.round,kd=Math.floor,fa=e=>({x:e,y:e}),lO={left:"right",right:"left",bottom:"top",top:"bottom"};function px(e,t,a){return ys(e,Yl(t,a))}function Wa(e,t){return typeof e=="function"?e(t):e}function ds(e){return e.split("-")[0]}function $r(e){return e.split("-")[1]}function Nb(e){return e==="x"?"y":"x"}function Eb(e){return e==="y"?"height":"width"}function Ds(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Rb(e){return Nb(Ds(e))}function iO(e,t,a){a===void 0&&(a=!1);const o=$r(e),l=Rb(e),c=Eb(l);let u=l==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=hf(u)),[u,hf(u)]}function cO(e){const t=hf(e);return[mx(e),t,mx(t)]}function mx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const fj=["left","right"],pj=["right","left"],uO=["top","bottom"],dO=["bottom","top"];function fO(e,t,a){switch(e){case"top":case"bottom":return a?t?pj:fj:t?fj:pj;case"left":case"right":return t?uO:dO;default:return[]}}function pO(e,t,a,o){const l=$r(e);let c=fO(ds(e),a==="start",o);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map(mx)))),c}function hf(e){const t=ds(e);return lO[t]+e.slice(t.length)}function mO(e){return{top:0,right:0,bottom:0,left:0,...e}}function WS(e){return typeof e!="number"?mO(e):{top:e,right:e,bottom:e,left:e}}function Hc(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 Rc(e,t){return t<0||t>=e.length}function Wd(e,t){return Fa(e.current,{disabledIndices:t})}function hx(e,t){return Fa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Fa(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&&gf(e,c,o));return c}function gf(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const l=e[t];return l?sp(l)?!a&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function hO(e){return e.visibility==="hidden"||e.visibility==="collapse"}function sp(e,t=e?fs(e):null){return!e||!e.isConnected||!t||hO(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const gO='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function xO(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return ql(a)?a.host:null}function gx(e){for(const t of Array.from(e.children))if(Vn(t)==="summary")return t;return null}function bO(e,t){const a=gx(t);return!!a&&(e===a||We(a,e))}function ZS(e){const t=e?Vn(e):"";return e!=null&&e.matches(gO)&&(t!=="summary"||e.parentElement!=null&&Vn(e.parentElement)==="details"&&gx(e.parentElement)===e)&&(t!=="details"||gx(e)==null)&&(t!=="input"||e.type!=="hidden")}function JS(e){if(!ZS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=xO(t)){const a=t!==e,o=Vn(t)==="slot";if(t.hasAttribute("inert")||a&&Vn(t)==="details"&&!t.open&&!bO(e,t)||t.hasAttribute("hidden")||!o&&!_O(t,a))return!1}return!0}function _O(e,t){const a=fs(e);return t?a.display!=="none":sp(e,a)}function e2(e){const t=e.tabIndex;if(t<0){const a=Vn(e);if(a==="details"||a==="audio"||a==="video"||Vt(e)&&e.isContentEditable)return 0}return t}function Xh(e){if(Vn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function vO(e,t){const a=Xh(e);if(!a)return!0;const o=t.find(l=>{const c=Xh(l);return c?.name===a.name&&c.form===a.form&&c.checked});return o?o===a:t.find(l=>{const c=Xh(l);return c?.name===a.name&&c.form===a.form})===a}function t2(e){if(Vt(e)&&Vn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Vt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function n2(e,t){t2(e).forEach(a=>{ZS(a)&&t.push(a),n2(a,t)})}function s2(e,t,a){t2(e).forEach(o=>{Vt(o)&&o.matches(t)&&a.push(o),s2(o,t,a)})}function Tb(e){return JS(e)&&e2(e)>=0}function a2(e){const t=[];return n2(e,t),t.filter(JS)}function eu(e){const t=a2(e);return t.filter(a=>e2(a)>=0&&vO(a,t))}function r2(e,t){const a=eu(e),o=a.length;if(o===0)return;const l=Gn(xt(e)),c=a.indexOf(l),u=c===-1?t===1?0:o-1:c+t;return a[u]}function Ab(e){return r2(xt(e).body,1)||e}function o2(e){return r2(xt(e).body,-1)||e}function l2(e,t){if(!e)return null;const a=eu(xt(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 yO(e){return l2(e,1)}function jO(e){return l2(e,-1)}function Ll(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!We(a,o)}function wO(e){eu(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function mj(e){const t=[];s2(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 Pr(e,t,a=!0){return e.filter(l=>l.parentId===t).flatMap(l=>[...!a||l.context?.open?[l]:[],...Pr(e,l.id,a)])}function hj(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 qc(e){return`data-base-ui-${e}`}let Sd=0;function Zd(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:l}=t;cancelAnimationFrame(Sd);function c(){l&&!l()||e?.focus({preventScroll:a})}if(o)return c(),An;const u=requestAnimationFrame(c);return Sd=u,()=>{Sd===u&&(cancelAnimationFrame(u),Sd=0)}}const Qh={inert:new WeakMap,"aria-hidden":new WeakMap},gj="data-base-ui-inert",xx={inert:new WeakSet,"aria-hidden":new WeakSet};let lc=new WeakMap,Wh=0;function kO(e){return xx[e]}function i2(e){return e?ql(e)?e.host:i2(e.parentNode):null}const xj=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=i2(a);return e.contains(o)?o:null}).filter(a=>a!=null),bj=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},_j=(e,t,a)=>{const o=[],l=c=>{!c||a.has(c)||Array.from(c.children).forEach(u=>{Vn(u)!=="script"&&(t.has(u)?l(u):o.push(u))})};return l(e),o};function SO(e,t,a,o,{mark:l=!0}){let c=null;o?c="inert":a&&(c="aria-hidden");let u=null,p=null;const m=xj(t,e),h=l?_j(t,bj(m),new Set(m)):[],g=[],b=[];if(c){const v=Qh[c],w=kO(c);p=w,u=v;const N=xj(t,Array.from(t.querySelectorAll("[aria-live]"))),y=m.concat(N);_j(t,bj(y),new Set(y)).forEach(E=>{const S=E.getAttribute(c),C=S!==null&&S!=="false",R=(v.get(E)||0)+1;v.set(E,R),g.push(E),R===1&&C&&w.add(E),C||E.setAttribute(c,c==="inert"?"":"true")})}return l&&h.forEach(v=>{const w=(lc.get(v)||0)+1;lc.set(v,w),b.push(v),w===1&&v.setAttribute(gj,"")}),Wh+=1,()=>{u&&g.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 w=(lc.get(v)||0)-1;lc.set(v,w),w||v.removeAttribute(gj)}),Wh-=1,Wh||(Qh.inert=new WeakMap,Qh["aria-hidden"]=new WeakMap,xx.inert=new WeakSet,xx["aria-hidden"]=new WeakSet,lc=new WeakMap)}}function vj(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:l=!0}=t,c=xt(e[0]).body;return SO(e,c,a,o,{mark:l})}let yj=0;function CO(e,t="mui"){const[a,o]=x.useState(e),l=e||a;return x.useEffect(()=>{a==null&&(yj+=1,o(`${t}-${yj}`))},[a,t]),l}const jj=Sb.useId;function So(e,t){if(jj!==void 0){const a=jj();return e??(t?`${t}-${a}`:a)}return CO(e,t)}const NO=parseInt(x.version,10);function Mb(e){return NO>=e}function wj(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Mb(19)?a?.ref:t.ref)??null}function bx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function EO(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 RO(e,t){return typeof e=="function"?e(t):e}function TO(e,t){return typeof e=="function"?e(t):e}const Ob={};function Kn(e,t,a,o,l){if(!a&&!o&&!l&&!e)return xf(t);let c=xf(e);return t&&(c=_c(c,t)),a&&(c=_c(c,a)),o&&(c=_c(c,o)),l&&(c=_c(c,l)),c}function AO(e){if(e.length===0)return Ob;if(e.length===1)return xf(e[0]);let t=xf(e[0]);for(let a=1;a<e.length;a+=1)t=_c(t,e[a]);return t}function xf(e){return zb(e)?{...u2(e,Ob)}:MO(e)}function _c(e,t){return zb(t)?u2(t,e):OO(e,t)}function MO(e){const t={...e};for(const a in t){const o=t[a];c2(a,o)&&(t[a]=d2(o))}return t}function OO(e,t){if(!t)return e;for(const a in t){const o=t[a];switch(a){case"style":{e[a]=bx(e.style,o);break}case"className":{e[a]=f2(e.className,o);break}default:c2(a,o)?e[a]=zO(e[a],o):e[a]=o}}return e}function c2(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 zb(e){return typeof e=="function"}function u2(e,t){return zb(e)?e(t):e??Ob}function zO(e,t){return t?e?(...a)=>{const o=a[0];if(p2(o)){const c=o;bf(c);const u=t(...a);return c.baseUIHandlerPrevented||e?.(...a),u}const l=t(...a);return e?.(...a),l}:d2(t):e}function d2(e){return e&&((...t)=>{const a=t[0];return p2(a)&&bf(a),e(...t)})}function bf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function f2(e,t){return t?e?t+" "+e:t:e}function p2(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Et(e,t,a={}){const o=t.render,l=DO(t,a);if(a.enabled===!1)return null;const c=a.state??Yt;return IO(e,o,l,c)}function DO(e,t={}){const{className:a,style:o,render:l}=e,{state:c=Yt,ref:u,props:p,stateAttributesMapping:m,enabled:h=!0}=t,g=h?RO(a,c):void 0,b=h?TO(o,c):void 0,v=h?EO(c,m):Yt,w=h&&p?LO(p):void 0,N=h?bx(v,w)??{}:Yt;return typeof document<"u"&&(h?Array.isArray(u)?N.ref=Z5([N.ref,wj(l),...u]):N.ref=Qa(N.ref,wj(l),u):Qa(null,null)),h?(g!==void 0&&(N.className=f2(N.className,g)),b!==void 0&&(N.style=bx(N.style,b)),N):Yt}function LO(e){return Array.isArray(e)?AO(e):Kn(void 0,e)}const PO=Symbol.for("react.lazy");function IO(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const l=Kn(a,t.props);l.ref=a.ref;let c=t;return c?.$$typeof===PO&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return BO(e,a);throw new Error(on(8))}function BO(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 UO=500,$O=500,HO={style:{transition:"none"}},qO="data-base-ui-click-trigger",m2={fallbackAxisSide:"none"},h2={fallbackAxisSide:"end"},VO={clipPath:"inset(50%)",position:"fixed",top:0,left:0},g2=x.createContext(null),x2=()=>x.useContext(g2),FO=qc("portal");function b2(e={}){const{ref:t,container:a,componentProps:o=Yt,elementProps:l}=e,c=So(),p=x2()?.portalNode,[m,h]=x.useState(null),[g,b]=x.useState(null),v=Ue(j=>{j!==null&&b(j)}),w=x.useRef(null);ze(()=>{if(a===null){w.current&&(w.current=null,b(null),h(null));return}if(c==null)return;const j=(a&&(vb(a)?a:a.current))??p??document.body;if(j==null){w.current&&(w.current=null,b(null),h(null));return}w.current!==j&&(w.current=j,b(null),h(j))},[a,p,c]);const N=Et("div",o,{ref:[t,v],props:[{id:c,[FO]:""},l]});return{portalNode:g,portalSubtree:m&&N?Is.createPortal(N,m):null}}const Db=x.forwardRef(function(t,a){const{render:o,className:l,style:c,children:u,container:p,renderGuards:m,...h}=t,{portalNode:g,portalSubtree:b}=b2({container:p,ref:a,componentProps:t,elementProps:h}),v=x.useRef(null),w=x.useRef(null),N=x.useRef(null),y=x.useRef(null),[j,E]=x.useState(null),S=x.useRef(!1),C=j?.modal,R=j?.open,M=typeof m=="boolean"?m:!!j&&!j.modal&&j.open&&!!g;x.useEffect(()=>{if(!g||C)return;function O(D){g&&D.relatedTarget&&Ll(D)&&(D.type==="focusin"?S.current&&(mj(g),S.current=!1):(wO(g),S.current=!0))}return da(_t(g,"focusin",O,!0),_t(g,"focusout",O,!0))},[g,C]),ze(()=>{!g||R!==!0||!S.current||(mj(g),S.current=!1)},[R,g]);const T=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:w,beforeInsideRef:N,afterInsideRef:y,portalNode:g,setFocusManagerState:E}),[g]);return s.jsxs(x.Fragment,{children:[b,s.jsxs(g2.Provider,{value:T,children:[M&&g&&s.jsx(Gl,{"data-type":"outside",ref:v,onFocus:O=>{if(Ll(O,g))N.current?.focus();else{const D=j?j.domReference:null;o2(D)?.focus()}}}),M&&g&&s.jsx("span",{"aria-owns":g.id,style:VO}),g&&Is.createPortal(u,g),M&&g&&s.jsx(Gl,{"data-type":"outside",ref:w,onFocus:O=>{if(Ll(O,g))y.current?.focus();else{const D=j?j.domReference:null;Ab(D)?.focus(),j?.closeOnFocusOut&&j?.onOpenChange(!1,st(ko,O.nativeEvent))}}})]})]})});function _2(){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 Lb{nodesRef={current:[]};events=_2();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 v2=x.createContext(null),y2=x.createContext(null),Hr=()=>x.useContext(v2)?.id||null,qr=e=>{const t=x.useContext(y2);return e??t};function j2(e){const t=So(),a=qr(e),o=Hr();return ze(()=>{if(!t)return;const l={id:t,parentId:o};return a?.addNode(l),()=>{a?.removeNode(l)}},[a,t,o]),t}function GO(e){const{children:t,id:a}=e,o=Hr();return s.jsx(v2.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function YO(e){const{children:t,externalTree:a}=e,o=Jn(()=>a??new Lb).current;return s.jsx(y2.Provider,{value:o,children:t})}function qa(e){return e==null?e:"current"in e?e.current:e}function KO(e,t){const a=Qt(qn(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 kj=20;let Tr=[];function Pb(){Tr=Tr.filter(e=>e.deref()?.isConnected)}function Sj(e){Pb(),e&&Vn(e)!=="body"&&(Tr.push(new WeakRef(e)),Tr.length>kj&&(Tr=Tr.slice(-kj)))}function Cj(){return Pb(),Tr[Tr.length-1]?.deref()}function XO(e){return e?Tb(e)?e:eu(e)[0]||e:null}function Nj(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=a2(e).filter(l=>{const c=l.getAttribute("data-tabindex")||"";return Tb(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 Ib(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:h="",nextFocusableElement:g,previousFocusableElement:b,beforeContentFocusGuardRef:v,externalTree:w,getInsideElements:N}=e,y="rootStore"in t?t.rootStore:t,j=y.useState("open"),E=y.useState("domReferenceElement"),S=y.useState("floatingElement"),{events:C,dataRef:R}=y.context,M=Ue(()=>R.current.floatingContext?.nodeId),T=l===!1,O=dx(E)&&T,D=fn(l),B=fn(c),L=fn(h),U=fn(j),z=qr(w),P=x2(),$=x.useRef(!1),V=x.useRef(!1),q=x.useRef(!1),X=x.useRef(null),K=x.useRef(""),F=x.useRef(""),G=x.useRef(null),I=x.useRef(null),Y=Qa(G,v,P?.beforeInsideRef),Z=Qa(I,P?.afterInsideRef),te=Nn(),fe=Nn(),ee=Fl(),se=P!=null,re=pf(S),me=Ue((he=re)=>he?eu(he):[]),Me=Ue(()=>N?.().filter(he=>he!=null)??[]);x.useEffect(()=>{if(o||!p)return;function he(we){we.key==="Tab"&&We(re,Gn(xt(re)))&&me().length===0&&!O&&aa(we)}const Ce=xt(re);return _t(Ce,"keydown",he)},[o,re,p,O,me]),x.useEffect(()=>{if(o||!j)return;const he=xt(re);function Ce(){q.current=!1}function we($e){const Se=qn($e),Te=Me(),ve=We(S,Se)||We(E,Se)||We(P?.portalNode,Se)||Te.some(Ne=>Ne===Se||We(Ne,Se));q.current=!ve,F.current=$e.pointerType||"keyboard",Se?.closest(`[${qO}]`)&&(V.current=!0,fe.start(0,()=>{V.current=!1}))}function Be(){F.current="keyboard"}return da(_t(he,"pointerdown",we,!0),_t(he,"pointerup",Ce,!0),_t(he,"pointercancel",Ce,!0),_t(he,"keydown",Be,!0),Ce)},[o,S,E,re,j,P,fe,Me]),x.useEffect(()=>{if(o||!m)return;const he=xt(re);function Ce(){V.current=!0,fe.start(0,()=>{V.current=!1})}function we(Te){const ve=qn(Te);Tb(ve)&&(X.current=ve)}function Be(Te){const ve=Te.relatedTarget,Ne=Te.currentTarget,De=qn(Te);p&&ve==null&&De!=null&&We(S,De)&&Sj(De),queueMicrotask(()=>{const Pe=M(),Ie=y.context.triggerElements,ue=Me(),_e=ve?.hasAttribute(qc("focus-guard"))&&[G.current,I.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,qa(b),qa(g)].includes(ve),qe=!(We(E,ve)||We(S,ve)||We(ve,S)||We(P?.portalNode,ve)||ue.some(Re=>Re===ve||We(Re,ve))||ve!=null&&Ie.hasElement(ve)||Ie.hasMatchingElement(Re=>We(Re,ve))||_e||z&&(Pr(z.nodesRef.current,Pe).find(Re=>We(Re.context?.elements.floating,ve)||We(Re.context?.elements.domReference,ve))||hj(z.nodesRef.current,Pe).find(Re=>[Re.context?.elements.floating,pf(Re.context?.elements.floating)].includes(ve)||Re.context?.elements.domReference===ve)));if(Ne===E&&re&&Nj(re),u&&Ne!==E&&!sp(De)&&Gn(he)===he.body){if(Vt(re)&&(re.focus(),u==="popup")){ee.request(()=>{re.focus()});return}const Re=me(),Oe=X.current,et=(Oe&&Re.includes(Oe)?Oe:null)||Re[Re.length-1]||re;Vt(et)&&et.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(O||!p)&&ve&&qe&&!V.current&&(O||ve!==Cj())&&($.current=!0,y.setOpen(!1,st(ko,Te)))})}function $e(){q.current||(R.current.insideReactTree=!0,te.start(0,()=>{R.current.insideReactTree=!1}))}const Se=Vt(E)?E:null;if(!(!S&&!Se))return da(Se&&_t(Se,"focusout",Be),Se&&_t(Se,"pointerdown",Ce),S&&_t(S,"focusin",we),S&&_t(S,"focusout",Be),S&&P&&_t(S,"focusout",$e,!0))},[o,E,S,re,p,z,P,y,m,u,me,O,M,R,te,fe,ee,g,b,Me]),x.useEffect(()=>{if(o||!S||!j)return;const he=Array.from(P?.portalNode?.querySelectorAll(`[${qc("portal")}]`)||[]),we=(z?hj(z.nodesRef.current,M()):[]).find(Ne=>dx(Ne.context?.elements.domReference||null))?.context?.elements.domReference,$e=[...[S,...he,G.current,I.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...Me()],we,qa(b),qa(g),O?E:null].filter(Ne=>Ne!=null),Se=vj($e,{ariaHidden:p||O,mark:!1}),Te=[S,...he].filter(Ne=>Ne!=null),ve=vj(Te);return()=>{ve(),Se()}},[j,o,E,S,p,P,O,z,M,g,b,Me]),ze(()=>{if(!j||o||!Vt(re))return;const he=xt(re),Ce=Gn(he);queueMicrotask(()=>{const we=D.current,Be=typeof we=="function"?we(L.current||""):we;if(Be===void 0||Be===!1||We(re,Ce))return;let Se=null;const Te=()=>(Se==null&&(Se=me(re)),Se[0]||re);let ve;Be===!0||Be===null?ve=Te():ve=qa(Be),ve=ve||Te();const Ne=We(re,Gn(he));Zd(ve,{preventScroll:ve===re,shouldFocus(){if(!U.current)return!1;if(Ne)return!0;const De=Gn(he);return!(De!==ve&&We(re,De))}})})},[o,j,re,me,D,L,U]),ze(()=>{if(o||!re)return;const he=xt(re),Ce=Gn(he),we=L.current==null;Sj(Ce);function Be(Se){if(Se.open||(K.current=KO(Se.nativeEvent,F.current)),Se.reason===Mn&&Se.nativeEvent.type==="mouseleave"&&($.current=!0),Se.reason===tp)if(Se.nested)$.current=!1;else if(_b(Se.nativeEvent)||BS(Se.nativeEvent))$.current=!1;else{let Te=!1;xt(re).createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?$.current=!1:$.current=!0}}C.on("openchange",Be);function $e(){const Se=B.current;let Te=typeof Se=="function"?Se(K.current):Se;if(Te===void 0||Te===!1)return null;Te===null&&(Te=!0);const ve=E?.isConnected?E:null,Ne=Ce?.isConnected&&Vn(Ce)!=="body"?Ce:null;let De=we?Ne||ve:ve||Ne;return De||(De=Cj()||null),typeof Te=="boolean"?De:qa(Te)||De||null}return()=>{C.off("openchange",Be);const Se=Gn(he),Te=Me(),ve=We(S,Se)||Te.some(Pe=>Pe===Se||We(Pe,Se))||z&&Pr(z.nodesRef.current,M(),!1).some(Pe=>We(Pe.context?.elements.floating,Se)),Ne=B.current,De=$e();queueMicrotask(()=>{const Pe=XO(De),Ie=typeof Ne!="boolean";Ne&&!$.current&&Vt(Pe)&&(!(!Ie&&Pe!==Se&&Se!==he.body)||ve)&&Pe.focus({preventScroll:!0}),$.current=!1})}},[o,S,re,B,L,C,z,E,M,Me]),ze(()=>{if(!Br||j||!S)return;const he=Gn(xt(S));!Vt(he)||!ep(he)||We(S,he)&&he.blur()},[j,S]),ze(()=>{if(!(o||!P))return P.setFocusManagerState({modal:p,closeOnFocusOut:m,open:j,onOpenChange:y.setOpen,domReference:E}),()=>{P.setFocusManagerState(null)}},[o,P,p,j,y,m,E]),ze(()=>{if(!(o||!re))return Nj(re),()=>{queueMicrotask(Pb)}},[o,re]);const de=!o&&(p?!O:!0)&&(se||p);return s.jsxs(x.Fragment,{children:[de&&s.jsx(Gl,{"data-type":"inside",ref:Y,onFocus:he=>{if(p){const Ce=me();Zd(Ce[Ce.length-1])}else P?.portalNode&&($.current=!1,Ll(he,P.portalNode)?Ab(E)?.focus():qa(b??P.beforeOutsideRef)?.focus())}}),a,de&&s.jsx(Gl,{"data-type":"inside",ref:Z,onFocus:he=>{p?Zd(me()[0]):P?.portalNode&&(m&&($.current=!0),Ll(he,P.portalNode)?o2(E)?.focus():qa(g??P.afterOutsideRef)?.focus())}})]})}function w2(e,t={}){const{enabled:a=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:p=0,reason:m=ci}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,b=x.useRef(void 0),v=Fl(),w=Nn(),N=x.useMemo(()=>{function y(E,S,C,R){const M=st(m,S,C);E&&R==="touch"&&p>0?w.start(p,()=>{h.setOpen(!0,M)}):h.setOpen(E,M)}function j(E,S,C){const R=g.current.openEvent,M=h.select("domReferenceElement")!==S;return E&&M||!E||!l?!0:R&&u?!C(R.type):!1}return{onPointerDown(E){b.current=E.pointerType},onMouseDown(E){const S=b.current,C=E.nativeEvent,R=h.select("open");if(E.button!==0||o==="click"||wo(S,!0)&&c)return;const M=j(R,E.currentTarget,D=>D==="click"||D==="mousedown"),T=qn(C);if(ep(T)){y(M,C,T,S);return}const O=E.currentTarget;v.request(()=>{y(M,C,O,S)})},onClick(E){if(o==="mousedown-only")return;const S=b.current;if(o==="mousedown"&&S){b.current=void 0;return}if(wo(S,!0)&&c)return;const C=h.select("open"),R=j(C,E.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");y(R,E.nativeEvent,E.currentTarget,S)},onKeyDown(){b.current=void 0}}},[g,o,c,m,h,u,l,v,w,p]);return x.useMemo(()=>a?{reference:N}:Yt,[a,N])}function QO(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 h=c.width,g=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,h=0,g=0,!l||m?(h=t.axis==="y"?c.width:0,g=t.axis==="x"?c.height:0,b=u&&t.x!=null?t.x:b,v=p&&t.y!=null?t.y:v):l&&!m&&(g=t.axis==="x"?c.height:g,h=t.axis==="y"?c.width:h),l=!0,{width:h,height:g,x:b,y:v,top:v,right:b+h,bottom:v+g,left:b}}}}function Ej(e){return e!=null&&e.clientX!=null}function WO(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,h=x.useRef(!1),g=x.useRef(null),[b,v]=x.useState(),[w,N]=x.useState([]),y=Ue(R=>{l.set("positionReference",R)}),j=Ue((R,M,T)=>{h.current||m.current.openEvent&&!Ej(m.current.openEvent)||l.set("positionReference",QO(T??p,{x:R,y:M,axis:o,dataRef:m,pointerType:b}))}),E=Ue(R=>{c?g.current||(j(R.clientX,R.clientY,R.currentTarget),N([])):j(R.clientX,R.clientY,R.currentTarget)}),S=wo(b)?u:c;x.useEffect(()=>{if(!a){y(p);return}if(!S)return;function R(){g.current?.(),g.current=null}const M=Qt(u);function T(O){const D=qn(O);We(u,D)?R():j(O.clientX,O.clientY)}return!m.current.openEvent||Ej(m.current.openEvent)?g.current=_t(M,"mousemove",T):y(p),R},[S,a,u,m,p,l,j,y,w]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{a&&!u&&(h.current=!1)},[a,u]),x.useEffect(()=>{!a&&c&&(h.current=!0)},[a,c]);const C=x.useMemo(()=>{function R(M){v(M.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:E,onMouseEnter:E}},[E]);return x.useMemo(()=>a?{reference:C,trigger:C}:{},[a,C])}function ZO(){return!1}function JO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ap(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=ZO,bubbles:p,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),b=h.useState("floatingElement"),{dataRef:v}=h.context,w=qr(m),N=Ue(typeof l=="function"?l:()=>!1),y=typeof l=="function"?N:l,j=y!==!1,E=Ue(()=>c),{escapeKey:S,outsidePress:C}=JO(p),R=x.useRef(!1),M=x.useRef(!1),T=x.useRef(!1),O=x.useRef(!1),D=x.useRef(""),B=x.useRef(null),L=Nn(),U=Nn(),z=Ue(()=>{U.clear(),v.current.insideReactTree=!1}),P=Ue(Y=>{const Z=v.current.floatingContext?.nodeId;return(w?Pr(w.nodesRef.current,Z):[]).some(fe=>fe.context?.open&&!fe.context.dataRef.current[Y])}),$=Ue(Y=>Yh(Y,h.select("floatingElement"))||Yh(Y,h.select("domReferenceElement"))),V=Ue(Y=>{u()&&h.setOpen(!1,st(ci,Y.nativeEvent))}),q=Ue(Y=>{if(!g||!a||!o||Y.key!=="Escape"||O.current||!S&&P("__escapeKeyBubbles"))return;const Z=L5(Y)?Y.nativeEvent:Y,te=st(np,Z);h.setOpen(!1,te),te.isCanceled||Y.preventDefault(),!S&&!te.isPropagationAllowed&&Y.stopPropagation()}),X=Ue(()=>{v.current.insideReactTree=!0,U.start(0,z)}),K=Ue(Y=>{if(!g||!a||Y.button!==0)return;const Z=qn(Y.nativeEvent);We(h.select("floatingElement"),Z)&&(R.current||(R.current=!0,M.current=!1))}),F=Ue(Y=>{!g||!a||(Y.defaultPrevented||Y.nativeEvent.defaultPrevented)&&R.current&&(M.current=!0)});x.useEffect(()=>{if(!g||!a)return;v.current.__escapeKeyBubbles=S,v.current.__outsidePressBubbles=C;const Y=new Ks,Z=new Ks;function te(){Y.clear(),O.current=!0}function fe(){Y.start(Br?5:0,()=>{O.current=!1})}function ee(){T.current=!0,Z.start(0,()=>{T.current=!1})}function se(){R.current=!1,M.current=!1}function re(){const ue=D.current,_e=ue==="pen"||!ue?"mouse":ue,qe=E(),Re=typeof qe=="function"?qe():qe;return typeof Re=="string"?Re:Re[_e]}function me(ue){const _e=re();return _e==="intentional"&&ue.type!=="click"||_e==="sloppy"&&ue.type==="click"}function Me(ue){const _e=v.current.floatingContext?.nodeId,qe=w&&Pr(w.nodesRef.current,_e).some(Re=>Yh(ue,Re.context?.elements.floating));return $(ue)||qe}function de(ue){if(me(ue)){ue.type!=="click"&&!$(ue)&&(Z.clear(),T.current=!1),z();return}if(v.current.insideReactTree){z();return}const _e=qn(ue),qe=`[${qc("inert")}]`,Re=bt(_e)?_e.getRootNode():null,Oe=Array.from((ql(Re)?Re:xt(h.select("floatingElement"))).querySelectorAll(qe)),et=h.context.triggerElements;if(_e&&(et.hasElement(_e)||et.hasMatchingElement(vt=>We(vt,_e))))return;let rt=bt(_e)?_e:null;for(;rt&&!ua(rt);){const vt=ma(rt);if(ua(vt)||!bt(vt))break;rt=vt}if(!(Oe.length&&bt(_e)&&!H5(_e)&&!We(_e,h.select("floatingElement"))&&Oe.every(vt=>!We(rt,vt)))){if(Vt(_e)&&!("touches"in ue)){const vt=ua(_e),Mt=fs(_e),lt=/auto|scroll/,Rt=vt||lt.test(Mt.overflowX),xe=vt||lt.test(Mt.overflowY),Le=Rt&&_e.clientWidth>0&&_e.scrollWidth>_e.clientWidth,Xe=xe&&_e.clientHeight>0&&_e.scrollHeight>_e.clientHeight,it=Mt.direction==="rtl",Qe=Xe&&(it?ue.offsetX<=_e.offsetWidth-_e.clientWidth:ue.offsetX>_e.clientWidth),pt=Le&&ue.offsetY>_e.clientHeight;if(Qe||pt)return}if(!Me(ue)){if(re()==="intentional"&&T.current){Z.clear(),T.current=!1;return}typeof y=="function"&&!y(ue)||P("__outsidePressBubbles")||(h.setOpen(!1,st(tp,ue)),z())}}}function he(ue){re()!=="sloppy"||ue.pointerType==="touch"||!h.select("open")||!a||$(ue)||de(ue)}function Ce(ue){if(re()!=="sloppy"||!h.select("open")||!a||$(ue))return;const _e=ue.touches[0];_e&&(B.current={startTime:Date.now(),startX:_e.clientX,startY:_e.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}function we(ue,_e){const qe=qn(ue);if(!qe)return;const Re=_t(qe,ue.type,()=>{_e(ue),Re()})}function Be(ue){D.current="touch",we(ue,Ce)}function $e(ue){L.clear(),ue.type==="pointerdown"&&(D.current=ue.pointerType),!(ue.type==="mousedown"&&B.current&&!B.current.dismissOnMouseDown)&&we(ue,_e=>{_e.type==="pointerdown"?he(_e):de(_e)})}function Se(ue){if(!R.current)return;const _e=M.current;if(se(),re()==="intentional"){if(ue.type==="pointercancel"){_e&&ee();return}if(!Me(ue)){if(_e){ee();return}typeof y=="function"&&!y(ue)||(Z.clear(),T.current=!0,z())}}}function Te(ue){if(re()!=="sloppy"||!B.current||$(ue))return;const _e=ue.touches[0];if(!_e)return;const qe=Math.abs(_e.clientX-B.current.startX),Re=Math.abs(_e.clientY-B.current.startY),Oe=Math.sqrt(qe*qe+Re*Re);Oe>5&&(B.current.dismissOnTouchEnd=!0),Oe>10&&(de(ue),L.clear(),B.current=null)}function ve(ue){we(ue,Te)}function Ne(ue){re()!=="sloppy"||!B.current||$(ue)||(B.current.dismissOnTouchEnd&&de(ue),L.clear(),B.current=null)}function De(ue){we(ue,Ne)}const Pe=xt(b),Ie=da(o&&da(_t(Pe,"keydown",q),_t(Pe,"compositionstart",te),_t(Pe,"compositionend",fe)),j&&da(_t(Pe,"click",$e,!0),_t(Pe,"pointerdown",$e,!0),_t(Pe,"pointerup",Se,!0),_t(Pe,"pointercancel",Se,!0),_t(Pe,"mousedown",$e,!0),_t(Pe,"mouseup",Se,!0),_t(Pe,"touchstart",Be,!0),_t(Pe,"touchmove",ve,!0),_t(Pe,"touchend",De,!0)));return()=>{Ie(),Y.clear(),Z.clear(),se(),T.current=!1}},[v,b,o,j,y,g,a,S,C,q,z,E,P,$,w,h,L]),x.useEffect(z,[y,z]);const G=x.useMemo(()=>({onKeyDown:q,onPointerDown:V,onClick:V}),[q,V]),I=x.useMemo(()=>({onKeyDown:q,onPointerDown:F,onMouseDown:F,onClickCapture:X,onMouseDownCapture(Y){X(),K(Y)},onPointerDownCapture(Y){X(),K(Y)},onMouseUpCapture:X,onTouchEndCapture:X,onTouchMoveCapture:X}),[q,X,K,F]);return x.useMemo(()=>a?{reference:G,floating:I,trigger:G}:{},[a,G,I])}function Rj(e,t,a){let{reference:o,floating:l}=e;const c=Ds(t),u=Rb(t),p=Eb(u),m=ds(t),h=c==="y",g=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 w;switch(m){case"top":w={x:g,y:o.y-l.height};break;case"bottom":w={x:g,y:o.y+o.height};break;case"right":w={x:o.x+o.width,y:b};break;case"left":w={x:o.x-l.width,y:b};break;default:w={x:o.x,y:o.y}}switch($r(t)){case"start":w[u]-=v*(a&&h?-1:1);break;case"end":w[u]+=v*(a&&h?-1:1);break}return w}async function e4(e,t){var a;t===void 0&&(t={});const{x:o,y:l,platform:c,rects:u,elements:p,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:b="floating",altBoundary:v=!1,padding:w=0}=Wa(t,e),N=WS(w),j=p[v?b==="floating"?"reference":"floating":b],E=Hc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(j)))==null||a?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:h,rootBoundary:g,strategy:m})),S=b==="floating"?{x:o,y:l,width:u.floating.width,height:u.floating.height}:u.reference,C=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(C))?await(c.getScale==null?void 0:c.getScale(C))||{x:1,y:1}:{x:1,y:1},M=Hc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:S,offsetParent:C,strategy:m}):S);return{top:(E.top-M.top+N.top)/R.y,bottom:(M.bottom-E.bottom+N.bottom)/R.y,left:(E.left-M.left+N.left)/R.x,right:(M.right-E.right+N.right)/R.x}}const t4=50,n4=async(e,t,a)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:u}=a,p=u.detectOverflow?u:{...u,detectOverflow:e4},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:l}),{x:g,y:b}=Rj(h,o,m),v=o,w=0;const N={};for(let y=0;y<c.length;y++){const j=c[y];if(!j)continue;const{name:E,fn:S}=j,{x:C,y:R,data:M,reset:T}=await S({x:g,y:b,initialPlacement:o,placement:v,strategy:l,middlewareData:N,rects:h,platform:p,elements:{reference:e,floating:t}});g=C??g,b=R??b,N[E]={...N[E],...M},T&&w<t4&&(w++,typeof T=="object"&&(T.placement&&(v=T.placement),T.rects&&(h=T.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):T.rects),{x:g,y:b}=Rj(h,v,m)),y=-1)}return{x:g,y:b,placement:v,strategy:l,middlewareData:N}},s4=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:h}=t,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:y=!0,...j}=Wa(e,t);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const E=ds(l),S=Ds(p),C=ds(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=v||(C||!y?[hf(p)]:cO(p)),T=N!=="none";!v&&T&&M.push(...pO(p,y,N,R));const O=[p,...M],D=await m.detectOverflow(t,j),B=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(g&&B.push(D[E]),b){const $=iO(l,u,R);B.push(D[$[0]],D[$[1]])}if(L=[...L,{placement:l,overflows:B}],!B.every($=>$<=0)){var U,z;const $=(((U=c.flip)==null?void 0:U.index)||0)+1,V=O[$];if(V&&(!(b==="alignment"?S!==Ds(V):!1)||L.every(K=>Ds(K.placement)===S?K.overflows[0]>0:!0)))return{data:{index:$,overflows:L},reset:{placement:V}};let q=(z=L.filter(X=>X.overflows[0]<=0).sort((X,K)=>X.overflows[1]-K.overflows[1])[0])==null?void 0:z.placement;if(!q)switch(w){case"bestFit":{var P;const X=(P=L.filter(K=>{if(T){const F=Ds(K.placement);return F===S||F==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(F=>F>0).reduce((F,G)=>F+G,0)]).sort((K,F)=>K[1]-F[1])[0])==null?void 0:P[0];X&&(q=X);break}case"initialPlacement":q=p;break}if(l!==q)return{reset:{placement:q}}}return{}}}};function Tj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Aj(e){return oO.some(t=>e[t]>=0)}const a4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:a,platform:o}=t,{strategy:l="referenceHidden",...c}=Wa(e,t);switch(l){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),p=Tj(u,a.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:Aj(p)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),p=Tj(u,a.floating);return{data:{escapedOffsets:p,escaped:Aj(p)}}}default:return{}}}}},k2=new Set(["left","top"]);async function r4(e,t){const{placement:a,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),u=ds(a),p=$r(a),m=Ds(a)==="y",h=k2.has(u)?-1:1,g=c&&m?-1:1,b=Wa(t,e);let{mainAxis:v,crossAxis:w,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"&&(w=p==="end"?N*-1:N),m?{x:w*g,y:v*h}:{x:v*h,y:w*g}}const o4=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 r4(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}}}}},l4=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:E=>{let{x:S,y:C}=E;return{x:S,y:C}}},...h}=Wa(e,t),g={x:a,y:o},b=await c.detectOverflow(t,h),v=Ds(ds(l)),w=Nb(v);let N=g[w],y=g[v];if(u){const E=w==="y"?"top":"left",S=w==="y"?"bottom":"right",C=N+b[E],R=N-b[S];N=px(C,N,R)}if(p){const E=v==="y"?"top":"left",S=v==="y"?"bottom":"right",C=y+b[E],R=y-b[S];y=px(C,y,R)}const j=m.fn({...t,[w]:N,[v]:y});return{...j,data:{x:j.x-a,y:j.y-o,enabled:{[w]:u,[v]:p}}}}}},i4=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:h=!0}=Wa(e,t),g={x:a,y:o},b=Ds(l),v=Nb(b);let w=g[v],N=g[b];const y=Wa(p,t),j=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const C=v==="y"?"height":"width",R=c.reference[v]-c.floating[C]+j.mainAxis,M=c.reference[v]+c.reference[C]-j.mainAxis;w<R?w=R:w>M&&(w=M)}if(h){var E,S;const C=v==="y"?"width":"height",R=k2.has(ds(l)),M=c.reference[b]-c.floating[C]+(R&&((E=u.offset)==null?void 0:E[b])||0)+(R?0:j.crossAxis),T=c.reference[b]+c.reference[C]+(R?0:((S=u.offset)==null?void 0:S[b])||0)-(R?j.crossAxis:0);N<M?N=M:N>T&&(N=T)}return{[v]:w,[b]:N}}}},c4=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=()=>{},...h}=Wa(e,t),g=await u.detectOverflow(t,h),b=ds(l),v=$r(l),w=Ds(l)==="y",{width:N,height:y}=c.floating;let j,E;b==="top"||b==="bottom"?(j=b,E=v===(await(u.isRTL==null?void 0:u.isRTL(p.floating))?"start":"end")?"left":"right"):(E=b,j=v==="end"?"top":"bottom");const S=y-g.top-g.bottom,C=N-g.left-g.right,R=Yl(y-g[j],S),M=Yl(N-g[E],C),T=!t.middlewareData.shift;let O=R,D=M;if((a=t.middlewareData.shift)!=null&&a.enabled.x&&(D=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(O=S),T&&!v){const L=ys(g.left,0),U=ys(g.right,0),z=ys(g.top,0),P=ys(g.bottom,0);w?D=N-2*(L!==0||U!==0?L+U:ys(g.left,g.right)):O=y-2*(z!==0||P!==0?z+P:ys(g.top,g.bottom))}await m({...t,availableWidth:D,availableHeight:O});const B=await u.getDimensions(p.floating);return N!==B.width||y!==B.height?{reset:{rects:!0}}:{}}}};function S2(e){const t=fs(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=Vt(e),c=l?e.offsetWidth:a,u=l?e.offsetHeight:o,p=mf(a)!==c||mf(o)!==u;return p&&(a=c,o=u),{width:a,height:o,$:p}}function Bb(e){return bt(e)?e:e.contextElement}function Pl(e){const t=Bb(e);if(!Vt(t))return fa(1);const a=t.getBoundingClientRect(),{width:o,height:l,$:c}=S2(t);let u=(c?mf(a.width):a.width)/o,p=(c?mf(a.height):a.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!p||!Number.isFinite(p))&&(p=1),{x:u,y:p}}const u4=fa(0);function C2(e){const t=Qt(e);return!jb()||!t.visualViewport?u4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function d4(e,t,a){return t===void 0&&(t=!1),!a||t&&a!==Qt(e)?!1:t}function Co(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const l=e.getBoundingClientRect(),c=Bb(e);let u=fa(1);t&&(o?bt(o)&&(u=Pl(o)):u=Pl(e));const p=d4(c,a,o)?C2(c):fa(0);let m=(l.left+p.x)/u.x,h=(l.top+p.y)/u.y,g=l.width/u.x,b=l.height/u.y;if(c){const v=Qt(c),w=o&&bt(o)?Qt(o):o;let N=v,y=cx(N);for(;y&&o&&w!==N;){const j=Pl(y),E=y.getBoundingClientRect(),S=fs(y),C=E.left+(y.clientLeft+parseFloat(S.paddingLeft))*j.x,R=E.top+(y.clientTop+parseFloat(S.paddingTop))*j.y;m*=j.x,h*=j.y,g*=j.x,b*=j.y,m+=C,h+=R,N=Qt(y),y=cx(N)}}return Hc({width:g,height:b,x:m,y:h})}function rp(e,t){const a=Wf(e).scrollLeft;return t?t.left+a:Co(xa(e)).left+a}function N2(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-rp(e,a),l=a.top+t.scrollTop;return{x:o,y:l}}function f4(e){let{elements:t,rect:a,offsetParent:o,strategy:l}=e;const c=l==="fixed",u=xa(o),p=t?Qf(t.floating):!1;if(o===u||p&&c)return a;let m={scrollLeft:0,scrollTop:0},h=fa(1);const g=fa(0),b=Vt(o);if((b||!b&&!c)&&((Vn(o)!=="body"||Ur(u))&&(m=Wf(o)),b)){const w=Co(o);h=Pl(o),g.x=w.x+o.clientLeft,g.y=w.y+o.clientTop}const v=u&&!b&&!c?N2(u,m):fa(0);return{width:a.width*h.x,height:a.height*h.y,x:a.x*h.x-m.scrollLeft*h.x+g.x+v.x,y:a.y*h.y-m.scrollTop*h.y+g.y+v.y}}function p4(e){return Array.from(e.getClientRects())}function m4(e){const t=xa(e),a=Wf(e),o=e.ownerDocument.body,l=ys(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=ys(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-a.scrollLeft+rp(e);const p=-a.scrollTop;return fs(o).direction==="rtl"&&(u+=ys(t.clientWidth,o.clientWidth)-l),{width:l,height:c,x:u,y:p}}const Mj=25;function h4(e,t){const a=Qt(e),o=xa(e),l=a.visualViewport;let c=o.clientWidth,u=o.clientHeight,p=0,m=0;if(l){c=l.width,u=l.height;const g=jb();(!g||g&&t==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const h=rp(o);if(h<=0){const g=o.ownerDocument,b=g.body,v=getComputedStyle(b),w=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,N=Math.abs(o.clientWidth-b.clientWidth-w);N<=Mj&&(c-=N)}else h<=Mj&&(c+=h);return{width:c,height:u,x:p,y:m}}function g4(e,t){const a=Co(e,!0,t==="fixed"),o=a.top+e.clientTop,l=a.left+e.clientLeft,c=Vt(e)?Pl(e):fa(1),u=e.clientWidth*c.x,p=e.clientHeight*c.y,m=l*c.x,h=o*c.y;return{width:u,height:p,x:m,y:h}}function Oj(e,t,a){let o;if(t==="viewport")o=h4(e,a);else if(t==="document")o=m4(xa(e));else if(bt(t))o=g4(t,a);else{const l=C2(e);o={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return Hc(o)}function E2(e,t){const a=ma(e);return a===t||!bt(a)||ua(a)?!1:fs(a).position==="fixed"||E2(a,t)}function x4(e,t){const a=t.get(e);if(a)return a;let o=$c(e,[],!1).filter(p=>bt(p)&&Vn(p)!=="body"),l=null;const c=fs(e).position==="fixed";let u=c?ma(e):e;for(;bt(u)&&!ua(u);){const p=fs(u),m=yb(u);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Ur(u)&&!m&&E2(e,u))?o=o.filter(g=>g!==u):l=p,u=ma(u)}return t.set(e,o),o}function b4(e){let{element:t,boundary:a,rootBoundary:o,strategy:l}=e;const u=[...a==="clippingAncestors"?Qf(t)?[]:x4(t,this._c):[].concat(a),o],p=Oj(t,u[0],l);let m=p.top,h=p.right,g=p.bottom,b=p.left;for(let v=1;v<u.length;v++){const w=Oj(t,u[v],l);m=ys(w.top,m),h=Yl(w.right,h),g=Yl(w.bottom,g),b=ys(w.left,b)}return{width:h-b,height:g-m,x:b,y:m}}function _4(e){const{width:t,height:a}=S2(e);return{width:t,height:a}}function v4(e,t,a){const o=Vt(t),l=xa(t),c=a==="fixed",u=Co(e,!0,c,t);let p={scrollLeft:0,scrollTop:0};const m=fa(0);function h(){m.x=rp(l)}if(o||!o&&!c)if((Vn(t)!=="body"||Ur(l))&&(p=Wf(t)),o){const w=Co(t,!0,c,t);m.x=w.x+t.clientLeft,m.y=w.y+t.clientTop}else l&&h();c&&!o&&l&&h();const g=l&&!o&&!c?N2(l,p):fa(0),b=u.left+p.scrollLeft-m.x-g.x,v=u.top+p.scrollTop-m.y-g.y;return{x:b,y:v,width:u.width,height:u.height}}function Zh(e){return fs(e).position==="static"}function zj(e,t){if(!Vt(e)||fs(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return xa(e)===a&&(a=a.ownerDocument.body),a}function R2(e,t){const a=Qt(e);if(Qf(e))return a;if(!Vt(e)){let l=ma(e);for(;l&&!ua(l);){if(bt(l)&&!Zh(l))return l;l=ma(l)}return a}let o=zj(e,t);for(;o&&I5(o)&&Zh(o);)o=zj(o,t);return o&&ua(o)&&Zh(o)&&!yb(o)?a:o||$5(e)||a}const y4=async function(e){const t=this.getOffsetParent||R2,a=this.getDimensions,o=await a(e.floating);return{reference:v4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function j4(e){return fs(e).direction==="rtl"}const T2={convertOffsetParentRelativeRectToViewportRelativeRect:f4,getDocumentElement:xa,getClippingRect:b4,getOffsetParent:R2,getElementRects:y4,getClientRects:p4,getDimensions:_4,getScale:Pl,isElement:bt,isRTL:j4};function A2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function w4(e,t){let a=null,o;const l=xa(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 h=e.getBoundingClientRect(),{left:g,top:b,width:v,height:w}=h;if(p||t(),!v||!w)return;const N=kd(b),y=kd(l.clientWidth-(g+v)),j=kd(l.clientHeight-(b+w)),E=kd(g),C={rootMargin:-N+"px "+-y+"px "+-j+"px "+-E+"px",threshold:ys(0,Yl(1,m))||1};let R=!0;function M(T){const O=T[0].intersectionRatio;if(O!==m){if(!R)return u();O?u(!1,O):o=setTimeout(()=>{u(!1,1e-7)},1e3)}O===1&&!A2(h,e.getBoundingClientRect())&&u(),R=!1}try{a=new IntersectionObserver(M,{...C,root:l.ownerDocument})}catch{a=new IntersectionObserver(M,C)}a.observe(e)}return u(!0),c}function Dj(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,h=Bb(e),g=l||c?[...h?$c(h):[],...t?$c(t):[]]:[];g.forEach(E=>{l&&E.addEventListener("scroll",a,{passive:!0}),c&&E.addEventListener("resize",a)});const b=h&&p?w4(h,a):null;let v=-1,w=null;u&&(w=new ResizeObserver(E=>{let[S]=E;S&&S.target===h&&w&&t&&(w.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=w)==null||C.observe(t)})),a()}),h&&!m&&w.observe(h),t&&w.observe(t));let N,y=m?Co(e):null;m&&j();function j(){const E=Co(e);y&&!A2(y,E)&&a(),y=E,N=requestAnimationFrame(j)}return a(),()=>{var E;g.forEach(S=>{l&&S.removeEventListener("scroll",a),c&&S.removeEventListener("resize",a)}),b?.(),(E=w)==null||E.disconnect(),w=null,m&&cancelAnimationFrame(N)}}const k4=o4,S4=l4,C4=s4,N4=c4,E4=a4,R4=i4,T4=(e,t,a)=>{const o=new Map,l={platform:T2,...a},c={...l.platform,_c:o};return n4(e,t,{...l,platform:c})};var A4=typeof document<"u",M4=function(){},Jd=A4?x.useLayoutEffect:M4;function _f(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(!_f(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)&&!_f(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function M2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lj(e,t){const a=M2(e);return Math.round(t*a)/a}function Jh(e){const t=x.useRef(e);return Jd(()=>{t.current=e}),t}function O4(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:h}=e,[g,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[v,w]=x.useState(o);_f(v,o)||w(o);const[N,y]=x.useState(null),[j,E]=x.useState(null),S=x.useCallback(K=>{K!==T.current&&(T.current=K,y(K))},[]),C=x.useCallback(K=>{K!==O.current&&(O.current=K,E(K))},[]),R=c||N,M=u||j,T=x.useRef(null),O=x.useRef(null),D=x.useRef(g),B=m!=null,L=Jh(m),U=Jh(l),z=Jh(h),P=x.useCallback(()=>{if(!T.current||!O.current)return;const K={placement:t,strategy:a,middleware:v};U.current&&(K.platform=U.current),T4(T.current,O.current,K).then(F=>{const G={...F,isPositioned:z.current!==!1};$.current&&!_f(D.current,G)&&(D.current=G,Is.flushSync(()=>{b(G)}))})},[v,t,a,U,z]);Jd(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,b(K=>({...K,isPositioned:!1})))},[h]);const $=x.useRef(!1);Jd(()=>($.current=!0,()=>{$.current=!1}),[]),Jd(()=>{if(R&&(T.current=R),M&&(O.current=M),R&&M){if(L.current)return L.current(R,M,P);P()}},[R,M,P,L,B]);const V=x.useMemo(()=>({reference:T,floating:O,setReference:S,setFloating:C}),[S,C]),q=x.useMemo(()=>({reference:R,floating:M}),[R,M]),X=x.useMemo(()=>{const K={position:a,left:0,top:0};if(!q.floating)return K;const F=Lj(q.floating,g.x),G=Lj(q.floating,g.y);return p?{...K,transform:"translate("+F+"px, "+G+"px)",...M2(q.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:F,top:G}},[a,p,q.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:P,refs:V,elements:q,floatingStyles:X}),[g,P,V,q,X])}const z4=(e,t)=>{const a=k4(e);return{name:a.name,fn:a.fn,options:[e,t]}},D4=(e,t)=>{const a=S4(e);return{name:a.name,fn:a.fn,options:[e,t]}},L4=(e,t)=>({fn:R4(e).fn,options:[e,t]}),P4=(e,t)=>{const a=C4(e);return{name:a.name,fn:a.fn,options:[e,t]}},I4=(e,t)=>{const a=N4(e);return{name:a.name,fn:a.fn,options:[e,t]}},B4=(e,t)=>{const a=E4(e);return{name:a.name,fn:a.fn,options:[e,t]}};function Ub(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(on(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var eg={exports:{}},tg={};/**
651
+ * @license React
652
+ * use-sync-external-store-shim.production.js
653
+ *
654
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
655
+ *
656
+ * This source code is licensed under the MIT license found in the
657
+ * LICENSE file in the root directory of this source tree.
658
+ */var Pj;function U4(){if(Pj)return tg;Pj=1;var e=Kc();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 w=v(),N=o({inst:{value:w,getSnapshot:v}}),y=N[0].inst,j=N[1];return c(function(){y.value=w,y.getSnapshot=v,m(y)&&j({inst:y})},[b,w,v]),l(function(){return m(y)&&j({inst:y}),b(function(){m(y)&&j({inst:y})})},[b]),u(w),w}function m(b){var v=b.getSnapshot;b=b.value;try{var w=v();return!a(b,w)}catch{return!0}}function h(b,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:p;return tg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,tg}var Ij;function O2(){return Ij||(Ij=1,eg.exports=U4()),eg.exports}var vf=O2(),ng={exports:{}},sg={};/**
659
+ * @license React
660
+ * use-sync-external-store-shim/with-selector.production.js
661
+ *
662
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
663
+ *
664
+ * This source code is licensed under the MIT license found in the
665
+ * LICENSE file in the root directory of this source tree.
666
+ */var Bj;function $4(){if(Bj)return sg;Bj=1;var e=Kc(),t=O2();function a(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}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 sg.useSyncExternalStoreWithSelector=function(h,g,b,v,w){var N=c(null);if(N.current===null){var y={hasValue:!1,value:null};N.current=y}else y=N.current;N=p(function(){function E(T){if(!S){if(S=!0,C=T,T=v(T),w!==void 0&&y.hasValue){var O=y.value;if(w(O,T))return R=O}return R=T}if(O=R,o(C,T))return O;var D=v(T);return w!==void 0&&w(O,D)?(C=T,O):(C=T,R=D)}var S=!1,C,R,M=b===void 0?null:b;return[function(){return E(g())},M===null?void 0:function(){return E(M())}]},[g,b,v,w]);var j=l(h,N[0],N[1]);return u(function(){y.hasValue=!0,y.value=j},[j]),m(j),j},sg}var Uj;function H4(){return Uj||(Uj=1,ng.exports=$4()),ng.exports}var q4=H4();const V4=Mb(19),F4=V4?Y4:K4;function tt(e,t,a,o,l){return F4(e,t,a,o,l)}function G4(e,t,a,o,l){const c=x.useCallback(()=>t(e.getSnapshot(),a,o,l),[e,t,a,o,l]);return vf.useSyncExternalStore(e.subscribe,c,c)}S5({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()}}),vf.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Y4(e,t,a,o,l){const c=k5();if(!c)return G4(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 K4(e,t,a,o,l){return q4.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,a,o,l))}class z2{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 op extends z2{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;ze(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;ze(()=>(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);ze(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,l=a!==void 0;ze(()=>{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??An);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 X4={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 lp extends op{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:_2(),nested:o,triggerElements:c},X4),this.syncOnly=a}syncOpenEvent=(t,a)=>{(!t||!this.state.open||a!=null&&P5(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 D2(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:u}=e,p=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(a?"popupElement":"positionerElement"),g=t.context.triggerElements,b=u,v=x.useRef(null);o===void 0&&v.current===null&&(v.current=new lp({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const w=o??v.current;return t.useSyncedValue("floatingId",l),ze(()=>{const N={open:p,floatingId:l,referenceElement:m,floatingElement:h};bt(m)&&(N.domReferenceElement=m),w.state.positionReference===w.state.referenceElement&&(N.positionReference=m),w.update(N)},[p,l,m,h,w]),w.context.onOpenChange=b,w.context.nested=c,w}function ui(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),ze(()=>{if(!e&&c&&o!=="ending"&&a){const p=oa.request(()=>{l("ending")});return()=>{oa.cancel(p)}}},[e,c,o,a]),ze(()=>{if(!e||t)return;const p=oa.request(()=>{l(void 0)});return()=>{oa.cancel(p)}},[t,e]),ze(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&l("starting");const p=oa.request(()=>{l("idle")});return()=>{oa.cancel(p)}},[t,e,c,o]),{mounted:c,setMounted:u,transitionStatus:o}}let No=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Q4={[No.startingStyle]:""},W4={[No.endingStyle]:""},tr={transitionStatus(e){return e==="starting"?Q4:e==="ending"?W4:null}};function L2(e,t=!1,a=!0){const o=Fl();return Ue((l,c=null)=>{o.cancel();const u=qa(e);if(u==null)return;const p=u,m=()=>{Is.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function h(){Promise.all(p.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(a){c?.aborted||m();return}const g=p.getAnimations();!c?.aborted&&g.length>0&&g.some(b=>b.pending||b.playState!=="finished")&&h()})}if(t){const g=No.startingStyle;if(!p.hasAttribute(g)){o.request(h);return}const b=new MutationObserver(()=>{p.hasAttribute(g)||(b.disconnect(),h())});b.observe(p,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(h)})}function ba(e){const{enabled:t=!0,open:a,ref:o,onComplete:l}=e,c=Ue(l),u=L2(o,a,!1);x.useEffect(()=>{if(!t)return;const p=new AbortController;return u(c,p.signal),()=>{p.abort()}},[t,a,c,u])}const ip={tabIndex:-1,[ux]:""};function Z4(e){return t=>t==="touch"?e.current:!0}function P2(e,t,a=!1){const o=So(),l=Hr()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=t(o,l));const u=e??c.current;return D2({popupStore:u,treatPopupAsFloatingElement:a,floatingRootContext:u.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:u.setOpen}),{store:u,internalStore:c.current}}function J4(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 I2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function ez(e,t,a,o={}){const l=a.reason,c=l===Mn,u=t&&l===zl,p=!t&&(l===ci||l===np),m=I2(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const h=()=>{const g={...o.extraState,open:t};u?g.instantType="focus":p?g.instantType="dismiss":c&&(g.instantType=void 0),$b(g,t,a.trigger,m()),e.update(g)};c?Is.flushSync(h):h()}function B2(e,t,a,o){Ub(()=>{t===void 0&&e.state.open===!1&&a&&(e.state={...e.state,open:!0,activeTriggerId:o,preventUnmountingOnClose:!1})})}function U2(e,t,a,o){const l=a.useState("isMountedByTrigger",e),c=J4(e,a),u=Ue(p=>{if(c(p),!p)return;const m=a.select("open"),h=a.select("activeTriggerId");if(h===e){a.update({activeTriggerElement:p,...m?o:null});return}h==null&&m&&a.update({activeTriggerId:e,activeTriggerElement:p,...o})});return ze(()=>{l&&a.update({activeTriggerElement:t.current,...o})},[l,a,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:l}}function Hb(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=e.useState("open"),l=e.useState("triggerCount");ze(()=>{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 h=e.context.triggerElements.getById(p);h?h!==e.state.activeTriggerElement&&(u.activeTriggerElement=h):m=p}if(!m&&!p&&c===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[g,b]=h.value;u.activeTriggerId=g,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 h=st(ha);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,l,a])}function qb(e,t,a){const{mounted:o,setMounted:l,transitionStatus:c}=ui(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 ba({enabled:o&&!e&&!p,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:c}}function Vb(e,t){e.useSyncedValues(t),ze(()=>()=>{e.update({activeTriggerProps:Yt,inactiveTriggerProps:Yt,popupProps:Yt})},[e])}function tz(e,t){ze(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),ze(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class tu{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 nz(){return new lp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new tu,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Fb(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:nz(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Yt,inactiveTriggerProps:Yt,popupProps:Yt}}function $2(e,t,a=!1){return new lp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0})}const Tc=Ae(e=>e.triggerIdProp??e.activeTriggerId),Gb=Ae(e=>e.openProp??e.open),$j=Ae(e=>(e.popupElement?.id??e.floatingId)||void 0);function H2(e,t){return t!==void 0&&Gb(e)&&Tc(e)===t}function sz(e,t){return H2(e,t)?!0:t!==void 0&&Gb(e)&&Tc(e)==null&&e.triggerCount===1}const Yb={open:Gb,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:Tc,activeTriggerElement:Ae(e=>e.mounted?e.activeTriggerElement:null),popupId:$j,isTriggerActive:Ae((e,t)=>t!==void 0&&Tc(e)===t),isOpenedByTrigger:Ae((e,t)=>H2(e,t)),isMountedByTrigger:Ae((e,t)=>t!==void 0&&Tc(e)===t&&e.mounted),triggerProps:Ae((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Ae((e,t)=>sz(e,t)?$j(e):void 0),popupProps:Ae(e=>e.popupProps),popupElement:Ae(e=>e.popupElement),positionerElement:Ae(e=>e.positionerElement)};function q2(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,l=So(),c=Hr()!=null,u=Jn(()=>new lp({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new tu,floatingId:l,syncOnly:!1,nested:c})).current;return ze(()=>{const p={open:t,floatingId:l};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=bt(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 az(e={}){const{nodeId:t,externalTree:a}=e,o=q2(e),l=e.rootContext||o,c=l.useState("referenceElement"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.useState("open"),h=l.useState("floatingId"),[g,b]=x.useState(null),[v,w]=x.useState(void 0),[N,y]=x.useState(void 0),j=x.useRef(null),E=qr(a),S=x.useMemo(()=>({reference:c,floating:u,domReference:p}),[c,u,p]),C=O4({...e,elements:{...S,...g&&{reference:g}}}),R=bt(v)?v:null,M=N===void 0?l.state.floatingElement:N;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?p:R),l.useSyncedValue("floatingElement",M);const T=x.useCallback(z=>{const P=bt(z)?{getBoundingClientRect:()=>z.getBoundingClientRect(),getClientRects:()=>z.getClientRects(),contextElement:z}:z;b(P),C.refs.setReference(P)},[C.refs]),O=x.useCallback(z=>{(bt(z)||z===null)&&(j.current=z,w(z)),(bt(C.refs.reference.current)||C.refs.reference.current===null||z!==null&&!bt(z))&&C.refs.setReference(z)},[C.refs,w]),D=x.useCallback(z=>{y(z),C.refs.setFloating(z)},[C.refs]),B=x.useMemo(()=>({...C.refs,setReference:O,setFloating:D,setPositionReference:T,domReference:j}),[C.refs,O,D,T]),L=x.useMemo(()=>({...C.elements,domReference:p}),[C.elements,p]),U=x.useMemo(()=>({...C,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:h,refs:B,elements:L,nodeId:t,rootStore:l}),[C,B,L,t,l,m,h]);return ze(()=>{p&&(j.current=p)},[p]),ze(()=>{l.context.dataRef.current.floatingContext=U;const z=E?.nodesRef.current.find(P=>P.id===t);z&&(z.context=U)}),x.useMemo(()=>({...C,context:U,refs:B,elements:L,rootStore:l}),[C,B,L,U,l])}const ag=xb&&Br;function V2(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),h=x.useRef(!0),g=Nn();x.useEffect(()=>{const v=l.select("domReferenceElement");if(!a)return;const w=Qt(v);function N(){const E=l.select("domReferenceElement");!l.select("open")&&Vt(E)&&E===Gn(xt(E))&&(p.current=!0)}function y(){h.current=!0}function j(){h.current=!1}return da(_t(w,"blur",N),ag&&_t(w,"keydown",y,!0),ag&&_t(w,"pointerdown",j,!0))},[l,a]),x.useEffect(()=>{if(!a)return;function v(w){if(w.reason===ci||w.reason===np){const N=l.select("domReferenceElement");bt(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(w){const N=w.currentTarget;if(p.current){if(m.current===N)return;v()}const y=qn(w.nativeEvent);if(bt(y)){if(ag&&!w.relatedTarget){if(!h.current&&!ep(y))return}else if(!V5(y))return}const j=ff(w.relatedTarget,l.context.triggerElements),{nativeEvent:E,currentTarget:S}=w,C=typeof o=="function"?o():o;if(l.select("open")&&j||C===0||C===void 0){l.setOpen(!0,st(zl,E,S));return}g.start(C,()=>{p.current||l.setOpen(!0,st(zl,E,S))})},onBlur(w){v();const N=w.relatedTarget,y=w.nativeEvent,j=bt(N)&&N.hasAttribute(qc("focus-guard"))&&N.getAttribute("data-type")==="outside";g.start(0,()=>{const E=l.select("domReferenceElement"),S=Gn(xt(E));!N&&S===E||We(u.current.floatingContext?.refs.floating.current,S)||We(E,S)||j||ff(N??S,l.context.triggerElements)||l.setOpen(!1,st(zl,y))})}}},[u,o,l,g]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class Kb{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 Ks,this.restTimeout=new Ks,this.handleCloseOptions=void 0}static create(){return new Kb}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const yf=new WeakMap;function jf(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&yf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),yf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function F2(e,t){const{scopeElement:a,referenceElement:o,floatingElement:l}=t,c=yf.get(a);c&&c!==e&&jf(c),jf(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,yf.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Xb(e){const t=e.context.dataRef.current,a=Jn(()=>t.hoverInteractionState??Kb.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),gb(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:h}=c.context,g=qr(),b=Hr(),v=Xb(c),w=Nn(),N=Ue(()=>qS(h.current.openEvent?.type,v.interactedInside)),y=Ue(()=>G5(h.current.openEvent?.type)),j=Ue(()=>{jf(v)});ze(()=>{u||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,j())},[u,v,j]),x.useEffect(()=>j,[j]),ze(()=>{if(a&&u&&v.handleCloseOptions?.blockPointerEvents&&y()&&bt(m)&&p){const E=m,S=p,C=xt(p),R=g?.nodesRef.current.find(D=>D.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const M=v.pointerEventsScopeElement!==S?v.pointerEventsScopeElement:null,T=R!==S?R:null,O=v.handleCloseOptions?.getScope?.()??M??T??E.closest("[data-rootownerid]")??C.body;return F2(v,{scopeElement:O,referenceElement:E,floatingElement:S}),()=>{j()}}},[a,u,m,p,v,y,g,b,j]),x.useEffect(()=>{if(!a)return;function E(){return!!(g&&b&&Pr(g.nodesRef.current,b).length>0)}function S(D){const B=Vl(o,"close",v.pointerType),L=()=>{c.setOpen(!1,st(Mn,D)),g?.events.emit("floating.closed",D)};B?v.openChangeTimeout.start(B,L):(v.openChangeTimeout.clear(),L())}function C(D){const B=qn(D);if(!q5(B)){v.interactedInside=!1;return}v.interactedInside=B?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),w.clear(),g?.events.off("floating.closed",T),j()}function M(D){if(E()&&g){g.events.on("floating.closed",T);return}if(ff(D.relatedTarget,c.context.triggerElements))return;const B=h.current.floatingContext?.nodeId??l,L=D.relatedTarget;if(!(g&&B&&bt(L)&&Pr(g.nodesRef.current,B,!1).some(z=>We(z.context?.elements.floating,L)))){if(v.handler){v.handler(D);return}j(),y()&&!N()&&S(D)}}function T(D){!g||!b||E()||w.start(0,()=>{g.events.off("floating.closed",T),c.setOpen(!1,st(Mn,D)),g.events.emit("floating.closed",D)})}const O=p;return da(O&&_t(O,"mouseenter",R),O&&_t(O,"mouseleave",M),O&&_t(O,"pointerdown",C,!0),()=>{g?.events.off("floating.closed",T)})},[a,p,c,h,o,l,y,N,j,v,g,b,w])}const rz={current:null};function Y2(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:p=!0,triggerElementRef:m=rz,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:b,isClosing:v,shouldOpen:w}=t,N="rootStore"in e?e.rootStore:e,{dataRef:y,events:j}=N.context,E=qr(h),S=Xb(N),C=x.useRef(!1),R=fn(l),M=fn(o),T=fn(u),O=fn(a),D=fn(w),B=fn(v),L=Ue(()=>qS(y.current.openEvent?.type,S.interactedInside)),U=Ue(()=>D.current?.()!==!1),z=Ue((V,q,X)=>{const K=N.context.triggerElements;if(K.hasElement(q))return!V||!We(V,q);if(!bt(X))return!1;const F=X;return K.hasMatchingElement(G=>We(G,F))&&(!V||!We(V,F))}),P=Ue(()=>{if(!S.handler)return;xt(N.select("domReferenceElement")).removeEventListener("mousemove",S.handler),S.handler=void 0}),$=Ue(()=>{jf(S)});return g&&(S.handleCloseOptions=R.current?.__options),x.useEffect(()=>P,[P]),x.useEffect(()=>{if(!a)return;function V(q){q.open?C.current=!1:(C.current=q.reason===Mn,P(),S.openChangeTimeout.clear(),S.restTimeout.clear(),S.blockMouseMove=!0,S.restTimeoutPending=!1)}return j.on("openchange",V),()=>{j.off("openchange",V)}},[a,j,S,P]),x.useEffect(()=>{if(!a)return;function V(F,G=!0){const I=Vl(M.current,"close",S.pointerType);I?S.openChangeTimeout.start(I,()=>{N.setOpen(!1,st(Mn,F)),E?.events.emit("floating.closed",F)}):G&&(S.openChangeTimeout.clear(),N.setOpen(!1,st(Mn,F)),E?.events.emit("floating.closed",F))}const q=m.current??(g?N.select("domReferenceElement"):null);if(!bt(q))return;function X(F){if(S.openChangeTimeout.clear(),S.blockMouseMove=!1,c&&!wo(S.pointerType))return;const G=cj(T.current),I=Vl(M.current,"open",S.pointerType),Y=qn(F),Z=F.currentTarget??null,te=N.select("domReferenceElement");let fe=Z;if(bt(Y)&&!N.context.triggerElements.hasElement(Y)){for(const we of N.context.triggerElements.elements())if(We(we,Y)){fe=we;break}}bt(Z)&&bt(te)&&!N.context.triggerElements.hasElement(Z)&&We(Z,te)&&(fe=te);const ee=fe==null?!1:z(te,fe,Y),se=N.select("open"),re=B.current?.()??N.select("transitionStatus")==="ending",me=!se&&re&&C.current,Me=!ee&&bt(fe)&&bt(te)&&We(te,fe)&&me,de=G>0&&!I,he=ee&&(se||me)||Me,Ce=!se||ee;if(he){U()&&N.setOpen(!0,st(Mn,F,fe));return}de||(I?S.openChangeTimeout.start(I,()=>{Ce&&U()&&N.setOpen(!0,st(Mn,F,fe))}):Ce&&U()&&N.setOpen(!0,st(Mn,F,fe)))}function K(F){if(L()){$();return}P();const G=N.select("domReferenceElement"),I=xt(G);S.restTimeout.clear(),S.restTimeoutPending=!1;const Y=y.current.floatingContext??b?.();if(ff(F.relatedTarget,N.context.triggerElements))return;if(R.current&&Y){N.select("open")||S.openChangeTimeout.clear();const te=m.current;S.handler=R.current({...Y,tree:E,x:F.clientX,y:F.clientY,onClose(){$(),P(),O.current&&!L()&&te===N.select("domReferenceElement")&&V(F,!0)}}),I.addEventListener("mousemove",S.handler),S.handler(F);return}(S.pointerType==="touch"?!We(N.select("floatingElement"),F.relatedTarget):!0)&&V(F)}return p?da(_t(q,"mousemove",X,{once:!0}),_t(q,"mouseenter",X),_t(q,"mouseleave",K)):da(_t(q,"mouseenter",X),_t(q,"mouseleave",K))},[P,$,y,M,N,a,R,S,g,z,L,c,p,T,m,E,O,b,B,U]),x.useMemo(()=>{if(!a)return;function V(q){S.pointerType=q.pointerType}return{onPointerDown:V,onPointerEnter:V,onMouseMove(q){const{nativeEvent:X}=q,K=q.currentTarget,F=N.select("domReferenceElement"),G=N.select("open"),I=z(F,K,q.target);if(c&&!wo(S.pointerType))return;if(G&&I&&S.handleCloseOptions?.blockPointerEvents){const te=N.select("floatingElement");if(te){const fe=S.handleCloseOptions?.getScope?.()??K.ownerDocument.body;F2(S,{scopeElement:fe,referenceElement:K,floatingElement:te})}}const Y=cj(T.current);if(G&&!I||Y===0||!I&&S.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;S.restTimeout.clear();function Z(){if(S.restTimeoutPending=!1,L())return;const te=N.select("open");!S.blockMouseMove&&(!te||I)&&U()&&N.setOpen(!0,st(Mn,X,K))}S.pointerType==="touch"?Is.flushSync(()=>{Z()}):I&&G?Z():(S.restTimeoutPending=!0,S.restTimeout.start(Y,Z))}}},[a,S,L,z,c,N,T,U])}const oz="Escape";function cp(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function Cd(e,t){return cp(t,e===HS||e===wb,e===Zf||e===Jf)}function rg(e,t,a){return cp(t,e===wb,a?e===Zf:e===Jf)||e==="Enter"||e===" "||e===""}function lz(e,t,a){return cp(t,a?e===Zf:e===Jf,e===wb)}function iz(e,t,a,o){const l=a?e===Jf:e===Zf,c=e===HS;return t==="both"||t==="horizontal"&&o?e===oz:cp(t,l,c)}function K2(e,t){const{listRef:a,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:m=!1,nested:h=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:v="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:N=!0,disabledIndices:y=void 0,orientation:j="vertical",parentOrientation:E,id:S,resetOnPointerLeave:C=!0,externalTree:R,grid:M}=t,T=M!=null,O="rootStore"in e?e.rootStore:e,D=O.useState("open"),B=O.useState("floatingElement"),L=O.useState("domReferenceElement"),U=O.context.dataRef,z=pf(B),P=dx(L),$=fn(z),V=Hr(),q=qr(R),X=x.useRef(v),K=x.useRef(u??-1),F=x.useRef(null),G=x.useRef(!0),I=Ue(ue=>{l(K.current===-1?null:K.current,ue)}),Y=x.useRef(!!B),Z=x.useRef(D),te=x.useRef(!1),fe=x.useRef(!1),ee=x.useRef(null),se=fn(y),re=fn(D),me=fn(u),Me=fn(C),de=Fl(),he=Fl(),Ce=Ue(()=>{function ue(Oe){b?q?.events.emit("virtualfocus",Oe):ee.current=Zd(Oe,{sync:te.current,preventScroll:!0})}const _e=a.current[K.current],qe=fe.current;_e&&ue(_e),(te.current?Oe=>Oe():Oe=>de.request(Oe))(()=>{const Oe=a.current[K.current]||_e;if(!Oe)return;_e||ue(Oe),ve&&(qe||!G.current)&&Oe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ze(()=>{U.current.orientation=j},[U,j]),ze(()=>{c&&(D&&B?(K.current=u??-1,X.current&&u!=null&&(fe.current=!0,I())):Y.current&&(K.current=-1,I()))},[c,D,B,u,I]),ze(()=>{if(c){if(!D){te.current=!1;return}if(B)if(o==null){if(te.current=!1,me.current!=null)return;if(Y.current&&(K.current=-1,Ce()),(!Z.current||!Y.current)&&X.current&&(F.current!=null||X.current===!0&&F.current==null)){let ue=0;const _e=()=>{a.current[0]==null?(ue<2&&(ue?Re=>he.request(Re):queueMicrotask)(_e),ue+=1):(K.current=F.current==null||rg(F.current,j,g)||h?Wd(a):hx(a),F.current=null,I())};_e()}}else Rc(a.current,o)||(K.current=o,Ce(),fe.current=!1)}},[c,D,B,o,me,h,a,j,g,I,Ce,he]),ze(()=>{if(!c||B||!q||b||!Y.current)return;const ue=q.nodesRef.current,_e=ue.find(Oe=>Oe.id===V)?.context?.elements.floating,qe=Gn(xt(L??_e??null)),Re=ue.some(Oe=>Oe.context&&We(Oe.context.elements.floating,qe));_e&&!Re&&G.current&&_e.focus({preventScroll:!0})},[c,B,L,q,V,b]),ze(()=>{Z.current=D,Y.current=!!B}),ze(()=>{D||(F.current=null,X.current=v)},[D,v]);const we=o!=null,Be=Ue(ue=>{if(!re.current)return;const _e=a.current.indexOf(ue.currentTarget);_e!==-1&&(K.current!==_e||o!==_e)&&(K.current=_e,I(ue))}),$e=Ue(()=>E??q?.nodesRef.current.find(ue=>ue.id===V)?.context?.dataRef?.current.orientation),Se=Ue(()=>Wd(a,se.current)),Te=Ue(ue=>{if(G.current=!1,te.current=!0,ue.which===229||!re.current&&ue.currentTarget===$.current)return;if(h&&iz(ue.key,j,g,T)){Cd(ue.key,$e())||aa(ue),O.setOpen(!1,st(fx,ue.nativeEvent)),Vt(L)&&(b?q?.events.emit("virtualfocus",L):L.focus());return}const _e=K.current,qe=Wd(a,y),Re=hx(a,y);if(P||(ue.key==="Home"&&(aa(ue),K.current=qe,I(ue)),ue.key==="End"&&(aa(ue),K.current=Re,I(ue))),M!=null){const Oe=M(ue,K.current,a,j,m,g,y,qe,Re);if(Oe!=null&&(K.current=Oe,I(ue)),j==="both")return}if(Cd(ue.key,j)){if(aa(ue),D&&!b&&Gn(ue.currentTarget.ownerDocument)===ue.currentTarget){K.current=rg(ue.key,j,g)?qe:Re,I(ue);return}rg(ue.key,j,g)?m?_e>=Re?p&&_e!==a.current.length?K.current=-1:(te.current=!1,K.current=qe):K.current=Fa(a.current,{startingIndex:_e,disabledIndices:y}):K.current=Math.min(Re,Fa(a.current,{startingIndex:_e,disabledIndices:y})):m?_e<=qe?p&&_e!==-1?K.current=a.current.length:(te.current=!1,K.current=Re):K.current=Fa(a.current,{startingIndex:_e,decrement:!0,disabledIndices:y}):K.current=Math.max(qe,Fa(a.current,{startingIndex:_e,decrement:!0,disabledIndices:y})),Rc(a.current,K.current)&&(K.current=-1),I(ue)}}),ve=x.useMemo(()=>({onFocus(_e){te.current=!0,Be(_e)},onClick:({currentTarget:_e})=>_e.focus({preventScroll:!0}),onMouseMove(_e){te.current=!0,fe.current=!1,w&&Be(_e)},onPointerLeave(_e){if(!re.current||!G.current||_e.pointerType==="touch")return;te.current=!0;const qe=_e.relatedTarget;if(!(!w||a.current.includes(qe))&&Me.current&&(ee.current?.(),ee.current=null,K.current=-1,I(_e),!b)){const Re=$.current,Oe=Gn(xt(Re));Re&&We(Re,Oe)&&Re.focus({preventScroll:!0})}}}),[Be,re,$,w,a,I,Me,b]),Ne=x.useMemo(()=>b&&D&&we&&{"aria-activedescendant":`${S}-${o}`},[b,D,we,S,o]),De=x.useMemo(()=>({"aria-orientation":j==="both"?void 0:j,...P?{}:Ne,onKeyDown(ue){if(ue.key==="Tab"&&ue.shiftKey&&D&&!b){const _e=qn(ue.nativeEvent);if(_e&&!We($.current,_e))return;aa(ue),O.setOpen(!1,st(ko,ue.nativeEvent)),Vt(L)&&L.focus();return}Te(ue)},onPointerMove(){G.current=!0}}),[Ne,Te,$,j,P,O,D,b,L]),Pe=x.useMemo(()=>{function ue(Re){O.setOpen(!0,st(fx,Re.nativeEvent,Re.currentTarget))}function _e(Re){v==="auto"&&_b(Re.nativeEvent)&&(X.current=!b)}function qe(Re){X.current=v,v==="auto"&&BS(Re.nativeEvent)&&(X.current=!0)}return{onKeyDown(Re){const Oe=O.select("open");G.current=!1;const et=Re.key.startsWith("Arrow"),rt=lz(Re.key,$e(),g),vt=Cd(Re.key,j),Mt=(h?rt:vt)||Re.key==="Enter"||Re.key.trim()==="";if(b&&Oe)return Te(Re);if(!(!Oe&&!N&&et)){if(Mt){const lt=Cd(Re.key,$e());F.current=h&&lt?null:Re.key}if(h){rt&&(aa(Re),Oe?(K.current=Se(),I(Re)):ue(Re));return}vt&&(me.current!=null&&(K.current=me.current),aa(Re),!Oe&&N?ue(Re):Te(Re),Oe&&I(Re))}},onFocus(Re){O.select("open")&&!b&&(K.current=-1,I(Re))},onPointerDown:qe,onPointerEnter:qe,onMouseDown:_e,onClick:_e}},[Te,v,Se,h,I,O,N,j,$e,g,me,b]),Ie=x.useMemo(()=>({...Ne,...Pe}),[Ne,Pe]);return x.useMemo(()=>c?{reference:Ie,floating:De,item:ve,trigger:Pe}:{},[c,Ie,De,Pe,ve])}function X2(e,t){const{listRef:a,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:u,onTyping:p,enabled:m=!0,resetMs:h=750,selectedIndex:g=null}=t,b="rootStore"in e?e.rootStore:e,v=b.useState("open"),w=Nn(),N=x.useRef(""),y=x.useRef(g??l??-1),j=x.useRef(null),E=Ue(R=>{function M($){const V=o?.current[$];return!V||sp(V)}function T($){return M($)?u==null||!gf(Xa,$,u):!1}function O($,V,q=0){if($.length===0)return-1;const X=(q%$.length+$.length)%$.length,K=V.toLowerCase();for(let F=0;F<$.length;F+=1){const G=(X+F)%$.length;if(!(!$[G]?.toLowerCase().startsWith(K)||!T(G)))return G}return-1}const D=a.current;if(N.current.length>0&&R.key===" "&&(aa(R),p?.(!0)),N.current.length>0&&N.current[0]!==" "&&O(D,N.current)===-1&&R.key!==" "&&p?.(!1),D==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;v&&R.key!==" "&&(aa(R),p?.(!0));const B=N.current==="";B&&(y.current=g??l??-1),D.every(($,V)=>$&&T(V)?$[0]?.toLowerCase()!==$[1]?.toLowerCase():!0)&&N.current===R.key&&(N.current="",y.current=j.current),N.current+=R.key,w.start(h,()=>{N.current="",y.current=j.current,p?.(!1)});const z=((B?g??l??-1:y.current)??0)+1,P=O(D,N.current,z);P!==-1?(c?.(P),j.current=P):R.key!==" "&&(N.current="",p?.(!1))}),S=Ue(R=>{const M=R.relatedTarget,T=b.select("domReferenceElement"),O=b.select("floatingElement");We(T,M)||We(O,M)||(w.clear(),N.current="",y.current=j.current,p?.(!1))});ze(()=>{!v&&g!==null||(w.clear(),j.current=null,N.current!==""&&(N.current=""))},[v,g,w]),ze(()=>{v&&N.current===""&&(y.current=g??l??-1)},[v,g,l]);const C=x.useMemo(()=>({onKeyDown:E,onBlur:S}),[E,S]);return x.useMemo(()=>m?{reference:C,floating:C}:{},[m,C])}const Hj=.1,cz=Hj*Hj,Ht=.5;function Nd(e,t,a,o,l,c){return o>=t!=c>=t&&e<=(l-a)*(t-o)/(c-o)+a}function Ed(e,t,a,o,l,c,u,p,m,h){let g=!1;return Nd(e,t,a,o,l,c)&&(g=!g),Nd(e,t,l,c,u,p)&&(g=!g),Nd(e,t,u,p,m,h)&&(g=!g),Nd(e,t,m,h,a,o)&&(g=!g),g}function uz(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function Rd(e,t,a,o,l,c){const u=Math.min(a,l),p=Math.max(a,l),m=Math.min(o,c),h=Math.max(o,c);return e>=u&&e<=p&&t>=m&&t<=h}function Q2(e={}){const{blockPointerEvents:t=!1}=e,a=new Ks,o=({x:l,y:c,placement:u,elements:p,onClose:m,nodeId:h,tree:g})=>{const b=u?.split("-")[0];let v=!1,w=null,N=null,y=typeof performance<"u"?performance.now():0;function j(S,C){const R=performance.now(),M=R-y;if(w===null||N===null||M===0)return w=S,N=C,y=R,!1;const T=S-w,O=C-N,D=T*T+O*O,B=M*M*cz;return w=S,N=C,y=R,D<B}function E(){a.clear(),m()}return function(C){a.clear();const R=p.domReference,M=p.floating;if(!R||!M||b==null||l==null||c==null)return;const{clientX:T,clientY:O}=C,D=qn(C),B=C.type==="mouseleave",L=We(M,D),U=We(R,D);if(L&&(v=!0,!B))return;if(U&&(v=!1,!B)){v=!0;return}if(B&&bt(C.relatedTarget)&&We(M,C.relatedTarget))return;function z(){return!!(g&&Pr(g.nodesRef.current,h).length>0)}function P(){z()||E()}if(z())return;const $=R.getBoundingClientRect(),V=M.getBoundingClientRect(),q=l>V.right-V.width/2,X=c>V.bottom-V.height/2,K=V.width>$.width,F=V.height>$.height,G=(K?$:V).left,I=(K?$:V).right,Y=(F?$:V).top,Z=(F?$:V).bottom;if(b==="top"&&c>=$.bottom-1||b==="bottom"&&c<=$.top+1||b==="left"&&l>=$.right-1||b==="right"&&l<=$.left+1){P();return}let te=!1;switch(b){case"top":te=Rd(T,O,G,$.top+1,I,V.bottom-1);break;case"bottom":te=Rd(T,O,G,V.top+1,I,$.bottom-1);break;case"left":te=Rd(T,O,V.right-1,Z,$.left+1,Y);break;case"right":te=Rd(T,O,$.right-1,Z,V.left+1,Y);break}if(te)return;if(v&&!uz(T,O,$)){P();return}if(!B&&j(T,O)){P();return}let fe=!1;switch(b){case"top":{const ee=K?Ht/2:Ht*4,se=K||q?l+ee:l-ee,re=K?l-ee:q?l+ee:l-ee,me=c+Ht+1,Me=q||K?V.bottom-Ht:V.top,de=q?K?V.bottom-Ht:V.top:V.bottom-Ht;fe=Ed(T,O,se,me,re,me,V.left,Me,V.right,de);break}case"bottom":{const ee=K?Ht/2:Ht*4,se=K||q?l+ee:l-ee,re=K?l-ee:q?l+ee:l-ee,me=c-Ht,Me=q||K?V.top+Ht:V.bottom,de=q?K?V.top+Ht:V.bottom:V.top+Ht;fe=Ed(T,O,se,me,re,me,V.left,Me,V.right,de);break}case"left":{const ee=F?Ht/2:Ht*4,se=F||X?c+ee:c-ee,re=F?c-ee:X?c+ee:c-ee,me=l+Ht+1,Me=X||F?V.right-Ht:V.left,de=X?F?V.right-Ht:V.left:V.right-Ht;fe=Ed(T,O,Me,V.top,de,V.bottom,me,se,me,re);break}case"right":{const ee=F?Ht/2:Ht*4,se=F||X?c+ee:c-ee,re=F?c-ee:X?c+ee:c-ee,me=l-Ht,Me=X||F?V.left+Ht:V.right,de=X?F?V.left+Ht:V.right:V.left+Ht;fe=Ed(T,O,me,se,me,re,Me,V.top,de,V.bottom);break}}fe?v||a.start(40,P):P()}};return o.__options={...e,blockPointerEvents:t},o}const dz={...Yb,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 Qb extends op{constructor(t,a,o=!1){const l=new tu,c={...fz(),...t};c.floatingRootContext=$2(l,a,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},dz)}setOpen=(t,a)=>{ez(this,t,a,{extraState:{openChangeReason:a.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,st(ci,t))}static useStore(t,a){return P2(t,(l,c)=>new Qb(a,l,c)).store}}function fz(){return{...Fb(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const pz=hb(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:h,handle:g,triggerId:b,defaultTriggerId:v=null,children:w}=t,N=Qb.useStore(g?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});B2(N,l,o,v),N.useControlledProp("openProp",l),N.useControlledProp("triggerIdProp",b),N.useContextCallback("onOpenChange",m),N.useContextCallback("onOpenChangeComplete",h);const y=N.useState("open"),j=!a&&y,E=N.useState("activeTriggerId"),S=N.useState("mounted"),C=N.useState("payload");N.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c}),N.useSyncedValue("disabled",a),Hb(N,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:M}=qb(j,N),T=N.useState("isInstantPhase"),O=N.useState("instantType"),D=N.useState("lastOpenChangeReason"),B=x.useRef(null);ze(()=>{y&&a&&N.setOpen(!1,st(FS))},[y,a,N]),ze(()=>{M==="ending"&&D===ha||M!=="ending"&&T?(O!=="delay"&&(B.current=O),N.set("instantType","delay")):B.current!==null&&(N.set("instantType",B.current),B.current=null)},[M,T,D,O,N]),ze(()=>{j&&E==null&&N.set("payload",void 0)},[N,E,j]);const L=x.useCallback(()=>{N.setOpen(!1,st(kb))},[N]);x.useImperativeHandle(p,()=>({unmount:R,close:L}),[R,L]);const U=j||S||!a&&u!=="none";return s.jsxs(IS.Provider,{value:N,children:[U&&s.jsx(mz,{store:N,disabled:a,trackCursorAxis:u}),typeof w=="function"?w({payload:C}):w]})});function mz({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),l=ap(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=WO(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),u=x.useMemo(()=>Kn(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Kn(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Kn(ip,c.floating,l.floating),[c.floating,l.floating]);return Vb(e,{activeTriggerProps:u,inactiveTriggerProps:p,popupProps:m}),null}let _o=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=No.startingStyle]="startingStyle",e[e.endingStyle=No.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),wf=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const hz={[wf.popupOpen]:""},gz={[wf.popupOpen]:"",[wf.pressed]:""},xz={[_o.open]:""},bz={[_o.closed]:""},_z={[_o.anchorHidden]:""},W2={open(e){return e?hz:null}},_x={open(e){return e?gz:null}},Lo={open(e){return e?xz:bz},anchorHidden(e){return e?_z:null}};function Ws(e){return So(e,"base-ui")}const Z2=x.createContext(void 0);function vz(){return x.useContext(Z2)}let yz=(function(e){return e[e.popupOpen=wf.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const jz=600,J2="data-base-ui-tooltip-trigger";function qj(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;o<a.length;o+=1){const l=a[o];if(bt(l))return l}}const t=e.target;return bt(t)?t:null}function wz(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&&bt(o.host)?o.host:null}return null}const kz=PS(function(t,a){const{render:o,className:l,style:c,handle:u,payload:p,disabled:m,delay:h,closeOnClick:g=!0,closeDelay:b,id:v,...w}=t,N=Jc(!0),y=u?.store??N;if(!y)throw new Error(on(82));const j=Ws(v),E=y.useState("isTriggerActive",j),S=y.useState("isOpenedByTrigger",j),C=y.useState("floatingRootContext"),R=x.useRef(null),M=h??jz,T=b??0,{registerTrigger:O,isMountedByThisTrigger:D}=U2(j,R,y,{payload:p,closeOnClick:g,closeDelay:T}),B=vz(),{delayRef:L,isInstantPhase:U,hasProvider:z}=W5(C,{open:S}),P=Xb(C);y.useSyncedValue("isInstantPhase",U);const $=y.useState("disabled"),V=m??$,q=fn(V),X=y.useState("trackCursorAxis"),K=y.useState("disableHoverablePopup"),F=x.useRef(!1),G=Nn(),I=x.useRef(void 0);function Y(){const he=B?.delay,Ce=typeof L.current=="object"?L.current.open:void 0;let we=M;return z&&(Ce!==0?we=h??he??M:we=0),we}function Z(he){const Ce=R.current;if(!Ce||!he)return!1;const we=wz(he);return we!==null&&we!==Ce&&We(Ce,we)}function te(he){const Ce=Z(he);return F.current=Ce,Ce&&(P.openChangeTimeout.clear(),P.restTimeout.clear(),P.restTimeoutPending=!1,G.clear()),Ce}const fe=Y2(C,{enabled:!V,mouseOnly:!0,move:!1,handleClose:!K&&X!=="both"?Q2():null,restMs:Y,delay(){const he=typeof L.current=="object"?L.current.close:void 0;let Ce=T;return b==null&&z&&(Ce=he),{close:Ce}},triggerElementRef:R,isActiveTrigger:E,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ee=V2(C,{enabled:!V}).reference,se=he=>{const Ce=F.current,we=qj(he),Be=te(we),$e=R.current,Se=$e&&we&&We($e,we);if(Be&&y.select("open")&&y.select("lastOpenChangeReason")===Mn){y.setOpen(!1,st(Mn,he));return}if(Ce&&!Be&&Se&&!q.current&&!y.select("open")&&$e&&wo(I.current)){const Te=()=>{!F.current&&!q.current&&!y.select("open")&&y.setOpen(!0,st(Mn,he,$e))},ve=Y();ve===0?(G.clear(),Te()):G.start(ve,Te)}},re=y.useState("triggerProps",D);return Et("button",t,{state:{open:S},ref:[a,O,R],props:[fe,ee,D||X!=="none"?re:void 0,{onMouseOver(he){se(he.nativeEvent)},onFocus(he){Z(qj(he.nativeEvent))&&he.preventBaseUIHandler()},onMouseLeave(){F.current=!1,G.clear(),I.current=void 0},onPointerEnter(he){I.current=he.pointerType},onPointerDown(he){I.current=he.pointerType,y.set("closeOnClick",g),g&&!y.select("open")&&y.cancelPendingOpen(he.nativeEvent)},onClick(he){g&&!y.select("open")&&y.cancelPendingOpen(he.nativeEvent)},id:j,[yz.triggerDisabled]:V?"":void 0,[J2]:V?void 0:""},w],stateAttributesMapping:W2})}),eC=x.createContext(void 0);function Sz(){const e=x.useContext(eC);if(e===void 0)throw new Error(on(70));return e}const Cz=x.forwardRef(function(t,a){const{children:o,container:l,className:c,render:u,style:p,...m}=t,{portalNode:h,portalSubtree:g}=b2({container:l,ref:a,componentProps:t,elementProps:m});return!g&&!h?null:s.jsxs(x.Fragment,{children:[g,h&&Is.createPortal(o,h)]})}),Nz=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t;return Jc().useState("mounted")||o?s.jsx(eC.Provider,{value:o,children:s.jsx(Cz,{ref:a,...l})}):null}),tC=x.createContext(void 0);function nC(){const e=x.useContext(tC);if(e===void 0)throw new Error(on(71));return e}const Ez=x.createContext(void 0);function up(){return x.useContext(Ez)?.direction??"ltr"}const Rz=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:h,padding:g=0,offsetParent:b="real"}=Wa(e,t)||{};if(h==null)return{};const v=WS(g),w={x:a,y:o},N=Rb(l),y=Eb(N),j=await u.getDimensions(h),E=N==="y",S=E?"top":"left",C=E?"bottom":"right",R=E?"clientHeight":"clientWidth",M=c.reference[y]+c.reference[N]-w[N]-c.floating[y],T=w[N]-c.reference[N],O=b==="real"?await u.getOffsetParent?.(h):p.floating;let D=p.floating[R]||c.floating[y];(!D||!await u.isElement?.(O))&&(D=p.floating[R]||c.floating[y]);const B=M/2-T/2,L=D/2-j[y]/2-1,U=Math.min(v[S],L),z=Math.min(v[C],L),P=U,$=D-j[y]-z,V=D/2-j[y]/2+B,q=px(P,V,$),X=!m.arrow&&$r(l)!=null&&V!==q&&c.reference[y]/2-(V<P?U:z)-j[y]/2<0,K=X?V<P?V-P:V-$:0;return{[N]:w[N]+K,data:{[N]:q,centerOffset:V-q-K,...X&&{alignmentOffset:K}},reset:X}}}),Tz=(e,t)=>({...Rz(e),options:[e,t]}),Az=B4().fn,Mz={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 Az(e)).data?.referenceHidden||c}}}},ef={sideX:"left",sideY:"top"},sC={name:"adaptiveOrigin",async fn(e){const{x:t,y:a,rects:{floating:o},elements:{floating:l},platform:c,strategy:u,placement:p}=e,m=Qt(l),h=m.getComputedStyle(l);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:t,y:a,data:ef};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 S=xt(l);v={width:S.documentElement.clientWidth,height:S.documentElement.clientHeight}}else await c.isElement?.(b)&&(v=await c.getDimensions(b));const w=ds(p);let N=t,y=a;w==="left"&&(N=v.width-(t+o.width)),w==="top"&&(y=v.height-(a+o.height));const j=w==="left"?"right":ef.sideX,E=w==="top"?"bottom":ef.sideY;return{x:N,y,data:{sideX:j,sideY:E}}}};function aC(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 Vj(e,t,a){const{rects:o,placement:l}=e;return{side:aC(t,ds(l),a),align:$r(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Wb(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:h=!1,arrowPadding:g=5,disableAnchorTracking:b=!1,inline:v,keepMounted:w=!1,floatingRootContext:N,mounted:y,collisionAvoidance:j,shiftCrossAxis:E=!1,nodeId:S,adaptiveOrigin:C,lazyFlip:R=!1,externalTree:M}=e,[T,O]=x.useState(null);!y&&T!==null&&O(null);const D=j.side||"flip",B=j.align||"flip",L=j.fallbackAxisSide||"end",U=typeof t=="function"?t:void 0,z=Ue(U),P=U?z:t,$=fn(t),V=fn(y),X=up()==="rtl",K=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"}[o],F=c==="center"?K:`${K}-${c}`;let G=m;const I=1,Y=o==="bottom"?I:0,Z=o==="top"?I:0,te=o==="right"?I:0,fe=o==="left"?I:0;typeof G=="number"?G={top:G+Y,right:G+fe,bottom:G+Z,left:G+te}:G&&(G={top:(G.top||0)+Y,right:(G.right||0)+fe,bottom:(G.bottom||0)+Z,left:(G.left||0)+te});const ee={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:G},se=x.useRef(null),re=fn(l),me=fn(u),Me=typeof l!="function"?l:0,de=typeof u!="function"?u:0,he=[];v&&he.push(v),he.push(z4(Qe=>{const pt=Vj(Qe,o,X),Ot=typeof re.current=="function"?re.current(pt):re.current,Zt=typeof me.current=="function"?me.current(pt):me.current;return{mainAxis:Ot,crossAxis:Zt,alignmentAxis:Zt}},[Me,de,X,o]));const Ce=B==="none"&&D!=="shift",we=!Ce&&(h||E||D==="shift"),Be=D==="none"?null:P4({...ee,padding:{top:G.top+I,right:G.right+I,bottom:G.bottom+I,left:G.left+I},mainAxis:!E&&D==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),$e=Ce?null:D4(Qe=>{const pt=xt(Qe.elements.floating).documentElement;return{...ee,rootBoundary:E?{x:0,y:0,width:pt.clientWidth,height:pt.clientHeight}:void 0,mainAxis:B!=="none",crossAxis:we,limiter:h||E?void 0:L4(Ot=>{if(!se.current)return{};const{width:Zt,height:Xt}=se.current.getBoundingClientRect(),Jt=Ds(ds(Ot.placement)),mn=Jt==="y"?Zt:Xt,ns=Jt==="y"?G.left+G.right:G.top+G.bottom;return{offset:mn/2+ns/2}})}},[ee,h,E,G,B]);D==="shift"||B==="shift"||c==="center"?he.push($e,Be):he.push(Be,$e),he.push(I4({...ee,apply({elements:{floating:Qe},availableWidth:pt,availableHeight:Ot,rects:Zt}){if(!V.current)return;const Xt=Qe.style;Xt.setProperty("--available-width",`${pt}px`),Xt.setProperty("--available-height",`${Ot}px`);const Jt=Qt(Qe).devicePixelRatio||1,{x:mn,y:ns,width:ps,height:ws}=Zt.reference,hn=(Math.round((mn+ps)*Jt)-Math.round(mn*Jt))/Jt,ks=(Math.round((ns+ws)*Jt)-Math.round(ns*Jt))/Jt;Xt.setProperty("--anchor-width",`${hn}px`),Xt.setProperty("--anchor-height",`${ks}px`)}}),Tz(Qe=>({element:se.current||xt(Qe.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(Qe){const{elements:pt,middlewareData:Ot,placement:Zt,rects:Xt,y:Jt}=Qe,mn=ds(Zt),ns=Ds(mn),ps=se.current,ws=Ot.arrow?.x||0,hn=Ot.arrow?.y||0,ks=ps?.clientWidth||0,va=ps?.clientHeight||0,$s=ws+ks/2,ya=hn+va/2,ut=Math.abs(Ot.shift?.y||0),It=Xt.reference.height/2,gn=typeof l=="function"?l(Vj(Qe,o,X)):l,En=ut>gn,kn={top:`${$s}px calc(100% + ${gn}px)`,bottom:`${$s}px ${-gn}px`,left:`calc(100% + ${gn}px) ${ya}px`,right:`${-gn}px ${ya}px`}[mn],Ft=`${$s}px ${Xt.reference.y+It-Jt}px`;return pt.floating.style.setProperty("--transform-origin",we&&ns==="y"&&En?Ft:kn),{}}},Mz,C),ze(()=>{!y&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,N]);const Se=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Te,elements:ve,x:Ne,y:De,middlewareData:Pe,update:Ie,placement:ue,context:_e,isPositioned:qe,floatingStyles:Re}=az({rootContext:N,open:w?y:void 0,placement:F,middleware:he,strategy:a,whileElementsMounted:w?void 0:(...Qe)=>Dj(...Qe,Se),nodeId:S,externalTree:M}),{sideX:Oe,sideY:et}=Pe.adaptiveOrigin||ef,rt=qe?a:"fixed",vt=x.useMemo(()=>{const Qe=C?{position:rt,[Oe]:Ne,[et]:De}:{position:rt,...Re};return qe||(Qe.opacity=0),Qe},[C,rt,Oe,Ne,et,De,Re,qe]),Mt=x.useRef(null);ze(()=>{if(!y)return;const Qe=$.current,pt=typeof Qe=="function"?Qe():Qe,Zt=(Fj(pt)?pt.current:pt)||null||null;Zt!==Mt.current&&(Te.setPositionReference(Zt),Mt.current=Zt)},[y,Te,P,$]),x.useEffect(()=>{if(!y)return;const Qe=$.current;typeof Qe!="function"&&Fj(Qe)&&Qe.current!==Mt.current&&(Te.setPositionReference(Qe.current),Mt.current=Qe.current)},[y,Te,P,$]),x.useEffect(()=>{if(w&&y&&ve.reference&&ve.floating)return Dj(ve.reference,ve.floating,Ie,Se)},[w,y,ve,Ie,Se]);const lt=ds(ue),Rt=aC(o,lt,X),xe=$r(ue)||"center",Le=!!Pe.hide?.referenceHidden;ze(()=>{R&&y&&qe&&O(lt)},[R,y,qe,lt]);const Xe=x.useMemo(()=>({position:"absolute",top:Pe.arrow?.y,left:Pe.arrow?.x}),[Pe.arrow]),it=Pe.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:vt,arrowStyles:Xe,arrowRef:se,arrowUncentered:it,side:Rt,align:xe,physicalSide:lt,anchorHidden:Le,refs:Te,context:_e,isPositioned:qe,update:Ie}),[vt,Xe,se,it,Rt,xe,lt,Le,Te,_e,qe,Ie])}function Fj(e){return e!=null&&"current"in e}function dp(e){return e==="starting"?HO:Yt}function Zb(e,t,{styles:a,transitionStatus:o,props:l,refs:c,hidden:u,inert:p=!1}){const m={...a};return p&&(m.pointerEvents="none"),Et("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},dp(o),l],stateAttributesMapping:Lo})}const Oz=x.forwardRef(function(t,a){const{render:o,className:l,anchor:c,positionMethod:u="absolute",side:p="top",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:w=5,sticky:N=!1,disableAnchorTracking:y=!1,collisionAvoidance:j=h2,style:E,...S}=t,C=Jc(),R=Sz(),M=C.useState("open"),T=C.useState("mounted"),O=C.useState("trackCursorAxis"),D=C.useState("disableHoverablePopup"),B=C.useState("floatingRootContext"),L=C.useState("instantType"),U=C.useState("transitionStatus"),z=C.useState("hasViewport"),P=Wb({anchor:c,positionMethod:u,floatingRootContext:B,mounted:T,side:p,sideOffset:h,align:m,alignOffset:g,collisionBoundary:b,collisionPadding:v,sticky:N,arrowPadding:w,disableAnchorTracking:y,keepMounted:R,collisionAvoidance:j,adaptiveOrigin:z?sC:void 0}),$=x.useMemo(()=>({open:M,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:O!=="none"?"tracking-cursor":L}),[M,P.side,P.align,P.anchorHidden,O,L]),V=Zb(t,$,{styles:P.positionerStyles,transitionStatus:U,props:S,refs:[a,C.useStateSetter("positionerElement")],hidden:!T,inert:!M||O==="both"||D});return s.jsx(tC.Provider,{value:P,children:V})}),zz={...Lo,...tr},Dz=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=Jc(),{side:m,align:h}=nC(),g=p.useState("open"),b=p.useState("instantType"),v=p.useState("transitionStatus"),w=p.useState("popupProps"),N=p.useState("floatingRootContext"),y=p.useState("disabled"),j=p.useState("closeDelay");ba({open:g,ref:p.context.popupRef,onComplete(){g&&p.context.onOpenChangeComplete?.(!0)}}),G2(N,{enabled:!y,closeDelay:j});const E=p.useStateSetter("popupElement");return Et("div",t,{state:{open:g,side:m,align:h,instant:b,transitionStatus:v},ref:[a,p.context.popupRef,E],props:[w,dp(v),u],stateAttributesMapping:zz})}),Lz=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=Jc(),{arrowRef:m,side:h,align:g,arrowUncentered:b,arrowStyles:v}=nC(),w=p.useState("open"),N=p.useState("instantType");return Et("div",t,{state:{open:w,side:h,align:g,uncentered:b,instant:N},ref:[a,m],props:[{style:v,"aria-hidden":!0},u],stateAttributesMapping:Lo})}),Pz=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 s.jsx(Z2.Provider,{value:c,children:s.jsx(Q5,{delay:u,timeoutMs:l,children:t.children})})};function fp(e){return Mb(19)?e:e?"true":void 0}function Iz(e){const[t,a]=x.useState({current:e,previous:null});return e!==t.current&&a({current:e,previous:t.current}),t.previous}function Ct(...e){return LS(Bc(e))}function Bz({delay:e=0,...t}){return s.jsx(Pz,{"data-slot":"tooltip-provider",delay:e,...t})}function Jb({...e}){return s.jsx(pz,{"data-slot":"tooltip",...e})}function e_({...e}){return s.jsx(kz,{"data-slot":"tooltip-trigger",...e})}function t_({className:e,side:t="top",sideOffset:a=4,align:o="center",alignOffset:l=0,children:c,...u}){return s.jsx(Nz,{children:s.jsx(Oz,{align:o,alignOffset:l,side:t,sideOffset:a,className:"isolate z-50",children:s.jsxs(Dz,{"data-slot":"tooltip-content",className:Ct("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,s.jsx(Lz,{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 Sl({label:e,active:t,onClick:a,isAdd:o,isSettings:l,isDefault:c,icon:u,title:p,testId:m}){const h=e.trim()||"·",{initials:g,subLabel:b}=rC(h),v=o||l?"indigo":oC(h),w=b&&!o&&!l&&!c;return s.jsxs(Jb,{children:[s.jsx(e_,{render:s.jsxs("button",{type:"button",onClick:a,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[s.jsx("span",{className:ke("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&&qz(v),!o&&!l&&!c&&!t&&Hz(v)),children:u??g}),w&&s.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),s.jsx(t_,{side:"right",children:p||e})]})}function rC(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:Uz(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 Uz(e){return e.length>6?e.slice(0,5)+"…":e}function oC(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)|0;return sj[Math.abs(t)%sj.length]}const lC={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"},$z={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 Hz(e){return lC[e]}function qz(e){return $z[e]}function Vz(e){const{initials:t}=rC(e);return{initials:t,idleClass:lC[oC(e)]}}function Ke({content:e,side:t="top",children:a}){return e?s.jsxs(Jb,{children:[s.jsx(e_,{render:a}),s.jsx(t_,{side:t,children:e})]}):a}const iC=x.createContext(void 0);function n_(e){const t=x.useContext(iC);if(t===void 0&&!e)throw new Error(on(33));return t}const cC=x.createContext(void 0);function Vr(e){const t=x.useContext(cC);if(t===void 0&&!e)throw new Error(on(36));return t}const Fz=x.createContext(void 0);function pp(e=!0){const t=x.useContext(Fz);if(t===void 0&&!e)throw new Error(on(25));return t}function Kl({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(h=>{l||u(h)},[]);return[p,m]}const uC=x.createContext(void 0);function s_(e=!1){const t=x.useContext(uC);if(t===void 0&&!e)throw new Error(on(16));return t}function Gz(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 h={onKeyDown(g){a&&t&&g.key!=="Tab"&&g.preventDefault()}};return o||(h.tabIndex=l,!c&&a&&(h.tabIndex=t?l:-1)),(c&&(t||u)||!c&&a)&&(h["aria-disabled"]=a),c&&(!t||p)&&(h.disabled=a),h},[o,a,t,u,p,c,l])}}function Fr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:l=!0,composite:c}=e,u=x.useRef(null),p=s_(!0),m=c??p!==void 0,{props:h}=Gz({focusableWhenDisabled:a,disabled:t,composite:m,tabIndex:o,isNativeButton:l}),g=x.useCallback(()=>{const w=u.current;og(w)&&m&&t&&h.disabled===void 0&&w.disabled&&(w.disabled=!1)},[t,h.disabled,m]);ze(g,[g]);const b=x.useCallback((w={})=>{const{onClick:N,onMouseDown:y,onKeyUp:j,onKeyDown:E,onPointerDown:S,...C}=w;return Kn({onClick(R){if(t){R.preventDefault();return}N?.(R)},onMouseDown(R){t||y?.(R)},onKeyDown(R){if(t||(bf(R),E?.(R),R.baseUIHandlerPrevented))return;const M=R.target===R.currentTarget,T=R.currentTarget,O=og(T),D=!l&&Yz(T),B=M&&(l?O:!D),L=R.key==="Enter",U=R.key===" ",z=T.getAttribute("role"),P=z?.startsWith("menuitem")||z==="option"||z==="gridcell";if(M&&m&&U){if(R.defaultPrevented&&P)return;R.preventDefault(),D||l&&O?(T.click(),R.preventBaseUIHandler()):B&&(N?.(R),R.preventBaseUIHandler());return}B&&(!l&&(U||L)&&R.preventDefault(),!l&&L&&N?.(R))},onKeyUp(R){if(!t){if(bf(R),j?.(R),R.target===R.currentTarget&&l&&m&&og(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}S?.(R)}},l?{type:"button"}:{role:"button"},h,C)},[t,h,m,l]),v=Ue(w=>{u.current=w,g()});return{getButtonProps:b,buttonRef:v}}function og(e){return Vt(e)&&e.tagName==="BUTTON"}function Yz(e){return!!(e?.tagName==="A"&&e?.href)}function Kz(e){const{closeOnClick:t,highlighted:a,id:o,nodeId:l,store:c,typingRef:u,itemRef:p,itemMetadata:m}=e,{events:h}=c.useState("floatingTreeRoot"),g=c.useState("open"),b=pp(!0),v=b!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:g&&a?0:-1,onKeyDown(w){w.key===" "&&u?.current&&w.preventDefault()},onMouseMove(w){l&&h.emit("itemhover",{nodeId:l,target:w.currentTarget})},onClick(w){t&&h.emit("close",{domEvent:w,reason:Dl})},onMouseUp(w){if(b){const N=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,v&&N&&Math.abs(w.clientX-N.x)<=1&&Math.abs(w.clientY-N.y)<=1||v&&!xb&&w.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!v||w.button===2)&&(!m||m.type==="regular-item")&&p.current.click()}}),[t,a,o,h,l,g,c,u,p,b,v,m])}const dC={type:"regular-item"};function fC(e){const{closeOnClick:t,disabled:a=!1,highlighted:o,id:l,store:c,typingRef:u=c.context.typingRef,nativeButton:p,itemMetadata:m,nodeId:h}=e,g=c.useState("disabled"),b=a||g,v=x.useRef(null),{getButtonProps:w,buttonRef:N}=Fr({disabled:b,focusableWhenDisabled:!0,native:p,composite:!0}),y=Kz({closeOnClick:t,highlighted:o,id:l,nodeId:h,store:c,typingRef:u,itemRef:v,itemMetadata:m}),j=x.useCallback(S=>Kn(y,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},S,w),[y,w,m]),E=Qa(v,N);return x.useMemo(()=>({getItemProps:j,itemRef:E}),[j,E])}const pC=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Xz(){return x.useContext(pC)}let mC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function nu(e={}){const{label:t,metadata:a,textRef:o,indexGuessBehavior:l,index:c}=e,{register:u,unregister:p,subscribeMapChange:m,elementsRef:h,labelsRef:g,nextIndexRef:b}=Xz(),v=x.useRef(-1),[w,N]=x.useState(c??(l===mC.GuessFromOrder?()=>{if(v.current===-1){const E=b.current;b.current+=1,v.current=E}return v.current}:-1)),y=x.useRef(null),j=x.useCallback(E=>{if(y.current=E,w!==-1&&E!==null&&(h.current[w]=E,g)){const S=t!==void 0;g.current[w]=S?t:o?.current?.textContent??E.textContent}},[w,h,g,t,o]);return ze(()=>{if(c!=null)return;const E=y.current;if(E)return u(E,a),()=>{p(E)}},[c,u,p,a]),ze(()=>{if(c==null)return m(E=>{const S=y.current?E.get(y.current)?.index:null;S!=null&&N(S)})},[c,m,N]),{ref:j,index:w}}let Gj=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const hC={checked(e){return e?{[Gj.checked]:""}:{[Gj.unchecked]:""}},...tr},Qz=x.createContext(void 0),Wz=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:h=!0,style:g,...b}=t,v=nu({label:u}),w=n_(!0),N=Ws(c),{store:y}=Vr(),j=y.useState("isActive",v.index),E=y.useState("itemProps"),{getItemProps:S,itemRef:C}=fC({closeOnClick:h,disabled:m,highlighted:j,id:N,store:y,nativeButton:p,nodeId:w?.context.nodeId,itemMetadata:dC});return Et("div",t,{state:{disabled:m,highlighted:j},props:[E,b,S],ref:[C,a,v.ref]})}),Zz=x.createContext(void 0);function gC(e){return x.useContext(Zz)}const Ac="ArrowUp",Mc="ArrowDown",kf="ArrowLeft",Sf="ArrowRight",mp="Home",hp="End",xC=new Set([kf,Sf]),Jz=new Set([kf,Sf,mp,hp]),bC=new Set([Ac,Mc]),eD=new Set([Ac,Mc,mp,hp]),_C=new Set([...xC,...bC]),gp=new Set([..._C,mp,hp]),tD="Shift",nD="Control",sD="Alt",aD="Meta",rD=new Set([tD,nD,sD,aD]);function oD(e){return Vt(e)&&e.tagName==="INPUT"}function Yj(e){return!!(oD(e)&&e.selectionStart!=null||Vt(e)&&e.tagName==="TEXTAREA")}function Kj(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=Xj(e,t,"left"),h=Td(e),g=Td(t);a==="ltr"&&(m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight?l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight:m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft&&(l=m-g.scrollMarginLeft-h.scrollPaddingLeft)),a==="rtl"&&(m-g.scrollMarginRight<e.scrollLeft+h.scrollPaddingLeft?l=m-g.scrollMarginLeft-h.scrollPaddingLeft:m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight&&(l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=Xj(e,t,"top"),h=Td(e),g=Td(t);m-g.scrollMarginTop<e.scrollTop+h.scrollPaddingTop?c=m-g.scrollMarginTop-h.scrollPaddingTop:m+t.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-h.scrollPaddingBottom&&(c=m+t.offsetHeight+g.scrollMarginBottom-e.clientHeight+h.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function Xj(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 Td(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 lD={...Lo,...tr},iD=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m}=Vr(),{side:h,align:g}=n_(),b=gC()!=null,v=m.useState("open"),w=m.useState("transitionStatus"),N=m.useState("popupProps"),y=m.useState("mounted"),j=m.useState("instantType"),E=m.useState("activeTriggerElement"),S=m.useState("parent"),C=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),M=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),O=m.useState("closeDelay"),D=m.useState("activeTriggerElement"),B=m.useState("hoverEnabled"),L=m.useState("disabled"),U=m.useState("openMethod"),z=S.type==="context-menu";ba({open:v,ref:m.context.popupRef,onComplete(){v&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function X(K){m.setOpen(!1,st(K.reason,K.domEvent))}return T.events.on("close",X),()=>{T.events.off("close",X)}},[T.events,m]),G2(M,{enabled:B&&!L&&!z&&S.type!=="menubar",closeDelay:O});const P=x.useCallback(X=>{m.set("popupElement",X)},[m]),$={transitionStatus:w,side:h,align:g,open:v,nested:S.type==="menu",instant:j},V=Et("div",t,{state:$,ref:[a,m.context.popupRef,P],stateAttributesMapping:lD,props:[N,{onKeyDown(X){b&&gp.has(X.key)&&X.stopPropagation()}},dp(w),p,{"data-rootownerid":R}]});let q=S.type===void 0||z;return(E||S.type==="menubar"&&C!==tp)&&(q=!0),s.jsx(Ib,{context:M,openInteractionType:U,modal:z,disabled:!y,returnFocus:u===void 0?q:u,initialFocus:S.type!=="menu",restoreFocus:!0,externalTree:S.type!=="menubar"?T:void 0,previousFocusableElement:D,nextFocusableElement:S.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:S.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:V})}),vC=x.createContext(void 0);function cD(){const e=x.useContext(vC);if(e===void 0)throw new Error(on(32));return e}const uD=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=Vr();return c.useState("mounted")||o?s.jsx(vC.Provider,{value:o,children:s.jsx(Db,{ref:a,...l})}):null});function xp(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:l}=e,c=Ue(l),u=x.useRef(0),p=Jn(fD).current,m=Jn(dD).current,[h,g]=x.useState(0),b=x.useRef(h),v=Ue((E,S)=>{m.set(E,S??null),b.current+=1,g(b.current)}),w=Ue(E=>{m.delete(E),b.current+=1,g(b.current)}),N=x.useMemo(()=>{const E=new Map;return Array.from(m.keys()).filter(C=>C.isConnected).sort(pD).forEach((C,R)=>{const M=m.get(C)??{};E.set(C,{...M,index:R})}),E},[m,h]);ze(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const E=new MutationObserver(S=>{const C=new Set,R=M=>C.has(M)?C.delete(M):C.add(M);S.forEach(M=>{M.removedNodes.forEach(R),M.addedNodes.forEach(R)}),C.size===0&&(b.current+=1,g(b.current))});return N.forEach((S,C)=>{C.parentElement&&E.observe(C.parentElement,{childList:!0})}),()=>{E.disconnect()}},[N]),ze(()=>{b.current===h&&(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,h]),ze(()=>()=>{a.current=[]},[a]),ze(()=>()=>{o&&(o.current=[])},[o]);const y=Ue(E=>(p.add(E),()=>{p.delete(E)}));ze(()=>{p.forEach(E=>E(N))},[p,N]);const j=x.useMemo(()=>({register:v,unregister:w,subscribeMapChange:y,elementsRef:a,labelsRef:o,nextIndexRef:u}),[v,w,y,a,o,u]);return s.jsx(pC.Provider,{value:j,children:t})}function dD(){return new Map}function fD(){return new Set}function pD(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 a_=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 s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let Qj={},Wj={},Zj="";function mD(e){if(typeof document>"u")return!1;const t=xt(e);return Qt(t).innerWidth-t.documentElement.clientWidth>0}function hD(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=xt(e),o=a.documentElement,l=a.body,c=Ur(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 h=c.offsetWidth;return c.style.overflowY=u,o.style.scrollbarGutter=p,m===h}function gD(e){const t=xt(e),a=t.documentElement,o=t.body,l=Ur(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 xD(e){const t=xt(e),a=t.documentElement,o=t.body,l=Qt(a);let c=0,u=0,p=!1;const m=oa.create();if(Br&&(l.visualViewport?.scale??1)!==1)return()=>{};function h(){const w=l.getComputedStyle(a),N=l.getComputedStyle(o),E=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=a.scrollTop,u=a.scrollLeft,Qj={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},Zj=a.style.scrollBehavior,Wj={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 S=a.scrollHeight>a.clientHeight,C=a.scrollWidth>a.clientWidth,R=w.overflowY==="scroll"||N.overflowY==="scroll",M=w.overflowX==="scroll"||N.overflowX==="scroll",T=Math.max(0,l.innerWidth-o.clientWidth),O=Math.max(0,l.innerHeight-o.clientHeight),D=parseFloat(N.marginTop)+parseFloat(N.marginBottom),B=parseFloat(N.marginLeft)+parseFloat(N.marginRight),L=Ur(a)?a:o;if(p=hD(e),p){a.style.scrollbarGutter=E,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(S||R)&&(a.style.overflowY="scroll"),(C||M)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:D||O?`calc(100dvh - ${D+O}px)`:"100dvh",width:B||T?`calc(100vw - ${B+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 g(){Object.assign(a.style,Qj),Object.assign(o.style,Wj),p||(a.scrollTop=c,a.scrollLeft=u,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=Zj)}function b(){g(),m.request(h)}h();const v=_t(l,"resize",b);return()=>{m.cancel(),g(),typeof l.removeEventListener=="function"&&v()}}class bD{lockCount=0;restore=null;timeoutLock=Ks.create();timeoutUnlock=Ks.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=xt(t).documentElement,l=Qt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=An;return}const c=Kf||!mD(t);this.restore=c?gD(t):xD(t)}}const _D=new bD;function yC(e=!0,t=null){ze(()=>{if(e)return _D.acquire(t)},[e,t])}const vD=20;function jC(e,t,a,o){const[l,c]=x.useState(!1);ze(()=>{if(!e||!t||a==null){c(!1);return}const u=xt(a).documentElement.clientWidth,p=a.offsetWidth;c(u>0&&p>0&&p>=u-vD)},[e,t,a]),yC(e&&(!t||l),o)}const yD=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p,align:m,sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:w=5,sticky:N=!1,disableAnchorTracking:y=!1,collisionAvoidance:j=m2,style:E,...S}=t,{store:C}=Vr(),R=cD(),M=pp(!0),T=C.useState("parent"),O=C.useState("floatingRootContext"),D=C.useState("floatingTreeRoot"),B=C.useState("mounted"),L=C.useState("open"),U=C.useState("modal"),z=C.useState("openMethod"),P=C.useState("activeTriggerElement"),$=C.useState("transitionStatus"),V=C.useState("positionerElement"),q=C.useState("instantType"),X=C.useState("hasViewport"),K=C.useState("lastOpenChangeReason"),F=C.useState("floatingNodeId"),G=C.useState("floatingParentNodeId"),I=O.useState("domReferenceElement"),Y=x.useRef(null),Z=L2(V,!1,!1);let te=o,fe=h,ee=g,se=m,re=j;T.type==="context-menu"&&(te=o??T.context?.anchor,se=se??"start",!p&&se!=="center"&&(ee=t.alignOffset??2,fe=t.sideOffset??-5));let me=p,Me=se;T.type==="menu"?(me=me??"inline-end",Me=Me??"start",re=t.collisionAvoidance??h2):T.type==="menubar"&&(me=me??(T.context.orientation==="vertical"?"inline-end":"bottom"),Me=Me??"start");const de=T.type==="context-menu",he=Wb({anchor:te,floatingRootContext:O,positionMethod:M?"fixed":l,mounted:B,side:me,sideOffset:fe,align:Me,alignOffset:ee,arrowPadding:de?0:w,collisionBoundary:b,collisionPadding:v,sticky:N,nodeId:F,keepMounted:R,disableAnchorTracking:y,collisionAvoidance:re,shiftCrossAxis:de&&!("side"in re&&re.side==="flip"),externalTree:D,adaptiveOrigin:X?sC:void 0});x.useEffect(()=>{function Ne(De){De.open&&(De.parentNodeId===F&&C.set("hoverEnabled",!1),De.nodeId!==F&&De.parentNodeId===C.select("floatingParentNodeId")&&C.setOpen(!1,st(bc)))}return D.events.on("menuopenchange",Ne),()=>{D.events.off("menuopenchange",Ne)}},[C,D.events,F]),x.useEffect(()=>{if(C.select("floatingParentNodeId")==null)return;function Ne(De){if(De.open||De.nodeId!==C.select("floatingParentNodeId"))return;const Pe=De.reason??bc;C.setOpen(!1,st(Pe))}return D.events.on("menuopenchange",Ne),()=>{D.events.off("menuopenchange",Ne)}},[D.events,C]);const Ce=Nn();x.useEffect(()=>{L||Ce.clear()},[L,Ce]),x.useEffect(()=>{function Ne(De){if(!(!L||De.nodeId!==C.select("floatingParentNodeId")))if(De.target&&P&&P!==De.target){const Pe=C.select("closeDelay");Pe>0?Ce.isStarted()||Ce.start(Pe,()=>{C.setOpen(!1,st(bc))}):C.setOpen(!1,st(bc))}else Ce.clear()}return D.events.on("itemhover",Ne),()=>{D.events.off("itemhover",Ne)}},[D.events,L,P,C,Ce]),x.useEffect(()=>{const Ne={open:L,nodeId:F,parentNodeId:G,reason:C.select("lastOpenChangeReason")};D.events.emit("menuopenchange",Ne)},[D.events,L,C,F,G]),ze(()=>{const Ne=I,De=Y.current;if(Ne&&(Y.current=Ne),De&&Ne&&Ne!==De){C.set("instantType",void 0);const Pe=new AbortController;return Z(()=>{C.set("instantType","trigger-change")},Pe.signal),()=>{Pe.abort()}}},[I,Z,C]);const we={open:L,side:he.side,align:he.align,anchorHidden:he.anchorHidden,nested:T.type==="menu",instant:q},Be=T.type==="menubar"&&T.context.modal;jC(L&&(Be||U&&K!==Mn),z==="touch",V,P);const Se=Zb(t,we,{styles:he.positionerStyles,transitionStatus:$,props:S,refs:[a,C.useStateSetter("positionerElement")],hidden:!B,inert:!L}),Te=B&&T.type!=="menu"&&(T.type!=="menubar"&&U&&K!==Mn||T.type==="menubar"&&T.context.modal);let ve=null;return T.type==="menubar"?ve=T.context.contentElement:T.type===void 0&&(ve=P),s.jsxs(iC.Provider,{value:he,children:[Te&&s.jsx(a_,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:fp(!L),cutout:ve}),s.jsx(GO,{id:F,children:s.jsx(xp,{elementsRef:C.context.itemDomElements,labelsRef:C.context.itemLabels,children:Se})})]})}),wC=x.createContext(void 0);function jD(){const e=x.useContext(wC);if(e===void 0)throw new Error(on(34));return e}const wD=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,value:c,defaultValue:u,onValueChange:p,disabled:m=!1,style:h,"aria-labelledby":g,...b}=t,[v,w]=x.useState(void 0),[N,y]=Kl({controlled:c,default:u,name:"MenuRadioGroup"}),j=Ue((R,M)=>{p?.(R,M),!M.isCanceled&&y(R)}),S=Et("div",t,{state:{disabled:m},ref:a,props:{role:"group","aria-labelledby":g??v,"aria-disabled":m||void 0,...b}}),C=x.useMemo(()=>({value:N,setValue:j,disabled:m}),[N,j,m]);return s.jsx(Qz.Provider,{value:w,children:s.jsx(wC.Provider,{value:C,children:S})})})),kC=x.createContext(void 0);function kD(){const e=x.useContext(kC);if(e===void 0)throw new Error(on(35));return e}const SD=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:h=!1,value:g,style:b,...v}=t,w=nu({label:u}),N=n_(!0),y=Ws(c),{store:j}=Vr(),E=j.useState("isActive",w.index),S=j.useState("itemProps"),{value:C,setValue:R,disabled:M}=jD(),T=M||m,O=C===g,{getItemProps:D,itemRef:B}=fC({closeOnClick:h,disabled:T,highlighted:E,id:y,store:j,nativeButton:p,nodeId:N?.context.nodeId,itemMetadata:dC}),L=x.useMemo(()=>({disabled:T,highlighted:E,checked:O}),[T,E,O]);function U(P){const $=st(Dl,P.nativeEvent,void 0,{preventUnmountOnClose(){}});R(g,$)}const z=Et("div",t,{state:L,stateAttributesMapping:hC,props:[S,{role:"menuitemradio","aria-checked":O,onClick:U},v,D],ref:[B,a,w.ref]});return s.jsx(kC.Provider,{value:L,children:z})}),CD=x.forwardRef(function(t,a){const{render:o,className:l,style:c,keepMounted:u=!1,...p}=t,m=kD(),h=x.useRef(null),{transitionStatus:g,setMounted:b}=ui(m.checked);ba({open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Et("span",t,{state:v,stateAttributesMapping:hC,ref:[a,h],props:{"aria-hidden":!0,...p},enabled:u||m.checked})}),ND=x.createContext(null);function SC(e){return x.useContext(ND)}function ED(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 r_(e,t){const a=x.useRef(e),o=Ue(t);ze(()=>{a.current!==e&&o(a.current)},[e,o]),ze(()=>{a.current=e},[e])}function RD(e,t){const a=Ue((c,u)=>{(typeof e=="function"?e():e)||t(u||(Kf?"touch":""))}),{onClick:o,onPointerDown:l}=ED(a);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function CC(e){const[t,a]=x.useState(null),o=RD(e,a);return r_(e,l=>{l&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const TD={...Yb,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 o_ extends op{constructor(t){super({...AD(),...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 tu},TD),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=Jn(()=>new o_(a)).current;return t??o}unsubscribeParentListener=null}function AD(){return{...Fb(),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 Lb,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Yt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const MD=x.createContext(void 0);function OD(){return x.useContext(MD)}const zD=hb(function(t){const{children:a,open:o,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:p=!1,modal:m,loopFocus:h=!0,orientation:g="vertical",actionsRef:b,closeParentOnEsc:v=!1,handle:w,triggerId:N,defaultTriggerId:y=null,highlightItemOnHover:j=!0}=t,E=pp(!0),S=Vr(!0),C=SC(!0),R=OD(),M=x.useMemo(()=>R&&S?{type:"menu",store:S.store}:C?{type:"menubar",context:C}:E&&!S?{type:"context-menu",context:E}:{type:void 0},[E,S,C,R]),T=o_.useStore(w?.store,{open:u,openProp:o,activeTriggerId:y,triggerIdProp:N,parent:M});B2(T,o,u,y),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",N),T.useContextCallback("onOpenChangeComplete",c);const O=So(),D=So(),B=T.useState("floatingTreeRoot"),L=j2(B),U=Hr(),z=T.useState("open"),P=T.useState("activeTriggerElement"),$=T.useState("positionerElement"),V=T.useState("hoverEnabled"),q=T.useState("disabled"),X=T.useState("lastOpenChangeReason"),K=T.useState("parent"),F=T.useState("activeIndex"),G=T.useState("payload"),I=T.useState("floatingParentNodeId"),Y=x.useRef(null),Z=x.useRef(K.type!=="context-menu"),te=Nn(),fe=x.useRef(!0),ee=Nn(),se=I!=null,{openMethod:re,triggerProps:me}=CC(z);T.useSyncedValues({disabled:p,highlightItemOnHover:j,modal:K.type===void 0?m:void 0,openMethod:re,rootId:O}),Hb(T);const{forceUnmount:Me}=qb(z,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})});ze(()=>{E&&!S?T.update({parent:{type:"context-menu",context:E},floatingNodeId:L,floatingParentNodeId:U}):S&&T.update({floatingNodeId:L,floatingParentNodeId:U})},[E,S,L,U,T]),x.useEffect(()=>{if(z||(Y.current=null),K.type==="context-menu"){if(!z){te.clear(),Z.current=!1;return}te.start(500,()=>{Z.current=!0})}},[te,z,K.type]),ze(()=>{!z&&!V&&T.set("hoverEnabled",!0)},[z,V,T]);const de=Ue((Oe,et)=>{const rt=et.reason;if(z===Oe&&et.trigger===P&&X===rt)return;const vt=I2(et);if(!Oe&&et.trigger==null&&(et.trigger=P??void 0),l?.(Oe,et),et.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(Oe,et);const Mt=et.event;if(Oe===!1&&Mt?.type==="click"&&Mt.pointerType==="touch"&&!fe.current)return;Oe&&rt===zl?(fe.current=!1,ee.start(300,()=>{fe.current=!0})):(fe.current=!0,ee.clear());const lt=(rt===ci||rt===Dl)&&Mt.detail===0&&Mt?.isTrusted,Rt=!Oe&&(rt===np||rt==null),xe={open:Oe,openChangeReason:rt};Y.current=et.event??null,$b(xe,Oe,et.trigger,vt()),T.update(xe),K.type==="menubar"&&(rt===zl||rt===ko||rt===Mn||rt===fx||rt===bc)?T.set("instantType","group"):lt||Rt?T.set("instantType",lt?"click":"dismiss"):T.set("instantType",void 0)}),he=D2({popupStore:T,floatingId:D,nested:U!=null,onOpenChange:de}),Ce=he.context.events;x.useEffect(()=>{const Oe=({open:et,eventDetails:rt})=>de(et,rt);return Ce.on("setOpen",Oe),()=>{Ce?.off("setOpen",Oe)}},[Ce,de]);const we=x.useCallback(()=>{T.setOpen(!1,st(kb))},[T]);x.useImperativeHandle(b,()=>({unmount:Me,close:we}),[Me,we]);let Be;K.type==="context-menu"&&(Be=K.context),x.useImperativeHandle(Be?.positionerRef,()=>$,[$]),x.useImperativeHandle(Be?.actionsRef,()=>({setOpen:de}),[de]);const $e=ap(he,{enabled:!q,bubbles:{escapeKey:v&&K.type==="menu"},outsidePress(){return K.type!=="context-menu"||Y.current?.type==="contextmenu"?!0:Z.current},externalTree:se?B:void 0}),Se=up(),Te=x.useCallback(Oe=>{T.select("activeIndex")!==Oe&&T.set("activeIndex",Oe)},[T]),ve=K2(he,{enabled:!q,listRef:T.context.itemDomElements,activeIndex:F,nested:K.type!==void 0,loopFocus:h,orientation:g,parentOrientation:K.type==="menubar"?K.context.orientation:void 0,rtl:Se==="rtl",disabledIndices:Xa,onNavigate:Te,openOnArrowKeyDown:K.type!=="context-menu",externalTree:se?B:void 0,focusItemOnHover:j}),Ne=x.useCallback(Oe=>{T.context.typingRef.current=Oe},[T]),De=X2(he,{enabled:!q,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:F,resetMs:UO,onMatch:Oe=>{z&&Oe!==F&&T.set("activeIndex",Oe)},onTyping:Ne}),Pe=x.useMemo(()=>{const Oe=Kn(De.reference,ve.reference,$e.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=z,Oe},[T,De.reference,ve.reference,$e.reference,me,z]),Ie=x.useMemo(()=>{const Oe=Kn(ve.trigger,$e.trigger,me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=!1,Oe},[ve.trigger,$e.trigger,me]),ue=x.useMemo(()=>Kn(ip,{id:D,role:"menu","aria-labelledby":P?.id,onMouseMove(){T.set("allowMouseEnter",!0),K.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Oe){const et=T.select("keyboardEventRelay");et&&!Oe.isPropagationStopped()&&et(Oe)}},De.floating,ve.floating,$e.floating),[P,D,K.type,T,De.floating,ve.floating,$e.floating]),_e=ve.item??Yt;Vb(T,{floatingRootContext:he,activeTriggerProps:Pe,inactiveTriggerProps:Ie,popupProps:ue,itemProps:_e});const qe=x.useMemo(()=>({store:T,parent:M}),[T,M]),Re=s.jsx(cC.Provider,{value:qe,children:typeof a=="function"?a({payload:G}):a});return K.type===void 0||K.type==="context-menu"?s.jsx(YO,{externalTree:B,children:Re}):Re});function NC(e){const t=e.getBoundingClientRect(),a=Qt(e);if(bb)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,h=parseFloat(l.height)||0,g=Math.max(t.width,u,m),b=Math.max(t.height,p,h),v=g-t.width,w=b-t.height;return{left:t.left-v/2,right:t.right+v/2,top:t.top-w/2,bottom:t.bottom+w/2}}function EC(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=s_(),{ref:l,index:c}=nu(e),u=a===c,p=x.useRef(null),m=Qa(l,p);return{compositeProps:{tabIndex:u?0:-1,onFocus(){o(c)},onMouseMove(){const g=p.current;if(!t||!g)return;const b=g.hasAttribute("disabled")||g.ariaDisabled==="true";!u&&!b&&g.focus()}},compositeRef:m,index:c}}function DD(e){const{render:t,className:a,style:o,state:l=Yt,props:c=Xa,refs:u=Xa,metadata:p,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:b,compositeRef:v}=EC({metadata:p});return Et(h,e,{state:l,ref:[...u,v],props:[b,...c,g],stateAttributesMapping:m})}function RC(e){if(Vt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!ua(e))return RC(ma(e))}function LD(e,t){const a=x.useRef(null);function o(c){Is.flushSync(()=>{e.setOpen(!1,st(ko,c.nativeEvent,c.currentTarget))}),jO(a.current)?.focus()}function l(c){const u=e.select("positionerElement");if(u&&Ll(c,u))e.context.beforeContentFocusGuardRef.current?.focus();else{Is.flushSync(()=>{e.setOpen(!1,st(ko,c.nativeEvent,c.currentTarget))});let p=yO(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&We(u,p);){const m=p;if(p=Ab(p),p===m)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:l}}function PD(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,xt(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:Yt,[t,a,o])}const Ad=2,ID=PS(function(t,a){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,id:m,openOnHover:h,delay:g=100,closeDelay:b=0,handle:v,payload:w,...N}=t,y=Vr(!0),j=v?.store??y?.store;if(!j)throw new Error(on(85));const E=Ws(m),S=j.useState("isTriggerActive",E),C=j.useState("floatingRootContext"),R=j.useState("isOpenedByTrigger",E),M=j.useState("triggerPopupId",E),T=x.useRef(null),O=UD(),D=s_(!0),B=qr(),L=x.useMemo(()=>B??new Lb,[B]),U=j2(L),z=Hr(),{registerTrigger:P,isMountedByThisTrigger:$}=U2(E,T,j,{payload:w,closeDelay:b,parent:O,floatingTreeRoot:L,floatingNodeId:U,floatingParentNodeId:z,keyboardEventRelay:D?.relayKeyboardEvent}),V=O.type==="menubar",q=j.useState("disabled"),X=u||q||V&&O.context.disabled,{getButtonProps:K,buttonRef:F}=Fr({disabled:X,native:p});x.useEffect(()=>{!R&&O.type===void 0&&(j.context.allowMouseUpTriggerRef.current=!1)},[j,R,O.type]);const G=x.useRef(null),I=Nn(),Y=Ue(ve=>{if(!G.current)return;I.clear(),j.context.allowMouseUpTriggerRef.current=!1;const Ne=ve.target;if(We(G.current,Ne)||We(j.select("positionerElement"),Ne)||Ne===G.current||Ne!=null&&RC(Ne)===j.select("rootId"))return;const De=NC(G.current);ve.clientX>=De.left-Ad&&ve.clientX<=De.right+Ad&&ve.clientY>=De.top-Ad&&ve.clientY<=De.bottom+Ad||L.events.emit("close",{domEvent:ve,reason:VS})});x.useEffect(()=>{R&&j.select("lastOpenChangeReason")===Mn&&xt(G.current).addEventListener("mouseup",Y,{once:!0})},[R,Y,j]);const Z=V&&O.context.hasSubmenuOpen,fe=Y2(C,{enabled:(h??Z)&&!X&&O.type!=="context-menu"&&(!V||Z&&!$),handleClose:Q2({blockPointerEvents:!V}),mouseOnly:!0,move:!1,restMs:O.type===void 0?g:void 0,delay:{close:b},triggerElementRef:T,externalTree:L,isActiveTrigger:S,isClosing:()=>j.select("transitionStatus")==="ending"}),ee=BD(R,j.select("lastOpenChangeReason")),se=w2(C,{enabled:!X&&O.type!=="context-menu",event:R&&V?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?ee:!1}),re=V2(C,{enabled:!X&&Z}),me=PD({open:R,enabled:V,mouseDownAction:"open"}),Me=x.useMemo(()=>Kn(re.reference,se.reference),[re.reference,se.reference]),de=j.useState("triggerProps",$),{preFocusGuardRef:he,handlePreFocusGuardFocus:Ce,handleFocusTargetFocus:we}=LD(j,T),Be={disabled:X,open:R},$e=[G,a,F,P,T],Se=[Me,fe??Yt,de,{"aria-haspopup":"menu","aria-controls":M,id:E,onMouseDown:ve=>{if(j.select("open"))return;I.start(200,()=>{j.context.allowMouseUpTriggerRef.current=!0}),xt(ve.currentTarget).addEventListener("mouseup",Y,{once:!0})}},V?{role:"menuitem"}:{},me,N,K],Te=Et("button",t,{enabled:!V,stateAttributesMapping:_x,state:Be,ref:$e,props:Se});return V?s.jsx(DD,{tag:"button",render:o,className:l,style:c,state:Be,refs:$e,props:Se,stateAttributesMapping:_x}):R?s.jsxs(x.Fragment,{children:[s.jsx(Gl,{ref:he,onFocus:Ce},`${E}-pre-focus-guard`),s.jsx(x.Fragment,{children:Te},E),s.jsx(Gl,{ref:j.context.triggerFocusTargetRef,onFocus:we},`${E}-post-focus-guard`)]}):s.jsx(x.Fragment,{children:Te},E)});function BD(e,t){const a=Nn(),[o,l]=x.useState(!1);return ze(()=>{e&&t==="trigger-hover"?(l(!0),a.start($O,()=>{l(!1)})):e||(a.clear(),l(!1))},[e,t,a]),o}function UD(){const e=pp(!0),t=Vr(!0),a=SC();return x.useMemo(()=>a?{type:"menubar",context:a}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,a])}function TC(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function AC({...e}){return s.jsx(zD,{"data-slot":"dropdown-menu",...e})}function MC({...e}){return s.jsx(ID,{"data-slot":"dropdown-menu-trigger",...e})}function OC({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:o=4,className:l,...c}){return s.jsx(uD,{children:s.jsx(yD,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:o,children:s.jsx(iD,{"data-slot":"dropdown-menu-content",className:Ct("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 $D({className:e,inset:t,variant:a="default",...o}){return s.jsx(Wz,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:Ct("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 HD({...e}){return s.jsx(wD,{"data-slot":"dropdown-menu-radio-group",...e})}function qD({className:e,children:t,inset:a,...o}){return s.jsxs(SD,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:Ct("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:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s.jsx(CD,{children:s.jsx(Lr,{})})}),t]})}const VD={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",refresh:"Refrescar",view_all:"Ver todo",saved:"Guardado.",deleted:"Eliminado.",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",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memorias",structure:"Estructura",docs:"Docs",files:"Archivos"},sections:{workspace:"Workspace",content:"Contenido",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",routines_active:"Rutinas activas",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"abrir",roster:"Equipo",no_agents:"Todavía no hay agentes.",orchestrators:"Orquestadores",specialists:"Especialistas",recent_tasks:"Tasks recientes",no_activity:"No hay tasks abiertas."},artifacts:{title:"Artifacts",subtitle:"Scripts y archivos reutilizables guardados en el proyecto. Los crean los agentes; podés verlos, ejecutarlos, renombrarlos o eliminarlos."},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",live_title:"Chat con {agent}",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.",thread_subtitle:"Historial con {persona} en {channel}. Si respondés acá, la conversación sigue desde la web.",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",new_session:"Nueva sesión",delete:"Borrar",delete_confirm_title:"Borrar chat",delete_confirm_desc:"Esta acción no se puede deshacer. Se elimina para siempre el historial de este chat.",deleted:"Chat borrado.",meta_created:"Creado {date} · {channel}",meta_new:"Chat nuevo · {channel}",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",pick_agent:"Elegí un agente"}},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}",conflict_detail:"{name} está definido en {winner} y {loser}. Se usa {winner}; {loser} queda ignorado.",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",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",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
667
+
668
+ 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_short:"Emociones",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_form:{emoji:"Emoji",area:"Área",role:"Rol",no_role:"— sin rol —",autonomy:"Autonomía",autonomy_hint:"Cuánto puede hacer el agente sin pedir confirmación.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permiso"},structure:{title:"Estructura",subtitle:"Áreas y roles de la empresa. Las áreas agrupan agentes; los roles definen su función.",info:"Las áreas son agrupaciones opcionales. Los roles definen la función de un agente y pueden pertenecer a un área.",empty:"Todavía no hay áreas ni roles. Creá el primero arriba.",new_area:"Nueva área",new_role:"Nuevo rol",edit_area:"Editar área",edit_role:"Editar rol",create_area:"Crear área",create_role:"Crear rol",name:"Nombre",slug:"Slug",goal:"Objetivo",goal_hint:"Para qué existe esta área (opcional).",area:"Área",description:"Descripción",no_area:"— sin área —",roles:"Roles",add_role:"rol",no_roles:"sin roles",general_roles:"Roles generales",delete_area:"Borrar área",delete_role:"Borrar rol",delete_area_desc:'¿Borrar el área "{name}"? Sus roles quedan sin área, no se eliminan.',delete_role_desc:'¿Borrar el rol "{name}"?'},files:{docs_label:"Docs",files_label:"Archivos",new_doc:"Nuevo documento",new_doc_hint:"Podés usar carpetas: cases/onboarding/spec.md",empty:"No hay archivos.",docs_empty:"Todavía no hay documentación. Creá el primer documento.",truncated:"Listado recortado (demasiados archivos).",select_prompt:"Elegí un archivo para verlo.",save:"Guardar",saved:"Guardado.",deleted:"Eliminado.",created:"Documento creado.",edit:"Editar",preview:"Preview",discard:"Descartar",no_preview:"No hay preview para este archivo.",too_large:"Archivo demasiado grande para mostrar.",path_label:"Ruta del archivo",path_example:"ej. cases/onboarding/spec.md",create:"Crear"},tasks:{state_open:"abiertas",state_done:"hechas",state_dropped:"descartadas",status_pending:"pendiente",status_running:"corriendo",status_in_review:"en revisión",status_blocked:"bloqueada",done_label:"hecha",dropped_label:"descartada",detail_title:"Detalle de task",field_title:"Título",field_prompt:"Prompt",field_status:"Estado",field_agent:"Agente",field_creator:"Creada por",field_source:"Origen",field_created:"Creada",field_updated:"Actualizada",field_done:"Completada",prompt_ph:"Descripción / prompt de la task…",toggle_prompt:"Prompt",view_thread:"Ver conversación",mark_done:"Completar"},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."}},FD={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",refresh:"Refresh",view_all:"View all",saved:"Saved.",deleted:"Deleted.",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",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memories",structure:"Structure",docs:"Docs",files:"Files"},sections:{workspace:"Workspace",content:"Content",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",routines_active:"Active routines",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"open",roster:"Team",no_agents:"No agents yet.",orchestrators:"Orchestrators",specialists:"Specialists",recent_tasks:"Recent tasks",no_activity:"No open tasks."},artifacts:{title:"Artifacts",subtitle:"Reusable scripts and files stored under the project. Agents create them; you can view, run, rename or delete them."},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",live_title:"Chat with {agent}",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.",thread_subtitle:"History with {persona} on {channel}. Replying here continues the conversation from the web.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",new_session:"New session",delete:"Delete",delete_confirm_title:"Delete chat",delete_confirm_desc:"This can't be undone. This chat's history will be permanently deleted.",deleted:"Chat deleted.",meta_created:"Created {date} · {channel}",meta_new:"New chat · {channel}",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",pick_agent:"Pick an agent"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",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}",conflict_detail:"{name} is defined in {winner} and {loser}. APX uses {winner}; {loser} is ignored.",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",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",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
669
+
670
+ 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_short:"Emotions",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_form:{emoji:"Emoji",area:"Area",role:"Role",no_role:"— no role —",autonomy:"Autonomy",autonomy_hint:"How much the agent can do without asking for confirmation.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permission"},structure:{title:"Structure",subtitle:"Company areas and roles. Areas group agents; roles define their function.",info:"Areas are optional groupings. Roles define an agent's function and may belong to an area.",empty:"No areas or roles yet. Create the first one above.",new_area:"New area",new_role:"New role",edit_area:"Edit area",edit_role:"Edit role",create_area:"Create area",create_role:"Create role",name:"Name",slug:"Slug",goal:"Goal",goal_hint:"What this area exists for (optional).",area:"Area",description:"Description",no_area:"— no area —",roles:"Roles",add_role:"role",no_roles:"no roles",general_roles:"General roles",delete_area:"Delete area",delete_role:"Delete role",delete_area_desc:'Delete area "{name}"? Its roles are detached, not deleted.',delete_role_desc:'Delete role "{name}"?'},files:{docs_label:"Docs",files_label:"Files",new_doc:"New document",new_doc_hint:"Folders allowed: cases/onboarding/spec.md",empty:"No files.",docs_empty:"No documentation yet. Create the first document.",truncated:"Listing truncated (too many files).",select_prompt:"Pick a file to view it.",save:"Save",saved:"Saved.",deleted:"Deleted.",created:"Document created.",edit:"Edit",preview:"Preview",discard:"Discard",no_preview:"No preview for this file.",too_large:"File too large to display.",path_label:"File path",path_example:"e.g. cases/onboarding/spec.md",create:"Create"},tasks:{state_open:"open",state_done:"done",state_dropped:"dropped",status_pending:"pending",status_running:"running",status_in_review:"in review",status_blocked:"blocked",done_label:"done",dropped_label:"dropped",detail_title:"Task detail",field_title:"Title",field_prompt:"Prompt",field_status:"Status",field_agent:"Agent",field_creator:"Created by",field_source:"Source",field_created:"Created",field_updated:"Updated",field_done:"Completed",prompt_ph:"Task description / prompt…",toggle_prompt:"Prompt",view_thread:"View thread",mark_done:"Complete"},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."}},l_={es:VD,en:FD};function GD(){try{const e=localStorage.getItem(On.language);if(e&&e in l_)return e}catch{}return"en"}let bp=GD();function zC(e){bp=e;try{localStorage.setItem(On.language,e)}catch{}}const DC=[{value:"es",label:"Español"},{value:"en",label:"English"}];function i_(){return bp}function YD(e){const t=l_[bp],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 KD(e,t){return t?e.replace(/\{(\w+)\}/g,(a,o)=>o in t?String(t[o]):`{${o}}`):e}function XD(e){const t=YD(e);if(t!==void 0)return t;if(bp!=="es"){const a=l_.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 d(e,t){const a=XD(e);return a===void 0?e:KD(a,t)}function c_(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 QD({collapsed:e,onToggle:t}){return s.jsx(Ke,{content:d(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:s.jsx("button",{type:"button",onClick:t,"aria-label":d(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:s.jsx(SS,{className:ke("size-4 transition-transform",e&&"rotate-180")})})})}function WD({sections:e,active:t,onChange:a,collapsed:o=!1}){return s.jsx("nav",{className:ke("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-44 px-2"),children:e.map((l,c)=>s.jsxs("div",{className:ke("w-full",c>0&&"mt-2"),children:[!o&&l.title&&s.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),s.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:u,label:p,icon:m,badge:h})=>{const g=t===u,b=s.jsxs("button",{type:"button",onClick:()=>a(u),"data-testid":`tabnav-${u||"index"}`,className:ke("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",g?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[s.jsx(m,{className:"size-4 shrink-0"}),!o&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),h!==void 0&&s.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:h})]})]});return o?s.jsx(Ke,{content:p,side:"right",children:b},u):s.jsx(x.Fragment,{children:b},u)})})]},c))})}const LC=0,PC=1,IC=2,Jj=3;var ew=Object.prototype.hasOwnProperty;function vx(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--&&vx(e[o],t[o]););return o===-1}if(!a||typeof e=="object"){o=0;for(a in e)if(ew.call(e,a)&&++o&&!ew.call(t,a)||!(a in t)||!vx(e[a],t[a]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const Va=new WeakMap,Ga=()=>{},Hn=Ga(),yx=Object,St=e=>e===Hn,la=e=>typeof e=="function",Ir=(e,t)=>({...e,...t}),BC=e=>la(e.then),lg={},Md={},u_="undefined",su=typeof window!=u_,jx=typeof document!=u_,ZD=su&&"Deno"in window,JD=()=>su&&typeof window.requestAnimationFrame!=u_,UC=(e,t)=>{const a=Va.get(e);return[()=>!St(t)&&e.get(t)||lg,o=>{if(!St(t)){const l=e.get(t);t in Md||(Md[t]=l),a[5](t,Ir(l,o),l||lg)}},a[6],()=>!St(t)&&t in Md?Md[t]:!St(t)&&e.get(t)||lg]};let wx=!0;const eL=()=>wx,[kx,Sx]=su&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ga,Ga],tL=()=>{const e=jx&&document.visibilityState;return St(e)||e!=="hidden"},nL=e=>(jx&&document.addEventListener("visibilitychange",e),kx("focus",e),()=>{jx&&document.removeEventListener("visibilitychange",e),Sx("focus",e)}),sL=e=>{const t=()=>{wx=!0,e()},a=()=>{wx=!1};return kx("online",t),kx("offline",a),()=>{Sx("online",t),Sx("offline",a)}},aL={isOnline:eL,isVisible:tL},rL={initFocus:nL,initReconnect:sL},tw=!Xc.useId,Il=!su||ZD,oL=e=>JD()?window.requestAnimationFrame(e):setTimeout(e,1),ig=Il?x.useEffect:x.useLayoutEffect,cg=typeof navigator<"u"&&navigator.connection,nw=!Il&&cg&&(["slow-2g","2g"].includes(cg.effectiveType)||cg.saveData),Od=new WeakMap,lL=e=>yx.prototype.toString.call(e),ug=(e,t)=>e===`[object ${t}]`;let iL=0;const Cx=e=>{const t=typeof e,a=lL(e),o=ug(a,"Date"),l=ug(a,"RegExp"),c=ug(a,"Object");let u,p;if(yx(e)===e&&!o&&!l){if(u=Od.get(e),u)return u;if(u=++iL+"~",Od.set(e,u),Array.isArray(e)){for(u="@",p=0;p<e.length;p++)u+=Cx(e[p])+",";Od.set(e,u)}if(c){u="#";const m=yx.keys(e).sort();for(;!St(p=m.pop());)St(e[p])||(u+=p+":"+Cx(e[p])+",");Od.set(e,u)}}else u=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},d_=e=>{if(la(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 cL=0;const Nx=()=>++cL;async function $C(...e){const[t,a,o,l]=e,c=Ir({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let u=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const h=v=>typeof p=="function"?p(v):p!==!1,g=c.throwOnError;if(la(a)){const v=a,w=[],N=t.keys();for(const y of N)!/^\$(inf|sub)\$/.test(y)&&v(t.get(y)._k)&&w.push(y);return Promise.all(w.map(b))}return b(a);async function b(v){const[w]=d_(v);if(!w)return;const[N,y]=UC(t,w),[j,E,S,C]=Va.get(t),R=()=>{const $=j[w];return(la(c.revalidate)?c.revalidate(N().data,v):c.revalidate!==!1)&&(delete S[w],delete C[w],$&&$[0])?$[0](IC).then(()=>N().data):N().data};if(e.length<3)return R();let M=o,T,O=!1;const D=Nx();E[w]=[D,0];const B=!St(m),L=N(),U=L.data,z=L._c,P=St(z)?U:z;if(B&&(m=la(m)?m(P,U):m,y({data:m,_c:P})),la(M))try{M=M(P)}catch($){T=$,O=!0}if(M&&BC(M))if(M=await M.catch($=>{T=$,O=!0}),D!==E[w][0]){if(O)throw T;return M}else O&&B&&h(T)&&(u=!0,y({data:P,_c:Hn}));if(u&&!O)if(la(u)){const $=u(M,P);y({data:$,error:Hn,_c:Hn})}else y({data:M,error:Hn,_c:Hn});if(E[w][1]=Nx(),Promise.resolve(R()).then(()=>{y({_c:Hn})}),O){if(g)throw T;return}return M}}const sw=(e,t)=>{for(const a in e)e[a][0]&&e[a][0](t)},uL=(e,t)=>{if(!Va.has(e)){const a=Ir(rL,t),o=Object.create(null),l=$C.bind(Hn,e);let c=Ga;const u=Object.create(null),p=(g,b)=>{const v=u[g]||[];return u[g]=v,v.push(b),()=>{const w=v.indexOf(b);w>=0&&(v[w]=v[v.length-1],v.pop())}},m=(g,b,v)=>{e.set(g,b);const w=u[g];if(w)for(const N of w)N(b,v)},h=()=>{if(!Va.has(e)&&(Va.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!Il)){const g=a.initFocus(setTimeout.bind(Hn,sw.bind(Hn,o,LC))),b=a.initReconnect(setTimeout.bind(Hn,sw.bind(Hn,o,PC)));c=()=>{g&&g(),b&&b(),Va.delete(e)}}};return h(),[e,l,h,c]}return[e,Va.get(e)[4]]},dL=(e,t,a,o,l)=>{const c=a.errorRetryCount,u=l.retryCount,p=~~((Math.random()+.5)*(1<<(u<8?u:8)))*a.errorRetryInterval;!St(c)&&u>c||setTimeout(o,p,l)},fL=vx,[HC,Cf]=uL(new Map),pL=Ir({onLoadingSlow:Ga,onSuccess:Ga,onError:Ga,onErrorRetry:dL,onDiscarded:Ga,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:nw?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:nw?5e3:3e3,compare:fL,isPaused:()=>!1,cache:HC,mutate:Cf,fallback:{}},aL),mL=(e,t)=>{const a=Ir(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=Ir(l,u))}return a},hL=x.createContext({}),gL="$inf$",qC=su&&window.__SWR_DEVTOOLS_USE__,xL=qC?window.__SWR_DEVTOOLS_USE__:[],bL=()=>{qC&&(window.__SWR_DEVTOOLS_REACT__=Xc)},_L=e=>la(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],VC=()=>{const e=x.useContext(hL);return x.useMemo(()=>Ir(pL,e),[e])},vL=e=>(t,a,o)=>e(t,a&&((...c)=>{const[u]=d_(t),[,,,p]=Va.get(HC);if(u.startsWith(gL))return a(...c);const m=p[u];return St(m)?a(...c):(delete p[u],m)}),o),yL=xL.concat(vL),jL=e=>function(...a){const o=VC(),[l,c,u]=_L(a),p=mL(o,u);let m=e;const{use:h}=p,g=(h||[]).concat(yL);for(let b=g.length;b--;)m=g[b](m);return m(l,c||p.fetcher||null,p)},wL=(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())}};bL();const dg=Xc.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}}),fg={dedupe:!0},Nf=Promise.resolve(Hn);Nf.status="fulfilled";Nf.value=Hn;const kL=()=>Ga,SL=(e,t,a)=>{const{cache:o,compare:l,suspense:c,fallbackData:u,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:h,refreshWhenHidden:g,refreshWhenOffline:b,keepPreviousData:v,strictServerPrefetchWarning:w}=a,[N,y,j,E]=Va.get(o),[S,C]=d_(e),R=x.useRef(!1),M=x.useRef(!1),T=x.useRef(S),O=x.useRef(t),D=x.useRef(a),B=()=>D.current,L=()=>B().isVisible()&&B().isOnline(),[U,z,P,$]=UC(o,S),V=x.useRef({}).current,q=St(u)?St(a.fallback)?Hn:a.fallback[S]:u,X=(Se,Te)=>{for(const ve in V){const Ne=ve;if(Ne==="data"){if(!l(Se[Ne],Te[Ne])&&(!St(Se[Ne])||!l(ee,Te[Ne])))return!1}else if(Te[Ne]!==Se[Ne])return!1}return!0},K=!R.current,F=x.useMemo(()=>{const Se=U(),Te=$(),ve=Ie=>{const ue=Ir(Ie);return delete ue._k,(()=>{if(!S||!t||B().isPaused())return!1;if(K&&!St(p))return p;const qe=St(q)?ue.data:q;return St(qe)||m})()?{isValidating:!0,isLoading:!0,...ue}:ue},Ne=ve(Se),De=Se===Te?Ne:ve(Te);let Pe=Ne;return[()=>{const Ie=ve(U());return X(Ie,Pe)?(Pe.data=Ie.data,Pe.isLoading=Ie.isLoading,Pe.isValidating=Ie.isValidating,Pe.error=Ie.error,Pe):(Pe=Ie,Ie)},()=>De]},[o,S]),G=vf.useSyncExternalStore(x.useCallback(Se=>P(S,(Te,ve)=>{X(ve,Te)||Se()}),[o,S]),F[0],F[1]),I=N[S]&&N[S].length>0,Y=G.data,Z=St(Y)?q&&BC(q)?dg(q):q:Y,te=G.error,fe=x.useRef(Z),ee=v?St(Y)?St(fe.current)?Z:fe.current:Y:Z,se=S&&St(Z),re=x.useRef(null);!Il&&vf.useSyncExternalStore(kL,()=>(re.current=!1,re),()=>(re.current=!0,re));const me=re.current;w&&me&&!c&&se&&console.warn(`Missing pre-initiated data for serialized key "${S}" 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 Me=!S||!t||B().isPaused()||I&&!St(te)?!1:K&&!St(p)?p:c?St(Z)?!1:m:St(Z)||m,de=K&&Me,he=St(G.isValidating)?de:G.isValidating,Ce=St(G.isLoading)?de:G.isLoading,we=x.useCallback(async Se=>{const Te=O.current;if(!S||!Te||M.current||B().isPaused())return!1;let ve,Ne,De=!0;const Pe=Se||{},Ie=!j[S]||!Pe.dedupe,ue=()=>tw?!M.current&&S===T.current&&R.current:S===T.current,_e={isValidating:!1,isLoading:!1},qe=()=>{z(_e)},Re=()=>{const et=j[S];et&&et[1]===Ne&&delete j[S]},Oe={isValidating:!0};St(U().data)&&(Oe.isLoading=!0);try{if(Ie&&(z(Oe),a.loadingTimeout&&St(U().data)&&setTimeout(()=>{De&&ue()&&B().onLoadingSlow(S,a)},a.loadingTimeout),j[S]=[Te(C),Nx()]),[ve,Ne]=j[S],ve=await ve,Ie&&setTimeout(Re,a.dedupingInterval),!j[S]||j[S][1]!==Ne)return Ie&&ue()&&B().onDiscarded(S),!1;_e.error=Hn;const et=y[S];if(!St(et)&&(Ne<=et[0]||Ne<=et[1]||et[1]===0))return qe(),Ie&&ue()&&B().onDiscarded(S),!1;const rt=U().data;_e.data=l(rt,ve)?rt:ve,Ie&&ue()&&B().onSuccess(ve,S,a)}catch(et){Re();const rt=B(),{shouldRetryOnError:vt}=rt;rt.isPaused()||(_e.error=et,Ie&&ue()&&(rt.onError(et,S,rt),(vt===!0||la(vt)&&vt(et))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||L())&&rt.onErrorRetry(et,S,rt,Mt=>{const lt=N[S];lt&&lt[0]&&lt[0](Jj,Mt)},{retryCount:(Pe.retryCount||0)+1,dedupe:!0})))}return De=!1,qe(),!0},[S,o]),Be=x.useCallback((...Se)=>$C(o,T.current,...Se),[]);if(ig(()=>{O.current=t,D.current=a,St(Y)||(fe.current=Y)}),ig(()=>{if(!S)return;const Se=we.bind(Hn,fg);let Te=0;B().revalidateOnFocus&&(Te=Date.now()+B().focusThrottleInterval);const Ne=wL(S,N,(De,Pe={})=>{if(De==LC){const Ie=Date.now();B().revalidateOnFocus&&Ie>Te&&L()&&(Te=Ie+B().focusThrottleInterval,Se())}else if(De==PC)B().revalidateOnReconnect&&L()&&Se();else{if(De==IC)return we();if(De==Jj)return we(Pe)}});return M.current=!1,T.current=S,R.current=!0,z({_k:C}),Me&&(j[S]||(St(Z)||Il?Se():oL(Se))),()=>{M.current=!0,Ne()}},[S]),ig(()=>{let Se;function Te(){const Ne=la(h)?h(U().data):h;Ne&&Se!==-1&&(Se=setTimeout(ve,Ne))}function ve(){!U().error&&(g||B().isVisible())&&(b||B().isOnline())?we(fg).then(Te):Te()}return Te(),()=>{Se&&(clearTimeout(Se),Se=-1)}},[h,g,b,S]),x.useDebugValue(ee),c){if(!tw&&Il&&se)throw new Error("Fallback data is required when using Suspense in SSR.");se&&(O.current=t,D.current=a,M.current=!1);const Se=E[S],Te=!St(Se)&&se?Be(Se):Nf;if(dg(Te),!St(te)&&se)throw te;const ve=se?we(fg):Nf;!St(ee)&&se&&(ve.status="fulfilled",ve.value=!0),dg(ve)}return{mutate:Be,get data(){return V.data=!0,ee},get error(){return V.error=!0,te},get isValidating(){return V.isValidating=!0,he},get isLoading(){return V.isLoading=!0,Ce}}},Ge=jL(SL);let Xl=null;function bo(e){Xl=e}function f_(){return Xl}class au extends Error{status;body;constructor(t,a,o){super(a),this.status=t,this.body=o}}async function ic(e,t,a,o={}){const l={"content-type":"application/json",...Xl?{authorization:`Bearer ${Xl}`}:{},...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 au(c.status,`${e} ${t} → ${c.status}: ${u}`,p)}if(c.status!==204)return await c.json()}function Tl(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 ie={get:e=>ic("GET",e),post:(e,t)=>ic("POST",e,t),put:(e,t)=>ic("PUT",e,t),patch:(e,t)=>ic("PATCH",e,t),del:e=>ic("DELETE",e)};async function FC(e,t,a,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...Xl?{authorization:`Bearer ${Xl}`}:{}},body:JSON.stringify(t)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new au(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:h}=await c.read();if(h)break;p+=u.decode(m,{stream:!0});let g=p.indexOf(`
671
+ `);for(;g>=0;){const b=p.slice(0,g).trim();if(p=p.slice(g+1),b)try{a(JSON.parse(b))}catch{}g=p.indexOf(`
672
+ `)}}if(p.trim())try{a(JSON.parse(p.trim()))}catch{}}const CL={get:()=>ie.get("/health")},cs={list:()=>ie.get("/projects"),register:e=>ie.post("/projects",{path:e}),remove:e=>ie.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ie.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ie.get(`/projects/${e}/config`),set:(e,t)=>ie.patch(`/projects/${e}/config`,{set:t}),unset:(e,t)=>ie.patch(`/projects/${e}/config`,{unset:t}),put:(e,t)=>ie.put(`/projects/${e}/config`,t)},apcProject:{set:(e,t,a)=>ie.patch(`/projects/${e}/apc-project`,{set:t,unset:a}),put:(e,t)=>ie.put(`/projects/${e}/apc-project`,t)},memory:{get:e=>ie.get(`/projects/${e}/memory`),put:(e,t)=>ie.put(`/projects/${e}/memory`,{body:t})}},ln={list:e=>ie.get(`/projects/${e}/agents`),get:(e,t)=>ie.get(`/projects/${e}/agents/${t}`),create:(e,t)=>ie.post(`/projects/${e}/agents`,t),update:(e,t,a)=>ie.patch(`/projects/${e}/agents/${encodeURIComponent(t)}`,a),remove:(e,t)=>ie.del(`/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,a)=>ie.post(`/projects/${e}/agents/${encodeURIComponent(t)}/chat`,a),memory:{get:(e,t)=>ie.get(`/projects/${e}/agents/${t}/memory`),put:(e,t,a)=>ie.put(`/projects/${e}/agents/${t}/memory`,{body:a})},vault:e=>ie.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,t={},a="")=>ie.post("/agents/vault",{slug:e,fields:t,body:a}),vaultPatch:(e,t)=>ie.patch(`/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>ie.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ie.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>ie.post(`/projects/${e}/agents/import`,{slug:t})},Eo={list:(e,t)=>ie.get(`/projects/${e}/agents/${t}/conversations`),get:(e,t,a)=>ie.get(`/projects/${e}/agents/${t}/conversations/${a}`),threads:e=>ie.get(`/projects/${e}/super-agent/threads`),thread:(e,t,a)=>ie.get(`/projects/${e}/super-agent/threads/${t}/${a}`),remove:(e,t,a)=>ie.del(`/projects/${e}/agents/${t}/conversations/${a}`),removeThread:(e,t,a)=>ie.del(`/projects/${e}/super-agent/threads/${t}/${a}`),compact:(e,t,a)=>ie.post(a?`/projects/${e}/agents/${t}/conversations/${a}/compact`:`/projects/${e}/agents/${t}/compact`,{})},Er={list:e=>ie.get(`/projects/${e}/routines`),get:(e,t)=>ie.get(`/projects/${e}/routines/${t}`),run:(e,t)=>ie.post(`/projects/${e}/routines/${t}/run`),enable:(e,t)=>ie.post(`/projects/${e}/routines/${t}/enable`),disable:(e,t)=>ie.post(`/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>ie.post(`/projects/${e}/routines`,t),remove:(e,t)=>ie.del(`/projects/${e}/routines/${encodeURIComponent(t)}`)},Qn={list:(e,t="open")=>ie.get(`/projects/${e}/tasks?state=${t}`).then(a=>Tl(a).items),global:(e="open")=>ie.get(`/tasks?state=${e}`).then(t=>Tl(t).items),listPage:(e,{state:t,limit:a,offset:o})=>ie.get(`/projects/${e}/tasks?state=${t}&limit=${a}&offset=${o}`).then(l=>Tl(l)),globalPage:({state:e,limit:t,offset:a})=>ie.get(`/tasks?state=${e}&limit=${t}&offset=${a}`).then(o=>Tl(o)),get:(e,t)=>ie.get(`/projects/${e}/tasks/${t}`),add:(e,t)=>ie.post(`/projects/${e}/tasks`,t),patch:(e,t,a)=>ie.patch(`/projects/${e}/tasks/${t}`,{patch:a}),status:(e,t,a)=>ie.post(`/projects/${e}/tasks/${t}/status`,{status:a}),done:(e,t)=>ie.post(`/projects/${e}/tasks/${t}/done`),drop:(e,t)=>ie.post(`/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>ie.post(`/projects/${e}/tasks/${t}/reopen`),summary:e=>ie.get(`/projects/${e}/tasks-summary`)},Rr={list:e=>ie.get(`/projects/${e}/mcps`),check:e=>ie.get(`/projects/${e}/mcps/check`),add:(e,t,a)=>ie.post(`/projects/${e}/mcps?scope=${t}`,a),remove:(e,t,a="shared")=>ie.del(`/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${a}`),test:(e,t)=>ie.post(`/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>ie.get(`/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},Vc={list:(e,t={})=>ie.get(`/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,a={})=>ie.get(`/projects/${e}/vars/${encodeURIComponent(t)}${a.reveal?"?reveal=1":""}`),upsert:(e,t)=>ie.post(`/projects/${e}/vars`,t),remove:(e,t,a="project")=>ie.del(`/projects/${e}/vars/${encodeURIComponent(t)}?scope=${a}`)},pg=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}`:""},Ef={global:(e={})=>ie.get(`/messages/global${pg(e)}`),project:(e,t={})=>ie.get(`/projects/${e}/messages${pg(t)}`),search:(e,t,a=50)=>ie.get(`/projects/${e}/messages/search${pg({q:t,limit:a})}`)},NL={global:e=>ie.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:Tl(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"),ie.get(`/sessions?${c.toString()}`).then(u=>Tl(u))}},EL={list:()=>ie.get("/tools")},zn={channels:{list:()=>ie.get("/telegram/channels"),upsert:e=>ie.post("/telegram/channels",e),patch:(e,t)=>ie.patch(`/telegram/channels/${e}`,t),remove:e=>ie.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ie.get("/telegram/contacts"),patch:(e,t)=>ie.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>ie.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ie.get("/telegram/roles"),set:(e,t)=>ie.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>ie.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ie.get("/telegram/status"),start:()=>ie.post("/telegram/start"),stop:()=>ie.post("/telegram/stop"),send:e=>ie.post("/telegram/send",e)},Rf={list:()=>ie.get("/engines"),models:e=>ie.post("/engines/models",e)},Ql={reload:()=>ie.post("/admin/reload"),shutdown:()=>ie.post("/admin/shutdown"),config:{get:()=>ie.get("/admin/config"),patch:e=>ie.patch("/admin/config",e)},superAgent:()=>ie.get("/admin/super-agent"),logs:(e="errors",t=200)=>ie.get(`/admin/logs?file=${e}&limit=${t}`)},Wl={list:()=>ie.get("/pair/list"),revoke:e=>ie.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ie.post("/pair/init",{}),status:e=>ie.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ie.post("/pair/confirm",e)},aw={get:()=>ie.get("/identity"),patch:e=>ie.patch("/identity",e)},GC={send:(e,t)=>ie.post(`/projects/${e}/super-agent/chat`,t),stream:(e,t,a,o)=>FC(`/projects/${e}/super-agent/chat/stream`,t,a,o),summarize:e=>ie.post("/super-agent/summarize",e)},rw={dirs:e=>ie.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>ie.get(`/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},RL=["alloy","echo","fable","onyx","nova","shimmer"],TL=["Kore","Puck","Charon","Fenrir","Aoede"],AL=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],ML=["tts-1","tts-1-hd"],OL=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],zL=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],Tf={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 DL(e){const t=f_(),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 Af={providers:()=>ie.get("/tts/providers"),sttHardware:()=>ie.get("/transcribe/hardware"),sttModels:e=>ie.get(`/transcribe/models?backend=${e}`),say:e=>ie.post("/tts/say",e),turn:e=>ie.post("/voice/turn",e)},YC={manifest:()=>ie.get("/deck/manifest"),setWidget:(e,t)=>ie.patch(`/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>ie.post("/deck/exec",e)},fo=e=>`/projects/${e}/code/sessions`,$a={sessions:{list:e=>ie.get(fo(e)).then(t=>t.sessions),get:(e,t)=>ie.get(`${fo(e)}/${t}`),create:(e,t={})=>ie.post(fo(e),t),update:(e,t,a)=>ie.patch(`${fo(e)}/${t}`,a),remove:(e,t)=>ie.del(`${fo(e)}/${t}`)},changes:(e,t)=>ie.get(`${fo(e)}/${t}/changes`),stream:(e,t,a,o,l)=>FC(`${fo(e)}/${t}/chat/stream`,a,o,l)},Ar={list:e=>ie.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>ie.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,a=[])=>ie.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:a}),remove:(e,t)=>ie.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,a)=>ie.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:a}),rename:(e,t,a)=>ie.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:a})},vc={list:e=>ie.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>ie.get("/skills/inspector"),updateInspector:e=>ie.put("/skills/inspector",e),index:(e={})=>ie.post("/skills/index",e),inspect:(e,t)=>ie.post("/skills/inspect",{prompt:e,project_path:t})},Or={get:e=>ie.get(`/projects/${e}/organization`),createArea:(e,t)=>ie.post(`/projects/${e}/organization/areas`,t),updateArea:(e,t,a)=>ie.patch(`/projects/${e}/organization/areas/${encodeURIComponent(t)}`,a),removeArea:(e,t)=>ie.del(`/projects/${e}/organization/areas/${encodeURIComponent(t)}`),createRole:(e,t)=>ie.post(`/projects/${e}/organization/roles`,t),updateRole:(e,t,a)=>ie.patch(`/projects/${e}/organization/roles/${encodeURIComponent(t)}`,a),removeRole:(e,t)=>ie.del(`/projects/${e}/organization/roles/${encodeURIComponent(t)}`)},yc={tree:(e,t="project")=>ie.get(`/projects/${e}/fs/tree?scope=${t}`),read:(e,t,a="project")=>ie.get(`/projects/${e}/fs/file?scope=${a}&path=${encodeURIComponent(t)}`),write:(e,t,a,o="project")=>ie.put(`/projects/${e}/fs/file`,{scope:o,path:t,content:a}),mkdir:(e,t,a="project")=>ie.post(`/projects/${e}/fs/dir`,{scope:a,path:t}),remove:(e,t,a="project")=>ie.del(`/projects/${e}/fs/entry?scope=${a}&path=${encodeURIComponent(t)}`)};function ru(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/projects",()=>cs.list(),{refreshInterval:Gf.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 p_(e){const{projects:t,isLoading:a,mutate:o}=ru();return{project:t.find(c=>String(c.id)===e)??null,isLoading:a,mutate:o}}function m_(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/identity",()=>aw.get());return{identity:e||{},error:t,isLoading:a,mutate:o,save:async c=>{const u=await aw.patch(c);return await o(u,{revalidate:!1}),u}}}function _p(){const{identity:e}=m_();return e?.agent_name?.trim()||"APX"}function LL(){return[{id:"desktop",label:d("nav.modules.desktop"),href:"/m/desktop",icon:cb},{id:"code",label:d("nav.modules.code"),href:"/m/code",icon:Ka}]}function PL(e,t,a){const[o,l]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!a)return;const u=()=>{const m=getComputedStyle(c),h=(parseFloat(m.paddingTop)||0)+(parseFloat(m.paddingBottom)||0),g=c.clientHeight-h;if(g<=0)return;const b=parseFloat(m.rowGap)||12,w=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+b,y=Math.max(0,Math.floor((g+b)/w))-1;l(y>=t?t:Math.max(0,y-1))};u();const p=new ResizeObserver(u);return p.observe(c),()=>p.disconnect()},[e,t,a]),a?Math.min(o,t):t}function ow({projects:e,label:t,sublabel:a,icon:o,tooltip:l,header:c,active:u,testId:p,onSelect:m,isActive:h}){return s.jsxs(AC,{children:[s.jsxs(MC,{"data-testid":p,title:l,"aria-label":l,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[s.jsx("span",{className:ke("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&&s.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:a})]}),s.jsxs(OC,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[s.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:c}),e.map(g=>{const b=g.name||g.path.split("/").pop()||String(g.id),v=`/p/${g.id}`,{initials:w,idleClass:N}=Vz(b);return s.jsxs($D,{"data-testid":`project-menu-item-${g.id}`,onClick:()=>m(v),className:ke(h(v)&&"bg-accent/60 text-foreground"),children:[s.jsx("span",{className:ke("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",N),children:w}),s.jsx("span",{className:"truncate",children:b})]},g.id)})]})]})}function IL({onSelect:e,onOpenRoby:t,onOpenAddProject:a}){const{projects:o,isLoading:l}=ru(),c=es(),u=LL(),p=_p(),m=x.useRef(null),{collapsed:h,toggle:g}=c_(On.sidebarCollapsed+".projects"),b=S=>c.pathname===S||c.pathname.startsWith(`${S}/`),v=o.find(S=>String(S.id)==="0"),w=o.filter(S=>String(S.id)!=="0").sort((S,C)=>Number(C.id)-Number(S.id)),N=PL(m,w.length,!h&&w.length>0),y=w.slice(0,N),j=w.slice(N),E=j.some(S=>b(`/p/${S.id}`));return s.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[s.jsx(Ke,{content:d("nav.apx_admin"),side:"right",children:s.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:s.jsx(G3,{size:36})})}),l&&s.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),v&&s.jsx(Sl,{label:d("base.title"),testId:"project-avatar-0",title:d("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:s.jsx("img",{src:"/modules/superagent.png",alt:d("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),u.map(S=>s.jsx(Sl,{label:S.label,testId:`module-avatar-${S.id}`,title:S.label,active:b(S.href),icon:s.jsx(S.icon,{size:18}),onClick:()=>e(S.href)},S.id)),s.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[w.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),s.jsx(Ke,{content:d(h?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:s.jsx("button",{type:"button",onClick:g,"data-testid":"nav-toggle-projects","aria-label":d(h?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!h,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:s.jsx(Bs,{className:ke("size-3.5 transition-transform",h&&"-rotate-90")})})})]}),s.jsxs("div",{ref:m,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden py-1.5",children:[w.length>0&&h&&s.jsx(ow,{projects:w,icon:s.jsx(h3,{size:18}),sublabel:String(w.length),tooltip:d("nav.all_projects"),header:d("nav.all_projects"),active:w.some(S=>b(`/p/${S.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),w.length>0&&!h&&s.jsxs(s.Fragment,{children:[s.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:s.jsx(Sl,{label:"Ag",active:!1,onClick:()=>{}})}),y.map(S=>{const C=S.name||S.path.split("/").pop()||String(S.id),R=`/p/${S.id}`;return s.jsx("div",{"data-rail-item":!0,className:"w-full",children:s.jsx(Sl,{label:C,testId:`project-avatar-${S.id}`,title:`${C} — ${S.path}`,active:b(R),onClick:()=>e(R)})},S.id)}),j.length>0&&s.jsx(ow,{projects:j,label:`+${j.length}`,tooltip:d("nav.more_projects",{count:j.length}),header:d("nav.more_projects",{count:j.length}),active:E,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),s.jsx(Sl,{label:d("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:s.jsx(Kt,{size:18}),active:!1,onClick:()=>a?a():e("/?action=add-project"),title:d("nav.add_project")})]})]}),s.jsx(Sl,{label:d("nav.settings"),isSettings:!0,testId:"nav-settings",icon:s.jsx(Ic,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:d("nav.settings")}),s.jsx(Ke,{content:d("settings_ui.documentation"),side:"right",children:s.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":d("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:s.jsx(GM,{size:18})})}),s.jsx(Ke,{content:d("superagent.talk",{persona:p}),side:"right",children:s.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":d("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:s.jsx(rn,{size:18})})})]})}function KC(e){switch(e){case"personal":return d("settings_ui.kind_personal");case"company":return d("settings_ui.kind_company");case"app":return d("settings_ui.kind_app");case"software":return d("settings_ui.kind_software");case"default":return d("settings_ui.kind_default");case"other":return d("settings_ui.kind_other");default:return d("nav.project")}}function Ve({title:e,description:t,action:a,className:o,children:l,fullHeight:c}){return s.jsxs("section",{className:ke("rounded-xl border border-border bg-card p-5",c&&"flex h-full min-h-0 flex-col",o),children:[s.jsxs("header",{className:ke("mb-4 flex items-start justify-between gap-4",c&&"shrink-0"),children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&s.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),a]}),s.jsx("div",{className:ke(c&&"flex min-h-0 flex-1 flex-col"),children:l})]})}function lw({children:e}){return s.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 ou({ok:e}){return s.jsx("span",{className:ke("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const BL=x.forwardRef(function(t,a){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:p=!0,style:m,...h}=t,{getButtonProps:g,buttonRef:b}=Fr({disabled:c,focusableWhenDisabled:u,native:p});return Et("button",t,{state:{disabled:c},ref:[a,b],props:[h,g]})}),iw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cw=Bc,h_=(e,t)=>a=>{var o;if(t?.variants==null)return cw(e,a?.class,a?.className);const{variants:l,defaultVariants:c}=t,u=Object.keys(l).map(h=>{const g=a?.[h],b=c?.[h];if(g===null)return null;const v=iw(g)||iw(b);return l[h][v]}),p=a&&Object.entries(a).reduce((h,g)=>{let[b,v]=g;return v===void 0||(h[b]=v),h},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((h,g)=>{let{class:b,className:v,...w}=g;return Object.entries(w).every(N=>{let[y,j]=N;return Array.isArray(j)?j.includes({...c,...p}[y]):{...c,...p}[y]===j})?[...h,b,v]:h},[]);return cw(e,u,m,a?.class,a?.className)},UL=h_("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 Za({className:e,variant:t="default",size:a="default",...o}){return s.jsx(BL,{"data-slot":"button",className:Ct(UL({variant:t,size:a,className:e})),...o})}let uw=(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 $L={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},jc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},HL={disabled:!1,...jc},g_={valid(e){return e===null?null:e?{[uw.valid]:""}:{[uw.invalid]:""}}},qL={invalid:void 0,name:void 0,validityData:{state:$L,errors:[],error:"",value:"",initialValue:null},setValidityData:An,disabled:void 0,touched:jc.touched,setTouched:An,dirty:jc.dirty,setDirty:An,filled:jc.filled,setFilled:An,focused:jc.focused,setFocused:An,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:HL,markedDirtyRef:{current:!1},registerFieldControl:An,validation:{getValidationProps:(e,t=Yt)=>t,inputRef:{current:null},registerInput:An,commit:async()=>{},change:An}},VL=x.createContext(qL);function lu(e=!0){const t=x.useContext(VL);if(t.setValidityData===An&&!e)throw new Error(on(28));return t}const FL=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:An,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function x_(){return x.useContext(FL)}const GL=x.createContext({controlId:void 0,registerControlId:An,labelId:void 0,setLabelId:An,messageIds:[],setMessageIds:An,getDescriptionProps:e=>e});function vp(){return x.useContext(GL)}function YL(e,t,a,o=!0,l){const[c,u]=x.useState(),p=Ws(l?`${l}-label`:void 0),m=e??t??c;return ze(()=>{const h=e||t||!o?void 0:KL(a.current,p);c!==h&&u(h)}),m}function KL(e,t){const a=XL(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function XL(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 yp(e={}){const{id:t,implicit:a=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=vp(),u=Ws(t),p=a?l:void 0,m=Jn(()=>Symbol("labelable-control")),h=x.useRef(!1),g=x.useRef(t!=null),b=Ue(()=>{!h.current||c===An||(h.current=!1,c(m.current,void 0))});return ze(()=>{if(c===An)return;let v;if(a){const w=o?.current;bt(w)&&w.closest("label")!=null?v=t??null:v=p??u}else if(t!=null)g.current=!0,v=t;else if(g.current)v=u;else{b();return}if(v===void 0){b();return}h.current=!0,c(m.current,v)},[t,o,p,c,a,u,m,b]),x.useEffect(()=>b,[b]),l??u}function b_(e,t,a,o,l=!0,c){const{registerFieldControl:u}=lu(),p=x.useRef(null);p.current||(p.current=Symbol()),ze(()=>{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 QL=x.forwardRef(function(t,a){const{render:o,className:l,id:c,name:u,value:p,disabled:m=!1,onValueChange:h,defaultValue:g,autoFocus:b=!1,style:v,...w}=t,{state:N,name:y,disabled:j,setTouched:E,setDirty:S,validityData:C,setFocused:R,setFilled:M,validationMode:T,validation:O}=lu(),{clearErrors:D}=x_(),B=j||m,L=y??u,U={...N,disabled:B},{labelId:z}=vp(),P=yp({id:c});ze(()=>{const G=p!=null;O.inputRef.current?.value||G&&p!==""?M(!0):G&&p===""&&M(!1)},[O.inputRef,M,p]);const $=x.useRef(null);ze(()=>{b&&$.current===Gn(xt($.current))&&R(!0)},[b,R]);const[V]=Kl({controlled:p,default:g,name:"FieldControl",state:"value"}),q=p!==void 0,X=q?V:void 0,K=Ue(()=>O.inputRef.current?.value);return b_(O.inputRef,P,X,K,!B,u),Et("input",t,{ref:[a,$],state:U,props:[{id:P,disabled:B,name:L,ref:O.inputRef,"aria-labelledby":z,autoFocus:b,...q?{value:X}:{defaultValue:g},onChange(G){const I=G.currentTarget.value;h?.(I,st(ha,G.nativeEvent)),S(I!==C.initialValue),M(I!==""),G.nativeEvent.defaultPrevented||(D(L),O.change(I))},onFocus(){R(!0)},onBlur(G){E(!0),R(!1),T==="onBlur"&&O.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(E(!0),O.commit(G.currentTarget.value))}},w,G=>O.getValidationProps(B,G)],stateAttributesMapping:g_})}),WL=x.forwardRef(function(t,a){return s.jsx(QL,{ref:a,...t})});function ZL({className:e,type:t,...a}){return s.jsx(WL,{type:t,"data-slot":"input",className:Ct("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 JL({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:Ct("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 eP(e){return Et(e.defaultTagName??"div",e,e)}const tP=h_("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 nP({className:e,variant:t="default",render:a,...o}){return eP({defaultTagName:"span",props:Kn({className:Ct(tP({variant:t}),e)},o),render:a,state:{slot:"badge",variant:t}})}const XC=x.createContext(void 0);function sP(){const e=x.useContext(XC);if(e===void 0)throw new Error(on(63));return e}let dw=(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 QC={...g_,checked(e){return e?{[dw.checked]:""}:{[dw.unchecked]:""}}},aP=x.forwardRef(function(t,a){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":u,form:p,id:m,inputRef:h,name:g,nativeButton:b=!1,onCheckedChange:v,readOnly:w=!1,required:N=!1,disabled:y=!1,render:j,uncheckedValue:E,value:S,style:C,...R}=t,{clearErrors:M}=x_(),{state:T,setTouched:O,setDirty:D,validityData:B,setFilled:L,setFocused:U,validationMode:z,disabled:P,name:$,validation:V}=lu(),{labelId:q}=vp(),X=P||y,K=$??g,F=x.useRef(null),G=Qa(F,h,V.inputRef),I=x.useRef(null),Y=Ws(),Z=yp({id:m,implicit:!1,controlRef:I}),te=b?void 0:Z,[fe,ee]=Kl({controlled:o,default:!!c,name:"Switch",state:"checked"});b_(I,Y,fe,void 0,!X,g),ze(()=>{F.current&&L(F.current.checked)},[F,L]),r_(fe,()=>{M(K),D(fe!==B.initialValue),L(fe),V.change(fe)});const{getButtonProps:se,buttonRef:re}=Fr({disabled:X,native:b}),me=YL(u,q,F,!b,te),Me={id:b?Z:Y,role:"switch","aria-checked":fe,"aria-readonly":w||void 0,"aria-required":N||void 0,"aria-labelledby":me,onFocus(){X||U(!0)},onBlur(){const we=F.current;!we||X||(O(!0),U(!1),z==="onBlur"&&V.commit(we.checked))},onClick(we){if(w||X)return;we.preventDefault();const Be=F.current;Be&&Be.dispatchEvent(new(Qt(Be)).PointerEvent("click",{bubbles:!0,shiftKey:we.shiftKey,ctrlKey:we.ctrlKey,altKey:we.altKey,metaKey:we.metaKey}))}},de=Kn({checked:fe,disabled:X,form:p,id:te,name:K,required:N,style:K?QS:Cb,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(we){if(we.nativeEvent.defaultPrevented)return;if(w){we.preventDefault();return}const Be=we.currentTarget.checked,$e=st(ha,we.nativeEvent);v?.(Be,$e),!$e.isCanceled&&ee(Be)},onFocus(){I.current?.focus()}},we=>V.getValidationProps(X,we),S!==void 0?{value:S}:Yt),he=x.useMemo(()=>({...T,checked:fe,disabled:X,readOnly:w,required:N}),[T,fe,X,w,N]),Ce=Et("span",t,{state:he,ref:[a,I,re],props:[Me,R,se,we=>V.getValidationProps(X,we)],stateAttributesMapping:QC});return s.jsxs(XC.Provider,{value:he,children:[Ce,!fe&&K&&E!==void 0&&s.jsx("input",{type:"hidden",form:p,name:K,value:E,disabled:X}),s.jsx("input",{...de,suppressHydrationWarning:!0})]})}),rP=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,p=sP();return Et("span",t,{state:p,ref:a,stateAttributesMapping:QC,props:u})});function oP({className:e,size:t="default",...a}){return s.jsx(aP,{"data-slot":"switch","data-size":t,className:Ct("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:s.jsx(rP,{"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 lP({className:e,...t}){return s.jsx(Zc,{role:"status","aria-label":"Loading",className:Ct("size-4 animate-spin",e),...t})}const WC=x.createContext(!1),ZC=x.createContext(void 0);function Po(e){const t=x.useContext(ZC);if(e===!1&&t===void 0)throw new Error(on(27));return t}const iP={...Lo,...tr},JC=x.forwardRef(function(t,a){const{render:o,className:l,style:c,forceRender:u=!1,...p}=t,{store:m}=Po(),h=m.useState("open"),g=m.useState("nested"),b=m.useState("mounted"),v=m.useState("transitionStatus");return Et("div",t,{state:{open:h,transitionStatus:v},ref:[m.context.backdropRef,a],stateAttributesMapping:iP,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:u||!g})}),jp=x.forwardRef(function(t,a){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,...m}=t,{store:h}=Po(),g=h.useState("open"),{getButtonProps:b,buttonRef:v}=Fr({disabled:u,native:p}),w={disabled:u};function N(y){g&&h.setOpen(!1,st(Y5,y.nativeEvent))}return Et("button",t,{state:w,ref:[a,v],props:[{onClick:N},m,b]})}),eN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=Po(),h=Ws(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),Et("p",t,{ref:a,props:[{id:h},p]})});let cP=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),uP=(function(e){return e[e.open=_o.open]="open",e[e.closed=_o.closed]="closed",e[e.startingStyle=_o.startingStyle]="startingStyle",e[e.endingStyle=_o.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tN=x.createContext(void 0);function dP(){const e=x.useContext(tN);if(e===void 0)throw new Error(on(26));return e}const fP={...Lo,...tr,nestedDialogOpen(e){return e?{[uP.nestedDialogOpen]:""}:null}},nN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,initialFocus:p,...m}=t,{store:h}=Po(),g=h.useState("descriptionElementId"),b=h.useState("disablePointerDismissal"),v=h.useState("floatingRootContext"),w=h.useState("popupProps"),N=h.useState("modal"),y=h.useState("mounted"),j=h.useState("nested"),E=h.useState("nestedOpenDialogCount"),S=h.useState("open"),C=h.useState("openMethod"),R=h.useState("titleElementId"),M=h.useState("transitionStatus"),T=h.useState("role"),O=v.useState("floatingId"),D=m.id??O;dP(),ba({open:S,ref:h.context.popupRef,onComplete(){S&&h.context.onOpenChangeComplete?.(!0)}});const B=p===void 0?Z4(h.context.popupRef):p,L=E>0,U=h.useStateSetter("popupElement"),P=Et("div",t,{state:{open:S,nested:j,transitionStatus:M,nestedDialogOpen:L},props:[w,{id:D,"aria-labelledby":R??void 0,"aria-describedby":g??void 0,role:T,...ip,hidden:!y,onKeyDown($){gp.has($.key)&&$.stopPropagation()},style:{[cP.nestedDialogs]:E}},m],ref:[a,h.context.popupRef,U],stateAttributesMapping:fP});return s.jsx(Ib,{context:v,openInteractionType:C,disabled:!y,closeOnFocusOut:!b,initialFocus:B,returnFocus:u,modal:N!==!1,restoreFocus:"popup",children:P})}),sN=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=Po(),u=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return u||o?s.jsx(tN.Provider,{value:o,children:s.jsxs(Db,{ref:a,...l,children:[u&&p===!0&&s.jsx(a_,{ref:c.context.internalBackdropRef,inert:fp(!m)}),t.children]})}):null});function pP(e){const{store:t,actionsRef:a}=e,o=t.useState("open");tz(t,o),Hb(t);const{forceUnmount:l}=qb(o,t),c=x.useCallback(()=>{t.setOpen(!1,st(kb))},[t]);x.useImperativeHandle(a,()=>({unmount:l,close:c}),[l,c])}function mP({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,h]=x.useState(0),[g,b]=x.useState(0),v=m===0,w=ap(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!e.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const S=qn(E);return v&&!l?c&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===S||e.context.backdropRef.current===S||We(S,u)&&!S?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:v});yC(o&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(E,S)=>{h(E),b(S)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),b(0)}),x.useEffect(()=>(t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(m+1,g+(a?1:0)),t?.onNestedDialogClose&&!o&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&o&&t.onNestedDialogClose()}),[a,o,m,g,t]);const N=w.reference??Yt,y=w.trigger??Yt,j=w.floating??Yt;return Vb(e,{activeTriggerProps:N,inactiveTriggerProps:y,popupProps:j,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const hP={...Yb,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 __ extends op{constructor(t,a,o=!1){const l=new tu,c=gP(t);c.floatingRootContext=$2(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},hP)}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 P2(t,(l,c)=>new __(a,l,c),!0).store}}function gP(e={}){return{...Fb(),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 xP(e,t="dialog"){const{children:a,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:h,handle:g,triggerId:b,defaultTriggerId:v=null}=e,w=t==="drawer",N=t==="alert-dialog",y=N?!0:m,j=N||p,E=N?"alertdialog":"dialog",S=Po(!0),R={modal:y,disablePointerDismissal:j,nested:!!S,role:E},M=__.useStore(g?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...R});Ub(()=>{const U=o===void 0&&M.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;N?M.update(U?{...R,...U}:R):U&&M.update(U)}),M.useControlledProp("openProp",o),M.useControlledProp("triggerIdProp",b),M.useSyncedValues(R),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",u);const T=M.useState("open"),O=M.useState("mounted"),D=M.useState("payload");pP({store:M,actionsRef:h});const B=T||O,L=x.useMemo(()=>({store:M}),[M]);return s.jsx(WC.Provider,{value:!1,children:s.jsxs(ZC.Provider,{value:L,children:[B&&s.jsx(mP,{store:M,parentContext:S?.store.context,isDrawer:w}),typeof a=="function"?a({payload:D}):a]})})}function aN(e){const t=x.useContext(WC)?"drawer":"dialog";return xP(e,t)}const rN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=Po(),h=Ws(u);return m.useSyncedValueWithCleanup("titleElementId",h),Et("h2",t,{ref:a,props:[{id:h},p]})});function Ex({...e}){return s.jsx(aN,{"data-slot":"dialog",...e})}function bP({...e}){return s.jsx(sN,{"data-slot":"dialog-portal",...e})}function _P({...e}){return s.jsx(jp,{"data-slot":"dialog-close",...e})}function vP({className:e,...t}){return s.jsx(JC,{"data-slot":"dialog-overlay",className:Ct("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 Rx({className:e,children:t,showCloseButton:a=!0,...o}){return s.jsxs(bP,{children:[s.jsx(vP,{}),s.jsxs(nN,{"data-slot":"dialog-content",className:Ct("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&&s.jsxs(jp,{"data-slot":"dialog-close",render:s.jsx(Za,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[s.jsx(Us,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Tx({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ct("flex flex-col gap-2",e),...t})}function fw({className:e,showCloseButton:t=!1,children:a,...o}){return s.jsxs("div",{"data-slot":"dialog-footer",className:Ct("-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&&s.jsx(jp,{render:s.jsx(Za,{variant:"outline"}),children:"Close"})]})}function Ax({className:e,...t}){return s.jsx(rN,{"data-slot":"dialog-title",className:Ct("font-heading text-base leading-none font-medium",e),...t})}function yP({className:e,...t}){return s.jsx(eN,{"data-slot":"dialog-description",className:Ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const jP={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},wP={sm:"sm",md:"default"};function ne({variant:e="secondary",size:t="md",loading:a,className:o,children:l,disabled:c,type:u="button",...p}){return s.jsxs(Za,{type:u,variant:jP[e],size:wP[t],disabled:c||a,className:o,...p,children:[a?s.jsx(Dn,{size:14}):null,l]})}function Ee(e){return s.jsx(ZL,{...e})}function pn(e){return s.jsx(JL,{...e})}function kP(e){return s.jsx("select",{...e,className:ke("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 s.jsxs("div",{className:"block space-y-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a&&s.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&&s.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Wt({checked:e,onChange:t,label:a,disabled:o}){return s.jsxs("label",{className:ke("inline-flex items-center gap-2",o&&"opacity-50"),children:[s.jsx(oP,{checked:e,onCheckedChange:t,disabled:o}),a&&s.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 s.jsx(nP,{variant:o,className:ke("rounded-md",l[t],a),children:e})}function cn({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 s.jsx(Ex,{open:e,onOpenChange:m=>{m||t()},children:s.jsxs(Rx,{className:ke("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[u]),children:[(a||o)&&s.jsxs(Tx,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a&&s.jsx(Ax,{children:a}),o&&s.jsx(yP,{children:o})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&s.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function Dn({size:e=14}){return s.jsx(lP,{style:{width:e,height:e}})}function gt({children:e}){return s.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 ot({label:e="Cargando…"}){return s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Dn,{})," ",e]})}const oN=x.createContext(null);let SP=1;function CP({children:e}){const[t,a]=x.useState([]),o=x.useCallback((c,u)=>{const p=SP++;a(m=>[...m,{id:p,kind:c,message:u}]),setTimeout(()=>{a(m=>m.filter(h=>h.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]),s.jsxs(oN.Provider,{value:l,children:[e,s.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=>s.jsx("div",{className:ke("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:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:ke("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")}),s.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function nt(){const e=x.useContext(oN);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function lN(){const{data:e,error:t,isLoading:a}=Ge("/health",()=>CL.get(),{refreshInterval:Gf.health});return{health:e,error:t,isLoading:a,isUp:!t&&!!e}}function NP(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/engines",()=>Rf.list());return{engines:e?.engines||[],error:t,isLoading:a,mutate:o}}function EP(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/telegram/status",()=>zn.status(),{refreshInterval:Gf.telegramStatus});return{status:e,error:t,isLoading:a,mutate:o}}function v_(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/telegram/channels",()=>zn.channels.list());return{channels:e?.channels||[],error:t,isLoading:a,mutate:o}}function y_(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/telegram/contacts",()=>zn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:a,mutate:o}}function us(e){return typeof e=="string"&&e.startsWith("*** set ***")}function zr(e,t="(no seteada)"){return us(e)?e:t}function Ro(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function iN({channel:e,onClose:t,onSaved:a}){const o=nt(),[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(d("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===u.name?await zn.channels.patch(e.name,u):await zn.channels.upsert(u),o.success(d("telegram_channel_dialog.saved")),a()}catch(h){o.error(h.message)}finally{c(!1)}};return s.jsx(cn,{open:!!e,onClose:t,title:e?.name?d("telegram_channel_dialog.edit_title",{name:e.name}):d("telegram_channel_dialog.new_title"),description:d("telegram_ui.channel_dialog_desc"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:l,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:m,loading:l,children:d("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("telegram_channel_dialog.name_label"),children:s.jsx(Ee,{value:u.name,onChange:h=>p({...u,name:h.target.value}),disabled:!!e?.name})}),s.jsx(le,{label:d("telegram_channel_dialog.token_label"),hint:e?.bot_token?zr(e.bot_token):d("telegram_ui.bot_token_hint"),children:s.jsx(Ee,{type:"password",value:u.bot_token||"",onChange:h=>p({...u,bot_token:h.target.value}),placeholder:e?.bot_token?zr(e.bot_token):""})}),s.jsx(le,{label:d("telegram_channel_dialog.chat_id"),children:s.jsx(Ee,{value:u.chat_id||"",onChange:h=>p({...u,chat_id:h.target.value})})}),s.jsx(le,{label:d("telegram_channel_dialog.project_label"),hint:d("telegram_channel_dialog.project_hint"),children:s.jsx(Ee,{value:u.project||"",onChange:h=>p({...u,project:h.target.value})})}),s.jsx(le,{label:d("telegram_channel_dialog.route_label"),hint:d("telegram_channel_dialog.route_hint"),children:s.jsx(Ee,{value:u.route_to_agent||"",onChange:h=>p({...u,route_to_agent:h.target.value})})}),s.jsx(le,{label:d("telegram_channel_dialog.owner_label"),hint:d("telegram_channel_dialog.owner_hint"),children:s.jsx(Ee,{value:u.owner_user_id!=null?String(u.owner_user_id):"",onChange:h=>{const g=h.target.value.trim();p({...u,owner_user_id:g===""?void 0:/^\d+$/.test(g)?Number(g):g})},placeholder:"889721252"})}),s.jsx(Wt,{checked:!!u.respond_with_engine,onChange:h=>p({...u,respond_with_engine:h}),label:d("telegram_channel_dialog.respond_label")})]})})}function cN({channel:e,onClose:t}){const a=nt(),[o,l]=x.useState(d("admin.telegram_default_message")),[c,u]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){u(!0);try{await zn.send({text:o,channel:e.name}),a.success(d("telegram_ui.message_sent")),t()}catch(m){a.error(m.message)}finally{u(!1)}}};return s.jsx(cn,{open:!!e,onClose:t,title:e?d("telegram_send_dialog.title",{name:e.name}):"",description:e?d("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:c,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:p,loading:c,children:d("chat_ui.send")})]}),children:s.jsx(le,{label:d("telegram_ui.message_label"),children:s.jsx(pn,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function uN({bare:e=!1}){const t=nt(),{contacts:a,roles:o,channelOwners:l,isLoading:c,mutate:u}=y_(),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)])),h=async(v,w)=>{try{await zn.contacts.patch(v.user_id,{role:w}),t.success(d("telegram_ui.role_assigned",{name:v.name||v.user_id,role:w})),u()}catch(N){t.error(N.message)}},g=async v=>{if(confirm(d("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await zn.contacts.remove(v.user_id),t.success(d("telegram_contacts.removed")),u()}catch(w){t.error(w.message)}},b=s.jsxs(s.Fragment,{children:[c&&s.jsx(ot,{}),!c&&a.length===0&&s.jsx(gt,{children:d("telegram_contacts.empty")}),a.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:a.map(v=>{const w=p.has(String(v.user_id)),N=w?"owner":v.role||"guest";return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"font-medium",children:v.name||"—"}),v.username&&s.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",v.username]}),w&&s.jsx(Fe,{tone:"success",children:d("telegram_contacts.owner_badge")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ke,{content:d(w?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:s.jsx(kP,{value:N,disabled:w,onChange:y=>h(v,y.target.value),children:m.map(y=>s.jsx("option",{value:y,children:y},y))})}),s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>g(v),children:d("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["user_id: ",String(v.user_id)]}),s.jsxs("span",{children:[d("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),s.jsx("span",{children:RP(o[N])})]})]},String(v.user_id))})})]});return e?b:s.jsx(Ve,{title:d("telegram_contacts.title"),description:d("telegram_contacts.desc"),children:b})}function RP(e){return!e||e.tools===void 0?"":e.tools==="*"?d("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${d("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:d("telegram_contacts.tools_none"):""}function TP(){const e=Ln(),[t,a]=si(),o=nt(),{health:l,isUp:c}=lN(),{projects:u,isLoading:p,mutate:m}=ru(),{engines:h,isLoading:g}=NP(),{status:b,mutate:v}=EP(),{channels:w,isLoading:N,mutate:y}=v_(),[j,E]=x.useState(null),[S,C]=x.useState(null),R=async()=>{try{await Ql.reload(),o.success(d("admin.reload_success"))}catch(D){o.error(D.message)}},M=async()=>{try{b?.enabled?(await zn.stop(),o.info(d("admin.telegram_polling_stopped"))):(await zn.start(),o.success(d("admin.telegram_polling_started"))),v()}catch(D){o.error(D.message)}},T=async D=>{if(confirm(d("telegram_channels.delete_confirm",{name:D})))try{await zn.channels.remove(D),o.success(d("admin.telegram_channel_removed")),y()}catch(B){o.error(B.message)}},O=async(D,B)=>{if(confirm(d("admin.unregister_confirm",{label:B})))try{await cs.remove(D),o.success(d("project.unregistered")),m()}catch(L){o.error(L.message)}};return s.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[s.jsxs("header",{className:"flex items-end justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:d("admin.title")}),s.jsx("p",{className:"text-sm text-muted-fg",children:d("admin.subtitle")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ke,{content:d("daemon.reload_hint"),children:s.jsxs(ne,{size:"sm",onClick:R,children:[d("common.reload")," config"]})}),s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>{const D=new URLSearchParams(t);D.set("action","add-project"),a(D)},children:[s.jsx(Kt,{size:14})," ",d("nav.project")]})]})]}),s.jsx(Ve,{title:d("daemon.version"),children:s.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[s.jsx(mg,{label:d("daemon.version"),value:l?.version||"—"}),s.jsx(mg,{label:d("daemon.uptime"),value:l?`${l.uptime_s}s`:"—"}),s.jsx(mg,{label:d("daemon.status"),value:d(c?"daemon.running":"daemon.down"),ok:c})]})}),s.jsxs(Ve,{title:d("admin.engines_title"),description:d("admin.engines_subtitle"),children:[g&&s.jsx(ot,{}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.map(D=>s.jsx(Fe,{tone:"info",children:D},D))})]}),s.jsxs(Ve,{title:d("admin.telegram_title"),description:d("admin.telegram_subtitle"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Wt,{checked:!!b?.enabled,onChange:M,label:b?.enabled?d("admin.telegram_polling_on"):d("admin.telegram_polling_off")}),s.jsxs(ne,{size:"sm",onClick:()=>E({name:""}),children:[s.jsx(Kt,{size:14})," ",d("admin.telegram_add_channel")]})]}),children:[N&&s.jsx(ot,{}),w.length===0&&s.jsx(gt,{children:d("common.none_yet")}),s.jsx("ul",{className:"space-y-2 text-sm",children:w.map(D=>s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"font-medium",children:D.name}),s.jsxs("div",{className:"flex items-center gap-2",children:[D.project&&s.jsxs(Fe,{tone:"success",children:["project = ",D.project]}),s.jsxs(ne,{size:"sm",variant:"ghost",onClick:()=>C(D),children:[s.jsx(Qs,{size:13})," ",d("admin.telegram_send_test")]}),s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>E(D),children:d("common.edit")}),s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>T(D.name),children:d("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["chat_id: ",D.chat_id||"—"]}),s.jsxs("span",{children:["route_to_agent: ",D.route_to_agent||"default APX"]}),s.jsxs("span",{children:["engine: ",D.respond_with_engine?d("admin.engine_badge"):d("admin.engine_badge_no")]})]})]},D.name))})]}),s.jsx(uN,{}),s.jsxs(Ve,{title:d("admin.projects_title"),description:d("admin.projects_subtitle"),children:[p&&s.jsx(ot,{}),s.jsx("ul",{className:"divide-y divide-border",children:u.map(D=>s.jsxs("li",{className:"flex items-center gap-3 py-2",children:[s.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",D.id]}),s.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${D.id}`),children:[s.jsx("span",{className:"font-medium",children:D.name||D.path.split("/").pop()}),s.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:D.path})]}),s.jsxs(Fe,{children:[D.agents??0," ",d("admin.agents_badge")]}),Number(D.id)!==0&&s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>O(String(D.id),D.name||D.path),children:d("admin.unregister")})]},D.id))})]}),s.jsx(iN,{channel:j,onClose:()=>E(null),onSaved:()=>{E(null),y()}}),s.jsx(cN,{channel:S,onClose:()=>C(null)})]})}function mg({label:e,value:t,ok:a}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&s.jsx(ou,{ok:a}),s.jsx("span",{children:t})]})]})}const dN=x.createContext(null),fN=x.createContext(null),pN=x.createContext(""),mN=x.createContext(null),hN=x.createContext(null),gN=x.createContext(null);function AP({children:e}){const[t,a]=x.useState(null),[o,l]=x.useState(""),[c,u]=x.useState(null);return s.jsx(fN.Provider,{value:a,children:s.jsx(dN.Provider,{value:t,children:s.jsx(mN.Provider,{value:l,children:s.jsx(pN.Provider,{value:o,children:s.jsx(gN.Provider,{value:u,children:s.jsx(hN.Provider,{value:c,children:e})})})})})})}function MP(){return x.useContext(dN)}function OP(e,t){const a=x.useContext(fN);x.useEffect(()=>(a?.({collapsed:e,toggle:t}),()=>a?.(null)),[e,t,a])}function zP(){return x.useContext(pN)}function DP(e){const t=x.useContext(mN);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function LP(){return x.useContext(hN)}function PP(e){const t=x.useContext(gN);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function xN({sections:e,active:t,onChange:a,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:u,testId:p,children:m}){return OP(o,l),s.jsxs("div",{className:"flex h-full",children:[s.jsx(WD,{sections:e,active:t,onChange:a,collapsed:o}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?s.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,s.jsx("div",{className:ke("flex-1 min-h-0 overflow-y-auto",u),"data-testid":p,children:m})]})]})}const pw={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 bN({mood:e="happy",className:t}){const a=pw[e]??pw.happy,[o,l]=a.eyes,c="text-emerald-700 dark:text-emerald-600/70";return s.jsxs("div",{"aria-hidden":!0,className:Ct("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[a.top&&s.jsx("div",{children:s.jsx("span",{className:c,children:` ${a.top}`})}),s.jsx("div",{children:" ▄███████▄"}),s.jsxs("div",{children:[" █ ",s.jsx("span",{className:c,children:"██"})," ",s.jsx("span",{className:c,children:"██"})," █"]}),s.jsx("div",{children:` █ ${o} ${l} █`}),s.jsx("div",{children:` █ ${a.mouth} █`}),s.jsx("div",{children:" ▀███████▀"})]})}function _N({mood:e="confused",title:t,titleClassName:a,message:o,action:l,className:c,testId:u}){return s.jsx("div",{className:Ct("grid h-full place-items-center p-8",c),"data-testid":u,children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx(bN,{mood:e,className:"mb-6 text-sm"}),t!=null&&s.jsx("div",{className:Ct("font-mono font-semibold leading-none tracking-tight text-foreground",a),children:t}),o!=null&&s.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&s.jsx("div",{className:"mt-6",children:l})]})})}const j_={pending:{labelKey:"tasks.status_pending",color:"text-amber-500",dot:"bg-amber-400",Icon:ZM},running:{labelKey:"tasks.status_running",color:"text-sky-500",dot:"bg-sky-400",Icon:Zc,spin:!0},in_review:{labelKey:"tasks.status_in_review",color:"text-violet-500",dot:"bg-violet-400",Icon:xS},blocked:{labelKey:"tasks.status_blocked",color:"text-slate-400",dot:"bg-slate-400",Icon:JM}},vN=["pending","running","in_review","blocked"];function Mf(e){return e.state==="done"?"done":e.state==="dropped"?"dropped":e.status??"pending"}function w_(e){return d(j_[e].labelKey)}function Of({status:e,className:t}){if(e==="done")return s.jsx(nb,{className:ke("size-4 text-emerald-500",t)});if(e==="dropped")return s.jsx(gS,{className:ke("size-4 text-muted-foreground",t)});const a=j_[e];return s.jsx(a.Icon,{className:ke("size-4",a.color,a.spin&&"animate-spin",t)})}function k_({status:e}){const t=e==="done"?d("tasks.done_label"):e==="dropped"?d("tasks.dropped_label"):w_(e),a=e==="done"?"text-emerald-500 border-emerald-500/30":e==="dropped"?"text-muted-foreground border-border":`${j_[e].color} border-current/30`;return s.jsxs("span",{className:ke("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium capitalize",a),children:[s.jsx(Of,{status:e,className:"size-3"}),t]})}function mw({pid:e}){const t=Ln(),a=Ge(`/projects/${e}/tasks?state=open`,()=>Qn.list(e),{refreshInterval:2e4}),o=Ge(`/projects/${e}/tasks-summary`,()=>Qn.summary(e),{refreshInterval:2e4}),l=Ge(`/projects/${e}/routines`,()=>Er.list(e)),c=Ge(`/projects/${e}/agents`,()=>ln.list(e)),u=Ge(`/projects/${e}/mcps`,()=>Rr.list(e)),p=Ge(`/projects/${e}/artifacts`,()=>Ar.list(e)),m=c.data??[],h=m.filter(w=>w.is_master||w.type==="orchestrator"),g=m.filter(w=>!(w.is_master||w.type==="orchestrator")),b=(l.data??[]).filter(w=>w.enabled).length,v=[...a.data??[]].sort((w,N)=>(N.created_at||"").localeCompare(w.created_at||"")).slice(0,6);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[s.jsx(po,{title:d("project.overview.agents"),value:m.length,href:`/p/${e}/agents`,icon:rn}),s.jsx(po,{title:d("project.overview.tasks_open"),value:o.data?.open??a.data?.length??"…",href:`/p/${e}/tasks`,icon:Hl}),s.jsx(po,{title:d("project.overview.routines_active"),value:b,href:`/p/${e}/routines`,icon:jo}),s.jsx(po,{title:d("project.overview.artifacts"),value:p.data?.length??"…",href:`/p/${e}/artifacts`,icon:lf})]}),o.data&&o.data.open>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:vN.map(w=>s.jsxs(rf,{to:`/p/${e}/tasks`,className:"flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-xs hover:bg-accent/40",children:[s.jsx(Of,{status:w,className:"size-3.5"}),s.jsx("span",{className:"capitalize text-muted-foreground",children:w_(w)}),s.jsx("span",{className:"font-semibold",children:o.data.status?.[w]??0})]},w))}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Ve,{title:d("project.overview.roster"),className:"!p-4",children:m.length===0?s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.overview.no_agents")}):s.jsxs("div",{className:"space-y-3",children:[h.length>0&&s.jsx(hw,{label:d("project.overview.orchestrators"),icon:pa,agents:h,pid:e,navigate:t}),g.length>0&&s.jsx(hw,{label:d("project.overview.specialists"),icon:rn,agents:g,pid:e,navigate:t})]})}),s.jsx(Ve,{title:d("project.overview.recent_tasks"),className:"!p-4",action:s.jsx(rf,{to:`/p/${e}/tasks`,className:"text-xs text-sky-500 hover:text-sky-400",children:d("common.view_all")}),children:v.length===0?s.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-fg",children:[s.jsx(eb,{className:"size-4"}),d("project.overview.no_activity")]}):s.jsx("ul",{className:"space-y-1.5",children:v.map(w=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>t(`/p/${e}/tasks?task=${w.id}`),className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-accent/40",children:[s.jsx(Of,{status:Mf(w),className:"size-3.5 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:w.title}),s.jsx(k_,{status:Mf(w)})]})},w.id))})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[s.jsx(po,{title:d("project.overview.chat"),value:d("project.overview.chat_value"),href:`/p/${e}/chat`,icon:uf}),s.jsx(po,{title:d("project.overview.mcps"),value:u.data?.length??"…",href:`/p/${e}/mcps`,icon:ax}),s.jsx(po,{title:d("project.overview.routines"),value:l.data?.length??"…",href:`/p/${e}/routines`,icon:jo})]})]})}function hw({label:e,icon:t,agents:a,pid:o,navigate:l}){return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(t,{className:"size-3.5"}),e," (",a.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(c=>s.jsxs("button",{type:"button",onClick:()=>l(`/p/${o}/agents/${c.slug}`),className:ke("inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs hover:border-muted-fg/50"),children:[s.jsx("span",{className:"text-sm leading-none",children:c.emoji||"🤖"}),s.jsx("span",{className:"truncate",children:c.slug})]},c.slug))})]})}function po({title:e,value:t,href:a,icon:o}){return s.jsxs(rf,{to:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[s.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:s.jsx(o,{size:20})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function IP(){const e=Ln(),{projects:t,isLoading:a}=ru();return s.jsxs(Ve,{title:d("base.workspaces_title"),description:d("base.workspaces_desc"),action:s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[s.jsx(Kt,{size:14})," ",d("base.workspaces_new")]}),children:[a&&s.jsx(ot,{}),!a&&t.length===0&&s.jsx(gt,{children:d("base.workspaces_empty")}),s.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?d("base.title"):o.name||o.path.split("/").pop()||String(o.id);return s.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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rb,{className:"size-4 text-muted-fg"}),s.jsx("span",{className:"truncate text-sm font-semibold",children:c}),s.jsx(Fe,{tone:l?"success":"info",children:l?d("base.title"):KC(o.kind)})]}),s.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const yN=x.createContext(null),jN=x.createContext(null);function _a(){const e=x.useContext(yN);if(e===null)throw new Error(on(60));return e}function wN(){const e=x.useContext(jN);if(e===null)throw new Error(on(61));return e}const BP=(e,t)=>Object.is(e,t);function To(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function UP(e,t,a){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:To(t,o,a))}function Oc(e,t,a){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:To(o,t,a))}function $P(e,t,a){return e.filter(o=>!To(t,o,a))}function Mx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function kN(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function HP(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(kN(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 SN(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 Mx(e)}function go(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Mx(e.value):Mx(e)}function CN(e,t,a){function o(){return SN(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=kN(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 qP(e,t,a){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:CN(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:go(t,o)!==""}),hasNullItemLabel:Ae((e,t)=>t?HP(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=>To(t,l,a)):To(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 VP(e,t,a=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>a(o,t[l]))}function wc(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Fs=1;function S_(e,t){return Math.max(0,e-t)}function zf(e,t){if(t<=0)return 0;const a=wc(e,0,t),o=a,l=t-a,c=o<=Fs,u=l<=Fs;return c&&u?o<=l?0:t:c?0:u?t:a}function FP(e){const{id:t,value:a,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:u=!1,onOpenChange:p,name:m,form:h,autoComplete:g,disabled:b=!1,readOnly:v=!1,required:w=!1,modal:N=!0,actionsRef:y,inputRef:j,onOpenChangeComplete:E,items:S,multiple:C=!1,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T=BP,highlightItemOnHover:O=!0,children:D}=e,{clearErrors:B}=x_(),{setDirty:L,setTouched:U,setFocused:z,validityData:P,setFilled:$,name:V,disabled:q,validation:X,validationMode:K}=lu(),F=yp({id:t}),G=q||b,I=V??m,[Y,Z]=Kl({controlled:a,default:C?o??Xa:o,name:"Select",state:"value"}),[te,fe]=Kl({controlled:c,default:u,name:"Select",state:"open"}),ee=x.useRef([]),se=x.useRef([]),re=x.useRef(null),me=x.useRef(null),Me=x.useRef(0),de=x.useRef(null),he=x.useRef([]),Ce=x.useRef(!1),we=x.useRef(null),Be=x.useRef(null),$e=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Se=x.useRef(!1),{mounted:Te,setMounted:ve,transitionStatus:Ne}=ui(te),{openMethod:De,triggerProps:Pe}=CC(te),Ie=Jn(()=>new z2({id:F,labelId:void 0,modal:N,multiple:C,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,value:Y,open:te,mounted:Te,transitionStatus:Ne,items:S,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,ue=tt(Ie,Je.activeIndex),_e=tt(Ie,Je.selectedIndex),qe=tt(Ie,Je.triggerElement),Re=tt(Ie,Je.positionerElement),Oe=Iz(De),et=De??Oe??null,rt=x.useMemo(()=>C?"":go(Y,M),[C,Y,M]),vt=x.useMemo(()=>C&&Array.isArray(Y)?Y.map(ut=>go(ut,M)):go(Y,M),[C,Y,M]),Mt=fn(Ie.state.triggerElement),lt=Ue(()=>vt);b_(Mt,F,Y,lt,!G,m);const Rt=x.useRef(Y),xe=C?Array.isArray(Y)&&Y.length>0:Y!=null&&go(Y,M)!=="";ze(()=>{Y!==Rt.current&&Ie.set("forceMount",!0)},[Ie,Y]),ze(()=>{$(xe)},[xe,$]),ze(function(){const It=he.current;let gn;if(C){const En=Array.isArray(Y)?Y:[];if(En.length===0)gn=null;else{const kn=En[En.length-1],Ft=Oc(It,kn,T);gn=Ft===-1?null:Ft}}else{const En=Oc(It,Y,T);gn=En===-1?null:En}gn===null&&(Be.current=null),!te&&Ie.set("selectedIndex",gn)},[xe,C,te,Y,he,T,Ie,Be]);function Le(ut){const It=P.initialValue;return Array.isArray(ut)&&Array.isArray(It)?!VP(ut,It,(gn,En)=>To(gn,En,T)):ut!==It}r_(Y,()=>{B(I),L(Le(Y)),X.change(Y)});const Xe=Ue((ut,It)=>{p?.(ut,It),!It.isCanceled&&(fe(ut),!ut&&(It.reason===ko||It.reason===tp)&&(U(!0),z(!1),K==="onBlur"&&X.commit(Y)))}),it=Ue(()=>{ve(!1),Ie.update({activeIndex:null,openMethod:null}),E?.(!1)});ba({enabled:!y,open:te,ref:re,onComplete(){te||it()}}),x.useImperativeHandle(y,()=>({unmount:it}),[it]);const Qe=Ue((ut,It)=>{l?.(ut,It),!It.isCanceled&&Z(ut)}),pt=Ue(()=>{const ut=Ie.state.listElement||re.current;if(!ut)return;const It=S_(ut.scrollHeight,ut.clientHeight),gn=zf(ut.scrollTop,It),En=gn>0,kn=gn<It;Ie.state.scrollUpArrowVisible!==En&&Ie.set("scrollUpArrowVisible",En),Ie.state.scrollDownArrowVisible!==kn&&Ie.set("scrollDownArrowVisible",kn)}),Ot=q2({open:te,onOpenChange:Xe,elements:{reference:qe,floating:Re}}),Zt=w2(Ot,{enabled:!v&&!G,event:"mousedown"}),Xt=ap(Ot),Jt=K2(Ot,{enabled:!v&&!G,listRef:ee,activeIndex:ue,selectedIndex:_e,disabledIndices:Xa,onNavigate(ut){ut===null&&!te||Ie.set("activeIndex",ut)},focusItemOnHover:O}),mn=X2(Ot,{enabled:!v&&!G&&(te||!C),listRef:se,activeIndex:ue,selectedIndex:_e,disabledIndices:ut=>TC(ee.current[ut]),onMatch(ut){te?Ie.set("activeIndex",ut):Qe(he.current[ut],st("none"))},onTyping(ut){Ce.current=ut}}),ns=x.useMemo(()=>{const ut=Kn(mn.reference,Jt.reference,Xt.reference,Zt.reference,Pe);return F&&(ut.id=F),ut},[Zt.reference,mn.reference,Jt.reference,Xt.reference,Pe,F]),ps=x.useMemo(()=>Kn(ip,mn.floating,Jt.floating,Xt.floating),[mn.floating,Jt.floating,Xt.floating]),ws=Jt.item??Yt;Ub(()=>{Ie.update({popupProps:ps,triggerProps:ns})}),ze(()=>{Ie.update({id:F,modal:N,multiple:C,value:Y,open:te,mounted:Te,transitionStatus:Ne,popupProps:ps,triggerProps:ns,items:S,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,openMethod:et})},[Ie,F,N,C,Y,te,Te,Ne,ps,ns,S,R,M,T,et]);const hn=x.useMemo(()=>({store:Ie,name:I,required:w,disabled:G,readOnly:v,multiple:C,highlightItemOnHover:O,setValue:Qe,setOpen:Xe,listRef:ee,popupRef:re,scrollHandlerRef:me,handleScrollArrowVisibility:pt,scrollArrowsMountedCountRef:Me,itemProps:ws,valueRef:de,valuesRef:he,labelsRef:se,typingRef:Ce,selectionRef:$e,firstItemTextRef:we,selectedItemTextRef:Be,validation:X,onOpenChangeComplete:E,alignItemWithTriggerActiveRef:Se,initialValueRef:Rt}),[Ie,I,w,G,v,C,O,Qe,Xe,ws,X,E,pt]),ks=Qa(j,X.inputRef),va=C&&Array.isArray(Y)&&Y.length>0,$s=C?void 0:I,ya=x.useMemo(()=>!C||!Array.isArray(Y)||!I?null:Y.map(ut=>{const It=go(ut,M);return s.jsx("input",{type:"hidden",form:h,name:I,value:It,disabled:G},It)}),[C,Y,h,I,M,G]);return s.jsx(yN.Provider,{value:hn,children:s.jsxs(jN.Provider,{value:Ot,children:[D,s.jsx("input",{...X.getValidationProps(G,{onFocus(){Ie.state.triggerElement?.focus({focusVisible:!0})},onChange(ut){if(ut.nativeEvent.defaultPrevented||G||v)return;const It=ut.currentTarget.value,gn=st(ha,ut.nativeEvent);function En(){if(C)return;const kn=It.toLowerCase();let Ft=he.current.findIndex(Zs=>go(Zs,M).toLowerCase()===kn||SN(Zs,R).toLowerCase()===kn);Ft===-1&&(Ft=he.current.findIndex((Zs,di)=>{const iu=se.current[di];return iu!=null&&iu.toLowerCase()===kn}));const Pn=Ft===-1?void 0:he.current[Ft];Pn!=null&&Qe(Pn,gn)}Ie.set("forceMount",!0),queueMicrotask(En)}}),id:F&&$s==null?`${F}-hidden-input`:void 0,form:h,name:$s,autoComplete:g,value:rt,disabled:G,required:w&&!va,readOnly:v,ref:ks,style:I?QS:Cb,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ya]})})}function GP(e,t){return e??t}const zd=2,YP=400,KP={..._x,...g_,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},XP=x.forwardRef(function(t,a){const{render:o,className:l,id:c,disabled:u=!1,nativeButton:p=!0,style:m,...h}=t,{setTouched:g,setFocused:b,validationMode:v,state:w,disabled:N}=lu(),{labelId:y}=vp(),{store:j,setOpen:E,selectionRef:S,validation:C,readOnly:R,required:M,alignItemWithTriggerActiveRef:T,disabled:O}=_a(),D=N||O||u,B=tt(j,Je.open),L=tt(j,Je.mounted),U=tt(j,Je.value),z=tt(j,Je.triggerProps),P=tt(j,Je.positionerElement),$=tt(j,Je.listElement),V=tt(j,Je.popupSide),q=tt(j,Je.id),X=tt(j,Je.labelId),K=tt(j,Je.hasSelectedValue),F=L&&P?V:null,G=c??q,I=GP(y,X);yp({id:G});const Y=fn(P),Z=x.useRef(null),{getButtonProps:te,buttonRef:fe}=Fr({disabled:D,native:p}),ee=Ue(Ce=>{j.set("triggerElement",Ce)}),se=Nn(),re=Nn(),me=Nn();x.useEffect(()=>{if(B)return me.start(YP,()=>{S.current.allowUnselectedMouseUp=!0,S.current.allowSelectedMouseUp=!0}),()=>{me.clear()};S.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},re.clear()},[B,S,re,me]);const Me=Kn(z,{id:G,role:"combobox","aria-expanded":B?"true":"false","aria-haspopup":"listbox","aria-controls":B?$?.id??pf(P)?.id:void 0,"aria-labelledby":I,"aria-readonly":R||void 0,"aria-required":M||void 0,tabIndex:D?-1:0,onFocus(Ce){b(!0),B&&T.current&&E(!1,st(ha,Ce.nativeEvent)),se.start(0,()=>{j.set("forceMount",!0)})},onBlur(Ce){We(P,Ce.relatedTarget)||(g(!0),b(!1),v==="onBlur"&&C.commit(U))},onMouseDown(Ce){if(B)return;const we=xt(Ce.currentTarget);function Be($e){if(!Z.current)return;const Se=$e.target;if(We(Z.current,Se)||We(Y.current,Se))return;const Te=NC(Z.current);$e.clientX>=Te.left-zd&&$e.clientX<=Te.right+zd&&$e.clientY>=Te.top-zd&&$e.clientY<=Te.bottom+zd||E(!1,st(VS,$e))}re.start(0,()=>{we.addEventListener("mouseup",Be,{once:!0})})}},h,te),de=C.getValidationProps(D,Me);de.role="combobox";const he={...w,open:B,disabled:D,value:U,readOnly:R,popupSide:F,placeholder:!K};return Et("button",t,{ref:[a,Z,fe,ee],state:he,stateAttributesMapping:KP,props:de})}),QP={value:()=>null},WP=x.forwardRef(function(t,a){const{className:o,render:l,children:c,placeholder:u,style:p,...m}=t,{store:h,valueRef:g}=_a(),b=tt(h,Je.value),v=tt(h,Je.items),w=tt(h,Je.itemToStringLabel),N=tt(h,Je.hasSelectedValue),y=!N&&u!=null&&c==null,j=tt(h,Je.hasNullItemLabel,y),E={value:b,placeholder:!N};let S=null;return typeof c=="function"?S=c(b):c!=null?S=c:!N&&u!=null&&!j?S=u:Array.isArray(b)?S=qP(b,v,w):S=CN(b,v,w),Et("span",t,{state:E,ref:[a,g],props:[{children:S},m],stateAttributesMapping:QP})}),ZP=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,{store:p}=_a(),h={open:tt(p,Je.open)};return Et("span",t,{state:h,ref:a,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:W2})}),JP=x.createContext(void 0),e6=x.forwardRef(function(t,a){const{store:o}=_a(),l=tt(o,Je.mounted),c=tt(o,Je.forceMount);return l||c?s.jsx(JP.Provider,{value:!0,children:s.jsx(Db,{ref:a,...t})}):null}),NN=x.createContext(void 0);function C_(){const e=x.useContext(NN);if(!e)throw new Error(on(59));return e}function Df(e,t){e&&Object.assign(e.style,t)}const EN={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},t6={position:"fixed"},n6=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p="bottom",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:w=5,sticky:N=!1,disableAnchorTracking:y,alignItemWithTrigger:j=!0,collisionAvoidance:E=m2,style:S,...C}=t,{store:R,listRef:M,labelsRef:T,alignItemWithTriggerActiveRef:O,selectedItemTextRef:D,valuesRef:B,initialValueRef:L,popupRef:U,setValue:z}=_a(),P=wN(),$=tt(R,Je.open),V=tt(R,Je.mounted),q=tt(R,Je.modal),X=tt(R,Je.value),K=tt(R,Je.openMethod),F=tt(R,Je.positionerElement),G=tt(R,Je.triggerElement),I=tt(R,Je.isItemEqualToValue),Y=tt(R,Je.transitionStatus),Z=x.useRef(null),te=x.useRef(null),[fe,ee]=x.useState(j),se=V&&fe&&K!=="touch";!V&&fe!==j&&ee(j),ze(()=>{V||(Je.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),Je.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,V]),x.useImperativeHandle(O,()=>se),jC((se||q)&&$,K==="touch",F,G);const re=Wb({anchor:o,floatingRootContext:P,positionMethod:l,mounted:V,side:p,sideOffset:h,align:m,alignOffset:g,arrowPadding:w,collisionBoundary:b,collisionPadding:v,sticky:N,disableAnchorTracking:y??se,collisionAvoidance:E,keepMounted:!0}),me=se?"none":re.side,Me=se?t6:re.positionerStyles,de={open:$,side:me,align:re.align,anchorHidden:re.anchorHidden};ze(()=>{R.set("popupSide",re.side)},[R,re.side]);const he=Ue(Se=>{R.set("positionerElement",Se)}),Ce=Zb(t,de,{styles:Me,transitionStatus:Y,props:C,refs:[a,he],hidden:!V,inert:!$}),we=x.useRef(0),Be=Ue(Se=>{if(Se.size===0&&we.current===0||B.current.length===0)return;const Te=we.current;if(we.current=Se.size,Se.size===Te)return;const ve=st(ha);if(Te!==0&&!R.state.multiple&&X!==null&&Oc(B.current,X,I)===-1){const De=L.current,Ie=De!=null&&Oc(B.current,De,I)!==-1?De:null;z(Ie,ve),Ie===null&&(R.set("selectedIndex",null),D.current=null)}if(Te!==0&&R.state.multiple&&Array.isArray(X)){const Ne=Pe=>Oc(B.current,Pe,I)!==-1,De=X.filter(Pe=>Ne(Pe));(De.length!==X.length||De.some(Pe=>!UP(X,Pe,I)))&&(z(De,ve),De.length===0&&(R.set("selectedIndex",null),D.current=null))}if($&&se){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ne={height:""};Df(F,Ne),Df(U.current,Ne)}}),$e=x.useMemo(()=>({...re,side:me,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:ee,scrollUpArrowRef:Z,scrollDownArrowRef:te}),[re,me,se,ee]);return s.jsx(xp,{elementsRef:M,labelsRef:T,onMapChange:Be,children:s.jsxs(NN.Provider,{value:$e,children:[V&&q&&s.jsx(a_,{inert:fp(!$),cutout:G}),Ce]})})}),Dd="base-ui-disable-scrollbar",Ox={className:Dd,getElement(e){return s.jsx("style",{nonce:e,href:Dd,precedence:"base-ui:low",children:`.${Dd}{scrollbar-width:none}.${Dd}::-webkit-scrollbar{display:none}`})}},s6=x.createContext(void 0),a6={disableStyleElements:!1};function r6(){return x.useContext(s6)??a6}const o6={...Lo,...tr},l6=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m,popupRef:h,onOpenChangeComplete:g,setOpen:b,valueRef:v,firstItemTextRef:w,selectedItemTextRef:N,multiple:y,handleScrollArrowVisibility:j,scrollHandlerRef:E,listRef:S,highlightItemOnHover:C}=_a(),{side:R,align:M,alignItemWithTriggerActive:T,isPositioned:O,setControlledAlignItemWithTrigger:D}=C_(),B=gC()!=null,L=wN(),U=up(),{nonce:z,disableStyleElements:P}=r6(),$=tt(m,Je.id),V=tt(m,Je.open),q=tt(m,Je.openMethod),X=tt(m,Je.mounted),K=tt(m,Je.popupProps),F=tt(m,Je.transitionStatus),G=tt(m,Je.triggerElement),I=tt(m,Je.positionerElement),Y=tt(m,Je.listElement),Z=x.useRef(!1),te=x.useRef(!1),fe=x.useRef({}),ee=Fl(),se=Ue(de=>{if(!I||!h.current||!te.current)return;if(Z.current||!T){j();return}const he=I.style.top==="0px",Ce=I.style.bottom==="0px";if(!he&&!Ce){j();return}const we=xw(I),Be=kc(I.getBoundingClientRect().height,"y",we),$e=xt(I),Se=Qt(I),Te=Se.getComputedStyle(I),ve=parseFloat(Te.marginTop),Ne=parseFloat(Te.marginBottom),De=gw(Se.getComputedStyle(h.current)),Pe=Math.min($e.documentElement.clientHeight-ve-Ne,De),Ie=de.scrollTop,ue=Ld(de);let _e=0,qe=null,Re=!1,Oe=!1;const et=lt=>{I.style.height=`${lt}px`},rt=(lt,Rt)=>{const xe=wc(lt,0,Pe-Be);xe>0&&et(Be+xe),de.scrollTop=Rt,Pe-(Be+xe)<=Fs&&(Z.current=!0),j()},vt=he?ue-Ie:Ie,Mt=Math.min(Be+vt,Pe);if(_e=Mt,vt<=Fs){rt(vt,he?ue:0);return}if(Pe-Mt>Fs)he?Oe=!0:qe=0;else if(Re=!0,Ce&&Ie<ue){const lt=Be+vt-Pe;qe=Ie-(vt-lt)}if(_e=Math.ceil(_e),_e!==0&&et(_e),Oe||qe!=null){const lt=Ld(de),Rt=Oe?lt:wc(qe,0,lt);Math.abs(de.scrollTop-Rt)>Fs&&(de.scrollTop=Rt)}(Re||_e>=Pe-Fs)&&(Z.current=!0),j()});x.useImperativeHandle(E,()=>se,[se]),ba({open:V,ref:h,onComplete(){V&&g?.(!0)}});const re={open:V,transitionStatus:F,side:R,align:M};ze(()=>{!I||!h.current||Object.keys(fe.current).length||(fe.current={top:I.style.top||"0",left:I.style.left||"0",right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[h,I]),ze(()=>{V||T||(te.current=!1,Z.current=!1,Df(I,fe.current))},[V,T,I,h]),ze(()=>{const de=h.current;if(!V||!G||!I||!de||T&&!O||m.state.transitionStatus==="ending")return;if(!T){te.current=!0,ee.request(j),de.style.removeProperty("--transform-origin");return}const he=i6(de);de.style.removeProperty("--transform-origin");try{let Ce=N.current;Ce?.isConnected||(Ce=!Je.hasSelectedValue(m.state)&&w.current?.isConnected?w.current:null);const we=v.current,Be=Qt(I),$e=Be.getComputedStyle(I),Se=Be.getComputedStyle(de),Te=xt(G),ve=xw(G),Ne=Pd(G.getBoundingClientRect(),ve),De=Pd(I.getBoundingClientRect(),ve),Pe=Ne.height,Ie=Y||de,ue=Ie.scrollHeight,_e=parseFloat(Se.borderBottomWidth),qe=parseFloat($e.marginTop)||10,Re=parseFloat($e.marginBottom)||10,Oe=parseFloat($e.minHeight)||100,et=gw(Se),rt=5,vt=5,Mt=20,lt=Te.documentElement.clientHeight-qe-Re,Rt=Te.documentElement.clientWidth,xe=lt-Ne.bottom+Pe;let Le,Xe=U==="rtl"?Ne.right-De.width:Ne.left,it=0;if(Ce&&we){const hn=Pd(we.getBoundingClientRect(),ve);Le=Pd(Ce.getBoundingClientRect(),ve),Xe=De.left+(U==="rtl"?hn.right-Le.right:hn.left-Le.left);const ks=hn.top-Ne.top+hn.height/2;it=Le.top-De.top+Le.height/2-ks}const Qe=xe+it+Re+_e;let pt=Math.min(lt,Qe);const Ot=lt-qe-Re,Zt=Qe-pt,Xt=Rt-vt;I.style.left=`${wc(Xe,rt,Xt-De.width)}px`,I.style.height=`${pt}px`,I.style.maxHeight="none",I.style.marginTop=`${qe}px`,I.style.marginBottom=`${Re}px`,de.style.height="100%";const Jt=Ld(Ie),mn=Zt>=Jt-Fs;mn&&(pt=Math.min(lt,De.height)-(Zt-Jt));const ns=Ne.top<Mt||Ne.bottom>lt-Mt||Math.ceil(pt)+Fs<Math.min(ue,Oe),ps=(Be.visualViewport?.scale??1)!==1&&Br;if(ns||ps){te.current=!0,Df(I,fe.current),D(!1);return}const ws=Math.max(Oe,pt);if(mn){const hn=Math.max(0,lt-Qe);I.style.top=De.height>=Ot?"0":`${hn}px`,I.style.height=`${pt}px`,Ie.scrollTop=Ld(Ie)}else I.style.bottom="0",Ie.scrollTop=Zt;if(Le){const hn=De.top,ks=De.height,va=Le.top+Le.height/2,$s=ks>0?(va-hn)/ks*100:50,ya=wc($s,0,100);de.style.setProperty("--transform-origin",`50% ${ya}%`)}(ws===lt||pt>=et)&&(Z.current=!0),j(),C&&m.state.selectedIndex===null&&m.state.activeIndex===null&&S.current[0]!=null&&m.set("activeIndex",0),te.current=!0}finally{he()}},[m,V,I,G,v,w,N,h,j,T,D,ee,Y,S,C,U,O]),x.useEffect(()=>{if(!T||!I||!V)return;const de=Qt(I);function he(Ce){b(!1,st(K5,Ce))}return _t(de,"resize",he)},[b,T,I,V]);const me={...Y?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${$}-list`},onKeyDown(de){B&&gp.has(de.key)&&de.stopPropagation()},onScroll(de){Y||se(de.currentTarget)},...T&&{style:Y?{height:"100%"}:EN}},Me=Et("div",t,{ref:[a,h],state:re,stateAttributesMapping:o6,props:[K,me,dp(F),{className:!Y&&T?Ox.className:void 0},p]});return s.jsxs(x.Fragment,{children:[!P&&Ox.getElement(z),s.jsx(Ib,{context:L,modal:!1,disabled:!X,openInteractionType:q,returnFocus:u,restoreFocus:!0,children:Me})]})});function gw(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ld(e){return S_(e.scrollHeight,e.clientHeight)}function xw(e){return T2.getScale(e)}function kc(e,t,a){return e/a[t]}function Pd(e,t){return Hc({x:kc(e.x,"x",t),y:kc(e.y,"y",t),width:kc(e.width,"x",t),height:kc(e.height,"y",t)})}const bw=[["transform","none"],["scale","1"],["translate","0 0"]];function i6(e){const{style:t}=e,a={};for(const[o,l]of bw)a[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of bw){const l=a[o];l?t.setProperty(o,l):t.removeProperty(o)}}}const c6=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...u}=t,{store:p,scrollHandlerRef:m}=_a(),{alignItemWithTriggerActive:h}=C_(),g=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(j){m.current?.(j.currentTarget)},...h&&{style:EN},className:g&&b!=="touch"?Ox.className:void 0},y=Ue(j=>{p.set("listElement",j)});return Et("div",t,{ref:[a,y],props:[N,u]})}),RN=x.createContext(void 0);function N_(){const e=x.useContext(RN);if(!e)throw new Error(on(57));return e}const u6=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,style:c,value:u=null,label:p,disabled:m=!1,nativeButton:h=!1,...g}=t,b=x.useRef(null),v=nu({label:p,textRef:b,indexGuessBehavior:mC.GuessFromOrder}),{store:w,itemProps:N,setOpen:y,setValue:j,selectionRef:E,typingRef:S,valuesRef:C,multiple:R,selectedItemTextRef:M,disabled:T,readOnly:O}=_a(),D=tt(w,Je.isActive,v.index),B=tt(w,Je.open),L=tt(w,Je.isSelected,u),U=tt(w,Je.isSelectedByFocus,v.index),z=tt(w,Je.isItemEqualToValue),P=v.index,$=P!==-1,V=x.useRef(null);ze(()=>{if(!$)return;const se=C.current;return se[P]=u,()=>{delete se[P]}},[$,P,u,C]),ze(()=>{if(!$)return;const se=w.state.value;let re=se;R&&Array.isArray(se)&&(re=se.length>0?se[se.length-1]:void 0),re!==void 0&&To(u,re,z)&&(w.set("selectedIndex",P),b.current&&(M.current=b.current))},[$,P,R,z,w,u,M]);const q=x.useRef(null),X=x.useRef("mouse"),K=x.useRef(!1),{getButtonProps:F,buttonRef:G}=Fr({disabled:m,focusableWhenDisabled:!0,native:h,composite:!0}),I={disabled:m,selected:L,highlighted:D};function Y(se){if(T||O)return;const re=w.state.value;if(R){const me=Array.isArray(re)?re:[],Me=L?$P(me,u,z):[...me,u];j(Me,st(Dl,se))}else j(u,st(Dl,se)),y(!1,st(Dl,se))}function Z(){E.current.dragY=0}const te={role:"option","aria-selected":L,tabIndex:B&&D?0:-1,onKeyDown(se){q.current=se.key,w.set("activeIndex",P),se.key===" "&&S.current&&se.preventDefault()},onClick(se){const re=se.type==="click"&&X.current!=="touch",me=se.nativeEvent.pointerType,Me=re&&_b(se.nativeEvent)&&(me!==void 0||D),de=re&&!Me&&!K.current;K.current=!1,!(se.type==="keydown"&&q.current===null)&&(m||se.type==="keydown"&&q.current===" "&&S.current||de||(q.current=null,Y(se.nativeEvent)))},onPointerEnter(se){X.current=se.pointerType},onPointerMove(se){if(se.pointerType==="mouse"&&se.buttons===1){const re=E.current;re.dragY+=se.movementY,re.dragY**2>=64&&(re.allowUnselectedMouseUp=!0)}},onPointerDown(se){X.current=se.pointerType,K.current=!0,Z()},onMouseUp(){if(Z(),m||X.current==="touch"||K.current)return;const se=!E.current.allowSelectedMouseUp&&L,re=!E.current.allowUnselectedMouseUp&&!L;se||re||(K.current=!0,V.current?.click(),K.current=!1)}},fe=Et("div",t,{ref:[G,a,v.ref,V],state:I,props:[N,te,g,F]}),ee=x.useMemo(()=>({selected:L,index:P,textRef:b,selectedByFocus:U,hasRegistered:$}),[L,P,b,U,$]);return s.jsx(RN.Provider,{value:ee,children:fe})})),d6=x.forwardRef(function(t,a){const o=t.keepMounted??!1,{selected:l}=N_();return o||l?s.jsx(f6,{...t,ref:a}):null}),f6=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:h,setMounted:g}=ui(p),v=Et("span",e,{ref:[t,m],state:{selected:p,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:tr});return ba({open:p,ref:m,onComplete(){p||g(!1)}}),v})),p6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:u}=N_(),{firstItemTextRef:p,selectedItemTextRef:m}=_a(),{render:h,className:g,style:b,...v}=t,w=x.useCallback(y=>{y&&(u&&o===0&&(p.current=y),u&&c&&(m.current=y))},[p,m,o,c,u]);return Et("div",t,{ref:[w,a,l],props:v})})),TN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,direction:u,keepMounted:p=!1,...m}=t,h=u==="up",{store:g,popupRef:b,listRef:v,handleScrollArrowVisibility:w,scrollArrowsMountedCountRef:N}=_a(),{side:y,scrollDownArrowRef:j,scrollUpArrowRef:E}=C_(),S=h?Je.scrollUpArrowVisible:Je.scrollDownArrowVisible,C=tt(g,S),R=tt(g,Je.openMethod),M=C&&R!=="touch",T=Nn(),O=h?E:j,{mounted:D,transitionStatus:B,setMounted:L}=ui(M);ze(()=>(N.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{N.current=Math.max(0,N.current-1),N.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,N]),ba({open:M,ref:O,onComplete(){M||L(!1)}});const P=Et("div",t,{ref:[a,O],state:{direction:u,visible:M,side:y,transitionStatus:B},props:[{"aria-hidden":!0,children:h?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||T.isStarted())return;g.set("activeIndex",null);function q(){const X=g.state.listElement??b.current;if(!X)return;g.set("activeIndex",null),w();const K=S_(X.scrollHeight,X.clientHeight),F=zf(X.scrollTop,K),G=F===(h?0:K),I=v.current;if(F!==X.scrollTop&&(X.scrollTop=F),I.length===0&&g.set(h?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){T.clear();return}if(I.length>0){const Y=O.current?.offsetHeight||0;X.scrollTop=m6(I,h,F,X.clientHeight,Y,K)}T.start(40,q)}T.start(40,q)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:tr});return D||p?P:null});function m6(e,t,a,o,l,c){if(t){let g=0;const b=a+l-Fs;for(let N=0;N<e.length;N+=1){const y=e[N];if(y&&y.offsetTop>=b){g=N;break}}const v=Math.max(0,g-1),w=e[v];return v<g&&w?zf(w.offsetTop-l,c):0}let u=e.length-1;const p=a+o-l+Fs;for(let g=0;g<e.length;g+=1){const b=e[g];if(b&&b.offsetTop+b.offsetHeight>p){u=Math.max(0,g-1);break}}const m=Math.min(e.length-1,u+1),h=e[m];return m>u&&h?zf(h.offsetTop+h.offsetHeight-o+l,c):c}const h6=x.forwardRef(function(t,a){return s.jsx(TN,{...t,ref:a,direction:"down"})}),g6=x.forwardRef(function(t,a){return s.jsx(TN,{...t,ref:a,direction:"up"})}),x6=FP;function b6({className:e,...t}){return s.jsx(WP,{"data-slot":"select-value",className:Ct("flex flex-1 text-left",e),...t})}function _6({className:e,size:t="default",children:a,...o}){return s.jsxs(XP,{"data-slot":"select-trigger","data-size":t,className:Ct("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,s.jsx(ZP,{render:s.jsx(Bs,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function v6({className:e,children:t,side:a="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...p}){return s.jsx(e6,{children:s.jsx(n6,{side:a,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:s.jsxs(l6,{"data-slot":"select-content","data-align-trigger":u,className:Ct("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:[s.jsx(j6,{}),s.jsx(c6,{children:t}),s.jsx(w6,{})]})})})}function y6({className:e,children:t,...a}){return s.jsxs(u6,{"data-slot":"select-item",className:Ct("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:[s.jsx(p6,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),s.jsx(d6,{render:s.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:s.jsx(Lr,{className:"pointer-events-none"})})]})}function j6({className:e,...t}){return s.jsx(g6,{"data-slot":"select-scroll-up-button",className:Ct("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:s.jsx(tb,{})})}function w6({className:e,...t}){return s.jsx(h6,{"data-slot":"select-scroll-down-button",className:Ct("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:s.jsx(Bs,{})})}function dt({value:e,onChange:t,options:a,placeholder:o="— elegir —",disabled:l,className:c,showIcon:u=!1}){return s.jsxs(x6,{value:e,onValueChange:p=>t(p??""),disabled:l,children:[s.jsx(_6,{className:ke("h-9 w-full",c),children:s.jsx(b6,{placeholder:o,children:p=>{const m=a.find(g=>g.value===p),h=u?m?.icon:void 0;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[h&&s.jsx(h,{className:"size-3.5 shrink-0"}),s.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),s.jsx(v6,{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 s.jsx(y6,{value:p.value,disabled:p.disabled,children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?s.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?s.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[s.jsx("span",{className:"truncate font-medium",children:p.label}),s.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):s.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const _w=320;function k6(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 S6(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function C6({m:e}){const[t,a]=x.useState(!1),o=(e.body?.length||0)>_w,l=!o||t?e.body:`${e.body.slice(0,_w)}…`;return s.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?s.jsx(fS,{size:14,className:"text-blue-400"}):s.jsx(mS,{size:14,className:"text-emerald-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[s.jsx("span",{className:"font-mono",children:k6(e.ts)}),s.jsx(Fe,{tone:"info",children:e.channel}),e.type&&s.jsx(Fe,{children:e.type}),s.jsx("span",{className:"font-medium text-foreground",children:S6(e)})]}),e.body&&s.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&s.jsx("button",{type:"button",onClick:()=>a(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:d(t?"logs.show_less":"logs.show_more")})]})]})}function N6(){const[e,t]=x.useState(!1),a=Ge(e?"/admin/logs?errors":null,()=>Ql.logs("errors",200)),o=a.data?.entries||[];return s.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>t(l.target.open),children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[d("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),s.jsxs("div",{className:"border-t border-border p-3",children:[a.isLoading&&s.jsx(ot,{}),e&&!a.isLoading&&o.length===0&&s.jsx("p",{className:"text-xs text-muted-fg",children:d("logs.no_errors")}),s.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>s.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&s.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&s.jsx("span",{className:"text-destructive",children:l.level})]}),s.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 E6({pid:e}){const t=!e||String(e)==="0",[a,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(""),g=a.trim()||void 0,b=t?`/messages/global?channel=${g??""}`:`/projects/${e}/messages?channel=${g??""}`,v=Ge(b,()=>t?Ef.global({channel:g,limit:300}):Ef.project(e,{channel:g,limit:300})),w=x.useMemo(()=>[...v.data||[]].sort((j,E)=>(E.ts||"").localeCompare(j.ts||"")),[v.data]),N=x.useMemo(()=>Array.from(new Set(w.map(j=>j.type).filter(Boolean))),[w]),y=x.useMemo(()=>w.filter(j=>!(l&&j.direction!==l||u&&j.type!==u||m&&!(j.body||"").toLowerCase().includes(m.toLowerCase()))),[w,l,u,m]);return s.jsxs(Ve,{title:d("logs.title"),description:d(t?"logs.desc_global":"logs.desc_project"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ee,{placeholder:d("logs.filter_channel"),value:a,onChange:j=>o(j.target.value),className:"w-44"}),s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:s.jsx(Ys,{size:13})})]}),children:[t&&s.jsx(N6,{}),s.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"w-36",children:s.jsx(dt,{value:l,onChange:c,placeholder:d("logs.filter_dir"),options:[{value:"",label:d("logs.all_directions")},{value:"in",label:d("logs.in")},{value:"out",label:d("logs.out")}]})}),s.jsx("div",{className:"w-40",children:s.jsx(dt,{value:u,onChange:p,placeholder:d("logs.filter_type"),options:[{value:"",label:d("logs.all_types")},...N.map(j=>({value:j,label:j}))]})}),s.jsx(Ee,{placeholder:d("logs.search_text"),value:m,onChange:j=>h(j.target.value),className:"w-56"}),s.jsxs("span",{className:"text-[11px] text-muted-fg",children:[y.length," ",d("logs.count_of")," ",w.length]})]}),v.isLoading&&s.jsx(ot,{}),v.error&&s.jsx(gt,{children:d("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&y.length===0&&s.jsx(gt,{children:g?d("logs.no_activity_ch",{ch:g}):d("logs.no_activity")}),s.jsx("ul",{className:"space-y-1 text-sm",children:y.map((j,E)=>s.jsx(C6,{m:j},`${j.ts}-${E}`))})]})}function AN({value:e,onChange:t,options:a,placeholder:o=d("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:u}){const[p,m]=x.useState(!1),[h,g]=x.useState(e),b=x.useRef(null),v=x.useRef(null),[w,N]=x.useState(null);x.useEffect(()=>{g(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const C=()=>{const R=b.current;if(!R)return;const M=R.getBoundingClientRect();N({top:M.bottom+4,left:M.left,width:M.width})};return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[p]),x.useEffect(()=>{if(!p)return;const C=R=>{const M=R.target;b.current?.contains(M)||v.current?.contains(M)||m(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);const y=h.trim().toLowerCase(),E=y&&!(h===e)?a.filter(C=>C.toLowerCase().includes(y)):a,S=C=>{t(C),g(C),m(!1)};return s.jsxs("div",{ref:b,className:ke("relative",u),children:[s.jsxs("div",{className:ke("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&&s.jsx(Ke,{content:c||d("models_ui.invalid_hint"),children:s.jsx("span",{children:s.jsx(ES,{className:"size-3.5 shrink-0 text-amber-400"})})}),s.jsx("input",{value:h,placeholder:o,onChange:C=>{g(C.target.value),t(C.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),s.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(C=>!C),className:"shrink-0 text-muted-fg hover:text-foreground",children:s.jsx(Bs,{className:"size-4"})})]}),p&&E.length>0&&w&&Is.createPortal(s.jsx("ul",{ref:v,style:{position:"fixed",top:w.top,left:w.left,width:w.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:E.map(C=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),S(C)},className:ke("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",C===e&&"bg-accent/50"),children:s.jsx("span",{className:"truncate font-mono text-xs",children:C})})},C))}),document.body)]})}function Gr(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/admin/config",()=>Ql.config.get()),l=async(c,u)=>{const p=await Ql.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 MN(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/admin/super-agent",()=>Ql.superAgent());return{superAgent:e,error:t,isLoading:a,mutate:o}}const R6={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"},T6={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"},zc=[{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 hg(e,t){return t&&t in e?e[t]:e.custom}const Lf={anthropic:er,openai:rn,gemini:g3,groq:Hl,openrouter:lb,ollama:CS,azure:t3,mock:vS,custom:li},vo={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 ON(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function gg({value:e,onChange:t,providers:a}){const{provider:o,model:l}=ON(e),c=a.find(g=>g.slug===o),u=!!o&&!c,p=x.useMemo(()=>{const g=c?vo[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...g]))},[c]),m=g=>{const b=a.find(w=>w.slug===g),v=b?.default_model||vo[b?.engine]?.default_model||"";t(v?`${g}:${v}`:`${g}:`)},h=g=>t(`${o}:${g}`);return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(dt,{value:o,onChange:m,placeholder:u?d("router_panel.provider_not_found",{name:o}):d("router_panel.provider_ph"),options:a.map(g=>({value:g.slug,label:g.slug,icon:Lf[g.engine]}))}),s.jsx(AN,{value:l,onChange:h,options:p,invalid:u,invalidHint:d("router_panel.provider_not_configured",{name:o})})]})}function A6(){const e=nt(),{superAgent:t,isLoading:a,mutate:o}=MN(),{config:l,patch:c}=Gr(),[u,p]=x.useState(""),[m,h]=x.useState([]),[g,b]=x.useState(""),[v,w]=x.useState(null),[N,y]=x.useState(!1),[j,E]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const L=t.model_fallback?.models||[],U=Array.isArray(L)?L:[];p(t.model||""),h(U),E({model:t.model||"",fallback:U})},[t]);const S=x.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([U,z])=>({slug:U,engine:z?.engine||U,default_model:z?.default_model||vo[z?.engine||U]?.default_model}))},[l.engines]),C=L=>{const{provider:U}=ON(L);return S.some(z=>z.slug===U)};if(a||!t)return s.jsx(ot,{});const R=u!==j.model||JSON.stringify(m)!==JSON.stringify(j.fallback),M=async()=>{y(!0);try{await c({"super_agent.model":u,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(d("router_panel.saved_toast")),E({model:u,fallback:m}),o()}catch(L){e.error(L.message)}finally{y(!1)}},T=()=>{const L=g.trim().replace(/:$/,"");!L||!L.includes(":")||m.includes(L)||(h([...m,L]),b(""))},O=(L,U)=>{const z=[...m];z[L]=U,h(z)},D=L=>{h(m.filter((U,z)=>z!==L)),v===L&&w(null)},B=(L,U)=>{const z=L+U;if(z<0||z>=m.length)return;const P=[...m];[P[L],P[z]]=[P[z],P[L]],h(P)};return s.jsx(Ve,{title:d("router_panel.title"),description:d("router_panel.description"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs(Fe,{tone:"success",children:[s.jsx(lb,{size:11})," ",d("router_panel.badge_default")]}),s.jsx("span",{className:`font-mono text-xs ${!C(u)&&u?"text-amber-400":""}`,children:u||"—"}),m.map(L=>s.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[s.jsx(pS,{size:12}),s.jsx("span",{className:`font-mono text-xs ${C(L)?"":"text-amber-400"}`,children:L})]},L))]}),S.length===0?s.jsx("p",{className:"text-xs text-muted-fg",children:d("router_panel.no_providers")}):s.jsx(le,{label:d("router_panel.active_model_label"),hint:d("router_panel.active_model_hint"),children:s.jsx(gg,{value:u,onChange:p,providers:S})}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium",children:d("router_panel.fallback_title")}),s.jsx("div",{className:"text-xs text-muted-fg",children:d("router_panel.fallback_desc")})]}),s.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((L,U)=>{const z=!C(L),P=v===U;return s.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"w-6 text-muted-fg",children:["#",U+1]}),P?s.jsx("div",{className:"flex-1",children:s.jsx(gg,{value:L,onChange:$=>O(U,$),providers:S})}):s.jsxs("button",{type:"button",onClick:()=>w(U),className:"flex flex-1 items-center gap-1.5 text-left",children:[z&&s.jsx(ES,{size:12,className:"text-amber-400"}),s.jsx("span",{className:`font-mono ${z?"text-amber-400":""}`,children:L})]}),P?s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>w(null),children:d("router_panel.done")}):s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>w(U),children:s.jsx(ga,{size:12})}),s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>B(U,-1),disabled:U===0,children:"↑"}),s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>B(U,1),disabled:U===m.length-1,children:"↓"}),s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>D(U),children:s.jsx(wn,{size:12})})]})},`${U}-${L}`)}),m.length===0&&s.jsx("li",{className:"text-xs text-muted-fg",children:d("router_panel.fallback_empty")})]}),S.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs text-muted-fg",children:d("router_panel.add_to_chain")}),s.jsx(gg,{value:g,onChange:b,providers:S}),s.jsxs(ne,{size:"sm",variant:"secondary",onClick:T,disabled:!g.includes(":")||g.endsWith(":"),children:[s.jsx(Kt,{size:13})," ",d("router_panel.add_to_chain")]})]})]}),s.jsx(ne,{variant:"primary",loading:N,disabled:!R,onClick:M,children:d(R?"router_panel.save":"router_panel.saved")})]})})}function M6({provider:e,onEdit:t,onDelete:a,onToggle:o}){const l=hg(R6,e.engine),c=hg(T6,e.engine),u=hg(Lf,e.engine),p=zc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,h=Ro(e.api_key),g=e.is_active!==!1;return s.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:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:ke("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:s.jsx(u,{className:"size-5 text-white"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),s.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),s.jsxs("span",{className:ke("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[s.jsx(u,{className:"size-3"})," ",p]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(Ke,{content:d(g?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:s.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:ke("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",g?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[s.jsx("span",{className:ke("size-1.5 rounded-full",g?"bg-emerald-400":"bg-muted-fg/40")}),d(g?"providers_card.active":"providers_card.off")]})}),s.jsx(Ke,{content:d("providers_modal.delete"),children:s.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:s.jsx(wn,{className:"size-3.5"})})})]})]}),s.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[s.jsx(cc,{label:d("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&s.jsx(cc,{label:d("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),s.jsx(cc,{label:d("providers_card.api_key"),value:m?h?`…${h}`:d("providers_card.key_set"):"—",mono:!!h}),e.default_temperature!==void 0&&s.jsx(cc,{label:d("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&s.jsx(cc,{label:d("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function cc({label:e,value:t,mono:a,truncate:o}){return s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:e}),s.jsx("span",{className:ke("text-foreground",a&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const vw={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:""},O6=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function uc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Id(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function z6(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:Id(e.pricing?.input_per_million),p_output:Id(e.pricing?.output_per_million),p_cache_read:Id(e.pricing?.cache_read_per_million),p_cache_write:Id(e.pricing?.cache_write_per_million)}}function D6({open:e,initial:t,existingSlugs:a,onClose:o,onSave:l}){const c=!!t,[u,p]=x.useState(vw),[m,h]=x.useState(!1),[g,b]=x.useState(null),[v,w]=x.useState([]),[N,y]=x.useState(!1),[j,E]=x.useState(null),[S,C]=x.useState(!1),[R,M]=x.useState("");x.useEffect(()=>{if(!e)return;const F=t?z6(t):vw;p(F),b(null),E(null),C(!1);const G=vo[F.engine];w(G?.known_models||[])},[e,t]);const T=F=>p(G=>({...G,...F})),O=F=>{const G=vo[F];T({engine:F,name:F==="custom"?u.name:zc.find(I=>I.value===F)?.label||F,slug:F==="custom"?u.slug:F,base_url:G.base_url,default_model:G.default_model}),w(G.known_models),E(null)},D=F=>{const G=vo[F];T({engine:F,base_url:u.base_url||G.base_url,default_model:u.default_model||G.default_model}),w(G.known_models)},B=async()=>{y(!0),E(null);try{const F=await Rf.models({engine:u.engine,slug:u.slug||uc(u.name),base_url:u.base_url||void 0,api_key:u.api_key_value||void 0});if(F.error){E(F.error);return}w(F.models),F.models.length===0&&E(d("providers_modal.err_no_models"))}catch(F){E(F.message||d("providers_modal.err_list_models"))}finally{y(!1)}},L=x.useMemo(()=>u.default_model&&!v.includes(u.default_model)?[u.default_model,...v]:v,[v,u.default_model]),U=()=>{const F=(u.slug||uc(u.name)).trim();if(!F)return b(d("providers_modal.err_slug_required")),null;if(!c&&a.includes(F))return b(d("providers_modal.err_slug_exists",{slug:F})),null;let G;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;G=Z}catch{return b(d("providers_modal.err_model_limits_json")),null}const Y=[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:G,pricing:Y},modelLimits:G}},z=()=>{const F=U();if(!F)return;const{provider:G}=F,I={name:G.name,engine:G.engine,is_active:G.is_active!==!1,default_temperature:G.default_temperature,default_max_tokens:G.default_max_tokens};G.base_url&&(I.base_url=G.base_url),G.default_model&&(I.default_model=G.default_model),G.context_limit_tokens&&(I.context_limit_tokens=G.context_limit_tokens),G.model_context_limits&&(I.model_context_limits=G.model_context_limits),G.pricing&&(I.pricing=G.pricing),u.api_key_value.trim()&&(I.api_key=u.api_key_value.trim()),M(JSON.stringify(I,null,2)),b(null),C(!0)},P=async()=>{h(!0),b(null);try{if(S){const G=(u.slug||uc(u.name)).trim();if(!G){b(d("providers_modal.err_slug_required_form"));return}let I;try{I=JSON.parse(R)}catch{b(d("providers_modal.err_json_invalid"));return}if(!I||typeof I!="object"||Array.isArray(I)){b(d("providers_modal.err_json_object"));return}const Y=I;if(!Y.engine||typeof Y.engine!="string"){b(d("providers_modal.err_engine_missing"));return}const Z={slug:G,name:typeof Y.name=="string"?Y.name:G,engine:String(Y.engine),base_url:typeof Y.base_url=="string"?Y.base_url:void 0,default_model:typeof Y.default_model=="string"?Y.default_model:void 0,is_active:Y.is_active!==!1};await l({provider:Z,raw:Y,originalSlug:t?.slug}),o();return}const F=U();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||d("providers_modal.err_save"))}finally{h(!1)}},$=c&&us(t?.api_key),V=Ro(t?.api_key),q=$?d("providers_modal.api_key_set",{suffix:V??""}):"sk-…",X=u.engine==="ollama",K=vo[u.engine]?.api_key_env;return s.jsx(cn,{open:e,onClose:o,title:c?d("providers_modal.edit_title",{name:t?.name||t?.slug||""}):d("providers_modal.new_title"),description:d("providers_modal.description"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:o,disabled:m,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:P,loading:m,children:d(c?"common.save":"common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[c?s.jsx("span",{}):s.jsx("div",{className:"flex flex-wrap gap-1.5",children:O6.map(F=>{const G=Lf[F],I=F==="custom"?d("providers_modal.custom"):zc.find(Z=>Z.value===F)?.label||F,Y=u.engine===F;return s.jsxs("button",{type:"button",onClick:()=>O(F),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${Y?"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:[s.jsx(G,{className:"size-3.5"})," ",I]},F)})}),s.jsxs("button",{type:"button",onClick:()=>S?C(!1):z(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${S?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[s.jsx(KM,{className:"size-3.5"})," ",d(S?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),S?s.jsxs("div",{className:"space-y-2",children:[s.jsx(le,{label:d("providers_modal.json_label"),hint:d("providers_modal.json_hint",{slug:u.slug||uc(u.name)||"<slug>"}),children:s.jsx(pn,{rows:14,className:"font-mono text-xs",value:R,onChange:F=>M(F.target.value),spellCheck:!1})}),s.jsx("p",{className:"text-[11px] text-muted-fg",children:d("providers_modal.json_help")})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("providers_modal.name_label"),children:s.jsx(Ee,{value:u.name,onChange:F=>T({name:F.target.value,slug:c?u.slug:uc(F.target.value)}),placeholder:d("providers_modal.name_ph")})}),s.jsx(le,{label:d("providers_modal.engine_label"),children:s.jsx(dt,{value:u.engine,onChange:F=>D(F),options:zc.map(F=>({value:F.value,label:F.label,icon:Lf[F.value]}))})})]}),s.jsx(le,{label:d("providers_modal.base_url_label"),hint:d("providers_modal.base_url_hint"),children:s.jsx(Ee,{value:u.base_url,onChange:F=>T({base_url:F.target.value}),placeholder:d("providers_modal.base_url_ph")})}),!X&&s.jsx(le,{label:d("providers_modal.api_key_label"),hint:$?d("providers_modal.api_key_hint_existing"):K?d("providers_modal.api_key_hint_env",{env:K}):d("providers_modal.api_key_hint"),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",value:u.api_key_value,onChange:F=>T({api_key_value:F.target.value}),placeholder:q})}),s.jsx(le,{label:d("providers_modal.model_label"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(AN,{value:u.default_model,onChange:F=>T({default_model:F}),options:L,className:"flex-1"}),s.jsx(Ke,{content:d("providers_modal.list_models_hint"),children:s.jsxs(ne,{size:"sm",variant:"secondary",onClick:B,disabled:N,"aria-label":d("providers_modal.list_models_hint"),children:[N?s.jsx(Zc,{className:"size-3.5 animate-spin"}):s.jsx(Ys,{className:"size-3.5"}),d("providers_modal.load_models")]})})]}),j&&s.jsx("p",{className:"text-[11px] text-amber-400",children:j})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("providers_modal.max_tokens_label"),children:s.jsx(Ee,{type:"number",min:256,step:256,value:u.default_max_tokens,onChange:F=>T({default_max_tokens:parseInt(F.target.value)||4096})})}),s.jsx(le,{label:d("providers_modal.temperature_label",{value:u.default_temperature.toFixed(1)}),children:s.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"})})]}),s.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[s.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:d("providers_modal.pricing_summary")}),s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsx(le,{label:d("providers_modal.context_limit_label"),children:s.jsx(Ee,{type:"number",min:0,step:1024,value:u.context_limit_tokens,onChange:F=>T({context_limit_tokens:parseInt(F.target.value)||0})})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("providers_modal.price_input"),children:s.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_input,onChange:F=>T({p_input:F.target.value}),placeholder:"0.15"})}),s.jsx(le,{label:d("providers_modal.price_output"),children:s.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_output,onChange:F=>T({p_output:F.target.value}),placeholder:"0.60"})}),s.jsx(le,{label:d("providers_modal.price_cache_read"),children:s.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_cache_read,onChange:F=>T({p_cache_read:F.target.value}),placeholder:"0.03"})}),s.jsx(le,{label:d("providers_modal.price_cache_write"),children:s.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_cache_write,onChange:F=>T({p_cache_write:F.target.value}),placeholder:"0.00"})})]}),s.jsx(le,{label:d("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:s.jsx(pn,{rows:3,className:"font-mono text-xs",value:u.model_context_limits_json,onChange:F=>T({model_context_limits_json:F.target.value})})})]})]}),s.jsx(Wt,{checked:u.is_active,onChange:F=>T({is_active:F}),label:d("providers_modal.active_label")})]}),g&&s.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:g})]})})}const L6=new Set(zc.map(e=>e.value));function P6(e,t){const a=typeof t.engine=="string"&&t.engine||(L6.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 I6(){const e=nt(),{config:t,isLoading:a,patch:o,mutate:l}=Gr(),[c,u]=x.useState(!1),[p,m]=x.useState(null);if(a)return s.jsx(ot,{});const h=t.engines||{},g=Object.entries(h).map(([E,S])=>P6(E,S||{})),b=g.map(E=>E.slug),v=()=>{m(null),u(!0)},w=E=>{m(E),u(!0)},N=async({provider:E,apiKeyValue:S,raw:C})=>{if(C){await o({[`engines.${E.slug}`]:C}),e.success(d("engines_panel.saved_json")),l();return}const R=`engines.${E.slug}`,M={[`${R}.name`]:E.name,[`${R}.engine`]:E.engine,[`${R}.is_active`]:E.is_active!==!1,[`${R}.default_temperature`]:E.default_temperature,[`${R}.default_max_tokens`]:E.default_max_tokens},T=[],O=(D,B)=>{B===void 0||B===""?T.push(`${R}.${D}`):M[`${R}.${D}`]=B};O("base_url",E.base_url),O("default_model",E.default_model),O("context_limit_tokens",E.context_limit_tokens),O("pricing",E.pricing),O("model_context_limits",E.model_context_limits),S&&(M[`${R}.api_key`]=S),await o(M,T),e.success(d("engines_panel.saved")),l()},y=async E=>{try{await o({[`engines.${E.slug}.is_active`]:E.is_active===!1}),l()}catch(S){e.error(S.message)}},j=async E=>{if(confirm(d("engines_panel.delete_confirm",{name:E.name||E.slug})))try{await o(void 0,[`engines.${E.slug}`]),e.success(d("engines_panel.deleted")),l()}catch(S){e.error(S.message)}};return s.jsxs(Ve,{title:d("engines_panel.title"),description:d("engines_panel.description"),action:s.jsxs(ne,{size:"sm",variant:"primary",onClick:v,children:[s.jsx(Kt,{size:14})," ",d("engines_panel.new_btn")]}),children:[g.length===0?s.jsx(gt,{children:d("engines_panel.empty")}):s.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[g.map(E=>s.jsx(M6,{provider:E,onEdit:()=>w(E),onDelete:()=>j(E),onToggle:()=>y(E)},E.slug)),s.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:[s.jsx(Kt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:d("engines_panel.add_card")})]})]}),s.jsx(D6,{open:c,initial:p,existingSlugs:b,onClose:()=>{u(!1),m(null)},onSave:N})]})}function zN(){return s.jsxs("div",{className:"space-y-6",children:[s.jsx(A6,{}),s.jsx(I6,{})]})}function B6(){const e=nt(),[t,a]=x.useState(!1),l=Ge(t?"/agents/vault?include_removed=1":"/agents/vault",()=>ln.vault({includeRemoved:t})),c=l.data||[],[u,p]=x.useState(null),m=async g=>{const b=g.source!=="user",v=b?d("base.defaults_tombstone_msg",{slug:g.slug}):d("base.defaults_delete_msg",{slug:g.slug});if(confirm(v))try{await ln.vaultRemove(g.slug),e.success(d(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(w){e.error(w.message)}},h=async g=>{try{await ln.vaultRestore(g),e.success(d("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return s.jsxs(Ve,{title:d("base.defaults_title"),description:d("base.defaults_desc"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Wt,{checked:t,onChange:a,label:d("base.defaults_show_removed")}),s.jsxs(ne,{size:"sm",onClick:()=>p("new"),children:[s.jsx(Kt,{size:14})," ",d("base.defaults_new")]})]}),children:[l.isLoading&&s.jsx(ot,{}),!l.isLoading&&c.length===0&&s.jsx(gt,{children:d("base.defaults_empty")}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(g=>{const b=t&&g.tombstoned;return s.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:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:g.is_master?s.jsx(pa,{className:"size-4 text-white"}):s.jsx(rn,{className:"size-4 text-white"})}),s.jsx("span",{className:"truncate text-sm font-semibold",children:g.slug}),s.jsx(U6,{source:g.source})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?s.jsx(xg,{label:d("base.defaults_restore"),onClick:()=>h(g.slug),variant:"secondary",children:s.jsx(ri,{size:13})}):s.jsxs(s.Fragment,{children:[s.jsx(xg,{label:d("base.defaults_edit"),onClick:()=>p(g),variant:"ghost",children:s.jsx(ga,{size:13})}),s.jsx(xg,{label:g.source==="user"?d("base.defaults_delete"):d("base.defaults_hide"),onClick:()=>m(g),variant:"ghost-destructive",children:s.jsx(wn,{size:13})})]})})]}),g.model?s.jsx(Fe,{tone:"info",children:g.model}):s.jsx("span",{className:"text-[10px] text-muted-fg",children:d("agents_ui.model_router_default")}),g.description&&s.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:g.description}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.role&&s.jsx(Fe,{children:g.role}),g.skills?.map(v=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(er,{size:9})," ",v]},v)),g.tools?.map(v=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(li,{size:9})," ",v]},v))]})]},g.slug)})}),u!==null&&s.jsx($6,{agent:u==="new"?null:u,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function U6({source:e}){return e==="user"?s.jsx(Fe,{tone:"success",children:d("agents_ui.source_user")}):e==="user-override"?s.jsx(Fe,{tone:"warning",children:d("agents_ui.source_override")}):s.jsx(Fe,{tone:"muted",children:d("agents_ui.source_bundled")})}function xg({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 s.jsxs(Jb,{children:[s.jsx(e_,{render:s.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${l} ${c[a]}`,children:o})}),s.jsx(t_,{children:e})]})}function $6({agent:e,onClose:t,onSaved:a}){const o=nt(),[l,c]=x.useState(!1),u=!e,[p,m]=x.useState(e?.slug??""),[h,g]=x.useState(e?.role??""),[b,v]=x.useState(e?.model??""),[w,N]=x.useState(e?.description??""),[y,j]=x.useState(e?.language??"es"),[E,S]=x.useState((e?.skills??[]).join(", ")),[C,R]=x.useState((e?.tools??[]).join(", ")),[M,T]=x.useState(!!e?.is_master),[O,D]=x.useState(e?.body??""),B=async()=>{const L={role:h||void 0,model:b||void 0,description:w||void 0,language:y||void 0,skills:E,tools:C,is_master:M};c(!0);try{if(u){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(d("base.defaults_slug_invalid"));await ln.vaultCreate(p,L,O),o.success(d("base.defaults_created",{slug:p}))}else await ln.vaultPatch(e.slug,{fields:L,body:O}),o.success(d("base.defaults_saved",{slug:e.slug}));a()}catch(U){o.error(U.message)}finally{c(!1)}};return s.jsx(cn,{open:!0,onClose:t,title:u?d("base.defaults_new_title"):d("base.defaults_edit_title",{slug:e.slug}),description:u?d("base.defaults_new_desc"):e.source==="bundled"?d("base.defaults_bundled_desc"):d("base.defaults_user_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:l,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:B,loading:l,children:d("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[u&&s.jsx(le,{label:"slug",hint:d("agents_ui.slug_kebab_hint"),children:s.jsx(Ee,{autoFocus:!0,value:p,onChange:L=>m(L.target.value),placeholder:"reviewer"})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:"role",children:s.jsx(Ee,{value:h,onChange:L=>g(L.target.value),placeholder:"Code reviewer"})}),s.jsx(le,{label:"model",children:s.jsx(Ee,{value:b,onChange:L=>v(L.target.value),placeholder:"openrouter:..."})}),s.jsx(le,{label:"language",children:s.jsx(Ee,{value:y,onChange:L=>j(L.target.value),placeholder:"es"})}),s.jsx(le,{label:"is_master",children:s.jsx("div",{className:"flex h-9 items-center",children:s.jsx(Wt,{checked:M,onChange:T,label:d("base.defaults_master_label")})})})]}),s.jsx(le,{label:"description",children:s.jsx(Ee,{value:w,onChange:L=>N(L.target.value)})}),s.jsx(le,{label:"skills",hint:d("agents_ui.comma_separated"),children:s.jsx(Ee,{value:E,onChange:L=>S(L.target.value),placeholder:"code-review, git"})}),s.jsx(le,{label:"tools",hint:d("agents_ui.comma_separated"),children:s.jsx(Ee,{value:C,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),s.jsx(le,{label:"body",hint:d("agents_ui.body_hint"),children:s.jsx(pn,{value:O,onChange:L=>D(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const H6=20,yw=[10,20,50,100];function E_({key:e,fetchPage:t,resetKey:a,initialPageSize:o=H6,swr:l}){const[c,u]=x.useState(1),[p,m]=x.useState(o);x.useEffect(()=>{u(1)},[a]);const h=(c-1)*p,g=Ge(e==null?null:[e,p,h],()=>t(p,h),{keepPreviousData:!0,...l}),b=g.data?.total??0,v=Math.max(1,Math.ceil(b/p)),w=Math.min(c,v);x.useEffect(()=>{c!==w&&u(w)},[c,w]);const N=b===0?0:h,y=Math.min(h+p,b);return{items:g.data?.items??[],isLoading:g.isLoading,error:g.error,mutate:g.mutate,page:w,pageCount:v,total:b,start:N,end:y,pageSize:p,setPage:u,setPageSize:j=>{m(j),u(1)}}}function q6({page:e,pageCount:t,total:a,start:o,end:l,pageSize:c,onPage:u,onPageSize:p}){return a<=yw[0]?null:s.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"tabular-nums",children:d("common.pager_range",{from:o+1,to:l,total:a})}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:d("common.pager_per_page")}),s.jsx("div",{className:"w-[4.5rem]",children:s.jsx(dt,{value:String(c),onChange:m=>p(Number(m)),options:yw.map(m=>({value:String(m),label:String(m)}))})})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>u(e-1),"aria-label":d("common.pager_prev"),children:s.jsx(QM,{size:14})}),s.jsx("span",{className:"px-1 tabular-nums",children:d("common.pager_page",{page:e,total:t})}),s.jsx(ne,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>u(e+1),"aria-label":d("common.pager_next"),children:s.jsx(Do,{size:14})})]})]})}function R_({paged:e,fullHeight:t,className:a,children:o}){const l=s.jsx(q6,{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?s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsx("div",{className:ke("min-h-0 flex-1 overflow-y-auto",a),children:o}),s.jsx("div",{className:"shrink-0",children:l})]}):s.jsxs("div",{className:a,children:[o,l]})}const V6={apx:"success",claude:"info",codex:"warning"};function F6(){const e=nt(),t=_p(),[a,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(!1);x.useEffect(()=>{const j=setTimeout(()=>p(l.trim()),350);return()=>clearTimeout(j)},[l]);const g=E_({key:`/sessions?engine=${a}&q=${u}&deep=${m?1:0}`,fetchPage:(j,E)=>NL.page({engine:a||void 0,q:u||void 0,deep:m,limit:j,offset:E}),resetKey:`${a}|${u}|${m?1:0}`}),b=()=>{c(""),p(""),o(""),h(!1)},v=async j=>{try{await navigator.clipboard.writeText(`apx session resume ${j.id} --continue`),e.success(d("base.sessions_cmd_copied"))}catch{e.error(d("base.sessions_copy_failed"))}},w=j=>{const E=`Continue this session: ${j.id} (engine: ${j.engine}${j.title?`, title: "${j.title}"`:""}${j.cwd?`, folder: ${j.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:E}}))},N=async j=>{if(!j.cwd){e.error(d("base.sessions_no_folder"));return}try{await YC.exec({kind:"open_path",target:j.cwd})}catch(E){e.error(d("base.sessions_folder_failed",{msg:E.message}))}},y=async j=>{const E=j.path||j.cwd;if(!E){e.error(d("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(E),e.success(d("base.sessions_path_copied"))}catch{e.error(d("base.sessions_copy_failed"))}};return s.jsxs(Ve,{fullHeight:!0,title:d("base.sessions_title"),description:d("base.sessions_desc"),action:s.jsx(Ke,{content:d("base.sessions_refresh"),children:s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>g.mutate(),children:s.jsx(Ys,{size:13})})}),children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Ec,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),s.jsx(Ee,{className:"pl-8",placeholder:d("base.sessions_search_ph"),value:l,onChange:j=>c(j.target.value)})]}),s.jsx(Ke,{content:d("base.sessions_deep_tip"),children:s.jsx(ne,{size:"sm",variant:m?"primary":"secondary",onClick:()=>h(j=>!j),children:d("base.sessions_deep")})}),s.jsx("div",{className:"w-36",children:s.jsx(dt,{value:a,onChange:o,options:[{value:"",label:d("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),s.jsx(Ke,{content:d("base.sessions_clear"),children:s.jsx(ne,{size:"sm",variant:"ghost",onClick:b,children:s.jsx(Us,{size:14})})})]}),g.isLoading&&s.jsx(ot,{}),g.error&&s.jsx(gt,{children:d("base.sessions_error",{msg:g.error.message})}),!g.isLoading&&!g.error&&g.total===0&&s.jsx(gt,{children:u?d("base.sessions_no_match",{q:u}):d("base.sessions_empty")}),s.jsx(R_,{paged:g,fullHeight:!0,children:s.jsx("ul",{className:"space-y-1 text-sm",children:g.items.map((j,E)=>s.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx(Fe,{tone:V6[j.engine]||"muted",children:j.engine}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:j.title||j.id}),s.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[s.jsx("span",{className:"shrink-0",children:j.id}),j.cwd&&s.jsxs("span",{className:"truncate",children:["· ",j.cwd]})]})]}),j.mtime>0&&s.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(j.mtime).toLocaleString()}),s.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[s.jsx(Ke,{content:d("base.sessions_act_cmd"),children:s.jsx(ne,{size:"sm",variant:"ghost","aria-label":d("base.sessions_act_cmd"),onClick:()=>v(j),children:s.jsx(Ka,{size:13})})}),s.jsx(Ke,{content:d("base.sessions_act_ask",{name:t}),children:s.jsx(ne,{size:"sm",variant:"ghost","aria-label":d("base.sessions_act_ask",{name:t}),onClick:()=>w(j),children:s.jsx(rn,{size:13})})}),s.jsx(Ke,{content:d("base.sessions_act_folder"),children:s.jsx(ne,{size:"sm",variant:"ghost","aria-label":d("base.sessions_act_folder"),onClick:()=>N(j),children:s.jsx(ai,{size:13})})}),s.jsx(Ke,{content:d("base.sessions_act_path"),children:s.jsx(ne,{size:"sm",variant:"ghost","aria-label":d("base.sessions_act_path"),onClick:()=>y(j),children:s.jsx(Pc,{size:13})})})]})]},`${j.engine}-${j.id}-${E}`))})})]})}function G6(){const e=Ln(),[t,a]=x.useState("open"),o=E_({key:`/tasks?state=${t}`,fetchPage:(l,c)=>Qn.globalPage({state:t,limit:l,offset:c}),resetKey:t});return s.jsxs(Ve,{fullHeight:!0,title:d("project.global_tasks.title"),description:d("project.global_tasks.subtitle"),action:s.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>s.jsx(ne,{size:"sm",variant:t===l?"primary":"ghost",onClick:()=>a(l),children:l},l))}),children:[o.isLoading&&s.jsx(ot,{}),!o.isLoading&&o.total===0&&s.jsx(gt,{children:d("project.global_tasks.empty")}),s.jsx(R_,{paged:o,fullHeight:!0,children:s.jsx("ul",{className:"space-y-2 text-sm",children:o.items.map(l=>s.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:d("project.global_tasks.go_project"),children:s.jsx(Fe,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium",children:l.title}),s.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[s.jsx("span",{children:l.state}),l.agent&&s.jsxs(Fe,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>s.jsxs("span",{children:["#",c]},c)),l.due&&s.jsxs("span",{children:[d("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})})]})}const DN=x.createContext(void 0);function T_(){const e=x.useContext(DN);if(e===void 0)throw new Error(on(64));return e}let Y6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const wp={tabActivationDirection:e=>({[Y6.activationDirection]:e})},K6=x.forwardRef(function(t,a){const{className:o,defaultValue:l=0,onValueChange:c,orientation:u="horizontal",render:p,value:m,style:h,...g}=t,b=t.defaultValue!==void 0,v=x.useRef([]),[w,N]=x.useState(()=>new Map),[y,j]=Kl({controlled:m,default:l,name:"Tabs",state:"value"}),E=m!==void 0,[S,C]=x.useState(()=>new Map),R=x.useRef(void 0),M=x.useCallback(me=>{if(me===void 0)return null;for(const[Me,de]of S.entries())if(de!=null&&me===(de.value??de.index))return Me;return null},[S]),[T,O]=x.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:D,tabActivationDirection:B}=T;let L=B,U=!1;D!==y&&(L=jw(D,y,u,S),U=D!=null&&y!=null&&M(y)==null);const z=U?D:y,P=D!==z||B!==L;ze(()=>{P&&O({previousValue:z,tabActivationDirection:L})},[z,P,L]);const $=Ue((me,Me)=>{const de=jw(y,me,u,S);Me.activationDirection=de,c?.(me,Me),!Me.isCanceled&&j(me)}),V=Ue((me,Me)=>{c?.(me,st(Me,void 0,void 0,{activationDirection:"none"}))}),q=Ue((me,Me)=>{N(de=>{if(de.get(me)===Me)return de;const he=new Map(de);return he.set(me,Me),he})}),X=Ue((me,Me)=>{N(de=>{if(!de.has(me)||de.get(me)!==Me)return de;const he=new Map(de);return he.delete(me),he})}),K=x.useCallback(me=>w.get(me),[w]),F=x.useCallback(me=>{for(const Me of S.values())if(me===Me?.value)return Me?.id},[S]),G=x.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:F,getTabPanelIdByValue:K,onValueChange:$,orientation:u,registerMountedTabPanel:q,setTabMap:C,unregisterMountedTabPanel:X,tabActivationDirection:L,value:y}),[M,F,K,$,u,q,C,X,L,y]),I=x.useMemo(()=>{for(const me of S.values())if(me!=null&&me.value===y)return me},[S,y]),Y=x.useMemo(()=>{for(const me of S.values())if(me!=null&&!me.disabled)return me.value},[S]),Z=x.useRef(!b),te=x.useRef(l),fe=x.useRef(b),ee=x.useRef(!1);ze(()=>{if(E)return;function me(Ce,we){j(Ce),O(Be=>Be.previousValue===Ce&&Be.tabActivationDirection==="none"?Be:{previousValue:Ce,tabActivationDirection:"none"}),V(Ce,we),Z.current=!1}if(S.size===0){ee.current&&y!==null&&!R.current?.isConnected&&me(null,uj);return}ee.current=!0,R.current=S.keys().next().value;const Me=I?.disabled,de=I==null&&y!==null;if(!Me&&y===te.current&&(fe.current=!1),fe.current&&Me&&y===te.current)return;const he=Z.current;if(Me||de){const Ce=Y??null;if(y===Ce){Z.current=!1;return}let we=uj;he?we=dj:Me&&(we=FS),me(Ce,we);return}he&&I!=null&&(V(y,dj),Z.current=!1)},[Y,E,V,I,j,S,y]);const re=Et("div",t,{state:{orientation:u,tabActivationDirection:L},ref:a,props:g,stateAttributesMapping:wp});return s.jsx(DN.Provider,{value:G,children:s.jsx(xp,{elementsRef:v,children:re})})});function jw(e,t,a,o){if(e==null||t==null)return"none";let l=null,c=null;for(const[m,h]of o.entries()){if(h==null)continue;const g=h.value??h.index;if(e===g&&(l=m),t===g&&(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 LN="data-composite-item-active",PN=x.createContext(void 0);function X6(){const e=x.useContext(PN);if(e===void 0)throw new Error(on(65));return e}const Q6=x.forwardRef(function(t,a){const{className:o,disabled:l=!1,render:c,value:u,id:p,nativeButton:m=!0,style:h,...g}=t,{value:b,getTabPanelIdByValue:v,orientation:w,tabActivationDirection:N}=T_(),{activateOnFocus:y,highlightedTabIndex:j,onTabActivation:E,registerTabResizeObserverElement:S,setHighlightedTabIndex:C,tabsListElement:R}=X6(),M=Ws(p),T=x.useMemo(()=>({disabled:l,id:M,value:u}),[l,M,u]),{compositeProps:O,compositeRef:D,index:B}=EC({metadata:T}),L=u===b,U=x.useRef(!1),z=x.useRef(null);ze(()=>{const Z=z.current;if(Z)return S(Z)},[S]),ze(()=>{if(U.current){U.current=!1;return}if(!(L&&B>-1&&j!==B))return;const Z=R;if(Z!=null){const te=Gn(xt(Z));if(te&&We(Z,te))return}l||C(B)},[L,B,j,C,l,R]);const{getButtonProps:P,buttonRef:$}=Fr({disabled:l,native:m,focusableWhenDisabled:!0}),V=v(u),q=x.useRef(!1),X=x.useRef(!1);function K(Z){L||l||E(u,st(ha,Z.nativeEvent,void 0,{activationDirection:"none"}))}function F(Z){L||(B>-1&&!l&&C(B),!l&&y&&(!q.current||q.current&&X.current)&&E(u,st(ha,Z.nativeEvent,void 0,{activationDirection:"none"})))}function G(Z){if(L||l)return;q.current=!0;function te(){q.current=!1,X.current=!1}(!Z.button||Z.button===0)&&(X.current=!0,xt(Z.currentTarget).addEventListener("pointerup",te,{once:!0}))}return Et("button",t,{state:{disabled:l,active:L,orientation:w,tabActivationDirection:N},ref:[a,$,D,z],props:[O,{role:"tab","aria-controls":V,"aria-selected":L,id:M,onClick:K,onFocus:F,onPointerDown:G,[LN]:L?"":void 0,onKeyDownCapture(){U.current=!0}},g,P],stateAttributesMapping:wp})});let W6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=No.startingStyle]="startingStyle",e[e.endingStyle=No.endingStyle]="endingStyle",e})({});const Z6={...wp,...tr},J6=x.forwardRef(function(t,a){const{className:o,value:l,render:c,keepMounted:u=!1,style:p,...m}=t,{value:h,getTabIdByPanelValue:g,orientation:b,tabActivationDirection:v,registerMountedTabPanel:w,unregisterMountedTabPanel:N}=T_(),y=Ws(),j=x.useMemo(()=>({id:y,value:l}),[y,l]),{ref:E,index:S}=nu({metadata:j}),C=l===h,{mounted:R,transitionStatus:M,setMounted:T}=ui(C),O=!R,D=g(l),B={hidden:O,orientation:b,tabActivationDirection:v,transitionStatus:M},L=x.useRef(null),U=Et("div",t,{state:B,ref:[a,E,L],props:[{"aria-labelledby":D,hidden:O,id:y,role:"tabpanel",tabIndex:C?0:-1,inert:fp(!C),[W6.index]:S},m],stateAttributesMapping:Z6});return ba({open:C,ref:L,onComplete(){C||T(!1)}}),ze(()=>{if(!(O&&!u)&&y!=null)return w(l,y),()=>{N(l,y)}},[O,u,l,y,w,N]),u||R?U:null}),eI=[];function tI(e){const{loopFocus:t=!0,orientation:a="both",grid:o,onLoop:l,direction:c,highlightedIndex:u,onHighlightedIndexChange:p,rootRef:m,enableHomeAndEndKeys:h=!1,stopEventPropagation:g=!1,disabledIndices:b,modifierKeys:v=eI}=e,[w,N]=x.useState(0),y=o!=null,j=x.useRef(null),E=Qa(j,m),S=x.useRef([]),C=x.useRef(!1),R=u??w,M=Ue((L,U=!1)=>{if((p??N)(L),U){const z=S.current[L];Kj(j.current,z,c,a)}}),T=Ue(L=>{if(L.size===0||C.current)return;C.current=!0;const U=Array.from(L.keys()),z=U.find($=>$?.hasAttribute(LN))??null,P=z?U.indexOf(z):-1;if(P!==-1)M(P);else if(gf(U,R,b)){const $=Fa(U,{disabledIndices:b});Rc(U,$)||M($)}Kj(j.current,z,c,a)});ze(()=>{if(b==null||u!=null||!C.current)return;const L=S.current;if(gf(L,R,b)){const U=Fa(L,{disabledIndices:b});Rc(L,U)||M(U)}},[b,u,R,S,M]);const O=Ue((L,U,z)=>l?l(L,U,z,S):z),D=Ue(L=>{const U=h?gp:_C;if(!U.has(L.key)||nI(L,v)||!j.current)return;const P=c==="rtl",$=P?kf:Sf,V={horizontal:$,vertical:Mc,both:$}[a],q=P?Sf:kf,X={horizontal:q,vertical:Ac,both:q}[a],K=qn(L.nativeEvent);if(K!=null&&Yj(K)&&!TC(K)){const fe=K.selectionStart,ee=K.selectionEnd,se=K.value??"";if(fe==null||L.shiftKey||fe!==ee||L.key!==X&&fe<se.length||L.key!==V&&fe>0)return}let F=R;const G=Wd(S,b),I=hx(S,b);o!=null&&(F=o({disabledIndices:b,elementsRef:S,event:L,highlightedIndex:R,loopFocus:t,maxIndex:I,minIndex:G,onLoop:O,orientation:a,rtl:P}));const Y={horizontal:[$],vertical:[Mc],both:[$,Mc]}[a],Z={horizontal:[q],vertical:[Ac],both:[q,Ac]}[a],te=y?U:{horizontal:h?Jz:xC,vertical:h?eD:bC,both:U}[a];h&&(L.key===mp?F=G:L.key===hp&&(F=I)),F===R&&(Y.includes(L.key)||Z.includes(L.key))&&(t&&F===I&&Y.includes(L.key)?(F=G,l&&(F=l(L,R,F,S))):t&&F===G&&Z.includes(L.key)?(F=I,l&&(F=l(L,R,F,S))):F=Fa(S.current,{startingIndex:F,decrement:Z.includes(L.key),disabledIndices:b})),F!==R&&!Rc(S.current,F)&&(g&&L.stopPropagation(),te.has(L.key)&&L.preventDefault(),M(F,!0),queueMicrotask(()=>{S.current[F]?.focus()}))});return{props:{ref:E,onFocus(L){const U=j.current,z=qn(L.nativeEvent);!U||z==null||!Yj(z)||z.setSelectionRange(0,z.value.length??0)},onKeyDown:D},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:S,disabledIndices:b,onMapChange:T,relayKeyboardEvent:D}}function nI(e,t){for(const a of rD.values())if(!t.includes(a)&&e.getModifierState(a))return!0;return!1}function sI(e){const{render:t,className:a,style:o,refs:l=Xa,props:c=Xa,state:u=Yt,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:b,loopFocus:v,onLoop:w,enableHomeAndEndKeys:N,onMapChange:y,stopEventPropagation:j=!0,rootRef:E,disabledIndices:S,modifierKeys:C,highlightItemOnHover:R=!1,tag:M="div",...T}=e,O=up(),{props:D,highlightedIndex:B,onHighlightedIndexChange:L,elementsRef:U,onMapChange:z,relayKeyboardEvent:P}=tI({grid:b,loopFocus:v,onLoop:w,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:E,stopEventPropagation:j,enableHomeAndEndKeys:N,direction:O,disabledIndices:S,modifierKeys:C}),$=Et(M,e,{state:u,ref:l,props:[D,...c,T],stateAttributesMapping:p}),V=x.useMemo(()=>({highlightedIndex:B,onHighlightedIndexChange:L,highlightItemOnHover:R,relayKeyboardEvent:P}),[B,L,R,P]);return s.jsx(uC.Provider,{value:V,children:s.jsx(xp,{elementsRef:U,onMapChange:q=>{y?.(q),z(q)},children:$})})}const aI=x.forwardRef(function(t,a){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:u,style:p,...m}=t,{onValueChange:h,orientation:g,value:b,setTabMap:v,tabActivationDirection:w}=T_(),[N,y]=x.useState(0),[j,E]=x.useState(null),S=x.useRef(new Set),C=x.useRef(new Set),R=x.useRef(null);ze(()=>{if(typeof ResizeObserver>"u")return;const U=new ResizeObserver(()=>{S.current.forEach(z=>{z()})});return R.current=U,j&&U.observe(j),C.current.forEach(z=>{U.observe(z)}),()=>{U.disconnect(),R.current=null}},[j]);const M=Ue(U=>(S.current.add(U),()=>{S.current.delete(U)})),T=Ue(U=>(C.current.add(U),R.current?.observe(U),()=>{C.current.delete(U),R.current?.unobserve(U)})),O=Ue((U,z)=>{U!==b&&h(U,z)}),D={orientation:g,tabActivationDirection:w},B={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:N,registerIndicatorUpdateListener:M,registerTabResizeObserverElement:T,onTabActivation:O,setHighlightedTabIndex:y,tabsListElement:j}),[o,N,M,T,O,y,j]);return s.jsx(PN.Provider,{value:L,children:s.jsx(sI,{render:u,className:l,style:p,state:D,refs:[a,E],props:[B,m],stateAttributesMapping:wp,highlightedIndex:N,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:y,onMapChange:v,disabledIndices:Xa})})});function kp({className:e,...t}){return s.jsx(K6,{"data-slot":"tabs",className:Ct("flex flex-col gap-4",e),...t})}const rI=h_("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 Sp({className:e,variant:t="default",...a}){return s.jsx(aI,{"data-slot":"tabs-list","data-variant":t,className:Ct(rI({variant:t}),e),...a})}function ia({className:e,...t}){return s.jsx(Q6,{"data-slot":"tabs-trigger",className:Ct("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 Ls({className:e,...t}){return s.jsx(J6,{"data-slot":"tabs-content",className:Ct("text-sm outline-none",e),...t})}function ww(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 A_(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,A_(l,c)):a[c]=l}return a}function oI(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function zx({sections:e,source:t,placeholderSource:a,jsonTitle:o,jsonDescription:l,saveLabel:c=d("common.save"),onSaveFields:u,onSaveJson:p,busy:m}){const h=e[0]?.key||"json",[g,b]=x.useState({}),[v,w]=x.useState(""),[N,y]=x.useState("");x.useEffect(()=>{const C={};for(const R of e.flatMap(M=>M.fields))C[R.path]=ww(t,R.path)??"";b(C),w(JSON.stringify(t||{},null,2)),y("")},[t,e]);const j=x.useMemo(()=>new Set(e.flatMap(C=>C.fields.map(R=>R.path))),[e]),E=async()=>{const C={},R=[];for(const M of e.flatMap(T=>T.fields)){const T=g[M.path];if(!us(T)){if(T===""||T===void 0||T===null){R.push(M.path);continue}if(M.kind==="number"){const O=Number(T);Number.isFinite(O)&&(C[M.path]=O)}else C[M.path]=T}}await u(C,R.filter(M=>j.has(M)))},S=async()=>{y("");try{await p(oI(v))}catch(C){y(C.message)}};return s.jsxs(kp,{defaultValue:h,className:"space-y-4",children:[s.jsxs(Sp,{className:"flex flex-wrap",children:[e.map(C=>s.jsx(ia,{value:C.key,children:C.label},C.key)),s.jsx(ia,{value:"json",children:"JSON"})]}),e.map(C=>s.jsx(Ls,{value:C.key,children:s.jsxs("div",{className:"space-y-4",children:[C.description&&s.jsx("p",{className:"text-sm text-muted-fg",children:C.description}),s.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:C.fields.map(R=>s.jsx(lI,{field:R,value:g[R.path],inherited:ww(a,R.path),onChange:M=>b(T=>({...T,[R.path]:M}))},R.path))}),s.jsx(ne,{variant:"primary",loading:m,onClick:E,children:c})]})},C.key)),s.jsx(Ls,{value:"json",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:o}),l&&s.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),s.jsx(pn,{rows:18,className:"font-mono text-xs",value:v,onChange:C=>w(C.target.value)}),N&&s.jsx("p",{className:"text-xs text-destructive",children:N}),s.jsx(ne,{variant:"primary",loading:m,onClick:S,children:d("settings_ui.save_json")})]})})]})}function lI({field:e,value:t,inherited:a,onChange:o}){const l=e.placeholder||kw(a)||(us(t)?zr(t):""),c=e.hint||(a!==void 0?`Heredado: ${kw(a)}`:void 0);return e.kind==="boolean"?s.jsx("div",{className:"flex items-end pb-1",children:s.jsx(Wt,{checked:t===!0,onChange:o,label:e.label})}):s.jsx(le,{label:e.label,hint:c,children:e.kind==="select"?s.jsx(dt,{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"?s.jsx(pn,{rows:4,value:String(t||""),placeholder:l,onChange:u=>o(u.target.value)}):s.jsx(Ee,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(us(t)?"":t||""),placeholder:e.kind==="password"&&us(t)?zr(t):e.kind==="password"&&us(a)?zr(a):l,onChange:u=>o(u.target.value)})})}function kw(e){return e==null||e===""?"":us(e)?zr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function iI(){return[{key:"routing",label:d("settings_ui.cfg_overrides_label"),description:d("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:d("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:d("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:d("settings_ui.cfg_permission_mode"),kind:"select",options:fb.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:d("settings_ui.cfg_extra_prompt"),kind:"textarea"}]},{key:"telegram",label:d("settings_ui.cfg_telegram_label"),fields:[{path:"telegram.route_to_agent",label:d("settings_ui.cfg_route_to_agent")},{path:"telegram.chat_id",label:d("settings_ui.cfg_chat_id")},{path:"telegram.bot_token",label:d("settings_ui.cfg_bot_token"),kind:"password"},{path:"telegram.respond_with_engine",label:d("settings_ui.cfg_respond_with_engine"),kind:"boolean"}]},{key:"engines",label:d("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:d("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:d("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:d("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:d("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:d("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:d("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function cI(){return[{key:"identity",label:d("settings_ui.cfg_project_label"),description:d("settings_ui.cfg_project_desc"),fields:[{path:"name",label:d("settings_ui.cfg_name")},{path:"version",label:d("settings_ui.cfg_version")},{path:"apf",label:d("settings_ui.cfg_apc_spec")},{path:"apx",label:d("settings_ui.cfg_apx_install")},{path:"apx_id",label:d("settings_ui.cfg_apx_storage_id")}]}]}function uI({pid:e}){const t=nt(),a=Ln(),{project:o,mutate:l}=p_(e),c=Ge(`/projects/${e}/config`,()=>cs.config.show(e)),u=String(e)==="0";if(c.isLoading)return s.jsx(ot,{});if(!c.data)return s.jsx(gt,{children:d("project.config.no_data")});const p=async h=>{await cs.apcProject.put(e,h),t.success(d("project.config.save_project")),c.mutate()},m=async h=>{await cs.config.put(e,h),t.success(d("project.config.save_override")),c.mutate()};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ve,{title:d("project.config.section_title"),description:d("project.config.section_desc"),children:s.jsxs(kp,{defaultValue:"override",className:"space-y-4",children:[s.jsxs(Sp,{children:[s.jsx(ia,{value:"override",children:"Override"}),s.jsx(ia,{value:"project",children:"APC project"}),s.jsx(ia,{value:"effective",children:"Effective"})]}),s.jsx(Ls,{value:"override",children:s.jsx(zx,{sections:iI(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(h,g)=>{await cs.config.set(e,h),g.length&&await cs.config.unset(e,g),t.success(d("project.config.save_fields_success")),c.mutate()},onSaveJson:m})}),s.jsx(Ls,{value:"project",children:s.jsx(zx,{sections:cI(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(h,g)=>{await cs.apcProject.set(e,fI(h),g),t.success(d("project.config.save_meta_success")),c.mutate()},onSaveJson:p})}),s.jsx(Ls,{value:"effective",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:d("project.config.effective_read")}),s.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?s.jsx(dI,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),a("/")}}):null]})}function dI({pid:e,label:t,onRebuilt:a,onUnregistered:o}){const l=nt(),[c,u]=x.useState(null),[p,m]=x.useState(null),h=async()=>{u("rebuild");try{await cs.rebuild(e),l.success(d("project.rebuild_done")),a()}catch(b){l.error(b.message)}finally{u(null),m(null)}},g=async()=>{u("unregister");try{await cs.remove(e),l.success(d("project.unregistered")),o()}catch(b){l.error(b.message)}finally{u(null),m(null)}};return s.jsxs(s.Fragment,{children:[s.jsx(Ve,{title:d("project.danger.title"),description:d("project.danger.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:d("project.rebuild")}),s.jsx("div",{className:"text-xs text-muted-fg",children:d("project.danger.rebuild_desc")})]}),s.jsxs(ne,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[s.jsx(Ys,{size:13})," ",d("project.rebuild")]})]}),s.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:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:d("admin.unregister")}),s.jsx("div",{className:"text-xs text-muted-fg",children:d("project.danger.unregister_desc")})]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[s.jsx(wn,{size:13})," ",d("admin.unregister")]})]})]})}),s.jsx(cn,{open:p==="rebuild",onClose:()=>c?null:m(null),title:d("project.danger.rebuild_confirm_title"),description:d("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:h,loading:c==="rebuild",children:d("project.rebuild")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.danger.rebuild_long")})}),s.jsx(cn,{open:p==="unregister",onClose:()=>c?null:m(null),title:d("project.danger.unregister_confirm_title"),description:d("project.unregister_confirm",{label:t}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:d("common.cancel")}),s.jsx(ne,{variant:"destructive",onClick:g,loading:c==="unregister",children:d("admin.unregister")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.danger.unregister_long")})})]})}function fI(e){const t={};for(const[a,o]of Object.entries(A_(e)))us(o)||(t[a]=o);return t}function Bl(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function IN({open:e,onClose:t,pid:a,editing:o,onSaved:l}){const c=nt(),[u,p]=x.useState(""),[m,h]=x.useState(""),[g,b]=x.useState(""),[v,w]=x.useState(!1);x.useEffect(()=>{e&&(p(o?.name??""),h(o?.slug??""),b(o?.goal??""))},[e,o]);const N=async()=>{if(u.trim()){w(!0);try{o?await Or.updateArea(a,o.slug,{name:u,goal:g}):await Or.createArea(a,{name:u,slug:m||Bl(u),goal:g}),c.success(d("common.saved")),l(),t()}catch(y){c.error(y instanceof Error?y.message:String(y))}finally{w(!1)}}};return s.jsx(cn,{open:e,onClose:t,title:d(o?"structure.edit_area":"structure.new_area"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,children:d("common.cancel")}),s.jsx(ne,{variant:"primary","data-testid":"area-create",onClick:()=>void N(),loading:v,disabled:!u.trim(),children:d(o?"common.save":"structure.create_area")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("structure.name"),children:s.jsx(Ee,{autoFocus:!0,"data-testid":"area-name",value:u,onChange:y=>{p(y.target.value),o||h(Bl(y.target.value))},placeholder:"Engineering"})}),!o&&s.jsx(le,{label:d("structure.slug"),children:s.jsx(Ee,{value:m,onChange:y=>h(Bl(y.target.value)),className:"font-mono",placeholder:"engineering"})}),s.jsx(le,{label:d("structure.goal"),hint:d("structure.goal_hint"),children:s.jsx(pn,{value:g,onChange:y=>b(y.target.value),rows:2})})]})})}function BN({open:e,onClose:t,pid:a,areas:o,editing:l,presetArea:c,onSaved:u}){const p=nt(),[m,h]=x.useState(""),[g,b]=x.useState(""),[v,w]=x.useState(""),[N,y]=x.useState(""),[j,E]=x.useState(!1);x.useEffect(()=>{e&&(h(l?.name??""),b(l?.slug??""),w(l?.area??c??""),y(l?.description??""))},[e,l,c]);const S=async()=>{if(m.trim()){E(!0);try{l?await Or.updateRole(a,l.slug,{name:m,area:v||null,description:N}):await Or.createRole(a,{name:m,slug:g||Bl(m),area:v||null,description:N}),p.success(d("common.saved")),u(),t()}catch(R){p.error(R instanceof Error?R.message:String(R))}finally{E(!1)}}},C=[{value:"",label:d("structure.no_area")},...o.map(R=>({value:R.slug,label:R.name}))];return s.jsx(cn,{open:e,onClose:t,title:d(l?"structure.edit_role":"structure.new_role"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:()=>void S(),loading:j,disabled:!m.trim(),children:d(l?"common.save":"structure.create_role")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("structure.name"),children:s.jsx(Ee,{autoFocus:!0,value:m,onChange:R=>{h(R.target.value),l||b(Bl(R.target.value))},placeholder:"Tech Lead"})}),!l&&s.jsx(le,{label:d("structure.slug"),children:s.jsx(Ee,{value:g,onChange:R=>b(Bl(R.target.value)),className:"font-mono",placeholder:"tech-lead"})}),s.jsx(le,{label:d("structure.area"),children:s.jsx(dt,{value:v,onChange:w,options:C,placeholder:d("structure.no_area")})}),s.jsx(le,{label:d("structure.description"),children:s.jsx(pn,{value:N,onChange:R=>y(R.target.value),rows:2})})]})})}function UN({value:e,onChange:t}){return s.jsx(Ee,{value:e,onChange:a=>t([...a.target.value].slice(-2).join("")),className:"text-center text-lg",placeholder:"🤖","aria-label":d("agents_form.emoji")})}const pI=[{value:"total",labelKey:"auto_total"},{value:"automatico",labelKey:"auto_automatico"},{value:"permiso",labelKey:"auto_permiso"}];function $N({value:e,onChange:t}){return s.jsx("div",{className:"inline-flex w-full rounded-lg border border-border p-0.5",children:pI.map(a=>s.jsx("button",{type:"button",onClick:()=>t(a.value),className:ke("flex-1 rounded-md px-2 py-1 text-[12px] font-medium capitalize transition-colors",e===a.value?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"),children:d(`agents_form.${a.labelKey}`)},a.value))})}function HN({pid:e,area:t,role:a,onArea:o,onRole:l}){const c=Ge(`/projects/${e}/organization`,()=>Or.get(e)),[u,p]=x.useState(!1),[m,h]=x.useState(!1),g=c.data?.areas??[],v=(c.data?.roles??[]).filter(y=>t?y.area===t||y.area===null:!0),w=[{value:"",label:d("structure.no_area")},...g.map(y=>({value:y.slug,label:y.name}))],N=[{value:"",label:d("agents_form.no_role")},...v.map(y=>({value:y.slug,label:y.name}))];return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("agents_form.area"),children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(dt,{value:t,onChange:y=>{o(y)},options:w,placeholder:d("structure.no_area"),className:"flex-1"}),s.jsx(Sw,{label:d("structure.new_area"),onClick:()=>p(!0)})]})}),s.jsx(le,{label:d("agents_form.role"),children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(dt,{value:a,onChange:l,options:N,placeholder:d("agents_form.no_role"),className:"flex-1"}),s.jsx(Sw,{label:d("structure.new_role"),onClick:()=>h(!0)})]})})]}),s.jsx(IN,{open:u,onClose:()=>p(!1),pid:e,onSaved:()=>void c.mutate()}),s.jsx(BN,{open:m,onClose:()=>h(!1),pid:e,areas:g,presetArea:t||null,onSaved:()=>void c.mutate()})]})}function Sw({label:e,onClick:t}){return s.jsx("button",{type:"button",onClick:t,title:e,"aria-label":e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(Kt,{className:"size-4"})})}function qN({open:e,onClose:t,onConfirm:a,title:o,description:l,confirmLabel:c,destructive:u=!0}){const[p,m]=x.useState(!1),h=async()=>{m(!0);try{await a(),t()}finally{m(!1)}};return s.jsx(cn,{open:e,onClose:t,title:o,footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:p,children:d("common.cancel")}),s.jsx(ne,{variant:u?"destructive":"primary",onClick:()=>void h(),loading:p,children:c??d("common.confirm")})]}),children:s.jsx("p",{className:"text-sm text-muted-foreground",children:l})})}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,h=0;for(c=0;c<u;++c)p=a[c],m+=p.x,h+=p.y;for(m=(m/u-e)*o,h=(h/u-t)*o,c=0;c<u;++c)p=a[c],p.x-=m,p.y-=h}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 hI(e){const t=+this._x.call(null,e),a=+this._y.call(null,e);return VN(this.cover(t,a),t,a,e)}function VN(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,h=e._x1,g=e._y1,b,v,w,N,y,j,E,S;if(!c)return e._root=u,e;for(;c.length;)if((y=t>=(b=(p+h)/2))?p=b:h=b,(j=a>=(v=(m+g)/2))?m=v:g=v,l=c,!(c=c[E=j<<1|y]))return l[E]=u,e;if(w=+e._x.call(null,c.data),N=+e._y.call(null,c.data),t===w&&a===N)return u.next=c,l?l[E]=u:e._root=u,e;do l=l?l[E]=new Array(4):e._root=new Array(4),(y=t>=(b=(p+h)/2))?p=b:h=b,(j=a>=(v=(m+g)/2))?m=v:g=v;while((E=j<<1|y)===(S=(N>=v)<<1|w>=b));return l[S]=c,l[E]=u,e}function gI(e){var t,a,o=e.length,l,c,u=new Array(o),p=new Array(o),m=1/0,h=1/0,g=-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>g&&(g=l),c<h&&(h=c),c>b&&(b=c));if(m>g||h>b)return this;for(this.cover(m,h).cover(g,b),a=0;a<o;++a)VN(this,u[a],p[a],e[a]);return this}function xI(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,h;a>e||e>=l||o>t||t>=c;)switch(h=(t<o)<<1|e<a,m=new Array(4),m[h]=p,p=m,u*=2,h){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 bI(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function _I(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 Wn(e,t,a,o,l){this.node=e,this.x0=t,this.y0=a,this.x1=o,this.y1=l}function vI(e,t,a){var o,l=this._x0,c=this._y0,u,p,m,h,g=this._x1,b=this._y1,v=[],w=this._root,N,y;for(w&&v.push(new Wn(w,l,c,g,b)),a==null?a=1/0:(l=e-a,c=t-a,g=e+a,b=t+a,a*=a);N=v.pop();)if(!(!(w=N.node)||(u=N.x0)>g||(p=N.y0)>b||(m=N.x1)<l||(h=N.y1)<c))if(w.length){var j=(u+m)/2,E=(p+h)/2;v.push(new Wn(w[3],j,E,m,h),new Wn(w[2],u,E,j,h),new Wn(w[1],j,p,m,E),new Wn(w[0],u,p,j,E)),(y=(t>=E)<<1|e>=j)&&(N=v[v.length-1],v[v.length-1]=v[v.length-1-y],v[v.length-1-y]=N)}else{var S=e-+this._x.call(null,w.data),C=t-+this._y.call(null,w.data),R=S*S+C*C;if(R<a){var M=Math.sqrt(a=R);l=e-M,c=t-M,g=e+M,b=t+M,o=w.data}}return o}function yI(e){if(isNaN(g=+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,h=this._y1,g,b,v,w,N,y,j,E;if(!a)return this;if(a.length)for(;;){if((N=g>=(v=(u+m)/2))?u=v:m=v,(y=b>=(w=(p+h)/2))?p=w:h=w,t=a,!(a=a[j=y<<1|N]))return this;if(!a.length)break;(t[j+1&3]||t[j+2&3]||t[j+3&3])&&(o=t,E=j)}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[j]=c:delete t[j],(a=t[0]||t[1]||t[2]||t[3])&&a===(t[3]||t[2]||t[1]||t[0])&&!a.length&&(o?o[E]=a:this._root=a),this):(this._root=c,this)}function jI(e){for(var t=0,a=e.length;t<a;++t)this.remove(e[t]);return this}function wI(){return this._root}function kI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function SI(e){var t=[],a,o=this._root,l,c,u,p,m;for(o&&t.push(new Wn(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 h=(c+p)/2,g=(u+m)/2;(l=o[3])&&t.push(new Wn(l,h,g,p,m)),(l=o[2])&&t.push(new Wn(l,c,g,h,m)),(l=o[1])&&t.push(new Wn(l,h,u,p,g)),(l=o[0])&&t.push(new Wn(l,c,u,h,g))}return this}function CI(e){var t=[],a=[],o;for(this._root&&t.push(new Wn(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,h=o.y1,g=(u+m)/2,b=(p+h)/2;(c=l[0])&&t.push(new Wn(c,u,p,g,b)),(c=l[1])&&t.push(new Wn(c,g,p,m,b)),(c=l[2])&&t.push(new Wn(c,u,b,g,h)),(c=l[3])&&t.push(new Wn(c,g,b,m,h))}a.push(o)}for(;o=a.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function NI(e){return e[0]}function EI(e){return arguments.length?(this._x=e,this):this._x}function RI(e){return e[1]}function TI(e){return arguments.length?(this._y=e,this):this._y}function M_(e,t,a){var o=new O_(t??NI,a??RI,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function O_(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 Cw(e){for(var t={data:e.data},a=t;e=e.next;)a=a.next={data:e.data};return t}var ts=M_.prototype=O_.prototype;ts.copy=function(){var e=new O_(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=Cw(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]=Cw(o));return e};ts.add=hI;ts.addAll=gI;ts.cover=xI;ts.data=bI;ts.extent=_I;ts.find=vI;ts.remove=yI;ts.removeAll=jI;ts.root=wI;ts.size=kI;ts.visit=SI;ts.visitAfter=CI;ts.x=EI;ts.y=TI;function yo(e){return function(){return e}}function Mr(e){return(e()-.5)*1e-6}function AI(e){return e.x+e.vx}function MI(e){return e.y+e.vy}function OI(e){var t,a,o,l=1,c=1;typeof e!="function"&&(e=yo(e==null?1:+e));function u(){for(var h,g=t.length,b,v,w,N,y,j,E=0;E<c;++E)for(b=M_(t,AI,MI).visitAfter(p),h=0;h<g;++h)v=t[h],y=a[v.index],j=y*y,w=v.x+v.vx,N=v.y+v.vy,b.visit(S);function S(C,R,M,T,O){var D=C.data,B=C.r,L=y+B;if(D){if(D.index>v.index){var U=w-D.x-D.vx,z=N-D.y-D.vy,P=U*U+z*z;P<L*L&&(U===0&&(U=Mr(o),P+=U*U),z===0&&(z=Mr(o),P+=z*z),P=(L-(P=Math.sqrt(P)))/P*l,v.vx+=(U*=P)*(L=(B*=B)/(j+B)),v.vy+=(z*=P)*L,D.vx-=U*(L=1-L),D.vy-=z*L)}return}return R>w+L||T<w-L||M>N+L||O<N-L}}function p(h){if(h.data)return h.r=a[h.data.index];for(var g=h.r=0;g<4;++g)h[g]&&h[g].r>h.r&&(h.r=h[g].r)}function m(){if(t){var h,g=t.length,b;for(a=new Array(g),h=0;h<g;++h)b=t[h],a[b.index]=+e(b,h,t)}}return u.initialize=function(h,g){t=h,o=g,m()},u.iterations=function(h){return arguments.length?(c=+h,u):c},u.strength=function(h){return arguments.length?(l=+h,u):l},u.radius=function(h){return arguments.length?(e=typeof h=="function"?h:yo(+h),m(),u):e},u}function zI(e){return e.index}function Nw(e,t){var a=e.get(t);if(!a)throw new Error("node not found: "+t);return a}function DI(e){var t=zI,a=b,o,l=yo(30),c,u,p,m,h,g=1;e==null&&(e=[]);function b(j){return 1/Math.min(p[j.source.index],p[j.target.index])}function v(j){for(var E=0,S=e.length;E<g;++E)for(var C=0,R,M,T,O,D,B,L;C<S;++C)R=e[C],M=R.source,T=R.target,O=T.x+T.vx-M.x-M.vx||Mr(h),D=T.y+T.vy-M.y-M.vy||Mr(h),B=Math.sqrt(O*O+D*D),B=(B-c[C])/B*j*o[C],O*=B,D*=B,T.vx-=O*(L=m[C]),T.vy-=D*L,M.vx+=O*(L=1-L),M.vy+=D*L}function w(){if(u){var j,E=u.length,S=e.length,C=new Map(u.map((M,T)=>[t(M,T,u),M])),R;for(j=0,p=new Array(E);j<S;++j)R=e[j],R.index=j,typeof R.source!="object"&&(R.source=Nw(C,R.source)),typeof R.target!="object"&&(R.target=Nw(C,R.target)),p[R.source.index]=(p[R.source.index]||0)+1,p[R.target.index]=(p[R.target.index]||0)+1;for(j=0,m=new Array(S);j<S;++j)R=e[j],m[j]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(S),N(),c=new Array(S),y()}}function N(){if(u)for(var j=0,E=e.length;j<E;++j)o[j]=+a(e[j],j,e)}function y(){if(u)for(var j=0,E=e.length;j<E;++j)c[j]=+l(e[j],j,e)}return v.initialize=function(j,E){u=j,h=E,w()},v.links=function(j){return arguments.length?(e=j,w(),v):e},v.id=function(j){return arguments.length?(t=j,v):t},v.iterations=function(j){return arguments.length?(g=+j,v):g},v.strength=function(j){return arguments.length?(a=typeof j=="function"?j:yo(+j),N(),v):a},v.distance=function(j){return arguments.length?(l=typeof j=="function"?j:yo(+j),y(),v):l},v}var LI={value:()=>{}};function FN(){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 tf(a)}function tf(e){this._=e}function PI(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}})}tf.prototype=FN.prototype={constructor:tf,on:function(e,t){var a=this._,o=PI(e+"",a),l,c=-1,u=o.length;if(arguments.length<2){for(;++c<u;)if((l=(e=o[c]).type)&&(l=II(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]=Ew(a[l],e.name,t);else if(t==null)for(l in a)a[l]=Ew(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 tf(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 II(e,t){for(var a=0,o=e.length,l;a<o;++a)if((l=e[a]).name===t)return l.value}function Ew(e,t,a){for(var o=0,l=e.length;o<l;++o)if(e[o].name===t){e[o]=LI,e=e.slice(0,o).concat(e.slice(o+1));break}return a!=null&&e.push({name:t,value:a}),e}var Zl=0,Sc=0,dc=0,GN=1e3,Pf,Cc,If=0,Ao=0,Cp=0,Fc=typeof performance=="object"&&performance.now?performance:Date,YN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function KN(){return Ao||(YN(BI),Ao=Fc.now()+Cp)}function BI(){Ao=0}function Dx(){this._call=this._time=this._next=null}Dx.prototype=XN.prototype={constructor:Dx,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?KN():+a)+(t==null?0:+t),!this._next&&Cc!==this&&(Cc?Cc._next=this:Pf=this,Cc=this),this._call=e,this._time=a,Lx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lx())}};function XN(e,t,a){var o=new Dx;return o.restart(e,t,a),o}function UI(){KN(),++Zl;for(var e=Pf,t;e;)(t=Ao-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Zl}function Rw(){Ao=(If=Fc.now())+Cp,Zl=Sc=0;try{UI()}finally{Zl=0,HI(),Ao=0}}function $I(){var e=Fc.now(),t=e-If;t>GN&&(Cp-=t,If=e)}function HI(){for(var e,t=Pf,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:Pf=a);Cc=e,Lx(o)}function Lx(e){if(!Zl){Sc&&(Sc=clearTimeout(Sc));var t=e-Ao;t>24?(e<1/0&&(Sc=setTimeout(Rw,e-Fc.now()-Cp)),dc&&(dc=clearInterval(dc))):(dc||(If=Fc.now(),dc=setInterval($I,GN)),Zl=1,YN(Rw))}}const qI=1664525,VI=1013904223,Tw=4294967296;function FI(){let e=1;return()=>(e=(qI*e+VI)%Tw)/Tw}function GI(e){return e.x}function YI(e){return e.y}var KI=10,XI=Math.PI*(3-Math.sqrt(5));function QI(e){var t,a=1,o=.001,l=1-Math.pow(o,1/300),c=0,u=.6,p=new Map,m=XN(b),h=FN("tick","end"),g=FI();e==null&&(e=[]);function b(){v(),h.call("tick",t),a<o&&(m.stop(),h.call("end",t))}function v(y){var j,E=e.length,S;y===void 0&&(y=1);for(var C=0;C<y;++C)for(a+=(c-a)*l,p.forEach(function(R){R(a)}),j=0;j<E;++j)S=e[j],S.fx==null?S.x+=S.vx*=u:(S.x=S.fx,S.vx=0),S.fy==null?S.y+=S.vy*=u:(S.y=S.fy,S.vy=0);return t}function w(){for(var y=0,j=e.length,E;y<j;++y){if(E=e[y],E.index=y,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var S=KI*Math.sqrt(.5+y),C=y*XI;E.x=S*Math.cos(C),E.y=S*Math.sin(C)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function N(y){return y.initialize&&y.initialize(e,g),y}return w(),t={tick:v,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(y){return arguments.length?(e=y,w(),p.forEach(N),t):e},alpha:function(y){return arguments.length?(a=+y,t):a},alphaMin:function(y){return arguments.length?(o=+y,t):o},alphaDecay:function(y){return arguments.length?(l=+y,t):+l},alphaTarget:function(y){return arguments.length?(c=+y,t):c},velocityDecay:function(y){return arguments.length?(u=1-y,t):1-u},randomSource:function(y){return arguments.length?(g=y,p.forEach(N),t):g},force:function(y,j){return arguments.length>1?(j==null?p.delete(y):p.set(y,N(j)),t):p.get(y)},find:function(y,j,E){var S=0,C=e.length,R,M,T,O,D;for(E==null?E=1/0:E*=E,S=0;S<C;++S)O=e[S],R=y-O.x,M=j-O.y,T=R*R+M*M,T<E&&(D=O,E=T);return D},on:function(y,j){return arguments.length>1?(h.on(y,j),t):h.on(y)}}}function WI(){var e,t,a,o,l=yo(-30),c,u=1,p=1/0,m=.81;function h(w){var N,y=e.length,j=M_(e,GI,YI).visitAfter(b);for(o=w,N=0;N<y;++N)t=e[N],j.visit(v)}function g(){if(e){var w,N=e.length,y;for(c=new Array(N),w=0;w<N;++w)y=e[w],c[y.index]=+l(y,w,e)}}function b(w){var N=0,y,j,E=0,S,C,R;if(w.length){for(S=C=R=0;R<4;++R)(y=w[R])&&(j=Math.abs(y.value))&&(N+=y.value,E+=j,S+=j*y.x,C+=j*y.y);w.x=S/E,w.y=C/E}else{y=w,y.x=y.data.x,y.y=y.data.y;do N+=c[y.data.index];while(y=y.next)}w.value=N}function v(w,N,y,j){if(!w.value)return!0;var E=w.x-t.x,S=w.y-t.y,C=j-N,R=E*E+S*S;if(C*C/m<R)return R<p&&(E===0&&(E=Mr(a),R+=E*E),S===0&&(S=Mr(a),R+=S*S),R<u&&(R=Math.sqrt(u*R)),t.vx+=E*w.value*o/R,t.vy+=S*w.value*o/R),!0;if(w.length||R>=p)return;(w.data!==t||w.next)&&(E===0&&(E=Mr(a),R+=E*E),S===0&&(S=Mr(a),R+=S*S),R<u&&(R=Math.sqrt(u*R)));do w.data!==t&&(C=c[w.data.index]*o/R,t.vx+=E*C,t.vy+=S*C);while(w=w.next)}return h.initialize=function(w,N){e=w,a=N,g()},h.strength=function(w){return arguments.length?(l=typeof w=="function"?w:yo(+w),g(),h):l},h.distanceMin=function(w){return arguments.length?(u=w*w,h):Math.sqrt(u)},h.distanceMax=function(w){return arguments.length?(p=w*w,h):Math.sqrt(p)},h.theta=function(w){return arguments.length?(m=w*w,h):Math.sqrt(m)},h}const fc={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function ZI(){return{agent:d("agents_ui.kind_agent"),memory:d("agents_ui.kind_memory"),thread:d("agents_ui.kind_thread"),task:d("agents_ui.kind_task"),routine:d("agents_ui.kind_routine"),agentlink:d("agents_ui.kind_hierarchy")}}const pc=760,mc=460;function JI({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,h]=x.useState(null);x.useEffect(()=>{const j={id:"__center",label:e,kind:"agent",relation:"self",x:pc/2,y:mc/2,fx:pc/2,fy:mc/2},E=[j,...t.map(R=>({...R}))],S=E.slice(1).map(R=>({source:j,target:R}));l.current=E,c.current=S;const C=QI(E).force("link",DI(S).distance(120).strength(.5)).force("charge",WI().strength(-220)).force("center",mI(pc/2,mc/2).strength(.05)).force("collide",OI(26)).on("tick",()=>p(R=>R+1));return o.current=C,()=>{C.stop()}},[e,t]);const g=j=>{const E=a.current.getBoundingClientRect();return{x:(j.clientX-E.left)/E.width*pc,y:(j.clientY-E.top)/E.height*mc}},b=j=>E=>{j.id!=="__center"&&(u.current=j,E.target.setPointerCapture?.(E.pointerId),o.current?.alphaTarget(.3).restart())},v=j=>{const E=u.current;if(!E)return;const{x:S,y:C}=g(j);E.fx=S,E.fy=C},w=()=>{const j=u.current;j&&(j.fx=null,j.fy=null),u.current=null,o.current?.alphaTarget(0)},N=l.current,y=c.current;return s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:s.jsxs("svg",{ref:a,viewBox:`0 0 ${pc} ${mc}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:w,onPointerLeave:w,children:[y.map((j,E)=>s.jsx("line",{x1:j.source.x,y1:j.source.y,x2:j.target.x,y2:j.target.y,stroke:fc[j.target.kind],strokeOpacity:.22,strokeWidth:1.5},E)),N.map(j=>{if(j.id==="__center")return s.jsxs("g",{transform:`translate(${j.x},${j.y})`,children:[s.jsx("circle",{r:22,fill:fc.agent}),s.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},j.id);const E=m?.id===j.id;return s.jsxs("g",{transform:`translate(${j.x},${j.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(j),onClick:()=>h(j),children:[s.jsx("circle",{r:E?9:6,fill:fc[j.kind],fillOpacity:E?1:.9,stroke:E?"#fff":"none",strokeWidth:E?2:0}),s.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:j.label.length>22?`${j.label.slice(0,22)}…`:j.label})]},j.id)})]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const j=ZI();return Object.keys(j).filter(E=>E!=="agent").map(E=>s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"size-2 rounded-full",style:{background:fc[E]}})," ",j[E]]},E))})(),s.jsx("span",{className:"ml-auto",children:d("agents_ui.nodes_drag_hint",{n:String(t.length)})})]}),m&&s.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-2 rounded-full",style:{background:fc[m.kind]}}),s.jsx("span",{className:"font-medium",children:m.label}),s.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&s.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function e8(){return[{key:"overview",label:d("agents_ui.tab_explorer"),icon:Ff},{key:"memories",label:d("project.nav.memories"),icon:of},{key:"records",label:d("project.agent_detail.records_title"),icon:eb},{key:"sleep",label:d("project.agent_detail.sleep_title"),icon:jo},{key:"brain",label:d("project.agent_detail.brain_title"),icon:er},{key:"config",label:d("settings.tabs.advanced"),icon:Ic}]}function QN(){return[{value:"",label:d("agents_ui.type_none")},{value:"orchestrator",label:d("agents_ui.type_orchestrator"),description:d("agents_ui.type_orchestrator_desc")},{value:"specialist",label:d("agents_ui.type_specialist"),description:d("agents_ui.type_specialist_desc")},{value:"assistant",label:d("agents_ui.type_assistant"),description:d("agents_ui.type_assistant_desc")},{value:"worker",label:d("agents_ui.type_worker"),description:d("agents_ui.type_worker_desc")},{value:"monitor",label:d("agents_ui.type_monitor"),description:d("agents_ui.type_monitor_desc")}]}const Px=e=>e.split(",").map(t=>t.trim()).filter(Boolean),t8=(e,t)=>e.filter(a=>a.spec?.agent===t||t==="super-agent"&&a.kind==="super_agent");function n8(e){return e.split(`
673
+ `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function s8({pid:e}){const{slug:t=""}=aS(),a=Ln(),[o,l]=x.useState("overview"),c=e8(),u=Ge(`/projects/${e}/agents/${t}`,()=>ln.get(e,t)),p=Ge(`/projects/${e}/agents`,()=>ln.list(e)),m=Ge(`/projects/${e}/routines`,()=>Er.list(e)),h=Ge(`/projects/${e}/messages?agent=${t}`,()=>Ef.project(e,{agent:t,limit:200})),g=Ge(`/projects/${e}/agents/${t}/conversations`,()=>Eo.list(e,t)),b=Ge(`/projects/${e}/tasks?all`,()=>Qn.list(e,"all")),v=u.data,w=t8(m.data||[],t),N=(b.data||[]).filter(E=>E.agent===t),y=(p.data||[]).filter(E=>E.parent===t);if(u.isLoading)return s.jsx(ot,{});if(!v)return s.jsx("div",{className:"text-sm text-muted-fg",children:d("project.agent_detail.not_found")});const j=v.is_master?pa:rn;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("button",{onClick:()=>a(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:s.jsx(qM,{size:16})}),s.jsx("div",{className:ke("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:s.jsx(j,{className:"size-5 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h1",{className:"text-lg font-semibold",children:v.slug}),v.is_master&&s.jsxs(Fe,{tone:"success",children:[s.jsx(pa,{size:10})," ",d("project.agents.orchestrator")]}),v.role&&s.jsx(Fe,{children:v.role}),v.model&&s.jsx(Fe,{tone:"info",children:v.model}),v.parent&&s.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[d("project.agent_detail.reports_to")," ",v.parent]})]}),v.description&&s.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:v.description})]})]}),s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>a(`/p/${e}/chat?agent=${t}`),children:[s.jsx(Qs,{size:13})," ",d("project.agent_detail.chat_btn",{slug:v.slug})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:E,label:S,icon:C})=>s.jsxs("button",{onClick:()=>l(E),className:ke("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===E?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[s.jsx(C,{size:14})," ",S]},E))}),o==="overview"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[s.jsx(Bd,{label:d("agents_ui.stat_threads"),value:g.data?.length??0,icon:uf}),s.jsx(Bd,{label:d("agents_ui.stat_records"),value:h.data?.length??0,icon:eb}),s.jsx(Bd,{label:d("agents_ui.stat_tasks"),value:N.length,icon:Ff}),s.jsx(Bd,{label:d("agents_ui.stat_heartbeats"),value:w.length,icon:jo})]}),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(Ve,{title:d("agent_detail_extra.skills_title"),description:"",children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(E=>s.jsxs(Fe,{tone:"info",children:[s.jsx(er,{size:10})," ",E]},E)),v.tools?.map(E=>s.jsxs(Fe,{children:[s.jsx(li,{size:10})," ",E]},E)),!v.skills?.length&&!v.tools?.length&&s.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),s.jsx(Ve,{title:d("project.agent_detail.threads_recent"),description:"",children:s.jsxs("ul",{className:"space-y-1 text-xs",children:[(g.data||[]).slice(0,6).map(E=>s.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[s.jsx("span",{className:"truncate",children:E.title||E.filename}),s.jsxs("span",{className:"shrink-0 text-muted-fg",children:[E.messages??0," ",d("project.agent_detail.msgs_count")]})]},E.id)),!g.data?.length&&s.jsx("li",{className:"text-muted-fg",children:d("project.agent_detail.no_threads")})]})})]}),y.length>0&&s.jsx(Ve,{title:d("project.agent_detail.subagents"),description:d("project.agent_detail.subagents_desc"),children:s.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(E=>s.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${E.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:[s.jsx(rn,{size:14,className:"text-muted-fg"})," ",E.slug]},E.slug))})})]}),o==="memories"&&s.jsx(r8,{pid:e,slug:t,initial:v.memory||"",onSaved:()=>u.mutate()}),o==="records"&&s.jsx(o8,{records:h.data||[],loading:h.isLoading}),o==="sleep"&&s.jsx(l8,{routines:w}),o==="brain"&&s.jsx(c8,{slug:t,memory:v.memory||"",threads:(g.data||[]).map(E=>({id:E.id,label:E.title||E.filename})),tasks:N.map(E=>({id:E.id,label:E.title,detail:E.body||void 0})),routines:w,parent:v.parent||null,children:y.map(E=>E.slug)}),o==="config"&&s.jsx(a8,{pid:e,agent:v,agents:p.data||[],onSaved:()=>{u.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),a(`/p/${e}/agents`)}})]})}function a8({pid:e,agent:t,agents:a,onSaved:o,onDeleted:l}){const c=nt(),[u,p]=x.useState(t.emoji||""),[m,h]=x.useState(t.type||""),[g,b]=x.useState(t.area||""),[v,w]=x.useState(t.role||""),[N,y]=x.useState(t.autonomy||""),[j,E]=x.useState(t.model||""),[S,C]=x.useState(t.parent||""),[R,M]=x.useState(!!t.is_master),[T,O]=x.useState((t.skills||[]).join(", ")),[D,B]=x.useState((t.tools||[]).join(", ")),[L,U]=x.useState(t.description||""),[z,P]=x.useState(t.system||""),[$,V]=x.useState(!1),[q,X]=x.useState(!1),K=async()=>{V(!0);try{await ln.update(e,t.slug,{emoji:u||null,type:m||null,area:g||null,role:v||null,autonomy:N||null,model:j||null,parent:S||null,is_master:R||m==="orchestrator",skills:Px(T),tools:Px(D),description:L||null,system:z}),c.success(d("project.agent_detail.update_success")),o()}catch(G){c.error(G.message)}finally{V(!1)}},F=async()=>{await ln.remove(e,t.slug),c.success(d("project.agent_detail.delete_success")),l()};return s.jsxs(Ve,{title:d("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${d("agents_ui.config_def_desc")}`,children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr] gap-3",children:[s.jsx(le,{label:d("agents_form.emoji"),children:s.jsx(UN,{value:u,onChange:p})}),s.jsx(le,{label:d("project.agent_detail.type_label"),children:s.jsx(dt,{value:m,onChange:h,options:QN()})})]}),s.jsx(HN,{pid:e,area:g,role:v,onArea:b,onRole:w}),s.jsx(le,{label:d("agents_form.autonomy"),hint:d("agents_form.autonomy_hint"),children:s.jsx($N,{value:N,onChange:y})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.agent_detail.parent_label"),children:s.jsx(dt,{value:S,onChange:C,placeholder:d("project.agent_detail.none_parent"),options:[{value:"",label:d("project.agent_detail.none_parent")},...a.filter(G=>G.slug!==t.slug).map(G=>({value:G.slug,label:G.slug}))]})}),s.jsx(le,{label:d("project.agent_detail.model_label"),hint:d("project.agent_detail.model_hint"),children:s.jsx(Ee,{value:j,onChange:G=>E(G.target.value),placeholder:d("project.agent_detail.model_ph")})})]}),s.jsx(le,{label:d("project.agent_detail.skills_label"),children:s.jsx(Ee,{value:T,onChange:G=>O(G.target.value),placeholder:"skill-a, skill-b"})}),s.jsx(i8,{value:D,onChange:B}),s.jsx(le,{label:d("project.agent_detail.bio_label"),children:s.jsx(pn,{rows:2,value:L,onChange:G=>U(G.target.value)})}),s.jsx(le,{label:d("project.agent_detail.system_label"),hint:d("project.agent_detail.system_hint"),children:s.jsx(pn,{rows:10,className:"font-mono text-xs",value:z,onChange:G=>P(G.target.value),placeholder:"You are…"})}),s.jsx(Wt,{checked:R,onChange:M,label:d("project.agent_detail.master_label")}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[s.jsxs(ne,{variant:"destructive",onClick:()=>X(!0),children:[s.jsx(wn,{size:13})," ",d("project.agent_detail.delete_btn")]}),s.jsxs(ne,{variant:"primary",loading:$,onClick:K,children:[s.jsx(oi,{size:13})," ",d("project.agent_detail.save_btn")]})]})]}),s.jsx(qN,{open:q,onClose:()=>X(!1),onConfirm:F,title:d("project.agent_detail.delete_btn"),description:d("project.agent_detail.delete_confirm",{slug:t.slug}),confirmLabel:d("project.agent_detail.delete_btn")})]})}function Bd({label:e,value:t,icon:a}){return s.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[s.jsx(a,{size:13})," ",e]}),s.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function r8({pid:e,slug:t,initial:a,onSaved:o}){const l=nt(),[c,u]=x.useState(a),[p,m]=x.useState(!1);x.useEffect(()=>{u(a)},[a]);const h=c!==a,g=async()=>{m(!0);try{await ln.memory.put(e,t,c),l.success(d("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{m(!1)}};return s.jsxs(Ve,{title:d("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${t}/memory.md — ${d("agents_ui.memory_durable_desc")}`,children:[s.jsx(pn,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>u(b.target.value),placeholder:d("project.agent_detail.memory_empty")}),s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",d("project.memories.chars")]}),s.jsxs(ne,{size:"sm",variant:"primary",loading:p,disabled:!h,onClick:g,children:[s.jsx(oi,{size:12})," ",d("project.memories.save_btn")]})]})]})}function o8({records:e,loading:t}){const a=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return s.jsxs(Ve,{title:d("project.agent_detail.records_title"),description:d("project.agent_detail.records_desc"),children:[t&&s.jsx(ot,{}),!t&&a.length===0&&s.jsx("p",{className:"text-xs text-muted-fg",children:d("project.agent_detail.no_activity")}),s.jsx("ul",{className:"space-y-1 text-sm",children:a.map((o,l)=>s.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?s.jsx(fS,{size:13,className:"text-blue-400"}):s.jsx(mS,{size:13,className:"text-emerald-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[s.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),s.jsx(Fe,{tone:"info",children:o.channel}),o.type&&s.jsx(Fe,{children:o.type})]}),o.body&&s.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 l8({routines:e}){return e.length===0?s.jsx(Ve,{title:d("project.agent_detail.sleep_title"),description:d("project.agent_detail.sleep_desc"),children:s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[s.jsx("div",{className:"font-medium text-amber-400",children:d("project.agent_detail.sleep_deep")}),s.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:d("project.agent_detail.sleep_deep_desc")})]})}):s.jsx(Ve,{title:d("project.agent_detail.sleep_title"),description:d("project.agent_detail.sleep_desc"),children:s.jsx("div",{className:"space-y-3",children:e.map(t=>{const a=t.enabled,o=t.last_status==="error";return s.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:ke("size-2 rounded-full",o?"bg-destructive":a?"bg-emerald-400":"bg-muted-fg/40")}),s.jsx("span",{className:"text-sm font-medium",children:t.name}),s.jsx(Fe,{tone:a?"success":"muted",children:d(a?"agents_ui.running":"agents_ui.paused")}),o&&s.jsx(Fe,{tone:"danger",children:d("agents_ui.last_error")})]}),s.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[s.jsx(Ud,{label:d("agents_ui.field_tick"),value:t.schedule}),s.jsx(Ud,{label:d("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),s.jsx(Ud,{label:d("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),s.jsx(Ud,{label:d("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&s.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 Ud({label:e,value:t}){return s.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function i8({value:e,onChange:t}){const a=Ge("/tools",()=>EL.list()),o=Px(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 s.jsxs(le,{label:d("agents_ui.tools_label"),hint:d("project.agent_detail.tools_hint"),children:[s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return s.jsx(Ke,{content:p.description||p.name,children:s.jsx("button",{type:"button",onClick:()=>c(p.name),className:ke("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=>s.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))]}),s.jsx(Ee,{className:"mt-2",value:e,onChange:p=>t(p.target.value),placeholder:d("project.agent_detail.tools_custom_ph")})]})}function c8({slug:e,memory:t,threads:a,tasks:o,routines:l,parent:c,children:u}){const p=x.useMemo(()=>{const m=[];return n8(t).forEach((h,g)=>m.push({id:`m${g}`,label:h,kind:"memory",relation:"knows",detail:h})),a.slice(0,8).forEach(h=>m.push({id:`th-${h.id}`,label:h.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(h=>m.push({id:`ts-${h.id}`,label:h.label,kind:"task",relation:"handles_task",detail:h.detail})),l.forEach(h=>m.push({id:`rt-${h.name}`,label:h.name,kind:"routine",relation:"ticks",detail:`schedule: ${h.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),u.forEach(h=>m.push({id:`c-${h}`,label:h,kind:"agentlink",relation:"orchestrates"})),m},[t,a,o,l,c,u]);return s.jsx(Ve,{title:d("project.agent_detail.brain_title"),description:d("project.agent_detail.brain_desc"),children:p.length===0?s.jsx("p",{className:"text-xs text-muted-fg",children:d("project.agent_detail.brain_empty")}):s.jsx(JI,{center:e,nodes:p})})}const u8=["","es","en","pt","fr","it","de"],Aw=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function WN(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:pa}:{gradient:"from-slate-600 to-gray-600",Icon:rn}}function d8(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 f8({pid:e}){const t=Ln();nt();const a=Ge(`/projects/${e}/agents`,()=>ln.list(e)),[o,l]=x.useState("hierarchy"),[c,u]=x.useState(!1),[p,m]=x.useState(!1),h=a.data||[],g=N=>t(`/p/${e}/agents/${N}`),b=N=>t(N?`/p/${e}/chat?agent=${N}`:`/p/${e}/chat`),{roots:v,childrenByParent:w}=x.useMemo(()=>d8(h),[h]);return s.jsxs(Ve,{title:d("project.agents.title"),description:d("project.agents.subtitle_full"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsxs("button",{onClick:()=>l("hierarchy"),className:ke("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[s.jsx(lb,{size:13})," ",d("project.agents.hierarchy")]}),s.jsxs("button",{onClick:()=>l("list"),className:ke("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[s.jsx(N3,{size:13})," ",d("project.agents.list_view")]})]}),s.jsxs(ne,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[s.jsx(I3,{size:13})," ",d("project.agents.import")]}),s.jsxs(ne,{size:"sm",variant:"secondary",onClick:()=>b(),children:[s.jsx(Qs,{size:13})," ",d("project.agents.chat")]}),s.jsxs(ne,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>u(!0),children:[s.jsx(Kt,{size:14})," ",d("project.agents.new")]})]}),children:[a.isLoading&&s.jsx(ot,{}),!a.isLoading&&h.length===0&&s.jsx(gt,{children:d("project.agents.empty_text")}),!a.isLoading&&h.length>0&&(o==="hierarchy"?s.jsx(m8,{roots:v,childrenByParent:w,onOpen:g,onChat:b}):s.jsx(h8,{agents:h,onOpen:g,onChat:b})),s.jsx(g8,{open:c,pid:e,agents:h,onClose:()=>u(!1),onCreated:()=>{u(!1),a.mutate()}}),s.jsx(p8,{open:p,pid:e,existing:h.map(N=>N.slug),onClose:()=>m(!1),onImported:()=>a.mutate()})]})}function p8({open:e,onClose:t,onImported:a,pid:o,existing:l}){const c=nt(),u=Ge(e?"/agents/vault":null,()=>ln.vault()),[p,m]=x.useState(""),h=u.data||[],g=async b=>{m(b);try{await ln.import(o,b),c.success(d("project.agents.import_success",{slug:b})),a()}catch(v){c.error(v.message)}finally{m("")}};return s.jsxs(cn,{open:e,onClose:t,title:d("project.agents.import_title"),description:d("project.agents.import_desc"),size:"lg",footer:s.jsx(ne,{variant:"ghost",onClick:t,children:d("common.close")}),children:[u.isLoading&&s.jsx(ot,{}),!u.isLoading&&h.length===0&&s.jsx(gt,{children:d("project.agents.import_empty")}),s.jsx("ul",{className:"space-y-2",children:h.map(b=>{const v=l.includes(b.slug);return s.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[s.jsx(rn,{size:16,className:"shrink-0 text-muted-fg"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&s.jsxs(Fe,{tone:"success",children:[s.jsx(pa,{size:9})," ",d("project.agents.orchestrator")]}),b.model&&s.jsx(Fe,{tone:"info",children:b.model})]}),b.description&&s.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),s.jsx(ne,{size:"sm",variant:"primary",disabled:v||p===b.slug,loading:p===b.slug,onClick:()=>g(b.slug),children:d(v?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function m8({roots:e,childrenByParent:t,onOpen:a,onChat:o}){return s.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=t.get(l.slug)||[];return s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(bg,{agent:l,onOpen:a,onChat:o,wide:!0}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-5 w-px bg-border"}),s.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(u=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(bg,{agent:u,onOpen:a,onChat:o}),(t.get(u.slug)||[]).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-4 w-px bg-border"}),s.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(u.slug)||[]).map(p=>s.jsx(bg,{agent:p,onOpen:a,onChat:o,compact:!0},p.slug))})]})]},u.slug))})]})]},l.slug)})})}function bg({agent:e,onOpen:t,onChat:a,wide:o,compact:l}){const{gradient:c,Icon:u}=WN(e);return s.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:ke("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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:e.emoji?s.jsx("span",{className:"text-base leading-none",children:e.emoji}):s.jsx(u,{className:"size-4 text-white"})}),s.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&s.jsxs(Fe,{tone:"success",children:[s.jsx(pa,{size:9})," ",d("project.agents.orchestrator")]}),e.role&&s.jsx(Fe,{children:e.role}),e.model&&!l&&s.jsx(Fe,{tone:"info",children:e.model})]}),s.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:[s.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[s.jsx(Vf,{size:12})," ",d("project.agents.view")]}),s.jsxs("button",{onClick:()=>a(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[s.jsx(Qs,{size:12})," ",d("project.agents.chat")]})]})]})}function h8({agents:e,onOpen:t,onChat:a}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return s.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:u}=WN(l);return s.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:[s.jsx("div",{className:ke("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:l.emoji?s.jsx("span",{className:"text-lg leading-none",children:l.emoji}):s.jsx(u,{className:"size-4 text-white"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&s.jsxs(Fe,{tone:"success",children:[s.jsx(pa,{size:10})," ",d("project.agents.orchestrator")]}),l.role&&s.jsx(Fe,{children:l.role}),l.model&&s.jsx(Fe,{tone:"info",children:l.model}),l.parent&&s.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&s.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),s.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(p=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(er,{size:9})," ",p]},p)),l.tools?.map(p=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(li,{size:9})," ",p]},p))]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[s.jsxs("button",{onClick:()=>t(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[s.jsx(Vf,{size:12})," ",d("project.agents.view")]}),s.jsxs("button",{onClick:()=>a(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[s.jsx(Qs,{size:12})," ",d("project.agents.chat")]})]})]},l.slug)})})}function g8({open:e,onClose:t,onCreated:a,pid:o,agents:l}){const c=nt(),[u,p]=x.useState(""),[m,h]=x.useState(""),[g,b]=x.useState(""),[v,w]=x.useState(""),[N,y]=x.useState(""),[j,E]=x.useState(""),[S,C]=x.useState(""),[R,M]=x.useState(""),[T,O]=x.useState(""),[D,B]=x.useState(""),[L,U]=x.useState(""),[z,P]=x.useState(!1),[$,V]=x.useState(""),[q,X]=x.useState(!1),K=()=>{p(""),h(""),b(""),w(""),y(""),E(""),C(""),M(""),O(""),B(""),U(""),P(!1),V("")},F=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(u)){c.error(d("project.agents.slug_invalid"));return}X(!0);try{await ln.create(o,{slug:u,emoji:m||void 0,type:g||void 0,role:v||void 0,area:N||void 0,autonomy:j||void 0,model:S||void 0,language:R||void 0,description:T||void 0,skills:Aw(D),tools:Aw(L),is_master:z||g==="orchestrator",parent:$||void 0}),c.success(d("project.agents.create_success",{slug:u})),a(),K()}catch(G){c.error(G?.message||d("project.agents.create_error"))}finally{X(!1)}};return s.jsx(cn,{open:e,onClose:t,title:d("project.agents.new_title"),description:d("project.agents.new_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:q,children:d("common.cancel")}),s.jsx(ne,{variant:"primary","data-testid":"agent-create-submit",onClick:F,loading:q,children:d("common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_1fr] gap-3",children:[s.jsx(le,{label:d("agents_form.emoji"),children:s.jsx(UN,{value:m,onChange:h})}),s.jsx(le,{label:d("project.agents.slug_label"),children:s.jsx(Ee,{autoFocus:!0,"data-testid":"agent-slug",value:u,onChange:G=>p(G.target.value),placeholder:d("project.agents.slug_ph")})}),s.jsx(le,{label:d("project.agent_detail.type_label"),children:s.jsx(dt,{value:g,onChange:b,options:QN()})})]}),s.jsx(HN,{pid:o,area:N,role:v,onArea:y,onRole:w}),s.jsx(le,{label:d("agents_form.autonomy"),hint:d("agents_form.autonomy_hint"),children:s.jsx($N,{value:j,onChange:E})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.agents.model_label"),hint:d("project.agents.model_hint"),children:s.jsx(Ee,{value:S,onChange:G=>C(G.target.value)})}),s.jsx(le,{label:d("project.agents.lang_label"),children:s.jsx(dt,{value:R,onChange:M,options:u8.map(G=>({value:G,label:G||"—"}))})})]}),s.jsx(le,{label:d("project.agents.desc_label"),children:s.jsx(pn,{rows:2,value:T,onChange:G=>O(G.target.value),placeholder:d("project.agents.desc_ph")})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.agents.skills_label"),children:s.jsx(Ee,{value:D,onChange:G=>B(G.target.value),placeholder:d("project.agents.skills_ph")})}),s.jsx(le,{label:d("project.agents.tools_label"),children:s.jsx(Ee,{value:L,onChange:G=>U(G.target.value),placeholder:d("project.agents.tools_ph")})})]}),s.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[s.jsx(le,{label:d("project.agents.parent_label"),hint:d("project.agents.parent_hint"),children:s.jsx(dt,{value:$,onChange:V,placeholder:d("project.agents.none_parent"),options:[{value:"",label:d("project.agents.none_parent")},...l.filter(G=>G.slug!==u).map(G=>({value:G.slug,label:G.slug}))]})}),s.jsx(Wt,{checked:z,onChange:P,label:d("project.agents.master_label")})]})]})})}function $d(e){return e.split(`
674
+ `).map(t=>t.trim()).filter(Boolean)}function Gc(){return{exec_agent:{label:d("agents_ui.kind_exec_agent"),desc:d("agents_ui.kind_exec_agent_desc"),icon:rn},super_agent:{label:d("agents_ui.kind_super_agent"),desc:d("agents_ui.kind_super_agent_desc"),icon:pa},telegram:{label:d("agents_ui.kind_telegram"),desc:d("agents_ui.kind_telegram_desc"),icon:Qs},shell:{label:d("agents_ui.kind_shell"),desc:d("agents_ui.kind_shell_desc"),icon:Ka},heartbeat:{label:d("agents_ui.kind_heartbeat"),desc:d("agents_ui.kind_heartbeat_desc"),icon:jo}}}function x8(e){const t=Gc();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 z_(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:d("agents_ui.unit_seconds"),m:d("agents_ui.unit_minutes"),h:d("agents_ui.unit_hours"),d:d("agents_ui.unit_days")}[a[2]]||a[2];return d("agents_ui.every_n_unit",{n:o,unit:l})}return d("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 b8(){return[{label:d("agents_ui.preset_every_10m"),value:"every:10m"},{label:d("agents_ui.preset_hourly"),value:"every:1h"},{label:d("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:d("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function ZN(){return[{v:"{{pre_output}}",where:"prompt",desc:d("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:d("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:d("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:d("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:d("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:d("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:d("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:d("agents_ui.var_routine")}]}function hc(e){return ZN().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function _8({routines:e,selectedName:t,onSelect:a}){return s.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[s.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:d("project.routines.list_title")}),s.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const l=Gc()[o.kind],c=l?.icon||Hl,u=o.name===t;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>a(o.name),"aria-current":u,className:ke("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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:ke("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:s.jsx(c,{size:13})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&s.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:d("project.routines.paused")}),s.jsx(ou,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[s.jsx("span",{className:"truncate",children:l?.label||o.kind}),s.jsxs("span",{className:"shrink-0",children:["⏱ ",z_(o.schedule)]})]})]})},o.name)})})]})}function v8({title:e,body:t,mono:a}){return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:ke("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:s.jsx("span",{className:"text-muted-fg",children:d("project.routines.block_empty")})})]})}function JN(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function eE(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 tE({st:e}){return e==="ok"?s.jsx(Lr,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?s.jsx(Us,{size:13,className:"shrink-0 text-destructive"}):s.jsx(FM,{size:13,className:"shrink-0 text-amber-500"})}function nE(e){return d(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function _g({title:e,children:t}){return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const vg="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function y8({m:e,onClose:t}){const a=JN(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??""),h=s.jsx("span",{className:"text-muted-fg",children:d("project.routines.block_empty")});return s.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx(tE,{st:a}),s.jsx("span",{className:ke("font-medium",a==="ok"&&"text-emerald-500",a==="error"&&"text-destructive",a==="skipped"&&"text-amber-500"),children:nE(a)}),s.jsx("span",{className:"font-mono text-muted-fg",children:eE(e.ts)})]}),s.jsx("button",{type:"button",onClick:t,"aria-label":d("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:s.jsx(Us,{size:14})})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&s.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&s.jsx(_g,{title:d("project.routines.block_pre"),children:c.pre.output?.trim()?s.jsx("pre",{className:vg,children:c.pre.output}):h}),s.jsx(_g,{title:d("project.routines.runs_output"),children:u?s.jsx("pre",{className:vg,children:u}):p?s.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?s.jsx("div",{className:"text-muted-fg",children:m}):h}),c?.post&&c.post.length>0&&s.jsx(_g,{title:d("project.routines.block_post"),children:s.jsx("div",{className:"space-y-1.5",children:c.post.map((g,b)=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",g.cmd," ",s.jsxs("span",{className:"opacity-70",children:["· exit ",g.exit]})]}),(g.stdout||g.stderr)&&s.jsx("pre",{className:vg,children:g.stdout||g.stderr})]},b))})})]})]})}function j8({pid:e,name:t,running:a}){const o=Ge(`/projects/${e}/routines/${t}/runs`,async()=>(await Ef.project(e,{channel:"routine",limit:200})).filter(h=>h.meta?.routine===t&&(h.actor_id==="apx:routine"||h.type==="system"))),l=(o.data||[]).slice(0,50),[c,u]=x.useState(null),p=c&&l.find(m=>m.ts===c)||null;return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[s.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:d("project.routines.runs_title")}),s.jsxs("div",{className:ke("grid min-h-0 flex-1 overflow-hidden",p?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[s.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&s.jsx(ot,{}),!o.isLoading&&l.length===0&&s.jsx("div",{className:"text-xs text-muted-fg",children:d("project.routines.runs_empty")}),s.jsxs("ul",{className:"space-y-1",children:[a&&s.jsx("li",{children:s.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:[s.jsx(Dn,{size:12}),s.jsx("span",{className:"text-muted-fg",children:d("project.routines.running")})]})}),l.map((m,h)=>{const g=JN(m),b=c===m.ts;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>u(b?null:m.ts),"aria-current":b,className:ke("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:[s.jsx(tE,{st:g}),s.jsx("span",{className:"font-mono text-muted-fg",children:eE(m.ts)}),s.jsx("span",{className:ke("font-medium",g==="ok"&&"text-emerald-500",g==="error"&&"text-destructive",g==="skipped"&&"text-amber-500"),children:nE(g)})]})},`${m.ts}-${h}`)})]})]}),p&&s.jsx(y8,{m:p,onClose:()=>u(null)})]})]})}function w8({pid:e,routine:t,onEdit:a,onRun:o,onToggle:l,onDelete:c,running:u}){const p=Gc()[t.kind],m=p?.icon||Hl,h=t.spec||{},g=t.pre_commands||[],b=t.post_commands||[],v=[];return g.length&&v.push({title:d("project.routines.block_pre"),body:g.join(`
675
+ `),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?v.push({title:d("project.routines.block_prompt"),body:String(h.prompt||"")}):t.kind==="telegram"?v.push({title:d("project.routines.block_text"),body:String(h.text||"")}):t.kind==="shell"?v.push({title:d("project.routines.block_command"),body:String(h.command||""),mono:!0}):t.kind==="heartbeat"&&v.push({title:d("project.routines.block_text"),body:String(h.message||"")}),b.length&&v.push({title:d("project.routines.block_post"),body:b.join(`
676
+ `),mono:!0}),s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:ke("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:s.jsx(m,{size:14})}),s.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),s.jsx(Fe,{tone:t.kind==="shell"?"warning":"info",children:p?.label||t.kind})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(Wt,{checked:t.enabled,onChange:l}),s.jsx(Ke,{content:d("common.run"),children:s.jsx(ne,{size:"sm",variant:"secondary",onClick:o,loading:u,children:s.jsx(ub,{size:13})})}),s.jsx(Ke,{content:d("project.routines.edit_hint"),children:s.jsxs(ne,{size:"sm",variant:"secondary",onClick:a,children:[s.jsx(ga,{size:13})," ",d("project.routines.edit_btn")]})}),s.jsx(Ke,{content:d("common.delete"),children:s.jsx(ne,{size:"sm",variant:"destructive",onClick:c,children:s.jsx(wn,{size:13})})})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[s.jsxs("span",{children:["⏱ ",z_(t.schedule)]}),t.next_run_at&&s.jsxs("span",{children:[d("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&s.jsxs("span",{children:[d("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),s.jsxs("span",{className:ke(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[d("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&s.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),s.jsx("div",{className:"space-y-3",children:v.map(w=>s.jsx(v8,{title:w.title,body:w.body,mono:w.mono},w.title))})]}),s.jsx(j8,{pid:e,name:t.name,running:u})]})}function Cl({label:e,hint:t,value:a,onChange:o,vars:l,rows:c=3,mono:u,placeholder:p}){const m=x.useRef(null),h=g=>{const b=m.current?.querySelector("textarea");if(!b){o(a?`${a}${g}`:g);return}const v=b.selectionStart??a.length,w=b.selectionEnd??a.length,N=a.slice(0,v)+g+a.slice(w);o(N),requestAnimationFrame(()=>{b.focus();const y=v+g.length;b.setSelectionRange(y,y)})};return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&s.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),s.jsxs("div",{ref:m,className:"space-y-1.5",children:[s.jsx(pn,{rows:c,className:ke(u&&"font-mono text-xs"),value:a,onChange:g=>o(g.target.value),placeholder:p}),l.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(g=>s.jsx("button",{type:"button",onClick:()=>h(g.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:g.v},g.v))})]})]})}function k8(){return s.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[s.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:d("project.routines.vars_title")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ZN().map(e=>s.jsx(Ke,{content:s.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:s.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,s.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function S8({draft:e,onClose:t,onSaved:a,pid:o}){const l=nt(),c=Ge(e?`/projects/${o}/agents`:null,()=>ln.list(o)),[u,p]=x.useState(!1),[m,h]=x.useState(""),[g,b]=x.useState("super_agent"),[v,w]=x.useState("every:10m"),[N,y]=x.useState(!0),[j,E]=x.useState(""),[S,C]=x.useState(""),[R,M]=x.useState("default"),[T,O]=x.useState(""),[D,B]=x.useState(""),[L,U]=x.useState(""),[z,P]=x.useState("heartbeat"),[$,V]=x.useState(""),[q,X]=x.useState(""),[K,F]=x.useState(""),G=Ge(e&&g==="telegram"?"/telegram/channels":null,()=>zn.channels.list());x.useEffect(()=>{if(!e)return;const de=e.spec&&typeof e.spec=="object"?e.spec:{};h(e.name||""),b(e.kind||"super_agent"),w(e.schedule||"every:10m"),y(e.enabled??!0),E(de.agent||""),C(de.prompt||""),M(de.channel||"default"),O(de.chat_id?String(de.chat_id):""),B(de.text||""),U(de.command||""),P(de.channel||"heartbeat"),V(de.message||""),X((e.pre_commands||[]).join(`
677
+ `)),F((e.post_commands||[]).join(`
678
+ `))},[e]);const I=g==="exec_agent"||g==="super_agent"||g==="telegram",Y=()=>{switch(g){case"exec_agent":return{agent:j,prompt:S};case"super_agent":return{prompt:S};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:D};case"shell":return{command:L};case"heartbeat":return{channel:z,message:$}}},Z=async()=>{if(!m){l.error(d("project.routines.name_required"));return}p(!0);try{await Er.upsert(o,{name:m,kind:g,schedule:v,enabled:N,spec:Y(),pre_commands:I?$d(q):[],post_commands:I?$d(K):[]}),l.success(d("project.routines.saved")),a()}catch(de){l.error(de?.message||d("project.routines.save_error"))}finally{p(!1)}},te=(()=>{const de=G.data?.channels||[],he=["default",...de.map(we=>we.name)];R&&!he.includes(R)&&he.push(R);const Ce=new Set;return he.filter(we=>Ce.has(we)?!1:(Ce.add(we),!0)).map(we=>{const Be=de.find(Se=>Se.name===we),$e=Be?.project?`proyecto ${Be.project}`:Be?.chat_id?`chat ${Be.chat_id}`:void 0;return{value:we,label:we,description:$e}})})(),fe=I?$d(q):[],ee=I?$d(K):[],se=(()=>{switch(g){case"exec_agent":return j?d("agents_ui.action_agent_answers",{agent:j}):d("agents_ui.action_agent_pick_answers");case"super_agent":return d("agents_ui.action_super_answers");case"telegram":return d("agents_ui.action_telegram_channel",{channel:R});case"shell":return L?d("agents_ui.summary_runs_cmd",{cmd:L.slice(0,48)}):d("agents_ui.action_runs_shell");case"heartbeat":return d("agents_ui.summary_heartbeat")}})(),re=g==="telegram"?D:g==="shell"?L:g==="heartbeat"?$:S,me=Gc()[g].icon,Me=[...fe.map((de,he)=>({id:`pre-${he}`,icon:Ka,label:d("agents_ui.step_pre"),detail:de,action:!1})),{id:"action",icon:me,label:se,detail:re?re.slice(0,90):d("project.routines.block_empty"),action:!0},...ee.map((de,he)=>({id:`post-${he}`,icon:Ka,label:d("agents_ui.step_post"),detail:de,action:!1}))];return s.jsx(cn,{open:!!e,onClose:t,title:e?.name?d("project.routines.edit_title",{name:e.name}):d("project.routines.new_title"),description:d("project.routines.dialog_desc"),size:"xl",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:u,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:Z,loading:u,children:d("common.save")})]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[s.jsx(Wt,{checked:N,onChange:y,label:d("project.routines.enabled_label")}),s.jsx("span",{className:"text-[11px] text-muted-fg",children:d(N?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),s.jsx(le,{label:d("project.routines.name_field"),hint:e?.name?d("project.routines.name_no_edit"):void 0,children:s.jsx(Ee,{value:m,disabled:!!e?.name,onChange:de=>h(de.target.value),placeholder:"resumen-diario"})}),s.jsx(le,{label:d("project.routines.kind_field"),children:s.jsx(dt,{value:g,onChange:de=>b(de),options:x8(g)})}),s.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Gc()[g].desc}),g==="exec_agent"&&s.jsx(le,{label:d("project.routines.agent_field"),hint:d("project.routines.agent_hint"),children:s.jsx(dt,{value:j,onChange:E,placeholder:c.isLoading?d("project.routines.agent_loading"):d("project.routines.agent_pick"),options:(c.data||[]).map(de=>({value:de.slug,label:de.slug,description:[de.role,de.model].filter(Boolean).join(" · ")||void 0}))})}),s.jsx(le,{label:d("project.routines.schedule_field"),hint:d("project.routines.schedule_hint"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap gap-1",children:[b8().map(de=>s.jsx("button",{type:"button",onClick:()=>w(de.value),className:ke("rounded-md border px-2 py-0.5 text-[11px]",v===de.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:de.label},de.value)),s.jsx("button",{type:"button",onClick:()=>w("manual"),className:ke("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:d("agents_ui.preset_manual")})]}),s.jsx(Ee,{value:v,onChange:de=>w(de.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),s.jsx(k8,{})]}),s.jsxs("div",{className:"space-y-3",children:[I&&s.jsx(Cl,{label:d("project.routines.pre_field"),hint:d("project.routines.pre_hint"),rows:2,mono:!0,value:q,onChange:X,vars:hc("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),g==="exec_agent"&&s.jsx(Cl,{label:d("project.routines.prompt_exec"),rows:4,value:S,onChange:C,vars:hc("prompt"),placeholder:d("project.routines.prompt_exec_ph")}),g==="super_agent"&&s.jsx(Cl,{label:d("project.routines.prompt_super"),rows:4,value:S,onChange:C,vars:hc("prompt"),placeholder:d("project.routines.prompt_super_ph")}),g==="telegram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.routines.tg_channel"),children:s.jsx(dt,{value:R,onChange:M,options:te})}),s.jsx(le,{label:d("project.routines.tg_chat_id"),children:s.jsx(Ee,{value:T,onChange:de=>O(de.target.value),placeholder:d("agents_ui.tg_chat_id_ph")})})]}),s.jsx(Cl,{label:d("project.routines.tg_text"),hint:d("project.routines.tg_text_hint"),rows:6,value:D,onChange:B,vars:hc("prompt"),placeholder:d("agents_ui.tg_text_ph")})]}),g==="shell"&&s.jsx(Cl,{label:d("project.routines.shell_field"),hint:d("project.routines.shell_hint"),rows:11,mono:!0,value:L,onChange:U,vars:[],placeholder:"cd /repo && git pull && npm test"}),g==="heartbeat"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.routines.hb_channel"),children:s.jsx(Ee,{value:z,onChange:de=>P(de.target.value),placeholder:"heartbeat"})}),s.jsx(le,{label:d("project.routines.hb_message"),children:s.jsx(Ee,{value:$,onChange:de=>V(de.target.value),placeholder:d("agents_ui.hb_message_ph")})})]}),I&&s.jsx(Cl,{label:d("project.routines.post_field"),hint:d("project.routines.post_hint"),rows:2,mono:!0,value:K,onChange:F,vars:hc("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[d("project.routines.what_happens")," ",s.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",z_(v)]})]}),s.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:Me.map((de,he)=>s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.jsxs("div",{className:ke("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",de.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[s.jsxs("div",{className:ke("flex items-center gap-1.5 text-[11px] font-medium",de.action?"text-emerald-400":"text-muted-fg"),children:[s.jsx(de.icon,{size:12})," ",de.label]}),de.detail&&s.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:de.detail})]}),he<Me.length-1&&s.jsx(pS,{size:14,className:"shrink-0 self-center text-muted-fg"})]},de.id))})]})]})})}function C8({pid:e}){const t=nt(),a=Ge(`/projects/${e}/routines`,()=>Er.list(e)),[o,l]=si(),[c,u]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(!1),[b,v]=x.useState(null),[w,N]=x.useState(null),y=a.data||[],j=o.get("r_id"),E=y.find(T=>T.name===j)||null,S=T=>l(O=>{const D=new URLSearchParams(O);return T?D.set("r_id",T):D.delete("r_id"),D},{replace:!0});x.useEffect(()=>{y.length!==0&&(j&&y.some(T=>T.name===j)||S(y[0].name))},[y,j]);const C=async T=>{try{await(T.enabled?Er.disable:Er.enable)(e,T.name),a.mutate()}catch(O){t.error(O?.message||d("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;v(null),N(T.name);try{await Er.run(e,T.name),t.success(d("project.routines.run_success",{name:T.name})),await Promise.all([a.mutate(),Cf(`/projects/${e}/routines/${T.name}/runs`)])}catch(O){t.error(O?.message||d("project.routines.run_error"))}finally{N(null)}},M=async()=>{if(p){g(!0);try{await Er.remove(e,p.name),t.success(d("project.routines.delete_success")),j===p.name&&S(null),m(null),a.mutate()}catch(T){t.error(T?.message||d("project.routines.delete_error"))}finally{g(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[s.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:d("project.routines.title")}),s.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:d("project.routines.subtitle")})]}),s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>u({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[s.jsx(Kt,{size:14})," ",d("project.routines.new_btn")]})]}),a.isLoading&&s.jsx(ot,{}),!a.isLoading&&y.length===0&&s.jsx(gt,{children:d("project.routines.empty")}),y.length>0&&s.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:[s.jsx(_8,{routines:y,selectedName:E?.name??null,onSelect:S}),s.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:E?s.jsx(w8,{pid:e,routine:E,onEdit:()=>u({...E}),onRun:()=>v(E),onToggle:()=>C(E),onDelete:()=>m(E),running:w===E.name},E.name):s.jsx("div",{className:"flex h-full items-center justify-center p-8",children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.routines.detail_empty")})})})]}),s.jsx(S8,{draft:c,onClose:()=>u(null),onSaved:()=>{u(null),a.mutate()},pid:e}),s.jsx(cn,{open:!!p,onClose:()=>h?null:m(null),title:d("project.routines.delete_confirm",{name:p?.name||""}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>m(null),disabled:h,children:d("common.cancel")}),s.jsx(ne,{variant:"destructive",onClick:M,loading:h,children:d("common.delete")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.routines.delete_confirm_body")})}),s.jsx(cn,{open:!!b,onClose:()=>v(null),title:d("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>v(null),children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:R,children:d("common.run")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.routines.run_confirm_body")})})]})}function mo({label:e,children:t}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:e}),s.jsx("span",{className:"text-right font-mono text-foreground/90",children:t})]})}function N8({pid:e,taskId:t,onClose:a,onChanged:o}){const l=nt(),c=Ln(),{data:u,isLoading:p,mutate:m}=Ge(`/projects/${e}/tasks/${t}`,()=>Qn.get(e,t)),[h,g]=x.useState(""),[b,v]=x.useState(!1);x.useEffect(()=>{g(u?.body??"")},[u?.id,u?.body]);const w=()=>{m(),o()},N=async S=>{v(!0);try{await S(),w()}catch(C){l.error(C instanceof Error?C.message:String(C))}finally{v(!1)}};if(p)return s.jsx("div",{className:"flex w-80 items-center justify-center border-l border-border",children:s.jsx(Dn,{})});if(!u)return null;const y=Mf(u),j=u.state==="open",E=h!==(u.body??"");return s.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-l border-border bg-card/40","data-testid":"task-detail",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:d("tasks.detail_title")}),s.jsx("button",{type:"button",onClick:a,"aria-label":d("common.close"),className:"text-muted-foreground hover:text-foreground",children:s.jsx(Us,{className:"size-4"})})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:d("tasks.field_title")}),s.jsx("div",{className:"text-sm font-semibold",children:u.title})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(k_,{status:y}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:u.id})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:d("tasks.field_prompt")}),E&&s.jsxs("button",{type:"button",onClick:()=>N(async()=>{await Qn.patch(e,u.id,{body:h}),l.success(d("common.saved"))}),className:"flex items-center gap-1 text-[10px] text-emerald-500 hover:text-emerald-400",children:[s.jsx(oi,{className:"size-3"}),d("files.save")]})]}),s.jsx(pn,{rows:4,value:h,onChange:S=>g(S.target.value),placeholder:d("tasks.prompt_ph"),className:"text-xs"})]}),j&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:d("tasks.field_status")}),s.jsx(dt,{value:u.status??"pending",onChange:S=>N(()=>Qn.status(e,u.id,S)),options:vN.map(S=>({value:S,label:w_(S)}))})]}),s.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border bg-background/40 p-2.5",children:[u.agent&&s.jsxs(mo,{label:d("tasks.field_agent"),children:["@",u.agent]}),u.created_by&&s.jsx(mo,{label:d("tasks.field_creator"),children:u.created_by}),u.source&&s.jsx(mo,{label:d("tasks.field_source"),children:u.source}),u.due&&s.jsx(mo,{label:d("project.tasks.due"),children:u.due}),s.jsx(mo,{label:d("tasks.field_created"),children:new Date(u.created_at).toLocaleString()}),s.jsx(mo,{label:d("tasks.field_updated"),children:new Date(u.updated_at).toLocaleString()}),u.done_at&&s.jsx(mo,{label:d("tasks.field_done"),children:new Date(u.done_at).toLocaleString()})]}),u.thread&&s.jsxs("button",{type:"button",onClick:()=>c(`/p/${e}/chat?thread=${u.thread}`),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-sky-500/30 bg-sky-500/5 px-3 py-2 text-xs text-sky-500 hover:bg-sky-500/10",children:[s.jsx(i3,{className:"size-3.5"}),d("tasks.view_thread")]})]}),s.jsx("div",{className:"flex shrink-0 gap-2 border-t border-border px-4 py-3",children:j?s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",variant:"primary",className:"flex-1",loading:b,onClick:()=>N(()=>Qn.done(e,u.id)),children:[s.jsx(Lr,{size:13}),d("tasks.mark_done")]}),s.jsx(ne,{size:"sm",variant:"destructive",loading:b,onClick:()=>N(()=>Qn.drop(e,u.id)),"aria-label":d("project.tasks.aria_drop"),children:s.jsx(wn,{size:13})})]}):s.jsxs(ne,{size:"sm",variant:"secondary",className:"flex-1",loading:b,onClick:()=>N(()=>Qn.reopen(e,u.id)),children:[s.jsx(ri,{size:13}),d("project.tasks.reopen")]})})]})}function E8({pid:e}){const[t,a]=x.useState("open"),[o,l]=si(),c=o.get("task"),u=nt(),p=E_({key:`/projects/${e}/tasks?state=${t}`,fetchPage:(C,R)=>Qn.listPage(e,{state:t,limit:C,offset:R}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[m,h]=x.useState(""),[g,b]=x.useState(""),[v,w]=x.useState(!1),[N,y]=x.useState(!1),j=C=>{const R=new URLSearchParams(o);C?R.set("task",C):R.delete("task"),l(R,{replace:!0})},E=async()=>{if(m.trim()){y(!0);try{await Qn.add(e,{title:m.trim(),body:g.trim()||null,source:"web"}),h(""),b(""),w(!1),u.success(d("project.tasks.created")),p.mutate()}catch(C){u.error(C?.message||d("project.tasks.create_error"))}finally{y(!1)}}},S=async(C,R)=>{try{await C(),u.success(R),p.mutate()}catch(M){u.error(M?.message||d("common.error_generic"))}};return s.jsxs(Ve,{fullHeight:!0,title:d("project.tasks.title"),description:d("project.tasks.subtitle"),action:s.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(C=>s.jsx(ne,{size:"sm","data-testid":`task-filter-${C}`,variant:t===C?"primary":"ghost",onClick:()=>a(C),children:d(`tasks.state_${C}`)},C))}),children:[s.jsxs("div",{className:"mb-4 shrink-0 space-y-2",children:[s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx(le,{label:d("project.tasks.add_label"),children:s.jsx(Ee,{"data-testid":"task-input",placeholder:d("project.tasks.add_placeholder"),value:m,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!v&&E()}})}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>w(C=>!C),"aria-label":d("tasks.toggle_prompt"),children:[v?s.jsx(tb,{size:14}):s.jsx(Bs,{size:14})," ",d("tasks.field_prompt")]}),s.jsxs(ne,{variant:"primary","data-testid":"task-add",onClick:E,loading:N,children:[s.jsx(Kt,{size:14})," ",d("project.tasks.add")]})]}),v&&s.jsx(pn,{rows:3,value:g,onChange:C=>b(C.target.value),placeholder:d("tasks.prompt_ph"),className:"text-xs"})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 gap-4",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[p.isLoading&&s.jsx(ot,{}),!p.isLoading&&p.total===0&&s.jsxs(gt,{children:[t==="open"?d("project.tasks.empty_open"):d("project.tasks.empty",{state:t})," ",s.jsx("code",{children:'apx task add "…"'})]}),s.jsx(R_,{paged:p,fullHeight:!0,children:s.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:p.items.map(C=>{const R=Mf(C);return s.jsxs("li",{"data-testid":`task-${C.id}`,onClick:()=>j(C.id),className:`flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2 hover:border-muted-fg/50 ${c===C.id?"border-primary/50 bg-primary/5":"border-border bg-muted/30"}`,children:[s.jsx(Of,{status:R,className:"mt-0.5 shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-medium",children:C.title}),s.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[C.state==="open"&&s.jsx(k_,{status:R}),C.tags?.map(M=>s.jsxs(Fe,{children:["#",M]},M)),C.agent&&s.jsxs(Fe,{tone:"info",children:["@",C.agent]}),C.due&&s.jsxs("span",{children:[d("project.tasks.due")," ",C.due]})]})]}),s.jsx("div",{className:"flex shrink-0 gap-1",onClick:M=>M.stopPropagation(),children:C.state==="open"?s.jsxs(s.Fragment,{children:[s.jsx(ne,{size:"sm",variant:"secondary","aria-label":d("project.tasks.aria_done"),"data-testid":`task-done-${C.id}`,onClick:()=>S(()=>Qn.done(e,C.id),d("project.tasks.done")),children:s.jsx(Lr,{size:13})}),s.jsx(ne,{size:"sm",variant:"destructive","aria-label":d("project.tasks.aria_drop"),"data-testid":`task-drop-${C.id}`,onClick:()=>S(()=>Qn.drop(e,C.id),d("project.tasks.drop")),children:s.jsx(wn,{size:13})})]}):s.jsx(ne,{size:"sm",variant:"ghost","aria-label":d("project.tasks.aria_reopen"),"data-testid":`task-reopen-${C.id}`,onClick:()=>S(()=>Qn.reopen(e,C.id),d("project.tasks.reopen")),children:s.jsx(ri,{size:13})})})]},C.id)})})})]}),c&&s.jsx(N8,{pid:e,taskId:c,onClose:()=>j(null),onChanged:()=>p.mutate()})]})]})}const R8="\\$\\{var\\.([^}\\s]+)\\}";function sE(e="g"){return new RegExp(R8,e)}function aE(e){return sE("").test(e)}function T8(e){const t=[];let a=0;for(const o of e.matchAll(sE("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 yg(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 Mw(e,t){e.replaceChildren();const a=T8(t);for(const o of a)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(rE(o.value));(a.length===0||a[a.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function rE(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 A8(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(e)}function M8(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(t)}const D_=x.forwardRef(function({value:t,onChange:a,placeholder:o,className:l,varNames:c=[],onCreateVar:u},p){const m=x.useRef(null),h=x.useRef(null),g=x.useRef(null),[b,v]=x.useState(!1),[w,N]=x.useState(""),y=x.useRef(t);x.useEffect(()=>{const T=m.current;T&&(t===y.current&&T.childNodes.length>0||(Mw(T,t),y.current=t))},[t]);const j=x.useCallback(()=>{const T=m.current;if(!T)return;const O=yg(T);y.current=O,O!==t&&a(O)},[a,t]),E=x.useCallback(()=>{const T=m.current;if(!T)return;const O=yg(T);if(aE(O)&&z8(T)){const D=D8(T);Mw(T,O),D!=null&&L8(T,D)}y.current=yg(T),y.current!==t&&a(y.current)},[a,t]),S=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const O=T.getRangeAt(0),D=m.current;D&&D.contains(O.startContainer)&&(g.current=O.cloneRange())},[]),C=x.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const O=window.getSelection();if(!O||O.rangeCount===0)return;const D=O.getRangeAt(0);if(!D.collapsed)return;const{startContainer:B,startOffset:L}=D;if(B.nodeType===Node.TEXT_NODE&&L===0){const U=B.previousSibling;if(U instanceof HTMLElement&&U.dataset.varName){T.preventDefault(),U.remove(),j();return}}else if(B===m.current){const U=B.childNodes[L-1];if(U instanceof HTMLElement&&U.dataset.varName){T.preventDefault(),U.remove(),j();return}}}},[j]),R=x.useCallback(T=>{const O=m.current;if(!O)return;const D=g.current;O.focus();let B;D&&O.contains(D.startContainer)?B=D:(B=document.createRange(),B.selectNodeContents(O),B.collapse(!1)),A8(B,rE(T)),g.current=null,j()},[j]);x.useImperativeHandle(p,()=>({insertVar:R,focus:()=>m.current?.focus()}),[R]);const M=c.filter(T=>T.toLowerCase().includes(w.toLowerCase()));return s.jsxs("div",{className:ke("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:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[s.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:E,onKeyDown:C,onBlur:j,onFocus:S,onMouseUp:S,onKeyUp:S,className:ke("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&&s.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})]}),s.jsxs("div",{ref:h,className:"relative flex",children:[s.jsx(Ke,{content:d("chat_ui.insert_variable"),children:s.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),S()},onClick:()=>v(T=>!T),"aria-label":d("chat_ui.insert_variable"),className:ke("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",b&&"bg-muted/60 text-foreground"),children:s.jsx(Kt,{size:14})})}),b&&s.jsx(O8,{anchorRef:h,query:w,onQuery:N,varNames:M,onPick:T=>{R(T),v(!1),N("")},onClose:()=>{v(!1),N("")},onCreateVar:u})]})]})});function O8({anchorRef:e,query:t,onQuery:a,varNames:o,onPick:l,onClose:c,onCreateVar:u}){const p=x.useRef(null),m=x.useRef(null),[h,g]=x.useState(null),b=x.useCallback(()=>{const v=e.current;if(!v)return;const w=v.getBoundingClientRect(),N=256,y=4,j=8,E=window.innerWidth-N-j,S=Math.max(j,Math.min(w.right-N,E)),C=w.bottom+y,R=p.current?.offsetHeight??260,M=C+R<=window.innerHeight-j?C:Math.max(j,w.top-R-y);g({left:S,top:M,width:N})},[e]);return x.useLayoutEffect(()=>{b()},[b,t,o.length]),x.useEffect(()=>(b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}),[b]),x.useEffect(()=>{m.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function v(w){const N=w.target;p.current?.contains(N)||e.current?.contains(N)||c()}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[e,c]),h?Is.createPortal(s.jsxs("div",{ref:p,style:h,className:"fixed z-[1000] rounded-md border border-border bg-popover shadow-lg",children:[s.jsx("div",{className:"border-b border-border p-2",children:s.jsx("input",{ref:m,value:t,onChange:v=>a(v.target.value),placeholder:d("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),s.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[o.length===0&&s.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:d("shared_ui.no_matches")}),o.map(v=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:w=>w.preventDefault(),onClick:()=>l(v),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:v})},v))]}),u&&s.jsx("div",{className:"border-t border-border p-1",children:s.jsxs("button",{type:"button",onMouseDown:v=>v.preventDefault(),onClick:()=>{u(),c()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[s.jsx(Kt,{size:12})," ",d("shared_ui.create_variable")]})})]}),document.body):null}function z8(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&aE(t.textContent??""))return!0;return!1}function D8(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 L8(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()}M8(e)}function Ow(e){return e?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[]}function zw(e){const t={};for(const a of e)a.key.trim()&&(t[a.key.trim()]=a.value);return t}function Dw({rows:e,onChange:t,keyPlaceholder:a=d("shared_ui.kv_key_ph"),valuePlaceholder:o=d("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:u}){const p=(g,b)=>{const v=e.slice();v[g]={...v[g],...b},t(v)},m=g=>t(e.filter((b,v)=>v!==g)),h=()=>t([...e,{key:"",value:""}]);return s.jsxs("div",{className:"space-y-2",children:[e.length===0&&u&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:u}),e.map((g,b)=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Ee,{value:g.key,onChange:v=>p(b,{key:v.target.value}),placeholder:a,className:"w-40 font-mono text-xs"}),s.jsx("div",{className:"flex-1",children:s.jsx(D_,{value:g.value,onChange:v=>p(b,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),s.jsx(ne,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":d("shared_ui.remove_row"),children:s.jsx(wn,{size:13})})]},b)),s.jsxs(ne,{type:"button",size:"sm",variant:"ghost",onClick:h,children:[s.jsx(Kt,{size:12})," ",d("shared_ui.add_row")]})]})}const P8={apc:"info",runtime:"success",global:"muted"};function Ix(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function jg(e){return e==="runtime"?d("project.mcps.source_runtime"):e==="apc"?d("project.mcps.source_apc"):e==="claude"?d("project.mcps.source_claude"):e==="codex"?d("project.mcps.source_codex"):e==="cursor"?d("project.mcps.source_cursor"):e==="vscode"?d("project.mcps.source_vscode"):e==="roo"?d("project.mcps.source_roo"):e==="gemini"?d("project.mcps.source_gemini"):e==="global"?d("project.mcps.scope_global"):e}function I8({pid:e}){const t=nt(),a=Ge(`/projects/${e}/mcps`,()=>Rr.list(e)),o=Ge(`/projects/${e}/mcps/check`,()=>Rr.check(e)),l=Ge(`/projects/${e}/vars`,()=>Vc.list(e)),[c,u]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(null),b=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(y,j)=>{if(confirm(d("project.mcps.delete_confirm",{name:y,scope:j})))try{await Rr.remove(e,y,j),t.success(d("project.mcps.removed")),a.mutate(),p===y&&m(null)}catch(E){t.error(E?.message||d("common.error_generic"))}},w=async y=>{try{await Rr.add(e,Ix(y.source),{name:y.name,enabled:!y.enabled}),a.mutate()}catch(j){t.error(j?.message||d("common.error_generic"))}},N=async y=>{m(y),g({name:y,busy:!0});try{const j=await Rr.test(e,y);g({name:y,result:j})}catch(j){g({name:y,result:{ok:!1,error:j?.message||"error"}})}};return s.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[s.jsx("div",{className:"lg:col-span-3",children:s.jsxs(Ve,{title:d("project.mcps.title"),description:d("project.mcps.subtitle"),action:s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>u({kind:"new"}),children:[s.jsx(Kt,{size:14})," ",d("project.mcps.new")]}),children:[o.data?.conflicts?.length?s.jsxs("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:[s.jsx("div",{className:"font-medium",children:d("project.mcps.conflicts",{names:o.data.conflicts.map(y=>y.name).join(", ")})}),s.jsx("ul",{className:"mt-1 space-y-1 text-muted-fg",children:o.data.conflicts.map(y=>s.jsxs("li",{className:"flex gap-2",children:[s.jsx("span",{"aria-hidden":"true",children:"•"}),s.jsx("span",{children:d("project.mcps.conflict_detail",{name:y.name,winner:jg(y.winner),loser:jg(y.loser)})})]},`${y.name}-${y.winner}-${y.loser}`))})]}):null,a.isLoading&&s.jsx(ot,{}),!a.isLoading&&(a.data?.length??0)===0&&s.jsx(gt,{children:d("project.mcps.empty")}),s.jsx("ul",{className:"space-y-2 text-sm",children:(a.data||[]).map(y=>{const j=y.source==="apc"||y.source==="runtime"||y.source==="global",E=Ix(y.source),S=p===y.name;return s.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(S?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(y.name),role:"button",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:"font-medium",children:y.name}),s.jsx(Fe,{tone:P8[y.source]??"muted",children:jg(y.source)}),s.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(y.transport||"stdio").toUpperCase()}),s.jsx("div",{onClick:C=>C.stopPropagation(),children:s.jsx(Wt,{checked:y.enabled!==!1,onChange:()=>w(y),label:""})}),s.jsx(Ke,{content:d("project.mcps.test_btn"),children:s.jsx(ne,{size:"sm",variant:"ghost",onClick:C=>{C.stopPropagation(),N(y.name)},"aria-label":d("project.mcps.test_btn"),children:s.jsx(vS,{size:13})})}),s.jsx(Ke,{content:d("project.mcps.logs_btn"),children:s.jsx(ne,{size:"sm",variant:"ghost",onClick:C=>{C.stopPropagation(),m(y.name)},"aria-label":d("project.mcps.logs_btn"),children:s.jsx(df,{size:13})})}),j&&s.jsx(Ke,{content:d("project.mcps.edit_btn"),children:s.jsx(ne,{size:"sm",variant:"ghost",onClick:C=>{C.stopPropagation(),u({kind:"edit",entry:y})},"aria-label":d("project.mcps.edit_btn"),children:s.jsx(ga,{size:13})})}),j&&s.jsx(ne,{size:"sm",variant:"destructive",onClick:C=>{C.stopPropagation(),v(y.name,E)},children:s.jsx(wn,{size:13})})]}),h?.name===y.name&&s.jsx(B8,{result:h.result,busy:!!h.busy,onClose:()=>g(null)})]},`${y.source}-${y.name}`)})}),c&&s.jsx($8,{mode:c,pid:e,varNames:b,onClose:()=>u(null),onSaved:()=>{u(null),a.mutate()},onVarsChanged:()=>l.mutate()})]})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(U8,{pid:e,mcpName:p,runningTest:!!h?.busy})})]})}function B8({result:e,busy:t,onClose:a}){return s.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[s.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[t&&s.jsx("span",{className:"text-muted-fg",children:d("project.mcps.testing")}),!t&&e?.ok&&s.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[s.jsx(nb,{size:12})," ",d("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!t&&e&&!e.ok&&s.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[s.jsx(gS,{size:12})," ",e.error]}),s.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:a,children:"×"})]}),!t&&e?.ok&&e.tools&&e.tools.length>0&&s.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>s.jsxs("li",{className:"truncate",children:[s.jsx("span",{className:"text-primary",children:o.name}),o.description&&s.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&s.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function U8({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 h=!1;const g=async()=>{try{const w=await Rr.logs(e,t);h||(l(w),u(null))}catch(w){h||u(w?.message||"error")}};g();const v=setInterval(g,a?1200:4e3);return()=>{h=!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]),s.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[s.jsx(Ka,{size:13,className:"text-muted-fg"}),s.jsx("span",{className:"font-medium",children:d("project.mcps.logs_panel_title")}),t?s.jsx(Fe,{tone:"info",children:t}):s.jsxs("span",{className:"text-muted-fg",children:["— ",d("project.mcps.logs_panel_pick")]})]}),s.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&s.jsx("p",{className:"text-muted-fg",children:d("project.mcps.logs_panel_hint")}),t&&c&&s.jsx("p",{className:"text-red-400",children:c}),t&&!c&&o&&s.jsxs(s.Fragment,{children:[s.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&&s.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&s.jsx("p",{className:"text-muted-fg",children:d("project.mcps.logs_panel_idle")}),o.events?.map((h,g)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:h.ts.slice(11,19)}),s.jsx("span",{className:h.level==="error"?"text-red-400":h.level==="stderr"?"text-amber-400":"text-emerald-400",children:h.level}),s.jsx("span",{className:"flex-1 break-all",children:h.msg})]},g)),o.stderr_tail&&s.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[s.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),s.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function $8({mode:e,pid:t,varNames:a,onClose:o,onSaved:l,onVarsChanged:c}){const u=nt(),p=e.kind==="edit",m=p?e.entry:null,[h,g]=x.useState(!1),[b,v]=x.useState(m?Ix(m.source):"runtime"),[w,N]=x.useState(m?.name||""),[y,j]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[E,S]=x.useState(m?.command||""),[C,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[M,T]=x.useState(Ow(m?.env)),[O,D]=x.useState(m?.url||""),[B,L]=x.useState(Ow(m?.headers)),[U,z]=x.useState(m?.enabled!==!1),[P,$]=x.useState(!1),V=async()=>{if(!w.trim()){u.error(d("project.mcps.name_required"));return}g(!0);try{const q=C.map(K=>K.trim()).filter(Boolean),X=y==="stdio"?{name:w.trim(),command:E.trim(),args:q.length?q:void 0,env:M.length?zw(M):void 0,enabled:U}:{name:w.trim(),url:O.trim(),headers:B.length?zw(B):void 0,enabled:U};await Rr.add(t,b,X),u.success(d(p?"project.mcps.updated":"project.mcps.added")),l()}catch(q){u.error(q?.message||d("common.error_generic"))}finally{g(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(cn,{open:!0,onClose:()=>h?null:o(),title:d(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:d("project.mcps.new_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:o,disabled:h,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:V,loading:h,children:d(p?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.mcps.scope_label"),children:s.jsx(dt,{value:b,onChange:q=>v(q),options:[{value:"runtime",label:d("project.mcps.scope_runtime"),description:d("project.mcps.scope_runtime_desc")},{value:"shared",label:d("project.mcps.scope_shared"),description:d("project.mcps.scope_shared_desc")},{value:"global",label:d("project.mcps.scope_global"),description:d("project.mcps.scope_global_desc")}]})}),s.jsx(le,{label:d("project.mcps.transport_label"),children:s.jsx(dt,{value:y,onChange:q=>j(q),options:[{value:"stdio",label:d("project.mcps.transport_stdio"),description:d("project.mcps.transport_stdio_desc")},{value:"http",label:d("project.mcps.transport_http"),description:d("project.mcps.transport_http_desc")}]})})]}),s.jsx(le,{label:d("project.mcps.name_label"),children:s.jsx(Ee,{value:w,onChange:q=>N(q.target.value),placeholder:d("project.mcps.name_ph"),disabled:p})}),y==="stdio"?s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("project.mcps.cmd_label"),children:s.jsx(Ee,{value:E,onChange:q=>S(q.target.value),placeholder:d("project.mcps.cmd_ph")})}),s.jsx(le,{label:d("project.mcps.args_label"),hint:d("project.mcps.args_hint_tokens"),children:s.jsx(H8,{args:C,onChange:R,varNames:a,onCreateVar:()=>$(!0)})}),s.jsx(le,{label:d("project.mcps.env_label"),hint:d("project.mcps.env_hint_tokens"),children:s.jsx(Dw,{rows:M,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:a,onCreateVar:()=>$(!0),emptyLabel:d("project.mcps.env_empty")})})]}):s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("project.mcps.url_label"),children:s.jsx(D_,{value:O,onChange:D,placeholder:d("project.mcps.url_ph"),varNames:a,onCreateVar:()=>$(!0)})}),s.jsx(le,{label:d("project.mcps.headers_label"),hint:d("project.mcps.headers_hint"),children:s.jsx(Dw,{rows:B,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:a,onCreateVar:()=>$(!0),emptyLabel:d("project.mcps.headers_empty")})})]}),s.jsx(Wt,{checked:U,onChange:z,label:d("project.mcps.enabled_label")})]})}),P&&s.jsx(q8,{pid:t,onClose:()=>$(!1),onCreated:()=>{$(!1),c()}})]})}function H8({args:e,onChange:t,varNames:a,onCreateVar:o}){const l=(p,m)=>{const h=e.slice();h[p]=m,t(h)},c=p=>t(e.filter((m,h)=>h!==p)),u=()=>t([...e,""]);return s.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(D_,{value:p,onChange:h=>l(m,h),placeholder:d("agents_ui.arg_placeholder"),varNames:a,onCreateVar:o})}),s.jsx(ne,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":d("agents_ui.remove_arg"),children:s.jsx(wn,{size:13})})]},m)),s.jsxs(ne,{type:"button",size:"sm",variant:"ghost",onClick:u,children:[s.jsx(Kt,{size:12})," ",d("project.mcps.add_arg")]})]})}function q8({pid:e,onClose:t,onCreated:a}){const o=nt(),l=String(e)==="0",[c,u]=x.useState(""),[p,m]=x.useState(""),[h,g]=x.useState(!1),[b,v]=x.useState(l?"global":"project"),w=async()=>{if(!c.trim()){o.error(d("project.vars.name_required"));return}if(!p){o.error(d("project.vars.value_required"));return}g(!0);try{await Vc.upsert(e,{name:c.trim(),value:p,scope:b}),o.success(d("project.vars.added")),a()}catch(N){o.error(N?.message||d("common.error_generic"))}finally{g(!1)}};return s.jsx(cn,{open:!0,onClose:()=>h?null:t(),title:d("project.vars.new_title"),description:d("project.vars.new_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:h,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:w,loading:h,children:d("project.vars.add_btn")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("project.vars.scope_label"),children:s.jsx(dt,{value:b,onChange:N=>v(N),options:[...l?[]:[{value:"project",label:d("project.vars.scope_project"),description:d("project.vars.scope_project_desc")}],{value:"global",label:d("project.vars.scope_global"),description:d("project.vars.scope_global_desc")}]})}),s.jsx(le,{label:d("project.vars.name_label"),hint:d("project.vars.name_hint"),children:s.jsx(Ee,{value:c,onChange:N=>u(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),s.jsx(le,{label:d("project.vars.value_label"),hint:d("project.vars.value_hint"),children:s.jsx(Ee,{type:"password",value:p,onChange:N=>m(N.target.value),className:"font-mono text-xs"})})]})})}function V8({pid:e}){const t=nt(),a=String(e)==="0",[o,l]=x.useState(a?"global":"all"),[c,u]=x.useState(!1),p=Ge(`/projects/${e}/vars?reveal=${c?1:0}`,()=>Vc.list(e,{reveal:c})),[m,h]=x.useState(null),g=x.useMemo(()=>{if(!p.data)return[];const v=[],w=p.data.project||{},N=p.data.global||{};for(const[y,j]of Object.entries(w))v.push({name:y,scope:"project",masked:j});for(const[y,j]of Object.entries(N))w[y]===void 0&&v.push({name:y,scope:"global",masked:j});return v.filter(y=>o==="all"?!0:y.scope===o).sort((y,j)=>y.name.localeCompare(j.name))},[p.data,o]),b=async(v,w)=>{if(confirm(d("project.vars.delete_confirm",{name:v,scope:w})))try{await Vc.remove(e,v,w),t.success(d("project.vars.removed")),p.mutate()}catch(N){t.error(N?.message||d("common.error_generic"))}};return s.jsxs(Ve,{title:d("project.vars.title"),description:d(a?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Wt,{checked:c,onChange:u,label:d("project.vars.reveal_all")}),s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>h({}),children:[s.jsx(Kt,{size:14})," ",d("project.vars.new")]})]}),children:[!a&&s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"text-muted-fg",children:d("project.vars.filter_label")}),s.jsx(wg,{active:o==="all",onClick:()=>l("all"),children:d("project.vars.filter_all")}),s.jsx(wg,{active:o==="project",onClick:()=>l("project"),children:d("project.vars.filter_project")}),s.jsx(wg,{active:o==="global",onClick:()=>l("global"),children:d("project.vars.filter_global")})]}),p.isLoading&&s.jsx(ot,{}),!p.isLoading&&g.length===0&&s.jsx(gt,{children:d("project.vars.empty")}),g.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:g.map(v=>s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"font-mono text-xs font-medium",children:v.name}),s.jsx(Fe,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?d("project.vars.scope_project"):d("project.vars.scope_global")}),s.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:v.masked}),s.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>h({name:v.name,scope:v.scope}),"aria-label":d("project.vars.edit_btn"),children:s.jsx(ga,{size:13})}),!(a&&v.scope==="project")&&s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>b(v.name,v.scope),"aria-label":d("project.vars.delete_btn"),children:s.jsx(wn,{size:13})})]})]},`${v.scope}-${v.name}`))}),s.jsx(F8,{open:m!==null,initial:m||void 0,onClose:()=>h(null),pid:e,isBase:a,onSaved:()=>{h(null),p.mutate()}})]})}function wg({active:e,onClick:t,children:a}){return s.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 F8({open:e,onClose:t,pid:a,isBase:o,initial:l,onSaved:c}){const u=nt(),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[b,v]=x.useState(l?.name||""),[w,N]=x.useState(l?.value||""),[y,j]=x.useState(l?.scope||(o?"global":"project")),E=!!l?.name;x.useEffect(()=>{e&&(v(l?.name||""),N(l?.value||""),j(l?.scope||(o?"global":"project")),g(!1))},[e,l?.name,l?.scope,l?.value,o]);const S=async()=>{if(!b.trim()){u.error(d("project.vars.name_required"));return}if(!w){u.error(d("project.vars.value_required"));return}m(!0);try{await Vc.upsert(a,{name:b.trim(),value:w,scope:y}),u.success(d(E?"project.vars.updated":"project.vars.added")),c()}catch(C){u.error(C?.message||d("common.error_generic"))}finally{m(!1)}};return s.jsx(cn,{open:e,onClose:()=>p?null:t(),title:d(E?"project.vars.edit_title":"project.vars.new_title"),description:d("project.vars.new_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:p,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:S,loading:p,children:d(E?"project.vars.save_btn":"project.vars.add_btn")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("project.vars.scope_label"),children:s.jsx(dt,{value:y,onChange:C=>j(C),options:[...o?[]:[{value:"project",label:d("project.vars.scope_project"),description:d("project.vars.scope_project_desc")}],{value:"global",label:d("project.vars.scope_global"),description:d("project.vars.scope_global_desc")}]})}),s.jsx(le,{label:d("project.vars.name_label"),hint:d("project.vars.name_hint"),children:s.jsx(Ee,{value:b,onChange:C=>v(C.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:E,autoFocus:!E})}),s.jsx(le,{label:d("project.vars.value_label"),hint:d("project.vars.value_hint"),children:s.jsxs("div",{className:"relative",children:[s.jsx(Ee,{type:h?"text":"password",value:w,onChange:C=>N(C.target.value),placeholder:E?d("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:E}),s.jsx("button",{type:"button",onClick:()=>g(C=>!C),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":d(h?"project.vars.hide":"project.vars.reveal"),children:h?s.jsx(c3,{size:14}):s.jsx(Vf,{size:14})})]})})]})})}function L_({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l=!1,disabled:c=!1,placeholder:u,autoFocus:p,minRows:m=2,maxRows:h=8,footer:g,className:b}){const v=x.useRef(null);x.useLayoutEffect(()=>{const N=v.current;if(!N)return;const y=()=>{N.style.height="auto",N.offsetHeight;const E=parseFloat(getComputedStyle(N).lineHeight)||20,S=E*m,C=E*h;N.style.height=`${Math.min(Math.max(N.scrollHeight,S),C)}px`,N.style.overflowY=N.scrollHeight>C?"auto":"hidden"};y();const j=requestAnimationFrame(y);return()=>cancelAnimationFrame(j)},[e,m,h]);const w=e.trim().length>0&&!c;return s.jsxs("div",{className:Ct("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:[s.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||!w)return;a()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[s.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:g}),l&&o?s.jsx(Ke,{content:d("chat_ui.stop"),children:s.jsx(Za,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":d("chat_ui.stop"),children:s.jsx(NS,{className:"size-3.5",fill:"currentColor"})})}):s.jsx(Ke,{content:d("chat_ui.send"),children:s.jsx(Za,{type:"button",size:"icon-sm",variant:"default",onClick:a,disabled:!w,"aria-label":d("chat_ui.send"),children:s.jsx(VM,{className:"size-4"})})})]})]})}function P_({value:e,onChange:t,disabled:a}){const[o,l]=x.useState(!1),[c,u]=x.useState(""),[p,m]=x.useState([]),[h,g]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const j=E=>{b.current&&!b.current.contains(E.target)&&l(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[o]),x.useEffect(()=>{if(!o||h)return;let j=!1;return(async()=>{try{const{engines:E}=await Rf.list(),S=await Promise.all(E.map(C=>Rf.models({engine:C}).then(R=>(R.models||[]).map(M=>M.includes(":")?M:`${C}:${M}`)).catch(()=>[])));if(!j){const C=Array.from(new Set(S.flat())).sort();m(C),g(!0)}}catch{j||g(!0)}})(),()=>{j=!0}},[o,h]);const v=c.trim().toLowerCase(),w=v?p.filter(j=>j.toLowerCase().includes(v)):p,N=e||d("shared_ui.auto"),y=j=>{t(j),l(!1),u("")};return s.jsxs("div",{ref:b,className:"relative",children:[s.jsx(Ke,{content:d("chat_ui.pick_model"),children:s.jsxs("button",{type:"button",disabled:a,onClick:()=>l(j=>!j),"data-testid":"chat-model-picker",className:ke("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":d("chat_ui.pick_model"),children:[s.jsx(CS,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate font-mono",children:N}),s.jsx(Bs,{className:"size-3 shrink-0 opacity-60"})]})}),o&&s.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:[s.jsx("input",{autoFocus:!0,value:c,placeholder:d("shared_ui.model_filter_ph"),onChange:j=>u(j.target.value),onKeyDown:j=>{j.key==="Enter"&&c.trim()&&y(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"}),s.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[s.jsx("li",{children:s.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),y("")},className:ke("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:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Us,{className:"size-3"})," ",d("shared_ui.auto_router")]}),!e&&s.jsx(Lr,{className:"size-3"})]})}),!h&&s.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:d("shared_ui.loading_models")}),h&&w.length===0&&c.trim()&&s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:j=>{j.preventDefault(),y(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:d("shared_ui.use_value",{value:c.trim()})})}),w.map(j=>s.jsx("li",{children:s.jsxs("button",{type:"button",onMouseDown:E=>{E.preventDefault(),y(j)},className:ke("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",j===e&&"bg-accent/50"),children:[s.jsx("span",{className:"truncate",children:j}),j===e&&s.jsx(Lr,{className:"size-3 shrink-0"})]})},j))]})]})]})}function G8({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 s.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:s.jsx(L_,{value:c,onValueChange:u,onSubmit:p,onStop:t,busy:a,placeholder:d("project.chat.placeholder"),maxRows:12,footer:l?s.jsx(P_,{value:o||"",onChange:l,disabled:a}):void 0})})}function Y8(){return{read_file:{icon:ab,label:d("shared_ui.tool_read_file")},write_file:{icon:d3,label:d("shared_ui.tool_write_file")},edit_file:{icon:cf,label:d("shared_ui.tool_edit_file")},list_files:{icon:ob,label:d("shared_ui.tool_list_files")},search_files:{icon:Ec,label:d("shared_ui.tool_search_files")},search_messages:{icon:Ec,label:d("shared_ui.tool_search_messages")},tail_messages:{icon:Ec,label:d("shared_ui.tool_tail_messages")},run_shell:{icon:Ka,label:d("shared_ui.tool_run_shell")},send_telegram:{icon:Qs,label:d("shared_ui.tool_send_telegram")},call_agent:{icon:rn,label:d("shared_ui.tool_call_agent")},call_mcp:{icon:A3,label:d("shared_ui.tool_call_mcp")},call_runtime:{icon:rn,label:d("shared_ui.tool_call_runtime")},create_task:{icon:C3,label:d("shared_ui.tool_create_task")}}}const oE=new Set(["write_file","edit_file"]);function K8(e){return Y8()[e]||{icon:li,label:e}}function X8(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 Lw(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Q8({status:e}){return e==="running"?s.jsx(Zc,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?s.jsx(Us,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?s.jsx(r3,{className:"size-3 shrink-0 text-amber-400"}):s.jsx(Lr,{className:"size-3 shrink-0 text-emerald-400"})}function W8({part:e}){const[t,a]=x.useState(!1),{icon:o,label:l}=K8(e.tool),c=X8(e.tool,e.args),u=oE.has(e.tool),p=!!e.args||e.result!==void 0;return s.jsxs("div",{className:ke("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[s.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?s.jsx(Do,{className:ke("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):s.jsx("span",{className:"size-3 shrink-0"}),s.jsx(o,{className:ke("size-3.5 shrink-0",u?"text-violet-400":"text-muted-foreground")}),s.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&s.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),s.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&s.jsx("span",{className:"text-[10px] text-amber-400",children:d("shared_ui.dedup")}),s.jsx(Q8,{status:e.status})]})]}),t&&p&&s.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&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:d("shared_ui.args")}),s.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:Lw(e.args)})]}),e.result!==void 0&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:d("shared_ui.result")}),s.jsx("pre",{className:ke("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:Lw(e.result)})]})]})]})}function Z8(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 J8({part:e,pending:t}){const a=Z8(e),o=d(t?"ask_panel.status_waiting":"ask_panel.status_received");return s.jsxs("div",{className:ke("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:[s.jsxs("div",{className:"flex items-center gap-2",children:[t?s.jsx(Zc,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):s.jsx(nb,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),s.jsx(wS,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"text-[12px] font-medium",children:o}),a.length>1&&s.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length," preguntas"]})]}),a.length>0&&s.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:a.map((l,c)=>s.jsx("li",{className:"list-disc",children:l},c))})]})}function lE(e){const t=e.split(`
679
+ `),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 e7({text:e}){const t=lE(e);return t?s.jsx("div",{className:"flex w-full justify-center",children:s.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:[s.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[s.jsx(wS,{className:"size-3.5"}),s.jsx("span",{children:d("ask_panel.answers_header")})]}),s.jsx("ul",{className:"space-y-2.5",children:t.map((a,o)=>s.jsxs("li",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:a.question}),s.jsx("div",{className:ke("whitespace-pre-wrap text-[13px] leading-snug",a.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:a.answer})]},o))})]})}):null}function Bx(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
680
+
681
+ `).trim()}function t7(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]
682
+ ${a.join(`
683
+ `)}`}function n7(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=t7(a);o&&t.push(o)}return t.join(`
684
+
685
+ `).trim()}const iE=e=>[{kind:"text",text:e}];function cE(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function s7(e){const t=[];let a=null,o=0;for(const l of e){const c=l.ts||new Date().toISOString();l.role==="user"?(a=null,t.push({role:"user",parts:iE(l.content),ts:c})):(l.role==="assistant"||l.role==="tool")&&(a||(a={role:"assistant",parts:[],ts:c},t.push(a)),l.role==="tool"?a.parts.push({kind:"tool",id:`hist-${o++}`,tool:l.tool||"tool",args:l.args,result:l.result,status:cE(l.result)?"error":"done"}):l.content&&a.parts.push({kind:"text",text:l.content}))}return t}function I_(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=cE(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 a7(e,t){const[a,o]=x.useState([]),[l,c]=x.useState(!1),[u,p]=x.useState(void 0),m=x.useRef(null),h=x.useRef(void 0),g=x.useRef(0),b=x.useCallback(S=>{o(C=>{const R=[...C],M=R[R.length-1];return M&&M.role==="assistant"&&(R[R.length-1]=S(M)),R})},[]),v=x.useCallback(S=>{if(S.type==="error"){t?.(S.error||d("shared_ui.err_stream"));return}b(C=>I_(C,S))},[b,t]),w=x.useCallback(async(S,C={})=>{const R=S.trim();if(!R||l)return;const M=()=>new Date().toISOString(),T=a.map(D=>({role:D.role,content:n7(D)}));if(o(D=>[...D,{role:"user",parts:iE(R),ts:M()},{role:"assistant",parts:[],ts:M(),pending:!0}]),c(!0),C.agentSlug){try{const D=await ln.chat(e,C.agentSlug,{prompt:R,conversation_id:h.current,model:C.model||void 0,channel:"web"});h.current=D.conversation_id,p(D.conversation_id),b(B=>({...B,pending:!1,model:D.engine,parts:[{kind:"text",text:D.text}]}))}catch(D){t?.(D?.message||d("shared_ui.err_chat_failed")),o(B=>B.filter((L,U)=>U!==B.length-1))}finally{c(!1)}return}const O=new AbortController;m.current=O;try{await GC.stream(e,{prompt:R,previousMessages:T,model:C.model||void 0,channel:"web"},v,O.signal),b(D=>({...D,pending:!1}))}catch(D){O.signal.aborted?b(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:d("code_module.stopped")}]})):(t?.(D?.message||d("shared_ui.err_stream_failed")),o(B=>B.filter((L,U)=>U!==B.length-1)))}finally{c(!1),m.current=null}},[e,a,l,v,b,t]),N=x.useCallback(()=>m.current?.abort(),[]),y=x.useCallback(()=>{l||(g.current++,h.current=void 0,p(void 0),o([]))},[l]),j=x.useCallback(async(S,C)=>{if(l)return;const R=++g.current;o([]);try{const M=await Eo.get(e,S,C);if(R!==g.current)return;const T=(M.messages??[]).filter(O=>O.role==="user"||O.role==="assistant").map(O=>({role:O.role,parts:[{kind:"text",text:O.content}],ts:O.ts||new Date().toISOString()}));h.current=C,p(C),o(T)}catch(M){if(R!==g.current)return;h.current=void 0,p(void 0),o([]),t?.(M?.message||d("shared_ui.err_load_conversation"))}},[e,l,t]),E=x.useCallback(async(S,C)=>{if(l)return;const R=++g.current;o([]);try{const M=await Eo.thread(e,S,C);if(R!==g.current)return;const T=s7(M.messages??[]);h.current=void 0,p(void 0),o(T)}catch(M){if(R!==g.current)return;h.current=void 0,p(void 0),o([]),t?.(M?.message||d("shared_ui.err_load_conversation"))}},[e,l,t]);return{msgs:a,send:w,stop:N,clear:y,load:j,loadThread:E,streaming:l,conversationId:u}}function r7({msg:e,isLast:t,isAskAnswer:a,onCopy:o}){const l=e.role==="user",c=Bx(e),u=e.parts.some(p=>p.kind==="tool");if(l&&a){const p=Bx(e);if(lE(p))return s.jsx(e7,{text:p})}return s.jsxs("div",{className:ke("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&s.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:s.jsx(rn,{size:14})}),s.jsxs("div",{className:ke("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&&s.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((p,m)=>s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[s.jsx(jS,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?s.jsx(Ke,{content:d("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[s.jsx(er,{size:10}),e.inspector.loaded?.map(p=>s.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>s.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?s.jsx(J8,{part:p,pending:!!t},`${p.id}-${m}`):s.jsx(W8,{part:p},`${p.id}-${m}`):p.text?s.jsx("div",{className:ke("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&&s.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsx("span",{children:o7(e.ts)}),!l&&e.model&&s.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&u&&s.jsxs("span",{children:["· ",d("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&s.jsx(Ke,{content:d("chat_ui.copy"),children:s.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":d("chat_ui.copy"),children:[s.jsx(Pc,{size:10})," ",d("chat_ui.copy")]})})]})]}),l&&s.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:s.jsx(db,{size:14})})]})}function o7(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function B_({msgs:e,onCopy:t}){const a=x.useRef(null);if(x.useEffect(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(gt,{children:d("project.chat.empty")})});const o=e.length-1;return s.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>s.jsx(r7,{msg:l,isLast:c===o,isAskAnswer:l7(e,c),onCopy:t},c)),s.jsx("div",{ref:a})]})}function l7(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 i7(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function uE({msgs:e}){const[t,a]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:u,model:p}=x.useMemo(()=>{let h=0,g=0,b=0,v;const w=new Set,N=[];for(const y of e)if(y.role==="assistant"){y.usage&&(h+=y.usage.input_tokens||0,g+=y.usage.output_tokens||0),y.model&&(v=y.model);for(const j of y.parts)if(j.kind==="tool"&&(b+=1,oE.has(j.tool)&&j.status!=="error")){const E=i7(j.args);E&&!w.has(E)&&(w.add(E),N.push({path:E,tool:j.tool}))}}return{inTok:h,outTok:g,toolCount:b,changed:N,model:v}},[e]),m=o+l;return m===0&&c===0?null:s.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[s.jsxs("button",{type:"button",onClick:()=>u.length>0&&a(h=>!h),className:ke("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",u.length>0&&"hover:text-foreground"),children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ff,{size:12})," ",kg(m)," tok",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",kg(o),"↑ / ",kg(l),"↓)"]})]}),c>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(li,{size:12})," ",c," tools"]}),u.length>0&&s.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[s.jsx(cf,{size:12})," ",u.length," archivos"]}),p&&s.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),u.length>0&&s.jsx(Bs,{className:ke("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&u.length>0&&s.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(h=>s.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[s.jsx(cf,{size:11,className:"shrink-0 text-violet-400"}),s.jsx("span",{className:"truncate",children:h.path}),s.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:h.tool==="write_file"?"write":"edit"})]},h.path))})]})}function kg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Rl(){return{picked:new Set,text:"",skipped:!1}}function Pw(e,t){const a=[];return e.forEach((o,l)=>{const c=t[l]||Rl();if(c.skipped){a.push(`- ${o.question}
686
+ → (omitido)`);return}const u=[];if(o.options&&o.options.length>0){const h=[...c.picked].sort((g,b)=>g-b).map(g=>o.options[g]?.label).filter(Boolean);h.length>0&&u.push(h.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}
687
+ → ${m}`)}),a.join(`
688
+ `)}function dE({turnKey:e,questions:t,onSubmit:a,onDismiss:o,disabled:l}){const c=t.length,[u,p]=x.useState(0),[m,h]=x.useState(()=>t.map(()=>Rl()));x.useEffect(()=>{p(0),h(t.map(()=>Rl()))},[e,t]);const g=t[u],b=m[u]||Rl(),v=!!g?.options&&g.options.length>0,w=!!g?.multiSelect,N=g?.allowText!==!1,y=T=>{h(O=>{const D=[...O],B=D[u]||Rl();return D[u]={...B,...T,skipped:!1},D})},j=T=>{h(O=>{const D=[...O],B=D[u]||Rl(),L=new Set(B.picked);return w?L.has(T)?L.delete(T):L.add(T):(L.clear(),L.add(T)),D[u]={...B,picked:L,skipped:!1},D})},E=x.useMemo(()=>!0,[]),S=u===c-1,C=()=>p(T=>Math.max(0,T-1)),R=()=>{if(S){a(Pw(t,m));return}p(T=>Math.min(c-1,T+1))},M=()=>{if(h(T=>{const O=[...T];return O[u]={picked:new Set,text:"",skipped:!0},O}),S){const T=m.map((O,D)=>D===u?{picked:new Set,text:"",skipped:!0}:O);a(Pw(t,T))}else p(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=O=>{if(l)return;const D=O.target?.tagName?.toLowerCase(),B=D==="input"||D==="textarea";if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),R();return}if(!B&&v&&/^[1-9]$/.test(O.key)){const L=parseInt(O.key,10)-1;L<(g?.options?.length||0)&&(O.preventDefault(),j(L))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!g||c===0?null:s.jsxs("div",{className:ke("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:[s.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[s.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]}),g.header&&s.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:g.header}),s.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:g.question}),o&&s.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":d("common.close"),children:s.jsx(Us,{className:"size-3.5"})})]}),s.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&g.options.map((T,O)=>{const D=b.picked.has(O);return s.jsxs("button",{type:"button",onClick:()=>j(O),className:ke("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",D?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&s.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),w?s.jsx("span",{className:ke("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",D?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:D&&s.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):s.jsx("span",{className:ke("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",D?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:O+1})]},`${O}:${T.label}`)}),(N||!v)&&s.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[v&&s.jsx("div",{className:"mb-1 text-xs font-medium",children:d("ask_panel.other")}),s.jsx("input",{type:"text",value:b.text,onChange:T=>y({text:T.target.value}),placeholder:d(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"})]})]}),s.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[s.jsx("button",{type:"button",onClick:C,disabled:u===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:d("ask_panel.back")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{type:"button",onClick:M,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:d("ask_panel.skip")}),s.jsxs("button",{type:"button",onClick:R,disabled:!E,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:[d(S?"ask_panel.submit":"ask_panel.next"),s.jsx(a3,{className:"size-3 opacity-60"})]})]})]})]})}function c7(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 fE(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 h=t.parts.length-1;h>=0;h--){const g=t.parts[h];if(g.kind==="tool"&&g.tool==="ask_questions"){a=g,o=h;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 h of c)if(u=h.map(c7).filter(g=>!!g),u.length>0)break;return u.length?{turnKey:`${t.ts||""}#${o}`,questions:u}:null}const Ux={web:{label:"Web",icon:ib,order:0},telegram:{label:"Telegram",icon:Qs,order:1},desktop:{label:"Desktop",icon:cb,order:2},voice:{label:"Voice",icon:kS,order:3},a2a:{label:"Agent ↔ Agent",icon:rn,order:4},schedule:{label:"Schedule",icon:P3,order:5},other:{label:"Other",icon:ai,order:6}};function Iw(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 u7({pid:e,slug:t,onLoaded:a}){const{data:o}=Ge(`/projects/${e}/agents/${t}/conversations`,()=>Eo.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{a(t,o)},[t,o]),null}function d7({pid:e,agents:t,superAgentSlug:a,superAgentLabel:o,selected:l,onSelect:c,onNewChat:u}){const[p,m]=x.useState(""),[h,g]=x.useState(""),[b,v]=x.useState({}),[w,N]=x.useState({}),[y,j]=x.useState(!1),E=String(e)==="0",S=Ge(E?`/projects/${e}/super-agent/threads`:null,()=>Eo.threads(e),{revalidateOnFocus:!1}),C=(z,P)=>{P&&N($=>{const V=$[z];return V&&V.length===P.length&&V===P?$:{...$,[z]:P}})},R=x.useMemo(()=>{const z=[];for(const P of t)for(const $ of w[P.slug]||[])z.push({...$,agent_slug:$.agent_slug||P.slug});return z},[t,w]),M=x.useMemo(()=>{const z=p.trim().toLowerCase();return R.filter(P=>!(h&&P.agent_slug!==h||z&&!`${P.title||""} ${P.id} ${P.agent_slug}`.toLowerCase().includes(z)))},[R,p,h]),T=x.useMemo(()=>{if(h&&h!==a)return[];const z=p.trim().toLowerCase();return(S.data||[]).filter(P=>z?`${P.title} ${P.id} ${P.channel}`.toLowerCase().includes(z):!0)},[S.data,p,h,a]),O=x.useMemo(()=>{const z=new Map,P=($,V)=>{const q=z.get($);q?q.push(V):z.set($,[V])};for(const $ of M)P(Iw($.channel),{type:"conv",conv:$,sortTs:$.started_at||""});for(const $ of T)P(Iw($.channel),{type:"thread",thread:$,sortTs:$.last_ts||$.started_at||""});return Array.from(z.entries()).map(([$,V])=>({key:$,items:V.sort((q,X)=>new Date(X.sortTs||0).getTime()-new Date(q.sortTs||0).getTime())})).sort(($,V)=>Ux[$.key].order-Ux[V.key].order)},[M,T]),D=x.useMemo(()=>[{slug:a,label:o},...t.map(z=>({slug:z.slug,label:z.slug}))],[t,a,o]),B=x.useMemo(()=>[{value:"",label:d("project.chat.list.all_agents")},{value:a,label:o},...t.map(z=>({value:z.slug,label:z.slug}))],[t,a,o]),L=R.length+(S.data?.length||0),U=Object.keys(w).length>0||t.length===0||!!S.data;return s.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(z=>s.jsx(u7,{pid:e,slug:z.slug,onLoaded:C},z.slug)),s.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-semibold",children:d("project.chat.list.title")}),s.jsx("p",{className:"text-[10px] text-muted-fg",children:d("project.chat.list.count",{n:L})})]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",onClick:()=>j(z=>!z),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:[s.jsx(Kt,{className:"size-3"})," ",d("project.chat.list.new")]}),y&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>j(!1)}),s.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-56 rounded-md border border-border bg-card p-1 shadow-lg",children:[s.jsx("p",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-fg",children:d("project.chat.list.pick_agent")}),s.jsx("div",{className:"max-h-64 overflow-y-auto",children:D.map(z=>s.jsxs("button",{type:"button",onClick:()=>{j(!1),u(z.slug)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",children:[s.jsx(rn,{className:"size-3 shrink-0 text-muted-fg"}),s.jsx("span",{className:"truncate",children:z.label})]},`new-${z.slug}`))})]})]})]})]}),s.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[s.jsx(Ee,{value:p,onChange:z=>m(z.target.value),placeholder:d("project.chat.list.search")}),s.jsx(dt,{value:h,onChange:g,options:B})]}),s.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!U&&s.jsx("div",{className:"px-2 py-1",children:s.jsx(ot,{})}),O.map(z=>s.jsx(f7,{keyName:z.key,count:z.items.length,collapsed:!!b[z.key],onToggle:()=>v(P=>({...P,[z.key]:!P[z.key]})),children:z.items.map(P=>{if(P.type==="thread"){const q=P.thread,X=l.kind==="thread"&&l.channel===q.channel&&l.threadId===q.id;return s.jsx(Bw,{title:q.title,subtitle:[q.channel,`${q.messages} msg`].join(" · "),badge:"super",timeAgo:q.last_ts,selected:X,onClick:()=>c({kind:"thread",channel:q.channel,threadId:q.id},{channel:q.channel,createdAt:q.started_at,title:q.title})},`thread-${q.channel}-${q.id}`)}const $=P.conv,V=l.kind==="conv"&&l.agentSlug===$.agent_slug&&l.convId===$.id;return s.jsx(Bw,{title:$.title||$.id,subtitle:[$.agent_slug,`${$.messages??0} msg`].filter(Boolean).join(" · "),badge:$.agent_slug,timeAgo:$.started_at,selected:V,onClick:()=>c({kind:"conv",agentSlug:$.agent_slug,convId:$.id},{channel:$.channel,createdAt:$.started_at,title:$.title})},`${$.agent_slug}-${$.id}`)})},z.key)),U&&R.length===0&&T.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:d("project.chat.list.empty")})]})]})}function f7({keyName:e,count:t,collapsed:a,onToggle:o,children:l}){const c=Ux[e],u=c.icon;return s.jsxs("section",{className:"space-y-1",children:[s.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:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a?s.jsx(Do,{className:"size-3"}):s.jsx(Bs,{className:"size-3"}),s.jsx(u,{className:"size-3"}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),s.jsx("span",{className:"text-[10px]",children:t})]}),!a&&s.jsx("div",{className:"space-y-0.5",children:l})]})}function Bw({title:e,subtitle:t,badge:a,timeAgo:o,selected:l,onClick:c}){return s.jsxs("button",{type:"button",onClick:c,className:Bc("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:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("p",{className:Bc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[s.jsx(xS,{className:"size-2.5"}),p7(o)]})]}),s.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[s.jsx("span",{className:"truncate",children:t}),a&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[s.jsx(db,{className:"size-2.5"}),a]})]})]})}function p7(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 Hd="__super_agent__";function m7({pid:e}){const t=nt(),[a,o]=si(),l=Ge(`/projects/${e}/agents`,()=>ln.list(e)),[c,u]=x.useState(!1),[p,m]=x.useState(""),[h,g]=x.useState(null),{msgs:b,send:v,stop:w,clear:N,load:y,loadThread:j,streaming:E}=a7(e,ee=>t.error(ee)),S=_p(),[C,R]=x.useState(()=>{const ee=a.get("agent"),se=a.get("conv"),re=a.get("channel"),me=a.get("thread");return re&&me?{kind:"thread",channel:re,threadId:me}:ee&&se?{kind:"conv",agentSlug:ee,convId:se}:ee?{kind:"live",agentSlug:ee}:{kind:"live",agentSlug:Hd}}),[M,T]=x.useState(void 0),[O,D]=x.useState(!1),[B,L]=x.useState(!1),U=(ee,se)=>{R(ee),T(se);const re=new URLSearchParams;ee.kind==="conv"?(re.set("agent",ee.agentSlug),re.set("conv",ee.convId)):ee.kind==="thread"?(re.set("channel",ee.channel),re.set("thread",ee.threadId)):re.set("agent",ee.agentSlug),o(re,{replace:!0})},z=l.data||[],P=ee=>ee===Hd,$=x.useMemo(()=>C.kind==="thread"?void 0:z.find(ee=>ee.slug===C.agentSlug),[z,C]),V=C.kind==="thread"||P(C.agentSlug);x.useEffect(()=>{C.kind==="conv"?y(C.agentSlug,C.convId):C.kind==="thread"?j(C.channel,C.threadId):N()},[C.kind,C.kind==="conv"?C.convId:C.kind==="thread"?`${C.channel}:${C.threadId}`:C.agentSlug]);const q=async ee=>{if(V){await v(ee,{model:p||void 0});return}$&&await v(ee,{model:p||void 0,agentSlug:$.slug})},X=async ee=>{try{await navigator.clipboard.writeText(ee),t.info(d("project.chat.copied"))}catch{}},K=ee=>{U({kind:"live",agentSlug:ee}),N()},F=()=>{const ee=V?Hd:$?.slug??C.agentSlug;U({kind:"live",agentSlug:ee}),N()},G=async()=>{L(!0);try{C.kind==="conv"?(await Eo.remove(e,C.agentSlug,C.convId),Cf(`/projects/${e}/agents/${C.agentSlug}/conversations`)):C.kind==="thread"&&(await Eo.removeThread(e,C.channel,C.threadId),Cf(`/projects/${e}/super-agent/threads`)),t.success(d("project.chat.deleted")),D(!1),F()}catch(ee){t.error(ee?.message||d("shared_ui.err_chat_failed"))}finally{L(!1)}},I=V?S:$?.slug??C.agentSlug,Y=C.kind==="thread"?C.channel:M?.channel||"web",Z=C.kind==="thread"?C.threadId:M?.createdAt,te=C.kind==="live"?d("project.chat.live_title",{agent:I}):M?.title||(C.kind==="thread"?C.threadId:C.convId),fe=Z?d("project.chat.meta_created",{date:h7(Z),channel:Y}):d("project.chat.meta_new",{channel:Y});return l.isLoading?s.jsx(ot,{}):s.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[s.jsx(d7,{pid:e,agents:z,superAgentSlug:Hd,superAgentLabel:d("agents_ui.super_agent_label",{persona:S}),selected:C,onSelect:U,onNewChat:K}),s.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"truncate text-sm font-semibold",children:te}),s.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:fe})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[V?s.jsx(Fe,{tone:"success",children:d("agents_ui.super_agent_badge")}):s.jsx(Fe,{tone:"info",children:I}),!z.length&&!V&&s.jsxs(ne,{variant:"primary",size:"sm",onClick:()=>u(!0),children:[s.jsx(Kt,{size:14})," ",d("project.chat.create_agent")]}),s.jsxs(ne,{variant:"ghost",size:"sm",disabled:E||b.length===0,onClick:F,children:[s.jsx(ri,{size:13})," ",d("project.chat.new_session")]}),(C.kind==="conv"||C.kind==="thread")&&s.jsxs(ne,{variant:"destructive",size:"sm",disabled:E,onClick:()=>D(!0),children:[s.jsx(wn,{size:13})," ",d("project.chat.delete")]})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length?s.jsx(B_,{msgs:b,onCopy:X}):s.jsx("div",{className:"flex h-full items-center justify-center p-8",children:s.jsx("p",{className:"text-sm text-muted-fg",children:d("project.chat.empty")})})}),s.jsx(uE,{msgs:b}),(()=>{const ee=E?null:fE(b);return!ee||ee.turnKey===h?null:s.jsx(dE,{turnKey:ee.turnKey,questions:ee.questions,onSubmit:se=>void q(se),onDismiss:()=>g(ee.turnKey),disabled:E})})(),s.jsx(G8,{onSend:q,onStop:w,streaming:E,model:p,onModelChange:m})]}),s.jsx(g7,{open:c,pid:e,onClose:()=>u(!1),onCreated:()=>{u(!1),l.mutate()}}),s.jsx(cn,{open:O,onClose:()=>D(!1),title:d("project.chat.delete_confirm_title"),description:d("project.chat.delete_confirm_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:()=>D(!1),disabled:B,children:d("common.cancel")}),s.jsxs(ne,{variant:"destructive",onClick:G,loading:B,children:[s.jsx(wn,{size:14})," ",d("project.chat.delete")]})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:te})})]})}function h7(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}function g7({open:e,onClose:t,onCreated:a,pid:o}){const l=nt(),[c,u]=x.useState(""),[p,m]=x.useState("master"),[h,g]=x.useState(""),[b,v]=x.useState(!0),[w,N]=x.useState(!1),y=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(d("project.agents.slug_invalid"));return}N(!0);try{await ln.create(o,{slug:c,role:p,model:h||void 0,is_master:b}),l.success(d("project.agents.created",{slug:c})),u(""),m("master"),g(""),v(!0),a()}catch(j){l.error(j.message)}finally{N(!1)}};return s.jsx(cn,{open:e,onClose:t,title:d("project.chat.create_agent_title"),description:d("project.chat.create_agent_desc"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:w,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:y,loading:w,children:d("common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:"slug",children:s.jsx(Ee,{autoFocus:!0,value:c,onChange:j=>u(j.target.value),placeholder:"master"})}),s.jsx(le,{label:d("project.chat.role_label"),children:s.jsx(Ee,{value:p,onChange:j=>m(j.target.value),placeholder:"master"})}),s.jsx(le,{label:d("project.chat.model_label"),hint:d("project.chat.model_hint"),children:s.jsx(Ee,{value:h,onChange:j=>g(j.target.value)})}),s.jsx(Wt,{checked:b,onChange:v,label:d("project.chat.master_label")})]})})}function x7({pid:e}){const t=nt(),{project:a}=p_(e),{channels:o,isLoading:l,mutate:c}=v_(),u=String(e),p=a?.name||a?.path?.split("/").pop()||u,m=`proj-${u}`,h=o.find(O=>O.project===u||O.project===p||O.name===m),[g,b]=x.useState(!!h),[v,w]=x.useState(""),[N,y]=x.useState(""),[j,E]=x.useState(""),[S,C]=x.useState(!0),[R,M]=x.useState(!1);if(x.useEffect(()=>{h?(b(!0),w(""),y(h.chat_id||""),E(h.route_to_agent||""),C(h.respond_with_engine??!0)):(b(!1),w(""),y(""),E(""),C(!0))},[h?.name,h?.chat_id,h?.route_to_agent]),l)return s.jsx(ot,{});const T=async()=>{M(!0);try{if(!g){h&&(await zn.channels.remove(h.name),t.success(d("project.telegram.cleared"))),await c();return}const O={name:h?.name||m,project:u,chat_id:N,route_to_agent:j,respond_with_engine:S,...v?{bot_token:v}:{}};h?await zn.channels.patch(h.name,O):await zn.channels.upsert(O),t.success(d("project.telegram.saved")),await c(),w("")}catch(O){t.error(O.message)}finally{M(!1)}};return s.jsx(Ve,{title:d("project.telegram.title"),description:d("project.telegram.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Wt,{checked:g,onChange:b,label:d(g?"project.telegram.override_active":"project.telegram.use_default")}),h&&s.jsx(Fe,{tone:"success",children:d("project.telegram.channel_badge",{name:h.name})})]}),g&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("project.telegram.bot_token"),hint:h?.bot_token?`${zr(h.bot_token)} ${d("telegram_ui.empty_keep")}`:d("project.telegram.bot_hint_none"),children:s.jsx(Ee,{type:"password",value:v,onChange:O=>w(O.target.value),placeholder:h?.bot_token?zr(h.bot_token):""})}),s.jsx(le,{label:d("project.telegram.chat_id"),children:s.jsx(Ee,{value:N,onChange:O=>y(O.target.value)})}),s.jsx(le,{label:d("project.telegram.route_agent"),hint:d("project.telegram.route_hint"),children:s.jsx(Ee,{value:j,onChange:O=>E(O.target.value)})})]}),s.jsx(Wt,{checked:S,onChange:C,label:d("project.telegram.respond_engine")})]}),s.jsx("div",{className:"pt-2",children:s.jsx(ne,{variant:"primary",loading:R,onClick:T,children:d("common.save")})}),!g&&!h&&s.jsx(gt,{children:d("project.telegram.no_override")})]})})}function pE({load:e,save:t,rows:a=10,placeholder:o}){const l=nt(),[c,u]=x.useState(null),[p,m]=x.useState(""),[h,g]=x.useState(!1);if(x.useEffect(()=>{let w=!0;return e().then(N=>{w&&(u(N),m(N))}).catch(()=>{w&&(u(""),m(""))}),()=>{w=!1}},[e]),c===null)return s.jsx(ot,{});const b=p!==c,v=async()=>{g(!0);try{await t(p),u(p),l.success(d("project.memories.saved"))}catch(w){l.error(w.message)}finally{g(!1)}};return s.jsxs("div",{className:"space-y-2",children:[s.jsx(pn,{rows:a,className:"font-mono text-xs",value:p,onChange:w=>m(w.target.value),placeholder:o}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[11px] text-muted-fg",children:[p.length," ",d("project.memories.chars")]}),s.jsxs(ne,{size:"sm",variant:"primary",loading:h,disabled:!b,onClick:v,children:[s.jsx(oi,{size:12})," ",d("project.memories.save_btn")]})]})]})}function b7({pid:e,agent:t}){const[a,o]=x.useState(!1),l=t.is_master?pa:rn;return s.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[s.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[a?s.jsx(Bs,{size:14,className:"text-muted-fg"}):s.jsx(Do,{size:14,className:"text-muted-fg"}),s.jsx(l,{size:14,className:t.is_master?"text-violet-400":"text-muted-fg"}),s.jsx("span",{className:"text-sm font-medium",children:t.slug}),t.role&&s.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",t.role]})]}),a&&s.jsx("div",{className:"border-t border-border p-3",children:s.jsx(pE,{rows:8,load:()=>ln.memory.get(e,t.slug).then(c=>c.body),save:c=>ln.memory.put(e,t.slug,c).then(()=>{})})})]})}function _7({pid:e}){const t=Ge(`/projects/${e}/agents`,()=>ln.list(e));return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ve,{title:d("project.memories.project_title"),description:d("project.memories.project_desc"),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.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:s.jsx(of,{className:"size-4 text-white"})}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(pE,{rows:12,load:()=>cs.memory.get(e).then(a=>a.body),save:a=>cs.memory.put(e,a).then(()=>{}),placeholder:d("project.memories.project_ph")})})]})}),s.jsxs(Ve,{title:d("project.memories.agents_title"),description:d("project.memories.agents_desc"),children:[t.isLoading&&s.jsx(ot,{}),!t.isLoading&&(t.data?.length??0)===0&&s.jsx(gt,{children:d("project.memories.no_agents")}),s.jsx("ul",{className:"space-y-2",children:(t.data||[]).map(a=>s.jsx(b7,{pid:e,agent:a},a.slug))})]})]})}function v7({pid:e,entry:t,onDeleted:a,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[u,p]=x.useState(!1),[m,h]=x.useState(null),g=nt(),[b,v]=x.useState(!1),[w,N]=x.useState(t.name),y=x.useRef(null),[j,E]=x.useState(!1),[S,C]=x.useState(!1),[R,M]=x.useState(!1),T=j?["artifact",e,t.name]:null,O=Ge(T,()=>Ar.read(e,t.name),{revalidateOnFocus:!1}),D=!O.data?.content||O.data.content.startsWith("#!"),B=async $=>{try{await navigator.clipboard.writeText($),g.info(d("modules_ui.code_copied"))}catch{}},L=async()=>{p(!0),h(null);try{const $=await Ar.run(e,t.name);h($),$.ok?g.info(d("modules_ui.code_artifact_exit_ok",{ms:$.durationMs??0})):g.error(d("modules_ui.code_artifact_exit_fail",{code:$.exitCode??$.signal??"?",timeout:$.timedOut?d("modules_ui.code_artifact_timeout_suffix"):""}))}catch($){g.error($.message)}finally{p(!1)}},U=async()=>{M(!0);try{await Ar.remove(e,t.name),C(!1),a()}catch($){g.error($.message)}finally{M(!1)}},z=()=>{N(t.name),v(!0),requestAnimationFrame(()=>y.current?.select())},P=async()=>{const $=w.trim();if(v(!1),!(!$||$===t.name))try{await Ar.rename(e,t.name,$),o()}catch(V){g.error(V.message)}};return s.jsxs("li",{className:"rounded-md border border-border",children:[s.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[s.jsx(lf,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?s.jsx("input",{ref:y,value:w,onChange:$=>N($.target.value),onBlur:()=>void P(),onKeyDown:$=>{$.key==="Enter"&&P(),$.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"}):s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),s.jsx(Ke,{content:d("code_module.artifacts_rename"),children:s.jsx("button",{type:"button",onClick:z,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(ga,{className:"size-3"})})}),s.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),s.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),s.jsx(Ke,{content:d("code_module.artifacts_copy_path"),children:s.jsx("button",{type:"button",onClick:()=>void B(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(Pc,{className:"size-3"})})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[s.jsxs(Ex,{open:j,onOpenChange:E,children:[s.jsx(Ke,{content:d("code_module.artifacts_view"),children:s.jsxs("button",{type:"button",onClick:()=>E(!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:[s.jsx(Vf,{className:"size-3"}),d("modules_ui.code_artifact_view_short")]})}),s.jsxs(Rx,{className:"sm:max-w-lg",children:[s.jsx(Tx,{children:s.jsx(Ax,{className:"font-mono text-sm",children:t.name})}),O.isLoading?s.jsx("div",{className:"flex justify-center py-6",children:s.jsx(Dn,{size:16})}):s.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:O.data?.content??""}),s.jsx(fw,{showCloseButton:!0})]})]}),c&&s.jsx(Ke,{content:d("code_module.artifacts_edit"),children:s.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:[s.jsx(D3,{className:"size-3"}),d("modules_ui.code_artifact_edit_short")]})}),D&&s.jsx(Ke,{content:d("code_module.artifacts_run"),children:s.jsxs("button",{type:"button",disabled:u,onClick:()=>l?l(`apx artifact run ${t.name}`):void L(),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 disabled:opacity-60 dark:text-emerald-300",children:[u?s.jsx(Dn,{size:10}):s.jsx(ub,{className:"size-3"}),d("code_module.artifacts_run")]})}),s.jsxs(Ex,{open:S,onOpenChange:C,children:[s.jsx(Ke,{content:d("code_module.artifacts_delete"),children:s.jsx("button",{type:"button",onClick:()=>C(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:s.jsx(wn,{className:"size-3"})})}),s.jsxs(Rx,{className:"sm:max-w-sm",children:[s.jsx(Tx,{children:s.jsxs(Ax,{className:"font-mono text-sm",children:[d("code_module.artifacts_delete")," — ",t.name]})}),s.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:d("code_module.artifacts_delete_confirm")}),s.jsxs(fw,{children:[s.jsx(_P,{render:s.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:d("common.cancel")}),s.jsxs("button",{type:"button",onClick:()=>void U(),disabled:R,className:ke("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&&s.jsx(Dn,{size:10}),d("code_module.delete")]})]})]})]})]}),s.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[d("code_module.artifacts_run_hint")," ",s.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),m&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[s.jsx("span",{className:ke("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:d("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&s.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:d("modules_ui.code_artifact_timeout")}),m.truncated&&s.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:d("modules_ui.code_artifact_truncated")}),s.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&s.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&s.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 mE({pid:e,onRunInTerminal:t,onEditArtifact:a}){const o=Ge(e?["artifacts",e]:null,()=>Ar.list(e)),l=o.data||[];return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?d("code_module.artifacts_count",{n:l.length}):""}),s.jsx(Ke,{content:d("code_module.reload"),children:s.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?s.jsx(Dn,{size:12}):s.jsx(Ys,{className:"size-3"})})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?s.jsx(gt,{children:d("code_module.artifacts_none")}):s.jsx("ul",{className:"space-y-1.5",children:l.map(c=>s.jsx(v7,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:a},c.name))})})]})}function y7({pid:e}){const t=Ln(),a=o=>{const l=new URLSearchParams({pid:e,...o}).toString();t(`/m/code?${l}`)};return s.jsx(Ve,{title:d("project.artifacts.title"),description:d("project.artifacts.subtitle"),fullHeight:!0,className:"min-h-[24rem]",children:s.jsx(mE,{pid:e,onRunInTerminal:o=>a({cmd:o}),onEditArtifact:o=>a({edit:o})})})}function j7({pid:e}){const t=nt(),a=Ge(`/projects/${e}/organization`,()=>Or.get(e)),[o,l]=x.useState(null),[c,u]=x.useState(null),[p,m]=x.useState(null),h=()=>void a.mutate(),g=a.data?.areas??[],b=a.data?.roles??[],v=N=>b.filter(y=>y.area===N),w=async()=>{p&&(p.kind==="area"?await Or.removeArea(e,p.slug):await Or.removeRole(e,p.slug),t.success(d("common.deleted")),h())};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ve,{title:d("structure.title"),description:d("structure.subtitle"),action:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{size:"sm",variant:"secondary","data-testid":"structure-new-area",onClick:()=>l({}),children:[s.jsx(Kt,{className:"size-3.5"}),d("structure.new_area")]}),s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>u({}),children:[s.jsx(Kt,{className:"size-3.5"}),d("structure.new_role")]})]}),children:[s.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-sky-500/20 bg-sky-500/5 px-3 py-2 text-[13px] text-muted-foreground",children:[s.jsx(jS,{className:"mt-0.5 size-4 shrink-0 text-sky-500"}),s.jsx("span",{children:d("structure.info")})]}),a.isLoading?s.jsx(ot,{}):g.length===0&&b.length===0?s.jsx(gt,{children:d("structure.empty")}):s.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[g.map(N=>s.jsxs("div",{className:"group rounded-lg border border-border bg-card/50 p-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(rb,{className:"mt-0.5 size-4 shrink-0 text-emerald-500"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-semibold",children:N.name}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:N.slug})]}),N.goal&&s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:N.goal})]}),s.jsxs("div",{className:"flex shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsx("button",{type:"button",onClick:()=>l({editing:N}),className:"text-muted-foreground hover:text-foreground","aria-label":d("common.edit"),children:s.jsx(ga,{className:"size-3.5"})}),s.jsx("button",{type:"button",onClick:()=>m({kind:"area",slug:N.slug,name:N.name}),className:"text-muted-foreground hover:text-red-500","aria-label":d("common.delete"),children:s.jsx(wn,{className:"size-3.5"})})]})]}),s.jsxs("div",{className:"mt-3 border-t border-border/60 pt-2",children:[s.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[s.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[d("structure.roles")," (",v(N.slug).length,")"]}),s.jsxs("button",{type:"button",onClick:()=>u({presetArea:N.slug}),className:"text-[11px] text-sky-500 hover:text-sky-400",children:["+ ",d("structure.add_role")]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[v(N.slug).map(y=>s.jsx(Uw,{role:y,onEdit:()=>u({editing:y}),onDelete:()=>m({kind:"role",slug:y.slug,name:y.name})},y.slug)),v(N.slug).length===0&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:d("structure.no_roles")})]})]})]},N.slug)),v(null).length>0&&s.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card/30 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(hS,{className:"size-3.5"}),d("structure.general_roles")]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:v(null).map(N=>s.jsx(Uw,{role:N,onEdit:()=>u({editing:N}),onDelete:()=>m({kind:"role",slug:N.slug,name:N.name})},N.slug))})]})]})]}),s.jsx(IN,{open:!!o,onClose:()=>l(null),pid:e,editing:o?.editing,onSaved:h}),s.jsx(BN,{open:!!c,onClose:()=>u(null),pid:e,areas:g,editing:c?.editing,presetArea:c?.presetArea,onSaved:h}),s.jsx(qN,{open:!!p,onClose:()=>m(null),onConfirm:w,title:p?.kind==="area"?d("structure.delete_area"):d("structure.delete_role"),description:p?.kind==="area"?d("structure.delete_area_desc",{name:p?.name??""}):d("structure.delete_role_desc",{name:p?.name??""}),confirmLabel:d("common.delete")})]})}function Uw({role:e,onEdit:t,onDelete:a}){return s.jsxs("span",{className:"group/chip inline-flex items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",children:[s.jsx(hS,{className:"size-3 text-muted-foreground"}),s.jsx("span",{children:e.name}),s.jsx("button",{type:"button",onClick:t,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-foreground","aria-label":d("common.edit"),children:s.jsx(ga,{className:"size-2.5"})}),s.jsx("button",{type:"button",onClick:a,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-red-500","aria-label":d("common.delete"),children:s.jsx(wn,{className:"size-2.5"})})]})}function w7(e){switch(e){case"markdown":return{Icon:ab,color:"text-sky-500"};case"text":return{Icon:u3,color:"text-amber-500"};case"image":return{Icon:j3,color:"text-pink-500"};default:return{Icon:_S,color:"text-muted-foreground"}}}function k7(e){const t=e.split("/"),a=[];for(let o=1;o<t.length;o++)a.push(t.slice(0,o).join("/"));return a}function hE({node:e,depth:t,selectedPath:a,expanded:o,toggle:l,onSelect:c,onDelete:u}){const p=e.type==="dir",m=o.has(e.path),h=a===e.path,{Icon:g,color:b}=p?{Icon:m?ai:yS,color:"text-muted-foreground"}:w7(e.kind);return s.jsxs("div",{children:[s.jsxs("div",{className:ke("group flex items-center gap-1 rounded px-1.5 py-1 text-[13px] cursor-pointer",h?"bg-primary/15 text-foreground":"hover:bg-accent/40 text-foreground/80"),style:{paddingLeft:t*12+6},onClick:()=>p?l(e.path):c(e),children:[p?m?s.jsx(Bs,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx(Do,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx("span",{className:"w-3.5 shrink-0"}),s.jsx(g,{className:ke("size-3.5 shrink-0",b)}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),u&&!p&&s.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(e)},className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500","aria-label":`delete ${e.name}`,children:s.jsx(wn,{className:"size-3.5"})})]}),p&&m&&e.children?.map(v=>s.jsx(hE,{node:v,depth:t+1,selectedPath:a,expanded:o,toggle:l,onSelect:c,onDelete:u},v.path))]})}function S7({nodes:e,selectedPath:t,onSelect:a,onDelete:o,className:l}){const[c,u]=x.useState(()=>new Set);x.useEffect(()=>{t&&u(m=>{const h=new Set(m);for(const g of k7(t))h.add(g);return h})},[t]);const p=m=>u(h=>{const g=new Set(h);return g.has(m)?g.delete(m):g.add(m),g});return s.jsx("div",{className:ke("select-none",l),children:e.map(m=>s.jsx(hE,{node:m,depth:0,selectedPath:t,expanded:c,toggle:p,onSelect:a,onDelete:o},m.path))})}function qd(e,t){const a=[],o=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g;let l=0,c,u=0;for(;c=o.exec(e);)c.index>l&&a.push(s.jsx(x.Fragment,{children:e.slice(l,c.index)},`${t}-t${u}`)),c[2]!==void 0?a.push(s.jsx("strong",{children:c[2]},`${t}-b${u}`)):c[4]!==void 0?a.push(s.jsx("em",{children:c[4]},`${t}-i${u}`)):c[6]!==void 0?a.push(s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:c[6]},`${t}-c${u}`)):c[8]!==void 0&&a.push(s.jsx("a",{href:c[9],target:"_blank",rel:"noreferrer",className:"text-sky-500 underline underline-offset-2 hover:text-sky-400",children:c[8]},`${t}-l${u}`)),l=o.lastIndex,u+=1;return l<e.length&&a.push(s.jsx(x.Fragment,{children:e.slice(l)},`${t}-tend`)),a}function gE({content:e,className:t}){const a=e.replace(/\r\n/g,`
689
+ `).split(`
690
+ `),o=[];let l=0,c=0;const u=(p,m)=>{const h=m?"ol":"ul";o.push(s.jsx(h,{className:ke("my-2 space-y-1 pl-5",m?"list-decimal":"list-disc"),children:p.map((g,b)=>s.jsx("li",{children:qd(g,`li${c}-${b}`)},b))},`k${c++}`))};for(;l<a.length;){const p=a[l];if(/^```/.test(p.trim())){const g=[];for(l+=1;l<a.length&&!/^```/.test(a[l].trim());)g.push(a[l++]);l+=1,o.push(s.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg bg-muted/60 p-3 font-mono text-[12px] leading-[1.6]",children:s.jsx("code",{children:g.join(`
691
+ `)})},`k${c++}`));continue}if(p.trim()===""){l+=1;continue}const m=p.match(/^(#{1,6})\s+(.*)$/);if(m){const g=m[1].length,b=["text-2xl","text-xl","text-lg","text-base","text-sm","text-sm"];o.push(s.jsx("div",{className:ke("mt-3 mb-1 font-semibold text-foreground",b[g-1]),children:qd(m[2],`h${c}`)},`k${c++}`)),l+=1;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(p.trim())){o.push(s.jsx("hr",{className:"my-3 border-border"},`k${c++}`)),l+=1;continue}if(/^>\s?/.test(p)){const g=[];for(;l<a.length&&/^>\s?/.test(a[l]);)g.push(a[l++].replace(/^>\s?/,""));o.push(s.jsx("blockquote",{className:"my-2 border-l-2 border-border pl-3 text-muted-foreground",children:qd(g.join(" "),`q${c}`)},`k${c++}`));continue}if(/^\s*[-*+]\s+/.test(p)){const g=[];for(;l<a.length&&/^\s*[-*+]\s+/.test(a[l]);)g.push(a[l++].replace(/^\s*[-*+]\s+/,""));u(g,!1);continue}if(/^\s*\d+\.\s+/.test(p)){const g=[];for(;l<a.length&&/^\s*\d+\.\s+/.test(a[l]);)g.push(a[l++].replace(/^\s*\d+\.\s+/,""));u(g,!0);continue}const h=[];for(;l<a.length&&a[l].trim()!==""&&!/^(#{1,6})\s/.test(a[l])&&!/^```/.test(a[l].trim())&&!/^>\s?/.test(a[l])&&!/^\s*[-*+]\s+/.test(a[l])&&!/^\s*\d+\.\s+/.test(a[l]);)h.push(a[l++]);o.push(s.jsx("p",{className:"my-2 leading-relaxed",children:qd(h.join(" "),`p${c}`)},`k${c++}`))}return s.jsx("div",{className:ke("text-sm text-foreground/90",t),children:o})}function C7({value:e,onChange:t,showPreview:a=!1,placeholder:o,onSave:l,className:c}){return s.jsxs("div",{className:ke("flex min-h-0 flex-1",c),children:[s.jsx("textarea",{value:e,onChange:u=>t(u.target.value),onKeyDown:u=>{l&&(u.metaKey||u.ctrlKey)&&u.key==="s"&&(u.preventDefault(),l())},placeholder:o,spellCheck:!1,className:ke("min-h-0 resize-none bg-transparent p-4 font-mono text-[13px] leading-[1.7] text-foreground/90 outline-none",a?"w-1/2 border-r border-border":"w-full")}),a&&s.jsx("div",{className:"min-h-0 w-1/2 overflow-y-auto p-4",children:s.jsx(gE,{content:e})})]})}function Vd({onClick:e,active:t,disabled:a,children:o}){return s.jsx("button",{type:"button",onClick:e,disabled:a,className:ke("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-40",t?"bg-primary/15 text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:o})}function N7({content:e}){return s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:s.jsx("tbody",{children:e.split(`
692
+ `).map((t,a)=>s.jsxs("tr",{className:"hover:bg-accent/20",children:[s.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:a+1}),s.jsx("td",{className:"whitespace-pre px-4 align-top text-foreground/90",children:t||" "})]},a))})})})}function E7({file:e,loading:t,onSave:a}){const o=typeof a=="function",[l,c]=x.useState(""),[u,p]=x.useState(!1),[m,h]=x.useState(!0),[g,b]=x.useState(!1);if(x.useEffect(()=>{c(e?.content??""),p(!1),h(!0)},[e?.path,e?.content]),t)return s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(Dn,{size:16})});if(!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:d("files.select_prompt")});const v=e.kind==="markdown",w=e.kind==="text"||e.kind==="markdown",N=u&&l!==(e.content??""),y=async()=>{if(!(!a||!N)){b(!0);try{await a(l),p(!1)}finally{b(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"file-viewer",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[s.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e.path,N&&s.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),v&&u&&s.jsxs(Vd,{onClick:()=>h(j=>!j),active:m,children:[s.jsx(n3,{className:"size-3"}),d("files.preview")]}),o&&w&&(u?s.jsxs(s.Fragment,{children:[s.jsxs(Vd,{onClick:()=>{c(e.content??""),p(!1)},disabled:g,children:[s.jsx(ri,{className:"size-3"}),d("files.discard")]}),s.jsxs(Vd,{onClick:()=>void y(),disabled:!N||g,active:N,children:[g?s.jsx(Dn,{size:10}):s.jsx(oi,{className:"size-3"}),d("files.save")]})]}):s.jsxs(Vd,{onClick:()=>p(!0),children:[s.jsx(ga,{className:"size-3"}),d("files.edit")]}))]}),v?u?s.jsx(C7,{value:l,onChange:c,showPreview:m,onSave:()=>void y()}):s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:s.jsx(gE,{content:e.content??""})}):e.kind==="text"?u?s.jsx("textarea",{value:l,onChange:j=>c(j.target.value),onKeyDown:j=>{(j.metaKey||j.ctrlKey)&&j.key==="s"&&(j.preventDefault(),y())},spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent p-4 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none"}):s.jsx(N7,{content:e.content??""}):e.kind==="image"&&e.encoding==="base64"?s.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-auto p-4",children:s.jsx("img",{src:`data:${e.mime};base64,${e.content}`,alt:e.name,className:"max-h-full max-w-full rounded object-contain"})}):s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(f3,{className:"size-8 opacity-50"}),s.jsx("span",{children:e.too_large?d("files.too_large"):d("files.no_preview")}),s.jsxs("span",{className:"flex items-center gap-1 text-xs opacity-70",children:[s.jsx(o3,{className:"size-3"}),(e.size/1024).toFixed(1)," KB"]})]})]})}function R7({open:e,onClose:t,pid:a,scope:o,onCreated:l}){const c=nt(),[u,p]=x.useState(""),[m,h]=x.useState(!1),g=async()=>{let b=u.trim().replace(/^\/+/,"");if(b){/\.[a-z0-9]+$/i.test(b)||(b+=".md"),h(!0);try{await yc.write(a,b,"",o),c.success(d("files.created")),p(""),l(b)}catch(v){c.error(v instanceof Error?v.message:String(v))}finally{h(!1)}}};return s.jsx(cn,{open:e,onClose:t,title:d("files.new_doc"),description:d("files.new_doc_hint"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,children:d("common.cancel")}),s.jsx(ne,{variant:"primary","data-testid":"new-file-create",onClick:()=>void g(),loading:m,disabled:!u.trim(),children:d("files.create")})]}),children:s.jsx(le,{label:d("files.path_label"),hint:d("files.path_example"),children:s.jsx(Ee,{autoFocus:!0,"data-testid":"new-file-path",value:u,onChange:b=>p(b.target.value),onKeyDown:b=>{b.key==="Enter"&&g()},placeholder:"cases/onboarding/spec.md"})})})}function xE({pid:e,scope:t,editable:a=!1,emptyHint:o}){const l=nt(),[c,u]=x.useState(null),[p,m]=x.useState(!1),h=`/projects/${e}/fs/tree?scope=${t}`,g=Ge(h,()=>yc.tree(e,t)),b=c?`/projects/${e}/fs/file?scope=${t}&path=${c}`:null,v=Ge(b,()=>c?yc.read(e,c,t):null),w=C=>u(C.path),N=a?async C=>{c&&(await yc.write(e,c,C,t),l.success(d("files.saved")),v.mutate())}:void 0,y=a?async C=>{await yc.remove(e,C.path,t),c===C.path&&u(null),l.success(d("files.deleted")),g.mutate()}:void 0,j=C=>{m(!1),u(C),g.mutate()},E=g.data?.tree??[],S=!g.isLoading&&E.length===0;return s.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[s.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[s.jsx(ai,{className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:d(t==="docs"?"files.docs_label":"files.files_label")}),a&&s.jsx("button",{type:"button","data-testid":"docs-new",onClick:()=>m(!0),className:"text-muted-foreground hover:text-foreground","aria-label":d("files.new_doc"),title:d("files.new_doc"),children:s.jsx(nx,{className:"size-4"})}),s.jsx("button",{type:"button",onClick:()=>void g.mutate(),className:"text-muted-foreground hover:text-foreground","aria-label":d("common.refresh"),children:s.jsx(Ys,{className:g.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[g.isLoading?s.jsx("div",{className:"flex justify-center py-6",children:s.jsx(Dn,{size:14})}):S?s.jsx("div",{className:"p-3",children:s.jsx(gt,{children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{children:o??d("files.empty")}),a&&s.jsxs(ne,{size:"sm",variant:"secondary",onClick:()=>m(!0),children:[s.jsx(nx,{className:"size-3.5"}),d("files.new_doc")]})]})})}):s.jsx(S7,{nodes:E,selectedPath:c,onSelect:w,onDelete:y}),g.data?.truncated&&s.jsx("p",{className:"px-2 py-1 text-[10px] text-muted-foreground/60",children:d("files.truncated")})]})]}),s.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:s.jsx(E7,{file:v.data??null,loading:!!b&&v.isLoading,onSave:N})}),a&&s.jsx(R7,{open:p,onClose:()=>m(!1),pid:e,scope:t,onCreated:j})]})}function T7({pid:e}){return s.jsx("div",{className:"h-full",children:s.jsx(xE,{pid:e,scope:"docs",editable:!0,emptyHint:d("files.docs_empty")})})}function A7({pid:e}){return s.jsx("div",{className:"h-full",children:s.jsx(xE,{pid:e,scope:"project"})})}function M7(){const e=Ln(),t=es(),{pid:a=""}=aS(),{project:o}=p_(a),{collapsed:l,toggle:c}=c_(On.sidebarCollapsed+".project"),u=String(a)==="0",p=x.useMemo(()=>{if(u)return[{title:d("base.nav_general"),items:[{key:"",label:"Dashboard",icon:k3},{key:"workspaces",label:d("base.workspaces_title"),icon:YM},{key:"models",label:d("settings.tabs.engines"),icon:sb},{key:"agent-defaults",label:d("base.defaults_title"),icon:rn}]},{title:d("base.nav_activity"),items:[{key:"chat",label:d("project.nav.chat"),icon:uf},{key:"sessions",label:d("base.sessions_title"),icon:v3},{key:"tasks",label:d("project.nav.tasks"),icon:Hl},{key:"logs",label:d("project.nav.logs"),icon:df}]},{title:d("base.nav_system"),items:[{key:"agents",label:d("project.nav.agents"),icon:rn},{key:"memories",label:d("project.nav.memories"),icon:of},{key:"routines",label:d("project.nav.routines"),icon:jo},{key:"mcps",label:d("project.nav.mcps"),icon:ax},{key:"vars",label:d("project.nav.vars"),icon:sx},{key:"artifacts",label:d("project.nav.artifacts"),icon:lf},{key:"config",label:d("project.nav.config"),icon:Ic}]}];const g=o?.kind==="company";return[{title:d("project.sections.workspace"),items:[{key:"",label:d("project.nav.overview"),icon:rb},{key:"telegram",label:d("project.nav.telegram"),icon:Qs},{key:"chat",label:d("project.nav.chat"),icon:uf},{key:"agents",label:d("project.nav.agents"),icon:rn},...g?[{key:"structure",label:d("project.nav.structure"),icon:XM}]:[],{key:"memories",label:d("project.nav.memories"),icon:of}]},{title:d("project.sections.content"),items:[{key:"docs",label:d("project.nav.docs"),icon:ab},{key:"files",label:d("project.nav.files"),icon:ob}]},{title:d("project.sections.automation"),items:[{key:"routines",label:d("project.nav.routines"),icon:jo},{key:"tasks",label:d("project.nav.tasks"),icon:Hl},{key:"mcps",label:d("project.nav.mcps"),icon:ax},{key:"vars",label:d("project.nav.vars"),icon:sx},{key:"artifacts",label:d("project.nav.artifacts"),icon:lf},{key:"logs",label:d("project.nav.logs"),icon:df}]},{title:d("project.sections.config"),items:[{key:"config",label:d("project.nav.config"),icon:Ic}]}]},[u,o?.kind]),m=t.pathname.replace(`/p/${a}`,"").replace(/^\//,"").split("/")[0];if(!o)return s.jsx(_N,{testId:"screen-project-not-found",mood:"confused",message:d("project.not_found",{pid:a}),action:s.jsx(Za,{variant:"outline",onClick:()=>e("/"),children:d("not_found.home")})});const h=g=>{const b=g?`/p/${a}/${g}`:`/p/${a}`;e(b)};return s.jsx(xN,{sections:p,active:m,onChange:h,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 py-6 pt-3 pr-6 pl-1",testId:`project-tab-${m||"overview"}`,children:s.jsxs(iS,{children:[s.jsx(Pt,{index:!0,element:s.jsx(mw,{pid:a})}),s.jsx(Pt,{path:"workspaces",element:s.jsx(IP,{})}),s.jsx(Pt,{path:"models",element:s.jsx(zN,{})}),s.jsx(Pt,{path:"agent-defaults",element:s.jsx(B6,{})}),s.jsx(Pt,{path:"sessions",element:s.jsx(F6,{})}),s.jsx(Pt,{path:"logs",element:s.jsx(E6,{pid:a})}),s.jsx(Pt,{path:"config",element:s.jsx(uI,{pid:a})}),s.jsx(Pt,{path:"telegram",element:s.jsx(x7,{pid:a})}),s.jsx(Pt,{path:"agents",element:s.jsx(f8,{pid:a})}),s.jsx(Pt,{path:"agents/:slug",element:s.jsx(s8,{pid:a})}),s.jsx(Pt,{path:"structure",element:s.jsx(j7,{pid:a})}),s.jsx(Pt,{path:"docs",element:s.jsx(T7,{pid:a})}),s.jsx(Pt,{path:"files",element:s.jsx(A7,{pid:a})}),s.jsx(Pt,{path:"memories",element:s.jsx(_7,{pid:a})}),s.jsx(Pt,{path:"routines",element:s.jsx(C8,{pid:a})}),s.jsx(Pt,{path:"tasks",element:u?s.jsx(G6,{}):s.jsx(E8,{pid:a})}),s.jsx(Pt,{path:"mcps",element:s.jsx(I8,{pid:a})}),s.jsx(Pt,{path:"artifacts",element:s.jsx(y7,{pid:a})}),s.jsx(Pt,{path:"vars",element:s.jsx(V8,{pid:a})}),s.jsx(Pt,{path:"threads",element:s.jsx(rM,{to:`/p/${a}/chat`,replace:!0})}),s.jsx(Pt,{path:"chat",element:s.jsx(m7,{pid:a})}),s.jsx(Pt,{path:"*",element:s.jsx(mw,{pid:a})})]})})}function O7({value:e,onChange:t,options:a,placeholder:o,className:l}){const c=S=>a.find(C=>C.value===S)?.label??S,[u,p]=x.useState(!1),[m,h]=x.useState(c(e)),g=x.useRef(null),b=x.useRef(null),[v,w]=x.useState(null);x.useEffect(()=>{h(c(e))},[e,a]),x.useLayoutEffect(()=>{if(!u)return;const S=()=>{const C=g.current;if(!C)return;const R=C.getBoundingClientRect();w({top:R.bottom+4,left:R.left,width:R.width})};return S(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[u]),x.useEffect(()=>{if(!u)return;const S=C=>{const R=C.target;g.current?.contains(R)||b.current?.contains(R)||(h(c(e)),p(!1))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u,e,a]);const N=m.trim().toLowerCase(),y=m===c(e),j=N&&!y?a.filter(S=>S.label.toLowerCase().includes(N)||S.value.toLowerCase().includes(N)):a,E=S=>{t(S.value),h(S.label),p(!1)};return s.jsxs("div",{ref:g,className:ke("relative",l),children:[s.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-input bg-transparent px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring dark:bg-input/30 dark:hover:bg-input/50",children:[s.jsx("input",{value:m,placeholder:o,onChange:S=>{h(S.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),s.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(S=>!S),className:"shrink-0 text-muted-fg hover:text-foreground",children:s.jsx(Bs,{className:"size-4"})})]}),u&&j.length>0&&v&&Is.createPortal(s.jsx("ul",{ref:b,style:{position:"fixed",top:v.top,left:v.left,width:v.width},className:"z-[1000] max-h-60 overflow-y-auto rounded-lg bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:j.map(S=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:C=>{C.preventDefault(),E(S)},className:ke("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",S.value===e&&"bg-accent/50"),children:s.jsx("span",{className:"truncate font-mono text-xs",children:S.label})})},S.value))}),document.body)]})}const z7=["es","en","pt","fr","it","de","ca","gl","eu","nl","sv","no","da","fi","is","pl","cs","sk","sl","hr","sr","uk","ru","bg","ro","hu","el","tr","ar","he","fa","hi","bn","ta","ur","id","ms","vi","th","ko","ja","zh"];function D7(e){return e&&e.charAt(0).toLocaleUpperCase()+e.slice(1)}function L7(){const e=i_();let t=null;try{t=new Intl.DisplayNames([e],{type:"language"})}catch{t=null}return z7.map(a=>{const o=t?.of(a);return{value:a,label:o?D7(o):a}}).sort((a,o)=>a.label.localeCompare(o.label,e))}const P7=["UTC","America/Argentina/Buenos_Aires","America/Sao_Paulo","America/New_York","America/Los_Angeles","America/Mexico_City","Europe/London","Europe/Madrid","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"];function I7(){try{const e=Intl.supportedValuesOf;if(typeof e=="function")return e("timeZone")}catch{}return P7}function $w(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function B7(e,t){try{const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t).find(c=>c.type==="timeZoneName")?.value??"GMT",o=/GMT([+-])(\d{1,2})(?::(\d{2}))?/.exec(a);return o?(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+(o[3]?parseInt(o[3],10):0)):0}catch{return 0}}function U7(e){const t=e<0?"-":"+",a=Math.abs(e),o=String(Math.floor(a/60)).padStart(2,"0"),l=String(a%60).padStart(2,"0");return`GMT${t}${o}:${l}`}let Fd=null;function $7(){if(Fd)return Fd;const e=new Date;return Fd=I7().map(t=>({value:t,label:t,off:B7(t,e)})).sort((t,a)=>t.off-a.off||t.value.localeCompare(a.value)).map(({value:t,off:a})=>({value:t,label:`(${U7(a)}) ${t}`})),Fd}function H7(){const e=nt(),{identity:t,isLoading:a,save:o}=m_(),[l,c]=x.useState({}),[u,p]=x.useState(!1),m=x.useMemo(()=>$7(),[]);if(x.useEffect(()=>{c({...t,timezone:t?.timezone||$w()})},[t]),a)return s.jsx(ot,{});const h=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(d("settings.identity.saved"))}catch(g){e.error(g.message)}finally{p(!1)}};return s.jsxs(Ve,{title:d("settings.identity.title"),description:d("settings.identity.subtitle"),children:[t?null:s.jsx(gt,{children:d("common.none_yet")}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("settings.identity.owner_name"),children:s.jsx(Ee,{value:l.owner_name||"",onChange:g=>c({...l,owner_name:g.target.value})})}),s.jsx(le,{label:d("settings.identity.language"),children:s.jsx(dt,{value:l.language||"es",onChange:g=>c({...l,language:g}),options:L7()})}),s.jsx(le,{label:d("settings.identity.timezone"),hint:d("settings.identity.timezone_hint"),children:s.jsx(O7,{value:l.timezone||$w(),onChange:g=>c({...l,timezone:g}),options:m})})]}),s.jsx("div",{className:"mt-3",children:s.jsx(le,{label:d("settings.identity.owner_context"),hint:d("settings.identity.owner_context_hint"),children:s.jsx(pn,{rows:3,value:l.owner_context||"",onChange:g=>c({...l,owner_context:g.target.value})})})}),s.jsx("div",{className:"mt-4",children:s.jsx(ne,{variant:"primary",loading:u,onClick:h,children:d("common.save")})})]})}function q7(){const e=nt(),t=Ln(),{superAgent:a,isLoading:o,mutate:l}=MN(),{patch:c}=Gr(),{identity:u,save:p}=m_(),[m,h]=x.useState(!0),[g,b]=x.useState(""),[v,w]=x.useState(""),[N,y]=x.useState("permiso"),[j,E]=x.useState(!1);if(x.useEffect(()=>{a&&(h(!!a.enabled),b(a.system||""),y(a.permission_mode||"permiso"))},[a]),x.useEffect(()=>{w(u.personality||"")},[u.personality]),o||!a)return s.jsx(ot,{});const S=async()=>{E(!0);try{await c({"super_agent.enabled":m,"super_agent.system":g,"super_agent.permission_mode":N},["super_agent.name"]),await p({personality:v}),e.success(d("settings.super_agent.saved")),l()}catch(C){e.error(C.message)}finally{E(!1)}};return s.jsx(Ve,{title:d("settings.super_agent.title"),description:d("settings.super_agent.behavior_subtitle"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx(Wt,{checked:m,onChange:h,label:d("settings.super_agent.enabled_label")})}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:d("settings.super_agent.model_active")}),s.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:a.model||"—"})]}),s.jsxs(ne,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[s.jsx(sb,{size:13})," ",d("settings.super_agent.model_configure")]})]}),s.jsx(le,{label:d("settings.super_agent.permission_mode"),children:s.jsx(dt,{value:N,onChange:y,options:fb.map(C=>({value:C,label:C}))})}),s.jsx(le,{label:d("settings.super_agent.personality"),children:s.jsx(pn,{rows:2,value:v,onChange:C=>w(C.target.value)})}),s.jsx(le,{label:d("settings.super_agent.system"),hint:d("settings.super_agent.system_hint"),children:s.jsx(pn,{rows:6,className:"font-mono text-xs",value:g,onChange:C=>b(C.target.value),placeholder:d("settings.super_agent.system_ph")})}),s.jsx(ne,{variant:"primary",loading:j,onClick:S,children:d("common.save")})]})})}const Sg={providers:()=>ie.get("/embeddings/providers"),test:(e={})=>ie.post("/embeddings/test",e),reindex:()=>ie.post("/embeddings/reindex",{})},V7=()=>[{value:"auto",label:d("memory_panel.provider_auto")},{value:"ollama",label:d("memory_panel.provider_ollama")},{value:"gemini",label:d("memory_panel.provider_gemini")},{value:"openai",label:d("memory_panel.provider_openai")},{value:"tf",label:d("memory_panel.provider_tf")}],F7=()=>[{value:"chain",label:d("memory_panel.mode_chain")},{value:"single",label:d("memory_panel.mode_single")}],Hw=e=>e.startsWith("***");function G7(){const e=nt(),{config:t,isLoading:a,patch:o}=Gr(),{data:l,mutate:c}=Ge("/embeddings/providers",()=>Sg.providers()),[u,p]=x.useState(!1),[m,h]=x.useState(null);if(a)return s.jsx(ot,{});const g=t.memory||{},b=g.embeddings||{},v=l?.configured_provider||b.provider||"auto",w=l?.mode||b.mode||"chain",N=l?.engines||[],y=async S=>{p(!0);try{await o(S),await c()}catch(C){e.error(d("memory_panel.save_failed",{msg:C.message}))}finally{p(!1)}},j=async()=>{p(!0),h(null);try{const S=await Sg.test({});h(`${S.embedder} · dim ${S.dim} · ${S.ms}ms`),e.success(d("memory_panel.test_ok",{embedder:S.embedder}))}catch(S){e.error(d("memory_panel.test_failed",{msg:S.message}))}finally{p(!1)}},E=async()=>{p(!0);try{const S=await Sg.reindex();e.success(d("memory_panel.reindexed",{indexed:S.indexed,cleared:S.cleared}))}catch(S){e.error(d("memory_panel.reindex_failed",{msg:S.message}))}finally{p(!1)}};return s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[s.jsx(Ve,{title:d("memory_panel.embeddings_title"),description:d("memory_panel.embeddings_desc"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("memory_panel.provider_label"),hint:d("memory_panel.provider_hint"),children:s.jsx(dt,{value:v,onChange:S=>y({"memory.embeddings.provider":S}),options:V7(),disabled:u,className:"max-w-xl"})}),s.jsx(le,{label:d("memory_panel.mode_label"),hint:d("memory_panel.mode_hint"),children:s.jsx(dt,{value:w,onChange:S=>y({"memory.embeddings.mode":S}),options:F7(),disabled:u,className:"max-w-md"})}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:N.map(S=>s.jsxs(Fe,{tone:S.available?"success":"muted",children:[S.id,": ",S.available?d("memory_panel.available"):d("memory_panel.unavailable")]},S.id))}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[s.jsxs(ne,{variant:"secondary",onClick:j,loading:u,children:[s.jsx(er,{size:14})," ",d("memory_panel.test_btn")]}),s.jsxs(ne,{variant:"secondary",onClick:E,loading:u,children:[s.jsx(bS,{size:14})," ",d("memory_panel.reindex_btn")]}),m&&s.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),s.jsxs(Ve,{title:d("memory_panel.ollama_title"),description:d("memory_panel.ollama_desc"),children:[s.jsx(le,{label:d("memory_panel.model_label"),children:s.jsx(Ee,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:u,onBlur:S=>{const C=S.target.value.trim();C&&C!==b.ollama?.model&&y({"memory.embeddings.ollama.model":C})},className:"max-w-md"})}),s.jsx(le,{label:d("memory_panel.base_url_label"),hint:d("memory_panel.ollama_base_url_hint"),children:s.jsx(Ee,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:u,onBlur:S=>y({"memory.embeddings.ollama.base_url":S.target.value.trim()}),className:"max-w-md"})})]}),s.jsxs(Ve,{title:d("memory_panel.openai_title"),description:d("memory_panel.openai_desc"),children:[s.jsx(le,{label:d("memory_panel.model_label"),children:s.jsx(Ee,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:u,onBlur:S=>{const C=S.target.value.trim();C&&C!==b.openai?.model&&y({"memory.embeddings.openai.model":C})},className:"max-w-md"})}),s.jsx(le,{label:d("memory_panel.api_key_label"),hint:d("memory_panel.openai_key_hint"),children:s.jsx(Ee,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:u,onBlur:S=>{const C=S.target.value;C&&!Hw(C)&&y({"memory.embeddings.openai.api_key":C})},className:"max-w-md"})})]}),s.jsxs(Ve,{title:d("memory_panel.gemini_title"),description:d("memory_panel.gemini_desc"),children:[s.jsx(le,{label:d("memory_panel.model_label"),children:s.jsx(Ee,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:u,onBlur:S=>{const C=S.target.value.trim();C&&C!==b.gemini?.model&&y({"memory.embeddings.gemini.model":C})},className:"max-w-md"})}),s.jsx(le,{label:d("memory_panel.api_key_label"),hint:d("memory_panel.gemini_key_hint"),children:s.jsx(Ee,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:u,onBlur:S=>{const C=S.target.value;C&&!Hw(C)&&y({"memory.embeddings.gemini.api_key":C})},className:"max-w-md"})})]}),s.jsxs(Ve,{title:d("memory_panel.compaction_title"),description:d("memory_panel.compaction_desc"),children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(le,{label:d("memory_panel.threshold_label"),hint:d("memory_panel.threshold_hint"),children:s.jsx(Ee,{type:"number",min:1,defaultValue:g.compact_threshold??60,placeholder:"60",disabled:u,onBlur:S=>{const C=parseInt(S.target.value,10);Number.isFinite(C)&&C>0&&C!==g.compact_threshold&&y({"memory.compact_threshold":C})},className:"max-w-[10rem]"})}),s.jsx(le,{label:d("memory_panel.keep_recent_label"),hint:d("memory_panel.keep_recent_hint"),children:s.jsx(Ee,{type:"number",min:1,defaultValue:g.keep_recent??40,placeholder:"40",disabled:u,onBlur:S=>{const C=parseInt(S.target.value,10);Number.isFinite(C)&&C>0&&C!==g.keep_recent&&y({"memory.keep_recent":C})},className:"max-w-[10rem]"})})]}),s.jsx(le,{label:d("memory_panel.compact_model_label"),hint:d("memory_panel.compact_model_hint"),children:s.jsx(Ee,{defaultValue:g.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:u,onBlur:S=>{const C=S.target.value.trim();C&&C!==g.compact_model&&y({"memory.compact_model":C})},className:"max-w-md"})}),s.jsx(le,{label:d("memory_panel.compact_fallback_label"),hint:d("memory_panel.compact_fallback_hint"),children:s.jsx(Ee,{defaultValue:g.compact_fallback_model||"",placeholder:d("memory_panel.compact_fallback_ph"),disabled:u,onBlur:S=>{const C=S.target.value.trim();C!==(g.compact_fallback_model||"")&&y({"memory.compact_fallback_model":C})},className:"max-w-md"})})]})]})}function Y7(){return[{key:"load_threshold",label:d("settings_ui.knob_load_threshold"),hint:d("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:d("settings_ui.knob_hint_threshold"),hint:d("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:d("settings_ui.knob_margin"),hint:d("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:d("settings_ui.knob_max_loaded"),hint:d("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:d("settings_ui.knob_max_hints"),hint:d("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:d("settings_ui.knob_prompt_floor"),hint:d("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:d("settings_ui.knob_body_char_cap"),hint:d("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function K7(){const e=nt(),{data:t,mutate:a,isLoading:o}=Ge("/skills/inspector",()=>vc.inspector()),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,h]=x.useState(null);if(o||!t)return s.jsx(ot,{});const g=t.config,b=t.index,v=async y=>{c(!0);try{await vc.updateInspector(y),await a()}catch(j){e.error(d("settings_ui.could_not_save",{msg:j.message}))}finally{c(!1)}},w=async(y=!1)=>{c(!0);try{const j=await vc.index({force:y});e.success(d("settings_ui.indexed_with",{embedder:j.embedder,dim:j.dim,added:j.changed.added,refreshed:j.changed.refreshed,removed:j.changed.removed})),await a()}catch(j){e.error(d("settings_ui.index_failed",{msg:j.message}))}finally{c(!1)}},N=async()=>{if(u.trim()){c(!0),h(null);try{const y=await vc.inspect(u.trim());h(y.trace)}catch(y){e.error(d("settings_ui.dry_run_failed",{msg:y.message}))}finally{c(!1)}}};return s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[s.jsx(Ve,{title:d("settings_ui.inspector_title"),description:d("settings_ui.inspector_desc"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(le,{label:d("settings_ui.enable_inspector"),hint:d("settings_ui.enable_inspector_hint"),children:s.jsx(Wt,{checked:g.enabled,disabled:l,onChange:y=>v({enabled:y}),label:g.enabled?d("settings_ui.on"):d("settings_ui.off")})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[s.jsx(Fe,{tone:b.count>0?"success":"warning",children:d("settings_ui.index_count",{n:b.count})}),s.jsx(Fe,{tone:"muted",children:b.embedder||d("settings_ui.not_indexed")}),b.dim?s.jsx(Fe,{tone:"muted",children:d("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?s.jsx("span",{className:"text-xs text-muted-foreground",children:d("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[s.jsxs(ne,{variant:"secondary",onClick:()=>w(!1),loading:l,children:[s.jsx(Ys,{size:14})," ",d("settings_ui.reindex")]}),s.jsxs(ne,{variant:"secondary",onClick:()=>w(!0),loading:l,children:[s.jsx(Ys,{size:14})," ",d("settings_ui.reindex_forced")]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:d("settings_ui.embedder_source")})]})]})}),s.jsx(Ve,{title:d("settings_ui.thresholds_title"),description:d("settings_ui.thresholds_desc"),children:s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:Y7().map(y=>s.jsx(le,{label:y.label,hint:y.hint,children:s.jsx(Ee,{type:"number",step:y.step,min:y.min,max:y.max,defaultValue:String(g[y.key]),disabled:l,onBlur:j=>{const E=Number(j.target.value);Number.isFinite(E)&&E!==g[y.key]&&v({[y.key]:E})},className:"max-w-[12rem]"})},y.key))})}),s.jsx(Ve,{title:d("settings_ui.test_title"),description:d("settings_ui.test_desc"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Ee,{value:u,placeholder:d("settings_ui.test_placeholder"),disabled:l,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&N()},className:"max-w-xl flex-1"}),s.jsxs(ne,{variant:"primary",onClick:N,loading:l,children:[s.jsx(U3,{size:14})," ",d("settings_ui.test_btn")]})]}),m&&s.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[s.jsx(er,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?s.jsx(Fe,{tone:"warning",children:d("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?s.jsx(Fe,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?s.jsxs("div",{className:"mb-1",children:[s.jsxs("span",{className:"text-muted-foreground",children:[d("settings_ui.loaded_label")," "]}),m.loaded.map(y=>s.jsx(Fe,{tone:"success",className:"mr-1",children:y},y))]}):null,m.hinted?.length?s.jsxs("div",{className:"mb-1",children:[s.jsxs("span",{className:"text-muted-foreground",children:[d("settings_ui.suggested_label")," "]}),m.hinted.map(y=>s.jsx(Fe,{tone:"info",className:"mr-1",children:y},y))]}):null,m.scored?.length?s.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(y=>s.jsxs("div",{children:[y.sim.toFixed(3)," ",y.slug]},y.slug))}):null]})]})})]})}function X7(){const e=nt(),{config:t,isLoading:a,patch:o,mutate:l}=Gr(),c=t.telegram?.channels||[],u=Math.max(0,c.findIndex(M=>M.name==="default")),p=c[u],[m,h]=x.useState(!0),[g,b]=x.useState(1500),[v,w]=x.useState(!0),[N,y]=x.useState(""),[j,E]=x.useState(""),[S,C]=x.useState(!1);if(x.useEffect(()=>{h(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),w(!!t.telegram?.respond_with_engine),y(""),E(p?.chat_id||"")},[t,p?.chat_id]),a)return s.jsx(ot,{});const R=async()=>{C(!0);try{const M=c.slice(),T={name:"default",chat_id:j,respond_with_engine:v,...N?{bot_token:N}:{}};c.length===0?M.push(T):M[u]={...p,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":g,"telegram.respond_with_engine":v,"telegram.channels":M}),e.success(d("settings.telegram_global.saved")),l(),y("")}catch(M){e.error(M.message)}finally{C(!1)}};return s.jsx(Ve,{title:d("settings.telegram_global.title"),description:d("settings.telegram_global.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Wt,{checked:m,onChange:h,label:d("settings.telegram_global.enabled")}),s.jsx(Wt,{checked:v,onChange:w,label:d("settings.telegram_global.respond_with_engine")})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${Ro(p.bot_token)??""} ${d("telegram_ui.secret_set_replace")}`:d("telegram_ui.bot_token_hint_short"),children:s.jsx(Ee,{type:"password",value:N,onChange:M=>y(M.target.value),placeholder:p?.bot_token?`…${Ro(p.bot_token)??""} ${d("telegram_ui.secret_already_set")}`:""})}),s.jsx(le,{label:d("settings.telegram_global.chat_id"),children:s.jsx(Ee,{value:j,onChange:M=>E(M.target.value),placeholder:"889721252"})}),s.jsx(le,{label:d("settings.telegram_global.poll_interval"),children:s.jsx(Ee,{type:"number",value:String(g),onChange:M=>b(Number(M.target.value)||1500)})})]}),s.jsx(ne,{variant:"primary",loading:S,onClick:R,children:d("common.save")})]})})}function Q7(){const e=nt(),{channels:t,isLoading:a,mutate:o}=v_(),{contacts:l}=y_(),[c,u]=x.useState(null),[p,m]=x.useState(null),h=new Map;for(const b of l)h.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const g=async b=>{if(confirm(d("telegram_channels.delete_confirm",{name:b})))try{await zn.channels.remove(b),e.success(d("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return s.jsxs(Ve,{title:d("telegram_channels.title"),description:d("telegram_channels.desc"),action:s.jsxs(ne,{size:"sm",onClick:()=>u({name:""}),children:[s.jsx(Kt,{size:14})," ",d("telegram_channels.new_btn")]}),children:[a&&s.jsx(ot,{}),!a&&t.length===0&&s.jsx(gt,{children:d("telegram_channels.empty")}),s.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const v=b.owner_user_id!=null?h.get(String(b.owner_user_id))||d("telegram_ui.user_id_fallback",{id:b.owner_user_id}):d("telegram_channels.no_owner");return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"font-medium",children:b.name}),s.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&s.jsxs(Fe,{tone:"success",children:["project = ",b.project]}),s.jsxs(ne,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[s.jsx(Qs,{size:13})," ",d("admin.telegram_send_test")]}),s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>u(b),children:d("common.edit")}),s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>g(b.name),children:d("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),s.jsxs("span",{children:["bot_token: ",b.bot_token?`…${Ro(b.bot_token)??""}`:"—"]}),s.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||d("telegram_ui.default_apx")]}),s.jsxs("span",{children:["engine: ",b.respond_with_engine?d("telegram_ui.yes"):d("telegram_ui.no")]}),s.jsxs("span",{className:"col-span-2",children:[d("telegram_channels.owner_label")," ",v]})]})]},b.name)})}),s.jsx(iN,{channel:c,onClose:()=>u(null),onSaved:()=>{u(null),o()}}),s.jsx(cN,{channel:p,onClose:()=>m(null)})]})}const qw=new Set(["owner","guest"]);function W7(){const e=nt(),{roles:t,mutate:a,isLoading:o}=y_(),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState(!1),v=async()=>{const y=l.trim();if(!y){e.error(d("telegram_roles.name_required"));return}if(qw.has(y)){e.error(d("telegram_roles.builtin_error",{name:y}));return}b(!0);try{const j=m?"*":u.split(",").map(E=>E.trim()).filter(Boolean);await zn.roles.set(y,j),e.success(d("telegram_roles.saved",{name:y})),c(""),p(""),h(!1),a()}catch(j){e.error(j.message)}finally{b(!1)}},w=async y=>{if(confirm(d("telegram_roles.delete_confirm",{name:y})))try{await zn.roles.remove(y),e.success(d("telegram_roles.removed")),a()}catch(j){e.error(j.message)}},N=Object.entries(t);return s.jsxs(Ve,{title:d("telegram_roles.title"),description:d("telegram_roles.desc"),children:[o&&s.jsx(ot,{}),N.length===0&&!o&&s.jsx(gt,{children:d("telegram_roles.empty")}),N.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:N.map(([y,j])=>{const E=qw.has(y),S=j?.tools==="*"?d("telegram_roles.tools_all"):Array.isArray(j?.tools)&&j.tools.length>0?j.tools.join(", "):d("telegram_roles.tools_none");return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"font-medium",children:y}),E&&s.jsx(Fe,{tone:"info",children:d("telegram_roles.builtin")})]}),!E&&s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>w(y),children:d("telegram_roles.delete_btn")})]}),s.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[d("telegram_contacts.tools_label")," ",S]})]},y)})}),s.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(Kt,{size:14})," ",d("telegram_roles.new_title")]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(le,{label:d("telegram_roles.name_label"),children:s.jsx(Ee,{value:l,onChange:y=>c(y.target.value),placeholder:d("telegram_roles.name_ph")})}),s.jsx(le,{label:d("telegram_roles.tools_label"),hint:d("telegram_roles.tools_hint"),children:s.jsx(Ee,{value:u,onChange:y=>p(y.target.value),disabled:m,placeholder:d("telegram_roles.tools_ph")})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Wt,{checked:m,onChange:h,label:d("telegram_roles.full_access")}),s.jsx(ne,{variant:"primary",loading:g,onClick:v,children:d("telegram_roles.save_btn")})]})]})]})}const bE="apx.settings.telegramTab";function Z7(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(bE);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function J7(){const[e,t]=x.useState("default");x.useEffect(()=>{t(Z7())},[]);const a=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(l);try{window.localStorage.setItem(bE,l)}catch{}};return s.jsxs(kp,{value:e,onValueChange:a,className:"w-full",children:[s.jsxs(Sp,{children:[s.jsx(ia,{value:"default",children:d("settings.telegram_global.title")}),s.jsx(ia,{value:"channels",children:d("telegram_channels.title")}),s.jsx(ia,{value:"contacts",children:d("telegram_contacts.title")}),s.jsx(ia,{value:"roles",children:d("telegram_roles.title")})]}),s.jsx(Ls,{value:"default",className:"mt-4",children:s.jsx(X7,{})}),s.jsx(Ls,{value:"channels",className:"mt-4",children:s.jsx(Q7,{})}),s.jsx(Ls,{value:"contacts",className:"mt-4",children:s.jsx(uN,{})}),s.jsx(Ls,{value:"roles",className:"mt-4",children:s.jsx(W7,{})})]})}function eB(){const{data:e,error:t,isLoading:a,mutate:o}=Ge("/pair/list",()=>Wl.list(),{refreshInterval:Gf.pairList});return{clients:e?.clients||[],error:t,isLoading:a,mutate:o}}var Nl={},Cg,Vw;function tB(){return Vw||(Vw=1,Cg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Cg}var Ng={},Nr={},Fw;function Io(){if(Fw)return Nr;Fw=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 Nr.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},Nr.getSymbolTotalCodewords=function(o){return t[o]},Nr.getBCHDigit=function(a){let o=0;for(;a!==0;)o++,a>>>=1;return o},Nr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},Nr.isKanjiModeEnabled=function(){return typeof e<"u"},Nr.toSJIS=function(o){return e(o)},Nr}var Eg={},Gw;function U_(){return Gw||(Gw=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}}})(Eg)),Eg}var Rg,Yw;function nB(){if(Yw)return Rg;Yw=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++}},Rg=e,Rg}var Tg,Kw;function sB(){if(Kw)return Tg;Kw=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]},Tg=e,Tg}var Ag={},Xw;function aB(){return Xw||(Xw=1,(function(e){const t=Io().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}})(Ag)),Ag}var Mg={},Qw;function rB(){if(Qw)return Mg;Qw=1;const e=Io().getSymbolSize,t=7;return Mg.getPositions=function(o){const l=e(o);return[[0,0],[l-t,0],[0,l-t]]},Mg}var Og={},Ww;function oB(){return Ww||(Ww=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,h=null,g=null;for(let b=0;b<c;b++){p=m=0,h=g=null;for(let v=0;v<c;v++){let w=l.get(b,v);w===h?p++:(p>=5&&(u+=t.N1+(p-5)),h=w,p=1),w=l.get(v,b),w===g?m++:(m>=5&&(u+=t.N1+(m-5)),g=w,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 h=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(h===4||h===0)&&u++}return u*t.N2},e.getPenaltyN3=function(l){const c=l.size;let u=0,p=0,m=0;for(let h=0;h<c;h++){p=m=0;for(let g=0;g<c;g++)p=p<<1&2047|l.get(h,g),g>=10&&(p===1488||p===93)&&u++,m=m<<1&2047|l.get(g,h),g>=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 h=0;h<u;h++){c(h),e.applyMask(h,l);const g=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(h,l),g<m&&(m=g,p=h)}return p}})(Og)),Og}var Gd={},Zw;function _E(){if(Zw)return Gd;Zw=1;const e=U_(),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 Gd.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}},Gd.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}},Gd}var zg={},gc={},Jw;function lB(){if(Jw)return gc;Jw=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]})(),gc.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},gc.exp=function(o){return e[o]},gc.mul=function(o,l){return o===0||l===0?0:e[t[o]+t[l]]},gc}var ek;function iB(){return ek||(ek=1,(function(e){const t=lB();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}})(zg)),zg}var Dg,tk;function cB(){if(tk)return Dg;tk=1;const e=iB();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},Dg=t,Dg}var Lg={},Pg={},Ig={},nk;function vE(){return nk||(nk=1,Ig.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ig}var sa={},sk;function yE(){if(sk)return sa;sk=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
693
+ ]))+`;sa.KANJI=new RegExp(a,"g"),sa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),sa.BYTE=new RegExp(o,"g"),sa.NUMERIC=new RegExp(e,"g"),sa.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+a+"$"),c=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return sa.testKanji=function(m){return l.test(m)},sa.testNumeric=function(m){return c.test(m)},sa.testAlphanumeric=function(m){return u.test(m)},sa}var ak;function Bo(){return ak||(ak=1,(function(e){const t=vE(),a=yE();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}}})(Pg)),Pg}var rk;function uB(){return rk||(rk=1,(function(e){const t=Io(),a=_E(),o=U_(),l=Bo(),c=vE(),u=7973,p=t.getBCHDigit(u);function m(v,w,N){for(let y=1;y<=40;y++)if(w<=e.getCapacity(y,N,v))return y}function h(v,w){return l.getCharCountIndicator(v,w)+4}function g(v,w){let N=0;return v.forEach(function(y){const j=h(y.mode,w);N+=j+y.getBitsLength()}),N}function b(v,w){for(let N=1;N<=40;N++)if(g(v,N)<=e.getCapacity(N,w,l.MIXED))return N}e.from=function(w,N){return c.isValid(w)?parseInt(w,10):N},e.getCapacity=function(w,N,y){if(!c.isValid(w))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=l.BYTE);const j=t.getSymbolTotalCodewords(w),E=a.getTotalCodewordsCount(w,N),S=(j-E)*8;if(y===l.MIXED)return S;const C=S-h(y,w);switch(y){case l.NUMERIC:return Math.floor(C/10*3);case l.ALPHANUMERIC:return Math.floor(C/11*2);case l.KANJI:return Math.floor(C/13);case l.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(w,N){let y;const j=o.from(N,o.M);if(Array.isArray(w)){if(w.length>1)return b(w,j);if(w.length===0)return 1;y=w[0]}else y=w;return m(y.mode,y.getLength(),j)},e.getEncodedBits=function(w){if(!c.isValid(w)||w<7)throw new Error("Invalid QR Code version");let N=w<<12;for(;t.getBCHDigit(N)-p>=0;)N^=u<<t.getBCHDigit(N)-p;return w<<12|N}})(Lg)),Lg}var Bg={},ok;function dB(){if(ok)return Bg;ok=1;const e=Io(),t=1335,a=21522,o=e.getBCHDigit(t);return Bg.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},Bg}var Ug={},$g,lk;function fB(){if(lk)return $g;lk=1;const e=Bo();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))},$g=t,$g}var Hg,ik;function pB(){if(ik)return Hg;ik=1;const e=Bo(),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)},Hg=a,Hg}var qg,ck;function mB(){if(ck)return qg;ck=1;const e=Bo();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)},qg=t,qg}var Vg,uk;function hB(){if(uk)return Vg;uk=1;const e=Bo(),t=Io();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]+`
694
+ Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Vg=a,Vg}var Fg={exports:{}},dk;function gB(){return dk||(dk=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,h,g,b,v,w,N,y,j;!p.empty();){m=p.pop(),h=m.value,b=m.cost,v=a[h]||{};for(g in v)v.hasOwnProperty(g)&&(w=v[g],N=b+w,y=u[g],j=typeof u[g]>"u",(j||y>N)&&(u[g]=N,p.push(g,N),c[g]=h))}if(typeof l<"u"&&typeof u[l]>"u"){var E=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(E)}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})(Fg)),Fg.exports}var fk;function xB(){return fk||(fk=1,(function(e){const t=Bo(),a=fB(),o=pB(),l=mB(),c=hB(),u=yE(),p=Io(),m=gB();function h(E){return unescape(encodeURIComponent(E)).length}function g(E,S,C){const R=[];let M;for(;(M=E.exec(C))!==null;)R.push({data:M[0],index:M.index,mode:S,length:M[0].length});return R}function b(E){const S=g(u.NUMERIC,t.NUMERIC,E),C=g(u.ALPHANUMERIC,t.ALPHANUMERIC,E);let R,M;return p.isKanjiModeEnabled()?(R=g(u.BYTE,t.BYTE,E),M=g(u.KANJI,t.KANJI,E)):(R=g(u.BYTE_KANJI,t.BYTE,E),M=[]),S.concat(C,R,M).sort(function(O,D){return O.index-D.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function v(E,S){switch(S){case t.NUMERIC:return a.getBitsLength(E);case t.ALPHANUMERIC:return o.getBitsLength(E);case t.KANJI:return c.getBitsLength(E);case t.BYTE:return l.getBitsLength(E)}}function w(E){return E.reduce(function(S,C){const R=S.length-1>=0?S[S.length-1]:null;return R&&R.mode===C.mode?(S[S.length-1].data+=C.data,S):(S.push(C),S)},[])}function N(E){const S=[];for(let C=0;C<E.length;C++){const R=E[C];switch(R.mode){case t.NUMERIC:S.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:S.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:S.push([R,{data:R.data,mode:t.BYTE,length:h(R.data)}]);break;case t.BYTE:S.push([{data:R.data,mode:t.BYTE,length:h(R.data)}])}}return S}function y(E,S){const C={},R={start:{}};let M=["start"];for(let T=0;T<E.length;T++){const O=E[T],D=[];for(let B=0;B<O.length;B++){const L=O[B],U=""+T+B;D.push(U),C[U]={node:L,lastCount:0},R[U]={};for(let z=0;z<M.length;z++){const P=M[z];C[P]&&C[P].node.mode===L.mode?(R[P][U]=v(C[P].lastCount+L.length,L.mode)-v(C[P].lastCount,L.mode),C[P].lastCount+=L.length):(C[P]&&(C[P].lastCount=L.length),R[P][U]=v(L.length,L.mode)+4+t.getCharCountIndicator(L.mode,S))}}M=D}for(let T=0;T<M.length;T++)R[M[T]].end=0;return{map:R,table:C}}function j(E,S){let C;const R=t.getBestModeForData(E);if(C=t.from(S,R),C!==t.BYTE&&C.bit<R.bit)throw new Error('"'+E+'" cannot be encoded with mode '+t.toString(C)+`.
695
+ Suggested mode is: `+t.toString(R));switch(C===t.KANJI&&!p.isKanjiModeEnabled()&&(C=t.BYTE),C){case t.NUMERIC:return new a(E);case t.ALPHANUMERIC:return new o(E);case t.KANJI:return new c(E);case t.BYTE:return new l(E)}}e.fromArray=function(S){return S.reduce(function(C,R){return typeof R=="string"?C.push(j(R,null)):R.data&&C.push(j(R.data,R.mode)),C},[])},e.fromString=function(S,C){const R=b(S,p.isKanjiModeEnabled()),M=N(R),T=y(M,C),O=m.find_path(T.map,"start","end"),D=[];for(let B=1;B<O.length-1;B++)D.push(T.table[O[B]].node);return e.fromArray(w(D))},e.rawSplit=function(S){return e.fromArray(b(S,p.isKanjiModeEnabled()))}})(Ug)),Ug}var pk;function bB(){if(pk)return Ng;pk=1;const e=Io(),t=U_(),a=nB(),o=sB(),l=aB(),c=rB(),u=oB(),p=_E(),m=cB(),h=uB(),g=dB(),b=Bo(),v=xB();function w(T,O){const D=T.size,B=c.getPositions(O);for(let L=0;L<B.length;L++){const U=B[L][0],z=B[L][1];for(let P=-1;P<=7;P++)if(!(U+P<=-1||D<=U+P))for(let $=-1;$<=7;$++)z+$<=-1||D<=z+$||(P>=0&&P<=6&&($===0||$===6)||$>=0&&$<=6&&(P===0||P===6)||P>=2&&P<=4&&$>=2&&$<=4?T.set(U+P,z+$,!0,!0):T.set(U+P,z+$,!1,!0))}}function N(T){const O=T.size;for(let D=8;D<O-8;D++){const B=D%2===0;T.set(D,6,B,!0),T.set(6,D,B,!0)}}function y(T,O){const D=l.getPositions(O);for(let B=0;B<D.length;B++){const L=D[B][0],U=D[B][1];for(let z=-2;z<=2;z++)for(let P=-2;P<=2;P++)z===-2||z===2||P===-2||P===2||z===0&&P===0?T.set(L+z,U+P,!0,!0):T.set(L+z,U+P,!1,!0)}}function j(T,O){const D=T.size,B=h.getEncodedBits(O);let L,U,z;for(let P=0;P<18;P++)L=Math.floor(P/3),U=P%3+D-8-3,z=(B>>P&1)===1,T.set(L,U,z,!0),T.set(U,L,z,!0)}function E(T,O,D){const B=T.size,L=g.getEncodedBits(O,D);let U,z;for(U=0;U<15;U++)z=(L>>U&1)===1,U<6?T.set(U,8,z,!0):U<8?T.set(U+1,8,z,!0):T.set(B-15+U,8,z,!0),U<8?T.set(8,B-U-1,z,!0):U<9?T.set(8,15-U-1+1,z,!0):T.set(8,15-U-1,z,!0);T.set(B-8,8,1,!0)}function S(T,O){const D=T.size;let B=-1,L=D-1,U=7,z=0;for(let P=D-1;P>0;P-=2)for(P===6&&P--;;){for(let $=0;$<2;$++)if(!T.isReserved(L,P-$)){let V=!1;z<O.length&&(V=(O[z]>>>U&1)===1),T.set(L,P-$,V),U--,U===-1&&(z++,U=7)}if(L+=B,L<0||D<=L){L-=B,B=-B;break}}}function C(T,O,D){const B=new a;D.forEach(function($){B.put($.mode.bit,4),B.put($.getLength(),b.getCharCountIndicator($.mode,T)),$.write(B)});const L=e.getSymbolTotalCodewords(T),U=p.getTotalCodewordsCount(T,O),z=(L-U)*8;for(B.getLengthInBits()+4<=z&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const P=(z-B.getLengthInBits())/8;for(let $=0;$<P;$++)B.put($%2?17:236,8);return R(B,T,O)}function R(T,O,D){const B=e.getSymbolTotalCodewords(O),L=p.getTotalCodewordsCount(O,D),U=B-L,z=p.getBlocksCount(O,D),P=B%z,$=z-P,V=Math.floor(B/z),q=Math.floor(U/z),X=q+1,K=V-q,F=new m(K);let G=0;const I=new Array(z),Y=new Array(z);let Z=0;const te=new Uint8Array(T.buffer);for(let me=0;me<z;me++){const Me=me<$?q:X;I[me]=te.slice(G,G+Me),Y[me]=F.encode(I[me]),G+=Me,Z=Math.max(Z,Me)}const fe=new Uint8Array(B);let ee=0,se,re;for(se=0;se<Z;se++)for(re=0;re<z;re++)se<I[re].length&&(fe[ee++]=I[re][se]);for(se=0;se<K;se++)for(re=0;re<z;re++)fe[ee++]=Y[re][se];return fe}function M(T,O,D,B){let L;if(Array.isArray(T))L=v.fromArray(T);else if(typeof T=="string"){let V=O;if(!V){const q=v.rawSplit(T);V=h.getBestVersionForData(q,D)}L=v.fromString(T,V||40)}else throw new Error("Invalid data");const U=h.getBestVersionForData(L,D);if(!U)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=U;else if(O<U)throw new Error(`
696
+ The chosen QR Code version cannot contain this amount of data.
697
+ Minimum version required to store current data is: `+U+`.
698
+ `);const z=C(O,D,L),P=e.getSymbolSize(O),$=new o(P);return w($,O),N($),y($,O),E($,D,0),O>=7&&j($,O),S($,z),isNaN(B)&&(B=u.getBestMask($,E.bind(null,$,D))),u.applyMask(B,$),E($,D,B),{modules:$,version:O,errorCorrectionLevel:D,maskPattern:B,segments:L}}return Ng.create=function(O,D){if(typeof O>"u"||O==="")throw new Error("No input text");let B=t.M,L,U;return typeof D<"u"&&(B=t.from(D.errorCorrectionLevel,t.M),L=h.from(D.version),U=u.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),M(O,L,B,U)},Ng}var Gg={},Yg={},mk;function jE(){return mk||(mk=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),h=Math.floor((u+c.margin*2)*m),g=c.margin*m,b=[c.color.light,c.color.dark];for(let v=0;v<h;v++)for(let w=0;w<h;w++){let N=(v*h+w)*4,y=c.color.light;if(v>=g&&w>=g&&v<h-g&&w<h-g){const j=Math.floor((v-g)/m),E=Math.floor((w-g)/m);y=b[p[j*u+E]?1:0]}o[N++]=y.r,o[N++]=y.g,o[N++]=y.b,o[N]=y.a}}})(Yg)),Yg}var hk;function _B(){return hk||(hk=1,(function(e){const t=jE();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,h=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(h=o()),m=t.getOptions(m);const g=t.getImageWidth(c.modules.size,m),b=h.getContext("2d"),v=b.createImageData(g,g);return t.qrToImageData(v.data,c,m),a(b,h,g),b.putImageData(v,0,0),h},e.renderToDataURL=function(c,u,p){let m=p;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const h=e.render(c,u,m),g=m.type||"image/png",b=m.rendererOpts||{};return h.toDataURL(g,b.quality)}})(Gg)),Gg}var Kg={},gk;function vB(){if(gk)return Kg;gk=1;const e=jE();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,h=!1,g=0;for(let b=0;b<l.length;b++){const v=Math.floor(b%c),w=Math.floor(b/c);!v&&!h&&(h=!0),l[b]?(g++,b>0&&v>0&&l[b-1]||(p+=h?a("M",v+u,.5+w+u):a("m",m,0),m=0,h=!1),v+1<c&&l[b+1]||(p+=a("h",g),g=0)):m++}return p}return Kg.render=function(c,u,p){const m=e.getOptions(u),h=c.modules.size,g=c.modules.data,b=h+m.margin*2,v=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",w="<path "+t(m.color.dark,"stroke")+' d="'+o(g,h,m.margin)+'"/>',N='viewBox="0 0 '+b+" "+b+'"',j='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+N+' shape-rendering="crispEdges">'+v+w+`</svg>
699
+ `;return typeof p=="function"&&p(null,j),j},Kg}var xk;function yB(){if(xk)return Nl;xk=1;const e=tB(),t=bB(),a=_B(),o=vB();function l(c,u,p,m,h){const g=[].slice.call(arguments,1),b=g.length,v=typeof g[b-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(b<2)throw new Error("Too few arguments provided");b===2?(h=p,p=u,u=m=void 0):b===3&&(u.getContext&&typeof h>"u"?(h=m,m=void 0):(h=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(w,N){try{const y=t.create(p,m);w(c(y,u,m))}catch(y){N(y)}})}try{const w=t.create(p,m);h(null,c(w,u,m))}catch(w){h(w)}}return Nl.create=t.create,Nl.toCanvas=l.bind(null,a.render),Nl.toDataURL=l.bind(null,a.renderToDataURL),Nl.toString=l.bind(null,function(c,u,p){return o.render(c,p)}),Nl}var jB=yB();const wB=Fx(jB);function kB({value:e,size:t=200}){const[a,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return wB.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,t]),s.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:a?s.jsx("img",{src:a,width:t,height:t,alt:"QR"}):s.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function SB(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function CB({open:e,onClose:t,onPaired:a}){const o=nt(),[l,c]=x.useState(null),[u,p]=x.useState(null),[m,h]=x.useState(0),[g,b]=x.useState(!1),v=x.useRef(null),w=x.useCallback(async()=>{c(null),p(null),b(!1);try{const S=await Wl.init();c(S),h(Math.round((S.ttl_ms||9e4)/1e3))}catch(S){S instanceof au&&S.status===403?p(d("settings.devices_pair_localhost_only")):p(S.message)}},[]);x.useEffect(()=>{e?w():(c(null),p(null),b(!1))},[e,w]),x.useEffect(()=>{if(!l||g||m<=0)return;const S=window.setTimeout(()=>h(C=>C-1),1e3);return()=>window.clearTimeout(S)},[l,m,g]),x.useEffect(()=>{if(!e||!l||g)return;let S=!0;const C=async()=>{try{const R=await Wl.status(l.pairing_id);if(!S)return;if(R.status==="confirmed"){b(!0),o.success(d("settings.devices_pair_done")),a(),window.setTimeout(()=>{S&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){h(0);return}}catch{}v.current=window.setTimeout(C,1500)};return v.current=window.setTimeout(C,1500),()=>{S=!1,v.current&&window.clearTimeout(v.current)}},[e,l,g,t,a,o]);const N=!!l&&!g&&m<=0,y=l?SB(l.lan_urls):"",j=l?`${y}/#pair=${l.pairing_id}`:"",E=async(S,C)=>{try{await navigator.clipboard.writeText(S),o.success(C)}catch{o.error(S)}};return s.jsxs(cn,{open:e,onClose:t,title:d("settings.devices_pair_title"),description:d("settings.devices_pair_desc"),footer:s.jsx(ne,{variant:"secondary",onClick:t,children:d("common.close")}),children:[u&&s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),!u&&!l&&s.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[s.jsx(Dn,{})," ",d("common.loading")]}),!u&&l&&s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx("div",{className:N?"opacity-40":"",children:s.jsx(kB,{value:j,size:196})}),g?s.jsx("p",{className:"text-sm font-medium text-emerald-500",children:d("settings.devices_pair_done")}):N?s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("p",{className:"text-sm text-muted-fg",children:d("settings.devices_pair_expired")}),s.jsx(ne,{variant:"primary",onClick:()=>void w(),children:d("settings.devices_pair_regen")})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-center text-xs text-muted-fg",children:d("settings.devices_pair_scan")}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[s.jsx(Dn,{size:12}),s.jsx("span",{children:d("settings.devices_pair_waiting")}),s.jsxs("span",{className:"tabular-nums",children:["· ",d("settings.devices_pair_expires",{s:m})]})]}),s.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:d("settings.devices_pair_link")}),s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:j}),s.jsx(Ke,{content:d("settings.devices_pair_copy"),children:s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>E(j,d("settings.devices_pair_copied")),children:s.jsx(Pc,{size:14})})})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:d("settings.devices_pair_code")}),s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.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}),s.jsx(Ke,{content:d("settings.devices_pair_copy"),children:s.jsx(ne,{size:"sm",variant:"secondary",onClick:()=>E(l.pairing_id,d("settings.devices_pair_copied_code")),children:s.jsx(Pc,{size:14})})})]})]})]})]})]})]})}function NB(){const e=nt(),{clients:t,isLoading:a,mutate:o}=eB(),[l,c]=x.useState(!1),[u,p]=x.useState(""),m=async g=>{if(confirm(d("settings.devices_revoke_confirm",{id:g})))try{await Wl.revoke(g),e.success(d("settings.devices_revoke_success")),o()}catch(b){e.error(b.message)}},h=()=>{const g=u.trim();if(g){bo(g);try{localStorage.setItem(On.token,g)}catch{}p(""),e.success(d("settings.token_saved"))}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ve,{title:d("settings.devices"),description:d("settings.devices_sub"),action:s.jsxs(ne,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[s.jsx(M3,{size:14})," ",d("settings.devices_pair_btn")]}),children:[a&&s.jsx(ot,{}),!a&&t.length===0&&s.jsx(gt,{children:d("settings.devices_empty")}),t.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:t.map(g=>s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"font-medium",children:g.label||g.id}),s.jsx(Fe,{tone:g.kind==="web"?"info":g.kind==="deck"?"success":"muted",children:g.kind}),s.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",g.token_suffix]}),s.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[d("settings.devices_last_seen")," ",g.last_seen?new Date(g.last_seen).toLocaleString():d("settings.devices_never")]}),s.jsx(ne,{size:"sm",variant:"destructive",onClick:()=>m(g.id),children:d("settings.devices_revoke")})]},g.id))}),s.jsx(CB,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]}),s.jsxs(Ve,{title:d("settings.token"),description:d("settings.token_sub"),children:[s.jsx(le,{label:d("settings_ui.bearer_label"),children:s.jsx(Ee,{type:"password",placeholder:f_()?d("settings.token_active"):d("settings.token_paste"),value:u,onChange:g=>p(g.target.value),className:"font-mono",onKeyDown:g=>{g.key==="Enter"&&h()}})}),s.jsx("div",{className:"mt-2",children:s.jsx(ne,{variant:"primary",onClick:h,children:d("common.save")})})]})]})}const EB=[{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:fb.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 RB(){const{config:e,isLoading:t,patch:a,mutate:o}=Gr();if(t)return s.jsx(ot,{});const l=async c=>{const u={};for(const[p,m]of Object.entries(A_(c)))us(m)||(u[p]=m);await a(u),o()};return s.jsx(Ve,{title:d("global_config.title"),description:d("settings_ui.global_config_desc"),children:s.jsx(zx,{sections:EB,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:d("settings_ui.global_json_desc"),onSaveFields:async(c,u)=>{await a(c,u),o()},onSaveJson:l})})}function TB(){const e=nt(),{health:t,isUp:a}=lN(),o=async()=>{try{await Ql.reload(),e.success(d("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ve,{title:d("daemon.version"),action:s.jsx(ne,{size:"sm",onClick:o,children:d("common.reload")}),children:s.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[s.jsx(Xg,{label:d("daemon.version"),value:t?.version||"—"}),s.jsx(Xg,{label:d("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),s.jsx(Xg,{label:d("daemon.status"),value:d(a?"daemon.running":"daemon.down"),ok:a})]})}),s.jsx(RB,{})]})}function Xg({label:e,value:t,ok:a}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&s.jsx(ou,{ok:a}),s.jsx("span",{children:t})]})]})}function AB(){const{preference:e,set:t}=pb(),[a,o]=x.useState(i_()),l=c=>{zC(c),o(c),window.location.reload()};return s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[s.jsx(Ve,{title:d("settings.appearance"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{variant:e==="light"?"primary":"secondary",onClick:()=>t("light"),children:d("settings.light_mode")}),s.jsx(ne,{variant:e==="dark"?"primary":"secondary",onClick:()=>t("dark"),children:d("settings.dark_mode")}),s.jsx(ne,{variant:e==="system"?"primary":"secondary",onClick:()=>t("system"),children:d("settings.system_mode")})]})}),s.jsx(Ve,{title:d("settings.language"),children:s.jsx("div",{className:"flex items-center gap-2",children:DC.map(c=>s.jsx(ne,{variant:a===c.value?"primary":"secondary",onClick:()=>l(c.value),children:c.label},c.value))})})]})}function MB({className:e,...t}){return s.jsx("kbd",{"data-slot":"kbd",className:Ct("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 $x=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function OB(e){return($x?{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 zB(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function DB(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 LB(e){const t=DB(e);if(!t)return null;const a=[];($x?e.metaKey:e.ctrlKey)&&a.push("CommandOrControl"),$x&&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 PB({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 h=g=>{if(g.preventDefault(),g.stopPropagation(),g.key==="Escape"){u(!1);return}const b=LB(g);b&&(t(b),u(!1))};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[c,t]);const m=zB(e);return s.jsxs("div",{className:ke("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:[s.jsxs("button",{ref:p,type:"button",disabled:a,onClick:()=>u(h=>!h),onBlur:()=>u(!1),"aria-label":d("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?s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.desktop_shortcut_recording")}):m.length?s.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:m.map((h,g)=>s.jsxs("span",{className:"flex items-center gap-1",children:[g>0&&s.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),s.jsx(MB,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:OB(h)})]},g))}):s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.desktop_shortcut_record")}),s.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:d(c?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),l?s.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:l}):null]})}const Al={status:()=>ie.get("/desktop/status"),start:()=>ie.post("/desktop/start",{}),stop:()=>ie.post("/desktop/stop",{}),restart:()=>ie.post("/desktop/restart",{}),autostartGet:()=>ie.get("/desktop/autostart"),autostartSet:e=>ie.post("/desktop/autostart",{enable:e})};function IB(e=30){return ie.get(`/messages/global?channel=desktop&limit=${e}`)}function wE({showConfigLink:e=!1}){const t=nt(),{data:a,isLoading:o,mutate:l}=Ge("/desktop/status",()=>Al.status(),{refreshInterval:5e3}),c=!!a?.running,[u,p]=x.useState(null),m=async(v,w)=>{p(v);try{await w()}catch(N){t.error(N.message)}finally{p(null),setTimeout(()=>l(),1200)}},h=()=>m("start",async()=>{const v=await Al.start();t.success(v.already?d("modules_ui.desktop_start_already"):d("modules_ui.desktop_start_done"))}),g=()=>m("stop",async()=>{const v=await Al.stop();t.success(v.stopped?d("modules_ui.desktop_stop_done"):d("modules_ui.desktop_stop_none"))}),b=()=>m("restart",async()=>{(await Al.restart()).reloaded>0?t.success(d("modules_ui.desktop_restart_done")):t.info(d("modules_ui.desktop_restart_none"))});return s.jsx(Ve,{title:d("desktop_screen.status_title"),description:d("modules_ui.desktop_status_desc"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{variant:"primary",size:"sm",onClick:h,loading:u==="start",disabled:c||u!==null&&u!=="start",children:d("modules_ui.desktop_start")}),s.jsx(ne,{variant:"secondary",size:"sm",onClick:g,loading:u==="stop",disabled:!c||u!==null&&u!=="stop",children:d("modules_ui.desktop_stop")}),s.jsx(ne,{variant:"secondary",size:"sm",onClick:b,loading:u==="restart",disabled:!c||u!==null&&u!=="restart",title:d("modules_ui.desktop_restart_hint"),children:d("modules_ui.desktop_restart")}),e&&s.jsx(qf,{to:"/settings/desktop",children:s.jsxs(ne,{size:"sm",variant:"ghost",children:[s.jsx(Ic,{size:14})," ",d("desktop_screen.open_config")]})})]}),children:o?s.jsx(ot,{}):s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[s.jsx(ou,{ok:c}),s.jsx("span",{className:"font-medium",children:d(c?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),s.jsx("button",{type:"button",onClick:()=>l(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:d("modules_ui.desktop_refresh")}),s.jsxs("span",{className:"text-xs text-muted-fg",children:["(",d("modules_ui.desktop_from_terminal")," ",s.jsx(lw,{children:"apx desktop start"})," · ",s.jsx(lw,{children:"apx desktop --debug"}),")"]})]})})}const BB="CommandOrControl+G",UB=()=>[{value:"left",label:d("modules_ui.desktop_pos_left")},{value:"center",label:d("modules_ui.desktop_pos_center")},{value:"right",label:d("modules_ui.desktop_pos_right")}],$B=()=>[{value:"system",label:d("modules_ui.desktop_theme_system")},{value:"light",label:d("modules_ui.desktop_theme_light")},{value:"dark",label:d("modules_ui.desktop_theme_dark")}];function HB(){const e=nt(),{config:t,isLoading:a,patch:o}=Gr(),l=t,c=l.desktop?.shortcut||l.overlay?.shortcut||BB,u=l.desktop?.enabled!==!1,p=l.desktop?.theme||"system",m=l.desktop?.position||"right",{data:h,mutate:g}=Ge("/desktop/autostart",()=>Al.autostartGet()),[b,v]=x.useState(c),[w,N]=x.useState(!1),[y,j]=x.useState(!1);x.useEffect(()=>v(c),[c]);const E=async()=>{const R=b.trim();if(!(!R||R===c)){N(!0);try{await o({"desktop.shortcut":R}),e.success(d("modules_ui.desktop_shortcut_saved"))}catch(M){e.error(M.message)}finally{N(!1)}}},S=async(R,M,T)=>{N(!0);try{await o({[R]:M}),e.success(T)}catch(O){e.error(O.message)}finally{N(!1)}},C=async R=>{j(!0);try{await Al.autostartSet(R),await g(),e.success(d(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(M){e.error(M.message)}finally{j(!1)}};return s.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[s.jsx(wE,{}),s.jsx(Ve,{title:d("desktop_screen.autostart_title"),description:d("modules_ui.desktop_autostart_desc"),children:h?s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Wt,{checked:h.enabled,onChange:C,disabled:y,label:h.enabled?d("common.enabled"):d("common.disabled")}),s.jsx("span",{className:"text-xs text-muted-fg",children:d("modules_ui.desktop_platform",{platform:h.platform})})]}):s.jsx(ot,{})}),s.jsx(Ve,{title:d("desktop_screen.shortcut_title"),description:d("modules_ui.desktop_shortcut_desc"),children:a?s.jsx(ot,{}):s.jsx(le,{label:d("modules_ui.desktop_accelerator"),hint:d("modules_ui.desktop_accelerator_hint"),children:s.jsx(PB,{value:b,onChange:v,disabled:w,trailing:s.jsx(ne,{variant:"primary",size:"sm",onClick:E,loading:w,disabled:!b.trim()||b.trim()===c,children:d("common.save")})})})}),s.jsx(Ve,{title:d("desktop_screen.appearance_title"),description:d("modules_ui.desktop_appearance_desc"),children:a?s.jsx(ot,{}):s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(le,{label:d("modules_ui.desktop_theme"),hint:d("modules_ui.desktop_restart_apply"),children:s.jsx(dt,{value:p,onChange:R=>S("desktop.theme",R,d("modules_ui.desktop_theme_set",{value:R})),options:$B(),disabled:w})}),s.jsx(le,{label:d("modules_ui.desktop_position"),hint:d("modules_ui.desktop_position_hint"),children:s.jsx(dt,{value:m,onChange:R=>S("desktop.position",R,d("modules_ui.desktop_position_set",{value:R})),options:UB(),disabled:w})})]})}),s.jsx(Ve,{title:d("desktop_screen.activation_title"),description:d("modules_ui.desktop_activation_desc"),children:a?s.jsx(ot,{}):s.jsxs("div",{className:"space-y-3",children:[s.jsx(Wt,{checked:u,onChange:R=>S("desktop.enabled",R,d(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:w,label:d(u?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),s.jsxs("p",{className:"text-xs text-muted-fg",children:[d("modules_ui.desktop_stt_engine")," ",s.jsx(qf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:d("nav.modules.voice")})," ",d("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function qB({engines:e,order:t,onToggleEnabled:a,onToggleEmotions:o,onReorder:l,onConfigure:c,onRemove:u,onAddNew:p,busy:m}){const h=e.filter(w=>w.id!=="mock"),g=new Map(h.map(w=>[w.id,w])),b=[...t.filter(w=>g.has(w)),...h.map(w=>w.id).filter(w=>!t.includes(w))],v=(w,N)=>{const y=b.indexOf(w),j=y+N;if(y<0||j<0||j>=b.length)return;const E=[...b];[E[y],E[j]]=[E[j],E[y]],l(E)};return s.jsxs("div",{className:"space-y-2",children:[b.map((w,N)=>{const y=g.get(w),j=Tf[w],E=y.custom?y.label||w:j?.name||w,S=y.custom?y.note||d("voice_ui.custom_note"):j?.note||"";return s.jsxs("div",{"data-testid":`voice-provider-${w}`,className:ke("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!y.enabled&&"opacity-60"),children:[s.jsxs("div",{className:"flex flex-col",children:[s.jsx("button",{type:"button",onClick:()=>v(w,-1),disabled:m||N===0,"aria-label":d("voice_ui.move_up"),"data-testid":`voice-provider-${w}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:s.jsx(tb,{className:"size-3.5"})}),s.jsx("button",{type:"button",onClick:()=>v(w,1),disabled:m||N===b.length-1,"aria-label":d("voice_ui.move_down"),"data-testid":`voice-provider-${w}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:s.jsx(Bs,{className:"size-3.5"})})]}),s.jsx(ou,{ok:y.available?!0:y.configured?!1:null}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:E}),y.custom&&s.jsx(Fe,{tone:"info",children:d("voice_ui.badge_custom")}),j?.local&&s.jsx(Fe,{tone:"info",children:d("voice_ui.badge_local")}),y.available?s.jsx(Fe,{tone:"success",children:d("voice_ui.badge_available")}):y.configured?s.jsx(Fe,{tone:"warning",children:d("voice_ui.badge_unavailable")}):s.jsx(Fe,{tone:"muted",children:d("voice_ui.badge_not_configured")})]}),s.jsx("div",{className:"truncate text-xs text-muted-fg",children:S})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.emotionsApplicable&&s.jsx("button",{type:"button",onClick:()=>o(w,!y.emotionsOn),disabled:m,title:d("voice_ui.emotions_hint"),"data-testid":`voice-provider-${w}-emotions`,className:ke("rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50",y.emotionsOn?"border-emerald-500/50 bg-emerald-500/10 text-emerald-300":"border-border text-muted-fg hover:text-fg"),children:d("voice_ui.emotions_short")}),s.jsx(Wt,{checked:y.enabled,onChange:C=>a(w,C),disabled:m}),s.jsxs(ne,{size:"sm",variant:"secondary",onClick:()=>c(w),"data-testid":`voice-provider-${w}-config`,children:[s.jsx(O3,{className:"size-3.5"})," ",d("voice_ui.configure")]}),y.custom&&s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>u(w),disabled:m,"aria-label":d("voice_ui.remove"),"data-testid":`voice-provider-${w}-remove`,children:s.jsx(wn,{className:"size-3.5"})})]})]},w)}),s.jsxs("button",{type:"button",onClick:p,disabled:m,"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:[s.jsx(Kt,{className:"size-4"})," ",d("voice_ui.add_provider")]})]})}function Cn(e){return typeof e=="string"?e:e==null?"":String(e)}function VB(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function bk({on:e,setOn:t,tags:a,setTags:o}){return s.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[s.jsx(Wt,{checked:e,onChange:t,label:d("voice_ui.emotions_label")}),s.jsx("p",{className:"text-xs text-muted-fg",children:d("voice_ui.emotions_hint")}),e&&s.jsx(le,{label:d("voice_ui.emotions_tags_label"),hint:d("voice_ui.emotions_tags_hint"),children:s.jsx(Ee,{value:a,onChange:l=>o(l.target.value),placeholder:OL.join(", ")})})]})}function FB({open:e,providerId:t,config:a,onClose:o,onSave:l}){const[c,u]=x.useState(!1),[p,m]=x.useState(null),[h,g]=x.useState(""),[b,v]=x.useState({}),[w,N]=x.useState(!1),[y,j]=x.useState(""),[E,S]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;m(null),g("");const z=a||{},P=z.emotions;if(N(!!P?.enabled),j(Array.isArray(P?.tags)?P.tags.join(", "):""),S(!1),t==="__new__"||t.startsWith("custom:")){const V=z;v({label:Cn(V.label),base_url:Cn(V.base_url),model:Cn(V.model),voice:Cn(V.voice),format:Cn(V.format),style:Cn(V.style),temperature:Cn(V.temperature)})}else if(t==="piper"){const V=z;v({bin:Cn(V.bin),model:Cn(V.model),speaker:Cn(V.speaker)})}else if(t==="elevenlabs"){const V=z;v({model:Cn(V.model),voice_id:Cn(V.voice_id),output_format:Cn(V.output_format)})}else if(t==="openai"){const V=z;v({model:Cn(V.model)||"tts-1",voice:Cn(V.voice)||"alloy",format:Cn(V.format)||"mp3"})}else if(t==="gemini"){const V=z;v({model:Cn(V.model),voice:Cn(V.voice)||"Kore",style:Cn(V.style)})}else v({})},[e,t,a]),!t)return null;const C=t==="__new__",R=C||t.startsWith("custom:"),M=Tf[t],T=z=>v(P=>({...P,...z})),O=t!=="piper"&&t!=="mock",D=O&&us(a?.api_key),B=D?d("voice_ui.api_key_set",{suffix:Ro(a?.api_key)??""}):d("voice_ui.api_key_label"),L=C?d("voice_ui.new_provider"):R?b.label||t.slice(7):M?.name||t,U=async()=>{u(!0),m(null);try{const z=C?VB(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(d("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(d("voice_ui.err_base_url_required"));if(!z)throw new Error(d("voice_ui.err_label_required"))}const P=R?`voice.tts.custom.${z}`:`voice.tts.${t}`,$={},V=[],q=(X,K)=>{K.trim()?$[`${P}.${X}`]=K.trim():V.push(`${P}.${X}`)};if(R?($[`${P}.label`]=b.label.trim(),$[`${P}.base_url`]=b.base_url.trim(),q("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?$[`${P}.temperature`]=Number(b.temperature):V.push(`${P}.temperature`),q("model",b.model),q("voice",b.voice)):t==="piper"?(q("bin",b.bin),q("model",b.model),b.speaker.trim()?$[`${P}.speaker`]=b.speaker.trim():V.push(`${P}.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"){$[`${P}.emotions.enabled`]=w;const X=y.split(",").map(K=>K.trim().toLowerCase()).filter(Boolean);X.length?$[`${P}.emotions.tags`]=X:V.push(`${P}.emotions.tags`)}O&&h.trim()&&($[`${P}.api_key`]=h.trim()),await l({set:$,unset:V}),o()}catch(z){m(z.message||d("voice_ui.err_save"))}finally{u(!1)}};return s.jsx(cn,{open:e,onClose:o,title:d("voice_screen.configure_provider",{name:L}),description:R?d("voice_ui.custom_desc"):M?.note,size:"md",footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:o,disabled:c,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:U,loading:c,"data-testid":"voice-provider-save",children:d("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[t==="piper"&&s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("voice_ui.piper_bin_label"),hint:d("voice_ui.piper_bin_hint"),children:s.jsx(Ee,{value:b.bin,onChange:z=>T({bin:z.target.value}),placeholder:"piper"})}),s.jsx(le,{label:d("voice_ui.piper_model_label"),hint:d("voice_ui.piper_model_hint"),children:s.jsx(Ee,{value:b.model,onChange:z=>T({model:z.target.value}),placeholder:"/abs/path/voice.onnx"})}),s.jsx(le,{label:d("voice_ui.piper_speaker_label"),hint:d("voice_ui.piper_speaker_hint"),children:s.jsx(Ee,{value:b.speaker,onChange:z=>T({speaker:z.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("voice_ui.api_key_label"),hint:D?d("voice_ui.api_key_keep_hint"):d("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:z=>g(z.target.value),placeholder:B})}),s.jsx(le,{label:d("voice_ui.model_label"),children:s.jsx(dt,{value:b.model||"",onChange:z=>T({model:z}),options:AL.map(z=>({value:z,label:z})),placeholder:"eleven_multilingual_v2"})}),s.jsx(le,{label:d("voice_ui.voice_id_label"),hint:d("voice_ui.voice_id_hint"),children:s.jsx(Ee,{value:b.voice_id,onChange:z=>T({voice_id:z.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),s.jsx(le,{label:d("voice_ui.output_format_label"),children:s.jsx(Ee,{value:b.output_format,onChange:z=>T({output_format:z.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("voice_ui.api_key_label"),hint:D?d("voice_ui.api_key_keep_hint"):d("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:z=>g(z.target.value),placeholder:B})}),s.jsx(le,{label:d("voice_ui.model_label"),children:s.jsx(dt,{value:b.model||"tts-1",onChange:z=>T({model:z}),options:ML.map(z=>({value:z,label:z}))})}),s.jsx(le,{label:d("voice_ui.voice_label"),children:s.jsx(dt,{value:b.voice||"alloy",onChange:z=>T({voice:z}),options:RL.map(z=>({value:z,label:z}))})}),s.jsx(le,{label:d("voice_ui.format_label"),children:s.jsx(dt,{value:b.format||"mp3",onChange:z=>T({format:z}),options:["mp3","opus","aac","flac","wav"].map(z=>({value:z,label:z}))})})]}),R&&s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("voice_ui.label_label"),hint:d("voice_ui.label_hint"),children:s.jsx(Ee,{value:b.label,onChange:z=>T({label:z.target.value}),placeholder:"QVox"})}),s.jsx(le,{label:d("voice_ui.base_url_req_label"),hint:d("voice_ui.base_url_req_hint"),children:s.jsx(Ee,{value:b.base_url,onChange:z=>T({base_url:z.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),s.jsx(le,{label:d("voice_ui.api_key_label"),hint:d(D?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:z=>g(z.target.value),placeholder:B})}),s.jsx(le,{label:d("voice_ui.style_label"),hint:d("voice_ui.openai_style_hint"),children:s.jsx(pn,{rows:2,value:b.style||"",onChange:z=>T({style:z.target.value}),placeholder:d("voice_ui.style_ph")})}),s.jsx(le,{label:d("voice_ui.temperature_label"),hint:d("voice_ui.temperature_hint"),children:s.jsx(Ee,{value:b.temperature,onChange:z=>T({temperature:z.target.value}),inputMode:"decimal",placeholder:"0.7"})}),s.jsx(bk,{on:w,setOn:N,tags:y,setTags:j}),s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:()=>S(z=>!z),className:"text-xs text-muted-fg hover:text-fg",children:[E?"▾ ":"▸ ",d("voice_ui.advanced")]}),E&&s.jsxs("div",{className:"mt-2 space-y-3",children:[s.jsx(le,{label:d("voice_ui.model_label"),hint:d("voice_ui.custom_model_hint"),children:s.jsx(Ee,{value:b.model,onChange:z=>T({model:z.target.value}),placeholder:d("voice_ui.custom_optional_ph")})}),s.jsx(le,{label:d("voice_ui.voice_label"),hint:d("voice_ui.custom_voice_hint"),children:s.jsx(Ee,{value:b.voice,onChange:z=>T({voice:z.target.value}),placeholder:d("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&s.jsxs(s.Fragment,{children:[s.jsx(le,{label:d("voice_ui.api_key_label"),hint:D?d("voice_ui.api_key_keep_hint"):d("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:z=>g(z.target.value),placeholder:B})}),s.jsx(le,{label:d("voice_ui.model_label"),hint:d("voice_ui.gemini_model_hint"),children:s.jsx(Ee,{value:b.model,onChange:z=>T({model:z.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),s.jsx(le,{label:d("voice_ui.voice_label"),children:s.jsx(dt,{value:b.voice||"Kore",onChange:z=>T({voice:z}),options:TL.map(z=>({value:z,label:z}))})}),s.jsx(le,{label:d("voice_ui.style_label"),hint:d("voice_ui.style_hint"),children:s.jsx(pn,{rows:2,value:b.style||"",onChange:z=>T({style:z.target.value}),placeholder:d("voice_ui.style_ph")})}),s.jsx(bk,{on:w,setOn:N,tags:y,setTags:j})]}),t==="mock"&&s.jsx("p",{className:"text-sm text-muted-fg",children:d("voice_ui.mock_desc")}),p&&s.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function GB(){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 h=>{c(!0);try{u();const g=await DL(h);t.current=g,e.current||(e.current=new Audio);const b=e.current;b.src=g,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[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 YB({engines:e,defaultProvider:t,mode:a}){const o=nt(),{play:l,stop:c,playing:u,loading:p}=GB(),[m,h]=x.useState(d("voice_ui.test_default_text")),[g,b]=x.useState(""),[v,w]=x.useState(!1),[N,y]=x.useState(null),E=[{value:"",label:a==="single"&&t&&t!=="auto"?d("voice_ui.test_default_engine",{name:Tf[t]?.name||t}):d("voice_ui.test_default_chain")},...e.filter(C=>C.id!=="mock").map(C=>({value:C.id,label:C.custom?C.label||C.id:Tf[C.id]?.name||C.id,disabled:!C.available}))],S=async()=>{const C=m.trim();if(!C){o.error(d("voice_ui.test_empty_error"));return}w(!0);try{const R=await Af.say({text:C,provider:g||void 0});y(R),await l(R.audio_path)}catch(R){o.error(R.message||d("voice_ui.test_synth_error"))}finally{w(!1)}};return s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("voice_ui.test_engine_label"),hint:d("voice_ui.test_engine_hint"),children:s.jsx(dt,{value:g,onChange:b,options:E})}),s.jsx(le,{label:d("voice_ui.test_text_label"),children:s.jsx(pn,{rows:2,value:m,onChange:C=>h(C.target.value),placeholder:d("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{variant:"primary",onClick:S,loading:v,disabled:p,"data-testid":"voice-test-say",children:[s.jsx(B3,{className:"size-4"})," ",d("voice_ui.say_this")]}),u?s.jsxs(ne,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[s.jsx(NS,{className:"size-4"})," ",d("voice_ui.stop")]}):N?s.jsxs(ne,{variant:"secondary",onClick:()=>l(N.audio_path),loading:p,"data-testid":"voice-test-replay",children:[s.jsx(ub,{className:"size-4"})," ",d("voice_ui.replay")]}):null,N&&s.jsxs("span",{className:"text-xs text-muted-fg",children:[d("voice_ui.engine_result"),": ",s.jsx("strong",{children:N.provider}),N.duration_s?` · ${N.duration_s.toFixed(1)}s`:""]})]})]})}const _k={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 vk({gpu:e}){const t=_k[e]??_k.none;return s.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 KB(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const XB=()=>[{value:"auto",label:d("voice_ui.stt_provider_auto")},{value:"local",label:d("voice_ui.stt_provider_local")},{value:"openai",label:d("voice_ui.stt_provider_openai")},{value:"custom",label:d("voice_ui.stt_provider_custom")}],yk=()=>[{value:"auto",label:d("voice_ui.lang_auto")},{value:"es",label:d("voice_ui.lang_es")},{value:"en",label:d("voice_ui.lang_en")},{value:"pt",label:d("voice_ui.lang_pt")},{value:"fr",label:d("voice_ui.lang_fr")},{value:"it",label:d("voice_ui.lang_it")},{value:"de",label:d("voice_ui.lang_de")}];function QB({config:e,onPatch:t,busy:a}){const[o,l]=x.useState(null);x.useEffect(()=>{let P=!0;return Af.sttHardware().then($=>{P&&l($)}).catch(()=>{}),()=>{P=!1}},[]);const c=e.provider||"auto",u=e.local||{},p=e.openai||{},m=e.custom||{},h=u.model||"small",g=u.language||"auto",b=c==="auto"||c==="local",v=(P,$,V)=>{const q=V.trim();q!==($||"").trim()&&t({[P]:q})},w=(P,$)=>{const V=$.trim();!V||us(V)||t({[P]:V})},N=P=>us(P)?d("voice_ui.api_key_set",{suffix:Ro(P)??""}):d("voice_ui.api_key_label"),y=u.backend||"auto",j=o?.hardware.gpu||"none",E=y==="auto"?o?.recommended.backend||"faster":y,S=E==="mlx",C=S?"metal":E==="faster"&&j==="cuda"?"cuda":"none",R=()=>{const P=[{value:"auto",label:d("voice_ui.stt_backend_auto")}];return j==="metal"&&P.push({value:"mlx",label:"Metal — mlx-whisper"}),P.push({value:"faster",label:j==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),P},[M,T]=x.useState([]);x.useEffect(()=>{let P=!0;return Af.sttModels(E).then($=>{P&&T($.models)}).catch(()=>{P&&T([])}),()=>{P=!1}},[E]);const O=P=>`${P.id} · ${P.downloaded?"✓ "+P.size:P.size}`,D=()=>M.length?M.map(P=>({value:S?P.repo:P.id,label:O(P)})):zL.map(P=>({value:P,label:P})),B=S?u.mlx_model||o?.recommended.model||"":h,L=S?"transcription.local.mlx_model":"transcription.local.model",U=M.find(P=>(S?P.repo:P.id)===B),z=!!U&&!U.downloaded;return s.jsxs("div",{className:"space-y-3",children:[o&&s.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-fg",children:[d("voice_ui.stt_hw_label"),":"]}),s.jsx(vk,{gpu:o.hardware.gpu}),s.jsx("span",{className:"font-medium text-fg",children:o.hardware.gpuName||o.hardware.platform}),o.hardware.mem_gb?s.jsxs("span",{className:"text-muted-fg",children:["· ",o.hardware.mem_gb," GB",o.hardware.unified_memory?" unified":""]}):null]}),s.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[d("voice_ui.stt_hw_recommended"),":"," ",s.jsx("span",{className:"text-fg",children:o.recommended.model})," ","(",KB(o.recommended),")",o.recommended.limited?` — ${d("voice_ui.stt_hw_limited")}`:""]})]}),s.jsx(le,{label:d("voice_ui.stt_engine_label"),hint:d("voice_ui.stt_engine_hint"),children:s.jsx(dt,{value:c,onChange:P=>t({"transcription.provider":P}),options:XB(),disabled:a,className:"max-w-md"})}),b&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("voice_ui.stt_backend_label"),hint:d("voice_ui.stt_backend_hint"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(dt,{value:y,onChange:P=>t({"transcription.local.backend":P}),options:R(),disabled:a,className:"max-w-xs"}),s.jsx(vk,{gpu:C})]})}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(le,{label:d("voice_ui.stt_model_label"),hint:z?d("voice_ui.stt_model_needs_download",{size:U.size}):d("voice_ui.stt_model_hint"),children:s.jsx(dt,{value:B,onChange:P=>t({[L]:P}),options:D(),disabled:a})}),s.jsx(le,{label:d("voice_ui.stt_language_label"),hint:d("voice_ui.stt_language_hint"),children:s.jsx(dt,{value:g,onChange:P=>t({"transcription.local.language":P}),options:yk(),disabled:a})})]})]}),c==="openai"&&s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(le,{label:d("voice_ui.api_key_label"),hint:us(p.api_key)?d("voice_ui.api_key_keep_hint"):d("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(p.api_key),onBlur:P=>w("transcription.openai.api_key",P.target.value),disabled:a})}),s.jsx(le,{label:d("voice_ui.stt_openai_model_label"),hint:d("voice_ui.stt_openai_model_hint"),children:s.jsx(Ee,{defaultValue:p.model||"",placeholder:"whisper-1",onBlur:P=>v("transcription.openai.model",p.model,P.target.value),disabled:a})})]}),c==="custom"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("voice_ui.stt_custom_baseurl_label"),hint:d("voice_ui.stt_custom_baseurl_hint"),children:s.jsx(Ee,{defaultValue:m.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:P=>v("transcription.custom.base_url",m.base_url,P.target.value),disabled:a})}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(le,{label:d("voice_ui.stt_custom_model_label"),hint:d("voice_ui.stt_custom_model_hint"),children:s.jsx(Ee,{defaultValue:m.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:P=>v("transcription.custom.model",m.model,P.target.value),disabled:a})}),s.jsx(le,{label:d("voice_ui.stt_language_label"),hint:d("voice_ui.stt_language_hint"),children:s.jsx(dt,{value:m.language||"auto",onChange:P=>t({"transcription.custom.language":P}),options:yk(),disabled:a})})]}),s.jsx(le,{label:d("voice_ui.api_key_label"),hint:d("voice_ui.stt_custom_key_hint"),children:s.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(m.api_key),onBlur:P=>w("transcription.custom.api_key",P.target.value),disabled:a})})]})]})}function WB(){const e=nt(),{config:t,isLoading:a,patch:o,mutate:l}=Gr(),{data:c,isLoading:u,error:p,mutate:m}=Ge("/tts/providers",()=>Af.providers()),[h,g]=x.useState(null),[b,v]=x.useState(!1),w=t,N=w.voice?.tts||{},y=w.transcription||{},j=c?.configured_provider||N.provider||"auto",E=c?.mode||N.mode||"chain",S=c?.order||[],C=(c?.engines||[]).map(U=>{if(!(!!U.custom||U.id==="gemini"))return U;const P=U.custom?N.custom?.[U.id.slice(7)]:N.gemini;return{...U,emotionsApplicable:!0,emotionsOn:!!P?.emotions?.enabled}}),R=x.useMemo(()=>!h||h==="__new__"?{}:h.startsWith("custom:")?N.custom?.[h.slice(7)]||{}:N[h]||{},[h,N]),M=async(U,z)=>{v(!0);try{const P=U.startsWith("custom:")?`voice.tts.custom.${U.slice(7)}.enabled`:`voice.tts.${U}.enabled`;await o({[P]:z}),await m()}catch(P){e.error(P.message)}finally{v(!1)}},T=async(U,z)=>{v(!0);try{const P=U.startsWith("custom:")?`voice.tts.custom.${U.slice(7)}.emotions.enabled`:`voice.tts.${U}.emotions.enabled`;await o({[P]:z}),await m(),await l()}catch(P){e.error(P.message)}finally{v(!1)}},O=async U=>{v(!0);try{await o({"voice.tts.order":U}),await m()}catch(z){e.error(z.message)}finally{v(!1)}},D=async({set:U,unset:z})=>{await o(U,z.length?z:void 0),await m(),await l(),e.success(d("voice_ui.toast_config_saved"))},B=async U=>{if(U.startsWith("custom:")&&window.confirm(d("voice_ui.remove_confirm"))){v(!0);try{const z=U.slice(7);await o({"voice.tts.order":S.filter(P=>P!==U)},[`voice.tts.custom.${z}`]),await m(),await l(),e.success(d("voice_ui.toast_provider_removed"))}catch(z){e.error(z.message)}finally{v(!1)}}},L=async(U,z)=>{try{await o(U,z),e.success(d("voice_ui.toast_transcription_updated"))}catch(P){e.error(P.message)}};return s.jsxs("div",{"data-testid":"screen-voice",children:[s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[s.jsx(Ve,{title:d("voice_screen.providers_title"),description:d("voice_ui.providers_desc"),children:u||a?s.jsx(ot,{}):p?s.jsx(gt,{children:d("voice_ui.providers_load_error",{msg:p.message})}):s.jsx(qB,{engines:C,order:S,onToggleEnabled:M,onToggleEmotions:T,onReorder:O,onConfigure:U=>g(U),onRemove:B,onAddNew:()=>g("__new__"),busy:b})}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ve,{title:d("voice_screen.test_title"),description:d("voice_ui.test_desc"),children:s.jsx(YB,{engines:C,defaultProvider:j,mode:E})}),s.jsx(Ve,{title:d("voice_screen.stt_title"),description:d("voice_ui.stt_desc"),children:a?s.jsx(ot,{}):s.jsx(QB,{config:y,onPatch:L})})]})]}),s.jsx(FB,{open:!!h,providerId:h,config:R,onClose:()=>g(null),onSave:D})]})}function ZB(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 JB({manifest:e}){const t=e.daemon,a=e.safety;return s.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",s.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.deck_daemon_active",{uptime:ZB(t.uptime_s)})})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),s.jsx("span",{className:"text-muted-fg",children:"·"}),s.jsxs("span",{className:"text-muted-fg",children:[d("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[a.direct_shell===!1&&s.jsx(Fe,{tone:"success",children:d("modules_ui.deck_safety_no_shell")}),a.arbitrary_commands===!1&&s.jsx(Fe,{tone:"success",children:d("modules_ui.deck_safety_no_arbitrary")}),a.dangerous_actions_require_confirmation&&s.jsx(Fe,{tone:"info",children:d("modules_ui.deck_safety_confirm")})]})]})}function eU(e){return e==="available"?"success":e==="configured"?"info":"muted"}function tU(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function nU(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function sU({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 s.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:ke("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:[s.jsx(Ke,{content:e.source==="apx"?d("deck_screen.widget_native"):d("deck_screen.widget_external"),children:s.jsx("span",{className:ke("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"font-medium",children:e.title}),s.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),s.jsx(Fe,{tone:nU(e.kind),children:e.kind}),s.jsx(Fe,{tone:eU(e.status),children:tU(e.status)}),a?s.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:s.jsx(Wt,{checked:c,onChange:u,disabled:o||!t})}):s.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function aU({desktop:e,widgets:t,onToggle:a}){return t.length===0?null:s.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),s.jsx("ul",{className:"space-y-1.5",children:t.map(o=>s.jsx(sU,{widget:o,onToggle:o.source==="external"?l=>a(o.id,l):void 0},o.id))})]})}function rU(){nt();const{data:e,error:t,isLoading:a,mutate:o}=Ge("/deck/manifest",()=>YC.manifest(),{refreshInterval:3e4}),l=async(g,b)=>{},c=e?.deck.desktops??[],u=e?.deck.widgets??[],p=c.map(g=>({desktop:g,widgets:u.filter(b=>b.desktop===g.id)})),h=u.filter(g=>g.source==="external").filter(g=>g.user_enabled===!0).length;return s.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[s.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&&s.jsx(JB,{manifest:e}),s.jsxs(Ve,{title:d("deck_screen.widgets_title"),description:a?d("modules_ui.deck_loading_manifest"):t?d("modules_ui.deck_manifest_error"):d("modules_ui.deck_widgets_summary",{count:u.length,enabled:h}),action:s.jsx(Ke,{content:d("deck_screen.reload_manifest"),children:s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>o(),disabled:a,"aria-label":d("deck_screen.reload_manifest"),children:s.jsx(Ys,{size:14,className:a?"animate-spin":""})})}),children:[a&&s.jsx(ot,{label:d("modules_ui.deck_loading_manifest_full")}),!a&&t&&s.jsxs(gt,{children:[d("modules_ui.deck_manifest_load_failed")," ",s.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>o(),children:d("modules_ui.deck_retry")})]}),!a&&!t&&u.length===0&&s.jsx(gt,{children:d("modules_ui.deck_no_widgets")}),!a&&!t&&u.length>0&&s.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(g=>g.widgets.length>0).map(g=>s.jsx(aU,{desktop:g.desktop,widgets:g.widgets,onToggle:l},g.desktop.id))})]}),e?.apx&&s.jsx(Ve,{title:d("deck_screen.context_title"),description:d("modules_ui.deck_context_desc"),children:s.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.deck_active_project")}),s.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:d("modules_ui.deck_none")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.deck_registered_projects")}),s.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:d("modules_ui.deck_active_plugins")}),s.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),s.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:s.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[s.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:s.jsx(s3,{className:"size-6 text-muted-fg"})}),s.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:d("deck_screen.preview_badge")}),s.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:d("deck_screen.preview_title")}),s.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:d("deck_screen.preview_body")})]})})]})}const oU=[{title:d("settings.account_section"),items:[{key:"identity",label:d("settings.tabs.identity"),icon:db}]},{title:d("settings.agents_section"),items:[{key:"super_agent",label:d("settings.tabs.super_agent"),icon:rn},{key:"engines",label:d("settings.tabs.engines"),icon:sb},{key:"memory",label:"Memory (RAG)",icon:bS},{key:"skills",label:"Skills (RAG)",icon:er}]},{title:d("settings.channels_section"),items:[{key:"telegram",label:d("settings.tabs.telegram"),icon:Qs},{key:"devices",label:d("settings.tabs.devices"),icon:z3}]},{title:d("settings.modules_section"),items:[{key:"voice",label:d("nav.modules.voice"),icon:kS},{key:"desktop",label:d("nav.modules.desktop"),icon:cb},{key:"deck",label:d("nav.modules.deck"),icon:S3},{key:"web",label:d("nav.modules.web"),icon:b3}]},{title:d("settings.advanced_section"),items:[{key:"advanced",label:d("settings.tabs.advanced"),icon:df}]}],lU=new Set(["engines","telegram","memory","skills","web","voice"]),iU={identity:()=>s.jsx(H7,{}),super_agent:()=>s.jsx(q7,{}),engines:()=>s.jsx(zN,{}),memory:()=>s.jsx(G7,{}),skills:()=>s.jsx(K7,{}),telegram:()=>s.jsx(J7,{}),devices:()=>s.jsx(NB,{}),voice:()=>s.jsx(WB,{}),deck:()=>s.jsx(rU,{}),desktop:()=>s.jsx(HB,{}),web:()=>s.jsx(AB,{}),advanced:()=>s.jsx(TB,{})};function cU(){const e=Ln(),t=es(),a=uU(t.pathname),o=iU[a],{collapsed:l,toggle:c}=c_(On.sidebarCollapsed+".settings");return s.jsx(xN,{sections:oU,active:a,onChange:u=>e(u==="identity"?"/settings":`/settings/${dU(u)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${lU.has(a)?"":"mx-auto max-w-3xl"} space-y-6 py-6 pt-3 pr-6 pl-4`,testId:`settings-tab-${a}`,children:s.jsx(o,{})})}function uU(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"web":return"web";case"appearance":return"web";case"config":case"advanced":return"advanced";default:return"identity"}}function dU(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function fU(){const{data:e,isLoading:t,mutate:a}=Ge("/messages/global?channel=desktop",()=>IB(40),{refreshInterval:8e3});return s.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{children:s.jsx(wE,{showConfigLink:!0})}),s.jsx("div",{children:s.jsx(Ve,{title:d("desktop_screen.last_conv_title"),description:d("modules_ui.desktop_last_conv_desc"),action:s.jsx("button",{type:"button",onClick:()=>a(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:d("modules_ui.desktop_refresh")}),children:s.jsx(pU,{messages:e||[],loading:t})})})]})})}function pU({messages:e,loading:t}){const a=x.useMemo(()=>hU(e),[e]);return t?s.jsx(ot,{}):e.length?s.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:a.slice().reverse().map((o,l)=>s.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,u)=>s.jsx(mU,{m:c},u))},l))}):s.jsx(gt,{children:d("modules_ui.desktop_no_messages")})}function mU({m:e}){const t=e.direction==="in",a=gU(e.ts);return s.jsxs("div",{className:"py-1",children:[s.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[s.jsx("span",{className:"font-semibold",children:d(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),s.jsx("span",{children:a})]}),s.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||s.jsx("span",{className:"italic opacity-50",children:d("modules_ui.desktop_empty_msg")})})]})}function hU(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 gU(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 xU(e,t){const a=getComputedStyle(e),o=parseFloat(a.fontSize);return t*o}function bU(e,t){const a=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(a.fontSize);return t*o}function _U(e){return e/100*window.innerHeight}function vU(e){return e/100*window.innerWidth}function yU(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 Nc({groupSize:e,panelElement:t,styleProp:a}){let o;const[l,c]=yU(a);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=bU(t,l);break}case"em":{o=xU(t,l);break}case"vh":{o=_U(l);break}case"vw":{o=vU(l);break}}return o}function Zn(e){return parseFloat(e.toFixed(3))}function Jl({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 Hx(e){const{panels:t}=e,a=Jl({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 g=Nc({groupSize:a,panelElement:l,styleProp:c.collapsedSize});u=Zn(g/a*100)}let p;if(c.defaultSize!==void 0){const g=Nc({groupSize:a,panelElement:l,styleProp:c.defaultSize});p=Zn(g/a*100)}let m=0;if(c.minSize!==void 0){const g=Nc({groupSize:a,panelElement:l,styleProp:c.minSize});m=Zn(g/a*100)}let h=100;if(c.maxSize!==void 0){const g=Nc({groupSize:a,panelElement:l,styleProp:c.maxSize});h=Zn(g/a*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:u,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:h,panelId:o.id}})}function qt(e,t="Assertion error"){if(!e)throw Error(t)}function qx(e,t){return Array.from(t).sort(e==="horizontal"?jU:wU)}function jU(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return a!==0?a:e.element.offsetWidth-t.element.offsetWidth}function wU(e,t){const a=e.element.offsetTop-t.element.offsetTop;return a!==0?a:e.element.offsetHeight-t.element.offsetHeight}function kE(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function SE(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 kU({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}=SE(o,u),h=e==="horizontal"?p:m;h<c&&(c=h,l=u)}return qt(l,"No rect found"),l}let Yd;function SU(){return Yd===void 0&&(typeof matchMedia=="function"?Yd=!!matchMedia("(pointer:coarse)").matches:Yd=!1),Yd}function CE(e){const{element:t,orientation:a,panels:o,separators:l}=e,c=qx(a,Array.from(t.children).filter(kE).map(N=>({element:N}))).map(({element:N})=>N),u=[];let p=!1,m=!1,h=-1,g=-1,b=0,v,w=[];{let N=-1;for(const y of c)y.hasAttribute("data-panel")&&(N++,y.hasAttribute("data-disabled")||(b++,h===-1&&(h=N),g=N))}if(b>1){let N=-1;for(const y of c)if(y.hasAttribute("data-panel")){N++;const j=o.find(E=>E.element===y);if(j){if(v){const E=v.element.getBoundingClientRect(),S=y.getBoundingClientRect();let C;if(m){const R=a==="horizontal"?new DOMRect(E.right,E.top,0,E.height):new DOMRect(E.left,E.bottom,E.width,0),M=a==="horizontal"?new DOMRect(S.left,S.top,0,S.height):new DOMRect(S.left,S.top,S.width,0);switch(w.length){case 0:{C=[R,M];break}case 1:{const T=w[0],O=kU({orientation:a,rects:[E,S],targetRect:T.element.getBoundingClientRect()});C=[T,O===E?M:R];break}default:{C=w;break}}}else w.length?C=w:C=[a==="horizontal"?new DOMRect(E.right,S.top,S.left-E.right,S.height):new DOMRect(S.left,E.bottom,S.width,S.top-E.bottom)];for(const R of C){let M="width"in R?R:R.element.getBoundingClientRect();const T=SU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(M.width<T){const D=T-M.width;M=new DOMRect(M.x-D/2,M.y,M.width+D,M.height)}if(M.height<T){const D=T-M.height;M=new DOMRect(M.x,M.y-D/2,M.width,M.height+D)}const O=N<=h||N>g;!p&&!O&&u.push({group:e,groupSize:Jl({group:e}),panels:[v,j],separator:"width"in R?void 0:R,rect:M}),p=!1}}m=!1,v=j,w=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(p=!0);const j=l.find(E=>E.element===y);j?w.push(j):(v=void 0,w=[])}else m=!0}return u}class NE{#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(h){c===null&&(l=!0,c=h)}}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 Ul={cursorFlags:0,state:"inactive"};const $_=new NE;function Mo(){return Ul}function CU(e){return $_.addListener("change",e)}function NU(e){const t=Ul,a={...Ul};a.cursorFlags=e,Ul=a,$_.emit("change",{prev:t,next:a})}function $l(e){const t=Ul;Ul=e,$_.emit("change",{prev:t,next:e})}const EU=e=>e,Qg=()=>{},EE=1,RE=2,TE=4,AE=8,jk=3,wk=12;let Kd;function kk(){return Kd===void 0&&(Kd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Kd=!0)),Kd}function RU({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&&kk()){const c=(e&EE)!==0,u=(e&RE)!==0,p=(e&TE)!==0,m=(e&AE)!==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 kk()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const Sk=new WeakMap;function H_(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:a}=Sk.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=Mo();switch(o.state){case"active":case"hover":{const l=RU({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}}Sk.set(e,{prevStyle:t,styleSheet:a})}let ca=new Map;const ME=new NE;function TU(e){ca=new Map(ca),ca.delete(e)}function Ck(e,t){for(const[a]of ca)if(a.id===e)return a}function Dr(e,t){for(const[a,o]of ca)if(a.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Uo(){return ca}function q_(e,t){return ME.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function Ja(e,t,a){const o=ca.get(e);ca=new Map(ca),ca.set(e,t),ME.emit("groupChange",{group:e,isUserInteraction:a?.isUserInteraction===!0,prev:o,next:t})}function OE(e){const t=Mo();let a=!1;switch(t.state){case"active":$l({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(H_(e),a=!0,t.hitRegions.forEach(o=>{const l=Dr(o.group.id,!0);Ja(o.group,l,{isUserInteraction:!0})}))}return a}function Nk(e){e.defaultPrevented||OE(e.currentTarget)}function AU(e,t,a){let o,l={x:1/0,y:1/0};for(const c of t){const u=SE(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 MU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function OU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:Tk(e),b:Tk(t)};let o;for(;a.a.at(-1)===a.b.at(-1);)o=a.a.pop(),a.b.pop();qt(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:Rk(Ek(a.a)),b:Rk(Ek(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 zU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function DU(e){const t=getComputedStyle(zE(e)??e).display;return t==="flex"||t==="inline-flex"}function LU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||DU(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"||zU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Ek(e){let t=e.length;for(;t--;){const a=e[t];if(qt(a,"Missing node"),LU(a))return a}return null}function Rk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Tk(e){const t=[];for(;e;)t.push(e),e=zE(e);return t}function zE(e){const{parentNode:t}=e;return MU(t)?t.host:t}function PU(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 IU({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!kE(a)||a.contains(e)||e.contains(a))return!0;if(OU(a,e)>0){let o=a;for(;o;){if(o.contains(e))return!0;if(PU(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function V_(e,t){const a=[];return t.forEach((o,l)=>{if(l.disabled)return;const c=CE(l),u=AU(l.orientation,c,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&IU({groupElement:l.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&a.push(u.hitRegion)}),a}function BU(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 Yn(e,t,a=0){return Math.abs(Zn(e)-Zn(t))<=a}function ra(e,t){return Yn(e,t)?0:e>t?1:-1}function Ml({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(ra(o,m)<0)if(c){const h=(l+m)/2;ra(o,h)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Zn(o),o}function Yc({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:o,prevLayout:l,trigger:c}){if(Yn(e,0))return t;const u=c==="imperative-api",p=Object.values(t),m=Object.values(l),h=[...p],[g,b]=o;qt(g!=null,"Invalid first pivot index"),qt(b!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const y=e<0?b:g,j=a[y];qt(j,`Panel constraints not found for index ${y}`);const{collapsedSize:E=0,collapsible:S,minSize:C=0}=j;if(S){const R=p[y];if(qt(R!=null,`Previous layout not found for panel index ${y}`),Yn(R,E)){const M=C-R;ra(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}{const y=e<0?g:b,j=a[y];qt(j,`No panel constraints found for index ${y}`);const{collapsedSize:E=0,collapsible:S,minSize:C=0}=j;if(S){const R=p[y];if(qt(R!=null,`Previous layout not found for panel index ${y}`),Yn(R,C)){const M=R-E;ra(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}break}default:{const y=e<0?b:g,j=a[y];qt(j,`Panel constraints not found for index ${y}`);const E=p[y],{collapsible:S,collapsedSize:C,minSize:R}=j;if(S&&ra(E,R)<0)if(e>0){const M=R-C,T=M/2,O=E+e;ra(O,R)<0&&(e=ra(e,T)<=0?0:M)}else{const M=R-C,T=100-M/2,O=E-e;ra(O,R)<0&&(e=ra(100+e,T)>0?0:-M)}break}}{const y=e<0?1:-1;let j=e<0?b:g,E=0;for(;;){const C=p[j];qt(C!=null,`Previous layout not found for panel index ${j}`);const R=Ml({overrideDisabledPanels:u,panelConstraints:a[j],prevSize:C,size:100})-C;if(E+=R,j+=y,j<0||j>=a.length)break}const S=Math.min(Math.abs(e),Math.abs(E));e=e<0?0-S:S}{let y=e<0?g:b;for(;y>=0&&y<a.length;){const j=Math.abs(e)-Math.abs(v),E=p[y];qt(E!=null,`Previous layout not found for panel index ${y}`);const S=E-j,C=Ml({overrideDisabledPanels:u,panelConstraints:a[y],prevSize:E,size:S});if(!Yn(E,C)&&(v+=E-C,h[y]=C,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(BU(m,h))return l;{const y=e<0?b:g,j=p[y];qt(j!=null,`Previous layout not found for panel index ${y}`);const E=j+v,S=Ml({overrideDisabledPanels:u,panelConstraints:a[y],prevSize:j,size:E});if(h[y]=S,!Yn(S,E)){let C=E-S,R=e<0?b:g;for(;R>=0&&R<a.length;){const M=h[R];qt(M!=null,`Previous layout not found for panel index ${R}`);const T=M+C,O=Ml({overrideDisabledPanels:u,panelConstraints:a[R],prevSize:M,size:T});if(Yn(M,O)||(C-=O-M,h[R]=O),Yn(C,0))break;e>0?R--:R++}}}const w=Object.values(h).reduce((y,j)=>j+y,0);if(!Yn(w,100,.1))return l;const N=Object.keys(l);return h.reduce((y,j,E)=>(y[N[E]]=j,y),{})}function Oo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(t[a]===void 0||ra(e[a],t[a])!==0)return!1;return!0}function zo({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(!Yn(l,100)&&o.length>0)for(let p=0;p<t.length;p++){const m=o[p];qt(m!=null,`No layout data found for index ${p}`);const h=100/l*m;o[p]=h}let c=0;for(let p=0;p<t.length;p++){const m=a[p];qt(m!=null,`No layout data found for index ${p}`);const h=o[p];qt(h!=null,`No layout data found for index ${p}`);const g=Ml({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:h});h!=g&&(c+=h-g,o[p]=g)}if(!Yn(c,0))for(let p=0;p<t.length;p++){const m=o[p];qt(m!=null,`No layout data found for index ${p}`);const h=m+c,g=Ml({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:h});if(m!==g&&(c-=g-m,o[p]=g,Yn(c,0)))break}const u=Object.keys(e);return o.reduce((p,m,h)=>(p[u[h]]=m,p),{})}function DE({groupId:e,panelId:t}){const a=()=>{const m=Uo();for(const[h,{defaultLayoutDeferred:g,derivedPanelConstraints:b,layout:v,groupSize:w,separatorToPanels:N}]of m)if(h.id===e)return{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:h,groupSize:w,layout:v,separatorToPanels:N};throw Error(`Group ${e} not found`)},o=()=>{const m=a().derivedPanelConstraints.find(h=>h.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{const m=a().group.panels.find(h=>h.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:h,prevLayout:g,derivedPanelConstraints:b})=>{const v=c(),w=h.findIndex(j=>j.id===t),N=w===0,y=w===h.length-1;if(y&&m<v&&(N||h.slice(0,w).every((j,E)=>{const S=b[E];return S?.collapsible&&Yn(S.collapsedSize,g[S.panelId])}))){const j=h.slice(0,w).reduce((E,S)=>E+g[S.id],0);return{...g,[t]:Zn(100-j)}}return Yc({delta:y?v-m:m-v,initialLayout:g,panelConstraints:b,pivotIndices:y?[w-1,w]:[w,w+1],prevLayout:g,trigger:"imperative-api"})},p=m=>{const h=c();if(m===h)return;const{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:v,groupSize:w,layout:N,separatorToPanels:y}=a(),j=u({nextSize:m,panels:v.panels,prevLayout:N,derivedPanelConstraints:b}),E=zo({layout:j,panelConstraints:b});Oo(N,E)||Ja(v,{defaultLayoutDeferred:g,derivedPanelConstraints:b,groupSize:w,layout:E,separatorToPanels:y})};return{collapse:()=>{const{collapsible:m,collapsedSize:h}=o(),{mutableValues:g}=l(),b=c();m&&b!==h&&(g.expandToSize=b,p(h))},expand:()=>{const{collapsible:m,collapsedSize:h,minSize:g}=o(),{mutableValues:b}=l(),v=c();if(m&&v===h){let w=b.expandToSize??g;w===0&&(w=1),p(w)}},getSize:()=>{const{group:m}=a(),h=c(),{element:g}=l(),b=m.orientation==="horizontal"?g.offsetWidth:g.offsetHeight;return{asPercentage:h,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:h}=o(),g=c();return m&&Yn(h,g)},resize:m=>{const{group:h}=a(),{element:g}=l(),b=Jl({group:h}),v=Nc({groupSize:b,panelElement:g,styleProp:m}),w=Zn(v/b*100);p(w)}}}function Ak(e){if(e.defaultPrevented)return;const t=Uo();V_(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=DE({groupId:a.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function nf(e){const t=Uo();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 LE({groupId:e}){const t=()=>{const a=Uo();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(),h=zo({layout:a,panelConstraints:l});return o?p:(Oo(p,h)||Ja(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:u,layout:h,separatorToPanels:m}),h)}}}function ho(e,t){const a=nf(e),o=Dr(a.id,!0),l=a.separators.find(g=>g.element===e);qt(l,"Matching separator not found");const c=o.separatorToPanels.get(l);qt(c,"Matching panels not found");const u=c.map(g=>a.panels.indexOf(g)),p=LE({groupId:a.id}).getLayout(),m=Yc({delta:t,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:p,trigger:"keyboard"}),h=zo({layout:m,panelConstraints:o.derivedPanelConstraints});Oo(p,h)||Ja(a,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:h,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Mk(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=nf(t);if(!a.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),a.orientation==="vertical"&&ho(t,5);break}case"ArrowLeft":{e.preventDefault(),a.orientation==="horizontal"&&ho(t,-5);break}case"ArrowRight":{e.preventDefault(),a.orientation==="horizontal"&&ho(t,5);break}case"ArrowUp":{e.preventDefault(),a.orientation==="vertical"&&ho(t,-5);break}case"End":{e.preventDefault(),ho(t,100);break}case"Enter":{e.preventDefault();const o=nf(t),l=Dr(o.id,!0),{derivedPanelConstraints:c,layout:u,separatorToPanels:p}=l,m=o.separators.find(v=>v.element===t);qt(m,"Matching separator not found");const h=p.get(m);qt(h,"Matching panels not found");const g=h[0],b=c.find(v=>v.panelId===g.id);if(qt(b,"Panel metadata not found"),b.collapsible){const v=u[g.id],w=b.collapsedSize===v?o.mutableState.expandedPanelSizes[g.id]??b.minSize:b.collapsedSize;ho(t,w-v)}break}case"F6":{e.preventDefault();const o=nf(t).separators.map(u=>u.element),l=Array.from(o).findIndex(u=>u===e.currentTarget);qt(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(),ho(t,-100);break}}}function Ok(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Uo(),a=V_(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)}),$l({cursorFlags:0,hitRegions:a,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}function PE({document:e,event:t,hitRegions:a,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:u}){let p=0;a.forEach(h=>{const{group:g,groupSize:b}=h,{orientation:v,panels:w}=g,{disableCursor:N}=g.mutableState;let y=0;c?v==="horizontal"?y=(t.clientX-c.x)/b*100:y=(t.clientY-c.y)/b*100:v==="horizontal"?y=t.clientX<0?-100:100:y=t.clientY<0?-100:100;const j=o.get(g),E=l.get(g);if(!j||!E)return;const{defaultLayoutDeferred:S,derivedPanelConstraints:C,groupSize:R,layout:M,separatorToPanels:T}=E;if(C&&M&&T){const O=Yc({delta:y,initialLayout:j,panelConstraints:C,pivotIndices:h.panels.map(D=>w.indexOf(D)),prevLayout:M,trigger:"mouse-or-touch"});if(Oo(O,M)){if(y!==0&&!N)switch(v){case"horizontal":{p|=y<0?EE:RE;break}case"vertical":{p|=y<0?TE:AE;break}}}else Ja(h.group,{defaultLayoutDeferred:S,derivedPanelConstraints:C,groupSize:R,layout:O,separatorToPanels:T})}});let m=0;t.movementX===0?m|=u&jk:m|=p&jk,t.movementY===0?m|=u&wk:m|=p&wk,NU(m),H_(e)}function zk(e){const t=Uo(),a=Mo();switch(a.state){case"active":PE({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}}function Dk(e){if(e.defaultPrevented)return;const t=Mo(),a=Uo();switch(t.state){case"active":{if(e.buttons===0){$l({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=Dr(o.group.id,!0);Ja(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)}PE({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=V_(e,a);o.length===0?t.state!=="inactive"&&$l({cursorFlags:0,state:"inactive"}):$l({cursorFlags:0,hitRegions:o,state:"hover"}),H_(e.currentTarget);break}}}function Lk(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Mo().state){case"hover":$l({cursorFlags:0,state:"inactive"})}}function Pk(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||OE(e.currentTarget)&&e.preventDefault()}function Ik(e){let t=0,a=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const u=Zn(c.defaultSize);a+=u,o[c.panelId]=u}else o[c.panelId]=void 0;const l=e.length-t;if(l!==0){const c=Zn((100-a)/l);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=c)}return o}function UU(e,t,a){if(!a[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const l=Jl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,p={asPercentage:Zn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,u)}function $U(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 HU({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 w=v/100*a,N=Zn(w/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 h=100-l,g={...o};if(p.forEach((b,v)=>{g[v]=b}),c>0)for(const b of m){const v=o[b]??0;g[b]=Zn(v/c*h)}else{const b=Zn(h/m.length);for(const v of m)g[v]=b}return g}function qU(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 El=new Map;function VU(e){let t=!0;qt(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 y of N){const{borderBoxSize:j,target:E}=y;if(E===e.element){if(t){const S=Jl({group:e});if(S===0)return;const C=Dr(e.id);if(!C)return;const R=Hx(e),M=C.defaultLayoutDeferred?Ik(R):C.layout,T=HU({group:e,nextGroupSize:S,prevGroupSize:C.groupSize,prevLayout:M}),O=zo({layout:T,panelConstraints:R});if(!C.defaultLayoutDeferred&&Oo(C.layout,O)&&$U(C.derivedPanelConstraints,R)&&C.groupSize===S)return;Ja(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:S,layout:O,separatorToPanels:C.separatorToPanels})}}else UU(e,E,j)}});c.observe(e.element),e.panels.forEach(N=>{qt(!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=Jl({group:e}),p=Hx(e),m=e.panels.map(({id:N})=>N).join(",");let h=e.mutableState.defaultLayout;h&&(qU(e.panels,h)||(h=void 0));const g=e.mutableState.layouts[m]??h??Ik(p),b=zo({layout:g,panelConstraints:p}),v=e.element.ownerDocument;El.set(v,(El.get(v)??0)+1);const w=new Map;return CE(e).forEach(N=>{N.separator&&w.set(N.separator,N.panels)}),Ja(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:p,groupSize:u,layout:b,separatorToPanels:w}),e.separators.forEach(N=>{qt(!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",Mk)}),El.get(v)===1&&(v.addEventListener("contextmenu",Nk,!0),v.addEventListener("dblclick",Ak,!0),v.addEventListener("pointerdown",Ok,!0),v.addEventListener("pointerleave",zk),v.addEventListener("pointermove",Dk),v.addEventListener("pointerout",Lk),v.addEventListener("pointerup",Pk,!0)),function(){t=!1,El.set(v,Math.max(0,(El.get(v)??0)-1)),TU(e),e.separators.forEach(N=>{N.element.removeEventListener("keydown",Mk)}),El.get(v)||(v.removeEventListener("contextmenu",Nk,!0),v.removeEventListener("dblclick",Ak,!0),v.removeEventListener("pointerdown",Ok,!0),v.removeEventListener("pointerleave",zk),v.removeEventListener("pointermove",Dk),v.removeEventListener("pointerout",Lk),v.removeEventListener("pointerup",Pk,!0)),c.disconnect()}}function FU(){const[e,t]=x.useState({}),a=x.useCallback(()=>t({}),[]);return[e,a]}function F_(e){const t=x.useId();return`${e??t}`}const $o=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Dc(e){const t=x.useRef(e);return $o(()=>{t.current=e},[e]),x.useCallback((...a)=>t.current?.(...a),[t])}function G_(...e){return Dc(t=>{e.forEach(a=>{if(a)switch(typeof a){case"function":{a(t);break}case"object":{a.current=t;break}}})})}function Y_(e){const t=x.useRef({...e});return $o(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const IE=x.createContext(null);function GU(e,t){const a=x.useRef({getLayout:()=>({}),setLayout:EU});x.useImperativeHandle(t,()=>a.current,[]),$o(()=>{Object.assign(a.current,LE({groupId:e}))})}function Vx({children:e,className:t,defaultLayout:a,disableCursor:o,disabled:l,elementRef:c,groupRef:u,id:p,onLayoutChange:m,onLayoutChanged:h,orientation:g="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:v,...w}){const N=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=Dc(U=>{Oo(N.current.onLayoutChange,U)||(N.current.onLayoutChange=U,m?.(U))}),j=Dc((U,z)=>{Oo(N.current.onLayoutChanged,U)||(N.current.onLayoutChanged=U,h?.(U,{isUserInteraction:z}))}),E=F_(p),S=x.useRef(null),[C,R]=FU(),M=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=G_(S,c);GU(E,u);const O=Dc((U,z)=>{const P=Mo(),$=Ck(U),V=Dr(U);if(V){let q=!1;switch(P.state){case"active":{q=P.hitRegions.some(X=>X.group===$);break}}return{flexGrow:V.layout[z]??1,pointerEvents:q?"none":void 0}}if(a?.[z])return{flexGrow:a?.[z]}}),D=Y_({defaultLayout:a,disableCursor:o}),B=x.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:O,id:E,orientation:g,registerPanel:U=>{const z=M.current;return z.panels=qx(g,[...z.panels,U]),R(),()=>{z.panels=z.panels.filter(P=>P!==U),R()}},registerSeparator:U=>{const z=M.current;return z.separators=qx(g,[...z.separators,U]),R(),()=>{z.separators=z.separators.filter(P=>P!==U),R()}},updatePanelProps:(U,{disabled:z})=>{const P=M.current.panels.find(q=>q.id===U);P&&(P.panelConstraints.disabled=z);const $=Ck(E),V=Dr(E);$&&V&&Ja($,{...V,derivedPanelConstraints:Hx($)})},updateSeparatorProps:(U,{disabled:z,disableDoubleClick:P})=>{const $=M.current.separators.find(V=>V.id===U);$&&($.disabled=z,$.disableDoubleClick=P)}}),[O,E,R,g,D]),L=x.useRef(null);return $o(()=>{const U=S.current;if(U===null)return;const z=M.current;let P;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===z.panels.length){P={};for(const G of z.panels){const I=D.defaultLayout[G.id];I!==void 0&&(P[G.id]=I)}}const $={disabled:!!l,element:U,id:E,mutableState:{defaultLayout:P,disableCursor:!!D.disableCursor,expandedPanelSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:g,panels:z.panels,resizeTargetMinimumSize:z.resizeTargetMinimumSize,separators:z.separators};L.current=$;const V=VU($),{defaultLayoutDeferred:q,derivedPanelConstraints:X,layout:K}=Dr($.id,!0);!q&&X.length>0&&(y(K),j(K,!1));const F=q_(E,G=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:Y,layout:Z}=G.next;if(I||Y.length===0)return;const te=$.panels.map(({id:ee})=>ee).join(",");$.mutableState.layouts[te]=Z,Y.forEach(ee=>{if(ee.collapsible){const{layout:se}=G.prev??{};if(se){const re=Yn(ee.collapsedSize,Z[ee.panelId]),me=Yn(ee.collapsedSize,se[ee.panelId]);re&&!me&&($.mutableState.expandedPanelSizes[ee.panelId]=se[ee.panelId])}}});const fe=Mo().state!=="active";y(Z),fe&&j(Z,G.isUserInteraction)});return()=>{L.current=null,V(),F()}},[l,E,j,y,g,C,D]),x.useEffect(()=>{const U=L.current;U&&(U.mutableState.defaultLayout=a,U.mutableState.disableCursor=!!o)}),s.jsx(IE.Provider,{value:B,children:s.jsx("div",{...w,className:t,"data-group":!0,"data-testid":E,id:E,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}Vx.displayName="Group";function K_(){const e=x.useContext(IE);return qt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function YU(e,t){const{id:a}=K_(),o=x.useRef({collapse:Qg,expand:Qg,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Qg});x.useImperativeHandle(t,()=>o.current,[]),$o(()=>{Object.assign(o.current,DE({groupId:a,panelId:e}))})}function xo({children:e,className:t,collapsedSize:a="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:u,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:h="100%",minSize:g="0%",onResize:b,panelRef:v,style:w,...N}){const y=!!m,j=F_(m),E=Y_({disabled:c}),S=x.useRef(null),C=G_(S,u),{getPanelStyles:R,id:M,orientation:T,registerPanel:O,updatePanelProps:D}=K_(),B=b!==null,L=Dc(($,V,q)=>{b?.($,m,q)});$o(()=>{const $=S.current;if($!==null){const V={element:$,id:j,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?L:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:a,collapsible:o,defaultSize:l,disabled:E.disabled,maxSize:h,minSize:g}};return O(V)}},[p,a,o,l,B,j,y,h,g,L,O,E]),x.useEffect(()=>{D(j,{disabled:c})},[c,j,D]),YU(j,v);const U=()=>{const $=R(M,j);if($)return JSON.stringify($)},z=x.useSyncExternalStore($=>q_(M,$),U,U);let P;return z?P=JSON.parse(z):l!==void 0?P={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:P={flexGrow:1},s.jsx("div",{...N,"data-disabled":c||void 0,"data-panel":!0,"data-testid":j,id:j,ref:C,style:{...KU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...P},children:s.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...w,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}xo.displayName="Panel";const KU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function XU({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,h=p.collapsible?p.collapsedSize:p.minSize,g=[o,o+1];c=zo({layout:Yc({delta:h-u,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[a],l=zo({layout:Yc({delta:m-u,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:l,valueMin:c,valueNow:u}}function X_({children:e,className:t,disabled:a,disableDoubleClick:o,elementRef:l,id:c,style:u,...p}){const m=F_(c),h=Y_({disabled:a,disableDoubleClick:o}),[g,b]=x.useState({}),[v,w]=x.useState("inactive"),[N,y]=x.useState(!1),j=x.useRef(null),E=G_(j,l),{disableCursor:S,id:C,orientation:R,registerSeparator:M,updateSeparatorProps:T}=K_(),O=R==="horizontal"?"vertical":"horizontal";$o(()=>{const L=j.current;if(L!==null){const U={disabled:h.disabled,disableDoubleClick:h.disableDoubleClick,element:L,id:m},z=M(U),P=CU(V=>{w(V.next.state!=="inactive"&&V.next.hitRegions.some(q=>q.separator===U)?V.next.state:"inactive")}),$=q_(C,V=>{const{derivedPanelConstraints:q,layout:X,separatorToPanels:K}=V.next,F=K.get(U);if(F){const G=F[0],I=F.indexOf(G);b(XU({layout:X,panelConstraints:q,panelId:G.id,panelIndex:I}))}});return()=>{P(),$(),z()}}},[C,m,M,h]),x.useEffect(()=>{T(m,{disabled:a,disableDoubleClick:o})},[a,o,m,T]);let D;a&&!S&&(D="not-allowed");let B;if(a)B="disabled";else switch(v){case"active":{B="active";break}default:N?B="focus":B=v}return s.jsx("div",{...p,"aria-controls":g.valueControls,"aria-disabled":a||void 0,"aria-orientation":O,"aria-valuemax":g.valueMax,"aria-valuemin":g.valueMin,"aria-valuenow":g.valueNow,children:e,className:t,"data-separator":B,"data-testid":m,id:m,onBlur:()=>y(!1),onFocus:()=>y(!0),ref:E,role:"separator",style:{flexBasis:"auto",cursor:D,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:a?void 0:0})}X_.displayName="Separator";function QU({projects:e,value:t,onChange:a,disabled:o}){const l=e.map(c=>{const u=c.path?.split("/").filter(Boolean).pop()||d("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||u,icon:m3,description:c.path}});return s.jsx("div",{className:"w-full","data-testid":"code-project-select",children:s.jsx(dt,{value:t,onChange:a,options:l,placeholder:d("modules_ui.code_pick_project_ph"),disabled:o})})}function WU({sessions:e,activeId:t,busy:a,onSelect:o,onCreate:l,onRename:c,onDelete:u}){return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:d("code_module.sessions")}),s.jsx(Ke,{content:d("code_module.new_session"),children:s.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:[s.jsx(Kt,{className:"size-3"})," ",d("code_module.new_session")]})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?s.jsx("div",{className:"p-2",children:s.jsx(gt,{children:d("code_module.no_sessions")})}):s.jsx("ul",{className:"space-y-0.5",children:e.map(p=>s.jsxs("li",{className:"group/item relative",children:[s.jsxs("button",{type:"button",onClick:()=>o(p.id),className:ke("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:[s.jsx(ib,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-medium",children:p.title}),s.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),s.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[s.jsx(Ke,{content:d("code_module.rename"),children:s.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:s.jsx(ga,{className:"size-3"})})}),s.jsx(Ke,{content:d("code_module.delete"),children:s.jsx("button",{type:"button",onClick:()=>u(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:s.jsx(wn,{className:"size-3"})})})]})]},p.id))})})]})}function ZU({mode:e,onChange:t,disabled:a}){const o=(l,c,u,p)=>s.jsx(Ke,{content:u,children:s.jsxs("button",{type:"button",disabled:a,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>t(l),className:ke("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:[s.jsx(p,{className:"size-3.5"})," ",c]})});return s.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",d("code_module.mode_build"),d("code_module.mode_build_hint"),_3),o("plan",d("code_module.mode_plan"),d("code_module.mode_plan_hint"),e3)]})}function JU({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,mode:u,onModeChange:p,model:m,onModelChange:h}){return s.jsx(L_,{value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,placeholder:d("code_module.placeholder"),minRows:1,maxRows:6,footer:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ZU,{mode:u,onChange:p,disabled:l}),s.jsx(P_,{value:m,onChange:h,disabled:l})]})})}function Wg(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 e9(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 t9(e){let t=0,a=0,o=0;for(const u of e)u.role==="user"?t+=Wg(u,{text:!0}):a+=Wg(u,{text:!0}),o+=Wg(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 Bk={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ha({label:e,value:t}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function Uk(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 n9({turns:e,session:t}){const a=x.useMemo(()=>e9(e),[e]),o=x.useMemo(()=>t9(e),[e]);return e.length===0?s.jsx("div",{className:"p-3",children:s.jsx(gt,{children:d("code_module.ctx_none")})}):s.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[s.jsx(Ha,{label:d("code_module.ctx_model"),value:a.model||d("modules_ui.code_ctx_auto")}),t?.mode&&s.jsx(Ha,{label:d("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&s.jsx(Ha,{label:d("modules_ui.code_ctx_agent"),value:t.agentSlug}),s.jsx(Ha,{label:d("code_module.ctx_messages"),value:d("modules_ui.code_ctx_msgs_value",{user:a.userMsgs,assistant:a.assistantMsgs})}),s.jsx(Ha,{label:d("code_module.ctx_input"),value:a.input.toLocaleString()}),s.jsx(Ha,{label:d("code_module.ctx_output"),value:a.output.toLocaleString()}),s.jsx(Ha,{label:d("modules_ui.code_ctx_tokens_total"),value:(a.input+a.output).toLocaleString()}),t?.createdAt&&s.jsx(Ha,{label:d("modules_ui.code_ctx_created"),value:Uk(t.createdAt)}),t?.updatedAt&&s.jsx(Ha,{label:d("modules_ui.code_ctx_activity"),value:Uk(t.updatedAt)}),s.jsx("hr",{className:"border-border my-2"}),s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:d("code_module.ctx_breakdown")}),o.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>s.jsx(Ke,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:s.jsx("div",{className:Bk[l.key],style:{width:`${l.percent}%`}})},l.key))}),s.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>s.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{className:`size-2 rounded-full ${Bk[l.key]}`}),s.jsx("span",{className:"flex-1 text-foreground/80",children:d(`code_module.seg_${l.key}`)}),s.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:d("code_module.ctx_none")})]})]})}function s9(e){const t=[];for(const a of(e||"").split(`
700
+ `))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 a9({patch:e}){const t=x.useMemo(()=>s9(e),[e]);return t.length?s.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:s.jsx("code",{className:"block",children:t.map((a,o)=>s.jsxs("div",{className:ke("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:[s.jsx("span",{className:"select-none opacity-50",children:a.kind==="add"?"+":a.kind==="del"?"-":" "}),a.text]},o))})}):null}const r9={added:nx,modified:cf,deleted:p3},o9={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 l9({file:e}){const[t,a]=x.useState(!1),o=r9[e.status];return s.jsxs("li",{className:"rounded-md border border-border",children:[s.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:[s.jsx(Do,{className:ke("size-3 shrink-0 transition-transform",t&&"rotate-90")}),s.jsx(o,{className:ke("size-3.5 shrink-0",o9[e.status])}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),s.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&s.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&s.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&s.jsx("div",{className:"border-t border-border p-1.5",children:s.jsx(a9,{patch:e.patch})})]})}function i9({changes:e,loading:t,onRefresh:a}){const o=e?.files||[];return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?d("code_module.changes_files",{n:o.length}):""}),s.jsx(Ke,{content:d("code_module.reload"),children:s.jsx("button",{type:"button",onClick:a,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?s.jsx(Dn,{size:12}):s.jsx(Ys,{className:"size-3"})})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?s.jsx(gt,{children:d("code_module.changes_no_git")}):o.length===0?s.jsx(gt,{children:d("code_module.changes_none")}):s.jsx("ul",{className:"space-y-1.5",children:o.map(l=>s.jsx(l9,{file:l},l.path))})})]})}const c9=[{value:"context",icon:Ff,label:"tab_context"},{value:"changes",icon:x3,label:"tab_changes"},{value:"artifacts",icon:R3,label:"tab_artifacts"}];function u9({pid:e,turns:t,changes:a,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:u,onEditArtifact:p}){const[m,h]=x.useState("context"),g=a?.files.length||0;return s.jsxs(kp,{value:m,onValueChange:h,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[s.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:s.jsx(Sp,{variant:"line",className:"w-full",children:c9.map(({value:b,icon:v,label:w})=>{const N=m===b,y=d(`code_module.${w}`);return s.jsx(Ke,{content:y,children:s.jsxs(ia,{value:b,className:N?"flex-1 min-w-0":"w-8 shrink-0",children:[s.jsx(v,{className:"size-3.5 shrink-0"}),N&&s.jsx("span",{className:"truncate text-xs",children:y}),b==="changes"&&g>0&&s.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:g})]})},b)})})}),s.jsx(Ls,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:s.jsx(n9,{turns:t,session:c})}),s.jsx(Ls,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(i9,{changes:a,loading:o,onRefresh:l})}),s.jsx(Ls,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(mE,{pid:e,onRunInTerminal:u,onEditArtifact:p})})]})}function d9(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 h=c.find(g=>g.name===l[p]);h||(h={name:l[p],path:u,type:m?"file":"dir",children:m?void 0:[]},c.push(h)),m||(c=h.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 BE({node:e,depth:t,onOpenFile:a,openDirs:o,toggleDir:l}){const c=e.type==="dir",u=c&&o.has(e.path);return s.jsxs("li",{children:[s.jsxs("button",{type:"button",onClick:()=>c?l(e.path):a(e.path),style:{paddingLeft:`${t*12+6}px`},className:ke("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?s.jsxs(s.Fragment,{children:[s.jsx(Do,{className:ke("size-3 shrink-0 transition-transform",u&&"rotate-90")}),u?s.jsx(ai,{className:"size-3.5 shrink-0 text-amber-400"}):s.jsx(yS,{className:"size-3.5 shrink-0 text-amber-400"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"size-3 shrink-0"}),s.jsx(_S,{className:"size-3.5 shrink-0 text-sky-400"})]}),s.jsx("span",{className:"truncate",children:e.name})]}),c&&u&&e.children&&e.children.length>0&&s.jsx("ul",{children:e.children.map(p=>s.jsx(BE,{node:p,depth:t+1,onOpenFile:a,openDirs:o,toggleDir:l},p.path))})]})}function f9({pid:e,projectPath:t,className:a,onOpenFile:o}){const[l,c]=x.useState([]),[u,p]=x.useState(!1),[m,h]=x.useState(!1),[g,b]=x.useState(()=>new Set),v=x.useCallback(async()=>{p(!0);try{const S=(await ie.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(`
701
+ `).map(C=>C.trim()).filter(Boolean);c(S),h(!0)}catch{h(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{b(new Set),v()},[v]);const w=x.useCallback(E=>{b(S=>{const C=new Set(S);return C.has(E)?C.delete(E):C.add(E),C})},[]),N=x.useCallback(()=>{b(new Set)},[]),y=d9(l),j=g.size>0;return s.jsxs("div",{className:ke("flex h-full flex-col",a),"data-testid":"code-file-tree",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Ke,{content:d("code_module.tree_collapse_all"),children:s.jsx("button",{type:"button",onClick:N,disabled:!j,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:s.jsx(WM,{className:"size-3"})})}),s.jsx(Ke,{content:d("code_module.reload"),children:s.jsx("button",{type:"button",onClick:()=>void v(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:u?s.jsx(Dn,{size:12}):s.jsx(Ys,{className:"size-3"})})})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?y.length===0?s.jsx("div",{className:"p-3",children:s.jsx(gt,{children:"Sin archivos"})}):s.jsx("ul",{children:y.map(E=>s.jsx(BE,{node:E,depth:0,onOpenFile:o??(()=>{}),openDirs:g,toggleDir:w},E.path))}):s.jsx("div",{className:"flex justify-center pt-6",children:s.jsx(Dn,{size:14})})})]})}function p9({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 h=l&&c!==t,g=async()=>{if(!(!o||!h)){m(!0);try{await o(c)}finally{m(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[s.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,h&&s.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&s.jsxs(s.Fragment,{children:[s.jsx(Ke,{content:d("code_module.discard_changes"),children:s.jsxs("button",{type:"button",onClick:()=>u(t),disabled:!h||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:[s.jsx(ri,{className:"size-3"}),"Descartar"]})}),s.jsx(Ke,{content:d("code_module.save_shortcut_hint"),children:s.jsxs("button",{type:"button",onClick:()=>void g(),disabled:!h||p,className:ke("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",h&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?s.jsx(Dn,{size:10}):s.jsx(oi,{className:"size-3"}),"Guardar"]})})]})]}),a?s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(Dn,{size:16})}):l?s.jsx("textarea",{value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),g())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:s.jsx("tbody",{children:t.split(`
702
+ `).map((b,v)=>s.jsxs("tr",{className:"hover:bg-accent/20",children:[s.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}),s.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},v))})})})]})}function m9({pid:e,className:t,initCmd:a,onClose:o}){const[l,c]=x.useState([]),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState([]),[v,w]=x.useState(-1),N=x.useRef(null),y=x.useRef(null);x.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{a&&(p(a),setTimeout(()=>y.current?.focus(),50))},[a]);const j=async S=>{const C=S.trim();if(C){b(R=>[C,...R.slice(0,49)]),w(-1),c(R=>[...R,{type:"cmd",text:`$ ${C}`}]),h(!0);try{const R=await ie.post("/run",{cmd:C,project:e});R.stdout&&c(M=>[...M,{type:"out",text:R.stdout}]),R.stderr&&c(M=>[...M,{type:"err",text:R.stderr}])}catch(R){c(M=>[...M,{type:"err",text:String(R.message)}])}finally{h(!1)}}},E=S=>{if(S.key==="Enter")j(u),p("");else if(S.key==="ArrowUp"){S.preventDefault();const C=Math.min(v+1,g.length-1);w(C),p(g[C]??"")}else if(S.key==="ArrowDown"){S.preventDefault();const C=Math.max(v-1,-1);w(C),p(C===-1?"":g[C]??"")}};return s.jsxs("div",{className:ke("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[s.jsx(Ka,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),s.jsx(Ke,{content:d("code_module.terminal_clear"),children:s.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(l3,{className:"size-3"})})}),s.jsx(Ke,{content:d("code_module.terminal_close"),children:s.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(Us,{className:"size-3"})})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>y.current?.focus(),children:[l.map((S,C)=>s.jsx("div",{className:ke("whitespace-pre-wrap break-all",S.type==="cmd"&&"text-emerald-400",S.type==="err"&&"text-rose-400",S.type==="out"&&"text-foreground/90"),children:S.text},C)),s.jsx("div",{ref:N})]}),s.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[s.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),s.jsx("input",{ref:y,value:u,onChange:S=>p(S.target.value),onKeyDown:E,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 xc="super-agent";function Zg(){return s.jsx(X_,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function h9(){return s.jsx(X_,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function g9(){const e=nt(),t=Ge("/projects",()=>cs.list()),a=x.useMemo(()=>t.data||[],[t.data]),[o,l]=x.useState(""),[c,u]=x.useState(null),[p,m]=x.useState(xc),[h,g]=x.useState([]),[b,v]=x.useState(""),[w,N]=x.useState(!1),[y,j]=x.useState(!0),[E,S]=x.useState(!0),[C,R]=x.useState(!1),[M,T]=x.useState(""),[O,D]=x.useState(!1),B=x.useRef(null),[L,U]=si(),z=x.useRef(!1),[P,$]=x.useState([]),[V,q]=x.useState("chat"),X=x.useCallback(xe=>{R(!0),T(xe)},[]);x.useEffect(()=>{!o&&a.length&&l(String(a[0].id))},[o,a]);const K=Ge(o?["code-sessions",o]:null,()=>$a.sessions.list(o)),F=Ge(o?["agents",o]:null,()=>ln.list(o)),G=Ge(o&&c?["code-session",o,c]:null,()=>$a.sessions.get(o,c)),I=Ge(o&&c?["code-changes",o,c]:null,()=>$a.changes(o,c));x.useEffect(()=>{const xe=K.data||[];!c&&xe.length&&u(xe[0].id),c&&xe.length&&!xe.some(Le=>Le.id===c)&&u(xe[0]?.id??null)},[K.data,c]),x.useEffect(()=>{G.data&&m(G.data.agentSlug||xc)},[G.data]),x.useEffect(()=>{w||(G.data?g(G.data.messages||[]):c||g([]))},[G.data,c,w]),x.useEffect(()=>()=>B.current?.abort(),[]);const Y=G.data,Z=Y?.mode==="plan"?"plan":"build",te=Y?.model||"",fe=xe=>{xe===o||w||(l(xe),u(null),g([]))},ee=xe=>{w||xe===c||(u(xe),g([]))},se=async()=>{if(!(!o||w))try{const xe=await $a.sessions.create(o,{title:d("code_module.untitled"),agentSlug:p!==xc?p:null});await K.mutate(),u(xe.id),g([])}catch(xe){e.error(xe.message)}},re=async(xe,Le)=>{const Xe=window.prompt(d("code_module.rename"),Le);if(!(!Xe||Xe===Le))try{await $a.sessions.update(o,xe,{title:Xe}),await K.mutate(),xe===c&&await G.mutate()}catch(it){e.error(it.message)}},me=async xe=>{if(!w&&window.confirm(d("code_module.delete_confirm")))try{await $a.sessions.remove(o,xe),xe===c&&(u(null),g([])),await K.mutate()}catch(Le){e.error(Le.message)}},Me=async xe=>{if(m(xe),!!c)try{await $a.sessions.update(o,c,{agentSlug:xe!==xc?xe:null}),await Promise.all([G.mutate(),K.mutate()])}catch(Le){e.error(Le.message)}},de=x.useCallback(async xe=>{if(c)try{await $a.sessions.update(o,c,xe),await Promise.all([G.mutate(),K.mutate()])}catch(Le){e.error(Le.message)}},[o,c,G,K,e]),he=()=>{B.current?.abort(),N(!1)},Ce=xe=>g(Le=>{const Xe=[...Le],it=Xe[Xe.length-1];return it&&it.role==="assistant"&&(Xe[Xe.length-1]=xe(it)),Xe}),we=async xe=>{const Le=(xe??b).trim();if(!Le||w||!o||!c)return;const Xe=new Date().toISOString();g(pt=>[...pt,{role:"user",parts:[{kind:"text",text:Le}],ts:Xe},{role:"assistant",parts:[],ts:Xe,pending:!0}]),v(""),N(!0);const it=new AbortController;B.current=it;const Qe=pt=>{if(pt.type==="error"){e.error(pt.error||d("modules_ui.code_stream_error"));return}Ce(Ot=>I_(Ot,pt))};try{await $a.stream(o,c,{prompt:Le},Qe,it.signal),Ce(pt=>({...pt,pending:!1}))}catch(pt){it.signal.aborted?Ce(Ot=>({...Ot,pending:!1,parts:[...Ot.parts,{kind:"text",text:d("code_module.stopped")}]})):(e.error(pt.message),g(Ot=>Ot.filter((Zt,Xt)=>Xt!==Ot.length-1)))}finally{B.current===it&&(B.current=null),N(!1),G.mutate(),K.mutate(),I.mutate()}},Be=async xe=>{try{await navigator.clipboard.writeText(xe),e.info(d("modules_ui.code_copied"))}catch{}},$e=x.useCallback(xe=>{q(xe),$(Le=>Le.some(Xe=>Xe.path===xe)?Le:[...Le,{path:xe,content:"",loading:!0}]),ie.post("/run",{cmd:`cat "${xe}"`,project:o}).then(Le=>{const Xe=Le.stdout||Le.stderr||d("modules_ui.code_file_empty");$(it=>it.map(Qe=>Qe.path===xe?{...Qe,content:Xe,loading:!1}:Qe))}).catch(Le=>{$(Xe=>Xe.map(it=>it.path===xe?{...it,content:d("modules_ui.code_file_error",{msg:Le.message}),loading:!1}:it))})},[o]),Se=x.useCallback(xe=>{$(Le=>Le.filter(Xe=>Xe.path!==xe)),q(Le=>Le===xe?"chat":Le)},[]),Te=x.useCallback(xe=>{const Le=`artifacts/${xe}`;q(Le),$(Xe=>Xe.some(it=>it.path===Le)?Xe:[...Xe,{path:Le,content:"",loading:!0,artifactName:xe}]),Ar.read(o,xe).then(Xe=>{$(it=>it.map(Qe=>Qe.path===Le?{...Qe,content:Xe.content,loading:!1}:Qe))}).catch(Xe=>{$(it=>it.map(Qe=>Qe.path===Le?{...Qe,content:d("modules_ui.code_file_error",{msg:Xe.message}),loading:!1}:Qe))})},[o]);x.useEffect(()=>{if(z.current)return;const xe=L.get("pid"),Le=L.get("cmd"),Xe=L.get("edit");if(!(!xe||!Le&&!Xe)){if(String(o)!==String(xe)){l(String(xe));return}z.current=!0,Xe&&Te(Xe),Le&&X(Le.endsWith(" ")?Le:Le+" "),U({},{replace:!0})}},[L,o,Te,X,U]);const ve=x.useCallback(async(xe,Le)=>{const Xe=P.find(it=>it.path===xe);if(Xe?.artifactName)try{await Ar.write(o,Xe.artifactName,Le),$(it=>it.map(Qe=>Qe.path===xe?{...Qe,content:Le}:Qe)),e.info(d("modules_ui.code_saved"))}catch(it){e.error(it.message)}},[P,o,e]),Ne=!t.isLoading&&a.length>0,De=x.useMemo(()=>{const xe=[{value:xc,label:d("modules_ui.code_super_agent"),icon:rn,description:d("modules_ui.code_super_agent_desc")}],Le=(F.data||[]).map(Xe=>({value:Xe.slug,label:Xe.slug,icon:rn,description:Xe.description||Xe.role||void 0}));return[...xe,...Le]},[F.data]),Pe=x.useMemo(()=>h,[h]),Ie=x.useMemo(()=>K.data?.find(xe=>xe.id===c)?.title||"",[K.data,c]),ue=x.useMemo(()=>a.find(xe=>String(xe.id)===o),[a,o]);DP(Ie);const[_e,qe]=x.useState(null),Re=w?null:fE(h),Oe=Re&&Re.turnKey!==_e,et=xe=>{we(xe)},rt=x.useCallback(()=>j(xe=>!xe),[]),vt=x.useCallback(()=>D(xe=>!xe),[]),Mt=x.useCallback(()=>R(xe=>!xe),[]),lt=x.useCallback(()=>S(xe=>!xe),[]),Rt=x.useMemo(()=>c?s.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:SS,open:y,toggle:rt,title:d("modules_ui.code_panel_sessions")},{Icon:ob,open:O,toggle:vt,title:d("modules_ui.code_panel_tree")},{Icon:Ka,open:C,toggle:Mt,title:d("modules_ui.code_panel_terminal")},{Icon:T3,open:E,toggle:lt,title:d("modules_ui.code_panel_context")}].map(({Icon:xe,open:Le,toggle:Xe,title:it})=>s.jsx(Ke,{content:it,children:s.jsx("button",{type:"button",onClick:Xe,"data-active":Le,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:s.jsx(xe,{className:"size-3.5"})})},it))}):null,[c,y,O,C,E,rt,vt,Mt,lt]);return PP(Rt),s.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?s.jsx(ot,{}):Ne?s.jsxs(Vx,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[s.jsx(xo,{id:"top",defaultSize:C?"55%":"100%",minSize:"20%",children:s.jsxs(Vx,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[y&&s.jsxs(s.Fragment,{children:[s.jsx(xo,{id:"left",defaultSize:"14%",minSize:"8%",children:s.jsxs("aside",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border p-2",children:s.jsx(QU,{projects:a,value:o,onChange:fe,disabled:w})}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(WU,{sessions:K.data||[],activeId:c,busy:w,onSelect:ee,onCreate:se,onRename:re,onDelete:me})}),s.jsx("div",{className:"shrink-0 border-t border-border p-2",children:s.jsx(dt,{value:p,onChange:Me,options:De,disabled:w,showIcon:!0})})]})}),s.jsx(Zg,{})]}),O&&s.jsxs(s.Fragment,{children:[s.jsx(xo,{id:"tree",defaultSize:"13%",minSize:"8%",children:s.jsx("div",{className:"h-full",children:s.jsx(f9,{pid:o,projectPath:ue?.path,onOpenFile:$e})})}),s.jsx(Zg,{})]}),s.jsx(xo,{id:"main",defaultSize:"50%",minSize:"20%",children:s.jsxs("div",{className:"flex h-full flex-col",children:[P.length>0&&s.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[s.jsxs("button",{type:"button",onClick:()=>q("chat"),"data-active":V==="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:[s.jsx(ib,{className:"size-3 shrink-0"}),d("modules_ui.code_chat_tab")]}),P.map(xe=>{const Le=xe.path.split("/").pop()??xe.path,Xe=V===xe.path;return s.jsxs("div",{"data-active":Xe,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:[s.jsx(Ke,{content:xe.path,children:s.jsx("button",{type:"button",onClick:()=>q(xe.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Le})}),s.jsx(Ke,{content:d("code_module.close"),children:s.jsx("button",{type:"button",onClick:()=>Se(xe.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:s.jsx(Us,{className:"size-2.5"})})})]},xe.path)})]}),V==="chat"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?h.length?s.jsx(B_,{msgs:h,onCopy:Be}):s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(gt,{children:d("code_module.empty_chat")})}):s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(gt,{children:d("code_module.pick_project")})})}),Oe&&Re&&s.jsx(dE,{turnKey:Re.turnKey,questions:Re.questions,onSubmit:et,onDismiss:()=>qe(Re.turnKey),disabled:w})]}):s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const xe=P.find(Le=>Le.path===V);return xe?s.jsx(p9,{path:xe.path,content:xe.content,loading:xe.loading,onSave:xe.artifactName?Le=>ve(xe.path,Le):void 0}):null})()}),s.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:s.jsx(JU,{value:b,onValueChange:v,onSubmit:()=>void we(),onStop:he,busy:w,disabled:!c,mode:Z,onModeChange:xe=>void de({mode:xe}),model:te,onModelChange:xe=>void de({model:xe||null})})})]})}),E&&s.jsxs(s.Fragment,{children:[s.jsx(Zg,{}),s.jsx(xo,{id:"right",defaultSize:"22%",minSize:"15%",children:s.jsx("aside",{className:"flex h-full flex-col",children:s.jsx(u9,{pid:o,turns:Pe,changes:I.data,changesLoading:I.isLoading,onRefreshChanges:()=>void I.mutate(),session:G.data?{title:G.data.title,mode:G.data.mode,createdAt:G.data.createdAt,updatedAt:G.data.updatedAt,agentSlug:G.data.agentSlug??null}:null,onRunInTerminal:X,onEditArtifact:Te})})})]})]})}),C&&o&&s.jsxs(s.Fragment,{children:[s.jsx(h9,{}),s.jsx(xo,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:s.jsx(m9,{pid:o,initCmd:M,onClose:Mt,className:"h-full"})})]})]}):s.jsx("div",{className:"grid flex-1 place-items-center",children:s.jsx(gt,{children:d("code_module.no_projects")})})})}function x9({open:e,onClose:t}){const{mutate:a}=VC(),o=Ln(),l=nt(),[c,u]=x.useState(""),[p,m]=x.useState(!1),[h,g]=x.useState(""),[b,v]=x.useState([]),[w,N]=x.useState(null),[y,j]=x.useState(""),[E,S]=x.useState(!1),[C,R]=x.useState(!1),M=async(D,B=!1)=>{S(!0),j("");try{const L=await rw.dirs(D||"~");g(L.path),u(L.path),N(L.parent),v(L.entries)}catch(L){const U=L.message;j(U),B||l.error(U)}finally{S(!1)}};x.useEffect(()=>{e||(u(""),m(!1),g(""),v([]),N(null),j(""))},[e]);const T=async()=>{S(!0);try{const D=await rw.pickDir(d("add_project.picker_prompt"));if("cancelled"in D)return;u(D.path);return}catch{m(!0),await M(c||"~")}finally{S(!1)}},O=async()=>{const D=c.trim();if(!D){l.error(d("add_project.path_required"));return}R(!0);try{const B=await cs.register(D);l.success(d("add_project.registered",{id:B.id})),await a("/projects"),t(),o(`/p/${B.id}`)}catch(B){l.error(B.message)}finally{R(!1)}};return s.jsx(cn,{open:e,onClose:t,title:d("add_project.title"),description:d("add_project.subtitle"),footer:s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:C,children:d("common.cancel")}),s.jsx(ne,{variant:"primary",onClick:O,loading:C,children:d("add_project.register")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(le,{label:d("add_project.path_label"),hint:d("add_project.path_hint"),children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ee,{autoFocus:!0,placeholder:d("add_project.path_placeholder"),value:c,onChange:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&O()}}),s.jsxs(ne,{onClick:T,disabled:E,children:[s.jsx(Ec,{size:14})," ",d("add_project.search_btn")]})]})}),p&&s.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[s.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:h||c||"~"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>M("~"),disabled:E,children:s.jsx(y3,{size:13})}),s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>w&&M(w),disabled:!w||E,children:".."}),s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:E,children:s.jsx(Us,{size:13})})]})]}),s.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[E&&s.jsx(ot,{}),!E&&y&&s.jsx(gt,{children:d("add_project.browser_unavailable")}),!E&&!y&&b.length===0&&s.jsx(gt,{children:d("add_project.no_folders")}),!E&&!y&&b.map(D=>s.jsxs("button",{type:"button",onClick:()=>M(D),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[s.jsx(ai,{size:14,className:"text-muted-fg"}),s.jsx("span",{className:"truncate",children:D.split("/").pop()}),s.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:D})]},D))]})]})]})})}function b9({onPaired:e}){const[t,a]=x.useState(""),[o,l]=x.useState(_9()),[c,u]=x.useState(!1),[p,m]=x.useState(null);async function h(){const g=t.trim();if(!g){m(d("pairing.err_required"));return}u(!0),m(null);try{const b=await Wl.confirm({pairing_id:g,label:o.trim()||void 0});bo(b.token);try{localStorage.setItem(On.token,b.token)}catch{}e()}catch(b){m(v9(b)),u(!1)}}return s.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:s.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:s.jsx(sx,{size:20})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-base font-semibold",children:d("pairing.title")}),s.jsx("p",{className:"text-xs text-muted-fg",children:d("pairing.subtitle")})]})]}),s.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[s.jsx("li",{className:"font-medium text-foreground",children:d("pairing.steps_title")}),s.jsxs("li",{children:["1. ",d("pairing.step_1")]}),s.jsxs("li",{children:["2. ",d("pairing.step_2")]}),s.jsxs("li",{children:["3. ",d("pairing.step_3")]})]}),s.jsxs("form",{className:"space-y-3",onSubmit:g=>{g.preventDefault(),h()},children:[s.jsx(le,{label:d("pairing.code_label"),children:s.jsx(Ee,{value:t,onChange:g=>a(g.target.value),placeholder:d("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),s.jsx(le,{label:d("pairing.label_label"),hint:d("pairing.revoke_hint"),children:s.jsx(Ee,{value:o,onChange:g=>l(g.target.value),placeholder:d("pairing.label_ph")})}),p&&s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),s.jsx(ne,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:d(c?"pairing.linking":"pairing.submit")})]})]})})}function _9(){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 v9(e){if(e instanceof au){if(e.status===410)return d("pairing.err_expired");if(e.status===404||e.status===409)return d("pairing.err_unknown")}return d("pairing.err_generic")}function y9({...e}){return s.jsx(aN,{"data-slot":"sheet",...e})}function j9({...e}){return s.jsx(sN,{"data-slot":"sheet-portal",...e})}function w9({className:e,...t}){return s.jsx(JC,{"data-slot":"sheet-overlay",className:Ct("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 k9({className:e,children:t,side:a="right",showCloseButton:o=!0,...l}){return s.jsxs(j9,{children:[s.jsx(w9,{}),s.jsxs(nN,{"data-slot":"sheet-content","data-side":a,className:Ct("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&&s.jsxs(jp,{"data-slot":"sheet-close",render:s.jsx(Za,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(Us,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function S9({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:Ct("flex flex-col gap-0.5 p-4",e),...t})}function C9({className:e,...t}){return s.jsx(rN,{"data-slot":"sheet-title",className:Ct("font-heading text-base font-medium text-foreground",e),...t})}function N9({className:e,...t}){return s.jsx(eN,{"data-slot":"sheet-description",className:Ct("text-sm text-muted-foreground",e),...t})}function E9({value:e,projectPath:t,onPick:a}){const o=R9(e),l=o?T9(e):"",{data:c}=Ge(o?["/skills",t||""]:null,()=>vc.list(t)),u=c?.skills||[],p=x.useMemo(()=>{const m=l.toLowerCase();return m?u.filter(h=>h.slug.toLowerCase().includes(m)).slice(0,8):u.slice(0,8)},[u,l]);return!o||p.length===0?null:s.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[s.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:p.map(m=>s.jsx("li",{children:s.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:[s.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),s.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 R9(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function T9(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function A9(){try{const e=localStorage.getItem(On.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 M9({open:e,onOpenChange:t}){const a=_p(),o=nt(),[l,c]=x.useState(A9),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState(""),v=x.useRef(null);x.useEffect(()=>{const S=l.filter(C=>!C.pending);try{S.length?localStorage.setItem(On.robyChat,JSON.stringify(S)):localStorage.removeItem(On.robyChat)}catch{}},[l]);const w=()=>{if(!m){c([]),p("");try{localStorage.removeItem(On.robyChat)}catch{}}};x.useEffect(()=>()=>v.current?.abort(),[]),x.useEffect(()=>{const S=C=>{const R=C.detail?.prompt;typeof R=="string"&&(t(!0),p(R))};return window.addEventListener("apx:roby-prompt",S),()=>window.removeEventListener("apx:roby-prompt",S)},[t]);const N=()=>{v.current?.abort(),h(!1)},y=S=>c(C=>{const R=[...C],M=R[R.length-1];return M?.role==="assistant"&&(R[R.length-1]=S(M)),R}),j=async()=>{const S=u.trim();if(!S||m)return;const C=new Date().toISOString(),R=l.filter(D=>!D.pending).map(D=>({role:D.role,content:Bx(D)}));c(D=>[...D,{role:"user",parts:[{kind:"text",text:S}],ts:C},{role:"assistant",parts:[],ts:C,pending:!0}]),p(""),h(!0);const M=new AbortController;v.current=M;let T=!1;const O=D=>{if(D?.type==="error"){T=!0,o.error(D.error||"error"),c(B=>{const L=[...B],U=L[L.length-1];return U?.role==="assistant"&&U.pending&&L.pop(),L});return}y(B=>I_(B,D))};try{await GC.stream(0,{prompt:S,previousMessages:R,model:g||void 0,channel:"web_sidebar"},O,M.signal),y(D=>({...D,pending:!1}))}catch(D){M.signal.aborted?y(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:d("project.chat.stopped_marker")}]})):T||(o.error(D.message),c(B=>{const L=[...B],U=L[L.length-1];return U?.role==="assistant"&&U.pending&&L.pop(),L}))}finally{v.current===M&&(v.current=null),h(!1)}},E=async S=>{try{await navigator.clipboard.writeText(S),o.info(d("project.chat.copied"))}catch{}};return s.jsx(y9,{open:e,onOpenChange:t,children:s.jsxs(k9,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[s.jsxs(S9,{className:"pr-12",children:[s.jsxs(C9,{className:"flex items-center gap-2",children:[s.jsx(rn,{size:18})," ",d("superagent.title",{persona:a}),s.jsx("span",{className:"text-xs font-normal text-muted-fg",children:d("superagent.badge")})]}),s.jsx(N9,{children:d("superagent.desc")})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?s.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:d("superagent.empty",{persona:a})}):s.jsx(B_,{msgs:l,onCopy:E})}),s.jsx(uE,{msgs:l}),s.jsxs("div",{className:"border-t border-border p-3",children:[s.jsx("div",{className:"mb-1.5",children:s.jsx(E9,{value:u,onPick:S=>p(`/${S} `)})}),s.jsx(L_,{value:u,onValueChange:p,onSubmit:()=>void j(),onStop:N,busy:m,placeholder:d("superagent.placeholder"),footer:s.jsx(P_,{value:g,onChange:b,disabled:m})}),s.jsx("div",{className:"mt-1.5 flex justify-end",children:s.jsxs(Za,{size:"xs",variant:"ghost",onClick:w,disabled:m||l.length===0,children:[s.jsx(Kt,{className:"size-3"})," ",d("superagent.new_chat")]})})]})]})})}function O9(){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 z9(){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 g=await fetch("/health");if(!g.ok)throw new Error(`HTTP ${g.status}`)}catch(g){c||t({status:"error",reason:String(g)});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 g=await Wl.confirm({pairing_id:m,label:O9(),kind:"web"});bo(g.token);try{localStorage.setItem(On.token,g.token)}catch{}c||t({status:"ok"});return}catch{}}const h=p.get("token");if(h){bo(h);try{localStorage.setItem(On.token,h)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const g=localStorage.getItem(On.token);g&&bo(g)}catch{}try{const g=await fetch("/admin/web-token");if(g.ok){const b=await g.json();if(b?.token){bo(b.token);try{localStorage.setItem(On.token,b.token)}catch{}}}}catch{}if(!f_()){c||t({status:"unpaired"});return}try{await ie.get("/projects"),c||t({status:"ok"})}catch(g){if(g instanceof au&&(g.status===401||g.status===403)){bo(null);try{localStorage.removeItem(On.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(g)})}})(),()=>{c=!0}},[a]),{...e,reload:l}}function D9(){const e=z9();return e.status==="loading"?s.jsx($k,{text:d("daemon.connecting")}):e.status==="error"?s.jsx($k,{mood:"sad",text:d("daemon.unreachable"),sub:`${d("daemon.unreachable_hint")}
703
+
704
+ ${e.reason}`}):e.status==="unpaired"?s.jsx(b9,{onPaired:e.reload}):s.jsx(CP,{children:s.jsx(Bz,{delay:0,children:s.jsx(L9,{})})})}function L9(){const e=Ln(),t=es(),[a,o]=si(),{theme:l,toggle:c}=pb(),u=a.get("action")==="add-project",[p,m]=x.useState(!1),h=()=>{const b=new URLSearchParams(a);b.delete("action"),o(b,{replace:!0})},g=()=>{const b=new URLSearchParams(a);b.set("action","add-project"),o(b)};return s.jsx(AP,{children:s.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[s.jsx(IL,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:g}),s.jsxs("main",{className:"m-2 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[s.jsx(P9,{onToggleTheme:c,isDark:l==="dark",pathname:t.pathname}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs(iS,{children:[s.jsx(Pt,{path:"/",element:s.jsx(TP,{})}),s.jsx(Pt,{path:"/settings/*",element:s.jsx(cU,{})}),s.jsx(Pt,{path:"/m/desktop/*",element:s.jsx(fU,{})}),s.jsx(Pt,{path:"/m/code/*",element:s.jsx(g9,{})}),s.jsx(Pt,{path:"/p/:pid/*",element:s.jsx(M7,{})}),s.jsx(Pt,{path:"*",element:s.jsx(H9,{})})]})})]}),s.jsx(x9,{open:u,onClose:h}),s.jsx(M9,{open:p,onOpenChange:m})]})})}function P9({onToggleTheme:e,isDark:t,pathname:a}){const{projects:o}=ru(),l=zP(),c=a.split("/").filter(Boolean),u=c[0]==="p"?o.find(N=>String(N.id)===c[1]):void 0,p=c[0]==="settings"?U9(c[1]):c[0]==="p"?$9(c[2]):"",m=c[0]==="p"&&c[1]==="0",h=u?.name||u?.path?.split("/").pop()||d("nav.project"),g=a==="/"?d("topbar.breadcrumb_root"):c[0]==="settings"?[d("topbar.breadcrumb_root"),d("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[d("topbar.breadcrumb_root"),B9(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[d("topbar.breadcrumb_root"),d("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[d("topbar.breadcrumb_root"),d("topbar.breadcrumb_projects"),h,p].filter(Boolean).join(" › "):d("topbar.breadcrumb_root"),b=a==="/"?"":c[0]==="settings"?d("settings.subtitle"):c[0]==="p"?m?d("base.subtitle"):u?`${KC(u.kind)} · ${u.path}`:"":"",v=MP(),w=LP();return s.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[v&&s.jsx(QD,{collapsed:v.collapsed,onToggle:v.toggle}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[g,b&&s.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),w,s.jsx(I9,{}),s.jsx(Ke,{content:d(t?"topbar.light":"topbar.dark"),children:s.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?s.jsx(L3,{size:14}):s.jsx(E3,{size:14})})})]})}function I9(){const e=i_(),t=a=>{a!==e&&(zC(a),window.location.reload())};return s.jsxs(AC,{children:[s.jsxs(MC,{"data-testid":"lang-menu",title:d("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:[s.jsx(w3,{size:14}),s.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),s.jsx(OC,{align:"end",children:s.jsx(HD,{value:e,onValueChange:a=>t(a),children:DC.map(a=>s.jsx(qD,{value:a.value,children:a.label},a.value))})})]})}function B9(e){switch(e){case"desktop":return d("nav.modules.desktop");case"code":return d("nav.modules.code");default:return e||""}}function U9(e){switch(e){case"super-agent":return d("settings.tabs.super_agent");case"engines":return d("settings.tabs.engines");case"telegram":return d("settings.tabs.telegram");case"devices":return d("settings.tabs.devices");case"voice":return d("nav.modules.voice");case"deck":return d("nav.modules.deck");case"desktop":return d("nav.modules.desktop");case"appearance":return d("settings.appearance");case"config":case"advanced":return d("settings.tabs.advanced");case"identity":default:return e||""}}function $9(e){switch(e){case"chat":return d("project.nav.chat");case"telegram":return d("project.nav.telegram");case"agents":return d("project.nav.agents");case"routines":return d("project.nav.routines");case"tasks":return d("project.nav.tasks");case"mcps":return d("project.nav.mcps");case"artifacts":return d("project.nav.artifacts");case"config":return d("project.nav.config");case"workspaces":return d("base.workspaces_title");case"models":return d("settings.tabs.engines");case"agent-defaults":return d("base.defaults_title");case"sessions":return d("base.sessions_title");case"logs":return d("project.nav.logs");case"memories":return d("project.nav.memories");default:return""}}function $k({text:e,sub:t,mood:a="happy"}){return s.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx(bN,{mood:a,className:"mb-4 text-xs"}),s.jsx("div",{className:"text-foreground",children:e}),t&&s.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function H9(){const e=Ln();return s.jsx(_N,{testId:"screen-not-found",mood:"confused",title:d("not_found.title"),titleClassName:"text-7xl",message:d("not_found.message"),action:s.jsx(Za,{variant:"outline",onClick:()=>e("/"),children:d("not_found.home")})})}lA.createRoot(document.getElementById("root")).render(s.jsx(Xc.StrictMode,{children:s.jsx(AM,{children:s.jsx(q3,{children:s.jsx(D9,{})})})}));
705
+ //# sourceMappingURL=index-DPAuXATr.js.map