tide-commander 1.45.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BossLogsModal-N4CnX-0x.js → BossLogsModal-BEZSJWBV.js} +1 -1
- package/dist/assets/BossSpawnModal-BknVJp2f.js +1 -0
- package/dist/assets/{ControlsModal-Cr5klRxS.js → ControlsModal-BZKmtLz7.js} +1 -1
- package/dist/assets/{DockerLogsModal-D6U9obTe.js → DockerLogsModal-DD8gRVu6.js} +1 -1
- package/dist/assets/{EmbeddedEditor-Bnm-9Q73.js → EmbeddedEditor-DMcKiZ5q.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-GoKvyYWS.js → GmailOAuthSetup-CO2LqLvU.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-D3sAGlZq.js → GoogleOAuthSetup-OVzavssB.js} +1 -1
- package/dist/assets/{IframeModal-DQqev6_V.js → IframeModal-DJn-dNqr.js} +1 -1
- package/dist/assets/IntegrationsPanel-C0JSiDOw.js +2 -0
- package/dist/assets/{LogViewerModal-DB0xx-oB.js → LogViewerModal-BgIfdR-l.js} +1 -1
- package/dist/assets/{MonitoringModal-BspW74kP.js → MonitoringModal-Dm8wbcHY.js} +1 -1
- package/dist/assets/{PM2LogsModal-Cz4GZtyl.js → PM2LogsModal-CDULU4yk.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-KCCSJy3B.js → RestoreArchivedAreaModal-DLuiZj6S.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-DqZ1JedM.js → SaveSnapshotModal-CbfjHVJz.js} +1 -1
- package/dist/assets/Scene2DCanvas-Dw9o4Fk8.js +1 -0
- package/dist/assets/{SceneManager-DggU0iAh.js → SceneManager-KAhHYpUf.js} +1 -1
- package/dist/assets/SkillsPanel-BYy3W8hd.js +28 -0
- package/dist/assets/SnapshotManager-LxlHIjaa.js +1 -0
- package/dist/assets/SpawnModal-Ch7yKsdS.js +1 -0
- package/dist/assets/SubordinateAssignmentModal-zuSTZAqj.js +1 -0
- package/dist/assets/{SupervisorPanel-CxId5lI7.js → SupervisorPanel-tTfMa-0x.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-BCzGGCPD.js → TriggerManagerPanel-BoHdbpqk.js} +2 -2
- package/dist/assets/{WorkflowEditorPanel-BmNCGmxP.js → WorkflowEditorPanel-Cusd-51G.js} +2 -2
- package/dist/assets/{index-8WVMR823.js → index-BPn1NjZ5.js} +1 -1
- package/dist/assets/{index-CvJuv-ho.js → index-BoFICHSl.js} +2 -2
- package/dist/assets/{index-Sej69v19.js → index-C_3LXJYS.js} +3 -3
- package/dist/assets/{index-Bhb-rse9.js → index-CeMGJMtZ.js} +3 -3
- package/dist/assets/{index-COBkxsEU.js → index-ChZ1qMl3.js} +1 -1
- package/dist/assets/{index-C9B8kaWK.js → index-Cxx3kFoj.js} +1 -1
- package/dist/assets/{index-CcYTUJp1.js → index-D3KwWKEv.js} +4 -4
- package/dist/assets/index-ifiZ65Cu.js +1 -0
- package/dist/assets/main-3GpIvzEr.css +1 -0
- package/dist/assets/main-BsOvZp5M.js +153 -0
- package/dist/assets/{web-RTEsf66y.js → web-B5moyGVG.js} +1 -1
- package/dist/assets/{web-CrUhsC9T.js → web-BYzo_b4X.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/src/packages/server/data/index.js +25 -0
- package/dist/src/packages/server/routes/config.js +7 -0
- package/dist/src/packages/server/routes/custom-class-icons.js +138 -0
- package/dist/src/packages/server/routes/index.js +2 -0
- package/dist/src/packages/server/services/custom-class-service.js +7 -2
- package/package.json +1 -1
- package/dist/assets/BossSpawnModal-4CPjS2xn.js +0 -1
- package/dist/assets/IntegrationsPanel-C9hWD7mO.js +0 -2
- package/dist/assets/Scene2DCanvas-MRhWT6EA.js +0 -1
- package/dist/assets/SkillsPanel-DZC0Im2z.js +0 -28
- package/dist/assets/SnapshotManager-3LQMRFLh.js +0 -1
- package/dist/assets/SpawnModal-C_e6q2uv.js +0 -1
- package/dist/assets/SubordinateAssignmentModal-BZdSk9WL.js +0 -1
- package/dist/assets/index-B8SWRPUd.js +0 -1
- package/dist/assets/main-6CnCKW13.js +0 -153
- package/dist/assets/main-DjGrMNoB.css +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-ponyfill-DZOWXZ4K.js","assets/vendor-react--Eh9ivFN.js","assets/index-CvJuv-ho.js","assets/modulepreload-polyfill-B5Qt9EMX.js","assets/vendor-three-Chj50gSY.js","assets/web-RTEsf66y.js","assets/SceneManager-DggU0iAh.js","assets/prism-cpp-CK2Ly5dS.js","assets/prism-java-CK6tws4L.js","assets/prism-csharp-ByDDDiWW.js","assets/prism-ruby-CQBUuZIF.js","assets/prism-php-Dt9698bA.js","assets/prism-scss-CeN16CFC.js","assets/prism-perl-UZfqnD51.js","assets/prism-haskell-Ce8aBmia.js","assets/prism-elixir-df27OMMQ.js","assets/xterm-6GBZ9nXN.css","assets/SpawnModal-C_e6q2uv.js","assets/BossSpawnModal-4CPjS2xn.js","assets/SubordinateAssignmentModal-BZdSk9WL.js","assets/index-8WVMR823.js","assets/index-Bykeknjl.css","assets/index-CcYTUJp1.js","assets/index-Sej69v19.js","assets/index-Bhb-rse9.js","assets/SupervisorPanel-CxId5lI7.js","assets/index-COBkxsEU.js","assets/ControlsModal-Cr5klRxS.js","assets/SkillsPanel-DZC0Im2z.js","assets/SnapshotManager-3LQMRFLh.js","assets/RestoreArchivedAreaModal-KCCSJy3B.js","assets/IntegrationsPanel-C9hWD7mO.js","assets/MonitoringModal-BspW74kP.js","assets/WorkflowEditorPanel-BmNCGmxP.js","assets/TriggerManagerPanel-BCzGGCPD.js","assets/index-C9B8kaWK.js","assets/index-CprCD9du.css","assets/PM2LogsModal-Cz4GZtyl.js","assets/LogViewerModal-DB0xx-oB.js","assets/DockerLogsModal-D6U9obTe.js","assets/BossLogsModal-N4CnX-0x.js","assets/Scene2DCanvas-MRhWT6EA.js","assets/Scene2DCanvas-DwXbvB-b.css","assets/index-B8SWRPUd.js","assets/index-BZyCMBzi.css","assets/IframeModal-DQqev6_V.js","assets/IframeModal-DJkCGwT6.css","assets/SaveSnapshotModal-DqZ1JedM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var D_=Object.defineProperty;var R_=(t,e,n)=>e in t?D_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var et=(t,e,n)=>R_(t,typeof e!="symbol"?e+"":e,n);import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as Kb,g as ju,a as IA,c as O0}from"./vendor-react--Eh9ivFN.js";import{T as O_,a as nb,b as BA,L as FA,c as Zc,F as Rf,M as ar,V as zA,C as Pr,d as sr,S as Mr,e as L_,P as P_,D as sb,f as Of,g as ao,I as I_,Q as $A,h as B_,O as HA,i as F_,j as z_,B as eu,k as $_,l as UA,N as H_,m as U_,n as W_,o as ab,p as WA,R as rb,q as q_,r as V_,s as G_,t as wf,u as Y_,v as Qb,w as qA,x as pl,y as K_,z as VA,A as Q_,E as ul,G as X_,H as J_,J as Z_,K as eM,U as Fm,W as GA,X as tM,Y as nM,Z as sM,_ as aM,$ as rM,a0 as iM,a1 as YA,a2 as oM,a3 as L0,a4 as P0,a5 as I0,a6 as B0,a7 as ib,a8 as lM,a9 as cM,aa as uM,ab as dM,ac as fM,ad as pM,ae as hM,af as mM,ag as gM,ah as bM,ai as xM,aj as yM}from"./vendor-three-Chj50gSY.js";function vM(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in t)){const r=Object.getOwnPropertyDescriptor(s,a);r&&Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var zm={exports:{}},Nc={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var F0;function wM(){if(F0)return Nc;F0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,a,r){var i=null;if(r!==void 0&&(i=""+r),a.key!==void 0&&(i=""+a.key),"key"in a){r={};for(var c in a)c!=="key"&&(r[c]=a[c])}else r=a;return a=r.ref,{$$typeof:t,type:s,key:i,ref:a!==void 0?a:null,props:r}}return Nc.Fragment=e,Nc.jsx=n,Nc.jsxs=n,Nc}var z0;function kM(){return z0||(z0=1,zm.exports=wM()),zm.exports}var o=kM(),b=Kb();const Ce=ju(b),KA=vM({__proto__:null,default:Ce},[b]);var $m={exports:{}},Tc={},Hm={exports:{}},Um={};/**
|
|
11
|
-
* @license React
|
|
12
|
-
* scheduler.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var $0;function SM(){return $0||($0=1,(function(t){function e(F,H){var V=F.length;F.push(H);e:for(;0<V;){var G=V-1>>>1,B=F[G];if(0<a(B,H))F[G]=H,F[V]=B,V=G;else break e}}function n(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var H=F[0],V=F.pop();if(V!==H){F[0]=V;e:for(var G=0,B=F.length,Q=B>>>1;G<Q;){var K=2*(G+1)-1,q=F[K],xe=K+1,de=F[xe];if(0>a(q,V))xe<B&&0>a(de,q)?(F[G]=de,F[xe]=V,G=xe):(F[G]=q,F[K]=V,G=K);else if(xe<B&&0>a(de,V))F[G]=de,F[xe]=V,G=xe;else break e}}return H}function a(F,H){var V=F.sortIndex-H.sortIndex;return V!==0?V:F.id-H.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;t.unstable_now=function(){return r.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var d=[],f=[],h=1,m=null,x=3,y=!1,v=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function E(F){for(var H=n(f);H!==null;){if(H.callback===null)s(f);else if(H.startTime<=F)s(f),H.sortIndex=H.expirationTime,e(d,H);else break;H=n(f)}}function D(F){if(S=!1,E(F),!v)if(n(d)!==null)v=!0,_||(_=!0,I());else{var H=n(f);H!==null&&$(D,H.startTime-F)}}var _=!1,P=-1,O=5,T=-1;function M(){return C?!0:!(t.unstable_now()-T<O)}function R(){if(C=!1,_){var F=t.unstable_now();T=F;var H=!0;try{e:{v=!1,S&&(S=!1,N(P),P=-1),y=!0;var V=x;try{t:{for(E(F),m=n(d);m!==null&&!(m.expirationTime>F&&M());){var G=m.callback;if(typeof G=="function"){m.callback=null,x=m.priorityLevel;var B=G(m.expirationTime<=F);if(F=t.unstable_now(),typeof B=="function"){m.callback=B,E(F),H=!0;break t}m===n(d)&&s(d),E(F)}else s(d);m=n(d)}if(m!==null)H=!0;else{var Q=n(f);Q!==null&&$(D,Q.startTime-F),H=!1}}break e}finally{m=null,x=V,y=!1}H=void 0}}finally{H?I():_=!1}}}var I;if(typeof j=="function")I=function(){j(R)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,W=z.port2;z.port1.onmessage=R,I=function(){W.postMessage(null)}}else I=function(){k(R,0)};function $(F,H){P=k(function(){F(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(F){switch(x){case 1:case 2:case 3:var H=3;break;default:H=x}var V=x;x=H;try{return F()}finally{x=V}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(F,H){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var V=x;x=F;try{return H()}finally{x=V}},t.unstable_scheduleCallback=function(F,H,V){var G=t.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?G+V:G):V=G,F){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=V+B,F={id:h++,callback:H,priorityLevel:F,startTime:V,expirationTime:B,sortIndex:-1},V>G?(F.sortIndex=V,e(f,F),n(d)===null&&F===n(f)&&(S?(N(P),P=-1):S=!0,$(D,V-G))):(F.sortIndex=B,e(d,F),v||y||(v=!0,_||(_=!0,I()))),F},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(F){var H=x;return function(){var V=x;x=H;try{return F.apply(this,arguments)}finally{x=V}}}})(Um)),Um}var H0;function CM(){return H0||(H0=1,Hm.exports=SM()),Hm.exports}/**
|
|
19
|
-
* @license React
|
|
20
|
-
* react-dom-client.production.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var U0;function AM(){if(U0)return Tc;U0=1;var t=CM(),e=Kb(),n=IA();function s(l){var u="https://react.dev/errors/"+l;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function r(l){var u=l,p=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,(u.flags&4098)!==0&&(p=u.return),l=u.return;while(l)}return u.tag===3?p:null}function i(l){if(l.tag===13){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function c(l){if(l.tag===31){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function d(l){if(r(l)!==l)throw Error(s(188))}function f(l){var u=l.alternate;if(!u){if(u=r(l),u===null)throw Error(s(188));return u!==l?null:l}for(var p=l,g=u;;){var w=p.return;if(w===null)break;var A=w.alternate;if(A===null){if(g=w.return,g!==null){p=g;continue}break}if(w.child===A.child){for(A=w.child;A;){if(A===p)return d(w),l;if(A===g)return d(w),u;A=A.sibling}throw Error(s(188))}if(p.return!==g.return)p=w,g=A;else{for(var L=!1,Y=w.child;Y;){if(Y===p){L=!0,p=w,g=A;break}if(Y===g){L=!0,g=w,p=A;break}Y=Y.sibling}if(!L){for(Y=A.child;Y;){if(Y===p){L=!0,p=A,g=w;break}if(Y===g){L=!0,g=A,p=w;break}Y=Y.sibling}if(!L)throw Error(s(189))}}if(p.alternate!==g)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?l:u}function h(l){var u=l.tag;if(u===5||u===26||u===27||u===6)return l;for(l=l.child;l!==null;){if(u=h(l),u!==null)return u;l=l.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),j=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function I(l){return l===null||typeof l!="object"?null:(l=R&&l[R]||l["@@iterator"],typeof l=="function"?l:null)}var z=Symbol.for("react.client.reference");function W(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===z?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case _:return"SuspenseList";case T:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case v:return"Portal";case j:return l.displayName||"Context";case N:return(l._context.displayName||"Context")+".Consumer";case E:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case P:return u=l.displayName||null,u!==null?u:W(l.type)||"Memo";case O:u=l._payload,l=l._init;try{return W(l(u))}catch{}}return null}var $=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},G=[],B=-1;function Q(l){return{current:l}}function K(l){0>B||(l.current=G[B],G[B]=null,B--)}function q(l,u){B++,G[B]=l.current,l.current=u}var xe=Q(null),de=Q(null),Z=Q(null),be=Q(null);function je(l,u){switch(q(Z,u),q(de,l),q(xe,null),u.nodeType){case 9:case 11:l=(l=u.documentElement)&&(l=l.namespaceURI)?s0(l):0;break;default:if(l=u.tagName,u=u.namespaceURI)u=s0(u),l=a0(u,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}K(xe),q(xe,l)}function ce(){K(xe),K(de),K(Z)}function Ee(l){l.memoizedState!==null&&q(be,l);var u=xe.current,p=a0(u,l.type);u!==p&&(q(de,l),q(xe,p))}function ze(l){de.current===l&&(K(xe),K(de)),be.current===l&&(K(be),Sc._currentValue=V)}var Ge,_e;function me(l){if(Ge===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);Ge=u&&u[1]||"",_e=-1<p.stack.indexOf(`
|
|
27
|
-
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
28
|
-
`+Ge+l+_e}var De=!1;function te(l,u){if(!l||De)return"";De=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Ze=function(){throw Error()};if(Object.defineProperty(Ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ze,[])}catch(qe){var Fe=qe}Reflect.construct(l,[],Ze)}else{try{Ze.call()}catch(qe){Fe=qe}l.call(Ze.prototype)}}else{try{throw Error()}catch(qe){Fe=qe}(Ze=l())&&typeof Ze.catch=="function"&&Ze.catch(function(){})}}catch(qe){if(qe&&Fe&&typeof qe.stack=="string")return[qe.stack,Fe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var A=g.DetermineComponentFrameRoot(),L=A[0],Y=A[1];if(L&&Y){var ae=L.split(`
|
|
29
|
-
`),Oe=Y.split(`
|
|
30
|
-
`);for(w=g=0;g<ae.length&&!ae[g].includes("DetermineComponentFrameRoot");)g++;for(;w<Oe.length&&!Oe[w].includes("DetermineComponentFrameRoot");)w++;if(g===ae.length||w===Oe.length)for(g=ae.length-1,w=Oe.length-1;1<=g&&0<=w&&ae[g]!==Oe[w];)w--;for(;1<=g&&0<=w;g--,w--)if(ae[g]!==Oe[w]){if(g!==1||w!==1)do if(g--,w--,0>w||ae[g]!==Oe[w]){var Ke=`
|
|
31
|
-
`+ae[g].replace(" at new "," at ");return l.displayName&&Ke.includes("<anonymous>")&&(Ke=Ke.replace("<anonymous>",l.displayName)),Ke}while(1<=g&&0<=w);break}}}finally{De=!1,Error.prepareStackTrace=p}return(p=l?l.displayName||l.name:"")?me(p):""}function He(l,u){switch(l.tag){case 26:case 27:case 5:return me(l.type);case 16:return me("Lazy");case 13:return l.child!==u&&u!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return te(l.type,!1);case 11:return te(l.type.render,!1);case 1:return te(l.type,!0);case 31:return me("Activity");default:return""}}function ye(l){try{var u="",p=null;do u+=He(l,p),p=l,l=l.return;while(l);return u}catch(g){return`
|
|
32
|
-
Error generating stack: `+g.message+`
|
|
33
|
-
`+g.stack}}var Re=Object.prototype.hasOwnProperty,re=t.unstable_scheduleCallback,pe=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,at=t.unstable_requestPaint,ut=t.unstable_now,ue=t.unstable_getCurrentPriorityLevel,X=t.unstable_ImmediatePriority,se=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,J=t.unstable_LowPriority,we=t.unstable_IdlePriority,We=t.log,Be=t.unstable_setDisableYieldValue,ie=null,Ie=null;function oe(l){if(typeof We=="function"&&Be(l),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(ie,l)}catch{}}var he=Math.clz32?Math.clz32:Qe,ne=Math.log,Le=Math.LN2;function Qe(l){return l>>>=0,l===0?32:31-(ne(l)/Le|0)|0}var $e=256,nt=262144,ot=4194304;function st(l){var u=l&42;if(u!==0)return u;switch(l&-l){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 l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function lt(l,u,p){var g=l.pendingLanes;if(g===0)return 0;var w=0,A=l.suspendedLanes,L=l.pingedLanes;l=l.warmLanes;var Y=g&134217727;return Y!==0?(g=Y&~A,g!==0?w=st(g):(L&=Y,L!==0?w=st(L):p||(p=Y&~l,p!==0&&(w=st(p))))):(Y=g&~A,Y!==0?w=st(Y):L!==0?w=st(L):p||(p=g&~l,p!==0&&(w=st(p)))),w===0?0:u!==0&&u!==w&&(u&A)===0&&(A=w&-w,p=u&-u,A>=p||A===32&&(p&4194048)!==0)?u:w}function it(l,u){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&u)===0}function ht(l,u){switch(l){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 jt(){var l=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),l}function ge(l){for(var u=[],p=0;31>p;p++)u.push(l);return u}function Te(l,u){l.pendingLanes|=u,u!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function Ye(l,u,p,g,w,A){var L=l.pendingLanes;l.pendingLanes=p,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=p,l.entangledLanes&=p,l.errorRecoveryDisabledLanes&=p,l.shellSuspendCounter=0;var Y=l.entanglements,ae=l.expirationTimes,Oe=l.hiddenUpdates;for(p=L&~p;0<p;){var Ke=31-he(p),Ze=1<<Ke;Y[Ke]=0,ae[Ke]=-1;var Fe=Oe[Ke];if(Fe!==null)for(Oe[Ke]=null,Ke=0;Ke<Fe.length;Ke++){var qe=Fe[Ke];qe!==null&&(qe.lane&=-536870913)}p&=~Ze}g!==0&&tt(l,g,0),A!==0&&w===0&&l.tag!==0&&(l.suspendedLanes|=A&~(L&~u))}function tt(l,u,p){l.pendingLanes|=u,l.suspendedLanes&=~u;var g=31-he(u);l.entangledLanes|=u,l.entanglements[g]=l.entanglements[g]|1073741824|p&261930}function Nt(l,u){var p=l.entangledLanes|=u;for(l=l.entanglements;p;){var g=31-he(p),w=1<<g;w&u|l[g]&u&&(l[g]|=u),p&=~w}}function zt(l,u){var p=u&-u;return p=(p&42)!==0?1:Pt(p),(p&(l.suspendedLanes|u))!==0?0:p}function Pt(l){switch(l){case 2:l=1;break;case 8:l=4;break;case 32:l=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:l=128;break;case 268435456:l=134217728;break;default:l=0}return l}function It(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function Vt(){var l=H.p;return l!==0?l:(l=window.event,l===void 0?32:N0(l.type))}function mt(l,u){var p=H.p;try{return H.p=l,u()}finally{H.p=p}}var ct=Math.random().toString(36).slice(2),xt="__reactFiber$"+ct,Dt="__reactProps$"+ct,Sn="__reactContainer$"+ct,cn="__reactEvents$"+ct,ls="__reactListeners$"+ct,Ba="__reactHandles$"+ct,Ts="__reactResources$"+ct,Hs="__reactMarker$"+ct;function Fa(l){delete l[xt],delete l[Dt],delete l[cn],delete l[ls],delete l[Ba]}function ks(l){var u=l[xt];if(u)return u;for(var p=l.parentNode;p;){if(u=p[Sn]||p[xt]){if(p=u.alternate,u.child!==null||p!==null&&p.child!==null)for(l=d0(l);l!==null;){if(p=l[xt])return p;l=d0(l)}return u}l=p,p=l.parentNode}return null}function Zn(l){if(l=l[xt]||l[Sn]){var u=l.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return l}return null}function _t(l){var u=l.tag;if(u===5||u===26||u===27||u===6)return l.stateNode;throw Error(s(33))}function rs(l){var u=l[Ts];return u||(u=l[Ts]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function fn(l){l[Hs]=!0}var cr=new Set,Hr={};function Es(l,u){_s(l,u),_s(l+"Capture",u)}function _s(l,u){for(Hr[l]=u,l=0;l<u.length;l++)cr.add(u[l])}var Ei=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]*$"),wo={},Ur={};function Il(l){return Re.call(Ur,l)?!0:Re.call(wo,l)?!1:Ei.test(l)?Ur[l]=!0:(wo[l]=!0,!1)}function gs(l,u,p){if(Il(u))if(p===null)l.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":l.removeAttribute(u);return;case"boolean":var g=u.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){l.removeAttribute(u);return}}l.setAttribute(u,""+p)}}function Ca(l,u,p){if(p===null)l.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(u);return}l.setAttribute(u,""+p)}}function cs(l,u,p,g){if(g===null)l.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(p);return}l.setAttributeNS(u,p,""+g)}}function Vn(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Wr(l){var u=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Ae(l,u,p){var g=Object.getOwnPropertyDescriptor(l.constructor.prototype,u);if(!l.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var w=g.get,A=g.set;return Object.defineProperty(l,u,{configurable:!0,get:function(){return w.call(this)},set:function(L){p=""+L,A.call(this,L)}}),Object.defineProperty(l,u,{enumerable:g.enumerable}),{getValue:function(){return p},setValue:function(L){p=""+L},stopTracking:function(){l._valueTracker=null,delete l[u]}}}}function Je(l){if(!l._valueTracker){var u=Wr(l)?"checked":"value";l._valueTracker=Ae(l,u,""+l[u])}}function Ct(l){if(!l)return!1;var u=l._valueTracker;if(!u)return!0;var p=u.getValue(),g="";return l&&(g=Wr(l)?l.checked?"true":"false":l.value),l=g,l!==p?(u.setValue(l),!0):!1}function en(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Ln=/[\n"\\]/g;function $t(l){return l.replace(Ln,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function At(l,u,p,g,w,A,L,Y){l.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?l.type=L:l.removeAttribute("type"),u!=null?L==="number"?(u===0&&l.value===""||l.value!=u)&&(l.value=""+Vn(u)):l.value!==""+Vn(u)&&(l.value=""+Vn(u)):L!=="submit"&&L!=="reset"||l.removeAttribute("value"),u!=null?Ss(l,L,Vn(u)):p!=null?Ss(l,L,Vn(p)):g!=null&&l.removeAttribute("value"),w==null&&A!=null&&(l.defaultChecked=!!A),w!=null&&(l.checked=w&&typeof w!="function"&&typeof w!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?l.name=""+Vn(Y):l.removeAttribute("name")}function Nn(l,u,p,g,w,A,L,Y){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(l.type=A),u!=null||p!=null){if(!(A!=="submit"&&A!=="reset"||u!=null)){Je(l);return}p=p!=null?""+Vn(p):"",u=u!=null?""+Vn(u):p,Y||u===l.value||(l.value=u),l.defaultValue=u}g=g??w,g=typeof g!="function"&&typeof g!="symbol"&&!!g,l.checked=Y?l.checked:!!g,l.defaultChecked=!!g,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(l.name=L),Je(l)}function Ss(l,u,p){u==="number"&&en(l.ownerDocument)===l||l.defaultValue===""+p||(l.defaultValue=""+p)}function Pn(l,u,p,g){if(l=l.options,u){u={};for(var w=0;w<p.length;w++)u["$"+p[w]]=!0;for(p=0;p<l.length;p++)w=u.hasOwnProperty("$"+l[p].value),l[p].selected!==w&&(l[p].selected=w),w&&g&&(l[p].defaultSelected=!0)}else{for(p=""+Vn(p),u=null,w=0;w<l.length;w++){if(l[w].value===p){l[w].selected=!0,g&&(l[w].defaultSelected=!0);return}u!==null||l[w].disabled||(u=l[w])}u!==null&&(u.selected=!0)}}function Us(l,u,p){if(u!=null&&(u=""+Vn(u),u!==l.value&&(l.value=u),p==null)){l.defaultValue!==u&&(l.defaultValue=u);return}l.defaultValue=p!=null?""+Vn(p):""}function Aa(l,u,p,g){if(u==null){if(g!=null){if(p!=null)throw Error(s(92));if($(g)){if(1<g.length)throw Error(s(93));g=g[0]}p=g}p==null&&(p=""),u=p}p=Vn(u),l.defaultValue=p,g=l.textContent,g===p&&g!==""&&g!==null&&(l.value=g),Je(l)}function ia(l,u){if(u){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=u;return}}l.textContent=u}var Bl=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 Iu(l,u,p){var g=u.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?g?l.setProperty(u,""):u==="float"?l.cssFloat="":l[u]="":g?l.setProperty(u,p):typeof p!="number"||p===0||Bl.has(u)?u==="float"?l.cssFloat=p:l[u]=(""+p).trim():l[u]=p+"px"}function Bu(l,u,p){if(u!=null&&typeof u!="object")throw Error(s(62));if(l=l.style,p!=null){for(var g in p)!p.hasOwnProperty(g)||u!=null&&u.hasOwnProperty(g)||(g.indexOf("--")===0?l.setProperty(g,""):g==="float"?l.cssFloat="":l[g]="");for(var w in u)g=u[w],u.hasOwnProperty(w)&&p[w]!==g&&Iu(l,w,g)}else for(var A in u)u.hasOwnProperty(A)&&Iu(l,A,u[A])}function ko(l){if(l.indexOf("-")===-1)return!1;switch(l){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 Fu=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"]]),_i=/^[\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 qr(l){return _i.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}function ja(){}var Fl=null;function zl(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Vr=null,ur=null;function $l(l){var u=Zn(l);if(u&&(l=u.stateNode)){var p=l[Dt]||null;e:switch(l=u.stateNode,u.type){case"input":if(At(l,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),u=p.name,p.type==="radio"&&u!=null){for(p=l;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+$t(""+u)+'"][type="radio"]'),u=0;u<p.length;u++){var g=p[u];if(g!==l&&g.form===l.form){var w=g[Dt]||null;if(!w)throw Error(s(90));At(g,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(u=0;u<p.length;u++)g=p[u],g.form===l.form&&Ct(g)}break e;case"textarea":Us(l,p.value,p.defaultValue);break e;case"select":u=p.value,u!=null&&Pn(l,!!p.multiple,u,!1)}}}var So=!1;function Hl(l,u,p){if(So)return l(u,p);So=!0;try{var g=l(u);return g}finally{if(So=!1,(Vr!==null||ur!==null)&&(Cd(),Vr&&(u=Vr,l=ur,ur=Vr=null,$l(u),l)))for(u=0;u<l.length;u++)$l(l[u])}}function Gr(l,u){var p=l.stateNode;if(p===null)return null;var g=p[Dt]||null;if(g===null)return null;p=g[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(l=l.type,g=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!g;break e;default:l=!1}if(l)return null;if(p&&typeof p!="function")throw Error(s(231,u,typeof p));return p}var oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Co=!1;if(oa)try{var Yr={};Object.defineProperty(Yr,"passive",{get:function(){Co=!0}}),window.addEventListener("test",Yr,Yr),window.removeEventListener("test",Yr,Yr)}catch{Co=!1}var Na=null,Ao=null,Mi=null;function Ul(){if(Mi)return Mi;var l,u=Ao,p=u.length,g,w="value"in Na?Na.value:Na.textContent,A=w.length;for(l=0;l<p&&u[l]===w[l];l++);var L=p-l;for(g=1;g<=L&&u[p-g]===w[A-g];g++);return Mi=w.slice(l,1<g?1-g:void 0)}function Di(l){var u=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&u===13&&(l=13)):l=u,l===10&&(l=13),32<=l||l===13?l:0}function ee(){return!0}function Ne(){return!1}function fe(l){function u(p,g,w,A,L){this._reactName=p,this._targetInst=w,this.type=g,this.nativeEvent=A,this.target=L,this.currentTarget=null;for(var Y in l)l.hasOwnProperty(Y)&&(p=l[Y],this[Y]=p?p(A):A[Y]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?ee:Ne,this.isPropagationStopped=Ne,this}return m(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=ee)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=ee)},persist:function(){},isPersistent:ee}),u}var Ue={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gt=fe(Ue),Tt=m({},Ue,{view:0,detail:0}),Cn=fe(Tt),tn,$n,es,Ms=m({},Tt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wp,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==es&&(es&&l.type==="mousemove"?(tn=l.screenX-es.screenX,$n=l.screenY-es.screenY):$n=tn=0,es=l),tn)},movementY:function(l){return"movementY"in l?l.movementY:$n}}),zp=fe(Ms),$p=m({},Ms,{dataTransfer:0}),zu=fe($p),$u=m({},Tt,{relatedTarget:0}),Ri=fe($u),Hu=m({},Ue,{animationName:0,elapsedTime:0,pseudoElement:0}),Hp=fe(Hu),Up=m({},Ue,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),IT=fe(Up),BT=m({},Ue,{data:0}),oy=fe(BT),FT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zT={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"},$T={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function HT(l){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(l):(l=$T[l])?!!u[l]:!1}function Wp(){return HT}var UT=m({},Tt,{key:function(l){if(l.key){var u=FT[l.key]||l.key;if(u!=="Unidentified")return u}return l.type==="keypress"?(l=Di(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?zT[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wp,charCode:function(l){return l.type==="keypress"?Di(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Di(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),WT=fe(UT),qT=m({},Ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ly=fe(qT),VT=m({},Tt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wp}),GT=fe(VT),YT=m({},Ue,{propertyName:0,elapsedTime:0,pseudoElement:0}),KT=fe(YT),QT=m({},Ms,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),XT=fe(QT),JT=m({},Ue,{newState:0,oldState:0}),ZT=fe(JT),eE=[9,13,27,32],qp=oa&&"CompositionEvent"in window,Wl=null;oa&&"documentMode"in document&&(Wl=document.documentMode);var tE=oa&&"TextEvent"in window&&!Wl,cy=oa&&(!qp||Wl&&8<Wl&&11>=Wl),uy=" ",dy=!1;function fy(l,u){switch(l){case"keyup":return eE.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function py(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var jo=!1;function nE(l,u){switch(l){case"compositionend":return py(u);case"keypress":return u.which!==32?null:(dy=!0,uy);case"textInput":return l=u.data,l===uy&&dy?null:l;default:return null}}function sE(l,u){if(jo)return l==="compositionend"||!qp&&fy(l,u)?(l=Ul(),Mi=Ao=Na=null,jo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return cy&&u.locale!=="ko"?null:u.data;default:return null}}var aE={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 hy(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!aE[l.type]:u==="textarea"}function my(l,u,p,g){Vr?ur?ur.push(g):ur=[g]:Vr=g,u=Md(u,"onChange"),0<u.length&&(p=new gt("onChange","change",null,p,g),l.push({event:p,listeners:u}))}var ql=null,Vl=null;function rE(l){Xw(l,0)}function Uu(l){var u=_t(l);if(Ct(u))return l}function gy(l,u){if(l==="change")return u}var by=!1;if(oa){var Vp;if(oa){var Gp="oninput"in document;if(!Gp){var xy=document.createElement("div");xy.setAttribute("oninput","return;"),Gp=typeof xy.oninput=="function"}Vp=Gp}else Vp=!1;by=Vp&&(!document.documentMode||9<document.documentMode)}function yy(){ql&&(ql.detachEvent("onpropertychange",vy),Vl=ql=null)}function vy(l){if(l.propertyName==="value"&&Uu(Vl)){var u=[];my(u,Vl,l,zl(l)),Hl(rE,u)}}function iE(l,u,p){l==="focusin"?(yy(),ql=u,Vl=p,ql.attachEvent("onpropertychange",vy)):l==="focusout"&&yy()}function oE(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Uu(Vl)}function lE(l,u){if(l==="click")return Uu(u)}function cE(l,u){if(l==="input"||l==="change")return Uu(u)}function uE(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var Ws=typeof Object.is=="function"?Object.is:uE;function Gl(l,u){if(Ws(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var p=Object.keys(l),g=Object.keys(u);if(p.length!==g.length)return!1;for(g=0;g<p.length;g++){var w=p[g];if(!Re.call(u,w)||!Ws(l[w],u[w]))return!1}return!0}function wy(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function ky(l,u){var p=wy(l);l=0;for(var g;p;){if(p.nodeType===3){if(g=l+p.textContent.length,l<=u&&g>=u)return{node:p,offset:u-l};l=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=wy(p)}}function Sy(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?Sy(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function Cy(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var u=en(l.document);u instanceof l.HTMLIFrameElement;){try{var p=typeof u.contentWindow.location.href=="string"}catch{p=!1}if(p)l=u.contentWindow;else break;u=en(l.document)}return u}function Yp(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u&&(u==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||u==="textarea"||l.contentEditable==="true")}var dE=oa&&"documentMode"in document&&11>=document.documentMode,No=null,Kp=null,Yl=null,Qp=!1;function Ay(l,u,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Qp||No==null||No!==en(g)||(g=No,"selectionStart"in g&&Yp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Yl&&Gl(Yl,g)||(Yl=g,g=Md(Kp,"onSelect"),0<g.length&&(u=new gt("onSelect","select",null,u,p),l.push({event:u,listeners:g}),u.target=No)))}function Oi(l,u){var p={};return p[l.toLowerCase()]=u.toLowerCase(),p["Webkit"+l]="webkit"+u,p["Moz"+l]="moz"+u,p}var To={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionrun:Oi("Transition","TransitionRun"),transitionstart:Oi("Transition","TransitionStart"),transitioncancel:Oi("Transition","TransitionCancel"),transitionend:Oi("Transition","TransitionEnd")},Xp={},jy={};oa&&(jy=document.createElement("div").style,"AnimationEvent"in window||(delete To.animationend.animation,delete To.animationiteration.animation,delete To.animationstart.animation),"TransitionEvent"in window||delete To.transitionend.transition);function Li(l){if(Xp[l])return Xp[l];if(!To[l])return l;var u=To[l],p;for(p in u)if(u.hasOwnProperty(p)&&p in jy)return Xp[l]=u[p];return l}var Ny=Li("animationend"),Ty=Li("animationiteration"),Ey=Li("animationstart"),fE=Li("transitionrun"),pE=Li("transitionstart"),hE=Li("transitioncancel"),_y=Li("transitionend"),My=new Map,Jp="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(" ");Jp.push("scrollEnd");function Ta(l,u){My.set(l,u),Es(u,[l])}var Wu=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",l);return}console.error(l)},la=[],Eo=0,Zp=0;function qu(){for(var l=Eo,u=Zp=Eo=0;u<l;){var p=la[u];la[u++]=null;var g=la[u];la[u++]=null;var w=la[u];la[u++]=null;var A=la[u];if(la[u++]=null,g!==null&&w!==null){var L=g.pending;L===null?w.next=w:(w.next=L.next,L.next=w),g.pending=w}A!==0&&Dy(p,w,A)}}function Vu(l,u,p,g){la[Eo++]=l,la[Eo++]=u,la[Eo++]=p,la[Eo++]=g,Zp|=g,l.lanes|=g,l=l.alternate,l!==null&&(l.lanes|=g)}function eh(l,u,p,g){return Vu(l,u,p,g),Gu(l)}function Pi(l,u){return Vu(l,null,null,u),Gu(l)}function Dy(l,u,p){l.lanes|=p;var g=l.alternate;g!==null&&(g.lanes|=p);for(var w=!1,A=l.return;A!==null;)A.childLanes|=p,g=A.alternate,g!==null&&(g.childLanes|=p),A.tag===22&&(l=A.stateNode,l===null||l._visibility&1||(w=!0)),l=A,A=A.return;return l.tag===3?(A=l.stateNode,w&&u!==null&&(w=31-he(p),l=A.hiddenUpdates,g=l[w],g===null?l[w]=[u]:g.push(u),u.lane=p|536870912),A):null}function Gu(l){if(50<gc)throw gc=0,cm=null,Error(s(185));for(var u=l.return;u!==null;)l=u,u=l.return;return l.tag===3?l.stateNode:null}var _o={};function mE(l,u,p,g){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qs(l,u,p,g){return new mE(l,u,p,g)}function th(l){return l=l.prototype,!(!l||!l.isReactComponent)}function dr(l,u){var p=l.alternate;return p===null?(p=qs(l.tag,u,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=u,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&65011712,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,u=l.dependencies,p.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p.refCleanup=l.refCleanup,p}function Ry(l,u){l.flags&=65011714;var p=l.alternate;return p===null?(l.childLanes=0,l.lanes=u,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=p.childLanes,l.lanes=p.lanes,l.child=p.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=p.memoizedProps,l.memoizedState=p.memoizedState,l.updateQueue=p.updateQueue,l.type=p.type,u=p.dependencies,l.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),l}function Yu(l,u,p,g,w,A){var L=0;if(g=l,typeof l=="function")th(l)&&(L=1);else if(typeof l=="string")L=v_(l,p,xe.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case T:return l=qs(31,p,u,w),l.elementType=T,l.lanes=A,l;case S:return Ii(p.children,w,A,u);case C:L=8,w|=24;break;case k:return l=qs(12,p,u,w|2),l.elementType=k,l.lanes=A,l;case D:return l=qs(13,p,u,w),l.elementType=D,l.lanes=A,l;case _:return l=qs(19,p,u,w),l.elementType=_,l.lanes=A,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case j:L=10;break e;case N:L=9;break e;case E:L=11;break e;case P:L=14;break e;case O:L=16,g=null;break e}L=29,p=Error(s(130,l===null?"null":typeof l,"")),g=null}return u=qs(L,p,u,w),u.elementType=l,u.type=g,u.lanes=A,u}function Ii(l,u,p,g){return l=qs(7,l,g,u),l.lanes=p,l}function nh(l,u,p){return l=qs(6,l,null,u),l.lanes=p,l}function Oy(l){var u=qs(18,null,null,0);return u.stateNode=l,u}function sh(l,u,p){return u=qs(4,l.children!==null?l.children:[],l.key,u),u.lanes=p,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}var Ly=new WeakMap;function ca(l,u){if(typeof l=="object"&&l!==null){var p=Ly.get(l);return p!==void 0?p:(u={value:l,source:u,stack:ye(u)},Ly.set(l,u),u)}return{value:l,source:u,stack:ye(u)}}var Mo=[],Do=0,Ku=null,Kl=0,ua=[],da=0,Kr=null,za=1,$a="";function fr(l,u){Mo[Do++]=Kl,Mo[Do++]=Ku,Ku=l,Kl=u}function Py(l,u,p){ua[da++]=za,ua[da++]=$a,ua[da++]=Kr,Kr=l;var g=za;l=$a;var w=32-he(g)-1;g&=~(1<<w),p+=1;var A=32-he(u)+w;if(30<A){var L=w-w%5;A=(g&(1<<L)-1).toString(32),g>>=L,w-=L,za=1<<32-he(u)+w|p<<w|g,$a=A+l}else za=1<<A|p<<w|g,$a=l}function ah(l){l.return!==null&&(fr(l,1),Py(l,1,0))}function rh(l){for(;l===Ku;)Ku=Mo[--Do],Mo[Do]=null,Kl=Mo[--Do],Mo[Do]=null;for(;l===Kr;)Kr=ua[--da],ua[da]=null,$a=ua[--da],ua[da]=null,za=ua[--da],ua[da]=null}function Iy(l,u){ua[da++]=za,ua[da++]=$a,ua[da++]=Kr,za=u.id,$a=u.overflow,Kr=l}var us=null,_n=null,rn=!1,Qr=null,fa=!1,ih=Error(s(519));function Xr(l){var u=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ql(ca(u,l)),ih}function By(l){var u=l.stateNode,p=l.type,g=l.memoizedProps;switch(u[xt]=l,u[Dt]=g,p){case"dialog":Kt("cancel",u),Kt("close",u);break;case"iframe":case"object":case"embed":Kt("load",u);break;case"video":case"audio":for(p=0;p<xc.length;p++)Kt(xc[p],u);break;case"source":Kt("error",u);break;case"img":case"image":case"link":Kt("error",u),Kt("load",u);break;case"details":Kt("toggle",u);break;case"input":Kt("invalid",u),Nn(u,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Kt("invalid",u);break;case"textarea":Kt("invalid",u),Aa(u,g.value,g.defaultValue,g.children)}p=g.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||u.textContent===""+p||g.suppressHydrationWarning===!0||t0(u.textContent,p)?(g.popover!=null&&(Kt("beforetoggle",u),Kt("toggle",u)),g.onScroll!=null&&Kt("scroll",u),g.onScrollEnd!=null&&Kt("scrollend",u),g.onClick!=null&&(u.onclick=ja),u=!0):u=!1,u||Xr(l,!0)}function Fy(l){for(us=l.return;us;)switch(us.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:us=us.return}}function Ro(l){if(l!==us)return!1;if(!rn)return Fy(l),rn=!0,!1;var u=l.tag,p;if((p=u!==3&&u!==27)&&((p=u===5)&&(p=l.type,p=!(p!=="form"&&p!=="button")||Cm(l.type,l.memoizedProps)),p=!p),p&&_n&&Xr(l),Fy(l),u===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));_n=u0(l)}else if(u===31){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));_n=u0(l)}else u===27?(u=_n,di(l.type)?(l=Em,Em=null,_n=l):_n=u):_n=us?ha(l.stateNode.nextSibling):null;return!0}function Bi(){_n=us=null,rn=!1}function oh(){var l=Qr;return l!==null&&(Ls===null?Ls=l:Ls.push.apply(Ls,l),Qr=null),l}function Ql(l){Qr===null?Qr=[l]:Qr.push(l)}var lh=Q(null),Fi=null,pr=null;function Jr(l,u,p){q(lh,u._currentValue),u._currentValue=p}function hr(l){l._currentValue=lh.current,K(lh)}function ch(l,u,p){for(;l!==null;){var g=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,g!==null&&(g.childLanes|=u)):g!==null&&(g.childLanes&u)!==u&&(g.childLanes|=u),l===p)break;l=l.return}}function uh(l,u,p,g){var w=l.child;for(w!==null&&(w.return=l);w!==null;){var A=w.dependencies;if(A!==null){var L=w.child;A=A.firstContext;e:for(;A!==null;){var Y=A;A=w;for(var ae=0;ae<u.length;ae++)if(Y.context===u[ae]){A.lanes|=p,Y=A.alternate,Y!==null&&(Y.lanes|=p),ch(A.return,p,l),g||(L=null);break e}A=Y.next}}else if(w.tag===18){if(L=w.return,L===null)throw Error(s(341));L.lanes|=p,A=L.alternate,A!==null&&(A.lanes|=p),ch(L,p,l),L=null}else L=w.child;if(L!==null)L.return=w;else for(L=w;L!==null;){if(L===l){L=null;break}if(w=L.sibling,w!==null){w.return=L.return,L=w;break}L=L.return}w=L}}function Oo(l,u,p,g){l=null;for(var w=u,A=!1;w!==null;){if(!A){if((w.flags&524288)!==0)A=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var L=w.alternate;if(L===null)throw Error(s(387));if(L=L.memoizedProps,L!==null){var Y=w.type;Ws(w.pendingProps.value,L.value)||(l!==null?l.push(Y):l=[Y])}}else if(w===be.current){if(L=w.alternate,L===null)throw Error(s(387));L.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(l!==null?l.push(Sc):l=[Sc])}w=w.return}l!==null&&uh(u,l,p,g),u.flags|=262144}function Qu(l){for(l=l.firstContext;l!==null;){if(!Ws(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function zi(l){Fi=l,pr=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function ds(l){return zy(Fi,l)}function Xu(l,u){return Fi===null&&zi(l),zy(l,u)}function zy(l,u){var p=u._currentValue;if(u={context:u,memoizedValue:p,next:null},pr===null){if(l===null)throw Error(s(308));pr=u,l.dependencies={lanes:0,firstContext:u},l.flags|=524288}else pr=pr.next=u;return p}var gE=typeof AbortController<"u"?AbortController:function(){var l=[],u=this.signal={aborted:!1,addEventListener:function(p,g){l.push(g)}};this.abort=function(){u.aborted=!0,l.forEach(function(p){return p()})}},bE=t.unstable_scheduleCallback,xE=t.unstable_NormalPriority,Gn={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dh(){return{controller:new gE,data:new Map,refCount:0}}function Xl(l){l.refCount--,l.refCount===0&&bE(xE,function(){l.controller.abort()})}var Jl=null,fh=0,Lo=0,Po=null;function yE(l,u){if(Jl===null){var p=Jl=[];fh=0,Lo=mm(),Po={status:"pending",value:void 0,then:function(g){p.push(g)}}}return fh++,u.then($y,$y),u}function $y(){if(--fh===0&&Jl!==null){Po!==null&&(Po.status="fulfilled");var l=Jl;Jl=null,Lo=0,Po=null;for(var u=0;u<l.length;u++)(0,l[u])()}}function vE(l,u){var p=[],g={status:"pending",value:null,reason:null,then:function(w){p.push(w)}};return l.then(function(){g.status="fulfilled",g.value=u;for(var w=0;w<p.length;w++)(0,p[w])(u)},function(w){for(g.status="rejected",g.reason=w,w=0;w<p.length;w++)(0,p[w])(void 0)}),g}var Hy=F.S;F.S=function(l,u){Aw=ut(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&yE(l,u),Hy!==null&&Hy(l,u)};var $i=Q(null);function ph(){var l=$i.current;return l!==null?l:An.pooledCache}function Ju(l,u){u===null?q($i,$i.current):q($i,u.pool)}function Uy(){var l=ph();return l===null?null:{parent:Gn._currentValue,pool:l}}var Io=Error(s(460)),hh=Error(s(474)),Zu=Error(s(542)),ed={then:function(){}};function Wy(l){return l=l.status,l==="fulfilled"||l==="rejected"}function qy(l,u,p){switch(p=l[p],p===void 0?l.push(u):p!==u&&(u.then(ja,ja),u=p),u.status){case"fulfilled":return u.value;case"rejected":throw l=u.reason,Gy(l),l;default:if(typeof u.status=="string")u.then(ja,ja);else{if(l=An,l!==null&&100<l.shellSuspendCounter)throw Error(s(482));l=u,l.status="pending",l.then(function(g){if(u.status==="pending"){var w=u;w.status="fulfilled",w.value=g}},function(g){if(u.status==="pending"){var w=u;w.status="rejected",w.reason=g}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw l=u.reason,Gy(l),l}throw Ui=u,Io}}function Hi(l){try{var u=l._init;return u(l._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Ui=p,Io):p}}var Ui=null;function Vy(){if(Ui===null)throw Error(s(459));var l=Ui;return Ui=null,l}function Gy(l){if(l===Io||l===Zu)throw Error(s(483))}var Bo=null,Zl=0;function td(l){var u=Zl;return Zl+=1,Bo===null&&(Bo=[]),qy(Bo,l,u)}function ec(l,u){u=u.props.ref,l.ref=u!==void 0?u:null}function nd(l,u){throw u.$$typeof===x?Error(s(525)):(l=Object.prototype.toString.call(u),Error(s(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l)))}function Yy(l){function u(Se,le){if(l){var Me=Se.deletions;Me===null?(Se.deletions=[le],Se.flags|=16):Me.push(le)}}function p(Se,le){if(!l)return null;for(;le!==null;)u(Se,le),le=le.sibling;return null}function g(Se){for(var le=new Map;Se!==null;)Se.key!==null?le.set(Se.key,Se):le.set(Se.index,Se),Se=Se.sibling;return le}function w(Se,le){return Se=dr(Se,le),Se.index=0,Se.sibling=null,Se}function A(Se,le,Me){return Se.index=Me,l?(Me=Se.alternate,Me!==null?(Me=Me.index,Me<le?(Se.flags|=67108866,le):Me):(Se.flags|=67108866,le)):(Se.flags|=1048576,le)}function L(Se){return l&&Se.alternate===null&&(Se.flags|=67108866),Se}function Y(Se,le,Me,Xe){return le===null||le.tag!==6?(le=nh(Me,Se.mode,Xe),le.return=Se,le):(le=w(le,Me),le.return=Se,le)}function ae(Se,le,Me,Xe){var Et=Me.type;return Et===S?Ke(Se,le,Me.props.children,Xe,Me.key):le!==null&&(le.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===O&&Hi(Et)===le.type)?(le=w(le,Me.props),ec(le,Me),le.return=Se,le):(le=Yu(Me.type,Me.key,Me.props,null,Se.mode,Xe),ec(le,Me),le.return=Se,le)}function Oe(Se,le,Me,Xe){return le===null||le.tag!==4||le.stateNode.containerInfo!==Me.containerInfo||le.stateNode.implementation!==Me.implementation?(le=sh(Me,Se.mode,Xe),le.return=Se,le):(le=w(le,Me.children||[]),le.return=Se,le)}function Ke(Se,le,Me,Xe,Et){return le===null||le.tag!==7?(le=Ii(Me,Se.mode,Xe,Et),le.return=Se,le):(le=w(le,Me),le.return=Se,le)}function Ze(Se,le,Me){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=nh(""+le,Se.mode,Me),le.return=Se,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return Me=Yu(le.type,le.key,le.props,null,Se.mode,Me),ec(Me,le),Me.return=Se,Me;case v:return le=sh(le,Se.mode,Me),le.return=Se,le;case O:return le=Hi(le),Ze(Se,le,Me)}if($(le)||I(le))return le=Ii(le,Se.mode,Me,null),le.return=Se,le;if(typeof le.then=="function")return Ze(Se,td(le),Me);if(le.$$typeof===j)return Ze(Se,Xu(Se,le),Me);nd(Se,le)}return null}function Fe(Se,le,Me,Xe){var Et=le!==null?le.key:null;if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return Et!==null?null:Y(Se,le,""+Me,Xe);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case y:return Me.key===Et?ae(Se,le,Me,Xe):null;case v:return Me.key===Et?Oe(Se,le,Me,Xe):null;case O:return Me=Hi(Me),Fe(Se,le,Me,Xe)}if($(Me)||I(Me))return Et!==null?null:Ke(Se,le,Me,Xe,null);if(typeof Me.then=="function")return Fe(Se,le,td(Me),Xe);if(Me.$$typeof===j)return Fe(Se,le,Xu(Se,Me),Xe);nd(Se,Me)}return null}function qe(Se,le,Me,Xe,Et){if(typeof Xe=="string"&&Xe!==""||typeof Xe=="number"||typeof Xe=="bigint")return Se=Se.get(Me)||null,Y(le,Se,""+Xe,Et);if(typeof Xe=="object"&&Xe!==null){switch(Xe.$$typeof){case y:return Se=Se.get(Xe.key===null?Me:Xe.key)||null,ae(le,Se,Xe,Et);case v:return Se=Se.get(Xe.key===null?Me:Xe.key)||null,Oe(le,Se,Xe,Et);case O:return Xe=Hi(Xe),qe(Se,le,Me,Xe,Et)}if($(Xe)||I(Xe))return Se=Se.get(Me)||null,Ke(le,Se,Xe,Et,null);if(typeof Xe.then=="function")return qe(Se,le,Me,td(Xe),Et);if(Xe.$$typeof===j)return qe(Se,le,Me,Xu(le,Xe),Et);nd(le,Xe)}return null}function yt(Se,le,Me,Xe){for(var Et=null,un=null,kt=le,Ut=le=0,sn=null;kt!==null&&Ut<Me.length;Ut++){kt.index>Ut?(sn=kt,kt=null):sn=kt.sibling;var dn=Fe(Se,kt,Me[Ut],Xe);if(dn===null){kt===null&&(kt=sn);break}l&&kt&&dn.alternate===null&&u(Se,kt),le=A(dn,le,Ut),un===null?Et=dn:un.sibling=dn,un=dn,kt=sn}if(Ut===Me.length)return p(Se,kt),rn&&fr(Se,Ut),Et;if(kt===null){for(;Ut<Me.length;Ut++)kt=Ze(Se,Me[Ut],Xe),kt!==null&&(le=A(kt,le,Ut),un===null?Et=kt:un.sibling=kt,un=kt);return rn&&fr(Se,Ut),Et}for(kt=g(kt);Ut<Me.length;Ut++)sn=qe(kt,Se,Ut,Me[Ut],Xe),sn!==null&&(l&&sn.alternate!==null&&kt.delete(sn.key===null?Ut:sn.key),le=A(sn,le,Ut),un===null?Et=sn:un.sibling=sn,un=sn);return l&&kt.forEach(function(gi){return u(Se,gi)}),rn&&fr(Se,Ut),Et}function Ot(Se,le,Me,Xe){if(Me==null)throw Error(s(151));for(var Et=null,un=null,kt=le,Ut=le=0,sn=null,dn=Me.next();kt!==null&&!dn.done;Ut++,dn=Me.next()){kt.index>Ut?(sn=kt,kt=null):sn=kt.sibling;var gi=Fe(Se,kt,dn.value,Xe);if(gi===null){kt===null&&(kt=sn);break}l&&kt&&gi.alternate===null&&u(Se,kt),le=A(gi,le,Ut),un===null?Et=gi:un.sibling=gi,un=gi,kt=sn}if(dn.done)return p(Se,kt),rn&&fr(Se,Ut),Et;if(kt===null){for(;!dn.done;Ut++,dn=Me.next())dn=Ze(Se,dn.value,Xe),dn!==null&&(le=A(dn,le,Ut),un===null?Et=dn:un.sibling=dn,un=dn);return rn&&fr(Se,Ut),Et}for(kt=g(kt);!dn.done;Ut++,dn=Me.next())dn=qe(kt,Se,Ut,dn.value,Xe),dn!==null&&(l&&dn.alternate!==null&&kt.delete(dn.key===null?Ut:dn.key),le=A(dn,le,Ut),un===null?Et=dn:un.sibling=dn,un=dn);return l&&kt.forEach(function(M_){return u(Se,M_)}),rn&&fr(Se,Ut),Et}function wn(Se,le,Me,Xe){if(typeof Me=="object"&&Me!==null&&Me.type===S&&Me.key===null&&(Me=Me.props.children),typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case y:e:{for(var Et=Me.key;le!==null;){if(le.key===Et){if(Et=Me.type,Et===S){if(le.tag===7){p(Se,le.sibling),Xe=w(le,Me.props.children),Xe.return=Se,Se=Xe;break e}}else if(le.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===O&&Hi(Et)===le.type){p(Se,le.sibling),Xe=w(le,Me.props),ec(Xe,Me),Xe.return=Se,Se=Xe;break e}p(Se,le);break}else u(Se,le);le=le.sibling}Me.type===S?(Xe=Ii(Me.props.children,Se.mode,Xe,Me.key),Xe.return=Se,Se=Xe):(Xe=Yu(Me.type,Me.key,Me.props,null,Se.mode,Xe),ec(Xe,Me),Xe.return=Se,Se=Xe)}return L(Se);case v:e:{for(Et=Me.key;le!==null;){if(le.key===Et)if(le.tag===4&&le.stateNode.containerInfo===Me.containerInfo&&le.stateNode.implementation===Me.implementation){p(Se,le.sibling),Xe=w(le,Me.children||[]),Xe.return=Se,Se=Xe;break e}else{p(Se,le);break}else u(Se,le);le=le.sibling}Xe=sh(Me,Se.mode,Xe),Xe.return=Se,Se=Xe}return L(Se);case O:return Me=Hi(Me),wn(Se,le,Me,Xe)}if($(Me))return yt(Se,le,Me,Xe);if(I(Me)){if(Et=I(Me),typeof Et!="function")throw Error(s(150));return Me=Et.call(Me),Ot(Se,le,Me,Xe)}if(typeof Me.then=="function")return wn(Se,le,td(Me),Xe);if(Me.$$typeof===j)return wn(Se,le,Xu(Se,Me),Xe);nd(Se,Me)}return typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint"?(Me=""+Me,le!==null&&le.tag===6?(p(Se,le.sibling),Xe=w(le,Me),Xe.return=Se,Se=Xe):(p(Se,le),Xe=nh(Me,Se.mode,Xe),Xe.return=Se,Se=Xe),L(Se)):p(Se,le)}return function(Se,le,Me,Xe){try{Zl=0;var Et=wn(Se,le,Me,Xe);return Bo=null,Et}catch(kt){if(kt===Io||kt===Zu)throw kt;var un=qs(29,kt,null,Se.mode);return un.lanes=Xe,un.return=Se,un}finally{}}}var Wi=Yy(!0),Ky=Yy(!1),Zr=!1;function mh(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gh(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function ei(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function ti(l,u,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(pn&2)!==0){var w=g.pending;return w===null?u.next=u:(u.next=w.next,w.next=u),g.pending=u,u=Gu(l),Dy(l,null,p),u}return Vu(l,g,u,p),Gu(l)}function tc(l,u,p){if(u=u.updateQueue,u!==null&&(u=u.shared,(p&4194048)!==0)){var g=u.lanes;g&=l.pendingLanes,p|=g,u.lanes=p,Nt(l,p)}}function bh(l,u){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var w=null,A=null;if(p=p.firstBaseUpdate,p!==null){do{var L={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};A===null?w=A=L:A=A.next=L,p=p.next}while(p!==null);A===null?w=A=u:A=A.next=u}else w=A=u;p={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:A,shared:g.shared,callbacks:g.callbacks},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=u}var xh=!1;function nc(){if(xh){var l=Po;if(l!==null)throw l}}function sc(l,u,p,g){xh=!1;var w=l.updateQueue;Zr=!1;var A=w.firstBaseUpdate,L=w.lastBaseUpdate,Y=w.shared.pending;if(Y!==null){w.shared.pending=null;var ae=Y,Oe=ae.next;ae.next=null,L===null?A=Oe:L.next=Oe,L=ae;var Ke=l.alternate;Ke!==null&&(Ke=Ke.updateQueue,Y=Ke.lastBaseUpdate,Y!==L&&(Y===null?Ke.firstBaseUpdate=Oe:Y.next=Oe,Ke.lastBaseUpdate=ae))}if(A!==null){var Ze=w.baseState;L=0,Ke=Oe=ae=null,Y=A;do{var Fe=Y.lane&-536870913,qe=Fe!==Y.lane;if(qe?(nn&Fe)===Fe:(g&Fe)===Fe){Fe!==0&&Fe===Lo&&(xh=!0),Ke!==null&&(Ke=Ke.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var yt=l,Ot=Y;Fe=u;var wn=p;switch(Ot.tag){case 1:if(yt=Ot.payload,typeof yt=="function"){Ze=yt.call(wn,Ze,Fe);break e}Ze=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=Ot.payload,Fe=typeof yt=="function"?yt.call(wn,Ze,Fe):yt,Fe==null)break e;Ze=m({},Ze,Fe);break e;case 2:Zr=!0}}Fe=Y.callback,Fe!==null&&(l.flags|=64,qe&&(l.flags|=8192),qe=w.callbacks,qe===null?w.callbacks=[Fe]:qe.push(Fe))}else qe={lane:Fe,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},Ke===null?(Oe=Ke=qe,ae=Ze):Ke=Ke.next=qe,L|=Fe;if(Y=Y.next,Y===null){if(Y=w.shared.pending,Y===null)break;qe=Y,Y=qe.next,qe.next=null,w.lastBaseUpdate=qe,w.shared.pending=null}}while(!0);Ke===null&&(ae=Ze),w.baseState=ae,w.firstBaseUpdate=Oe,w.lastBaseUpdate=Ke,A===null&&(w.shared.lanes=0),ii|=L,l.lanes=L,l.memoizedState=Ze}}function Qy(l,u){if(typeof l!="function")throw Error(s(191,l));l.call(u)}function Xy(l,u){var p=l.callbacks;if(p!==null)for(l.callbacks=null,l=0;l<p.length;l++)Qy(p[l],u)}var Fo=Q(null),sd=Q(0);function Jy(l,u){l=Sr,q(sd,l),q(Fo,u),Sr=l|u.baseLanes}function yh(){q(sd,Sr),q(Fo,Fo.current)}function vh(){Sr=sd.current,K(Fo),K(sd)}var Vs=Q(null),pa=null;function ni(l){var u=l.alternate;q(Hn,Hn.current&1),q(Vs,l),pa===null&&(u===null||Fo.current!==null||u.memoizedState!==null)&&(pa=l)}function wh(l){q(Hn,Hn.current),q(Vs,l),pa===null&&(pa=l)}function Zy(l){l.tag===22?(q(Hn,Hn.current),q(Vs,l),pa===null&&(pa=l)):si()}function si(){q(Hn,Hn.current),q(Vs,Vs.current)}function Gs(l){K(Vs),pa===l&&(pa=null),K(Hn)}var Hn=Q(0);function ad(l){for(var u=l;u!==null;){if(u.tag===13){var p=u.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Nm(p)||Tm(p)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var mr=0,Ht=null,yn=null,Yn=null,rd=!1,zo=!1,qi=!1,id=0,ac=0,$o=null,wE=0;function In(){throw Error(s(321))}function kh(l,u){if(u===null)return!1;for(var p=0;p<u.length&&p<l.length;p++)if(!Ws(l[p],u[p]))return!1;return!0}function Sh(l,u,p,g,w,A){return mr=A,Ht=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,F.H=l===null||l.memoizedState===null?Pv:Bh,qi=!1,A=p(g,w),qi=!1,zo&&(A=tv(u,p,g,w)),ev(l),A}function ev(l){F.H=oc;var u=yn!==null&&yn.next!==null;if(mr=0,Yn=yn=Ht=null,rd=!1,ac=0,$o=null,u)throw Error(s(300));l===null||Kn||(l=l.dependencies,l!==null&&Qu(l)&&(Kn=!0))}function tv(l,u,p,g){Ht=l;var w=0;do{if(zo&&($o=null),ac=0,zo=!1,25<=w)throw Error(s(301));if(w+=1,Yn=yn=null,l.updateQueue!=null){var A=l.updateQueue;A.lastEffect=null,A.events=null,A.stores=null,A.memoCache!=null&&(A.memoCache.index=0)}F.H=Iv,A=u(p,g)}while(zo);return A}function kE(){var l=F.H,u=l.useState()[0];return u=typeof u.then=="function"?rc(u):u,l=l.useState()[0],(yn!==null?yn.memoizedState:null)!==l&&(Ht.flags|=1024),u}function Ch(){var l=id!==0;return id=0,l}function Ah(l,u,p){u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~p}function jh(l){if(rd){for(l=l.memoizedState;l!==null;){var u=l.queue;u!==null&&(u.pending=null),l=l.next}rd=!1}mr=0,Yn=yn=Ht=null,zo=!1,ac=id=0,$o=null}function Cs(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yn===null?Ht.memoizedState=Yn=l:Yn=Yn.next=l,Yn}function Un(){if(yn===null){var l=Ht.alternate;l=l!==null?l.memoizedState:null}else l=yn.next;var u=Yn===null?Ht.memoizedState:Yn.next;if(u!==null)Yn=u,yn=l;else{if(l===null)throw Ht.alternate===null?Error(s(467)):Error(s(310));yn=l,l={memoizedState:yn.memoizedState,baseState:yn.baseState,baseQueue:yn.baseQueue,queue:yn.queue,next:null},Yn===null?Ht.memoizedState=Yn=l:Yn=Yn.next=l}return Yn}function od(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rc(l){var u=ac;return ac+=1,$o===null&&($o=[]),l=qy($o,l,u),u=Ht,(Yn===null?u.memoizedState:Yn.next)===null&&(u=u.alternate,F.H=u===null||u.memoizedState===null?Pv:Bh),l}function ld(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return rc(l);if(l.$$typeof===j)return ds(l)}throw Error(s(438,String(l)))}function Nh(l){var u=null,p=Ht.updateQueue;if(p!==null&&(u=p.memoCache),u==null){var g=Ht.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(u={data:g.data.map(function(w){return w.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),p===null&&(p=od(),Ht.updateQueue=p),p.memoCache=u,p=u.data[u.index],p===void 0)for(p=u.data[u.index]=Array(l),g=0;g<l;g++)p[g]=M;return u.index++,p}function gr(l,u){return typeof u=="function"?u(l):u}function cd(l){var u=Un();return Th(u,yn,l)}function Th(l,u,p){var g=l.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=p;var w=l.baseQueue,A=g.pending;if(A!==null){if(w!==null){var L=w.next;w.next=A.next,A.next=L}u.baseQueue=w=A,g.pending=null}if(A=l.baseState,w===null)l.memoizedState=A;else{u=w.next;var Y=L=null,ae=null,Oe=u,Ke=!1;do{var Ze=Oe.lane&-536870913;if(Ze!==Oe.lane?(nn&Ze)===Ze:(mr&Ze)===Ze){var Fe=Oe.revertLane;if(Fe===0)ae!==null&&(ae=ae.next={lane:0,revertLane:0,gesture:null,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null}),Ze===Lo&&(Ke=!0);else if((mr&Fe)===Fe){Oe=Oe.next,Fe===Lo&&(Ke=!0);continue}else Ze={lane:0,revertLane:Oe.revertLane,gesture:null,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null},ae===null?(Y=ae=Ze,L=A):ae=ae.next=Ze,Ht.lanes|=Fe,ii|=Fe;Ze=Oe.action,qi&&p(A,Ze),A=Oe.hasEagerState?Oe.eagerState:p(A,Ze)}else Fe={lane:Ze,revertLane:Oe.revertLane,gesture:Oe.gesture,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null},ae===null?(Y=ae=Fe,L=A):ae=ae.next=Fe,Ht.lanes|=Ze,ii|=Ze;Oe=Oe.next}while(Oe!==null&&Oe!==u);if(ae===null?L=A:ae.next=Y,!Ws(A,l.memoizedState)&&(Kn=!0,Ke&&(p=Po,p!==null)))throw p;l.memoizedState=A,l.baseState=L,l.baseQueue=ae,g.lastRenderedState=A}return w===null&&(g.lanes=0),[l.memoizedState,g.dispatch]}function Eh(l){var u=Un(),p=u.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=l;var g=p.dispatch,w=p.pending,A=u.memoizedState;if(w!==null){p.pending=null;var L=w=w.next;do A=l(A,L.action),L=L.next;while(L!==w);Ws(A,u.memoizedState)||(Kn=!0),u.memoizedState=A,u.baseQueue===null&&(u.baseState=A),p.lastRenderedState=A}return[A,g]}function nv(l,u,p){var g=Ht,w=Un(),A=rn;if(A){if(p===void 0)throw Error(s(407));p=p()}else p=u();var L=!Ws((yn||w).memoizedState,p);if(L&&(w.memoizedState=p,Kn=!0),w=w.queue,Dh(rv.bind(null,g,w,l),[l]),w.getSnapshot!==u||L||Yn!==null&&Yn.memoizedState.tag&1){if(g.flags|=2048,Ho(9,{destroy:void 0},av.bind(null,g,w,p,u),null),An===null)throw Error(s(349));A||(mr&127)!==0||sv(g,u,p)}return p}function sv(l,u,p){l.flags|=16384,l={getSnapshot:u,value:p},u=Ht.updateQueue,u===null?(u=od(),Ht.updateQueue=u,u.stores=[l]):(p=u.stores,p===null?u.stores=[l]:p.push(l))}function av(l,u,p,g){u.value=p,u.getSnapshot=g,iv(u)&&ov(l)}function rv(l,u,p){return p(function(){iv(u)&&ov(l)})}function iv(l){var u=l.getSnapshot;l=l.value;try{var p=u();return!Ws(l,p)}catch{return!0}}function ov(l){var u=Pi(l,2);u!==null&&Ps(u,l,2)}function _h(l){var u=Cs();if(typeof l=="function"){var p=l;if(l=p(),qi){oe(!0);try{p()}finally{oe(!1)}}}return u.memoizedState=u.baseState=l,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:l},u}function lv(l,u,p,g){return l.baseState=p,Th(l,yn,typeof g=="function"?g:gr)}function SE(l,u,p,g,w){if(fd(l))throw Error(s(485));if(l=u.action,l!==null){var A={payload:w,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){A.listeners.push(L)}};F.T!==null?p(!0):A.isTransition=!1,g(A),p=u.pending,p===null?(A.next=u.pending=A,cv(u,A)):(A.next=p.next,u.pending=p.next=A)}}function cv(l,u){var p=u.action,g=u.payload,w=l.state;if(u.isTransition){var A=F.T,L={};F.T=L;try{var Y=p(w,g),ae=F.S;ae!==null&&ae(L,Y),uv(l,u,Y)}catch(Oe){Mh(l,u,Oe)}finally{A!==null&&L.types!==null&&(A.types=L.types),F.T=A}}else try{A=p(w,g),uv(l,u,A)}catch(Oe){Mh(l,u,Oe)}}function uv(l,u,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(g){dv(l,u,g)},function(g){return Mh(l,u,g)}):dv(l,u,p)}function dv(l,u,p){u.status="fulfilled",u.value=p,fv(u),l.state=p,u=l.pending,u!==null&&(p=u.next,p===u?l.pending=null:(p=p.next,u.next=p,cv(l,p)))}function Mh(l,u,p){var g=l.pending;if(l.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=p,fv(u),u=u.next;while(u!==g)}l.action=null}function fv(l){l=l.listeners;for(var u=0;u<l.length;u++)(0,l[u])()}function pv(l,u){return u}function hv(l,u){if(rn){var p=An.formState;if(p!==null){e:{var g=Ht;if(rn){if(_n){t:{for(var w=_n,A=fa;w.nodeType!==8;){if(!A){w=null;break t}if(w=ha(w.nextSibling),w===null){w=null;break t}}A=w.data,w=A==="F!"||A==="F"?w:null}if(w){_n=ha(w.nextSibling),g=w.data==="F!";break e}}Xr(g)}g=!1}g&&(u=p[0])}}return p=Cs(),p.memoizedState=p.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pv,lastRenderedState:u},p.queue=g,p=Rv.bind(null,Ht,g),g.dispatch=p,g=_h(!1),A=Ih.bind(null,Ht,!1,g.queue),g=Cs(),w={state:u,dispatch:null,action:l,pending:null},g.queue=w,p=SE.bind(null,Ht,w,A,p),w.dispatch=p,g.memoizedState=l,[u,p,!1]}function mv(l){var u=Un();return gv(u,yn,l)}function gv(l,u,p){if(u=Th(l,u,pv)[0],l=cd(gr)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=rc(u)}catch(L){throw L===Io?Zu:L}else g=u;u=Un();var w=u.queue,A=w.dispatch;return p!==u.memoizedState&&(Ht.flags|=2048,Ho(9,{destroy:void 0},CE.bind(null,w,p),null)),[g,A,l]}function CE(l,u){l.action=u}function bv(l){var u=Un(),p=yn;if(p!==null)return gv(u,p,l);Un(),u=u.memoizedState,p=Un();var g=p.queue.dispatch;return p.memoizedState=l,[u,g,!1]}function Ho(l,u,p,g){return l={tag:l,create:p,deps:g,inst:u,next:null},u=Ht.updateQueue,u===null&&(u=od(),Ht.updateQueue=u),p=u.lastEffect,p===null?u.lastEffect=l.next=l:(g=p.next,p.next=l,l.next=g,u.lastEffect=l),l}function xv(){return Un().memoizedState}function ud(l,u,p,g){var w=Cs();Ht.flags|=l,w.memoizedState=Ho(1|u,{destroy:void 0},p,g===void 0?null:g)}function dd(l,u,p,g){var w=Un();g=g===void 0?null:g;var A=w.memoizedState.inst;yn!==null&&g!==null&&kh(g,yn.memoizedState.deps)?w.memoizedState=Ho(u,A,p,g):(Ht.flags|=l,w.memoizedState=Ho(1|u,A,p,g))}function yv(l,u){ud(8390656,8,l,u)}function Dh(l,u){dd(2048,8,l,u)}function AE(l){Ht.flags|=4;var u=Ht.updateQueue;if(u===null)u=od(),Ht.updateQueue=u,u.events=[l];else{var p=u.events;p===null?u.events=[l]:p.push(l)}}function vv(l){var u=Un().memoizedState;return AE({ref:u,nextImpl:l}),function(){if((pn&2)!==0)throw Error(s(440));return u.impl.apply(void 0,arguments)}}function wv(l,u){return dd(4,2,l,u)}function kv(l,u){return dd(4,4,l,u)}function Sv(l,u){if(typeof u=="function"){l=l();var p=u(l);return function(){typeof p=="function"?p():u(null)}}if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function Cv(l,u,p){p=p!=null?p.concat([l]):null,dd(4,4,Sv.bind(null,u,l),p)}function Rh(){}function Av(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;return u!==null&&kh(u,g[1])?g[0]:(p.memoizedState=[l,u],l)}function jv(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;if(u!==null&&kh(u,g[1]))return g[0];if(g=l(),qi){oe(!0);try{l()}finally{oe(!1)}}return p.memoizedState=[g,u],g}function Oh(l,u,p){return p===void 0||(mr&1073741824)!==0&&(nn&261930)===0?l.memoizedState=u:(l.memoizedState=p,l=Nw(),Ht.lanes|=l,ii|=l,p)}function Nv(l,u,p,g){return Ws(p,u)?p:Fo.current!==null?(l=Oh(l,p,g),Ws(l,u)||(Kn=!0),l):(mr&42)===0||(mr&1073741824)!==0&&(nn&261930)===0?(Kn=!0,l.memoizedState=p):(l=Nw(),Ht.lanes|=l,ii|=l,u)}function Tv(l,u,p,g,w){var A=H.p;H.p=A!==0&&8>A?A:8;var L=F.T,Y={};F.T=Y,Ih(l,!1,u,p);try{var ae=w(),Oe=F.S;if(Oe!==null&&Oe(Y,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var Ke=vE(ae,g);ic(l,u,Ke,Qs(l))}else ic(l,u,g,Qs(l))}catch(Ze){ic(l,u,{then:function(){},status:"rejected",reason:Ze},Qs())}finally{H.p=A,L!==null&&Y.types!==null&&(L.types=Y.types),F.T=L}}function jE(){}function Lh(l,u,p,g){if(l.tag!==5)throw Error(s(476));var w=Ev(l).queue;Tv(l,w,u,V,p===null?jE:function(){return _v(l),p(g)})}function Ev(l){var u=l.memoizedState;if(u!==null)return u;u={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:V},next:null};var p={};return u.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:p},next:null},l.memoizedState=u,l=l.alternate,l!==null&&(l.memoizedState=u),u}function _v(l){var u=Ev(l);u.next===null&&(u=l.alternate.memoizedState),ic(l,u.next.queue,{},Qs())}function Ph(){return ds(Sc)}function Mv(){return Un().memoizedState}function Dv(){return Un().memoizedState}function NE(l){for(var u=l.return;u!==null;){switch(u.tag){case 24:case 3:var p=Qs();l=ei(p);var g=ti(u,l,p);g!==null&&(Ps(g,u,p),tc(g,u,p)),u={cache:dh()},l.payload=u;return}u=u.return}}function TE(l,u,p){var g=Qs();p={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},fd(l)?Ov(u,p):(p=eh(l,u,p,g),p!==null&&(Ps(p,l,g),Lv(p,u,g)))}function Rv(l,u,p){var g=Qs();ic(l,u,p,g)}function ic(l,u,p,g){var w={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(fd(l))Ov(u,w);else{var A=l.alternate;if(l.lanes===0&&(A===null||A.lanes===0)&&(A=u.lastRenderedReducer,A!==null))try{var L=u.lastRenderedState,Y=A(L,p);if(w.hasEagerState=!0,w.eagerState=Y,Ws(Y,L))return Vu(l,u,w,0),An===null&&qu(),!1}catch{}finally{}if(p=eh(l,u,w,g),p!==null)return Ps(p,l,g),Lv(p,u,g),!0}return!1}function Ih(l,u,p,g){if(g={lane:2,revertLane:mm(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},fd(l)){if(u)throw Error(s(479))}else u=eh(l,p,g,2),u!==null&&Ps(u,l,2)}function fd(l){var u=l.alternate;return l===Ht||u!==null&&u===Ht}function Ov(l,u){zo=rd=!0;var p=l.pending;p===null?u.next=u:(u.next=p.next,p.next=u),l.pending=u}function Lv(l,u,p){if((p&4194048)!==0){var g=u.lanes;g&=l.pendingLanes,p|=g,u.lanes=p,Nt(l,p)}}var oc={readContext:ds,use:ld,useCallback:In,useContext:In,useEffect:In,useImperativeHandle:In,useLayoutEffect:In,useInsertionEffect:In,useMemo:In,useReducer:In,useRef:In,useState:In,useDebugValue:In,useDeferredValue:In,useTransition:In,useSyncExternalStore:In,useId:In,useHostTransitionStatus:In,useFormState:In,useActionState:In,useOptimistic:In,useMemoCache:In,useCacheRefresh:In};oc.useEffectEvent=In;var Pv={readContext:ds,use:ld,useCallback:function(l,u){return Cs().memoizedState=[l,u===void 0?null:u],l},useContext:ds,useEffect:yv,useImperativeHandle:function(l,u,p){p=p!=null?p.concat([l]):null,ud(4194308,4,Sv.bind(null,u,l),p)},useLayoutEffect:function(l,u){return ud(4194308,4,l,u)},useInsertionEffect:function(l,u){ud(4,2,l,u)},useMemo:function(l,u){var p=Cs();u=u===void 0?null:u;var g=l();if(qi){oe(!0);try{l()}finally{oe(!1)}}return p.memoizedState=[g,u],g},useReducer:function(l,u,p){var g=Cs();if(p!==void 0){var w=p(u);if(qi){oe(!0);try{p(u)}finally{oe(!1)}}}else w=u;return g.memoizedState=g.baseState=w,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:w},g.queue=l,l=l.dispatch=TE.bind(null,Ht,l),[g.memoizedState,l]},useRef:function(l){var u=Cs();return l={current:l},u.memoizedState=l},useState:function(l){l=_h(l);var u=l.queue,p=Rv.bind(null,Ht,u);return u.dispatch=p,[l.memoizedState,p]},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Cs();return Oh(p,l,u)},useTransition:function(){var l=_h(!1);return l=Tv.bind(null,Ht,l.queue,!0,!1),Cs().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,u,p){var g=Ht,w=Cs();if(rn){if(p===void 0)throw Error(s(407));p=p()}else{if(p=u(),An===null)throw Error(s(349));(nn&127)!==0||sv(g,u,p)}w.memoizedState=p;var A={value:p,getSnapshot:u};return w.queue=A,yv(rv.bind(null,g,A,l),[l]),g.flags|=2048,Ho(9,{destroy:void 0},av.bind(null,g,A,p,u),null),p},useId:function(){var l=Cs(),u=An.identifierPrefix;if(rn){var p=$a,g=za;p=(g&~(1<<32-he(g)-1)).toString(32)+p,u="_"+u+"R_"+p,p=id++,0<p&&(u+="H"+p.toString(32)),u+="_"}else p=wE++,u="_"+u+"r_"+p.toString(32)+"_";return l.memoizedState=u},useHostTransitionStatus:Ph,useFormState:hv,useActionState:hv,useOptimistic:function(l){var u=Cs();u.memoizedState=u.baseState=l;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=p,u=Ih.bind(null,Ht,!0,p),p.dispatch=u,[l,u]},useMemoCache:Nh,useCacheRefresh:function(){return Cs().memoizedState=NE.bind(null,Ht)},useEffectEvent:function(l){var u=Cs(),p={impl:l};return u.memoizedState=p,function(){if((pn&2)!==0)throw Error(s(440));return p.impl.apply(void 0,arguments)}}},Bh={readContext:ds,use:ld,useCallback:Av,useContext:ds,useEffect:Dh,useImperativeHandle:Cv,useInsertionEffect:wv,useLayoutEffect:kv,useMemo:jv,useReducer:cd,useRef:xv,useState:function(){return cd(gr)},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Un();return Nv(p,yn.memoizedState,l,u)},useTransition:function(){var l=cd(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:rc(l),u]},useSyncExternalStore:nv,useId:Mv,useHostTransitionStatus:Ph,useFormState:mv,useActionState:mv,useOptimistic:function(l,u){var p=Un();return lv(p,yn,l,u)},useMemoCache:Nh,useCacheRefresh:Dv};Bh.useEffectEvent=vv;var Iv={readContext:ds,use:ld,useCallback:Av,useContext:ds,useEffect:Dh,useImperativeHandle:Cv,useInsertionEffect:wv,useLayoutEffect:kv,useMemo:jv,useReducer:Eh,useRef:xv,useState:function(){return Eh(gr)},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Un();return yn===null?Oh(p,l,u):Nv(p,yn.memoizedState,l,u)},useTransition:function(){var l=Eh(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:rc(l),u]},useSyncExternalStore:nv,useId:Mv,useHostTransitionStatus:Ph,useFormState:bv,useActionState:bv,useOptimistic:function(l,u){var p=Un();return yn!==null?lv(p,yn,l,u):(p.baseState=l,[l,p.queue.dispatch])},useMemoCache:Nh,useCacheRefresh:Dv};Iv.useEffectEvent=vv;function Fh(l,u,p,g){u=l.memoizedState,p=p(g,u),p=p==null?u:m({},u,p),l.memoizedState=p,l.lanes===0&&(l.updateQueue.baseState=p)}var zh={enqueueSetState:function(l,u,p){l=l._reactInternals;var g=Qs(),w=ei(g);w.payload=u,p!=null&&(w.callback=p),u=ti(l,w,g),u!==null&&(Ps(u,l,g),tc(u,l,g))},enqueueReplaceState:function(l,u,p){l=l._reactInternals;var g=Qs(),w=ei(g);w.tag=1,w.payload=u,p!=null&&(w.callback=p),u=ti(l,w,g),u!==null&&(Ps(u,l,g),tc(u,l,g))},enqueueForceUpdate:function(l,u){l=l._reactInternals;var p=Qs(),g=ei(p);g.tag=2,u!=null&&(g.callback=u),u=ti(l,g,p),u!==null&&(Ps(u,l,p),tc(u,l,p))}};function Bv(l,u,p,g,w,A,L){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(g,A,L):u.prototype&&u.prototype.isPureReactComponent?!Gl(p,g)||!Gl(w,A):!0}function Fv(l,u,p,g){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(p,g),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(p,g),u.state!==l&&zh.enqueueReplaceState(u,u.state,null)}function Vi(l,u){var p=u;if("ref"in u){p={};for(var g in u)g!=="ref"&&(p[g]=u[g])}if(l=l.defaultProps){p===u&&(p=m({},p));for(var w in l)p[w]===void 0&&(p[w]=l[w])}return p}function zv(l){Wu(l)}function $v(l){console.error(l)}function Hv(l){Wu(l)}function pd(l,u){try{var p=l.onUncaughtError;p(u.value,{componentStack:u.stack})}catch(g){setTimeout(function(){throw g})}}function Uv(l,u,p){try{var g=l.onCaughtError;g(p.value,{componentStack:p.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function $h(l,u,p){return p=ei(p),p.tag=3,p.payload={element:null},p.callback=function(){pd(l,u)},p}function Wv(l){return l=ei(l),l.tag=3,l}function qv(l,u,p,g){var w=p.type.getDerivedStateFromError;if(typeof w=="function"){var A=g.value;l.payload=function(){return w(A)},l.callback=function(){Uv(u,p,g)}}var L=p.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(l.callback=function(){Uv(u,p,g),typeof w!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var Y=g.stack;this.componentDidCatch(g.value,{componentStack:Y!==null?Y:""})})}function EE(l,u,p,g,w){if(p.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(u=p.alternate,u!==null&&Oo(u,p,w,!0),p=Vs.current,p!==null){switch(p.tag){case 31:case 13:return pa===null?Ad():p.alternate===null&&Bn===0&&(Bn=3),p.flags&=-257,p.flags|=65536,p.lanes=w,g===ed?p.flags|=16384:(u=p.updateQueue,u===null?p.updateQueue=new Set([g]):u.add(g),fm(l,g,w)),!1;case 22:return p.flags|=65536,g===ed?p.flags|=16384:(u=p.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([g])},p.updateQueue=u):(p=u.retryQueue,p===null?u.retryQueue=new Set([g]):p.add(g)),fm(l,g,w)),!1}throw Error(s(435,p.tag))}return fm(l,g,w),Ad(),!1}if(rn)return u=Vs.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=w,g!==ih&&(l=Error(s(422),{cause:g}),Ql(ca(l,p)))):(g!==ih&&(u=Error(s(423),{cause:g}),Ql(ca(u,p))),l=l.current.alternate,l.flags|=65536,w&=-w,l.lanes|=w,g=ca(g,p),w=$h(l.stateNode,g,w),bh(l,w),Bn!==4&&(Bn=2)),!1;var A=Error(s(520),{cause:g});if(A=ca(A,p),mc===null?mc=[A]:mc.push(A),Bn!==4&&(Bn=2),u===null)return!0;g=ca(g,p),p=u;do{switch(p.tag){case 3:return p.flags|=65536,l=w&-w,p.lanes|=l,l=$h(p.stateNode,g,l),bh(p,l),!1;case 1:if(u=p.type,A=p.stateNode,(p.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(oi===null||!oi.has(A))))return p.flags|=65536,w&=-w,p.lanes|=w,w=Wv(w),qv(w,l,p,g),bh(p,w),!1}p=p.return}while(p!==null);return!1}var Hh=Error(s(461)),Kn=!1;function fs(l,u,p,g){u.child=l===null?Ky(u,null,p,g):Wi(u,l.child,p,g)}function Vv(l,u,p,g,w){p=p.render;var A=u.ref;if("ref"in g){var L={};for(var Y in g)Y!=="ref"&&(L[Y]=g[Y])}else L=g;return zi(u),g=Sh(l,u,p,L,A,w),Y=Ch(),l!==null&&!Kn?(Ah(l,u,w),br(l,u,w)):(rn&&Y&&ah(u),u.flags|=1,fs(l,u,g,w),u.child)}function Gv(l,u,p,g,w){if(l===null){var A=p.type;return typeof A=="function"&&!th(A)&&A.defaultProps===void 0&&p.compare===null?(u.tag=15,u.type=A,Yv(l,u,A,g,w)):(l=Yu(p.type,null,g,u,u.mode,w),l.ref=u.ref,l.return=u,u.child=l)}if(A=l.child,!Qh(l,w)){var L=A.memoizedProps;if(p=p.compare,p=p!==null?p:Gl,p(L,g)&&l.ref===u.ref)return br(l,u,w)}return u.flags|=1,l=dr(A,g),l.ref=u.ref,l.return=u,u.child=l}function Yv(l,u,p,g,w){if(l!==null){var A=l.memoizedProps;if(Gl(A,g)&&l.ref===u.ref)if(Kn=!1,u.pendingProps=g=A,Qh(l,w))(l.flags&131072)!==0&&(Kn=!0);else return u.lanes=l.lanes,br(l,u,w)}return Uh(l,u,p,g,w)}function Kv(l,u,p,g){var w=g.children,A=l!==null?l.memoizedState:null;if(l===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((u.flags&128)!==0){if(A=A!==null?A.baseLanes|p:p,l!==null){for(g=u.child=l.child,w=0;g!==null;)w=w|g.lanes|g.childLanes,g=g.sibling;g=w&~A}else g=0,u.child=null;return Qv(l,u,A,p,g)}if((p&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},l!==null&&Ju(u,A!==null?A.cachePool:null),A!==null?Jy(u,A):yh(),Zy(u);else return g=u.lanes=536870912,Qv(l,u,A!==null?A.baseLanes|p:p,p,g)}else A!==null?(Ju(u,A.cachePool),Jy(u,A),si(),u.memoizedState=null):(l!==null&&Ju(u,null),yh(),si());return fs(l,u,w,p),u.child}function lc(l,u){return l!==null&&l.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function Qv(l,u,p,g,w){var A=ph();return A=A===null?null:{parent:Gn._currentValue,pool:A},u.memoizedState={baseLanes:p,cachePool:A},l!==null&&Ju(u,null),yh(),Zy(u),l!==null&&Oo(l,u,g,!0),u.childLanes=w,null}function hd(l,u){return u=gd({mode:u.mode,children:u.children},l.mode),u.ref=l.ref,l.child=u,u.return=l,u}function Xv(l,u,p){return Wi(u,l.child,null,p),l=hd(u,u.pendingProps),l.flags|=2,Gs(u),u.memoizedState=null,l}function _E(l,u,p){var g=u.pendingProps,w=(u.flags&128)!==0;if(u.flags&=-129,l===null){if(rn){if(g.mode==="hidden")return l=hd(u,g),u.lanes=536870912,lc(null,l);if(wh(u),(l=_n)?(l=c0(l,fa),l=l!==null&&l.data==="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Kr!==null?{id:za,overflow:$a}:null,retryLane:536870912,hydrationErrors:null},p=Oy(l),p.return=u,u.child=p,us=u,_n=null)):l=null,l===null)throw Xr(u);return u.lanes=536870912,null}return hd(u,g)}var A=l.memoizedState;if(A!==null){var L=A.dehydrated;if(wh(u),w)if(u.flags&256)u.flags&=-257,u=Xv(l,u,p);else if(u.memoizedState!==null)u.child=l.child,u.flags|=128,u=null;else throw Error(s(558));else if(Kn||Oo(l,u,p,!1),w=(p&l.childLanes)!==0,Kn||w){if(g=An,g!==null&&(L=zt(g,p),L!==0&&L!==A.retryLane))throw A.retryLane=L,Pi(l,L),Ps(g,l,L),Hh;Ad(),u=Xv(l,u,p)}else l=A.treeContext,_n=ha(L.nextSibling),us=u,rn=!0,Qr=null,fa=!1,l!==null&&Iy(u,l),u=hd(u,g),u.flags|=4096;return u}return l=dr(l.child,{mode:g.mode,children:g.children}),l.ref=u.ref,u.child=l,l.return=u,l}function md(l,u){var p=u.ref;if(p===null)l!==null&&l.ref!==null&&(u.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(s(284));(l===null||l.ref!==p)&&(u.flags|=4194816)}}function Uh(l,u,p,g,w){return zi(u),p=Sh(l,u,p,g,void 0,w),g=Ch(),l!==null&&!Kn?(Ah(l,u,w),br(l,u,w)):(rn&&g&&ah(u),u.flags|=1,fs(l,u,p,w),u.child)}function Jv(l,u,p,g,w,A){return zi(u),u.updateQueue=null,p=tv(u,g,p,w),ev(l),g=Ch(),l!==null&&!Kn?(Ah(l,u,A),br(l,u,A)):(rn&&g&&ah(u),u.flags|=1,fs(l,u,p,A),u.child)}function Zv(l,u,p,g,w){if(zi(u),u.stateNode===null){var A=_o,L=p.contextType;typeof L=="object"&&L!==null&&(A=ds(L)),A=new p(g,A),u.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,A.updater=zh,u.stateNode=A,A._reactInternals=u,A=u.stateNode,A.props=g,A.state=u.memoizedState,A.refs={},mh(u),L=p.contextType,A.context=typeof L=="object"&&L!==null?ds(L):_o,A.state=u.memoizedState,L=p.getDerivedStateFromProps,typeof L=="function"&&(Fh(u,p,L,g),A.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(L=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),L!==A.state&&zh.enqueueReplaceState(A,A.state,null),sc(u,g,A,w),nc(),A.state=u.memoizedState),typeof A.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(l===null){A=u.stateNode;var Y=u.memoizedProps,ae=Vi(p,Y);A.props=ae;var Oe=A.context,Ke=p.contextType;L=_o,typeof Ke=="object"&&Ke!==null&&(L=ds(Ke));var Ze=p.getDerivedStateFromProps;Ke=typeof Ze=="function"||typeof A.getSnapshotBeforeUpdate=="function",Y=u.pendingProps!==Y,Ke||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(Y||Oe!==L)&&Fv(u,A,g,L),Zr=!1;var Fe=u.memoizedState;A.state=Fe,sc(u,g,A,w),nc(),Oe=u.memoizedState,Y||Fe!==Oe||Zr?(typeof Ze=="function"&&(Fh(u,p,Ze,g),Oe=u.memoizedState),(ae=Zr||Bv(u,p,ae,g,Fe,Oe,L))?(Ke||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(u.flags|=4194308)):(typeof A.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=Oe),A.props=g,A.state=Oe,A.context=L,g=ae):(typeof A.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{A=u.stateNode,gh(l,u),L=u.memoizedProps,Ke=Vi(p,L),A.props=Ke,Ze=u.pendingProps,Fe=A.context,Oe=p.contextType,ae=_o,typeof Oe=="object"&&Oe!==null&&(ae=ds(Oe)),Y=p.getDerivedStateFromProps,(Oe=typeof Y=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(L!==Ze||Fe!==ae)&&Fv(u,A,g,ae),Zr=!1,Fe=u.memoizedState,A.state=Fe,sc(u,g,A,w),nc();var qe=u.memoizedState;L!==Ze||Fe!==qe||Zr||l!==null&&l.dependencies!==null&&Qu(l.dependencies)?(typeof Y=="function"&&(Fh(u,p,Y,g),qe=u.memoizedState),(Ke=Zr||Bv(u,p,Ke,g,Fe,qe,ae)||l!==null&&l.dependencies!==null&&Qu(l.dependencies))?(Oe||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,qe,ae),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,qe,ae)),typeof A.componentDidUpdate=="function"&&(u.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof A.componentDidUpdate!="function"||L===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||L===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=qe),A.props=g,A.state=qe,A.context=ae,g=Ke):(typeof A.componentDidUpdate!="function"||L===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||L===l.memoizedProps&&Fe===l.memoizedState||(u.flags|=1024),g=!1)}return A=g,md(l,u),g=(u.flags&128)!==0,A||g?(A=u.stateNode,p=g&&typeof p.getDerivedStateFromError!="function"?null:A.render(),u.flags|=1,l!==null&&g?(u.child=Wi(u,l.child,null,w),u.child=Wi(u,null,p,w)):fs(l,u,p,w),u.memoizedState=A.state,l=u.child):l=br(l,u,w),l}function ew(l,u,p,g){return Bi(),u.flags|=256,fs(l,u,p,g),u.child}var Wh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qh(l){return{baseLanes:l,cachePool:Uy()}}function Vh(l,u,p){return l=l!==null?l.childLanes&~p:0,u&&(l|=Ks),l}function tw(l,u,p){var g=u.pendingProps,w=!1,A=(u.flags&128)!==0,L;if((L=A)||(L=l!==null&&l.memoizedState===null?!1:(Hn.current&2)!==0),L&&(w=!0,u.flags&=-129),L=(u.flags&32)!==0,u.flags&=-33,l===null){if(rn){if(w?ni(u):si(),(l=_n)?(l=c0(l,fa),l=l!==null&&l.data!=="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Kr!==null?{id:za,overflow:$a}:null,retryLane:536870912,hydrationErrors:null},p=Oy(l),p.return=u,u.child=p,us=u,_n=null)):l=null,l===null)throw Xr(u);return Tm(l)?u.lanes=32:u.lanes=536870912,null}var Y=g.children;return g=g.fallback,w?(si(),w=u.mode,Y=gd({mode:"hidden",children:Y},w),g=Ii(g,w,p,null),Y.return=u,g.return=u,Y.sibling=g,u.child=Y,g=u.child,g.memoizedState=qh(p),g.childLanes=Vh(l,L,p),u.memoizedState=Wh,lc(null,g)):(ni(u),Gh(u,Y))}var ae=l.memoizedState;if(ae!==null&&(Y=ae.dehydrated,Y!==null)){if(A)u.flags&256?(ni(u),u.flags&=-257,u=Yh(l,u,p)):u.memoizedState!==null?(si(),u.child=l.child,u.flags|=128,u=null):(si(),Y=g.fallback,w=u.mode,g=gd({mode:"visible",children:g.children},w),Y=Ii(Y,w,p,null),Y.flags|=2,g.return=u,Y.return=u,g.sibling=Y,u.child=g,Wi(u,l.child,null,p),g=u.child,g.memoizedState=qh(p),g.childLanes=Vh(l,L,p),u.memoizedState=Wh,u=lc(null,g));else if(ni(u),Tm(Y)){if(L=Y.nextSibling&&Y.nextSibling.dataset,L)var Oe=L.dgst;L=Oe,g=Error(s(419)),g.stack="",g.digest=L,Ql({value:g,source:null,stack:null}),u=Yh(l,u,p)}else if(Kn||Oo(l,u,p,!1),L=(p&l.childLanes)!==0,Kn||L){if(L=An,L!==null&&(g=zt(L,p),g!==0&&g!==ae.retryLane))throw ae.retryLane=g,Pi(l,g),Ps(L,l,g),Hh;Nm(Y)||Ad(),u=Yh(l,u,p)}else Nm(Y)?(u.flags|=192,u.child=l.child,u=null):(l=ae.treeContext,_n=ha(Y.nextSibling),us=u,rn=!0,Qr=null,fa=!1,l!==null&&Iy(u,l),u=Gh(u,g.children),u.flags|=4096);return u}return w?(si(),Y=g.fallback,w=u.mode,ae=l.child,Oe=ae.sibling,g=dr(ae,{mode:"hidden",children:g.children}),g.subtreeFlags=ae.subtreeFlags&65011712,Oe!==null?Y=dr(Oe,Y):(Y=Ii(Y,w,p,null),Y.flags|=2),Y.return=u,g.return=u,g.sibling=Y,u.child=g,lc(null,g),g=u.child,Y=l.child.memoizedState,Y===null?Y=qh(p):(w=Y.cachePool,w!==null?(ae=Gn._currentValue,w=w.parent!==ae?{parent:ae,pool:ae}:w):w=Uy(),Y={baseLanes:Y.baseLanes|p,cachePool:w}),g.memoizedState=Y,g.childLanes=Vh(l,L,p),u.memoizedState=Wh,lc(l.child,g)):(ni(u),p=l.child,l=p.sibling,p=dr(p,{mode:"visible",children:g.children}),p.return=u,p.sibling=null,l!==null&&(L=u.deletions,L===null?(u.deletions=[l],u.flags|=16):L.push(l)),u.child=p,u.memoizedState=null,p)}function Gh(l,u){return u=gd({mode:"visible",children:u},l.mode),u.return=l,l.child=u}function gd(l,u){return l=qs(22,l,null,u),l.lanes=0,l}function Yh(l,u,p){return Wi(u,l.child,null,p),l=Gh(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function nw(l,u,p){l.lanes|=u;var g=l.alternate;g!==null&&(g.lanes|=u),ch(l.return,u,p)}function Kh(l,u,p,g,w,A){var L=l.memoizedState;L===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:w,treeForkCount:A}:(L.isBackwards=u,L.rendering=null,L.renderingStartTime=0,L.last=g,L.tail=p,L.tailMode=w,L.treeForkCount=A)}function sw(l,u,p){var g=u.pendingProps,w=g.revealOrder,A=g.tail;g=g.children;var L=Hn.current,Y=(L&2)!==0;if(Y?(L=L&1|2,u.flags|=128):L&=1,q(Hn,L),fs(l,u,g,p),g=rn?Kl:0,!Y&&l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&nw(l,p,u);else if(l.tag===19)nw(l,p,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(w){case"forwards":for(p=u.child,w=null;p!==null;)l=p.alternate,l!==null&&ad(l)===null&&(w=p),p=p.sibling;p=w,p===null?(w=u.child,u.child=null):(w=p.sibling,p.sibling=null),Kh(u,!1,w,p,A,g);break;case"backwards":case"unstable_legacy-backwards":for(p=null,w=u.child,u.child=null;w!==null;){if(l=w.alternate,l!==null&&ad(l)===null){u.child=w;break}l=w.sibling,w.sibling=p,p=w,w=l}Kh(u,!0,p,null,A,g);break;case"together":Kh(u,!1,null,null,void 0,g);break;default:u.memoizedState=null}return u.child}function br(l,u,p){if(l!==null&&(u.dependencies=l.dependencies),ii|=u.lanes,(p&u.childLanes)===0)if(l!==null){if(Oo(l,u,p,!1),(p&u.childLanes)===0)return null}else return null;if(l!==null&&u.child!==l.child)throw Error(s(153));if(u.child!==null){for(l=u.child,p=dr(l,l.pendingProps),u.child=p,p.return=u;l.sibling!==null;)l=l.sibling,p=p.sibling=dr(l,l.pendingProps),p.return=u;p.sibling=null}return u.child}function Qh(l,u){return(l.lanes&u)!==0?!0:(l=l.dependencies,!!(l!==null&&Qu(l)))}function ME(l,u,p){switch(u.tag){case 3:je(u,u.stateNode.containerInfo),Jr(u,Gn,l.memoizedState.cache),Bi();break;case 27:case 5:Ee(u);break;case 4:je(u,u.stateNode.containerInfo);break;case 10:Jr(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,wh(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(ni(u),u.flags|=128,null):(p&u.child.childLanes)!==0?tw(l,u,p):(ni(u),l=br(l,u,p),l!==null?l.sibling:null);ni(u);break;case 19:var w=(l.flags&128)!==0;if(g=(p&u.childLanes)!==0,g||(Oo(l,u,p,!1),g=(p&u.childLanes)!==0),w){if(g)return sw(l,u,p);u.flags|=128}if(w=u.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),q(Hn,Hn.current),g)break;return null;case 22:return u.lanes=0,Kv(l,u,p,u.pendingProps);case 24:Jr(u,Gn,l.memoizedState.cache)}return br(l,u,p)}function aw(l,u,p){if(l!==null)if(l.memoizedProps!==u.pendingProps)Kn=!0;else{if(!Qh(l,p)&&(u.flags&128)===0)return Kn=!1,ME(l,u,p);Kn=(l.flags&131072)!==0}else Kn=!1,rn&&(u.flags&1048576)!==0&&Py(u,Kl,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(l=Hi(u.elementType),u.type=l,typeof l=="function")th(l)?(g=Vi(l,g),u.tag=1,u=Zv(null,u,l,g,p)):(u.tag=0,u=Uh(null,u,l,g,p));else{if(l!=null){var w=l.$$typeof;if(w===E){u.tag=11,u=Vv(null,u,l,g,p);break e}else if(w===P){u.tag=14,u=Gv(null,u,l,g,p);break e}}throw u=W(l)||l,Error(s(306,u,""))}}return u;case 0:return Uh(l,u,u.type,u.pendingProps,p);case 1:return g=u.type,w=Vi(g,u.pendingProps),Zv(l,u,g,w,p);case 3:e:{if(je(u,u.stateNode.containerInfo),l===null)throw Error(s(387));g=u.pendingProps;var A=u.memoizedState;w=A.element,gh(l,u),sc(u,g,null,p);var L=u.memoizedState;if(g=L.cache,Jr(u,Gn,g),g!==A.cache&&uh(u,[Gn],p,!0),nc(),g=L.element,A.isDehydrated)if(A={element:g,isDehydrated:!1,cache:L.cache},u.updateQueue.baseState=A,u.memoizedState=A,u.flags&256){u=ew(l,u,g,p);break e}else if(g!==w){w=ca(Error(s(424)),u),Ql(w),u=ew(l,u,g,p);break e}else{switch(l=u.stateNode.containerInfo,l.nodeType){case 9:l=l.body;break;default:l=l.nodeName==="HTML"?l.ownerDocument.body:l}for(_n=ha(l.firstChild),us=u,rn=!0,Qr=null,fa=!0,p=Ky(u,null,g,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Bi(),g===w){u=br(l,u,p);break e}fs(l,u,g,p)}u=u.child}return u;case 26:return md(l,u),l===null?(p=m0(u.type,null,u.pendingProps,null))?u.memoizedState=p:rn||(p=u.type,l=u.pendingProps,g=Dd(Z.current).createElement(p),g[xt]=u,g[Dt]=l,ps(g,p,l),fn(g),u.stateNode=g):u.memoizedState=m0(u.type,l.memoizedProps,u.pendingProps,l.memoizedState),null;case 27:return Ee(u),l===null&&rn&&(g=u.stateNode=f0(u.type,u.pendingProps,Z.current),us=u,fa=!0,w=_n,di(u.type)?(Em=w,_n=ha(g.firstChild)):_n=w),fs(l,u,u.pendingProps.children,p),md(l,u),l===null&&(u.flags|=4194304),u.child;case 5:return l===null&&rn&&((w=g=_n)&&(g=o_(g,u.type,u.pendingProps,fa),g!==null?(u.stateNode=g,us=u,_n=ha(g.firstChild),fa=!1,w=!0):w=!1),w||Xr(u)),Ee(u),w=u.type,A=u.pendingProps,L=l!==null?l.memoizedProps:null,g=A.children,Cm(w,A)?g=null:L!==null&&Cm(w,L)&&(u.flags|=32),u.memoizedState!==null&&(w=Sh(l,u,kE,null,null,p),Sc._currentValue=w),md(l,u),fs(l,u,g,p),u.child;case 6:return l===null&&rn&&((l=p=_n)&&(p=l_(p,u.pendingProps,fa),p!==null?(u.stateNode=p,us=u,_n=null,l=!0):l=!1),l||Xr(u)),null;case 13:return tw(l,u,p);case 4:return je(u,u.stateNode.containerInfo),g=u.pendingProps,l===null?u.child=Wi(u,null,g,p):fs(l,u,g,p),u.child;case 11:return Vv(l,u,u.type,u.pendingProps,p);case 7:return fs(l,u,u.pendingProps,p),u.child;case 8:return fs(l,u,u.pendingProps.children,p),u.child;case 12:return fs(l,u,u.pendingProps.children,p),u.child;case 10:return g=u.pendingProps,Jr(u,u.type,g.value),fs(l,u,g.children,p),u.child;case 9:return w=u.type._context,g=u.pendingProps.children,zi(u),w=ds(w),g=g(w),u.flags|=1,fs(l,u,g,p),u.child;case 14:return Gv(l,u,u.type,u.pendingProps,p);case 15:return Yv(l,u,u.type,u.pendingProps,p);case 19:return sw(l,u,p);case 31:return _E(l,u,p);case 22:return Kv(l,u,p,u.pendingProps);case 24:return zi(u),g=ds(Gn),l===null?(w=ph(),w===null&&(w=An,A=dh(),w.pooledCache=A,A.refCount++,A!==null&&(w.pooledCacheLanes|=p),w=A),u.memoizedState={parent:g,cache:w},mh(u),Jr(u,Gn,w)):((l.lanes&p)!==0&&(gh(l,u),sc(u,null,null,p),nc()),w=l.memoizedState,A=u.memoizedState,w.parent!==g?(w={parent:g,cache:g},u.memoizedState=w,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=w),Jr(u,Gn,g)):(g=A.cache,Jr(u,Gn,g),g!==w.cache&&uh(u,[Gn],p,!0))),fs(l,u,u.pendingProps.children,p),u.child;case 29:throw u.pendingProps}throw Error(s(156,u.tag))}function xr(l){l.flags|=4}function Xh(l,u,p,g,w){if((u=(l.mode&32)!==0)&&(u=!1),u){if(l.flags|=16777216,(w&335544128)===w)if(l.stateNode.complete)l.flags|=8192;else if(Mw())l.flags|=8192;else throw Ui=ed,hh}else l.flags&=-16777217}function rw(l,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!v0(u))if(Mw())l.flags|=8192;else throw Ui=ed,hh}function bd(l,u){u!==null&&(l.flags|=4),l.flags&16384&&(u=l.tag!==22?jt():536870912,l.lanes|=u,Vo|=u)}function cc(l,u){if(!rn)switch(l.tailMode){case"hidden":u=l.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:g.sibling=null}}function Mn(l){var u=l.alternate!==null&&l.alternate.child===l.child,p=0,g=0;if(u)for(var w=l.child;w!==null;)p|=w.lanes|w.childLanes,g|=w.subtreeFlags&65011712,g|=w.flags&65011712,w.return=l,w=w.sibling;else for(w=l.child;w!==null;)p|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=l,w=w.sibling;return l.subtreeFlags|=g,l.childLanes=p,u}function DE(l,u,p){var g=u.pendingProps;switch(rh(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mn(u),null;case 1:return Mn(u),null;case 3:return p=u.stateNode,g=null,l!==null&&(g=l.memoizedState.cache),u.memoizedState.cache!==g&&(u.flags|=2048),hr(Gn),ce(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(l===null||l.child===null)&&(Ro(u)?xr(u):l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,oh())),Mn(u),null;case 26:var w=u.type,A=u.memoizedState;return l===null?(xr(u),A!==null?(Mn(u),rw(u,A)):(Mn(u),Xh(u,w,null,g,p))):A?A!==l.memoizedState?(xr(u),Mn(u),rw(u,A)):(Mn(u),u.flags&=-16777217):(l=l.memoizedProps,l!==g&&xr(u),Mn(u),Xh(u,w,l,g,p)),null;case 27:if(ze(u),p=Z.current,w=u.type,l!==null&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(!g){if(u.stateNode===null)throw Error(s(166));return Mn(u),null}l=xe.current,Ro(u)?By(u):(l=f0(w,g,p),u.stateNode=l,xr(u))}return Mn(u),null;case 5:if(ze(u),w=u.type,l!==null&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(!g){if(u.stateNode===null)throw Error(s(166));return Mn(u),null}if(A=xe.current,Ro(u))By(u);else{var L=Dd(Z.current);switch(A){case 1:A=L.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:A=L.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":A=L.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":A=L.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":A=L.createElement("div"),A.innerHTML="<script><\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?L.createElement("select",{is:g.is}):L.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?L.createElement(w,{is:g.is}):L.createElement(w)}}A[xt]=u,A[Dt]=g;e:for(L=u.child;L!==null;){if(L.tag===5||L.tag===6)A.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===u)break e;for(;L.sibling===null;){if(L.return===null||L.return===u)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}u.stateNode=A;e:switch(ps(A,w,g),w){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&xr(u)}}return Mn(u),Xh(u,u.type,l===null?null:l.memoizedProps,u.pendingProps,p),null;case 6:if(l&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(s(166));if(l=Z.current,Ro(u)){if(l=u.stateNode,p=u.memoizedProps,g=null,w=us,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}l[xt]=u,l=!!(l.nodeValue===p||g!==null&&g.suppressHydrationWarning===!0||t0(l.nodeValue,p)),l||Xr(u,!0)}else l=Dd(l).createTextNode(g),l[xt]=u,u.stateNode=l}return Mn(u),null;case 31:if(p=u.memoizedState,l===null||l.memoizedState!==null){if(g=Ro(u),p!==null){if(l===null){if(!g)throw Error(s(318));if(l=u.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(557));l[xt]=u}else Bi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Mn(u),l=!1}else p=oh(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=p),l=!0;if(!l)return u.flags&256?(Gs(u),u):(Gs(u),null);if((u.flags&128)!==0)throw Error(s(558))}return Mn(u),null;case 13:if(g=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(w=Ro(u),g!==null&&g.dehydrated!==null){if(l===null){if(!w)throw Error(s(318));if(w=u.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[xt]=u}else Bi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Mn(u),w=!1}else w=oh(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=w),w=!0;if(!w)return u.flags&256?(Gs(u),u):(Gs(u),null)}return Gs(u),(u.flags&128)!==0?(u.lanes=p,u):(p=g!==null,l=l!==null&&l.memoizedState!==null,p&&(g=u.child,w=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(w=g.alternate.memoizedState.cachePool.pool),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==w&&(g.flags|=2048)),p!==l&&p&&(u.child.flags|=8192),bd(u,u.updateQueue),Mn(u),null);case 4:return ce(),l===null&&ym(u.stateNode.containerInfo),Mn(u),null;case 10:return hr(u.type),Mn(u),null;case 19:if(K(Hn),g=u.memoizedState,g===null)return Mn(u),null;if(w=(u.flags&128)!==0,A=g.rendering,A===null)if(w)cc(g,!1);else{if(Bn!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(A=ad(l),A!==null){for(u.flags|=128,cc(g,!1),l=A.updateQueue,u.updateQueue=l,bd(u,l),u.subtreeFlags=0,l=p,p=u.child;p!==null;)Ry(p,l),p=p.sibling;return q(Hn,Hn.current&1|2),rn&&fr(u,g.treeForkCount),u.child}l=l.sibling}g.tail!==null&&ut()>kd&&(u.flags|=128,w=!0,cc(g,!1),u.lanes=4194304)}else{if(!w)if(l=ad(A),l!==null){if(u.flags|=128,w=!0,l=l.updateQueue,u.updateQueue=l,bd(u,l),cc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!rn)return Mn(u),null}else 2*ut()-g.renderingStartTime>kd&&p!==536870912&&(u.flags|=128,w=!0,cc(g,!1),u.lanes=4194304);g.isBackwards?(A.sibling=u.child,u.child=A):(l=g.last,l!==null?l.sibling=A:u.child=A,g.last=A)}return g.tail!==null?(l=g.tail,g.rendering=l,g.tail=l.sibling,g.renderingStartTime=ut(),l.sibling=null,p=Hn.current,q(Hn,w?p&1|2:p&1),rn&&fr(u,g.treeForkCount),l):(Mn(u),null);case 22:case 23:return Gs(u),vh(),g=u.memoizedState!==null,l!==null?l.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(p&536870912)!==0&&(u.flags&128)===0&&(Mn(u),u.subtreeFlags&6&&(u.flags|=8192)):Mn(u),p=u.updateQueue,p!==null&&bd(u,p.retryQueue),p=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==p&&(u.flags|=2048),l!==null&&K($i),null;case 24:return p=null,l!==null&&(p=l.memoizedState.cache),u.memoizedState.cache!==p&&(u.flags|=2048),hr(Gn),Mn(u),null;case 25:return null;case 30:return null}throw Error(s(156,u.tag))}function RE(l,u){switch(rh(u),u.tag){case 1:return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return hr(Gn),ce(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 26:case 27:case 5:return ze(u),null;case 31:if(u.memoizedState!==null){if(Gs(u),u.alternate===null)throw Error(s(340));Bi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 13:if(Gs(u),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(s(340));Bi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return K(Hn),null;case 4:return ce(),null;case 10:return hr(u.type),null;case 22:case 23:return Gs(u),vh(),l!==null&&K($i),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 24:return hr(Gn),null;case 25:return null;default:return null}}function iw(l,u){switch(rh(u),u.tag){case 3:hr(Gn),ce();break;case 26:case 27:case 5:ze(u);break;case 4:ce();break;case 31:u.memoizedState!==null&&Gs(u);break;case 13:Gs(u);break;case 19:K(Hn);break;case 10:hr(u.type);break;case 22:case 23:Gs(u),vh(),l!==null&&K($i);break;case 24:hr(Gn)}}function uc(l,u){try{var p=u.updateQueue,g=p!==null?p.lastEffect:null;if(g!==null){var w=g.next;p=w;do{if((p.tag&l)===l){g=void 0;var A=p.create,L=p.inst;g=A(),L.destroy=g}p=p.next}while(p!==w)}}catch(Y){gn(u,u.return,Y)}}function ai(l,u,p){try{var g=u.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var A=w.next;g=A;do{if((g.tag&l)===l){var L=g.inst,Y=L.destroy;if(Y!==void 0){L.destroy=void 0,w=u;var ae=p,Oe=Y;try{Oe()}catch(Ke){gn(w,ae,Ke)}}}g=g.next}while(g!==A)}}catch(Ke){gn(u,u.return,Ke)}}function ow(l){var u=l.updateQueue;if(u!==null){var p=l.stateNode;try{Xy(u,p)}catch(g){gn(l,l.return,g)}}}function lw(l,u,p){p.props=Vi(l.type,l.memoizedProps),p.state=l.memoizedState;try{p.componentWillUnmount()}catch(g){gn(l,u,g)}}function dc(l,u){try{var p=l.ref;if(p!==null){switch(l.tag){case 26:case 27:case 5:var g=l.stateNode;break;case 30:g=l.stateNode;break;default:g=l.stateNode}typeof p=="function"?l.refCleanup=p(g):p.current=g}}catch(w){gn(l,u,w)}}function Ha(l,u){var p=l.ref,g=l.refCleanup;if(p!==null)if(typeof g=="function")try{g()}catch(w){gn(l,u,w)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(w){gn(l,u,w)}else p.current=null}function cw(l){var u=l.type,p=l.memoizedProps,g=l.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":p.autoFocus&&g.focus();break e;case"img":p.src?g.src=p.src:p.srcSet&&(g.srcset=p.srcSet)}}catch(w){gn(l,l.return,w)}}function Jh(l,u,p){try{var g=l.stateNode;t_(g,l.type,p,u),g[Dt]=u}catch(w){gn(l,l.return,w)}}function uw(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&di(l.type)||l.tag===4}function Zh(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||uw(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&di(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function em(l,u,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,u?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(l,u):(u=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,u.appendChild(l),p=p._reactRootContainer,p!=null||u.onclick!==null||(u.onclick=ja));else if(g!==4&&(g===27&&di(l.type)&&(p=l.stateNode,u=null),l=l.child,l!==null))for(em(l,u,p),l=l.sibling;l!==null;)em(l,u,p),l=l.sibling}function xd(l,u,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,u?p.insertBefore(l,u):p.appendChild(l);else if(g!==4&&(g===27&&di(l.type)&&(p=l.stateNode),l=l.child,l!==null))for(xd(l,u,p),l=l.sibling;l!==null;)xd(l,u,p),l=l.sibling}function dw(l){var u=l.stateNode,p=l.memoizedProps;try{for(var g=l.type,w=u.attributes;w.length;)u.removeAttributeNode(w[0]);ps(u,g,p),u[xt]=l,u[Dt]=p}catch(A){gn(l,l.return,A)}}var yr=!1,Qn=!1,tm=!1,fw=typeof WeakSet=="function"?WeakSet:Set,is=null;function OE(l,u){if(l=l.containerInfo,km=Fd,l=Cy(l),Yp(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var w=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{p.nodeType,A.nodeType}catch{p=null;break e}var L=0,Y=-1,ae=-1,Oe=0,Ke=0,Ze=l,Fe=null;t:for(;;){for(var qe;Ze!==p||w!==0&&Ze.nodeType!==3||(Y=L+w),Ze!==A||g!==0&&Ze.nodeType!==3||(ae=L+g),Ze.nodeType===3&&(L+=Ze.nodeValue.length),(qe=Ze.firstChild)!==null;)Fe=Ze,Ze=qe;for(;;){if(Ze===l)break t;if(Fe===p&&++Oe===w&&(Y=L),Fe===A&&++Ke===g&&(ae=L),(qe=Ze.nextSibling)!==null)break;Ze=Fe,Fe=Ze.parentNode}Ze=qe}p=Y===-1||ae===-1?null:{start:Y,end:ae}}else p=null}p=p||{start:0,end:0}}else p=null;for(Sm={focusedElem:l,selectionRange:p},Fd=!1,is=u;is!==null;)if(u=is,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,is=l;else for(;is!==null;){switch(u=is,A=u.alternate,l=u.flags,u.tag){case 0:if((l&4)!==0&&(l=u.updateQueue,l=l!==null?l.events:null,l!==null))for(p=0;p<l.length;p++)w=l[p],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((l&1024)!==0&&A!==null){l=void 0,p=u,w=A.memoizedProps,A=A.memoizedState,g=p.stateNode;try{var yt=Vi(p.type,w);l=g.getSnapshotBeforeUpdate(yt,A),g.__reactInternalSnapshotBeforeUpdate=l}catch(Ot){gn(p,p.return,Ot)}}break;case 3:if((l&1024)!==0){if(l=u.stateNode.containerInfo,p=l.nodeType,p===9)jm(l);else if(p===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":jm(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(s(163))}if(l=u.sibling,l!==null){l.return=u.return,is=l;break}is=u.return}}function pw(l,u,p){var g=p.flags;switch(p.tag){case 0:case 11:case 15:wr(l,p),g&4&&uc(5,p);break;case 1:if(wr(l,p),g&4)if(l=p.stateNode,u===null)try{l.componentDidMount()}catch(L){gn(p,p.return,L)}else{var w=Vi(p.type,u.memoizedProps);u=u.memoizedState;try{l.componentDidUpdate(w,u,l.__reactInternalSnapshotBeforeUpdate)}catch(L){gn(p,p.return,L)}}g&64&&ow(p),g&512&&dc(p,p.return);break;case 3:if(wr(l,p),g&64&&(l=p.updateQueue,l!==null)){if(u=null,p.child!==null)switch(p.child.tag){case 27:case 5:u=p.child.stateNode;break;case 1:u=p.child.stateNode}try{Xy(l,u)}catch(L){gn(p,p.return,L)}}break;case 27:u===null&&g&4&&dw(p);case 26:case 5:wr(l,p),u===null&&g&4&&cw(p),g&512&&dc(p,p.return);break;case 12:wr(l,p);break;case 31:wr(l,p),g&4&&gw(l,p);break;case 13:wr(l,p),g&4&&bw(l,p),g&64&&(l=p.memoizedState,l!==null&&(l=l.dehydrated,l!==null&&(p=UE.bind(null,p),c_(l,p))));break;case 22:if(g=p.memoizedState!==null||yr,!g){u=u!==null&&u.memoizedState!==null||Qn,w=yr;var A=Qn;yr=g,(Qn=u)&&!A?kr(l,p,(p.subtreeFlags&8772)!==0):wr(l,p),yr=w,Qn=A}break;case 30:break;default:wr(l,p)}}function hw(l){var u=l.alternate;u!==null&&(l.alternate=null,hw(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&Fa(u)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var Rn=null,Ds=!1;function vr(l,u,p){for(p=p.child;p!==null;)mw(l,u,p),p=p.sibling}function mw(l,u,p){if(Ie&&typeof Ie.onCommitFiberUnmount=="function")try{Ie.onCommitFiberUnmount(ie,p)}catch{}switch(p.tag){case 26:Qn||Ha(p,u),vr(l,u,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Qn||Ha(p,u);var g=Rn,w=Ds;di(p.type)&&(Rn=p.stateNode,Ds=!1),vr(l,u,p),vc(p.stateNode),Rn=g,Ds=w;break;case 5:Qn||Ha(p,u);case 6:if(g=Rn,w=Ds,Rn=null,vr(l,u,p),Rn=g,Ds=w,Rn!==null)if(Ds)try{(Rn.nodeType===9?Rn.body:Rn.nodeName==="HTML"?Rn.ownerDocument.body:Rn).removeChild(p.stateNode)}catch(A){gn(p,u,A)}else try{Rn.removeChild(p.stateNode)}catch(A){gn(p,u,A)}break;case 18:Rn!==null&&(Ds?(l=Rn,o0(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,p.stateNode),el(l)):o0(Rn,p.stateNode));break;case 4:g=Rn,w=Ds,Rn=p.stateNode.containerInfo,Ds=!0,vr(l,u,p),Rn=g,Ds=w;break;case 0:case 11:case 14:case 15:ai(2,p,u),Qn||ai(4,p,u),vr(l,u,p);break;case 1:Qn||(Ha(p,u),g=p.stateNode,typeof g.componentWillUnmount=="function"&&lw(p,u,g)),vr(l,u,p);break;case 21:vr(l,u,p);break;case 22:Qn=(g=Qn)||p.memoizedState!==null,vr(l,u,p),Qn=g;break;default:vr(l,u,p)}}function gw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null))){l=l.dehydrated;try{el(l)}catch(p){gn(u,u.return,p)}}}function bw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{el(l)}catch(p){gn(u,u.return,p)}}function LE(l){switch(l.tag){case 31:case 13:case 19:var u=l.stateNode;return u===null&&(u=l.stateNode=new fw),u;case 22:return l=l.stateNode,u=l._retryCache,u===null&&(u=l._retryCache=new fw),u;default:throw Error(s(435,l.tag))}}function yd(l,u){var p=LE(l);u.forEach(function(g){if(!p.has(g)){p.add(g);var w=WE.bind(null,l,g);g.then(w,w)}})}function Rs(l,u){var p=u.deletions;if(p!==null)for(var g=0;g<p.length;g++){var w=p[g],A=l,L=u,Y=L;e:for(;Y!==null;){switch(Y.tag){case 27:if(di(Y.type)){Rn=Y.stateNode,Ds=!1;break e}break;case 5:Rn=Y.stateNode,Ds=!1;break e;case 3:case 4:Rn=Y.stateNode.containerInfo,Ds=!0;break e}Y=Y.return}if(Rn===null)throw Error(s(160));mw(A,L,w),Rn=null,Ds=!1,A=w.alternate,A!==null&&(A.return=null),w.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)xw(u,l),u=u.sibling}var Ea=null;function xw(l,u){var p=l.alternate,g=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:Rs(u,l),Os(l),g&4&&(ai(3,l,l.return),uc(3,l),ai(5,l,l.return));break;case 1:Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),g&64&&yr&&(l=l.updateQueue,l!==null&&(g=l.callbacks,g!==null&&(p=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=p===null?g:p.concat(g))));break;case 26:var w=Ea;if(Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),g&4){var A=p!==null?p.memoizedState:null;if(g=l.memoizedState,p===null)if(g===null)if(l.stateNode===null){e:{g=l.type,p=l.memoizedProps,w=w.ownerDocument||w;t:switch(g){case"title":A=w.getElementsByTagName("title")[0],(!A||A[Hs]||A[xt]||A.namespaceURI==="http://www.w3.org/2000/svg"||A.hasAttribute("itemprop"))&&(A=w.createElement(g),w.head.insertBefore(A,w.querySelector("head > title"))),ps(A,g,p),A[xt]=l,fn(A),g=A;break e;case"link":var L=x0("link","href",w).get(g+(p.href||""));if(L){for(var Y=0;Y<L.length;Y++)if(A=L[Y],A.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&A.getAttribute("rel")===(p.rel==null?null:p.rel)&&A.getAttribute("title")===(p.title==null?null:p.title)&&A.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){L.splice(Y,1);break t}}A=w.createElement(g),ps(A,g,p),w.head.appendChild(A);break;case"meta":if(L=x0("meta","content",w).get(g+(p.content||""))){for(Y=0;Y<L.length;Y++)if(A=L[Y],A.getAttribute("content")===(p.content==null?null:""+p.content)&&A.getAttribute("name")===(p.name==null?null:p.name)&&A.getAttribute("property")===(p.property==null?null:p.property)&&A.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&A.getAttribute("charset")===(p.charSet==null?null:p.charSet)){L.splice(Y,1);break t}}A=w.createElement(g),ps(A,g,p),w.head.appendChild(A);break;default:throw Error(s(468,g))}A[xt]=l,fn(A),g=A}l.stateNode=g}else y0(w,l.type,l.stateNode);else l.stateNode=b0(w,g,l.memoizedProps);else A!==g?(A===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):A.count--,g===null?y0(w,l.type,l.stateNode):b0(w,g,l.memoizedProps)):g===null&&l.stateNode!==null&&Jh(l,l.memoizedProps,p.memoizedProps)}break;case 27:Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),p!==null&&g&4&&Jh(l,l.memoizedProps,p.memoizedProps);break;case 5:if(Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),l.flags&32){w=l.stateNode;try{ia(w,"")}catch(yt){gn(l,l.return,yt)}}g&4&&l.stateNode!=null&&(w=l.memoizedProps,Jh(l,w,p!==null?p.memoizedProps:w)),g&1024&&(tm=!0);break;case 6:if(Rs(u,l),Os(l),g&4){if(l.stateNode===null)throw Error(s(162));g=l.memoizedProps,p=l.stateNode;try{p.nodeValue=g}catch(yt){gn(l,l.return,yt)}}break;case 3:if(Ld=null,w=Ea,Ea=Rd(u.containerInfo),Rs(u,l),Ea=w,Os(l),g&4&&p!==null&&p.memoizedState.isDehydrated)try{el(u.containerInfo)}catch(yt){gn(l,l.return,yt)}tm&&(tm=!1,yw(l));break;case 4:g=Ea,Ea=Rd(l.stateNode.containerInfo),Rs(u,l),Os(l),Ea=g;break;case 12:Rs(u,l),Os(l);break;case 31:Rs(u,l),Os(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 13:Rs(u,l),Os(l),l.child.flags&8192&&l.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(wd=ut()),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 22:w=l.memoizedState!==null;var ae=p!==null&&p.memoizedState!==null,Oe=yr,Ke=Qn;if(yr=Oe||w,Qn=Ke||ae,Rs(u,l),Qn=Ke,yr=Oe,Os(l),g&8192)e:for(u=l.stateNode,u._visibility=w?u._visibility&-2:u._visibility|1,w&&(p===null||ae||yr||Qn||Gi(l)),p=null,u=l;;){if(u.tag===5||u.tag===26){if(p===null){ae=p=u;try{if(A=ae.stateNode,w)L=A.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{Y=ae.stateNode;var Ze=ae.memoizedProps.style,Fe=Ze!=null&&Ze.hasOwnProperty("display")?Ze.display:null;Y.style.display=Fe==null||typeof Fe=="boolean"?"":(""+Fe).trim()}}catch(yt){gn(ae,ae.return,yt)}}}else if(u.tag===6){if(p===null){ae=u;try{ae.stateNode.nodeValue=w?"":ae.memoizedProps}catch(yt){gn(ae,ae.return,yt)}}}else if(u.tag===18){if(p===null){ae=u;try{var qe=ae.stateNode;w?l0(qe,!0):l0(ae.stateNode,!1)}catch(yt){gn(ae,ae.return,yt)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===l)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break e;for(;u.sibling===null;){if(u.return===null||u.return===l)break e;p===u&&(p=null),u=u.return}p===u&&(p=null),u.sibling.return=u.return,u=u.sibling}g&4&&(g=l.updateQueue,g!==null&&(p=g.retryQueue,p!==null&&(g.retryQueue=null,yd(l,p))));break;case 19:Rs(u,l),Os(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 30:break;case 21:break;default:Rs(u,l),Os(l)}}function Os(l){var u=l.flags;if(u&2){try{for(var p,g=l.return;g!==null;){if(uw(g)){p=g;break}g=g.return}if(p==null)throw Error(s(160));switch(p.tag){case 27:var w=p.stateNode,A=Zh(l);xd(l,A,w);break;case 5:var L=p.stateNode;p.flags&32&&(ia(L,""),p.flags&=-33);var Y=Zh(l);xd(l,Y,L);break;case 3:case 4:var ae=p.stateNode.containerInfo,Oe=Zh(l);em(l,Oe,ae);break;default:throw Error(s(161))}}catch(Ke){gn(l,l.return,Ke)}l.flags&=-3}u&4096&&(l.flags&=-4097)}function yw(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var u=l;yw(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),l=l.sibling}}function wr(l,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)pw(l,u.alternate,u),u=u.sibling}function Gi(l){for(l=l.child;l!==null;){var u=l;switch(u.tag){case 0:case 11:case 14:case 15:ai(4,u,u.return),Gi(u);break;case 1:Ha(u,u.return);var p=u.stateNode;typeof p.componentWillUnmount=="function"&&lw(u,u.return,p),Gi(u);break;case 27:vc(u.stateNode);case 26:case 5:Ha(u,u.return),Gi(u);break;case 22:u.memoizedState===null&&Gi(u);break;case 30:Gi(u);break;default:Gi(u)}l=l.sibling}}function kr(l,u,p){for(p=p&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var g=u.alternate,w=l,A=u,L=A.flags;switch(A.tag){case 0:case 11:case 15:kr(w,A,p),uc(4,A);break;case 1:if(kr(w,A,p),g=A,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(Oe){gn(g,g.return,Oe)}if(g=A,w=g.updateQueue,w!==null){var Y=g.stateNode;try{var ae=w.shared.hiddenCallbacks;if(ae!==null)for(w.shared.hiddenCallbacks=null,w=0;w<ae.length;w++)Qy(ae[w],Y)}catch(Oe){gn(g,g.return,Oe)}}p&&L&64&&ow(A),dc(A,A.return);break;case 27:dw(A);case 26:case 5:kr(w,A,p),p&&g===null&&L&4&&cw(A),dc(A,A.return);break;case 12:kr(w,A,p);break;case 31:kr(w,A,p),p&&L&4&&gw(w,A);break;case 13:kr(w,A,p),p&&L&4&&bw(w,A);break;case 22:A.memoizedState===null&&kr(w,A,p),dc(A,A.return);break;case 30:break;default:kr(w,A,p)}u=u.sibling}}function nm(l,u){var p=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),l=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(l=u.memoizedState.cachePool.pool),l!==p&&(l!=null&&l.refCount++,p!=null&&Xl(p))}function sm(l,u){l=null,u.alternate!==null&&(l=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==l&&(u.refCount++,l!=null&&Xl(l))}function _a(l,u,p,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)vw(l,u,p,g),u=u.sibling}function vw(l,u,p,g){var w=u.flags;switch(u.tag){case 0:case 11:case 15:_a(l,u,p,g),w&2048&&uc(9,u);break;case 1:_a(l,u,p,g);break;case 3:_a(l,u,p,g),w&2048&&(l=null,u.alternate!==null&&(l=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==l&&(u.refCount++,l!=null&&Xl(l)));break;case 12:if(w&2048){_a(l,u,p,g),l=u.stateNode;try{var A=u.memoizedProps,L=A.id,Y=A.onPostCommit;typeof Y=="function"&&Y(L,u.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(ae){gn(u,u.return,ae)}}else _a(l,u,p,g);break;case 31:_a(l,u,p,g);break;case 13:_a(l,u,p,g);break;case 23:break;case 22:A=u.stateNode,L=u.alternate,u.memoizedState!==null?A._visibility&2?_a(l,u,p,g):fc(l,u):A._visibility&2?_a(l,u,p,g):(A._visibility|=2,Uo(l,u,p,g,(u.subtreeFlags&10256)!==0||!1)),w&2048&&nm(L,u);break;case 24:_a(l,u,p,g),w&2048&&sm(u.alternate,u);break;default:_a(l,u,p,g)}}function Uo(l,u,p,g,w){for(w=w&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var A=l,L=u,Y=p,ae=g,Oe=L.flags;switch(L.tag){case 0:case 11:case 15:Uo(A,L,Y,ae,w),uc(8,L);break;case 23:break;case 22:var Ke=L.stateNode;L.memoizedState!==null?Ke._visibility&2?Uo(A,L,Y,ae,w):fc(A,L):(Ke._visibility|=2,Uo(A,L,Y,ae,w)),w&&Oe&2048&&nm(L.alternate,L);break;case 24:Uo(A,L,Y,ae,w),w&&Oe&2048&&sm(L.alternate,L);break;default:Uo(A,L,Y,ae,w)}u=u.sibling}}function fc(l,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var p=l,g=u,w=g.flags;switch(g.tag){case 22:fc(p,g),w&2048&&nm(g.alternate,g);break;case 24:fc(p,g),w&2048&&sm(g.alternate,g);break;default:fc(p,g)}u=u.sibling}}var pc=8192;function Wo(l,u,p){if(l.subtreeFlags&pc)for(l=l.child;l!==null;)ww(l,u,p),l=l.sibling}function ww(l,u,p){switch(l.tag){case 26:Wo(l,u,p),l.flags&pc&&l.memoizedState!==null&&w_(p,Ea,l.memoizedState,l.memoizedProps);break;case 5:Wo(l,u,p);break;case 3:case 4:var g=Ea;Ea=Rd(l.stateNode.containerInfo),Wo(l,u,p),Ea=g;break;case 22:l.memoizedState===null&&(g=l.alternate,g!==null&&g.memoizedState!==null?(g=pc,pc=16777216,Wo(l,u,p),pc=g):Wo(l,u,p));break;default:Wo(l,u,p)}}function kw(l){var u=l.alternate;if(u!==null&&(l=u.child,l!==null)){u.child=null;do u=l.sibling,l.sibling=null,l=u;while(l!==null)}}function hc(l){var u=l.deletions;if((l.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var g=u[p];is=g,Cw(g,l)}kw(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Sw(l),l=l.sibling}function Sw(l){switch(l.tag){case 0:case 11:case 15:hc(l),l.flags&2048&&ai(9,l,l.return);break;case 3:hc(l);break;case 12:hc(l);break;case 22:var u=l.stateNode;l.memoizedState!==null&&u._visibility&2&&(l.return===null||l.return.tag!==13)?(u._visibility&=-3,vd(l)):hc(l);break;default:hc(l)}}function vd(l){var u=l.deletions;if((l.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var g=u[p];is=g,Cw(g,l)}kw(l)}for(l=l.child;l!==null;){switch(u=l,u.tag){case 0:case 11:case 15:ai(8,u,u.return),vd(u);break;case 22:p=u.stateNode,p._visibility&2&&(p._visibility&=-3,vd(u));break;default:vd(u)}l=l.sibling}}function Cw(l,u){for(;is!==null;){var p=is;switch(p.tag){case 0:case 11:case 15:ai(8,p,u);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var g=p.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Xl(p.memoizedState.cache)}if(g=p.child,g!==null)g.return=p,is=g;else e:for(p=l;is!==null;){g=is;var w=g.sibling,A=g.return;if(hw(g),g===p){is=null;break e}if(w!==null){w.return=A,is=w;break e}is=A}}}var PE={getCacheForType:function(l){var u=ds(Gn),p=u.data.get(l);return p===void 0&&(p=l(),u.data.set(l,p)),p},cacheSignal:function(){return ds(Gn).controller.signal}},IE=typeof WeakMap=="function"?WeakMap:Map,pn=0,An=null,Yt=null,nn=0,mn=0,Ys=null,ri=!1,qo=!1,am=!1,Sr=0,Bn=0,ii=0,Yi=0,rm=0,Ks=0,Vo=0,mc=null,Ls=null,im=!1,wd=0,Aw=0,kd=1/0,Sd=null,oi=null,ts=0,li=null,Go=null,Cr=0,om=0,lm=null,jw=null,gc=0,cm=null;function Qs(){return(pn&2)!==0&&nn!==0?nn&-nn:F.T!==null?mm():Vt()}function Nw(){if(Ks===0)if((nn&536870912)===0||rn){var l=nt;nt<<=1,(nt&3932160)===0&&(nt=262144),Ks=l}else Ks=536870912;return l=Vs.current,l!==null&&(l.flags|=32),Ks}function Ps(l,u,p){(l===An&&(mn===2||mn===9)||l.cancelPendingCommit!==null)&&(Yo(l,0),ci(l,nn,Ks,!1)),Te(l,p),((pn&2)===0||l!==An)&&(l===An&&((pn&2)===0&&(Yi|=p),Bn===4&&ci(l,nn,Ks,!1)),Ua(l))}function Tw(l,u,p){if((pn&6)!==0)throw Error(s(327));var g=!p&&(u&127)===0&&(u&l.expiredLanes)===0||it(l,u),w=g?zE(l,u):dm(l,u,!0),A=g;do{if(w===0){qo&&!g&&ci(l,u,0,!1);break}else{if(p=l.current.alternate,A&&!BE(p)){w=dm(l,u,!1),A=!1;continue}if(w===2){if(A=u,l.errorRecoveryDisabledLanes&A)var L=0;else L=l.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){u=L;e:{var Y=l;w=mc;var ae=Y.current.memoizedState.isDehydrated;if(ae&&(Yo(Y,L).flags|=256),L=dm(Y,L,!1),L!==2){if(am&&!ae){Y.errorRecoveryDisabledLanes|=A,Yi|=A,w=4;break e}A=Ls,Ls=w,A!==null&&(Ls===null?Ls=A:Ls.push.apply(Ls,A))}w=L}if(A=!1,w!==2)continue}}if(w===1){Yo(l,0),ci(l,u,0,!0);break}e:{switch(g=l,A=w,A){case 0:case 1:throw Error(s(345));case 4:if((u&4194048)!==u)break;case 6:ci(g,u,Ks,!ri);break e;case 2:Ls=null;break;case 3:case 5:break;default:throw Error(s(329))}if((u&62914560)===u&&(w=wd+300-ut(),10<w)){if(ci(g,u,Ks,!ri),lt(g,0,!0)!==0)break e;Cr=u,g.timeoutHandle=r0(Ew.bind(null,g,p,Ls,Sd,im,u,Ks,Yi,Vo,ri,A,"Throttled",-0,0),w);break e}Ew(g,p,Ls,Sd,im,u,Ks,Yi,Vo,ri,A,null,-0,0)}}break}while(!0);Ua(l)}function Ew(l,u,p,g,w,A,L,Y,ae,Oe,Ke,Ze,Fe,qe){if(l.timeoutHandle=-1,Ze=u.subtreeFlags,Ze&8192||(Ze&16785408)===16785408){Ze={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ja},ww(u,A,Ze);var yt=(A&62914560)===A?wd-ut():(A&4194048)===A?Aw-ut():0;if(yt=k_(Ze,yt),yt!==null){Cr=A,l.cancelPendingCommit=yt(Iw.bind(null,l,u,A,p,g,w,L,Y,ae,Ke,Ze,null,Fe,qe)),ci(l,A,L,!Oe);return}}Iw(l,u,A,p,g,w,L,Y,ae)}function BE(l){for(var u=l;;){var p=u.tag;if((p===0||p===11||p===15)&&u.flags&16384&&(p=u.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var g=0;g<p.length;g++){var w=p[g],A=w.getSnapshot;w=w.value;try{if(!Ws(A(),w))return!1}catch{return!1}}if(p=u.child,u.subtreeFlags&16384&&p!==null)p.return=u,u=p;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function ci(l,u,p,g){u&=~rm,u&=~Yi,l.suspendedLanes|=u,l.pingedLanes&=~u,g&&(l.warmLanes|=u),g=l.expirationTimes;for(var w=u;0<w;){var A=31-he(w),L=1<<A;g[A]=-1,w&=~L}p!==0&&tt(l,p,u)}function Cd(){return(pn&6)===0?(bc(0),!1):!0}function um(){if(Yt!==null){if(mn===0)var l=Yt.return;else l=Yt,pr=Fi=null,jh(l),Bo=null,Zl=0,l=Yt;for(;l!==null;)iw(l.alternate,l),l=l.return;Yt=null}}function Yo(l,u){var p=l.timeoutHandle;p!==-1&&(l.timeoutHandle=-1,a_(p)),p=l.cancelPendingCommit,p!==null&&(l.cancelPendingCommit=null,p()),Cr=0,um(),An=l,Yt=p=dr(l.current,null),nn=u,mn=0,Ys=null,ri=!1,qo=it(l,u),am=!1,Vo=Ks=rm=Yi=ii=Bn=0,Ls=mc=null,im=!1,(u&8)!==0&&(u|=u&32);var g=l.entangledLanes;if(g!==0)for(l=l.entanglements,g&=u;0<g;){var w=31-he(g),A=1<<w;u|=l[w],g&=~A}return Sr=u,qu(),p}function _w(l,u){Ht=null,F.H=oc,u===Io||u===Zu?(u=Vy(),mn=3):u===hh?(u=Vy(),mn=4):mn=u===Hh?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,Ys=u,Yt===null&&(Bn=1,pd(l,ca(u,l.current)))}function Mw(){var l=Vs.current;return l===null?!0:(nn&4194048)===nn?pa===null:(nn&62914560)===nn||(nn&536870912)!==0?l===pa:!1}function Dw(){var l=F.H;return F.H=oc,l===null?oc:l}function Rw(){var l=F.A;return F.A=PE,l}function Ad(){Bn=4,ri||(nn&4194048)!==nn&&Vs.current!==null||(qo=!0),(ii&134217727)===0&&(Yi&134217727)===0||An===null||ci(An,nn,Ks,!1)}function dm(l,u,p){var g=pn;pn|=2;var w=Dw(),A=Rw();(An!==l||nn!==u)&&(Sd=null,Yo(l,u)),u=!1;var L=Bn;e:do try{if(mn!==0&&Yt!==null){var Y=Yt,ae=Ys;switch(mn){case 8:um(),L=6;break e;case 3:case 2:case 9:case 6:Vs.current===null&&(u=!0);var Oe=mn;if(mn=0,Ys=null,Ko(l,Y,ae,Oe),p&&qo){L=0;break e}break;default:Oe=mn,mn=0,Ys=null,Ko(l,Y,ae,Oe)}}FE(),L=Bn;break}catch(Ke){_w(l,Ke)}while(!0);return u&&l.shellSuspendCounter++,pr=Fi=null,pn=g,F.H=w,F.A=A,Yt===null&&(An=null,nn=0,qu()),L}function FE(){for(;Yt!==null;)Ow(Yt)}function zE(l,u){var p=pn;pn|=2;var g=Dw(),w=Rw();An!==l||nn!==u?(Sd=null,kd=ut()+500,Yo(l,u)):qo=it(l,u);e:do try{if(mn!==0&&Yt!==null){u=Yt;var A=Ys;t:switch(mn){case 1:mn=0,Ys=null,Ko(l,u,A,1);break;case 2:case 9:if(Wy(A)){mn=0,Ys=null,Lw(u);break}u=function(){mn!==2&&mn!==9||An!==l||(mn=7),Ua(l)},A.then(u,u);break e;case 3:mn=7;break e;case 4:mn=5;break e;case 7:Wy(A)?(mn=0,Ys=null,Lw(u)):(mn=0,Ys=null,Ko(l,u,A,7));break;case 5:var L=null;switch(Yt.tag){case 26:L=Yt.memoizedState;case 5:case 27:var Y=Yt;if(L?v0(L):Y.stateNode.complete){mn=0,Ys=null;var ae=Y.sibling;if(ae!==null)Yt=ae;else{var Oe=Y.return;Oe!==null?(Yt=Oe,jd(Oe)):Yt=null}break t}}mn=0,Ys=null,Ko(l,u,A,5);break;case 6:mn=0,Ys=null,Ko(l,u,A,6);break;case 8:um(),Bn=6;break e;default:throw Error(s(462))}}$E();break}catch(Ke){_w(l,Ke)}while(!0);return pr=Fi=null,F.H=g,F.A=w,pn=p,Yt!==null?0:(An=null,nn=0,qu(),Bn)}function $E(){for(;Yt!==null&&!Ve();)Ow(Yt)}function Ow(l){var u=aw(l.alternate,l,Sr);l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Lw(l){var u=l,p=u.alternate;switch(u.tag){case 15:case 0:u=Jv(p,u,u.pendingProps,u.type,void 0,nn);break;case 11:u=Jv(p,u,u.pendingProps,u.type.render,u.ref,nn);break;case 5:jh(u);default:iw(p,u),u=Yt=Ry(u,Sr),u=aw(p,u,Sr)}l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Ko(l,u,p,g){pr=Fi=null,jh(u),Bo=null,Zl=0;var w=u.return;try{if(EE(l,w,u,p,nn)){Bn=1,pd(l,ca(p,l.current)),Yt=null;return}}catch(A){if(w!==null)throw Yt=w,A;Bn=1,pd(l,ca(p,l.current)),Yt=null;return}u.flags&32768?(rn||g===1?l=!0:qo||(nn&536870912)!==0?l=!1:(ri=l=!0,(g===2||g===9||g===3||g===6)&&(g=Vs.current,g!==null&&g.tag===13&&(g.flags|=16384))),Pw(u,l)):jd(u)}function jd(l){var u=l;do{if((u.flags&32768)!==0){Pw(u,ri);return}l=u.return;var p=DE(u.alternate,u,Sr);if(p!==null){Yt=p;return}if(u=u.sibling,u!==null){Yt=u;return}Yt=u=l}while(u!==null);Bn===0&&(Bn=5)}function Pw(l,u){do{var p=RE(l.alternate,l);if(p!==null){p.flags&=32767,Yt=p;return}if(p=l.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!u&&(l=l.sibling,l!==null)){Yt=l;return}Yt=l=p}while(l!==null);Bn=6,Yt=null}function Iw(l,u,p,g,w,A,L,Y,ae){l.cancelPendingCommit=null;do Nd();while(ts!==0);if((pn&6)!==0)throw Error(s(327));if(u!==null){if(u===l.current)throw Error(s(177));if(A=u.lanes|u.childLanes,A|=Zp,Ye(l,p,A,L,Y,ae),l===An&&(Yt=An=null,nn=0),Go=u,li=l,Cr=p,om=A,lm=w,jw=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(l.callbackNode=null,l.callbackPriority=0,qE(ke,function(){return Hw(),null})):(l.callbackNode=null,l.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,w=H.p,H.p=2,L=pn,pn|=4;try{OE(l,u,p)}finally{pn=L,H.p=w,F.T=g}}ts=1,Bw(),Fw(),zw()}}function Bw(){if(ts===1){ts=0;var l=li,u=Go,p=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var g=H.p;H.p=2;var w=pn;pn|=4;try{xw(u,l);var A=Sm,L=Cy(l.containerInfo),Y=A.focusedElem,ae=A.selectionRange;if(L!==Y&&Y&&Y.ownerDocument&&Sy(Y.ownerDocument.documentElement,Y)){if(ae!==null&&Yp(Y)){var Oe=ae.start,Ke=ae.end;if(Ke===void 0&&(Ke=Oe),"selectionStart"in Y)Y.selectionStart=Oe,Y.selectionEnd=Math.min(Ke,Y.value.length);else{var Ze=Y.ownerDocument||document,Fe=Ze&&Ze.defaultView||window;if(Fe.getSelection){var qe=Fe.getSelection(),yt=Y.textContent.length,Ot=Math.min(ae.start,yt),wn=ae.end===void 0?Ot:Math.min(ae.end,yt);!qe.extend&&Ot>wn&&(L=wn,wn=Ot,Ot=L);var Se=ky(Y,Ot),le=ky(Y,wn);if(Se&&le&&(qe.rangeCount!==1||qe.anchorNode!==Se.node||qe.anchorOffset!==Se.offset||qe.focusNode!==le.node||qe.focusOffset!==le.offset)){var Me=Ze.createRange();Me.setStart(Se.node,Se.offset),qe.removeAllRanges(),Ot>wn?(qe.addRange(Me),qe.extend(le.node,le.offset)):(Me.setEnd(le.node,le.offset),qe.addRange(Me))}}}}for(Ze=[],qe=Y;qe=qe.parentNode;)qe.nodeType===1&&Ze.push({element:qe,left:qe.scrollLeft,top:qe.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<Ze.length;Y++){var Xe=Ze[Y];Xe.element.scrollLeft=Xe.left,Xe.element.scrollTop=Xe.top}}Fd=!!km,Sm=km=null}finally{pn=w,H.p=g,F.T=p}}l.current=u,ts=2}}function Fw(){if(ts===2){ts=0;var l=li,u=Go,p=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var g=H.p;H.p=2;var w=pn;pn|=4;try{pw(l,u.alternate,u)}finally{pn=w,H.p=g,F.T=p}}ts=3}}function zw(){if(ts===4||ts===3){ts=0,at();var l=li,u=Go,p=Cr,g=jw;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?ts=5:(ts=0,Go=li=null,$w(l,l.pendingLanes));var w=l.pendingLanes;if(w===0&&(oi=null),It(p),u=u.stateNode,Ie&&typeof Ie.onCommitFiberRoot=="function")try{Ie.onCommitFiberRoot(ie,u,void 0,(u.current.flags&128)===128)}catch{}if(g!==null){u=F.T,w=H.p,H.p=2,F.T=null;try{for(var A=l.onRecoverableError,L=0;L<g.length;L++){var Y=g[L];A(Y.value,{componentStack:Y.stack})}}finally{F.T=u,H.p=w}}(Cr&3)!==0&&Nd(),Ua(l),w=l.pendingLanes,(p&261930)!==0&&(w&42)!==0?l===cm?gc++:(gc=0,cm=l):gc=0,bc(0)}}function $w(l,u){(l.pooledCacheLanes&=u)===0&&(u=l.pooledCache,u!=null&&(l.pooledCache=null,Xl(u)))}function Nd(){return Bw(),Fw(),zw(),Hw()}function Hw(){if(ts!==5)return!1;var l=li,u=om;om=0;var p=It(Cr),g=F.T,w=H.p;try{H.p=32>p?32:p,F.T=null,p=lm,lm=null;var A=li,L=Cr;if(ts=0,Go=li=null,Cr=0,(pn&6)!==0)throw Error(s(331));var Y=pn;if(pn|=4,Sw(A.current),vw(A,A.current,L,p),pn=Y,bc(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(ie,A)}catch{}return!0}finally{H.p=w,F.T=g,$w(l,u)}}function Uw(l,u,p){u=ca(p,u),u=$h(l.stateNode,u,2),l=ti(l,u,2),l!==null&&(Te(l,2),Ua(l))}function gn(l,u,p){if(l.tag===3)Uw(l,l,p);else for(;u!==null;){if(u.tag===3){Uw(u,l,p);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(oi===null||!oi.has(g))){l=ca(p,l),p=Wv(2),g=ti(u,p,2),g!==null&&(qv(p,g,u,l),Te(g,2),Ua(g));break}}u=u.return}}function fm(l,u,p){var g=l.pingCache;if(g===null){g=l.pingCache=new IE;var w=new Set;g.set(u,w)}else w=g.get(u),w===void 0&&(w=new Set,g.set(u,w));w.has(p)||(am=!0,w.add(p),l=HE.bind(null,l,u,p),u.then(l,l))}function HE(l,u,p){var g=l.pingCache;g!==null&&g.delete(u),l.pingedLanes|=l.suspendedLanes&p,l.warmLanes&=~p,An===l&&(nn&p)===p&&(Bn===4||Bn===3&&(nn&62914560)===nn&&300>ut()-wd?(pn&2)===0&&Yo(l,0):rm|=p,Vo===nn&&(Vo=0)),Ua(l)}function Ww(l,u){u===0&&(u=jt()),l=Pi(l,u),l!==null&&(Te(l,u),Ua(l))}function UE(l){var u=l.memoizedState,p=0;u!==null&&(p=u.retryLane),Ww(l,p)}function WE(l,u){var p=0;switch(l.tag){case 31:case 13:var g=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:g=l.stateNode;break;case 22:g=l.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(u),Ww(l,p)}function qE(l,u){return re(l,u)}var Td=null,Qo=null,pm=!1,Ed=!1,hm=!1,ui=0;function Ua(l){l!==Qo&&l.next===null&&(Qo===null?Td=Qo=l:Qo=Qo.next=l),Ed=!0,pm||(pm=!0,GE())}function bc(l,u){if(!hm&&Ed){hm=!0;do for(var p=!1,g=Td;g!==null;){if(l!==0){var w=g.pendingLanes;if(w===0)var A=0;else{var L=g.suspendedLanes,Y=g.pingedLanes;A=(1<<31-he(42|l)+1)-1,A&=w&~(L&~Y),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(p=!0,Yw(g,A))}else A=nn,A=lt(g,g===An?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||it(g,A)||(p=!0,Yw(g,A));g=g.next}while(p);hm=!1}}function VE(){qw()}function qw(){Ed=pm=!1;var l=0;ui!==0&&s_()&&(l=ui);for(var u=ut(),p=null,g=Td;g!==null;){var w=g.next,A=Vw(g,u);A===0?(g.next=null,p===null?Td=w:p.next=w,w===null&&(Qo=p)):(p=g,(l!==0||(A&3)!==0)&&(Ed=!0)),g=w}ts!==0&&ts!==5||bc(l),ui!==0&&(ui=0)}function Vw(l,u){for(var p=l.suspendedLanes,g=l.pingedLanes,w=l.expirationTimes,A=l.pendingLanes&-62914561;0<A;){var L=31-he(A),Y=1<<L,ae=w[L];ae===-1?((Y&p)===0||(Y&g)!==0)&&(w[L]=ht(Y,u)):ae<=u&&(l.expiredLanes|=Y),A&=~Y}if(u=An,p=nn,p=lt(l,l===u?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),g=l.callbackNode,p===0||l===u&&(mn===2||mn===9)||l.cancelPendingCommit!==null)return g!==null&&g!==null&&pe(g),l.callbackNode=null,l.callbackPriority=0;if((p&3)===0||it(l,p)){if(u=p&-p,u===l.callbackPriority)return u;switch(g!==null&&pe(g),It(p)){case 2:case 8:p=se;break;case 32:p=ke;break;case 268435456:p=we;break;default:p=ke}return g=Gw.bind(null,l),p=re(p,g),l.callbackPriority=u,l.callbackNode=p,u}return g!==null&&g!==null&&pe(g),l.callbackPriority=2,l.callbackNode=null,2}function Gw(l,u){if(ts!==0&&ts!==5)return l.callbackNode=null,l.callbackPriority=0,null;var p=l.callbackNode;if(Nd()&&l.callbackNode!==p)return null;var g=nn;return g=lt(l,l===An?g:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),g===0?null:(Tw(l,g,u),Vw(l,ut()),l.callbackNode!=null&&l.callbackNode===p?Gw.bind(null,l):null)}function Yw(l,u){if(Nd())return null;Tw(l,u,!0)}function GE(){r_(function(){(pn&6)!==0?re(X,VE):qw()})}function mm(){if(ui===0){var l=Lo;l===0&&(l=$e,$e<<=1,($e&261888)===0&&($e=256)),ui=l}return ui}function Kw(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:qr(""+l)}function Qw(l,u){var p=u.ownerDocument.createElement("input");return p.name=u.name,p.value=u.value,l.id&&p.setAttribute("form",l.id),u.parentNode.insertBefore(p,u),l=new FormData(l),p.parentNode.removeChild(p),l}function YE(l,u,p,g,w){if(u==="submit"&&p&&p.stateNode===w){var A=Kw((w[Dt]||null).action),L=g.submitter;L&&(u=(u=L[Dt]||null)?Kw(u.formAction):L.getAttribute("formAction"),u!==null&&(A=u,L=null));var Y=new gt("action","action",null,g,w);l.push({event:Y,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ui!==0){var ae=L?Qw(w,L):new FormData(w);Lh(p,{pending:!0,data:ae,method:w.method,action:A},null,ae)}}else typeof A=="function"&&(Y.preventDefault(),ae=L?Qw(w,L):new FormData(w),Lh(p,{pending:!0,data:ae,method:w.method,action:A},A,ae))},currentTarget:w}]})}}for(var gm=0;gm<Jp.length;gm++){var bm=Jp[gm],KE=bm.toLowerCase(),QE=bm[0].toUpperCase()+bm.slice(1);Ta(KE,"on"+QE)}Ta(Ny,"onAnimationEnd"),Ta(Ty,"onAnimationIteration"),Ta(Ey,"onAnimationStart"),Ta("dblclick","onDoubleClick"),Ta("focusin","onFocus"),Ta("focusout","onBlur"),Ta(fE,"onTransitionRun"),Ta(pE,"onTransitionStart"),Ta(hE,"onTransitionCancel"),Ta(_y,"onTransitionEnd"),_s("onMouseEnter",["mouseout","mouseover"]),_s("onMouseLeave",["mouseout","mouseover"]),_s("onPointerEnter",["pointerout","pointerover"]),_s("onPointerLeave",["pointerout","pointerover"]),Es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Es("onBeforeInput",["compositionend","keypress","textInput","paste"]),Es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xc="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(" "),XE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xc));function Xw(l,u){u=(u&4)!==0;for(var p=0;p<l.length;p++){var g=l[p],w=g.event;g=g.listeners;e:{var A=void 0;if(u)for(var L=g.length-1;0<=L;L--){var Y=g[L],ae=Y.instance,Oe=Y.currentTarget;if(Y=Y.listener,ae!==A&&w.isPropagationStopped())break e;A=Y,w.currentTarget=Oe;try{A(w)}catch(Ke){Wu(Ke)}w.currentTarget=null,A=ae}else for(L=0;L<g.length;L++){if(Y=g[L],ae=Y.instance,Oe=Y.currentTarget,Y=Y.listener,ae!==A&&w.isPropagationStopped())break e;A=Y,w.currentTarget=Oe;try{A(w)}catch(Ke){Wu(Ke)}w.currentTarget=null,A=ae}}}}function Kt(l,u){var p=u[cn];p===void 0&&(p=u[cn]=new Set);var g=l+"__bubble";p.has(g)||(Jw(u,l,2,!1),p.add(g))}function xm(l,u,p){var g=0;u&&(g|=4),Jw(p,l,g,u)}var _d="_reactListening"+Math.random().toString(36).slice(2);function ym(l){if(!l[_d]){l[_d]=!0,cr.forEach(function(p){p!=="selectionchange"&&(XE.has(p)||xm(p,!1,l),xm(p,!0,l))});var u=l.nodeType===9?l:l.ownerDocument;u===null||u[_d]||(u[_d]=!0,xm("selectionchange",!1,u))}}function Jw(l,u,p,g){switch(N0(u)){case 2:var w=A_;break;case 8:w=j_;break;default:w=Om}p=w.bind(null,u,p,l),w=void 0,!Co||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(w=!0),g?w!==void 0?l.addEventListener(u,p,{capture:!0,passive:w}):l.addEventListener(u,p,!0):w!==void 0?l.addEventListener(u,p,{passive:w}):l.addEventListener(u,p,!1)}function vm(l,u,p,g,w){var A=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var L=g.tag;if(L===3||L===4){var Y=g.stateNode.containerInfo;if(Y===w)break;if(L===4)for(L=g.return;L!==null;){var ae=L.tag;if((ae===3||ae===4)&&L.stateNode.containerInfo===w)return;L=L.return}for(;Y!==null;){if(L=ks(Y),L===null)return;if(ae=L.tag,ae===5||ae===6||ae===26||ae===27){g=A=L;continue e}Y=Y.parentNode}}g=g.return}Hl(function(){var Oe=A,Ke=zl(p),Ze=[];e:{var Fe=My.get(l);if(Fe!==void 0){var qe=gt,yt=l;switch(l){case"keypress":if(Di(p)===0)break e;case"keydown":case"keyup":qe=WT;break;case"focusin":yt="focus",qe=Ri;break;case"focusout":yt="blur",qe=Ri;break;case"beforeblur":case"afterblur":qe=Ri;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":qe=zp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":qe=zu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":qe=GT;break;case Ny:case Ty:case Ey:qe=Hp;break;case _y:qe=KT;break;case"scroll":case"scrollend":qe=Cn;break;case"wheel":qe=XT;break;case"copy":case"cut":case"paste":qe=IT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":qe=ly;break;case"toggle":case"beforetoggle":qe=ZT}var Ot=(u&4)!==0,wn=!Ot&&(l==="scroll"||l==="scrollend"),Se=Ot?Fe!==null?Fe+"Capture":null:Fe;Ot=[];for(var le=Oe,Me;le!==null;){var Xe=le;if(Me=Xe.stateNode,Xe=Xe.tag,Xe!==5&&Xe!==26&&Xe!==27||Me===null||Se===null||(Xe=Gr(le,Se),Xe!=null&&Ot.push(yc(le,Xe,Me))),wn)break;le=le.return}0<Ot.length&&(Fe=new qe(Fe,yt,null,p,Ke),Ze.push({event:Fe,listeners:Ot}))}}if((u&7)===0){e:{if(Fe=l==="mouseover"||l==="pointerover",qe=l==="mouseout"||l==="pointerout",Fe&&p!==Fl&&(yt=p.relatedTarget||p.fromElement)&&(ks(yt)||yt[Sn]))break e;if((qe||Fe)&&(Fe=Ke.window===Ke?Ke:(Fe=Ke.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,qe?(yt=p.relatedTarget||p.toElement,qe=Oe,yt=yt?ks(yt):null,yt!==null&&(wn=r(yt),Ot=yt.tag,yt!==wn||Ot!==5&&Ot!==27&&Ot!==6)&&(yt=null)):(qe=null,yt=Oe),qe!==yt)){if(Ot=zp,Xe="onMouseLeave",Se="onMouseEnter",le="mouse",(l==="pointerout"||l==="pointerover")&&(Ot=ly,Xe="onPointerLeave",Se="onPointerEnter",le="pointer"),wn=qe==null?Fe:_t(qe),Me=yt==null?Fe:_t(yt),Fe=new Ot(Xe,le+"leave",qe,p,Ke),Fe.target=wn,Fe.relatedTarget=Me,Xe=null,ks(Ke)===Oe&&(Ot=new Ot(Se,le+"enter",yt,p,Ke),Ot.target=Me,Ot.relatedTarget=wn,Xe=Ot),wn=Xe,qe&&yt)t:{for(Ot=JE,Se=qe,le=yt,Me=0,Xe=Se;Xe;Xe=Ot(Xe))Me++;Xe=0;for(var Et=le;Et;Et=Ot(Et))Xe++;for(;0<Me-Xe;)Se=Ot(Se),Me--;for(;0<Xe-Me;)le=Ot(le),Xe--;for(;Me--;){if(Se===le||le!==null&&Se===le.alternate){Ot=Se;break t}Se=Ot(Se),le=Ot(le)}Ot=null}else Ot=null;qe!==null&&Zw(Ze,Fe,qe,Ot,!1),yt!==null&&wn!==null&&Zw(Ze,wn,yt,Ot,!0)}}e:{if(Fe=Oe?_t(Oe):window,qe=Fe.nodeName&&Fe.nodeName.toLowerCase(),qe==="select"||qe==="input"&&Fe.type==="file")var un=gy;else if(hy(Fe))if(by)un=cE;else{un=oE;var kt=iE}else qe=Fe.nodeName,!qe||qe.toLowerCase()!=="input"||Fe.type!=="checkbox"&&Fe.type!=="radio"?Oe&&ko(Oe.elementType)&&(un=gy):un=lE;if(un&&(un=un(l,Oe))){my(Ze,un,p,Ke);break e}kt&&kt(l,Fe,Oe),l==="focusout"&&Oe&&Fe.type==="number"&&Oe.memoizedProps.value!=null&&Ss(Fe,"number",Fe.value)}switch(kt=Oe?_t(Oe):window,l){case"focusin":(hy(kt)||kt.contentEditable==="true")&&(No=kt,Kp=Oe,Yl=null);break;case"focusout":Yl=Kp=No=null;break;case"mousedown":Qp=!0;break;case"contextmenu":case"mouseup":case"dragend":Qp=!1,Ay(Ze,p,Ke);break;case"selectionchange":if(dE)break;case"keydown":case"keyup":Ay(Ze,p,Ke)}var Ut;if(qp)e:{switch(l){case"compositionstart":var sn="onCompositionStart";break e;case"compositionend":sn="onCompositionEnd";break e;case"compositionupdate":sn="onCompositionUpdate";break e}sn=void 0}else jo?fy(l,p)&&(sn="onCompositionEnd"):l==="keydown"&&p.keyCode===229&&(sn="onCompositionStart");sn&&(cy&&p.locale!=="ko"&&(jo||sn!=="onCompositionStart"?sn==="onCompositionEnd"&&jo&&(Ut=Ul()):(Na=Ke,Ao="value"in Na?Na.value:Na.textContent,jo=!0)),kt=Md(Oe,sn),0<kt.length&&(sn=new oy(sn,l,null,p,Ke),Ze.push({event:sn,listeners:kt}),Ut?sn.data=Ut:(Ut=py(p),Ut!==null&&(sn.data=Ut)))),(Ut=tE?nE(l,p):sE(l,p))&&(sn=Md(Oe,"onBeforeInput"),0<sn.length&&(kt=new oy("onBeforeInput","beforeinput",null,p,Ke),Ze.push({event:kt,listeners:sn}),kt.data=Ut)),YE(Ze,l,Oe,p,Ke)}Xw(Ze,u)})}function yc(l,u,p){return{instance:l,listener:u,currentTarget:p}}function Md(l,u){for(var p=u+"Capture",g=[];l!==null;){var w=l,A=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||A===null||(w=Gr(l,p),w!=null&&g.unshift(yc(l,w,A)),w=Gr(l,u),w!=null&&g.push(yc(l,w,A))),l.tag===3)return g;l=l.return}return[]}function JE(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function Zw(l,u,p,g,w){for(var A=u._reactName,L=[];p!==null&&p!==g;){var Y=p,ae=Y.alternate,Oe=Y.stateNode;if(Y=Y.tag,ae!==null&&ae===g)break;Y!==5&&Y!==26&&Y!==27||Oe===null||(ae=Oe,w?(Oe=Gr(p,A),Oe!=null&&L.unshift(yc(p,Oe,ae))):w||(Oe=Gr(p,A),Oe!=null&&L.push(yc(p,Oe,ae)))),p=p.return}L.length!==0&&l.push({event:u,listeners:L})}var ZE=/\r\n?/g,e_=/\u0000|\uFFFD/g;function e0(l){return(typeof l=="string"?l:""+l).replace(ZE,`
|
|
34
|
-
`).replace(e_,"")}function t0(l,u){return u=e0(u),e0(l)===u}function vn(l,u,p,g,w,A){switch(p){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||ia(l,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&ia(l,""+g);break;case"className":Ca(l,"class",g);break;case"tabIndex":Ca(l,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ca(l,p,g);break;case"style":Bu(l,g,A);break;case"data":if(u!=="object"){Ca(l,"data",g);break}case"src":case"href":if(g===""&&(u!=="a"||p!=="href")){l.removeAttribute(p);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){l.removeAttribute(p);break}g=qr(""+g),l.setAttribute(p,g);break;case"action":case"formAction":if(typeof g=="function"){l.setAttribute(p,"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 A=="function"&&(p==="formAction"?(u!=="input"&&vn(l,u,"name",w.name,w,null),vn(l,u,"formEncType",w.formEncType,w,null),vn(l,u,"formMethod",w.formMethod,w,null),vn(l,u,"formTarget",w.formTarget,w,null)):(vn(l,u,"encType",w.encType,w,null),vn(l,u,"method",w.method,w,null),vn(l,u,"target",w.target,w,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){l.removeAttribute(p);break}g=qr(""+g),l.setAttribute(p,g);break;case"onClick":g!=null&&(l.onclick=ja);break;case"onScroll":g!=null&&Kt("scroll",l);break;case"onScrollEnd":g!=null&&Kt("scrollend",l);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(p=g.__html,p!=null){if(w.children!=null)throw Error(s(60));l.innerHTML=p}}break;case"multiple":l.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":l.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){l.removeAttribute("xlink:href");break}p=qr(""+g),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,""+g):l.removeAttribute(p);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":g&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,""):l.removeAttribute(p);break;case"capture":case"download":g===!0?l.setAttribute(p,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,g):l.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?l.setAttribute(p,g):l.removeAttribute(p);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?l.removeAttribute(p):l.setAttribute(p,g);break;case"popover":Kt("beforetoggle",l),Kt("toggle",l),gs(l,"popover",g);break;case"xlinkActuate":cs(l,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":cs(l,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":cs(l,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":cs(l,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":cs(l,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":cs(l,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":cs(l,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":cs(l,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":cs(l,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":gs(l,"is",g);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=Fu.get(p)||p,gs(l,p,g))}}function wm(l,u,p,g,w,A){switch(p){case"style":Bu(l,g,A);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(p=g.__html,p!=null){if(w.children!=null)throw Error(s(60));l.innerHTML=p}}break;case"children":typeof g=="string"?ia(l,g):(typeof g=="number"||typeof g=="bigint")&&ia(l,""+g);break;case"onScroll":g!=null&&Kt("scroll",l);break;case"onScrollEnd":g!=null&&Kt("scrollend",l);break;case"onClick":g!=null&&(l.onclick=ja);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hr.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(w=p.endsWith("Capture"),u=p.slice(2,w?p.length-7:void 0),A=l[Dt]||null,A=A!=null?A[p]:null,typeof A=="function"&&l.removeEventListener(u,A,w),typeof g=="function")){typeof A!="function"&&A!==null&&(p in l?l[p]=null:l.hasAttribute(p)&&l.removeAttribute(p)),l.addEventListener(u,g,w);break e}p in l?l[p]=g:g===!0?l.setAttribute(p,""):gs(l,p,g)}}}function ps(l,u,p){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Kt("error",l),Kt("load",l);var g=!1,w=!1,A;for(A in p)if(p.hasOwnProperty(A)){var L=p[A];if(L!=null)switch(A){case"src":g=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,u));default:vn(l,u,A,L,p,null)}}w&&vn(l,u,"srcSet",p.srcSet,p,null),g&&vn(l,u,"src",p.src,p,null);return;case"input":Kt("invalid",l);var Y=A=L=w=null,ae=null,Oe=null;for(g in p)if(p.hasOwnProperty(g)){var Ke=p[g];if(Ke!=null)switch(g){case"name":w=Ke;break;case"type":L=Ke;break;case"checked":ae=Ke;break;case"defaultChecked":Oe=Ke;break;case"value":A=Ke;break;case"defaultValue":Y=Ke;break;case"children":case"dangerouslySetInnerHTML":if(Ke!=null)throw Error(s(137,u));break;default:vn(l,u,g,Ke,p,null)}}Nn(l,A,Y,ae,Oe,L,w,!1);return;case"select":Kt("invalid",l),g=L=A=null;for(w in p)if(p.hasOwnProperty(w)&&(Y=p[w],Y!=null))switch(w){case"value":A=Y;break;case"defaultValue":L=Y;break;case"multiple":g=Y;default:vn(l,u,w,Y,p,null)}u=A,p=L,l.multiple=!!g,u!=null?Pn(l,!!g,u,!1):p!=null&&Pn(l,!!g,p,!0);return;case"textarea":Kt("invalid",l),A=w=g=null;for(L in p)if(p.hasOwnProperty(L)&&(Y=p[L],Y!=null))switch(L){case"value":g=Y;break;case"defaultValue":w=Y;break;case"children":A=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(91));break;default:vn(l,u,L,Y,p,null)}Aa(l,g,w,A);return;case"option":for(ae in p)if(p.hasOwnProperty(ae)&&(g=p[ae],g!=null))switch(ae){case"selected":l.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:vn(l,u,ae,g,p,null)}return;case"dialog":Kt("beforetoggle",l),Kt("toggle",l),Kt("cancel",l),Kt("close",l);break;case"iframe":case"object":Kt("load",l);break;case"video":case"audio":for(g=0;g<xc.length;g++)Kt(xc[g],l);break;case"image":Kt("error",l),Kt("load",l);break;case"details":Kt("toggle",l);break;case"embed":case"source":case"link":Kt("error",l),Kt("load",l);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 p)if(p.hasOwnProperty(Oe)&&(g=p[Oe],g!=null))switch(Oe){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,u));default:vn(l,u,Oe,g,p,null)}return;default:if(ko(u)){for(Ke in p)p.hasOwnProperty(Ke)&&(g=p[Ke],g!==void 0&&wm(l,u,Ke,g,p,void 0));return}}for(Y in p)p.hasOwnProperty(Y)&&(g=p[Y],g!=null&&vn(l,u,Y,g,p,null))}function t_(l,u,p,g){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,A=null,L=null,Y=null,ae=null,Oe=null,Ke=null;for(qe in p){var Ze=p[qe];if(p.hasOwnProperty(qe)&&Ze!=null)switch(qe){case"checked":break;case"value":break;case"defaultValue":ae=Ze;default:g.hasOwnProperty(qe)||vn(l,u,qe,null,g,Ze)}}for(var Fe in g){var qe=g[Fe];if(Ze=p[Fe],g.hasOwnProperty(Fe)&&(qe!=null||Ze!=null))switch(Fe){case"type":A=qe;break;case"name":w=qe;break;case"checked":Oe=qe;break;case"defaultChecked":Ke=qe;break;case"value":L=qe;break;case"defaultValue":Y=qe;break;case"children":case"dangerouslySetInnerHTML":if(qe!=null)throw Error(s(137,u));break;default:qe!==Ze&&vn(l,u,Fe,qe,g,Ze)}}At(l,L,Y,ae,Oe,Ke,A,w);return;case"select":qe=L=Y=Fe=null;for(A in p)if(ae=p[A],p.hasOwnProperty(A)&&ae!=null)switch(A){case"value":break;case"multiple":qe=ae;default:g.hasOwnProperty(A)||vn(l,u,A,null,g,ae)}for(w in g)if(A=g[w],ae=p[w],g.hasOwnProperty(w)&&(A!=null||ae!=null))switch(w){case"value":Fe=A;break;case"defaultValue":Y=A;break;case"multiple":L=A;default:A!==ae&&vn(l,u,w,A,g,ae)}u=Y,p=L,g=qe,Fe!=null?Pn(l,!!p,Fe,!1):!!g!=!!p&&(u!=null?Pn(l,!!p,u,!0):Pn(l,!!p,p?[]:"",!1));return;case"textarea":qe=Fe=null;for(Y in p)if(w=p[Y],p.hasOwnProperty(Y)&&w!=null&&!g.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:vn(l,u,Y,null,g,w)}for(L in g)if(w=g[L],A=p[L],g.hasOwnProperty(L)&&(w!=null||A!=null))switch(L){case"value":Fe=w;break;case"defaultValue":qe=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==A&&vn(l,u,L,w,g,A)}Us(l,Fe,qe);return;case"option":for(var yt in p)if(Fe=p[yt],p.hasOwnProperty(yt)&&Fe!=null&&!g.hasOwnProperty(yt))switch(yt){case"selected":l.selected=!1;break;default:vn(l,u,yt,null,g,Fe)}for(ae in g)if(Fe=g[ae],qe=p[ae],g.hasOwnProperty(ae)&&Fe!==qe&&(Fe!=null||qe!=null))switch(ae){case"selected":l.selected=Fe&&typeof Fe!="function"&&typeof Fe!="symbol";break;default:vn(l,u,ae,Fe,g,qe)}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 Ot in p)Fe=p[Ot],p.hasOwnProperty(Ot)&&Fe!=null&&!g.hasOwnProperty(Ot)&&vn(l,u,Ot,null,g,Fe);for(Oe in g)if(Fe=g[Oe],qe=p[Oe],g.hasOwnProperty(Oe)&&Fe!==qe&&(Fe!=null||qe!=null))switch(Oe){case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(s(137,u));break;default:vn(l,u,Oe,Fe,g,qe)}return;default:if(ko(u)){for(var wn in p)Fe=p[wn],p.hasOwnProperty(wn)&&Fe!==void 0&&!g.hasOwnProperty(wn)&&wm(l,u,wn,void 0,g,Fe);for(Ke in g)Fe=g[Ke],qe=p[Ke],!g.hasOwnProperty(Ke)||Fe===qe||Fe===void 0&&qe===void 0||wm(l,u,Ke,Fe,g,qe);return}}for(var Se in p)Fe=p[Se],p.hasOwnProperty(Se)&&Fe!=null&&!g.hasOwnProperty(Se)&&vn(l,u,Se,null,g,Fe);for(Ze in g)Fe=g[Ze],qe=p[Ze],!g.hasOwnProperty(Ze)||Fe===qe||Fe==null&&qe==null||vn(l,u,Ze,Fe,g,qe)}function n0(l){switch(l){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n_(){if(typeof performance.getEntriesByType=="function"){for(var l=0,u=0,p=performance.getEntriesByType("resource"),g=0;g<p.length;g++){var w=p[g],A=w.transferSize,L=w.initiatorType,Y=w.duration;if(A&&Y&&n0(L)){for(L=0,Y=w.responseEnd,g+=1;g<p.length;g++){var ae=p[g],Oe=ae.startTime;if(Oe>Y)break;var Ke=ae.transferSize,Ze=ae.initiatorType;Ke&&n0(Ze)&&(ae=ae.responseEnd,L+=Ke*(ae<Y?1:(Y-Oe)/(ae-Oe)))}if(--g,u+=8*(A+L)/(w.duration/1e3),l++,10<l)break}}if(0<l)return u/l/1e6}return navigator.connection&&(l=navigator.connection.downlink,typeof l=="number")?l:5}var km=null,Sm=null;function Dd(l){return l.nodeType===9?l:l.ownerDocument}function s0(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function a0(l,u){if(l===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&u==="foreignObject"?0:l}function Cm(l,u){return l==="textarea"||l==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var Am=null;function s_(){var l=window.event;return l&&l.type==="popstate"?l===Am?!1:(Am=l,!0):(Am=null,!1)}var r0=typeof setTimeout=="function"?setTimeout:void 0,a_=typeof clearTimeout=="function"?clearTimeout:void 0,i0=typeof Promise=="function"?Promise:void 0,r_=typeof queueMicrotask=="function"?queueMicrotask:typeof i0<"u"?function(l){return i0.resolve(null).then(l).catch(i_)}:r0;function i_(l){setTimeout(function(){throw l})}function di(l){return l==="head"}function o0(l,u){var p=u,g=0;do{var w=p.nextSibling;if(l.removeChild(p),w&&w.nodeType===8)if(p=w.data,p==="/$"||p==="/&"){if(g===0){l.removeChild(w),el(u);return}g--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")g++;else if(p==="html")vc(l.ownerDocument.documentElement);else if(p==="head"){p=l.ownerDocument.head,vc(p);for(var A=p.firstChild;A;){var L=A.nextSibling,Y=A.nodeName;A[Hs]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&A.rel.toLowerCase()==="stylesheet"||p.removeChild(A),A=L}}else p==="body"&&vc(l.ownerDocument.body);p=w}while(p);el(u)}function l0(l,u){var p=l;l=0;do{var g=p.nextSibling;if(p.nodeType===1?u?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(u?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),g&&g.nodeType===8)if(p=g.data,p==="/$"){if(l===0)break;l--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||l++;p=g}while(p)}function jm(l){var u=l.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var p=u;switch(u=u.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":jm(p),Fa(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}l.removeChild(p)}}function o_(l,u,p,g){for(;l.nodeType===1;){var w=p;if(l.nodeName.toLowerCase()!==u.toLowerCase()){if(!g&&(l.nodeName!=="INPUT"||l.type!=="hidden"))break}else if(g){if(!l[Hs])switch(u){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(A=l.getAttribute("rel"),A==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(A!==w.rel||l.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||l.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||l.getAttribute("title")!==(w.title==null?null:w.title))break;return l;case"style":if(l.hasAttribute("data-precedence"))break;return l;case"script":if(A=l.getAttribute("src"),(A!==(w.src==null?null:w.src)||l.getAttribute("type")!==(w.type==null?null:w.type)||l.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&A&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(u==="input"&&l.type==="hidden"){var A=w.name==null?null:""+w.name;if(w.type==="hidden"&&l.getAttribute("name")===A)return l}else return l;if(l=ha(l.nextSibling),l===null)break}return null}function l_(l,u,p){if(u==="")return null;for(;l.nodeType!==3;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!p||(l=ha(l.nextSibling),l===null))return null;return l}function c0(l,u){for(;l.nodeType!==8;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!u||(l=ha(l.nextSibling),l===null))return null;return l}function Nm(l){return l.data==="$?"||l.data==="$~"}function Tm(l){return l.data==="$!"||l.data==="$?"&&l.ownerDocument.readyState!=="loading"}function c_(l,u){var p=l.ownerDocument;if(l.data==="$~")l._reactRetry=u;else if(l.data!=="$?"||p.readyState!=="loading")u();else{var g=function(){u(),p.removeEventListener("DOMContentLoaded",g)};p.addEventListener("DOMContentLoaded",g),l._reactRetry=g}}function ha(l){for(;l!=null;l=l.nextSibling){var u=l.nodeType;if(u===1||u===3)break;if(u===8){if(u=l.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return l}var Em=null;function u0(l){l=l.nextSibling;for(var u=0;l;){if(l.nodeType===8){var p=l.data;if(p==="/$"||p==="/&"){if(u===0)return ha(l.nextSibling);u--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||u++}l=l.nextSibling}return null}function d0(l){l=l.previousSibling;for(var u=0;l;){if(l.nodeType===8){var p=l.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(u===0)return l;u--}else p!=="/$"&&p!=="/&"||u++}l=l.previousSibling}return null}function f0(l,u,p){switch(u=Dd(p),l){case"html":if(l=u.documentElement,!l)throw Error(s(452));return l;case"head":if(l=u.head,!l)throw Error(s(453));return l;case"body":if(l=u.body,!l)throw Error(s(454));return l;default:throw Error(s(451))}}function vc(l){for(var u=l.attributes;u.length;)l.removeAttributeNode(u[0]);Fa(l)}var ma=new Map,p0=new Set;function Rd(l){return typeof l.getRootNode=="function"?l.getRootNode():l.nodeType===9?l:l.ownerDocument}var Ar=H.d;H.d={f:u_,r:d_,D:f_,C:p_,L:h_,m:m_,X:b_,S:g_,M:x_};function u_(){var l=Ar.f(),u=Cd();return l||u}function d_(l){var u=Zn(l);u!==null&&u.tag===5&&u.type==="form"?_v(u):Ar.r(l)}var Xo=typeof document>"u"?null:document;function h0(l,u,p){var g=Xo;if(g&&typeof u=="string"&&u){var w=$t(u);w='link[rel="'+l+'"][href="'+w+'"]',typeof p=="string"&&(w+='[crossorigin="'+p+'"]'),p0.has(w)||(p0.add(w),l={rel:l,crossOrigin:p,href:u},g.querySelector(w)===null&&(u=g.createElement("link"),ps(u,"link",l),fn(u),g.head.appendChild(u)))}}function f_(l){Ar.D(l),h0("dns-prefetch",l,null)}function p_(l,u){Ar.C(l,u),h0("preconnect",l,u)}function h_(l,u,p){Ar.L(l,u,p);var g=Xo;if(g&&l&&u){var w='link[rel="preload"][as="'+$t(u)+'"]';u==="image"&&p&&p.imageSrcSet?(w+='[imagesrcset="'+$t(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(w+='[imagesizes="'+$t(p.imageSizes)+'"]')):w+='[href="'+$t(l)+'"]';var A=w;switch(u){case"style":A=Jo(l);break;case"script":A=Zo(l)}ma.has(A)||(l=m({rel:"preload",href:u==="image"&&p&&p.imageSrcSet?void 0:l,as:u},p),ma.set(A,l),g.querySelector(w)!==null||u==="style"&&g.querySelector(wc(A))||u==="script"&&g.querySelector(kc(A))||(u=g.createElement("link"),ps(u,"link",l),fn(u),g.head.appendChild(u)))}}function m_(l,u){Ar.m(l,u);var p=Xo;if(p&&l){var g=u&&typeof u.as=="string"?u.as:"script",w='link[rel="modulepreload"][as="'+$t(g)+'"][href="'+$t(l)+'"]',A=w;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Zo(l)}if(!ma.has(A)&&(l=m({rel:"modulepreload",href:l},u),ma.set(A,l),p.querySelector(w)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(kc(A)))return}g=p.createElement("link"),ps(g,"link",l),fn(g),p.head.appendChild(g)}}}function g_(l,u,p){Ar.S(l,u,p);var g=Xo;if(g&&l){var w=rs(g).hoistableStyles,A=Jo(l);u=u||"default";var L=w.get(A);if(!L){var Y={loading:0,preload:null};if(L=g.querySelector(wc(A)))Y.loading=5;else{l=m({rel:"stylesheet",href:l,"data-precedence":u},p),(p=ma.get(A))&&_m(l,p);var ae=L=g.createElement("link");fn(ae),ps(ae,"link",l),ae._p=new Promise(function(Oe,Ke){ae.onload=Oe,ae.onerror=Ke}),ae.addEventListener("load",function(){Y.loading|=1}),ae.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,Od(L,u,g)}L={type:"stylesheet",instance:L,count:1,state:Y},w.set(A,L)}}}function b_(l,u){Ar.X(l,u);var p=Xo;if(p&&l){var g=rs(p).hoistableScripts,w=Zo(l),A=g.get(w);A||(A=p.querySelector(kc(w)),A||(l=m({src:l,async:!0},u),(u=ma.get(w))&&Mm(l,u),A=p.createElement("script"),fn(A),ps(A,"link",l),p.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(w,A))}}function x_(l,u){Ar.M(l,u);var p=Xo;if(p&&l){var g=rs(p).hoistableScripts,w=Zo(l),A=g.get(w);A||(A=p.querySelector(kc(w)),A||(l=m({src:l,async:!0,type:"module"},u),(u=ma.get(w))&&Mm(l,u),A=p.createElement("script"),fn(A),ps(A,"link",l),p.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(w,A))}}function m0(l,u,p,g){var w=(w=Z.current)?Rd(w):null;if(!w)throw Error(s(446));switch(l){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(u=Jo(p.href),p=rs(w).hoistableStyles,g=p.get(u),g||(g={type:"style",instance:null,count:0,state:null},p.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){l=Jo(p.href);var A=rs(w).hoistableStyles,L=A.get(l);if(L||(w=w.ownerDocument||w,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(l,L),(A=w.querySelector(wc(l)))&&!A._p&&(L.instance=A,L.state.loading=5),ma.has(l)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},ma.set(l,p),A||y_(w,l,p,L.state))),u&&g===null)throw Error(s(528,""));return L}if(u&&g!==null)throw Error(s(529,""));return null;case"script":return u=p.async,p=p.src,typeof p=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=Zo(p),p=rs(w).hoistableScripts,g=p.get(u),g||(g={type:"script",instance:null,count:0,state:null},p.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,l))}}function Jo(l){return'href="'+$t(l)+'"'}function wc(l){return'link[rel="stylesheet"]['+l+"]"}function g0(l){return m({},l,{"data-precedence":l.precedence,precedence:null})}function y_(l,u,p,g){l.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=l.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),ps(u,"link",p),fn(u),l.head.appendChild(u))}function Zo(l){return'[src="'+$t(l)+'"]'}function kc(l){return"script[async]"+l}function b0(l,u,p){if(u.count++,u.instance===null)switch(u.type){case"style":var g=l.querySelector('style[data-href~="'+$t(p.href)+'"]');if(g)return u.instance=g,fn(g),g;var w=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return g=(l.ownerDocument||l).createElement("style"),fn(g),ps(g,"style",w),Od(g,p.precedence,l),u.instance=g;case"stylesheet":w=Jo(p.href);var A=l.querySelector(wc(w));if(A)return u.state.loading|=4,u.instance=A,fn(A),A;g=g0(p),(w=ma.get(w))&&_m(g,w),A=(l.ownerDocument||l).createElement("link"),fn(A);var L=A;return L._p=new Promise(function(Y,ae){L.onload=Y,L.onerror=ae}),ps(A,"link",g),u.state.loading|=4,Od(A,p.precedence,l),u.instance=A;case"script":return A=Zo(p.src),(w=l.querySelector(kc(A)))?(u.instance=w,fn(w),w):(g=p,(w=ma.get(A))&&(g=m({},p),Mm(g,w)),l=l.ownerDocument||l,w=l.createElement("script"),fn(w),ps(w,"link",g),l.head.appendChild(w),u.instance=w);case"void":return null;default:throw Error(s(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Od(g,p.precedence,l));return u.instance}function Od(l,u,p){for(var g=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=g.length?g[g.length-1]:null,A=w,L=0;L<g.length;L++){var Y=g[L];if(Y.dataset.precedence===u)A=Y;else if(A!==w)break}A?A.parentNode.insertBefore(l,A.nextSibling):(u=p.nodeType===9?p.head:p,u.insertBefore(l,u.firstChild))}function _m(l,u){l.crossOrigin==null&&(l.crossOrigin=u.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=u.referrerPolicy),l.title==null&&(l.title=u.title)}function Mm(l,u){l.crossOrigin==null&&(l.crossOrigin=u.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=u.referrerPolicy),l.integrity==null&&(l.integrity=u.integrity)}var Ld=null;function x0(l,u,p){if(Ld===null){var g=new Map,w=Ld=new Map;w.set(p,g)}else w=Ld,g=w.get(p),g||(g=new Map,w.set(p,g));if(g.has(l))return g;for(g.set(l,null),p=p.getElementsByTagName(l),w=0;w<p.length;w++){var A=p[w];if(!(A[Hs]||A[xt]||l==="link"&&A.getAttribute("rel")==="stylesheet")&&A.namespaceURI!=="http://www.w3.org/2000/svg"){var L=A.getAttribute(u)||"";L=l+L;var Y=g.get(L);Y?Y.push(A):g.set(L,[A])}}return g}function y0(l,u,p){l=l.ownerDocument||l,l.head.insertBefore(p,u==="title"?l.querySelector("head > title"):null)}function v_(l,u,p){if(p===1||u.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return l=u.disabled,typeof u.precedence=="string"&&l==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function v0(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function w_(l,u,p,g){if(p.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var w=Jo(g.href),A=u.querySelector(wc(w));if(A){u=A._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(l.count++,l=Pd.bind(l),u.then(l,l)),p.state.loading|=4,p.instance=A,fn(A);return}A=u.ownerDocument||u,g=g0(g),(w=ma.get(w))&&_m(g,w),A=A.createElement("link"),fn(A);var L=A;L._p=new Promise(function(Y,ae){L.onload=Y,L.onerror=ae}),ps(A,"link",g),p.instance=A}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(p,u),(u=p.state.preload)&&(p.state.loading&3)===0&&(l.count++,p=Pd.bind(l),u.addEventListener("load",p),u.addEventListener("error",p))}}var Dm=0;function k_(l,u){return l.stylesheets&&l.count===0&&Bd(l,l.stylesheets),0<l.count||0<l.imgCount?function(p){var g=setTimeout(function(){if(l.stylesheets&&Bd(l,l.stylesheets),l.unsuspend){var A=l.unsuspend;l.unsuspend=null,A()}},6e4+u);0<l.imgBytes&&Dm===0&&(Dm=62500*n_());var w=setTimeout(function(){if(l.waitingForImages=!1,l.count===0&&(l.stylesheets&&Bd(l,l.stylesheets),l.unsuspend)){var A=l.unsuspend;l.unsuspend=null,A()}},(l.imgBytes>Dm?50:800)+u);return l.unsuspend=p,function(){l.unsuspend=null,clearTimeout(g),clearTimeout(w)}}:null}function Pd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bd(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Id=null;function Bd(l,u){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Id=new Map,u.forEach(S_,l),Id=null,Pd.call(l))}function S_(l,u){if(!(u.state.loading&4)){var p=Id.get(l);if(p)var g=p.get(null);else{p=new Map,Id.set(l,p);for(var w=l.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A<w.length;A++){var L=w[A];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(p.set(L.dataset.precedence,L),g=L)}g&&p.set(null,g)}w=u.instance,L=w.getAttribute("data-precedence"),A=p.get(L)||g,A===g&&p.set(null,w),p.set(L,w),this.count++,g=Pd.bind(this),w.addEventListener("load",g),w.addEventListener("error",g),A?A.parentNode.insertBefore(w,A.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(w,l.firstChild)),u.state.loading|=4}}var Sc={$$typeof:j,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function C_(l,u,p,g,w,A,L,Y,ae){this.tag=1,this.containerInfo=l,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=ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ge(0),this.hiddenUpdates=ge(null),this.identifierPrefix=g,this.onUncaughtError=w,this.onCaughtError=A,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.incompleteTransitions=new Map}function w0(l,u,p,g,w,A,L,Y,ae,Oe,Ke,Ze){return l=new C_(l,u,p,L,ae,Oe,Ke,Ze,Y),u=1,A===!0&&(u|=24),A=qs(3,null,null,u),l.current=A,A.stateNode=l,u=dh(),u.refCount++,l.pooledCache=u,u.refCount++,A.memoizedState={element:g,isDehydrated:p,cache:u},mh(A),l}function k0(l){return l?(l=_o,l):_o}function S0(l,u,p,g,w,A){w=k0(w),g.context===null?g.context=w:g.pendingContext=w,g=ei(u),g.payload={element:p},A=A===void 0?null:A,A!==null&&(g.callback=A),p=ti(l,g,u),p!==null&&(Ps(p,l,u),tc(p,l,u))}function C0(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var p=l.retryLane;l.retryLane=p!==0&&p<u?p:u}}function Rm(l,u){C0(l,u),(l=l.alternate)&&C0(l,u)}function A0(l){if(l.tag===13||l.tag===31){var u=Pi(l,67108864);u!==null&&Ps(u,l,67108864),Rm(l,67108864)}}function j0(l){if(l.tag===13||l.tag===31){var u=Qs();u=Pt(u);var p=Pi(l,u);p!==null&&Ps(p,l,u),Rm(l,u)}}var Fd=!0;function A_(l,u,p,g){var w=F.T;F.T=null;var A=H.p;try{H.p=2,Om(l,u,p,g)}finally{H.p=A,F.T=w}}function j_(l,u,p,g){var w=F.T;F.T=null;var A=H.p;try{H.p=8,Om(l,u,p,g)}finally{H.p=A,F.T=w}}function Om(l,u,p,g){if(Fd){var w=Lm(g);if(w===null)vm(l,u,g,zd,p),T0(l,g);else if(T_(w,l,u,p,g))g.stopPropagation();else if(T0(l,g),u&4&&-1<N_.indexOf(l)){for(;w!==null;){var A=Zn(w);if(A!==null)switch(A.tag){case 3:if(A=A.stateNode,A.current.memoizedState.isDehydrated){var L=st(A.pendingLanes);if(L!==0){var Y=A;for(Y.pendingLanes|=2,Y.entangledLanes|=2;L;){var ae=1<<31-he(L);Y.entanglements[1]|=ae,L&=~ae}Ua(A),(pn&6)===0&&(kd=ut()+500,bc(0))}}break;case 31:case 13:Y=Pi(A,2),Y!==null&&Ps(Y,A,2),Cd(),Rm(A,2)}if(A=Lm(g),A===null&&vm(l,u,g,zd,p),A===w)break;w=A}w!==null&&g.stopPropagation()}else vm(l,u,g,null,p)}}function Lm(l){return l=zl(l),Pm(l)}var zd=null;function Pm(l){if(zd=null,l=ks(l),l!==null){var u=r(l);if(u===null)l=null;else{var p=u.tag;if(p===13){if(l=i(u),l!==null)return l;l=null}else if(p===31){if(l=c(u),l!==null)return l;l=null}else if(p===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;l=null}else u!==l&&(l=null)}}return zd=l,null}function N0(l){switch(l){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(ue()){case X:return 2;case se:return 8;case ke:case J:return 32;case we:return 268435456;default:return 32}default:return 32}}var Im=!1,fi=null,pi=null,hi=null,Cc=new Map,Ac=new Map,mi=[],N_="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 T0(l,u){switch(l){case"focusin":case"focusout":fi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":hi=null;break;case"pointerover":case"pointerout":Cc.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ac.delete(u.pointerId)}}function jc(l,u,p,g,w,A){return l===null||l.nativeEvent!==A?(l={blockedOn:u,domEventName:p,eventSystemFlags:g,nativeEvent:A,targetContainers:[w]},u!==null&&(u=Zn(u),u!==null&&A0(u)),l):(l.eventSystemFlags|=g,u=l.targetContainers,w!==null&&u.indexOf(w)===-1&&u.push(w),l)}function T_(l,u,p,g,w){switch(u){case"focusin":return fi=jc(fi,l,u,p,g,w),!0;case"dragenter":return pi=jc(pi,l,u,p,g,w),!0;case"mouseover":return hi=jc(hi,l,u,p,g,w),!0;case"pointerover":var A=w.pointerId;return Cc.set(A,jc(Cc.get(A)||null,l,u,p,g,w)),!0;case"gotpointercapture":return A=w.pointerId,Ac.set(A,jc(Ac.get(A)||null,l,u,p,g,w)),!0}return!1}function E0(l){var u=ks(l.target);if(u!==null){var p=r(u);if(p!==null){if(u=p.tag,u===13){if(u=i(p),u!==null){l.blockedOn=u,mt(l.priority,function(){j0(p)});return}}else if(u===31){if(u=c(p),u!==null){l.blockedOn=u,mt(l.priority,function(){j0(p)});return}}else if(u===3&&p.stateNode.current.memoizedState.isDehydrated){l.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}l.blockedOn=null}function $d(l){if(l.blockedOn!==null)return!1;for(var u=l.targetContainers;0<u.length;){var p=Lm(l.nativeEvent);if(p===null){p=l.nativeEvent;var g=new p.constructor(p.type,p);Fl=g,p.target.dispatchEvent(g),Fl=null}else return u=Zn(p),u!==null&&A0(u),l.blockedOn=p,!1;u.shift()}return!0}function _0(l,u,p){$d(l)&&p.delete(u)}function E_(){Im=!1,fi!==null&&$d(fi)&&(fi=null),pi!==null&&$d(pi)&&(pi=null),hi!==null&&$d(hi)&&(hi=null),Cc.forEach(_0),Ac.forEach(_0)}function Hd(l,u){l.blockedOn===u&&(l.blockedOn=null,Im||(Im=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,E_)))}var Ud=null;function M0(l){Ud!==l&&(Ud=l,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ud===l&&(Ud=null);for(var u=0;u<l.length;u+=3){var p=l[u],g=l[u+1],w=l[u+2];if(typeof g!="function"){if(Pm(g||p)===null)continue;break}var A=Zn(p);A!==null&&(l.splice(u,3),u-=3,Lh(A,{pending:!0,data:w,method:p.method,action:g},g,w))}}))}function el(l){function u(ae){return Hd(ae,l)}fi!==null&&Hd(fi,l),pi!==null&&Hd(pi,l),hi!==null&&Hd(hi,l),Cc.forEach(u),Ac.forEach(u);for(var p=0;p<mi.length;p++){var g=mi[p];g.blockedOn===l&&(g.blockedOn=null)}for(;0<mi.length&&(p=mi[0],p.blockedOn===null);)E0(p),p.blockedOn===null&&mi.shift();if(p=(l.ownerDocument||l).$$reactFormReplay,p!=null)for(g=0;g<p.length;g+=3){var w=p[g],A=p[g+1],L=w[Dt]||null;if(typeof A=="function")L||M0(p);else if(L){var Y=null;if(A&&A.hasAttribute("formAction")){if(w=A,L=A[Dt]||null)Y=L.formAction;else if(Pm(w)!==null)continue}else Y=L.action;typeof Y=="function"?p[g+1]=Y:(p.splice(g,3),g-=3),M0(p)}}}function D0(){function l(A){A.canIntercept&&A.info==="react-transition"&&A.intercept({handler:function(){return new Promise(function(L){return w=L})},focusReset:"manual",scroll:"manual"})}function u(){w!==null&&(w(),w=null),g||setTimeout(p,20)}function p(){if(!g&&!navigation.transition){var A=navigation.currentEntry;A&&A.url!=null&&navigation.navigate(A.url,{state:A.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,w=null;return navigation.addEventListener("navigate",l),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(p,100),function(){g=!0,navigation.removeEventListener("navigate",l),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),w!==null&&(w(),w=null)}}}function Bm(l){this._internalRoot=l}Wd.prototype.render=Bm.prototype.render=function(l){var u=this._internalRoot;if(u===null)throw Error(s(409));var p=u.current,g=Qs();S0(p,g,l,u,null,null)},Wd.prototype.unmount=Bm.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var u=l.containerInfo;S0(l.current,2,null,l,null,null),Cd(),u[Sn]=null}};function Wd(l){this._internalRoot=l}Wd.prototype.unstable_scheduleHydration=function(l){if(l){var u=Vt();l={blockedOn:null,target:l,priority:u};for(var p=0;p<mi.length&&u!==0&&u<mi[p].priority;p++);mi.splice(p,0,l),p===0&&E0(l)}};var R0=e.version;if(R0!=="19.2.4")throw Error(s(527,R0,"19.2.4"));H.findDOMNode=function(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(s(188)):(l=Object.keys(l).join(","),Error(s(268,l)));return l=f(u),l=l!==null?h(l):null,l=l===null?null:l.stateNode,l};var __={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qd.isDisabled&&qd.supportsFiber)try{ie=qd.inject(__),Ie=qd}catch{}}return Tc.createRoot=function(l,u){if(!a(l))throw Error(s(299));var p=!1,g="",w=zv,A=$v,L=Hv;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(w=u.onUncaughtError),u.onCaughtError!==void 0&&(A=u.onCaughtError),u.onRecoverableError!==void 0&&(L=u.onRecoverableError)),u=w0(l,1,!1,null,null,p,g,null,w,A,L,D0),l[Sn]=u.current,ym(l),new Bm(u)},Tc.hydrateRoot=function(l,u,p){if(!a(l))throw Error(s(299));var g=!1,w="",A=zv,L=$v,Y=Hv,ae=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(w=p.identifierPrefix),p.onUncaughtError!==void 0&&(A=p.onUncaughtError),p.onCaughtError!==void 0&&(L=p.onCaughtError),p.onRecoverableError!==void 0&&(Y=p.onRecoverableError),p.formState!==void 0&&(ae=p.formState)),u=w0(l,1,!0,u,p??null,g,w,ae,A,L,Y,D0),u.context=k0(null),p=u.current,g=Qs(),g=Pt(g),w=ei(g),w.callback=null,ti(p,w,g),p=g,u.current.lanes=p,Te(u,p),Ua(u),l[Sn]=u.current,ym(l),new Wd(u)},Tc.version="19.2.4",Tc}var W0;function jM(){if(W0)return $m.exports;W0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),$m.exports=AM(),$m.exports}var NM=jM();const Ft=t=>typeof t=="string",Ec=()=>{let t,e;const n=new Promise((s,a)=>{t=s,e=a});return n.resolve=t,n.reject=e,n},q0=t=>t==null?"":String(t),TM=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},EM=/###/g,V0=t=>t&&t.includes("###")?t.replace(EM,"."):t,G0=t=>!t||Ft(t),tu=(t,e,n)=>{const s=Ft(e)?e.split("."):e;let a=0;for(;a<s.length-1;){if(G0(t))return{};const r=V0(s[a]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++a}return G0(t)?{}:{obj:t,k:V0(s[a])}},Y0=(t,e,n)=>{const{obj:s,k:a}=tu(t,e,Object);if(s!==void 0||e.length===1){s[a]=n;return}let r=e[e.length-1],i=e.slice(0,e.length-1),c=tu(t,i,Object);for(;c.obj===void 0&&i.length;)r=`${i[i.length-1]}.${r}`,i=i.slice(0,i.length-1),c=tu(t,i,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${r}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${r}`]=n},_M=(t,e,n,s)=>{const{obj:a,k:r}=tu(t,e,Object);a[r]=a[r]||[],a[r].push(n)},Lf=(t,e)=>{const{obj:n,k:s}=tu(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},MM=(t,e,n)=>{const s=Lf(t,n);return s!==void 0?s:Lf(e,n)},QA=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?Ft(t[s])||t[s]instanceof String||Ft(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):QA(t[s],e[s],n):t[s]=e[s]);return t},Ki=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),DM={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},RM=t=>Ft(t)?t.replace(/[&<>"'\/]/g,e=>DM[e]):t;class OM{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const LM=[" ",",","?","!",";"],PM=new OM(20),IM=(t,e,n)=>{e=e||"",n=n||"";const s=LM.filter(i=>!e.includes(i)&&!n.includes(i));if(s.length===0)return!0;const a=PM.getRegExp(`(${s.map(i=>i==="?"?"\\?":i).join("|")})`);let r=!a.test(t);if(!r){const i=t.indexOf(n);i>0&&!a.test(t.substring(0,i))&&(r=!0)}return r},ob=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let a=t;for(let r=0;r<s.length;){if(!a||typeof a!="object")return;let i,c="";for(let d=r;d<s.length;++d)if(d!==r&&(c+=n),c+=s[d],i=a[c],i!==void 0){if(["string","number","boolean"].includes(typeof i)&&d<s.length-1)continue;r+=d-r+1;break}a=i}return a},hu=t=>t==null?void 0:t.replace(/_/g,"-"),BM={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,s;(s=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||s.call(n,console,e)}};class Pf{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||BM,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,s,a){return a&&!this.debug?null:(Ft(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new Pf(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Pf(this.logger,e)}}var Ka=new Pf;class mp{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const a=this.observers[s].get(n)||0;this.observers[s].set(n,a+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}once(e,n){const s=(...a)=>{n(...a),this.off(e,s)};return this.on(e,s),this}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,r])=>{for(let i=0;i<r;i++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,r])=>{for(let i=0;i<r;i++)a(e,...n)})}}class K0 extends mp{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,a={}){var f,h;const r=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.includes(".")?c=e.split("."):(c=[e,n],s&&(Array.isArray(s)?c.push(...s):Ft(s)&&r?c.push(...s.split(r)):c.push(s)));const d=Lf(this.data,c);return!d&&!n&&!s&&e.includes(".")&&(e=c[0],n=c[1],s=c.slice(2).join(".")),d||!i||!Ft(s)?d:ob((h=(f=this.data)==null?void 0:f[e])==null?void 0:h[n],s,r)}addResource(e,n,s,a,r={silent:!1}){const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let c=[e,n];s&&(c=c.concat(i?s.split(i):s)),e.includes(".")&&(c=e.split("."),a=n,n=c[1]),this.addNamespaces(n),Y0(this.data,c,a),r.silent||this.emit("added",e,n,s,a)}addResources(e,n,s,a={silent:!1}){for(const r in s)(Ft(s[r])||Array.isArray(s[r]))&&this.addResource(e,n,r,s[r],{silent:!0});a.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,a,r,i={silent:!1,skipCopy:!1}){let c=[e,n];e.includes(".")&&(c=e.split("."),a=s,s=n,n=c[1]),this.addNamespaces(n);let d=Lf(this.data,c)||{};i.skipCopy||(s=JSON.parse(JSON.stringify(s))),a?QA(d,s,r):d={...d,...s},Y0(this.data,c,d),i.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var XA={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,a){return t.forEach(r=>{var i;e=((i=this.processors[r])==null?void 0:i.process(e,n,s,a))??e}),e}};const JA=Symbol("i18next/PATH_KEY");function FM(){const t=[],e=Object.create(null);let n;return e.get=(s,a)=>{var r;return(r=n==null?void 0:n.revoke)==null||r.call(n),a===JA?t:(t.push(a),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function ml(t,e){const{[JA]:n}=t(FM()),s=(e==null?void 0:e.keySeparator)??".",a=(e==null?void 0:e.nsSeparator)??":";if(n.length>1&&a){const r=e==null?void 0:e.ns,i=Array.isArray(r)?r:null;if(i&&i.length>1&&i.slice(1).includes(n[0]))return`${n[0]}${a}${n.slice(1).join(s)}`}return n.join(s)}const Wm=t=>!Ft(t)&&typeof t!="boolean"&&typeof t!="number";class If extends mp{constructor(e,n={}){super(),TM(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ka.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const a=this.resolve(e,s);if((a==null?void 0:a.res)===void 0)return!1;const r=Wm(a.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const i=s&&e.includes(s),c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!IM(e,s,a);if(i&&!c){const d=e.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:e,namespaces:Ft(r)?[r]:r};const f=e.split(s);(s!==a||s===a&&this.options.ns.includes(f[0]))&&(r=f.shift()),e=f.join(a)}return{key:e,namespaces:Ft(r)?[r]:r}}translate(e,n,s){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=ml(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]),e=e.map(z=>typeof z=="function"?ml(z,{...this.options,...a}):String(z));const r=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:c,namespaces:d}=this.extractFromKey(e[e.length-1],a),f=d[d.length-1];let h=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const m=a.lng||this.language,x=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((m==null?void 0:m.toLowerCase())==="cimode")return x?r?{res:`${f}${h}${c}`,usedKey:c,exactUsedKey:c,usedLng:m,usedNS:f,usedParams:this.getUsedParamsDetails(a)}:`${f}${h}${c}`:r?{res:c,usedKey:c,exactUsedKey:c,usedLng:m,usedNS:f,usedParams:this.getUsedParamsDetails(a)}:c;const y=this.resolve(e,a);let v=y==null?void 0:y.res;const S=(y==null?void 0:y.usedKey)||c,C=(y==null?void 0:y.exactUsedKey)||c,k=["[object Number]","[object Function]","[object RegExp]"],N=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,E=a.count!==void 0&&!Ft(a.count),D=If.hasDefaultValue(a),_=E?this.pluralResolver.getSuffix(m,a.count,a):"",P=a.ordinal&&E?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",O=E&&!a.ordinal&&a.count===0,T=O&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${_}`]||a[`defaultValue${P}`]||a.defaultValue;let M=v;j&&!v&&D&&(M=T);const R=Wm(M),I=Object.prototype.toString.apply(M);if(j&&M&&R&&!k.includes(I)&&!(Ft(N)&&Array.isArray(M))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(S,M,{...a,ns:d}):`key '${c} (${this.language})' returned an object instead of string.`;return r?(y.res=z,y.usedParams=this.getUsedParamsDetails(a),y):z}if(i){const z=Array.isArray(M),W=z?[]:{},$=z?C:S;for(const F in M)if(Object.prototype.hasOwnProperty.call(M,F)){const H=`${$}${i}${F}`;D&&!v?W[F]=this.translate(H,{...a,defaultValue:Wm(T)?T[F]:void 0,joinArrays:!1,ns:d}):W[F]=this.translate(H,{...a,joinArrays:!1,ns:d}),W[F]===H&&(W[F]=M[F])}v=W}}else if(j&&Ft(N)&&Array.isArray(v))v=v.join(N),v&&(v=this.extendTranslation(v,e,a,s));else{let z=!1,W=!1;!this.isValidLookup(v)&&D&&(z=!0,v=T),this.isValidLookup(v)||(W=!0,v=c);const F=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:v,H=D&&T!==v&&this.options.updateMissing;if(W||z||H){if(this.logger.log(H?"updateKey":"missingKey",m,f,c,H?T:v),i){const Q=this.resolve(c,{...a,keySeparator:!1});Q&&Q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let V=[];const G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&G&&G[0])for(let Q=0;Q<G.length;Q++)V.push(G[Q]);else this.options.saveMissingTo==="all"?V=this.languageUtils.toResolveHierarchy(a.lng||this.language):V.push(a.lng||this.language);const B=(Q,K,q)=>{var de;const xe=D&&q!==v?q:F;this.options.missingKeyHandler?this.options.missingKeyHandler(Q,f,K,xe,H,a):(de=this.backendConnector)!=null&&de.saveMissing&&this.backendConnector.saveMissing(Q,f,K,xe,H,a),this.emit("missingKey",Q,f,K,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&E?V.forEach(Q=>{const K=this.pluralResolver.getSuffixes(Q,a);O&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!K.includes(`${this.options.pluralSeparator}zero`)&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(q=>{B([Q],c+q,a[`defaultValue${q}`]||T)})}):B(V,c,T))}v=this.extendTranslation(v,e,a,y,s),W&&v===c&&this.options.appendNamespaceToMissingKey&&(v=`${f}${h}${c}`),(W||z)&&this.options.parseMissingKeyHandler&&(v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${h}${c}`:c,z?v:void 0,a))}return r?(y.res=v,y.usedParams=this.getUsedParamsDetails(a),y):v}extendTranslation(e,n,s,a,r){var d,f;if((d=this.i18nFormat)!=null&&d.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const h=Ft(e)&&(((f=s==null?void 0:s.interpolation)==null?void 0:f.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(h){const y=e.match(this.interpolator.nestingRegexp);m=y&&y.length}let x=s.replace&&!Ft(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),e=this.interpolator.interpolate(e,x,s.lng||this.language||a.usedLng,s),h){const y=e.match(this.interpolator.nestingRegexp),v=y&&y.length;m<v&&(s.nest=!1)}!s.lng&&a&&a.res&&(s.lng=this.language||a.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...y)=>(r==null?void 0:r[0])===y[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):this.translate(...y,n),s)),s.interpolation&&this.interpolator.reset()}const i=s.postProcess||this.options.postProcess,c=Ft(i)?[i]:i;return e!=null&&(c!=null&&c.length)&&s.applyPostProcessor!==!1&&(e=XA.handle(c,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,a,r,i,c;return Ft(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(d=>typeof d=="function"?ml(d,{...this.options,...n}):d)),e.forEach(d=>{if(this.isValidLookup(s))return;const f=this.extractFromKey(d,n),h=f.key;a=h;let m=f.namespaces;this.options.fallbackNS&&(m=m.concat(this.options.fallbackNS));const x=n.count!==void 0&&!Ft(n.count),y=x&&!n.ordinal&&n.count===0,v=n.context!==void 0&&(Ft(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(C=>{var k,N;this.isValidLookup(s)||(c=C,!this.checkedLoadedFor[`${S[0]}-${C}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((N=this.utils)!=null&&N.hasLoadedNamespace(c))&&(this.checkedLoadedFor[`${S[0]}-${C}`]=!0,this.logger.warn(`key "${a}" for languages "${S.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(j=>{var _;if(this.isValidLookup(s))return;i=j;const E=[h];if((_=this.i18nFormat)!=null&&_.addLookupKeys)this.i18nFormat.addLookupKeys(E,h,j,C,n);else{let P;x&&(P=this.pluralResolver.getSuffix(j,n.count,n));const O=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(x&&(n.ordinal&&P.startsWith(T)&&E.push(h+P.replace(T,this.options.pluralSeparator)),E.push(h+P),y&&E.push(h+O)),v){const M=`${h}${this.options.contextSeparator||"_"}${n.context}`;E.push(M),x&&(n.ordinal&&P.startsWith(T)&&E.push(M+P.replace(T,this.options.pluralSeparator)),E.push(M+P),y&&E.push(M+O))}}let D;for(;D=E.pop();)this.isValidLookup(s)||(r=D,s=this.getResource(j,C,D,n))}))})}),{res:s,usedKey:a,exactUsedKey:r,usedLng:i,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,a={}){var r;return(r=this.i18nFormat)!=null&&r.getResource?this.i18nFormat.getResource(e,n,s,a):this.resourceStore.getResource(e,n,s,a)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!Ft(e.replace);let a=s?e.replace:e;if(s&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!s){a={...a};for(const r of n)delete a[r]}return a}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&s.startsWith(n)&&e[s]!==void 0)return!0;return!1}}class Q0{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ka.create("languageUtils")}getScriptPartFromCode(e){if(e=hu(e),!e||!e.includes("-"))return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=hu(e),!e||!e.includes("-"))return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ft(e)&&e.includes("-")){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(s=>{if(n)return;const a=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const a=this.getScriptPartFromCode(s);if(this.isSupportedCode(a))return n=a;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>i===r?!0:!i.includes("-")&&!r.includes("-")?!1:!!(i.includes("-")&&!r.includes("-")&&i.slice(0,i.indexOf("-"))===r||i.startsWith(r)&&r.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Ft(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),a=[],r=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return Ft(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):Ft(e)&&r(this.formatLanguageCode(e)),s.forEach(i=>{a.includes(i)||r(this.formatLanguageCode(i))}),a}}const X0={zero:0,one:1,two:2,few:3,many:4,other:5},J0={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class zM{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Ka.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=hu(e==="dev"?"en":e),a=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:a});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let i;try{i=new Intl.PluralRules(s,{type:a})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),J0;if(!e.match(/-|_/))return J0;const d=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(d,n)}return this.pluralRulesCache[r]=i,i}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(a=>`${n}${a}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((a,r)=>X0[a]-X0[r]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,n,s={}){const a=this.getRule(e,s);return a?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const Z0=(t,e,n,s=".",a=!0)=>{let r=MM(t,e,n);return!r&&a&&Ft(n)&&(r=ob(t,n,s),r===void 0&&(r=ob(e,n,s))),r},qm=t=>t.replace(/\$/g,"$$$$");class ek{constructor(e={}){var n;this.logger=Ka.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:a,prefix:r,prefixEscaped:i,suffix:c,suffixEscaped:d,formatSeparator:f,unescapeSuffix:h,unescapePrefix:m,nestingPrefix:x,nestingPrefixEscaped:y,nestingSuffix:v,nestingSuffixEscaped:S,nestingOptionsSeparator:C,maxReplaces:k,alwaysFormat:N}=e.interpolation;this.escape=n!==void 0?n:RM,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=r?Ki(r):i||"{{",this.suffix=c?Ki(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=h?"":m||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=x?Ki(x):y||Ki("$t("),this.nestingSuffix=v?Ki(v):S||Ki(")"),this.nestingOptionsSeparator=C||",",this.maxReplaces=k||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,s,a){var y;let r,i,c;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(!v.includes(this.formatSeparator)){const N=Z0(n,d,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(N,void 0,s,{...a,...n,interpolationkey:v}):N}const S=v.split(this.formatSeparator),C=S.shift().trim(),k=S.join(this.formatSeparator).trim();return this.format(Z0(n,d,C,this.options.keySeparator,this.options.ignoreJSONStructure),k,s,{...a,...n,interpolationkey:C})};this.resetRegExp();const h=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,m=((y=a==null?void 0:a.interpolation)==null?void 0:y.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>qm(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?qm(this.escape(v)):qm(v)}].forEach(v=>{for(c=0;r=v.regex.exec(e);){const S=r[1].trim();if(i=f(S),i===void 0)if(typeof h=="function"){const k=h(e,r,a);i=Ft(k)?k:""}else if(a&&Object.prototype.hasOwnProperty.call(a,S))i="";else if(m){i=r[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),i="";else!Ft(i)&&!this.useRawValueToEscape&&(i=q0(i));const C=v.safeValue(i);if(e=e.replace(r[0],C),m?(v.regex.lastIndex+=i.length,v.regex.lastIndex-=r[0].length):v.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,s={}){let a,r,i;const c=(d,f)=>{const h=this.nestingOptionsSeparator;if(!d.includes(h))return d;const m=d.split(new RegExp(`${Ki(h)}[ ]*{`));let x=`{${m[1]}`;d=m[0],x=this.interpolate(x,i);const y=x.match(/'/g),v=x.match(/"/g);(((y==null?void 0:y.length)??0)%2===0&&!v||((v==null?void 0:v.length)??0)%2!==0)&&(x=x.replace(/'/g,'"'));try{i=JSON.parse(x),f&&(i={...f,...i})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,S),`${d}${h}${x}`}return i.defaultValue&&i.defaultValue.includes(this.prefix)&&delete i.defaultValue,d};for(;a=this.nestingRegexp.exec(e);){let d=[];i={...s},i=i.replace&&!Ft(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const f=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(f!==-1&&(d=a[1].slice(f).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),a[1]=a[1].slice(0,f)),r=n(c.call(this,a[1].trim(),i),i),r&&a[0]===e&&!Ft(r))return r;Ft(r)||(r=q0(r)),r||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),r=""),d.length&&(r=d.reduce((h,m)=>this.format(h,m,s.lng,{...s,interpolationkey:a[1].trim()}),r.trim())),e=e.replace(a[0],r),this.regexp.lastIndex=0}return e}}const $M=t=>{let e=t.toLowerCase().trim();const n={};if(t.includes("(")){const s=t.split("(");e=s[0].toLowerCase().trim();const a=s[1].slice(0,-1);e==="currency"&&!a.includes(":")?n.currency||(n.currency=a.trim()):e==="relativetime"&&!a.includes(":")?n.range||(n.range=a.trim()):a.split(";").forEach(i=>{if(i){const[c,...d]=i.split(":"),f=d.join(":").trim().replace(/^'+|'+$/g,""),h=c.trim();n[h]||(n[h]=f),f==="false"&&(n[h]=!1),f==="true"&&(n[h]=!0),isNaN(f)||(n[h]=parseInt(f,10))}})}return{formatName:e,formatOptions:n}},tk=t=>{const e={};return(n,s,a)=>{let r=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(r={...r,[a.interpolationkey]:void 0});const i=s+JSON.stringify(r);let c=e[i];return c||(c=t(hu(s),a),e[i]=c),c(n)}},HM=t=>(e,n,s)=>t(hu(n),s)(e);class UM{constructor(e={}){this.logger=Ka.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?tk:HM;this.formats={number:s((a,r)=>{const i=new Intl.NumberFormat(a,{...r});return c=>i.format(c)}),currency:s((a,r)=>{const i=new Intl.NumberFormat(a,{...r,style:"currency"});return c=>i.format(c)}),datetime:s((a,r)=>{const i=new Intl.DateTimeFormat(a,{...r});return c=>i.format(c)}),relativetime:s((a,r)=>{const i=new Intl.RelativeTimeFormat(a,{...r});return c=>i.format(c,r.range||"day")}),list:s((a,r)=>{const i=new Intl.ListFormat(a,{...r});return c=>i.format(c)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=tk(n)}format(e,n,s,a={}){if(!n||e==null)return e;const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&!r[0].includes(")")&&r.find(c=>c.includes(")"))){const c=r.findIndex(d=>d.includes(")"));r[0]=[r[0],...r.splice(1,c)].join(this.formatSeparator)}return r.reduce((c,d)=>{var m;const{formatName:f,formatOptions:h}=$M(d);if(this.formats[f]){let x=c;try{const y=((m=a==null?void 0:a.formatParams)==null?void 0:m[a.interpolationkey])||{},v=y.locale||y.lng||a.locale||a.lng||s;x=this.formats[f](c,v,{...h,...a,...y})}catch(y){this.logger.warn(y)}return x}else this.logger.warn(`there was no format function for ${f}`);return c},e)}}const WM=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class qM extends mp{constructor(e,n,s,a={}){var r,i;super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=a,this.logger=Ka.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(i=(r=this.backend)==null?void 0:r.init)==null||i.call(r,s,a.backend,a)}queueLoad(e,n,s,a){const r={},i={},c={},d={};return e.forEach(f=>{let h=!0;n.forEach(m=>{const x=`${f}|${m}`;!s.reload&&this.store.hasResourceBundle(f,m)?this.state[x]=2:this.state[x]<0||(this.state[x]===1?i[x]===void 0&&(i[x]=!0):(this.state[x]=1,h=!1,i[x]===void 0&&(i[x]=!0),r[x]===void 0&&(r[x]=!0),d[m]===void 0&&(d[m]=!0)))}),h||(c[f]=!0)}),(Object.keys(r).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(r),pending:Object.keys(i),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(d)}}loaded(e,n,s){const a=e.split("|"),r=a[0],i=a[1];n&&this.emit("failedLoading",r,i,n),!n&&s&&this.store.addResourceBundle(r,i,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const c={};this.queue.forEach(d=>{_M(d.loaded,[r],i),WM(d,e),n&&d.errors.push(n),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(f=>{c[f]||(c[f]={});const h=d.loaded[f];h.length&&h.forEach(m=>{c[f][m]===void 0&&(c[f][m]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(d=>!d.done)}read(e,n,s,a=0,r=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:a,wait:r,callback:i});return}this.readingCalls++;const c=(f,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const m=this.waitingReads.shift();this.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(f&&h&&a<this.maxRetries){setTimeout(()=>{this.read(e,n,s,a+1,r*2,i)},r);return}i(f,h)},d=this.backend[s].bind(this.backend);if(d.length===2){try{const f=d(e,n);f&&typeof f.then=="function"?f.then(h=>c(null,h)).catch(c):c(null,f)}catch(f){c(f)}return}return d(e,n,c)}prepareLoading(e,n,s={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();Ft(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ft(n)&&(n=[n]);const r=this.queueLoad(e,n,s,a);if(!r.toLoad.length)return r.pending.length||a(),null;r.toLoad.forEach(i=>{this.loadOne(i)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),a=s[0],r=s[1];this.read(a,r,"read",void 0,void 0,(i,c)=>{i&&this.logger.warn(`${n}loading namespace ${r} for language ${a} failed`,i),!i&&c&&this.logger.log(`${n}loaded namespace ${r} for language ${a}`,c),this.loaded(e,i,c)})}saveMissing(e,n,s,a,r,i={},c=()=>{}){var d,f,h,m,x;if((f=(d=this.services)==null?void 0:d.utils)!=null&&f.hasLoadedNamespace&&!((m=(h=this.services)==null?void 0:h.utils)!=null&&m.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${s}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((x=this.backend)!=null&&x.create){const y={...i,isUpdate:r},v=this.backend.create.bind(this.backend);if(v.length<6)try{let S;v.length===5?S=v(e,n,s,a,y):S=v(e,n,s,a),S&&typeof S.then=="function"?S.then(C=>c(null,C)).catch(c):c(null,S)}catch(S){c(S)}else v(e,n,s,a,c,y)}!e||!e[0]||this.store.addResource(e[0],n,s,a)}}}const Vm=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Ft(t[1])&&(e.defaultValue=t[1]),Ft(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),nk=t=>(Ft(t.ns)&&(t.ns=[t.ns]),Ft(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ft(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),Vd=()=>{},VM=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class nu extends mp{constructor(e={},n){if(super(),this.options=nk(e),this.services={},this.logger=Ka,this.modules={external:[]},VM(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(Ft(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const s=Vm();this.options={...s,...this.options,...nk(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const a=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?Ka.init(a(this.modules.logger),this.options):Ka.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=UM;const h=new Q0(this.options);this.store=new K0(this.options.resources,this.options);const m=this.services;m.logger=Ka,m.resourceStore=this.store,m.languageUtils=h,m.pluralResolver=new zM(h,{prepend:this.options.pluralSeparator}),f&&(m.formatter=a(f),m.formatter.init&&m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new ek(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new qM(a(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",(x,...y)=>{this.emit(x,...y)}),this.modules.languageDetector&&(m.languageDetector=a(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=a(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new If(this.services,this.options),this.translator.on("*",(x,...y)=>{this.emit(x,...y)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Vd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=(...h)=>this.store[f](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=(...h)=>(this.store[f](...h),this)});const c=Ec(),d=()=>{const f=(h,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(m),n(h,m)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),c}loadResources(e,n=Vd){var r,i;let s=n;const a=Ft(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const c=[],d=f=>{if(!f||f==="cimode")return;this.services.languageUtils.toResolveHierarchy(f).forEach(m=>{m!=="cimode"&&(c.includes(m)||c.push(m))})};a?d(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>d(h)),(i=(r=this.options.preload)==null?void 0:r.forEach)==null||i.call(r,f=>d(f)),this.services.backendConnector.load(c,this.options.ns,f=>{!f&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(f)})}else s(null)}reloadResources(e,n,s){const a=Ec();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Vd),this.services.backendConnector.reload(e,n,r=>{a.resolve(),s(r)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&XA.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!["cimode","dev"].includes(s)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=Ec();this.emit("languageChanging",e);const a=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},r=(c,d)=>{d?this.isLanguageChangingTo===e&&(a(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,s.resolve((...f)=>this.t(...f)),n&&n(c,(...f)=>this.t(...f))},i=c=>{var h,m;!e&&!c&&this.services.languageDetector&&(c=[]);const d=Ft(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(Ft(c)?[c]:c);f&&(this.language||a(f),this.translator.language||this.translator.changeLanguage(f),(m=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||m.call(h,f)),this.loadResources(f,x=>{r(x,f)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),s}getFixedT(e,n,s){const a=(r,i,...c)=>{let d;typeof i!="object"?d=this.options.overloadTranslationOptionHandler([r,i].concat(c)):d={...i},d.lng=d.lng||a.lng,d.lngs=d.lngs||a.lngs,d.ns=d.ns||a.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||s||a.keyPrefix);const f={...this.options,...d};typeof d.keyPrefix=="function"&&(d.keyPrefix=ml(d.keyPrefix,f));const h=this.options.keySeparator||".";let m;return d.keyPrefix&&Array.isArray(r)?m=r.map(x=>(typeof x=="function"&&(x=ml(x,f)),`${d.keyPrefix}${h}${x}`)):(typeof r=="function"&&(r=ml(r,f)),m=d.keyPrefix?`${d.keyPrefix}${h}${r}`:r),this.t(m,d)};return Ft(e)?a.lng=e:a.lngs=e,a.ns=n,a.keyPrefix=s,a}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const i=(c,d)=>{const f=this.services.backendConnector.state[`${c}|${d}`];return f===-1||f===0||f===2};if(n.precheck){const c=n.precheck(this,i);if(c!==void 0)return c}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(s,e)&&(!a||i(r,e)))}loadNamespaces(e,n){const s=Ec();return this.options.ns?(Ft(e)&&(e=[e]),e.forEach(a=>{this.options.ns.includes(a)||this.options.ns.push(a)}),this.loadResources(a=>{s.resolve(),n&&n(a)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=Ec();Ft(e)&&(e=[e]);const a=this.options.preload||[],r=e.filter(i=>!a.includes(i)&&this.services.languageUtils.isSupportedCode(i));return r.length?(this.options.preload=a.concat(r),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}dir(e){var a,r;if(e||(e=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const i=new Intl.Locale(e);if(i&&i.getTextInfo){const c=i.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((r=this.services)==null?void 0:r.languageUtils)||new Q0(Vm());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(s.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new nu(e,n);return s.createInstance=nu.createInstance,s}cloneInstance(e={},n=Vd){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},r=new nu(a);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(c=>{r[c]=this[c]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s){const c=Object.keys(this.store.data).reduce((d,f)=>(d[f]={...this.store.data[f]},d[f]=Object.keys(d[f]).reduce((h,m)=>(h[m]={...d[f][m]},h),d[f]),d),{});r.store=new K0(c,a),r.services.resourceStore=r.store}if(e.interpolation){const d={...Vm().interpolation,...this.options.interpolation,...e.interpolation},f={...a,interpolation:d};r.services.interpolator=new ek(f)}return r.translator=new If(r.services,a),r.translator.on("*",(c,...d)=>{r.emit(c,...d)}),r.init(a,n),r.translator.options=a,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const En=nu.createInstance();En.createInstance;En.dir;En.init;En.loadResources;En.reloadResources;En.use;En.changeLanguage;En.getFixedT;En.t;En.exists;En.setDefaultNamespace;En.hasLoadedNamespace;En.loadNamespaces;En.loadLanguages;const GM=(t,e,n,s)=>{var r,i,c,d;const a=[n,{code:e,...s||{}}];if((i=(r=t==null?void 0:t.services)==null?void 0:r.logger)!=null&&i.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);uo(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(d=(c=t==null?void 0:t.services)==null?void 0:c.logger)!=null&&d.warn?t.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},sk={},lb=(t,e,n,s)=>{uo(n)&&sk[n]||(uo(n)&&(sk[n]=new Date),GM(t,e,n,s))},ZA=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},cb=(t,e,n)=>{t.loadNamespaces(e,ZA(t,n))},ak=(t,e,n,s)=>{if(uo(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return cb(t,n,s);n.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,ZA(t,s))},YM=(t,e,n={})=>!e.languages||!e.languages.length?(lb(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(s,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!a(s.isLanguageChangingTo,t))return!1}}),uo=t=>typeof t=="string",KM=t=>typeof t=="object"&&t!==null,QM=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,XM={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},JM=t=>XM[t],ZM=t=>t.replace(QM,JM);let ub={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ZM,transDefaultProps:void 0};const eD=(t={})=>{ub={...ub,...t}},tD=()=>ub;let ej;const nD=t=>{ej=t},sD=()=>ej,aD={type:"3rdParty",init(t){eD(t.options.react),nD(t)}},rD=b.createContext();class iD{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Gm={exports:{}},Ym={};/**
|
|
35
|
-
* @license React
|
|
36
|
-
* use-sync-external-store-shim.production.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var rk;function oD(){if(rk)return Ym;rk=1;var t=Kb();function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,r=t.useLayoutEffect,i=t.useDebugValue;function c(m,x){var y=x(),v=s({inst:{value:y,getSnapshot:x}}),S=v[0].inst,C=v[1];return r(function(){S.value=y,S.getSnapshot=x,d(S)&&C({inst:S})},[m,y,x]),a(function(){return d(S)&&C({inst:S}),m(function(){d(S)&&C({inst:S})})},[m]),i(y),y}function d(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function f(m,x){return x()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Ym.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,Ym}var ik;function lD(){return ik||(ik=1,Gm.exports=oD()),Gm.exports}var cD=lD();const uD=(t,e)=>{if(uo(e))return e;if(KM(e)&&uo(e.defaultValue))return e.defaultValue;if(typeof t=="function")return"";if(Array.isArray(t)){const n=t[t.length-1];return typeof n=="function"?"":n}return t},dD={t:uD,ready:!1},fD=()=>()=>{},pt=(t,e={})=>{var T,M,R;const{i18n:n}=e,{i18n:s,defaultNS:a}=b.useContext(rD)||{},r=n||s||sD();r&&!r.reportNamespaces&&(r.reportNamespaces=new iD),r||lb(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=b.useMemo(()=>{var I;return{...tD(),...(I=r==null?void 0:r.options)==null?void 0:I.react,...e}},[r,e]),{useSuspense:c,keyPrefix:d}=i,f=t||a||((T=r==null?void 0:r.options)==null?void 0:T.defaultNS),h=uo(f)?[f]:f||["translation"],m=b.useMemo(()=>h,h);(R=(M=r==null?void 0:r.reportNamespaces)==null?void 0:M.addUsedNamespaces)==null||R.call(M,m);const x=b.useRef(0),y=b.useCallback(I=>{if(!r)return fD;const{bindI18n:z,bindI18nStore:W}=i,$=()=>{x.current+=1,I()};return z&&r.on(z,$),W&&r.store.on(W,$),()=>{z&&z.split(" ").forEach(F=>r.off(F,$)),W&&W.split(" ").forEach(F=>r.store.off(F,$))}},[r,i]),v=b.useRef(),S=b.useCallback(()=>{if(!r)return dD;const I=!!(r.isInitialized||r.initializedStoreOnce)&&m.every(V=>YM(V,r,i)),z=e.lng||r.language,W=x.current,$=v.current;if($&&$.ready===I&&$.lng===z&&$.keyPrefix===d&&$.revision===W)return $;const H={t:r.getFixedT(z,i.nsMode==="fallback"?m:m[0],d),ready:I,lng:z,keyPrefix:d,revision:W};return v.current=H,H},[r,m,d,i,e.lng]),[C,k]=b.useState(0),{t:N,ready:j}=cD.useSyncExternalStore(y,S,S);b.useEffect(()=>{if(r&&!j&&!c){const I=()=>k(z=>z+1);e.lng?ak(r,e.lng,m,I):cb(r,m,I)}},[r,e.lng,m,j,c,C]);const E=r||{},D=b.useRef(null),_=b.useRef(),P=I=>{const z=Object.getOwnPropertyDescriptors(I);z.__original&&delete z.__original;const W=Object.create(Object.getPrototypeOf(I),z);if(!Object.prototype.hasOwnProperty.call(W,"__original"))try{Object.defineProperty(W,"__original",{value:I,writable:!1,enumerable:!1,configurable:!1})}catch{}return W},O=b.useMemo(()=>{const I=E,z=I==null?void 0:I.language;let W=I;I&&(D.current&&D.current.__original===I?_.current!==z?(W=P(I),D.current=W,_.current=z):W=D.current:(W=P(I),D.current=W,_.current=z));const $=!j&&!c?(...H)=>(lb(r,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),N(...H)):N,F=[$,W,j];return F.t=$,F.i18n=W,F.ready=j,F},[N,E,j,E.resolvedLanguage,E.language,E.languages]);if(r&&c&&!j)throw new Promise(I=>{const z=()=>I();e.lng?ak(r,e.lng,m,z):cb(r,m,z)});return O};function db(t){"@babel/helpers - typeof";return db=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},db(t)}function tj(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":db(XMLHttpRequest))==="object"}function pD(t){return!!t&&typeof t.then=="function"}function hD(t){return pD(t)?t:Promise.resolve(t)}var mD=/\{\{(.+?)\}\}/g;function ok(t,e){return t.replace(mD,function(n,s){var a=e[s.trim()];return a??n})}const gD="modulepreload",bD=function(t){return"/"+t},lk={},vt=function(e,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=i(n.map(f=>{if(f=bD(f),f in lk)return;lk[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":gD,h||(x.as="script"),x.crossOrigin="",x.href=f,d&&x.setAttribute("nonce",d),document.head.appendChild(x),h)return new Promise((y,v)=>{x.addEventListener("load",y),x.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function r(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&r(c.reason);return e().catch(r)})};function ck(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function uk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ck(Object(n),!0).forEach(function(s){xD(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ck(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function xD(t,e,n){return(e=yD(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yD(t){var e=vD(t,"string");return fo(e)=="symbol"?e:e+""}function vD(t,e){if(fo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(fo(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fo(t){"@babel/helpers - typeof";return fo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fo(t)}var Si=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?Si=global.fetch:typeof window<"u"&&window.fetch&&(Si=window.fetch);var mu;tj()&&(typeof global<"u"&&global.XMLHttpRequest?mu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(mu=window.XMLHttpRequest));var Bf;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Bf=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Bf=window.ActiveXObject));typeof Si!="function"&&(Si=void 0);if(!Si&&!mu&&!Bf)try{vt(()=>import("./browser-ponyfill-DZOWXZ4K.js").then(t=>t.b),__vite__mapDeps([0,1])).then(function(t){Si=t.default}).catch(function(){})}catch{}var fb=function(e,n){if(n&&fo(n)==="object"){var s="";for(var a in n)s+="&"+encodeURIComponent(a)+"="+encodeURIComponent(n[a]);if(!s)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+s.slice(1)}return e},dk=function(e,n,s,a){var r=function(d){if(!d.ok)return s(d.statusText||"Error",{status:d.status});d.text().then(function(f){s(null,{status:d.status,data:f})}).catch(s)};if(a){var i=a(e,n);if(i instanceof Promise){i.then(r).catch(s);return}}typeof fetch=="function"?fetch(e,n).then(r).catch(s):Si(e,n).then(r).catch(s)},fk=!1,wD=function(e,n,s,a){e.queryStringParams&&(n=fb(n,e.queryStringParams));var r=uk({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(r["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),s&&(r["Content-Type"]="application/json");var i=typeof e.requestOptions=="function"?e.requestOptions(s):e.requestOptions,c=uk({method:s?"POST":"GET",body:s?e.stringify(s):void 0,headers:r},fk?{}:i),d=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{dk(n,c,a,d)}catch(f){if(!i||Object.keys(i).length===0||!f.message||f.message.indexOf("not implemented")<0)return a(f);try{Object.keys(i).forEach(function(h){delete c[h]}),dk(n,c,a,d),fk=!0}catch(h){a(h)}}},kD=function(e,n,s,a){s&&fo(s)==="object"&&(s=fb("",s).slice(1)),e.queryStringParams&&(n=fb(n,e.queryStringParams));try{var r=mu?new mu:new Bf("MSXML2.XMLHTTP.3.0");r.open(s?"POST":"GET",n,1),e.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=!!e.withCredentials,s&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.overrideMimeType&&r.overrideMimeType("application/json");var i=e.customHeaders;if(i=typeof i=="function"?i():i,i)for(var c in i)r.setRequestHeader(c,i[c]);r.onreadystatechange=function(){r.readyState>3&&a(r.status>=400?r.statusText:null,{status:r.status,data:r.responseText})},r.send(s)}catch(d){console&&console.log(d)}},SD=function(e,n,s,a){if(typeof s=="function"&&(a=s,s=void 0),a=a||function(){},Si&&n.indexOf("file:")!==0)return wD(e,n,s,a);if(tj()||typeof ActiveXObject=="function")return kD(e,n,s,a);a(new Error("No fetch and no xhr implementation found!"))};function vl(t){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vl(t)}function pk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Km(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pk(Object(n),!0).forEach(function(s){nj(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pk(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function CD(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AD(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,sj(s.key),s)}}function jD(t,e,n){return e&&AD(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function nj(t,e,n){return(e=sj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sj(t){var e=ND(t,"string");return vl(e)=="symbol"?e:e+""}function ND(t,e){if(vl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(vl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var TD=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,s,a){return nj({},s,a||"")},parseLoadPayload:function(n,s){},request:SD,reloadInterval:typeof window<"u"?!1:3600*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},aj=(function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};CD(this,t),this.services=e,this.options=n,this.allOptions=s,this.type="backend",this.init(e,n,s)}return jD(t,[{key:"init",value:function(n){var s=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Km(Km(Km({},TD()),this.options||{}),a),this.allOptions=r,this.services&&this.options.reloadInterval){var i=setInterval(function(){return s.reload()},this.options.reloadInterval);vl(i)==="object"&&typeof i.unref=="function"&&i.unref()}}},{key:"readMulti",value:function(n,s,a){this._readAny(n,n,s,s,a)}},{key:"read",value:function(n,s,a){this._readAny([n],n,[s],s,a)}},{key:"_readAny",value:function(n,s,a,r,i){var c=this,d=this.options.loadPath;typeof this.options.loadPath=="function"&&(d=this.options.loadPath(n,a)),d=hD(d),d.then(function(f){if(!f)return i(null,{});var h=ok(f,{lng:n.join("+"),ns:a.join("+")});c.loadUrl(h,i,s,r)})}},{key:"loadUrl",value:function(n,s,a,r){var i=this,c=typeof a=="string"?[a]:a,d=typeof r=="string"?[r]:r,f=this.options.parseLoadPayload(c,d);this.options.request(this.options,n,f,function(h,m){if(m&&(m.status>=500&&m.status<600||!m.status))return s("failed loading "+n+"; status code: "+m.status,!0);if(m&&m.status>=400&&m.status<500)return s("failed loading "+n+"; status code: "+m.status,!1);if(!m&&h&&h.message){var x=h.message.toLowerCase(),y=["failed","fetch","network","load"].find(function(C){return x.indexOf(C)>-1});if(y)return s("failed loading "+n+": "+h.message,!0)}if(h)return s(h,!1);var v,S;try{typeof m.data=="string"?v=i.options.parse(m.data,a,r):v=m.data}catch{S="failed parsing "+n+" to json"}if(S)return s(S,!1);s(null,v)})}},{key:"create",value:function(n,s,a,r,i){var c=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var d=this.options.parsePayload(s,a,r),f=0,h=[],m=[];n.forEach(function(x){var y=c.options.addPath;typeof c.options.addPath=="function"&&(y=c.options.addPath(x,s));var v=ok(y,{lng:x,ns:s});c.options.request(c.options,v,d,function(S,C){f+=1,h.push(S),m.push(C),f===n.length&&typeof i=="function"&&i(h,m)})})}}},{key:"reload",value:function(){var n=this,s=this.services,a=s.backendConnector,r=s.languageUtils,i=s.logger,c=a.language;if(!(c&&c.toLowerCase()==="cimode")){var d=[],f=function(m){var x=r.toResolveHierarchy(m);x.forEach(function(y){d.indexOf(y)<0&&d.push(y)})};f(c),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),d.forEach(function(h){n.allOptions.ns.forEach(function(m){a.read(h,m,"read",null,null,function(x,y){x&&i.warn("loading namespace ".concat(m," for language ").concat(h," failed"),x),!x&&y&&i.log("loaded namespace ".concat(m," for language ").concat(h),y),a.loaded("".concat(h,"|").concat(m),x,y)})})})}}}])})();aj.type="backend";const{slice:ED,forEach:_D}=[];function MD(t){return _D.call(ED.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function DD(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const hk=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,RD=function(t,e){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(e);let r=`${t}=${a}`;if(s.maxAge>0){const i=s.maxAge-0;if(Number.isNaN(i))throw new Error("maxAge should be a Number");r+=`; Max-Age=${Math.floor(i)}`}if(s.domain){if(!hk.test(s.domain))throw new TypeError("option domain is invalid");r+=`; Domain=${s.domain}`}if(s.path){if(!hk.test(s.path))throw new TypeError("option path is invalid");r+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");r+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(r+="; HttpOnly"),s.secure&&(r+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s.partitioned&&(r+="; Partitioned"),r},mk={create(t,e,n,s){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+n*60*1e3)),s&&(a.domain=s),document.cookie=RD(t,e,a)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let s=0;s<n.length;s++){let a=n[s];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(e)===0)return a.substring(e.length,a.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var OD={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return mk.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:s,cookieDomain:a,cookieOptions:r}=e;n&&typeof document<"u"&&mk.create(n,t,s,a,r)}},LD={name:"querystring",lookup(t){var s;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:a}=window.location;!window.location.search&&((s=window.location.hash)==null?void 0:s.indexOf("?"))>-1&&(a=window.location.hash.substring(window.location.hash.indexOf("?")));const i=a.substring(1).split("&");for(let c=0;c<i.length;c++){const d=i[c].indexOf("=");d>0&&i[c].substring(0,d)===e&&(n=i[c].substring(d+1))}}return n}},PD={name:"hash",lookup(t){var a;let{lookupHash:e,lookupFromHashIndex:n}=t,s;if(typeof window<"u"){const{hash:r}=window.location;if(r&&r.length>2){const i=r.substring(1);if(e){const c=i.split("&");for(let d=0;d<c.length;d++){const f=c[d].indexOf("=");f>0&&c[d].substring(0,f)===e&&(s=c[d].substring(f+1))}}if(s)return s;if(!s&&n>-1){const c=r.match(/\/([a-zA-Z-]*)/g);return Array.isArray(c)?(a=c[typeof n=="number"?n:0])==null?void 0:a.replace("/",""):void 0}}}return s}};let tl=null;const gk=()=>{if(tl!==null)return tl;try{if(tl=typeof window<"u"&&window.localStorage!==null,!tl)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{tl=!1}return tl};var ID={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&gk())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&gk()&&window.localStorage.setItem(n,t)}};let nl=null;const bk=()=>{if(nl!==null)return nl;try{if(nl=typeof window<"u"&&window.sessionStorage!==null,!nl)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{nl=!1}return nl};var BD={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&bk())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&bk()&&window.sessionStorage.setItem(n,t)}},FD={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:s,language:a}=navigator;if(n)for(let r=0;r<n.length;r++)e.push(n[r]);s&&e.push(s),a&&e.push(a)}return e.length>0?e:void 0}},zD={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const s=e||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(n=s.getAttribute("lang")),n}},$D={name:"path",lookup(t){var a;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(a=n[typeof e=="number"?e:0])==null?void 0:a.replace("/",""):void 0}},HD={name:"subdomain",lookup(t){var a,r;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,s=typeof window<"u"&&((r=(a=window.location)==null?void 0:a.hostname)==null?void 0:r.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(s)return s[n]}};let rj=!1;try{document.cookie,rj=!0}catch{}const ij=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];rj||ij.splice(1,1);const UD=()=>({order:ij,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class oj{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=MD(n,this.options||{},UD()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(OD),this.addDetector(LD),this.addDetector(ID),this.addDetector(BD),this.addDetector(FD),this.addDetector(zD),this.addDetector($D),this.addDetector(HD),this.addDetector(PD)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(s=>{if(this.detectors[s]){let a=this.detectors[s].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(n=n.concat(a))}}),n=n.filter(s=>s!=null&&!DD(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(e,this.options)}))}}oj.type="languageDetector";const Ff={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a",default:"#888888"},pb={running:"#4aff9e",stopped:"#888888",error:"#ff4a4a",unknown:"#ffaa00",starting:"#4a9eff",stopping:"#ffaa00"},WD={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888888"},Yq=["#4a9eff","#4aff9e","#ff9e4a","#ff4a9e","#9e4aff","#ff4a4a","#4affff","#ffff4a","#4ad7ff","#00e6a8","#ff6b4a","#ff66cc","#b84aff","#ff4a7a","#00d9ff","#e6ff4a","#1a3a6e","#1a5e3a","#6e3a1a","#6e1a4a","#4a1a6e","#6e1a1a","#1a5e5e","#5e5e1a","#1a4a6e","#145a47","#6e2c1a","#6e1a5e","#3b1a6e","#6e1a33","#14566e","#4f5e1a"],Gd={recent:"#50fa7b",short:"#f1fa8c",medium:"#ffb86c",long:"#ff5555"};function Xb(t){const n=Math.floor((Date.now()-t)/1e3)/60;return n<1?Gd.recent:n<5?Gd.short:n<30?Gd.medium:Gd.long}function Jb(t){return Ff[t]??Ff.default}let kf=null;function lj(){if(!kf)try{kf=globalThis.__i18n}catch{}return kf}function qD(t){kf=t}function VD(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString()}function GD(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString()}function YD(t){var a;const e=lj(),n=(a=e==null?void 0:e.t)==null?void 0:a.bind(e),s=Math.floor((Date.now()-t)/1e3);return s<60?n?n("common:time.seconds",{count:s}):`${s}s`:s<3600?n?n("common:time.minutes",{count:Math.floor(s/60)}):`${Math.floor(s/60)}m`:s<86400?n?n("common:time.hours",{count:Math.floor(s/3600)}):`${Math.floor(s/3600)}h`:n?n("common:time.days",{count:Math.floor(s/86400)}):`${Math.floor(s/86400)}d`}function gp(t){var f;const e=lj(),n=(f=e==null?void 0:e.t)==null?void 0:f.bind(e),s=Math.floor((Date.now()-t)/1e3);if(s<5)return n?n("common:time.justNow"):"just now";if(s<60)return n?n("common:time.secondsAgo",{count:s}):`${s}s ago`;const a=Math.floor(s/60);if(a<60){const h=s%60;return h>0?n?n("common:time.minutesSecondsAgo",{minutes:a,seconds:h}):`${a}m ${h}s ago`:n?n("common:time.minutesAgo",{count:a}):`${a}m ago`}const r=Math.floor(a/60),i=a%60;if(r<24)return i>0?n?n("common:time.hoursMinutesAgo",{hours:r,minutes:i}):`${r}h ${i}m ago`:n?n("common:time.hoursAgo",{count:r}):`${r}h ago`;const c=Math.floor(r/24),d=r%24;return d>0?n?n("common:time.daysHoursAgo",{days:c,hours:d}):`${c}d ${d}h ago`:n?n("common:time.daysAgo",{count:c}):`${c}d ago`}function su(t,e){return t?e?t.replace(/\s*\(?\s*~?\$[\d,.]+\s*\)?/g,"").replace(/\s*cost[:\s]+~?\$[\d,.]+/gi,"").replace(/\s*price[:\s]+~?\$[\d,.]+/gi,"").replace(/\s*\(~?\$[\d,.]+\s*(?:USD|cost|spent)?\)/gi,"").replace(/\s*-\s*~?\$[\d,.]+\s*$/g,"").replace(/[^\S\n]+/g," ").trim():t:""}En.use(aj).use(oj).use(aD).init({fallbackLng:"en",ns:["common","tools","config","errors","notifications","dashboard","terminal"],defaultNS:"common",backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["localStorage","navigator"],lookupLocalStorage:"tide-commander-language",caches:["localStorage"]},interpolation:{escapeValue:!1},react:{useSuspense:!0}}).then(()=>{qD(En)});const ft={CONFIG:"tide-commander-config",SHOW_FPS:"tide-show-fps",SETTINGS:"tide-settings",SHORTCUTS:"tide-shortcuts",MOUSE_CONTROLS:"tide-mouse-controls",BACKEND_URL:"tide-backend-url",AUTH_TOKEN:"tide-auth-token",SCENE_VIEW_MODE:"tide-scene-view-mode",CAMERA_STATE:"tide-camera-state",CAMERA_STATE_2D:"tide-camera-state-2d",VIEW_MODE:"guake-view-mode",ADVANCED_VIEW:"guake-advanced-view",TERMINAL_HEIGHT:"guake-terminal-height",TERMINAL_FULLSCREEN:"guake-terminal-fullscreen",INPUT_TEXT_PREFIX:"guake-input-",PASTED_TEXTS_PREFIX:"guake-pasted-",COMMANDER_TAB:"commander-active-tab",COMMANDER_FILTERS:"commander-filters",LAST_CWD:"tide-last-cwd",GLOBAL_SUPERVISOR_COLLAPSED:"tide-global-supervisor-collapsed",TOOLS_COLLAPSED:"tide-tool-history-collapsed",FILES_COLLAPSED:"tide-file-history-collapsed",MOBILE_VIEW:"tide-mobile-view",TREE_PANEL_WIDTH:"tide-tree-panel-width",MOBILE_TREE_PANEL_HEIGHT:"tide-mobile-tree-panel-height",AGENT_ORDER:"tide-agent-order",AOP_CONFIG:"tide-aop-config",AOP_OPEN:"tide-aop-open",AOP_TRACKING_BOARD_VISIBLE:"tide-aop-tracking-board-visible",MOBILE_OVERVIEW_HEIGHT:"tide-mobile-overview-height",SPLIT_PANE_AGENT_IDS:"tide-split-pane-agent-ids",SPLIT_PANE_ORIENTATION:"tide-split-pane-orientation",GIT_PANEL_OPEN:"guake-git-panel-open",GIT_PANEL_MODE:"guake-git-panel-mode",GIT_PANEL_VIEW_MODE:"guake-git-view-mode",GIT_PANEL_FOLDER_IDX:"guake-git-folder-idx",BUILDINGS_PANEL_OPEN:"guake-buildings-panel-open",WORKFLOW_PANEL_OPEN:"guake-workflow-panel-open",SIDE_PANEL_WIDTH:"guake-side-panel-width",UNSEEN_AGENTS:"tide-unseen-agents",PENDING_MESSAGES:"tide-pending-messages"},hb="tide-backend-url-change";function ta(t,e){try{const n=localStorage.getItem(t);return n===null?e:JSON.parse(n)}catch{return e}}function va(t,e=""){try{return localStorage.getItem(t)??e}catch{return e}}function Er(t,e=!1){try{const n=localStorage.getItem(t);return n===null?e:n==="true"}catch{return e}}function Zb(t,e){try{const n=localStorage.getItem(t);if(n===null)return e;const s=Number(n);return isNaN(s)?e:s}catch{return e}}function ya(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function er(t,e){try{localStorage.setItem(t,e)}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function Qa(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function ex(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function xk(t){try{localStorage.removeItem(t)}catch(e){console.error(`Failed to remove from localStorage: ${t}`,e)}}function Sa(){const t=tx();return t?t.replace(/\/$/,""):`${window.location.protocol}//${window.location.host}`}function Ni(){return va(ft.AUTH_TOKEN,"")}function tx(){return va(ft.BACKEND_URL,"")}function KD(t){const e=t.trim();er(ft.BACKEND_URL,e),typeof window<"u"&&window.dispatchEvent(new CustomEvent(hb,{detail:e}))}function QD(t){if(typeof window>"u")return()=>{};const e=s=>{t(s.detail)},n=s=>{s.key===ft.BACKEND_URL&&t(s.newValue??"")};return window.addEventListener(hb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(hb,e),window.removeEventListener("storage",n)}}function Mt(t){return`${Sa()}${t}`}async function Lt(t,e){const n=Ni(),s=new Headers(e==null?void 0:e.headers);return n&&s.set("X-Auth-Token",n),fetch(t,{...e,headers:s,cache:"no-store"})}function mb(t){const e=Ni();if(!e)return t;try{const n=!t.startsWith("http://")&&!t.startsWith("https://"),s=n?"http://dummy":void 0,a=new URL(t,s);return a.searchParams.set("token",e),n?a.pathname+a.search:a.toString()}catch{const n=t.includes("?")?"&":"?";return`${t}${n}token=${encodeURIComponent(e)}`}}function ns(t=!1,e){const[n,s]=b.useState(t),[a,r]=b.useState(e),i=b.useCallback(f=>{f!==void 0&&r(f),s(!0)},[]),c=b.useCallback(()=>{s(!1)},[]),d=b.useCallback(()=>{s(f=>!f)},[]);return{isOpen:n,data:a,open:i,close:c,toggle:d,setData:r}}function XD(){const[t,e]=b.useState(null),n=b.useCallback(a=>{e(a)},[]),s=b.useCallback(()=>{e(null)},[]);return{isOpen:t!==null,id:t,open:n,close:s}}function JD(){const[t,e]=b.useState(!1),[n,s]=b.useState({x:0,y:0}),[a,r]=b.useState({x:0,z:0}),[i,c]=b.useState({type:"ground"}),d=b.useCallback((h,m,x)=>{s(h),r(m),c(x),e(!0)},[]),f=b.useCallback(()=>{e(!1)},[]);return{isOpen:t,screenPosition:n,worldPosition:a,target:i,open:d,close:f}}const na=[],ZD=new Set;function zf(){ZD.forEach(t=>t())}function eR(t,e){const n=na.findIndex(s=>s.id===t);return n!==-1&&na.splice(n,1),na.push({id:t,close:e}),zf(),()=>{const s=na.findIndex(a=>a.id===t);s!==-1&&(na.splice(s,1),zf())}}function Sf(){return na.length===0?!1:(na.pop().close(),zf(),!0)}function tR(t){const e=na.findIndex(n=>n.id===t);return e===-1?!1:e<na.length-1}function nR(...t){const e=new Set(t);for(;na.length>0;){const n=na[na.length-1];if(e.has(n.id))break;na.pop().close()}zf()}function Qt(t,e,n){const s=b.useRef(n);s.current=n,b.useEffect(()=>e?eR(t,()=>s.current()):void 0,[t,e])}const gu=5,Qm={0:0,1:4,2:8,3:14,4:25,5:50};let au=null,yk=!1;async function sR(){if(yk)return au;yk=!0;try{const t=await vt(()=>import("./index-CvJuv-ho.js"),__vite__mapDeps([2,3,1,4]));au={Haptics:t.Haptics,ImpactStyle:t.ImpactStyle}}catch{}return au}sR();function $f(t){const e=Math.round(t),n=e<=0?0:e>=gu?gu:e;if(n!==0){if(au){const{Haptics:s,ImpactStyle:a}=au;if(n<=2&&typeof s.selectionChanged=="function"){s.selectionChanged().catch(()=>{navigator.vibrate&&navigator.vibrate(Qm[n])});return}const i={3:"Light",4:"Medium",5:"Heavy"}[n];if(i&&a[i]){s.impact({style:a[i]}).catch(()=>{navigator.vibrate&&navigator.vibrate(Qm[n])});return}}navigator.vibrate&&navigator.vibrate(Qm[n])}}function vk(t,e){const{threshold:n=80,maxVerticalMovement:s=50,enabled:a=!0,onSwipeLeft:r,onSwipeRight:i,onSwipeMove:c,onSwipeCancel:d,vibrationIntensity:f=1}=e,h=b.useRef({startX:0,startY:0,startTime:0,isTracking:!1,hasMovedEnough:!1}),m=b.useCallback(S=>{if(S.touches.length!==1)return;const C=S.touches[0];h.current={startX:C.clientX,startY:C.clientY,startTime:Date.now(),isTracking:!0,hasMovedEnough:!1}},[]),x=b.useCallback(S=>{if(!h.current.isTracking||S.touches.length!==1)return;const C=S.touches[0],k=C.clientX-h.current.startX;if(Math.abs(C.clientY-h.current.startY)>s){h.current.isTracking=!1,h.current.hasMovedEnough&&(d==null||d());return}const E=window.innerWidth*.4,D=Math.max(-1,Math.min(1,k/E));Math.abs(k)>=12&&(h.current.hasMovedEnough=!0,c==null||c(D))},[s,c,d]),y=b.useCallback(S=>{const C=h.current.isTracking,k=h.current.hasMovedEnough;if(!C)return;const N=S.changedTouches[0],j=N.clientX-h.current.startX,E=Math.abs(N.clientY-h.current.startY),D=Date.now()-h.current.startTime;h.current.isTracking=!1,h.current.hasMovedEnough=!1,Math.abs(j)>=n&&E<=s&&D<500?($f(f),j>0?i==null||i():r==null||r()):k&&(d==null||d())},[n,s,f,r,i,d]),v=b.useCallback(()=>{const S=h.current.hasMovedEnough;h.current.isTracking=!1,h.current.hasMovedEnough=!1,S&&(d==null||d())},[d]);b.useEffect(()=>{const S=t.current;if(!(!S||!a||!(window.innerWidth<=768&&"ontouchstart"in window)))return S.addEventListener("touchstart",m,{passive:!0}),S.addEventListener("touchmove",x,{passive:!0}),S.addEventListener("touchend",y,{passive:!0}),S.addEventListener("touchcancel",v,{passive:!0}),()=>{S.removeEventListener("touchstart",m),S.removeEventListener("touchmove",x),S.removeEventListener("touchend",y),S.removeEventListener("touchcancel",v)}},[t,a,m,x,y,v])}const wk=8,aR=.93,kk=.4;function rR(t){const{gestureRef:e,agentListRef:n,enabled:s,onSelect:a}=t,[r,i]=b.useState(!1),[c,d]=b.useState(null),f=b.useRef(!1),h=b.useRef(null),m=b.useRef(a);m.current=a;const x=b.useCallback(()=>{if(f.current)return;f.current=!0,i(!0);const C=n.current;if(C){const k=Math.round(C.clientHeight/2);C.style.paddingTop=`${k}px`,C.style.paddingBottom=`${k}px`}},[n]),y=b.useCallback(()=>{f.current=!1,h.current=null,i(!1),d(null);const C=n.current;C&&(C.style.paddingTop="",C.style.paddingBottom="")},[n]),v=b.useCallback(C=>{const k=n.current;if(!k)return;k.scrollTop+=C;const N=k.getBoundingClientRect(),j=N.top+N.height/2,E=N.left+N.width/2,D=document.elementFromPoint(E,j);let _=null;if(D){const P=D.closest("[data-agent-id]");P&&k.contains(P)&&(_=P.dataset.agentId)}if(_!==h.current&&(h.current=_,d(_),_)){const P=U.getState().settings.vibrationIntensity??1;$f(P)}},[n]),S=b.useCallback(()=>{const C=h.current;if(C){const k=U.getState().settings.vibrationIntensity??1,N=k<=0?0:Math.min(k+1,gu);$f(N),m.current(C)}y()},[y]);return b.useEffect(()=>{const C=e.current;if(!C||!s)return;const k=C.style.touchAction;C.style.touchAction="none";let N=!1,j=!1,E=0,D=0,_=0,P=0,O=0,T=0,M=0,R=0;const I=()=>{M&&(cancelAnimationFrame(M),M=0)},z=()=>{if(Math.abs(T)<kk){T=0;return}C.scrollTop+=T,T*=aR,M=requestAnimationFrame(z)},W=V=>{if(I(),V.touches.length>=2){V.preventDefault(),N=!1,j=!1,R=(V.touches[0].clientY+V.touches[1].clientY)/2,x(),v(0);return}N=!0,j=!1,E=V.touches[0].clientX,D=V.touches[0].clientY,_=C.scrollTop,P=D,O=performance.now(),T=0},$=V=>{if(V.touches.length>=2){if(V.preventDefault(),(j||N)&&(j=!1,N=!1),!f.current){R=(V.touches[0].clientY+V.touches[1].clientY)/2,x(),v(0);return}const Q=(V.touches[0].clientY+V.touches[1].clientY)/2,K=R-Q;R=Q,v(K);return}if(f.current&&V.touches.length===1){V.preventDefault();const Q=V.touches[0].clientY,K=R-Q;R=Q,v(K);return}if(!N&&!j)return;const G=V.touches[0].clientX,B=V.touches[0].clientY;if(N&&!j){const Q=Math.abs(G-E),K=Math.abs(B-D);if(Q<wk&&K<wk)return;if(K>=Q)j=!0,N=!1,V.preventDefault();else{N=!1;return}}if(j){V.preventDefault();const Q=performance.now(),K=Q-O;C.scrollTop=_+(D-B),K>0&&(T=(P-B)/K*16),P=B,O=Q}},F=V=>{if(f.current&&V.touches.length===0){S();return}f.current||(j||N)&&V.touches.length===0&&(j&&Math.abs(T)>kk&&(M=requestAnimationFrame(z)),j=!1,N=!1)},H=()=>{j=!1,N=!1,I(),f.current&&y()};return C.addEventListener("touchstart",W,{passive:!1}),C.addEventListener("touchmove",$,{passive:!1}),C.addEventListener("touchend",F,{passive:!0}),C.addEventListener("touchcancel",H,{passive:!0}),()=>{C.removeEventListener("touchstart",W),C.removeEventListener("touchmove",$),C.removeEventListener("touchend",F),C.removeEventListener("touchcancel",H),C.style.touchAction=k,I();const V=n.current;V&&(V.style.paddingTop="",V.style.paddingBottom="")}},[e,n,s,x,y,v,S]),{isActive:r,hoveredAgentId:c}}const iR={width:400,height:300,copyStyleSheets:!0,keepOnTop:"focus"};function oR(){return"documentPictureInPicture"in window}function lR(t,e){for(const r of t.styleSheets)try{if(r.cssRules){const i=e.createElement("style");for(const c of r.cssRules)i.appendChild(e.createTextNode(c.cssText));e.head.appendChild(i)}}catch{if(r.href){const i=e.createElement("link");i.rel="stylesheet",i.href=r.href,e.head.appendChild(i)}}const n=t.documentElement.style.cssText;n&&(e.documentElement.style.cssText=n);const s=getComputedStyle(t.documentElement),a=[];for(let r=0;r<s.length;r++){const i=s[r];i.startsWith("--")&&a.push(`${i}: ${s.getPropertyValue(i)}`)}if(a.length>0){const r=e.createElement("style");r.textContent=`:root { ${a.join("; ")} }`,e.head.appendChild(r)}}function cR(){const[t,e]=b.useState(!1),[n,s]=b.useState(null),[a,r]=b.useState(null),i=b.useRef(null),c=oR(),d=b.useCallback(()=>{if(i.current){const m=i.current.__cleanupFns;m&&m.forEach(x=>x()),i.current.close(),i.current=null}s(null),r(null),e(!1)},[]),f=b.useCallback(async m=>{if(!c)return console.warn("Document Picture-in-Picture is not supported in this browser"),!1;i.current&&d();const x={...iR,...m};try{const v=await window.documentPictureInPicture.requestWindow({width:x.width,height:x.height,disallowReturnToOpener:!0});i.current=v,x.copyStyleSheets&&lR(document,v.document);const S=v.document.createElement("div");S.id="pip-root",S.style.width="100%",S.style.height="100%",v.document.body.appendChild(S),v.document.body.style.margin="0",v.document.body.style.padding="0",v.document.body.style.overflow="hidden",v.addEventListener("pagehide",()=>{i.current=null,s(null),r(null),e(!1)});const C=[];if(x.keepOnTop&&x.keepOnTop!=="none"){const k=x.keepOnTop==="raise",N=()=>{i.current&&!i.current.closed&&setTimeout(()=>{i.current&&!i.current.closed&&(i.current.focus(),k&&setTimeout(()=>window.focus(),10))},50)},j=()=>{document.visibilityState==="visible"&&i.current&&!i.current.closed&&setTimeout(()=>{i.current&&!i.current.closed&&(i.current.focus(),k&&setTimeout(()=>window.focus(),10))},100)};window.addEventListener("focus",N),document.addEventListener("visibilitychange",j),C.push(()=>window.removeEventListener("focus",N),()=>document.removeEventListener("visibilitychange",j))}return v.__cleanupFns=C,s(v),r(S),e(!0),!0}catch(y){return console.error("Failed to open Picture-in-Picture window:",y),!1}},[c,d]),h=b.useCallback(async m=>{t?d():await f(m)},[t,f,d]);return b.useEffect(()=>()=>{i.current&&i.current.close()},[]),b.useMemo(()=>({isOpen:t,pipWindow:n,pipContainer:a,isSupported:c,open:f,close:d,toggle:h}),[t,n,a,c,f,d,h])}function _c(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}class uR{constructor(){et(this,"messages",new Map);et(this,"logs",[]);et(this,"maxMessagesPerAgent",200);et(this,"maxLogs",500);et(this,"enabled",!0);et(this,"listeners",new Set);et(this,"logListeners",new Set)}setEnabled(e){this.enabled=e,this.notifyListeners("all")}isEnabled(){return this.enabled}captureSent(e,n){try{const s=JSON.parse(n);console.log(`[AgentDebugger] SENT - agent: ${e.slice(0,4)}, type: ${s.type}, size: ${n.length}B`),this.addMessage(e,{id:_c(),agentId:e,direction:"sent",type:s.type||"unknown",payload:s.payload||s,timestamp:Date.now(),size:n.length,raw:n})}catch(s){console.error("[AgentDebugger] Failed to parse SENT message:",String(s).slice(0,80)),this.addMessage(e,{id:_c(),agentId:e,direction:"sent",type:"parse_error",payload:{error:String(s)},timestamp:Date.now(),size:n.length,raw:n})}}captureReceived(e,n){try{const s=JSON.parse(n);console.log(`[AgentDebugger] RECEIVED - agent: ${e.slice(0,4)}, type: ${s.type}, size: ${n.length}B`),this.addMessage(e,{id:_c(),agentId:e,direction:"received",type:s.type||"unknown",payload:s.payload||s,timestamp:Date.now(),size:n.length,raw:n})}catch(s){console.error("[AgentDebugger] Failed to parse RECEIVED message:",String(s).slice(0,80)),this.addMessage(e,{id:_c(),agentId:e,direction:"received",type:"parse_error",payload:{error:String(s)},timestamp:Date.now(),size:n.length,raw:n})}}addMessage(e,n){let s=this.messages.get(e);s||(s=[],this.messages.set(e,s)),s.push(n),console.log(`[AgentDebugger] Added message for ${e}, total: ${s.length}, type: ${n.type}, direction: ${n.direction}`),s.length>this.maxMessagesPerAgent&&s.shift(),this.notifyListeners(e)}getMessages(e){return this.messages.get(e)||[]}getStats(e){const n=this.getMessages(e),s=n.filter(i=>i.direction==="sent").length,a=n.filter(i=>i.direction==="received").length,r=[...new Set(n.map(i=>i.type))];return{total:n.length,sent:s,received:a,messageTypes:r}}clearMessages(e){this.messages.delete(e),this.notifyListeners(e)}clearAllMessages(){this.messages.clear(),this.notifyListeners("all")}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(e){this.listeners.forEach(n=>n(e))}getAgentIds(){return Array.from(this.messages.keys())}log(e,n,s,a){const r={id:_c(),level:e,message:n,data:s,timestamp:Date.now(),source:a};this.logs.push(r),this.logs.length>this.maxLogs&&this.logs.shift(),this.notifyLogListeners()}debug(e,n,s){this.log("debug",e,n,s)}info(e,n,s){this.log("info",e,n,s)}warn(e,n,s){this.log("warn",e,n,s)}error(e,n,s){this.log("error",e,n,s)}getLogs(){return this.logs}clearLogs(){this.logs=[],this.notifyLogListeners()}subscribeLogs(e){return this.logListeners.add(e),()=>this.logListeners.delete(e)}notifyLogListeners(){this.logListeners.forEach(e=>e())}}const hs=new uR,bu={debug:(t,e,n)=>hs.debug(t,e,n),info:(t,e,n)=>hs.info(t,e,n),warn:(t,e,n)=>hs.warn(t,e,n),error:(t,e,n)=>hs.error(t,e,n)};/*! Capacitor: https://capacitorjs.com/ - MIT License */var wl;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(wl||(wl={}));class Xm extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const dR=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},fR=t=>{const e=t.CapacitorCustomPlatform||null,n=t.Capacitor||{},s=n.Plugins=n.Plugins||{},a=()=>e!==null?e.name:dR(t),r=()=>a()!=="web",i=m=>{const x=f.get(m);return!!(x!=null&&x.platforms.has(a())||c(m))},c=m=>{var x;return(x=n.PluginHeaders)===null||x===void 0?void 0:x.find(y=>y.name===m)},d=m=>t.console.error(m),f=new Map,h=(m,x={})=>{const y=f.get(m);if(y)return console.warn(`Capacitor plugin "${m}" already registered. Cannot register plugins twice.`),y.proxy;const v=a(),S=c(m);let C;const k=async()=>(!C&&v in x?C=typeof x[v]=="function"?C=await x[v]():C=x[v]:e!==null&&!C&&"web"in x&&(C=typeof x.web=="function"?C=await x.web():C=x.web),C),N=(O,T)=>{var M,R;if(S){const I=S==null?void 0:S.methods.find(z=>T===z.name);if(I)return I.rtype==="promise"?z=>n.nativePromise(m,T.toString(),z):(z,W)=>n.nativeCallback(m,T.toString(),z,W);if(O)return(M=O[T])===null||M===void 0?void 0:M.bind(O)}else{if(O)return(R=O[T])===null||R===void 0?void 0:R.bind(O);throw new Xm(`"${m}" plugin is not implemented on ${v}`,wl.Unimplemented)}},j=O=>{let T;const M=(...R)=>{const I=k().then(z=>{const W=N(z,O);if(W){const $=W(...R);return T=$==null?void 0:$.remove,$}else throw new Xm(`"${m}.${O}()" is not implemented on ${v}`,wl.Unimplemented)});return O==="addListener"&&(I.remove=async()=>T()),I};return M.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(M,"name",{value:O,writable:!1,configurable:!1}),M},E=j("addListener"),D=j("removeListener"),_=(O,T)=>{const M=E({eventName:O},T),R=async()=>{const z=await M;D({eventName:O,callbackId:z},T)},I=new Promise(z=>M.then(()=>z({remove:R})));return I.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await R()},I},P=new Proxy({},{get(O,T){switch(T){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return S?_:E;case"removeListener":return D;default:return j(T)}}});return s[m]=P,f.set(m,{name:m,proxy:P,platforms:new Set([...Object.keys(x),...S?[v]:[]])}),P};return n.convertFileSrc||(n.convertFileSrc=m=>m),n.getPlatform=a,n.handleError=d,n.isNativePlatform=r,n.isPluginAvailable=i,n.registerPlugin=h,n.Exception=Xm,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},pR=t=>t.Capacitor=fR(t),Hf=pR(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Nu=Hf.registerPlugin;class nx{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,n){let s=!1;this.listeners[e]||(this.listeners[e]=[],s=!0),this.listeners[e].push(n);const r=this.windowListeners[e];r&&!r.registered&&this.addWindowListener(r),s&&this.sendRetainedArgumentsForEvent(e);const i=async()=>this.removeListener(e,n);return Promise.resolve({remove:i})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n,s){const a=this.listeners[e];if(!a){if(s){let r=this.retainedEventArguments[e];r||(r=[]),r.push(n),this.retainedEventArguments[e]=r}return}a.forEach(r=>r(n))}hasListeners(e){var n;return!!(!((n=this.listeners[e])===null||n===void 0)&&n.length)}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new Hf.Exception(e,wl.Unimplemented)}unavailable(e="not available"){return new Hf.Exception(e,wl.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const a=s.indexOf(n);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const n=this.retainedEventArguments[e];n&&(delete this.retainedEventArguments[e],n.forEach(s=>{this.notifyListeners(e,s)}))}}const Sk=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Ck=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class hR extends nx{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[a,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=Ck(a).trim(),r=Ck(r).trim(),n[a]=r}),n}async setCookie(e){try{const n=Sk(e.key),s=Sk(e.value),a=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",r=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${a}; path=${r}; ${i};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}Nu("CapacitorCookies",{web:()=>new hR});const mR=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const a=s.result;e(a.indexOf(",")>=0?a.split(",")[1]:a)},s.onerror=a=>n(a),s.readAsDataURL(t)}),gR=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(a=>a.toLocaleLowerCase()).reduce((a,r,i)=>(a[r]=t[e[i]],a),{})},bR=(t,e=!0)=>t?Object.entries(t).reduce((s,a)=>{const[r,i]=a;let c,d;return Array.isArray(i)?(d="",i.forEach(f=>{c=e?encodeURIComponent(f):f,d+=`${r}=${c}&`}),d.slice(0,-1)):(c=e?encodeURIComponent(i):i,d=`${r}=${c}`),`${s}&${d}`},"").substr(1):null,xR=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),a=gR(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(a.includes("application/x-www-form-urlencoded")){const r=new URLSearchParams;for(const[i,c]of Object.entries(t.data||{}))r.set(i,c);n.body=r.toString()}else if(a.includes("multipart/form-data")||t.data instanceof FormData){const r=new FormData;if(t.data instanceof FormData)t.data.forEach((c,d)=>{r.append(d,c)});else for(const c of Object.keys(t.data))r.append(c,t.data[c]);n.body=r;const i=new Headers(n.headers);i.delete("content-type"),n.headers=i}else(a.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class yR extends nx{async request(e){const n=xR(e,e.webFetchExtra),s=bR(e.params,e.shouldEncodeUrlParams),a=s?`${e.url}?${s}`:e.url,r=await fetch(a,n),i=r.headers.get("content-type")||"";let{responseType:c="text"}=r.ok?e:{};i.includes("application/json")&&(c="json");let d,f;switch(c){case"arraybuffer":case"blob":f=await r.blob(),d=await mR(f);break;case"json":d=await r.json();break;case"document":case"text":default:d=await r.text()}const h={};return r.headers.forEach((m,x)=>{h[x]=m}),{data:d,headers:h,status:r.status,url:r.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}const Kq=Nu("CapacitorHttp",{web:()=>new yR});var Ak;(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(Ak||(Ak={}));var jk;(function(t){t.StatusBar="StatusBar",t.NavigationBar="NavigationBar"})(jk||(jk={}));class vR extends nx{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Nu("SystemBars",{web:()=>new vR});var Nk;(function(t){t[t.Sunday=1]="Sunday",t[t.Monday=2]="Monday",t[t.Tuesday=3]="Tuesday",t[t.Wednesday=4]="Wednesday",t[t.Thursday=5]="Thursday",t[t.Friday=6]="Friday",t[t.Saturday=7]="Saturday"})(Nk||(Nk={}));const sx=Nu("LocalNotifications",{web:()=>vt(()=>import("./web-RTEsf66y.js"),__vite__mapDeps([5,3,1,4])).then(t=>new t.LocalNotificationsWeb)}),wR=Nu("ServerConfig");let kR=100;const SR="agent_alerts",gb="tide-notification-tap";function CR(){return typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window}function cj(t){if(CR()){U.openTerminalOnMobile(t);return}if(document.querySelector(".commander-overlay")){U.requestCommanderExpand(t);return}U.selectAgent(t),U.setTerminalOpen(!0)}function Tu(){try{return Hf.isNativePlatform()}catch{return!1}}async function AR(){if(Tu())try{const t=await sx.requestPermissions();return console.log("[Notifications] Permission result:",t.display),t.display==="granted"}catch(t){return console.error("[Notifications] Failed to request permissions:",t),!1}else return"Notification"in window?await Notification.requestPermission()==="granted":!1}async function jR(t){const{title:e,body:n,icon:s,data:a}=t;if(Tu())try{const r=kR++;console.log("[Notifications] Scheduling native notification id="+r,e),await sx.schedule({notifications:[{id:r,title:e,body:n,extra:a,channelId:SR,smallIcon:"ic_launcher",autoCancel:!0}]}),console.log("[Notifications] Notification scheduled successfully")}catch(r){console.error("[Notifications] Failed to schedule notification:",r)}else if("Notification"in window&&Notification.permission==="granted"){const r=new Notification(e,{body:n,icon:s,data:a});r.onclick=()=>{window.focus(),a&&window.dispatchEvent(new CustomEvent(gb,{detail:a}))}}}let Jm=!1;async function NR(t){const e=[];if(Jm)return()=>{};if(Jm=!0,t){const n=s=>{const a=s;a.detail&&t(a.detail)};window.addEventListener(gb,n),e.push(()=>window.removeEventListener(gb,n))}if(Tu())try{const n=await sx.addListener("localNotificationActionPerformed",s=>{t&&s.notification.extra&&t(s.notification.extra)});e.push(()=>n.remove())}catch(n){console.error("[Notifications] Failed to add tap listener:",n)}return()=>{e.forEach(n=>n()),Jm=!1}}function TR(t,e){Tu()&&wR.syncConfig({url:t,token:e}).catch(n=>{console.warn("[Notifications] Failed to sync config to native service:",n)})}window.__tideWsState||(window.__tideWsState={ws:null,isConnecting:!1,reconnectAttempts:0,reconnectTimeout:null});const bp=()=>window.__tideWsState.ws,Tk=t=>{window.__tideWsState.ws=t},ER=()=>window.__tideWsState.isConnecting,Mc=t=>{window.__tideWsState.isConnecting=t},bb=()=>window.__tideWsState.reconnectAttempts,xb=t=>{window.__tideWsState.reconnectAttempts=t},uj=()=>window.__tideWsState.reconnectTimeout,dj=t=>{window.__tideWsState.reconnectTimeout=t},Ek=10,ax="tide_ws_has_connected";function _k(){return sessionStorage.getItem(ax)==="true"}function _R(t){sessionStorage.setItem(ax,"true")}function MR(){sessionStorage.removeItem(ax)}let fj=null;const DR=t=>{fj=t},Mk=()=>fj,Pe={onToast:null,onAgentCreated:null,onAgentUpdated:null,onAgentDeleted:null,onAgentsSync:null,onAreasSync:null,onSpawnError:null,onSpawnSuccess:null,onToolUse:null,onDirectoryNotFound:null,onDelegation:null,onCustomClassesSync:null,onReconnect:null,onAgentNotification:null,onBuildingUpdated:null,onSubagentStarted:null,onSubagentCompleted:null};function pj(t){t.onToast&&(Pe.onToast=t.onToast),t.onAgentCreated&&(Pe.onAgentCreated=t.onAgentCreated),t.onAgentUpdated&&(Pe.onAgentUpdated=t.onAgentUpdated),t.onAgentDeleted&&(Pe.onAgentDeleted=t.onAgentDeleted),t.onAgentsSync&&(Pe.onAgentsSync=t.onAgentsSync),t.onAreasSync&&(Pe.onAreasSync=t.onAreasSync),t.onSpawnError&&(Pe.onSpawnError=t.onSpawnError),t.onSpawnSuccess&&(Pe.onSpawnSuccess=t.onSpawnSuccess),t.onToolUse&&(Pe.onToolUse=t.onToolUse),t.onDirectoryNotFound&&(Pe.onDirectoryNotFound=t.onDirectoryNotFound),t.onDelegation&&(Pe.onDelegation=t.onDelegation),t.onCustomClassesSync&&(Pe.onCustomClassesSync=t.onCustomClassesSync),t.onReconnect&&(Pe.onReconnect=t.onReconnect),t.onAgentNotification&&(Pe.onAgentNotification=t.onAgentNotification),t.onBuildingUpdated&&(Pe.onBuildingUpdated=t.onBuildingUpdated),t.onSubagentStarted&&(Pe.onSubagentStarted=t.onSubagentStarted),t.onSubagentCompleted&&(Pe.onSubagentCompleted=t.onSubagentCompleted)}function RR(){Pe.onToast=null,Pe.onAgentCreated=null,Pe.onAgentUpdated=null,Pe.onAgentDeleted=null,Pe.onAgentsSync=null,Pe.onAreasSync=null,Pe.onSpawnError=null,Pe.onSpawnSuccess=null,Pe.onToolUse=null,Pe.onDirectoryNotFound=null,Pe.onDelegation=null,Pe.onCustomClassesSync=null,Pe.onReconnect=null,Pe.onAgentNotification=null,Pe.onSubagentStarted=null,Pe.onSubagentCompleted=null}function OR(){Pe.onAgentCreated=null,Pe.onAgentUpdated=null,Pe.onAgentDeleted=null,Pe.onAgentsSync=null,Pe.onAreasSync=null,Pe.onToolUse=null,Pe.onDelegation=null,Pe.onCustomClassesSync=null,Pe.onBuildingUpdated=null,Pe.onSubagentStarted=null,Pe.onSubagentCompleted=null}const Yd=new Map,LR=new Map,yb={start(t){},end(t){},async measure(t,e){this.start(t);try{return await e()}finally{this.end(t)}},measureSync(t,e){this.start(t);try{return e()}finally{this.end(t)}},getMetrics(t){const e={},n=t?Yd.has(t)?[[t,Yd.get(t)]]:[]:Array.from(Yd.entries());for(const[s,a]of n){const r=[...a.samples].sort((f,h)=>f-h),i=Math.floor(r.length*.5),c=Math.floor(r.length*.95),d=Math.floor(r.length*.99);e[s]={count:a.count,avgMs:a.totalMs/a.count,minMs:a.minMs,maxMs:a.maxMs,lastMs:a.lastMs,p50Ms:r[i]||0,p95Ms:r[c]||0,p99Ms:r[d]||0}}return e},clear(){Yd.clear(),LR.clear()},report(){}};class PR{constructor(){et(this,"frames",[]);et(this,"lastFrameTime",0);et(this,"frameCount",0);et(this,"fps",0);et(this,"minFps",1/0);et(this,"maxFps",0);et(this,"fpsHistory",[]);et(this,"maxHistorySize",60)}tick(e=200){const n=performance.now();if(this.lastFrameTime>0){const s=n-this.lastFrameTime;s<e&&(this.frames.push(s),this.frames.length>60&&this.frames.shift())}this.lastFrameTime=n,this.frameCount++}update(){if(this.frames.length===0)return;const e=this.frames.reduce((n,s)=>n+s,0)/this.frames.length;this.fps=1e3/e,this.minFps=Math.min(this.minFps,this.fps),this.maxFps=Math.max(this.maxFps,this.fps),this.fpsHistory.push(this.fps),this.fpsHistory.length>this.maxHistorySize&&this.fpsHistory.shift()}getFPS(){return Math.round(this.fps)}getStats(){const e=this.fpsHistory.length>0?this.fpsHistory.reduce((n,s)=>n+s,0)/this.fpsHistory.length:this.fps;return{current:Math.round(this.fps),min:Math.round(this.minFps===1/0?0:this.minFps),max:Math.round(this.maxFps),avg:Math.round(e)}}reset(){this.frames=[],this.lastFrameTime=0,this.frameCount=0,this.fps=0,this.minFps=1/0,this.maxFps=0,this.fpsHistory=[]}}const Kd=new PR;class IR{constructor(){et(this,"snapshots",[]);et(this,"maxSnapshots",120);et(this,"intervalId",null);et(this,"leakThresholdMB",50);et(this,"baselineUsedMB",0)}getUsage(){const e=performance.memory;return e?{usedMB:Math.round(e.usedJSHeapSize/1024/1024),totalMB:Math.round(e.totalJSHeapSize/1024/1024),limitMB:Math.round(e.jsHeapSizeLimit/1024/1024)}:null}log(){const e=this.getUsage();e&&console.log(`[Memory] Used: ${e.usedMB}MB / ${e.totalMB}MB (limit: ${e.limitMB}MB)`)}startMonitoring(e=1e3){if(this.intervalId)return;const n=this.getUsage();n&&(this.baselineUsedMB=n.usedMB),this.intervalId=setInterval(()=>{this.takeSnapshot()},e),console.log("[Memory] Monitoring started. Use memory.report() to see analysis.")}stopMonitoring(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null,console.log("[Memory] Monitoring stopped."))}takeSnapshot(){const e=this.getUsage();if(!e)return;const n={timestamp:Date.now(),heapUsedMB:e.usedMB,heapTotalMB:e.totalMB,heapLimitMB:e.limitMB};this.snapshots.push(n),this.snapshots.length>this.maxSnapshots&&this.snapshots.shift();const s=e.usedMB-this.baselineUsedMB;s>this.leakThresholdMB&&console.warn(`[Memory] Warning: Heap grew by ${s}MB since monitoring started (baseline: ${this.baselineUsedMB}MB, current: ${e.usedMB}MB)`)}getGrowthRate(){if(this.snapshots.length<10)return null;const e=this.snapshots[0],n=this.snapshots[this.snapshots.length-1],s=(n.timestamp-e.timestamp)/1e3/60;return s<.1?null:(n.heapUsedMB-e.heapUsedMB)/s}report(){const e=this.getUsage();if(!e){console.log("[Memory] Memory API not available (Chrome only)");return}console.group("%c[Memory Report]","color: #ff6600; font-weight: bold"),console.log(`Current: ${e.usedMB}MB / ${e.totalMB}MB (limit: ${e.limitMB}MB)`),console.log(`Baseline: ${this.baselineUsedMB}MB`),console.log(`Growth: ${e.usedMB-this.baselineUsedMB}MB since monitoring started`);const n=this.getGrowthRate();if(n!==null&&(console.log(`Growth Rate: ${n.toFixed(2)}MB/min`),n>5&&console.warn("POTENTIAL MEMORY LEAK: Growth rate exceeds 5MB/min")),this.snapshots.length>1){const s=Math.min(...this.snapshots.map(r=>r.heapUsedMB)),a=Math.max(...this.snapshots.map(r=>r.heapUsedMB));console.log(`Range: ${s}MB - ${a}MB (${a-s}MB variance)`)}console.groupEnd()}getThreeJsInfo(e){var n;return(n=e==null?void 0:e.info)!=null&&n.memory?{geometries:e.info.memory.geometries,textures:e.info.memory.textures}:null}reset(){this.snapshots=[];const e=this.getUsage();e&&(this.baselineUsedMB=e.usedMB),console.log("[Memory] Reset. New baseline:",this.baselineUsedMB,"MB")}}const Dc=new IR;function Yc(t,e,n,s,a,r){}function hj(t,e){b.useRef(0),b.useEffect(()=>{},[t,5e3,!0])}if(typeof window<"u"){setInterval(()=>{try{performance.clearMarks(),performance.clearMeasures(),performance.clearResourceTimings()}catch{}},6e4);try{performance.setResourceTimingBufferSize(0)}catch{}}const vb=ft.PENDING_MESSAGES,BR=300*1e3;function mj(){try{const t=localStorage.getItem(vb);if(!t)return[];const e=JSON.parse(t),n=Date.now();return e.filter(s=>n-s.queuedAt<BR)}catch{return[]}}function gj(t){try{t.length===0?localStorage.removeItem(vb):localStorage.setItem(vb,JSON.stringify(t))}catch{}}function Qd(t){const e=mj();e.push({message:t,queuedAt:Date.now()}),gj(e)}function FR(){var s;const t=mj();if(t.length===0)return 0;let e=0;const n=[];for(const a of t)zR(a.message)?e++:n.push(a);if(gj(n),e>0){const a=e===1?"queued message":"queued messages";(s=Pe.onToast)==null||s.call(Pe,"success","Messages Sent",`${e} ${a} delivered after reconnecting.`)}return e}function rx(t){if(t.payload&&typeof t.payload=="object"){const e=t.payload;if(e.agentId)return e.agentId;if(e.parentAgentId)return e.parentAgentId;if(e.bossId)return e.bossId;if(e.id)return e.id}return null}function zR(t){const e=bp();if(!e||e.readyState!==WebSocket.OPEN)return!1;try{const n=JSON.stringify(t),s=rx(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",s,"payload:",t.payload),s&&hs.captureSent(s,n),e.send(n),!0}catch{return!1}}function ix(t){var n,s,a,r,i,c,d,f,h,m;const e=bp();if(!e)return(n=Mk())==null||n(),t.type==="send_command"?(Qd(t),(s=Pe.onToast)==null||s.call(Pe,"warning","Message Queued","Connection lost. Your message will be sent when reconnected.")):(a=Pe.onToast)==null||a.call(Pe,"error","Not Connected","Connecting to server... Please try again in a moment."),!1;if(e.readyState!==WebSocket.OPEN)return e.readyState===WebSocket.CONNECTING?t.type==="send_command"?(Qd(t),(r=Pe.onToast)==null||r.call(Pe,"warning","Message Queued","Still connecting. Your message will be sent automatically.")):(i=Pe.onToast)==null||i.call(Pe,"warning","Connecting...","WebSocket is still connecting. Please wait a moment and try again."):(e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING)&&((c=Mk())==null||c(),t.type==="send_command"?(Qd(t),(d=Pe.onToast)==null||d.call(Pe,"warning","Message Queued","Connection lost. Your message will be sent when reconnected.")):(f=Pe.onToast)==null||f.call(Pe,"warning","Reconnecting...","Connection lost. Reconnecting to server...")),!1;try{const x=JSON.stringify(t),y=rx(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",y,"payload:",t.payload),y&&hs.captureSent(y,x),e.send(x),!0}catch(x){return t.type==="send_command"?(Qd(t),(h=Pe.onToast)==null||h.call(Pe,"warning","Message Queued","Send failed. Your message will be retried when reconnected.")):(m=Pe.onToast)==null||m.call(Pe,"error","Send Failed",`Failed to send message: ${x}`),!1}}const Kc=new Set,$R=5e3;function Dk(t){if(!t.isDetached||!t.sessionId){Kc.delete(t.id);return}Kc.has(t.id)||(Kc.add(t.id),ix({type:"reattach_agent",payload:{agentId:t.id}}),setTimeout(()=>{Kc.delete(t.id)},$R))}function HR(t){var e,n,s,a,r,i,c,d,f,h,m,x,y,v,S,C,k,N,j,E,D,_,P,O;switch(yb.start(`ws:${t.type}`),t.type){case"agents_update":{const T=t.payload,M=T.filter(R=>R.class==="boss"||R.isBoss);M.length>0&&console.log("[WS agents_update] Boss agents received:",M.map(R=>({id:R.id,name:R.name,subordinateIds:R.subordinateIds}))),U.setAgents(T),(e=Pe.onAgentsSync)==null||e.call(Pe,T),U.loadToolHistory();for(const R of T)Dk(R);break}case"agent_created":{const T=t.payload;console.log("[WebSocket] Agent created:",T),U.addAgent(T);const M=(n=window.__spawnModalAreaContext)==null?void 0:n.areaId;M&&(U.assignAgentToArea(T.id,M),window.__spawnModalAreaContext=null),U.selectAgent(T.id),(s=Pe.onAgentCreated)==null||s.call(Pe,T),(a=Pe.onSpawnSuccess)==null||a.call(Pe),window.__spawnModalSuccess&&(console.log("[WebSocket] Calling __spawnModalSuccess"),window.__spawnModalSuccess()),(r=Pe.onToast)==null||r.call(Pe,"success","Agent Deployed",`${T.name} is ready for commands`);break}case"agent_updated":{const T=t.payload,R=U.getState().agents.get(T.id),I=(R==null?void 0:R.status)!==T.status;console.log(`[Tide] Agent updated: ${T.name} (${T.id}) status=${T.status} (was ${R==null?void 0:R.status})${I?" ⚡ STATUS CHANGED":""}`),I&&console.log(`[Tide] 🔔 Status change for ${T.name}: ${R==null?void 0:R.status} → ${T.status}`),I&&(R==null?void 0:R.status)==="working"&&T.status==="idle"&&U.triggerHistoryRefresh(T.id);const z=R?R.position.x!==T.position.x||R.position.z!==T.position.z:!1;U.updateAgent(T),Dk(T),(i=Pe.onAgentUpdated)==null||i.call(Pe,T,z);break}case"agent_deleted":{const{id:T}=t.payload;Kc.delete(T),U.removeAgent(T),(c=Pe.onAgentDeleted)==null||c.call(Pe,T);break}case"activity":{const T=t.payload;U.addActivity(T);break}case"event":{const T=t.payload;if(bu.debug(`Event: ${T.type}`,{agentId:T.agentId,toolName:T.toolName},"ws:event"),T.type==="tool_start"&&T.toolName&&((d=Pe.onToolUse)==null||d.call(Pe,T.agentId,T.toolName,T.toolInput),U.addToolExecution(T.agentId,T.toolName,T.toolInput),T.toolInput)){const M=T.toolInput.file_path||T.toolInput.path;M&&(T.toolName==="Write"?U.addFileChange(T.agentId,"created",M):T.toolName==="Edit"?U.addFileChange(T.agentId,"modified",M):T.toolName==="Read"&&U.addFileChange(T.agentId,"read",M))}break}case"output":{const T=t.payload;bu.debug(`Output: "${T.text.slice(0,80)}..."`,{agentId:T.agentId,isStreaming:T.isStreaming,length:T.text.length,hasSkillUpdate:!!T.skillUpdate,uuid:T.uuid,toolName:T.toolName},"ws:output"),U.addOutput(T.agentId,{text:T.text,isStreaming:T.isStreaming,timestamp:T.timestamp,isDelegation:T.isDelegation,skillUpdate:T.skillUpdate,subagentName:T.subagentName,uuid:T.uuid,toolName:T.toolName,toolInput:T.toolInput,toolOutput:T.toolOutput});break}case"context_stats":{const{agentId:T,stats:M}=t.payload;console.log(`[Tide] Received context stats for agent ${T}: ${M.usedPercent}% used`),U.updateAgentContextStats(T,M);break}case"context_update":{const{agentId:T,contextUsed:M,contextLimit:R}=t.payload;U.updateAgentContext(T,M,R);break}case"compacting_status":{const{agentId:T,active:M}=t.payload;U.setAgentCompacting(T,M);break}case"error":{const T=t.payload;console.error("[WebSocket] Error from server:",T.message),(f=Pe.onToast)==null||f.call(Pe,"error","Error",T.message),(h=Pe.onSpawnError)==null||h.call(Pe),window.__spawnModalError&&(console.log("[WebSocket] Calling __spawnModalError"),window.__spawnModalError());break}case"directory_not_found":{const{path:T}=t.payload;console.log("[WebSocket] Directory not found:",T),(m=Pe.onDirectoryNotFound)==null||m.call(Pe,T),window.__spawnModalDirNotFound&&(console.log("[WebSocket] Calling __spawnModalDirNotFound"),window.__spawnModalDirNotFound(T));break}case"command_started":{const{agentId:T,command:M}=t.payload,R=M.trim();if(R==="/context"||R==="/cost"||R==="/compact")break;U.addUserPromptToOutput(T,M);break}case"session_updated":{const{agentId:T}=t.payload;U.loadToolHistory(),U.triggerHistoryRefresh(T);const M=U.getState().agents.get(T);M&&U.updateAgent({...M});break}case"supervisor_report":{const T=t.payload;U.setSupervisorReport(T);break}case"narrative_update":{const{agentId:T,narrative:M}=t.payload;U.addNarrative(T,M);break}case"supervisor_status":{const T=t.payload;U.setSupervisorStatus(T);break}case"agent_supervisor_history":{const T=t.payload;U.setAgentSupervisorHistory(T);break}case"agent_analysis":{const{agentId:T,analysis:M}=t.payload;U.addAgentAnalysis(T,M);break}case"areas_update":{const T=t.payload;U.setAreasFromServer(T),(x=Pe.onAreasSync)==null||x.call(Pe);break}case"buildings_update":{const T=t.payload;U.setBuildingsFromServer(T);break}case"building_created":{const T=t.payload;U.addBuilding(T);break}case"building_updated":{const T=t.payload;U.updateBuildingFromServer(T),(y=Pe.onBuildingUpdated)==null||y.call(Pe,T);break}case"building_deleted":{const{id:T}=t.payload;U.removeBuildingFromServer(T);break}case"building_logs":{const{buildingId:T,logs:M}=t.payload;U.addBuildingLogs(T,M);break}case"pm2_logs_chunk":{const{buildingId:T,chunk:M}=t.payload;U.appendStreamingLogChunk(T,M);break}case"pm2_logs_streaming":{const{buildingId:T,streaming:M}=t.payload;U.setStreamingStatus(T,M);break}case"docker_logs_chunk":{const{buildingId:T,chunk:M}=t.payload;U.appendStreamingLogChunk(T,M);break}case"docker_logs_streaming":{const{buildingId:T,streaming:M}=t.payload;U.setStreamingStatus(T,M);break}case"docker_containers_list":{const{containers:T,composeProjects:M}=t.payload;console.log(`[WebSocket] Received ${T.length} containers, ${M.length} compose projects`),U.setDockerContainersList(T,M);break}case"boss_building_logs_chunk":{const{bossBuildingId:T,subordinateBuildingId:M,subordinateBuildingName:R,chunk:I,isError:z}=t.payload;U.appendBossStreamingLogChunk(T,M,R,I,z);break}case"boss_building_subordinates_updated":{const{bossBuildingId:T,subordinateBuildingIds:M}=t.payload;U.updateBuilding(T,{subordinateBuildingIds:M});break}case"permission_request":{const T=t.payload;U.addPermissionRequest(T);break}case"permission_resolved":{const{requestId:T,approved:M}=t.payload;U.resolvePermissionRequest(T,M);break}case"delegation_decision":{const T=t.payload;U.handleDelegationDecision(T),T.status==="sent"&&((v=Pe.onToast)==null||v.call(Pe,"info","Task Delegated",`Delegated to ${T.selectedAgentName}: ${T.reasoning.slice(0,80)}...`),T.bossId&&T.selectedAgentId&&((S=Pe.onDelegation)==null||S.call(Pe,T.bossId,T.selectedAgentId)));break}case"boss_subordinates_updated":{const{bossId:T,subordinateIds:M}=t.payload;U.updateBossSubordinates(T,M);break}case"delegation_history":{const{bossId:T,decisions:M}=t.payload;U.setDelegationHistory(T,M);break}case"session_history":{const{agentId:T,entries:M}=t.payload;U.setSessionHistory(T,M);break}case"boss_spawned_agent":{const{agent:T,bossPosition:M}=t.payload;console.log("[WebSocket] Boss spawned agent:",T.name,"- walking to boss at",M),U.addAgent(T),(C=Pe.onAgentCreated)==null||C.call(Pe,T),ix({type:"move_agent",payload:{agentId:T.id,position:M}}),(k=Pe.onToast)==null||k.call(Pe,"success","Agent Deployed",`${T.name} spawned by boss, walking to position`);break}case"agent_task_started":{const{bossId:T,subordinateId:M,subordinateName:R,taskDescription:I}=t.payload;console.log(`[WebSocket] Agent ${R} started task for boss ${T}: ${I.slice(0,50)}...`),U.handleAgentTaskStarted(T,M,R,I);break}case"agent_task_output":{const{bossId:T,subordinateId:M,output:R,isStreaming:I,timestamp:z,subagentName:W,toolName:$,toolInput:F,toolOutput:H}=t.payload;U.handleAgentTaskOutput(T,M,{text:R,isStreaming:I||!1,timestamp:z||Date.now(),subagentName:W,toolName:$,toolInput:F,toolOutput:H});break}case"agent_task_completed":{const{bossId:T,subordinateId:M,success:R}=t.payload;console.log(`[WebSocket] Agent task completed for boss ${T}, subordinate ${M}, success: ${R}`),U.handleAgentTaskCompleted(T,M,R);break}case"skills_update":{const T=t.payload;U.setSkillsFromServer(T);break}case"skill_created":{const T=t.payload;U.addSkillFromServer(T),console.log(`[WebSocket] Skill created: ${T.name}`);break}case"skill_updated":{const T=t.payload;U.updateSkillFromServer(T),console.log(`[WebSocket] Skill updated: ${T.name}`);break}case"skill_deleted":{const{id:T}=t.payload;U.removeSkillFromServer(T),console.log(`[WebSocket] Skill deleted: ${T}`);break}case"agent_skills":{const{agentId:T,skills:M}=t.payload;console.log(`[WebSocket] Agent ${T} has ${M.length} skills`);break}case"custom_agent_classes_update":{const T=t.payload;U.setCustomAgentClassesFromServer(T),console.log(`[WebSocket] Received ${T.length} custom agent classes`);const M=new Map;for(const R of T)M.set(R.id,R);(N=Pe.onCustomClassesSync)==null||N.call(Pe,M);break}case"custom_agent_class_created":{const T=t.payload;U.addCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class created: ${T.name}`),(j=Pe.onCustomClassesSync)==null||j.call(Pe,U.getState().customAgentClasses);break}case"custom_agent_class_updated":{const T=t.payload;U.updateCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class updated: ${T.name}`),(E=Pe.onCustomClassesSync)==null||E.call(Pe,U.getState().customAgentClasses);break}case"custom_agent_class_deleted":{const{id:T}=t.payload;U.removeCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class deleted: ${T}`),(D=Pe.onCustomClassesSync)==null||D.call(Pe,U.getState().customAgentClasses);break}case"global_usage":{const T=t.payload;console.log("[WebSocket] Global usage update:",T),U.setGlobalUsage(T);break}case"agent_notification":{const T=t.payload;console.log(`[WebSocket] Agent notification from ${T.agentName}: ${T.title}`),(_=Pe.onAgentNotification)==null||_.call(Pe,T);break}case"focus_agent":{const{agentId:T,openTerminal:M}=t.payload;if(!U.getState().agents.get(T)){console.warn(`[WebSocket] focus_agent ignored - agent not found: ${T}`);break}U.selectAgent(T),M&&U.setTerminalOpen(!0);const I=[0,80,220,500,1e3];for(const z of I)window.setTimeout(()=>{window.focus()},z);break}case"exec_task_started":{const{taskId:T,agentId:M,agentName:R,command:I,cwd:z}=t.payload;console.log(`[WebSocket] Exec task started: ${T} for agent ${R}: ${I.slice(0,50)}...`),U.handleExecTaskStarted(T,M,R,I,z);break}case"exec_task_output":{const{taskId:T,agentId:M,output:R,isError:I}=t.payload;U.handleExecTaskOutput(T,M,R,I);break}case"exec_task_completed":{const{taskId:T,agentId:M,exitCode:R,success:I}=t.payload;console.log(`[WebSocket] Exec task completed: ${T} for agent ${M}, success: ${I}`),U.handleExecTaskCompleted(T,M,R,I);break}case"subagent_started":{const T=t.payload;console.log(`[WebSocket] Subagent started: ${T.name} (${T.id}) for agent ${T.parentAgentId}`),U.addSubagent(T),(P=Pe.onSubagentStarted)==null||P.call(Pe,T);break}case"subagent_output":{const{subagentId:T,parentAgentId:M,text:R,timestamp:I}=t.payload,z=R.indexOf(":");if(z>0){const W=R.slice(0,z).trim(),$=R.slice(z+1).trim();U.addSubagentActivity(T,M,{toolName:W,description:$,timestamp:I})}else R.startsWith("Using ")&&U.addSubagentActivity(T,M,{toolName:R.slice(6).trim(),description:"",timestamp:I});break}case"subagent_completed":{const{subagentId:T,parentAgentId:M,success:R,resultPreview:I,subagentName:z,durationMs:W,tokensUsed:$,toolUseCount:F}=t.payload;console.log(`[WebSocket] Subagent completed: ${T} for agent ${M}, success: ${R}`),(W||$||F)&&U.updateSubagentStats(T,M,{durationMs:W||0,tokensUsed:$||0,toolUseCount:F||0}),U.completeSubagent(T,M,R),(O=Pe.onSubagentCompleted)==null||O.call(Pe,T);const H=U.getSubagent(T)||U.getSubagentByToolUseId(T),V=z||(H==null?void 0:H.name)||T,G=R?"✅":"❌",B=W?` (${(W/1e3).toFixed(0)}s · ${(($||0)/1e3).toFixed(1)}K tokens · ${F||0} tools)`:"";U.addOutput(M,{text:`${G} Subagent ${V} ${R?"completed":"failed"}${B}`,isStreaming:!1,timestamp:Date.now(),subagentName:V,toolOutput:I});break}case"subagent_stream":{const{toolUseId:T,parentAgentId:M,entries:R}=t.payload;U.addSubagentStreamEntries(T,M,R);break}case"secrets_update":{const T=t.payload;U.setSecretsFromServer(T),console.log(`[WebSocket] Received ${T.length} secrets`);break}case"secret_created":{const T=t.payload;U.addSecretFromServer(T),console.log(`[WebSocket] Secret created: ${T.name}`);break}case"secret_updated":{const T=t.payload;U.updateSecretFromServer(T),console.log(`[WebSocket] Secret updated: ${T.name}`);break}case"secret_deleted":{const{id:T}=t.payload;U.removeSecretFromServer(T),console.log(`[WebSocket] Secret deleted: ${T}`);break}case"database_connection_result":{const{buildingId:T,connectionId:M,success:R,error:I,serverVersion:z}=t.payload;U.setConnectionStatus(T,M,{connected:R,error:I,serverVersion:z}),console.log(`[WebSocket] Database connection ${R?"succeeded":"failed"}: ${M}`);break}case"databases_list":{const{buildingId:T,connectionId:M,databases:R}=t.payload;U.setDatabases(T,M,R),console.log(`[WebSocket] Received ${R.length} databases for ${M}`);break}case"tables_list":{const{buildingId:T,connectionId:M,database:R,tables:I}=t.payload;U.setTables(T,M,R,I),console.log(`[WebSocket] Received ${I.length} tables for ${R}`);break}case"table_schema":{const{buildingId:T,connectionId:M,database:R,table:I,columns:z,indexes:W,foreignKeys:$}=t.payload;U.setTableSchema(T,M,R,I,{columns:z,indexes:W||[],foreignKeys:$||[]}),console.log(`[WebSocket] Received schema for ${I}`);break}case"query_result":{const{buildingId:T,result:M}=t.payload;U.setQueryResult(T,M),console.log(`[WebSocket] Query ${M.status}: ${M.rowCount??M.affectedRows??0} rows in ${M.duration}ms`);break}case"silent_query_result":{const{buildingId:T,query:M,requestId:R,success:I,affectedRows:z,error:W}=t.payload;U.setSilentQueryResult(T,{query:M,requestId:R,success:I,affectedRows:z,error:W}),console.log(`[WebSocket] Silent query ${I?"succeeded":"failed"}: ${z??0} affected rows`);break}case"query_history_update":{const{buildingId:T,history:M}=t.payload;U.setQueryHistory(T,M),console.log(`[WebSocket] Received ${M.length} query history entries for ${T}`);break}}yb.end(`ws:${t.type}`)}DR(()=>xu());let Rk=!1;function bj(){const t=bp();t&&t.readyState===WebSocket.OPEN&&t.close(1e3,"Page unloading");const e=uj();e&&clearTimeout(e),window.__tideWsState&&(window.__tideWsState.ws=null,window.__tideWsState.reconnectTimeout=null,window.__tideWsState.isConnecting=!1,window.__tideWsState.reconnectAttempts=0),MR()}function UR(){Rk||(window.addEventListener("beforeunload",bj),Rk=!0)}function xj(){bj(),U.setConnected(!1),U.stopStatusPolling()}function WR(){xj(),xb(0),setTimeout(()=>xu(),100)}function xu(){UR();const t=uj();t&&(clearTimeout(t),dj(null));const e=bp();if(ER()||e&&e.readyState===WebSocket.CONNECTING)return;if(e&&e.readyState===WebSocket.OPEN){_k()&&Pe.onReconnect&&Pe.onReconnect();return}xb(bb()+1),Mc(!0);const n=tx(),s=Ni(),a=6200;let r;if(n){const c=n.replace(/^https:\/\//,"wss://").replace(/^http:\/\//,"ws://");r=c.endsWith("/ws")?c:`${c.replace(/\/$/,"")}/ws`}else r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;let i=null;try{s?i=new WebSocket(r,[`auth-${s}`]):i=new WebSocket(r)}catch{Mc(!1),Ok();return}Tk(i),i.onopen=()=>{var d,f,h;const c=_k();Mc(!1),xb(0),_R(),U.setConnected(!0),U.startStatusPolling(),U.clearAllPermissions(),c?((d=Pe.onToast)==null||d.call(Pe,"success","Reconnected","Connection restored - refreshing data..."),(f=Pe.onReconnect)==null||f.call(Pe)):(h=Pe.onToast)==null||h.call(Pe,"success","Connected","Connected to Tide Commander server"),TR(n,s),FR()},i.onmessage=c=>{try{const d=JSON.parse(c.data),f=rx(d);console.log("[AgentDebugger] RECEIVED - type:",d.type,"agentId:",f,"payload:",d.payload),f&&hs.captureReceived(f,c.data),HR(d)}catch(d){const f=c.data.substring(0,200);console.error("[WS] Failed to parse message:",d),console.error("[WS] Raw data (first 200 chars):",f),console.error("[WS] Full data length:",c.data.length),c.data.length<5e3&&console.error("[WS] Full malformed message:",c.data)}},i.onclose=()=>{var d,f;Mc(!1),Tk(null),U.setConnected(!1),U.stopStatusPolling();const c=bb();c<Ek?((d=Pe.onToast)==null||d.call(Pe,"warning","Disconnected",`Connection lost. Reconnecting... (attempt ${c+1}/${Ek})`),Ok()):(f=Pe.onToast)==null||f.call(Pe,"error","Connection Failed",`Could not connect to server. Please check if the backend is running on port ${a}.`)},i.onerror=()=>{Mc(!1)},U.setSendMessage(ix)}function Ok(){const t=bb(),e=Math.min(1e3*Math.pow(2,t-1),3e4);dj(setTimeout(xu,e))}function qR(t,e){const n={position:t,target:e};ya(ft.CAMERA_STATE,n)}function VR(){return ta(ft.CAMERA_STATE,null)}function Qq(t,e,n){const s={posX:t,posZ:e,zoom:n};ya(ft.CAMERA_STATE_2D,s)}function Xq(){return ta(ft.CAMERA_STATE_2D,null)}function Ml(){return{Authorization:`Bearer ${Ni()}`,"Content-Type":"application/json"}}async function GR(){const t=await fetch(`${Sa()}/api/workspaces`,{headers:Ml()});if(!t.ok)throw new Error(`Failed to fetch workspaces: ${t.statusText}`);return t.json()}async function YR(t,e){const n=await fetch(`${Sa()}/api/workspaces`,{method:"POST",headers:Ml(),body:JSON.stringify({name:t,areaIds:e})});if(!n.ok)throw new Error(`Failed to create workspace: ${n.statusText}`);return n.json()}async function Lk(t,e){const n=await fetch(`${Sa()}/api/workspaces/${t}`,{method:"PUT",headers:Ml(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to update workspace: ${n.statusText}`);return n.json()}async function KR(t){const e=await fetch(`${Sa()}/api/workspaces/${t}`,{method:"DELETE",headers:Ml()});if(!e.ok)throw new Error(`Failed to delete workspace: ${e.statusText}`)}async function QR(){const t=await fetch(`${Sa()}/api/workspaces/active`,{headers:Ml()});if(!t.ok)throw new Error(`Failed to get active workspace: ${t.statusText}`);return(await t.json()).activeWorkspaceId??null}async function Pk(t){const e=await fetch(`${Sa()}/api/workspaces/active`,{method:"PUT",headers:Ml(),body:JSON.stringify({workspaceId:t})});if(!e.ok)throw new Error(`Failed to set active workspace: ${e.statusText}`)}const yu=new Set;let Xa=null,to=[],yj=!1;const wb=new Set;function Zm(t){yj=t,wb.forEach(e=>e(t))}const vj="tide-commander-active-workspace";function Ik(){return typeof window>"u"?null:localStorage.getItem(vj)||null}function eg(t){typeof window>"u"||localStorage.setItem(vj,t||"")}function Rc(){yu.forEach(t=>t())}function XR(){return Xa}function xp(t){return Xa?t?Xa.areaIds.includes(t):!1:!0}function Jq(t){return Xa?Xa.areaIds.includes(t):!0}function ox(){const[,t]=b.useState(0);return b.useEffect(()=>{const e=()=>t(n=>n+1);return yu.add(e),()=>{yu.delete(e)}},[]),[Xa,to]}function JR(t){return yu.add(t),()=>{yu.delete(t)}}function ZR(){const[t,e]=b.useState(yj);return b.useEffect(()=>{const n=s=>e(s);return wb.add(n),()=>{wb.delete(n)}},[]),t}const tg=new Map,wj=Ce.memo(function(){const{t:e}=pt("common"),n=rr(),[s,a]=b.useState([]),[r,i]=b.useState(()=>Ik()),[c,d]=b.useState(!1),[f,h]=b.useState(!1),[m,x]=b.useState(!0),[y,v]=b.useState(null),[S,C]=b.useState(""),[k,N]=b.useState([]),[j,E]=b.useState(!1),D=b.useRef(null);b.useEffect(()=>{let $=!1;return(async()=>{try{const F=Ik(),[H,V]=await Promise.all([GR(),QR()]);if($)return;const G=F&&H.some(B=>B.id===F)?F:V&&H.some(B=>B.id===V)?V:null;a(H),to=H,i(G),eg(G),Xa=H.find(B=>B.id===G)??null,Rc()}catch(F){console.error("workspace error:",F)}finally{$||x(!1)}})(),()=>{$=!0}},[]),b.useEffect(()=>{if(!c&&!f)return;const $=F=>{D.current&&!D.current.contains(F.target)&&(d(!1),h(!1))};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[c,f]);const _=b.useMemo(()=>s.find($=>$.id===r)??null,[s,r]),P=b.useCallback(async $=>{Zm(!0);const F=Date.now();if(r){const B=VR();B&&(tg.set(r,B),Lk(r,{cameraState:B}).then(Q=>{a(K=>{const q=K.map(xe=>xe.id===r?Q:xe);return to=q,q})}).catch(Q=>console.error("workspace error:",Q)))}i($),eg($),d(!1);const H=$?s.find(B=>B.id===$)??null:null;if(Xa=H,to=s,Rc(),$){const Q=(H==null?void 0:H.cameraState)??tg.get($);Q&&(qR(Q.position,Q.target),tg.set($,Q))}Pk($).catch(B=>console.error("workspace error:",B));const V=Date.now()-F,G=400;V<G?setTimeout(()=>Zm(!1),G-V):Zm(!1)},[r,s]),O=b.useMemo(()=>Array.from(n.values()).filter($=>!$.archived),[n]),T=b.useCallback(async()=>{if(S.trim())try{const $=await YR(S.trim(),k),F=[...s,$];a(F),to=F,Rc(),C(""),N([]),E(!1)}catch($){console.error("workspace error:",$)}},[S,k,s]),M=b.useCallback(async()=>{if(!(!y||!S.trim()))try{const $=await Lk(y,{name:S.trim(),areaIds:k}),F=s.map(H=>H.id===y?$:H);a(F),to=F,y===r&&(Xa=$),Rc(),v(null),C(""),N([])}catch($){console.error("workspace error:",$)}},[y,S,k,s,r]),R=b.useCallback(async $=>{try{await KR($);const F=s.filter(H=>H.id!==$);a(F),to=F,r===$&&(i(null),eg(null),Xa=null,await Pk(null).catch(H=>console.error("workspace error:",H))),Rc()}catch(F){console.error("workspace error:",F)}},[s,r]),I=b.useCallback($=>{v($.id),C($.name),N([...$.areaIds]),E(!1)},[]),z=b.useCallback(()=>{v(null),C(""),N([]),E(!0)},[]),W=b.useCallback($=>{N(F=>F.includes($)?F.filter(H=>H!==$):[...F,$])},[]);return m?null:o.jsxs("div",{className:"workspace-switcher",ref:D,children:[o.jsxs("button",{className:"workspace-switcher-trigger",onClick:()=>{d(!c),h(!1)},title:"Workspaces",children:[o.jsx("span",{className:"workspace-switcher-icon",children:"📂"}),o.jsx("span",{className:"workspace-switcher-label",children:_?_.name:e("agentBar.allWorkspaces",{defaultValue:"All"})}),o.jsx("span",{className:"workspace-switcher-arrow",children:c?"▲":"▼"})]}),c&&!f&&o.jsxs("div",{className:"workspace-switcher-dropdown",children:[o.jsx("button",{className:`workspace-switcher-option ${r?"":"active"}`,onClick:()=>P(null),children:e("agentBar.allWorkspaces",{defaultValue:"All"})}),s.map($=>o.jsxs("button",{className:`workspace-switcher-option ${$.id===r?"active":""}`,onClick:()=>P($.id),children:[$.name,o.jsx("span",{className:"workspace-switcher-option-count",children:$.areaIds.length})]},$.id)),o.jsx("div",{className:"workspace-switcher-divider"}),o.jsxs("button",{className:"workspace-switcher-option workspace-switcher-manage",onClick:()=>h(!0),children:["⚙ ",e("agentBar.manageWorkspaces",{defaultValue:"Manage"})]})]}),f&&o.jsxs("div",{className:"workspace-switcher-dropdown workspace-switcher-manager",children:[o.jsxs("div",{className:"workspace-switcher-manager-header",children:[o.jsx("span",{children:e("agentBar.workspaces",{defaultValue:"Workspaces"})}),o.jsx("button",{className:"workspace-switcher-close",onClick:()=>h(!1),children:"×"})]}),o.jsx("div",{className:"workspace-switcher-manager-list",children:s.map($=>o.jsx("div",{className:"workspace-switcher-manager-item",children:y===$.id?o.jsxs("div",{className:"workspace-switcher-editor",children:[o.jsx("input",{type:"text",value:S,onChange:F=>C(F.target.value),className:"workspace-switcher-input",placeholder:"Workspace name",autoFocus:!0,onKeyDown:F=>{F.key==="Enter"&&M(),F.key==="Escape"&&v(null)}}),o.jsxs("div",{className:"workspace-switcher-area-list",children:[O.map(F=>o.jsxs("label",{className:"workspace-switcher-area-check",children:[o.jsx("input",{type:"checkbox",checked:k.includes(F.id),onChange:()=>W(F.id)}),o.jsx("span",{style:{color:F.color},children:F.name})]},F.id)),O.length===0&&o.jsx("span",{className:"workspace-switcher-empty",children:"No areas"})]}),o.jsxs("div",{className:"workspace-switcher-editor-actions",children:[o.jsx("button",{className:"workspace-switcher-btn-save",onClick:M,children:"Save"}),o.jsx("button",{className:"workspace-switcher-btn-cancel",onClick:()=>v(null),children:"Cancel"})]})]}):o.jsxs("div",{className:"workspace-switcher-manager-row",children:[o.jsx("span",{className:"workspace-switcher-manager-name",children:$.name}),o.jsxs("span",{className:"workspace-switcher-manager-count",children:[$.areaIds.length," areas"]}),o.jsx("button",{className:"workspace-switcher-btn-edit",onClick:()=>I($),title:"Edit",children:"✏"}),o.jsx("button",{className:"workspace-switcher-btn-delete",onClick:()=>R($.id),title:"Delete",children:"🗑"})]})},$.id))}),j?o.jsxs("div",{className:"workspace-switcher-editor workspace-switcher-create-form",children:[o.jsx("input",{type:"text",value:S,onChange:$=>C($.target.value),className:"workspace-switcher-input",placeholder:"New workspace name",autoFocus:!0,onKeyDown:$=>{$.key==="Enter"&&T(),$.key==="Escape"&&E(!1)}}),o.jsxs("div",{className:"workspace-switcher-area-list",children:[O.map($=>o.jsxs("label",{className:"workspace-switcher-area-check",children:[o.jsx("input",{type:"checkbox",checked:k.includes($.id),onChange:()=>W($.id)}),o.jsx("span",{style:{color:$.color},children:$.name})]},$.id)),O.length===0&&o.jsx("span",{className:"workspace-switcher-empty",children:"No areas"})]}),o.jsxs("div",{className:"workspace-switcher-editor-actions",children:[o.jsx("button",{className:"workspace-switcher-btn-save",onClick:T,children:"Create"}),o.jsx("button",{className:"workspace-switcher-btn-cancel",onClick:()=>E(!1),children:"Cancel"})]})]}):o.jsxs("button",{className:"workspace-switcher-option workspace-switcher-add",onClick:z,children:["+ ",e("agentBar.newWorkspace",{defaultValue:"New Workspace"})]})]})]})}),Uf="tide_webgl_active";typeof window<"u"&&(window.__tidePersistedScene===void 0&&(window.__tidePersistedScene=null),window.__tidePersistedCanvas===void 0&&(window.__tidePersistedCanvas=null),window.__tideWsConnected===void 0&&(window.__tideWsConnected=!1),window.__tideIsPageUnloading===void 0&&(window.__tideIsPageUnloading=!1));function yp(){return typeof window<"u"?window.__tidePersistedScene??null:null}function kj(){return typeof window<"u"?window.__tidePersistedCanvas??null:null}function eO(){return typeof window<"u"?window.__tideWsConnected??!1:!1}function vu(t){typeof window<"u"&&(window.__tidePersistedScene=t)}function ru(t){typeof window<"u"&&(window.__tidePersistedCanvas=t)}function Sj(t){typeof window<"u"&&(window.__tideWsConnected=t)}function tO(t){typeof window<"u"&&(window.__tideIsPageUnloading=t)}function nO(){sessionStorage.setItem(Uf,"true")}function Xd(t){tO(!0),sessionStorage.removeItem(Uf),xj(),RR(),window.__tideScene&&(window.__tideScene=null);const e=yp();e?(console.log("[App] Calling persistedScene.dispose()"),e.dispose(),vu(null)):console.log("[App] No persistedScene to dispose"),ru(null),Sj(!1);const n=document.getElementById("battlefield");n&&n.remove();const s=document.getElementById("app");s&&(s.innerHTML="")}function sO(){var a,r;if(window.__tideAppInitialized)return;if(window.__tideAppInitialized=!0,sessionStorage.getItem(Uf)==="true"&&console.log("[App] Detected unclean shutdown from previous session - forcing cleanup"),window.__tideScene){console.log("[App] Cleaning up stale __tideScene reference");try{(r=(a=window.__tideScene).dispose)==null||r.call(a)}catch{}window.__tideScene=null}const e=yp();if(e){console.log("[App] Cleaning up stale persistedScene");try{e.dispose()}catch{}vu(null)}const n=document.getElementById("battlefield"),s=kj();n&&n!==s&&n.remove(),sessionStorage.removeItem(Uf)}function aO(){typeof window>"u"||(sO(),window.addEventListener("pageshow",t=>{t.persisted&&(console.log("[App] Page restored from bfcache - cleaning up"),Xd(),window.location.reload())}),window.onunload=()=>Xd(),window.onbeforeunload=t=>{Xd()},window.addEventListener("pagehide",t=>{Xd(`pagehide (persisted=${t.persisted})`)}))}aO();const Bk={showTrees:!0,showBushes:!0,showHouse:!0,showLamps:!0,showGrass:!0,showClouds:!0,fogDensity:1,floorStyle:"metal",brightness:1,skyColor:null,battlefieldSize:50},Fk={saturation:2,roughness:.5,metalness:-1,emissiveBoost:0,envMapIntensity:1,wireframe:!1,colorMode:"normal"},zk={idleAnimation:"sit",workingAnimation:"sprint"},rO=0;function Cj(){const t={characterScale:2,scale2d:.7,scale3d:.7,show2DTaskLabels:!0,gridVisible:!1,timeMode:"day",terrain:Bk,modelStyle:Fk,animations:zk,fpsLimit:rO},e=ta(ft.CONFIG,null);if(e){const n=e.indicatorScale;return{characterScale:e.characterScale??t.characterScale,scale2d:e.scale2d??n??t.scale2d,scale3d:e.scale3d??n??t.scale3d,show2DTaskLabels:e.show2DTaskLabels??t.show2DTaskLabels,gridVisible:e.gridVisible??t.gridVisible,timeMode:e.timeMode??t.timeMode,terrain:{...Bk,...e.terrain},modelStyle:{...Fk,...e.modelStyle},animations:{...zk,...e.animations},fpsLimit:e.fpsLimit??t.fpsLimit}}return t}function iO(t){ya(ft.CONFIG,t)}function oO(){return typeof window>"u"?!0:window.matchMedia("(max-width: 768px)").matches}typeof window<"u"&&!window.__tideHmrRefreshListeners&&(window.__tideHmrRefreshListeners=new Set);function Aj(){console.log("[Tide HMR] Manual scene refresh triggered");const t=yp();if(t){try{t.dispose()}catch(n){console.warn("[Tide HMR] Error disposing scene:",n)}vu(null)}ru(null),window.__tideScene&&(window.__tideScene=null);const e=document.getElementById("battlefield");if(e){const n=e.getContext("webgl2")||e.getContext("webgl");if(n){const s=n.getExtension("WEBGL_lose_context");s&&s.loseContext()}}window.__tideHmrPendingSceneChanges=!1,window.location.reload()}typeof window<"u"&&(window.__tideHmrSceneRefresh=Aj);function lO({canvasRef:t,selectionBoxRef:e,viewMode:n,sceneMountKey:s=0,showToast:a,showAgentNotification:r,toolboxModal:i,contextMenu:c,setHoveredAgentPopup:d,setBuildingPopup:f,getBuildingPopup:h,openBuildingModal:m,openPM2LogsModal:x,openBossLogsModal:y,openDatabasePanel:v,onSceneLoadingChange:S}){const C=b.useRef(null),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),E=b.useRef(null);return b.useEffect(()=>{if(n!=="3d"){S==null||S(!1);return}if(!t.current||!e.current)return;let D=!1;S==null||S(!0);const _=yp(),O=kj()===t.current;function T(){var R,I,z,W,$,F,H,V;(R=C.current)==null||R.setOnToast(a),(I=C.current)==null||I.setOnBuildingClick((G,B)=>{U.selectBuilding(G);const Q=U.getState().buildings.get(G);(Q==null?void 0:Q.type)==="folder"&&Q.folderPath?U.openFileExplorer(Q.folderPath):(Q==null?void 0:Q.type)==="server"||(Q==null?void 0:Q.type)==="boss"||(Q==null?void 0:Q.type)==="database"?(k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f({buildingId:G,screenPos:B,fromClick:!0}),k.current=null},150)):m(G)}),(z=C.current)==null||z.setOnContextMenu((G,B,Q)=>{c.open(G,B,Q)}),(W=C.current)==null||W.setOnAgentHover(()=>{}),($=C.current)==null||$.setOnBuildingHover((G,B)=>{const Q=h();if(G&&B){const K=U.getState().buildings.get(G);((K==null?void 0:K.type)==="server"||(K==null?void 0:K.type)==="boss"||(K==null?void 0:K.type)==="database")&&!(Q!=null&&Q.fromClick)&&f({buildingId:G,screenPos:B,fromClick:!1})}else Q!=null&&Q.fromClick||f(null)}),(F=C.current)==null||F.setOnGroundClick(()=>{f(null)}),(H=C.current)==null||H.setOnAreaDoubleClick(G=>{U.selectArea(G),i.open()}),(V=C.current)==null||V.setOnBuildingDoubleClick(G=>{var Q;k.current&&(clearTimeout(k.current),k.current=null),f(null);const B=U.getState().buildings.get(G);(B==null?void 0:B.type)==="server"&&((Q=B.pm2)!=null&&Q.enabled)?x==null||x(G):(B==null?void 0:B.type)==="boss"?y==null||y(G):(B==null?void 0:B.type)==="database"?v==null||v(G):(B==null?void 0:B.type)==="folder"&&B.folderPath?U.openFileExplorer(B.folderPath):m(G)})}if(_)try{C.current=_,O?(console.log("[Tide] Reusing existing scene (StrictMode remount)"),_.ensureRenderLoopRunning()):(console.log("[Tide] Reattaching persisted scene to new canvas"),_.reattach(t.current,e.current),ru(t.current));const R=U.getState();_.syncAreas(),_.syncBuildings(),R.agents.size>0&&(console.log("[Tide] Re-syncing agents from store after remount:",R.agents.size),_.syncAgents(Array.from(R.agents.values()))),T()}catch(R){console.error("[Tide] Failed to reattach persisted 3D scene:",R),S==null||S(!1)}finally{j.current=requestAnimationFrame(()=>{E.current=requestAnimationFrame(()=>{S==null||S(!1),E.current=null}),j.current=null})}else{const R=t.current,I=e.current,z=async()=>{if(D){console.log("[Tide] Effect cleaned up before scene init, skipping"),S==null||S(!1);return}if(!R.isConnected||!I.isConnected){console.warn("[Tide] Canvas disconnected before initialization"),S==null||S(!1);return}(!R.clientWidth||!R.clientHeight)&&(console.log("[Tide] Canvas has no CSS dimensions, using window fallback"),R.style.width="100%",R.style.height="100%",R.offsetHeight),(!R.clientWidth||!R.clientHeight)&&(R.width=window.innerWidth,R.height=window.innerHeight),nO();try{const{SceneManager:W}=await vt(async()=>{const{SceneManager:H}=await import("./SceneManager-DggU0iAh.js");return{SceneManager:H}},__vite__mapDeps([6,4,3,1]));if(D){S==null||S(!1);return}const $=new W(R,I);C.current=$,vu($),ru(R);const F=Cj();$.setCharacterScale(F.characterScale),$.setScale3D(F.scale3d),$.setTimeMode(F.timeMode),$.setTerrainConfig(F.terrain),$.setFloorStyle(F.terrain.floorStyle,!0),$.setGridVisible(F.gridVisible),$.setAgentModelStyle(F.modelStyle),$.setIdleAnimation(F.animations.idleAnimation),$.setWorkingAnimation(F.animations.workingAnimation),$.setFpsLimit(F.fpsLimit),$.syncAreas(),$.syncBuildings(),$.loadCharacterModels().then(()=>{console.log("[Tide] Character models ready");const H=U.getState();H.customAgentClasses.size>0&&(console.log("[Tide] Applying custom classes from store:",H.customAgentClasses.size),$.setCustomAgentClasses(H.customAgentClasses)),H.agents.size>0&&(console.log("[Tide] Syncing agents from store:",H.agents.size),$.syncAgents(Array.from(H.agents.values()))),$.upgradeAgentModels()}).catch(H=>{console.warn("[Tide] Some models failed to load, using fallback:",H)}).finally(()=>{S==null||S(!1)}),T()}catch(W){console.error("[Tide] Failed to initialize 3D scene:",W),S==null||S(!1)}};N.current=requestAnimationFrame(()=>void z())}pj({onAgentCreated:R=>{var I,z,W;(I=C.current)==null||I.addAgent(R),(z=C.current)==null||z.refreshSelectionVisuals(),(W=window.__spawnModalSuccess)==null||W.call(window)},onAgentUpdated:(R,I)=>{var W;const z=U.getState().agents.get(R.id)||R;(W=C.current)==null||W.updateAgent(z,I)},onAgentDeleted:R=>{var I;(I=C.current)==null||I.removeAgent(R)},onAgentsSync:R=>{var z;const I=Array.from(U.getState().agents.values());(z=C.current)==null||z.syncAgents(I)},onAreasSync:()=>{var I,z;(I=C.current)==null||I.syncAreas();const R=Array.from(U.getState().agents.values());(z=C.current)==null||z.syncAgents(R)},onSpawnError:()=>{var R;(R=window.__spawnModalError)==null||R.call(window)},onSpawnSuccess:()=>{var R;(R=window.__spawnModalSuccess)==null||R.call(window)},onDirectoryNotFound:R=>{var I;(I=window.__spawnModalDirNotFound)==null||I.call(window,R)},onToolUse:(R,I,z)=>{var W;(W=C.current)==null||W.showToolBubble(R,I,z)},onDelegation:(R,I)=>{var z;(z=C.current)==null||z.showDelegationEffect(R,I)},onCustomClassesSync:R=>{var I,z;(I=C.current)==null||I.setCustomAgentClasses(R),(z=C.current)==null||z.upgradeAgentModels()},onBuildingUpdated:R=>{var I;(I=C.current)==null||I.updateBuilding(R)},onSubagentStarted:R=>{var I;(I=C.current)==null||I.addSubagentEffect(R.id,R.parentAgentId,R.name,R.subagentType)},onSubagentCompleted:R=>{var W;const I=U.getSubagent(R)||U.getSubagentByToolUseId(R),z=(I==null?void 0:I.id)||R;(W=C.current)==null||W.completeSubagentEffect(z),setTimeout(()=>{var $;($=C.current)==null||$.removeSubagentEffect(z)},3e4)}});const M=JR(()=>{if(C.current){C.current.syncAreas(),C.current.syncBuildings();const R=Array.from(U.getState().agents.values());C.current.syncAgents(R)}});return()=>{M(),D=!0,N.current!==null&&(cancelAnimationFrame(N.current),N.current=null),j.current!==null&&(cancelAnimationFrame(j.current),j.current=null),E.current!==null&&(cancelAnimationFrame(E.current),E.current=null),U.getState().viewMode!=="3d"&&oO()&&C.current&&(console.log("[Tide] 3D canvas unmounted - disposing scene to free memory"),OR(),C.current.dispose(),C.current=null,vu(null),ru(null))}},[n,s]),C}function cO({showToast:t,showAgentNotification:e}){b.useEffect(()=>{pj({onToast:t,onReconnect:()=>{U.triggerReconnect()},onAgentNotification:a=>{e(a)}}),eO()||(xu(),Sj(!0)),AR();let n;NR(a=>{a.type==="agent_notification"&&typeof a.agentId=="string"&&cj(a.agentId)}).then(a=>{n=a});const s=()=>{console.log("[Tide] App resumed from background, reconnecting..."),setTimeout(()=>xu(),100)};return window.addEventListener("tideAppResume",s),()=>{window.removeEventListener("tideAppResume",s),n==null||n()}},[t,e])}function uO(t){b.useEffect(()=>{let e="",n="",s=new Map;const a=r=>{var d;let i=!1;const c=new Map;for(const[f,h]of r){const x=`${h.position.x.toFixed(2)},${h.position.z.toFixed(2)},${h.status},${h.class},${h.isBoss},${((d=h.subordinateIds)==null?void 0:d.length)??0}`.split("").reduce((y,v)=>(y<<5)-y+v.charCodeAt(0),0);c.set(f,x),s.get(f)!==x&&(i=!0)}return c.size!==s.size&&(i=!0),{newVersion:c,changed:i}};return U.subscribe(()=>{var x;const r=U.getState(),i=Array.from(r.selectedAgentIds).sort().join(","),c=Array.from(r.selectedBuildingIds).sort().join(","),d=i!==e,f=c!==n,{newVersion:h,changed:m}=a(r.agents);(d||f||m)&&(e=i,n=c,s=h,(x=t.current)==null||x.refreshSelectionVisuals())})},[t])}function dO(t){b.useEffect(()=>{var s;(s=t.current)==null||s.syncAreas();let e=0,n=0;return U.subscribe(()=>{var c,d;const r=U.getState().areas;if(r.size!==e){e=r.size,n=Date.now(),(c=t.current)==null||c.syncAreas();return}let i=0;for(const[f,h]of r){let m=f.charCodeAt(0);m+=(h.width??0)+(h.height??0)+(h.radius??0),m+=Math.floor(h.center.x*100)+Math.floor(h.center.z*100),m+=(h.zIndex??0)*1e3;for(let x=0;x<h.name.length;x++)m+=h.name.charCodeAt(x);for(let x=0;x<h.color.length;x++)m+=h.color.charCodeAt(x);if(h.directoryGitCounts)for(const x of h.directoryGitCounts)m+=(x+1)*7;if(h.logo){m+=Math.floor((h.logo.opacity??.8)*1e3),m+=Math.floor(h.logo.width*100)+Math.floor(h.logo.height*100);for(let x=0;x<h.logo.position.length;x++)m+=h.logo.position.charCodeAt(x);if(h.logo.filename)for(let x=0;x<h.logo.filename.length;x++)m+=h.logo.filename.charCodeAt(x)}i^=m|0}i!==n&&(n=i,(d=t.current)==null||d.syncAreas())})},[t])}function fO(t){b.useEffect(()=>{var s;(s=t.current)==null||s.syncBuildings();let e=0,n=0;return U.subscribe(()=>{var c,d;const r=U.getState().buildings;if(r.size!==e){e=r.size,n=Date.now(),(c=t.current)==null||c.syncBuildings();return}let i=0;for(const[f,h]of r){i^=h.position.x*1e3+h.position.z|0,i^=(h.scale||1)*1e4|0;const m=`${h.style||""}${h.name}${h.status}${h.gitChangesCount||0}`;for(let x=0;x<m.length;x++)i=(i<<5)-i+m.charCodeAt(x)|0}i!==n&&(n=i,(d=t.current)==null||d.syncBuildings())})},[t])}function pO(t,e){b.useEffect(()=>{var n;(n=t.current)==null||n.highlightArea(e)},[t,e])}function hO(t,e){b.useEffect(()=>{var n;(n=t.current)==null||n.setPowerSaving(e)},[t,e])}function Bt(t,e,n,s,a={},r="global"){return{id:t,name:e,description:n,key:s,modifiers:a,enabled:!0,context:r}}const ng=[Bt("toggle-commander","Toggle Commander","Open/close Commander View","k",{ctrl:!0}),Bt("toggle-commander-tab","Toggle Commander (Tab)","Open/close Commander View with Tab","Tab",{}),Bt("spawn-agent","Spawn Agent","Open new agent spawn modal","n",{alt:!0}),Bt("select-agent-1","Select Agent 1","Select first agent","1",{ctrl:!0}),Bt("select-agent-2","Select Agent 2","Select second agent","2",{ctrl:!0}),Bt("select-agent-3","Select Agent 3","Select third agent","3",{ctrl:!0}),Bt("select-agent-4","Select Agent 4","Select fourth agent","4",{ctrl:!0}),Bt("select-agent-5","Select Agent 5","Select fifth agent","5",{ctrl:!0}),Bt("select-agent-6","Select Agent 6","Select sixth agent","6",{ctrl:!0}),Bt("select-agent-7","Select Agent 7","Select seventh agent","7",{ctrl:!0}),Bt("select-agent-8","Select Agent 8","Select eighth agent","8",{ctrl:!0}),Bt("select-agent-9","Select Agent 9","Select ninth agent","9",{ctrl:!0}),Bt("delete-selected","Delete Selected","Remove selected agents","Delete",{}),Bt("delete-selected-backspace","Delete Selected (Backspace)","Remove selected agents","Backspace",{}),Bt("deselect-all","Deselect All","Clear agent selection","Escape",{}),Bt("open-terminal","Open Terminal","Open terminal for selected agent","Space",{}),Bt("dashboard-selector-toggle","Dashboard Selector","Enable dashboard card selector",",",{}),Bt("dashboard-vim-left","Dashboard Left","Move dashboard selector left","h",{}),Bt("dashboard-vim-down","Dashboard Down","Move dashboard selector down","j",{}),Bt("dashboard-vim-up","Dashboard Up","Move dashboard selector up","k",{}),Bt("dashboard-vim-right","Dashboard Right","Move dashboard selector right","l",{}),Bt("next-agent","Next Agent","Select next agent on battlefield","l",{alt:!0}),Bt("prev-agent","Previous Agent","Select previous agent on battlefield","h",{alt:!0}),Bt("next-working-agent","Next Working Agent","Select next working agent on battlefield","l",{alt:!0,shift:!0}),Bt("prev-working-agent","Previous Working Agent","Select previous working agent on battlefield","h",{alt:!0,shift:!0}),Bt("next-message","Next Message","Navigate to next message in terminal","j",{alt:!0}),Bt("prev-message","Previous Message","Navigate to previous message in terminal","k",{alt:!0}),Bt("page-down-messages","Page Down Messages","Jump down 10 messages in terminal","d",{alt:!0,shift:!0}),Bt("page-up-messages","Page Up Messages","Jump up 10 messages in terminal","u",{alt:!0}),Bt("next-agent-terminal","Next Agent (Terminal)","Switch to next agent in terminal","l",{alt:!0}),Bt("prev-agent-terminal","Previous Agent (Terminal)","Switch to previous agent in terminal","h",{alt:!0}),Bt("activate-message","Activate Message","Click on interactive element in selected message","Space",{}),Bt("toggle-file-explorer","Toggle File Explorer","Open/close file explorer","e",{alt:!0}),Bt("file-explorer-close-tab","Close File Tab","Close active file tab in explorer","w",{alt:!0}),Bt("toggle-spotlight","Toggle Spotlight","Open/close global search","p",{alt:!0}),Bt("open-database","Open Database","Open last used database query builder","d",{alt:!0}),Bt("toggle-2d-view","Cycle View Mode","Cycle between 3D, 2D, and Dashboard views","2",{alt:!0}),Bt("clear-context","Clear Context","Clear context of the selected agent","c",{alt:!0,shift:!0}),Bt("commander-close","Close Commander","Close Commander View","Escape",{},"commander"),Bt("commander-vim-left","Navigate Left","Move focus left (Vim H)","h",{alt:!0},"commander"),Bt("commander-vim-down","Navigate Down","Move focus down (Vim J)","j",{alt:!0},"commander"),Bt("commander-vim-up","Navigate Up","Move focus up (Vim K)","k",{alt:!0},"commander"),Bt("commander-vim-right","Navigate Right","Move focus right (Vim L)","l",{alt:!0},"commander"),Bt("commander-expand","Expand/Collapse","Toggle agent expansion","o",{alt:!0},"commander"),Bt("commander-new-agent","New Agent","Open spawn form in commander","n",{alt:!0},"commander"),Bt("commander-next-tab","Next Tab","Switch to next area tab","Tab",{},"commander"),Bt("commander-prev-tab","Previous Tab","Switch to previous area tab","Tab",{shift:!0},"commander"),Bt("toolbox-close","Close Toolbox","Close Settings panel","Escape",{},"toolbox")];function kn(t,e){if(!e||!e.enabled)return!1;const{ctrl:n,alt:s,shift:a}=e.modifiers,r=n?t.ctrlKey||t.metaKey:!t.ctrlKey&&!t.metaKey,i=s?t.altKey:!t.altKey,c=a?t.shiftKey:!t.shiftKey;let d;if(n?d=(t.ctrlKey||t.metaKey)&&i&&c:d=r&&i&&c,!d)return!1;const f=e.key;if(f.length===1&&/^[a-zA-Z]$/.test(f)){const m=`Key${f.toUpperCase()}`;return t.code===m}if(f.length===1&&/^[0-9]$/.test(f)){const m=`Digit${f}`;return t.code===m}return f==="Space"||f===" "?t.code==="Space":t.key===f}function mO(t){return t===" "||t==="Space"?"space":(t.length===1,t.toLowerCase())}function gO(t){const e=t.trim().toLowerCase();if(e==="space")return"Space";if(e==="esc")return"Escape";if(e==="return")return"Enter";const n={escape:"Escape",enter:"Enter",tab:"Tab",backspace:"Backspace",delete:"Delete",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"};return n[e]?n[e]:e}function bO(t){if(!(t!=null&&t.key))return"";const e=[];return t.modifiers.ctrl&&e.push("ctrl"),t.modifiers.alt&&e.push("alt"),t.modifiers.shift&&e.push("shift"),t.modifiers.meta&&e.push("meta"),e.push(mO(t.key)),e.join("+")}function lx(t){if(!t)return null;const e=t.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(e.length===0)return null;const n=e[e.length-1],s={};for(const r of e.slice(0,-1))r==="ctrl"||r==="control"?s.ctrl=!0:r==="alt"||r==="option"?s.alt=!0:r==="shift"?s.shift=!0:(r==="meta"||r==="cmd"||r==="command")&&(s.meta=!0);const a=gO(n);return a?{key:a,modifiers:s}:null}function xO(t){const e=lx(t);return e?kb({key:e.key,modifiers:e.modifiers}):""}function yO(t,e){const n=lx(e);return n?kn(t,{key:n.key,modifiers:n.modifiers,enabled:!0}):!1}function kb(t){const e=[];if(t.modifiers.ctrl){const s=navigator.platform.toUpperCase().indexOf("MAC")>=0;e.push(s?"⌘":"Ctrl")}if(t.modifiers.alt){const s=navigator.platform.toUpperCase().indexOf("MAC")>=0;e.push(s?"⌥":"Alt")}t.modifiers.shift&&e.push("Shift"),t.modifiers.meta&&e.push("⌘");let n=t.key;return n===" "?n="Space":n.length===1&&(n=n.toUpperCase()),e.push(n),e.join("+")}function vO(t,e,n,s){return t.filter(a=>{if(a.id===n||!a.enabled||s&&a.context!=="global"&&a.context!==s)return!1;const r=h=>h===" "||h==="Space"?"Space":h.length===1?h.toLowerCase():h,i=r(a.key),c=r(e.key);if(i!==c)return!1;const d=a.modifiers,f=e.modifiers;return(d.ctrl||!1)===(f.ctrl||!1)&&(d.alt||!1)===(f.alt||!1)&&(d.shift||!1)===(f.shift||!1)&&(d.meta||!1)===(f.meta||!1)})}function wO({sceneRef:t,spawnModal:e,commanderModal:n,explorerModal:s,spotlightModal:a,deleteConfirmModal:r,onRequestBuildingDelete:i,onOpenDatabasePanel:c,onCloseDatabasePanel:d,databasePanelOpen:f}){b.useEffect(()=>{const h=m=>{var I,z,W,$,F;const x=U.getShortcuts(),y=m.target,v=y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.getAttribute("contenteditable")==="true"||!!y.closest(".cm-editor"),S=U.getState(),C=x.find(H=>H.id==="deselect-all");if(kn(m,C)){if(y.closest(".guake-bottom-terminal-embed"))return;if(Sf()){m.preventDefault();return}if(S.activeTool==="rectangle"||S.activeTool==="circle"){(I=t.current)==null||I.setDrawingTool(null),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(null);return}e.isOpen?e.close():S.terminalOpen?(U.setTerminalOpen(!1),document.activeElement instanceof HTMLElement&&document.activeElement.blur()):(U.deselectAll(),(z=t.current)==null||z.refreshSelectionVisuals())}for(let H=1;H<=9;H++){const V=x.find(G=>G.id===`select-agent-${H}`);if(kn(m,V)){m.preventDefault();const G=U.getState(),B=H-1,Q=Array.from(G.agents.keys());B<Q.length&&(U.selectAgent(Q[B]),(W=t.current)==null||W.refreshSelectionVisuals());return}}const k=x.find(H=>H.id==="spawn-agent");if(kn(m,k)){m.preventDefault(),e.open();return}const N=x.find(H=>H.id==="toggle-commander-tab");if(kn(m,N)&&!v){m.preventDefault(),n.toggle();return}const j=x.find(H=>H.id==="toggle-commander");if(kn(m,j)){m.preventDefault(),n.toggle();return}const E=x.find(H=>H.id==="toggle-file-explorer");if(kn(m,E)){m.preventDefault();const H=U.getState();if(s.isOpen||H.explorerFolderPath!==null||H.explorerAreaId!==null)s.close(),U.closeFileExplorer();else{const G=U.getLastExplorerState();if((G==null?void 0:G.type)==="folder")U.openFileExplorer(G.path);else if((G==null?void 0:G.type)==="area")if(H.areas.has(G.areaId))s.open(G.areaId);else{const B=Array.from(H.areas.values()).filter(Q=>Q.directories&&Q.directories.length>0);B.length>0&&s.open(B[0].id)}else{const B=Array.from(H.areas.values()).filter(Q=>Q.directories&&Q.directories.length>0);B.length>0&&s.open(B[0].id)}}return}if(m.altKey&&!m.ctrlKey&&!m.shiftKey&&!m.metaKey&&m.code==="KeyD"){if(m.preventDefault(),m.stopPropagation(),f){d();return}const H=localStorage.getItem("tide-commander-last-database-building"),V=U.getState();if(H){const G=V.buildings.get(H);if((G==null?void 0:G.type)==="database"){c(H);return}}for(const[G,B]of V.buildings)if(B.type==="database"){c(G);return}return}const D=x.find(H=>H.id==="toggle-spotlight");if(kn(m,D)||m.altKey&&!m.ctrlKey&&!m.metaKey&&m.code==="KeyP"){console.log("[useKeyboardShortcuts] Spotlight shortcut matched!",{spotlightShortcut:D,altKey:m.altKey,code:m.code}),m.preventDefault(),a.toggle();return}const _=x.find(H=>H.id==="toggle-2d-view");if(kn(m,_)){m.preventDefault();const H=U.getState().viewMode,V=H==="3d"?"2d":H==="2d"?"dashboard":"3d";U.setViewMode(V);return}const P=x.find(H=>H.id==="clear-context");if(kn(m,P)){m.preventDefault();const H=U.getState(),V=H.selectedAgentIds.size===1?Array.from(H.selectedAgentIds)[0]:null;V&&U.clearContext(V);return}const O=x.find(H=>H.id==="next-working-agent"),T=x.find(H=>H.id==="prev-working-agent");if((kn(m,O)||kn(m,T))&&!v){const H=U.getState();if(H.terminalOpen)return;const V=Array.from(H.agents.values());let G=V.filter(q=>H.agentsWithUnseenOutput.has(q.id));if(G.length===0&&(G=V.filter(q=>q.status==="working")),G.length===0)return;m.preventDefault();const B=H.selectedAgentIds.size===1?Array.from(H.selectedAgentIds)[0]:null,Q=B?G.findIndex(q=>q.id===B):-1;let K;kn(m,O)?K=Q===-1?0:(Q+1)%G.length:K=Q===-1?G.length-1:(Q-1+G.length)%G.length,U.selectAgent(G[K].id),($=t.current)==null||$.refreshSelectionVisuals();return}const M=x.find(H=>H.id==="delete-selected"),R=x.find(H=>H.id==="delete-selected-backspace");if((kn(m,M)||kn(m,R))&&!v){const H=U.getState();if(H.selectedAgentIds.size>0){m.preventDefault(),r.open();return}if(H.selectedBuildingIds.size>0){m.preventDefault(),i();return}return}if(!v){const H=Array.from(S.agents.values()).find(V=>{var B;const G=(B=V.shortcut)==null?void 0:B.trim();return G?yO(m,G):!1});if(H){m.preventDefault(),m.stopPropagation(),U.selectAgent(H.id),U.setTerminalOpen(!0),(F=t.current)==null||F.refreshSelectionVisuals();return}}};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[t,e,n,s,a,r,i,c,d,f])}function kO(){const[t,e]=b.useState(!1);return window.__tideSetBackNavModal=e,b.useEffect(()=>{if(window.__tideBackNavSetup){window.location.hash.includes("app")||(window.location.hash="#app");return}window.__tideBackNavSetup=!0,window.location.hash.includes("app")||(window.location.hash="#app");const s=()=>window.innerWidth<=768;let a=0;const r=()=>{var c;Date.now()-a<200||window.location.hash.includes("app")||(window.location.hash="#app",s()&&(Sf()||(c=window.__tideSetBackNavModal)==null||c.call(window,!0)))},i=()=>{var c;window.location.hash.includes("app")||(window.location.hash="#app"),window.location.hash==="#app"&&setTimeout(()=>{window.location.hash==="#app"&&!window.location.hash.includes("app2")&&(window.history.pushState(null,"","#app2"),window.history.pushState(null,"","#app"))},50),s()?Sf()?a=Date.now():(c=window.__tideSetBackNavModal)==null||c.call(window,!0):(Sf(),a=Date.now())};window.history.pushState(null,"","#app1"),window.history.pushState(null,"","#app2"),window.history.pushState(null,"","#app"),window.addEventListener("hashchange",r),window.addEventListener("popstate",i)},[]),{showBackNavModal:t,setShowBackNavModal:e,handleLeave:()=>{e(!1);const s=window.__tideHistoryDepth??2;window.history.go(-(s+1))}}}const sg="agent-order-change";function SO(t){const e=b.useMemo(()=>new Set(t.map(d=>d.id)),[t]),[n,s]=b.useState(()=>ta(ft.AGENT_ORDER,[]));b.useEffect(()=>{const d=f=>{s(f.detail)};return window.addEventListener(sg,d),()=>{window.removeEventListener(sg,d)}},[]);const a=b.useMemo(()=>{const d=n.filter(x=>e.has(x)),f=t.filter(x=>!d.includes(x.id)).map(x=>x.id),h=[...d,...f],m=new Map(t.map(x=>[x.id,x]));return h.map(x=>m.get(x)).filter(x=>x!==void 0)},[t,n,e]),r=b.useCallback(d=>{s(d),ya(ft.AGENT_ORDER,d),window.dispatchEvent(new CustomEvent(sg,{detail:d}))},[]),i=b.useCallback((d,f)=>{const h=a.map(x=>x.id),[m]=h.splice(d,1);h.splice(f,0,m),r(h)},[a,r]),c=b.useCallback(()=>{s([]),ya(ft.AGENT_ORDER,[])},[]);return b.useEffect(()=>{if(e.size===0)return;const d=n.filter(f=>e.has(f));d.length!==n.length&&r(d)},[e,n,r]),{orderedAgents:a,moveAgent:i,resetOrder:c}}function wa(t){const e=b.useRef(null),n=b.useCallback(a=>{e.current=a.target,a.target===a.currentTarget&&a.stopPropagation()},[]),s=b.useCallback(a=>{a.target===a.currentTarget&&e.current===a.currentTarget&&(a.stopPropagation(),t()),e.current=null},[t]);return{handleMouseDown:n,handleClick:s}}const CO=3e4;function AO(){const t=b.useRef(null);b.useEffect(()=>{const e=async()=>{var i,c;const n=U.getState(),s=new Map,a=new Map;for(const[d,f]of n.buildings){const h=f.folderPath||f.cwd;h&&(a.has(h)||a.set(h,[]),a.get(h).push(d))}for(const[d,f]of a)try{const h=await Lt(Mt(`/api/files/git-status?path=${encodeURIComponent(d)}`));if(!h.ok)continue;const x=((i=(await h.json()).files)==null?void 0:i.length)||0;s.set(d,x);for(const y of f){const v=U.getState().buildings.get(y);v&&v.gitChangesCount!==x&&U.updateBuildingLocal(y,{gitChangesCount:x})}}catch{}const r=new Map;for(const[d,f]of n.areas)f.archived||!f.directories||f.directories.forEach((h,m)=>{h&&(r.has(h)||r.set(h,[]),r.get(h).push({areaId:d,dirIndex:m}))});if(r.size!==0)for(const[d,f]of r)try{let h;if(s.has(d))h=s.get(d);else{const x=await Lt(Mt(`/api/files/git-status?path=${encodeURIComponent(d)}`));if(!x.ok)continue;h=((c=(await x.json()).files)==null?void 0:c.length)||0,s.set(d,h)}const m=new Map;for(const x of f)m.has(x.areaId)||m.set(x.areaId,[]),m.get(x.areaId).push({dirIndex:x.dirIndex,count:h});for(const[x,y]of m){const v=U.getState().areas.get(x);if(!v)continue;const S=v.directoryGitCounts?[...v.directoryGitCounts]:new Array(v.directories.length).fill(0);let C=!1;for(const{dirIndex:k,count:N}of y)S[k]!==N&&(S[k]=N,C=!0);C&&U.updateAreaLocal(x,{directoryGitCounts:S})}}catch{}};return e(),t.current=setInterval(e,CO),()=>{t.current&&(clearInterval(t.current),t.current=null)}},[])}const ag={historyLimit:500,hideCost:!0,showFPS:!1,powerSaving:!1,customAgentNames:[],experimental2DView:!1,experimentalVoiceAssistant:!1,experimentalTTS:!1,experimentalEchoPrompt:!1,externalEditorCommand:"",vibrationIntensity:1,tabTitle:"",tmuxMode:!1},$k=90,rg=["simple","chat","advanced"],Hk=55,Uk=20,Wk=95,jO=200,NO=12e4,TO=5,ea=new Map;function EO(t){const e=ea.get(t);e&&(ea.delete(t),ea.set(t,e))}function _O(){for(;ea.size>TO;){const t=ea.keys().next().value;if(t!==void 0)ea.delete(t);else break}}function MO(t){ea.delete(t)}function DO(t){return t.trim().replace(/\r\n/g,`
|
|
43
|
-
`)}function Sb(t,e){return`${t}:${DO(e)}`}function qk(t,e,n,s){if(t.uuid&&e.has(t.uuid))return!1;const a=t.isUserPrompt?"user":"assistant",r=Sb(a,t.text),i=t.timestamp||0,c=n.get(r);return c!==void 0&&Math.abs(i-c)<=NO?!1:i>s}function jj({selectedAgentId:t,hasSessionId:e,reconnectCount:n,historyRefreshTrigger:s,lastPrompts:a,outputScrollRef:r}){const[i,c]=b.useState([]),[d,f]=b.useState(!1),[h,m]=b.useState(!1),[x,y]=b.useState(0),[v,S]=b.useState(!1),[C,k]=b.useState(!1),[N,j]=b.useState(0),E=b.useRef(!0),D=b.useRef(0),_=b.useRef(0),P=b.useRef(!1),O=b.useRef(!1),T=b.useRef(null),M=b.useRef(!1),R=b.useRef(null),I=b.useRef(null);b.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]),b.useEffect(()=>{if(!t||!e){c([]),_.current=0,k(!1),O.current=!1,j(0),f(!1),m(!1),y(de=>de+1),M.current=!1,R.current=null;return}const V=`${t}:${n}:${s}`;if(R.current===V)return;const G=T.current!==null&&T.current!==t,B=n>0,Q=G||B,K=!G&&!M.current&&e;T.current=t,M.current=e,R.current=V;let q;if(B){const de=U.getOutputs(t);de.length>0&&(q=de.map(Z=>({...Z})))}I.current&&(clearTimeout(I.current),I.current=null),B&&ea.delete(t),D.current+=1;const xe=D.current;if(m(!0),!B){const de=ea.get(t);de?(EO(t),c(de.messages),_.current=de.messages.length,k(de.hasMore),O.current=de.hasMore,j(de.totalCount)):(c([]),_.current=0,k(!1),O.current=!1,j(0))}!K&&!B&&(I.current=setTimeout(()=>{f(!0)},150)),Lt(Mt(`/api/agents/${t}/history?limit=${$k}&offset=0`)).then(de=>{if(!de.ok)throw new Error(`HTTP ${de.status}: ${de.statusText}`);return de.json()}).then(de=>{if(xe!==D.current)return;const Z=Array.isArray(de.messages)?de.messages:[],be=Array.isArray(de.subagents)?de.subagents:[];c(Z),_.current=Z.length;const je=de.hasMore||!1;if(k(je),O.current=je,j(de.totalCount||0),be.length>0&&U.hydrateSubagentsFromHistory(t,be),ea.set(t,{messages:Z,hasMore:je,totalCount:de.totalCount||0}),_O(),q&&q.length>0){const ce=Z.length>0?Math.max(...Z.map(_e=>_e.timestamp?new Date(_e.timestamp).getTime():0)):0,Ee=new Set(Z.map(_e=>_e.uuid).filter(_e=>typeof _e=="string"&&_e.length>0)),ze=new Map;for(const _e of Z){if(_e.type!=="user"&&_e.type!=="assistant")continue;const me=Sb(_e.type,_e.content),De=_e.timestamp?new Date(_e.timestamp).getTime():0,te=ze.get(me)??0;De>te&&ze.set(me,De)}const Ge=q.filter(_e=>qk(_e,Ee,ze,ce));U.clearOutputs(t);for(const _e of Ge)U.addOutput(t,_e)}else if(Z.length>0){const ce=Math.max(...Z.map(me=>me.timestamp?new Date(me.timestamp).getTime():0)),Ee=new Set(Z.map(me=>me.uuid).filter(me=>typeof me=="string"&&me.length>0)),ze=new Map;for(const me of Z){if(me.type!=="user"&&me.type!=="assistant")continue;const De=Sb(me.type,me.content),te=me.timestamp?new Date(me.timestamp).getTime():0,He=ze.get(De)??0;te>He&&ze.set(De,te)}const Ge=U.getOutputs(t),_e=Ge.filter(me=>{const De=qk(me,Ee,ze,ce);return De||console.warn(`[HISTORY-DEDUP] Removing live output: uuid=${me.uuid||"none"} ts=${me.timestamp} lastHistTs=${ce} text="${me.text.slice(0,80)}"`),De});if(Ge.length!==_e.length){console.warn(`[HISTORY-DEDUP] Cleared ${Ge.length-_e.length}/${Ge.length} overlapping outputs for agent ${t}`),U.clearOutputs(t);for(const me of _e)U.addOutput(t,me)}}if(!a.get(t)){for(let ce=Z.length-1;ce>=0;ce--)if(Z[ce].type==="user"){U.setLastPrompt(t,Z[ce].content);break}}}).catch(de=>{if(console.error("Failed to load history:",de),c([]),_.current=0,k(!1),O.current=!1,j(0),Q&&q&&q.length>0){U.clearOutputs(t);for(const Z of q)U.addOutput(t,Z)}}).finally(()=>{E.current&&xe===D.current&&(I.current&&(clearTimeout(I.current),I.current=null),f(!1),m(!1),y(de=>de+1))})},[t,e,n,s]);const z=b.useCallback(async()=>{if(!t||P.current||!O.current)return;const V=r.current;if(!V){console.warn("loadMoreHistory: outputScrollRef not connected");return}const G=V.scrollHeight-V.scrollTop;P.current=!0,S(!0);const B=_.current;try{const K=await(await Lt(Mt(`/api/agents/${t}/history?limit=${$k}&offset=${B}`))).json(),q=Array.isArray(K.subagents)?K.subagents:[];if(q.length>0&&U.hydrateSubagentsFromHistory(t,q),K.messages&&K.messages.length>0){if(!E.current)return;c(de=>{const Z=[...K.messages,...de];return _.current=Z.length,Z});const xe=K.hasMore||!1;O.current=xe,k(xe),requestAnimationFrame(()=>{requestAnimationFrame(()=>{E.current&&(r.current&&(r.current.scrollTop=r.current.scrollHeight-G),P.current=!1,S(!1))})})}else{if(!E.current)return;P.current=!1,S(!1)}}catch(Q){if(console.error("Failed to load more history:",Q),!E.current)return;P.current=!1,S(!1)}},[t,r]),W=b.useCallback(V=>{if(!r.current||V.current)return;const{scrollTop:G}=r.current;!P.current&&O.current&&G<jO&&z()},[z,r]),$=b.useCallback(()=>{c([]),_.current=0,t&&ea.delete(t)},[t]),F=b.useRef(!1),H=b.useCallback(async()=>{var V,G;if(!(!t||!O.current)&&!(P.current||F.current)){F.current=!0,P.current=!0,S(!0);try{const Q=await(await Lt(Mt(`/api/agents/${t}/history?limit=100000&offset=0`))).json();if(!E.current)return;const K=Array.isArray(Q.subagents)?Q.subagents:[];K.length>0&&U.hydrateSubagentsFromHistory(t,K),Q.messages&&Q.messages.length>0&&(c(Q.messages),_.current=Q.messages.length),O.current=!1,k(!1),j(Q.totalCount||((V=Q.messages)==null?void 0:V.length)||0),ea.set(t,{messages:Q.messages||[],hasMore:!1,totalCount:Q.totalCount||((G=Q.messages)==null?void 0:G.length)||0})}catch(B){console.error("Failed to load all history:",B)}finally{E.current&&(P.current=!1,F.current=!1,S(!1))}}},[t]);return{history:i,loadingHistory:d,fetchingHistory:h,historyLoadVersion:x,loadingMore:v,hasMore:C,totalCount:N,isMountedRef:E,loadMoreHistory:z,loadAllHistory:H,allLoaded:!C,handleScroll:W,clearHistory:$,hasCachedHistory:b.useCallback(V=>ea.has(V),[])}}function Oc(...t){}function RO(t){return(t.tokensUsed??0)===0&&(t.contextUsed??0)===0&&!t.contextStats&&!t.sessionId&&!t.currentTask&&!t.lastAssignedTask}function Vk(t,e){var r,i;if(!t||RO(e))return e;const n=((r=t.contextStats)==null?void 0:r.lastUpdated)??0,s=((i=e.contextStats)==null?void 0:i.lastUpdated)??0;return n>0&&n>s?{...e,contextUsed:t.contextUsed,contextLimit:t.contextLimit,contextStats:t.contextStats}:e}function OO(t,e,n,s,a){return{setAgents(r){const i=new Map,c=t().agents;for(const f of r){const h=c.get(f.id);i.set(f.id,Vk(h,f)),(f.class==="boss"||f.isBoss)&&Oc("[Store.setAgents] Boss agent:",f.name,"subordinateIds:",f.subordinateIds)}const d=r.find(f=>f.status==="working");e(f=>{f.agents=i,d&&f.selectedAgentIds.size===0&&(f.selectedAgentIds=new Set([d.id]),f.terminalOpen=!0)}),n()},addAgent(r){e(i=>{const c=new Map(i.agents);c.set(r.id,r),i.agents=c}),n()},updateAgent(r){var v;const c=t().agents.get(r.id);let d=r;const f=r.trackingStatus,h=f!=null&&f!=="working";(c==null?void 0:c.status)!=="working"&&r.status==="working"&&!h&&(d={...r,trackingStatus:"working",trackingStatusDetail:void 0,trackingStatusTimestamp:r.trackingStatusTimestamp??Date.now()});const x=(c==null?void 0:c.status)!==d.status;x&&Oc(`[Store] Agent ${d.name} status update: ${c==null?void 0:c.status} → ${d.status}`);let y=!1;e(S=>{const C=new Map(S.agents);C.set(d.id,Vk(c,d)),S.agents=C,x&&(c==null?void 0:c.status)==="working"&&d.status==="idle"&&(S.terminalOpen&&S.selectedAgentIds.has(d.id)||(S.agentsWithUnseenOutput=new Set(S.agentsWithUnseenOutput),S.agentsWithUnseenOutput.add(d.id),Oc(`[Store] Agent ${d.name} completed work - marked as unseen`),y=!0))}),y&&a&&a(),n(),x&&Oc(`[Store] Agent ${d.name} status now in store: ${(v=t().agents.get(d.id))==null?void 0:v.status}`)},updateAgentContextStats(r,i){const d=t().agents.get(r);d&&(e(f=>{const h=new Map(f.agents);h.set(r,{...d,contextStats:i,contextUsed:i.totalTokens,contextLimit:i.contextWindow}),f.agents=h}),n())},updateAgentContext(r,i,c){const f=t().agents.get(r);if(f){const h=Math.max(1,c||2e5),m=Math.max(0,Math.min(100,Number((i/h*100).toFixed(1))));e(x=>{const y=new Map(x.agents),v=f.contextStats?{...f.contextStats,totalTokens:i,contextWindow:h,usedPercent:m,lastUpdated:Date.now()}:void 0;y.set(r,{...f,contextUsed:i,contextLimit:h,contextStats:v}),x.agents=y}),n()}},removeAgent(r){const i=t().agentsWithUnseenOutput.has(r);e(c=>{const d=new Map(c.agents);d.delete(r),c.agents=d;const f=new Set(c.selectedAgentIds);f.delete(r),c.selectedAgentIds=f,c.agentOutputs.delete(r),c.lastPrompts.delete(r),c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r)),c.delegationHistories.delete(r),c.lastDelegationReceived.delete(r),c.agentTaskProgress.delete(r),c.supervisor.narratives.delete(r),c.supervisor.agentHistories.delete(r),c.supervisor.historyFetchedForAgents.delete(r),c.subagents.delete(r)}),MO(r),i&&a&&a(),n()},selectAgent(r){let i=!1;e(c=>{c.selectedAgentIds=new Set(r?[r]:[]),r&&(c.lastSelectedAgentId=r,c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r),i=!0)),c.currentSnapshot=null}),i&&a&&a(),n()},addToSelection(r){let i=!1;e(c=>{const d=new Set(c.selectedAgentIds);d.has(r)?d.delete(r):(d.add(r),c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r),i=!0)),c.selectedAgentIds=d}),i&&a&&a(),n()},selectMultiple(r){e(i=>{i.selectedAgentIds=new Set(r)}),n()},deselectAll(){e(r=>{r.selectedAgentIds=new Set}),n()},spawnAgent(r,i,c,d,f,h,m,x,y,v,S,C,k,N,j){Oc("[Store] spawnAgent called with:",{name:r,agentClass:i,cwd:c,position:d,sessionId:f,useChrome:h,permissionMode:m,initialSkillIds:x,provider:y,codexConfig:v,codexModel:S,model:C,effort:N,opencodeModel:j,customInstructions:k?`${k.length} chars`:void 0});const E=d?{x:d.x,y:0,z:d.z}:void 0,D={type:"spawn_agent",payload:{name:r,class:i,cwd:c,position:E,sessionId:f,useChrome:h,permissionMode:m,initialSkillIds:x,provider:y,codexConfig:v,codexModel:S,opencodeModel:j,model:C,effort:N,customInstructions:k}},_=s();if(!_){console.error("[Store] sendMessage is not defined! WebSocket may not be connected");return}_(D)},createDirectoryAndSpawn(r,i,c){var d;(d=s())==null||d({type:"create_directory",payload:{path:r,name:i,class:c}})},sendCommand(r,i){var c;e(d=>{d.lastPrompts.set(r,{text:i,timestamp:Date.now()})}),n(),(c=s())==null||c({type:"send_command",payload:{agentId:r,command:i}})},refreshAgentContext(r){var i;(i=s())==null||i({type:"request_context_stats",payload:{agentId:r}})},moveAgentLocal(r,i){const d=t().agents.get(r);d&&(e(f=>{const h={...d,position:i},m=new Map(f.agents);m.set(r,h),f.agents=m}),n())},moveAgent(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d,position:i},x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"move_agent",payload:{agentId:r,position:i}})},killAgent(r){var i;(i=s())==null||i({type:"kill_agent",payload:{agentId:r}})},stopAgent(r){var i;(i=s())==null||i({type:"stop_agent",payload:{agentId:r}})},clearContext(r){var i;(i=s())==null||i({type:"clear_context",payload:{agentId:r}}),e(c=>{const d=c.agents.get(r);if(d){const y={...d,status:"idle",currentTask:void 0,taskLabel:void 0,trackingStatus:void 0,trackingStatusDetail:void 0,trackingStatusTimestamp:void 0,currentTool:void 0,lastAssignedTask:void 0,lastAssignedTaskTime:void 0,sessionId:void 0,tokensUsed:0,contextUsed:0,contextStats:void 0},v=new Map(c.agents);v.set(r,y),c.agents=v}const f=new Map(c.agentOutputs);f.delete(r),c.agentOutputs=f;const h=new Map(c.lastPrompts);h.delete(r),c.lastPrompts=h;const m=new Map(c.subagents);let x=!1;for(const[y,v]of m)v.parentAgentId===r&&(m.delete(y),x=!0);x&&(c.subagents=m)}),n()},restoreSession(r,i){var c;(c=s())==null||c({type:"restore_session",payload:{agentId:r,sessionId:i}}),e(d=>{const f=d.agents.get(r);if(f){const x={...f,status:"idle",currentTask:void 0,taskLabel:void 0,currentTool:void 0,sessionId:i,tokensUsed:0,contextUsed:0,contextStats:void 0},y=new Map(d.agents);y.set(r,x),d.agents=y}const h=new Map(d.agentOutputs);h.delete(r),d.agentOutputs=h;const m=new Map(d.lastPrompts);m.delete(r),d.lastPrompts=m}),n()},requestSessionHistory(r){var i;(i=s())==null||i({type:"request_session_history",payload:{agentId:r}})},setSessionHistory(r,i){e(c=>{const d=new Map(c.sessionHistories);d.set(r,i),c.sessionHistories=d}),n()},getSessionHistory(r){return t().sessionHistories.get(r)||[]},collapseContext(r){var i;(i=s())==null||i({type:"collapse_context",payload:{agentId:r}})},removeAgentFromServer(r){var i;(i=s())==null||i({type:"remove_agent",payload:{agentId:r}})},renameAgent(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d,name:i},x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"rename_agent",payload:{agentId:r,name:i}})},updateAgentProperties(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d};i.class!==void 0&&(m.class=i.class),i.permissionMode!==void 0&&(m.permissionMode=i.permissionMode),i.model!==void 0&&(m.model=i.model),i.effort!==void 0&&(m.effort=i.effort),i.provider!==void 0&&(m.provider=i.provider),i.codexConfig!==void 0&&(m.codexConfig=i.codexConfig),i.codexModel!==void 0&&(m.codexModel=i.codexModel),i.opencodeModel!==void 0&&(m.opencodeModel=i.opencodeModel),i.useChrome!==void 0&&(m.useChrome=i.useChrome),i.cwd!==void 0&&(m.cwd=i.cwd),i.shortcut!==void 0&&(m.shortcut=i.shortcut);const x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"update_agent_properties",payload:{agentId:r,updates:i}}),i.shortcut!==void 0&&Lt(Mt(`/api/agents/${r}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({shortcut:i.shortcut})}).catch(h=>{console.error("[Store] Failed to persist agent shortcut",h)})},getTotalTokens(){let r=0;for(const i of t().agents.values())r+=i.tokensUsed;return r},getSelectedAgents(){const r=t(),i=[];for(const c of r.selectedAgentIds){const d=r.agents.get(c);d&&i.push(d)}return i},addActivity(r){e(i=>{i.activities.unshift(r),i.activities.length>100&&i.activities.pop()}),n()},addToolExecution(r,i,c){const f=t().agents.get(r);e(h=>{h.toolExecutions.unshift({agentId:r,agentName:(f==null?void 0:f.name)||"Unknown",toolName:i,toolInput:c,timestamp:Date.now()}),h.toolExecutions.length>200&&h.toolExecutions.pop()}),n()},addFileChange(r,i,c){const f=t().agents.get(r);e(h=>{h.fileChanges.unshift({agentId:r,agentName:(f==null?void 0:f.name)||"Unknown",action:i,filePath:c,timestamp:Date.now()}),h.fileChanges.length>200&&h.fileChanges.pop()}),n()},async loadToolHistory(){try{const i=await(await Lt(Mt("/api/agents/tool-history?limit=100"))).json();e(c=>{i.toolExecutions&&(c.toolExecutions=i.toolExecutions),i.fileChanges&&(c.fileChanges=i.fileChanges)}),n()}catch(r){console.error("[Store] Failed to load tool history:",r)}}}}const Gk=200;function Yk(t){return t.length<=Gk?t:t.slice(-Gk)}function LO(t,e,n,s){return{addOutput(a,r){const i=s();e(c=>{const d=c.agentOutputs.get(a)||[];if(r.uuid&&d.some(x=>x.uuid===r.uuid))return;const f=Yk([...d,r]);bu.info(`Store: ${d.length} -> ${f.length}`,{agentId:a,text:r.text.slice(0,60),isStreaming:r.isStreaming,listeners:i},"store:addOutput");const h=new Map(c.agentOutputs);h.set(a,f),c.agentOutputs=h}),n()},clearOutputs(a){e(r=>{const i=new Map(r.agentOutputs);i.delete(a),r.agentOutputs=i}),n()},getOutputs(a){return t().agentOutputs.get(a)||[]},addUserPromptToOutput(a,r){this.addOutput(a,{text:r,isStreaming:!1,timestamp:Date.now(),isUserPrompt:!0})},getLastPrompt(a){return t().lastPrompts.get(a)},setLastPrompt(a,r){e(i=>{i.lastPrompts.set(a,{text:r,timestamp:Date.now()})}),n()},preserveOutputs(){const a=t(),r=new Map;for(const[i,c]of a.agentOutputs)r.set(i,c.map(d=>({...d})));return r},mergeOutputsWithHistory(a,r,i){let c=[...r,...i];return c.sort((d,f)=>d.timestamp-f.timestamp),c=Yk(c),e(d=>{const f=new Map(d.agentOutputs);f.set(a,c),d.agentOutputs=f}),n(),c}}}function PO(t,e,n,s){return{setSupervisorReport(a){e(r=>{r.supervisor.lastReport=a,r.supervisor.lastReportTime=a.timestamp;const i=new Map(r.supervisor.agentHistories);for(const c of a.agentSummaries){const d=i.get(c.agentId)||[],f={id:`${a.id}-${c.agentId}`,timestamp:a.timestamp,reportId:a.id,analysis:c};if(!d.some(h=>h.reportId===a.id)){const h=[f,...d];h.length>50&&h.pop(),i.set(c.agentId,h)}}r.supervisor.agentHistories=i,r.supervisor.generatingReport=!1}),n()},addNarrative(a,r){e(i=>{const c=i.supervisor.narratives.get(a)||[];c.unshift(r),c.length>50&&c.pop();const d=new Map(i.supervisor.narratives);d.set(a,c),i.supervisor.narratives=d}),n()},getNarratives(a){return t().supervisor.narratives.get(a)||[]},setSupervisorStatus(a){e(r=>{r.supervisor.enabled=a.enabled,a.autoReportOnComplete!==void 0&&(r.supervisor.autoReportOnComplete=a.autoReportOnComplete),r.supervisor.lastReportTime=a.lastReportTime,r.supervisor.nextReportTime=a.nextReportTime}),n()},setSupervisorConfig(a){var r;(r=s())==null||r({type:"set_supervisor_config",payload:a})},requestSupervisorReport(){var a;e(r=>{r.supervisor.generatingReport=!0}),n(),(a=s())==null||a({type:"request_supervisor_report",payload:{}})},requestAgentSupervisorHistory(a){var r;e(i=>{i.supervisor.loadingHistoryForAgent=a}),n(),(r=s())==null||r({type:"request_agent_supervisor_history",payload:{agentId:a}})},setAgentSupervisorHistory(a){e(r=>{const i=new Map(r.supervisor.agentHistories);i.set(a.agentId,a.entries),r.supervisor.agentHistories=i,r.supervisor.historyFetchedForAgents.add(a.agentId),r.supervisor.loadingHistoryForAgent===a.agentId&&(r.supervisor.loadingHistoryForAgent=null)}),n()},getAgentSupervisorHistory(a){return t().supervisor.agentHistories.get(a)||[]},addAgentAnalysis(a,r){e(i=>{const c=new Map(i.supervisor.agentHistories),d=c.get(a)||[],f={id:`single-${Date.now()}-${a}`,timestamp:Date.now(),reportId:`single-${Date.now()}`,analysis:r};if(!d.some(m=>Math.abs(m.timestamp-f.timestamp)<5e3&&m.analysis.statusDescription===r.statusDescription)){const m=[f,...d];m.length>50&&m.pop(),c.set(a,m),i.supervisor.agentHistories=c}}),n()},isLoadingHistoryForAgent(a){return t().supervisor.loadingHistoryForAgent===a},hasHistoryBeenFetched(a){return t().supervisor.historyFetchedForAgents.has(a)},setGlobalUsage(a){console.log("[Supervisor] setGlobalUsage called with:",a),e(r=>{r.supervisor.globalUsage=a,r.supervisor.refreshingUsage=!1}),n()},requestGlobalUsage(){console.log("[Supervisor] requestGlobalUsage called"),e(r=>{r.supervisor.refreshingUsage=!0}),n();const a=s();console.log("[Supervisor] sendMessage function:",a?"available":"null"),a?(console.log("[Supervisor] Sending request_global_usage message"),a({type:"request_global_usage",payload:{}})):console.warn("[Supervisor] Cannot send request_global_usage - no sendMessage function")},getGlobalUsage(){return t().supervisor.globalUsage}}}function IO(t,e,n,s){const a=()=>{var c;const i=Array.from(t().areas.values());(c=s())==null||c({type:"sync_areas",payload:i})},r=()=>{e(i=>{i.areas=new Map(i.areas)})};return{setActiveTool(i){e(c=>{c.activeTool=i,i!=="select"&&(c.selectedAreaId=null)}),n()},selectArea(i){e(c=>{c.selectedAreaId=i}),n()},addArea(i){if(i.zIndex===void 0||i.zIndex===null){const c=Array.from(t().areas.values()),d=c.length===0?-1:Math.max(...c.map(f=>f.zIndex??0));i.zIndex=d+1}e(c=>{c.areas.set(i.id,i)}),r(),a(),n()},updateArea(i,c){t().areas.get(i)&&(e(h=>{Object.assign(h.areas.get(i),c)}),r(),a(),n())},updateAreaLocal(i,c){t().areas.get(i)&&(e(h=>{Object.assign(h.areas.get(i),c)}),r(),n())},deleteArea(i){e(c=>{c.areas.delete(i),c.selectedAreaId===i&&(c.selectedAreaId=null)}),r(),a(),n()},assignAgentToArea(i,c){const f=t().areas.get(c);f&&!f.assignedAgentIds.includes(i)&&(e(h=>{for(const m of h.areas.values()){const x=m.assignedAgentIds.indexOf(i);x!==-1&&m.assignedAgentIds.splice(x,1)}h.areas.get(c).assignedAgentIds.push(i)}),r(),a(),n())},unassignAgentFromArea(i,c){const f=t().areas.get(c);if(f){const h=f.assignedAgentIds.indexOf(i);h!==-1&&(e(m=>{m.areas.get(c).assignedAgentIds.splice(h,1)}),r(),a(),n())}},addDirectoryToArea(i,c){const f=t().areas.get(i);f&&!f.directories.includes(c)&&(e(h=>{h.areas.get(i).directories.push(c)}),r(),a(),n())},removeDirectoryFromArea(i,c){const f=t().areas.get(i);if(f){const h=f.directories.indexOf(c);h!==-1&&(e(m=>{m.areas.get(i).directories.splice(h,1)}),r(),a(),n())}},getAreaDirectories(i){const c=t().areas.get(i);return(c==null?void 0:c.directories)||[]},isPositionInArea(i,c){if(c.type==="rectangle"&&c.width&&c.height){const d=c.width/2,f=c.height/2;return i.x>=c.center.x-d&&i.x<=c.center.x+d&&i.z>=c.center.z-f&&i.z<=c.center.z+f}else if(c.type==="circle"&&c.radius){const d=i.x-c.center.x,f=i.z-c.center.z;return d*d+f*f<=c.radius*c.radius}return!1},getAreaForAgent(i){const c=t(),d=c.agents.get(i);if(!d)return null;for(const f of c.areas.values())if(this.isPositionInArea({x:d.position.x,z:d.position.z},f))return f;return null},setAreasFromServer(i){e(c=>{const d=new Map;for(let f=0;f<i.length;f++){const h=i[f];if(!h.center||typeof h.center.x!="number"||typeof h.center.z!="number"||!h.type){console.error(`[Areas] Skipping malformed area "${(h==null?void 0:h.id)??(h==null?void 0:h.name)??"unknown"}": missing center or type`);continue}h.directories||(h.directories=[]),(h.zIndex===void 0||h.zIndex===null)&&(h.zIndex=f),h.archived===void 0&&(h.archived=!1),d.set(h.id,h)}c.areas=d}),n()},getAreasInZOrder(){return Array.from(t().areas.values()).sort((c,d)=>(c.zIndex??0)-(d.zIndex??0))},getNextZIndex(){const i=Array.from(t().areas.values());return i.length===0?0:Math.max(...i.map(d=>d.zIndex??0))+1},bringAreaToFront(i){const c=t(),d=c.areas.get(i);if(!d)return;const f=Array.from(c.areas.values()),h=f.length===0?-1:Math.max(...f.map(v=>v.zIndex??0)),m=h+1,x=d.zIndex??0,y=f.filter(v=>(v.zIndex??0)===h);x===h&&y.length===1||(e(v=>{v.areas.get(i).zIndex=m}),r(),a(),n())},sendAreaToBack(i){const c=t(),d=c.areas.get(i);if(!d)return;const f=Array.from(c.areas.values()),h=Math.min(...f.map(y=>y.zIndex??0)),m=d.zIndex??0,x=f.filter(y=>(y.zIndex??0)===h);m===h&&x.length===1||(e(y=>{for(const v of y.areas.values())v.id!==i&&(v.zIndex=(v.zIndex??0)+1);y.areas.get(i).zIndex=0}),r(),a(),n())},setAreaZIndex(i,c){t().areas.get(i)&&(e(h=>{h.areas.get(i).zIndex=c}),r(),a(),n())},archiveArea(i,c){const f=t().areas.get(i);if(!(!f||f.archived)){if(c)for(const h of f.assignedAgentIds)c(h);e(h=>{const m=h.areas.get(i);m.archived=!0,m.archivedAt=Date.now(),m.originalCenter={...m.center},h.selectedAreaId===i&&(h.selectedAreaId=null)}),r(),a(),n()}},restoreArchivedArea(i,c){const d=t(),f=d.areas.get(i);if(!f||!f.archived)return;const h=f.center,m=c||f.originalCenter||f.center,x=m.x-h.x,y=m.z-h.z,v=Array.from(d.areas.values()),C=(v.length===0?-1:Math.max(...v.map(k=>k.zIndex??0)))+1;e(k=>{const N=k.areas.get(i);if(N.archived=!1,N.archivedAt=void 0,N.center=m,N.zIndex=C,x!==0||y!==0)for(const j of N.assignedAgentIds){const E=k.agents.get(j);E&&(E.position={x:E.position.x+x,y:E.position.y,z:E.position.z+y})}}),r(),a(),n()},getArchivedAreas(){return Array.from(t().areas.values()).filter(i=>i.archived===!0)},getVisibleAreas(){return Array.from(t().areas.values()).filter(i=>!i.archived)},isAgentInArchivedArea(i){const c=t();for(const d of c.areas.values())if(d.archived&&d.assignedAgentIds.includes(i))return!0;return!1}}}const Nj="tide:bottom-pm2-log-retention",ig=5e3,BO=[1e3,2500,5e3,1e4,null];function Tj(){if(typeof window>"u")return ig;try{const t=window.localStorage.getItem(Nj);if(!t)return ig;if(t==="unlimited")return null;const e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}catch{}return ig}function FO(t){if(!(typeof window>"u"))try{window.localStorage.setItem(Nj,t===null?"unlimited":String(t))}catch{}}function Ej(t,e){if(!t||e===null)return t;const n=t.split(`
|
|
44
|
-
`);return n.length<=e?t:n.slice(-e).join(`
|
|
45
|
-
`)}function zO(t,e,n,s){const a=()=>{var c;const i=Array.from(t().buildings.values());(c=s())==null||c({type:"sync_buildings",payload:i})},r={selectBuilding(i){e(c=>{c.selectedBuildingIds.clear(),i&&c.selectedBuildingIds.add(i)}),n()},selectMultipleBuildings(i){e(c=>{c.selectedBuildingIds.clear();for(const d of i)c.selectedBuildingIds.add(d)}),n()},toggleBuildingSelection(i){e(c=>{c.selectedBuildingIds.has(i)?c.selectedBuildingIds.delete(i):c.selectedBuildingIds.add(i)}),n()},isBuildingSelected(i){return t().selectedBuildingIds.has(i)},getSelectedBuildingIds(){return Array.from(t().selectedBuildingIds)},deleteSelectedBuildings(){var c,d,f;const i=t();for(const h of i.selectedBuildingIds){const m=i.buildings.get(h);((c=m==null?void 0:m.pm2)!=null&&c.enabled||(d=m==null?void 0:m.docker)!=null&&d.enabled)&&((f=s())==null||f({type:"building_command",payload:{buildingId:h,command:"delete"}}))}e(h=>{const m=new Map(h.buildings);for(const x of h.selectedBuildingIds)m.delete(x);h.buildings=m,h.selectedBuildingIds.clear()}),a(),n()},addBuilding(i){e(c=>{const d=new Map(c.buildings);d.set(i.id,i),c.buildings=d}),a(),n()},updateBuilding(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,...c}),h.buildings=m}),a(),n())},updateBuildingLocal(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,...c}),h.buildings=m}),n())},deleteBuilding(i){var f,h,m;const d=t().buildings.get(i);((f=d==null?void 0:d.pm2)!=null&&f.enabled||(h=d==null?void 0:d.docker)!=null&&h.enabled)&&((m=s())==null||m({type:"building_command",payload:{buildingId:i,command:"delete"}})),e(x=>{const y=new Map(x.buildings);y.delete(i),x.buildings=y,x.selectedBuildingIds.delete(i)}),a(),n()},moveBuilding(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,position:c}),h.buildings=m}),a(),n())},updateBuildingPosition(i,c){r.moveBuilding(i,c)},createBuilding(i){const c={...i,id:`building_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,status:"stopped",createdAt:Date.now()};r.addBuilding(c)},sendBuildingCommand(i,c){var d;(d=s())==null||d({type:"building_command",payload:{buildingId:i,command:c}})},addBuildingLogs(i,c){e(d=>{const h=[...d.buildingLogs.get(i)||[],c];h.length>500&&h.splice(0,h.length-500);const m=new Map(d.buildingLogs);m.set(i,h),d.buildingLogs=m}),n()},getBuildingLogs(i){return t().buildingLogs.get(i)||[]},clearBuildingLogs(i){e(c=>{const d=new Map(c.buildingLogs);d.delete(i),c.buildingLogs=d}),n()},setBuildingsFromServer(i){e(c=>{const d=new Map;for(const f of i)d.set(f.id,f);c.buildings=d}),n()},updateBuildingFromServer(i){e(c=>{const d=new Map(c.buildings);d.set(i.id,i),c.buildings=d}),n()},removeBuildingFromServer(i){e(c=>{const d=new Map(c.buildings);d.delete(i),c.buildings=d,c.selectedBuildingIds.delete(i)}),n()},startLogStreaming(i,c=100){var f,h,m;const d=t().buildings.get(i);e(x=>{const y=new Map(x.streamingBuildingLogs);y.set(i,""),x.streamingBuildingLogs=y}),(f=d==null?void 0:d.docker)!=null&&f.enabled?(h=s())==null||h({type:"docker_logs_start",payload:{buildingId:i,lines:c}}):(m=s())==null||m({type:"pm2_logs_start",payload:{buildingId:i,lines:c}})},stopLogStreaming(i){var d,f,h;const c=t().buildings.get(i);(d=c==null?void 0:c.docker)!=null&&d.enabled?(f=s())==null||f({type:"docker_logs_stop",payload:{buildingId:i}}):(h=s())==null||h({type:"pm2_logs_stop",payload:{buildingId:i}})},appendStreamingLogChunk(i,c){e(d=>{const f=d.streamingBuildingLogs.get(i)||"",h=Tj(),m=Ej(f+c,h),x=new Map(d.streamingBuildingLogs);x.set(i,m),d.streamingBuildingLogs=x}),n()},setStreamingStatus(i,c){e(d=>{const f=new Set(d.streamingBuildingIds);c?f.add(i):f.delete(i),d.streamingBuildingIds=f}),n()},getStreamingLogs(i){return t().streamingBuildingLogs.get(i)||""},clearStreamingLogs(i){e(c=>{const d=new Map(c.streamingBuildingLogs);d.delete(i),c.streamingBuildingLogs=d}),n()},isLogStreaming(i){return t().streamingBuildingIds.has(i)},sendBossBuildingCommand(i,c){var d;(d=s())==null||d({type:"boss_building_command",payload:{buildingId:i,command:c}})},assignBuildingsToBoSS(i,c){var h;const f=t().buildings.get(i);f&&(e(m=>{const x=new Map(m.buildings);x.set(i,{...f,subordinateBuildingIds:c}),m.buildings=x}),a(),n()),(h=s())==null||h({type:"assign_buildings",payload:{bossBuildingId:i,subordinateBuildingIds:c}})},startBossLogStreaming(i,c=50){var d;e(f=>{const h=new Map(f.bossStreamingLogs);h.set(i,[]),f.bossStreamingLogs=h}),(d=s())==null||d({type:"boss_building_logs_start",payload:{buildingId:i,lines:c}})},stopBossLogStreaming(i){var c;(c=s())==null||c({type:"boss_building_logs_stop",payload:{buildingId:i}})},appendBossStreamingLogChunk(i,c,d,f,h){e(m=>{const x=m.bossStreamingLogs.get(i)||[],y={subordinateId:c,subordinateName:d,chunk:f,timestamp:Date.now(),isError:h},v=[...x,y];v.length>1e3&&v.splice(0,v.length-1e3);const S=new Map(m.bossStreamingLogs);S.set(i,v),m.bossStreamingLogs=S}),n()},getBossStreamingLogs(i){return t().bossStreamingLogs.get(i)||[]},clearBossStreamingLogs(i){e(c=>{const d=new Map(c.bossStreamingLogs);d.delete(i),c.bossStreamingLogs=d}),n()},requestDockerContainersList(){var i;(i=s())==null||i({type:"docker_list_containers",payload:{}})},setDockerContainersList(i,c){e(d=>{d.dockerContainersList=i,d.dockerComposeProjectsList=c}),n()},getDockerContainersList(){return t().dockerContainersList},getDockerComposeProjectsList(){return t().dockerComposeProjectsList}};return r}function $O(t,e,n,s){return{addPermissionRequest(a){e(r=>{const i=new Map(r.permissionRequests);i.set(a.id,a),r.permissionRequests=i}),n()},resolvePermissionRequest(a,r){const c=t().permissionRequests.get(a);c&&(e(d=>{const f=new Map(d.permissionRequests);f.set(a,{...c,status:r?"approved":"denied"}),d.permissionRequests=f}),n(),setTimeout(()=>{e(d=>{const f=new Map(d.permissionRequests);f.delete(a),d.permissionRequests=f}),n()},2e3))},respondToPermissionRequest(a,r,i,c){var d;(d=s())==null||d({type:"permission_response",payload:{requestId:a,approved:r,reason:i,remember:c}})},getPendingPermissionsForAgent(a){return Array.from(t().permissionRequests.values()).filter(r=>r.agentId===a&&r.status==="pending")},clearAllPermissions(){e(a=>{a.permissionRequests=new Map}),n()}}}function HO(t,e,n,s){return{spawnBossAgent(a,r,i,c,d,f,h,m,x,y,v,S,C){var N;const k=c?{x:c.x,y:0,z:c.z}:void 0;(N=s())==null||N({type:"spawn_boss_agent",payload:{name:a,class:r,cwd:i,position:k,subordinateIds:d,useChrome:f,permissionMode:h,provider:m,codexConfig:x,codexModel:y,model:v,customInstructions:S,initialSkillIds:C}})},assignSubordinates(a,r){var i;(i=s())==null||i({type:"assign_subordinates",payload:{bossId:a,subordinateIds:r}})},removeSubordinate(a,r){var i;(i=s())==null||i({type:"remove_subordinate",payload:{bossId:a,subordinateId:r}})},sendBossCommand(a,r){var i;e(c=>{c.pendingDelegation={bossId:a,command:r}}),n(),(i=s())==null||i({type:"send_boss_command",payload:{bossId:a,command:r}})},requestDelegationHistory(a){var r;(r=s())==null||r({type:"request_delegation_history",payload:{bossId:a}})},handleDelegationDecision(a){e(r=>{var f;const i=new Map(r.delegationHistories),c=i.get(a.bossId)||[],d=c.findIndex(h=>h.id===a.id);if(d!==-1?c[d]=a:(c.unshift(a),c.length>100&&c.pop()),i.set(a.bossId,c),r.delegationHistories=i,a.status==="sent"&&a.selectedAgentId){const h=r.agents.get(a.bossId),m=new Map(r.lastDelegationReceived);m.set(a.selectedAgentId,{bossName:(h==null?void 0:h.name)||"Boss",taskCommand:a.userCommand,timestamp:Date.now()}),r.lastDelegationReceived=m}((f=r.pendingDelegation)==null?void 0:f.bossId)===a.bossId&&a.status!=="pending"&&(r.pendingDelegation=null)}),n()},setDelegationHistory(a,r){e(i=>{const c=new Map(i.delegationHistories);c.set(a,r),i.delegationHistories=c}),n()},getDelegationHistory(a){return t().delegationHistories.get(a)||[]},getLastDelegationReceived(a){return t().lastDelegationReceived.get(a)||null},clearLastDelegationReceived(a){t().lastDelegationReceived.has(a)&&(e(i=>{const c=new Map(i.lastDelegationReceived);c.delete(a),i.lastDelegationReceived=c}),n())},updateBossSubordinates(a,r){const c=t().agents.get(a);c&&(e(d=>{const f={...c,subordinateIds:r},h=new Map(d.agents);h.set(a,f),d.agents=h}),n())},getSubordinates(a){const r=t(),i=r.agents.get(a),c=(i==null?void 0:i.isBoss)===!0||(i==null?void 0:i.class)==="boss";return!i||!c||!i.subordinateIds?[]:i.subordinateIds.map(d=>r.agents.get(d)).filter(d=>d!==void 0)},isBossAgent(a){const r=t().agents.get(a);return(r==null?void 0:r.isBoss)===!0||(r==null?void 0:r.class)==="boss"},getBossForAgent(a){const r=t(),i=r.agents.get(a);return i!=null&&i.bossId&&r.agents.get(i.bossId)||null},getAvailableSubordinates(){return Array.from(t().agents.values()).filter(a=>a.class!=="boss")},handleAgentTaskStarted(a,r,i,c){e(d=>{const f=new Map(d.agentTaskProgress);let h=f.get(a);h||(h=new Map,f.set(a,h)),h.set(r,{agentId:r,agentName:i,taskDescription:c,status:"working",output:[],startedAt:Date.now()}),d.agentTaskProgress=f}),n()},handleAgentTaskOutput(a,r,i){e(c=>{const d=c.agentTaskProgress.get(a);if(!d)return;const f=d.get(r);if(!f)return;const h=200;let m=[...f.output,i];m.length>h&&(m=m.slice(-h));const x=new Map(c.agentTaskProgress),y=new Map(d);y.set(r,{...f,output:m}),x.set(a,y),c.agentTaskProgress=x}),n()},handleAgentTaskCompleted(a,r,i){e(c=>{const d=c.agentTaskProgress.get(a);if(!d)return;const f=d.get(r);if(!f)return;const h=f.output.length>20?f.output.slice(-20):f.output,m=new Map(c.agentTaskProgress),x=new Map(d);x.set(r,{...f,status:i?"completed":"failed",completedAt:Date.now(),output:h}),m.set(a,x),c.agentTaskProgress=m}),n()},getAgentTaskProgress(a){return t().agentTaskProgress.get(a)||new Map},clearAgentTaskProgress(a,r){e(i=>{if(r){const c=i.agentTaskProgress.get(a);if(c){const d=new Map(i.agentTaskProgress),f=new Map(c);f.delete(r),d.set(a,f),i.agentTaskProgress=d}}else{const c=new Map(i.agentTaskProgress);c.delete(a),i.agentTaskProgress=c}}),n()},clearAllSubordinatesContext(a){const i=t().agents.get(a),c=(i==null?void 0:i.isBoss)===!0||(i==null?void 0:i.class)==="boss";if(console.log("[Store] clearAllSubordinatesContext called:",{bossId:a,bossName:i==null?void 0:i.name,isBoss:c,subordinateIds:i==null?void 0:i.subordinateIds}),!i||!c||!i.subordinateIds||i.subordinateIds.length===0){console.log("[Store] clearAllSubordinatesContext: No boss or subordinates found, returning early");return}const d=s();console.log("[Store] clearAllSubordinatesContext: sendMessage available:",!!d);for(const f of i.subordinateIds)console.log("[Store] clearAllSubordinatesContext: Sending clear_context for subordinate:",f),d==null||d({type:"clear_context",payload:{agentId:f}});e(f=>{const h=new Map(f.agentOutputs);for(const m of i.subordinateIds||[])h.delete(m);f.agentOutputs=h}),n(),console.log("[Store] clearAllSubordinatesContext: Completed")}}}function UO(t,e,n,s){return{setSkillsFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.skills=i}),n()},addSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.set(a.id,a),r.skills=i}),n()},updateSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.set(a.id,a),r.skills=i}),n()},removeSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.delete(a),r.skills=i}),n()},getSkill(a){return t().skills.get(a)},getAllSkills(){return Array.from(t().skills.values())},getSkillsForAgent(a){const r=t(),i=r.agents.get(a);return i?Array.from(r.skills.values()).filter(c=>c.enabled?!!(c.assignedAgentIds.includes(a)||c.assignedAgentClasses.includes(i.class)):!1):[]},createSkill(a){var r;(r=s())==null||r({type:"create_skill",payload:a})},updateSkill(a,r){var i;(i=s())==null||i({type:"update_skill",payload:{id:a,updates:r}})},deleteSkill(a){var r;(r=s())==null||r({type:"delete_skill",payload:{id:a}})},assignSkillToAgent(a,r){var i;(i=s())==null||i({type:"assign_skill",payload:{skillId:a,agentId:r}})},unassignSkillFromAgent(a,r){var i;(i=s())==null||i({type:"unassign_skill",payload:{skillId:a,agentId:r}})},requestAgentSkills(a){var r;(r=s())==null||r({type:"request_agent_skills",payload:{agentId:a}})},setCustomAgentClassesFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.customAgentClasses=i}),n()},addCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.set(a.id,a),r.customAgentClasses=i}),n()},updateCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.set(a.id,a),r.customAgentClasses=i}),n()},removeCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.delete(a),r.customAgentClasses=i}),n()},getCustomAgentClass(a){return t().customAgentClasses.get(a)},getAllCustomAgentClasses(){return Array.from(t().customAgentClasses.values())},createCustomAgentClass(a){var r;(r=s())==null||r({type:"create_custom_agent_class",payload:a})},updateCustomAgentClass(a,r){var i;(i=s())==null||i({type:"update_custom_agent_class",payload:{id:a,updates:r}})},deleteCustomAgentClass(a){var r;(r=s())==null||r({type:"delete_custom_agent_class",payload:{id:a}})}}}function WO(t,e,n){return{handleExecTaskStarted(s,a,r,i,c){e(d=>{const f={taskId:s,agentId:a,agentName:r,command:i,cwd:c,status:"running",output:[],startedAt:Date.now()};d.execTasks||(d.execTasks=new Map),d.execTasks.set(s,f)}),n()},handleExecTaskOutput(s,a,r,i){e(c=>{var m;const d=(m=c.execTasks)==null?void 0:m.get(s);if(!d)return;const f=r.split(`
|
|
46
|
-
`),h=[...d.output];for(const x of f)x.length>0&&h.push(i?`[stderr] ${x}`:x);h.length>500&&h.splice(0,h.length-500),c.execTasks.set(s,{...d,output:h})}),n()},handleExecTaskCompleted(s,a,r,i){e(c=>{var f;const d=(f=c.execTasks)==null?void 0:f.get(s);d&&(d.status=i?"completed":"failed",d.exitCode=r,d.completedAt=Date.now())}),n()},async stopExecTask(s){try{return(await fetch(`/api/exec/tasks/${s}`,{method:"DELETE"})).ok?(e(r=>{var c;const i=(c=r.execTasks)==null?void 0:c.get(s);i&&i.status==="running"&&(i.status="failed",i.exitCode=-15,i.completedAt=Date.now(),i.output.push("[Task stopped by user]"))}),n(),!0):!1}catch(a){return console.error("Failed to stop exec task:",a),!1}},getExecTasks(s){const a=t();return a.execTasks?Array.from(a.execTasks.values()).filter(r=>r.agentId===s):[]},getAllExecTasks(){const s=t();return s.execTasks?Array.from(s.execTasks.values()):[]},getExecTask(s){var r;return(r=t().execTasks)==null?void 0:r.get(s)},clearCompletedExecTasks(s){e(a=>{if(a.execTasks)for(const[r,i]of a.execTasks.entries())i.agentId===s&&i.status!=="running"&&a.execTasks.delete(r)}),n()},clearAllExecTasks(s){e(a=>{if(a.execTasks)for(const[r,i]of a.execTasks.entries())i.agentId===s&&a.execTasks.delete(r)}),n()},removeExecTask(s){e(a=>{a.execTasks&&a.execTasks.delete(s)}),n()}}}function qO(t,e,n,s){return{setSecretsFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.secrets=i}),n()},addSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.set(a.id,a),r.secrets=i}),n()},updateSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.set(a.id,a),r.secrets=i}),n()},removeSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.delete(a),r.secrets=i}),n()},getSecret(a){return t().secrets.get(a)},getSecretByKey(a){return Array.from(t().secrets.values()).find(r=>r.key===a)},getAllSecrets(){return Array.from(t().secrets.values())},createSecret(a){var r;(r=s())==null||r({type:"create_secret",payload:a})},updateSecret(a,r){var i;(i=s())==null||i({type:"update_secret",payload:{id:a,updates:r}})},deleteSecret(a){var r;(r=s())==null||r({type:"delete_secret",payload:{id:a}})}}}function Kk(){return{connectionStatus:new Map,databases:new Map,tables:new Map,tableSchemas:new Map,queryResults:[],queryHistory:[],executingQuery:!1,activeConnectionId:null,activeDatabase:null,lastSilentQueryResult:null}}function VO(t,e,n,s){const a=i=>{t().databaseState.has(i)||e(d=>{const f=new Map(d.databaseState);f.set(i,Kk()),d.databaseState=f})};return{testDatabaseConnection(i,c){var d;(d=s())==null||d({type:"test_database_connection",payload:{buildingId:i,connectionId:c}})},setConnectionStatus(i,c,d){a(i),e(f=>{const h=f.databaseState.get(i);if(h){const m=new Map(h.connectionStatus);m.set(c,d);const x={...h,connectionStatus:m},y=new Map(f.databaseState);y.set(i,x),f.databaseState=y}}),n()},listDatabases(i,c){var d;(d=s())==null||d({type:"list_databases",payload:{buildingId:i,connectionId:c}})},setDatabases(i,c,d){a(i),e(f=>{const h=f.databaseState.get(i);if(h){const m=new Map(h.databases);m.set(c,d);const x={...h,databases:m},y=new Map(f.databaseState);y.set(i,x),f.databaseState=y}}),n()},listTables(i,c,d){var f;(f=s())==null||f({type:"list_tables",payload:{buildingId:i,connectionId:c,database:d}})},setTables(i,c,d,f){a(i);const h=`${c}:${d}`;e(m=>{const x=m.databaseState.get(i);if(x){const y=new Map(x.tables);y.set(h,f);const v={...x,tables:y},S=new Map(m.databaseState);S.set(i,v),m.databaseState=S}}),n()},getTableSchema(i,c,d,f){var h;(h=s())==null||h({type:"get_table_schema",payload:{buildingId:i,connectionId:c,database:d,table:f}})},setTableSchema(i,c,d,f,h){a(i);const m=`${c}:${d}:${f}`;e(x=>{const y=x.databaseState.get(i);if(y){const v=new Map(y.tableSchemas);v.set(m,h);const S={...y,tableSchemas:v},C=new Map(x.databaseState);C.set(i,S),x.databaseState=C}}),n()},executeQuery(i,c,d,f,h=1e3){var m;a(i),e(x=>{const y=x.databaseState.get(i);if(y){const v={...y,executingQuery:!0},S=new Map(x.databaseState);S.set(i,v),x.databaseState=S}}),n(),(m=s())==null||m({type:"execute_query",payload:{buildingId:i,connectionId:c,database:d,query:f,limit:h}})},executeSilentQuery(i,c,d,f,h){var m;(m=s())==null||m({type:"execute_query",payload:{buildingId:i,connectionId:c,database:d,query:f,limit:0,silent:!0,requestId:h}})},setSilentQueryResult(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,lastSilentQueryResult:{...c,timestamp:Date.now()}},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},setQueryResult(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h=[c,...f.queryResults].slice(0,20),m={...f,queryResults:h,executingQuery:!1},x=new Map(d.databaseState);x.set(i,m),d.databaseState=x}}),n()},setExecutingQuery(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,executingQuery:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},requestQueryHistory(i,c=100){var d;(d=s())==null||d({type:"request_query_history",payload:{buildingId:i,limit:c}})},setQueryHistory(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,queryHistory:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},toggleQueryFavorite(i,c){var d;(d=s())==null||d({type:"toggle_query_favorite",payload:{buildingId:i,queryId:c}})},deleteQueryFromHistory(i,c){var d;(d=s())==null||d({type:"delete_query_history",payload:{buildingId:i,queryId:c}})},clearQueryHistory(i){var c;(c=s())==null||c({type:"clear_query_history",payload:{buildingId:i}})},setActiveConnection(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,activeConnectionId:c,activeDatabase:null},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},setActiveDatabase(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,activeDatabase:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},getDatabaseState(i){return t().databaseState.get(i)||Kk()},clearDatabaseState(i){e(c=>{const d=new Map(c.databaseState);d.delete(i),c.databaseState=d}),n()}}}function GO(t,e,n){return{async fetchSnapshots(){e(s=>{s.snapshotsLoading=!0,s.snapshotsError=null}),n();try{const s=await Lt(Mt("/api/snapshots"));if(!s.ok)throw new Error(`Failed to fetch snapshots: ${s.statusText}`);const a=await s.json(),r=Array.isArray(a)?a:a.snapshots||[];this.setSnapshots(r)}catch(s){const a=s instanceof Error?s.message:"Failed to fetch snapshots";this.setError(a),console.error("Snapshot fetch error:",s)}finally{e(s=>{s.snapshotsLoading=!1}),n()}},setSnapshots(s){e(a=>{const r=new Map;s.forEach(i=>{r.set(i.id,i)}),a.snapshots=r}),n()},async createSnapshot(s,a,r,i,c,d){e(f=>{f.snapshotsLoading=!0,f.snapshotsError=null}),n();try{const f={agentId:s,agentName:a,title:r,description:i,outputs:c||[],files:d||[]},h=await Lt(Mt("/api/snapshots"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok)throw new Error(`Failed to create snapshot: ${h.statusText}`);const m=await h.json();return await this.fetchSnapshots(),m}catch(f){const h=f instanceof Error?f.message:"Failed to create snapshot";throw this.setError(h),console.error("Snapshot creation error:",f),f}finally{e(f=>{f.snapshotsLoading=!1}),n()}},async loadSnapshot(s){e(a=>{a.snapshotsLoading=!0,a.snapshotsError=null}),n();try{const a=await Lt(Mt(`/api/snapshots/${s}`));if(!a.ok)throw new Error(`Failed to load snapshot: ${a.statusText}`);const r=await a.json();this.setCurrentSnapshot(r)}catch(a){const r=a instanceof Error?a.message:"Failed to load snapshot";this.setError(r),console.error("Snapshot load error:",a)}finally{e(a=>{a.snapshotsLoading=!1}),n()}},setCurrentSnapshot(s){e(a=>{a.currentSnapshot=s}),n()},async deleteSnapshot(s){var a;e(r=>{r.snapshotsLoading=!0,r.snapshotsError=null}),n();try{const r=await Lt(Mt(`/api/snapshots/${s}`),{method:"DELETE"});if(!r.ok)throw new Error(`Failed to delete snapshot: ${r.statusText}`);await this.fetchSnapshots(),((a=t().currentSnapshot)==null?void 0:a.id)===s&&this.setCurrentSnapshot(null)}catch(r){const i=r instanceof Error?r.message:"Failed to delete snapshot";throw this.setError(i),console.error("Snapshot deletion error:",r),r}finally{e(r=>{r.snapshotsLoading=!1}),n()}},async restoreFiles(s,a){e(r=>{r.snapshotsLoading=!0,r.snapshotsError=null}),n();try{const r=a?{filePaths:a}:{},i=await Lt(Mt(`/api/snapshots/${s}/restore`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to restore files: ${i.statusText}`)}catch(r){const i=r instanceof Error?r.message:"Failed to restore files";throw this.setError(i),console.error("File restoration error:",r),r}finally{e(r=>{r.snapshotsLoading=!1}),n()}},setLoading(s){e(a=>{a.snapshotsLoading=s}),n()},setError(s){e(a=>{a.snapshotsError=s}),n()},clearError(){this.setError(null)},reset(){e(s=>{s.snapshots=new Map,s.currentSnapshot=null,s.snapshotsLoading=!1,s.snapshotsError=null}),n()}}}const YO=3e4,og=new Map;function Jd(t,e,n){let s=t.get(e);if(!s){for(const[,a]of t)if(a.toolUseId===e&&a.parentAgentId===n){s=a;break}}return s}function Qk(t,e,n){const s=og.get(t);s&&clearTimeout(s),og.set(t,setTimeout(()=>{og.delete(t),e(a=>{const r=a.subagents.get(t);if(r&&(r.status==="completed"||r.status==="failed")){const i=new Map(a.subagents);i.delete(t),a.subagents=i}}),n()},YO))}function KO(t,e,n){return{addSubagent(s){e(a=>{const r=new Map(a.subagents);r.set(s.id,s),a.subagents=r}),n(),console.log(`[Subagent] Added: ${s.name} (${s.id}) for agent ${s.parentAgentId}`)},completeSubagent(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=new Map(i.subagents);d.set(c.id,{...c,status:r?"completed":"failed",completedAt:Date.now()}),i.subagents=d,console.log(`[Subagent] Completed: ${c.name} (${c.id}) success=${r}`),Qk(c.id,e,n)}}),n()},addSubagentActivity(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=[...c.activities||[],r].slice(-50),f=new Map(i.subagents);f.set(c.id,{...c,activities:d}),i.subagents=f}}),n()},updateSubagentStats(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=new Map(i.subagents);d.set(c.id,{...c,stats:r}),i.subagents=d}}),n()},getSubagentsForAgent(s){const a=t();return Array.from(a.subagents.values()).filter(r=>r.parentAgentId===s)},getSubagent(s){return t().subagents.get(s)},removeSubagent(s){e(a=>{const r=new Map(a.subagents);r.delete(s),a.subagents=r}),n()},addSubagentStreamEntries(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const f=[...c.streamEntries||[],...r].slice(-200),h=new Map(i.subagents);h.set(c.id,{...c,streamEntries:f}),i.subagents=h,(c.status==="completed"||c.status==="failed")&&Qk(c.id,e,n)}}),n()},getSubagentByToolUseId(s){const a=t();for(const[,r]of a.subagents)if(r.toolUseId===s)return r},hydrateSubagentsFromHistory(s,a){!a||a.length===0||(e(r=>{const i=new Map(r.subagents);for(const c of a){let d=!1;for(const[,m]of i)if(m.toolUseId===c.toolUseId&&m.parentAgentId===s){d=!0;break}if(d)continue;const f=`hist_${c.toolUseId}`,h={id:f,parentAgentId:s,toolUseId:c.toolUseId,name:c.name||"Subagent",description:c.description||"",subagentType:c.subagentType||"general-purpose",model:c.model,status:"completed",startedAt:c.startedAt||0,completedAt:c.completedAt,streamEntries:c.streamEntries.slice(-200),stats:c.stats};i.set(f,h)}r.subagents=i}),n())}}}const QO={workflowDefinitions:new Map,workflowInstances:new Map,selectedWorkflowId:null,workflowDetailOpen:!1,workflowDetailLevel:{level:"overview"},workflowChatMessages:[],workflowChatScope:{level:"workflow"},workflowChatLoading:!1};function XO(t,e,n,s){const a=()=>{const i=t();return{workflowDefinitions:i.workflowDefinitions??new Map,workflowInstances:i.workflowInstances??new Map,selectedWorkflowId:i.selectedWorkflowId??null,workflowDetailOpen:i.workflowDetailOpen??!1,workflowDetailLevel:i.workflowDetailLevel??{level:"overview"},workflowChatMessages:i.workflowChatMessages??[],workflowChatScope:i.workflowChatScope??{level:"workflow"},workflowChatLoading:i.workflowChatLoading??!1}};return{setWorkflowDefinitionsFromServer(i){e(c=>{const d=new Map;for(const f of i)d.set(f.id,f);c.workflowDefinitions=d}),n()},addWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.set(i.id,i),d.workflowDefinitions=f}),n()},updateWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.set(i.id,i),d.workflowDefinitions=f}),n()},removeWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.delete(i),d.workflowDefinitions=f,d.selectedWorkflowId===i&&(d.selectedWorkflowId=null,d.workflowDetailOpen=!1)}),n()},createWorkflowDefinition(i){var c;(c=s())==null||c({type:"create_workflow_def",payload:i})},updateWorkflowDefinition(i,c){var d;(d=s())==null||d({type:"update_workflow_def",payload:{id:i,updates:c}})},deleteWorkflowDefinition(i){var c;(c=s())==null||c({type:"delete_workflow_def",payload:{id:i}})},moveWorkflow(i,c){var d;e(f=>{const h=f,m=new Map(h.workflowDefinitions??new Map),x=m.get(i);x&&(m.set(i,{...x,position:c}),h.workflowDefinitions=m)}),(d=s())==null||d({type:"update_workflow_def",payload:{id:i,updates:{position:c}}}),n()},setWorkflowInstancesFromServer(i){e(c=>{const d=c,f=new Map;for(const h of i)f.set(h.id,h);d.workflowInstances=f}),n()},updateWorkflowInstanceFromServer(i){e(c=>{const d=c,f=new Map(d.workflowInstances??new Map);f.set(i.id,i),d.workflowInstances=f}),n()},removeWorkflowInstanceFromServer(i){e(c=>{const d=c,f=new Map(d.workflowInstances??new Map);f.delete(i),d.workflowInstances=f}),n()},startWorkflow(i,c){var d;(d=s())==null||d({type:"start_workflow",payload:{workflowDefId:i,initialVariables:c}})},pauseWorkflow(i){var c;(c=s())==null||c({type:"pause_workflow",payload:{instanceId:i}})},resumeWorkflow(i){var c;(c=s())==null||c({type:"resume_workflow",payload:{instanceId:i}})},cancelWorkflow(i){var c;(c=s())==null||c({type:"cancel_workflow",payload:{instanceId:i}})},manualTransition(i,c){var d;(d=s())==null||d({type:"manual_transition",payload:{instanceId:i,transitionId:c}})},selectWorkflow(i){e(c=>{c.selectedWorkflowId=i}),n()},openWorkflowDetail(i){e(c=>{const d=c;d.selectedWorkflowId=i,d.workflowDetailOpen=!0,d.workflowDetailLevel={level:"overview"},d.workflowChatMessages=[],d.workflowChatScope={level:"workflow"}}),n()},closeWorkflowDetail(){e(i=>{const c=i;c.workflowDetailOpen=!1,c.workflowDetailLevel={level:"overview"},c.workflowChatMessages=[]}),n()},navigateToExecution(i){e(c=>{const d=c;d.workflowDetailLevel={level:"execution",instanceId:i},d.workflowChatScope={level:"instance",instanceId:i}}),n()},navigateToStep(i,c){e(d=>{const f=d;f.workflowDetailLevel={level:"step",instanceId:i,stepId:c},f.workflowChatScope={level:"step",instanceId:i,stepId:c}}),n()},navigateBack(){const c=a().workflowDetailLevel;e(d=>{const f=d;c.level==="step"?(f.workflowDetailLevel={level:"execution",instanceId:c.instanceId},f.workflowChatScope={level:"instance",instanceId:c.instanceId}):c.level==="execution"&&(f.workflowDetailLevel={level:"overview"},f.workflowChatScope={level:"workflow"})}),n()},getWorkflowModelStatus(i){const c=a(),d=Array.from(c.workflowInstances.values()).filter(m=>m.workflowDefId===i);if(d.length===0)return"idle";if(d.some(m=>m.status==="failed"))return"error";if(d.some(m=>m.status==="running"||m.status==="paused"))return"running";const f=Date.now()-300*1e3;return d.filter(m=>m.status==="completed"&&m.completedAt&&m.completedAt>f).length>0?"completed":"idle"},addWorkflowChatMessage(i){e(c=>{const d=c;d.workflowChatMessages=[...d.workflowChatMessages??[],i]}),n()},setWorkflowChatScope(i){e(c=>{c.workflowChatScope=i}),n()},setWorkflowChatLoading(i){e(c=>{c.workflowChatLoading=i}),n()},clearWorkflowChat(){e(i=>{const c=i;c.workflowChatMessages=[]}),n()},getWorkflowDefinition(i){return a().workflowDefinitions.get(i)},getWorkflowInstances(i){return Array.from(a().workflowInstances.values()).filter(c=>c.workflowDefId===i)},getAllWorkflowDefinitions(){return Array.from(a().workflowDefinitions.values())}}}const lg={panSpeed:1,orbitSpeed:1,zoomSpeed:1,smoothing:.3,invertPanX:!1,invertPanY:!1,invertOrbitX:!1,invertOrbitY:!1},Zd={enabled:!0,pinchToZoom:!0,twoFingerPan:!0,shiftTwoFingerOrbit:!0,sensitivity:{zoom:1,pan:1,orbit:1}};function Qi(t,e,n,s,a,r,i){return{id:t,name:e,description:n,button:s,modifiers:a,action:r,enabled:!0,sensitivity:i}}const cg=[Qi("left-click-select","Select/Click","Select agents, click on buildings/areas","left",{},"primary-action"),Qi("left-drag-selection","Selection Box","Drag to select multiple agents","left",{},"selection-box"),Qi("right-click-context","Context Menu / Move","Show context menu or move selected agents","right",{},"context-menu"),Qi("alt-right-drag-pan","Camera Pan","Pan camera with Alt+Right-drag","right",{alt:!0},"camera-pan",1),Qi("middle-drag-orbit","Camera Orbit","Orbit camera with middle-drag","middle",{},"camera-orbit",1),Qi("shift-middle-drag-pan","Camera Pan (Alt)","Alternative pan with Shift+Middle-drag","middle",{shift:!0},"camera-pan",1),Qi("wheel-zoom","Zoom","Zoom camera with scroll wheel","middle",{},"camera-zoom",1)],Zq={0:"left",1:"middle",2:"right",3:"back",4:"forward"},JO={left:"Left Click",right:"Right Click",middle:"Middle Click",back:"Back Button",forward:"Forward Button"};function eV(t,e){const n=[];if(t.modifiers.ctrl){const s=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");n.push(s?"⌘":"Ctrl")}if(t.modifiers.alt){const s=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");n.push(s?"⌥":"Alt")}return t.modifiers.shift&&n.push("Shift"),n.push(e?e(t.button):JO[t.button]),n.join("+")}function tV(t,e){const n=e.ctrl?t.ctrlKey||t.metaKey:!t.ctrlKey&&!t.metaKey,s=e.alt?t.altKey:!t.altKey,a=e.shift?t.shiftKey:!t.shiftKey;return n&&s&&a}function nV(t,e,n){return t.filter(s=>{if(s.id===n||!s.enabled||s.button!==e.button)return!1;const a=s.modifiers,r=e.modifiers;return(a.ctrl||!1)===(r.ctrl||!1)&&(a.alt||!1)===(r.alt||!1)&&(a.shift||!1)===(r.shift||!1)})}function ss(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function La(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const[n,s]of t)if(e.get(n)!==s)return!1;return!0}function cx(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function wt(t,e=Object.is){const[n,s]=b.useState(()=>t(U.getState())),a=b.useRef(n);return b.useEffect(()=>{a.current=n},[n]),b.useEffect(()=>{const r=()=>{const i=t(U.getState());e(a.current,i)||(a.current=i,s(i))};return r(),U.subscribe(r)},[t,e]),n}function vs(){const[,t]=b.useState({});return b.useEffect(()=>U.subscribe(()=>t({})),[]),U.getState()}function Dl(){return wt(b.useCallback(t=>t.agents,[]),La)}function _j(){return wt(b.useCallback(t=>t.agents.size,[]))}function vp(){const t=Dl(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function ux(t){return wt(b.useCallback(e=>t?e.agents.get(t):void 0,[t]))}function dx(){return wt(b.useCallback(t=>t.selectedAgentIds,[]),cx)}function ZO(){return wt(b.useCallback(t=>t.lastSelectedAgentId,[]))}function eL(t){const e={working:[],"waiting-subordinates":[],"need-review":[],blocked:[],"can-clear-context":[]};return t.agents.forEach(n=>{n.trackingStatus&&n.trackingStatus in e&&e[n.trackingStatus].push(n)}),e}function tL(t,e){return ss(t.working,e.working)&&ss(t["waiting-subordinates"],e["waiting-subordinates"])&&ss(t["need-review"],e["need-review"])&&ss(t.blocked,e.blocked)&&ss(t["can-clear-context"],e["can-clear-context"])}function nL(){return wt(b.useCallback(t=>eL(t),[]),tL)}function Mj(t){const e=b.useRef([]),n=b.useRef(0),s=wt(b.useCallback(a=>t&&a.agentOutputs.get(t)||e.current,[t]),ss);return s.length!==n.current&&(bu.info(`Selector: ${n.current} -> ${s.length}`,{agentId:t,lastText:s.length>0?s[s.length-1].text.slice(0,40):null},"useAgentOutputs"),n.current=s.length),s}function sL(t){return wt(b.useCallback(e=>t?e.compactingAgents.has(t):!1,[t]))}function Dj(t){return wt(b.useCallback(e=>t?e.lastPrompts.get(t):void 0,[t]))}function fx(){return wt(b.useCallback(t=>t.lastPrompts,[]),La)}function Rj(){return wt(b.useCallback(t=>t.isConnected,[]))}function rr(){return wt(b.useCallback(t=>t.areas,[]),La)}function aL(){return wt(b.useCallback(t=>t.activeTool,[]))}function rL(){return wt(b.useCallback(t=>t.selectedAreaId,[]))}function px(){return wt(b.useCallback(t=>t.buildings,[]),La)}function iL(){return wt(b.useCallback(t=>t.selectedBuildingIds,[]),cx)}function oL(){return wt(b.useCallback(t=>t.supervisor,[]))}function sV(){return wt(b.useCallback(t=>t.supervisor.lastReport,[]))}function lL(){return wt(b.useCallback(t=>t.supervisor.generatingReport,[]))}function cL(){return wt(b.useCallback(t=>t.permissionRequests,[]),La)}function Br(){return wt(b.useCallback(t=>t.settings,[]))}function Oj(){return wt(b.useCallback(t=>t.settings.hideCost,[]))}function aV(){return wt(b.useCallback(t=>t.settings.customAgentNames,[]),ss)}function uL(){return wt(b.useCallback(t=>t.shortcuts,[]),ss)}function rV(){return wt(b.useCallback(t=>t.mouseControls,[]))}function iV(){return wt(b.useCallback(t=>t.mouseControls.trackpad,[]))}function Lj(){return wt(b.useCallback(t=>t.terminalOpen,[]))}function Pj(){return wt(b.useCallback(t=>t.mobileView,[]))}function hx(){return wt(b.useCallback(t=>t.fileViewerPath,[]))}function dL(){return wt(b.useCallback(t=>t.fileViewerEditData,[]))}function fL(){return wt(b.useCallback(t=>t.fileViewerSearchRoot,[]))}function pL(){return wt(b.useCallback(t=>t.explorerFolderPath,[]))}function mx(){return wt(b.useCallback(t=>t.contextModalAgentId,[]))}function oV(){return wt(b.useCallback(t=>t.commanderExpandRequest,[]))}function gx(){return wt(b.useCallback(t=>t.toolExecutions,[]),ss)}function Ij(){return wt(b.useCallback(t=>t.fileChanges,[]),ss)}function Bj(){return wt(b.useCallback(t=>t.skills,[]),La)}function hL(){const t=Bj(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function lV(t){return wt(b.useCallback(e=>t?e.skills.get(t):void 0,[t]))}function mL(t){const e=b.useRef([]),n=Dl(),s=Bj();if(!t)return e.current;const a=n.get(t);return a?Array.from(s.values()).filter(i=>i.enabled?!!(i.assignedAgentIds.includes(t)||i.assignedAgentClasses.includes(a.class)):!1):e.current}function gL(){return wt(b.useCallback(t=>t.customAgentClasses,[]),La)}function Pa(){const t=gL(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function Fj(t){return wt(b.useCallback(e=>t?e.customAgentClasses.get(t):void 0,[t]))}function zj(){return wt(b.useCallback(t=>t.reconnectCount,[]))}function $j(){return wt(b.useCallback(t=>t.historyRefreshTrigger,[]))}function cV(){return wt(b.useCallback(t=>t.supervisor.globalUsage,[]))}function uV(){return wt(b.useCallback(t=>t.supervisor.refreshingUsage,[]))}function bL(t){const e=b.useRef(new Map);return wt(b.useCallback(n=>t&&n.agentTaskProgress.get(t)||e.current,[t]),La)}function xL(t){return wt(b.useCallback(e=>!t||!e.execTasks?[]:Array.from(e.execTasks.values()).filter(n=>n.agentId===t),[t]),ss)}function yL(){return wt(b.useCallback(t=>t.secrets,[]),La)}function dV(){const t=yL(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}const vL={connectionStatus:new Map,databases:new Map,tables:new Map,tableSchemas:new Map,queryResults:[],queryHistory:[],executingQuery:!1,activeConnectionId:null,activeDatabase:null,lastSilentQueryResult:null};function bx(t){return wt(b.useCallback(e=>(t?e.databaseState.get(t):void 0)??vL,[t]))}function wL(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryResults)??[]},[t]),ss)}function fV(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryHistory)??[]},[t]),ss)}function kL(t){return wt(b.useCallback(e=>{if(!t)return!1;const n=e.databaseState.get(t);return(n==null?void 0:n.executingQuery)??!1},[t]))}function pV(){return wt(t=>t.dockerContainersList,ss)}function SL(){return wt(t=>t.currentSnapshot)}function CL(){return wt(t=>t.snapshotsLoading)}function AL(){return wt(t=>t.snapshotsError)}function jL(){return wt(t=>t.subagents,La)}function NL(t){return wt(b.useCallback(e=>t?Array.from(e.subagents.values()).filter(n=>n.parentAgentId===t):[],[t]),ss)}function TL(t){const e=b.useRef(new Map);return wt(b.useCallback(n=>{if(!t)return e.current;const s=new Map;for(const[a,r]of n.subagents)r.parentAgentId===t&&s.set(a,r);return s.size===0?e.current:s},[t]),La)}function Hj(){return wt(t=>t.viewMode)}function EL(){return wt(b.useCallback(t=>t.overviewPanelOpen,[]))}function _L(){return wt(b.useCallback(t=>t.trackingBoardVisible,[]))}function ML(){return wt(b.useCallback(t=>t.splitPaneAgentIds,[]))}function DL(){return wt(b.useCallback(t=>t.splitOrientation,[]))}function Uj(){return wt(b.useCallback(t=>t.agentsWithUnseenOutput,[]),cx)}class Xk{constructor(){et(this,"state");et(this,"listeners",new Set);et(this,"sendMessage",null);et(this,"agentActions");et(this,"outputActions");et(this,"supervisorActions");et(this,"areaActions");et(this,"buildingActions");et(this,"permissionActions");et(this,"delegationActions");et(this,"skillActions");et(this,"execTaskActions");et(this,"secretActions");et(this,"databaseActions");et(this,"snapshotActions");et(this,"subagentActions");et(this,"workflowActions");et(this,"statusPollInterval",null);this.state={agents:new Map,selectedAgentIds:new Set,lastSelectedAgentId:null,activities:[],isConnected:!1,areas:new Map,activeTool:null,selectedAreaId:null,buildings:new Map,selectedBuildingIds:new Set,buildingLogs:new Map,streamingBuildingLogs:new Map,streamingBuildingIds:new Set,bossStreamingLogs:new Map,agentOutputs:new Map,compactingAgents:new Set,lastPrompts:new Map,sessionHistories:new Map,toolExecutions:[],fileChanges:[],terminalOpen:!1,terminalResizing:!1,mobileView:this.loadMobileView(),settings:this.loadSettings(),shortcuts:this.loadShortcuts(),mouseControls:this.loadMouseControls(),fileViewerPath:null,fileViewerSearchRoot:null,fileViewerEditData:null,explorerFolderPath:null,explorerAreaId:null,contextModalAgentId:null,supervisor:{enabled:!0,autoReportOnComplete:!1,lastReport:null,narratives:new Map,lastReportTime:null,nextReportTime:null,agentHistories:new Map,loadingHistoryForAgent:null,historyFetchedForAgents:new Set,generatingReport:!1,globalUsage:null,refreshingUsage:!1},permissionRequests:new Map,delegationHistories:new Map,pendingDelegation:null,lastDelegationReceived:new Map,agentTaskProgress:new Map,skills:new Map,customAgentClasses:new Map,reconnectCount:0,historyRefreshTrigger:0,execTasks:new Map,secrets:new Map,databaseState:new Map,dockerContainersList:[],dockerComposeProjectsList:[],snapshots:new Map,currentSnapshot:null,snapshotsLoading:!1,snapshotsError:null,lastSelectionViaSwipe:!1,lastSelectionViaDirectClickAt:null,subagents:new Map,viewMode:(()=>{const i=va(ft.SCENE_VIEW_MODE,"3d");return i==="2d"||i==="3d"||i==="dashboard"?i:"3d"})(),overviewPanelOpen:Er(ft.AOP_OPEN,!1),trackingBoardVisible:Er(ft.AOP_TRACKING_BOARD_VISIBLE,!1),splitPaneAgentIds:this.loadSplitPaneAgentIds(),splitOrientation:this.loadSplitOrientation(),agentsWithUnseenOutput:this.loadUnseenAgents(),commanderExpandRequest:null,latestNotificationAgentId:null,...QO};const e=()=>this.state,n=i=>{i(this.state)},s=()=>this.notify(),a=()=>this.sendMessage,r=()=>this.listeners.size;this.agentActions=OO(e,n,s,a,()=>this.saveUnseenAgents()),this.outputActions=LO(e,n,s,r),this.supervisorActions=PO(e,n,s,a),this.areaActions=IO(e,n,s,a),this.buildingActions=zO(e,n,s,a),this.permissionActions=$O(e,n,s,a),this.delegationActions=HO(e,n,s,a),this.skillActions=UO(e,n,s,a),this.execTaskActions=WO(e,n,s),this.secretActions=qO(e,n,s,a),this.databaseActions=VO(e,n,s,a),this.snapshotActions=GO(e,n,s),this.subagentActions=KO(e,n,s),this.workflowActions=XO(e,n,s,a)}loadSettings(){const e=ta(ft.SETTINGS,null);if(e){const n={...ag,...e},s=Number(n.vibrationIntensity);return n.vibrationIntensity=Number.isFinite(s)?Math.max(0,Math.min(gu,Math.round(s))):ag.vibrationIntensity,n}return{...ag}}loadShortcuts(){const e=ta(ft.SHORTCUTS,null);return e?ng.map(s=>{const a=e.find(r=>r.id===s.id);return a?{...s,...a}:s}):[...ng]}loadMouseControls(){var n;const e=ta(ft.MOUSE_CONTROLS,null);return e?{bindings:cg.map(a=>{var i;const r=(i=e.bindings)==null?void 0:i.find(c=>c.id===a.id);return r?{...a,...r}:a}),sensitivity:{...lg,...e.sensitivity},trackpad:{...Zd,...e.trackpad,sensitivity:{...Zd.sensitivity,...(n=e.trackpad)==null?void 0:n.sensitivity}}}:{bindings:[...cg],sensitivity:{...lg},trackpad:{...Zd}}}loadMobileView(){const e=va(ft.MOBILE_VIEW,"");return e==="terminal"||e==="3d"?e:typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window?"3d":"terminal"}loadUnseenAgents(){const e=ta(ft.UNSEEN_AGENTS,[]);return new Set(e)}saveUnseenAgents(){const e=Array.from(this.state.agentsWithUnseenOutput);ya(ft.UNSEEN_AGENTS,e)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){this.listeners.forEach(e=>e())}getState(){return this.state}setSendMessage(e){this.sendMessage=e}setConnected(e){this.state.isConnected=e,this.notify()}triggerReconnect(){this.state.reconnectCount++,this.notify()}triggerHistoryRefresh(e){this.state.selectedAgentIds.has(e)&&(this.state.historyRefreshTrigger++,this.notify())}toggleTerminal(e){e&&!this.state.selectedAgentIds.has(e)&&(this.state.selectedAgentIds=new Set([e])),this.state.terminalOpen=!this.state.terminalOpen,this.notify()}setTerminalOpen(e){if(this.state.terminalOpen=e,e){if(this.state.mobileView="terminal",this.state.selectedAgentIds.size===0&&this.state.agents.size>0&&!this.state.currentSnapshot){const s=Array.from(this.state.agents.keys())[0];this.state.selectedAgentIds=new Set([s])}let n=!1;for(const s of this.state.selectedAgentIds)this.state.agentsWithUnseenOutput.has(s)&&(n||(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),n=!0),this.state.agentsWithUnseenOutput.delete(s));n&&this.saveUnseenAgents()}else window.innerWidth<=768&&(this.state.mobileView="3d");this.notify()}setOverviewPanelOpen(e){this.state.overviewPanelOpen=e,Qa(ft.AOP_OPEN,e),this.notify()}toggleTrackingBoard(){this.state.trackingBoardVisible=!this.state.trackingBoardVisible,Qa(ft.AOP_TRACKING_BOARD_VISIBLE,this.state.trackingBoardVisible),this.notify()}setTrackingBoardVisible(e){this.state.trackingBoardVisible=e,Qa(ft.AOP_TRACKING_BOARD_VISIBLE,e),this.notify()}loadSplitPaneAgentIds(){const e=ta(ft.SPLIT_PANE_AGENT_IDS,[]);return Array.isArray(e)?e:[]}saveSplitPaneAgentIds(){ya(ft.SPLIT_PANE_AGENT_IDS,this.state.splitPaneAgentIds)}loadSplitOrientation(){return va(ft.SPLIT_PANE_ORIENTATION,"horizontal")==="vertical"?"vertical":"horizontal"}addSplitPane(e){this.state.splitPaneAgentIds.includes(e)||this.state.splitPaneAgentIds.length>=4||(this.state.splitPaneAgentIds=[...this.state.splitPaneAgentIds,e],this.saveSplitPaneAgentIds(),this.notify())}removeSplitPane(e){this.state.splitPaneAgentIds.includes(e)&&(this.state.splitPaneAgentIds=this.state.splitPaneAgentIds.filter(n=>n!==e),this.saveSplitPaneAgentIds(),this.notify())}clearSplitPanes(){this.state.splitPaneAgentIds.length!==0&&(this.state.splitPaneAgentIds=[],this.saveSplitPaneAgentIds(),this.notify())}toggleSplitOrientation(){this.state.splitOrientation=this.state.splitOrientation==="horizontal"?"vertical":"horizontal",er(ft.SPLIT_PANE_ORIENTATION,this.state.splitOrientation),this.notify()}setMobileView(e){if(this.state.mobileView=e,er(ft.MOBILE_VIEW,e),e==="terminal"&&this.state.selectedAgentIds.size===0&&this.state.agents.size>0&&!this.state.currentSnapshot){const n=Array.from(this.state.agents.keys())[0];this.state.selectedAgentIds=new Set([n]),this.state.terminalOpen=!0}this.notify()}setViewMode(e){this.state.viewMode=e,er(ft.SCENE_VIEW_MODE,e),this.state.settings.experimental2DView=e==="2d",this.notify()}openTerminalOnMobile(e){nR("terminal"),this.state.selectedAgentIds=new Set([e]),this.state.terminalOpen=!0,this.state.mobileView="terminal",this.state.agentsWithUnseenOutput.has(e)&&(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),this.state.agentsWithUnseenOutput.delete(e),this.saveUnseenAgents()),this.notify()}clearUnseenForAgent(e){this.state.agentsWithUnseenOutput.has(e)&&(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),this.state.agentsWithUnseenOutput.delete(e),this.saveUnseenAgents(),this.notify())}setTerminalResizing(e){this.state.terminalResizing=e,this.notify()}setLastSelectionViaSwipe(e){this.state.lastSelectionViaSwipe=e}consumeSwipeSelectionFlag(){const e=this.state.lastSelectionViaSwipe;return this.state.lastSelectionViaSwipe=!1,e}setLastSelectionViaDirectClick(e){this.state.lastSelectionViaDirectClickAt=e?Date.now():null}consumeDirectClickSelectionFlag(){const e=this.state.lastSelectionViaDirectClickAt;return this.state.lastSelectionViaDirectClickAt=null,e===null?!1:Date.now()-e<=1500}setFileViewerPath(e,n,s){this.state.fileViewerPath=e,this.state.fileViewerEditData=n||null,this.state.fileViewerSearchRoot=s||null,this.notify()}clearFileViewerPath(){this.state.fileViewerPath=null,this.state.fileViewerEditData=null,this.state.fileViewerSearchRoot=null,this.notify()}requestCommanderExpand(e){this.state.commanderExpandRequest=e,this.notify()}clearCommanderExpandRequest(){this.state.commanderExpandRequest=null,this.notify()}setLatestNotificationAgentId(e){this.state.latestNotificationAgentId=e,this.notify()}getLastExplorerState(){try{const e=localStorage.getItem("file-explorer-last-opened");return e?JSON.parse(e):null}catch{return null}}setExplorerFolderPath(e){this.state.explorerFolderPath=e,this.notify()}openFileExplorer(e){this.state.explorerFolderPath=e,this.state.explorerAreaId=null,this.notify()}closeFileExplorer(){this.state.explorerFolderPath=null,this.state.explorerAreaId=null,this.notify()}openFileExplorerForArea(e){this.state.explorerFolderPath=null,this.state.explorerAreaId=e,this.notify()}openFileExplorerForAreaFolder(e,n){this.state.explorerAreaId=e,this.state.explorerFolderPath=n,this.notify()}setContextModalAgentId(e){this.state.contextModalAgentId=e,this.notify()}closeContextModal(){this.state.contextModalAgentId=null,this.notify()}updateSettings(e){const n={...e};if(n.vibrationIntensity!==void 0){const s=Number(n.vibrationIntensity);n.vibrationIntensity=Number.isFinite(s)?Math.max(0,Math.min(gu,Math.round(s))):this.state.settings.vibrationIntensity}this.state.settings={...this.state.settings,...n},ya(ft.SETTINGS,this.state.settings),this.notify()}getSettings(){return this.state.settings}getShortcuts(){return this.state.shortcuts}getShortcut(e){return this.state.shortcuts.find(n=>n.id===e)}updateShortcut(e,n){const s=this.state.shortcuts.findIndex(a=>a.id===e);s!==-1&&(this.state.shortcuts=[...this.state.shortcuts.slice(0,s),{...this.state.shortcuts[s],...n},...this.state.shortcuts.slice(s+1)],this.saveShortcuts(),this.notify())}resetShortcuts(){this.state.shortcuts=[...ng],this.saveShortcuts(),this.notify()}saveShortcuts(){ya(ft.SHORTCUTS,this.state.shortcuts)}getMouseControls(){return this.state.mouseControls}getMouseBinding(e){return this.state.mouseControls.bindings.find(n=>n.id===e)}updateMouseBinding(e,n){const s=this.state.mouseControls.bindings.findIndex(a=>a.id===e);s!==-1&&(this.state.mouseControls.bindings=[...this.state.mouseControls.bindings.slice(0,s),{...this.state.mouseControls.bindings[s],...n},...this.state.mouseControls.bindings.slice(s+1)],this.saveMouseControls(),this.notify())}updateCameraSensitivity(e){this.state.mouseControls.sensitivity={...this.state.mouseControls.sensitivity,...e},this.saveMouseControls(),this.notify()}resetMouseControls(){this.state.mouseControls={bindings:[...cg],sensitivity:{...lg},trackpad:{...Zd}},this.saveMouseControls(),this.notify()}getTrackpadConfig(){return this.state.mouseControls.trackpad}updateTrackpadConfig(e){this.state.mouseControls.trackpad={...this.state.mouseControls.trackpad,...e,sensitivity:{...this.state.mouseControls.trackpad.sensitivity,...e.sensitivity||{}}},this.saveMouseControls(),this.notify()}saveMouseControls(){ya(ft.MOUSE_CONTROLS,this.state.mouseControls)}startStatusPolling(){}stopStatusPolling(){this.statusPollInterval&&(clearInterval(this.statusPollInterval),this.statusPollInterval=null)}setAgents(...e){return this.agentActions.setAgents(...e)}addAgent(...e){return this.agentActions.addAgent(...e)}updateAgent(...e){return this.agentActions.updateAgent(...e)}updateAgentContextStats(...e){return this.agentActions.updateAgentContextStats(...e)}updateAgentContext(...e){return this.agentActions.updateAgentContext(...e)}setAgentCompacting(e,n){const s=new Set(this.state.compactingAgents);n?s.add(e):s.delete(e),this.state.compactingAgents=s,this.notify()}removeAgent(...e){return this.agentActions.removeAgent(...e)}selectAgent(...e){return this.agentActions.selectAgent(...e)}addToSelection(...e){return this.agentActions.addToSelection(...e)}selectMultiple(...e){return this.agentActions.selectMultiple(...e)}deselectAll(...e){return this.agentActions.deselectAll(...e)}spawnAgent(...e){return this.agentActions.spawnAgent(...e)}createDirectoryAndSpawn(...e){return this.agentActions.createDirectoryAndSpawn(...e)}sendCommand(...e){return this.agentActions.sendCommand(...e)}refreshAgentContext(...e){return this.agentActions.refreshAgentContext(...e)}moveAgentLocal(...e){return this.agentActions.moveAgentLocal(...e)}moveAgent(...e){return this.agentActions.moveAgent(...e)}killAgent(...e){return this.agentActions.killAgent(...e)}stopAgent(...e){return this.agentActions.stopAgent(...e)}clearContext(...e){return this.agentActions.clearContext(...e)}restoreSession(...e){return this.agentActions.restoreSession(...e)}requestSessionHistory(...e){return this.agentActions.requestSessionHistory(...e)}setSessionHistory(...e){return this.agentActions.setSessionHistory(...e)}getSessionHistory(...e){return this.agentActions.getSessionHistory(...e)}collapseContext(...e){return this.agentActions.collapseContext(...e)}removeAgentFromServer(...e){return this.agentActions.removeAgentFromServer(...e)}renameAgent(...e){return this.agentActions.renameAgent(...e)}updateAgentProperties(...e){return this.agentActions.updateAgentProperties(...e)}getTotalTokens(){return this.agentActions.getTotalTokens()}getSelectedAgents(){return this.agentActions.getSelectedAgents()}addActivity(...e){return this.agentActions.addActivity(...e)}addToolExecution(...e){return this.agentActions.addToolExecution(...e)}addFileChange(...e){return this.agentActions.addFileChange(...e)}loadToolHistory(){return this.agentActions.loadToolHistory()}addOutput(...e){return this.outputActions.addOutput(...e)}clearOutputs(...e){return this.outputActions.clearOutputs(...e)}getOutputs(...e){return this.outputActions.getOutputs(...e)}addUserPromptToOutput(...e){return this.outputActions.addUserPromptToOutput(...e)}getLastPrompt(...e){return this.outputActions.getLastPrompt(...e)}setLastPrompt(...e){return this.outputActions.setLastPrompt(...e)}preserveOutputs(){return this.outputActions.preserveOutputs()}mergeOutputsWithHistory(...e){return this.outputActions.mergeOutputsWithHistory(...e)}setSupervisorReport(...e){return this.supervisorActions.setSupervisorReport(...e)}addNarrative(...e){return this.supervisorActions.addNarrative(...e)}getNarratives(...e){return this.supervisorActions.getNarratives(...e)}setSupervisorStatus(...e){return this.supervisorActions.setSupervisorStatus(...e)}setSupervisorConfig(...e){return this.supervisorActions.setSupervisorConfig(...e)}requestSupervisorReport(){return this.supervisorActions.requestSupervisorReport()}requestAgentSupervisorHistory(...e){return this.supervisorActions.requestAgentSupervisorHistory(...e)}setAgentSupervisorHistory(...e){return this.supervisorActions.setAgentSupervisorHistory(...e)}getAgentSupervisorHistory(...e){return this.supervisorActions.getAgentSupervisorHistory(...e)}addAgentAnalysis(...e){return this.supervisorActions.addAgentAnalysis(...e)}isLoadingHistoryForAgent(...e){return this.supervisorActions.isLoadingHistoryForAgent(...e)}hasHistoryBeenFetched(...e){return this.supervisorActions.hasHistoryBeenFetched(...e)}setGlobalUsage(...e){return this.supervisorActions.setGlobalUsage(...e)}requestGlobalUsage(){return this.supervisorActions.requestGlobalUsage()}getGlobalUsage(){return this.supervisorActions.getGlobalUsage()}setActiveTool(...e){return this.areaActions.setActiveTool(...e)}selectArea(...e){return this.areaActions.selectArea(...e)}addArea(...e){return this.areaActions.addArea(...e)}updateArea(...e){return this.areaActions.updateArea(...e)}updateAreaLocal(...e){return this.areaActions.updateAreaLocal(...e)}deleteArea(...e){return this.areaActions.deleteArea(...e)}assignAgentToArea(...e){return this.areaActions.assignAgentToArea(...e)}unassignAgentFromArea(...e){return this.areaActions.unassignAgentFromArea(...e)}addDirectoryToArea(...e){return this.areaActions.addDirectoryToArea(...e)}removeDirectoryFromArea(...e){return this.areaActions.removeDirectoryFromArea(...e)}getAreaDirectories(...e){return this.areaActions.getAreaDirectories(...e)}isPositionInArea(...e){return this.areaActions.isPositionInArea(...e)}getAreaForAgent(...e){return this.areaActions.getAreaForAgent(...e)}setAreasFromServer(...e){return this.areaActions.setAreasFromServer(...e)}getAreasInZOrder(...e){return this.areaActions.getAreasInZOrder(...e)}getNextZIndex(...e){return this.areaActions.getNextZIndex(...e)}bringAreaToFront(...e){return this.areaActions.bringAreaToFront(...e)}sendAreaToBack(...e){return this.areaActions.sendAreaToBack(...e)}setAreaZIndex(...e){return this.areaActions.setAreaZIndex(...e)}archiveArea(...e){return this.areaActions.archiveArea(...e)}restoreArchivedArea(...e){return this.areaActions.restoreArchivedArea(...e)}getArchivedAreas(...e){return this.areaActions.getArchivedAreas(...e)}getVisibleAreas(...e){return this.areaActions.getVisibleAreas(...e)}isAgentInArchivedArea(...e){return this.areaActions.isAgentInArchivedArea(...e)}selectBuilding(...e){return this.buildingActions.selectBuilding(...e)}selectMultipleBuildings(...e){return this.buildingActions.selectMultipleBuildings(...e)}toggleBuildingSelection(...e){return this.buildingActions.toggleBuildingSelection(...e)}isBuildingSelected(...e){return this.buildingActions.isBuildingSelected(...e)}getSelectedBuildingIds(){return this.buildingActions.getSelectedBuildingIds()}deleteSelectedBuildings(){return this.buildingActions.deleteSelectedBuildings()}addBuilding(...e){return this.buildingActions.addBuilding(...e)}updateBuilding(...e){return this.buildingActions.updateBuilding(...e)}updateBuildingLocal(...e){return this.buildingActions.updateBuildingLocal(...e)}deleteBuilding(...e){return this.buildingActions.deleteBuilding(...e)}moveBuilding(...e){return this.buildingActions.moveBuilding(...e)}updateBuildingPosition(...e){return this.buildingActions.updateBuildingPosition(...e)}createBuilding(...e){return this.buildingActions.createBuilding(...e)}sendBuildingCommand(...e){return this.buildingActions.sendBuildingCommand(...e)}addBuildingLogs(...e){return this.buildingActions.addBuildingLogs(...e)}getBuildingLogs(...e){return this.buildingActions.getBuildingLogs(...e)}clearBuildingLogs(...e){return this.buildingActions.clearBuildingLogs(...e)}setBuildingsFromServer(...e){return this.buildingActions.setBuildingsFromServer(...e)}updateBuildingFromServer(...e){return this.buildingActions.updateBuildingFromServer(...e)}removeBuildingFromServer(...e){return this.buildingActions.removeBuildingFromServer(...e)}startLogStreaming(...e){return this.buildingActions.startLogStreaming(...e)}stopLogStreaming(...e){return this.buildingActions.stopLogStreaming(...e)}appendStreamingLogChunk(...e){return this.buildingActions.appendStreamingLogChunk(...e)}setStreamingStatus(...e){return this.buildingActions.setStreamingStatus(...e)}getStreamingLogs(...e){return this.buildingActions.getStreamingLogs(...e)}clearStreamingLogs(...e){return this.buildingActions.clearStreamingLogs(...e)}isLogStreaming(...e){return this.buildingActions.isLogStreaming(...e)}sendBossBuildingCommand(...e){return this.buildingActions.sendBossBuildingCommand(...e)}assignBuildingsToBoSS(...e){return this.buildingActions.assignBuildingsToBoSS(...e)}startBossLogStreaming(...e){return this.buildingActions.startBossLogStreaming(...e)}stopBossLogStreaming(...e){return this.buildingActions.stopBossLogStreaming(...e)}appendBossStreamingLogChunk(...e){return this.buildingActions.appendBossStreamingLogChunk(...e)}getBossStreamingLogs(...e){return this.buildingActions.getBossStreamingLogs(...e)}clearBossStreamingLogs(...e){return this.buildingActions.clearBossStreamingLogs(...e)}requestDockerContainersList(){return this.buildingActions.requestDockerContainersList()}setDockerContainersList(...e){return this.buildingActions.setDockerContainersList(...e)}getDockerContainersList(){return this.buildingActions.getDockerContainersList()}getDockerComposeProjectsList(){return this.buildingActions.getDockerComposeProjectsList()}setWorkflowDefinitionsFromServer(...e){return this.workflowActions.setWorkflowDefinitionsFromServer(...e)}addWorkflowDefinitionFromServer(...e){return this.workflowActions.addWorkflowDefinitionFromServer(...e)}updateWorkflowDefinitionFromServer(...e){return this.workflowActions.updateWorkflowDefinitionFromServer(...e)}removeWorkflowDefinitionFromServer(...e){return this.workflowActions.removeWorkflowDefinitionFromServer(...e)}createWorkflowDefinition(...e){return this.workflowActions.createWorkflowDefinition(...e)}updateWorkflowDefinition(...e){return this.workflowActions.updateWorkflowDefinition(...e)}deleteWorkflowDefinition(...e){return this.workflowActions.deleteWorkflowDefinition(...e)}moveWorkflow(...e){return this.workflowActions.moveWorkflow(...e)}setWorkflowInstancesFromServer(...e){return this.workflowActions.setWorkflowInstancesFromServer(...e)}updateWorkflowInstanceFromServer(...e){return this.workflowActions.updateWorkflowInstanceFromServer(...e)}removeWorkflowInstanceFromServer(...e){return this.workflowActions.removeWorkflowInstanceFromServer(...e)}startWorkflow(...e){return this.workflowActions.startWorkflow(...e)}pauseWorkflow(...e){return this.workflowActions.pauseWorkflow(...e)}resumeWorkflow(...e){return this.workflowActions.resumeWorkflow(...e)}cancelWorkflow(...e){return this.workflowActions.cancelWorkflow(...e)}manualTransition(...e){return this.workflowActions.manualTransition(...e)}selectWorkflow(...e){return this.workflowActions.selectWorkflow(...e)}openWorkflowDetail(...e){return this.workflowActions.openWorkflowDetail(...e)}closeWorkflowDetail(){return this.workflowActions.closeWorkflowDetail()}navigateToExecution(...e){return this.workflowActions.navigateToExecution(...e)}navigateToStep(...e){return this.workflowActions.navigateToStep(...e)}navigateBack(){return this.workflowActions.navigateBack()}getWorkflowModelStatus(...e){return this.workflowActions.getWorkflowModelStatus(...e)}addWorkflowChatMessage(...e){return this.workflowActions.addWorkflowChatMessage(...e)}setWorkflowChatScope(...e){return this.workflowActions.setWorkflowChatScope(...e)}setWorkflowChatLoading(...e){return this.workflowActions.setWorkflowChatLoading(...e)}clearWorkflowChat(){return this.workflowActions.clearWorkflowChat()}getWorkflowDefinition(...e){return this.workflowActions.getWorkflowDefinition(...e)}getWorkflowInstances(...e){return this.workflowActions.getWorkflowInstances(...e)}getAllWorkflowDefinitions(){return this.workflowActions.getAllWorkflowDefinitions()}addPermissionRequest(...e){return this.permissionActions.addPermissionRequest(...e)}resolvePermissionRequest(...e){return this.permissionActions.resolvePermissionRequest(...e)}respondToPermissionRequest(...e){return this.permissionActions.respondToPermissionRequest(...e)}getPendingPermissionsForAgent(...e){return this.permissionActions.getPendingPermissionsForAgent(...e)}clearAllPermissions(...e){return this.permissionActions.clearAllPermissions(...e)}spawnBossAgent(...e){return this.delegationActions.spawnBossAgent(...e)}assignSubordinates(...e){return this.delegationActions.assignSubordinates(...e)}removeSubordinate(...e){return this.delegationActions.removeSubordinate(...e)}sendBossCommand(...e){return this.delegationActions.sendBossCommand(...e)}requestDelegationHistory(...e){return this.delegationActions.requestDelegationHistory(...e)}handleDelegationDecision(...e){return this.delegationActions.handleDelegationDecision(...e)}setDelegationHistory(...e){return this.delegationActions.setDelegationHistory(...e)}getDelegationHistory(...e){return this.delegationActions.getDelegationHistory(...e)}getLastDelegationReceived(...e){return this.delegationActions.getLastDelegationReceived(...e)}clearLastDelegationReceived(...e){return this.delegationActions.clearLastDelegationReceived(...e)}updateBossSubordinates(...e){return this.delegationActions.updateBossSubordinates(...e)}getSubordinates(...e){return this.delegationActions.getSubordinates(...e)}isBossAgent(...e){return this.delegationActions.isBossAgent(...e)}getBossForAgent(...e){return this.delegationActions.getBossForAgent(...e)}getAvailableSubordinates(){return this.delegationActions.getAvailableSubordinates()}handleAgentTaskStarted(...e){return this.delegationActions.handleAgentTaskStarted(...e)}handleAgentTaskOutput(...e){return this.delegationActions.handleAgentTaskOutput(...e)}handleAgentTaskCompleted(...e){return this.delegationActions.handleAgentTaskCompleted(...e)}getAgentTaskProgress(...e){return this.delegationActions.getAgentTaskProgress(...e)}clearAgentTaskProgress(...e){return this.delegationActions.clearAgentTaskProgress(...e)}clearAllSubordinatesContext(...e){return this.delegationActions.clearAllSubordinatesContext(...e)}setSkillsFromServer(...e){return this.skillActions.setSkillsFromServer(...e)}addSkillFromServer(...e){return this.skillActions.addSkillFromServer(...e)}updateSkillFromServer(...e){return this.skillActions.updateSkillFromServer(...e)}removeSkillFromServer(...e){return this.skillActions.removeSkillFromServer(...e)}getSkill(...e){return this.skillActions.getSkill(...e)}getAllSkills(){return this.skillActions.getAllSkills()}getSkillsForAgent(...e){return this.skillActions.getSkillsForAgent(...e)}createSkill(...e){return this.skillActions.createSkill(...e)}updateSkill(...e){return this.skillActions.updateSkill(...e)}deleteSkill(...e){return this.skillActions.deleteSkill(...e)}assignSkillToAgent(...e){return this.skillActions.assignSkillToAgent(...e)}unassignSkillFromAgent(...e){return this.skillActions.unassignSkillFromAgent(...e)}requestAgentSkills(...e){return this.skillActions.requestAgentSkills(...e)}setCustomAgentClassesFromServer(...e){return this.skillActions.setCustomAgentClassesFromServer(...e)}addCustomAgentClassFromServer(...e){return this.skillActions.addCustomAgentClassFromServer(...e)}updateCustomAgentClassFromServer(...e){return this.skillActions.updateCustomAgentClassFromServer(...e)}removeCustomAgentClassFromServer(...e){return this.skillActions.removeCustomAgentClassFromServer(...e)}getCustomAgentClass(...e){return this.skillActions.getCustomAgentClass(...e)}getAllCustomAgentClasses(){return this.skillActions.getAllCustomAgentClasses()}createCustomAgentClass(...e){return this.skillActions.createCustomAgentClass(...e)}updateCustomAgentClass(...e){return this.skillActions.updateCustomAgentClass(...e)}deleteCustomAgentClass(...e){return this.skillActions.deleteCustomAgentClass(...e)}handleExecTaskStarted(...e){return this.execTaskActions.handleExecTaskStarted(...e)}handleExecTaskOutput(...e){return this.execTaskActions.handleExecTaskOutput(...e)}handleExecTaskCompleted(...e){return this.execTaskActions.handleExecTaskCompleted(...e)}stopExecTask(...e){return this.execTaskActions.stopExecTask(...e)}getExecTasks(...e){return this.execTaskActions.getExecTasks(...e)}getAllExecTasks(){return this.execTaskActions.getAllExecTasks()}getExecTask(...e){return this.execTaskActions.getExecTask(...e)}clearCompletedExecTasks(...e){return this.execTaskActions.clearCompletedExecTasks(...e)}clearAllExecTasks(...e){return this.execTaskActions.clearAllExecTasks(...e)}removeExecTask(...e){return this.execTaskActions.removeExecTask(...e)}setSecretsFromServer(...e){return this.secretActions.setSecretsFromServer(...e)}addSecretFromServer(...e){return this.secretActions.addSecretFromServer(...e)}updateSecretFromServer(...e){return this.secretActions.updateSecretFromServer(...e)}removeSecretFromServer(...e){return this.secretActions.removeSecretFromServer(...e)}getSecret(...e){return this.secretActions.getSecret(...e)}getSecretByKey(...e){return this.secretActions.getSecretByKey(...e)}getAllSecrets(){return this.secretActions.getAllSecrets()}createSecret(...e){return this.secretActions.createSecret(...e)}updateSecret(...e){return this.secretActions.updateSecret(...e)}deleteSecret(...e){return this.secretActions.deleteSecret(...e)}testDatabaseConnection(...e){return this.databaseActions.testDatabaseConnection(...e)}setConnectionStatus(...e){return this.databaseActions.setConnectionStatus(...e)}listDatabases(...e){return this.databaseActions.listDatabases(...e)}setDatabases(...e){return this.databaseActions.setDatabases(...e)}listTables(...e){return this.databaseActions.listTables(...e)}setTables(...e){return this.databaseActions.setTables(...e)}getTableSchema(...e){return this.databaseActions.getTableSchema(...e)}setTableSchema(...e){return this.databaseActions.setTableSchema(...e)}executeQuery(...e){return this.databaseActions.executeQuery(...e)}executeSilentQuery(...e){return this.databaseActions.executeSilentQuery(...e)}setSilentQueryResult(...e){return this.databaseActions.setSilentQueryResult(...e)}setQueryResult(...e){return this.databaseActions.setQueryResult(...e)}setExecutingQuery(...e){return this.databaseActions.setExecutingQuery(...e)}requestQueryHistory(...e){return this.databaseActions.requestQueryHistory(...e)}setQueryHistory(...e){return this.databaseActions.setQueryHistory(...e)}toggleQueryFavorite(...e){return this.databaseActions.toggleQueryFavorite(...e)}deleteQueryFromHistory(...e){return this.databaseActions.deleteQueryFromHistory(...e)}clearQueryHistory(...e){return this.databaseActions.clearQueryHistory(...e)}setActiveConnection(...e){return this.databaseActions.setActiveConnection(...e)}setActiveDatabase(...e){return this.databaseActions.setActiveDatabase(...e)}getDatabaseState(...e){return this.databaseActions.getDatabaseState(...e)}clearDatabaseState(...e){return this.databaseActions.clearDatabaseState(...e)}fetchSnapshots(...e){return this.snapshotActions.fetchSnapshots(...e)}setSnapshots(...e){return this.snapshotActions.setSnapshots(...e)}createSnapshot(...e){return this.snapshotActions.createSnapshot(...e)}loadSnapshot(...e){return this.snapshotActions.loadSnapshot(...e)}setCurrentSnapshot(...e){return this.snapshotActions.setCurrentSnapshot(...e)}deleteSnapshot(...e){return this.snapshotActions.deleteSnapshot(...e)}restoreFiles(...e){return this.snapshotActions.restoreFiles(...e)}setLoading(...e){return this.snapshotActions.setLoading(...e)}setError(...e){return this.snapshotActions.setError(...e)}clearError(...e){return this.snapshotActions.clearError(...e)}reset(...e){return this.snapshotActions.reset(...e)}addSubagent(...e){return this.subagentActions.addSubagent(...e)}completeSubagent(...e){return this.subagentActions.completeSubagent(...e)}getSubagentsForAgent(...e){return this.subagentActions.getSubagentsForAgent(...e)}getSubagent(...e){return this.subagentActions.getSubagent(...e)}removeSubagent(...e){return this.subagentActions.removeSubagent(...e)}getSubagentByToolUseId(...e){return this.subagentActions.getSubagentByToolUseId(...e)}addSubagentActivity(...e){return this.subagentActions.addSubagentActivity(...e)}updateSubagentStats(...e){return this.subagentActions.updateSubagentStats(...e)}addSubagentStreamEntries(...e){return this.subagentActions.addSubagentStreamEntries(...e)}hydrateSubagentsFromHistory(...e){return this.subagentActions.hydrateSubagentsFromHistory(...e)}}const Jk=1;function RL(){return typeof window<"u"?(window.__tideStore&&window.__tideStoreVersion===Jk||(window.__tideStore=new Xk,window.__tideStoreVersion=Jk),window.__tideStore):new Xk}const U=RL(),Wj=b.createContext(null),OL={error:"❌",success:"✅",warning:"⚠️",info:"ℹ️"};let LL=0;function PL({children:t}){const[e,n]=b.useState(null),s=b.useRef([]),a=b.useRef(null),r=b.useCallback(()=>{if(s.current.length>0&&!e){const d=s.current.shift();n(d)}},[e]);b.useEffect(()=>{e||r()},[e,r]),b.useEffect(()=>{if(e&&e.duration>0)return a.current=window.setTimeout(()=>{n(null)},e.duration),()=>{a.current&&clearTimeout(a.current)}},[e]);const i=b.useCallback((d,f,h,m=5e3)=>{const y={id:++LL,type:d,title:f,message:h,duration:m};if(s.current.push(y),!e){const v=s.current.shift();n(v)}},[e]),c=b.useCallback(()=>{a.current&&clearTimeout(a.current),n(null)},[]);return o.jsxs(Wj.Provider,{value:{showToast:i},children:[t,o.jsx("div",{id:"toast-container",children:e&&o.jsxs("div",{className:`toast ${e.type}`,children:[o.jsx("span",{className:"toast-icon",children:OL[e.type]}),o.jsxs("div",{className:"toast-content",children:[o.jsx("div",{className:"toast-title",children:e.title}),o.jsx("div",{className:"toast-message",children:e.message})]}),o.jsx("button",{className:"toast-close",onClick:c,children:"×"})]},e.id)})]})}function qj(){const t=b.useContext(Wj);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const po={scout:{icon:"🔍",color:"#4a9eff",description:"Codebase exploration, file discovery"},builder:{icon:"🔨",color:"#ff9e4a",description:"Feature implementation, writing code"},debugger:{icon:"🐛",color:"#ff4a4a",description:"Bug hunting, fixing issues"},architect:{icon:"📐",color:"#9e4aff",description:"Planning, design decisions"},warrior:{icon:"⚔️",color:"#ff4a9e",description:"Aggressive refactoring, migrations"},support:{icon:"💚",color:"#4aff9e",description:"Documentation, tests, cleanup"},boss:{icon:"👑",color:"#ffd700",description:"Team leader, delegates tasks to subordinates"}},wp=po,iu={bypass:{label:"Permissionless",description:"Skip all permission prompts (less safe, faster)"},interactive:{label:"Interactive",description:"Ask for approval before sensitive operations"}},ef={"gpt-5.4":{label:"GPT-5.4",description:"Latest frontier model with advanced reasoning and coding",icon:"🌟"},"gpt-5.3-codex":{label:"GPT-5.3 Codex",description:"Latest frontier agentic coding model",icon:"⚙️"},"gpt-5.2-codex":{label:"GPT-5.2 Codex",description:"Frontier agentic coding model",icon:"🧠"},"gpt-5.1-codex-max":{label:"GPT-5.1 Codex Max",description:"Codex-optimized flagship for deep and fast reasoning",icon:"🚀"},"gpt-5.1-codex-mini":{label:"GPT-5.1 Codex Mini",description:"Optimized for codex, cheaper and faster",icon:"⚡"},"gpt-5.2":{label:"GPT-5.2",description:"General frontier model with strong reasoning and coding",icon:"🧩"}},tf={sonnet:{label:"Sonnet",description:"Balanced performance and cost (recommended)",icon:"⚡"},opus:{label:"Opus",description:"Most capable, higher cost",icon:"🧠"},haiku:{label:"Haiku",description:"Fast and economical",icon:"🚀"}},ug={low:{label:"Low",description:"Minimal reasoning, fastest responses",icon:"🏃"},medium:{label:"Medium",description:"Balanced reasoning effort",icon:"⚖️"},high:{label:"High",description:"Deep reasoning for complex tasks (default)",icon:"🔬"},max:{label:"Max",description:"Maximum reasoning, most thorough",icon:"🧠"}},Cb="<<<BOSS_CONTEXT_START>>>",Zk="<<<BOSS_CONTEXT_END>>>",IL={server:{icon:"🖥️",color:"#4aff9e",description:"Service with start/stop commands and logs"},link:{icon:"🔗",color:"#4a9eff",description:"Quick links to URLs"},database:{icon:"🗄️",color:"#ff9e4a",description:"Database connection and queries"},docker:{icon:"🐳",color:"#4ac1ff",description:"Docker container management"},monitor:{icon:"📊",color:"#ff4a9e",description:"System metrics and monitoring"},folder:{icon:"📁",color:"#ffd700",description:"Folder shortcut - opens file explorer on click"},boss:{icon:"👑",color:"#ffd700",description:"Boss building - manages multiple buildings with unified controls"},terminal:{icon:"💻",color:"#a855f7",description:"Interactive web terminal via ttyd"}},hV={"server-rack":{label:"Server Rack",description:"Classic server rack with blinking LEDs"},tower:{label:"Control Tower",description:"Tall tower with rotating antenna"},dome:{label:"Data Dome",description:"Futuristic dome with energy ring"},pyramid:{label:"Power Pyramid",description:"Egyptian-style pyramid with glowing core"},desktop:{label:"Desktop PC",description:"Retro computer with monitor and keyboard"},"filing-cabinet":{label:"Filing Cabinet",description:"Office cabinet with sliding drawers"},satellite:{label:"Satellite Dish",description:"Communication dish with rotating receiver"},crystal:{label:"Data Crystal",description:"Floating crystal with energy particles"},factory:{label:"Mini Factory",description:"Industrial building with smoking chimney"},"command-center":{label:"Command Center",description:"Grand central hub for boss buildings with holographic rings"}},mV={"":{label:"Auto-detect",description:"Let PM2 detect the interpreter"},node:{label:"Node.js",description:"JavaScript/TypeScript runtime"},bun:{label:"Bun",description:"Bun JavaScript runtime"},python3:{label:"Python 3",description:"Python 3 interpreter"},python:{label:"Python 2",description:"Python 2 interpreter (legacy)"},java:{label:"Java",description:"Java runtime (use with -jar args)"},php:{label:"PHP",description:"PHP interpreter"},bash:{label:"Bash",description:"Bash shell script"},none:{label:"None (Binary)",description:"Direct execution (compiled binaries)"}},gV={no:{label:"No",description:"Do not automatically restart"},always:{label:"Always",description:"Always restart when stopped"},"unless-stopped":{label:"Unless Stopped",description:"Restart unless manually stopped"},"on-failure":{label:"On Failure",description:"Restart only on failure"}},bV={always:{label:"Always",description:"Always pull the image"},missing:{label:"If Missing",description:"Pull only if image not present"},never:{label:"Never",description:"Never pull, use local only"}},BL={mysql:{label:"MySQL",icon:"🐬",defaultPort:3306},postgresql:{label:"PostgreSQL",icon:"🐘",defaultPort:5432},oracle:{label:"Oracle",icon:"🔶",defaultPort:1521},sqlite:{label:"SQLite",icon:"🪶",defaultPort:0},mssql:{label:"SQL Server",icon:"🔷",defaultPort:1433}},Vj=b.createContext(null);function Gj(t){const e=po[t];if(e)return e.icon;const s=U.getState().customAgentClasses.get(t);return s?s.icon:"🤖"}function FL(t){const e=po[t];if(e)return e.color;const s=U.getState().customAgentClasses.get(t);return s?s.color:"#888888"}const zL=3,eS=80;function $L({notification:t,onDismiss:e,onClick:n}){const s=b.useRef({startX:0,startY:0,locked:!1}),[a,r]=b.useState(0),[i,c]=b.useState(!1),d=b.useRef(!1),f="ontouchstart"in window||navigator.maxTouchPoints>0,h=Gj(t.agentClass),m=FL(t.agentClass),x=b.useCallback(E=>{s.current={startX:E.touches[0].clientX,startY:E.touches[0].clientY,locked:!1},d.current=!1},[]),y=b.useCallback(E=>{const D=E.touches[0].clientX-s.current.startX,_=E.touches[0].clientY-s.current.startY;!s.current.locked&&(Math.abs(D)<10&&Math.abs(_)<10||(s.current.locked=!0,Math.abs(_)>Math.abs(D)))||D<0&&(d.current=!0,r(D))},[]),v=b.useCallback(()=>{a<-eS?(c(!0),$f(2),setTimeout(()=>e(t.id),200)):r(0),setTimeout(()=>{d.current=!1},50)},[a,e,t.id]),S=b.useCallback(()=>{d.current||n(t)},[n,t]),C=Math.min(Math.abs(a)/(eS*1.5),1),k=i?0:1-C*.6,N=i?"-120%":`${a}px`,j=d.current&&!i?"none":"transform 0.2s ease-out, opacity 0.2s ease-out";return o.jsxs("div",{className:`agent-notification${i?" is-dismissing":""}`,onClick:f?void 0:S,onTouchStart:x,onTouchMove:y,onTouchEnd:v,style:{"--agent-color":m,transform:`translateX(${N})`,opacity:k,transition:j},children:[o.jsxs("div",{className:"agent-notification-content",children:[o.jsxs("div",{className:"agent-notification-header",children:[o.jsx("span",{className:"agent-notification-icon",children:h}),o.jsx("span",{className:"agent-notification-name",children:t.agentName}),o.jsx("span",{className:"agent-notification-separator",children:"·"}),o.jsx("span",{className:"agent-notification-title",children:t.title})]}),o.jsx("div",{className:"agent-notification-message",children:t.message})]}),o.jsx("button",{className:"agent-notification-close",onClick:E=>{E.stopPropagation(),e(t.id)},children:"×"})]})}function HL({children:t}){const{t:e}=pt(["notifications"]),[n,s]=b.useState([]),a=b.useRef(new Map);b.useEffect(()=>()=>{a.current.forEach(d=>clearTimeout(d))},[]);const r=b.useCallback(d=>{s(h=>h.filter(m=>m.id!==d));const f=a.current.get(d);f&&(clearTimeout(f),a.current.delete(d))},[]),i=b.useCallback(d=>{U.setLatestNotificationAgentId(d.agentId),s(h=>{const m=[...h,d];if(m.length>zL){const x=m.shift();if(x){const y=a.current.get(x.id);y&&(clearTimeout(y),a.current.delete(x.id))}}return m});const f=window.setTimeout(()=>{r(d.id)},8e3);if(a.current.set(d.id,f),!Tu()){const h=Gj(d.agentClass);jR({title:`${h} ${d.agentName}: ${d.title}`,body:d.message,data:{type:"agent_notification",agentId:d.agentId,notificationId:d.id}})}},[r]),c=b.useCallback(d=>{cj(d.agentId),r(d.id)},[r]);return o.jsxs(Vj.Provider,{value:{showAgentNotification:i},children:[t,o.jsx("div",{id:"agent-notification-container",children:n.map(d=>o.jsx($L,{notification:d,onDismiss:r,onClick:c},d.id))})]})}function UL(){const t=b.useContext(Vj);if(!t)throw new Error("useAgentNotification must be used within AgentNotificationProvider");return t}const WL={scout:{icon:"🔍",color:4890367,description:"Explores and searches codebase"},builder:{icon:"🔨",color:16752202,description:"Creates and builds features"},debugger:{icon:"🐛",color:16730698,description:"Finds and fixes bugs"},architect:{icon:"📐",color:10373887,description:"Plans and designs systems"},warrior:{icon:"⚔️",color:16730782,description:"Tackles tough problems"},support:{icon:"💚",color:4915102,description:"Helps and assists others"},boss:{icon:"👑",color:16766720,description:"Manages and delegates to subordinates"}},qL=["Alex","Sam","Jordan","Taylor","Casey","Morgan","Riley","Quinn","Avery","Blake","Cameron","Drew","Emery","Finley","Harper","Jamie","Kai","Logan","Max","Nico","Parker","Reese","Sage","Sky"],xV=qL,VL={scout:"character-male-a.glb",builder:"character-male-b.glb",debugger:"character-female-a.glb",architect:"character-male-c.glb",warrior:"character-female-b.glb",support:"character-female-c.glb",boss:"character-male-c.glb"},yV=[{id:"scout",model:"character-male-a.glb",name:"Explorer",gender:"Male"},{id:"builder",model:"character-male-b.glb",name:"Crafter",gender:"Male"},{id:"architect",model:"character-male-c.glb",name:"Planner",gender:"Male"},{id:"debugger",model:"character-female-a.glb",name:"Analyst",gender:"Female"},{id:"warrior",model:"character-female-b.glb",name:"Fighter",gender:"Female"},{id:"support",model:"character-female-c.glb",name:"Healer",gender:"Female"}],vV=[{file:"character-male-a.glb",name:"Male A (Explorer)",gender:"Male"},{file:"character-male-b.glb",name:"Male B (Crafter)",gender:"Male"},{file:"character-male-c.glb",name:"Male C (Planner)",gender:"Male"},{file:"character-male-d.glb",name:"Male D",gender:"Male"},{file:"character-male-e.glb",name:"Male E",gender:"Male"},{file:"character-male-f.glb",name:"Male F",gender:"Male"},{file:"character-female-a.glb",name:"Female A (Analyst)",gender:"Female"},{file:"character-female-b.glb",name:"Female B (Fighter)",gender:"Female"},{file:"character-female-c.glb",name:"Female C (Healer)",gender:"Female"},{file:"character-female-d.glb",name:"Female D",gender:"Female"},{file:"character-female-e.glb",name:"Female E",gender:"Female"},{file:"character-female-f.glb",name:"Female F",gender:"Female"}],wV=3,kV=5,SV=1e3,CV=50,AV=1.2;function GL(t){return typeof t=="string"?t:"#"+t.toString(16).padStart(6,"0")}function Ia(t,e){const n=WL[t];if(n)return{icon:n.icon,color:GL(n.color),description:n.description};const s=e.find(a=>a.id===t);return s?{icon:s.icon,color:s.color,description:s.description}:{icon:"🤖",color:"#888888"}}const YL=2e5,KL=258400;function Lc(t){return Math.max(0,Math.min(100,t))}function tS(t){const e=t.provider==="codex"||t.provider==="opencode"?KL:YL,n=Math.max(1,Math.round(t.contextLimit||e)),s=Math.max(0,Math.min(Math.round(t.contextUsed||0),n)),a=Lc(Number((s/n*100).toFixed(1))),r=t.contextStats;if(!r)return{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Lc(Number((100-a).toFixed(1)))};const i=Math.max(1,Math.round(r.contextWindow||n)),c=Math.max(0,Math.min(Math.round(r.totalTokens||0),i)),d=Lc(Number((r.usedPercent??c/i*100).toFixed(1)));return n!==i||s!==c?{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Lc(Number((100-a).toFixed(1)))}:{totalTokens:c,contextWindow:i,usedPercent:d,freePercent:Lc(Number((100-d).toFixed(1)))}}function QL(t){const e=Math.floor((Date.now()-t)/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Wf(t){const e=Math.floor((Date.now()-t)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function kp(t){if(t.contextStats){const n=tS(t);return{remainingPercent:n.freePercent,usedPercent:n.usedPercent,hasData:!0,totalTokens:n.totalTokens,contextWindow:n.contextWindow,freeTokens:n.contextWindow-n.totalTokens}}const e=tS(t);return{remainingPercent:e.freePercent,usedPercent:e.usedPercent,hasData:!1,totalTokens:e.totalTokens,contextWindow:e.contextWindow,freeTokens:e.contextWindow-e.totalTokens}}function Yj(t){return t<20?"#c85858":t<50?"#c89858":"#6a9a78"}const nS={working:0,waiting_permission:1,waiting:2,error:3,orphaned:4,idle:5,offline:6};function XL(t){return[...t].sort((e,n)=>{const s=nS[e.status]??5,a=nS[n.status]??5;return s!==a?s-a:(n.lastActivity||0)-(e.lastActivity||0)})}function JL(t,e){const n=new Map;for(const s of t){const a=e(s.id),r=(a==null?void 0:a.id)||null;n.has(r)||n.set(r,[]),n.get(r).push(s)}return n}function ZL(t,e){return[...t].sort((n,s)=>{if(n===null)return 1;if(s===null)return-1;const a=n?e(n):void 0,r=s?e(s):void 0;return((a==null?void 0:a.name)||"").localeCompare((r==null?void 0:r.name)||"")})}function sS(t,e){if(e===O_)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===nb||e===BA){let n=t.getIndex();if(n===null){const i=[],c=t.getAttribute("position");if(c!==void 0){for(let d=0;d<c.count;d++)i.push(d);t.setIndex(i),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const s=n.count-2,a=[];if(e===nb)for(let i=1;i<=s;i++)a.push(n.getX(0)),a.push(n.getX(i)),a.push(n.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(a.push(n.getX(i)),a.push(n.getX(i+1)),a.push(n.getX(i+2))):(a.push(n.getX(i+2)),a.push(n.getX(i+1)),a.push(n.getX(i)));a.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=t.clone();return r.setIndex(a),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class e2 extends FA{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new r2(n)}),this.register(function(n){return new i2(n)}),this.register(function(n){return new m2(n)}),this.register(function(n){return new g2(n)}),this.register(function(n){return new b2(n)}),this.register(function(n){return new l2(n)}),this.register(function(n){return new c2(n)}),this.register(function(n){return new u2(n)}),this.register(function(n){return new d2(n)}),this.register(function(n){return new a2(n)}),this.register(function(n){return new f2(n)}),this.register(function(n){return new o2(n)}),this.register(function(n){return new h2(n)}),this.register(function(n){return new p2(n)}),this.register(function(n){return new n2(n)}),this.register(function(n){return new x2(n)}),this.register(function(n){return new y2(n)})}load(e,n,s,a){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const f=Zc.extractUrlBase(e);i=Zc.resolveURL(f,this.path)}else i=Zc.extractUrlBase(e);this.manager.itemStart(e);const c=function(f){a?a(f):console.error(f),r.manager.itemError(e),r.manager.itemEnd(e)},d=new Rf(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(e,function(f){try{r.parse(f,i,function(h){n(h),r.manager.itemEnd(e)},c)}catch(h){c(h)}},s,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,s,a){let r;const i={},c={},d=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(d.decode(new Uint8Array(e,0,4))===Kj){try{i[Xt.KHR_BINARY_GLTF]=new v2(e)}catch(m){a&&a(m);return}r=JSON.parse(i[Xt.KHR_BINARY_GLTF].content)}else r=JSON.parse(d.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){a&&a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const f=new R2(r,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const m=this.pluginCallbacks[h](f);m.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[m.name]=m,i[m.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const m=r.extensionsUsed[h],x=r.extensionsRequired||[];switch(m){case Xt.KHR_MATERIALS_UNLIT:i[m]=new s2;break;case Xt.KHR_DRACO_MESH_COMPRESSION:i[m]=new w2(r,this.dracoLoader);break;case Xt.KHR_TEXTURE_TRANSFORM:i[m]=new k2;break;case Xt.KHR_MESH_QUANTIZATION:i[m]=new S2;break;default:x.indexOf(m)>=0&&c[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}f.setExtensions(i),f.setPlugins(c),f.parse(s,a)}parseAsync(e,n){const s=this;return new Promise(function(a,r){s.parse(e,n,a,r)})}}function t2(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const Xt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class n2{constructor(e){this.parser=e,this.name=Xt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let s=0,a=n.length;s<a;s++){const r=n[s];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const n=this.parser,s="light:"+e;let a=n.cache.get(s);if(a)return a;const r=n.json,d=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let f;const h=new Pr(16777215);d.color!==void 0&&h.setRGB(d.color[0],d.color[1],d.color[2],sr);const m=d.range!==void 0?d.range:0;switch(d.type){case"directional":f=new sb(h),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new P_(h),f.distance=m;break;case"spot":f=new L_(h),f.distance=m,d.spot=d.spot||{},d.spot.innerConeAngle=d.spot.innerConeAngle!==void 0?d.spot.innerConeAngle:0,d.spot.outerConeAngle=d.spot.outerConeAngle!==void 0?d.spot.outerConeAngle:Math.PI/4,f.angle=d.spot.outerConeAngle,f.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return f.position.set(0,0,0),f.decay=2,Tr(f,d),d.intensity!==void 0&&(f.intensity=d.intensity),f.name=n.createUniqueName(d.name||"light_"+e),a=Promise.resolve(f),n.cache.add(s,a),a}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,s=this.parser,r=s.json.nodes[e],c=(r.extensions&&r.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(d){return s._getNodeRef(n.cache,c,d)})}}class s2{constructor(){this.name=Xt.KHR_MATERIALS_UNLIT}getMaterialType(){return pl}extendParams(e,n,s){const a=[];e.color=new Pr(1,1,1),e.opacity=1;const r=n.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],sr),e.opacity=i[3]}r.baseColorTexture!==void 0&&a.push(s.assignTexture(e,"map",r.baseColorTexture,Mr))}return Promise.all(a)}}class a2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name].emissiveStrength;return r!==void 0&&(n.emissiveIntensity=r),Promise.resolve()}}class r2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];if(i.clearcoatFactor!==void 0&&(n.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(s.assignTexture(n,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(s.assignTexture(n,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(s.assignTexture(n,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const c=i.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new zA(c,c)}return Promise.all(r)}}class i2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name];return n.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class o2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.iridescenceFactor!==void 0&&(n.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(s.assignTexture(n,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(n.iridescenceIOR=i.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(s.assignTexture(n,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}}class l2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[];n.sheenColor=new Pr(0,0,0),n.sheenRoughness=0,n.sheen=1;const i=a.extensions[this.name];if(i.sheenColorFactor!==void 0){const c=i.sheenColorFactor;n.sheenColor.setRGB(c[0],c[1],c[2],sr)}return i.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(s.assignTexture(n,"sheenColorMap",i.sheenColorTexture,Mr)),i.sheenRoughnessTexture!==void 0&&r.push(s.assignTexture(n,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class c2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.transmissionFactor!==void 0&&(n.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(s.assignTexture(n,"transmissionMap",i.transmissionTexture)),Promise.all(r)}}class u2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];n.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(s.assignTexture(n,"thicknessMap",i.thicknessTexture)),n.attenuationDistance=i.attenuationDistance||1/0;const c=i.attenuationColor||[1,1,1];return n.attenuationColor=new Pr().setRGB(c[0],c[1],c[2],sr),Promise.all(r)}}class d2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name];return n.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class f2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];n.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(s.assignTexture(n,"specularIntensityMap",i.specularTexture));const c=i.specularColorFactor||[1,1,1];return n.specularColor=new Pr().setRGB(c[0],c[1],c[2],sr),i.specularColorTexture!==void 0&&r.push(s.assignTexture(n,"specularColorMap",i.specularColorTexture,Mr)),Promise.all(r)}}class p2{constructor(e){this.parser=e,this.name=Xt.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return n.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(s.assignTexture(n,"bumpMap",i.bumpTexture)),Promise.all(r)}}class h2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:ar}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.anisotropyStrength!==void 0&&(n.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(n.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(s.assignTexture(n,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}}class m2{constructor(e){this.parser=e,this.name=Xt.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,s=n.json,a=s.textures[e];if(!a.extensions||!a.extensions[this.name])return null;const r=a.extensions[this.name],i=n.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,r.source,i)}}class g2{constructor(e){this.parser=e,this.name=Xt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,s=this.parser,a=s.json,r=a.textures[e];if(!r.extensions||!r.extensions[n])return null;const i=r.extensions[n],c=a.images[i.source];let d=s.textureLoader;if(c.uri){const f=s.options.manager.getHandler(c.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return s.loadTextureImage(e,i.source,d);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class b2{constructor(e){this.parser=e,this.name=Xt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,s=this.parser,a=s.json,r=a.textures[e];if(!r.extensions||!r.extensions[n])return null;const i=r.extensions[n],c=a.images[i.source];let d=s.textureLoader;if(c.uri){const f=s.options.manager.getHandler(c.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return s.loadTextureImage(e,i.source,d);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class x2{constructor(e){this.name=Xt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,s=n.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const a=s.extensions[this.name],r=this.parser.getDependency("buffer",a.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(c){const d=a.byteOffset||0,f=a.byteLength||0,h=a.count,m=a.byteStride,x=new Uint8Array(c,d,f);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(h,m,x,a.mode,a.filter).then(function(y){return y.buffer}):i.ready.then(function(){const y=new ArrayBuffer(h*m);return i.decodeGltfBuffer(new Uint8Array(y),h,m,x,a.mode,a.filter),y})})}else return null}}class y2{constructor(e){this.name=Xt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,s=n.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const a=n.meshes[s.mesh];for(const f of a.primitives)if(f.mode!==ga.TRIANGLES&&f.mode!==ga.TRIANGLE_STRIP&&f.mode!==ga.TRIANGLE_FAN&&f.mode!==void 0)return null;const i=s.extensions[this.name].attributes,c=[],d={};for(const f in i)c.push(this.parser.getDependency("accessor",i[f]).then(h=>(d[f]=h,d[f])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(f=>{const h=f.pop(),m=h.isGroup?h.children:[h],x=f[0].count,y=[];for(const v of m){const S=new Of,C=new ao,k=new $A,N=new ao(1,1,1),j=new I_(v.geometry,v.material,x);for(let E=0;E<x;E++)d.TRANSLATION&&C.fromBufferAttribute(d.TRANSLATION,E),d.ROTATION&&k.fromBufferAttribute(d.ROTATION,E),d.SCALE&&N.fromBufferAttribute(d.SCALE,E),j.setMatrixAt(E,S.compose(C,k,N));for(const E in d)if(E==="_COLOR_0"){const D=d[E];j.instanceColor=new B_(D.array,D.itemSize,D.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&v.geometry.setAttribute(E,d[E]);HA.prototype.copy.call(j,v),this.parser.assignFinalMaterial(j),y.push(j)}return h.isGroup?(h.clear(),h.add(...y),h):y[0]}))}}const Kj="glTF",Pc=12,aS={JSON:1313821514,BIN:5130562};class v2{constructor(e){this.name=Xt.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,Pc),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Kj)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const a=this.header.length-Pc,r=new DataView(e,Pc);let i=0;for(;i<a;){const c=r.getUint32(i,!0);i+=4;const d=r.getUint32(i,!0);if(i+=4,d===aS.JSON){const f=new Uint8Array(e,Pc+i,c);this.content=s.decode(f)}else if(d===aS.BIN){const f=Pc+i;this.body=e.slice(f,f+c)}i+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class w2{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Xt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const s=this.json,a=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,c={},d={},f={};for(const h in i){const m=Ab[h]||h.toLowerCase();c[m]=i[h]}for(const h in e.attributes){const m=Ab[h]||h.toLowerCase();if(i[h]!==void 0){const x=s.accessors[e.attributes[h]],y=gl[x.componentType];f[m]=y.name,d[m]=x.normalized===!0}}return n.getDependency("bufferView",r).then(function(h){return new Promise(function(m,x){a.decodeDracoFile(h,function(y){for(const v in y.attributes){const S=y.attributes[v],C=d[v];C!==void 0&&(S.normalized=C)}m(y)},c,f,sr,x)})})}}class k2{constructor(){this.name=Xt.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class S2{constructor(){this.name=Xt.KHR_MESH_QUANTIZATION}}class Qj extends cM{constructor(e,n,s,a){super(e,n,s,a)}copySampleValue_(e){const n=this.resultBuffer,s=this.sampleValues,a=this.valueSize,r=e*a*3+a;for(let i=0;i!==a;i++)n[i]=s[r+i];return n}interpolate_(e,n,s,a){const r=this.resultBuffer,i=this.sampleValues,c=this.valueSize,d=c*2,f=c*3,h=a-n,m=(s-n)/h,x=m*m,y=x*m,v=e*f,S=v-f,C=-2*y+3*x,k=y-x,N=1-C,j=k-x+m;for(let E=0;E!==c;E++){const D=i[S+E+c],_=i[S+E+d]*h,P=i[v+E+c],O=i[v+E]*h;r[E]=N*D+j*_+C*P+k*O}return r}}const C2=new $A;class A2 extends Qj{interpolate_(e,n,s,a){const r=super.interpolate_(e,n,s,a);return C2.fromArray(r).normalize().toArray(r),r}}const ga={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},gl={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},rS={9728:WA,9729:ab,9984:W_,9985:U_,9986:H_,9987:UA},iS={33071:V_,33648:q_,10497:rb},dg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ab={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},j2={CUBICSPLINE:void 0,LINEAR:YA,STEP:iM},fg={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function N2(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new Qb({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:lM})),t.DefaultMaterial}function Xi(t,e,n){for(const s in n.extensions)t[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=n.extensions[s])}function Tr(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function T2(t,e,n){let s=!1,a=!1,r=!1;for(let f=0,h=e.length;f<h;f++){const m=e[f];if(m.POSITION!==void 0&&(s=!0),m.NORMAL!==void 0&&(a=!0),m.COLOR_0!==void 0&&(r=!0),s&&a&&r)break}if(!s&&!a&&!r)return Promise.resolve(t);const i=[],c=[],d=[];for(let f=0,h=e.length;f<h;f++){const m=e[f];if(s){const x=m.POSITION!==void 0?n.getDependency("accessor",m.POSITION):t.attributes.position;i.push(x)}if(a){const x=m.NORMAL!==void 0?n.getDependency("accessor",m.NORMAL):t.attributes.normal;c.push(x)}if(r){const x=m.COLOR_0!==void 0?n.getDependency("accessor",m.COLOR_0):t.attributes.color;d.push(x)}}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(d)]).then(function(f){const h=f[0],m=f[1],x=f[2];return s&&(t.morphAttributes.position=h),a&&(t.morphAttributes.normal=m),r&&(t.morphAttributes.color=x),t.morphTargetsRelative=!0,t})}function E2(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,s=e.weights.length;n<s;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let s=0,a=n.length;s<a;s++)t.morphTargetDictionary[n[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function _2(t){let e;const n=t.extensions&&t.extensions[Xt.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+pg(n.attributes):e=t.indices+":"+pg(t.attributes)+":"+t.mode,t.targets!==void 0)for(let s=0,a=t.targets.length;s<a;s++)e+=":"+pg(t.targets[s]);return e}function pg(t){let e="";const n=Object.keys(t).sort();for(let s=0,a=n.length;s<a;s++)e+=n[s]+":"+t[n[s]]+";";return e}function jb(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function M2(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const D2=new Of;class R2{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new t2,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,a=-1,r=!1,i=-1;if(typeof navigator<"u"){const c=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(c)===!0;const d=c.match(/Version\/(\d+)/);a=s&&d?parseInt(d[1],10):-1,r=c.indexOf("Firefox")>-1,i=r?c.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&a<17||r&&i<98?this.textureLoader=new F_(this.options.manager):this.textureLoader=new z_(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Rf(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const s=this,a=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(i){const c={scene:i[0][a.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:a.asset,parser:s,userData:{}};return Xi(r,c,a),Tr(c,a),Promise.all(s._invokeAll(function(d){return d.afterRoot&&d.afterRoot(c)})).then(function(){for(const d of c.scenes)d.updateMatrixWorld();e(c)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],s=this.json.meshes||[];for(let a=0,r=n.length;a<r;a++){const i=n[a].joints;for(let c=0,d=i.length;c<d;c++)e[i[c]].isBone=!0}for(let a=0,r=e.length;a<r;a++){const i=e[a];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,s){if(e.refs[n]<=1)return s;const a=s.clone(),r=(i,c)=>{const d=this.associations.get(i);d!=null&&this.associations.set(c,d);for(const[f,h]of i.children.entries())r(h,c.children[f])};return r(s,a),a.name+="_instance_"+e.uses[n]++,a}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let s=0;s<n.length;s++){const a=e(n[s]);if(a)return a}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const s=[];for(let a=0;a<n.length;a++){const r=e(n[a]);r&&s.push(r)}return s}getDependency(e,n){const s=e+":"+n;let a=this.cache.get(s);if(!a){switch(e){case"scene":a=this.loadScene(n);break;case"node":a=this._invokeOne(function(r){return r.loadNode&&r.loadNode(n)});break;case"mesh":a=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(n)});break;case"accessor":a=this.loadAccessor(n);break;case"bufferView":a=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(n)});break;case"buffer":a=this.loadBuffer(n);break;case"material":a=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(n)});break;case"texture":a=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(n)});break;case"skin":a=this.loadSkin(n);break;case"animation":a=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(n)});break;case"camera":a=this.loadCamera(n);break;default:if(a=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,n)}),!a)throw new Error("Unknown type: "+e);break}this.cache.add(s,a)}return a}getDependencies(e){let n=this.cache.get(e);if(!n){const s=this,a=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(a.map(function(r,i){return s.getDependency(e,i)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],s=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[Xt.KHR_BINARY_GLTF].body);const a=this.options;return new Promise(function(r,i){s.load(Zc.resolveURL(n.uri,a.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(s){const a=n.byteLength||0,r=n.byteOffset||0;return s.slice(r,r+a)})}loadAccessor(e){const n=this,s=this.json,a=this.json.accessors[e];if(a.bufferView===void 0&&a.sparse===void 0){const i=dg[a.type],c=gl[a.componentType],d=a.normalized===!0,f=new c(a.count*i);return Promise.resolve(new eu(f,i,d))}const r=[];return a.bufferView!==void 0?r.push(this.getDependency("bufferView",a.bufferView)):r.push(null),a.sparse!==void 0&&(r.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(r).then(function(i){const c=i[0],d=dg[a.type],f=gl[a.componentType],h=f.BYTES_PER_ELEMENT,m=h*d,x=a.byteOffset||0,y=a.bufferView!==void 0?s.bufferViews[a.bufferView].byteStride:void 0,v=a.normalized===!0;let S,C;if(y&&y!==m){const k=Math.floor(x/y),N="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+k+":"+a.count;let j=n.cache.get(N);j||(S=new f(c,k*y,a.count*y/h),j=new $_(S,y/h),n.cache.add(N,j)),C=new oM(j,d,x%y/h,v)}else c===null?S=new f(a.count*d):S=new f(c,x,a.count*d),C=new eu(S,d,v);if(a.sparse!==void 0){const k=dg.SCALAR,N=gl[a.sparse.indices.componentType],j=a.sparse.indices.byteOffset||0,E=a.sparse.values.byteOffset||0,D=new N(i[1],j,a.sparse.count*k),_=new f(i[2],E,a.sparse.count*d);c!==null&&(C=new eu(C.array.slice(),C.itemSize,C.normalized)),C.normalized=!1;for(let P=0,O=D.length;P<O;P++){const T=D[P];if(C.setX(T,_[P*d]),d>=2&&C.setY(T,_[P*d+1]),d>=3&&C.setZ(T,_[P*d+2]),d>=4&&C.setW(T,_[P*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}C.normalized=v}return C})}loadTexture(e){const n=this.json,s=this.options,r=n.textures[e].source,i=n.images[r];let c=this.textureLoader;if(i.uri){const d=s.manager.getHandler(i.uri);d!==null&&(c=d)}return this.loadTextureImage(e,r,c)}loadTextureImage(e,n,s){const a=this,r=this.json,i=r.textures[e],c=r.images[n],d=(c.uri||c.bufferView)+":"+i.sampler;if(this.textureCache[d])return this.textureCache[d];const f=this.loadImageSource(n,s).then(function(h){h.flipY=!1,h.name=i.name||c.name||"",h.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(h.name=c.uri);const x=(r.samplers||{})[i.sampler]||{};return h.magFilter=rS[x.magFilter]||ab,h.minFilter=rS[x.minFilter]||UA,h.wrapS=iS[x.wrapS]||rb,h.wrapT=iS[x.wrapT]||rb,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==WA&&h.minFilter!==ab,a.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[d]=f,f}loadImageSource(e,n){const s=this,a=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(m=>m.clone());const i=a.images[e],c=self.URL||self.webkitURL;let d=i.uri||"",f=!1;if(i.bufferView!==void 0)d=s.getDependency("bufferView",i.bufferView).then(function(m){f=!0;const x=new Blob([m],{type:i.mimeType});return d=c.createObjectURL(x),d});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(d).then(function(m){return new Promise(function(x,y){let v=x;n.isImageBitmapLoader===!0&&(v=function(S){const C=new L0(S);C.needsUpdate=!0,x(C)}),n.load(Zc.resolveURL(m,r.path),v,void 0,y)})}).then(function(m){return f===!0&&c.revokeObjectURL(d),Tr(m,i),m.userData.mimeType=i.mimeType||M2(i.uri),m}).catch(function(m){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),m});return this.sourceCache[e]=h,h}assignTexture(e,n,s,a){const r=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(i=i.clone(),i.channel=s.texCoord),r.extensions[Xt.KHR_TEXTURE_TRANSFORM]){const c=s.extensions!==void 0?s.extensions[Xt.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const d=r.associations.get(i);i=r.extensions[Xt.KHR_TEXTURE_TRANSFORM].extendTexture(i,c),r.associations.set(i,d)}}return a!==void 0&&(i.colorSpace=a),e[n]=i,i})}assignFinalMaterial(e){const n=e.geometry;let s=e.material;const a=n.attributes.tangent===void 0,r=n.attributes.color!==void 0,i=n.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+s.uuid;let d=this.cache.get(c);d||(d=new G_,wf.prototype.copy.call(d,s),d.color.copy(s.color),d.map=s.map,d.sizeAttenuation=!1,this.cache.add(c,d)),s=d}else if(e.isLine){const c="LineBasicMaterial:"+s.uuid;let d=this.cache.get(c);d||(d=new Y_,wf.prototype.copy.call(d,s),d.color.copy(s.color),d.map=s.map,this.cache.add(c,d)),s=d}if(a||r||i){let c="ClonedMaterial:"+s.uuid+":";a&&(c+="derivative-tangents:"),r&&(c+="vertex-colors:"),i&&(c+="flat-shading:");let d=this.cache.get(c);d||(d=s.clone(),r&&(d.vertexColors=!0),i&&(d.flatShading=!0),a&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(c,d),this.associations.set(d,this.associations.get(s))),s=d}e.material=s}getMaterialType(){return Qb}loadMaterial(e){const n=this,s=this.json,a=this.extensions,r=s.materials[e];let i;const c={},d=r.extensions||{},f=[];if(d[Xt.KHR_MATERIALS_UNLIT]){const m=a[Xt.KHR_MATERIALS_UNLIT];i=m.getMaterialType(),f.push(m.extendParams(c,r,n))}else{const m=r.pbrMetallicRoughness||{};if(c.color=new Pr(1,1,1),c.opacity=1,Array.isArray(m.baseColorFactor)){const x=m.baseColorFactor;c.color.setRGB(x[0],x[1],x[2],sr),c.opacity=x[3]}m.baseColorTexture!==void 0&&f.push(n.assignTexture(c,"map",m.baseColorTexture,Mr)),c.metalness=m.metallicFactor!==void 0?m.metallicFactor:1,c.roughness=m.roughnessFactor!==void 0?m.roughnessFactor:1,m.metallicRoughnessTexture!==void 0&&(f.push(n.assignTexture(c,"metalnessMap",m.metallicRoughnessTexture)),f.push(n.assignTexture(c,"roughnessMap",m.metallicRoughnessTexture))),i=this._invokeOne(function(x){return x.getMaterialType&&x.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(x){return x.extendMaterialParams&&x.extendMaterialParams(e,c)})))}r.doubleSided===!0&&(c.side=qA);const h=r.alphaMode||fg.OPAQUE;if(h===fg.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,h===fg.MASK&&(c.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==pl&&(f.push(n.assignTexture(c,"normalMap",r.normalTexture)),c.normalScale=new zA(1,1),r.normalTexture.scale!==void 0)){const m=r.normalTexture.scale;c.normalScale.set(m,m)}if(r.occlusionTexture!==void 0&&i!==pl&&(f.push(n.assignTexture(c,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==pl){const m=r.emissiveFactor;c.emissive=new Pr().setRGB(m[0],m[1],m[2],sr)}return r.emissiveTexture!==void 0&&i!==pl&&f.push(n.assignTexture(c,"emissiveMap",r.emissiveTexture,Mr)),Promise.all(f).then(function(){const m=new i(c);return r.name&&(m.name=r.name),Tr(m,r),n.associations.set(m,{materials:e}),r.extensions&&Xi(a,m,r),m})}createUniqueName(e){const n=K_.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,s=this.extensions,a=this.primitiveCache;function r(c){return s[Xt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,n).then(function(d){return oS(d,c,n)})}const i=[];for(let c=0,d=e.length;c<d;c++){const f=e[c],h=_2(f),m=a[h];if(m)i.push(m.promise);else{let x;f.extensions&&f.extensions[Xt.KHR_DRACO_MESH_COMPRESSION]?x=r(f):x=oS(new VA,f,n),a[h]={primitive:f,promise:x},i.push(x)}}return Promise.all(i)}loadMesh(e){const n=this,s=this.json,a=this.extensions,r=s.meshes[e],i=r.primitives,c=[];for(let d=0,f=i.length;d<f;d++){const h=i[d].material===void 0?N2(this.cache):this.getDependency("material",i[d].material);c.push(h)}return c.push(n.loadGeometries(i)),Promise.all(c).then(function(d){const f=d.slice(0,d.length-1),h=d[d.length-1],m=[];for(let y=0,v=h.length;y<v;y++){const S=h[y],C=i[y];let k;const N=f[y];if(C.mode===ga.TRIANGLES||C.mode===ga.TRIANGLE_STRIP||C.mode===ga.TRIANGLE_FAN||C.mode===void 0)k=r.isSkinnedMesh===!0?new Q_(S,N):new ul(S,N),k.isSkinnedMesh===!0&&k.normalizeSkinWeights(),C.mode===ga.TRIANGLE_STRIP?k.geometry=sS(k.geometry,BA):C.mode===ga.TRIANGLE_FAN&&(k.geometry=sS(k.geometry,nb));else if(C.mode===ga.LINES)k=new X_(S,N);else if(C.mode===ga.LINE_STRIP)k=new J_(S,N);else if(C.mode===ga.LINE_LOOP)k=new Z_(S,N);else if(C.mode===ga.POINTS)k=new eM(S,N);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);Object.keys(k.geometry.morphAttributes).length>0&&E2(k,r),k.name=n.createUniqueName(r.name||"mesh_"+e),Tr(k,r),C.extensions&&Xi(a,k,C),n.assignFinalMaterial(k),m.push(k)}for(let y=0,v=m.length;y<v;y++)n.associations.set(m[y],{meshes:e,primitives:y});if(m.length===1)return r.extensions&&Xi(a,m[0],r),m[0];const x=new Fm;r.extensions&&Xi(a,x,r),n.associations.set(x,{meshes:e});for(let y=0,v=m.length;y<v;y++)x.add(m[y]);return x})}loadCamera(e){let n;const s=this.json.cameras[e],a=s[s.type];if(!a){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?n=new GA(tM.radToDeg(a.yfov),a.aspectRatio||1,a.znear||1,a.zfar||2e6):s.type==="orthographic"&&(n=new nM(-a.xmag,a.xmag,a.ymag,-a.ymag,a.znear,a.zfar)),s.name&&(n.name=this.createUniqueName(s.name)),Tr(n,s),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],s=[];for(let a=0,r=n.joints.length;a<r;a++)s.push(this._loadNodeShallow(n.joints[a]));return n.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",n.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(a){const r=a.pop(),i=a,c=[],d=[];for(let f=0,h=i.length;f<h;f++){const m=i[f];if(m){c.push(m);const x=new Of;r!==null&&x.fromArray(r.array,f*16),d.push(x)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[f])}return new sM(c,d)})}loadAnimation(e){const n=this.json,s=this,a=n.animations[e],r=a.name?a.name:"animation_"+e,i=[],c=[],d=[],f=[],h=[];for(let m=0,x=a.channels.length;m<x;m++){const y=a.channels[m],v=a.samplers[y.sampler],S=y.target,C=S.node,k=a.parameters!==void 0?a.parameters[v.input]:v.input,N=a.parameters!==void 0?a.parameters[v.output]:v.output;S.node!==void 0&&(i.push(this.getDependency("node",C)),c.push(this.getDependency("accessor",k)),d.push(this.getDependency("accessor",N)),f.push(v),h.push(S))}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(d),Promise.all(f),Promise.all(h)]).then(function(m){const x=m[0],y=m[1],v=m[2],S=m[3],C=m[4],k=[];for(let N=0,j=x.length;N<j;N++){const E=x[N],D=y[N],_=v[N],P=S[N],O=C[N];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const T=s._createAnimationTracks(E,D,_,P,O);if(T)for(let M=0;M<T.length;M++)k.push(T[M])}return new aM(r,void 0,k)})}createNodeMesh(e){const n=this.json,s=this,a=n.nodes[e];return a.mesh===void 0?null:s.getDependency("mesh",a.mesh).then(function(r){const i=s._getNodeRef(s.meshCache,a.mesh,r);return a.weights!==void 0&&i.traverse(function(c){if(c.isMesh)for(let d=0,f=a.weights.length;d<f;d++)c.morphTargetInfluences[d]=a.weights[d]}),i})}loadNode(e){const n=this.json,s=this,a=n.nodes[e],r=s._loadNodeShallow(e),i=[],c=a.children||[];for(let f=0,h=c.length;f<h;f++)i.push(s.getDependency("node",c[f]));const d=a.skin===void 0?Promise.resolve(null):s.getDependency("skin",a.skin);return Promise.all([r,Promise.all(i),d]).then(function(f){const h=f[0],m=f[1],x=f[2];x!==null&&h.traverse(function(y){y.isSkinnedMesh&&y.bind(x,D2)});for(let y=0,v=m.length;y<v;y++)h.add(m[y]);return h})}_loadNodeShallow(e){const n=this.json,s=this.extensions,a=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=n.nodes[e],i=r.name?a.createUniqueName(r.name):"",c=[],d=a._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return d&&c.push(d),r.camera!==void 0&&c.push(a.getDependency("camera",r.camera).then(function(f){return a._getNodeRef(a.cameraCache,r.camera,f)})),a._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){c.push(f)}),this.nodeCache[e]=Promise.all(c).then(function(f){let h;if(r.isBone===!0?h=new rM:f.length>1?h=new Fm:f.length===1?h=f[0]:h=new HA,h!==f[0])for(let m=0,x=f.length;m<x;m++)h.add(f[m]);if(r.name&&(h.userData.name=r.name,h.name=i),Tr(h,r),r.extensions&&Xi(s,h,r),r.matrix!==void 0){const m=new Of;m.fromArray(r.matrix),h.applyMatrix4(m)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);return a.associations.has(h)||a.associations.set(h,{}),a.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const n=this.extensions,s=this.json.scenes[e],a=this,r=new Fm;s.name&&(r.name=a.createUniqueName(s.name)),Tr(r,s),s.extensions&&Xi(n,r,s);const i=s.nodes||[],c=[];for(let d=0,f=i.length;d<f;d++)c.push(a.getDependency("node",i[d]));return Promise.all(c).then(function(d){for(let h=0,m=d.length;h<m;h++)r.add(d[h]);const f=h=>{const m=new Map;for(const[x,y]of a.associations)(x instanceof wf||x instanceof L0)&&m.set(x,y);return h.traverse(x=>{const y=a.associations.get(x);y!=null&&m.set(x,y)}),m};return a.associations=f(r),r})}_createAnimationTracks(e,n,s,a,r){const i=[],c=e.name?e.name:e.uuid,d=[];bi[r.path]===bi.weights?e.traverse(function(x){x.morphTargetInfluences&&d.push(x.name?x.name:x.uuid)}):d.push(c);let f;switch(bi[r.path]){case bi.weights:f=I0;break;case bi.rotation:f=B0;break;case bi.position:case bi.scale:f=P0;break;default:switch(s.itemSize){case 1:f=I0;break;case 2:case 3:default:f=P0;break}break}const h=a.interpolation!==void 0?j2[a.interpolation]:YA,m=this._getArrayFromAccessor(s);for(let x=0,y=d.length;x<y;x++){const v=new f(d[x]+"."+bi[r.path],n.array,m,h);a.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),i.push(v)}return i}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const s=jb(n.constructor),a=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)a[r]=n[r]*s;n=a}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const a=this instanceof B0?A2:Qj;return new a(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function O2(t,e,n){const s=e.attributes,a=new uM;if(s.POSITION!==void 0){const c=n.json.accessors[s.POSITION],d=c.min,f=c.max;if(d!==void 0&&f!==void 0){if(a.set(new ao(d[0],d[1],d[2]),new ao(f[0],f[1],f[2])),c.normalized){const h=jb(gl[c.componentType]);a.min.multiplyScalar(h),a.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const c=new ao,d=new ao;for(let f=0,h=r.length;f<h;f++){const m=r[f];if(m.POSITION!==void 0){const x=n.json.accessors[m.POSITION],y=x.min,v=x.max;if(y!==void 0&&v!==void 0){if(d.setX(Math.max(Math.abs(y[0]),Math.abs(v[0]))),d.setY(Math.max(Math.abs(y[1]),Math.abs(v[1]))),d.setZ(Math.max(Math.abs(y[2]),Math.abs(v[2]))),x.normalized){const S=jb(gl[x.componentType]);d.multiplyScalar(S)}c.max(d)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(c)}t.boundingBox=a;const i=new dM;a.getCenter(i.center),i.radius=a.min.distanceTo(a.max)/2,t.boundingSphere=i}function oS(t,e,n){const s=e.attributes,a=[];function r(i,c){return n.getDependency("accessor",i).then(function(d){t.setAttribute(c,d)})}for(const i in s){const c=Ab[i]||i.toLowerCase();c in t.attributes||a.push(r(s[i],c))}if(e.indices!==void 0&&!t.index){const i=n.getDependency("accessor",e.indices).then(function(c){t.setIndex(c)});a.push(i)}return ib.workingColorSpace!==sr&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ib.workingColorSpace}" not supported.`),Tr(t,e),O2(t,e,n),Promise.all(a).then(function(){return e.targets!==void 0?T2(t,e.targets,n):t})}const hg=new WeakMap;class L2 extends FA{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,n,s,a){const r=new Rf(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{this.parse(i,n,a)},s,a)}parse(e,n,s=()=>{}){this.decodeDracoFile(e,n,null,null,Mr,s).catch(s)}decodeDracoFile(e,n,s,a,r=sr,i=()=>{}){const c={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:r};return this.decodeGeometry(e,c).then(n).catch(i)}decodeGeometry(e,n){const s=JSON.stringify(n);if(hg.has(e)){const d=hg.get(e);if(d.key===s)return d.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let a;const r=this.workerNextTaskID++,i=e.byteLength,c=this._getWorker(r,i).then(d=>(a=d,new Promise((f,h)=>{a._callbacks[r]={resolve:f,reject:h},a.postMessage({type:"decode",id:r,taskConfig:n,buffer:e},[e])}))).then(d=>this._createGeometry(d.geometry));return c.catch(()=>!0).then(()=>{a&&r&&this._releaseTask(a,r)}),hg.set(e,{key:s,promise:c}),c}_createGeometry(e){const n=new VA;e.index&&n.setIndex(new eu(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const a=e.attributes[s],r=a.name,i=a.array,c=a.itemSize,d=new eu(i,c);r==="color"&&(this._assignVertexColorSpace(d,a.vertexColorSpace),d.normalized=!(i instanceof Float32Array)),n.setAttribute(r,d)}return n}_assignVertexColorSpace(e,n){if(n!==Mr)return;const s=new Pr;for(let a=0,r=e.count;a<r;a++)s.fromBufferAttribute(e,a),ib.toWorkingColorSpace(s,Mr),e.setXYZ(a,s.r,s.g,s.b)}_loadLibrary(e,n){const s=new Rf(this.manager);return s.setPath(this.decoderPath),s.setResponseType(n),s.setWithCredentials(this.withCredentials),new Promise((a,r)=>{s.load(e,a,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",n=[];return e?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then(s=>{const a=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const r=P2.toString(),i=["/* draco decoder */",a,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
47
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,n){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const a=new Worker(this.workerSourceURL);a._callbacks={},a._taskCosts={},a._taskLoad=0,a.postMessage({type:"init",decoderConfig:this.decoderConfig}),a.onmessage=function(r){const i=r.data;switch(i.type){case"decode":a._callbacks[i.id].resolve(i);break;case"error":a._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(a)}else this.workerPool.sort(function(a,r){return a._taskLoad>r._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=n,s._taskLoad+=n,s})}_releaseTask(e,n){e._taskLoad-=e._taskCosts[n],delete e._callbacks[n],delete e._taskCosts[n]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function P2(){let t,e;onmessage=function(i){const c=i.data;switch(c.type){case"init":t=c.decoderConfig,e=new Promise(function(h){t.onModuleLoaded=function(m){h({draco:m})},DracoDecoderModule(t)});break;case"decode":const d=c.buffer,f=c.taskConfig;e.then(h=>{const m=h.draco,x=new m.Decoder;try{const y=n(m,x,new Int8Array(d),f),v=y.attributes.map(S=>S.array.buffer);y.index&&v.push(y.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:y},v)}catch(y){console.error(y),self.postMessage({type:"error",id:c.id,error:y.message})}finally{m.destroy(x)}});break}};function n(i,c,d,f){const h=f.attributeIDs,m=f.attributeTypes;let x,y;const v=c.GetEncodedGeometryType(d);if(v===i.TRIANGULAR_MESH)x=new i.Mesh,y=c.DecodeArrayToMesh(d,d.byteLength,x);else if(v===i.POINT_CLOUD)x=new i.PointCloud,y=c.DecodeArrayToPointCloud(d,d.byteLength,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!y.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());const S={index:null,attributes:[]};for(const C in h){const k=self[m[C]];let N,j;if(f.useUniqueIDs)j=h[C],N=c.GetAttributeByUniqueId(x,j);else{if(j=c.GetAttributeId(x,i[h[C]]),j===-1)continue;N=c.GetAttribute(x,j)}const E=a(i,c,x,C,k,N);C==="color"&&(E.vertexColorSpace=f.vertexColorSpace),S.attributes.push(E)}return v===i.TRIANGULAR_MESH&&(S.index=s(i,c,x)),i.destroy(x),S}function s(i,c,d){const h=d.num_faces()*3,m=h*4,x=i._malloc(m);c.GetTrianglesUInt32Array(d,m,x);const y=new Uint32Array(i.HEAPF32.buffer,x,h).slice();return i._free(x),{array:y,itemSize:1}}function a(i,c,d,f,h,m){const x=m.num_components(),v=d.num_points()*x,S=v*h.BYTES_PER_ELEMENT,C=r(i,h),k=i._malloc(S);c.GetAttributeDataArrayForAllPoints(d,m,C,S,k);const N=new h(i.HEAPF32.buffer,k,v).slice();return i._free(k),{name:f,array:N,itemSize:x}}function r(i,c){switch(c){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}var I2=(function(){var t="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),s=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var a=WebAssembly.validate(n)?e:t,r,i=WebAssembly.instantiate(c(a),{}).then(function(k){r=k.instance,r.exports.__wasm_call_ctors()});function c(k){for(var N=new Uint8Array(k.length),j=0;j<k.length;++j){var E=k.charCodeAt(j);N[j]=E>96?E-97:E>64?E-39:E+4}for(var D=0,j=0;j<k.length;++j)N[D++]=N[j]<60?s[N[j]]:(N[j]-60)*64+N[++j];return N.buffer.slice(0,D)}function d(k,N,j,E,D,_){var P=r.exports.sbrk,O=j+3&-4,T=P(O*E),M=P(D.length),R=new Uint8Array(r.exports.memory.buffer);R.set(D,M);var I=k(T,j,E,M,D.length);if(I==0&&_&&_(T,O,E),N.set(R.subarray(T,T+j*E)),P(T-P(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var f={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},m=[],x=0;function y(k){var N={object:new Worker(k),pending:0,requests:{}};return N.object.onmessage=function(j){var E=j.data;N.pending-=E.count,N.requests[E.id][E.action](E.value),delete N.requests[E.id]},N}function v(k){for(var N="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(c(a))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+d.toString()+C.toString(),j=new Blob([N],{type:"text/javascript"}),E=URL.createObjectURL(j),D=0;D<k;++D)m[D]=y(E);URL.revokeObjectURL(E)}function S(k,N,j,E,D){for(var _=m[0],P=1;P<m.length;++P)m[P].pending<_.pending&&(_=m[P]);return new Promise(function(O,T){var M=new Uint8Array(j),R=x++;_.pending+=k,_.requests[R]={resolve:O,reject:T},_.object.postMessage({id:R,count:k,size:N,source:M,mode:E,filter:D},[M.buffer])})}function C(k){i.then(function(){var N=k.data;try{var j=new Uint8Array(N.count*N.size);d(r.exports[N.mode],j,N.count,N.size,N.source,r.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:j},[j.buffer])}catch(E){self.postMessage({id:N.id,count:N.count,action:"reject",value:E})}})}return{ready:i,supported:!0,useWorkers:function(k){v(k)},decodeVertexBuffer:function(k,N,j,E,D){d(r.exports.meshopt_decodeVertexBuffer,k,N,j,E,r.exports[f[D]])},decodeIndexBuffer:function(k,N,j,E){d(r.exports.meshopt_decodeIndexBuffer,k,N,j,E)},decodeIndexSequence:function(k,N,j,E){d(r.exports.meshopt_decodeIndexSequence,k,N,j,E)},decodeGltfBuffer:function(k,N,j,E,D,_){d(r.exports[h[D]],k,N,j,E,r.exports[f[_]])},decodeGltfBufferAsync:function(k,N,j,E,D){return m.length>0?S(k,N,j,h[E],f[D]):i.then(function(){var _=new Uint8Array(k*N);return d(r.exports[h[E]],_,k,N,j,r.exports[f[D]]),_})}}})();const B2={idle:"idle",working:"walk",waiting:"sit",waiting_permission:"idle",error:"emote-no",offline:"static",orphaned:"idle"},lS={idle:4915102,working:4890367,waiting:16752202,waiting_permission:16763904,error:16730698,offline:8947848,orphaned:16752202};function Xj({agentClass:t,modelFile:e,customModelFile:n,customModelUrl:s,modelScale:a=1,modelOffset:r,idleAnimation:i,status:c="idle",width:d=150,height:f=200}){const h=b.useRef(null),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),v=b.useRef(null),S=b.useRef(null),C=b.useRef(new Map),k=b.useRef(null),N=b.useRef(null),j=b.useRef(0),E=b.useRef(new fM),[D,_]=b.useState(!1),[P,O]=b.useState(!1),T=b.useRef(!1),M=b.useRef(0),R=b.useRef(new ao),I=b.useRef(!1),z=b.useRef({x:0,y:0}),W=b.useRef({x:0,y:0});b.useEffect(()=>{const F=h.current;if(!F)return;O(!1);const H=new pM;H.background=new Pr(1710628),x.current=H;const V=new GA(45,d/f,.1,100);V.position.set(0,1.2,1.4),V.lookAt(0,.4,0),y.current=V;let G;try{G=new hM({antialias:!0,alpha:!0})}catch{console.warn("[ModelPreview] WebGL context creation failed — too many active contexts"),O(!0);return}G.setSize(d,f),G.setPixelRatio(Math.min(window.devicePixelRatio,2)),G.setClearColor(1710628,1),F.appendChild(G.domElement),m.current=G;const B=new mM(16777215,1);H.add(B);const Q=new sb(16777215,1.5);Q.position.set(2,3,2),H.add(Q);const K=new sb(4890367,.6);K.position.set(-2,1,-1),H.add(K);const q=new gM(1,32),xe=new Qb({color:2763322,roughness:.8}),de=new ul(q,xe);de.rotation.x=-Math.PI/2,de.position.y=0,H.add(de);const Z=new bM(.35,.42,32),be=new pl({color:lS.idle,side:qA,transparent:!0,opacity:.8}),je=new ul(Z,be);je.rotation.x=-Math.PI/2,je.position.y=.01,H.add(je),N.current=je,_(!0);const ce=me=>{I.current=!0,z.current={x:me.clientX,y:me.clientY},F.style.cursor="grabbing"},Ee=me=>{if(!I.current||!v.current)return;const De=me.clientX-z.current.x,te=me.clientY-z.current.y;W.current.y+=De*.01,W.current.x+=te*.01,W.current.x=Math.max(-Math.PI/4,Math.min(Math.PI/4,W.current.x)),v.current.rotation.y=W.current.y,v.current.rotation.x=W.current.x,z.current={x:me.clientX,y:me.clientY}},ze=()=>{I.current=!1,F.style.cursor="grab"},Ge=()=>{I.current=!1,F.style.cursor="grab"};F.addEventListener("mousedown",ce),window.addEventListener("mousemove",Ee),window.addEventListener("mouseup",ze),F.addEventListener("mouseleave",Ge),F.style.cursor="grab";const _e=()=>{j.current=requestAnimationFrame(_e);const me=E.current.getDelta();if(S.current)S.current.update(me);else if(v.current&&!T.current){M.current+=me;const De=M.current,ye=Math.sin(De*1.5)*.02,pe=Math.sin(De*.8)*.01;v.current.position.set(R.current.x+pe,R.current.y+ye,R.current.z)}m.current&&x.current&&y.current&&m.current.render(x.current,y.current)};return _e(),()=>{if(cancelAnimationFrame(j.current),F.removeEventListener("mousedown",ce),window.removeEventListener("mousemove",Ee),window.removeEventListener("mouseup",ze),F.removeEventListener("mouseleave",Ge),v.current&&x.current&&(x.current.remove(v.current),v.current.traverse(me=>{var De,te;me instanceof ul&&((De=me.geometry)==null||De.dispose(),Array.isArray(me.material)?me.material.forEach(He=>{He.map&&He.map.dispose(),He.dispose()}):me.material&&(me.material.map&&((te=me.material.map)==null||te.dispose()),me.material.dispose()))}),v.current=null),N.current&&x.current&&(x.current.remove(N.current),N.current.geometry.dispose(),N.current.material.dispose(),N.current=null),x.current&&(x.current.traverse(me=>{var De;me instanceof ul&&((De=me.geometry)==null||De.dispose(),me.material instanceof wf&&me.material.dispose())}),x.current.clear()),S.current=null,k.current=null,C.current.clear(),m.current){try{const De=m.current.getContext().getExtension("WEBGL_lose_context");De&&De.loseContext()}catch{}m.current.dispose(),F.contains(m.current.domElement)&&F.removeChild(m.current.domElement),m.current=null}x.current=null,y.current=null,_(!1)}},[d,f]),b.useEffect(()=>{if(!D||!x.current)return;const F=new e2,H=new L2;H.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.7/"),F.setDRACOLoader(H),F.setMeshoptDecoder(I2);let V=null;const G=B=>{v.current&&x.current&&(x.current.remove(v.current),v.current=null,S.current=null,k.current=null);const Q=B.scene;Q.scale.setScalar(a);const K=(r==null?void 0:r.x)??0,q=(r==null?void 0:r.y)??0,xe=(r==null?void 0:r.z)??0;if(Q.position.set(K,xe,q),Q.visible=!0,W.current={x:0,y:0},Q.rotation.set(0,0,0),Q.traverse(de=>{if(de instanceof ul&&(de.castShadow=!0,de.receiveShadow=!0,de.material)){const Z=de.material;Z.map&&(Z.map.colorSpace=Mr)}}),x.current)if(x.current.add(Q),v.current=Q,R.current.copy(Q.position),B.animations.length>0){T.current=!0;const de=new xM(Q);S.current=de,C.current.clear();for(const Z of B.animations)C.current.set(Z.name.toLowerCase(),Z);if(i!==""){const Z=i?C.current.get(i.toLowerCase())||B.animations[0]:C.current.get("idle")||B.animations[0];if(Z){const be=de.clipAction(Z);be.reset().play(),k.current=be}}}else T.current=!1,S.current=null,C.current.clear()};if(n)V=URL.createObjectURL(n),console.log("[ModelPreview] Loading custom model from file:",n.name,"blob URL:",V),F.load(V,B=>{console.log("[ModelPreview] Successfully loaded custom model file, animations:",B.animations.length),G(B)},void 0,B=>{console.error("[ModelPreview] Failed to load custom model file:",B)});else if(s){const B=mb(s);console.log("[ModelPreview] Loading custom model from URL:",s),F.load(B,Q=>{console.log("[ModelPreview] Successfully loaded custom model URL, animations:",Q.animations.length),G(Q)},void 0,Q=>{console.error("[ModelPreview] Failed to load custom model URL:",s,Q)})}else{const B=e||(t?VL[t]:void 0)||"character-male-a.glb";F.load(`/assets/characters/${B}`,G,void 0,Q=>{console.error("[ModelPreview] Failed to load model:",B,Q)})}return()=>{V&&URL.revokeObjectURL(V),H.dispose()}},[t,e,n,s,a,r,D]);const $=F=>{if(!S.current)return;const H=B2[F],V=C.current.get(H);if(!V){const B=C.current.get("idle");if(B){const Q=S.current.clipAction(B);Q.reset().play(),k.current=Q}return}const G=S.current.clipAction(V);F==="working"?G.timeScale=1.5:F==="error"&&(G.setLoop(yM,1),G.clampWhenFinished=!0),k.current&&k.current!==G?(k.current.fadeOut(.3),G.reset().fadeIn(.3).play()):G.reset().play(),k.current=G};return b.useEffect(()=>{if(D){if(N.current){const F=N.current.material;F.color.setHex(lS[c]),c==="working"?F.opacity=.6+Math.sin(Date.now()*.005)*.4:F.opacity=.8}$(c)}},[c,D]),b.useEffect(()=>{if(!D||!S.current||c!=="idle")return;if(i===""){k.current&&(k.current.stop(),k.current=null);return}const F=i?i.toLowerCase():"idle",H=C.current.get(F);if(H){const V=S.current.clipAction(H);k.current&&k.current!==V?(k.current.fadeOut(.3),V.reset().fadeIn(.3).play()):V.reset().play(),k.current=V}else k.current&&(k.current.stop(),k.current=null)},[i,D,c]),P?o.jsx("div",{className:"model-preview",style:{width:d,height:f,borderRadius:8,overflow:"hidden",background:"#1a1a24",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",fontSize:12,textAlign:"center",padding:8},children:"3D preview unavailable"}):o.jsx("div",{ref:h,className:"model-preview",style:{width:d,height:f,borderRadius:8,overflow:"hidden",background:"#1a1a24"}})}function F2({shortcut:t,onUpdate:e}){const{t:n}=pt(["config","terminal"]),s=uL(),[a,r]=b.useState(!1),[i,c]=b.useState(null),d=b.useRef(null),f=b.useMemo(()=>i?vO(s,i,t.id,t.context):[],[i,s,t.id,t.context]);b.useEffect(()=>{if(!a)return;const y=v=>{if(v.preventDefault(),v.stopPropagation(),v.key==="Escape"&&!v.ctrlKey&&!v.altKey&&!v.shiftKey&&!v.metaKey){r(!1),c(null);return}if(["Control","Alt","Shift","Meta"].includes(v.key))return;let S=v.key;v.code.startsWith("Key")&&v.code.length===4?S=v.code.charAt(3).toLowerCase():v.code.startsWith("Digit")&&v.code.length===6?S=v.code.charAt(5):v.code==="Space"&&(S="Space");const C={key:S,modifiers:{ctrl:v.ctrlKey,alt:v.altKey,shift:v.shiftKey,meta:v.metaKey}};c(C)};return document.addEventListener("keydown",y,!0),()=>document.removeEventListener("keydown",y,!0)},[a]),b.useEffect(()=>{if(!a)return;const y=v=>{d.current&&!d.current.contains(v.target)&&(i&&f.length===0&&e(i),r(!1),c(null))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[a,i,f,e]);const h=()=>{a?(i&&f.length===0&&e(i),r(!1),c(null)):(r(!0),c(null))},m=y=>{y.stopPropagation(),e({key:"",modifiers:{}})};let x;return a?i?x=kb({...t,...i}):x=n("config:shortcuts.pressKeys"):t.key?x=kb(t):x=n("config:shortcuts.notSet"),o.jsxs("div",{className:"key-capture-container",children:[o.jsx("button",{ref:d,className:`key-capture-input ${a?"capturing":""} ${f.length>0?"conflict":""} ${t.enabled?"":"disabled"}`,onClick:h,title:n(a?"config:shortcuts.pressKeysOrClick":"config:shortcuts.clickToChange"),children:o.jsx("span",{className:"key-capture-value",children:x})}),t.key&&!a&&o.jsx("button",{className:"key-capture-clear",onClick:m,title:n("config:shortcuts.clearShortcut"),children:"×"}),f.length>0&&o.jsx("div",{className:"key-capture-conflict",children:n("config:shortcuts.conflictsWith",{names:f.map(y=>n(`terminal:controls.shortcuts.${y.id}.name`,{defaultValue:y.name})).join(", ")})})]})}function z2({value:t,onChange:e,onSubmit:n,placeholder:s="/path/to/folder",className:a="",directoriesOnly:r=!0,autoFocus:i=!1,hasError:c=!1,disabled:d=!1}){const[f,h]=b.useState([]),[m,x]=b.useState(-1),[y,v]=b.useState(!1),[S,C]=b.useState(!1),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),E=b.useCallback(async R=>{if(!R){h([]);return}C(!0);try{const I=new URLSearchParams({path:R,dirs:r?"true":"false",limit:"15"}),z=await Lt(Mt(`/api/files/autocomplete?${I}`));if(z.ok){const W=await z.json();h(W.suggestions||[]),x(-1)}}catch(I){console.error("Failed to fetch path suggestions:",I)}finally{C(!1)}},[r]);b.useEffect(()=>(j.current&&clearTimeout(j.current),t&&y?j.current=setTimeout(()=>{E(t)},150):h([]),()=>{j.current&&clearTimeout(j.current)}),[t,y,E]);const D=R=>{e(R.target.value),v(!0)},_=b.useCallback(R=>{var z;const I=R.isDirectory?R.path+"/":R.path;e(I),v(R.isDirectory),x(-1),(z=k.current)==null||z.focus(),R.isDirectory&&E(I)},[e,E]),P=R=>{if(!y||f.length===0){R.key==="Enter"&&n&&(R.preventDefault(),n()),R.key==="Escape"&&v(!1);return}switch(R.key){case"ArrowDown":R.preventDefault(),x(I=>I<f.length-1?I+1:I);break;case"ArrowUp":R.preventDefault(),x(I=>I>0?I-1:-1);break;case"Tab":if(R.preventDefault(),f.length>0){const I=m>=0?m:0;_(f[I])}break;case"Enter":R.preventDefault(),m>=0&&f[m]?_(f[m]):n&&(v(!1),n());break;case"Escape":R.preventDefault(),v(!1),x(-1);break}},O=()=>{v(!0),t&&E(t)},T=()=>{setTimeout(()=>{v(!1),x(-1)},200)};b.useEffect(()=>{if(m>=0&&N.current){const I=N.current.querySelectorAll(".folder-input-suggestion")[m];I&&I.scrollIntoView({block:"nearest"})}},[m]);const M=["folder-input",a,c?"error":""].filter(Boolean).join(" ");return o.jsxs("div",{className:"folder-input-container",children:[o.jsx("input",{ref:k,type:"text",className:M,value:t,onChange:D,onKeyDown:P,onFocus:O,onBlur:T,placeholder:s,autoFocus:i,disabled:d,autoComplete:"off",spellCheck:!1}),y&&(f.length>0||S)&&o.jsx("div",{ref:N,className:"folder-input-suggestions",children:S&&f.length===0?o.jsx("div",{className:"folder-input-loading",children:"Loading..."}):f.map((R,I)=>o.jsxs("div",{className:`folder-input-suggestion ${I===m?"selected":""}`,onClick:()=>_(R),onMouseEnter:()=>x(I),children:[o.jsx("span",{className:"folder-input-suggestion-icon",children:R.isDirectory?"📁":"📄"}),o.jsx("span",{className:"folder-input-suggestion-name",children:R.name}),R.isDirectory&&o.jsx("span",{className:"folder-input-suggestion-hint",children:"/"})]},R.path))})]})}function Jj({agent:t,isOpen:e,onClose:n}){const{t:s}=pt(["terminal","common","tools"]),a=hL(),r=Pa(),[i,c]=b.useState(t.name),[d,f]=b.useState(t.class),[h,m]=b.useState(t.permissionMode),[x,y]=b.useState(t.provider||"claude"),[v,S]=b.useState(t.codexConfig||{fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[C,k]=b.useState(t.model||"sonnet"),[N,j]=b.useState(t.effort),[E,D]=b.useState(t.codexModel||"gpt-5.3-codex"),[_,P]=b.useState(t.opencodeModel||"minimax/MiniMax-M1-80k"),[O,T]=b.useState(t.useChrome||!1),[M,R]=b.useState(t.cwd),[I,z]=b.useState((t.shortcut||"").trim()),[W,$]=b.useState(new Set),[F,H]=b.useState(""),[V,G]=b.useState(!1),[B,Q]=b.useState("");b.useMemo(()=>a.filter(te=>te.enabled&&(te.assignedAgentIds.includes(t.id)||te.assignedAgentClasses.includes(t.class))),[a,t.id,t.class]),b.useEffect(()=>{const te=a.filter(He=>He.assignedAgentIds.includes(t.id)).map(He=>He.id);$(new Set(te))},[a,t.id]),b.useEffect(()=>{if(e){c(t.name),f(t.class),m(t.permissionMode),y(t.provider||"claude"),S(t.codexConfig||{fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),k(t.model||"sonnet"),j(t.effort),D(t.codexModel||"gpt-5.3-codex"),P(t.opencodeModel||"minimax/MiniMax-M1-80k"),T(t.useChrome||!1),R(t.cwd),z((t.shortcut||"").trim());const te=a.filter(He=>He.assignedAgentIds.includes(t.id)).map(He=>He.id);$(new Set(te))}},[e,t,a]);const K=b.useMemo(()=>a.filter(te=>te.enabled),[a]),q=b.useMemo(()=>{if(!F.trim())return K;const te=F.toLowerCase();return K.filter(He=>He.name.toLowerCase().includes(te)||He.description.toLowerCase().includes(te)||He.slug.toLowerCase().includes(te))},[K,F]),xe=b.useMemo(()=>K.filter(te=>te.assignedAgentClasses.includes(d)),[K,d]),de=b.useCallback(te=>{$(He=>{const ye=new Set(He);return ye.has(te)?ye.delete(te):ye.add(te),ye})},[]),Z=b.useMemo(()=>{const te=r.find(He=>He.id===d);if(te!=null&&te.model)return te.model},[r,d]),be=b.useMemo(()=>{const te=r.find(He=>He.id===d);if(te!=null&&te.customModelPath)return Mt(`/api/custom-models/${te.id}`)},[r,d]),je=b.useMemo(()=>{const te=r.find(He=>He.id===d);return te==null?void 0:te.modelScale},[r,d]),ce=b.useMemo(()=>r.find(te=>te.id===d),[r,d]);b.useEffect(()=>{ce&&(Q(ce.instructions||""),G(!1))},[ce==null?void 0:ce.id]);const Ee=b.useMemo(()=>r.find(He=>He.id===d)?"scout":d,[r,d]),ze=b.useMemo(()=>{const te=i.trim();if(te&&te!==t.name||d!==t.class||h!==t.permissionMode||x!==(t.provider||"claude")||x==="claude"&&C!==(t.model||"sonnet")||x==="claude"&&N!==(t.effort||void 0)||x==="codex"&&E!==(t.codexModel||"gpt-5.3-codex")||x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})||x==="opencode"&&_!==(t.opencodeModel||"minimax/MiniMax-M1-80k")||O!==(t.useChrome||!1)||M!==t.cwd||I!==(t.shortcut||"").trim())return!0;const He=a.filter(Re=>Re.assignedAgentIds.includes(t.id)).map(Re=>Re.id).sort().join(","),ye=Array.from(W).sort().join(",");return He!==ye},[i,d,h,x,C,N,E,v,_,O,M,I,W,t,a]),Ge=()=>{const te=i.trim(),He={};te&&te!==t.name&&U.renameAgent(t.id,te),d!==t.class&&(He.class=d),h!==t.permissionMode&&(He.permissionMode=h),x!==(t.provider||"claude")&&(He.provider=x),x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})&&(He.codexConfig=v),x==="codex"&&E!==(t.codexModel||"gpt-5.3-codex")&&(He.codexModel=E),x==="opencode"&&_!==(t.opencodeModel||"minimax/MiniMax-M1-80k")&&(He.opencodeModel=_),x==="claude"&&C!==(t.model||"sonnet")&&(He.model=C),x==="claude"&&N!==(t.effort||void 0)&&(He.effort=N),O!==(t.useChrome||!1)&&(He.useChrome=O),M!==t.cwd&&(He.cwd=M),I!==(t.shortcut||"").trim()&&(He.shortcut=I);const ye=a.filter(re=>re.assignedAgentIds.includes(t.id)).map(re=>re.id).sort().join(","),Re=Array.from(W).sort().join(",");ye!==Re&&(He.skillIds=Array.from(W)),Object.keys(He).length>0&&U.updateAgentProperties(t.id,He),n()},{handleMouseDown:_e,handleClick:me}=wa(n),De=b.useMemo(()=>{const te=lx(I);return{id:`agent-terminal-shortcut-${t.id}`,name:"Terminal Shortcut",description:"Open terminal for this agent",key:(te==null?void 0:te.key)||"",modifiers:(te==null?void 0:te.modifiers)||{},enabled:!0,context:"global"}},[t.id,I]);return e?o.jsx("div",{className:"modal-overlay visible",onMouseDown:_e,onClick:me,children:o.jsxs("div",{className:"modal agent-edit-modal",children:[o.jsxs("div",{className:"modal-header",children:[s("terminal:spawn.editAgentTitle"),": ",i.trim()||t.name]}),o.jsxs("div",{className:"modal-body spawn-modal-body",children:[o.jsxs("div",{className:"spawn-top-section",children:[o.jsx("div",{className:"spawn-preview-compact",children:o.jsx(Xj,{agentClass:Ee,modelFile:Z,customModelUrl:be,modelScale:je,width:100,height:120})}),o.jsxs("div",{className:"spawn-class-section",children:[o.jsx("div",{className:"spawn-class-label",children:s("terminal:spawn.agentClass")}),o.jsxs("div",{className:"class-selector-inline",children:[r.map(te=>o.jsxs("button",{className:`class-chip ${d===te.id?"selected":""}`,onClick:()=>f(te.id),title:te.description,children:[o.jsx("span",{className:"class-chip-icon",children:te.icon}),o.jsx("span",{className:"class-chip-name",children:te.name})]},te.id)),Object.entries(po).filter(([te])=>te!=="boss").map(([te,He])=>o.jsxs("button",{className:`class-chip ${d===te?"selected":""}`,onClick:()=>f(te),title:He.description,children:[o.jsx("span",{className:"class-chip-icon",children:He.icon}),o.jsx("span",{className:"class-chip-name",children:te.charAt(0).toUpperCase()+te.slice(1)})]},te))]})]})]}),ce&&o.jsxs("div",{className:"custom-class-notice",children:[o.jsxs("div",{className:"custom-class-notice-header",onClick:()=>G(!V),style:{cursor:"pointer"},children:[o.jsx("span",{children:"📋"}),o.jsx("span",{children:ce.instructions?s("terminal:spawn.hasCustomInstructions"):"Add custom instructions"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:11,opacity:.6},children:V?"▲":"▼"})]}),!V&&ce.instructions&&o.jsx("div",{className:"custom-class-notice-info",children:s("terminal:spawn.instructionsInjected",{count:ce.instructions.length})}),V&&o.jsxs("div",{className:"custom-class-instructions-editor",children:[o.jsx("textarea",{value:B,onChange:te=>Q(te.target.value),placeholder:"CLAUDE.md instructions for this agent class...",rows:6,style:{width:"100%",resize:"vertical",fontFamily:"monospace",fontSize:12,background:"rgba(0,0,0,0.3)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:4,color:"var(--text-primary)",padding:"6px 8px",outline:"none"}}),o.jsxs("div",{style:{display:"flex",gap:6,marginTop:4,justifyContent:"flex-end"},children:[o.jsx("button",{onClick:()=>{U.updateCustomAgentClass(ce.id,{instructions:B}),G(!1)},style:{padding:"2px 10px",borderRadius:4,fontSize:11,cursor:"pointer",background:"rgba(0,200,200,0.2)",color:"var(--accent-cyan)",border:"1px solid rgba(0,200,200,0.3)"},children:"Save"}),o.jsx("button",{onClick:()=>{Q(ce.instructions||""),G(!1)},style:{padding:"2px 10px",borderRadius:4,fontSize:11,cursor:"pointer",background:"transparent",color:"var(--text-secondary)",border:"1px solid rgba(255,255,255,0.1)"},children:"Cancel"})]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4},children:"These instructions are injected as system prompt for all agents of this class."})]})]}),o.jsxs("div",{className:"spawn-form-section",children:[o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.name")}),o.jsx("input",{type:"text",className:"spawn-input",value:i,onChange:te=>c(te.target.value),placeholder:s("terminal:spawn.agentNamePlaceholder")})]})}),o.jsxs("div",{className:"spawn-form-row",children:[o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.runtime")}),o.jsxs("div",{className:"spawn-select-row",children:[o.jsxs("button",{className:`spawn-select-btn ${x==="claude"?"selected":""}`,onClick:()=>y("claude"),children:[o.jsx("span",{children:"🧠"}),o.jsx("span",{children:"Claude"})]}),o.jsxs("button",{className:`spawn-select-btn ${x==="codex"?"selected":""}`,onClick:()=>y("codex"),children:[o.jsx("span",{children:"⚙️"}),o.jsx("span",{children:"Codex"})]}),o.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${x==="opencode"?"selected":""}`,onClick:()=>y("opencode"),children:[o.jsx("span",{children:"🟢"}),o.jsx("span",{children:"OpenCode"})]})]})]}),o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.permissions")}),o.jsx("div",{className:"spawn-select-row",children:Object.keys(iu).map(te=>o.jsxs("button",{className:`spawn-select-btn ${h===te?"selected":""}`,onClick:()=>m(te),title:iu[te].description,children:[o.jsx("span",{children:te==="bypass"?"⚡":"🔐"}),o.jsx("span",{children:iu[te].label})]},te))})]})]}),o.jsxs("div",{className:"spawn-form-row",children:[o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.model")}),x==="claude"?o.jsx("div",{className:"spawn-select-row",children:Object.keys(tf).map(te=>o.jsxs("button",{className:`spawn-select-btn ${C===te?"selected":""}`,onClick:()=>k(te),title:tf[te].description,children:[o.jsx("span",{children:tf[te].icon}),o.jsx("span",{children:tf[te].label})]},te))}):x==="codex"?o.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(ef).map(te=>o.jsxs("button",{className:`spawn-select-btn ${E===te?"selected":""}`,onClick:()=>D(te),title:ef[te].description,children:[o.jsx("span",{children:ef[te].icon}),o.jsx("span",{children:ef[te].label})]},te))}):x==="opencode"?o.jsx("input",{type:"text",className:"spawn-input",value:_,onChange:te=>P(te.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):o.jsx("div",{className:"spawn-inline-hint",children:s("terminal:spawn.codex.configuration")})]}),x==="claude"&&o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:"Effort"}),o.jsxs("div",{className:"spawn-select-row spawn-select-row--effort",children:[o.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${N===void 0?"selected":""}`,onClick:()=>j(void 0),title:"Use default effort level",children:o.jsx("span",{children:"Default"})}),Object.keys(ug).map(te=>o.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${N===te?"selected":""}`,onClick:()=>j(te),title:ug[te].description,children:o.jsx("span",{children:ug[te].label})},te))]})]})]}),x==="codex"&&o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("terminal:spawn.codex.config")}),o.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:v.fullAuto!==!1,onChange:te=>S(He=>({...He,fullAuto:te.target.checked}))}),o.jsx("span",{children:s("terminal:spawn.codex.useFullAuto")})]}),o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:!!v.search,onChange:te=>S(He=>({...He,search:te.target.checked}))}),o.jsx("span",{children:s("terminal:spawn.codex.enableSearch")})]}),v.fullAuto===!1&&o.jsxs(o.Fragment,{children:[o.jsxs("select",{className:"spawn-input",value:v.sandbox||"workspace-write",onChange:te=>S(He=>({...He,sandbox:te.target.value})),children:[o.jsx("option",{value:"read-only",children:s("terminal:spawn.codex.sandboxReadOnly")}),o.jsx("option",{value:"workspace-write",children:s("terminal:spawn.codex.sandboxWorkspaceWrite")}),o.jsx("option",{value:"danger-full-access",children:s("terminal:spawn.codex.sandboxDangerFullAccess")})]}),o.jsxs("select",{className:"spawn-input",value:v.approvalMode||"on-request",onChange:te=>S(He=>({...He,approvalMode:te.target.value})),children:[o.jsx("option",{value:"untrusted",children:s("terminal:spawn.codex.approvalsUntrusted")}),o.jsx("option",{value:"on-failure",children:s("terminal:spawn.codex.approvalsOnFailure")}),o.jsx("option",{value:"on-request",children:s("terminal:spawn.codex.approvalsOnRequest")}),o.jsx("option",{value:"never",children:s("terminal:spawn.codex.approvalsNever")})]})]}),o.jsx("input",{type:"text",className:"spawn-input",placeholder:s("terminal:spawn.codex.profileOptional"),value:v.profile||"",onChange:te=>S(He=>({...He,profile:te.target.value||void 0}))})]})]})}),x==="claude"&&(C!==(t.model||"sonnet")||N!==(t.effort||void 0))&&o.jsx("div",{className:"model-change-notice",children:s("terminal:spawn.contextPreserved")}),o.jsx("div",{className:"spawn-form-row spawn-options-row",children:o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:O,onChange:te=>T(te.target.checked),disabled:x!=="claude"}),o.jsx("span",{children:s("terminal:spawn.chromeBrowser")})]})}),o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("terminal:spawn.workingDir")}),o.jsx(z2,{value:M,onChange:R,placeholder:s("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",directoriesOnly:!0})]})}),o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:"Terminal Shortcut"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[o.jsx(F2,{shortcut:De,onUpdate:te=>z(bO(te))}),o.jsx("div",{className:"spawn-inline-hint",children:I?`Opens this agent terminal with ${xO(I)}`:"Capture a global shortcut for this agent terminal"})]})]})}),M!==t.cwd&&o.jsx("div",{className:"model-change-notice warning",children:s("terminal:spawn.newSessionWarning")}),o.jsxs("div",{className:"spawn-skills-section",children:[o.jsxs("label",{className:"spawn-label",children:[s("terminal:spawn.skills")," ",o.jsxs("span",{className:"spawn-label-hint",children:["(",s("terminal:spawn.clickToToggle"),")"]})]}),K.length>6&&o.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:s("terminal:spawn.filterSkills"),value:F,onChange:te=>H(te.target.value)}),o.jsx("div",{className:"skills-chips-compact",children:K.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noEnabledSkills")}):q.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noSkillsMatch",{query:F})}):q.map(te=>{const He=xe.includes(te),Re=W.has(te.id)||He;return o.jsxs("button",{className:`skill-chip ${Re?"selected":""} ${He?"class-based":""}`,onClick:()=>!He&&de(te.id),title:He?s("terminal:spawn.assignedViaClass"):te.name,children:[Re&&o.jsx("span",{className:"skill-check",children:"✓"}),o.jsx("span",{className:"skill-chip-name",children:te.name}),te.builtin&&o.jsx("span",{className:"skill-chip-badge builtin",children:"TC"}),He&&o.jsx("span",{className:"skill-chip-badge",children:"class"})]},te.id)})})]})]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:n,children:s("common:buttons.cancel")}),o.jsx("button",{className:"btn btn-primary",onClick:Ge,disabled:!ze,children:s("common:buttons2.saveChanges")})]})]})}):null}const $2=Object.freeze(Object.defineProperty({__proto__:null,AgentEditModal:Jj},Symbol.toStringTag,{value:"Module"}));var Rl=IA();const H2=ju(Rl);function ir({children:t}){return typeof document>"u"?null:Rl.createPortal(t,document.body)}function Ic(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function cS(t){return`${t.toFixed(1)}%`}function U2(t){return t>=80?"#ff4a4a":t>=60?"#ff9e4a":t>=40?"#ffd700":"#4aff9e"}const W2={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},q2={systemPrompt:"terminal:context.systemPrompt",systemTools:"terminal:context.systemTools",messages:"terminal:context.messagesCategory",freeSpace:"terminal:context.freeSpace",autocompactBuffer:"terminal:context.autocompactBuffer"},V2={systemPrompt:"terminal:context.systemPromptDesc",systemTools:"terminal:context.systemToolsDesc",messages:"terminal:context.messagesDesc",freeSpace:"terminal:context.freeSpaceDesc",autocompactBuffer:"terminal:context.autocompactBufferDesc"};function Zj({agent:t,isOpen:e,onClose:n,onRefresh:s}){const{t:a}=pt(["terminal","common"]),r=t.contextStats,[i,c]=b.useState(!1),d=()=>{s&&!i&&(c(!0),s(),setTimeout(()=>c(!1),3e3))},f=["systemPrompt","systemTools","messages","autocompactBuffer","freeSpace"],h=b.useMemo(()=>r?f.map(v=>({key:v,...r.categories[v],label:a(q2[v]),description:a(V2[v]),color:W2[v]})):[],[r]),m=b.useMemo(()=>h.filter(v=>v.key!=="freeSpace"),[h]),{handleMouseDown:x,handleClick:y}=wa(n);return e?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onMouseDown:x,onClick:y,children:o.jsxs("div",{className:"modal context-view-modal",style:{maxWidth:"520px"},children:[o.jsxs("div",{className:"modal-header",style:{display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("span",{style:{flex:1},children:a("terminal:context.contextWindow",{name:t.name})}),s&&o.jsxs("button",{className:"btn btn-primary",onClick:d,disabled:i||t.status!=="idle",style:{padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},title:t.status!=="idle"?a("terminal:context.agentMustBeIdle"):a("terminal:context.fetchContextStats"),children:[o.jsx("span",{style:{display:"inline-block",animation:i?"spin 1s linear infinite":"none"},children:i?"⟳":"↻"}),a(i?"common:status.loading":"common:buttons.refresh")]})]}),o.jsx("div",{className:"modal-body",style:{padding:"16px"},children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px",padding:"8px 12px",background:"var(--bg-secondary)",borderRadius:"6px"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:a("terminal:context.model")}),o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:r.model})]}),o.jsxs("div",{style:{textAlign:"right"},children:[o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:a("terminal:context.contextWindowLabel")}),o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:Ic(r.contextWindow)})]})]}),o.jsxs("div",{style:{marginBottom:"24px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",fontSize:"13px"},children:[o.jsx("span",{children:a("terminal:context.contextUsage")}),o.jsxs("span",{style:{color:U2(r.usedPercent)},children:[Ic(r.totalTokens)," / ",Ic(r.contextWindow)," (",r.usedPercent,"%)"]})]}),o.jsx("div",{style:{height:"28px",background:"var(--bg-tertiary)",borderRadius:"6px",overflow:"hidden",display:"flex"},children:m.map(v=>v.percent>0&&o.jsx("div",{style:{width:`${v.percent}%`,background:v.color,height:"100%",minWidth:v.percent>.5?"2px":"0",transition:"width 0.3s ease"},title:`${v.label}: ${Ic(v.tokens)} (${cS(v.percent)})`},v.key))})]}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.5px"},children:a("terminal:context.tokenBreakdown")}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:h.map(v=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 12px",background:v.key==="freeSpace"?"transparent":"var(--bg-secondary)",borderRadius:"6px",borderLeft:v.key==="freeSpace"?"3px dashed rgba(255,255,255,0.2)":`3px solid ${v.color}`,opacity:v.key==="freeSpace"?.7:1},children:[o.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"3px",background:v.color,flexShrink:0,border:v.key==="freeSpace"?"1px dashed rgba(255,255,255,0.3)":"none"}}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:v.label}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:v.description})]}),o.jsxs("div",{style:{textAlign:"right"},children:[o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:Ic(v.tokens)}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:cS(v.percent)})]})]},v.key))})]}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",textAlign:"center"},children:a("terminal:context.lastUpdated",{time:new Date(r.lastUpdated).toLocaleTimeString()})})]}):o.jsxs("div",{style:{textAlign:"center",color:"var(--text-secondary)",padding:"32px"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px",opacity:.5},children:"📊"}),o.jsx("div",{style:{fontSize:"14px",marginBottom:"8px"},children:a("terminal:context.noContextData")}),o.jsx("div",{style:{fontSize:"12px",marginBottom:"20px",opacity:.7},children:a("terminal:context.clickRefresh")}),s&&o.jsxs("button",{className:"btn btn-primary",onClick:d,disabled:i||t.status!=="idle",style:{padding:"10px 24px",fontSize:"14px",display:"inline-flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{style:{display:"inline-block",animation:i?"spin 1s linear infinite":"none"},children:i?"⟳":"↻"}),a(i?"terminal:context.fetchingStats":"terminal:context.fetchContextStats")]}),t.status!=="idle"&&o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",marginTop:"12px"},children:a("terminal:context.agentMustBeIdle")})]})}),o.jsx("div",{className:"modal-footer",style:{display:"flex",justifyContent:"flex-end",padding:"12px 16px",borderTop:"1px solid var(--border-color)"},children:o.jsx("button",{className:"btn btn-secondary",onClick:n,children:a("common:buttons.close")})})]})})}):null}const G2=b.memo(function({tokensUsed:e,createdAt:n}){const{t:s}=pt(["common"]);return o.jsxs("div",{className:"unit-stats",children:[o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:s("labels.tokens")}),o.jsx("div",{className:"unit-stat-value",children:GD(e)})]}),o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:s("labels.uptime")}),o.jsx("div",{className:"unit-stat-value",children:YD(n)})]})]})}),eN=b.memo(function({contextInfo:e,onClick:n}){const{t:s}=pt(["common"]),{remainingPercent:a,hasData:r}=e;return o.jsxs("div",{className:"unit-context unit-context-clickable",onClick:n,title:s(r?"unitPanel.remainingContext":"unitPanel.notRetrievedYet"),style:{cursor:"pointer"},children:[o.jsxs("div",{className:"unit-stat-label",style:{display:"flex",alignItems:"center",gap:"4px"},children:[o.jsx("span",{children:s("unitPanel.remainingContext")}),r?o.jsx("span",{style:{fontSize:"10px",opacity:.6},children:"📊"}):o.jsx("span",{style:{fontSize:"9px",color:"#ff9e4a",opacity:.8},title:s("unitPanel.notRetrievedYet"),children:"⚠️"})]}),r?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"unit-context-bar",children:o.jsx("div",{className:"unit-context-fill",style:{width:`${a}%`,background:Yj(a)}})}),o.jsxs("span",{className:"unit-context-value",children:[Math.round(a),"%"]})]}):o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",fontStyle:"italic"},children:s("unitPanel.notRetrievedYet")})]})}),Y2=b.memo(function({lastActivity:e}){const{t:n}=pt(["common"]);return o.jsxs("div",{className:"unit-idle-timer",title:n("unitPanel.timeSinceActivity"),style:{color:Xb(e)},children:["⏱ ",gp(e)]})}),K2=b.memo(function({task:e}){const{t:n}=pt(["common"]);return o.jsxs("div",{className:"unit-task",children:[o.jsx("div",{className:"unit-stat-label",children:n("labels.task")}),o.jsx("div",{className:"unit-task-text",children:e})]})}),Q2=b.memo(function({cwd:e}){const{t:n}=pt(["common"]);return o.jsxs("div",{className:"unit-cwd",children:[o.jsx("div",{className:"unit-stat-label",children:n("labels.cwd")}),o.jsx("div",{className:"unit-cwd-path",title:e,children:e})]})}),X2=b.memo(function({text:e,maxLength:n=150}){const{t:s}=pt(["common"]);return o.jsxs("div",{className:"unit-last-prompt",children:[o.jsx("div",{className:"unit-stat-label",children:s("unitPanel.lastPrompt")}),o.jsx("div",{className:"unit-last-prompt-text",children:e.length>n?e.slice(0,n)+"...":e})]})}),J2=b.memo(function({text:e,maxLength:n=200}){const{t:s}=pt(["common"]);return o.jsxs("div",{className:"unit-last-message",children:[o.jsx("div",{className:"unit-stat-label",children:s("unitPanel.lastResponse")}),o.jsx("div",{className:"unit-last-message-text",children:e.length>n?e.slice(0,n)+"...":e})]})});function Z2({agent:t,onFocusAgent:e,onKillAgent:n,onCallSubordinates:s,onOpenAreaExplorer:a}){var ce,Ee;const{t:r}=pt(["common"]),i=vs(),c=Pa(),{showToast:d}=qj(),f=i.agents.get(t.id)||t,h=Ia(f.class,c),m=c.find(ze=>ze.id===f.class),x=m==null?void 0:m.model,y=m!=null&&m.customModelPath?Mt(`/api/custom-models/${m.id}`):void 0,v=m==null?void 0:m.modelScale,[S,C]=b.useState(!1),[k,N]=b.useState(f.name),j=b.useRef(null),[,E]=b.useState(0),[D,_]=b.useState(!0),[P,O]=b.useState(!1),[T,M]=b.useState([]),[R,I]=b.useState(null),[z,W]=b.useState(!1),[$,F]=b.useState(!1),H=U.getAgentSupervisorHistory(f.id),V=U.isLoadingHistoryForAgent(f.id);b.useEffect(()=>{!U.hasHistoryBeenFetched(f.id)&&!V&&U.requestAgentSupervisorHistory(f.id)},[f.id,V]),b.useEffect(()=>{N(f.name)},[f.name]),b.useEffect(()=>{S&&j.current&&(j.current.focus(),j.current.select())},[S]),b.useEffect(()=>{if(f.status==="idle"){const ze=setInterval(()=>{E(Ge=>Ge+1)},15e3);return()=>clearInterval(ze)}},[f.status]),b.useEffect(()=>{f.permissionMode==="interactive"&&Lt(Mt("/api/remembered-patterns")).then(ze=>ze.json()).then(M).catch(ze=>console.error("Failed to fetch remembered patterns:",ze))},[f.permissionMode]);const G=b.useMemo(()=>kp(f),[f.contextStats,f.contextUsed,f.contextLimit]),B=U.getAreaForAgent(f.id),Q=i.agentOutputs.get(f.id)||[],K=Q.length>0?Q[Q.length-1]:null,q=i.lastPrompts.get(f.id),xe=async(ze,Ge)=>{try{(await Lt(Mt(`/api/remembered-patterns/${ze}/${encodeURIComponent(Ge)}`),{method:"DELETE"})).ok&&M(me=>me.filter(De=>!(De.tool===ze&&De.pattern===Ge)))}catch(_e){console.error("Failed to remove pattern:",_e)}},de=async()=>{if(confirm(r("confirm.clearPatterns")))try{(await Lt(Mt("/api/remembered-patterns"),{method:"DELETE"})).ok&&M([])}catch(ze){console.error("Failed to clear patterns:",ze)}},Z=()=>{confirm(r("confirm.terminateAgent"))&&n(f.id)},be=()=>{const ze=k.trim();ze&&ze!==f.name?U.renameAgent(f.id,ze):N(f.name),C(!1)},je=ze=>{ze.key==="Enter"?be():ze.key==="Escape"&&(N(f.name),C(!1))};return o.jsxs("div",{className:"unit-panel",children:[o.jsx("div",{className:"unit-model-preview",children:o.jsx(Xj,{agentClass:f.class,modelFile:x,customModelUrl:y,modelScale:v,status:f.status,width:80,height:80})}),o.jsxs("div",{className:"unit-panel-header",children:[o.jsx("div",{className:"unit-class-icon",style:{background:`${h.color}20`},children:h.icon}),o.jsxs("div",{className:"unit-header-info",children:[S?o.jsx("input",{ref:j,type:"text",className:"unit-name-input",value:k,onChange:ze=>N(ze.target.value),onBlur:be,onKeyDown:je}):o.jsx("div",{className:"unit-name unit-name-editable",onClick:()=>C(!0),title:r("unitPanel.clickToRename"),children:f.name}),o.jsxs("div",{className:"unit-status",children:[o.jsx("span",{style:{color:Ff[f.status]||Ff.default},children:f.status}),o.jsxs("span",{children:[" • ",f.class," • ",f.provider]})]}),f.status==="idle"&&f.lastActivity>0&&o.jsx(Y2,{lastActivity:f.lastActivity})]}),o.jsxs("div",{className:"unit-header-actions",children:[o.jsx("button",{className:"unit-action-icon",onClick:()=>e(f.id),title:r("unitPanel.focusOnAgent"),children:"🎯"}),o.jsx("button",{className:"unit-action-icon",onClick:()=>W(!0),title:r("unitPanel.editProperties"),children:"✏️"}),(f.isBoss||f.class==="boss")&&f.subordinateIds&&f.subordinateIds.length>0&&o.jsx("button",{className:"unit-action-icon",onClick:()=>s==null?void 0:s(f.id),title:r("unitPanel.callSubordinates"),children:"📢"}),o.jsx("button",{className:"unit-action-icon",onClick:()=>I("collapse"),title:r("unitPanel.collapseContext"),disabled:f.status!=="idle",children:"📦"}),o.jsx("button",{className:"unit-action-icon warning",onClick:()=>I("clear"),title:r("unitPanel.clearContext"),children:"🧹"}),o.jsx("button",{className:"unit-action-icon danger",onClick:Z,title:r("unitPanel.killAgent"),children:"☠️"})]})]}),B&&o.jsxs("div",{className:"unit-area",children:[o.jsx("span",{className:"unit-area-dot",style:{background:B.color}}),o.jsx("span",{className:"unit-area-name",children:B.name})]}),q&&o.jsx(X2,{text:q.text}),K&&o.jsx(J2,{text:K.text}),o.jsx(G2,{tokensUsed:f.tokensUsed,createdAt:f.createdAt}),o.jsx(eN,{contextInfo:G,onClick:()=>F(!0)}),f.taskLabel&&o.jsxs("div",{className:"unit-task-label",children:[o.jsx("div",{className:"unit-stat-label",children:"📋 Task"}),o.jsx("div",{className:"unit-task-label-value",children:f.taskLabel})]}),f.currentTask&&o.jsx(K2,{task:f.currentTask}),o.jsx(Q2,{cwd:f.cwd}),o.jsx(eP,{currentAgentId:f.id}),o.jsxs("div",{className:"unit-permission-mode",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.permissions")}),o.jsxs("div",{className:"unit-permission-mode-value",title:(ce=iu[f.permissionMode])==null?void 0:ce.description,children:[o.jsx("span",{className:"unit-permission-mode-icon",children:f.permissionMode==="bypass"?"⚡":"🔐"}),o.jsx("span",{className:"unit-permission-mode-label",children:((Ee=iu[f.permissionMode])==null?void 0:Ee.label)||f.permissionMode})]})]}),f.permissionMode==="interactive"&&o.jsx(tP,{patterns:T,showPatterns:P,onToggle:()=>O(!P),onRemovePattern:xe,onClearAll:de}),f.sessionId?o.jsxs("div",{className:"unit-resume-cmd",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.resumeSession")}),o.jsxs("div",{className:"unit-resume-cmd-text",title:r("unitPanel.clickToCopy"),onClick:async()=>{const ze=f.provider==="codex"?`codex resume ${f.sessionId}`:f.provider==="opencode"?`opencode resume ${f.sessionId}`:`claude --resume ${f.sessionId}`;try{await navigator.clipboard.writeText(ze),d("success",r("toast.copied"),r("toast.resumeCommandCopied"),2e3)}catch{d("error",r("toast.errorTitle"),r("toast.failedToCopy"),3e3)}},children:[f.provider==="codex"?"codex resume":f.provider==="opencode"?"opencode resume":"claude --resume"," ",f.sessionId]})]}):o.jsxs("div",{className:"unit-resume-cmd",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.session")}),o.jsx("div",{className:"unit-new-session-indicator",children:r("unitPanel.newSession")})]}),o.jsx(nP,{agentId:f.id}),o.jsxs("div",{className:"unit-supervisor-history",children:[o.jsxs("div",{className:"unit-supervisor-history-header",onClick:()=>_(!D),children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.supervisorHistory")}),o.jsxs("span",{className:"unit-supervisor-history-toggle",children:[H.length>0&&o.jsx("span",{className:"unit-supervisor-history-count",children:H.length}),D?"▼":"▶"]})]}),D&&o.jsx("div",{className:"unit-supervisor-history-list",children:V?o.jsx("div",{className:"unit-supervisor-history-loading",children:r("status.loading")}):H.length===0?o.jsx("div",{className:"unit-supervisor-history-empty",children:r("unitPanel.noSupervisorReports")}):H.slice(0,10).map((ze,Ge)=>o.jsx(tN,{entry:ze,defaultExpanded:Ge===0},ze.id))})]}),(f.isBoss||f.class==="boss")&&o.jsx(aP,{agent:f}),f.bossId&&o.jsx(iP,{agentId:f.id,bossId:f.bossId}),f.class!=="boss"&&!f.isBoss&&!f.bossId&&o.jsx(oP,{agentId:f.id}),R&&o.jsx(sP,{action:R,agentName:f.name,onClose:()=>I(null),onConfirm:()=>{R==="collapse"?U.collapseContext(f.id):U.clearContext(f.id),I(null)}}),o.jsx(Jj,{agent:f,isOpen:z,onClose:()=>W(!1)}),o.jsx(Zj,{agent:f,isOpen:$,onClose:()=>F(!1),onRefresh:()=>{U.refreshAgentContext(f.id)}})]})}const eP=b.memo(function({currentAgentId:e}){const{t:n}=pt(["common"]),s=vs(),a=Pa(),[r,i]=b.useState(!1),c=b.useMemo(()=>[...Array.from(s.agents.values()).filter(f=>f.id!==e)].sort((f,h)=>(h.lastActivity||0)-(f.lastActivity||0)),[s.agents,e]);return c.length===0?null:o.jsxs("div",{className:"unit-other-agents",children:[o.jsxs("div",{className:"unit-other-agents-header",onClick:()=>i(!r),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("unitPanel.otherAgents")," (",c.length,")"]}),o.jsx("span",{className:"unit-other-agents-toggle",children:r?"▶":"▼"})]}),!r&&o.jsx("div",{className:"unit-other-agents-list",children:c.map(d=>{const f=Ia(d.class,a);return o.jsxs("div",{className:`unit-other-agent-item ${d.status}`,onClick:()=>{U.selectAgent(d.id),U.setTerminalOpen(!0)},children:[o.jsx("span",{className:"unit-other-agent-icon",style:{background:`${f.color}20`},children:f.icon}),o.jsxs("div",{className:"unit-other-agent-info",children:[o.jsx("span",{className:"unit-other-agent-name",children:d.name}),d.taskLabel&&o.jsx("span",{className:"unit-other-agent-task",children:d.taskLabel})]}),o.jsx("div",{className:`agent-status-dot ${d.status}`})]},d.id)})})]})}),tP=b.memo(function({patterns:e,showPatterns:n,onToggle:s,onRemovePattern:a,onClearAll:r}){const{t:i}=pt(["common"]);return o.jsxs("div",{className:"unit-remembered-patterns",children:[o.jsxs("div",{className:"unit-remembered-patterns-header",onClick:s,children:[o.jsx("div",{className:"unit-stat-label",children:i("unitPanel.allowedPatterns")}),o.jsxs("span",{className:"unit-remembered-patterns-toggle",children:[e.length>0&&o.jsx("span",{className:"unit-remembered-patterns-count",children:e.length}),n?"▼":"▶"]})]}),n&&o.jsx("div",{className:"unit-remembered-patterns-list",children:e.length===0?o.jsx("div",{className:"unit-remembered-patterns-empty",children:i("unitPanel.noPatterns")}):o.jsxs(o.Fragment,{children:[e.map((c,d)=>o.jsxs("div",{className:"unit-remembered-pattern-item",children:[o.jsx("span",{className:"unit-pattern-tool",children:c.tool}),o.jsx("span",{className:"unit-pattern-desc",title:c.pattern,children:c.description}),o.jsx("button",{className:"unit-pattern-remove",onClick:()=>a(c.tool,c.pattern),title:i("unitPanel.removePattern"),children:"×"})]},d)),o.jsx("button",{className:"unit-patterns-clear-all",onClick:r,children:i("buttons.clearAll")})]})})]})}),nP=b.memo(function({agentId:e}){const{t:n}=pt(["common"]),[s,a]=b.useState(!0),[r,i]=b.useState(!1),[c,d]=b.useState(null),[f,h]=b.useState([]),[m,x]=b.useState(!1),v=vs().sessionHistories.get(e)||[],S=()=>{const j=!s;a(j),!j&&!r&&(U.requestSessionHistory(e),i(!0))},C=j=>{U.restoreSession(e,j),d(null)},k=async j=>{if(c===j){d(null);return}d(j),x(!0),h([]);try{const E=await Lt(Mt(`/api/agents/${e}/session-preview/${j}?limit=30`));if(!E.ok)console.error(`Session preview failed: ${E.status}`),h([]);else{const D=await E.json();h(D.messages||[])}}catch(E){console.error("Session preview error:",E),h([])}finally{x(!1)}},N=j=>{const D=Date.now()-j;return D<36e5?`${Math.floor(D/6e4)}m ago`:D<864e5?`${Math.floor(D/36e5)}h ago`:new Date(j).toLocaleDateString(void 0,{month:"short",day:"numeric"})};return o.jsxs("div",{className:"unit-session-history",children:[o.jsxs("div",{className:"unit-session-history-header",onClick:S,children:[o.jsx("div",{className:"unit-stat-label",children:n("unitPanel.sessionHistory","Session History")}),o.jsxs("span",{className:"unit-session-history-toggle",children:[v.length>0&&o.jsx("span",{className:"unit-session-history-count",children:v.length}),s?"▶":"▼"]})]}),!s&&o.jsx("div",{className:"unit-session-history-list",children:v.length===0?o.jsx("div",{className:"unit-session-history-empty",children:n("unitPanel.noSessionHistory","No previous sessions")}):v.map(j=>o.jsxs("div",{children:[o.jsxs("div",{className:`unit-session-history-item ${c===j.sessionId?"active":""}`,children:[j.fileExists===!1&&o.jsx("span",{className:"unit-session-history-missing",title:"Session file missing from disk",children:"⚠"}),o.jsxs("div",{className:"unit-session-history-item-info",onClick:()=>k(j.sessionId),style:{cursor:"pointer"},children:[o.jsx("span",{className:"unit-session-history-item-summary",title:j.summary,children:j.summary.length>60?j.summary.slice(0,60)+"...":j.summary}),o.jsx("span",{className:"unit-session-history-item-date",children:N(j.endedAt)})]}),o.jsx("button",{className:"unit-session-history-restore-btn",onClick:()=>C(j.sessionId),title:n("unitPanel.restoreSession","Restore this session"),disabled:j.fileExists===!1,children:"↩"})]}),c===j.sessionId&&o.jsx("div",{className:"unit-session-preview",children:m?o.jsx("div",{className:"unit-session-preview-loading",children:"Loading..."}):f.length===0?o.jsx("div",{className:"unit-session-preview-empty",children:"No messages found"}):f.filter(E=>E.type==="user"||E.type==="assistant"||E.type==="tool_use").map((E,D)=>{if(E.type==="tool_use")return o.jsx("div",{className:"unit-session-preview-msg tool",children:o.jsx("span",{className:"unit-session-preview-tool-chip",children:E.toolName||"Tool"})},D);const _=E.type==="user"?300:400,P=E.content.length>_?E.content.slice(0,_)+"...":E.content;return o.jsxs("div",{className:`unit-session-preview-msg ${E.type}`,children:[o.jsx("div",{className:"unit-session-preview-role-chip",children:E.type==="user"?"YOU":"AGENT"}),o.jsx("div",{className:"unit-session-preview-text",children:P})]},D)})})]},j.sessionId))})]})}),sP=b.memo(function({action:e,agentName:n,onClose:s,onConfirm:a}){const{t:r}=pt(["common"]),{handleMouseDown:i,handleClick:c}=wa(s);return o.jsx("div",{className:"modal-overlay visible",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal confirm-modal",children:[o.jsx("div",{className:"modal-header",children:r(e==="collapse"?"unitPanel.collapseContextTitle":"unitPanel.clearContextTitle")}),o.jsx("div",{className:"modal-body confirm-modal-body",children:e==="collapse"?o.jsxs(o.Fragment,{children:[o.jsx("p",{dangerouslySetInnerHTML:{__html:r("unitPanel.collapseContextMsg",{name:n})}}),o.jsx("p",{className:"confirm-modal-note",children:r("unitPanel.collapseContextNote")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{dangerouslySetInnerHTML:{__html:r("unitPanel.clearContextMsg",{name:n})}}),o.jsx("p",{className:"confirm-modal-note",children:r("unitPanel.clearContextNote")})]})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:s,children:r("buttons.cancel")}),o.jsx("button",{className:`btn ${e==="clear"?"btn-danger":"btn-primary"}`,onClick:a,autoFocus:!0,children:r(e==="collapse"?"unitPanel.collapseBtn":"unitPanel.clearContextBtn")})]})]})})}),tN=b.memo(function({entry:e,defaultExpanded:n=!1,agent:s,onAgentClick:a}){var k;const{t:r}=pt(["common"]),[i,c]=b.useState(n),d=vs(),f=Pa(),{analysis:h}=e,m=d.settings.hideCost,x=su(h.statusDescription,m),y=su(h.recentWorkSummary,m),v=(k=h.concerns)==null?void 0:k.map(N=>su(N,m)).filter(N=>N.length>0),S=s?Ia(s.class,f):null,C=N=>{s&&a&&(N.stopPropagation(),a(s.id))};return o.jsxs("div",{className:"supervisor-history-item",children:[o.jsxs("div",{className:"supervisor-history-item-header",onClick:()=>c(!i),children:[o.jsx("span",{className:"supervisor-history-progress-dot",style:{background:WD[h.progress]||"#888"},title:h.progress}),o.jsxs("div",{className:"supervisor-history-item-content",children:[s&&S&&o.jsxs("div",{className:"supervisor-history-agent-line",onClick:C,children:[o.jsx("span",{className:"supervisor-history-agent-icon",children:S.icon}),o.jsx("span",{className:"supervisor-history-agent-name",children:s.name}),o.jsx("span",{className:"supervisor-history-time",children:Wf(e.timestamp)})]}),o.jsx("div",{className:"supervisor-history-status",children:x})]}),!s&&o.jsx("span",{className:"supervisor-history-time",children:Wf(e.timestamp)})]}),i&&o.jsxs("div",{className:"supervisor-history-item-details",children:[o.jsxs("div",{className:"supervisor-history-summary",children:[o.jsxs("strong",{children:[r("labels.summary"),":"]})," ",y]}),v&&v.length>0&&o.jsxs("div",{className:"supervisor-history-concerns",children:[o.jsxs("strong",{children:[r("labels.concerns"),":"]}),o.jsx("ul",{children:v.map((N,j)=>o.jsx("li",{children:N},j))})]})]})]})}),aP=b.memo(function({agent:e}){const{t:n}=pt(["common"]),s=vs(),a=Pa(),[r,i]=b.useState(!0),[c,d]=b.useState(!0),f=b.useMemo(()=>{const v=s.agents.get(e.id);return!v||!v.isBoss&&v.class!=="boss"||!v.subordinateIds?[]:v.subordinateIds.map(S=>s.agents.get(S)).filter(S=>S!==void 0)},[s.agents,e.id]),h=U.getDelegationHistory(e.id),m=s.pendingDelegation,x=(m==null?void 0:m.bossId)===e.id;b.useEffect(()=>{U.requestDelegationHistory(e.id)},[e.id]);const y=wp.boss;return o.jsxs("div",{className:"boss-section",children:[o.jsxs("div",{className:"boss-header",children:[o.jsx("span",{className:"boss-crown-icon",style:{color:y.color},children:y.icon}),o.jsx("span",{className:"boss-title",children:n("unitPanel.bossAgent")})]}),o.jsxs("div",{className:"boss-subordinates",children:[o.jsxs("div",{className:"boss-subordinates-header",onClick:()=>i(!r),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("labels.team")," (",f.length,")"]}),o.jsx("span",{className:"boss-toggle",children:r?"▼":"▶"})]}),r&&o.jsx("div",{className:"boss-subordinates-list",children:f.length===0?o.jsx("div",{className:"boss-subordinates-empty",children:n("unitPanel.noSubordinates")}):f.map(v=>{const S=Ia(v.class,a),C=kp(v),k=Math.max(0,Math.min(100,Math.round(C.usedPercent))),N=Math.round((1-k/100)*120),j={width:`${k}%`,"--boss-context-hue":`${N}`};return o.jsxs("div",{className:"boss-subordinate-item",onClick:()=>{U.selectAgent(v.id),U.setTerminalOpen(!0)},children:[o.jsx("span",{className:"boss-subordinate-icon",style:{color:S.color},children:S.icon}),o.jsxs("div",{className:"boss-subordinate-meta",children:[o.jsx("span",{className:"boss-subordinate-name",children:v.name}),o.jsxs("div",{className:"boss-subordinate-context",title:`${k}% context used`,children:[o.jsx("div",{className:"boss-subordinate-context-track",children:o.jsx("div",{className:"boss-subordinate-context-fill",style:j})}),o.jsxs("span",{className:"boss-subordinate-context-value",children:[k,"%"]})]})]}),o.jsx("span",{className:`boss-subordinate-status status-${v.status}`,children:v.status}),o.jsx("button",{className:"boss-subordinate-unlink",onClick:E=>{E.stopPropagation(),U.removeSubordinate(e.id,v.id)},title:n("unitPanel.unlinkSubordinate"),children:"✕"})]},v.id)})})]}),o.jsxs("div",{className:"boss-delegation-history",children:[o.jsxs("div",{className:"boss-delegation-history-header",onClick:()=>d(!c),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("unitPanel.delegationHistory")," (",h.length,")"]}),o.jsx("span",{className:"boss-toggle",children:c?"▼":"▶"})]}),c&&o.jsxs("div",{className:"boss-delegation-history-list",children:[x&&o.jsxs("div",{className:"boss-delegation-pending",children:[o.jsx("span",{className:"delegation-spinner",children:"⏳"}),n("unitPanel.analyzingRequest")]}),h.length===0&&!x?o.jsx("div",{className:"boss-delegation-empty",children:n("unitPanel.noDelegationHistory")}):h.slice(0,10).map(v=>o.jsx(rP,{decision:v},v.id))]})]})]})}),rP=b.memo(function({decision:e}){const{t:n}=pt(["common"]),[s,a]=b.useState(!1),i=vs().agents.get(e.selectedAgentId),c=i?wp[i.class]:null,d={high:"#4aff9e",medium:"#ff9e4a",low:"#ff4a4a"};return o.jsxs("div",{className:"delegation-decision-item",children:[o.jsxs("div",{className:"delegation-decision-header",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegation-decision-arrow",children:s?"▼":"▶"}),c&&o.jsx("span",{className:"delegation-decision-icon",style:{color:c.color},children:c.icon}),o.jsxs("span",{className:"delegation-decision-agent",children:["→ ",e.selectedAgentName]}),o.jsx("span",{className:"delegation-decision-confidence",style:{color:d[e.confidence]},title:n("unitPanel.confidence",{level:e.confidence}),children:e.confidence==="high"?"●●●":e.confidence==="medium"?"●●○":"●○○"}),o.jsx("span",{className:"delegation-decision-time",children:Wf(e.timestamp)})]}),s&&o.jsxs("div",{className:"delegation-decision-details",children:[o.jsxs("div",{className:"delegation-decision-command",children:[o.jsxs("strong",{children:[n("labels.command"),":"]}),o.jsx("div",{className:"delegation-command-text",children:e.userCommand.length>200?e.userCommand.slice(0,200)+"...":e.userCommand})]}),o.jsxs("div",{className:"delegation-decision-reasoning",children:[o.jsxs("strong",{children:[n("labels.reasoning"),":"]})," ",e.reasoning]}),e.alternativeAgents.length>0&&o.jsxs("div",{className:"delegation-decision-alternatives",children:[o.jsxs("strong",{children:[n("labels.alternatives"),":"]})," ",e.alternativeAgents.join(", ")]})]})]})}),iP=b.memo(function({agentId:e,bossId:n}){const{t:s}=pt(["common"]),r=vs().agents.get(n);if(!r)return null;const i=wp.boss,c=d=>{d.stopPropagation(),U.removeSubordinate(n,e)};return o.jsxs("div",{className:"subordinate-badge",children:[o.jsx("span",{className:"subordinate-badge-icon",style:{color:i.color},children:i.icon}),o.jsxs("span",{className:"subordinate-badge-text",children:[s("labels.reportsTo"),": ",o.jsx("strong",{children:r.name})]}),o.jsx("button",{className:"subordinate-badge-goto",onClick:()=>U.selectAgent(n),title:s("unitPanel.goToBoss"),children:"→"}),o.jsx("button",{className:"subordinate-badge-unlink",onClick:c,title:s("unitPanel.unlinkFromBoss"),children:"✕"})]})}),oP=b.memo(function({agentId:e}){const{t:n}=pt(["common"]),s=vs(),[a,r]=b.useState(!1),i=Array.from(s.agents.values()).filter(f=>f.isBoss===!0||f.class==="boss");if(i.length===0)return null;const c=wp.boss,d=f=>{const h=s.agents.get(f);if(!h)return;const m=h.subordinateIds||[];U.assignSubordinates(f,[...m,e]),r(!1)};return o.jsx("div",{className:"link-to-boss-section",children:a?o.jsxs("div",{className:"link-to-boss-dropdown",children:[o.jsxs("div",{className:"link-to-boss-header",children:[o.jsx("span",{children:n("unitPanel.selectBoss")}),o.jsx("button",{className:"link-to-boss-close",onClick:()=>r(!1),children:"✕"})]}),o.jsx("div",{className:"link-to-boss-list",children:i.map(f=>{var h;return o.jsxs("div",{className:"link-to-boss-item",onClick:()=>d(f.id),children:[o.jsx("span",{className:"link-to-boss-item-icon",style:{color:c.color},children:c.icon}),o.jsx("span",{className:"link-to-boss-item-name",children:f.name}),o.jsx("span",{className:"link-to-boss-item-count",children:n("unitPanel.agentsCount",{count:((h=f.subordinateIds)==null?void 0:h.length)||0})})]},f.id)})})]}):o.jsxs("button",{className:"link-to-boss-btn",onClick:()=>r(!0),children:[o.jsx("span",{className:"link-to-boss-icon",style:{color:c.color},children:c.icon}),o.jsx("span",{children:n("unitPanel.linkToBoss")})]})})});function uS({onOpenAreaExplorer:t}){const{t:e}=pt(["common"]),n=vs(),s=Array.from(n.agents.values()),a=Array.from(n.areas.values()),[r,i]=b.useState(""),[c,d]=b.useState(()=>{const P=va(ft.COMMANDER_FILTERS,"all");return P==="working"?"active":P||"all"}),f=b.useRef(null),h=b.useMemo(()=>s.map(P=>P.id).sort().join(","),[s]),m=b.useRef(new Set);b.useEffect(()=>{for(const P of s){if(m.current.has(P.id))continue;U.getAgentSupervisorHistory(P.id).length===0&&!U.isLoadingHistoryForAgent(P.id)&&(m.current.add(P.id),U.requestAgentSupervisorHistory(P.id))}},[h]);const x=n.agentsWithUnseenOutput,y=b.useMemo(()=>{const P={all:0,active:0,idle:0,error:0,waiting:0};for(const O of s)P.all++,(O.status==="working"||x.has(O.id))&&P.active++,O.status==="idle"&&!x.has(O.id)&&P.idle++,(O.status==="error"||O.status==="orphaned"||O.status==="offline")&&P.error++,(O.status==="waiting"||O.status==="waiting_permission")&&P.waiting++;return P},[s,x]),v=b.useMemo(()=>{const P=r.toLowerCase().trim();return s.filter(O=>{var T,M;if(c!=="all"&&(c==="active"&&O.status!=="working"&&!x.has(O.id)||c==="idle"&&(O.status!=="idle"||x.has(O.id))||c==="error"&&O.status!=="error"&&O.status!=="orphaned"&&O.status!=="offline"||c==="waiting"&&O.status!=="waiting"&&O.status!=="waiting_permission"))return!1;if(P){const R=O.name.toLowerCase().includes(P),I=((T=O.taskLabel)==null?void 0:T.toLowerCase().includes(P))||!1,z=O.class.toLowerCase().includes(P),W=((M=O.currentTool)==null?void 0:M.toLowerCase().includes(P))||!1;return R||I||z||W}return!0})},[s,r,c,x]),S=b.useMemo(()=>XL(v),[v]),C=JL(S,P=>U.getAreaForAgent(P));if(!r&&c==="all")for(const P of a)C.has(P.id)||C.set(P.id,[]);const k=ZL(Array.from(C.keys()),P=>n.areas.get(P)),N=b.useCallback(P=>{d(P),er(ft.COMMANDER_FILTERS,P)},[]),j=b.useCallback(()=>{var P;i(""),(P=f.current)==null||P.focus()},[]);if(s.length===0&&a.length===0)return o.jsxs("div",{className:"empty-state",children:[o.jsx("div",{className:"empty-state-icon",children:"⚔️"}),o.jsx("div",{className:"empty-state-title",children:e("agentsList.noAgentsDeployed")}),o.jsx("div",{className:"empty-state-desc",children:e("agentsList.clickNewAgent")})]});const E=r||c!=="all",D=v.length,_=s.length;return o.jsxs("div",{className:"agents-list",children:[o.jsxs("div",{className:"agents-stats-bar",children:[o.jsxs("div",{className:"agents-stats-item",children:[o.jsx("span",{className:"agents-stats-count",children:_}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.total")})]}),y.active>0&&o.jsxs("div",{className:"agents-stats-item working",children:[o.jsx("span",{className:"agents-stats-count",children:y.active}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusActive")})]}),y.idle>0&&o.jsxs("div",{className:"agents-stats-item idle",children:[o.jsx("span",{className:"agents-stats-count",children:y.idle}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusIdle")})]}),y.waiting>0&&o.jsxs("div",{className:"agents-stats-item waiting",children:[o.jsx("span",{className:"agents-stats-count",children:y.waiting}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusWaiting")})]}),y.error>0&&o.jsxs("div",{className:"agents-stats-item error",children:[o.jsx("span",{className:"agents-stats-count",children:y.error}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusError")})]})]}),o.jsxs("div",{className:"agents-search-bar",children:[o.jsx("span",{className:"agents-search-icon",children:"🔍"}),o.jsx("input",{ref:f,type:"text",className:"agents-search-input",placeholder:e("agentsList.searchPlaceholder"),value:r,onChange:P=>i(P.target.value)}),r&&o.jsx("button",{className:"agents-search-clear",onClick:j,children:"×"})]}),o.jsx("div",{className:"agents-filter-chips",children:["all","active","idle","waiting","error"].map(P=>{const O=y[P];return P!=="all"&&O===0?null:o.jsxs("button",{className:`agents-filter-chip ${P} ${c===P?"selected":""}`,onClick:()=>N(P),children:[e(`agentsList.filter_${P}`),o.jsx("span",{className:"agents-filter-chip-count",children:O})]},P)})}),E&&o.jsxs("div",{className:"agents-filter-info",children:[e("agentsList.showing",{count:D,total:_}),o.jsx("button",{className:"agents-filter-clear",onClick:()=>{i(""),N("all")},children:e("agentsList.clearFilters")})]}),o.jsxs("div",{className:"agents-list-scroll",children:[k.map(P=>{const O=C.get(P),T=P?n.areas.get(P):null;return E&&O.length===0?null:o.jsxs("div",{className:"agents-group",children:[o.jsxs("div",{className:"agents-group-header",style:T?{borderLeftColor:T.color,background:`${T.color}15`}:void 0,children:[T?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"agents-group-dot",style:{background:T.color}}),o.jsx("span",{className:"agents-group-name",children:T.name}),T.directories.length>0&&o.jsx("button",{className:"area-browse-btn",onClick:()=>t==null?void 0:t(T.id),title:e("agentsList.browseFiles"),children:"📂"})]}):o.jsx("span",{className:"agents-group-name unassigned",children:e("agentsList.unassigned")}),o.jsx("span",{className:"agents-group-count",children:O.length})]}),O.length>0&&o.jsx("div",{className:"agents-group-items",style:T?{background:`${T.color}08`}:void 0,children:O.map(M=>o.jsx(lP,{agent:M,area:T,searchQuery:r},M.id))})]},P||"unassigned")}),E&&D===0&&o.jsxs("div",{className:"agents-no-results",children:[o.jsx("span",{className:"agents-no-results-icon",children:"🔎"}),o.jsx("span",{children:e("agentsList.noResults")})]}),s.length>0&&o.jsx(cP,{agents:s})]})]})}const lP=b.memo(function({agent:e,area:n,searchQuery:s=""}){const a=vs(),r=Pa(),i=Ia(e.class,r),c=a.selectedAgentIds.has(e.id),d=a.agentsWithUnseenOutput.has(e.id),[,f]=b.useState(0);b.useEffect(()=>{if(e.status==="idle"){const N=setInterval(()=>{f(j=>j+1)},15e3);return()=>clearInterval(N)}},[e.status]);const h=()=>{U.selectAgent(e.id)},m=e.status==="idle"&&e.lastActivity>0,x=e.lastActivity>0?Xb(e.lastActivity):void 0,y=kp(e),v=Yj(y.remainingPercent),S=e.provider==="codex"?"CX":e.provider==="opencode"?"OC":"CL",C=e.provider==="codex"?"OpenAI Codex":e.provider==="opencode"?"OpenCode":"Claude",k=N=>{if(!s.trim())return N;const j=s.trim(),E=N.toLowerCase().indexOf(j.toLowerCase());return E===-1?N:o.jsxs(o.Fragment,{children:[N.slice(0,E),o.jsx("span",{className:"agents-search-highlight",children:N.slice(E,E+j.length)}),N.slice(E+j.length)]})};return o.jsxs("div",{className:`agent-item ${c?"selected":""} ${d?"unread":""} ${e.status}`,onClick:h,children:[o.jsxs("div",{className:"agent-item-icon",style:{background:`${i.color}20`},children:[i.icon,d&&o.jsx("span",{className:"agent-item-unread-dot"})]}),o.jsxs("div",{className:"agent-item-info",children:[o.jsxs("div",{className:"agent-item-top-row",children:[o.jsx("span",{className:"agent-item-name",children:k(e.name)}),o.jsx("span",{className:`agent-item-provider ${e.provider}`,title:C,children:S})]}),e.taskLabel&&o.jsx("div",{className:"agent-item-task",children:k(e.taskLabel)}),o.jsxs("div",{className:"agent-item-status",children:[o.jsx("span",{className:`agent-item-status-badge ${e.status}`,children:e.status}),m&&o.jsxs("span",{className:"agent-item-idle",style:{color:x},title:gp(e.lastActivity),children:["⏱ ",QL(e.lastActivity)]}),e.isBoss&&o.jsx("span",{className:"agent-item-boss-badge",title:"Boss agent",children:"B"})]}),o.jsx("div",{className:"agent-item-context-bar",title:`Context: ${Math.round(y.usedPercent)}% used`,children:o.jsx("div",{className:"agent-item-context-fill",style:{width:`${y.usedPercent}%`,background:v}})})]}),o.jsx("div",{className:`agent-status-dot ${e.status}`})]})}),cP=b.memo(function({agents:e}){const{t:n}=pt(["common"]),s=vs(),[a,r]=b.useState(()=>Er(ft.GLOBAL_SUPERVISOR_COLLAPSED)),i=()=>{const h=!a;r(h),Qa(ft.GLOBAL_SUPERVISOR_COLLAPSED,h)},c=b.useMemo(()=>{const h=[];for(const m of e){const x=U.getAgentSupervisorHistory(m.id);for(const y of x)h.push({agent:m,entry:y})}return h.sort((m,x)=>x.entry.timestamp-m.entry.timestamp),h.slice(0,30)},[e,s.supervisor.agentHistories]),d=b.useCallback(h=>{U.selectAgent(h)},[]),f=c.length>0?c[0].entry.timestamp:Date.now();return o.jsxs("div",{className:"global-supervisor-status",children:[o.jsxs("div",{className:"global-supervisor-header",onClick:i,children:[o.jsx("span",{className:"global-supervisor-toggle",children:a?"▶":"▼"}),o.jsx("span",{className:"global-supervisor-title",children:n("agentsList.supervisorStatus")}),c.length>0&&o.jsx("span",{className:"global-supervisor-count",children:c.length}),c.length>0&&o.jsx("span",{className:"global-supervisor-time",children:Wf(f)})]}),!a&&o.jsx("div",{className:"global-supervisor-list global-supervisor-timeline",children:c.length===0?o.jsx("div",{className:"global-supervisor-empty",children:n("unitPanel.noSupervisorReports")}):c.map(({agent:h,entry:m})=>o.jsx(tN,{entry:m,agent:h,onAgentClick:d,defaultExpanded:!1},m.id))})]})}),uP=b.memo(function({agents:e}){const{t:n}=pt(["common"]),s=Pa(),a=e.reduce((i,c)=>i+c.tokensUsed,0),r=e.filter(i=>i.status==="working").length;return o.jsxs("div",{className:"unit-panel",children:[o.jsxs("div",{className:"unit-panel-header",children:[o.jsx("div",{className:"unit-class-icon",style:{background:"#4a9eff20"},children:"👥"}),o.jsxs("div",{children:[o.jsx("div",{className:"unit-name",children:n("multiAgent.agentsSelected",{count:e.length})}),o.jsx("div",{className:"unit-status",children:n("multiAgent.groupSelection")})]})]}),o.jsxs("div",{className:"unit-stats",children:[o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:n("multiAgent.totalTokens")}),o.jsx("div",{className:"unit-stat-value",children:VD(a)})]}),o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:n("multiAgent.working")}),o.jsx("div",{className:"unit-stat-value",children:r})]})]}),o.jsx("div",{style:{padding:"8px 0",maxHeight:100,overflowY:"auto"},children:e.map(i=>o.jsx(dP,{agent:i,customClasses:s},i.id))}),o.jsx("div",{className:"unit-actions",children:o.jsx("button",{className:"unit-action-btn",onClick:()=>U.deselectAll(),children:n("buttons.deselectAll")})})]})}),dP=b.memo(function({agent:e,customClasses:n}){const s=Ia(e.class,n);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",fontSize:12},children:[o.jsx("span",{children:s.icon}),o.jsx("span",{style:{flex:1},children:e.name}),o.jsx("span",{style:{color:"var(--text-secondary)"},children:e.status})]})});function dS({onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}){const a=vs(),r=U.getSelectedAgents();if(a.selectedAgentIds.size===0)return o.jsx(uS,{onOpenAreaExplorer:s});if(a.selectedAgentIds.size===1){const i=r[0];return i?o.jsx(Z2,{agent:i,onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}):o.jsx(uS,{onOpenAreaExplorer:s})}return o.jsx(uP,{agents:r})}function fP(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const pP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mP={};function fS(t,e){return(mP.jsx?hP:pP).test(t)}const gP=/[ \t\n\f\r]/g;function bP(t){return typeof t=="object"?t.type==="text"?pS(t.value):!1:pS(t)}function pS(t){return t.replace(gP,"")===""}class Eu{constructor(e,n,s){this.normal=n,this.property=e,s&&(this.space=s)}}Eu.prototype.normal={};Eu.prototype.property={};Eu.prototype.space=void 0;function nN(t,e){const n={},s={};for(const a of t)Object.assign(n,a.property),Object.assign(s,a.normal);return new Eu(n,s,e)}function Nb(t){return t.toLowerCase()}class $s{constructor(e,n){this.attribute=n,this.property=e}}$s.prototype.attribute="";$s.prototype.booleanish=!1;$s.prototype.boolean=!1;$s.prototype.commaOrSpaceSeparated=!1;$s.prototype.commaSeparated=!1;$s.prototype.defined=!1;$s.prototype.mustUseProperty=!1;$s.prototype.number=!1;$s.prototype.overloadedBoolean=!1;$s.prototype.property="";$s.prototype.spaceSeparated=!1;$s.prototype.space=void 0;let xP=0;const Wt=yo(),Xn=yo(),Tb=yo(),rt=yo(),Tn=yo(),bl=yo(),Xs=yo();function yo(){return 2**++xP}const Eb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Wt,booleanish:Xn,commaOrSpaceSeparated:Xs,commaSeparated:bl,number:rt,overloadedBoolean:Tb,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),mg=Object.keys(Eb);class xx extends $s{constructor(e,n,s,a){let r=-1;if(super(e,n),hS(this,"space",a),typeof s=="number")for(;++r<mg.length;){const i=mg[r];hS(this,mg[r],(s&Eb[i])===Eb[i])}}}xx.prototype.defined=!0;function hS(t,e,n){n&&(t[e]=n)}function Ol(t){const e={},n={};for(const[s,a]of Object.entries(t.properties)){const r=new xx(s,t.transform(t.attributes||{},s),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(r.mustUseProperty=!0),e[s]=r,n[Nb(s)]=s,n[Nb(r.attribute)]=s}return new Eu(e,n,t.space)}const sN=Ol({properties:{ariaActiveDescendant:null,ariaAtomic:Xn,ariaAutoComplete:null,ariaBusy:Xn,ariaChecked:Xn,ariaColCount:rt,ariaColIndex:rt,ariaColSpan:rt,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:Xn,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:Xn,ariaFlowTo:Tn,ariaGrabbed:Xn,ariaHasPopup:null,ariaHidden:Xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:rt,ariaLive:null,ariaModal:Xn,ariaMultiLine:Xn,ariaMultiSelectable:Xn,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:rt,ariaPressed:Xn,ariaReadOnly:Xn,ariaRelevant:null,ariaRequired:Xn,ariaRoleDescription:Tn,ariaRowCount:rt,ariaRowIndex:rt,ariaRowSpan:rt,ariaSelected:Xn,ariaSetSize:rt,ariaSort:null,ariaValueMax:rt,ariaValueMin:rt,ariaValueNow:rt,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function aN(t,e){return e in t?t[e]:e}function rN(t,e){return aN(t,e.toLowerCase())}const yP=Ol({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bl,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:Wt,allowPaymentRequest:Wt,allowUserMedia:Wt,alt:null,as:null,async:Wt,autoCapitalize:null,autoComplete:Tn,autoFocus:Wt,autoPlay:Wt,blocking:Tn,capture:null,charSet:null,checked:Wt,cite:null,className:Tn,cols:rt,colSpan:null,content:null,contentEditable:Xn,controls:Wt,controlsList:Tn,coords:rt|bl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Wt,defer:Wt,dir:null,dirName:null,disabled:Wt,download:Tb,draggable:Xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Wt,formTarget:null,headers:Tn,height:rt,hidden:Tb,high:rt,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:Wt,inputMode:null,integrity:null,is:null,isMap:Wt,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:Wt,itemType:Tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Wt,low:rt,manifest:null,max:null,maxLength:rt,media:null,method:null,min:null,minLength:rt,multiple:Wt,muted:Wt,name:null,nonce:null,noModule:Wt,noValidate:Wt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Wt,optimum:rt,pattern:null,ping:Tn,placeholder:null,playsInline:Wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Wt,referrerPolicy:null,rel:Tn,required:Wt,reversed:Wt,rows:rt,rowSpan:rt,sandbox:Tn,scope:null,scoped:Wt,seamless:Wt,selected:Wt,shadowRootClonable:Wt,shadowRootDelegatesFocus:Wt,shadowRootMode:null,shape:null,size:rt,sizes:null,slot:null,span:rt,spellCheck:Xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:rt,step:null,style:null,tabIndex:rt,target:null,title:null,translate:null,type:null,typeMustMatch:Wt,useMap:null,value:Xn,width:rt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tn,axis:null,background:null,bgColor:null,border:rt,borderColor:null,bottomMargin:rt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Wt,declare:Wt,event:null,face:null,frame:null,frameBorder:null,hSpace:rt,leftMargin:rt,link:null,longDesc:null,lowSrc:null,marginHeight:rt,marginWidth:rt,noResize:Wt,noHref:Wt,noShade:Wt,noWrap:Wt,object:null,profile:null,prompt:null,rev:null,rightMargin:rt,rules:null,scheme:null,scrolling:Xn,standby:null,summary:null,text:null,topMargin:rt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:rt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Wt,disableRemotePlayback:Wt,prefix:null,property:null,results:rt,security:null,unselectable:null},space:"html",transform:rN}),vP=Ol({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Xs,accentHeight:rt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:rt,amplitude:rt,arabicForm:null,ascent:rt,attributeName:null,attributeType:null,azimuth:rt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:rt,by:null,calcMode:null,capHeight:rt,className:Tn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:rt,diffuseConstant:rt,direction:null,display:null,dur:null,divisor:rt,dominantBaseline:null,download:Wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:rt,enableBackground:null,end:null,event:null,exponent:rt,externalResourcesRequired:null,fill:null,fillOpacity:rt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:bl,g2:bl,glyphName:bl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:rt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:rt,horizOriginX:rt,horizOriginY:rt,id:null,ideographic:rt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:rt,k:rt,k1:rt,k2:rt,k3:rt,k4:rt,kernelMatrix:Xs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:rt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:rt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:rt,overlineThickness:rt,paintOrder:null,panose1:null,path:null,pathLength:rt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:rt,pointsAtY:rt,pointsAtZ:rt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xs,rev:Xs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xs,requiredFeatures:Xs,requiredFonts:Xs,requiredFormats:Xs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:rt,specularExponent:rt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:rt,strikethroughThickness:rt,string:null,stroke:null,strokeDashArray:Xs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:rt,strokeOpacity:rt,strokeWidth:null,style:null,surfaceScale:rt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xs,tabIndex:rt,tableValues:null,target:null,targetX:rt,targetY:rt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:rt,underlineThickness:rt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:rt,values:null,vAlphabetic:rt,vMathematical:rt,vectorEffect:null,vHanging:rt,vIdeographic:rt,version:null,vertAdvY:rt,vertOriginX:rt,vertOriginY:rt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:rt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:aN}),iN=Ol({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),oN=Ol({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rN}),lN=Ol({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),wP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},kP=/[A-Z]/g,mS=/-[a-z]/g,SP=/^data[-\w.:]+$/i;function CP(t,e){const n=Nb(e);let s=e,a=$s;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&SP.test(e)){if(e.charAt(4)==="-"){const r=e.slice(5).replace(mS,jP);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=e.slice(4);if(!mS.test(r)){let i=r.replace(kP,AP);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}a=xx}return new a(s,e)}function AP(t){return"-"+t.toLowerCase()}function jP(t){return t.charAt(1).toUpperCase()}const NP=nN([sN,yP,iN,oN,lN],"html"),yx=nN([sN,vP,iN,oN,lN],"svg");function TP(t){return t.join(" ").trim()}var sl={},gg,gS;function EP(){if(gS)return gg;gS=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,r=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
48
|
-
`,f="/",h="*",m="",x="comment",y="declaration";function v(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var N=1,j=1;function E(W){var $=W.match(e);$&&(N+=$.length);var F=W.lastIndexOf(d);j=~F?W.length-F:j+W.length}function D(){var W={line:N,column:j};return function($){return $.position=new _(W),T(),$}}function _(W){this.start=W,this.end={line:N,column:j},this.source=k.source}_.prototype.content=C;function P(W){var $=new Error(k.source+":"+N+":"+j+": "+W);if($.reason=W,$.filename=k.source,$.line=N,$.column=j,$.source=C,!k.silent)throw $}function O(W){var $=W.exec(C);if($){var F=$[0];return E(F),C=C.slice(F.length),$}}function T(){O(n)}function M(W){var $;for(W=W||[];$=R();)$!==!1&&W.push($);return W}function R(){var W=D();if(!(f!=C.charAt(0)||h!=C.charAt(1))){for(var $=2;m!=C.charAt($)&&(h!=C.charAt($)||f!=C.charAt($+1));)++$;if($+=2,m===C.charAt($-1))return P("End of comment missing");var F=C.slice(2,$-2);return j+=2,E(F),C=C.slice($),j+=2,W({type:x,comment:F})}}function I(){var W=D(),$=O(s);if($){if(R(),!O(a))return P("property missing ':'");var F=O(r),H=W({type:y,property:S($[0].replace(t,m)),value:F?S(F[0].replace(t,m)):m});return O(i),H}}function z(){var W=[];M(W);for(var $;$=I();)$!==!1&&(W.push($),M(W));return W}return T(),z()}function S(C){return C?C.replace(c,m):m}return gg=v,gg}var bS;function _P(){if(bS)return sl;bS=1;var t=sl&&sl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(sl,"__esModule",{value:!0}),sl.default=n;const e=t(EP());function n(s,a){let r=null;if(!s||typeof s!="string")return r;const i=(0,e.default)(s),c=typeof a=="function";return i.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:h}=d;c?a(f,h,d):h&&(r=r||{},r[f]=h)}),r}return sl}var Bc={},xS;function MP(){if(xS)return Bc;xS=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,r=function(f){return!f||n.test(f)||t.test(f)},i=function(f,h){return h.toUpperCase()},c=function(f,h){return"".concat(h,"-")},d=function(f,h){return h===void 0&&(h={}),r(f)?f:(f=f.toLowerCase(),h.reactCompat?f=f.replace(a,c):f=f.replace(s,c),f.replace(e,i))};return Bc.camelCase=d,Bc}var Fc,yS;function DP(){if(yS)return Fc;yS=1;var t=Fc&&Fc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},e=t(_P()),n=MP();function s(a,r){var i={};return!a||typeof a!="string"||(0,e.default)(a,function(c,d){c&&d&&(i[(0,n.camelCase)(c,r)]=d)}),i}return s.default=s,Fc=s,Fc}var RP=DP();const OP=ju(RP),cN=uN("end"),vx=uN("start");function uN(t){return e;function e(n){const s=n&&n.position&&n.position[t]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function LP(t){const e=vx(t),n=cN(t);if(e&&n)return{start:e,end:n}}function ou(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?vS(t.position):"start"in t||"end"in t?vS(t):"line"in t||"column"in t?_b(t):""}function _b(t){return wS(t&&t.line)+":"+wS(t&&t.column)}function vS(t){return _b(t&&t.start)+"-"+_b(t&&t.end)}function wS(t){return t&&typeof t=="number"?t:1}class ws extends Error{constructor(e,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",r={},i=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof e=="string"?a=e:!r.cause&&e&&(i=!0,a=e.message,r.cause=e),!r.ruleId&&!r.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?r.ruleId=s:(r.source=s.slice(0,d),r.ruleId=s.slice(d+1))}if(!r.place&&r.ancestors&&r.ancestors){const d=r.ancestors[r.ancestors.length-1];d&&(r.place=d.position)}const c=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=c?c.line:void 0,this.name=ou(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=i&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ws.prototype.file="";ws.prototype.name="";ws.prototype.reason="";ws.prototype.message="";ws.prototype.stack="";ws.prototype.column=void 0;ws.prototype.line=void 0;ws.prototype.ancestors=void 0;ws.prototype.cause=void 0;ws.prototype.fatal=void 0;ws.prototype.place=void 0;ws.prototype.ruleId=void 0;ws.prototype.source=void 0;const wx={}.hasOwnProperty,PP=new Map,IP=/[A-Z]/g,BP=new Set(["table","tbody","thead","tfoot","tr"]),FP=new Set(["td","th"]),dN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zP(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let s;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=YP(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=GP(n,e.jsx,e.jsxs)}const a={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:s,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?yx:NP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},r=fN(a,t,void 0);return r&&typeof r!="string"?r:a.create(t,a.Fragment,{children:r||void 0},void 0)}function fN(t,e,n){if(e.type==="element")return $P(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return HP(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return WP(t,e,n);if(e.type==="mdxjsEsm")return UP(t,e);if(e.type==="root")return qP(t,e,n);if(e.type==="text")return VP(t,e)}function $P(t,e,n){const s=t.schema;let a=s;e.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=yx,t.schema=a),t.ancestors.push(e);const r=hN(t,e.tagName,!1),i=KP(t,e);let c=Sx(t,e);return BP.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!bP(d):!0})),pN(t,i,r,e),kx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function HP(t,e){if(e.data&&e.data.estree&&t.evaluater){const s=e.data.estree.body[0];return s.type,t.evaluater.evaluateExpression(s.expression)}wu(t,e.position)}function UP(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);wu(t,e.position)}function WP(t,e,n){const s=t.schema;let a=s;e.name==="svg"&&s.space==="html"&&(a=yx,t.schema=a),t.ancestors.push(e);const r=e.name===null?t.Fragment:hN(t,e.name,!0),i=QP(t,e),c=Sx(t,e);return pN(t,i,r,e),kx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function qP(t,e,n){const s={};return kx(s,Sx(t,e)),t.create(e,t.Fragment,s,n)}function VP(t,e){return e.value}function pN(t,e,n,s){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=s)}function kx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function GP(t,e,n){return s;function s(a,r,i,c){const f=Array.isArray(i.children)?n:e;return c?f(r,i,c):f(r,i)}}function YP(t,e){return n;function n(s,a,r,i){const c=Array.isArray(r.children),d=vx(s);return e(a,r,i,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function KP(t,e){const n={};let s,a;for(a in e.properties)if(a!=="children"&&wx.call(e.properties,a)){const r=XP(t,a,e.properties[a]);if(r){const[i,c]=r;t.tableCellAlignToStyle&&i==="align"&&typeof c=="string"&&FP.has(e.tagName)?s=c:n[i]=c}}if(s){const r=n.style||(n.style={});r[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function QP(t,e){const n={};for(const s of e.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&t.evaluater){const r=s.data.estree.body[0];r.type;const i=r.expression;i.type;const c=i.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else wu(t,e.position);else{const a=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&t.evaluater){const c=s.value.data.estree.body[0];c.type,r=t.evaluater.evaluateExpression(c.expression)}else wu(t,e.position);else r=s.value===null?!0:s.value;n[a]=r}return n}function Sx(t,e){const n=[];let s=-1;const a=t.passKeys?new Map:PP;for(;++s<e.children.length;){const r=e.children[s];let i;if(t.passKeys){const d=r.type==="element"?r.tagName:r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement"?r.name:void 0;if(d){const f=a.get(d)||0;i=d+"-"+f,a.set(d,f+1)}}const c=fN(t,r,i);c!==void 0&&n.push(c)}return n}function XP(t,e,n){const s=CP(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?fP(n):TP(n)),s.property==="style"){let a=typeof n=="object"?n:JP(t,String(n));return t.stylePropertyNameCase==="css"&&(a=ZP(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&s.space?wP[s.property]||s.property:s.attribute,n]}}function JP(t,e){try{return OP(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const s=n,a=new ws("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=dN+"#cannot-parse-style-attribute",a}}function hN(t,e,n){let s;if(!n)s={type:"Literal",value:e};else if(e.includes(".")){const a=e.split(".");let r=-1,i;for(;++r<a.length;){const c=fS(a[r])?{type:"Identifier",name:a[r]}:{type:"Literal",value:a[r]};i=i?{type:"MemberExpression",object:i,property:c,computed:!!(r&&c.type==="Literal"),optional:!1}:c}s=i}else s=fS(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(s.type==="Literal"){const a=s.value;return wx.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(s);wu(t)}function wu(t,e){const n=new ws("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=dN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ZP(t){const e={};let n;for(n in t)wx.call(t,n)&&(e[eI(n)]=t[n]);return e}function eI(t){let e=t.replace(IP,tI);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function tI(t){return"-"+t.toLowerCase()}const bg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},nI={};function Cx(t,e){const n=nI,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return mN(t,s,a)}function mN(t,e,n){if(sI(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return kS(t.children,e,n)}return Array.isArray(t)?kS(t,e,n):""}function kS(t,e,n){const s=[];let a=-1;for(;++a<t.length;)s[a]=mN(t[a],e,n);return s.join("")}function sI(t){return!!(t&&typeof t=="object")}const SS=document.createElement("i");function Ax(t){const e="&"+t+";";SS.innerHTML=e;const n=SS.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function sa(t,e,n,s){const a=t.length;let r=0,i;if(e<0?e=-e>a?0:a+e:e=e>a?a:e,n=n>0?n:0,s.length<1e4)i=Array.from(s),i.unshift(e,n),t.splice(...i);else for(n&&t.splice(e,n);r<s.length;)i=s.slice(r,r+1e4),i.unshift(e,0),t.splice(...i),r+=1e4,e+=1e4}function ba(t,e){return t.length>0?(sa(t,t.length,0,e),t):e}const CS={}.hasOwnProperty;function gN(t){const e={};let n=-1;for(;++n<t.length;)aI(e,t[n]);return e}function aI(t,e){let n;for(n in e){const a=(CS.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let i;if(r)for(i in r){CS.call(a,i)||(a[i]=[]);const c=r[i];rI(a[i],Array.isArray(c)?c:c?[c]:[])}}}function rI(t,e){let n=-1;const s=[];for(;++n<e.length;)(e[n].add==="after"?t:s).push(e[n]);sa(t,0,0,s)}function bN(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ma(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const js=Ti(/[A-Za-z]/),ys=Ti(/[\dA-Za-z]/),iI=Ti(/[#-'*+\--9=?A-Z^-~]/);function qf(t){return t!==null&&(t<32||t===127)}const Mb=Ti(/\d/),oI=Ti(/[\dA-Fa-f]/),lI=Ti(/[!-/:-@[-`{-~]/);function Rt(t){return t!==null&&t<-2}function jn(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const Sp=Ti(new RegExp("\\p{P}|\\p{S}","u")),ho=Ti(/\s/);function Ti(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ll(t){const e=[];let n=-1,s=0,a=0;for(;++n<t.length;){const r=t.charCodeAt(n);let i="";if(r===37&&ys(t.charCodeAt(n+1))&&ys(t.charCodeAt(n+2)))a=2;else if(r<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(r))||(i=String.fromCharCode(r));else if(r>55295&&r<57344){const c=t.charCodeAt(n+1);r<56320&&c>56319&&c<57344?(i=String.fromCharCode(r,c),a=1):i="�"}else i=String.fromCharCode(r);i&&(e.push(t.slice(s,n),encodeURIComponent(i)),s=n+a+1,i=""),a&&(n+=a,a=0)}return e.join("")+t.slice(s)}function on(t,e,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let r=0;return i;function i(d){return Zt(d)?(t.enter(n),c(d)):e(d)}function c(d){return Zt(d)&&r++<a?(t.consume(d),c):(t.exit(n),e(d))}}const cI={tokenize:uI};function uI(t){const e=t.attempt(this.parser.constructs.contentInitial,s,a);let n;return e;function s(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),on(t,e,"linePrefix")}function a(c){return t.enter("paragraph"),r(c)}function r(c){const d=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,i(c)}function i(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Rt(c)?(t.consume(c),t.exit("chunkText"),r):(t.consume(c),i)}}const dI={tokenize:fI},AS={tokenize:pI};function fI(t){const e=this,n=[];let s=0,a,r,i;return c;function c(j){if(s<n.length){const E=n[s];return e.containerState=E[1],t.attempt(E[0].continuation,d,f)(j)}return f(j)}function d(j){if(s++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,a&&N();const E=e.events.length;let D=E,_;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){_=e.events[D][1].end;break}k(s);let P=E;for(;P<e.events.length;)e.events[P][1].end={..._},P++;return sa(e.events,D+1,0,e.events.slice(E)),e.events.length=P,f(j)}return c(j)}function f(j){if(s===n.length){if(!a)return x(j);if(a.currentConstruct&&a.currentConstruct.concrete)return v(j);e.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(AS,h,m)(j)}function h(j){return a&&N(),k(s),x(j)}function m(j){return e.parser.lazy[e.now().line]=s!==n.length,i=e.now().offset,v(j)}function x(j){return e.containerState={},t.attempt(AS,y,v)(j)}function y(j){return s++,n.push([e.currentConstruct,e.containerState]),x(j)}function v(j){if(j===null){a&&N(),k(0),t.consume(j);return}return a=a||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:r}),S(j)}function S(j){if(j===null){C(t.exit("chunkFlow"),!0),k(0),t.consume(j);return}return Rt(j)?(t.consume(j),C(t.exit("chunkFlow")),s=0,e.interrupt=void 0,c):(t.consume(j),S)}function C(j,E){const D=e.sliceStream(j);if(E&&D.push(null),j.previous=r,r&&(r.next=j),r=j,a.defineSkip(j.start),a.write(D),e.parser.lazy[j.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<i&&(!a.events[_][1].end||a.events[_][1].end.offset>i))return;const P=e.events.length;let O=P,T,M;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){if(T){M=e.events[O][1].end;break}T=!0}for(k(s),_=P;_<e.events.length;)e.events[_][1].end={...M},_++;sa(e.events,O+1,0,e.events.slice(P)),e.events.length=_}}function k(j){let E=n.length;for(;E-- >j;){const D=n[E];e.containerState=D[1],D[0].exit.call(e,t)}n.length=j}function N(){a.write([null]),r=void 0,a=void 0,e.containerState._closeFlow=void 0}}function pI(t,e,n){return on(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kl(t){if(t===null||jn(t)||ho(t))return 1;if(Sp(t))return 2}function Cp(t,e,n){const s=[];let a=-1;for(;++a<t.length;){const r=t[a].resolveAll;r&&!s.includes(r)&&(e=r(e,n),s.push(r))}return e}const Db={name:"attention",resolveAll:hI,tokenize:mI};function hI(t,e){let n=-1,s,a,r,i,c,d,f,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(s=n;s--;)if(t[s][0]==="exit"&&t[s][1].type==="attentionSequence"&&t[s][1]._open&&e.sliceSerialize(t[s][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[s][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[s][1].end.offset-t[s][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;d=t[s][1].end.offset-t[s][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[s][1].end},x={...t[n][1].start};jS(m,-d),jS(x,d),i={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...t[s][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},r={type:d>1?"strongText":"emphasisText",start:{...t[s][1].end},end:{...t[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...i.start},end:{...c.end}},t[s][1].end={...i.start},t[n][1].start={...c.end},f=[],t[s][1].end.offset-t[s][1].start.offset&&(f=ba(f,[["enter",t[s][1],e],["exit",t[s][1],e]])),f=ba(f,[["enter",a,e],["enter",i,e],["exit",i,e],["enter",r,e]]),f=ba(f,Cp(e.parser.constructs.insideSpan.null,t.slice(s+1,n),e)),f=ba(f,[["exit",r,e],["enter",c,e],["exit",c,e],["exit",a,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,f=ba(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,sa(t,s-1,n-s+3,f),n=s+f.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function mI(t,e){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=kl(s);let r;return i;function i(d){return r=d,t.enter("attentionSequence"),c(d)}function c(d){if(d===r)return t.consume(d),c;const f=t.exit("attentionSequence"),h=kl(d),m=!h||h===2&&a||n.includes(d),x=!a||a===2&&h||n.includes(s);return f._open=!!(r===42?m:m&&(a||!x)),f._close=!!(r===42?x:x&&(h||!m)),e(d)}}function jS(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const gI={name:"autolink",tokenize:bI};function bI(t,e,n){let s=0;return a;function a(y){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r}function r(y){return js(y)?(t.consume(y),i):y===64?n(y):f(y)}function i(y){return y===43||y===45||y===46||ys(y)?(s=1,c(y)):f(y)}function c(y){return y===58?(t.consume(y),s=0,d):(y===43||y===45||y===46||ys(y))&&s++<32?(t.consume(y),c):(s=0,f(y))}function d(y){return y===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):y===null||y===32||y===60||qf(y)?n(y):(t.consume(y),d)}function f(y){return y===64?(t.consume(y),h):iI(y)?(t.consume(y),f):n(y)}function h(y){return ys(y)?m(y):n(y)}function m(y){return y===46?(t.consume(y),s=0,h):y===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):x(y)}function x(y){if((y===45||ys(y))&&s++<63){const v=y===45?x:m;return t.consume(y),v}return n(y)}}const _u={partial:!0,tokenize:xI};function xI(t,e,n){return s;function s(r){return Zt(r)?on(t,a,"linePrefix")(r):a(r)}function a(r){return r===null||Rt(r)?e(r):n(r)}}const xN={continuation:{tokenize:vI},exit:wI,name:"blockQuote",tokenize:yI};function yI(t,e,n){const s=this;return a;function a(i){if(i===62){const c=s.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(i),t.exit("blockQuoteMarker"),r}return n(i)}function r(i){return Zt(i)?(t.enter("blockQuotePrefixWhitespace"),t.consume(i),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(i))}}function vI(t,e,n){const s=this;return a;function a(i){return Zt(i)?on(t,r,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):r(i)}function r(i){return t.attempt(xN,e,n)(i)}}function wI(t){t.exit("blockQuote")}const yN={name:"characterEscape",tokenize:kI};function kI(t,e,n){return s;function s(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),a}function a(r){return lI(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}const vN={name:"characterReference",tokenize:SI};function SI(t,e,n){const s=this;let a=0,r,i;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),d}function d(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),r=31,i=ys,h(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,i=oI,h):(t.enter("characterReferenceValue"),r=7,i=Mb,h(m))}function h(m){if(m===59&&a){const x=t.exit("characterReferenceValue");return i===ys&&!Ax(s.sliceSerialize(x))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return i(m)&&a++<r?(t.consume(m),h):n(m)}}const NS={partial:!0,tokenize:AI},TS={concrete:!0,name:"codeFenced",tokenize:CI};function CI(t,e,n){const s=this,a={partial:!0,tokenize:D};let r=0,i=0,c;return d;function d(_){return f(_)}function f(_){const P=s.events[s.events.length-1];return r=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,c=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(_)}function h(_){return _===c?(i++,t.consume(_),h):i<3?n(_):(t.exit("codeFencedFenceSequence"),Zt(_)?on(t,m,"whitespace")(_):m(_))}function m(_){return _===null||Rt(_)?(t.exit("codeFencedFence"),s.interrupt?e(_):t.check(NS,S,E)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(_))}function x(_){return _===null||Rt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(_)):Zt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),on(t,y,"whitespace")(_)):_===96&&_===c?n(_):(t.consume(_),x)}function y(_){return _===null||Rt(_)?m(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||Rt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(_)):_===96&&_===c?n(_):(t.consume(_),v)}function S(_){return t.attempt(a,E,C)(_)}function C(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),k}function k(_){return r>0&&Zt(_)?on(t,N,"linePrefix",r+1)(_):N(_)}function N(_){return _===null||Rt(_)?t.check(NS,S,E)(_):(t.enter("codeFlowValue"),j(_))}function j(_){return _===null||Rt(_)?(t.exit("codeFlowValue"),N(_)):(t.consume(_),j)}function E(_){return t.exit("codeFenced"),e(_)}function D(_,P,O){let T=0;return M;function M($){return _.enter("lineEnding"),_.consume($),_.exit("lineEnding"),R}function R($){return _.enter("codeFencedFence"),Zt($)?on(_,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):I($)}function I($){return $===c?(_.enter("codeFencedFenceSequence"),z($)):O($)}function z($){return $===c?(T++,_.consume($),z):T>=i?(_.exit("codeFencedFenceSequence"),Zt($)?on(_,W,"whitespace")($):W($)):O($)}function W($){return $===null||Rt($)?(_.exit("codeFencedFence"),P($)):O($)}}}function AI(t,e,n){const s=this;return a;function a(i){return i===null?n(i):(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r)}function r(i){return s.parser.lazy[s.now().line]?n(i):e(i)}}const xg={name:"codeIndented",tokenize:NI},jI={partial:!0,tokenize:TI};function NI(t,e,n){const s=this;return a;function a(f){return t.enter("codeIndented"),on(t,r,"linePrefix",5)(f)}function r(f){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(f):n(f)}function i(f){return f===null?d(f):Rt(f)?t.attempt(jI,i,d)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||Rt(f)?(t.exit("codeFlowValue"),i(f)):(t.consume(f),c)}function d(f){return t.exit("codeIndented"),e(f)}}function TI(t,e,n){const s=this;return a;function a(i){return s.parser.lazy[s.now().line]?n(i):Rt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),a):on(t,r,"linePrefix",5)(i)}function r(i){const c=s.events[s.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(i):Rt(i)?a(i):n(i)}}const EI={name:"codeText",previous:MI,resolve:_I,tokenize:DI};function _I(t){let e=t.length-4,n=3,s,a;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(s=n;++s<e;)if(t[s][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(s=n-1,e++;++s<=e;)a===void 0?s!==e&&t[s][1].type!=="lineEnding"&&(a=s):(s===e||t[s][1].type==="lineEnding")&&(t[a][1].type="codeTextData",s!==a+2&&(t[a][1].end=t[s-1][1].end,t.splice(a+2,s-a-2),e-=s-a-2,s=a+2),a=void 0);return t}function MI(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function DI(t,e,n){let s=0,a,r;return i;function i(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),s++,c):(t.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),d):m===96?(r=t.enter("codeTextSequence"),a=0,h(m)):Rt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),d):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Rt(m)?(t.exit("codeTextData"),d(m)):(t.consume(m),f)}function h(m){return m===96?(t.consume(m),a++,h):a===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(r.type="codeTextData",f(m))}}class RI{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(e,s):e>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(e,n,s){const a=n||0;this.setCursor(Math.trunc(e));const r=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&zc(this.left,s),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),zc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);zc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);zc(this.left,n.reverse())}}}function zc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function wN(t){const e={};let n=-1,s,a,r,i,c,d,f;const h=new RI(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,r=0,r<d.length&&d[r][1].type==="lineEndingBlank"&&(r+=2),r<d.length&&d[r][1].type==="content"))for(;++r<d.length&&d[r][1].type!=="content";)d[r][1].type==="chunkText"&&(d[r][1]._isInFirstContentOfListItem=!0,r++);if(s[0]==="enter")s[1].contentType&&(Object.assign(e,OI(h,n)),n=e[n],f=!0);else if(s[1]._container){for(r=n,a=void 0;r--;)if(i=h.get(r),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),i[1].type="lineEnding",a=r);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;a&&(s[1].end={...h.get(a)[1].start},c=h.slice(a,n),c.unshift(s),h.splice(a,n-a+1,c))}}return sa(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function OI(t,e){const n=t.get(e)[1],s=t.get(e)[2];let a=e-1;const r=[];let i=n._tokenizer;i||(i=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const c=i.events,d=[],f={};let h,m,x=-1,y=n,v=0,S=0;const C=[S];for(;y;){for(;t.get(++a)[1]!==y;);r.push(a),y._tokenizer||(h=s.sliceStream(y),y.next||h.push(null),m&&i.defineSkip(y.start),y._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(h),y._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=n;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(S=x+1,C.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(i.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),x=C.length;x--;){const k=c.slice(C[x],C[x+1]),N=r.pop();d.push([N,N+k.length-1]),t.splice(N,2,k)}for(d.reverse(),x=-1;++x<d.length;)f[v+d[x][0]]=v+d[x][1],v+=d[x][1]-d[x][0]-1;return f}const LI={resolve:II,tokenize:BI},PI={partial:!0,tokenize:FI};function II(t){return wN(t),t}function BI(t,e){let n;return s;function s(c){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),a(c)}function a(c){return c===null?r(c):Rt(c)?t.check(PI,i,r)(c):(t.consume(c),a)}function r(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function i(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function FI(t,e,n){const s=this;return a;function a(i){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),on(t,r,"linePrefix")}function r(i){if(i===null||Rt(i))return n(i);const c=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(i):t.interrupt(s.parser.constructs.flow,n,e)(i)}}function kN(t,e,n,s,a,r,i,c,d){const f=d||Number.POSITIVE_INFINITY;let h=0;return m;function m(k){return k===60?(t.enter(s),t.enter(a),t.enter(r),t.consume(k),t.exit(r),x):k===null||k===32||k===41||qf(k)?n(k):(t.enter(s),t.enter(i),t.enter(c),t.enter("chunkString",{contentType:"string"}),S(k))}function x(k){return k===62?(t.enter(r),t.consume(k),t.exit(r),t.exit(a),t.exit(s),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(t.exit("chunkString"),t.exit(c),x(k)):k===null||k===60||Rt(k)?n(k):(t.consume(k),k===92?v:y)}function v(k){return k===60||k===62||k===92?(t.consume(k),y):y(k)}function S(k){return!h&&(k===null||k===41||jn(k))?(t.exit("chunkString"),t.exit(c),t.exit(i),t.exit(s),e(k)):h<f&&k===40?(t.consume(k),h++,S):k===41?(t.consume(k),h--,S):k===null||k===32||k===40||qf(k)?n(k):(t.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(t.consume(k),S):S(k)}}function SN(t,e,n,s,a,r){const i=this;let c=0,d;return f;function f(y){return t.enter(s),t.enter(a),t.consume(y),t.exit(a),t.enter(r),h}function h(y){return c>999||y===null||y===91||y===93&&!d||y===94&&!c&&"_hiddenFootnoteSupport"in i.parser.constructs?n(y):y===93?(t.exit(r),t.enter(a),t.consume(y),t.exit(a),t.exit(s),e):Rt(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||Rt(y)||c++>999?(t.exit("chunkString"),h(y)):(t.consume(y),d||(d=!Zt(y)),y===92?x:m)}function x(y){return y===91||y===92||y===93?(t.consume(y),c++,m):m(y)}}function CN(t,e,n,s,a,r){let i;return c;function c(x){return x===34||x===39||x===40?(t.enter(s),t.enter(a),t.consume(x),t.exit(a),i=x===40?41:x,d):n(x)}function d(x){return x===i?(t.enter(a),t.consume(x),t.exit(a),t.exit(s),e):(t.enter(r),f(x))}function f(x){return x===i?(t.exit(r),d(i)):x===null?n(x):Rt(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),on(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===i||x===null||Rt(x)?(t.exit("chunkString"),f(x)):(t.consume(x),x===92?m:h)}function m(x){return x===i||x===92?(t.consume(x),h):h(x)}}function lu(t,e){let n;return s;function s(a){return Rt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n=!0,s):Zt(a)?on(t,s,n?"linePrefix":"lineSuffix")(a):e(a)}}const zI={name:"definition",tokenize:HI},$I={partial:!0,tokenize:UI};function HI(t,e,n){const s=this;let a;return r;function r(y){return t.enter("definition"),i(y)}function i(y){return SN.call(s,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return a=Ma(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),d):n(y)}function d(y){return jn(y)?lu(t,f)(y):f(y)}function f(y){return kN(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return t.attempt($I,m,m)(y)}function m(y){return Zt(y)?on(t,x,"whitespace")(y):x(y)}function x(y){return y===null||Rt(y)?(t.exit("definition"),s.parser.defined.push(a),e(y)):n(y)}}function UI(t,e,n){return s;function s(c){return jn(c)?lu(t,a)(c):n(c)}function a(c){return CN(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function r(c){return Zt(c)?on(t,i,"whitespace")(c):i(c)}function i(c){return c===null||Rt(c)?e(c):n(c)}}const WI={name:"hardBreakEscape",tokenize:qI};function qI(t,e,n){return s;function s(r){return t.enter("hardBreakEscape"),t.consume(r),a}function a(r){return Rt(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}const VI={name:"headingAtx",resolve:GI,tokenize:YI};function GI(t,e){let n=t.length-2,s=3,a,r;return t[s][1].type==="whitespace"&&(s+=2),n-2>s&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&t[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:t[s][1].start,end:t[n][1].end},r={type:"chunkText",start:t[s][1].start,end:t[n][1].end,contentType:"text"},sa(t,s,n-s+1,[["enter",a,e],["enter",r,e],["exit",r,e],["exit",a,e]])),t}function YI(t,e,n){let s=0;return a;function a(h){return t.enter("atxHeading"),r(h)}function r(h){return t.enter("atxHeadingSequence"),i(h)}function i(h){return h===35&&s++<6?(t.consume(h),i):h===null||jn(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),d(h)):h===null||Rt(h)?(t.exit("atxHeading"),e(h)):Zt(h)?on(t,c,"whitespace")(h):(t.enter("atxHeadingText"),f(h))}function d(h){return h===35?(t.consume(h),d):(t.exit("atxHeadingSequence"),c(h))}function f(h){return h===null||h===35||jn(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const KI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ES=["pre","script","style","textarea"],QI={concrete:!0,name:"htmlFlow",resolveTo:ZI,tokenize:eB},XI={partial:!0,tokenize:nB},JI={partial:!0,tokenize:tB};function ZI(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function eB(t,e,n){const s=this;let a,r,i,c,d;return f;function f(q){return h(q)}function h(q){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(q),m}function m(q){return q===33?(t.consume(q),x):q===47?(t.consume(q),r=!0,S):q===63?(t.consume(q),a=3,s.interrupt?e:B):js(q)?(t.consume(q),i=String.fromCharCode(q),C):n(q)}function x(q){return q===45?(t.consume(q),a=2,y):q===91?(t.consume(q),a=5,c=0,v):js(q)?(t.consume(q),a=4,s.interrupt?e:B):n(q)}function y(q){return q===45?(t.consume(q),s.interrupt?e:B):n(q)}function v(q){const xe="CDATA[";return q===xe.charCodeAt(c++)?(t.consume(q),c===xe.length?s.interrupt?e:I:v):n(q)}function S(q){return js(q)?(t.consume(q),i=String.fromCharCode(q),C):n(q)}function C(q){if(q===null||q===47||q===62||jn(q)){const xe=q===47,de=i.toLowerCase();return!xe&&!r&&ES.includes(de)?(a=1,s.interrupt?e(q):I(q)):KI.includes(i.toLowerCase())?(a=6,xe?(t.consume(q),k):s.interrupt?e(q):I(q)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(q):r?N(q):j(q))}return q===45||ys(q)?(t.consume(q),i+=String.fromCharCode(q),C):n(q)}function k(q){return q===62?(t.consume(q),s.interrupt?e:I):n(q)}function N(q){return Zt(q)?(t.consume(q),N):M(q)}function j(q){return q===47?(t.consume(q),M):q===58||q===95||js(q)?(t.consume(q),E):Zt(q)?(t.consume(q),j):M(q)}function E(q){return q===45||q===46||q===58||q===95||ys(q)?(t.consume(q),E):D(q)}function D(q){return q===61?(t.consume(q),_):Zt(q)?(t.consume(q),D):j(q)}function _(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(t.consume(q),d=q,P):Zt(q)?(t.consume(q),_):O(q)}function P(q){return q===d?(t.consume(q),d=null,T):q===null||Rt(q)?n(q):(t.consume(q),P)}function O(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||jn(q)?D(q):(t.consume(q),O)}function T(q){return q===47||q===62||Zt(q)?j(q):n(q)}function M(q){return q===62?(t.consume(q),R):n(q)}function R(q){return q===null||Rt(q)?I(q):Zt(q)?(t.consume(q),R):n(q)}function I(q){return q===45&&a===2?(t.consume(q),F):q===60&&a===1?(t.consume(q),H):q===62&&a===4?(t.consume(q),Q):q===63&&a===3?(t.consume(q),B):q===93&&a===5?(t.consume(q),G):Rt(q)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(XI,K,z)(q)):q===null||Rt(q)?(t.exit("htmlFlowData"),z(q)):(t.consume(q),I)}function z(q){return t.check(JI,W,K)(q)}function W(q){return t.enter("lineEnding"),t.consume(q),t.exit("lineEnding"),$}function $(q){return q===null||Rt(q)?z(q):(t.enter("htmlFlowData"),I(q))}function F(q){return q===45?(t.consume(q),B):I(q)}function H(q){return q===47?(t.consume(q),i="",V):I(q)}function V(q){if(q===62){const xe=i.toLowerCase();return ES.includes(xe)?(t.consume(q),Q):I(q)}return js(q)&&i.length<8?(t.consume(q),i+=String.fromCharCode(q),V):I(q)}function G(q){return q===93?(t.consume(q),B):I(q)}function B(q){return q===62?(t.consume(q),Q):q===45&&a===2?(t.consume(q),B):I(q)}function Q(q){return q===null||Rt(q)?(t.exit("htmlFlowData"),K(q)):(t.consume(q),Q)}function K(q){return t.exit("htmlFlow"),e(q)}}function tB(t,e,n){const s=this;return a;function a(i){return Rt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):n(i)}function r(i){return s.parser.lazy[s.now().line]?n(i):e(i)}}function nB(t,e,n){return s;function s(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(_u,e,n)}}const sB={name:"htmlText",tokenize:aB};function aB(t,e,n){const s=this;let a,r,i;return c;function c(B){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(B),d}function d(B){return B===33?(t.consume(B),f):B===47?(t.consume(B),D):B===63?(t.consume(B),j):js(B)?(t.consume(B),O):n(B)}function f(B){return B===45?(t.consume(B),h):B===91?(t.consume(B),r=0,v):js(B)?(t.consume(B),N):n(B)}function h(B){return B===45?(t.consume(B),y):n(B)}function m(B){return B===null?n(B):B===45?(t.consume(B),x):Rt(B)?(i=m,H(B)):(t.consume(B),m)}function x(B){return B===45?(t.consume(B),y):m(B)}function y(B){return B===62?F(B):B===45?x(B):m(B)}function v(B){const Q="CDATA[";return B===Q.charCodeAt(r++)?(t.consume(B),r===Q.length?S:v):n(B)}function S(B){return B===null?n(B):B===93?(t.consume(B),C):Rt(B)?(i=S,H(B)):(t.consume(B),S)}function C(B){return B===93?(t.consume(B),k):S(B)}function k(B){return B===62?F(B):B===93?(t.consume(B),k):S(B)}function N(B){return B===null||B===62?F(B):Rt(B)?(i=N,H(B)):(t.consume(B),N)}function j(B){return B===null?n(B):B===63?(t.consume(B),E):Rt(B)?(i=j,H(B)):(t.consume(B),j)}function E(B){return B===62?F(B):j(B)}function D(B){return js(B)?(t.consume(B),_):n(B)}function _(B){return B===45||ys(B)?(t.consume(B),_):P(B)}function P(B){return Rt(B)?(i=P,H(B)):Zt(B)?(t.consume(B),P):F(B)}function O(B){return B===45||ys(B)?(t.consume(B),O):B===47||B===62||jn(B)?T(B):n(B)}function T(B){return B===47?(t.consume(B),F):B===58||B===95||js(B)?(t.consume(B),M):Rt(B)?(i=T,H(B)):Zt(B)?(t.consume(B),T):F(B)}function M(B){return B===45||B===46||B===58||B===95||ys(B)?(t.consume(B),M):R(B)}function R(B){return B===61?(t.consume(B),I):Rt(B)?(i=R,H(B)):Zt(B)?(t.consume(B),R):T(B)}function I(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(t.consume(B),a=B,z):Rt(B)?(i=I,H(B)):Zt(B)?(t.consume(B),I):(t.consume(B),W)}function z(B){return B===a?(t.consume(B),a=void 0,$):B===null?n(B):Rt(B)?(i=z,H(B)):(t.consume(B),z)}function W(B){return B===null||B===34||B===39||B===60||B===61||B===96?n(B):B===47||B===62||jn(B)?T(B):(t.consume(B),W)}function $(B){return B===47||B===62||jn(B)?T(B):n(B)}function F(B){return B===62?(t.consume(B),t.exit("htmlTextData"),t.exit("htmlText"),e):n(B)}function H(B){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),V}function V(B){return Zt(B)?on(t,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):G(B)}function G(B){return t.enter("htmlTextData"),i(B)}}const jx={name:"labelEnd",resolveAll:lB,resolveTo:cB,tokenize:uB},rB={tokenize:dB},iB={tokenize:fB},oB={tokenize:pB};function lB(t){let e=-1;const n=[];for(;++e<t.length;){const s=t[e][1];if(n.push(t[e]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",e+=a}}return t.length!==n.length&&sa(t,0,t.length,n),t}function cB(t,e){let n=t.length,s=0,a,r,i,c;for(;n--;)if(a=t[n][1],r){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;t[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(i){if(t[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(r=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(i=n);const d={type:t[r][1].type==="labelLink"?"link":"image",start:{...t[r][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[r][1].start},end:{...t[i][1].end}},h={type:"labelText",start:{...t[r+s+2][1].end},end:{...t[i-2][1].start}};return c=[["enter",d,e],["enter",f,e]],c=ba(c,t.slice(r+1,r+s+3)),c=ba(c,[["enter",h,e]]),c=ba(c,Cp(e.parser.constructs.insideSpan.null,t.slice(r+s+4,i-3),e)),c=ba(c,[["exit",h,e],t[i-2],t[i-1],["exit",f,e]]),c=ba(c,t.slice(i+1)),c=ba(c,[["exit",d,e]]),sa(t,r,t.length,c),t}function uB(t,e,n){const s=this;let a=s.events.length,r,i;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){r=s.events[a][1];break}return c;function c(x){return r?r._inactive?m(x):(i=s.parser.defined.includes(Ma(s.sliceSerialize({start:r.end,end:s.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(x),t.exit("labelMarker"),t.exit("labelEnd"),d):n(x)}function d(x){return x===40?t.attempt(rB,h,i?h:m)(x):x===91?t.attempt(iB,h,i?f:m)(x):i?h(x):m(x)}function f(x){return t.attempt(oB,h,m)(x)}function h(x){return e(x)}function m(x){return r._balanced=!0,n(x)}}function dB(t,e,n){return s;function s(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),a}function a(m){return jn(m)?lu(t,r)(m):r(m)}function r(m){return m===41?h(m):kN(t,i,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function i(m){return jn(m)?lu(t,d)(m):h(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?CN(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return jn(m)?lu(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function fB(t,e,n){const s=this;return a;function a(c){return SN.call(s,t,r,i,"reference","referenceMarker","referenceString")(c)}function r(c){return s.parser.defined.includes(Ma(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function i(c){return n(c)}}function pB(t,e,n){return s;function s(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),a}function a(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}const hB={name:"labelStartImage",resolveAll:jx.resolveAll,tokenize:mB};function mB(t,e,n){const s=this;return a;function a(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),r}function r(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),i):n(c)}function i(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):e(c)}}const gB={name:"labelStartLink",resolveAll:jx.resolveAll,tokenize:bB};function bB(t,e,n){const s=this;return a;function a(i){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelLink"),r}function r(i){return i===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(i):e(i)}}const yg={name:"lineEnding",tokenize:xB};function xB(t,e){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),on(t,e,"linePrefix")}}const Cf={name:"thematicBreak",tokenize:yB};function yB(t,e,n){let s=0,a;return r;function r(f){return t.enter("thematicBreak"),i(f)}function i(f){return a=f,c(f)}function c(f){return f===a?(t.enter("thematicBreakSequence"),d(f)):s>=3&&(f===null||Rt(f))?(t.exit("thematicBreak"),e(f)):n(f)}function d(f){return f===a?(t.consume(f),s++,d):(t.exit("thematicBreakSequence"),Zt(f)?on(t,c,"whitespace")(f):c(f))}}const Is={continuation:{tokenize:SB},exit:AB,name:"list",tokenize:kB},vB={partial:!0,tokenize:jB},wB={partial:!0,tokenize:CB};function kB(t,e,n){const s=this,a=s.events[s.events.length-1];let r=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,i=0;return c;function c(y){const v=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:Mb(y)){if(s.containerState.type||(s.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),y===42||y===45?t.check(Cf,n,f)(y):f(y);if(!s.interrupt||y===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(y)}return n(y)}function d(y){return Mb(y)&&++i<10?(t.consume(y),d):(!s.interrupt||i<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(t.exit("listItemValue"),f(y)):n(y)}function f(y){return t.enter("listItemMarker"),t.consume(y),t.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,t.check(_u,s.interrupt?n:h,t.attempt(vB,x,m))}function h(y){return s.containerState.initialBlankLine=!0,r++,x(y)}function m(y){return Zt(y)?(t.enter("listItemPrefixWhitespace"),t.consume(y),t.exit("listItemPrefixWhitespace"),x):n(y)}function x(y){return s.containerState.size=r+s.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(y)}}function SB(t,e,n){const s=this;return s.containerState._closeFlow=void 0,t.check(_u,a,r);function a(c){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,on(t,e,"listItemIndent",s.containerState.size+1)(c)}function r(c){return s.containerState.furtherBlankLines||!Zt(c)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,i(c)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,t.attempt(wB,e,i)(c))}function i(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,on(t,t.attempt(Is,e,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function CB(t,e,n){const s=this;return on(t,a,"listItemIndent",s.containerState.size+1);function a(r){const i=s.events[s.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===s.containerState.size?e(r):n(r)}}function AB(t){t.exit(this.containerState.type)}function jB(t,e,n){const s=this;return on(t,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(r){const i=s.events[s.events.length-1];return!Zt(r)&&i&&i[1].type==="listItemPrefixWhitespace"?e(r):n(r)}}const _S={name:"setextUnderline",resolveTo:NB,tokenize:TB};function NB(t,e){let n=t.length,s,a,r;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){s=n;break}t[n][1].type==="paragraph"&&(a=n)}else t[n][1].type==="content"&&t.splice(n,1),!r&&t[n][1].type==="definition"&&(r=n);const i={type:"setextHeading",start:{...t[s][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",r?(t.splice(a,0,["enter",i,e]),t.splice(r+1,0,["exit",t[s][1],e]),t[s][1].end={...t[r][1].end}):t[s][1]=i,t.push(["exit",i,e]),t}function TB(t,e,n){const s=this;let a;return r;function r(f){let h=s.events.length,m;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){m=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(t.enter("setextHeadingLine"),a=f,i(f)):n(f)}function i(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===a?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),Zt(f)?on(t,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Rt(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const EB={tokenize:_B};function _B(t){const e=this,n=t.attempt(_u,s,t.attempt(this.parser.constructs.flowInitial,a,on(t,t.attempt(this.parser.constructs.flow,a,t.attempt(LI,a)),"linePrefix")));return n;function s(r){if(r===null){t.consume(r);return}return t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function a(r){if(r===null){t.consume(r);return}return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const MB={resolveAll:jN()},DB=AN("string"),RB=AN("text");function AN(t){return{resolveAll:jN(t==="text"?OB:void 0),tokenize:e};function e(n){const s=this,a=this.parser.constructs[t],r=n.attempt(a,i,c);return i;function i(h){return f(h)?r(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),d}function d(h){return f(h)?(n.exit("data"),r(h)):(n.consume(h),d)}function f(h){if(h===null)return!0;const m=a[h];let x=-1;if(m)for(;++x<m.length;){const y=m[x];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function jN(t){return e;function e(n,s){let a=-1,r;for(;++a<=n.length;)r===void 0?n[a]&&n[a][1].type==="data"&&(r=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==r+2&&(n[r][1].end=n[a-1][1].end,n.splice(r+2,a-r-2),a=r+2),r=void 0);return t?t(n,s):n}}function OB(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const s=t[n-1][1],a=e.sliceStream(s);let r=a.length,i=-1,c=0,d;for(;r--;){const f=a[r];if(typeof f=="string"){for(i=f.length;f.charCodeAt(i-1)===32;)c++,i--;if(i)break;i=-1}else if(f===-2)d=!0,c++;else if(f!==-1){r++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:r?i:s.start._bufferIndex+i,_index:s.start._index+r,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const LB={42:Is,43:Is,45:Is,48:Is,49:Is,50:Is,51:Is,52:Is,53:Is,54:Is,55:Is,56:Is,57:Is,62:xN},PB={91:zI},IB={[-2]:xg,[-1]:xg,32:xg},BB={35:VI,42:Cf,45:[_S,Cf],60:QI,61:_S,95:Cf,96:TS,126:TS},FB={38:vN,92:yN},zB={[-5]:yg,[-4]:yg,[-3]:yg,33:hB,38:vN,42:Db,60:[gI,sB],91:gB,92:[WI,yN],93:jx,95:Db,96:EI},$B={null:[Db,MB]},HB={null:[42,95]},UB={null:[]},WB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HB,contentInitial:PB,disable:UB,document:LB,flow:BB,flowInitial:IB,insideSpan:$B,string:FB,text:zB},Symbol.toStringTag,{value:"Module"}));function qB(t,e,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},r=[];let i=[],c=[];const d={attempt:P(D),check:P(_),consume:N,enter:j,exit:E,interrupt:P(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:t,previous:null,sliceSerialize:x,sliceStream:y,write:m};let h=e.tokenize.call(f,d);return e.resolveAll&&r.push(e),f;function m(R){return i=ba(i,R),C(),i[i.length-1]!==null?[]:(O(e,0),f.events=Cp(r,f.events,f),f.events)}function x(R,I){return GB(y(R),I)}function y(R){return VB(i,R)}function v(){const{_bufferIndex:R,_index:I,line:z,column:W,offset:$}=s;return{_bufferIndex:R,_index:I,line:z,column:W,offset:$}}function S(R){a[R.line]=R.column,M()}function C(){let R;for(;s._index<i.length;){const I=i[s._index];if(typeof I=="string")for(R=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===R&&s._bufferIndex<I.length;)k(I.charCodeAt(s._bufferIndex));else k(I)}}function k(R){h=h(R)}function N(R){Rt(R)?(s.line++,s.column=1,s.offset+=R===-3?2:1,M()):R!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===i[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=R}function j(R,I){const z=I||{};return z.type=R,z.start=v(),f.events.push(["enter",z,f]),c.push(z),z}function E(R){const I=c.pop();return I.end=v(),f.events.push(["exit",I,f]),I}function D(R,I){O(R,I.from)}function _(R,I){I.restore()}function P(R,I){return z;function z(W,$,F){let H,V,G,B;return Array.isArray(W)?K(W):"tokenize"in W?K([W]):Q(W);function Q(Z){return be;function be(je){const ce=je!==null&&Z[je],Ee=je!==null&&Z.null,ze=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(Ee)?Ee:Ee?[Ee]:[]];return K(ze)(je)}}function K(Z){return H=Z,V=0,Z.length===0?F:q(Z[V])}function q(Z){return be;function be(je){return B=T(),G=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?de():Z.tokenize.call(I?Object.assign(Object.create(f),I):f,d,xe,de)(je)}}function xe(Z){return R(G,B),$}function de(Z){return B.restore(),++V<H.length?q(H[V]):F}}}function O(R,I){R.resolveAll&&!r.includes(R)&&r.push(R),R.resolve&&sa(f.events,I,f.events.length-I,R.resolve(f.events.slice(I),f)),R.resolveTo&&(f.events=R.resolveTo(f.events,f))}function T(){const R=v(),I=f.previous,z=f.currentConstruct,W=f.events.length,$=Array.from(c);return{from:W,restore:F};function F(){s=R,f.previous=I,f.currentConstruct=z,f.events.length=W,c=$,M()}}function M(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function VB(t,e){const n=e.start._index,s=e.start._bufferIndex,a=e.end._index,r=e.end._bufferIndex;let i;if(n===a)i=[t[n].slice(s,r)];else{if(i=t.slice(n,a),s>-1){const c=i[0];typeof c=="string"?i[0]=c.slice(s):i.shift()}r>0&&i.push(t[a].slice(0,r))}return i}function GB(t,e){let n=-1;const s=[];let a;for(;++n<t.length;){const r=t[n];let i;if(typeof r=="string")i=r;else switch(r){case-5:{i="\r";break}case-4:{i=`
|
|
49
|
-
`;break}case-3:{i=`\r
|
|
50
|
-
`;break}case-2:{i=e?" ":" ";break}case-1:{if(!e&&a)continue;i=" ";break}default:i=String.fromCharCode(r)}a=r===-2,s.push(i)}return s.join("")}function YB(t){const s={constructs:gN([WB,...(t||{}).extensions||[]]),content:a(cI),defined:[],document:a(dI),flow:a(EB),lazy:{},string:a(DB),text:a(RB)};return s;function a(r){return i;function i(c){return qB(s,r,c)}}}function KB(t){for(;!wN(t););return t}const MS=/[\0\t\n\r]/g;function QB(){let t=1,e="",n=!0,s;return a;function a(r,i,c){const d=[];let f,h,m,x,y;for(r=e+(typeof r=="string"?r.toString():new TextDecoder(i||void 0).decode(r)),m=0,e="",n&&(r.charCodeAt(0)===65279&&m++,n=void 0);m<r.length;){if(MS.lastIndex=m,f=MS.exec(r),x=f&&f.index!==void 0?f.index:r.length,y=r.charCodeAt(x),!f){e=r.slice(m);break}if(y===10&&m===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<x&&(d.push(r.slice(m,x)),t+=x-m),y){case 0:{d.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,d.push(-2);t++<h;)d.push(-1);break}case 10:{d.push(-4),t=1;break}default:s=!0,t=1}m=x+1}return c&&(s&&d.push(-5),e&&d.push(e),d.push(null)),d}}const XB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JB(t){return t.replace(XB,ZB)}function ZB(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),r=a===120||a===88;return bN(n.slice(r?2:1),r?16:10)}return Ax(n)||t}const NN={}.hasOwnProperty;function eF(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),tF(n)(KB(YB(n).document().write(QB()(t,e,!0))))}function tF(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(Re),autolinkProtocol:T,autolinkEmail:T,atxHeading:r(De),blockQuote:r(Ee),characterEscape:T,characterReference:T,codeFenced:r(ze),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(ze,i),codeText:r(Ge,i),codeTextData:T,data:T,codeFlowValue:T,definition:r(_e),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(me),hardBreakEscape:r(te),hardBreakTrailing:r(te),htmlFlow:r(He,i),htmlFlowData:T,htmlText:r(He,i),htmlTextData:T,image:r(ye),label:i,link:r(Re),listItem:r(pe),listItemValue:x,listOrdered:r(re,m),listUnordered:r(re),paragraph:r(Ve),reference:q,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(De),strong:r(at),thematicBreak:r(ue)},exit:{atxHeading:d(),atxHeadingSequence:D,autolink:d(),autolinkEmail:ce,autolinkProtocol:je,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:Z,characterReference:be,codeFenced:d(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(k),codeText:d($),codeTextData:M,data:M,definition:d(),definitionDestinationString:E,definitionLabelString:N,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(I),hardBreakTrailing:d(I),htmlFlow:d(z),htmlFlowData:M,htmlText:d(W),htmlTextData:M,image:d(H),label:G,labelText:V,lineEnding:R,link:d(F),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:xe,resourceDestinationString:B,resourceTitleString:Q,resource:K,setextHeading:d(O),setextHeadingLineSequence:P,setextHeadingText:_,strong:d(),thematicBreak:d()}};TN(e,(t||{}).mdastExtensions||[]);const n={};return s;function s(X){let se={type:"root",children:[]};const ke={stack:[se],tokenStack:[],config:e,enter:c,exit:f,buffer:i,resume:h,data:n},J=[];let we=-1;for(;++we<X.length;)if(X[we][1].type==="listOrdered"||X[we][1].type==="listUnordered")if(X[we][0]==="enter")J.push(we);else{const We=J.pop();we=a(X,We,we)}for(we=-1;++we<X.length;){const We=e[X[we][0]];NN.call(We,X[we][1].type)&&We[X[we][1].type].call(Object.assign({sliceSerialize:X[we][2].sliceSerialize},ke),X[we][1])}if(ke.tokenStack.length>0){const We=ke.tokenStack[ke.tokenStack.length-1];(We[1]||DS).call(ke,void 0,We[0])}for(se.position={start:xi(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:xi(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<e.transforms.length;)se=e.transforms[we](se)||se;return se}function a(X,se,ke){let J=se-1,we=-1,We=!1,Be,ie,Ie,oe;for(;++J<=ke;){const he=X[J];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?we++:we--,oe=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(Be&&!oe&&!we&&!Ie&&(Ie=J),oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:oe=void 0}if(!we&&he[0]==="enter"&&he[1].type==="listItemPrefix"||we===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(Be){let ne=J;for(ie=void 0;ne--;){const Le=X[ne];if(Le[1].type==="lineEnding"||Le[1].type==="lineEndingBlank"){if(Le[0]==="exit")continue;ie&&(X[ie][1].type="lineEndingBlank",We=!0),Le[1].type="lineEnding",ie=ne}else if(!(Le[1].type==="linePrefix"||Le[1].type==="blockQuotePrefix"||Le[1].type==="blockQuotePrefixWhitespace"||Le[1].type==="blockQuoteMarker"||Le[1].type==="listItemIndent"))break}Ie&&(!ie||Ie<ie)&&(Be._spread=!0),Be.end=Object.assign({},ie?X[ie][1].start:he[1].end),X.splice(ie||J,0,["exit",Be,he[2]]),J++,ke++}if(he[1].type==="listItemPrefix"){const ne={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};Be=ne,X.splice(J,0,["enter",ne,he[2]]),J++,ke++,Ie=void 0,oe=!0}}}return X[se][1]._spread=We,ke}function r(X,se){return ke;function ke(J){c.call(this,X(J),J),se&&se.call(this,J)}}function i(){this.stack.push({type:"fragment",children:[]})}function c(X,se,ke){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([se,ke||void 0]),X.position={start:xi(se.start),end:void 0}}function d(X){return se;function se(ke){X&&X.call(this,ke),f.call(this,ke)}}function f(X,se){const ke=this.stack.pop(),J=this.tokenStack.pop();if(J)J[0].type!==X.type&&(se?se.call(this,X,J[0]):(J[1]||DS).call(this,X,J[0]));else throw new Error("Cannot close `"+X.type+"` ("+ou({start:X.start,end:X.end})+"): it’s not open");ke.position.end=xi(X.end)}function h(){return Cx(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(X){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function y(){const X=this.resume(),se=this.stack[this.stack.length-1];se.lang=X}function v(){const X=this.resume(),se=this.stack[this.stack.length-1];se.meta=X}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const X=this.resume(),se=this.stack[this.stack.length-1];se.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const X=this.resume(),se=this.stack[this.stack.length-1];se.value=X.replace(/(\r?\n|\r)$/g,"")}function N(X){const se=this.resume(),ke=this.stack[this.stack.length-1];ke.label=se,ke.identifier=Ma(this.sliceSerialize(X)).toLowerCase()}function j(){const X=this.resume(),se=this.stack[this.stack.length-1];se.title=X}function E(){const X=this.resume(),se=this.stack[this.stack.length-1];se.url=X}function D(X){const se=this.stack[this.stack.length-1];if(!se.depth){const ke=this.sliceSerialize(X).length;se.depth=ke}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function P(X){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function T(X){const ke=this.stack[this.stack.length-1].children;let J=ke[ke.length-1];(!J||J.type!=="text")&&(J=ut(),J.position={start:xi(X.start),end:void 0},ke.push(J)),this.stack.push(J)}function M(X){const se=this.stack.pop();se.value+=this.sliceSerialize(X),se.position.end=xi(X.end)}function R(X){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=se.children[se.children.length-1];ke.position.end=xi(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(se.type)&&(T.call(this,X),M.call(this,X))}function I(){this.data.atHardBreak=!0}function z(){const X=this.resume(),se=this.stack[this.stack.length-1];se.value=X}function W(){const X=this.resume(),se=this.stack[this.stack.length-1];se.value=X}function $(){const X=this.resume(),se=this.stack[this.stack.length-1];se.value=X}function F(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=se,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function H(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=se,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function V(X){const se=this.sliceSerialize(X),ke=this.stack[this.stack.length-2];ke.label=JB(se),ke.identifier=Ma(se).toLowerCase()}function G(){const X=this.stack[this.stack.length-1],se=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const J=X.children;ke.children=J}else ke.alt=se}function B(){const X=this.resume(),se=this.stack[this.stack.length-1];se.url=X}function Q(){const X=this.resume(),se=this.stack[this.stack.length-1];se.title=X}function K(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function xe(X){const se=this.resume(),ke=this.stack[this.stack.length-1];ke.label=se,ke.identifier=Ma(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function de(X){this.data.characterReferenceType=X.type}function Z(X){const se=this.sliceSerialize(X),ke=this.data.characterReferenceType;let J;ke?(J=bN(se,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):J=Ax(se);const we=this.stack[this.stack.length-1];we.value+=J}function be(X){const se=this.stack.pop();se.position.end=xi(X.end)}function je(X){M.call(this,X);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(X)}function ce(X){M.call(this,X);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(X)}function Ee(){return{type:"blockquote",children:[]}}function ze(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function De(){return{type:"heading",depth:0,children:[]}}function te(){return{type:"break"}}function He(){return{type:"html",value:""}}function ye(){return{type:"image",title:null,url:"",alt:null}}function Re(){return{type:"link",title:null,url:"",children:[]}}function re(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function pe(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Ve(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function ue(){return{type:"thematicBreak"}}}function xi(t){return{line:t.line,column:t.column,offset:t.offset}}function TN(t,e){let n=-1;for(;++n<e.length;){const s=e[n];Array.isArray(s)?TN(t,s):nF(t,s)}}function nF(t,e){let n;for(n in e)if(NN.call(e,n))switch(n){case"canContainEols":{const s=e[n];s&&t[n].push(...s);break}case"transforms":{const s=e[n];s&&t[n].push(...s);break}case"enter":case"exit":{const s=e[n];s&&Object.assign(t[n],s);break}}}function DS(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ou({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ou({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ou({start:e.start,end:e.end})+") is still open")}function sF(t){const e=this;e.parser=n;function n(s){return eF(s,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function aF(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function rF(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
51
|
-
`}]}function iF(t,e){const n=e.value?e.value+`
|
|
52
|
-
`:"",s={},a=e.lang?e.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r}function oF(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function lF(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function cF(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(e.identifier).toUpperCase(),a=Ll(s.toLowerCase()),r=t.footnoteOrder.indexOf(s);let i,c=t.footnoteCounts.get(s);c===void 0?(c=0,t.footnoteOrder.push(s),i=t.footnoteOrder.length):i=r+1,c+=1,t.footnoteCounts.set(s,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,f),t.applyData(e,f)}function uF(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function dF(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function EN(t,e){const n=e.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+s}];const a=t.all(e),r=a[0];r&&r.type==="text"?r.value="["+r.value:a.unshift({type:"text",value:"["});const i=a[a.length-1];return i&&i.type==="text"?i.value+=s:a.push({type:"text",value:s}),a}function fF(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return EN(t,e);const a={src:Ll(s.url||""),alt:e.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"img",properties:a,children:[]};return t.patch(e,r),t.applyData(e,r)}function pF(t,e){const n={src:Ll(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,s),t.applyData(e,s)}function hF(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,s),t.applyData(e,s)}function mF(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return EN(t,e);const a={href:Ll(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"a",properties:a,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function gF(t,e){const n={href:Ll(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function bF(t,e,n){const s=t.all(e),a=n?xF(n):_N(e),r={},i=[];if(typeof e.checked=="boolean"){const h=s[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),r.className=["task-list-item"]}let c=-1;for(;++c<s.length;){const h=s[c];(a||c!==0||h.type!=="element"||h.tagName!=="p")&&i.push({type:"text",value:`
|
|
53
|
-
`}),h.type==="element"&&h.tagName==="p"&&!a?i.push(...h.children):i.push(h)}const d=s[s.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
|
|
54
|
-
`});const f={type:"element",tagName:"li",properties:r,children:i};return t.patch(e,f),t.applyData(e,f)}function xF(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let s=-1;for(;!e&&++s<n.length;)e=_N(n[s])}return e}function _N(t){const e=t.spread;return e??t.children.length>1}function yF(t,e){const n={},s=t.all(e);let a=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++a<s.length;){const i=s[a];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const r={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(s,!0)};return t.patch(e,r),t.applyData(e,r)}function vF(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function wF(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function kF(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function SF(t,e){const n=t.all(e),s=n.shift(),a=[];if(s){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([s],!0)};t.patch(e.children[0],i),a.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=vx(e.children[1]),d=cN(e.children[e.children.length-1]);c&&d&&(i.position={start:c,end:d}),a.push(i)}const r={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(e,r),t.applyData(e,r)}function CF(t,e,n){const s=n?n.children:void 0,r=(s?s.indexOf(e):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,c=i?i.length:e.children.length;let d=-1;const f=[];for(;++d<c;){const m=e.children[d],x={},y=i?i[d]:void 0;y&&(x.align=y);let v={type:"element",tagName:r,properties:x,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,h),t.applyData(e,h)}function AF(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const RS=9,OS=32;function jF(t){const e=String(t),n=/\r?\n|\r/g;let s=n.exec(e),a=0;const r=[];for(;s;)r.push(LS(e.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(e);return r.push(LS(e.slice(a),a>0,!1)),r.join("")}function LS(t,e,n){let s=0,a=t.length;if(e){let r=t.codePointAt(s);for(;r===RS||r===OS;)s++,r=t.codePointAt(s)}if(n){let r=t.codePointAt(a-1);for(;r===RS||r===OS;)a--,r=t.codePointAt(a-1)}return a>s?t.slice(s,a):""}function NF(t,e){const n={type:"text",value:jF(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function TF(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const EF={blockquote:aF,break:rF,code:iF,delete:oF,emphasis:lF,footnoteReference:cF,heading:uF,html:dF,imageReference:fF,image:pF,inlineCode:hF,linkReference:mF,link:gF,listItem:bF,list:yF,paragraph:vF,root:wF,strong:kF,table:SF,tableCell:AF,tableRow:CF,text:NF,thematicBreak:TF,toml:nf,yaml:nf,definition:nf,footnoteDefinition:nf};function nf(){}const MN=-1,Ap=0,cu=1,Vf=2,Nx=3,Tx=4,Ex=5,_x=6,DN=7,RN=8,PS=typeof self=="object"?self:globalThis,_F=(t,e)=>{const n=(a,r)=>(t.set(r,a),a),s=a=>{if(t.has(a))return t.get(a);const[r,i]=e[a];switch(r){case Ap:case MN:return n(i,a);case cu:{const c=n([],a);for(const d of i)c.push(s(d));return c}case Vf:{const c=n({},a);for(const[d,f]of i)c[s(d)]=s(f);return c}case Nx:return n(new Date(i),a);case Tx:{const{source:c,flags:d}=i;return n(new RegExp(c,d),a)}case Ex:{const c=n(new Map,a);for(const[d,f]of i)c.set(s(d),s(f));return c}case _x:{const c=n(new Set,a);for(const d of i)c.add(s(d));return c}case DN:{const{name:c,message:d}=i;return n(new PS[c](d),a)}case RN:return n(BigInt(i),a);case"BigInt":return n(Object(BigInt(i)),a);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:c}=new Uint8Array(i);return n(new DataView(c),i)}}return n(new PS[r](i),a)};return s},IS=t=>_F(new Map,t)(0),al="",{toString:MF}={},{keys:DF}=Object,$c=t=>{const e=typeof t;if(e!=="object"||!t)return[Ap,e];const n=MF.call(t).slice(8,-1);switch(n){case"Array":return[cu,al];case"Object":return[Vf,al];case"Date":return[Nx,al];case"RegExp":return[Tx,al];case"Map":return[Ex,al];case"Set":return[_x,al];case"DataView":return[cu,n]}return n.includes("Array")?[cu,n]:n.includes("Error")?[DN,n]:[Vf,n]},sf=([t,e])=>t===Ap&&(e==="function"||e==="symbol"),RF=(t,e,n,s)=>{const a=(i,c)=>{const d=s.push(i)-1;return n.set(c,d),d},r=i=>{if(n.has(i))return n.get(i);let[c,d]=$c(i);switch(c){case Ap:{let h=i;switch(d){case"bigint":c=RN,h=i.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return a([MN],i)}return a([c,h],i)}case cu:{if(d){let x=i;return d==="DataView"?x=new Uint8Array(i.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(i)),a([d,[...x]],i)}const h=[],m=a([c,h],i);for(const x of i)h.push(r(x));return m}case Vf:{if(d)switch(d){case"BigInt":return a([d,i.toString()],i);case"Boolean":case"Number":case"String":return a([d,i.valueOf()],i)}if(e&&"toJSON"in i)return r(i.toJSON());const h=[],m=a([c,h],i);for(const x of DF(i))(t||!sf($c(i[x])))&&h.push([r(x),r(i[x])]);return m}case Nx:return a([c,i.toISOString()],i);case Tx:{const{source:h,flags:m}=i;return a([c,{source:h,flags:m}],i)}case Ex:{const h=[],m=a([c,h],i);for(const[x,y]of i)(t||!(sf($c(x))||sf($c(y))))&&h.push([r(x),r(y)]);return m}case _x:{const h=[],m=a([c,h],i);for(const x of i)(t||!sf($c(x)))&&h.push(r(x));return m}}const{message:f}=i;return a([c,{name:d,message:f}],i)};return r},BS=(t,{json:e,lossy:n}={})=>{const s=[];return RF(!(e||n),!!e,new Map,s)(t),s},Gf=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?IS(BS(t,e)):structuredClone(t):(t,e)=>IS(BS(t,e));function OF(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function LF(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function PF(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||OF,s=t.options.footnoteBackLabel||LF,a=t.options.footnoteLabel||"Footnotes",r=t.options.footnoteLabelTagName||"h2",i=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[d]);if(!f)continue;const h=t.all(f),m=String(f.identifier).toUpperCase(),x=Ll(m.toLowerCase());let y=0;const v=[],S=t.footnoteCounts.get(m);for(;S!==void 0&&++y<=S;){v.length>0&&v.push({type:"text",value:" "});let N=typeof n=="string"?n:n(d,y);typeof N=="string"&&(N={type:"text",value:N}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const N=C.children[C.children.length-1];N&&N.type==="text"?N.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...v)}else h.push(...v);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(h,!0)};t.patch(f,k),c.push(k)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...Gf(i),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
55
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
56
|
-
`}]}}const jp=(function(t){if(t==null)return zF;if(typeof t=="function")return Np(t);if(typeof t=="object")return Array.isArray(t)?IF(t):BF(t);if(typeof t=="string")return FF(t);throw new Error("Expected function, string, or object as test")});function IF(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=jp(t[n]);return Np(s);function s(...a){let r=-1;for(;++r<e.length;)if(e[r].apply(this,a))return!0;return!1}}function BF(t){const e=t;return Np(n);function n(s){const a=s;let r;for(r in t)if(a[r]!==e[r])return!1;return!0}}function FF(t){return Np(e);function e(n){return n&&n.type===t}}function Np(t){return e;function e(n,s,a){return!!($F(n)&&t.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function zF(){return!0}function $F(t){return t!==null&&typeof t=="object"&&"type"in t}const ON=[],HF=!0,Rb=!1,UF="skip";function LN(t,e,n,s){let a;typeof e=="function"&&typeof n!="function"?(s=n,n=e):a=e;const r=jp(a),i=s?-1:1;c(t,void 0,[])();function c(d,f,h){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return x;function x(){let y=ON,v,S,C;if((!e||r(d,f,h[h.length-1]||void 0))&&(y=WF(n(d,h)),y[0]===Rb))return y;if("children"in d&&d.children){const k=d;if(k.children&&y[0]!==UF)for(S=(s?k.children.length:-1)+i,C=h.concat(k);S>-1&&S<k.children.length;){const N=k.children[S];if(v=c(N,S,C)(),v[0]===Rb)return v;S=typeof v[1]=="number"?v[1]:S+i}}return y}}}function WF(t){return Array.isArray(t)?t:typeof t=="number"?[HF,t]:t==null?ON:[t]}function Mx(t,e,n,s){let a,r,i;typeof e=="function"&&typeof n!="function"?(r=void 0,i=e,a=n):(r=e,i=n,a=s),LN(t,r,c,a);function c(d,f){const h=f[f.length-1],m=h?h.children.indexOf(d):void 0;return i(d,m,h)}}const Ob={}.hasOwnProperty,qF={};function VF(t,e){const n=e||qF,s=new Map,a=new Map,r=new Map,i={...EF,...n.handlers},c={all:f,applyData:YF,definitionById:s,footnoteById:a,footnoteCounts:r,footnoteOrder:[],handlers:i,one:d,options:n,patch:GF,wrap:QF};return Mx(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?s:a,x=String(h.identifier).toUpperCase();m.has(x)||m.set(x,h)}}),c;function d(h,m){const x=h.type,y=c.handlers[x];if(Ob.call(c.handlers,x)&&y)return y(c,h,m);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in h){const{children:S,...C}=h,k=Gf(C);return k.children=c.all(h),k}return Gf(h)}return(c.options.unknownHandler||KF)(c,h,m)}function f(h){const m=[];if("children"in h){const x=h.children;let y=-1;for(;++y<x.length;){const v=c.one(x[y],h);if(v){if(y&&x[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=FS(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=FS(S.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function GF(t,e){t.position&&(e.position=LP(t))}function YF(t,e){let n=e;if(t&&t.data){const s=t.data.hName,a=t.data.hChildren,r=t.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const i="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:i}}n.type==="element"&&r&&Object.assign(n.properties,Gf(r)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function KF(t,e){const n=e.data||{},s="value"in e&&!(Ob.call(n,"hProperties")||Ob.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function QF(t,e){const n=[];let s=-1;for(e&&n.push({type:"text",value:`
|
|
57
|
-
`});++s<t.length;)s&&n.push({type:"text",value:`
|
|
58
|
-
`}),n.push(t[s]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
59
|
-
`}),n}function FS(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function zS(t,e){const n=VF(t,e),s=n.one(t,void 0),a=PF(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&r.children.push({type:"text",value:`
|
|
60
|
-
`},a),r}function XF(t,e){return t&&"run"in t?async function(n,s){const a=zS(n,{file:s,...e});await t.run(a,s)}:function(n,s){return zS(n,{file:s,...t||e})}}function $S(t){if(t)throw t}var vg,HS;function JF(){if(HS)return vg;HS=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},r=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var h=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!m)return!1;var x;for(x in f);return typeof x>"u"||t.call(f,x)},i=function(f,h){n&&h.name==="__proto__"?n(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):f[h.name]=h.newValue},c=function(f,h){if(h==="__proto__")if(t.call(f,h)){if(s)return s(f,h).value}else return;return f[h]};return vg=function d(){var f,h,m,x,y,v,S=arguments[0],C=1,k=arguments.length,N=!1;for(typeof S=="boolean"&&(N=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(f=arguments[C],f!=null)for(h in f)m=c(S,h),x=c(f,h),S!==x&&(N&&x&&(r(x)||(y=a(x)))?(y?(y=!1,v=m&&a(m)?m:[]):v=m&&r(m)?m:{},i(S,{name:h,newValue:d(N,v,x)})):typeof x<"u"&&i(S,{name:h,newValue:x}));return S},vg}var ZF=JF();const wg=ju(ZF);function Lb(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function e8(){const t=[],e={run:n,use:s};return e;function n(...a){let r=-1;const i=a.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);c(null,...a);function c(d,...f){const h=t[++r];let m=-1;if(d){i(d);return}for(;++m<a.length;)(f[m]===null||f[m]===void 0)&&(f[m]=a[m]);a=f,h?t8(h,c)(...f):i(null,...f)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return t.push(a),e}}function t8(t,e){let n;return s;function s(...i){const c=t.length>i.length;let d;c&&i.push(a);try{d=t.apply(this,i)}catch(f){const h=f;if(c&&n)throw h;return a(h)}c||(d&&d.then&&typeof d.then=="function"?d.then(r,a):d instanceof Error?a(d):r(d))}function a(i,...c){n||(n=!0,e(i,...c))}function r(i){a(null,i)}}const Wa={basename:n8,dirname:s8,extname:a8,join:r8,sep:"/"};function n8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Mu(t);let n=0,s=-1,a=t.length,r;if(e===void 0||e.length===0||e.length>t.length){for(;a--;)if(t.codePointAt(a)===47){if(r){n=a+1;break}}else s<0&&(r=!0,s=a+1);return s<0?"":t.slice(n,s)}if(e===t)return"";let i=-1,c=e.length-1;for(;a--;)if(t.codePointAt(a)===47){if(r){n=a+1;break}}else i<0&&(r=!0,i=a+1),c>-1&&(t.codePointAt(a)===e.codePointAt(c--)?c<0&&(s=a):(c=-1,s=i));return n===s?s=i:s<0&&(s=t.length),t.slice(n,s)}function s8(t){if(Mu(t),t.length===0)return".";let e=-1,n=t.length,s;for(;--n;)if(t.codePointAt(n)===47){if(s){e=n;break}}else s||(s=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function a8(t){Mu(t);let e=t.length,n=-1,s=0,a=-1,r=0,i;for(;e--;){const c=t.codePointAt(e);if(c===47){if(i){s=e+1;break}continue}n<0&&(i=!0,n=e+1),c===46?a<0?a=e:r!==1&&(r=1):a>-1&&(r=-1)}return a<0||n<0||r===0||r===1&&a===n-1&&a===s+1?"":t.slice(a,n)}function r8(...t){let e=-1,n;for(;++e<t.length;)Mu(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":i8(n)}function i8(t){Mu(t);const e=t.codePointAt(0)===47;let n=o8(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function o8(t,e){let n="",s=0,a=-1,r=0,i=-1,c,d;for(;++i<=t.length;){if(i<t.length)c=t.codePointAt(i);else{if(c===47)break;c=47}if(c===47){if(!(a===i-1||r===1))if(a!==i-1&&r===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),a=i,r=0;continue}}else if(n.length>0){n="",s=0,a=i,r=0;continue}}e&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+t.slice(a+1,i):n=t.slice(a+1,i),s=i-a-1;a=i,r=0}else c===46&&r>-1?r++:r=-1}return n}function Mu(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const l8={cwd:c8};function c8(){return"/"}function Pb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function u8(t){if(typeof t=="string")t=new URL(t);else if(!Pb(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return d8(t)}function d8(t){if(t.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const s=e.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(e)}const kg=["history","path","basename","stem","extname","dirname"];class PN{constructor(e){let n;e?Pb(e)?n={path:e}:typeof e=="string"||f8(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":l8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<kg.length;){const r=kg[s];r in n&&n[r]!==void 0&&n[r]!==null&&(this[r]=r==="history"?[...n[r]]:n[r])}let a;for(a in n)kg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Wa.basename(this.path):void 0}set basename(e){Cg(e,"basename"),Sg(e,"basename"),this.path=Wa.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Wa.dirname(this.path):void 0}set dirname(e){US(this.basename,"dirname"),this.path=Wa.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Wa.extname(this.path):void 0}set extname(e){if(Sg(e,"extname"),US(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Wa.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Pb(e)&&(e=u8(e)),Cg(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Wa.basename(this.path,this.extname):void 0}set stem(e){Cg(e,"stem"),Sg(e,"stem"),this.path=Wa.join(this.dirname||"",e+(this.extname||""))}fail(e,n,s){const a=this.message(e,n,s);throw a.fatal=!0,a}info(e,n,s){const a=this.message(e,n,s);return a.fatal=void 0,a}message(e,n,s){const a=new ws(e,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Sg(t,e){if(t&&t.includes(Wa.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Wa.sep+"`")}function Cg(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function US(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function f8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const p8=(function(t){const s=this.constructor.prototype,a=s[t],r=function(){return a.apply(r,arguments)};return Object.setPrototypeOf(r,s),r}),h8={}.hasOwnProperty;class Dx extends p8{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=e8()}copy(){const e=new Dx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];e.use(...s)}return e.data(wg(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Ng("data",this.frozen),this.namespace[e]=n,this):h8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ng("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(e,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=af(e),s=this.parser||this.Parser;return Ag("parse",s),s(String(n),n)}process(e,n){const s=this;return this.freeze(),Ag("process",this.parser||this.Parser),jg("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(r,i){const c=af(e),d=s.parse(c);s.run(d,c,function(h,m,x){if(h||!m||!x)return f(h);const y=m,v=s.stringify(y,x);b8(v)?x.value=v:x.result=v,f(h,x)});function f(h,m){h||!m?i(h):r?r(m):n(void 0,m)}}}processSync(e){let n=!1,s;return this.freeze(),Ag("processSync",this.parser||this.Parser),jg("processSync",this.compiler||this.Compiler),this.process(e,a),qS("processSync","process",n),s;function a(r,i){n=!0,$S(r),s=i}}run(e,n,s){WS(e),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?r(void 0,s):new Promise(r);function r(i,c){const d=af(n);a.run(e,d,f);function f(h,m,x){const y=m||e;h?c(h):i?i(y):s(void 0,y,x)}}}runSync(e,n){let s=!1,a;return this.run(e,n,r),qS("runSync","run",s),a;function r(i,c){$S(i),a=c,s=!0}}stringify(e,n){this.freeze();const s=af(n),a=this.compiler||this.Compiler;return jg("stringify",a),WS(e),a(e,s)}use(e,...n){const s=this.attachers,a=this.namespace;if(Ng("use",this.frozen),e!=null)if(typeof e=="function")d(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):i(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function r(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[h,...m]=f;d(h,m)}else i(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function i(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(a.settings=wg(!0,a.settings,f.settings))}function c(f){let h=-1;if(f!=null)if(Array.isArray(f))for(;++h<f.length;){const m=f[h];r(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,h){let m=-1,x=-1;for(;++m<s.length;)if(s[m][0]===f){x=m;break}if(x===-1)s.push([f,...h]);else if(h.length>0){let[y,...v]=h;const S=s[x][1];Lb(S)&&Lb(y)&&(y=wg(!0,S,y)),s[x]=[f,y,...v]}}}}const m8=new Dx().freeze();function Ag(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function jg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ng(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function WS(t){if(!Lb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function qS(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function af(t){return g8(t)?t:new PN(t)}function g8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function b8(t){return typeof t=="string"||x8(t)}function x8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const y8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",VS=[],GS={allowDangerousHtml:!0},v8=/^(https?|ircs?|mailto|xmpp)$/i,w8=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Dr(t){const e=k8(t),n=S8(t);return C8(e.runSync(e.parse(n),n),t)}function k8(t){const e=t.rehypePlugins||VS,n=t.remarkPlugins||VS,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...GS}:GS;return m8().use(sF).use(n).use(XF,s).use(e)}function S8(t){const e=t.children||"",n=new PN;return typeof e=="string"&&(n.value=e),n}function C8(t,e){const n=e.allowedElements,s=e.allowElement,a=e.components,r=e.disallowedElements,i=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||A8;for(const h of w8)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+y8+h.id,void 0);return Mx(t,f),zP(t,{Fragment:o.Fragment,components:a,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(h,m,x){if(h.type==="raw"&&x&&typeof m=="number")return i?x.children.splice(m,1):x.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let y;for(y in bg)if(Object.hasOwn(bg,y)&&Object.hasOwn(h.properties,y)){const v=h.properties[y],S=bg[y];(S===null||S.includes(h.tagName))&&(h.properties[y]=d(String(v||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):r?r.includes(h.tagName):!1;if(!y&&s&&typeof m=="number"&&(y=!s(h,m,x)),y&&x&&typeof m=="number")return c&&h.children?x.children.splice(m,1,...h.children):x.children.splice(m,1),m}}}function A8(t){const e=t.indexOf(":"),n=t.indexOf("?"),s=t.indexOf("#"),a=t.indexOf("/");return e===-1||a!==-1&&e>a||n!==-1&&e>n||s!==-1&&e>s||v8.test(t.slice(0,e))?t:""}function YS(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(e);for(;a!==-1;)s++,a=n.indexOf(e,a+e.length);return s}function j8(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function N8(t,e,n){const a=jp((n||{}).ignore||[]),r=T8(e);let i=-1;for(;++i<r.length;)LN(t,"text",c);function c(f,h){let m=-1,x;for(;++m<h.length;){const y=h[m],v=x?x.children:void 0;if(a(y,v?v.indexOf(y):void 0,x))return;x=y}if(x)return d(f,h)}function d(f,h){const m=h[h.length-1],x=r[i][0],y=r[i][1];let v=0;const C=m.children.indexOf(f);let k=!1,N=[];x.lastIndex=0;let j=x.exec(f.value);for(;j;){const E=j.index,D={index:j.index,input:j.input,stack:[...h,f]};let _=y(...j,D);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?x.lastIndex=E+1:(v!==E&&N.push({type:"text",value:f.value.slice(v,E)}),Array.isArray(_)?N.push(..._):_&&N.push(_),v=E+j[0].length,k=!0),!x.global)break;j=x.exec(f.value)}return k?(v<f.value.length&&N.push({type:"text",value:f.value.slice(v)}),m.children.splice(C,1,...N)):N=[f],C+N.length}}function T8(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let s=-1;for(;++s<n.length;){const a=n[s];e.push([E8(a[0]),_8(a[1])])}return e}function E8(t){return typeof t=="string"?new RegExp(j8(t),"g"):t}function _8(t){return typeof t=="function"?t:function(){return t}}const Tg="phrasing",Eg=["autolink","link","image","label"];function M8(){return{transforms:[B8],enter:{literalAutolink:R8,literalAutolinkEmail:_g,literalAutolinkHttp:_g,literalAutolinkWww:_g},exit:{literalAutolink:I8,literalAutolinkEmail:P8,literalAutolinkHttp:O8,literalAutolinkWww:L8}}}function D8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Eg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:Eg},{character:":",before:"[ps]",after:"\\/",inConstruct:Tg,notInConstruct:Eg}]}}function R8(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function _g(t){this.config.enter.autolinkProtocol.call(this,t)}function O8(t){this.config.exit.autolinkProtocol.call(this,t)}function L8(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function P8(t){this.config.exit.autolinkEmail.call(this,t)}function I8(t){this.exit(t)}function B8(t){N8(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,F8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z8]],{ignore:["link","linkReference"]})}function F8(t,e,n,s,a){let r="";if(!IN(a)||(/^w/i.test(e)&&(n=e+n,e="",r="http://"),!$8(n)))return!1;const i=H8(n+s);if(!i[0])return!1;const c={type:"link",title:null,url:r+e+i[0],children:[{type:"text",value:e+i[0]}]};return i[1]?[c,{type:"text",value:i[1]}]:c}function z8(t,e,n,s){return!IN(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function $8(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function H8(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],s=n.indexOf(")");const a=YS(t,"(");let r=YS(t,")");for(;s!==-1&&a>r;)t+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[t,n]}function IN(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||ho(n)||Sp(n))&&(!e||n!==47)}BN.peek=X8;function U8(){this.buffer()}function W8(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function q8(){this.buffer()}function V8(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function G8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ma(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Y8(t){this.exit(t)}function K8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ma(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Q8(t){this.exit(t)}function X8(){return"["}function BN(t,e,n,s){const a=n.createTracker(s);let r=a.move("[^");const i=n.enter("footnoteReference"),c=n.enter("reference");return r+=a.move(n.safe(n.associationId(t),{after:"]",before:r})),c(),i(),r+=a.move("]"),r}function J8(){return{enter:{gfmFootnoteCallString:U8,gfmFootnoteCall:W8,gfmFootnoteDefinitionLabelString:q8,gfmFootnoteDefinition:V8},exit:{gfmFootnoteCallString:G8,gfmFootnoteCall:Y8,gfmFootnoteDefinitionLabelString:K8,gfmFootnoteDefinition:Q8}}}function Z8(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:BN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,r,i){const c=r.createTracker(i);let d=c.move("[^");const f=r.enter("footnoteDefinition"),h=r.enter("label");return d+=c.move(r.safe(r.associationId(s),{before:d,after:"]"})),h(),d+=c.move("]:"),s.children&&s.children.length>0&&(c.shift(4),d+=c.move((e?`
|
|
61
|
-
`:" ")+r.indentLines(r.containerFlow(s,c.current()),e?FN:e9))),f(),d}}function e9(t,e,n){return e===0?t:FN(t,e,n)}function FN(t,e,n){return(n?"":" ")+t}const t9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];zN.peek=i9;function n9(){return{canContainEols:["delete"],enter:{strikethrough:a9},exit:{strikethrough:r9}}}function s9(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:t9}],handlers:{delete:zN}}}function a9(t){this.enter({type:"delete",children:[]},t)}function r9(t){this.exit(t)}function zN(t,e,n,s){const a=n.createTracker(s),r=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(t,{...a.current(),before:i,after:"~"}),i+=a.move("~~"),r(),i}function i9(){return"~"}function o9(t){return t.length}function l9(t,e){const n=e||{},s=(n.align||[]).concat(),a=n.stringLength||o9,r=[],i=[],c=[],d=[];let f=0,h=-1;for(;++h<t.length;){const S=[],C=[];let k=-1;for(t[h].length>f&&(f=t[h].length);++k<t[h].length;){const N=c9(t[h][k]);if(n.alignDelimiters!==!1){const j=a(N);C[k]=j,(d[k]===void 0||j>d[k])&&(d[k]=j)}S.push(N)}i[h]=S,c[h]=C}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)r[m]=KS(s[m]);else{const S=KS(s);for(;++m<f;)r[m]=S}m=-1;const x=[],y=[];for(;++m<f;){const S=r[m];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,d[m]-C.length-k.length);const j=C+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=C.length+N+k.length,N>d[m]&&(d[m]=N),y[m]=N),x[m]=j}i.splice(1,0,x),c.splice(1,0,y),h=-1;const v=[];for(;++h<i.length;){const S=i[h],C=c[h];m=-1;const k=[];for(;++m<f;){const N=S[m]||"";let j="",E="";if(n.alignDelimiters!==!1){const D=d[m]-(C[m]||0),_=r[m];_===114?j=" ".repeat(D):_===99?D%2?(j=" ".repeat(D/2+.5),E=" ".repeat(D/2-.5)):(j=" ".repeat(D/2),E=j):E=" ".repeat(D)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(j),k.push(N),n.alignDelimiters!==!1&&k.push(E),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==f-1)&&k.push("|")}v.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return v.join(`
|
|
62
|
-
`)}function c9(t){return t==null?"":String(t)}function KS(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function u9(t,e,n,s){const a=n.enter("blockquote"),r=n.createTracker(s);r.move("> "),r.shift(2);const i=n.indentLines(n.containerFlow(t,r.current()),d9);return a(),i}function d9(t,e,n){return">"+(n?"":" ")+t}function f9(t,e){return QS(t,e.inConstruct,!0)&&!QS(t,e.notInConstruct,!1)}function QS(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let s=-1;for(;++s<e.length;)if(t.includes(e[s]))return!0;return!1}function XS(t,e,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
63
|
-
`&&f9(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
64
|
-
`}function p9(t,e){const n=String(t);let s=n.indexOf(e),a=s,r=0,i=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++r>i&&(i=r):r=1,a=s+e.length,s=n.indexOf(e,a);return i}function h9(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function m9(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function g9(t,e,n,s){const a=m9(n),r=t.value||"",i=a==="`"?"GraveAccent":"Tilde";if(h9(t,n)){const m=n.enter("codeIndented"),x=n.indentLines(r,b9);return m(),x}const c=n.createTracker(s),d=a.repeat(Math.max(p9(r,a)+1,3)),f=n.enter("codeFenced");let h=c.move(d);if(t.lang){const m=n.enter(`codeFencedLang${i}`);h+=c.move(n.safe(t.lang,{before:h,after:" ",encode:["`"],...c.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${i}`);h+=c.move(" "),h+=c.move(n.safe(t.meta,{before:h,after:`
|
|
65
|
-
`,encode:["`"],...c.current()})),m()}return h+=c.move(`
|
|
66
|
-
`),r&&(h+=c.move(r+`
|
|
67
|
-
`)),h+=c.move(d),f(),h}function b9(t,e,n){return(n?"":" ")+t}function Rx(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function x9(t,e,n,s){const a=Rx(n),r=a==='"'?"Quote":"Apostrophe",i=n.enter("definition");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("[");return f+=d.move(n.safe(n.associationId(t),{before:f,after:"]",...d.current()})),f+=d.move("]: "),c(),!t.url||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(t.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(t.url,{before:f,after:t.title?" ":`
|
|
68
|
-
`,...d.current()}))),c(),t.title&&(c=n.enter(`title${r}`),f+=d.move(" "+a),f+=d.move(n.safe(t.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),i(),f}function y9(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function ku(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Yf(t,e,n){const s=kl(t),a=kl(e);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$N.peek=v9;function $N(t,e,n,s){const a=y9(n),r=n.enter("emphasis"),i=n.createTracker(s),c=i.move(a);let d=i.move(n.containerPhrasing(t,{after:a,before:c,...i.current()}));const f=d.charCodeAt(0),h=Yf(s.before.charCodeAt(s.before.length-1),f,a);h.inside&&(d=ku(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Yf(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+ku(m));const y=i.move(a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function v9(t,e,n){return n.options.emphasis||"*"}function w9(t,e){let n=!1;return Mx(t,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Rb}),!!((!t.depth||t.depth<3)&&Cx(t)&&(e.options.setext||n))}function k9(t,e,n,s){const a=Math.max(Math.min(6,t.depth||1),1),r=n.createTracker(s);if(w9(t,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(t,{...r.current(),before:`
|
|
69
|
-
`,after:`
|
|
70
|
-
`});return m(),h(),x+`
|
|
71
|
-
`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
72
|
-
`))+1))}const i="#".repeat(a),c=n.enter("headingAtx"),d=n.enter("phrasing");r.move(i+" ");let f=n.containerPhrasing(t,{before:"# ",after:`
|
|
73
|
-
`,...r.current()});return/^[\t ]/.test(f)&&(f=ku(f.charCodeAt(0))+f.slice(1)),f=f?i+" "+f:i,n.options.closeAtx&&(f+=" "+i),d(),c(),f}HN.peek=S9;function HN(t){return t.value||""}function S9(){return"<"}UN.peek=C9;function UN(t,e,n,s){const a=Rx(n),r=a==='"'?"Quote":"Apostrophe",i=n.enter("image");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("![");return f+=d.move(n.safe(t.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(t.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(t.url,{before:f,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${r}`),f+=d.move(" "+a),f+=d.move(n.safe(t.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),f+=d.move(")"),i(),f}function C9(){return"!"}WN.peek=A9;function WN(t,e,n,s){const a=t.referenceType,r=n.enter("imageReference");let i=n.enter("label");const c=n.createTracker(s);let d=c.move("![");const f=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return i(),n.stack=h,r(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function A9(){return"!"}qN.peek=j9;function qN(t,e,n){let s=t.value||"",a="`",r=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r<n.unsafe.length;){const i=n.unsafe[r],c=n.compilePattern(i);let d;if(i.atBreak)for(;d=c.exec(s);){let f=d.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(d.index+1)}}return a+s+a}function j9(){return"`"}function VN(t,e){const n=Cx(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}GN.peek=N9;function GN(t,e,n,s){const a=Rx(n),r=a==='"'?"Quote":"Apostrophe",i=n.createTracker(s);let c,d;if(VN(t,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let m=i.move("<");return m+=i.move(n.containerPhrasing(t,{before:m,after:">",...i.current()})),m+=i.move(">"),c(),n.stack=h,m}c=n.enter("link"),d=n.enter("label");let f=i.move("[");return f+=i.move(n.containerPhrasing(t,{before:f,after:"](",...i.current()})),f+=i.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),f+=i.move("<"),f+=i.move(n.safe(t.url,{before:f,after:">",...i.current()})),f+=i.move(">")):(d=n.enter("destinationRaw"),f+=i.move(n.safe(t.url,{before:f,after:t.title?" ":")",...i.current()}))),d(),t.title&&(d=n.enter(`title${r}`),f+=i.move(" "+a),f+=i.move(n.safe(t.title,{before:f,after:a,...i.current()})),f+=i.move(a),d()),f+=i.move(")"),c(),f}function N9(t,e,n){return VN(t,n)?"<":"["}YN.peek=T9;function YN(t,e,n,s){const a=t.referenceType,r=n.enter("linkReference");let i=n.enter("label");const c=n.createTracker(s);let d=c.move("[");const f=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return i(),n.stack=h,r(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function T9(){return"["}function Ox(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function E9(t){const e=Ox(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _9(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function KN(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function M9(t,e,n,s){const a=n.enter("list"),r=n.bulletCurrent;let i=t.ordered?_9(n):Ox(n);const c=t.ordered?i==="."?")":".":E9(n);let d=e&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((i==="*"||i==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),KN(n)===i&&h){let m=-1;for(;++m<t.children.length;){const x=t.children[m];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(i=c),n.bulletCurrent=i;const f=n.containerFlow(t,s);return n.bulletLastUsed=i,n.bulletCurrent=r,a(),f}function D9(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function R9(t,e,n,s){const a=D9(n);let r=n.bulletCurrent||Ox(n);e&&e.type==="list"&&e.ordered&&(r=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+r);let i=r.length+1;(a==="tab"||a==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(i=Math.ceil(i/4)*4);const c=n.createTracker(s);c.move(r+" ".repeat(i-r.length)),c.shift(i);const d=n.enter("listItem"),f=n.indentLines(n.containerFlow(t,c.current()),h);return d(),f;function h(m,x,y){return x?(y?"":" ".repeat(i))+m:(y?r:r+" ".repeat(i-r.length))+m}}function O9(t,e,n,s){const a=n.enter("paragraph"),r=n.enter("phrasing"),i=n.containerPhrasing(t,s);return r(),a(),i}const L9=jp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function P9(t,e,n,s){return(t.children.some(function(i){return L9(i)})?n.containerPhrasing:n.containerFlow).call(n,t,s)}function I9(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}QN.peek=B9;function QN(t,e,n,s){const a=I9(n),r=n.enter("strong"),i=n.createTracker(s),c=i.move(a+a);let d=i.move(n.containerPhrasing(t,{after:a,before:c,...i.current()}));const f=d.charCodeAt(0),h=Yf(s.before.charCodeAt(s.before.length-1),f,a);h.inside&&(d=ku(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Yf(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+ku(m));const y=i.move(a+a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function B9(t,e,n){return n.options.strong||"*"}function F9(t,e,n,s){return n.safe(t.value,s)}function z9(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function $9(t,e,n){const s=(KN(n)+(n.options.ruleSpaces?" ":"")).repeat(z9(n));return n.options.ruleSpaces?s.slice(0,-1):s}const XN={blockquote:u9,break:XS,code:g9,definition:x9,emphasis:$N,hardBreak:XS,heading:k9,html:HN,image:UN,imageReference:WN,inlineCode:qN,link:GN,linkReference:YN,list:M9,listItem:R9,paragraph:O9,root:P9,strong:QN,text:F9,thematicBreak:$9};function H9(){return{enter:{table:U9,tableData:JS,tableHeader:JS,tableRow:q9},exit:{codeText:V9,table:W9,tableData:Mg,tableHeader:Mg,tableRow:Mg}}}function U9(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function W9(t){this.exit(t),this.data.inTable=void 0}function q9(t){this.enter({type:"tableRow",children:[]},t)}function Mg(t){this.exit(t)}function JS(t){this.enter({type:"tableCell",children:[]},t)}function V9(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,G9));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function G9(t,e){return e==="|"?e:t}function Y9(t){const e=t||{},n=e.tableCellPadding,s=e.tablePipeAlign,a=e.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
74
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:i,tableCell:d,tableRow:c}};function i(y,v,S,C){return f(h(y,S,C),y.align)}function c(y,v,S,C){const k=m(y,S,C),N=f([k]);return N.slice(0,N.indexOf(`
|
|
75
|
-
`))}function d(y,v,S,C){const k=S.enter("tableCell"),N=S.enter("phrasing"),j=S.containerPhrasing(y,{...C,before:r,after:r});return N(),k(),j}function f(y,v){return l9(y,{align:v,alignDelimiters:s,padding:n,stringLength:a})}function h(y,v,S){const C=y.children;let k=-1;const N=[],j=v.enter("table");for(;++k<C.length;)N[k]=m(C[k],v,S);return j(),N}function m(y,v,S){const C=y.children;let k=-1;const N=[],j=v.enter("tableRow");for(;++k<C.length;)N[k]=d(C[k],y,v,S);return j(),N}function x(y,v,S){let C=XN.inlineCode(y,v,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function K9(){return{exit:{taskListCheckValueChecked:ZS,taskListCheckValueUnchecked:ZS,paragraph:X9}}}function Q9(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:J9}}}function ZS(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function X9(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=e.children;let r=-1,i;for(;++r<a.length;){const c=a[r];if(c.type==="paragraph"){i=c;break}}i===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(t)}function J9(t,e,n,s){const a=t.children[0],r=typeof t.checked=="boolean"&&a&&a.type==="paragraph",i="["+(t.checked?"x":" ")+"] ",c=n.createTracker(s);r&&c.move(i);let d=XN.listItem(t,e,n,{...s,...c.current()});return r&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(h){return h+i}}function Z9(){return[M8(),J8(),n9(),H9(),K9()]}function e4(t){return{extensions:[D8(),Z8(t),s9(),Y9(t),Q9()]}}const t4={tokenize:o4,partial:!0},JN={tokenize:l4,partial:!0},ZN={tokenize:c4,partial:!0},e1={tokenize:u4,partial:!0},n4={tokenize:d4,partial:!0},t1={name:"wwwAutolink",tokenize:r4,previous:s1},n1={name:"protocolAutolink",tokenize:i4,previous:a1},Fr={name:"emailAutolink",tokenize:a4,previous:r1},or={};function s4(){return{text:or}}let Ji=48;for(;Ji<123;)or[Ji]=Fr,Ji++,Ji===58?Ji=65:Ji===91&&(Ji=97);or[43]=Fr;or[45]=Fr;or[46]=Fr;or[95]=Fr;or[72]=[Fr,n1];or[104]=[Fr,n1];or[87]=[Fr,t1];or[119]=[Fr,t1];function a4(t,e,n){const s=this;let a,r;return i;function i(m){return!Ib(m)||!r1.call(s,s.previous)||Lx(s.events)?n(m):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(m))}function c(m){return Ib(m)?(t.consume(m),c):m===64?(t.consume(m),d):n(m)}function d(m){return m===46?t.check(n4,h,f)(m):m===45||m===95||ys(m)?(r=!0,t.consume(m),d):h(m)}function f(m){return t.consume(m),a=!0,d}function h(m){return r&&a&&js(s.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(m)):n(m)}}function r4(t,e,n){const s=this;return a;function a(i){return i!==87&&i!==119||!s1.call(s,s.previous)||Lx(s.events)?n(i):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(t4,t.attempt(JN,t.attempt(ZN,r),n),n)(i))}function r(i){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(i)}}function i4(t,e,n){const s=this;let a="",r=!1;return i;function i(m){return(m===72||m===104)&&a1.call(s,s.previous)&&!Lx(s.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),t.consume(m),c):n(m)}function c(m){if(js(m)&&a.length<5)return a+=String.fromCodePoint(m),t.consume(m),c;if(m===58){const x=a.toLowerCase();if(x==="http"||x==="https")return t.consume(m),d}return n(m)}function d(m){return m===47?(t.consume(m),r?f:(r=!0,d)):n(m)}function f(m){return m===null||qf(m)||jn(m)||ho(m)||Sp(m)?n(m):t.attempt(JN,t.attempt(ZN,h),n)(m)}function h(m){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(m)}}function o4(t,e,n){let s=0;return a;function a(i){return(i===87||i===119)&&s<3?(s++,t.consume(i),a):i===46&&s===3?(t.consume(i),r):n(i)}function r(i){return i===null?n(i):e(i)}}function l4(t,e,n){let s,a,r;return i;function i(f){return f===46||f===95?t.check(e1,d,c)(f):f===null||jn(f)||ho(f)||f!==45&&Sp(f)?d(f):(r=!0,t.consume(f),i)}function c(f){return f===95?s=!0:(a=s,s=void 0),t.consume(f),i}function d(f){return a||s||!r?n(f):e(f)}}function c4(t,e){let n=0,s=0;return a;function a(i){return i===40?(n++,t.consume(i),a):i===41&&s<n?r(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?t.check(e1,e,r)(i):i===null||jn(i)||ho(i)?e(i):(t.consume(i),a)}function r(i){return i===41&&s++,t.consume(i),a}}function u4(t,e,n){return s;function s(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),s):c===38?(t.consume(c),r):c===93?(t.consume(c),a):c===60||c===null||jn(c)||ho(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||jn(c)||ho(c)?e(c):s(c)}function r(c){return js(c)?i(c):n(c)}function i(c){return c===59?(t.consume(c),s):js(c)?(t.consume(c),i):n(c)}}function d4(t,e,n){return s;function s(r){return t.consume(r),a}function a(r){return ys(r)?n(r):e(r)}}function s1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||jn(t)}function a1(t){return!js(t)}function r1(t){return!(t===47||Ib(t))}function Ib(t){return t===43||t===45||t===46||t===95||ys(t)}function Lx(t){let e=t.length,n=!1;for(;e--;){const s=t[e][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const f4={tokenize:v4,partial:!0};function p4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:b4,continuation:{tokenize:x4},exit:y4}},text:{91:{name:"gfmFootnoteCall",tokenize:g4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:h4,resolveTo:m4}}}}function h4(t,e,n){const s=this;let a=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i;for(;a--;){const d=s.events[a][1];if(d.type==="labelImage"){i=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!i||!i._balanced)return n(d);const f=Ma(s.sliceSerialize({start:i.end,end:s.now()}));return f.codePointAt(0)!==94||!r.includes(f.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function m4(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},c=[t[n+1],t[n+2],["enter",s,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",r,e],["enter",i,e],["exit",i,e],["exit",r,e],t[t.length-2],t[t.length-1],["exit",s,e]];return t.splice(n,t.length-n+1,...c),t}function g4(t,e,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,i;return c;function c(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",f)}function f(m){if(r>999||m===93&&!i||m===null||m===91||jn(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return a.includes(Ma(s.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return jn(m)||(i=!0),r++,t.consume(m),m===92?h:f}function h(m){return m===91||m===92||m===93?(t.consume(m),r++,f):f(m)}}function b4(t,e,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,i=0,c;return d;function d(v){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(v){return v===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",h):n(v)}function h(v){if(i>999||v===93&&!c||v===null||v===91||jn(v))return n(v);if(v===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return r=Ma(s.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return jn(v)||(c=!0),i++,t.consume(v),v===92?m:h}function m(v){return v===91||v===92||v===93?(t.consume(v),i++,h):h(v)}function x(v){return v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),a.includes(r)||a.push(r),on(t,y,"gfmFootnoteDefinitionWhitespace")):n(v)}function y(v){return e(v)}}function x4(t,e,n){return t.check(_u,e,t.attempt(f4,e,n))}function y4(t){t.exit("gfmFootnoteDefinition")}function v4(t,e,n){const s=this;return on(t,a,"gfmFootnoteDefinitionIndent",5);function a(r){const i=s.events[s.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?e(r):n(r)}}function w4(t){let n=(t||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(i,c){let d=-1;for(;++d<i.length;)if(i[d][0]==="enter"&&i[d][1].type==="strikethroughSequenceTemporary"&&i[d][1]._close){let f=d;for(;f--;)if(i[f][0]==="exit"&&i[f][1].type==="strikethroughSequenceTemporary"&&i[f][1]._open&&i[d][1].end.offset-i[d][1].start.offset===i[f][1].end.offset-i[f][1].start.offset){i[d][1].type="strikethroughSequence",i[f][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},i[f][1].start),end:Object.assign({},i[d][1].end)},m={type:"strikethroughText",start:Object.assign({},i[f][1].end),end:Object.assign({},i[d][1].start)},x=[["enter",h,c],["enter",i[f][1],c],["exit",i[f][1],c],["enter",m,c]],y=c.parser.constructs.insideSpan.null;y&&sa(x,x.length,0,Cp(y,i.slice(f+1,d),c)),sa(x,x.length,0,[["exit",m,c],["enter",i[d][1],c],["exit",i[d][1],c],["exit",h,c]]),sa(i,f-1,d-f+3,x),d=f+x.length-2;break}}for(d=-1;++d<i.length;)i[d][1].type==="strikethroughSequenceTemporary"&&(i[d][1].type="data");return i}function r(i,c,d){const f=this.previous,h=this.events;let m=0;return x;function x(v){return f===126&&h[h.length-1][1].type!=="characterEscape"?d(v):(i.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const S=kl(f);if(v===126)return m>1?d(v):(i.consume(v),m++,y);if(m<2&&!n)return d(v);const C=i.exit("strikethroughSequenceTemporary"),k=kl(v);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,c(v)}}}class k4{constructor(){this.map=[]}add(e,n,s){S4(this,e,n,s)}consume(e){if(this.map.sort(function(r,i){return r[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];s.push(e.slice()),e.length=0;let a=s.pop();for(;a;){for(const r of a)e.push(r);a=s.pop()}this.map.length=0}}function S4(t,e,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...s);return}a+=1}t.map.push([e,n,s])}}function C4(t,e){let n=!1;const s=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const r=s.length-1;s[r]=s[r]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return s}function A4(){return{flow:{null:{name:"table",tokenize:j4,resolveAll:N4}}}}function j4(t,e,n){const s=this;let a=0,r=0,i;return c;function c(M){let R=s.events.length-1;for(;R>-1;){const W=s.events[R][1].type;if(W==="lineEnding"||W==="linePrefix")R--;else break}const I=R>-1?s.events[R][1].type:null,z=I==="tableHead"||I==="tableRow"?_:d;return z===_&&s.parser.lazy[s.now().line]?n(M):z(M)}function d(M){return t.enter("tableHead"),t.enter("tableRow"),f(M)}function f(M){return M===124||(i=!0,r+=1),h(M)}function h(M){return M===null?n(M):Rt(M)?r>1?(r=0,s.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),y):n(M):Zt(M)?on(t,h,"whitespace")(M):(r+=1,i&&(i=!1,a+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),i=!0,h):(t.enter("data"),m(M)))}function m(M){return M===null||M===124||jn(M)?(t.exit("data"),h(M)):(t.consume(M),M===92?x:m)}function x(M){return M===92||M===124?(t.consume(M),m):m(M)}function y(M){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(M):(t.enter("tableDelimiterRow"),i=!1,Zt(M)?on(t,v,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):v(M))}function v(M){return M===45||M===58?C(M):M===124?(i=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),S):D(M)}function S(M){return Zt(M)?on(t,C,"whitespace")(M):C(M)}function C(M){return M===58?(r+=1,i=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),k):M===45?(r+=1,k(M)):M===null||Rt(M)?E(M):D(M)}function k(M){return M===45?(t.enter("tableDelimiterFiller"),N(M)):D(M)}function N(M){return M===45?(t.consume(M),N):M===58?(i=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),j):(t.exit("tableDelimiterFiller"),j(M))}function j(M){return Zt(M)?on(t,E,"whitespace")(M):E(M)}function E(M){return M===124?v(M):M===null||Rt(M)?!i||a!==r?D(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):D(M)}function D(M){return n(M)}function _(M){return t.enter("tableRow"),P(M)}function P(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),P):M===null||Rt(M)?(t.exit("tableRow"),e(M)):Zt(M)?on(t,P,"whitespace")(M):(t.enter("data"),O(M))}function O(M){return M===null||M===124||jn(M)?(t.exit("data"),P(M)):(t.consume(M),M===92?T:O)}function T(M){return M===92||M===124?(t.consume(M),O):O(M)}}function N4(t,e){let n=-1,s=!0,a=0,r=[0,0,0,0],i=[0,0,0,0],c=!1,d=0,f,h,m;const x=new k4;for(;++n<t.length;){const y=t[n],v=y[1];y[0]==="enter"?v.type==="tableHead"?(c=!1,d!==0&&(eC(x,e,d,f,h),h=void 0,d=0),f={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},x.add(n,0,[["enter",f,e]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(s=!0,m=void 0,r=[0,0,0,0],i=[0,n+1,0,0],c&&(c=!1,h={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},x.add(n,0,[["enter",h,e]])),a=v.type==="tableDelimiterRow"?2:h?3:1):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(s=!1,i[2]===0&&(r[1]!==0&&(i[0]=i[1],m=rf(x,e,r,a,void 0,m),r=[0,0,0,0]),i[2]=n)):v.type==="tableCellDivider"&&(s?s=!1:(r[1]!==0&&(i[0]=i[1],m=rf(x,e,r,a,void 0,m)),r=i,i=[r[1],n,0,0])):v.type==="tableHead"?(c=!0,d=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=n,r[1]!==0?(i[0]=i[1],m=rf(x,e,r,a,n,m)):i[1]!==0&&(m=rf(x,e,i,a,n,m)),a=0):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(i[3]=n)}for(d!==0&&eC(x,e,d,f,h),x.consume(e.events),n=-1;++n<e.events.length;){const y=e.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=C4(e.events,n))}return t}function rf(t,e,n,s,a,r){const i=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(r.end=Object.assign({},dl(e.events,n[0])),t.add(n[0],0,[["exit",r,e]]));const d=dl(e.events,n[1]);if(r={type:i,start:Object.assign({},d),end:Object.assign({},d)},t.add(n[1],0,[["enter",r,e]]),n[2]!==0){const f=dl(e.events,n[2]),h=dl(e.events,n[3]),m={type:c,start:Object.assign({},f),end:Object.assign({},h)};if(t.add(n[2],0,[["enter",m,e]]),s!==2){const x=e.events[n[2]],y=e.events[n[3]];if(x[1].end=Object.assign({},y[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,S=n[3]-n[2]-1;t.add(v,S,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return a!==void 0&&(r.end=Object.assign({},dl(e.events,a)),t.add(a,0,[["exit",r,e]]),r=void 0),r}function eC(t,e,n,s,a){const r=[],i=dl(e.events,n);a&&(a.end=Object.assign({},i),r.push(["exit",a,e])),s.end=Object.assign({},i),r.push(["exit",s,e]),t.add(n+1,0,r)}function dl(t,e){const n=t[e],s=n[0]==="enter"?"start":"end";return n[1][s]}const T4={name:"tasklistCheck",tokenize:_4};function E4(){return{text:{91:T4}}}function _4(t,e,n){const s=this;return a;function a(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),r)}function r(d){return jn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),i):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),i):n(d)}function i(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Rt(d)?e(d):Zt(d)?t.check({tokenize:M4},e,n)(d):n(d)}}function M4(t,e,n){return on(t,s,"whitespace");function s(a){return a===null?n(a):e(a)}}function D4(t){return gN([s4(),p4(),w4(t),A4(),E4()])}const R4={};function Rr(t){const e=this,n=t||R4,s=e.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),i=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(D4(n)),r.push(Z9()),i.push(e4(n))}var Dg={exports:{}},tC;function O4(){return tC||(tC=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
76
|
-
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
77
|
-
*
|
|
78
|
-
* @license MIT <https://opensource.org/licenses/MIT>
|
|
79
|
-
* @author Lea Verou <https://lea.verou.me>
|
|
80
|
-
* @namespace
|
|
81
|
-
* @public
|
|
82
|
-
*/var n=(function(s){var a=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,i={},c={manual:s.Prism&&s.Prism.manual,disableWorkerMessageHandler:s.Prism&&s.Prism.disableWorkerMessageHandler,util:{encode:function N(j){return j instanceof d?new d(j.type,N(j.content),j.alias):Array.isArray(j)?j.map(N):j.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(N){return Object.prototype.toString.call(N).slice(8,-1)},objId:function(N){return N.__id||Object.defineProperty(N,"__id",{value:++r}),N.__id},clone:function N(j,E){E=E||{};var D,_;switch(c.util.type(j)){case"Object":if(_=c.util.objId(j),E[_])return E[_];D={},E[_]=D;for(var P in j)j.hasOwnProperty(P)&&(D[P]=N(j[P],E));return D;case"Array":return _=c.util.objId(j),E[_]?E[_]:(D=[],E[_]=D,j.forEach(function(O,T){D[T]=N(O,E)}),D);default:return j}},getLanguage:function(N){for(;N;){var j=a.exec(N.className);if(j)return j[1].toLowerCase();N=N.parentElement}return"none"},setLanguage:function(N,j){N.className=N.className.replace(RegExp(a,"gi"),""),N.classList.add("language-"+j)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(D){var N=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(D.stack)||[])[1];if(N){var j=document.getElementsByTagName("script");for(var E in j)if(j[E].src==N)return j[E]}return null}},isActive:function(N,j,E){for(var D="no-"+j;N;){var _=N.classList;if(_.contains(j))return!0;if(_.contains(D))return!1;N=N.parentElement}return!!E}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(N,j){var E=c.util.clone(c.languages[N]);for(var D in j)E[D]=j[D];return E},insertBefore:function(N,j,E,D){D=D||c.languages;var _=D[N],P={};for(var O in _)if(_.hasOwnProperty(O)){if(O==j)for(var T in E)E.hasOwnProperty(T)&&(P[T]=E[T]);E.hasOwnProperty(O)||(P[O]=_[O])}var M=D[N];return D[N]=P,c.languages.DFS(c.languages,function(R,I){I===M&&R!=N&&(this[R]=P)}),P},DFS:function N(j,E,D,_){_=_||{};var P=c.util.objId;for(var O in j)if(j.hasOwnProperty(O)){E.call(j,O,j[O],D||O);var T=j[O],M=c.util.type(T);M==="Object"&&!_[P(T)]?(_[P(T)]=!0,N(T,E,null,_)):M==="Array"&&!_[P(T)]&&(_[P(T)]=!0,N(T,E,O,_))}}},plugins:{},highlightAll:function(N,j){c.highlightAllUnder(document,N,j)},highlightAllUnder:function(N,j,E){var D={callback:E,container:N,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",D),D.elements=Array.prototype.slice.apply(D.container.querySelectorAll(D.selector)),c.hooks.run("before-all-elements-highlight",D);for(var _=0,P;P=D.elements[_++];)c.highlightElement(P,j===!0,D.callback)},highlightElement:function(N,j,E){var D=c.util.getLanguage(N),_=c.languages[D];c.util.setLanguage(N,D);var P=N.parentElement;P&&P.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(P,D);var O=N.textContent,T={element:N,language:D,grammar:_,code:O};function M(I){T.highlightedCode=I,c.hooks.run("before-insert",T),T.element.innerHTML=T.highlightedCode,c.hooks.run("after-highlight",T),c.hooks.run("complete",T),E&&E.call(T.element)}if(c.hooks.run("before-sanity-check",T),P=T.element.parentElement,P&&P.nodeName.toLowerCase()==="pre"&&!P.hasAttribute("tabindex")&&P.setAttribute("tabindex","0"),!T.code){c.hooks.run("complete",T),E&&E.call(T.element);return}if(c.hooks.run("before-highlight",T),!T.grammar){M(c.util.encode(T.code));return}if(j&&s.Worker){var R=new Worker(c.filename);R.onmessage=function(I){M(I.data)},R.postMessage(JSON.stringify({language:T.language,code:T.code,immediateClose:!0}))}else M(c.highlight(T.code,T.grammar,T.language))},highlight:function(N,j,E){var D={code:N,grammar:j,language:E};if(c.hooks.run("before-tokenize",D),!D.grammar)throw new Error('The language "'+D.language+'" has no grammar.');return D.tokens=c.tokenize(D.code,D.grammar),c.hooks.run("after-tokenize",D),d.stringify(c.util.encode(D.tokens),D.language)},tokenize:function(N,j){var E=j.rest;if(E){for(var D in E)j[D]=E[D];delete j.rest}var _=new m;return x(_,_.head,N),h(N,_,j,_.head,0),v(_)},hooks:{all:{},add:function(N,j){var E=c.hooks.all;E[N]=E[N]||[],E[N].push(j)},run:function(N,j){var E=c.hooks.all[N];if(!(!E||!E.length))for(var D=0,_;_=E[D++];)_(j)}},Token:d};s.Prism=c;function d(N,j,E,D){this.type=N,this.content=j,this.alias=E,this.length=(D||"").length|0}d.stringify=function N(j,E){if(typeof j=="string")return j;if(Array.isArray(j)){var D="";return j.forEach(function(M){D+=N(M,E)}),D}var _={type:j.type,content:N(j.content,E),tag:"span",classes:["token",j.type],attributes:{},language:E},P=j.alias;P&&(Array.isArray(P)?Array.prototype.push.apply(_.classes,P):_.classes.push(P)),c.hooks.run("wrap",_);var O="";for(var T in _.attributes)O+=" "+T+'="'+(_.attributes[T]||"").replace(/"/g,""")+'"';return"<"+_.tag+' class="'+_.classes.join(" ")+'"'+O+">"+_.content+"</"+_.tag+">"};function f(N,j,E,D){N.lastIndex=j;var _=N.exec(E);if(_&&D&&_[1]){var P=_[1].length;_.index+=P,_[0]=_[0].slice(P)}return _}function h(N,j,E,D,_,P){for(var O in E)if(!(!E.hasOwnProperty(O)||!E[O])){var T=E[O];T=Array.isArray(T)?T:[T];for(var M=0;M<T.length;++M){if(P&&P.cause==O+","+M)return;var R=T[M],I=R.inside,z=!!R.lookbehind,W=!!R.greedy,$=R.alias;if(W&&!R.pattern.global){var F=R.pattern.toString().match(/[imsuy]*$/)[0];R.pattern=RegExp(R.pattern.source,F+"g")}for(var H=R.pattern||R,V=D.next,G=_;V!==j.tail&&!(P&&G>=P.reach);G+=V.value.length,V=V.next){var B=V.value;if(j.length>N.length)return;if(!(B instanceof d)){var Q=1,K;if(W){if(K=f(H,G,N,z),!K||K.index>=N.length)break;var Z=K.index,q=K.index+K[0].length,xe=G;for(xe+=V.value.length;Z>=xe;)V=V.next,xe+=V.value.length;if(xe-=V.value.length,G=xe,V.value instanceof d)continue;for(var de=V;de!==j.tail&&(xe<q||typeof de.value=="string");de=de.next)Q++,xe+=de.value.length;Q--,B=N.slice(G,xe),K.index-=G}else if(K=f(H,0,B,z),!K)continue;var Z=K.index,be=K[0],je=B.slice(0,Z),ce=B.slice(Z+be.length),Ee=G+B.length;P&&Ee>P.reach&&(P.reach=Ee);var ze=V.prev;je&&(ze=x(j,ze,je),G+=je.length),y(j,ze,Q);var Ge=new d(O,I?c.tokenize(be,I):be,$,be);if(V=x(j,ze,Ge),ce&&x(j,V,ce),Q>1){var _e={cause:O+","+M,reach:Ee};h(N,j,E,V.prev,G,_e),P&&_e.reach>P.reach&&(P.reach=_e.reach)}}}}}}function m(){var N={value:null,prev:null,next:null},j={value:null,prev:N,next:null};N.next=j,this.head=N,this.tail=j,this.length=0}function x(N,j,E){var D=j.next,_={value:E,prev:j,next:D};return j.next=_,D.prev=_,N.length++,_}function y(N,j,E){for(var D=j.next,_=0;_<E&&D!==N.tail;_++)D=D.next;j.next=D,D.prev=j,N.length-=_}function v(N){for(var j=[],E=N.head.next;E!==N.tail;)j.push(E.value),E=E.next;return j}if(!s.document)return s.addEventListener&&(c.disableWorkerMessageHandler||s.addEventListener("message",function(N){var j=JSON.parse(N.data),E=j.language,D=j.code,_=j.immediateClose;s.postMessage(c.highlight(D,c.languages[E],E)),_&&s.close()},!1)),c;var S=c.util.currentScript();S&&(c.filename=S.src,S.hasAttribute("data-manual")&&(c.manual=!0));function C(){c.manual||c.highlightAll()}if(!c.manual){var k=document.readyState;k==="loading"||k==="interactive"&&S&&S.defer?document.addEventListener("DOMContentLoaded",C):window.requestAnimationFrame?window.requestAnimationFrame(C):window.setTimeout(C,16)}return c})(e);t.exports&&(t.exports=n),typeof O0<"u"&&(O0.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(a,r){var i={};i["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[r]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+r]={pattern:/[\s\S]+/,inside:n.languages[r]};var d={};d[a]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:c},n.languages.insertBefore("markup","cdata",d)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(s,a){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[a,"language-"+a],inside:n.languages[a]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(s){var a=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+a.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+a.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+a.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+a.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:a,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var r=s.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,(function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="Loading…",a=function(S,C){return"✖ Error "+S+" while fetching file: "+C},r="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",d="loading",f="loaded",h="failed",m="pre[data-src]:not(["+c+'="'+f+'"]):not(['+c+'="'+d+'"])';function x(S,C,k){var N=new XMLHttpRequest;N.open("GET",S,!0),N.onreadystatechange=function(){N.readyState==4&&(N.status<400&&N.responseText?C(N.responseText):N.status>=400?k(a(N.status,N.statusText)):k(r))},N.send(null)}function y(S){var C=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(S||"");if(C){var k=Number(C[1]),N=C[2],j=C[3];return N?j?[k,Number(j)]:[k,void 0]:[k,k]}}n.hooks.add("before-highlightall",function(S){S.selector+=", "+m}),n.hooks.add("before-sanity-check",function(S){var C=S.element;if(C.matches(m)){S.code="",C.setAttribute(c,d);var k=C.appendChild(document.createElement("CODE"));k.textContent=s;var N=C.getAttribute("data-src"),j=S.language;if(j==="none"){var E=(/\.(\w+)$/.exec(N)||[,"none"])[1];j=i[E]||E}n.util.setLanguage(k,j),n.util.setLanguage(C,j);var D=n.plugins.autoloader;D&&D.loadLanguages(j),x(N,function(_){C.setAttribute(c,f);var P=y(C.getAttribute("data-range"));if(P){var O=_.split(/\r\n?|\n/g),T=P[0],M=P[1]==null?O.length:P[1];T<0&&(T+=O.length),T=Math.max(0,Math.min(T-1,O.length)),M<0&&(M+=O.length),M=Math.max(0,Math.min(M,O.length)),_=O.slice(T,M).join(`
|
|
83
|
-
`),C.hasAttribute("data-start")||C.setAttribute("data-start",String(T+1))}k.textContent=_,n.highlightElement(k)},function(_){C.setAttribute(c,h),k.textContent=_})}}),n.plugins.fileHighlight={highlight:function(C){for(var k=(C||document).querySelectorAll(m),N=0,j;j=k[N++];)n.highlightElement(j)}};var v=!1;n.fileHighlight=function(){v||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),v=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Dg)),Dg.exports}var L4=O4();const aa=ju(L4);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;var nC={},sC;function P4(){return sC||(sC=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism)),nC}P4();(function(t){var e=t.util.clone(t.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,s=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function r(d,f){return d=d.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return s}).replace(/<SPREAD>/g,function(){return a}),RegExp(d,f)}a=r(a).source,t.languages.jsx=t.languages.extend("markup",e),t.languages.jsx.tag.pattern=r(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=e.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:r(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:r(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var i=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(i).join(""):""},c=function(d){for(var f=[],h=0;h<d.length;h++){var m=d[h],x=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?f.length>0&&f[f.length-1].tagName===i(m.content[0].content[1])&&f.pop():m.content[m.content.length-1].content==="/>"||f.push({tagName:i(m.content[0].content[1]),openedBraces:0}):f.length>0&&m.type==="punctuation"&&m.content==="{"?f[f.length-1].openedBraces++:f.length>0&&f[f.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?f[f.length-1].openedBraces--:x=!0),(x||typeof m=="string")&&f.length>0&&f[f.length-1].openedBraces===0){var y=i(m);h<d.length-1&&(typeof d[h+1]=="string"||d[h+1].type==="plain-text")&&(y+=i(d[h+1]),d.splice(h+1,1)),h>0&&(typeof d[h-1]=="string"||d[h-1].type==="plain-text")&&(y=i(d[h-1])+y,d.splice(h-1,1),h--),d[h]=new t.Token("plain-text",y,null,y)}m.content&&typeof m.content!="string"&&c(m.content)}};t.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||c(d.tokens)})})(Prism);(function(t){var e=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",e),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var n=t.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0})(Prism);(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var e=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+n.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),r=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,d){d=(d||"").replace(/m/g,"")+"m";var f=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<value>>/g,function(){return c});return RegExp(f,d)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<key>>/g,function(){return"(?:"+a+"|"+r+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(r),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);var aC={},rC;function I4(){return rC||(rC=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),aC}I4();(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],r=s.variable[1].inside,i=0;i<a.length;i++)r[a[i]]=t.languages.bash[a[i]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(h){return h=h.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),r=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+r+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+r+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+r+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(m){h!==m&&(t.languages.markdown[h].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function m(x){if(!(!x||typeof x=="string"))for(var y=0,v=x.length;y<v;y++){var S=x[y];if(S.type!=="code"){m(S.content);continue}var C=S.content[1],k=S.content[3];if(C&&k&&C.type==="code-language"&&k.type==="code-block"&&typeof C.content=="string"){var N=C.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");N=(/[a-z][\w-]*/i.exec(N)||[""])[0].toLowerCase();var j="language-"+N;k.alias?typeof k.alias=="string"?k.alias=[k.alias,j]:k.alias.push(j):k.alias=[j]}}}m(h.tokens)}),t.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var m="",x=0,y=h.classes.length;x<y;x++){var v=h.classes[x],S=/language-(.+)/.exec(v);if(S){m=S[1];break}}var C=t.languages[m];if(C)h.content=t.highlight(f(h.content),C,m);else if(m&&m!=="none"&&t.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=k,t.plugins.autoloader.loadLanguages(m,function(){var N=document.getElementById(k);N&&(N.innerHTML=t.highlight(N.textContent,t.languages[m],m))})}}});var i=RegExp(t.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function f(h){var m=h.replace(i,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(x,y){if(y=y.toLowerCase(),y[0]==="#"){var v;return y[1]==="x"?v=parseInt(y.slice(2),16):v=Number(y.slice(1)),d(v)}else{var S=c[y];return S||x}}),m}t.languages.md=t.languages.markdown})(Prism);Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var iC={},oC;function B4(){return oC||(oC=1,(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),iC}B4();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const F4={".ts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"jsx",".mjs":"javascript",".cjs":"javascript",".css":"css",".scss":"scss",".sass":"scss",".less":"css",".html":"markup",".xml":"markup",".svg":"markup",".graphql":"graphql",".gql":"graphql",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".groovy":"groovy",".gradle":"groovy",".clj":"clojure",".cljs":"clojure",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hxx":"cpp",".cs":"csharp",".py":"python",".rb":"ruby",".php":"php",".lua":"lua",".pl":"perl",".pm":"perl",".r":"r",".R":"r",".hs":"haskell",".lhs":"haskell",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hrl":"erlang",".rs":"rust",".go":"go",".swift":"swift",".sh":"bash",".bash":"bash",".zsh":"bash",".fish":"bash",".ps1":"powershell",".psm1":"powershell",".psd1":"powershell",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".md":"markdown",".mdx":"markdown",".sql":"sql",".dockerfile":"docker",".nginx":"nginx",".vim":"vim",".vimrc":"vim",".diff":"diff",".patch":"diff",".makefile":"makefile",".mk":"makefile"},ve="/assets/vscode-icons/",Kf={".7z":`${ve}file_type_zip.svg`,".R":`${ve}file_type_r.svg`,".adoc":`${ve}file_type_asciidoc.svg`,".asciidoc":`${ve}file_type_asciidoc.svg`,".astro":`${ve}file_type_astro.svg`,".avi":`${ve}file_type_video.svg`,".babelrc":`${ve}file_type_babel.svg`,".bash":`${ve}file_type_shell.svg`,".bat":`${ve}file_type_bat.svg`,".bmp":`${ve}file_type_image.svg`,".c":`${ve}file_type_c.svg`,".cc":`${ve}file_type_cpp.svg`,".cfg":`${ve}file_type_ini.svg`,".circleci":`${ve}file_type_circleci.svg`,".cjs":`${ve}file_type_js_official.svg`,".clj":`${ve}file_type_clojure.svg`,".cljs":`${ve}file_type_clojure.svg`,".cmd":`${ve}file_type_bat.svg`,".conf":`${ve}file_type_ini.svg`,".cpp":`${ve}file_type_cpp.svg`,".cs":`${ve}file_type_csharp.svg`,".css":`${ve}file_type_css.svg`,".csv":`${ve}file_type_csv.svg`,".cxx":`${ve}file_type_cpp.svg`,".dart":`${ve}file_type_dart.svg`,".diff":`${ve}file_type_diff.svg`,".dockerfile":`${ve}file_type_docker.svg`,".dockerignore":`${ve}file_type_docker.svg`,".env":`${ve}file_type_dotenv.svg`,".env.development":`${ve}file_type_dotenv.svg`,".env.local":`${ve}file_type_dotenv.svg`,".env.production":`${ve}file_type_dotenv.svg`,".env.test":`${ve}file_type_dotenv.svg`,".erb":`${ve}file_type_ruby.svg`,".erl":`${ve}file_type_erlang.svg`,".eslintrc":`${ve}file_type_eslint.svg`,".eslintrc.js":`${ve}file_type_eslint.svg`,".eslintrc.json":`${ve}file_type_eslint.svg`,".ex":`${ve}file_type_elixir.svg`,".exs":`${ve}file_type_elixir.svg`,".fish":`${ve}file_type_shell.svg`,".gif":`${ve}file_type_image.svg`,".git":`${ve}file_type_git.svg`,".gitattributes":`${ve}file_type_git.svg`,".github":`${ve}file_type_github.svg`,".gitignore":`${ve}file_type_git.svg`,".gitlab-ci.yml":`${ve}file_type_gitlab.svg`,".gitmodules":`${ve}file_type_git.svg`,".go":`${ve}file_type_go.svg`,".gql":`${ve}file_type_graphql.svg`,".gradle":`${ve}file_type_gradle.svg`,".graphql":`${ve}file_type_graphql.svg`,".groovy":`${ve}file_type_groovy.svg`,".gz":`${ve}file_type_zip.svg`,".h":`${ve}file_type_c.svg`,".hpp":`${ve}file_type_cpp.svg`,".hrl":`${ve}file_type_erlang.svg`,".hs":`${ve}file_type_haskell.svg`,".htm":`${ve}file_type_html.svg`,".html":`${ve}file_type_html.svg`,".ico":`${ve}file_type_image.svg`,".ini":`${ve}file_type_ini.svg`,".java":`${ve}file_type_java.svg`,".jl":`${ve}file_type_julia.svg`,".jpeg":`${ve}file_type_image.svg`,".jpg":`${ve}file_type_image.svg`,".js":`${ve}file_type_js_official.svg`,".json":`${ve}file_type_json_official.svg`,".json5":`${ve}file_type_json5.svg`,".jsonc":`${ve}file_type_json_official.svg`,".jsx":`${ve}file_type_reactjs.svg`,".kt":`${ve}file_type_kotlin.svg`,".kts":`${ve}file_type_kotlin.svg`,".kubernetes.yaml":`${ve}file_type_kubernetes.svg`,".less":`${ve}file_type_less.svg`,".lhs":`${ve}file_type_haskell.svg`,".lock":`${ve}file_type_lock.svg`,".log":`${ve}file_type_log.svg`,".lua":`${ve}file_type_lua.svg`,".markdown":`${ve}file_type_markdown.svg`,".md":`${ve}file_type_markdown.svg`,".mdown":`${ve}file_type_markdown.svg`,".mdx":`${ve}file_type_markdown.svg`,".mjs":`${ve}file_type_js_official.svg`,".mk":`${ve}file_type_makefile.svg`,".mov":`${ve}file_type_video.svg`,".mp3":`${ve}file_type_audio.svg`,".mp4":`${ve}file_type_video.svg`,".nim":`${ve}file_type_nim.svg`,".nims":`${ve}file_type_nim.svg`,".patch":`${ve}file_type_diff.svg`,".pdf":`${ve}file_type_pdf.svg`,".php":`${ve}file_type_php.svg`,".pl":`${ve}file_type_perl.svg`,".pm":`${ve}file_type_perl.svg`,".png":`${ve}file_type_image.svg`,".prettier.json":`${ve}file_type_prettier.svg`,".prettierrc":`${ve}file_type_prettier.svg`,".ps1":`${ve}file_type_powershell.svg`,".psd1":`${ve}file_type_powershell.svg`,".psm1":`${ve}file_type_powershell.svg`,".py":`${ve}file_type_python.svg`,".pyw":`${ve}file_type_python.svg`,".r":`${ve}file_type_r.svg`,".rar":`${ve}file_type_zip.svg`,".rb":`${ve}file_type_ruby.svg`,".rs":`${ve}file_type_rust.svg`,".rst":`${ve}file_type_rst.svg`,".sass":`${ve}file_type_scss.svg`,".scala":`${ve}file_type_scala.svg`,".scss":`${ve}file_type_scss.svg`,".sh":`${ve}file_type_shell.svg`,".sql":`${ve}file_type_sql.svg`,".sty":`${ve}file_type_latex.svg`,".svelte":`${ve}file_type_svelte.svg`,".svg":`${ve}file_type_svg.svg`,".swift":`${ve}file_type_swift.svg`,".tar":`${ve}file_type_tar.svg`,".tar.bz2":`${ve}file_type_zip.svg`,".tar.gz":`${ve}file_type_zip.svg`,".terraform":`${ve}file_type_terraform.svg`,".tex":`${ve}file_type_latex.svg`,".toml":`${ve}file_type_toml.svg`,".travis.yml":`${ve}file_type_travis.svg`,".ts":`${ve}file_type_typescript_official.svg`,".tsv":`${ve}file_type_tsv.svg`,".tsx":`${ve}file_type_typescript_official.svg`,".txt":`${ve}file_type_text.svg`,".vue":`${ve}file_type_vue.svg`,".webm":`${ve}file_type_video.svg`,".webp":`${ve}file_type_image.svg`,".xml":`${ve}file_type_xml.svg`,".yaml":`${ve}file_type_yaml_official.svg`,".yml":`${ve}file_type_yaml_official.svg`,".zig":`${ve}file_type_zig.svg`,".zip":`${ve}file_type_zip.svg`,".zsh":`${ve}file_type_shell.svg`,"CMakeLists.txt":`${ve}file_type_cmake.svg`,"Cargo.lock":`${ve}file_type_cargo.svg`,"Cargo.toml":`${ve}file_type_cargo.svg`,Dockerfile:`${ve}file_type_docker.svg`,Gemfile:`${ve}file_type_ruby.svg`,"Gemfile.lock":`${ve}file_type_ruby.svg`,Justfile:`${ve}file_type_just.svg`,Makefile:`${ve}file_type_makefile.svg`,Pipfile:`${ve}file_type_python.svg`,"Pipfile.lock":`${ve}file_type_python.svg`,Procfile:`${ve}file_type_procfile.svg`,Vagrantfile:`${ve}file_type_vagrant.svg`,"azure-pipelines.yml":`${ve}file_type_azurepipelines.svg`,"build.gradle":`${ve}file_type_gradle.svg`,"build.sbt":`${ve}file_type_scala.svg`,"docker-compose.yaml":`${ve}file_type_docker.svg`,"docker-compose.yml":`${ve}file_type_docker.svg`,dune:`${ve}file_type_dune.svg`,"gatsby-config.js":`${ve}file_type_gatsby.svg`,"go.mod":`${ve}file_type_go.svg`,"go.sum":`${ve}file_type_go.svg`,"heroku.yml":`${ve}file_type_heroku.svg`,"jsconfig.json":`${ve}file_type_jsconfig.svg`,"kubernetes.yaml":`${ve}file_type_kubernetes.svg`,makefile:`${ve}file_type_makefile.svg`,"meson.build":`${ve}file_type_meson.svg`,"mix.exs":`${ve}file_type_elixir.svg`,"next.config.js":`${ve}file_type_nextjs.svg`,"nuxt.config.js":`${ve}file_type_nuxtjs.svg`,"package-lock.json":`${ve}file_type_npm.svg`,"package.json":`${ve}file_type_npm.svg`,"pnpm-lock.yaml":`${ve}file_type_pnpm.svg`,"pom.xml":`${ve}file_type_maven.svg`,"pubspec.lock":`${ve}file_type_dart.svg`,"pubspec.yaml":`${ve}file_type_dart.svg`,"pyproject.toml":`${ve}file_type_python.svg`,"rebar.config":`${ve}file_type_erlang.svg`,"requirements.txt":`${ve}file_type_python.svg`,"terraform.tfvars":`${ve}file_type_terraform.svg`,"tox.ini":`${ve}file_type_tox.svg`,"tsconfig.json":`${ve}file_type_tsconfig.svg`,"vite.config.js":`${ve}file_type_vite.svg`,"vite.config.ts":`${ve}file_type_vite.svg`,"webpack.config.js":`${ve}file_type_webpack.svg`,"yarn.lock":`${ve}file_type_yarn.svg`,default:`${ve}default_file.svg`},i1={conflict:{icon:"C",color:"#ff5555",label:"Conflicts"},modified:{icon:"M",color:"#c89a5a",label:"Modified"},added:{icon:"A",color:"#5cb88a",label:"Added"},deleted:{icon:"D",color:"#c85a5a",label:"Deleted"},untracked:{icon:"U",color:"#6ab8c8",label:"Untracked"},renamed:{icon:"R",color:"#9a80c0",label:"Renamed"}},z4={c:()=>vt(()=>import("./prism-c-BI05wwL9.js"),[]),cpp:()=>vt(()=>import("./prism-c-BI05wwL9.js"),[]).then(()=>vt(()=>import("./prism-cpp-CK2Ly5dS.js").then(t=>t.p),__vite__mapDeps([7,1]))),java:()=>vt(()=>import("./prism-java-CK6tws4L.js").then(t=>t.p),__vite__mapDeps([8,1])),scala:()=>vt(()=>import("./prism-java-CK6tws4L.js").then(t=>t.p),__vite__mapDeps([8,1])).then(()=>vt(()=>import("./prism-scala-BjNo2HkN.js"),[])),csharp:()=>vt(()=>import("./prism-csharp-ByDDDiWW.js").then(t=>t.p),__vite__mapDeps([9,1])),kotlin:()=>vt(()=>import("./prism-kotlin-B1uvbSyh.js"),[]),groovy:()=>vt(()=>import("./prism-groovy-CGzo1uDg.js"),[]),ruby:()=>vt(()=>import("./prism-ruby-CQBUuZIF.js").then(t=>t.p),__vite__mapDeps([10,1])),php:()=>vt(()=>import("./prism-markup-templating-Ct1xsyfA.js"),[]).then(()=>vt(()=>import("./prism-php-Dt9698bA.js").then(t=>t.p),__vite__mapDeps([11,1]))),scss:()=>vt(()=>import("./prism-scss-CeN16CFC.js").then(t=>t.p),__vite__mapDeps([12,1])),toml:()=>vt(()=>import("./prism-toml-BrQIw_NO.js"),[]),docker:()=>vt(()=>import("./prism-docker-MnIa7k-I.js"),[]),swift:()=>vt(()=>import("./prism-swift--kriB360.js"),[]),lua:()=>vt(()=>import("./prism-lua-Cp_o7ONA.js"),[]),perl:()=>vt(()=>import("./prism-perl-UZfqnD51.js").then(t=>t.p),__vite__mapDeps([13,1])),r:()=>vt(()=>import("./prism-r-TxsGuNZJ.js"),[]),haskell:()=>vt(()=>import("./prism-haskell-Ce8aBmia.js").then(t=>t.p),__vite__mapDeps([14,1])),elixir:()=>vt(()=>import("./prism-elixir-df27OMMQ.js").then(t=>t.p),__vite__mapDeps([15,1])),erlang:()=>vt(()=>import("./prism-erlang-C3Aahqfa.js"),[]),clojure:()=>vt(()=>import("./prism-clojure-u3w_tjfy.js"),[]),graphql:()=>vt(()=>import("./prism-graphql-DJ177lJj.js"),[]),nginx:()=>vt(()=>import("./prism-nginx-43e5TboO.js"),[]),vim:()=>vt(()=>import("./prism-vim-uciLQ2PQ.js"),[]),diff:()=>vt(()=>import("./prism-diff-jN23ddHu.js"),[]),ini:()=>vt(()=>import("./prism-ini-DX5Euru7.js"),[]),powershell:()=>vt(()=>import("./prism-powershell-Ud14i9UV.js"),[]),makefile:()=>vt(()=>import("./prism-makefile-Dk8DMwhC.js"),[])},Rg=new Map;async function o1(t){if(t in aa.languages)return!0;const e=z4[t];if(!e)return!1;let n=Rg.get(t);n||(n=e(),Rg.set(t,n));try{return await n,t in aa.languages}catch{return!1}finally{Rg.delete(t)}}function jV(t){aa.highlightElement(t)}function Af(t){return F4[t]||"plaintext"}function $4(t){return t in aa.languages}function lC(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function mo(t,e){if(!t)return"";const n=aa.languages[e];if(!n)return lC(t);try{return aa.highlight(t,n,e)}catch{return lC(t)}}function H4(t){if(typeof document>"u")throw new Error("Clipboard unavailable");const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="-9999px",e.style.left="-9999px",document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);const n=document.execCommand("copy");if(document.body.removeChild(e),!n)throw new Error("Legacy clipboard copy failed")}async function uu(t){var e;if(typeof navigator<"u"&&((e=navigator.clipboard)!=null&&e.writeText)){await navigator.clipboard.writeText(t);return}H4(t)}function l1(t){const e=document.createElement("div");e.innerHTML=t;const n=e.firstElementChild;n&&(n.style.cssText+='font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;font-size:14px;color:#1f2328;line-height:1.6');const s={table:"border-collapse:collapse;width:100%;border:1px solid #d1d9e0;margin:12px 0;font-size:13px",th:"background:#f6f8fa;color:#1f2328;padding:6px 12px;border:1px solid #d1d9e0;font-weight:600;text-align:left;white-space:nowrap",td:"padding:6px 12px;border:1px solid #d1d9e0;color:#1f2328;vertical-align:top",h1:"font-size:2em;font-weight:700;margin:24px 0 12px;padding-bottom:6px;border-bottom:2px solid #d1d9e0;color:#1f2328",h2:"font-size:1.5em;font-weight:700;margin:20px 0 10px;padding-bottom:4px;border-bottom:1px solid #d1d9e0;color:#1f2328",h3:"font-size:1.25em;font-weight:600;margin:16px 0 8px;color:#1f2328",h4:"font-size:1.1em;font-weight:600;margin:12px 0 6px;color:#1f2328",h5:"font-size:1em;font-weight:600;margin:10px 0 4px;color:#1f2328",h6:"font-size:0.85em;font-weight:600;margin:10px 0 4px;color:#656d76",pre:'background:#f6f8fa;padding:16px;border-radius:6px;overflow:auto;border:1px solid #d1d9e0;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:1.5;margin:12px 0;color:#1f2328',blockquote:"border-left:4px solid #d1d9e0;padding:4px 16px;color:#656d76;margin:12px 0;background:#f6f8fa",a:"color:#0969da;text-decoration:underline",ul:"padding-left:28px;margin:8px 0",ol:"padding-left:28px;margin:8px 0",li:"margin:4px 0;color:#1f2328",hr:"border:none;border-top:2px solid #d1d9e0;margin:20px 0",strong:"font-weight:700;color:#1f2328",em:"font-style:italic",p:"margin:8px 0;line-height:1.6"};for(const[r,i]of Object.entries(s))for(const c of Array.from(e.querySelectorAll(r)))c.style.cssText+=i;for(const r of Array.from(e.querySelectorAll("code"))){const i=r.parentElement;i&&i.tagName.toLowerCase()==="pre"?r.style.cssText+='font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;background:transparent;padding:0;font-size:inherit;color:inherit':r.style.cssText+='background:#eff1f3;padding:2px 6px;border-radius:4px;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:0.85em;color:#cf222e'}for(const r of Array.from(e.querySelectorAll("table"))){r.setAttribute("width","100%"),r.querySelectorAll("tbody tr").forEach((j,E)=>{E%2===0?j.style.cssText+="background:#ffffff":j.style.cssText+="background:#f6f8fa"});const c=Array.from(r.querySelectorAll("thead th, thead td, tr:first-child th, tr:first-child td")),d=c.length;if(d<2)continue;const f=Array.from(r.querySelectorAll("tr")),h=new Array(d).fill(0),m=new Array(d).fill(0);c.forEach((j,E)=>{const D=(j.textContent||"").trim();D.length,h[E]=D.length});for(const j of f)Array.from(j.children).forEach((D,_)=>{if(_<d){const P=(D.textContent||"").trim();m[_]=Math.max(m[_],P.length);const O=P.split(/\s+/);for(const T of O)h[_]=Math.max(h[_],T.length)}});const x=h.reduce((j,E)=>j+E,0)||1,y=h.map(j=>{const E=j<=3?3:j<=6?5:8;return Math.max(E,Math.round(j/x*50))}),v=y.reduce((j,E)=>j+E,0),S=Math.max(0,100-v),C=m.reduce((j,E)=>j+E,0)||1,k=y.map((j,E)=>j+Math.round(m[E]/C*S)),N=k.reduce((j,E)=>j+E,0);k[k.length-1]+=100-N;for(const j of f)Array.from(j.children).forEach((D,_)=>{if(_<d){const P=`${k[_]}%`;D.setAttribute("width",P),D.style.cssText+=`;width:${P}`}})}const a={"hljs-keyword":"color:#cf222e;font-weight:600","hljs-built_in":"color:#8250df","hljs-type":"color:#8250df","hljs-literal":"color:#0550ae","hljs-number":"color:#0550ae","hljs-string":"color:#0a3069","hljs-comment":"color:#6e7781;font-style:italic","hljs-doctag":"color:#cf222e","hljs-meta":"color:#6e7781","hljs-attr":"color:#8250df","hljs-attribute":"color:#0550ae","hljs-name":"color:#116329","hljs-tag":"color:#116329","hljs-title":"color:#8250df;font-weight:600","hljs-variable":"color:#953800","hljs-params":"color:#1f2328","hljs-function":"color:#8250df","hljs-selector-tag":"color:#116329","hljs-selector-class":"color:#8250df","hljs-selector-id":"color:#0550ae","hljs-property":"color:#0550ae","hljs-regexp":"color:#0a3069","hljs-symbol":"color:#0550ae","hljs-addition":"color:#116329;background:#dafbe1","hljs-deletion":"color:#cf222e;background:#ffebe9"};for(const[r,i]of Object.entries(a))for(const c of Array.from(e.querySelectorAll(`.${r}`)))c.style.cssText+=i;return e.innerHTML}async function c1(t,e){const n=document.createElement("div");n.innerHTML=t,n.style.cssText='position:fixed;left:-9999px;top:-9999px;opacity:0;color:#1f2328;background:#ffffff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.6',document.body.appendChild(n);const s=document.createRange();s.selectNodeContents(n);const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(s));const r=document.execCommand("copy");if(document.body.removeChild(n),a&&a.removeAllRanges(),!r)throw new Error("Rich text copy failed")}function Jn({content:t,children:e,position:n="top",delay:s=150,maxWidth:a=280,disabled:r=!1,className:i=""}){const[c,d]=b.useState(!1),[f,h]=b.useState(!1),[m,x]=b.useState({top:0,left:0}),y=b.useRef(null),v=b.useRef(null),S=b.useRef(null),C=b.useRef(null),k=b.useCallback(()=>{if(!y.current||!v.current)return;const D=y.current.getBoundingClientRect(),_=v.current.getBoundingClientRect(),P=window.scrollY,O=window.scrollX,T=8;let M=0,R=0;switch(n){case"top":M=D.top+P-_.height-T,R=D.left+O+(D.width-_.width)/2;break;case"bottom":M=D.bottom+P+T,R=D.left+O+(D.width-_.width)/2;break;case"left":M=D.top+P+(D.height-_.height)/2,R=D.left+O-_.width-T;break;case"right":M=D.top+P+(D.height-_.height)/2,R=D.right+O+T;break}const I=window.innerWidth,z=window.innerHeight;R<T&&(R=T),R+_.width>I-T&&(R=I-_.width-T),M<T&&(M=T),M+_.height>z+P-T&&(M=z+P-_.height-T),x({top:M,left:R})},[n]),N=b.useCallback(()=>{r||(C.current&&(clearTimeout(C.current),C.current=null),S.current=setTimeout(()=>{h(!0),d(!0)},s))},[s,r]),j=b.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),d(!1),C.current=setTimeout(()=>{h(!1)},100)},[]);b.useEffect(()=>{f&&c&&requestAnimationFrame(k)},[f,c,k]),b.useEffect(()=>()=>{S.current&&clearTimeout(S.current),C.current&&clearTimeout(C.current)},[]);const E=f&&t&&Rl.createPortal(o.jsxs("div",{ref:v,className:`tide-tooltip tide-tooltip--${n} ${c?"tide-tooltip--visible":"tide-tooltip--hiding"} ${i}`,style:{position:"absolute",top:m.top,left:m.left,maxWidth:a,zIndex:1e4},role:"tooltip",children:[o.jsx("div",{className:"tide-tooltip__content",children:t}),o.jsx("div",{className:"tide-tooltip__arrow"})]}),document.body);return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:y,className:"tide-tooltip-trigger",onMouseEnter:N,onMouseLeave:j,onFocus:N,onBlur:j,style:{display:"inline-flex"},children:e}),E]})}function NV({text:t,title:e,position:n="top",size:s="md"}){const a=o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"tide-tooltip__title",children:e}),o.jsx("div",{className:"tide-tooltip__text",children:t})]});return o.jsx(Jn,{content:a,position:n,children:o.jsx("span",{className:`tide-help-icon tide-help-icon--${s}`,tabIndex:0,children:"?"})})}function Og(t,e){return t?mo(t,e):""}function U4(t,e,n){const s=t.split(`
|
|
84
|
-
`),a=e.split(`
|
|
85
|
-
`),r=n||"plaintext",i=s.length,c=a.length,d=Array(i+1).fill(null).map(()=>Array(c+1).fill(0));for(let D=1;D<=i;D++)for(let _=1;_<=c;_++)s[D-1]===a[_-1]?d[D][_]=d[D-1][_-1]+1:d[D][_]=Math.max(d[D-1][_],d[D][_-1]);const f=[];let h=i,m=c;for(;h>0||m>0;)h>0&&m>0&&s[h-1]===a[m-1]?(f.push({type:"equal",origIdx:h-1,modIdx:m-1}),h--,m--):m>0&&(h===0||d[h][m-1]>=d[h-1][m])?(f.push({type:"insert",modIdx:m-1}),m--):h>0&&(f.push({type:"delete",origIdx:h-1}),h--);f.reverse();const x=[],y=[],v=[],S=[];v.push({leftLine:0,rightLine:0});let C=-1,k=0,N=-1,j=0;const E=()=>{(k>0||j>0)&&S.push({leftStart:C>=0?C:x.length,leftCount:k,rightStart:N>=0?N:y.length,rightCount:j,type:k>0&&j>0?"modified":k>0?"removed":"added"}),C=-1,k=0,N=-1,j=0};for(const D of f)if(D.type==="equal"){E();const _=s[D.origIdx],P=Og(_,r);x.push({num:D.origIdx+1,text:_,highlighted:P,type:"unchanged"}),y.push({num:D.modIdx+1,text:_,highlighted:P,type:"unchanged"}),v.push({leftLine:x.length,rightLine:y.length})}else if(D.type==="delete"){C<0&&(C=x.length),k++;const _=s[D.origIdx],P=Og(_,r);x.push({num:D.origIdx+1,text:_,highlighted:P,type:"removed"})}else{N<0&&(N=y.length),j++;const _=a[D.modIdx],P=Og(_,r);y.push({num:D.modIdx+1,text:_,highlighted:P,type:"added"})}return E(),v.push({leftLine:x.length,rightLine:y.length}),{leftLines:x,rightLines:y,alignments:v,changeBlocks:S}}function W4(t,e,n,s,a,r){if(e<=0||n<=0)return 0;const i=t/a;let c=null,d=null;for(let k=0;k<s.length-1;k++){const N=s[k],j=s[k+1],E=r?N.leftLine:N.rightLine,D=r?j.leftLine:j.rightLine;if(i>=E&&i<D){c=N,d=j;break}}if(!c||!d)return t/Math.max(1,e-1)*n;const f=r?c.leftLine:c.rightLine,h=r?d.leftLine:d.rightLine,m=r?c.rightLine:c.leftLine,x=r?d.rightLine:d.leftLine,y=h-f,v=x-m;if(y===0)return m*a;const S=(i-f)/y;return(m+S*v)*a}const q4=[".md",".mdx",".markdown"];function Bb({originalContent:t,modifiedContent:e,filename:n,language:s,initialModifiedOnly:a=!1}){const{t:r}=pt(["terminal","common"]),i=b.useRef(null),c=b.useRef(null),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),m=b.useRef(null),x=b.useRef(null),[y,v]=b.useState("idle"),[S,C]=b.useState("idle"),[k,N]=b.useState(a),[j,E]=b.useState(0);b.useEffect(()=>{s&&s!=="plaintext"&&o1(s).then(()=>E(Z=>Z+1))},[s]);const D=!t,_=!e,P=b.useMemo(()=>{const Z=n.substring(n.lastIndexOf(".")).toLowerCase();return q4.includes(Z)},[n]),O=b.useCallback(async()=>{try{if(P&&k&&d.current){const Z=d.current.innerHTML,be=l1(Z),je=d.current.innerText;await c1(be,je)}else await uu(e);v("copied"),setTimeout(()=>v("idle"),2e3)}catch(Z){console.error("Copy modified content failed:",Z),v("error"),setTimeout(()=>v("idle"),2e3)}},[e,P,k]),T=b.useCallback(async()=>{if(!d.current){console.error("Copy HTML: markdown content ref is not available"),C("error"),setTimeout(()=>C("idle"),2e3);return}try{const Z=d.current.innerHTML;await uu(Z),C("copied"),setTimeout(()=>C("idle"),2e3)}catch(Z){console.error("Copy HTML failed:",Z),C("error"),setTimeout(()=>C("idle"),2e3)}},[]),{leftLines:M,rightLines:R,alignments:I,changeBlocks:z}=b.useMemo(()=>U4(t,e,s),[t,e,s,j]),W=b.useCallback(()=>{const Z=f.current,be=i.current,je=c.current;if(!Z||!be||!je)return;const ce=window.devicePixelRatio||1,Ee=Z.parentElement;if(!Ee)return;const ze=Ee.clientWidth,Ge=Ee.clientHeight;if(ze===0||Ge===0)return;const _e=Math.round(ze*ce),me=Math.round(Ge*ce);(Z.width!==_e||Z.height!==me)&&(Z.width=_e,Z.height=me);const De=Z.getContext("2d");if(!De)return;De.setTransform(ce,0,0,ce,0,0),De.clearRect(0,0,ze,Ge);const te=Ee.getBoundingClientRect(),He=be.getBoundingClientRect(),ye=je.getBoundingClientRect(),Re=He.top-te.top,re=ye.top-te.top,pe=be.scrollTop,Ve=je.scrollTop,at=be.clientHeight,ut=je.clientHeight;for(const ue of z){const X=Re+ue.leftStart*Q-pe,se=Re+(ue.leftStart+Math.max(ue.leftCount,.5))*Q-pe,ke=re+ue.rightStart*Q-Ve,J=re+(ue.rightStart+Math.max(ue.rightCount,.5))*Q-Ve;if(se<Re&&J<re||X>Re+at+20&&ke>re+ut+20)continue;ue.type==="modified"?(De.fillStyle="rgba(90, 130, 180, 0.2)",De.strokeStyle="rgba(90, 130, 180, 0.45)"):ue.type==="removed"?(De.fillStyle="rgba(200, 90, 90, 0.2)",De.strokeStyle="rgba(200, 90, 90, 0.45)"):(De.fillStyle="rgba(92, 184, 138, 0.2)",De.strokeStyle="rgba(92, 184, 138, 0.45)");const we=ze*.5;De.lineWidth=1,De.save(),De.beginPath(),De.rect(0,Re,ze,Ge-Re),De.clip(),De.beginPath(),De.moveTo(0,X),De.bezierCurveTo(we,X,we,ke,ze,ke),De.lineTo(ze,J),De.bezierCurveTo(we,J,we,se,0,se),De.closePath(),De.fill(),De.stroke(),De.restore()}},[z]);b.useEffect(()=>{if(k||D||_)return;const Z=f.current,be=i.current,je=c.current;if(!Z||!be||!je)return;const ce=Z.parentElement;if(!ce)return;const Ee=new ResizeObserver(()=>{W()});return Ee.observe(ce),requestAnimationFrame(()=>W()),()=>{Ee.disconnect(),h.current&&cancelAnimationFrame(h.current)}},[k,D,_,W]);const{leftBoundaries:$,rightBoundaries:F}=b.useMemo(()=>{const Z=new Map,be=new Map;for(const je of z){if(je.leftCount>0){const ce=je.leftStart,Ee=je.leftStart+je.leftCount-1;Z.set(ce,Z.has(ce)?"both":"top"),ce===Ee?Z.set(ce,"both"):Z.set(Ee,Z.has(Ee)?"both":"bottom")}if(je.rightCount>0){const ce=je.rightStart,Ee=je.rightStart+je.rightCount-1;be.set(ce,be.has(ce)?"both":"top"),ce===Ee?be.set(ce,"both"):be.set(Ee,be.has(Ee)?"both":"bottom")}}return{leftBoundaries:Z,rightBoundaries:be}},[z]),H=b.useMemo(()=>{const Z=R.filter(je=>je.type==="added").length,be=M.filter(je=>je.type==="removed").length;return{added:Z,removed:be}},[M,R]),V=b.useMemo(()=>{const Z=[];let be=!1;R.forEach((ce,Ee)=>{ce.type==="added"?be||(Z.push(Ee),be=!0):be=!1});let je=!1;return M.forEach((ce,Ee)=>{if(ce.type==="removed"){if(!je){const ze=Math.min(Ee,R.length-1);Z.includes(ze)||Z.push(ze),je=!0}}else je=!1}),Z.sort((ce,Ee)=>ce-Ee)},[M,R]),[G,B]=b.useState(0),Q=20,K=b.useCallback(Z=>{const be=i.current,je=c.current;if(!be||!je||m.current&&m.current!==Z)return;m.current=Z,x.current&&cancelAnimationFrame(x.current);const ce=Z==="left"?be:je,Ee=Z==="left"?je:be;Ee.scrollLeft=ce.scrollLeft;const ze=W4(ce.scrollTop,ce.scrollHeight-ce.clientHeight,Ee.scrollHeight-Ee.clientHeight,I,Q,Z==="left");Ee.scrollTop=ze,h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{W(),h.current=null}),x.current=requestAnimationFrame(()=>{m.current=null})},[I,W]);b.useEffect(()=>{const Z=i.current,be=c.current;if(!Z||!be)return;const je=()=>K("left"),ce=()=>K("right");return Z.addEventListener("scroll",je),be.addEventListener("scroll",ce),()=>{Z.removeEventListener("scroll",je),be.removeEventListener("scroll",ce),x.current&&cancelAnimationFrame(x.current)}},[K]);const q=b.useCallback(Z=>{if(Z<0||Z>=V.length)return;const je=V[Z]*Q;c.current&&(c.current.scrollTop=je),B(Z)},[V]),xe=b.useCallback(()=>{const Z=Math.min(G+1,V.length-1);q(Z)},[G,V.length,q]),de=b.useCallback(()=>{const Z=Math.max(G-1,0);q(Z)},[G,q]);return b.useEffect(()=>{V.length>0&&setTimeout(()=>{q(0),requestAnimationFrame(()=>W())},100)},[V,q,W]),o.jsxs("div",{className:"diff-viewer",children:[o.jsxs("div",{className:"diff-viewer-header",children:[o.jsx("div",{className:"diff-viewer-filename",children:n}),o.jsx("div",{className:"diff-viewer-nav",children:V.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Jn,{content:"Previous change (Up)",position:"bottom",children:o.jsx("button",{className:"diff-nav-btn",onClick:de,disabled:G===0,children:"↑"})}),o.jsxs("span",{className:"diff-nav-counter",children:[G+1," / ",V.length]}),o.jsx(Jn,{content:"Next change (Down)",position:"bottom",children:o.jsx("button",{className:"diff-nav-btn",onClick:xe,disabled:G===V.length-1,children:"↓"})})]})}),o.jsxs("div",{className:"diff-viewer-stats",children:[H.added>0&&o.jsxs("span",{className:"diff-stat added",children:["+",H.added]}),H.removed>0&&o.jsxs("span",{className:"diff-stat removed",children:["-",H.removed]})]}),o.jsxs("div",{className:"diff-viewer-actions",children:[!D&&!_&&o.jsx(Jn,{content:k?"Show diff view":"View only modified",position:"bottom",children:o.jsx("button",{className:`diff-toggle-btn ${k?"active":""}`,onClick:()=>N(!k),children:r(k?"terminal:diffViewer.showDiff":"terminal:diffViewer.modifiedOnly")})}),o.jsx(Jn,{content:P&&k?"Copy as rich text":"Copy modified content",position:"bottom",children:o.jsx("button",{className:`diff-copy-btn ${y}`,onClick:O,children:y==="copied"?`✓ ${r("terminal:diffViewer.copied")}`:y==="error"?`✗ ${r("terminal:diffViewer.errorCopy")}`:r(P&&k?"terminal:diffViewer.copyRichText":"common:buttons.copy")})}),P&&k&&o.jsx(Jn,{content:"Copy as HTML tags (for Google Docs, HTML editors)",position:"bottom",children:o.jsx("button",{className:`diff-copy-btn ${S}`,onClick:T,children:S==="copied"?`✓ ${r("terminal:diffViewer.copied")}`:S==="error"?`✗ ${r("terminal:diffViewer.errorCopy")}`:r("terminal:diffViewer.copyHtml")})})]})]}),o.jsxs("div",{className:`diff-viewer-panels ${k||D||_?"modified-only":""}`,children:[!k&&!D&&o.jsxs("div",{className:"diff-panel diff-panel-original",children:[o.jsx("div",{className:"diff-panel-header",children:o.jsx("span",{className:"diff-panel-label",children:r("terminal:diffViewer.originalHead")})}),o.jsx("div",{className:"diff-panel-content",ref:i,children:M.map((Z,be)=>{const je=$.get(be),ce=je==="both"?"diff-hunk-top diff-hunk-bottom":je==="top"?"diff-hunk-top":je==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${Z.type} ${ce}`,children:[o.jsx("span",{className:"diff-line-num",children:Z.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:Z.highlighted||" "}})]},be)})})]}),!k&&!D&&!_&&o.jsx("div",{className:"diff-connector-gutter",children:o.jsx("canvas",{ref:f})}),!_&&o.jsxs("div",{className:"diff-panel diff-panel-modified",children:[o.jsx("div",{className:"diff-panel-header",children:o.jsx("span",{className:"diff-panel-label",children:r(k||D?"terminal:diffViewer.modifiedContent":"terminal:diffViewer.modifiedWorking")})}),k&&P?o.jsx("div",{className:"diff-panel-content diff-markdown-content",ref:d,children:o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],children:e})})}):o.jsx("div",{className:"diff-panel-content",ref:c,children:R.map((Z,be)=>{const je=F.get(be),ce=je==="both"?"diff-hunk-top diff-hunk-bottom":je==="top"?"diff-hunk-top":je==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${Z.type} ${ce}`,children:[o.jsx("span",{className:"diff-line-num",children:Z.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:Z.highlighted||" "}})]},be)})})]})]})]})}function V4(t,e){if(!t||t.startsWith("/")||!e||!e.startsWith("/"))return t;const n=t.replace(/^\.\//,""),s=e.split("/").filter(Boolean),a=n.split("/").filter(Boolean),r=[...s];for(const i of a)if(i!=="."){if(i===".."){r.length>0&&r.pop();continue}r.push(i)}return`/${r.join("/")}`}function u1(t){if(!t)return{path:t};const e=t.trim().replace(/^`|`$/g,"").replace(/[),.;]+$/g,""),n=e.match(/^(.*)#L(\d+)(?:C\d+)?$/i);if(n)return{path:n[1],line:Number(n[2])};const s=e.match(/^(.+?\.[^:\s]+):(\d+)(?::\d+)?$/);return s&&s[1].includes(".")?{path:s[1],line:Number(s[2])}:{path:e}}function Tp(t,e){const n=u1(t);return{path:V4(n.path,e),line:n.line}}function G4(t,e){try{const n=t.split(`
|
|
86
|
-
`),s=e.split(`
|
|
87
|
-
`),a=[];let r=0;for(let i=0;i<s.length;i++){const d=s[i].match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);if(!d)continue;const f=parseInt(d[3],10),h=parseInt(d[4]??"1",10),m=f-1;for(;r<m&&r<n.length;)a.push(n[r]),r++;let x=0;for(let y=i+1;y<s.length;y++){const v=s[y];if(v.startsWith("@@")||v.startsWith("diff "))break;v.startsWith("---")||v.startsWith("+++")||v.startsWith("index ")||v.startsWith("new file")||v.startsWith("deleted file")||v.startsWith("\\")||(v.startsWith("-")?a.push(v.slice(1)):v.startsWith("+")?(x++,r++):(a.push(v.startsWith(" ")?v.slice(1):v),x++,r++))}}for(;r<n.length;)a.push(n[r]),r++;return a.join(`
|
|
88
|
-
`)}catch{return null}}const cC=[".md",".mdx",".markdown"],uC=[".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svg"],dC=[".pdf"];function d1({isOpen:t,onClose:e,filePath:n,action:s,editData:a,searchRoot:r}){const{t:i}=pt(["terminal","common"]),[c,d]=b.useState(null),[f,h]=b.useState(!1),[m,x]=b.useState(null),[y,v]=b.useState([]),[S,C]=b.useState([]),[k,N]=b.useState("idle"),[j,E]=b.useState("idle"),[D,_]=b.useState("idle"),[P,O]=b.useState("idle"),[T,M]=b.useState(null),[R,I]=b.useState(null),[z,W]=b.useState(!1),$=b.useRef(null),F=b.useRef(null),H=b.useRef(null),V=b.useMemo(()=>u1(n),[n]),G=V.path,B=(a==null?void 0:a.targetLine)??V.line,Q=(a==null?void 0:a.highlightRange)||void 0;b.useEffect(()=>{t&&G?(v([]),C([]),M(null),I(null),De()):(d(null),x(null),v([]),C([]),M(null),I(null))},[t,G]),b.useEffect(()=>{t&&H.current&&H.current.focus()},[t]),b.useEffect(()=>{if(!t)return;const ie=Ie=>{if(!(Ie.target instanceof HTMLInputElement||Ie.target instanceof HTMLTextAreaElement)){if(Ie.key==="Escape"){Ie.preventDefault(),Ie.stopPropagation(),e();return}if(Ie.key==="j"||Ie.key==="k"){Ie.preventDefault(),Ie.stopPropagation();const oe=Ie.key==="j"?100:-100;if(F.current){const he=F.current.querySelectorAll(".diff-panel-content");if(he.length>0)he.forEach(ne=>{ne.scrollBy({top:oe,behavior:"smooth"})});else{const ne=F.current.querySelector(".file-viewer-code-with-lines");ne?ne.scrollBy({top:oe,behavior:"smooth"}):F.current.scrollBy({top:oe,behavior:"smooth"})}}return}Ie.stopPropagation()}};return window.addEventListener("keydown",ie,{capture:!0}),()=>window.removeEventListener("keydown",ie,{capture:!0})},[t,e]);const K=b.useMemo(()=>{if(!c||!a||a.highlightRange)return null;const{oldString:ie="",newString:Ie="",operation:oe}=a;if(!ie&&!Ie)return null;if(oe==="append"&&Ie){if(c.content.endsWith(Ie))return c.content.slice(0,c.content.length-Ie.length);const he=c.content.lastIndexOf(Ie);return he!==-1?c.content.slice(0,he)+c.content.slice(he+Ie.length):null}if(Ie){const he=c.content.indexOf(Ie);return he!==-1?c.content.slice(0,he)+ie+c.content.slice(he+Ie.length):null}return null},[c,a]),q=!!a&&!a.highlightRange&&(!!a.oldString||!!a.newString),xe=(a==null?void 0:a.unifiedDiff)||T,de=!!xe,Z=b.useMemo(()=>K!==null||!c||!xe?null:G4(c.content,xe),[K,c,xe]),be=K??Z??R,je=be!==null&&(q||de),ce=de&&!je,Ee=Q!==void 0;b.useEffect(()=>{if(!c||!a||a.highlightRange||je||a.unifiedDiff||T!==null)return;(async()=>{try{const Ie=c.path||G,oe=await Lt(Mt(`/api/files/git-diff?path=${encodeURIComponent(Ie)}`));if(oe.ok){const he=await oe.json();if(he.diff&&he.diff.trim()){M(he.diff);return}}}catch{}M("")})()},[c,a,je,G,T]),b.useEffect(()=>{if(!c||!a||a.highlightRange||K!==null||Z!==null||R!==null||!q&&!de)return;(async()=>{try{const Ie=c.path||G,oe=await Lt(Mt(`/api/files/git-original?path=${encodeURIComponent(Ie)}`));if(oe.ok){const he=await oe.json();if(he.content!==void 0&&he.content!==c.content){I(he.content);return}}}catch{}I("")})()},[c,a,K,Z,R,q,de,G]),b.useEffect(()=>{if(!c)return;const ie=Af(c.extension);if(ie==="plaintext"||ie in aa.languages){W(!0);return}W(!1),o1(ie).then(()=>W(!0))},[c]);const ze=b.useMemo(()=>{if(!c||je||ce||cC.includes(c.extension))return[];const ie=Af(c.extension),Ie=aa.languages[ie],oe=he=>he.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return c.content.split(`
|
|
89
|
-
`).map(he=>Ie?aa.highlight(he||" ",Ie,ie):oe(he||" "))},[c,je,ce,z]);b.useEffect(()=>{if(!t||!c||!F.current)return;const ie=window.setTimeout(()=>{const Ie=()=>{if(!F.current)return;const oe=F.current.querySelector(".file-line-highlighted");if(oe){oe.scrollIntoView({block:"center",behavior:"auto"});return}if(B){const he=F.current.querySelector(`.file-viewer-line-num[data-line="${B}"]`);he==null||he.scrollIntoView({block:"center",behavior:"auto"})}};window.requestAnimationFrame(()=>window.requestAnimationFrame(Ie))},0);return()=>window.clearTimeout(ie)},[t,c,Ee,Q==null?void 0:Q.offset,B]);const Ge=async ie=>{const Ie=ie.substring(ie.lastIndexOf(".")).toLowerCase(),oe=dC.includes(Ie),he=uC.includes(Ie),ne=oe||he?`/api/files/info?path=${encodeURIComponent(ie)}`:`/api/files/read?path=${encodeURIComponent(ie)}`,Le=await Lt(Mt(ne)),Qe=await Le.json();if(!Le.ok){const $e=Qe.error==="Path is a directory";return{ok:!1,error:Qe.error,isDirectory:$e}}return(oe||he)&&(Qe.content=""),{ok:!0,data:Qe}},_e=async(ie,Ie)=>{var oe;try{const he=await Lt(Mt(`/api/files/resolve?name=${encodeURIComponent(ie)}&root=${encodeURIComponent(Ie)}`)),ne=await he.json();if(he.ok&&((oe=ne.results)==null?void 0:oe.length)>0)return ne.results}catch{}return[]},me=async ie=>{var Ie;try{const oe=await Lt(Mt(`/api/files/list?path=${encodeURIComponent(ie)}`)),he=await oe.json();if(oe.ok&&((Ie=he.files)==null?void 0:Ie.length)>0)return he.files.slice(0,20).map(ne=>({name:ne.name,path:ne.path,isDirectory:ne.isDirectory,size:ne.size||0,extension:ne.extension||""}))}catch{}return[]},De=async()=>{h(!0),x(null),v([]),C([]);try{const ie=await Ge(G);if(ie.ok){d(ie.data);return}if(ie.isDirectory){const he=await me(G);if(he.length>0){C(he);return}x(ie.error||i("terminal:fileExplorer.failedToLoad"));return}const Ie=G.split("/").pop()||G,oe=r||(G.startsWith("/")?G.split("/").slice(0,-1).join("/"):"");if(oe&&Ie){const he=await _e(Ie,oe);if(he.length===1&&!he[0].isDirectory){const ne=await Ge(he[0].path);if(ne.ok){d(ne.data);return}}else if(he.length>0){v(he);return}}x(ie.error||i("terminal:fileExplorer.failedToLoad"))}catch(ie){x(ie.message||i("terminal:fileExplorer.failedToLoad"))}finally{h(!1)}},te=async ie=>{if(ie.isDirectory){h(!0),v([]),C([]),x(null);try{const Ie=await me(ie.path);Ie.length>0?C(Ie):x("Empty directory")}catch{x("Failed to load directory")}finally{h(!1)}return}h(!0),v([]),C([]),x(null);try{const Ie=await Ge(ie.path);Ie.ok?d(Ie.data):x(Ie.error||i("terminal:fileExplorer.failedToLoad"))}catch(Ie){x(Ie.message||i("terminal:fileExplorer.failedToLoad"))}finally{h(!1)}},{handleMouseDown:He,handleClick:ye}=wa(e),Re=()=>{switch(s){case"created":return i("common:status.created");case"modified":return i("common:status.modified");case"deleted":return i("common:status.deleted");case"read":return i("common:status.read")}},re=()=>{switch(s){case"created":return"var(--accent-green)";case"modified":return"var(--accent-orange)";case"deleted":return"var(--accent-red)";case"read":return"var(--text-secondary)"}},pe=b.useCallback(async()=>{if(!$.current){console.error("Copy Rich Text: markdown content ref is not available"),N("error"),setTimeout(()=>N("idle"),2e3);return}try{const ie=$.current.innerHTML,Ie=l1(ie),oe=$.current.innerText;await c1(Ie,oe),N("copied"),setTimeout(()=>N("idle"),2e3)}catch(ie){console.error("Copy Rich Text failed:",ie),N("error"),setTimeout(()=>N("idle"),2e3)}},[]),Ve=b.useCallback(async()=>{if(!$.current){console.error("Copy HTML: markdown content ref is not available"),E("error"),setTimeout(()=>E("idle"),2e3);return}try{const ie=$.current.innerHTML;await uu(ie),E("copied"),setTimeout(()=>E("idle"),2e3)}catch(ie){console.error("Copy HTML failed:",ie),E("error"),setTimeout(()=>E("idle"),2e3)}},[]),at=b.useCallback(async()=>{if(!c){_("error"),setTimeout(()=>_("idle"),2e3);return}try{await uu(c.content),_("copied"),setTimeout(()=>_("idle"),2e3)}catch{_("error"),setTimeout(()=>_("idle"),2e3)}},[c]),ut=b.useCallback(async()=>{if(!c){O("error"),setTimeout(()=>O("idle"),2e3);return}try{await uu(c.content),O("copied"),setTimeout(()=>O("idle"),2e3)}catch{O("error"),setTimeout(()=>O("idle"),2e3)}},[c]),ue=ie=>ie<1024?`${ie} B`:ie<1024*1024?`${(ie/1024).toFixed(1)} KB`:`${(ie/(1024*1024)).toFixed(1)} MB`,X=c&&cC.includes(c.extension),se=c&&uC.includes(c.extension),ke=c&&dC.includes(c.extension),J=se?"Image":ke?"PDF":c?Af(c.extension):"text",we=Ni(),We=se?Mt(`/api/files/binary?path=${encodeURIComponent(G)}${we?`&token=${encodeURIComponent(we)}`:""}`):null,Be=ke?Mt(`/api/files/binary?path=${encodeURIComponent(G)}${we?`&token=${encodeURIComponent(we)}`:""}`):null;return t?o.jsx(ir,{children:o.jsx("div",{ref:H,className:"file-viewer-overlay",onMouseDown:He,onClick:ye,tabIndex:-1,children:o.jsxs("div",{className:"file-viewer-modal",children:[o.jsxs("div",{className:"file-viewer-header",children:[o.jsxs("div",{className:"file-viewer-title",children:[o.jsx("span",{className:"file-viewer-action",style:{color:re()},children:Re()}),o.jsx("span",{className:"file-viewer-filename",children:(c==null?void 0:c.filename)||G.split("/").pop()})]}),o.jsxs("div",{className:"file-viewer-header-buttons",children:[X&&c&&!je&&!ce&&!Ee&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`file-viewer-copy-html-btn ${k}`,onClick:pe,title:i("terminal:fileExplorer.copyRichTextTitle"),children:i(k==="copied"?"common:status.copied":k==="error"?"common:status.error":"terminal:fileExplorer.copyRichText")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${j}`,onClick:Ve,title:i("terminal:fileExplorer.copyHtmlTitle"),children:i(j==="copied"?"common:status.copied":j==="error"?"common:status.error":"terminal:fileExplorer.copyHtml")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${D}`,onClick:at,title:i("terminal:fileExplorer.copyMarkdownTitle"),children:i(D==="copied"?"common:status.copied":D==="error"?"common:status.error":"terminal:fileExplorer.copyMarkdown")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${P}`,onClick:ut,title:i("terminal:fileExplorer.copyOriginalTitle"),children:i(P==="copied"?"common:status.copied":P==="error"?"common:status.error":"terminal:fileExplorer.copyOriginal")})]}),se&&We||ke&&Be?o.jsx("a",{className:"file-viewer-copy-html-btn",href:`${se?We:Be}&download=true`,download:c==null?void 0:c.filename,title:i(se?"terminal:fileExplorer.downloadImage":"terminal:fileExplorer.downloadPdf"),children:i("common:buttons.download")}):null,o.jsx("button",{className:"file-viewer-close",onClick:e,children:"×"})]})]}),o.jsx("div",{className:"file-viewer-path",children:(c==null?void 0:c.path)||G}),c&&o.jsxs("div",{className:"file-viewer-meta",children:[o.jsx("span",{children:ue(c.size)}),o.jsx("span",{children:"•"}),o.jsx("span",{children:J}),c.content&&!se&&!ke&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsx("span",{children:i("terminal:fileViewer.lineCount",{count:c.content.split(`
|
|
90
|
-
`).length})})]})]}),o.jsxs("div",{className:"file-viewer-content",ref:F,children:[f&&o.jsx("div",{className:"file-viewer-loading",children:i("terminal:fileExplorer.loadingFile")}),m&&!y.length&&!S.length&&o.jsx("div",{className:"file-viewer-error",children:m}),y.length>0&&o.jsxs("div",{className:"file-viewer-resolve-results",children:[o.jsxs("div",{className:"file-viewer-resolve-header",children:["Found ",y.length," matching file",y.length>1?"s":""," in project:"]}),o.jsx("div",{className:"file-viewer-resolve-list",children:y.map(ie=>o.jsxs("button",{className:"file-viewer-resolve-item",onClick:()=>te(ie),children:[o.jsx("span",{className:"file-viewer-resolve-icon",children:ie.isDirectory?"📁":"📄"}),o.jsxs("span",{className:"file-viewer-resolve-info",children:[o.jsx("span",{className:"file-viewer-resolve-name",children:ie.name}),o.jsx("span",{className:"file-viewer-resolve-path",children:ie.path})]}),!ie.isDirectory&&ie.size>0&&o.jsx("span",{className:"file-viewer-resolve-size",children:ue(ie.size)})]},ie.path))})]}),S.length>0&&o.jsxs("div",{className:"file-viewer-resolve-results",children:[o.jsxs("div",{className:"file-viewer-resolve-header",children:["Directory contents (",S.length," items):"]}),o.jsx("div",{className:"file-viewer-resolve-list",children:S.map(ie=>o.jsxs("button",{className:"file-viewer-resolve-item",onClick:()=>te(ie),children:[o.jsx("span",{className:"file-viewer-resolve-icon",children:ie.isDirectory?"📁":"📄"}),o.jsxs("span",{className:"file-viewer-resolve-info",children:[o.jsx("span",{className:"file-viewer-resolve-name",children:ie.name}),o.jsx("span",{className:"file-viewer-resolve-path",children:ie.path})]}),!ie.isDirectory&&ie.size>0&&o.jsx("span",{className:"file-viewer-resolve-size",children:ue(ie.size)})]},ie.path))})]}),c&&!f&&!m&&(se&&We?o.jsx("div",{className:"file-viewer-image-wrapper",children:o.jsx("img",{src:We,alt:c.filename,className:"file-viewer-image"})}):ke&&Be?o.jsx("div",{className:"file-viewer-pdf-embed",children:o.jsx("iframe",{src:Be,title:c.filename,className:"file-viewer-pdf-iframe"})}):je?o.jsx(Bb,{originalContent:be,modifiedContent:c.content,filename:c.filename,language:J}):ce?o.jsx("pre",{className:"file-viewer-code file-viewer-unified-diff",children:xe.split(`
|
|
91
|
-
`).map((ie,Ie)=>{let oe="diff-ctx";return ie.startsWith("+")&&!ie.startsWith("+++")?oe="diff-add":ie.startsWith("-")&&!ie.startsWith("---")?oe="diff-del":ie.startsWith("@@")?oe="diff-hdr":(ie.startsWith("diff ")||ie.startsWith("index ")||ie.startsWith("---")||ie.startsWith("+++"))&&(oe="diff-meta"),o.jsxs("div",{className:`file-line file-line-${oe}`,children:[o.jsx("span",{className:"file-line-num",children:Ie+1}),o.jsx("code",{children:ie||" "})]},Ie)})}):Ee?o.jsx("pre",{className:"file-viewer-code file-viewer-code-highlighted",children:c.content.split(`
|
|
92
|
-
`).map((ie,Ie)=>{const oe=Ie+1,he=Q,ne=he&&oe>=he.offset&&oe<he.offset+he.limit;return o.jsxs("div",{className:`file-line ${ne?"file-line-highlighted":""}`,children:[o.jsx("span",{className:"file-line-num",children:oe}),o.jsx("code",{className:`language-${J}`,dangerouslySetInnerHTML:{__html:ze[Ie]||ie||" "}})]},Ie)})}):X?o.jsx("div",{className:"file-viewer-markdown markdown-content",ref:$,children:o.jsx(Dr,{remarkPlugins:[Rr],children:c.content})}):o.jsx("pre",{className:`file-viewer-code file-viewer-code-lines language-${J}`,children:ze.map((ie,Ie)=>o.jsxs("div",{className:`file-line ${B===Ie+1?"file-line-highlighted":""}`,children:[o.jsx("span",{className:`file-line-num ${B===Ie+1?"file-viewer-line-num-target":""}`,"data-line":Ie+1,children:Ie+1}),o.jsx("code",{className:`language-${J}`,dangerouslySetInnerHTML:{__html:ie}})]},Ie+1))}))]})]})})}):null}function Y4({agentIds:t}){const{t:e}=pt(["terminal"]),n=gx(),s=Ij(),[a,r]=b.useState(null),[i,c]=b.useState(null),[d,f]=b.useState(()=>Er(ft.TOOLS_COLLAPSED)),[h,m]=b.useState(()=>Er(ft.FILES_COLLAPSED)),x=()=>{const O=!d;f(O),Qa(ft.TOOLS_COLLAPSED,O)},y=()=>{const O=!h;m(O),Qa(ft.FILES_COLLAPSED,O)},v=b.useMemo(()=>new Set(t),[t]),S=b.useMemo(()=>n.filter(O=>v.has(O.agentId)),[n,v]),C=b.useMemo(()=>s.filter(O=>v.has(O.agentId)),[s,v]),k=t.length>1,N=O=>new Date(O).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),j=O=>{const T=O.split("/");return T.length>2?".../"+T.slice(-2).join("/"):O},E=O=>{switch(O){case"created":return"+";case"modified":return"~";case"deleted":return"-";case"read":return">"}},D=O=>{switch(O){case"created":return"var(--accent-green)";case"modified":return"var(--accent-orange)";case"deleted":return"var(--accent-red)";case"read":return"var(--text-secondary)"}},_=O=>O==="Read"?"📖":O==="Write"?"📝":O==="Edit"?"✏️":O==="Bash"?"💻":O==="Grep"?"🔍":O==="Glob"?"📁":O==="Task"||O==="Agent"?"🤖":O==="WebFetch"?"🌐":O==="WebSearch"?"🔎":"🔧",P=(O,T)=>{r({path:O,action:T})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"tool-history-stacked",children:[o.jsxs("div",{className:`tool-history-panel ${d?"collapsed":""}`,children:[o.jsxs("div",{className:"tool-history-panel-header",onClick:x,children:[o.jsx("span",{className:"tool-history-panel-toggle",children:d?"▶":"▼"}),e("terminal:toolHistory.tools")," (",S.length,")"]}),!d&&o.jsx("div",{className:"tool-history-panel-content",children:S.length===0?o.jsx("div",{className:"tool-history-empty",children:e("terminal:toolHistory.noToolsYet")}):o.jsx("div",{className:"tool-history-list",children:S.slice(0,50).map((O,T)=>o.jsx(Q4,{execution:O,formatTime:N,formatPath:j,getToolIcon:_,showAgentName:k,isExpanded:i===T,onToggle:()=>c(i===T?null:T),onViewFile:M=>r({path:M,action:"modified"})},T))})})]}),o.jsxs("div",{className:`tool-history-panel ${h?"collapsed":""}`,children:[o.jsxs("div",{className:"tool-history-panel-header",onClick:y,children:[o.jsx("span",{className:"tool-history-panel-toggle",children:h?"▶":"▼"}),e("terminal:toolHistory.filesSection")," (",C.length,")"]}),!h&&o.jsx("div",{className:"tool-history-panel-content",children:C.length===0?o.jsx("div",{className:"tool-history-empty",children:e("terminal:toolHistory.noFileChangesYet")}):o.jsx("div",{className:"tool-history-list",children:C.slice(0,50).map((O,T)=>o.jsx(J4,{change:O,formatTime:N,formatPath:j,getActionIcon:E,getActionColor:D,onClick:()=>P(O.filePath,O.action),showAgentName:k},T))})})]})]}),o.jsx(d1,{isOpen:a!==null,onClose:()=>r(null),filePath:(a==null?void 0:a.path)||"",action:(a==null?void 0:a.action)||"read"})]})}function K4(t,e){if(!e)return null;switch(t){case"WebSearch":return e.query||null;case"WebFetch":const n=e.url;return n&&n.length>50?n.slice(0,47)+"...":n||null;case"Read":case"Write":case"Edit":const s=e.file_path||e.path;return s?s.length>40?".../"+s.split("/").slice(-2).join("/"):s:null;case"Bash":const a=e.command;return a?a.length>50?a.slice(0,47)+"...":a:null;case"Grep":return e.pattern?`"${e.pattern}"`:null;case"Glob":return e.pattern||null;case"Task":const r=e.description;return r?r.length>40?r.slice(0,37)+"...":r:null;case"TodoWrite":const i=e.todos;return i!=null&&i.length?`${i.length} item${i.length>1?"s":""}`:null;default:for(const[,c]of Object.entries(e))if(typeof c=="string"&&c.length>0&&c.length<80)return c.length>50?c.slice(0,47)+"...":c;return null}}function Q4({execution:t,formatTime:e,formatPath:n,getToolIcon:s,showAgentName:a,isExpanded:r,onToggle:i,onViewFile:c}){const{t:d}=pt(["terminal"]),f=K4(t.toolName,t.toolInput),h=t.toolInput&&Object.keys(t.toolInput).length>0,m=t.toolInput?t.toolInput.file_path||t.toolInput.path:void 0,x=["Write","Edit","Read"].includes(t.toolName)&&m;return o.jsxs("div",{className:`tool-history-item tool-compact ${r?"expanded":""} ${h?"clickable":""}`,children:[o.jsxs("div",{className:"tool-row",onClick:h?i:void 0,title:t.toolName,children:[o.jsx("span",{className:"tool-expand-icon",children:h?r?"▼":"▶":" "}),o.jsx("span",{className:"tool-icon",title:t.toolName,children:s(t.toolName)}),o.jsx("div",{className:"tool-input-inline",title:f||t.toolName,children:f||t.toolName}),a&&o.jsx("span",{className:"tool-agent-compact",children:t.agentName}),o.jsx("span",{className:"tool-time",children:e(t.timestamp)})]}),r&&t.toolInput&&o.jsxs("div",{className:"tool-expanded-details",children:[o.jsxs("div",{className:"tool-expanded-header",children:[o.jsx("span",{className:"tool-expanded-name",children:t.toolName}),x&&o.jsx("button",{className:"tool-view-file-btn",onClick:y=>{y.stopPropagation(),c(m)},children:d("terminal:toolHistory.viewFile")})]}),o.jsx("pre",{className:"tool-input-json",children:X4(t.toolName,t.toolInput)})]})]})}function X4(t,e){if(t==="Write"&&e.content){const n=e.content,s=e.file_path||e.path,a=n.length>2e3?n.slice(0,2e3)+`
|
|
93
|
-
|
|
94
|
-
... (truncated)`:n;return`file: ${s}
|
|
95
|
-
|
|
96
|
-
${a}`}if(t==="Edit"){const n=[];if(e.file_path&&n.push(`file: ${e.file_path}`),e.old_string){const s=e.old_string;n.push(`
|
|
97
|
-
- old:
|
|
98
|
-
${s.slice(0,500)}${s.length>500?"...":""}`)}if(e.new_string){const s=e.new_string;n.push(`
|
|
99
|
-
+ new:
|
|
100
|
-
${s.slice(0,500)}${s.length>500?"...":""}`)}return n.join(`
|
|
101
|
-
`)}return t==="Bash"&&e.command?e.command:t==="TodoWrite"&&e.todos?e.todos.map((s,a)=>`${s.status==="completed"?"✓":s.status==="in_progress"?"→":"○"} ${s.content}`).join(`
|
|
102
|
-
`):JSON.stringify(e,null,2)}function J4({change:t,formatTime:e,formatPath:n,getActionIcon:s,getActionColor:a,onClick:r,showAgentName:i}){return o.jsxs("div",{className:"tool-history-item file-change clickable",onClick:r,children:[o.jsx("span",{className:"file-action",style:{color:a(t.action)},children:s(t.action)}),o.jsx("span",{className:"file-path",title:t.filePath,children:n(t.filePath)}),i&&o.jsx("span",{className:"tool-agent-compact",children:t.agentName}),o.jsx("span",{className:"tool-time",children:e(t.timestamp)})]})}function rl(t,e,n){let s=n.initialDeps??[],a,r=!0;function i(){var c,d,f;let h;n.key&&((c=n.debug)!=null&&c.call(n))&&(h=Date.now());const m=t();if(!(m.length!==s.length||m.some((v,S)=>s[S]!==v)))return a;s=m;let y;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(y=Date.now()),a=e(...m),n.key&&((f=n.debug)!=null&&f.call(n))){const v=Math.round((Date.now()-h)*100)/100,S=Math.round((Date.now()-y)*100)/100,C=S/16,k=(N,j)=>{for(N=String(N);N.length<j;)N=" "+N;return N};console.info(`%c⏱ ${k(S,5)} /${k(v,5)} ms`,`
|
|
103
|
-
font-size: .6rem;
|
|
104
|
-
font-weight: bold;
|
|
105
|
-
color: hsl(${Math.max(0,Math.min(120-120*C,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(r&&n.skipInitialOnChange)&&n.onChange(a),r=!1,a}return i.updateDeps=c=>{s=c},i}function fC(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const Z4=(t,e)=>Math.abs(t-e)<1.01,ez=(t,e,n)=>{let s;return function(...a){t.clearTimeout(s),s=t.setTimeout(()=>e.apply(this,a),n)}},pC=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},tz=t=>t,nz=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),s=[];for(let a=e;a<=n;a++)s.push(a);return s},sz=(t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;const a=i=>{const{width:c,height:d}=i;e({width:Math.round(c),height:Math.round(d)})};if(a(pC(n)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(i=>{const c=()=>{const d=i[0];if(d!=null&&d.borderBoxSize){const f=d.borderBoxSize[0];if(f){a({width:f.inlineSize,height:f.blockSize});return}}a(pC(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return r.observe(n,{box:"border-box"}),()=>{r.unobserve(n)}},hC={passive:!0},mC=typeof window>"u"?!0:"onscrollend"in window,az=(t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;let a=0;const r=t.options.useScrollendEvent&&mC?()=>{}:ez(s,()=>{e(a,!1)},t.options.isScrollingResetDelay),i=h=>()=>{const{horizontal:m,isRtl:x}=t.options;a=m?n.scrollLeft*(x&&-1||1):n.scrollTop,r(),e(a,h)},c=i(!0),d=i(!1);n.addEventListener("scroll",c,hC);const f=t.options.useScrollendEvent&&mC;return f&&n.addEventListener("scrollend",d,hC),()=>{n.removeEventListener("scroll",c),f&&n.removeEventListener("scrollend",d)}},rz=(t,e,n)=>{if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},iz=(t,{adjustments:e=0,behavior:n},s)=>{var a,r;const i=t+e;(r=(a=s.scrollElement)==null?void 0:a.scrollTo)==null||r.call(a,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class oz{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,s,a;return((a=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:a.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(r=>{const i=()=>{const c=r.target,d=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(c,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var a;(a=s())==null||a.disconnect(),n=null},observe:a=>{var r;return(r=s())==null?void 0:r.observe(a,{box:"border-box"})},unobserve:a=>{var r;return(r=s())==null?void 0:r.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,a])=>{typeof a>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tz,rangeExtractor:nz,onChange:()=>{},measureElement:rz,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,a;(a=(s=this.options).onChange)==null||a.call(s,this,n)},this.maybeNotify=rl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=r,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const a=new Map,r=new Map;for(let i=s-1;i>=0;i--){const c=n[i];if(a.has(c.lane))continue;const d=r.get(c.lane);if(d==null||c.end>d.end?r.set(c.lane,c):c.end<d.end&&a.set(c.lane,!0),a.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=rl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,s,a,r,i,c)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:a,getItemKey:r,enabled:i,lanes:c}),{key:!1}),this.getMeasurements=rl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:a,getItemKey:r,enabled:i,lanes:c},d)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const f=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,f),m=new Array(c).fill(void 0);for(let x=0;x<f;x++){const y=h[x];y&&(m[y.lane]=x)}for(let x=f;x<n;x++){const y=r(x),v=this.laneAssignments.get(x);let S,C;if(v!==void 0&&this.options.lanes>1){S=v;const E=m[S],D=E!==void 0?h[E]:void 0;C=D?D.end+this.options.gap:s+a}else{const E=this.options.lanes===1?h[x-1]:this.getFurthestMeasurement(h,x);C=E?E.end+this.options.gap:s+a,S=E?E.lane:x%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(x,S)}const k=d.get(y),N=typeof k=="number"?k:this.options.estimateSize(x),j=C+N;h[x]={index:x,start:C,size:N,end:j,key:y,lane:S},m[S]=x}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=rl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,a,r)=>this.range=n.length>0&&s>0?lz({measurements:n,outerSize:s,scrollOffset:a,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=rl(()=>{let n=null,s=null;const a=this.calculateRange();return a&&(n=a.startIndex,s=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,a,r,i)=>r===null||i===null?[]:n({startIndex:r,endIndex:i,overscan:s,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,a=n.getAttribute(s);return a?parseInt(a,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(a!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,a-r),c=Math.min(this.options.count-1,a+r);return n>=i&&n<=c}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,c)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(c))});return}const s=this.indexFromElement(n),a=this.options.getItemKey(s),r=this.elementsCache.get(a);r!==n&&(r&&this.observer.unobserve(r),this.observer.observe(n),this.elementsCache.set(a,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var a;const r=this.measurementsCache[n];if(!r)return;const i=this.itemSizeCache.get(r.key)??r.size,c=s-i;c!==0&&(((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,c,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.getVirtualItems=rl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const a=[];for(let r=0,i=n.length;r<i;r++){const c=n[r],d=s[c];a.push(d)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return fC(s[f1(0,s.length-1,a=>fC(s[a]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,s,a=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=n>=i+r?"end":"start"),s==="center"?n+=(a-r)/2:s==="end"&&(n-=r);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(s==="auto")if(i.end>=r+a-this.options.scrollPaddingEnd)s="end";else if(i.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const c=s==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,s,i.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:a="auto"}={})=>{const r=this.getOffsetForAlignment(n,s),i=this.now();this.scrollState={index:null,align:s,behavior:a,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:a="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getOffsetForIndex(n,s);if(!r)return;const[i,c]=r,d=this.now();this.scrollState={index:n,align:c,behavior:a,startedAt:d,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const a=this.getScrollOffset()+n,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let a;if(s.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((n=s[s.length-1])==null?void 0:n.end)??0;else{const r=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&r.some(c=>c===null);){const c=s[i];r[c.lane]===null&&(r[c.lane]=c.end),i--}a=Math.max(...r.filter(c=>c!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:a})=>{this.options.scrollToFn(n,{behavior:a,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=s?s[0]:this.scrollState.lastTargetOffset,r=1,i=a!==this.scrollState.lastTargetOffset;if(!i&&Z4(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=a,this.scrollState.behavior="auto",this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const f1=(t,e,n,s)=>{for(;t<=e;){const a=(t+e)/2|0,r=n(a);if(r<s)t=a+1;else if(r>s)e=a-1;else return a}return t>0?t-1:0};function lz({measurements:t,outerSize:e,scrollOffset:n,lanes:s}){const a=t.length-1,r=d=>t[d].start;if(t.length<=s)return{startIndex:0,endIndex:a};let i=f1(0,a,r,n),c=i;if(s===1)for(;c<a&&t[c].end<n+e;)c++;else if(s>1){const d=Array(s).fill(0);for(;c<a&&d.some(h=>h<n+e);){const h=t[c];d[h.lane]=h.end,c++}const f=Array(s).fill(n+e);for(;i>=0&&f.some(h=>h>=n);){const h=t[i];f[h.lane]=h.start,i--}i=Math.max(0,i-i%s),c=Math.min(a,c+(s-1-c%s))}return{startIndex:i,endIndex:c}}const gC=typeof document<"u"?b.useLayoutEffect:b.useEffect;function cz({useFlushSync:t=!0,...e}){const n=b.useReducer(()=>({}),{})[1],s={...e,onChange:(r,i)=>{var c;t&&i?Rl.flushSync(n):n(),(c=e.onChange)==null||c.call(e,r,i)}},[a]=b.useState(()=>new oz(s));return a.setOptions(s),gC(()=>a._didMount(),[]),gC(()=>a._willUpdate()),a}function p1(t){return cz({observeElementRect:sz,observeElementOffset:az,scrollToFn:iz,...t})}const bC={30:"#000000",31:"#ef4444",32:"#22c55e",33:"#eab308",34:"#3b82f6",35:"#a855f7",36:"#06b6d4",37:"#e5e5e5",90:"#666666",91:"#f87171",92:"#4ade80",93:"#facc15",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"},xC={40:"#000000",41:"#ef4444",42:"#22c55e",43:"#eab308",44:"#3b82f6",45:"#a855f7",46:"#06b6d4",47:"#e5e5e5",100:"#666666",101:"#f87171",102:"#4ade80",103:"#facc15",104:"#60a5fa",105:"#c084fc",106:"#22d3ee",107:"#ffffff"};function yC(t){const e=[];return t.color&&e.push(`color:${t.color}`),t.bgColor&&e.push(`background-color:${t.bgColor}`),t.bold&&e.push("font-weight:bold"),t.dim&&e.push("opacity:0.6"),t.italic&&e.push("font-style:italic"),t.underline&&e.push("text-decoration:underline"),e.join(";")}function uz(t,e){const n={...t};return e===0?{}:(e===1?n.bold=!0:e===2?n.dim=!0:e===3?n.italic=!0:e===4?n.underline=!0:e===7?n.inverse=!0:e===22?(n.bold=!1,n.dim=!1):e===23?n.italic=!1:e===24?n.underline=!1:e===27?n.inverse=!1:e===39?delete n.color:e===49?delete n.bgColor:e>=30&&e<=37?n.color=bC[e]:e>=40&&e<=47?n.bgColor=xC[e]:e>=90&&e<=97?n.color=bC[e]:e>=100&&e<=107&&(n.bgColor=xC[e]),n)}function Sl(t){const e=/(?:\x1b|\u001b)?\[([0-9;]*)m/g;let n="",s=0,a={},r;for(;(r=e.exec(t))!==null;){const c=t.slice(s,r.index);if(c){const f=yC(a);f?n+=`<span style="${f}">${of(c)}</span>`:n+=of(c)}const d=r[1].split(";").filter(Boolean).map(Number);if(d.length===0)a={};else for(const f of d)a=uz(a,f);s=r.index+r[0].length}const i=t.slice(s);if(i){const c=yC(a);c?n+=`<span style="${c}">${of(i)}</span>`:n+=of(i)}return n}function of(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const go=b.memo(function({isOpen:e,position:n,actions:s,onClose:a}){const r=b.useRef(null),i=b.useRef(null);b.useEffect(()=>{if(!e)return;const d=setTimeout(()=>{const f=x=>{r.current&&!r.current.contains(x.target)&&a()},h=x=>{x.key==="Escape"&&a()},m=x=>{var v,S;const y=x.target;y&&y!==document&&y!==document.documentElement&&((v=y.classList)!=null&&v.contains("xterm-viewport")||(S=y.closest)!=null&&S.call(y,".guake-bottom-terminal-embed"))||a()};document.addEventListener("mousedown",f),document.addEventListener("touchstart",f,{passive:!0}),document.addEventListener("keydown",h),window.addEventListener("scroll",m,!0),i.current=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("touchstart",f),document.removeEventListener("keydown",h),window.removeEventListener("scroll",m,!0)}},100);return()=>{var f;clearTimeout(d),(f=i.current)==null||f.call(i),i.current=null}},[e,a]),b.useEffect(()=>{if(!e||!r.current)return;const d=r.current,f=d.getBoundingClientRect(),h=window.innerWidth,m=window.innerHeight;let x=n.x,y=n.y;n.x+f.width>h-10&&(x=h-f.width-10),n.y+f.height>m-10&&(y=m-f.height-10),d.style.left=`${Math.max(10,x)}px`,d.style.top=`${Math.max(10,y)}px`},[e,n]);const c=b.useCallback(d=>{d.disabled||(d.onClick(),a())},[a]);return e?o.jsx("div",{ref:r,className:"context-menu",style:{left:n.x,top:n.y},onClick:d=>d.stopPropagation(),children:s.map((d,f)=>d.divider?o.jsx("div",{className:"context-menu-divider"},`divider-${f}`):o.jsxs("button",{className:`context-menu-item ${d.disabled?"disabled":""} ${d.danger?"danger":""}`,onClick:()=>c(d),onTouchEnd:h=>{h.preventDefault(),h.stopPropagation(),c(d)},disabled:d.disabled,children:[d.icon&&o.jsx("span",{className:"context-menu-icon",children:d.icon}),o.jsx("span",{className:"context-menu-label",children:d.label}),d.shortcut&&o.jsx("span",{className:"context-menu-shortcut",children:d.shortcut})]},d.id))}):null});function h1(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=h1(t[e]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function as(){for(var t,e,n=0,s="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=h1(t))&&(s&&(s+=" "),s+=e);return s}const m1=6048e5,dz=864e5,Ep=6e4,_p=36e5,fz=1e3,vC=Symbol.for("constructDateFrom");function xn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&vC in t?t[vC](e):t instanceof Date?new t.constructor(e):new Date(e)}function St(t,e){return xn(e||t,t)}function Da(t,e,n){const s=St(t,n==null?void 0:n.in);return isNaN(e)?xn((n==null?void 0:n.in)||t,NaN):(e&&s.setDate(s.getDate()+e),s)}function Oa(t,e,n){const s=St(t,n==null?void 0:n.in);if(isNaN(e))return xn(t,NaN);if(!e)return s;const a=s.getDate(),r=xn(t,s.getTime());r.setMonth(s.getMonth()+e+1,0);const i=r.getDate();return a>=i?r:(s.setFullYear(r.getFullYear(),r.getMonth(),a),s)}function g1(t,e,n){return xn(t,+St(t)+e)}function pz(t,e,n){return g1(t,e*_p)}let hz={};function vo(){return hz}function Ir(t,e){var c,d,f,h;const n=vo(),s=(e==null?void 0:e.weekStartsOn)??((d=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??0,a=St(t,e==null?void 0:e.in),r=a.getDay(),i=(r<s?7:0)+r-s;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function Cl(t,e){return Ir(t,{...e,weekStartsOn:1})}function b1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=xn(n,0);a.setFullYear(s+1,0,4),a.setHours(0,0,0,0);const r=Cl(a),i=xn(n,0);i.setFullYear(s,0,4),i.setHours(0,0,0,0);const c=Cl(i);return n.getTime()>=r.getTime()?s+1:n.getTime()>=c.getTime()?s:s-1}function Qf(t){const e=St(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function zr(t,...e){const n=xn.bind(null,e.find(s=>typeof s=="object"));return e.map(n)}function bo(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(0,0,0,0),n}function Al(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=bo(s),i=bo(a),c=+r-Qf(r),d=+i-Qf(i);return Math.round((c-d)/dz)}function mz(t,e){const n=b1(t,e),s=xn(t,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Cl(s)}function Su(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setTime(s.getTime()+e*Ep),s}function Px(t,e,n){return Oa(t,e*3,n)}function gz(t,e,n){return g1(t,e*1e3)}function Xf(t,e,n){return Da(t,e*7,n)}function Ra(t,e,n){return Oa(t,e*12,n)}function wC(t,e){let n,s=e==null?void 0:e.in;return t.forEach(a=>{!s&&typeof a=="object"&&(s=xn.bind(null,a));const r=St(a,s);(!n||n<r||isNaN(+r))&&(n=r)}),xn(s,n||NaN)}function kC(t,e){let n,s=e==null?void 0:e.in;return t.forEach(a=>{!s&&typeof a=="object"&&(s=xn.bind(null,a));const r=St(a,s);(!n||n>r||isNaN(+r))&&(n=r)}),xn(s,n||NaN)}function bz(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return+bo(s)==+bo(a)}function tr(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function jl(t){return!(!tr(t)&&typeof t!="number"||isNaN(+St(t)))}function Jf(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=s.getMonth()-a.getMonth();return r*12+i}function vi(t,e){const n=St(t,e==null?void 0:e.in);return Math.trunc(n.getMonth()/3)+1}function Zf(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=vi(s)-vi(a);return r*4+i}function ep(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()-a.getFullYear()}function xz(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=SC(s,a),i=Math.abs(Al(s,a));s.setDate(s.getDate()-r*i);const c=+(SC(s,a)===-r),d=r*(i-c);return d===0?0:d}function SC(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function x1(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(23,59,59,999),n}function y1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function Fb(t,e){const n=St(t,e==null?void 0:e.in),s=n.getMonth(),a=s-s%3;return n.setMonth(a,1),n.setHours(0,0,0,0),n}function v1(t,e){const n=St(t,e==null?void 0:e.in);return n.setDate(1),n.setHours(0,0,0,0),n}function w1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function Mp(t,e){const n=St(t,e==null?void 0:e.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function yz(t,e){var c,d;const n=vo(),s=n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,a=St(t,e==null?void 0:e.in),r=a.getDay(),i=(r<s?-7:0)+6-(r-s);return a.setDate(a.getDate()+i),a.setHours(23,59,59,999),a}const vz={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},wz=(t,e,n)=>{let s;const a=vz[t];return typeof a=="string"?s=a:e===1?s=a.one:s=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Lg(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const kz={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Sz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Cz={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Az={date:Lg({formats:kz,defaultWidth:"full"}),time:Lg({formats:Sz,defaultWidth:"full"}),dateTime:Lg({formats:Cz,defaultWidth:"full"})},jz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Nz=(t,e,n,s)=>jz[t];function Hc(t){return(e,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,c=n!=null&&n.width?String(n.width):i;a=t.formattingValues[c]||t.formattingValues[i]}else{const i=t.defaultWidth,c=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[c]||t.values[i]}const r=t.argumentCallback?t.argumentCallback(e):e;return a[r]}}const Tz={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ez={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_z={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Mz={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Dz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Rz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Oz=(t,e)=>{const n=Number(t),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Lz={ordinalNumber:Oz,era:Hc({values:Tz,defaultWidth:"wide"}),quarter:Hc({values:Ez,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Hc({values:_z,defaultWidth:"wide"}),day:Hc({values:Mz,defaultWidth:"wide"}),dayPeriod:Hc({values:Dz,defaultWidth:"wide",formattingValues:Rz,defaultFormattingWidth:"wide"})};function Uc(t){return(e,n={})=>{const s=n.width,a=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],r=e.match(a);if(!r)return null;const i=r[0],c=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?Iz(c,m=>m.test(i)):Pz(c,m=>m.test(i));let f;f=t.valueCallback?t.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const h=e.slice(i.length);return{value:f,rest:h}}}function Pz(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Iz(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Bz(t){return(e,n={})=>{const s=e.match(t.matchPattern);if(!s)return null;const a=s[0],r=e.match(t.parsePattern);if(!r)return null;let i=t.valueCallback?t.valueCallback(r[0]):r[0];i=n.valueCallback?n.valueCallback(i):i;const c=e.slice(a.length);return{value:i,rest:c}}}const Fz=/^(\d+)(th|st|nd|rd)?/i,zz=/\d+/i,$z={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Hz={any:[/^b/i,/^(a|c)/i]},Uz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Wz={any:[/1/i,/2/i,/3/i,/4/i]},qz={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Vz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Gz={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yz={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Kz={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Qz={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Xz={ordinalNumber:Bz({matchPattern:Fz,parsePattern:zz,valueCallback:t=>parseInt(t,10)}),era:Uc({matchPatterns:$z,defaultMatchWidth:"wide",parsePatterns:Hz,defaultParseWidth:"any"}),quarter:Uc({matchPatterns:Uz,defaultMatchWidth:"wide",parsePatterns:Wz,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Uc({matchPatterns:qz,defaultMatchWidth:"wide",parsePatterns:Vz,defaultParseWidth:"any"}),day:Uc({matchPatterns:Gz,defaultMatchWidth:"wide",parsePatterns:Yz,defaultParseWidth:"any"}),dayPeriod:Uc({matchPatterns:Kz,defaultMatchWidth:"any",parsePatterns:Qz,defaultParseWidth:"any"})},k1={code:"en-US",formatDistance:wz,formatLong:Az,formatRelative:Nz,localize:Lz,match:Xz,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Jz(t,e){const n=St(t,e==null?void 0:e.in);return Al(n,Mp(n))+1}function Ix(t,e){const n=St(t,e==null?void 0:e.in),s=+Cl(n)-+mz(n);return Math.round(s/m1)+1}function Bx(t,e){var h,m,x,y;const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=vo(),r=(e==null?void 0:e.firstWeekContainsDate)??((m=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((y=(x=a.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??1,i=xn((e==null?void 0:e.in)||t,0);i.setFullYear(s+1,0,r),i.setHours(0,0,0,0);const c=Ir(i,e),d=xn((e==null?void 0:e.in)||t,0);d.setFullYear(s,0,r),d.setHours(0,0,0,0);const f=Ir(d,e);return+n>=+c?s+1:+n>=+f?s:s-1}function Zz(t,e){var c,d,f,h;const n=vo(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=Bx(t,e),r=xn((e==null?void 0:e.in)||t,0);return r.setFullYear(a,0,s),r.setHours(0,0,0,0),Ir(r,e)}function S1(t,e){const n=St(t,e==null?void 0:e.in),s=+Ir(n,e)-+Zz(n,e);return Math.round(s/m1)+1}function bn(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const yi={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return bn(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):bn(n+1,2)},d(t,e){return bn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return bn(t.getHours()%12||12,e.length)},H(t,e){return bn(t.getHours(),e.length)},m(t,e){return bn(t.getMinutes(),e.length)},s(t,e){return bn(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return bn(a,e.length)}},il={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},CC={G:function(t,e,n){const s=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const s=t.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return yi.y(t,e)},Y:function(t,e,n,s){const a=Bx(t,s),r=a>0?a:1-a;if(e==="YY"){const i=r%100;return bn(i,2)}return e==="Yo"?n.ordinalNumber(r,{unit:"year"}):bn(r,e.length)},R:function(t,e){const n=b1(t);return bn(n,e.length)},u:function(t,e){const n=t.getFullYear();return bn(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return bn(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return bn(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return yi.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return bn(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const a=S1(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):bn(a,e.length)},I:function(t,e,n){const s=Ix(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):bn(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):yi.d(t,e)},D:function(t,e,n){const s=Jz(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):bn(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return bn(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return bn(r,e.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),a=s===0?7:s;switch(e){case"i":return String(a);case"ii":return bn(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let a;switch(s===12?a=il.noon:s===0?a=il.midnight:a=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let a;switch(s>=17?a=il.evening:s>=12?a=il.afternoon:s>=4?a=il.morning:a=il.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let s=t.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return yi.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):yi.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):bn(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):bn(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):yi.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):yi.s(t,e)},S:function(t,e){return yi.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return jC(s);case"XXXX":case"XX":return no(s);case"XXXXX":case"XXX":default:return no(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return jC(s);case"xxxx":case"xx":return no(s);case"xxxxx":case"xxx":default:return no(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+AC(s,":");case"OOOO":default:return"GMT"+no(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+AC(s,":");case"zzzz":default:return"GMT"+no(s,":")}},t:function(t,e,n){const s=Math.trunc(+t/1e3);return bn(s,e.length)},T:function(t,e,n){return bn(+t,e.length)}};function AC(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=Math.trunc(s/60),r=s%60;return r===0?n+String(a):n+String(a)+e+bn(r,2)}function jC(t,e){return t%60===0?(t>0?"-":"+")+bn(Math.abs(t)/60,2):no(t,e)}function no(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=bn(Math.trunc(s/60),2),r=bn(s%60,2);return n+a+e+r}const NC=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},C1=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},e$=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return NC(t,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",NC(s,e)).replace("{{time}}",C1(a,e))},zb={p:C1,P:e$},t$=/^D+$/,n$=/^Y+$/,s$=["D","DD","YY","YYYY"];function a$(t){return t$.test(t)}function r$(t){return n$.test(t)}function i$(t,e,n){const s=o$(t,e,n);if(console.warn(s),s$.includes(t))throw new RangeError(s)}function o$(t,e,n){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const l$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,c$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,u$=/^'([^]*?)'?$/,d$=/''/g,f$=/[a-zA-Z]/;function TC(t,e,n){var h,m,x,y,v,S,C,k;const s=vo(),a=(n==null?void 0:n.locale)??s.locale??k1,r=(n==null?void 0:n.firstWeekContainsDate)??((m=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:m.firstWeekContainsDate)??s.firstWeekContainsDate??((y=(x=s.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((S=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:S.weekStartsOn)??s.weekStartsOn??((k=(C=s.locale)==null?void 0:C.options)==null?void 0:k.weekStartsOn)??0,c=St(t,n==null?void 0:n.in);if(!jl(c))throw new RangeError("Invalid time value");let d=e.match(c$).map(N=>{const j=N[0];if(j==="p"||j==="P"){const E=zb[j];return E(N,a.formatLong)}return N}).join("").match(l$).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const j=N[0];if(j==="'")return{isToken:!1,value:p$(N)};if(CC[j])return{isToken:!0,value:N};if(j.match(f$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:N}});a.localize.preprocessor&&(d=a.localize.preprocessor(c,d));const f={firstWeekContainsDate:r,weekStartsOn:i,locale:a};return d.map(N=>{if(!N.isToken)return N.value;const j=N.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&r$(j)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&a$(j))&&i$(j,e,String(t));const E=CC[j[0]];return E(c,j,a.localize,f)}).join("")}function p$(t){const e=t.match(u$);return e?e[1].replace(d$,"'"):t}function EC(t,e){return St(t,e==null?void 0:e.in).getDate()}function h$(t,e){return St(t,e==null?void 0:e.in).getDay()}function m$(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=n.getMonth(),r=xn(n,0);return r.setFullYear(s,a+1,0),r.setHours(0,0,0,0),r.getDate()}function g$(){return Object.assign({},vo())}function bs(t,e){return St(t,e==null?void 0:e.in).getHours()}function b$(t,e){const n=St(t,e==null?void 0:e.in).getDay();return n===0?7:n}function xs(t,e){return St(t,e==null?void 0:e.in).getMinutes()}function zs(t,e){return St(t,e==null?void 0:e.in).getMonth()}function wi(t){return St(t).getSeconds()}function $b(t){return+St(t)}function Jt(t,e){return St(t,e==null?void 0:e.in).getFullYear()}function Or(t,e){return+St(t)>+St(e)}function Ja(t,e){return+St(t)<+St(e)}function x$(t,e){return+St(t)==+St(e)}function y$(t,e){const n=v$(e)?new e(0):xn(e,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}function v$(t){var e;return typeof t=="function"&&((e=t.prototype)==null?void 0:e.constructor)===t}const w$=10;class A1{constructor(){et(this,"subPriority",0)}validate(e,n){return!0}}class k$ extends A1{constructor(e,n,s,a,r){super(),this.value=e,this.validateValue=n,this.setValue=s,this.priority=a,r&&(this.subPriority=r)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,s){return this.setValue(e,n,this.value,s)}}class S$ extends A1{constructor(n,s){super();et(this,"priority",w$);et(this,"subPriority",-1);this.context=n||(a=>xn(s,a))}set(n,s){return s.timestampIsSet?n:xn(n,y$(n,this.context))}}class hn{run(e,n,s,a){const r=this.parse(e,n,s,a);return r?{setter:new k$(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(e,n,s){return!0}}class C$ extends hn{constructor(){super(...arguments);et(this,"priority",140);et(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,a){switch(s){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})||a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"})}}set(n,s,a){return s.era=a,n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}const Wn={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Ga={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function qn(t,e){return t&&{value:e(t.value),rest:t.rest}}function On(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function Ya(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const s=n[1]==="+"?1:-1,a=n[2]?parseInt(n[2],10):0,r=n[3]?parseInt(n[3],10):0,i=n[5]?parseInt(n[5],10):0;return{value:s*(a*_p+r*Ep+i*fz),rest:e.slice(n[0].length)}}function j1(t){return On(Wn.anyDigitsSigned,t)}function zn(t,e){switch(t){case 1:return On(Wn.singleDigit,e);case 2:return On(Wn.twoDigits,e);case 3:return On(Wn.threeDigits,e);case 4:return On(Wn.fourDigits,e);default:return On(new RegExp("^\\d{1,"+t+"}"),e)}}function tp(t,e){switch(t){case 1:return On(Wn.singleDigitSigned,e);case 2:return On(Wn.twoDigitsSigned,e);case 3:return On(Wn.threeDigitsSigned,e);case 4:return On(Wn.fourDigitsSigned,e);default:return On(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Fx(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function N1(t,e){const n=e>0,s=n?e:1-e;let a;if(s<=50)a=t||100;else{const r=s+50,i=Math.trunc(r/100)*100,c=t>=r%100;a=t+i-(c?100:0)}return n?a:1-a}function T1(t){return t%400===0||t%4===0&&t%100!==0}class A$ extends hn{constructor(){super(...arguments);et(this,"priority",130);et(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,a){const r=i=>({year:i,isTwoDigitYear:s==="yy"});switch(s){case"y":return qn(zn(4,n),r);case"yo":return qn(a.ordinalNumber(n,{unit:"year"}),r);default:return qn(zn(s.length,n),r)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a){const r=n.getFullYear();if(a.isTwoDigitYear){const c=N1(a.year,r);return n.setFullYear(c,0,1),n.setHours(0,0,0,0),n}const i=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class j$ extends hn{constructor(){super(...arguments);et(this,"priority",130);et(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,a){const r=i=>({year:i,isTwoDigitYear:s==="YY"});switch(s){case"Y":return qn(zn(4,n),r);case"Yo":return qn(a.ordinalNumber(n,{unit:"year"}),r);default:return qn(zn(s.length,n),r)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,r){const i=Bx(n,r);if(a.isTwoDigitYear){const d=N1(a.year,i);return n.setFullYear(d,0,r.firstWeekContainsDate),n.setHours(0,0,0,0),Ir(n,r)}const c=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(c,0,r.firstWeekContainsDate),n.setHours(0,0,0,0),Ir(n,r)}}class N$ extends hn{constructor(){super(...arguments);et(this,"priority",130);et(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return tp(s==="R"?4:s.length,n)}set(n,s,a){const r=xn(n,0);return r.setFullYear(a,0,4),r.setHours(0,0,0,0),Cl(r)}}class T$ extends hn{constructor(){super(...arguments);et(this,"priority",130);et(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return tp(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class E$ extends hn{constructor(){super(...arguments);et(this,"priority",120);et(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"Q":case"QQ":return zn(s.length,n);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})||a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class _$ extends hn{constructor(){super(...arguments);et(this,"priority",120);et(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"q":case"qq":return zn(s.length,n);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})||a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class M$ extends hn{constructor(){super(...arguments);et(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);et(this,"priority",110)}parse(n,s,a){const r=i=>i-1;switch(s){case"M":return qn(On(Wn.month,n),r);case"MM":return qn(zn(2,n),r);case"Mo":return qn(a.ordinalNumber(n,{unit:"month"}),r);case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})||a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}class D$ extends hn{constructor(){super(...arguments);et(this,"priority",110);et(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,a){const r=i=>i-1;switch(s){case"L":return qn(On(Wn.month,n),r);case"LL":return qn(zn(2,n),r);case"Lo":return qn(a.ordinalNumber(n,{unit:"month"}),r);case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})||a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}function R$(t,e,n){const s=St(t,n==null?void 0:n.in),a=S1(s,n)-e;return s.setDate(s.getDate()-a*7),St(s,n==null?void 0:n.in)}class O$ extends hn{constructor(){super(...arguments);et(this,"priority",100);et(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return On(Wn.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,r){return Ir(R$(n,a,r),r)}}function L$(t,e,n){const s=St(t,n==null?void 0:n.in),a=Ix(s,n)-e;return s.setDate(s.getDate()-a*7),s}class P$ extends hn{constructor(){super(...arguments);et(this,"priority",100);et(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,a){switch(s){case"I":return On(Wn.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return Cl(L$(n,a))}}const I$=[31,28,31,30,31,30,31,31,30,31,30,31],B$=[31,29,31,30,31,30,31,31,30,31,30,31];class F$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"subPriority",1);et(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return On(Wn.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return zn(s.length,n)}}validate(n,s){const a=n.getFullYear(),r=T1(a),i=n.getMonth();return r?s>=1&&s<=B$[i]:s>=1&&s<=I$[i]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class z$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"subpriority",1);et(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,a){switch(s){case"D":case"DD":return On(Wn.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return zn(s.length,n)}}validate(n,s){const a=n.getFullYear();return T1(a)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,a){return n.setMonth(0,a),n.setHours(0,0,0,0),n}}function zx(t,e,n){var m,x,y,v;const s=vo(),a=(n==null?void 0:n.weekStartsOn)??((x=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??s.weekStartsOn??((v=(y=s.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??0,r=St(t,n==null?void 0:n.in),i=r.getDay(),d=(e%7+7)%7,f=7-a,h=e<0||e>6?e-(i+f)%7:(d+f)%7-(i+f)%7;return Da(r,h,n)}class $$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=zx(n,a,r),n.setHours(0,0,0,0),n}}class H$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,r){const i=c=>{const d=Math.floor((c-1)/7)*7;return(c+r.weekStartsOn+6)%7+d};switch(s){case"e":case"ee":return qn(zn(s.length,n),i);case"eo":return qn(a.ordinalNumber(n,{unit:"day"}),i);case"eee":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeeee":return a.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=zx(n,a,r),n.setHours(0,0,0,0),n}}class U$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,r){const i=c=>{const d=Math.floor((c-1)/7)*7;return(c+r.weekStartsOn+6)%7+d};switch(s){case"c":case"cc":return qn(zn(s.length,n),i);case"co":return qn(a.ordinalNumber(n,{unit:"day"}),i);case"ccc":return a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"ccccc":return a.day(n,{width:"narrow",context:"standalone"});case"cccccc":return a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(n,{width:"wide",context:"standalone"})||a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=zx(n,a,r),n.setHours(0,0,0,0),n}}function W$(t,e,n){const s=St(t,n==null?void 0:n.in),a=b$(s,n),r=e-a;return Da(s,r,n)}class q$ extends hn{constructor(){super(...arguments);et(this,"priority",90);et(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,a){const r=i=>i===0?7:i;switch(s){case"i":case"ii":return zn(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return qn(a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r);case"iiiii":return qn(a.day(n,{width:"narrow",context:"formatting"}),r);case"iiiiii":return qn(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r);case"iiii":default:return qn(a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r)}}validate(n,s){return s>=1&&s<=7}set(n,s,a){return n=W$(n,a),n.setHours(0,0,0,0),n}}class V$ extends hn{constructor(){super(...arguments);et(this,"priority",80);et(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,a){switch(s){case"a":case"aa":case"aaa":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Fx(a),0,0,0),n}}class G$ extends hn{constructor(){super(...arguments);et(this,"priority",80);et(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,a){switch(s){case"b":case"bb":case"bbb":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Fx(a),0,0,0),n}}class Y$ extends hn{constructor(){super(...arguments);et(this,"priority",80);et(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,a){switch(s){case"B":case"BB":case"BBB":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Fx(a),0,0,0),n}}class K$ extends hn{constructor(){super(...arguments);et(this,"priority",70);et(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return On(Wn.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,a){const r=n.getHours()>=12;return r&&a<12?n.setHours(a+12,0,0,0):!r&&a===12?n.setHours(0,0,0,0):n.setHours(a,0,0,0),n}}class Q$ extends hn{constructor(){super(...arguments);et(this,"priority",70);et(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return On(Wn.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class X$ extends hn{constructor(){super(...arguments);et(this,"priority",70);et(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return On(Wn.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.getHours()>=12&&a<12?n.setHours(a+12,0,0,0):n.setHours(a,0,0,0),n}}class J$ extends hn{constructor(){super(...arguments);et(this,"priority",70);et(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return On(Wn.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,a){const r=a<=24?a%24:a;return n.setHours(r,0,0,0),n}}class Z$ extends hn{constructor(){super(...arguments);et(this,"priority",60);et(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return On(Wn.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class e3 extends hn{constructor(){super(...arguments);et(this,"priority",50);et(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return On(Wn.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class t3 extends hn{constructor(){super(...arguments);et(this,"priority",30);et(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=r=>Math.trunc(r*Math.pow(10,-s.length+3));return qn(zn(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class n3 extends hn{constructor(){super(...arguments);et(this,"priority",10);et(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Ya(Ga.basicOptionalMinutes,n);case"XX":return Ya(Ga.basic,n);case"XXXX":return Ya(Ga.basicOptionalSeconds,n);case"XXXXX":return Ya(Ga.extendedOptionalSeconds,n);case"XXX":default:return Ya(Ga.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class s3 extends hn{constructor(){super(...arguments);et(this,"priority",10);et(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Ya(Ga.basicOptionalMinutes,n);case"xx":return Ya(Ga.basic,n);case"xxxx":return Ya(Ga.basicOptionalSeconds,n);case"xxxxx":return Ya(Ga.extendedOptionalSeconds,n);case"xxx":default:return Ya(Ga.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class a3 extends hn{constructor(){super(...arguments);et(this,"priority",40);et(this,"incompatibleTokens","*")}parse(n){return j1(n)}set(n,s,a){return[xn(n,a*1e3),{timestampIsSet:!0}]}}class r3 extends hn{constructor(){super(...arguments);et(this,"priority",20);et(this,"incompatibleTokens","*")}parse(n){return j1(n)}set(n,s,a){return[xn(n,a),{timestampIsSet:!0}]}}const i3={G:new C$,y:new A$,Y:new j$,R:new N$,u:new T$,Q:new E$,q:new _$,M:new M$,L:new D$,w:new O$,I:new P$,d:new F$,D:new z$,E:new $$,e:new H$,c:new U$,i:new q$,a:new V$,b:new G$,B:new Y$,h:new K$,H:new Q$,K:new X$,k:new J$,m:new Z$,s:new e3,S:new t3,X:new n3,x:new s3,t:new a3,T:new r3},o3=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,l3=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,c3=/^'([^]*?)'?$/,u3=/''/g,d3=/\S/,f3=/[a-zA-Z]/;function p3(t,e,n,s){var C,k,N,j,E,D,_,P;const a=()=>xn((s==null?void 0:s.in)||n,NaN),r=g$(),i=(s==null?void 0:s.locale)??r.locale??k1,c=(s==null?void 0:s.firstWeekContainsDate)??((k=(C=s==null?void 0:s.locale)==null?void 0:C.options)==null?void 0:k.firstWeekContainsDate)??r.firstWeekContainsDate??((j=(N=r.locale)==null?void 0:N.options)==null?void 0:j.firstWeekContainsDate)??1,d=(s==null?void 0:s.weekStartsOn)??((D=(E=s==null?void 0:s.locale)==null?void 0:E.options)==null?void 0:D.weekStartsOn)??r.weekStartsOn??((P=(_=r.locale)==null?void 0:_.options)==null?void 0:P.weekStartsOn)??0;if(!e)return t?a():St(n,s==null?void 0:s.in);const f={firstWeekContainsDate:c,weekStartsOn:d,locale:i},h=[new S$(s==null?void 0:s.in,n)],m=e.match(l3).map(O=>{const T=O[0];if(T in zb){const M=zb[T];return M(O,i.formatLong)}return O}).join("").match(o3),x=[];for(let O of m){const T=O[0],M=i3[T];if(M){const{incompatibleTokens:R}=M;if(Array.isArray(R)){const z=x.find(W=>R.includes(W.token)||W.token===T);if(z)throw new RangeError(`The format string mustn't contain \`${z.fullToken}\` and \`${O}\` at the same time`)}else if(M.incompatibleTokens==="*"&&x.length>0)throw new RangeError(`The format string mustn't contain \`${O}\` and any other token at the same time`);x.push({token:T,fullToken:O});const I=M.run(t,O,i.match,f);if(!I)return a();h.push(I.setter),t=I.rest}else{if(T.match(f3))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(O==="''"?O="'":T==="'"&&(O=h3(O)),t.indexOf(O)===0)t=t.slice(O.length);else return a()}}if(t.length>0&&d3.test(t))return a();const y=h.map(O=>O.priority).sort((O,T)=>T-O).filter((O,T,M)=>M.indexOf(O)===T).map(O=>h.filter(T=>T.priority===O).sort((T,M)=>M.subPriority-T.subPriority)).map(O=>O[0]);let v=St(n,s==null?void 0:s.in);if(isNaN(+v))return a();const S={};for(const O of y){if(!O.validate(v,f))return a();const T=O.set(v,S,f);Array.isArray(T)?(v=T[0],Object.assign(S,T[1])):v=T}return v}function h3(t){return t.match(c3)[1].replace(u3,"'")}function m3(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()&&s.getMonth()===a.getMonth()}function g3(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return+Fb(s)==+Fb(a)}function b3(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()}function Cu(t,e,n){const s=+St(t,n==null?void 0:n.in),[a,r]=[+St(e.start,n==null?void 0:n.in),+St(e.end,n==null?void 0:n.in)].sort((i,c)=>i-c);return s>=a&&s<=r}function x3(t,e,n){return Da(t,-1,n)}function y3(t,e){const n=()=>xn(e==null?void 0:e.in,NaN),a=S3(t);let r;if(a.date){const f=C3(a.date,2);r=A3(f.restDateString,f.year)}if(!r||isNaN(+r))return n();const i=+r;let c=0,d;if(a.time&&(c=j3(a.time),isNaN(c)))return n();if(a.timezone){if(d=N3(a.timezone),isNaN(d))return n()}else{const f=new Date(i+c),h=St(0,e==null?void 0:e.in);return h.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),h.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),h}return St(i+c+d,e==null?void 0:e.in)}const lf={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},v3=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,w3=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,k3=/^([+-])(\d{2})(?::?(\d{2}))?$/;function S3(t){const e={},n=t.split(lf.dateTimeDelimiter);let s;if(n.length>2)return e;if(/:/.test(n[0])?s=n[0]:(e.date=n[0],s=n[1],lf.timeZoneDelimiter.test(e.date)&&(e.date=t.split(lf.timeZoneDelimiter)[0],s=t.substr(e.date.length,t.length))),s){const a=lf.timezone.exec(s);a?(e.time=s.replace(a[1],""),e.timezone=a[1]):e.time=s}return e}function C3(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),s=t.match(n);if(!s)return{year:NaN,restDateString:""};const a=s[1]?parseInt(s[1]):null,r=s[2]?parseInt(s[2]):null;return{year:r===null?a:r*100,restDateString:t.slice((s[1]||s[2]).length)}}function A3(t,e){if(e===null)return new Date(NaN);const n=t.match(v3);if(!n)return new Date(NaN);const s=!!n[4],a=Wc(n[1]),r=Wc(n[2])-1,i=Wc(n[3]),c=Wc(n[4]),d=Wc(n[5])-1;if(s)return D3(e,c,d)?T3(e,c,d):new Date(NaN);{const f=new Date(0);return!_3(e,r,i)||!M3(e,a)?new Date(NaN):(f.setUTCFullYear(e,r,Math.max(a,i)),f)}}function Wc(t){return t?parseInt(t):1}function j3(t){const e=t.match(w3);if(!e)return NaN;const n=Pg(e[1]),s=Pg(e[2]),a=Pg(e[3]);return R3(n,s,a)?n*_p+s*Ep+a*1e3:NaN}function Pg(t){return t&&parseFloat(t.replace(",","."))||0}function N3(t){if(t==="Z")return 0;const e=t.match(k3);if(!e)return 0;const n=e[1]==="+"?-1:1,s=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return O3(s,a)?n*(s*_p+a*Ep):NaN}function T3(t,e,n){const s=new Date(0);s.setUTCFullYear(t,0,4);const a=s.getUTCDay()||7,r=(e-1)*7+n+1-a;return s.setUTCDate(s.getUTCDate()+r),s}const E3=[31,null,31,30,31,30,31,31,30,31,30,31];function E1(t){return t%400===0||t%4===0&&t%100!==0}function _3(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(E3[e]||(E1(t)?29:28))}function M3(t,e){return e>=1&&e<=(E1(t)?366:365)}function D3(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function R3(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function O3(t,e){return e>=0&&e<=59}function Zs(t,e,n){const s=St(t,n==null?void 0:n.in),a=s.getFullYear(),r=s.getDate(),i=xn(t,0);i.setFullYear(a,e,15),i.setHours(0,0,0,0);const c=m$(i);return s.setMonth(e,Math.min(r,c)),s}function jf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setHours(e),s}function Nf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setMinutes(e),s}function fl(t,e,n){const s=St(t,n==null?void 0:n.in),a=Math.trunc(s.getMonth()/3)+1,r=e-a;return Zs(s,s.getMonth()+r*3)}function Tf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setSeconds(e),s}function qa(t,e,n){const s=St(t,n==null?void 0:n.in);return isNaN(+s)?xn(t,NaN):(s.setFullYear(e),s)}function lo(t,e,n){return Oa(t,-e,n)}function _1(t,e,n){return Px(t,-1,n)}function _C(t,e,n){return Xf(t,-1,n)}function Ci(t,e,n){return Ra(t,-e,n)}function Dp(){return typeof window<"u"}function Pl(t){return M1(t)?(t.nodeName||"").toLowerCase():"#document"}function ra(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function lr(t){var e;return(e=(M1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function M1(t){return Dp()?t instanceof Node||t instanceof ra(t).Node:!1}function Ns(t){return Dp()?t instanceof Element||t instanceof ra(t).Element:!1}function $r(t){return Dp()?t instanceof HTMLElement||t instanceof ra(t).HTMLElement:!1}function MC(t){return!Dp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ra(t).ShadowRoot}function Du(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=ka(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&a!=="inline"&&a!=="contents"}function L3(t){return/^(table|td|th)$/.test(Pl(t))}function Rp(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const P3=/transform|translate|scale|rotate|perspective|filter/,I3=/paint|layout|strict|content/,Zi=t=>!!t&&t!=="none";let Ig;function $x(t){const e=Ns(t)?ka(t):t;return Zi(e.transform)||Zi(e.translate)||Zi(e.scale)||Zi(e.rotate)||Zi(e.perspective)||!Hx()&&(Zi(e.backdropFilter)||Zi(e.filter))||P3.test(e.willChange||"")||I3.test(e.contain||"")}function B3(t){let e=Ai(t);for(;$r(e)&&!Nl(e);){if($x(e))return e;if(Rp(e))return null;e=Ai(e)}return null}function Hx(){return Ig==null&&(Ig=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ig}function Nl(t){return/^(html|body|#document)$/.test(Pl(t))}function ka(t){return ra(t).getComputedStyle(t)}function Op(t){return Ns(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ai(t){if(Pl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||MC(t)&&t.host||lr(t);return MC(e)?e.host:e}function D1(t){const e=Ai(t);return Nl(e)?t.ownerDocument?t.ownerDocument.body:t.body:$r(e)&&Du(e)?e:D1(e)}function Au(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=D1(t),r=a===((s=t.ownerDocument)==null?void 0:s.body),i=ra(a);if(r){const c=Hb(i);return e.concat(i,i.visualViewport||[],Du(a)?a:[],c&&n?Au(c):[])}else return e.concat(a,Au(a,[],n))}function Hb(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Tl=Math.min,co=Math.max,np=Math.round,cf=Math.floor,nr=t=>({x:t,y:t}),F3={left:"right",right:"left",bottom:"top",top:"bottom"};function z3(t,e,n){return co(t,Tl(e,n))}function Lp(t,e){return typeof t=="function"?t(e):t}function El(t){return t.split("-")[0]}function Ru(t){return t.split("-")[1]}function $3(t){return t==="x"?"y":"x"}function Ux(t){return t==="y"?"height":"width"}function ro(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Wx(t){return $3(ro(t))}function H3(t,e,n){n===void 0&&(n=!1);const s=Ru(t),a=Wx(t),r=Ux(a);let i=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=sp(i)),[i,sp(i)]}function U3(t){const e=sp(t);return[Ub(t),e,Ub(e)]}function Ub(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const DC=["left","right"],RC=["right","left"],W3=["top","bottom"],q3=["bottom","top"];function V3(t,e,n){switch(t){case"top":case"bottom":return n?e?RC:DC:e?DC:RC;case"left":case"right":return e?W3:q3;default:return[]}}function G3(t,e,n,s){const a=Ru(t);let r=V3(El(t),n==="start",s);return a&&(r=r.map(i=>i+"-"+a),e&&(r=r.concat(r.map(Ub)))),r}function sp(t){const e=El(t);return F3[e]+t.slice(e.length)}function Y3(t){return{top:0,right:0,bottom:0,left:0,...t}}function R1(t){return typeof t!="number"?Y3(t):{top:t,right:t,bottom:t,left:t}}function ap(t){const{x:e,y:n,width:s,height:a}=t;return{width:s,height:a,top:n,left:e,right:e+s,bottom:n+a,x:e,y:n}}var K3=typeof document<"u",Q3=function(){},rp=K3?b.useLayoutEffect:Q3;const X3={...KA},J3=X3.useInsertionEffect,Z3=J3||(t=>t());function eH(t){const e=b.useRef(()=>{});return Z3(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return e.current==null?void 0:e.current(...s)},[])}function OC(t,e,n){let{reference:s,floating:a}=t;const r=ro(e),i=Wx(e),c=Ux(i),d=El(e),f=r==="y",h=s.x+s.width/2-a.width/2,m=s.y+s.height/2-a.height/2,x=s[c]/2-a[c]/2;let y;switch(d){case"top":y={x:h,y:s.y-a.height};break;case"bottom":y={x:h,y:s.y+s.height};break;case"right":y={x:s.x+s.width,y:m};break;case"left":y={x:s.x-a.width,y:m};break;default:y={x:s.x,y:s.y}}switch(Ru(e)){case"start":y[i]-=x*(n&&f?-1:1);break;case"end":y[i]+=x*(n&&f?-1:1);break}return y}async function tH(t,e){var n;e===void 0&&(e={});const{x:s,y:a,platform:r,rects:i,elements:c,strategy:d}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:x=!1,padding:y=0}=Lp(e,t),v=R1(y),C=c[x?m==="floating"?"reference":"floating":m],k=ap(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(C)))==null||n?C:C.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:d})),N=m==="floating"?{x:s,y:a,width:i.floating.width,height:i.floating.height}:i.reference,j=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),E=await(r.isElement==null?void 0:r.isElement(j))?await(r.getScale==null?void 0:r.getScale(j))||{x:1,y:1}:{x:1,y:1},D=ap(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:j,strategy:d}):N);return{top:(k.top-D.top+v.top)/E.y,bottom:(D.bottom-k.bottom+v.bottom)/E.y,left:(k.left-D.left+v.left)/E.x,right:(D.right-k.right+v.right)/E.x}}const nH=50,sH=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:r=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:tH},d=await(i.isRTL==null?void 0:i.isRTL(e));let f=await i.getElementRects({reference:t,floating:e,strategy:a}),{x:h,y:m}=OC(f,s,d),x=s,y=0;const v={};for(let S=0;S<r.length;S++){const C=r[S];if(!C)continue;const{name:k,fn:N}=C,{x:j,y:E,data:D,reset:_}=await N({x:h,y:m,initialPlacement:s,placement:x,strategy:a,middlewareData:v,rects:f,platform:c,elements:{reference:t,floating:e}});h=j??h,m=E??m,v[k]={...v[k],...D},_&&y<nH&&(y++,typeof _=="object"&&(_.placement&&(x=_.placement),_.rects&&(f=_.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:a}):_.rects),{x:h,y:m}=OC(f,x,d)),S=-1)}return{x:h,y:m,placement:x,strategy:a,middlewareData:v}},aH=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:a,rects:r,platform:i,elements:c,middlewareData:d}=e,{element:f,padding:h=0}=Lp(t,e)||{};if(f==null)return{};const m=R1(h),x={x:n,y:s},y=Wx(a),v=Ux(y),S=await i.getDimensions(f),C=y==="y",k=C?"top":"left",N=C?"bottom":"right",j=C?"clientHeight":"clientWidth",E=r.reference[v]+r.reference[y]-x[y]-r.floating[v],D=x[y]-r.reference[y],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let P=_?_[j]:0;(!P||!await(i.isElement==null?void 0:i.isElement(_)))&&(P=c.floating[j]||r.floating[v]);const O=E/2-D/2,T=P/2-S[v]/2-1,M=Tl(m[k],T),R=Tl(m[N],T),I=M,z=P-S[v]-R,W=P/2-S[v]/2+O,$=z3(I,W,z),F=!d.arrow&&Ru(a)!=null&&W!==$&&r.reference[v]/2-(W<I?M:R)-S[v]/2<0,H=F?W<I?W-I:W-z:0;return{[y]:x[y]+H,data:{[y]:$,centerOffset:W-$-H,...F&&{alignmentOffset:H}},reset:F}}}),rH=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:a,middlewareData:r,rects:i,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:S=!0,...C}=Lp(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const k=El(a),N=ro(c),j=El(c)===c,E=await(d.isRTL==null?void 0:d.isRTL(f.floating)),D=x||(j||!S?[sp(c)]:U3(c)),_=v!=="none";!x&&_&&D.push(...G3(c,S,v,E));const P=[c,...D],O=await d.detectOverflow(e,C),T=[];let M=((s=r.flip)==null?void 0:s.overflows)||[];if(h&&T.push(O[k]),m){const W=H3(a,i,E);T.push(O[W[0]],O[W[1]])}if(M=[...M,{placement:a,overflows:T}],!T.every(W=>W<=0)){var R,I;const W=(((R=r.flip)==null?void 0:R.index)||0)+1,$=P[W];if($&&(!(m==="alignment"?N!==ro($):!1)||M.every(V=>ro(V.placement)===N?V.overflows[0]>0:!0)))return{data:{index:W,overflows:M},reset:{placement:$}};let F=(I=M.filter(H=>H.overflows[0]<=0).sort((H,V)=>H.overflows[1]-V.overflows[1])[0])==null?void 0:I.placement;if(!F)switch(y){case"bestFit":{var z;const H=(z=M.filter(V=>{if(_){const G=ro(V.placement);return G===N||G==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(G=>G>0).reduce((G,B)=>G+B,0)]).sort((V,G)=>V[1]-G[1])[0])==null?void 0:z[0];H&&(F=H);break}case"initialPlacement":F=c;break}if(a!==F)return{reset:{placement:F}}}return{}}}},iH=new Set(["left","top"]);async function oH(t,e){const{placement:n,platform:s,elements:a}=t,r=await(s.isRTL==null?void 0:s.isRTL(a.floating)),i=El(n),c=Ru(n),d=ro(n)==="y",f=iH.has(i)?-1:1,h=r&&d?-1:1,m=Lp(e,t);let{mainAxis:x,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),d?{x:y*h,y:x*f}:{x:x*f,y:y*h}}const lH=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:a,y:r,placement:i,middlewareData:c}=e,d=await oH(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:a+d.x,y:r+d.y,data:{...d,placement:i}}}}};function O1(t){const e=ka(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=$r(t),r=a?t.offsetWidth:n,i=a?t.offsetHeight:s,c=np(n)!==r||np(s)!==i;return c&&(n=r,s=i),{width:n,height:s,$:c}}function qx(t){return Ns(t)?t:t.contextElement}function xl(t){const e=qx(t);if(!$r(e))return nr(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:r}=O1(e);let i=(r?np(n.width):n.width)/s,c=(r?np(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const cH=nr(0);function L1(t){const e=ra(t);return!Hx()||!e.visualViewport?cH:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uH(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ra(t)?!1:e}function xo(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),r=qx(t);let i=nr(1);e&&(s?Ns(s)&&(i=xl(s)):i=xl(t));const c=uH(r,n,s)?L1(r):nr(0);let d=(a.left+c.x)/i.x,f=(a.top+c.y)/i.y,h=a.width/i.x,m=a.height/i.y;if(r){const x=ra(r),y=s&&Ns(s)?ra(s):s;let v=x,S=Hb(v);for(;S&&s&&y!==v;){const C=xl(S),k=S.getBoundingClientRect(),N=ka(S),j=k.left+(S.clientLeft+parseFloat(N.paddingLeft))*C.x,E=k.top+(S.clientTop+parseFloat(N.paddingTop))*C.y;d*=C.x,f*=C.y,h*=C.x,m*=C.y,d+=j,f+=E,v=ra(S),S=Hb(v)}}return ap({width:h,height:m,x:d,y:f})}function Pp(t,e){const n=Op(t).scrollLeft;return e?e.left+n:xo(lr(t)).left+n}function P1(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-Pp(t,n),a=n.top+e.scrollTop;return{x:s,y:a}}function dH(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const r=a==="fixed",i=lr(s),c=e?Rp(e.floating):!1;if(s===i||c&&r)return n;let d={scrollLeft:0,scrollTop:0},f=nr(1);const h=nr(0),m=$r(s);if((m||!m&&!r)&&((Pl(s)!=="body"||Du(i))&&(d=Op(s)),m)){const y=xo(s);f=xl(s),h.x=y.x+s.clientLeft,h.y=y.y+s.clientTop}const x=i&&!m&&!r?P1(i,d):nr(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+h.x+x.x,y:n.y*f.y-d.scrollTop*f.y+h.y+x.y}}function fH(t){return Array.from(t.getClientRects())}function pH(t){const e=lr(t),n=Op(t),s=t.ownerDocument.body,a=co(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=co(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Pp(t);const c=-n.scrollTop;return ka(s).direction==="rtl"&&(i+=co(e.clientWidth,s.clientWidth)-a),{width:a,height:r,x:i,y:c}}const LC=25;function hH(t,e){const n=ra(t),s=lr(t),a=n.visualViewport;let r=s.clientWidth,i=s.clientHeight,c=0,d=0;if(a){r=a.width,i=a.height;const h=Hx();(!h||h&&e==="fixed")&&(c=a.offsetLeft,d=a.offsetTop)}const f=Pp(s);if(f<=0){const h=s.ownerDocument,m=h.body,x=getComputedStyle(m),y=h.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,v=Math.abs(s.clientWidth-m.clientWidth-y);v<=LC&&(r-=v)}else f<=LC&&(r+=f);return{width:r,height:i,x:c,y:d}}function mH(t,e){const n=xo(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,r=$r(t)?xl(t):nr(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,d=a*r.x,f=s*r.y;return{width:i,height:c,x:d,y:f}}function PC(t,e,n){let s;if(e==="viewport")s=hH(t,n);else if(e==="document")s=pH(lr(t));else if(Ns(e))s=mH(e,n);else{const a=L1(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ap(s)}function I1(t,e){const n=Ai(t);return n===e||!Ns(n)||Nl(n)?!1:ka(n).position==="fixed"||I1(n,e)}function gH(t,e){const n=e.get(t);if(n)return n;let s=Au(t,[],!1).filter(c=>Ns(c)&&Pl(c)!=="body"),a=null;const r=ka(t).position==="fixed";let i=r?Ai(t):t;for(;Ns(i)&&!Nl(i);){const c=ka(i),d=$x(i);!d&&c.position==="fixed"&&(a=null),(r?!d&&!a:!d&&c.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Du(i)&&!d&&I1(t,i))?s=s.filter(h=>h!==i):a=c,i=Ai(i)}return e.set(t,s),s}function bH(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const i=[...n==="clippingAncestors"?Rp(e)?[]:gH(e,this._c):[].concat(n),s],c=PC(e,i[0],a);let d=c.top,f=c.right,h=c.bottom,m=c.left;for(let x=1;x<i.length;x++){const y=PC(e,i[x],a);d=co(y.top,d),f=Tl(y.right,f),h=Tl(y.bottom,h),m=co(y.left,m)}return{width:f-m,height:h-d,x:m,y:d}}function xH(t){const{width:e,height:n}=O1(t);return{width:e,height:n}}function yH(t,e,n){const s=$r(e),a=lr(e),r=n==="fixed",i=xo(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const d=nr(0);function f(){d.x=Pp(a)}if(s||!s&&!r)if((Pl(e)!=="body"||Du(a))&&(c=Op(e)),s){const y=xo(e,!0,r,e);d.x=y.x+e.clientLeft,d.y=y.y+e.clientTop}else a&&f();r&&!s&&a&&f();const h=a&&!s&&!r?P1(a,c):nr(0),m=i.left+c.scrollLeft-d.x-h.x,x=i.top+c.scrollTop-d.y-h.y;return{x:m,y:x,width:i.width,height:i.height}}function Bg(t){return ka(t).position==="static"}function IC(t,e){if(!$r(t)||ka(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return lr(t)===n&&(n=n.ownerDocument.body),n}function B1(t,e){const n=ra(t);if(Rp(t))return n;if(!$r(t)){let a=Ai(t);for(;a&&!Nl(a);){if(Ns(a)&&!Bg(a))return a;a=Ai(a)}return n}let s=IC(t,e);for(;s&&L3(s)&&Bg(s);)s=IC(s,e);return s&&Nl(s)&&Bg(s)&&!$x(s)?n:s||B3(t)||n}const vH=async function(t){const e=this.getOffsetParent||B1,n=this.getDimensions,s=await n(t.floating);return{reference:yH(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function wH(t){return ka(t).direction==="rtl"}const kH={convertOffsetParentRelativeRectToViewportRelativeRect:dH,getDocumentElement:lr,getClippingRect:bH,getOffsetParent:B1,getElementRects:vH,getClientRects:fH,getDimensions:xH,getScale:xl,isElement:Ns,isRTL:wH};function F1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function SH(t,e){let n=null,s;const a=lr(t);function r(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),r();const f=t.getBoundingClientRect(),{left:h,top:m,width:x,height:y}=f;if(c||e(),!x||!y)return;const v=cf(m),S=cf(a.clientWidth-(h+x)),C=cf(a.clientHeight-(m+y)),k=cf(h),j={rootMargin:-v+"px "+-S+"px "+-C+"px "+-k+"px",threshold:co(0,Tl(1,d))||1};let E=!0;function D(_){const P=_[0].intersectionRatio;if(P!==d){if(!E)return i();P?i(!1,P):s=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!F1(f,t.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(D,{...j,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,j)}n.observe(t)}return i(!0),r}function CH(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,f=qx(t),h=a||r?[...f?Au(f):[],...e?Au(e):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),r&&k.addEventListener("resize",n)});const m=f&&c?SH(f,n):null;let x=-1,y=null;i&&(y=new ResizeObserver(k=>{let[N]=k;N&&N.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(e)})),n()}),f&&!d&&y.observe(f),e&&y.observe(e));let v,S=d?xo(t):null;d&&C();function C(){const k=xo(t);S&&!F1(S,k)&&n(),S=k,v=requestAnimationFrame(C)}return n(),()=>{var k;h.forEach(N=>{a&&N.removeEventListener("scroll",n),r&&N.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,d&&cancelAnimationFrame(v)}}const AH=lH,jH=rH,BC=aH,NH=(t,e,n)=>{const s=new Map,a={platform:kH,...n},r={...a.platform,_c:s};return sH(t,e,{...a,platform:r})};var TH=typeof document<"u",EH=function(){},Ef=TH?b.useLayoutEffect:EH;function ip(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!ip(t[s],e[s]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,a[s]))return!1;for(s=n;s--!==0;){const r=a[s];if(!(r==="_owner"&&t.$$typeof)&&!ip(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function z1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function FC(t,e){const n=z1(t);return Math.round(e*n)/n}function Fg(t){const e=b.useRef(t);return Ef(()=>{e.current=t}),e}function _H(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:r,floating:i}={},transform:c=!0,whileElementsMounted:d,open:f}=t,[h,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=b.useState(s);ip(x,s)||y(s);const[v,S]=b.useState(null),[C,k]=b.useState(null),N=b.useCallback(V=>{V!==_.current&&(_.current=V,S(V))},[]),j=b.useCallback(V=>{V!==P.current&&(P.current=V,k(V))},[]),E=r||v,D=i||C,_=b.useRef(null),P=b.useRef(null),O=b.useRef(h),T=d!=null,M=Fg(d),R=Fg(a),I=Fg(f),z=b.useCallback(()=>{if(!_.current||!P.current)return;const V={placement:e,strategy:n,middleware:x};R.current&&(V.platform=R.current),NH(_.current,P.current,V).then(G=>{const B={...G,isPositioned:I.current!==!1};W.current&&!ip(O.current,B)&&(O.current=B,Rl.flushSync(()=>{m(B)}))})},[x,e,n,R,I]);Ef(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[f]);const W=b.useRef(!1);Ef(()=>(W.current=!0,()=>{W.current=!1}),[]),Ef(()=>{if(E&&(_.current=E),D&&(P.current=D),E&&D){if(M.current)return M.current(E,D,z);z()}},[E,D,z,M,T]);const $=b.useMemo(()=>({reference:_,floating:P,setReference:N,setFloating:j}),[N,j]),F=b.useMemo(()=>({reference:E,floating:D}),[E,D]),H=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!F.floating)return V;const G=FC(F.floating,h.x),B=FC(F.floating,h.y);return c?{...V,transform:"translate("+G+"px, "+B+"px)",...z1(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:B}},[n,c,F.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:z,refs:$,elements:F,floatingStyles:H}),[h,z,$,F,H])}const MH=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:a}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?BC({element:s.current,padding:a}).fn(n):{}:s?BC({element:s,padding:a}).fn(n):{}}}},DH=(t,e)=>{const n=AH(t);return{name:n.name,fn:n.fn,options:[t,e]}},RH=(t,e)=>{const n=jH(t);return{name:n.name,fn:n.fn,options:[t,e]}},OH=(t,e)=>{const n=MH(t);return{name:n.name,fn:n.fn,options:[t,e]}},LH={...KA};let zC=!1,PH=0;const $C=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+PH++;function IH(){const[t,e]=b.useState(()=>zC?$C():void 0);return rp(()=>{t==null&&e($C())},[]),b.useEffect(()=>{zC=!0},[]),t}const BH=LH.useId,$1=BH||IH,FH=b.forwardRef(function(e,n){const{context:{placement:s,elements:{floating:a},middlewareData:{arrow:r,shift:i}},width:c=14,height:d=7,tipRadius:f=0,strokeWidth:h=0,staticOffset:m,stroke:x,d:y,style:{transform:v,...S}={},...C}=e,k=$1(),[N,j]=b.useState(!1);if(rp(()=>{if(!a)return;ka(a).direction==="rtl"&&j(!0)},[a]),!a)return null;const[E,D]=s.split("-"),_=E==="top"||E==="bottom";let P=m;(_&&i!=null&&i.x||!_&&i!=null&&i.y)&&(P=null);const O=h*2,T=O/2,M=c/2*(f/-8+1),R=d/2*f/4,I=!!y,z=P&&D==="end"?"bottom":"top";let W=P&&D==="end"?"right":"left";P&&N&&(W=D==="end"?"left":"right");const $=(r==null?void 0:r.x)!=null?P||r.x:"",F=(r==null?void 0:r.y)!=null?P||r.y:"",H=y||"M0,0"+(" H"+c)+(" L"+(c-M)+","+(d-R))+(" Q"+c/2+","+d+" "+M+","+(d-R))+" Z",V={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[E];return o.jsxs("svg",{...C,"aria-hidden":!0,ref:n,width:I?c:c+O,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[W]:$,[z]:F,[E]:_||I?"100%":"calc(100% - "+O/2+"px)",transform:[V,v].filter(G=>!!G).join(" "),...S},children:[O>0&&o.jsx("path",{clipPath:"url(#"+k+")",fill:"none",stroke:x,strokeWidth:O+(y?0:1),d:H}),o.jsx("path",{stroke:O&&!y?C.fill:"none",d:H}),o.jsx("clipPath",{id:k,children:o.jsx("rect",{x:-T,y:T*(I?-1:1),width:c+O,height:c})})]})});function zH(){const t=new Map;return{emit(e,n){var s;(s=t.get(e))==null||s.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var s;(s=t.get(e))==null||s.delete(n)}}}const $H=b.createContext(null),HH=b.createContext(null),UH=()=>{var t;return((t=b.useContext($H))==null?void 0:t.id)||null},WH=()=>b.useContext(HH);function qH(t){const{open:e=!1,onOpenChange:n,elements:s}=t,a=$1(),r=b.useRef({}),[i]=b.useState(()=>zH()),c=UH()!=null,[d,f]=b.useState(s.reference),h=eH((y,v,S)=>{r.current.openEvent=y?v:void 0,i.emit("openchange",{open:y,event:v,reason:S,nested:c}),n==null||n(y,v,S)}),m=b.useMemo(()=>({setPositionReference:f}),[]),x=b.useMemo(()=>({reference:d||s.reference||null,floating:s.floating||null,domReference:s.reference}),[d,s.reference,s.floating]);return b.useMemo(()=>({dataRef:r,open:e,onOpenChange:h,elements:x,events:i,floatingId:a,refs:m}),[e,h,x,i,a,m])}function VH(t){t===void 0&&(t={});const{nodeId:e}=t,n=qH({...t,elements:{reference:null,floating:null,...t.elements}}),s=t.rootContext||n,a=s.elements,[r,i]=b.useState(null),[c,d]=b.useState(null),h=(a==null?void 0:a.domReference)||r,m=b.useRef(null),x=WH();rp(()=>{h&&(m.current=h)},[h]);const y=_H({...t,elements:{...a,...c&&{reference:c}}}),v=b.useCallback(j=>{const E=Ns(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(E),y.refs.setReference(E)},[y.refs]),S=b.useCallback(j=>{(Ns(j)||j===null)&&(m.current=j,i(j)),(Ns(y.refs.reference.current)||y.refs.reference.current===null||j!==null&&!Ns(j))&&y.refs.setReference(j)},[y.refs]),C=b.useMemo(()=>({...y.refs,setReference:S,setPositionReference:v,domReference:m}),[y.refs,S,v]),k=b.useMemo(()=>({...y.elements,domReference:h}),[y.elements,h]),N=b.useMemo(()=>({...y,...s,refs:C,elements:k,nodeId:e}),[y,C,k,e,s]);return rp(()=>{s.dataRef.current.floatingContext=N;const j=x==null?void 0:x.nodesRef.current.find(E=>E.id===e);j&&(j.context=N)}),b.useMemo(()=>({...y,context:N,refs:C,elements:k}),[y,C,k,N])}/*!
|
|
106
|
-
react-datepicker v9.1.0
|
|
107
|
-
https://github.com/Hacker0x01/react-datepicker
|
|
108
|
-
Released under the MIT License.
|
|
109
|
-
*/var Wb=function(e,n){return Wb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])},Wb(e,n)};function ms(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Wb(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var qt=function(){return qt=Object.assign||function(n){for(var s,a=1,r=arguments.length;a<r;a++){s=arguments[a];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])}return n},qt.apply(this,arguments)};function Za(t,e,n){if(n||arguments.length===2)for(var s=0,a=e.length,r;s<a;s++)(r||!(s in e))&&(r||(r=Array.prototype.slice.call(e,0,s)),r[s]=e[s]);return t.concat(r||Array.prototype.slice.call(e))}var GH=function(t){var e=t.showTimeSelectOnly,n=e===void 0?!1:e,s=t.showTime,a=s===void 0?!1:s,r=t.className,i=t.children,c=t.inline,d=n?"Choose Time":"Choose Date".concat(a?" and Time":"");return Ce.createElement("div",{className:r,"aria-label":d,role:c?void 0:"dialog","aria-modal":c?void 0:"true",translate:"no"},i)},YH=function(t,e){var n=b.useRef(null),s=b.useRef(t);b.useEffect(function(){s.current=t},[t]);var a=b.useCallback(function(r){var i,c=r.composed&&r.composedPath&&r.composedPath().find(function(d){return d instanceof Node})||r.target;n.current&&!n.current.contains(c)&&(e&&c instanceof HTMLElement&&c.classList.contains(e)||(i=s.current)===null||i===void 0||i.call(s,r))},[e]);return b.useEffect(function(){return document.addEventListener("mousedown",a),function(){document.removeEventListener("mousedown",a)}},[a]),n},Ip=function(t){var e=t.children,n=t.onClickOutside,s=t.className,a=t.containerRef,r=t.style,i=t.ignoreClass,c=YH(n,i);return Ce.createElement("div",{className:s,style:r,ref:function(d){c.current=d,a&&(a.current=d)}},e)},uf=null,HC=!1;function H1(){if(HC)return uf;HC=!0;try{var t="date-fns-tz";uf=require(t)}catch{uf=null}return uf}function UC(t,e){if(!e)return t;var n=H1();return n?n.toZonedTime(t,e):t}function jr(t,e){if(!e)return t;var n=H1();return n?n.fromZonedTime(t,e):t}var dt;(function(t){t.ArrowUp="ArrowUp",t.ArrowDown="ArrowDown",t.ArrowLeft="ArrowLeft",t.ArrowRight="ArrowRight",t.PageUp="PageUp",t.PageDown="PageDown",t.Home="Home",t.End="End",t.Enter="Enter",t.Space=" ",t.Tab="Tab",t.Escape="Escape",t.Backspace="Backspace",t.X="x"})(dt||(dt={}));function U1(){var t=typeof window<"u"?window:globalThis;return t}var Ou=12;function ln(t){if(t==null)return new Date;var e=typeof t=="string"?y3(t):St(t);return Fs(e)?e:new Date}function eo(t,e,n,s,a){a===void 0&&(a=ln());for(var r=_l(n)||_l(Vx()),i=Array.isArray(e)?e:[e],c=0,d=i;c<d.length;c++){var f=d[c],h=p3(t,f,a,{locale:r});if(Fs(h)&&(!s||t===Dn(h,f,n)))return h}if(!s&&t&&t.length>=8){var m=new Date(t);if(jl(m))return m}return null}function KH(t,e){if(e===void 0&&(e=ln()),!t)return null;var n=t.match(/\b(1\d{3}|2\d{3})\b/);if(!n||!n[1])return null;var s=parseInt(n[1],10),a=t.match(/(?:^|[/\-\s])?(0?[1-9]|1[0-2])(?:[/\-\s]|$)/),r=a&&a[1]?parseInt(a[1],10)-1:e.getMonth();return new Date(s,r,1)}function Fs(t){return jl(t)}function io(t){return t==null?null:tr(t)&&jl(t)?t:null}function Dn(t,e,n){if(n==="en")return TC(t,e,{useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0});var s=n?_l(n):void 0;return n&&!s&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),s=s||_l(Vx()),TC(t,e,{locale:s,useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0})}function Bs(t,e){var n=e.dateFormat,s=e.locale,a=Array.isArray(n)&&n.length>0?n[0]:n;return t&&Dn(t,a,s)||""}var W1=" - ";function QH(t,e,n){if(!t&&!e)return"";var s=t?Bs(t,n):"",a=e?Bs(e,n):"",r=n.rangeSeparator||W1;return"".concat(s).concat(r).concat(a)}function XH(t,e){if(!(t!=null&&t.length))return"";var n=t[0]?Bs(t[0],e):"";if(t.length===1)return n;if(t.length===2&&t[1]){var s=Bs(t[1],e);return"".concat(n,", ").concat(s)}var a=t.length-1;return"".concat(n," (+").concat(a,")")}function Nr(t,e){var n=e.hour,s=n===void 0?0:n,a=e.minute,r=a===void 0?0:a,i=e.second,c=i===void 0?0:i;return jf(Nf(Tf(t,c),r),s)}function JH(t){return Ix(t)}function ZH(t,e){return Dn(t,"ddd",e)}function Qc(t){return bo(t)}function ki(t,e,n){var s=_l(e||Vx());return Ir(t,{locale:s,weekStartsOn:n})}function Lr(t){return v1(t)}function Xc(t){return Mp(t)}function WC(t){return Fb(t)}function qC(){return bo(ln())}function VC(t){return x1(t)}function eU(t){return yz(t)}function tU(t){return y1(t)}function Va(t,e){return t&&e?b3(t,e):!t&&!e}function As(t,e){return t&&e?m3(t,e):!t&&!e}function op(t,e){return t&&e?g3(t,e):!t&&!e}function an(t,e){return t&&e?bz(t,e):!t&&!e}function oo(t,e){return t&&e?x$(t,e):!t&&!e}function so(t,e,n){var s,a=bo(e),r=x1(n);try{s=Cu(t,{start:a,end:r})}catch{s=!1}return s}function Vx(){var t=U1();return t.__localeId__}function _l(t){if(typeof t=="string"){var e=U1();return e.__localeData__?e.__localeData__[t]:void 0}else return t}function nU(t,e,n){return e(Dn(t,"EEEE",n))}function sU(t,e){return Dn(t,"EEEEEE",e)}function aU(t,e){return Dn(t,"EEE",e)}function Gx(t,e){return Dn(Zs(ln(),t),"LLLL",e)}function q1(t,e){return Dn(Zs(ln(),t),"LLL",e)}function rU(t,e){return Dn(fl(ln(),t),"QQQ",e)}function xa(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.excludeDateIntervals,c=n.includeDates,d=n.includeDateIntervals,f=n.filterDate,h=n.disabled;return h?!0:Lu(t,{minDate:s,maxDate:a})||r&&r.some(function(m){return m instanceof Date?an(t,m):an(t,m.date)})||i&&i.some(function(m){var x=m.start,y=m.end;return Cu(t,{start:x,end:y})})||c&&!c.some(function(m){return an(t,m)})||d&&!d.some(function(m){var x=m.start,y=m.end;return Cu(t,{start:x,end:y})})||f&&!f(ln(t))||!1}function Yx(t,e){var n=e===void 0?{}:e,s=n.excludeDates,a=n.excludeDateIntervals;return a&&a.length>0?a.some(function(r){var i=r.start,c=r.end;return Cu(t,{start:i,end:c})}):s&&s.some(function(r){var i;return r instanceof Date?an(t,r):an(t,(i=r.date)!==null&&i!==void 0?i:new Date)})||!1}function V1(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate;return Lu(t,{minDate:s?v1(s):void 0,maxDate:a?y1(a):void 0})||(r==null?void 0:r.some(function(d){return As(t,d instanceof Date?d:d.date)}))||i&&!i.some(function(d){return As(t,d)})||c&&!c(ln(t))||!1}function df(t,e,n,s){var a=Jt(t),r=zs(t),i=Jt(e),c=zs(e),d=Jt(s);return a===i&&a===d?r<=n&&n<=c:a<i?d===a&&r<=n||d===i&&c>=n||d<i&&d>a:!1}function iU(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates;return Lu(t,{minDate:s,maxDate:a})||r&&r.some(function(c){return As(c instanceof Date?c:c.date,t)})||i&&!i.some(function(c){return As(c,t)})||!1}function ff(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate,d=n.disabled;return d?!0:Lu(t,{minDate:s,maxDate:a})||(r==null?void 0:r.some(function(f){return op(t,f instanceof Date?f:f.date)}))||i&&!i.some(function(f){return op(t,f)})||c&&!c(ln(t))||!1}function pf(t,e,n){if(!e||!n||!jl(e)||!jl(n))return!1;var s=Jt(e),a=Jt(n);return s<=t&&a>=t}function _f(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate,d=n.disabled;if(d)return!0;var f=new Date(t,0,1);return Lu(f,{minDate:s?Mp(s):void 0,maxDate:a?w1(a):void 0})||(r==null?void 0:r.some(function(h){return Va(f,h instanceof Date?h:h.date)}))||i&&!i.some(function(h){return Va(f,h)})||c&&!c(ln(f))||!1}function hf(t,e,n,s){var a=Jt(t),r=vi(t),i=Jt(e),c=vi(e),d=Jt(s);return a===i&&a===d?r<=n&&n<=c:a<i?d===a&&r<=n||d===i&&c>=n||d<i&&d>a:!1}function Lu(t,e){var n,s=e===void 0?{}:e,a=s.minDate,r=s.maxDate;return(n=a&&Al(t,a)<0||r&&Al(t,r)>0)!==null&&n!==void 0?n:!1}function GC(t,e){return e.some(function(n){return bs(n)===bs(t)&&xs(n)===xs(t)&&wi(n)===wi(t)})}function YC(t,e){var n=e===void 0?{}:e,s=n.excludeTimes,a=n.includeTimes,r=n.filterTime;return s&&GC(t,s)||a&&!GC(t,a)||r&&!r(t)||!1}function KC(t,e){var n=e.minTime,s=e.maxTime;if(!n||!s)throw new Error("Both minTime and maxTime props required");var a=ln();a=jf(a,bs(t)),a=Nf(a,xs(t)),a=Tf(a,wi(t));var r=ln();r=jf(r,bs(n)),r=Nf(r,xs(n)),r=Tf(r,wi(n));var i=ln();i=jf(i,bs(s)),i=Nf(i,xs(s)),i=Tf(i,wi(s));var c;try{c=!Cu(a,{start:r,end:i})}catch{c=!1}return c}function QC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=lo(t,1);return s&&Jf(s,r)>0||a&&a.every(function(i){return Jf(i,r)>0})||!1}function XC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=Oa(t,1);return s&&Jf(r,s)>0||a&&a.every(function(i){return Jf(r,i)>0})||!1}function oU(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=Mp(t),i=_1(r);return s&&Zf(s,i)>0||a&&a.every(function(c){return Zf(c,i)>0})||!1}function lU(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=w1(t),i=Px(r,1);return s&&Zf(i,s)>0||a&&a.every(function(c){return Zf(i,c)>0})||!1}function JC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=Ci(t,1);return s&&ep(s,r)>0||a&&a.every(function(i){return ep(i,r)>0})||!1}function cU(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.yearItemNumber,r=a===void 0?Ou:a,i=Xc(Ci(t,r)),c=_r(i,r).endPeriod,d=s&&Jt(s);return d&&d>c||!1}function ZC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=Ra(t,1);return s&&ep(r,s)>0||a&&a.every(function(i){return ep(r,i)>0})||!1}function uU(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.yearItemNumber,r=a===void 0?Ou:a,i=Ra(t,r),c=_r(i,r).startPeriod,d=s&&Jt(s);return d&&d<c||!1}function G1(t){var e=t.minDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Al(a,e)>=0});return kC(s)}else return n?kC(n):e}function Y1(t){var e=t.maxDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Al(a,e)<=0});return wC(s)}else return n?wC(n):e}function eA(t,e){var n;t===void 0&&(t=[]),e===void 0&&(e="react-datepicker__day--highlighted");for(var s=new Map,a=0,r=t.length;a<r;a++){var i=t[a];if(tr(i)){var c=Dn(i,"MM.dd.yyyy"),d=s.get(c)||[];d.includes(e)||(d.push(e),s.set(c,d))}else if(typeof i=="object"){var f=Object.keys(i),h=(n=f[0])!==null&&n!==void 0?n:"",m=i[h];if(typeof h=="string"&&Array.isArray(m))for(var x=0,y=m.length;x<y;x++){var v=m[x];if(v){var c=Dn(v,"MM.dd.yyyy"),d=s.get(c)||[];d.includes(h)||(d.push(h),s.set(c,d))}}}}return s}function dU(t,e){return t.length!==e.length?!1:t.every(function(n,s){return n===e[s]})}function fU(t,e){t===void 0&&(t=[]),e===void 0&&(e="react-datepicker__day--holidays");var n=new Map;return t.forEach(function(s){var a=s.date,r=s.holidayName;if(tr(a)){var i=Dn(a,"MM.dd.yyyy"),c=n.get(i)||{className:"",holidayNames:[]};if(!("className"in c&&c.className===e&&dU(c.holidayNames,[r]))){c.className=e;var d=c.holidayNames;c.holidayNames=d?Za(Za([],d,!0),[r],!1):[r],n.set(i,c)}}}),n}function pU(t,e,n,s,a){for(var r=a.length,i=[],c=0;c<r;c++){var d=t,f=a[c];f&&(d=pz(d,bs(f)),d=Su(d,xs(f)),d=gz(d,wi(f)));var h=Su(t,(n+1)*s);Or(d,e)&&Ja(d,h)&&f!=null&&i.push(f)}return i}function ol(t){return t<10?"0".concat(t):"".concat(t)}function _r(t,e){e===void 0&&(e=Ou);var n=Math.ceil(Jt(t)/e)*e,s=n-(e-1);return{startPeriod:s,endPeriod:n}}function hU(t){var e=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),24);return Math.round((+n-+e)/36e5)}function tA(t){var e=t.getSeconds(),n=t.getMilliseconds();return St(t.getTime()-e*1e3-n)}function K1(t,e){return tA(t).getTime()===tA(e).getTime()}function nA(t){if(!tr(t))throw new Error("Invalid date");var e=new Date(t);return e.setHours(0,0,0,0),e}function zg(t,e){if(!tr(t)||!tr(e))throw new Error("Invalid date received");var n=nA(t),s=nA(e);return Ja(n,s)}function Q1(t){return t.key===dt.Space}var $g=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.inputRef=Ce.createRef(),s.onTimeChange=function(a){var r,i;s.setState({time:a});var c=s.props.date,d=c instanceof Date&&!isNaN(+c),f=d?c:new Date;if(a!=null&&a.includes(":")){var h=a.split(":"),m=h[0],x=h[1];f.setHours(Number(m)),f.setMinutes(Number(x))}(i=(r=s.props).onChange)===null||i===void 0||i.call(r,f)},s.renderTimeInput=function(){var a=s.state.time,r=s.props,i=r.date,c=r.timeString,d=r.customTimeInput;return d?b.cloneElement(d,{date:i,value:a,onChange:s.onTimeChange}):Ce.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",ref:s.inputRef,onClick:function(){var f;(f=s.inputRef.current)===null||f===void 0||f.focus()},required:!0,value:a,onChange:function(f){s.onTimeChange(f.target.value||c)}})},s.state={time:s.props.timeString},s}return e.getDerivedStateFromProps=function(n,s){return n.timeString!==s.time?{time:n.timeString}:null},e.prototype.render=function(){return Ce.createElement("div",{className:"react-datepicker__input-time-container"},Ce.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),Ce.createElement("div",{className:"react-datepicker-time__input-container"},Ce.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))},e})(b.Component),mU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.dayEl=b.createRef(),n.handleClick=function(s){!n.isDisabled()&&n.props.onClick&&n.props.onClick(s)},n.handleMouseEnter=function(s){!n.isDisabled()&&n.props.onMouseEnter&&n.props.onMouseEnter(s)},n.handleOnKeyDown=function(s){var a,r,i=s.key;i===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(r=(a=n.props).handleOnKeyDown)===null||r===void 0||r.call(a,s)},n.isSameDay=function(s){return an(n.props.day,s)},n.isKeyboardSelected=function(){var s;if(n.props.disabledKeyboardNavigation)return!1;var a=n.props.selectsMultiple?(s=n.props.selectedDates)===null||s===void 0?void 0:s.some(function(i){return n.isSameDayOrWeek(i)}):n.isSameDayOrWeek(n.props.selected),r=n.props.preSelection&&n.isDisabled(n.props.preSelection);return!a&&n.isSameDayOrWeek(n.props.preSelection)&&!r},n.isDisabled=function(s){return s===void 0&&(s=n.props.day),xa(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate,disabled:n.props.disabled})},n.isExcluded=function(){return Yx(n.props.day,{excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals})},n.isStartOfWeek=function(){return an(n.props.day,ki(n.props.day,n.props.locale,n.props.calendarStartDay))},n.isSameWeek=function(s){return n.props.showWeekPicker&&an(s,ki(n.props.day,n.props.locale,n.props.calendarStartDay))},n.isSameDayOrWeek=function(s){return n.isSameDay(s)||n.isSameWeek(s)},n.getHighLightedClass=function(){var s=n.props,a=s.day,r=s.highlightDates;if(!r)return!1;var i=Dn(a,"MM.dd.yyyy");return r.get(i)},n.getHolidaysClass=function(){var s,a=n.props,r=a.day,i=a.holidays;if(!i)return[void 0];var c=Dn(r,"MM.dd.yyyy");return i.has(c)?[(s=i.get(c))===null||s===void 0?void 0:s.className]:[void 0]},n.isInRange=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:so(a,r,i)},n.isInSelectingRange=function(){var s,a=n.props,r=a.day,i=a.selectsStart,c=a.selectsEnd,d=a.selectsRange,f=a.selectsDisabledDaysInRange,h=a.startDate,m=a.swapRange,x=a.endDate,y=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;if(n.isAfterMonth()||n.isBeforeMonth()||!(i||c||d)||!y||!f&&n.isDisabled())return!1;if(i&&x&&(Ja(y,x)||oo(y,x)))return so(r,y,x);if(c&&h&&(Or(y,h)||oo(y,h)))return so(r,h,y);if(d&&h&&!x){if(oo(y,h)||Or(y,h))return so(r,h,y);if(m&&Ja(y,h))return so(r,y,h)}return!1},n.isSelectingRangeStart=function(){var s;if(!n.isInSelectingRange())return!1;var a=n.props,r=a.day,i=a.startDate,c=a.selectsStart,d=a.swapRange,f=a.selectsRange,h=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;return c?an(r,h):f&&d&&i&&h?an(r,Ja(h,i)?h:i):an(r,i)},n.isSelectingRangeEnd=function(){var s;if(!n.isInSelectingRange())return!1;var a=n.props,r=a.day,i=a.endDate,c=a.selectsEnd,d=a.selectsRange,f=a.swapRange,h=a.startDate,m=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;return c?an(r,m):d&&f&&h&&m?an(r,Ja(m,h)?h:m):d?an(r,m):an(r,i)},n.isRangeStart=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:an(r,a)},n.isRangeEnd=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:an(i,a)},n.isWeekend=function(){var s=h$(n.props.day);return s===0||s===6},n.isAfterMonth=function(){return n.props.month!==void 0&&(n.props.month+1)%12===zs(n.props.day)},n.isBeforeMonth=function(){return n.props.month!==void 0&&(zs(n.props.day)+1)%12===n.props.month},n.isCurrentDay=function(){return n.isSameDay(ln())},n.isSelected=function(){var s;return n.props.selectsMultiple?(s=n.props.selectedDates)===null||s===void 0?void 0:s.some(function(a){return n.isSameDayOrWeek(a)}):n.isSameDayOrWeek(n.props.selected)},n.getClassNames=function(s){var a=n.props.dayClassName?n.props.dayClassName(s):void 0;return as("react-datepicker__day",a,"react-datepicker__day--"+ZH(n.props.day),{"react-datepicker__day--disabled":n.isDisabled(),"react-datepicker__day--excluded":n.isExcluded(),"react-datepicker__day--selected":n.isSelected(),"react-datepicker__day--keyboard-selected":n.isKeyboardSelected(),"react-datepicker__day--range-start":n.isRangeStart(),"react-datepicker__day--range-end":n.isRangeEnd(),"react-datepicker__day--in-range":n.isInRange(),"react-datepicker__day--in-selecting-range":n.isInSelectingRange(),"react-datepicker__day--selecting-range-start":n.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":n.isSelectingRangeEnd(),"react-datepicker__day--today":n.isCurrentDay(),"react-datepicker__day--weekend":n.isWeekend(),"react-datepicker__day--outside-month":n.isAfterMonth()||n.isBeforeMonth()},n.getHighLightedClass(),n.getHolidaysClass())},n.getAriaLabel=function(){var s=n.props,a=s.day,r=s.ariaLabelPrefixWhenEnabled,i=r===void 0?"Choose":r,c=s.ariaLabelPrefixWhenDisabled,d=c===void 0?"Not available":c,f=n.isDisabled()||n.isExcluded()?d:i;return"".concat(f," ").concat(Dn(a,"PPPP",n.props.locale))},n.getTitle=function(){var s=n.props,a=s.day,r=s.holidays,i=r===void 0?new Map:r,c=s.excludeDates,d=Dn(a,"MM.dd.yyyy"),f=[];return i.has(d)&&f.push.apply(f,i.get(d).holidayNames),n.isExcluded()&&f.push(c==null?void 0:c.filter(function(h){return h instanceof Date?an(h,a):an(h==null?void 0:h.date,a)}).map(function(h){if(!(h instanceof Date))return h==null?void 0:h.message})),f.join(", ")},n.getTabIndex=function(){var s=n.props.selected,a=n.props.preSelection,r=!(n.props.showWeekPicker&&(n.props.showWeekNumber||!n.isStartOfWeek()))&&(n.isKeyboardSelected()||n.isSameDay(s)&&an(a,s))?0:-1;return r},n.handleFocusDay=function(){var s;n.shouldFocusDay()&&((s=n.dayEl.current)===null||s===void 0||s.focus({preventScroll:!0}))},n.renderDayContents=function(){return n.props.monthShowsDuplicateDaysEnd&&n.isAfterMonth()||n.props.monthShowsDuplicateDaysStart&&n.isBeforeMonth()?null:n.props.renderDayContents?n.props.renderDayContents(EC(n.props.day),n.props.day):EC(n.props.day)},n.render=function(){return Ce.createElement("div",{ref:n.dayEl,className:n.getClassNames(n.props.day),onKeyDown:n.handleOnKeyDown,onClick:n.handleClick,onMouseEnter:n.props.usePointerEvent?void 0:n.handleMouseEnter,onPointerEnter:n.props.usePointerEvent?n.handleMouseEnter:void 0,tabIndex:n.getTabIndex(),"aria-label":n.getAriaLabel(),role:"gridcell",title:n.getTitle(),"aria-disabled":n.isDisabled(),"aria-current":n.isCurrentDay()?"date":void 0,"aria-selected":n.isSelected()||n.isInRange()},n.renderDayContents(),n.getTitle()!==""&&Ce.createElement("span",{className:"overlay"},n.getTitle()))},n}return e.prototype.componentDidMount=function(){this.handleFocusDay()},e.prototype.componentDidUpdate=function(){this.handleFocusDay()},e.prototype.shouldFocusDay=function(){var n=!1;return this.getTabIndex()===0&&this.isSameDay(this.props.preSelection)&&((!document.activeElement||document.activeElement===document.body)&&(n=!0),this.props.inline&&!this.props.shouldFocusDayInline&&(n=!1),this.isDayActiveElement()&&(n=!0),this.isDuplicateDay()&&(n=!1)),n},e.prototype.isDayActiveElement=function(){var n,s,a;return((s=(n=this.props.containerRef)===null||n===void 0?void 0:n.current)===null||s===void 0?void 0:s.contains(document.activeElement))&&((a=document.activeElement)===null||a===void 0?void 0:a.classList.contains("react-datepicker__day"))},e.prototype.isDuplicateDay=function(){return this.props.monthShowsDuplicateDaysEnd&&this.isAfterMonth()||this.props.monthShowsDuplicateDaysStart&&this.isBeforeMonth()},e})(b.Component),gU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.weekNumberEl=b.createRef(),n.handleClick=function(s){n.props.onClick&&n.props.onClick(s)},n.handleOnKeyDown=function(s){var a,r,i=s.key;i===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(r=(a=n.props).handleOnKeyDown)===null||r===void 0||r.call(a,s)},n.isKeyboardSelected=function(){return!n.props.disabledKeyboardNavigation&&!an(n.props.date,n.props.selected)&&an(n.props.date,n.props.preSelection)},n.getTabIndex=function(){return n.props.showWeekPicker&&n.props.showWeekNumber&&(n.isKeyboardSelected()||an(n.props.date,n.props.selected)&&an(n.props.preSelection,n.props.selected))?0:-1},n.handleFocusWeekNumber=function(s){var a=!1;n.getTabIndex()===0&&!(s!=null&&s.isInputFocused)&&an(n.props.date,n.props.preSelection)&&((!document.activeElement||document.activeElement===document.body)&&(a=!0),n.props.inline&&!n.props.shouldFocusDayInline&&(a=!1),n.props.containerRef&&n.props.containerRef.current&&n.props.containerRef.current.contains(document.activeElement)&&document.activeElement&&document.activeElement.classList.contains("react-datepicker__week-number")&&(a=!0)),a&&n.weekNumberEl.current&&n.weekNumberEl.current.focus({preventScroll:!0})},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{ariaLabelPrefix:"week "}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){this.handleFocusWeekNumber()},e.prototype.componentDidUpdate=function(n){this.handleFocusWeekNumber(n)},e.prototype.render=function(){var n=this.props,s=n.weekNumber,a=n.isWeekDisabled,r=n.ariaLabelPrefix,i=r===void 0?e.defaultProps.ariaLabelPrefix:r,c=n.onClick,d={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!c&&!a,"react-datepicker__week-number--selected":!!c&&an(this.props.date,this.props.selected)};return Ce.createElement("div",{ref:this.weekNumberEl,className:as(d),"aria-label":"".concat(i," ").concat(this.props.weekNumber),onClick:this.handleClick,onKeyDown:this.handleOnKeyDown,tabIndex:this.getTabIndex(),role:"gridcell"},s)},e})(b.Component),bU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.isDisabled=function(s){return xa(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate})},n.handleDayClick=function(s,a){n.props.onDayClick&&n.props.onDayClick(s,a)},n.handleDayMouseEnter=function(s){n.props.onDayMouseEnter&&n.props.onDayMouseEnter(s)},n.handleWeekClick=function(s,a,r){for(var i,c,d,f=new Date(s),h=0;h<7;h++){var m=new Date(s);m.setDate(m.getDate()+h);var x=!n.isDisabled(m);if(x){f=m;break}}typeof n.props.onWeekSelect=="function"&&n.props.onWeekSelect(f,a,r),n.props.showWeekPicker&&n.handleDayClick(f,r),((i=n.props.shouldCloseOnSelect)!==null&&i!==void 0?i:e.defaultProps.shouldCloseOnSelect)&&((d=(c=n.props).setOpen)===null||d===void 0||d.call(c,!1))},n.formatWeekNumber=function(s){return n.props.formatWeekNumber?n.props.formatWeekNumber(s):JH(s)},n.isWeekDisabled=function(){for(var s=n.startOfWeek(),a=Da(s,6),r=new Date(s);r<=a;){if(!n.isDisabled(r))return!1;r=Da(r,1)}return!0},n.renderDays=function(){var s=n.startOfWeek(),a=[],r=n.formatWeekNumber(s);if(n.props.showWeekNumber){var i=n.props.onWeekSelect||n.props.showWeekPicker?n.handleWeekClick.bind(n,s,r):void 0;a.push(Ce.createElement(gU,qt({key:"W"},e.defaultProps,n.props,{weekNumber:r,isWeekDisabled:n.isWeekDisabled(),date:s,onClick:i})))}return a.concat([0,1,2,3,4,5,6].map(function(c){var d=Da(s,c);return Ce.createElement(mU,qt({},e.defaultProps,n.props,{ariaLabelPrefixWhenEnabled:n.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:n.props.disabledDayAriaLabelPrefix,key:d.valueOf(),day:d,onClick:n.handleDayClick.bind(n,d),onMouseEnter:n.handleDayMouseEnter.bind(n,d)}))}))},n.startOfWeek=function(){return ki(n.props.day,n.props.locale,n.props.calendarStartDay)},n.isKeyboardSelected=function(){return!n.props.disabledKeyboardNavigation&&!an(n.startOfWeek(),n.props.selected)&&an(n.startOfWeek(),n.props.preSelection)},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{shouldCloseOnSelect:!0}},enumerable:!1,configurable:!0}),e.prototype.render=function(){var n={"react-datepicker__week":!0,"react-datepicker__week--selected":an(this.startOfWeek(),this.props.selected),"react-datepicker__week--keyboard-selected":this.isKeyboardSelected()},s=this.props.weekClassName?this.props.weekClassName(this.startOfWeek()):void 0;return Ce.createElement("div",{className:as(n,s),role:"row"},this.renderDays())},e})(b.Component),qc,xU=6,yl={TWO_COLUMNS:"two_columns",THREE_COLUMNS:"three_columns",FOUR_COLUMNS:"four_columns"},Hg=(qc={},qc[yl.TWO_COLUMNS]={grid:[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]],verticalNavigationOffset:2},qc[yl.THREE_COLUMNS]={grid:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]],verticalNavigationOffset:3},qc[yl.FOUR_COLUMNS]={grid:[[0,1,2,3],[4,5,6,7],[8,9,10,11]],verticalNavigationOffset:4},qc),mf=1;function sA(t,e){return t?yl.FOUR_COLUMNS:e?yl.TWO_COLUMNS:yl.THREE_COLUMNS}var yU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.MONTH_REFS=Za([],Array(12),!0).map(function(){return b.createRef()}),n.QUARTER_REFS=Za([],Array(4),!0).map(function(){return b.createRef()}),n.isDisabled=function(s){return xa(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate,disabled:n.props.disabled})},n.isExcluded=function(s){return Yx(s,{excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals})},n.handleDayClick=function(s,a){var r,i;(i=(r=n.props).onDayClick)===null||i===void 0||i.call(r,s,a,n.props.orderInDisplay)},n.handleDayMouseEnter=function(s){var a,r;(r=(a=n.props).onDayMouseEnter)===null||r===void 0||r.call(a,s)},n.handleMouseLeave=function(){var s,a;(a=(s=n.props).onMouseLeave)===null||a===void 0||a.call(s)},n.isRangeStartMonth=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:As(Zs(r,s),i)},n.isRangeStartQuarter=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:op(fl(r,s),i)},n.isRangeEndMonth=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:As(Zs(r,s),c)},n.isRangeEndQuarter=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:op(fl(r,s),c)},n.isInSelectingRangeMonth=function(s){var a,r=n.props,i=r.day,c=r.selectsStart,d=r.selectsEnd,f=r.selectsRange,h=r.startDate,m=r.endDate,x=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return!(c||d||f)||!x?!1:c&&m?df(x,m,s,i):d&&h||f&&h&&!m?df(h,x,s,i):!1},n.isSelectingMonthRangeStart=function(s){var a;if(!n.isInSelectingRangeMonth(s))return!1;var r=n.props,i=r.day,c=r.startDate,d=r.selectsStart,f=Zs(i,s),h=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d?As(f,h):As(f,c)},n.isSelectingMonthRangeEnd=function(s){var a;if(!n.isInSelectingRangeMonth(s))return!1;var r=n.props,i=r.day,c=r.endDate,d=r.selectsEnd,f=r.selectsRange,h=Zs(i,s),m=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d||f?As(h,m):As(h,c)},n.isInSelectingRangeQuarter=function(s){var a,r=n.props,i=r.day,c=r.selectsStart,d=r.selectsEnd,f=r.selectsRange,h=r.startDate,m=r.endDate,x=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return!(c||d||f)||!x?!1:c&&m?hf(x,m,s,i):d&&h||f&&h&&!m?hf(h,x,s,i):!1},n.isWeekInMonth=function(s){var a=n.props.day,r=Da(s,6);return As(s,a)||As(r,a)},n.isCurrentMonth=function(s,a){return Jt(s)===Jt(ln())&&a===zs(ln())},n.isCurrentQuarter=function(s,a){return Jt(s)===Jt(ln())&&a===vi(ln())},n.isSelectedMonth=function(s,a,r){return zs(r)===a&&Jt(s)===Jt(r)},n.isSelectMonthInList=function(s,a,r){return r.some(function(i){return n.isSelectedMonth(s,a,i)})},n.isSelectedQuarter=function(s,a,r){return vi(r)===a&&Jt(s)===Jt(r)},n.isSelectQuarterInList=function(s,a,r){return r.some(function(i){return n.isSelectedQuarter(s,a,i)})},n.isMonthSelected=function(){var s=n.props,a=s.day,r=s.selected,i=s.selectedDates,c=s.selectsMultiple,d=zs(a);return c?i==null?void 0:i.some(function(f){return n.isSelectedMonth(a,d,f)}):!!r&&n.isSelectedMonth(a,d,r)},n.isQuarterSelected=function(){var s=n.props,a=s.day,r=s.selected,i=s.selectedDates,c=s.selectsMultiple,d=vi(a);return c?i==null?void 0:i.some(function(f){return n.isSelectedQuarter(a,d,f)}):!!r&&n.isSelectedQuarter(a,d,r)},n.renderWeeks=function(){if(!Fs(n.props.day))return[];for(var s=[],a=n.props.fixedHeight,r=0,i=!1,c=ki(Lr(n.props.day),n.props.locale,n.props.calendarStartDay),d=function(v){return n.props.showWeekPicker?ki(v,n.props.locale,n.props.calendarStartDay):n.props.preSelection},f=function(v){return n.props.showWeekPicker?ki(v,n.props.locale,n.props.calendarStartDay):n.props.selected},h=n.props.selected?f(n.props.selected):void 0,m=n.props.preSelection?d(n.props.preSelection):void 0;s.push(Ce.createElement(bU,qt({},n.props,{ariaLabelPrefix:n.props.weekAriaLabelPrefix,key:r,day:c,month:zs(n.props.day),onDayClick:n.handleDayClick,onDayMouseEnter:n.handleDayMouseEnter,selected:h,preSelection:m,showWeekNumber:n.props.showWeekNumbers}))),!i;){r++,c=Xf(c,1);var x=a&&r>=xU,y=!a&&!n.isWeekInMonth(c);if(x||y)if(n.props.peekNextMonth)i=!0;else break}return s},n.onMonthClick=function(s,a){var r=n.isMonthDisabledForLabelDate(a),i=r.isDisabled,c=r.labelDate;i||n.handleDayClick(Lr(c),s)},n.onMonthMouseEnter=function(s){var a=n.isMonthDisabledForLabelDate(s),r=a.isDisabled,i=a.labelDate;r||n.handleDayMouseEnter(Lr(i))},n.handleMonthNavigation=function(s,a){var r,i,c,d;(i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,a),(d=(c=n.MONTH_REFS[s])===null||c===void 0?void 0:c.current)===null||d===void 0||d.focus()},n.handleKeyboardNavigation=function(s,a,r){var i,c=n.props,d=c.selected,f=c.preSelection,h=c.setPreSelection,m=c.minDate,x=c.maxDate,y=c.showFourColumnMonthYearPicker,v=c.showTwoColumnMonthYearPicker;if(f){var S=sA(y,v),C=n.getVerticalOffset(S),k=(i=Hg[S])===null||i===void 0?void 0:i.grid,N=function(P,O,T){var M,R,I=O,z=T;switch(P){case dt.ArrowRight:I=Oa(O,mf),z=T===11?0:T+mf;break;case dt.ArrowLeft:I=lo(O,mf),z=T===0?11:T-mf;break;case dt.ArrowUp:I=lo(O,C),z=!((M=k==null?void 0:k[0])===null||M===void 0)&&M.includes(T)?T+12-C:T-C;break;case dt.ArrowDown:I=Oa(O,C),z=!((R=k==null?void 0:k[k.length-1])===null||R===void 0)&&R.includes(T)?T-12+C:T+C;break}return{newCalculatedDate:I,newCalculatedMonth:z}},j=function(P,O,T){for(var M=40,R=P,I=!1,z=0,W=N(R,O,T),$=W.newCalculatedDate,F=W.newCalculatedMonth;!I;){if(z>=M){$=O,F=T;break}if(m&&$<m){R=dt.ArrowRight;var H=N(R,$,F);$=H.newCalculatedDate,F=H.newCalculatedMonth}if(x&&$>x){R=dt.ArrowLeft;var H=N(R,$,F);$=H.newCalculatedDate,F=H.newCalculatedMonth}if(iU($,n.props)){var H=N(R,$,F);$=H.newCalculatedDate,F=H.newCalculatedMonth}else I=!0;z++}return{newCalculatedDate:$,newCalculatedMonth:F}};if(a===dt.Enter){n.isMonthDisabled(r)||(n.onMonthClick(s,r),h==null||h(d));return}var E=j(a,f,r),D=E.newCalculatedDate,_=E.newCalculatedMonth;switch(a){case dt.ArrowRight:case dt.ArrowLeft:case dt.ArrowUp:case dt.ArrowDown:n.handleMonthNavigation(_,D);break}}},n.getVerticalOffset=function(s){var a,r;return(r=(a=Hg[s])===null||a===void 0?void 0:a.verticalNavigationOffset)!==null&&r!==void 0?r:0},n.onMonthKeyDown=function(s,a){var r=n.props,i=r.disabledKeyboardNavigation,c=r.handleOnMonthKeyDown,d=s.key;d!==dt.Tab&&s.preventDefault(),i||n.handleKeyboardNavigation(s,d,a),c&&c(s)},n.onQuarterClick=function(s,a){var r=fl(n.props.day,a);ff(r,n.props)||n.handleDayClick(WC(r),s)},n.onQuarterMouseEnter=function(s){var a=fl(n.props.day,s);ff(a,n.props)||n.handleDayMouseEnter(WC(a))},n.handleQuarterNavigation=function(s,a){var r,i,c,d;n.isDisabled(a)||n.isExcluded(a)||((i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,a),(d=(c=n.QUARTER_REFS[s-1])===null||c===void 0?void 0:c.current)===null||d===void 0||d.focus())},n.onQuarterKeyDown=function(s,a){var r,i,c=s.key;if(!n.props.disabledKeyboardNavigation)switch(c){case dt.Enter:n.onQuarterClick(s,a),(i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,n.props.selected);break;case dt.ArrowRight:if(!n.props.preSelection)break;n.handleQuarterNavigation(a===4?1:a+1,Px(n.props.preSelection,1));break;case dt.ArrowLeft:if(!n.props.preSelection)break;n.handleQuarterNavigation(a===1?4:a-1,_1(n.props.preSelection));break}},n.isMonthDisabledForLabelDate=function(s){var a,r=n.props,i=r.day,c=r.disabled,d=r.minDate,f=r.maxDate,h=r.excludeDates,m=r.includeDates,x=Zs(i,s);return c?{isDisabled:!0,labelDate:Zs(i,s)}:{isDisabled:(a=(d||f||h||m)&&V1(x,n.props))!==null&&a!==void 0?a:!1,labelDate:x}},n.isMonthDisabled=function(s){var a=n.isMonthDisabledForLabelDate(s).isDisabled;return a},n.getMonthClassNames=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate,d=a.preSelection,f=a.monthClassName,h=f?f(Zs(r,s)):void 0,m=n.getSelection();return as("react-datepicker__month-text","react-datepicker__month-".concat(s),h,{"react-datepicker__month-text--disabled":n.isMonthDisabled(s),"react-datepicker__month-text--selected":m?n.isSelectMonthInList(r,s,m):void 0,"react-datepicker__month-text--keyboard-selected":!n.props.disabledKeyboardNavigation&&d&&n.isSelectedMonth(r,s,d)&&!n.isMonthSelected()&&!n.isMonthDisabled(s),"react-datepicker__month-text--in-selecting-range":n.isInSelectingRangeMonth(s),"react-datepicker__month-text--in-range":i&&c?df(i,c,s,r):void 0,"react-datepicker__month-text--range-start":n.isRangeStartMonth(s),"react-datepicker__month-text--range-end":n.isRangeEndMonth(s),"react-datepicker__month-text--selecting-range-start":n.isSelectingMonthRangeStart(s),"react-datepicker__month-text--selecting-range-end":n.isSelectingMonthRangeEnd(s),"react-datepicker__month-text--today":n.isCurrentMonth(r,s)})},n.getTabIndex=function(s){if(n.props.preSelection==null)return"-1";var a=zs(n.props.preSelection),r=n.isMonthDisabledForLabelDate(a).isDisabled,i=s===a&&!(r||n.props.disabledKeyboardNavigation)?"0":"-1";return i},n.getQuarterTabIndex=function(s){if(n.props.preSelection==null)return"-1";var a=vi(n.props.preSelection),r=ff(n.props.day,n.props),i=s===a&&!(r||n.props.disabledKeyboardNavigation)?"0":"-1";return i},n.getAriaLabel=function(s){var a=n.props,r=a.chooseDayAriaLabelPrefix,i=r===void 0?"Choose":r,c=a.disabledDayAriaLabelPrefix,d=c===void 0?"Not available":c,f=a.day,h=a.locale,m=Zs(f,s),x=n.isDisabled(m)||n.isExcluded(m)?d:i;return"".concat(x," ").concat(Dn(m,"MMMM yyyy",h))},n.getQuarterClassNames=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate,d=a.minDate,f=a.maxDate,h=a.excludeDates,m=a.includeDates,x=a.filterDate,y=a.preSelection,v=a.disabledKeyboardNavigation,S=a.disabled,C=(d||f||h||m||x||S)&&ff(fl(r,s),n.props),k=n.getSelection();return as("react-datepicker__quarter-text","react-datepicker__quarter-".concat(s),{"react-datepicker__quarter-text--disabled":C,"react-datepicker__quarter-text--selected":k?n.isSelectQuarterInList(r,s,k):void 0,"react-datepicker__quarter-text--keyboard-selected":!v&&y&&n.isSelectedQuarter(r,s,y)&&!n.isQuarterSelected()&&!C,"react-datepicker__quarter-text--in-selecting-range":n.isInSelectingRangeQuarter(s),"react-datepicker__quarter-text--in-range":i&&c?hf(i,c,s,r):void 0,"react-datepicker__quarter-text--range-start":n.isRangeStartQuarter(s),"react-datepicker__quarter-text--range-end":n.isRangeEndQuarter(s),"react-datepicker__quarter-text--today":n.isCurrentQuarter(r,s)})},n.getMonthContent=function(s){var a=n.props,r=a.showFullMonthYearPicker,i=a.renderMonthContent,c=a.locale,d=a.day,f=q1(s,c),h=Gx(s,c);return i?i(s,f,h,d):r?h:f},n.getQuarterContent=function(s){var a,r=n.props,i=r.renderQuarterContent,c=r.locale,d=rU(s,c);return(a=i==null?void 0:i(s,d))!==null&&a!==void 0?a:d},n.renderMonths=function(){var s,a=n.props,r=a.showTwoColumnMonthYearPicker,i=a.showFourColumnMonthYearPicker,c=a.day,d=a.selected,f=(s=Hg[sA(i,r)])===null||s===void 0?void 0:s.grid;return f==null?void 0:f.map(function(h,m){return Ce.createElement("div",{className:"react-datepicker__month-wrapper",key:m},h.map(function(x,y){return Ce.createElement("div",{ref:n.MONTH_REFS[x],key:y,onClick:function(v){n.onMonthClick(v,x)},onKeyDown:function(v){Q1(v)&&(v.preventDefault(),v.key=dt.Enter),n.onMonthKeyDown(v,x)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onMonthMouseEnter(x)},onPointerEnter:n.props.usePointerEvent?function(){return n.onMonthMouseEnter(x)}:void 0,tabIndex:Number(n.getTabIndex(x)),className:n.getMonthClassNames(x),"aria-disabled":n.isMonthDisabled(x),role:"option","aria-label":n.getAriaLabel(x),"aria-current":n.isCurrentMonth(c,x)?"date":void 0,"aria-selected":d?n.isSelectedMonth(c,x,d):void 0},n.getMonthContent(x))}))})},n.renderQuarters=function(){var s=n.props,a=s.day,r=s.selected,i=[1,2,3,4];return Ce.createElement("div",{className:"react-datepicker__quarter-wrapper"},i.map(function(c,d){return Ce.createElement("div",{key:d,ref:n.QUARTER_REFS[d],role:"option",onClick:function(f){n.onQuarterClick(f,c)},onKeyDown:function(f){n.onQuarterKeyDown(f,c)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onQuarterMouseEnter(c)},onPointerEnter:n.props.usePointerEvent?function(){return n.onQuarterMouseEnter(c)}:void 0,className:n.getQuarterClassNames(c),"aria-selected":r?n.isSelectedQuarter(a,c,r):void 0,tabIndex:Number(n.getQuarterTabIndex(c)),"aria-current":n.isCurrentQuarter(a,c)?"date":void 0},n.getQuarterContent(c))}))},n.getClassNames=function(){var s=n.props,a=s.selectingDate,r=s.selectsStart,i=s.selectsEnd,c=s.showMonthYearPicker,d=s.showQuarterYearPicker,f=s.showWeekPicker;return as("react-datepicker__month",{"react-datepicker__month--selecting-range":a&&(r||i)},{"react-datepicker__monthPicker":c},{"react-datepicker__quarterPicker":d},{"react-datepicker__weekPicker":f})},n}return e.prototype.getSelection=function(){var n=this.props,s=n.selected,a=n.selectedDates,r=n.selectsMultiple;if(r)return a;if(s)return[s]},e.prototype.render=function(){var n=this.props,s=n.showMonthYearPicker,a=n.showQuarterYearPicker,r=n.day,i=n.ariaLabelPrefix,c=i===void 0?"Month ":i,d=c?c.trim()+" ":"",f=Fs(r)?"".concat(d).concat(Dn(r,"MMMM, yyyy",this.props.locale)):"",h=s||a;return h?Ce.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":f,role:"listbox"},s?this.renderMonths():this.renderQuarters()):Ce.createElement("div",{role:"table"},this.props.dayNamesHeader&&Ce.createElement("div",{role:"rowgroup"},this.props.dayNamesHeader),this.props.monthHeader&&Ce.createElement("div",{role:"rowgroup"},this.props.monthHeader),Ce.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":f,role:"rowgroup"},this.renderWeeks()),this.props.monthFooter&&Ce.createElement("div",{role:"rowgroup"},this.props.monthFooter))},e})(b.Component),vU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.monthOptionButtonsRef={},n.isSelectedMonth=function(s){return n.props.month===s},n.handleOptionKeyDown=function(s,a){var r;switch(a.key){case"Enter":a.preventDefault(),n.onChange(s);break;case"Escape":a.preventDefault(),n.props.onCancel();break;case"ArrowUp":case"ArrowDown":{a.preventDefault();var i=(s+(a.key==="ArrowUp"?-1:1)+n.props.monthNames.length)%n.props.monthNames.length;(r=n.monthOptionButtonsRef[i])===null||r===void 0||r.focus();break}}},n.renderOptions=function(){return n.monthOptionButtonsRef={},n.props.monthNames.map(function(s,a){return Ce.createElement("div",{ref:function(r){n.monthOptionButtonsRef[a]=r,n.isSelectedMonth(a)&&(r==null||r.focus())},role:"button",tabIndex:0,className:n.isSelectedMonth(a)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:s,onClick:n.onChange.bind(n,a),onKeyDown:n.handleOptionKeyDown.bind(n,a),"aria-selected":n.isSelectedMonth(a)?"true":void 0},n.isSelectedMonth(a)?Ce.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",s)})},n.onChange=function(s){return n.props.onChange(s)},n.handleClickOutside=function(){return n.props.onCancel()},n}return e.prototype.render=function(){return Ce.createElement(Ip,{className:"react-datepicker__month-dropdown",onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),wU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(s){return s.map(function(a,r){return Ce.createElement("option",{key:a,value:r},a)})},n.renderSelectMode=function(s){return Ce.createElement("select",{value:n.props.month,className:"react-datepicker__month-select",onChange:function(a){return n.onChange(parseInt(a.target.value))}},n.renderSelectOptions(s))},n.renderReadView=function(s,a){return Ce.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},a[n.props.month]))},n.renderDropdown=function(s){return Ce.createElement(vU,qt({key:"dropdown"},n.props,{monthNames:s,onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(s){var a=n.state.dropdownVisible,r=[n.renderReadView(!a,s)];return a&&r.unshift(n.renderDropdown(s)),r},n.onChange=function(s){n.toggleDropdown(),s!==n.props.month&&n.props.onChange(s)},n.toggleDropdown=function(){return n.setState({dropdownVisible:!n.state.dropdownVisible})},n}return e.prototype.render=function(){var n=this,s=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(r){return q1(r,n.props.locale)}:function(r){return Gx(r,n.props.locale)}),a;switch(this.props.dropdownMode){case"scroll":a=this.renderScrollMode(s);break;case"select":a=this.renderSelectMode(s);break}return Ce.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},a)},e})(b.Component),aA=5;function kU(t,e,n){for(var s=[],a=t??Ci(n,aA),r=e??Ra(n,aA),i=Lr(a),c=Lr(r);!Or(i,c);)s.push(ln(i)),i=Oa(i,1);return s}var SU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.renderOptions=function(){return s.state.monthYearsList.map(function(a){var r=$b(a),i=Va(s.props.date,a)&&As(s.props.date,a);return Ce.createElement("div",{className:i?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:r,onClick:s.onChange.bind(s,r),"aria-selected":i?"true":void 0},i?Ce.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Dn(a,s.props.dateFormat,s.props.locale))})},s.onChange=function(a){return s.props.onChange(a)},s.handleClickOutside=function(){s.props.onCancel()},s.state={monthYearsList:kU(s.props.minDate,s.props.maxDate,s.props.date)},s}return e.prototype.render=function(){var n=as({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return Ce.createElement(Ip,{className:n,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),rA=5,CU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(){for(var s,a,r=(s=n.props.minDate)!==null&&s!==void 0?s:Ci(n.props.date,rA),i=(a=n.props.maxDate)!==null&&a!==void 0?a:Ra(n.props.date,rA),c=Lr(r),d=Lr(i),f=[];!Or(c,d);){var h=$b(c);f.push(Ce.createElement("option",{key:h,value:h},Dn(c,n.props.dateFormat,n.props.locale))),c=Oa(c,1)}return f},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return Ce.createElement("select",{value:$b(Lr(n.props.date)),className:"react-datepicker__month-year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){var a=Dn(n.props.date,n.props.dateFormat,n.props.locale);return Ce.createElement("div",{key:"read",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},a))},n.renderDropdown=function(){return Ce.createElement(SU,qt({key:"dropdown"},n.props,{onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(){var s=n.state.dropdownVisible,a=[n.renderReadView(!s)];return s&&a.unshift(n.renderDropdown()),a},n.onChange=function(s){n.toggleDropdown();var a=ln(s);Va(n.props.date,a)&&As(n.props.date,a)||n.props.onChange(a)},n.toggleDropdown=function(){return n.setState({dropdownVisible:!n.state.dropdownVisible})},n}return e.prototype.render=function(){var n;switch(this.props.dropdownMode){case"scroll":n=this.renderScrollMode();break;case"select":n=this.renderSelectMode();break}return Ce.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),AU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={height:null},n.scrollToTheSelectedTime=function(){requestAnimationFrame(function(){var s,a,r;n.list&&(n.list.scrollTop=(r=n.centerLi&&e.calcCenterPosition(n.props.monthRef?n.props.monthRef.clientHeight-((a=(s=n.header)===null||s===void 0?void 0:s.clientHeight)!==null&&a!==void 0?a:0):n.list.clientHeight,n.centerLi))!==null&&r!==void 0?r:0)})},n.handleClick=function(s){var a,r;(n.props.minTime||n.props.maxTime)&&KC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&YC(s,n.props)||(r=(a=n.props).onChange)===null||r===void 0||r.call(a,s)},n.isSelectedTime=function(s){var a=io(n.props.selected);return a&&K1(a,s)},n.isDisabledTime=function(s){return(n.props.minTime||n.props.maxTime)&&KC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&YC(s,n.props)},n.liClasses=function(s){var a,r=["react-datepicker__time-list-item",n.props.timeClassName?n.props.timeClassName(s):void 0];return n.isSelectedTime(s)&&r.push("react-datepicker__time-list-item--selected"),n.isDisabledTime(s)&&r.push("react-datepicker__time-list-item--disabled"),n.props.injectTimes&&(bs(s)*3600+xs(s)*60+wi(s))%(((a=n.props.intervals)!==null&&a!==void 0?a:e.defaultProps.intervals)*60)!==0&&r.push("react-datepicker__time-list-item--injected"),r.join(" ")},n.handleOnKeyDown=function(s,a){var r,i;s.key===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(s.key===dt.ArrowUp||s.key===dt.ArrowLeft)&&s.target instanceof HTMLElement&&s.target.previousSibling&&(s.preventDefault(),s.target.previousSibling instanceof HTMLElement&&s.target.previousSibling.focus()),(s.key===dt.ArrowDown||s.key===dt.ArrowRight)&&s.target instanceof HTMLElement&&s.target.nextSibling&&(s.preventDefault(),s.target.nextSibling instanceof HTMLElement&&s.target.nextSibling.focus()),s.key===dt.Enter&&n.handleClick(a),(i=(r=n.props).handleOnKeyDown)===null||i===void 0||i.call(r,s)},n.renderTimes=function(){for(var s,a=[],r=typeof n.props.format=="string"?n.props.format:"p",i=(s=n.props.intervals)!==null&&s!==void 0?s:e.defaultProps.intervals,c=io(n.props.selected)||io(n.props.openToDate)||ln(),d=Qc(c),f=n.props.injectTimes&&n.props.injectTimes.sort(function(C,k){return C.getTime()-k.getTime()}),h=60*hU(c),m=h/i,x=0;x<m;x++){var y=Su(d,x*i);if(a.push(y),f){var v=pU(d,y,x,i,f);a=a.concat(v)}}var S=a.reduce(function(C,k){return k.getTime()<=c.getTime()?k:C},a[0]);return a.map(function(C){return Ce.createElement("li",{key:C.valueOf(),onClick:n.handleClick.bind(n,C),className:n.liClasses(C),ref:function(k){C===S&&(n.centerLi=k)},onKeyDown:function(k){n.handleOnKeyDown(k,C)},tabIndex:C===S?0:-1,role:"option","aria-selected":n.isSelectedTime(C)?"true":void 0,"aria-disabled":n.isDisabledTime(C)?"true":void 0},Dn(C,r,n.props.locale))})},n.renderTimeCaption=function(){return n.props.showTimeCaption===!1?Ce.createElement(Ce.Fragment,null):Ce.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(n.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(s){n.header=s}},Ce.createElement("div",{className:"react-datepicker-time__header"},n.props.timeCaption))},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{intervals:30,todayButton:null,timeCaption:"Time",showTimeCaption:!0}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){this.scrollToTheSelectedTime(),this.observeDatePickerHeightChanges()},e.prototype.componentWillUnmount=function(){var n;(n=this.resizeObserver)===null||n===void 0||n.disconnect()},e.prototype.observeDatePickerHeightChanges=function(){var n=this,s=this.props.monthRef;this.updateContainerHeight(),s&&(this.resizeObserver=new ResizeObserver(function(){n.updateContainerHeight()}),this.resizeObserver.observe(s))},e.prototype.updateContainerHeight=function(){if(this.props.monthRef&&this.header){var n=this.props.monthRef.clientHeight-this.header.clientHeight;this.state.height!==n&&this.setState({height:n})}},e.prototype.render=function(){var n=this,s,a=this.state.height;return Ce.createElement("div",{className:"react-datepicker__time-container ".concat(((s=this.props.todayButton)!==null&&s!==void 0?s:e.defaultProps.todayButton)?"react-datepicker__time-container--with-today-button":"")},this.renderTimeCaption(),Ce.createElement("div",{className:"react-datepicker__time"},Ce.createElement("div",{className:"react-datepicker__time-box"},Ce.createElement("ul",{className:"react-datepicker__time-list",ref:function(r){n.list=r},style:a?{height:a}:{},role:"listbox","aria-label":this.props.timeCaption},this.renderTimes()))))},e.calcCenterPosition=function(n,s){return s.offsetTop-(n/2-s.clientHeight/2)},e})(b.Component),iA=3,jU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.YEAR_REFS=Za([],Array(s.props.yearItemNumber),!0).map(function(){return b.createRef()}),s.isDisabled=function(a){return xa(a,{minDate:s.props.minDate,maxDate:s.props.maxDate,excludeDates:s.props.excludeDates,includeDates:s.props.includeDates,filterDate:s.props.filterDate})},s.isExcluded=function(a){return Yx(a,{excludeDates:s.props.excludeDates})},s.selectingDate=function(){var a;return(a=s.props.selectingDate)!==null&&a!==void 0?a:s.props.preSelection},s.updateFocusOnPaginate=function(a){var r=function(){var i,c;(c=(i=s.YEAR_REFS[a])===null||i===void 0?void 0:i.current)===null||c===void 0||c.focus()};window.requestAnimationFrame(r)},s.handleYearClick=function(a,r){s.props.onDayClick&&s.props.onDayClick(a,r)},s.handleYearNavigation=function(a,r){var i,c,d,f,h=s.props,m=h.date,x=h.yearItemNumber;if(!(m===void 0||x===void 0)){var y=_r(m,x).startPeriod;s.isDisabled(r)||s.isExcluded(r)||((c=(i=s.props).setPreSelection)===null||c===void 0||c.call(i,r),a-y<0?s.updateFocusOnPaginate(x-(y-a)):a-y>=x?s.updateFocusOnPaginate(Math.abs(x-(a-y))):(f=(d=s.YEAR_REFS[a-y])===null||d===void 0?void 0:d.current)===null||f===void 0||f.focus())}},s.isSameDay=function(a,r){return an(a,r)},s.isCurrentYear=function(a){return a===Jt(ln())},s.isRangeStart=function(a){return s.props.startDate&&s.props.endDate&&Va(qa(ln(),a),s.props.startDate)},s.isRangeEnd=function(a){return s.props.startDate&&s.props.endDate&&Va(qa(ln(),a),s.props.endDate)},s.isInRange=function(a){return pf(a,s.props.startDate,s.props.endDate)},s.isInSelectingRange=function(a){var r=s.props,i=r.selectsStart,c=r.selectsEnd,d=r.selectsRange,f=r.startDate,h=r.endDate;return!(i||c||d)||!s.selectingDate()?!1:i&&h?pf(a,s.selectingDate(),h):c&&f||d&&f&&!h?pf(a,f,s.selectingDate()):!1},s.isSelectingRangeStart=function(a){var r;if(!s.isInSelectingRange(a))return!1;var i=s.props,c=i.startDate,d=i.selectsStart,f=qa(ln(),a);return d?Va(f,(r=s.selectingDate())!==null&&r!==void 0?r:null):Va(f,c??null)},s.isSelectingRangeEnd=function(a){var r;if(!s.isInSelectingRange(a))return!1;var i=s.props,c=i.endDate,d=i.selectsEnd,f=i.selectsRange,h=qa(ln(),a);return d||f?Va(h,(r=s.selectingDate())!==null&&r!==void 0?r:null):Va(h,c??null)},s.isKeyboardSelected=function(a){if(!(s.props.disabledKeyboardNavigation||s.props.date===void 0||s.props.preSelection==null)){var r=s.props,i=r.minDate,c=r.maxDate,d=r.excludeDates,f=r.includeDates,h=r.filterDate,m=r.selected,x=Xc(qa(s.props.date,a)),y=(i||c||d||f||h)&&_f(a,s.props),v=!!m&&an(x,Xc(m)),S=an(x,Xc(s.props.preSelection));return!s.props.inline&&!v&&S&&!y}},s.isSelectedYear=function(a){var r=s.props,i=r.selectsMultiple,c=r.selected,d=r.selectedDates;return i?d==null?void 0:d.some(function(f){return a===Jt(f)}):!!c&&a===Jt(c)},s.onYearClick=function(a,r){var i=s.props.date;i!==void 0&&s.handleYearClick(Xc(qa(i,r)),a)},s.onYearKeyDown=function(a,r){var i,c,d=a.key,f=s.props,h=f.date,m=f.yearItemNumber,x=f.handleOnKeyDown;if(d!==dt.Tab&&a.preventDefault(),!s.props.disabledKeyboardNavigation)switch(d){case dt.Enter:if(s.props.selected==null)break;s.onYearClick(a,r),(c=(i=s.props).setPreSelection)===null||c===void 0||c.call(i,s.props.selected);break;case dt.ArrowRight:if(s.props.preSelection==null)break;s.handleYearNavigation(r+1,Ra(s.props.preSelection,1));break;case dt.ArrowLeft:if(s.props.preSelection==null)break;s.handleYearNavigation(r-1,Ci(s.props.preSelection,1));break;case dt.ArrowUp:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var y=_r(h,m).startPeriod,v=iA,S=r-v;if(S<y){var C=m%v;r>=y&&r<y+C?v=C:v+=C,S=r-v}s.handleYearNavigation(S,Ci(s.props.preSelection,v));break}case dt.ArrowDown:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var k=_r(h,m).endPeriod,v=iA,S=r+v;if(S>k){var C=m%v;r<=k&&r>k-C?v=C:v+=C,S=r+v}s.handleYearNavigation(S,Ra(s.props.preSelection,v));break}}x&&x(a)},s.getYearClassNames=function(a){var r=s.props,i=r.date,c=r.disabled,d=r.minDate,f=r.maxDate,h=r.excludeDates,m=r.includeDates,x=r.filterDate,y=r.yearClassName;return as("react-datepicker__year-text","react-datepicker__year-".concat(a),i?y==null?void 0:y(qa(i,a)):void 0,{"react-datepicker__year-text--selected":s.isSelectedYear(a),"react-datepicker__year-text--disabled":(d||f||h||m||x||c)&&_f(a,s.props),"react-datepicker__year-text--keyboard-selected":s.isKeyboardSelected(a),"react-datepicker__year-text--range-start":s.isRangeStart(a),"react-datepicker__year-text--range-end":s.isRangeEnd(a),"react-datepicker__year-text--in-range":s.isInRange(a),"react-datepicker__year-text--in-selecting-range":s.isInSelectingRange(a),"react-datepicker__year-text--selecting-range-start":s.isSelectingRangeStart(a),"react-datepicker__year-text--selecting-range-end":s.isSelectingRangeEnd(a),"react-datepicker__year-text--today":s.isCurrentYear(a)})},s.getYearTabIndex=function(a){if(s.props.disabledKeyboardNavigation||s.props.preSelection==null)return"-1";var r=Jt(s.props.preSelection),i=_f(a,s.props);return a===r&&!i?"0":"-1"},s.getYearContent=function(a){return s.props.renderYearContent?s.props.renderYearContent(a):a},s}return e.prototype.render=function(){var n=this,s=[],a=this.props,r=a.date,i=a.yearItemNumber,c=a.onYearMouseEnter,d=a.onYearMouseLeave;if(r===void 0)return null;for(var f=_r(r,i),h=f.startPeriod,m=f.endPeriod,x=function(S){s.push(Ce.createElement("div",{ref:y.YEAR_REFS[S-h],onClick:function(C){n.onYearClick(C,S)},onKeyDown:function(C){Q1(C)&&(C.preventDefault(),C.key=dt.Enter),n.onYearKeyDown(C,S)},tabIndex:Number(y.getYearTabIndex(S)),className:y.getYearClassNames(S),onMouseEnter:y.props.usePointerEvent?void 0:function(C){return c(C,S)},onPointerEnter:y.props.usePointerEvent?function(C){return c(C,S)}:void 0,onMouseLeave:y.props.usePointerEvent?void 0:function(C){return d(C,S)},onPointerLeave:y.props.usePointerEvent?function(C){return d(C,S)}:void 0,key:S,"aria-current":y.isCurrentYear(S)?"date":void 0},y.getYearContent(S)))},y=this,v=h;v<=m;v++)x(v);return Ce.createElement("div",{className:"react-datepicker__year"},Ce.createElement("div",{className:"react-datepicker__year-wrapper",onMouseLeave:this.props.usePointerEvent?void 0:this.props.clearSelectingDate,onPointerLeave:this.props.usePointerEvent?this.props.clearSelectingDate:void 0},s))},e})(b.Component);function NU(t,e,n,s){for(var a=[],r=0;r<2*e+1;r++){var i=t+e-r,c=!0;n&&(c=Jt(n)<=i),s&&c&&(c=Jt(s)>=i),c&&a.push(i)}return a}var TU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;s.yearOptionButtonsRef={},s.handleOptionKeyDown=function(c,d){var f;switch(d.key){case"Enter":d.preventDefault(),s.onChange(c);break;case"Escape":d.preventDefault(),s.props.onCancel();break;case"ArrowUp":case"ArrowDown":{d.preventDefault();var h=c+(d.key==="ArrowUp"?1:-1);s.yearOptionButtonsRef[h]&&((f=s.yearOptionButtonsRef[h])===null||f===void 0||f.focus());break}}},s.renderOptions=function(){s.yearOptionButtonsRef={};var c=s.props.year,d=s.state.yearsList.map(function(m){return Ce.createElement("div",{ref:function(x){s.yearOptionButtonsRef[m]=x,m===c&&(x==null||x.focus())},role:"button",tabIndex:0,className:c===m?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:m,onClick:s.onChange.bind(s,m),onKeyDown:s.handleOptionKeyDown.bind(s,m),"aria-selected":c===m?"true":void 0},c===m?Ce.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",m)}),f=s.props.minDate?Jt(s.props.minDate):null,h=s.props.maxDate?Jt(s.props.maxDate):null;return(!h||!s.state.yearsList.find(function(m){return m===h}))&&d.unshift(Ce.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:s.incrementYears},Ce.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),(!f||!s.state.yearsList.find(function(m){return m===f}))&&d.push(Ce.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:s.decrementYears},Ce.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),d},s.onChange=function(c){s.props.onChange(c)},s.handleClickOutside=function(){s.props.onCancel()},s.shiftYears=function(c){var d=s.state.yearsList.map(function(f){return f+c});s.setState({yearsList:d})},s.incrementYears=function(){return s.shiftYears(1)},s.decrementYears=function(){return s.shiftYears(-1)};var a=n.yearDropdownItemNumber,r=n.scrollableYearDropdown,i=a||(r?10:5);return s.state={yearsList:NU(s.props.year,i,s.props.minDate,s.props.maxDate)},s.dropdownRef=b.createRef(),s}return e.prototype.componentDidMount=function(){var n=this.dropdownRef.current;if(n){var s=n.children?Array.from(n.children):null,a=s?s.find(function(r){return r.ariaSelected}):null;n.scrollTop=a&&a instanceof HTMLElement?a.offsetTop+(a.clientHeight-n.clientHeight)/2:(n.scrollHeight-n.clientHeight)/2}},e.prototype.render=function(){var n=as({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return Ce.createElement(Ip,{className:n,containerRef:this.dropdownRef,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),EU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(){for(var s=n.props.minDate?Jt(n.props.minDate):1900,a=n.props.maxDate?Jt(n.props.maxDate):2100,r=[],i=s;i<=a;i++)r.push(Ce.createElement("option",{key:i,value:i},i));return r},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return Ce.createElement("select",{value:n.props.year,className:"react-datepicker__year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){return Ce.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},n.props.year))},n.renderDropdown=function(){return Ce.createElement(TU,qt({key:"dropdown"},n.props,{onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(){var s=n.state.dropdownVisible,a=[n.renderReadView(!s)];return s&&a.unshift(n.renderDropdown()),a},n.onChange=function(s){n.toggleDropdown(),s!==n.props.year&&n.props.onChange(s)},n.toggleDropdown=function(s){n.setState({dropdownVisible:!n.state.dropdownVisible},function(){n.props.adjustDateOnChange&&n.handleYearChange(n.props.date,s)})},n.handleYearChange=function(s,a){var r;(r=n.onSelect)===null||r===void 0||r.call(n,s,a),n.setOpen()},n.onSelect=function(s,a){var r,i;(i=(r=n.props).onSelect)===null||i===void 0||i.call(r,s,a)},n.setOpen=function(){var s,a;(a=(s=n.props).setOpen)===null||a===void 0||a.call(s,!0)},n}return e.prototype.render=function(){var n;switch(this.props.dropdownMode){case"scroll":n=this.renderScrollMode();break;case"select":n=this.renderSelectMode();break}return Ce.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),_U=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],X1="react-datepicker-ignore-onclickoutside",MU=function(t){var e=(t.className||"").split(/\s+/);return _U.some(function(n){return e.indexOf(n)>=0})},DU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.monthContainer=void 0,s.handleClickOutside=function(a){s.props.onClickOutside(a)},s.setClickOutsideRef=function(){return s.containerRef.current},s.handleDropdownFocus=function(a){var r,i;MU(a.target)&&((i=(r=s.props).onDropdownFocus)===null||i===void 0||i.call(r,a))},s.getDateInView=function(){var a=s.props,r=a.preSelection,i=a.selected,c=a.openToDate,d=G1(s.props),f=Y1(s.props),h=ln(),m=c||i||r;return m||(d&&Ja(h,d)?d:f&&Or(h,f)?f:h)},s.increaseMonth=function(){s.setState(function(a){var r=a.date;return{date:Oa(r,1)}},function(){return s.handleMonthChange(s.state.date)})},s.decreaseMonth=function(){s.setState(function(a){var r=a.date;return{date:lo(r,1)}},function(){return s.handleMonthChange(s.state.date)})},s.handleDayClick=function(a,r,i){s.props.onSelect(a,r,i),s.props.setPreSelection&&s.props.setPreSelection(a)},s.handleDayMouseEnter=function(a){s.setState({selectingDate:a}),s.props.onDayMouseEnter&&s.props.onDayMouseEnter(a)},s.handleMonthMouseLeave=function(){s.setState({selectingDate:void 0}),s.props.onMonthMouseLeave&&s.props.onMonthMouseLeave()},s.handleYearMouseEnter=function(a,r){s.setState({selectingDate:qa(ln(),r)}),s.props.onYearMouseEnter&&s.props.onYearMouseEnter(a,r)},s.handleYearMouseLeave=function(a,r){s.props.onYearMouseLeave&&s.props.onYearMouseLeave(a,r)},s.handleYearChange=function(a){var r,i,c,d;(i=(r=s.props).onYearChange)===null||i===void 0||i.call(r,a),s.setState({isRenderAriaLiveMessage:!0}),s.props.adjustDateOnChange&&(s.props.onSelect(a),(d=(c=s.props).setOpen)===null||d===void 0||d.call(c,!0)),s.props.setPreSelection&&s.props.setPreSelection(a)},s.getEnabledPreSelectionDateForMonth=function(a){if(!xa(a,s.props))return a;for(var r=Lr(a),i=tU(a),c=xz(i,r),d=null,f=0;f<=c;f++){var h=Da(r,f);if(!xa(h,s.props)){d=h;break}}return d},s.handleMonthChange=function(a){var r,i,c,d=(r=s.getEnabledPreSelectionDateForMonth(a))!==null&&r!==void 0?r:a;s.handleCustomMonthChange(d),s.props.adjustDateOnChange&&(s.props.onSelect(d),(c=(i=s.props).setOpen)===null||c===void 0||c.call(i,!0)),s.props.setPreSelection&&s.props.setPreSelection(d)},s.handleCustomMonthChange=function(a){var r,i;(i=(r=s.props).onMonthChange)===null||i===void 0||i.call(r,a),s.setState({isRenderAriaLiveMessage:!0})},s.handleMonthYearChange=function(a){s.handleYearChange(a),s.handleMonthChange(a)},s.changeYear=function(a){s.setState(function(r){var i=r.date;return{date:qa(i,Number(a))}},function(){return s.handleYearChange(s.state.date)})},s.changeMonth=function(a){s.setState(function(r){var i=r.date;return{date:Zs(i,Number(a))}},function(){var r,i;s.handleMonthChange(s.state.date),(i=(r=s.props).onMonthSelectedInChange)===null||i===void 0||i.call(r,0)})},s.changeMonthYear=function(a){s.setState(function(r){var i=r.date;return{date:qa(Zs(i,zs(a)),Jt(a))}},function(){return s.handleMonthYearChange(s.state.date)})},s.header=function(a,r){if(a===void 0&&(a=s.state.date),r===void 0&&(r=0),!Fs(a))return[];var i=s.props.disabled,c=ki(a,s.props.locale,s.props.calendarStartDay),d=[];return s.props.showWeekNumbers&&d.push(Ce.createElement("div",{key:"W",className:"react-datepicker__day-name ".concat(i?"react-datepicker__day-name--disabled":""),role:"columnheader"},Ce.createElement("span",{className:"react-datepicker__sr-only"},"Week number"),Ce.createElement("span",{"aria-hidden":"true"},s.props.weekLabel||"#"))),d.concat([0,1,2,3,4,5,6].map(function(f){var h=Da(c,f),m=s.formatWeekday(h,s.props.locale),x=Dn(h,"EEEE",s.props.locale),y=s.props.weekDayClassName?s.props.weekDayClassName(h):void 0;if(s.props.renderCustomDayName){var v=s.props.renderCustomDayName({day:h,shortName:m,fullName:x,locale:s.props.locale,customDayNameCount:r});return Ce.createElement("div",{key:f,role:"columnheader",className:as("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},v)}return Ce.createElement("div",{key:f,role:"columnheader",className:as("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},Ce.createElement("span",{className:"react-datepicker__sr-only"},x),Ce.createElement("span",{"aria-hidden":"true"},m))}))},s.formatWeekday=function(a,r){return s.props.formatWeekDay?nU(a,s.props.formatWeekDay,r):s.props.useWeekdaysShort?aU(a,r):sU(a,r)},s.decreaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Ci(i,s.props.showYearPicker?(r=s.props.yearItemNumber)!==null&&r!==void 0?r:e.defaultProps.yearItemNumber:1)}},function(){return s.handleYearChange(s.state.date)})},s.clearSelectingDate=function(){s.setState({selectingDate:void 0})},s.renderPreviousButton=function(){var a,r,i;if(!s.props.renderCustomHeader){var c=(a=s.props.monthsShown)!==null&&a!==void 0?a:e.defaultProps.monthsShown,d=s.props.showPreviousMonths?c-1:0,f=(r=s.props.monthSelectedIn)!==null&&r!==void 0?r:d,h=lo(s.state.date,f),m;switch(!0){case s.props.disabled:m=!0;break;case s.props.showMonthYearPicker:m=JC(s.state.date,s.props);break;case s.props.showYearPicker:m=cU(s.state.date,s.props);break;case s.props.showQuarterYearPicker:m=oU(s.state.date,s.props);break;default:m=QC(h,s.props);break}if(!(!((i=s.props.forceShowMonthNavigation)!==null&&i!==void 0?i:e.defaultProps.forceShowMonthNavigation)&&!s.props.showDisabledMonthNavigation&&m||s.props.showTimeSelectOnly)){var x=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"],y=["react-datepicker__navigation","react-datepicker__navigation--previous"],v=s.decreaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(v=s.decreaseYear),m&&s.props.showDisabledMonthNavigation&&(y.push("react-datepicker__navigation--previous--disabled"),v=void 0);var S=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,C=s.props,k=C.previousMonthButtonLabel,N=k===void 0?e.defaultProps.previousMonthButtonLabel:k,j=C.previousYearButtonLabel,E=j===void 0?e.defaultProps.previousYearButtonLabel:j,D=s.props,_=D.previousMonthAriaLabel,P=_===void 0?typeof N=="string"?N:"Previous Month":_,O=D.previousYearAriaLabel,T=O===void 0?typeof E=="string"?E:"Previous Year":O;return Ce.createElement("button",{type:"button",className:y.join(" "),onClick:v,onKeyDown:s.props.handleOnKeyDown,"aria-label":S?T:P},Ce.createElement("span",{className:x.join(" ")},S?E:N))}}},s.increaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Ra(i,s.props.showYearPicker?(r=s.props.yearItemNumber)!==null&&r!==void 0?r:e.defaultProps.yearItemNumber:1)}},function(){return s.handleYearChange(s.state.date)})},s.renderNextButton=function(){var a;if(!s.props.renderCustomHeader){var r;switch(!0){case s.props.disabled:r=!0;break;case s.props.showMonthYearPicker:r=ZC(s.state.date,s.props);break;case s.props.showYearPicker:r=uU(s.state.date,s.props);break;case s.props.showQuarterYearPicker:r=lU(s.state.date,s.props);break;default:r=XC(s.state.date,s.props);break}if(!(!((a=s.props.forceShowMonthNavigation)!==null&&a!==void 0?a:e.defaultProps.forceShowMonthNavigation)&&!s.props.showDisabledMonthNavigation&&r||s.props.showTimeSelectOnly)){var i=["react-datepicker__navigation","react-datepicker__navigation--next"],c=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"];s.props.showTimeSelect&&i.push("react-datepicker__navigation--next--with-time"),s.props.todayButton&&i.push("react-datepicker__navigation--next--with-today-button");var d=s.increaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(d=s.increaseYear),r&&s.props.showDisabledMonthNavigation&&(i.push("react-datepicker__navigation--next--disabled"),d=void 0);var f=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,h=s.props,m=h.nextMonthButtonLabel,x=m===void 0?e.defaultProps.nextMonthButtonLabel:m,y=h.nextYearButtonLabel,v=y===void 0?e.defaultProps.nextYearButtonLabel:y,S=s.props,C=S.nextMonthAriaLabel,k=C===void 0?typeof x=="string"?x:"Next Month":C,N=S.nextYearAriaLabel,j=N===void 0?typeof v=="string"?v:"Next Year":N;return Ce.createElement("button",{type:"button",className:i.join(" "),onClick:d,onKeyDown:s.props.handleOnKeyDown,"aria-label":f?j:k},Ce.createElement("span",{className:c.join(" ")},f?v:x))}}},s.renderCurrentMonth=function(a){a===void 0&&(a=s.state.date);var r=["react-datepicker__current-month"];return s.props.showYearDropdown&&r.push("react-datepicker__current-month--hasYearDropdown"),s.props.showMonthDropdown&&r.push("react-datepicker__current-month--hasMonthDropdown"),s.props.showMonthYearDropdown&&r.push("react-datepicker__current-month--hasMonthYearDropdown"),Ce.createElement("h2",{className:r.join(" ")},Fs(a)?Dn(a,s.props.dateFormat,s.props.locale):"")},s.renderYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showYearDropdown||a))return Ce.createElement(EU,qt({},e.defaultProps,s.props,{date:s.state.date,onChange:s.changeYear,year:Jt(s.state.date)}))},s.renderMonthDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showMonthDropdown||a))return Ce.createElement(wU,qt({},e.defaultProps,s.props,{month:zs(s.state.date),onChange:s.changeMonth}))},s.renderMonthYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showMonthYearDropdown||a))return Ce.createElement(CU,qt({},e.defaultProps,s.props,{date:s.state.date,onChange:s.changeMonthYear}))},s.handleTodayButtonClick=function(a){s.props.onSelect(qC(),a),s.props.setPreSelection&&s.props.setPreSelection(qC())},s.renderTodayButton=function(){if(!(!s.props.todayButton||s.props.showTimeSelectOnly))return Ce.createElement("div",{className:"react-datepicker__today-button",onClick:s.handleTodayButtonClick},s.props.todayButton)},s.renderDayNamesHeader=function(a,r){return r===void 0&&(r=0),Ce.createElement("div",{className:"react-datepicker__day-names",role:"row"},s.header(a,r))},s.renderDefaultHeader=function(a){var r=a.monthDate,i=a.i,c=Ce.createElement("div",{className:as("react-datepicker__header",{"react-datepicker__header--has-time-select":s.props.showTimeSelect,"react-datepicker__header--middle":s.props.monthHeaderPosition==="middle","react-datepicker__header--bottom":s.props.monthHeaderPosition==="bottom"})},s.renderCurrentMonth(r),Ce.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(s.props.dropdownMode),onFocus:s.handleDropdownFocus},s.renderMonthDropdown(i!==0),s.renderMonthYearDropdown(i!==0),s.renderYearDropdown(i!==0)));return s.props.monthHeaderPosition==="top"?c:Ce.createElement("div",{className:"react-datepicker__header-wrapper"},s.renderPreviousButton()||null,s.renderNextButton()||null,c)},s.renderCustomHeader=function(a){var r,i,c=a.monthDate,d=a.i;if(s.props.showTimeSelect&&!s.state.monthContainer||s.props.showTimeSelectOnly)return null;var f=s.props,h=f.showYearPicker,m=f.yearItemNumber,x;if(h){var y=_r(c,m),v=y.startPeriod,S=y.endPeriod;x={startYear:v,endYear:S}}var C=QC(s.state.date,s.props),k=XC(s.state.date,s.props),N=JC(s.state.date,s.props),j=ZC(s.state.date,s.props);return Ce.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:s.props.onDropdownFocus},(i=(r=s.props).renderCustomHeader)===null||i===void 0?void 0:i.call(r,qt(qt(qt({},s.state),h&&{visibleYearsRange:x}),{customHeaderCount:d,monthDate:c,changeMonth:s.changeMonth,changeYear:s.changeYear,decreaseMonth:s.decreaseMonth,increaseMonth:s.increaseMonth,decreaseYear:s.decreaseYear,increaseYear:s.increaseYear,prevMonthButtonDisabled:C,nextMonthButtonDisabled:k,prevYearButtonDisabled:N,nextYearButtonDisabled:j})))},s.renderYearHeader=function(a){var r=a.monthDate,i=s.props,c=i.showYearPicker,d=i.yearItemNumber,f=d===void 0?e.defaultProps.yearItemNumber:d,h=_r(r,f),m=h.startPeriod,x=h.endPeriod;return Ce.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},c?"".concat(m," - ").concat(x):Jt(r))},s.renderHeader=function(a){var r=a.monthDate,i=a.i,c=i===void 0?0:i,d={monthDate:r,i:c};switch(!0){case s.props.renderCustomHeader!==void 0:return s.renderCustomHeader(d);case(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker):return s.renderYearHeader(d);default:return s.renderDefaultHeader(d)}},s.renderMonths=function(){var a,r;if(!(s.props.showTimeSelectOnly||s.props.showYearPicker)){for(var i=[],c=(a=s.props.monthsShown)!==null&&a!==void 0?a:e.defaultProps.monthsShown,d=s.props.showPreviousMonths?c-1:0,f=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?Ra(s.state.date,d):lo(s.state.date,d),h=(r=s.props.monthSelectedIn)!==null&&r!==void 0?r:d,m=0;m<c;++m){var x=m-h+d,y=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?Ra(f,x):Oa(f,x),v="month-".concat(m),S=m<c-1,C=m>0;i.push(Ce.createElement("div",{key:v,ref:function(k){s.monthContainer=k??void 0},className:"react-datepicker__month-container"},s.props.monthHeaderPosition==="top"&&s.renderHeader({monthDate:y,i:m}),Ce.createElement(yU,qt({},e.defaultProps,s.props,{containerRef:s.containerRef,ariaLabelPrefix:s.props.monthAriaLabelPrefix,day:y,onDayClick:s.handleDayClick,handleOnKeyDown:s.props.handleOnDayKeyDown,handleOnMonthKeyDown:s.props.handleOnKeyDown,onDayMouseEnter:s.handleDayMouseEnter,onMouseLeave:s.handleMonthMouseLeave,orderInDisplay:m,selectingDate:s.state.selectingDate,monthShowsDuplicateDaysEnd:S,monthShowsDuplicateDaysStart:C,dayNamesHeader:s.renderDayNamesHeader(y,m),monthHeader:s.props.monthHeaderPosition==="middle"?s.renderHeader({monthDate:y,i:m}):void 0,monthFooter:s.props.monthHeaderPosition==="bottom"?s.renderHeader({monthDate:y,i:m}):void 0}))))}return i}},s.renderYears=function(){if(!s.props.showTimeSelectOnly&&s.props.showYearPicker)return Ce.createElement("div",{className:"react-datepicker__year--container"},s.renderHeader({monthDate:s.state.date}),Ce.createElement(jU,qt({},e.defaultProps,s.props,{selectingDate:s.state.selectingDate,date:s.state.date,onDayClick:s.handleDayClick,clearSelectingDate:s.clearSelectingDate,onYearMouseEnter:s.handleYearMouseEnter,onYearMouseLeave:s.handleYearMouseLeave})))},s.renderTimeSection=function(){if(s.props.showTimeSelect&&(s.state.monthContainer||s.props.showTimeSelectOnly))return Ce.createElement(AU,qt({},e.defaultProps,s.props,{onChange:s.props.onTimeChange,format:s.props.timeFormat,intervals:s.props.timeIntervals,monthRef:s.state.monthContainer}))},s.renderInputTimeSection=function(){var a,r;if(s.props.showTimeInput){if(s.props.selectsRange){var i=s.props,c=i.startDate,d=i.endDate,f=c?new Date(c):void 0,h=f&&Fs(f)&&!!c,m=h?"".concat(ol(f.getHours()),":").concat(ol(f.getMinutes())):"",x=d?new Date(d):void 0,y=x&&Fs(x)&&!!d,v=y?"".concat(ol(x.getHours()),":").concat(ol(x.getMinutes())):"";return Ce.createElement(Ce.Fragment,null,Ce.createElement($g,qt({},e.defaultProps,s.props,{date:f,timeString:m,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N,"start")},timeInputLabel:((a=s.props.timeInputLabel)!==null&&a!==void 0?a:"Time")+" (Start)"})),Ce.createElement($g,qt({},e.defaultProps,s.props,{date:x,timeString:v,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N,"end")},timeInputLabel:((r=s.props.timeInputLabel)!==null&&r!==void 0?r:"Time")+" (End)"})))}var S=s.props.selected?new Date(s.props.selected):void 0,C=S&&Fs(S)&&!!s.props.selected,k=C?"".concat(ol(S.getHours()),":").concat(ol(S.getMinutes())):"";return Ce.createElement($g,qt({},e.defaultProps,s.props,{date:S,timeString:k,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N)}}))}},s.renderAriaLiveRegion=function(){var a;if(!Fs(s.state.date))return Ce.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"});var r=_r(s.state.date,(a=s.props.yearItemNumber)!==null&&a!==void 0?a:e.defaultProps.yearItemNumber),i=r.startPeriod,c=r.endPeriod,d;return s.props.showYearPicker?d="".concat(i," - ").concat(c):s.props.showMonthYearPicker||s.props.showQuarterYearPicker?d=Jt(s.state.date):d="".concat(Gx(zs(s.state.date),s.props.locale)," ").concat(Jt(s.state.date)),Ce.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},s.state.isRenderAriaLiveMessage&&d)},s.renderChildren=function(){if(s.props.children)return Ce.createElement("div",{className:"react-datepicker__children-container"},s.props.children)},s.containerRef=b.createRef(),s.state={date:s.getDateInView(),selectingDate:void 0,monthContainer:void 0,isRenderAriaLiveMessage:!1},s}return Object.defineProperty(e,"defaultProps",{get:function(){return{monthsShown:1,forceShowMonthNavigation:!1,outsideClickIgnoreClass:X1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:Ou,monthHeaderPosition:"top"}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){var n=this;this.props.showTimeSelect&&(this.assignMonthContainer=(function(){n.setState({monthContainer:n.monthContainer})})())},e.prototype.componentDidUpdate=function(n){var s=this;if(this.props.preSelection&&Fs(this.props.preSelection)&&(!an(this.props.preSelection,n.preSelection)||this.props.monthSelectedIn!==n.monthSelectedIn)){var a=!As(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},function(){return a&&s.handleCustomMonthChange(s.state.date)})}else this.props.openToDate&&!an(this.props.openToDate,n.openToDate)&&this.setState({date:this.props.openToDate})},e.prototype.render=function(){var n=this.props.container||GH;return Ce.createElement(Ip,{onClickOutside:this.handleClickOutside,style:{display:"contents"},ignoreClass:this.props.outsideClickIgnoreClass},Ce.createElement("div",{style:{display:"contents"},ref:this.containerRef},Ce.createElement(n,{className:as("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showTime:this.props.showTimeSelect||this.props.showTimeInput,showTimeSelectOnly:this.props.showTimeSelectOnly,inline:this.props.inline},this.renderAriaLiveRegion(),this.props.monthHeaderPosition==="top"&&this.renderPreviousButton(),this.props.monthHeaderPosition==="top"&&this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren())))},e})(b.Component),RU=function(t){var e=t.icon,n=t.className,s=n===void 0?"":n,a=t.onClick,r="react-datepicker__calendar-icon";if(typeof e=="string")return Ce.createElement("i",{className:"".concat(r," ").concat(e," ").concat(s),"aria-hidden":"true",onClick:a});if(Ce.isValidElement(e)){var i=e;return Ce.cloneElement(i,{className:"".concat(i.props.className||""," ").concat(r," ").concat(s),onClick:function(c){typeof i.props.onClick=="function"&&i.props.onClick(c),typeof a=="function"&&a(c)}})}return Ce.createElement("svg",{className:"".concat(r," ").concat(s),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:a},Ce.createElement("path",{d:"M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"}))},J1=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.portalRoot=null,s.el=document.createElement("div"),s}return e.prototype.componentDidMount=function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)},e.prototype.componentWillUnmount=function(){this.portalRoot&&this.portalRoot.removeChild(this.el)},e.prototype.render=function(){return H2.createPortal(this.props.children,this.el)},e})(b.Component),OU="[tabindex], a, button, input, select, textarea",LU=function(t){return(t instanceof HTMLAnchorElement||!t.disabled)&&t.tabIndex!==-1},Z1=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.getTabChildren=function(){var a;return Array.prototype.slice.call((a=s.tabLoopRef.current)===null||a===void 0?void 0:a.querySelectorAll(OU),1,-1).filter(LU)},s.handleFocusStart=function(){var a=s.getTabChildren();a&&a.length>1&&a[a.length-1].focus()},s.handleFocusEnd=function(){var a=s.getTabChildren();a&&a.length>1&&a[0].focus()},s.tabLoopRef=b.createRef(),s}return e.prototype.render=function(){var n;return((n=this.props.enableTabLoop)!==null&&n!==void 0?n:e.defaultProps.enableTabLoop)?Ce.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},Ce.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,Ce.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},e.defaultProps={enableTabLoop:!0},e})(b.Component);function PU(t){function e(n){var s,a=typeof n.hidePopper=="boolean"?n.hidePopper:!0,r=b.useRef(null),i=VH(qt({open:!a,whileElementsMounted:CH,placement:n.popperPlacement,middleware:Za([RH({padding:15}),DH(10),OH({element:r})],(s=n.popperModifiers)!==null&&s!==void 0?s:[],!0)},n.popperProps)),c=qt(qt({},n),{hidePopper:a,popperProps:qt(qt({},i),{arrowRef:r})});return Ce.createElement(t,qt({},c))}return e.displayName="withFloating(".concat(t.displayName||t.name||"Component",")"),e}var IU=function(t){var e=t.className,n=t.wrapperClassName,s=t.hidePopper,a=s===void 0?!0:s,r=t.popperComponent,i=t.targetComponent,c=t.enableTabLoop,d=t.popperOnKeyDown,f=t.portalId,h=t.portalHost,m=t.popperProps,x=t.showArrow,y=t.popperTargetRef,v=t.monthHeaderPosition;b.useEffect(function(){y!=null&&y.current&&m.refs.setPositionReference(y.current)},[y,m.refs]);var S=void 0;if(!a){var C=as("react-datepicker-popper",!x&&"react-datepicker-popper-offset",v==="middle"&&"react-datepicker-popper--header-middle",v==="bottom"&&"react-datepicker-popper--header-bottom",e);S=Ce.createElement(Z1,{enableTabLoop:c},Ce.createElement("div",{ref:m.refs.setFloating,style:m.floatingStyles,className:C,"data-placement":m.placement,onKeyDown:d},r,x&&Ce.createElement(FH,{ref:m.arrowRef,context:m.context,fill:"currentColor",strokeWidth:1,height:8,width:16,style:{transform:"translateY(-1px)"},className:"react-datepicker__triangle"})))}t.popperContainer&&(S=b.createElement(t.popperContainer,{},S)),f&&!a&&(S=Ce.createElement(J1,{portalId:f,portalHost:h},S));var k=as("react-datepicker-wrapper",n);return Ce.createElement(Ce.Fragment,null,Ce.createElement("div",{ref:m.refs.setReference,className:k},i),S)},BU=PU(IU);function oA(t,e){return t&&e?zs(t)!==zs(e)||Jt(t)!==Jt(e):t!==e}var Ug="Date input not valid.",FU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.calendar=null,s.input=null,s.getPreSelection=function(){var a=s.props.timeZone,r=s.props.openToDate?s.props.openToDate:s.props.selectsEnd&&s.props.startDate?s.props.startDate:s.props.selectsStart&&s.props.endDate?s.props.endDate:ln();return a?UC(r,a):r},s.modifyHolidays=function(){var a;return(a=s.props.holidays)===null||a===void 0?void 0:a.reduce(function(r,i){var c=eo(i.date,"yyyy-MM-dd",void 0,!1);return c?Za(Za([],r,!0),[qt(qt({},i),{date:c})],!1):r},[])},s.calcInitialState=function(){var a=s.props.timeZone,r=s.getPreSelection(),i=G1(s.props),c=Y1(s.props),d=i&&Ja(r,Qc(i))?i:c&&Or(r,VC(c))?c:r,f=s.props.selectsRange?s.props.startDate:s.props.selected;return f&&a&&(f=UC(f,a)),{open:s.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:f??d,highlightDates:eA(s.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1,wasHidden:!1}},s.getInputValue=function(){var a,r=s.props,i=r.locale,c=r.startDate,d=r.endDate,f=r.rangeSeparator,h=r.selected,m=r.selectedDates,x=r.selectsMultiple,y=r.selectsRange,v=r.formatMultipleDates,S=r.value,C=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,k=s.state.inputValue;if(typeof S=="string")return S;if(typeof k=="string")return k;if(y)return QH(c,d,{dateFormat:C,locale:i,rangeSeparator:f});if(x){if(v){var N=function(j){return Bs(j,{dateFormat:C,locale:i})};return v(m??[],N)}return XH(m??[],{dateFormat:C,locale:i})}return Bs(h,{dateFormat:C,locale:i})},s.resetHiddenStatus=function(){s.setState(qt(qt({},s.state),{wasHidden:!1}))},s.setHiddenStatus=function(){s.setState(qt(qt({},s.state),{wasHidden:!0}))},s.setHiddenStateOnVisibilityHidden=function(){document.visibilityState==="hidden"&&s.setHiddenStatus()},s.clearPreventFocusTimeout=function(){s.preventFocusTimeout&&clearTimeout(s.preventFocusTimeout)},s.setFocus=function(){var a,r;(r=(a=s.input)===null||a===void 0?void 0:a.focus)===null||r===void 0||r.call(a,{preventScroll:!0})},s.setBlur=function(){var a,r;(r=(a=s.input)===null||a===void 0?void 0:a.blur)===null||r===void 0||r.call(a),s.cancelFocusInput()},s.deferBlur=function(){requestAnimationFrame(function(){s.setBlur()})},s.setOpen=function(a,r){r===void 0&&(r=!1),s.setState({open:a,preSelection:a&&s.state.open?s.state.preSelection:s.calcInitialState().preSelection,lastPreSelectChange:Wg},function(){a||s.setState(function(i){return{focused:r?i.focused:!1}},function(){!r&&s.deferBlur(),s.setState({inputValue:null})})})},s.inputOk=function(){return tr(s.state.preSelection)},s.isCalendarOpen=function(){return s.props.open===void 0?s.state.open&&!s.props.disabled&&!s.props.readOnly:s.props.open},s.handleFocus=function(a){var r,i,c=s.state.wasHidden,d=c?s.state.open:!0;c&&s.resetHiddenStatus(),s.state.preventFocus||((i=(r=s.props).onFocus)===null||i===void 0||i.call(r,a),d&&!s.props.preventOpenOnFocus&&!s.props.readOnly&&s.setOpen(!0)),s.setState({focused:!0})},s.sendFocusBackToInput=function(){s.preventFocusTimeout&&s.clearPreventFocusTimeout(),s.setState({preventFocus:!0},function(){s.preventFocusTimeout=setTimeout(function(){s.setFocus(),s.setState({preventFocus:!1})})})},s.cancelFocusInput=function(){clearTimeout(s.inputFocusTimeout),s.inputFocusTimeout=void 0},s.deferFocusInput=function(){s.cancelFocusInput(),s.inputFocusTimeout=setTimeout(function(){return s.setFocus()},1)},s.handleDropdownFocus=function(){s.cancelFocusInput()},s.resetInputValue=function(){s.setState(qt(qt({},s.state),{inputValue:null}))},s.handleBlur=function(a){var r,i;(!s.state.open||s.props.withPortal||s.props.showTimeInput)&&((i=(r=s.props).onBlur)===null||i===void 0||i.call(r,a));var c=s.state.inputValue;if(typeof c=="string"&&c.length>0){var d=/[a-zA-Z0-9]/.test(c);!d&&s.props.selected&&s.setSelected(null,void 0,!0)}s.resetInputValue(),s.state.open&&s.props.open===!1&&s.setOpen(!1),s.setState({focused:!1})},s.handleCalendarClickOutside=function(a){var r,i;(i=(r=s.props).onClickOutside)===null||i===void 0||i.call(r,a),!s.props.inline&&!a.defaultPrevented&&s.setOpen(!1),s.props.withPortal&&a.preventDefault()},s.handleChange=function(){for(var a,r,i,c,d,f,h,m,x=[],y=0;y<arguments.length;y++)x[y]=arguments[y];var v=x[0];if(!(s.props.onChangeRaw&&(s.props.onChangeRaw.apply(s,x),!v||typeof v.isDefaultPrevented!="function"||v.isDefaultPrevented()))){s.setState({inputValue:(v==null?void 0:v.target)instanceof HTMLInputElement?v.target.value:null,lastPreSelectChange:zU});var S=s.props,C=S.selectsRange,k=S.startDate,N=S.endDate,j=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,E=(r=s.props.strictParsing)!==null&&r!==void 0?r:e.defaultProps.strictParsing,D=(v==null?void 0:v.target)instanceof HTMLInputElement?v.target.value:"";if(C){var _=s.props.rangeSeparator,P=_.trim(),O=D.split(j.includes(P)?_:P,2).map(function(H){return H.trim()}),T=O[0],M=O[1],R=eo(T??"",j,s.props.locale,E),I=R?eo(M??"",j,s.props.locale,E):null,z=((i=io(k))===null||i===void 0?void 0:i.getTime())!==(R==null?void 0:R.getTime()),W=((c=io(N))===null||c===void 0?void 0:c.getTime())!==(I==null?void 0:I.getTime());if(!z&&!W||R&&xa(R,s.props)||I&&xa(I,s.props))return;R&&s.setState({preSelection:R}),(f=(d=s.props).onChange)===null||f===void 0||f.call(d,[R,I],v)}else{var $=eo(D,j,s.props.locale,E,(h=s.props.selected)!==null&&h!==void 0?h:void 0);if($||!D)s.setSelected($,v,!0);else if(!s.props.inline){var F=KH(D,(m=s.state.preSelection)!==null&&m!==void 0?m:void 0);F&&(!s.props.minDate||!Ja(F,s.props.minDate))&&(!s.props.maxDate||!Or(F,s.props.maxDate))&&s.setState({preSelection:F})}}}},s.handleSelect=function(a,r,i){var c;if(!s.props.readOnly){var d=s.props,f=d.selectsRange,h=d.startDate,m=d.endDate,x=d.locale,y=d.swapRange,v=(c=s.props.dateFormat)!==null&&c!==void 0?c:e.defaultProps.dateFormat,S=!f||h&&!m&&(y||!zg(a,h));if(s.props.shouldCloseOnSelect&&!s.props.showTimeSelect&&S&&s.sendFocusBackToInput(),s.props.onChangeRaw){var C=Bs(a,{dateFormat:v,locale:x});s.props.onChangeRaw(r,{date:a,formattedDate:C})}s.setSelected(a,r,!1,i),s.props.showDateSelect&&s.setState({isRenderAriaLiveMessage:!0}),!s.props.shouldCloseOnSelect||s.props.showTimeSelect?s.setPreSelection(a):S&&s.setOpen(!1)}},s.setSelected=function(a,r,i,c){var d,f,h=s.props.timeZone,m=a;if(m&&h&&(m=jr(m,h)),s.props.showYearPicker){if(m!==null&&_f(Jt(m),s.props))return}else if(s.props.showMonthYearPicker){if(m!==null&&V1(m,s.props))return}else if(m!==null&&xa(m,s.props))return;var x=s.props,y=x.onChange,v=x.selectsRange,S=x.startDate,C=x.endDate,k=x.selectsMultiple,N=x.selectedDates,j=x.minTime,E=x.swapRange;if(!oo(s.props.selected,m)||s.props.allowSameDay||v||k)if(m!==null&&(s.props.selected&&(!i||!s.props.showTimeSelect&&!s.props.showTimeSelectOnly&&!s.props.showTimeInput)&&(m=Nr(m,{hour:bs(s.props.selected),minute:xs(s.props.selected),second:wi(s.props.selected)})),!i&&(s.props.showTimeSelect||s.props.showTimeSelectOnly)&&j&&(m=Nr(m,{hour:j.getHours(),minute:j.getMinutes(),second:j.getSeconds()})),s.props.inline||s.setState({preSelection:m}),s.props.focusSelectedMonth||s.setState({monthSelectedIn:c})),v){var D=y,_=!S&&!C,P=S&&!C,O=!S&&!!C,T=S&&C;_?D==null||D([m,null],r):P?m===null?D==null||D([null,null],r):zg(m,S)?E?D==null||D([m,S],r):D==null||D([m,null],r):D==null||D([S,m],r):O&&(m&&zg(m,C)?D==null||D([m,C],r):D==null||D([m,null],r)),T&&(D==null||D([m,null],r))}else if(k){var M=y;if(m!==null)if(!(N!=null&&N.length))M==null||M([m],r);else{var R=N.some(function(z){return an(z,m)});if(R){var I=N.filter(function(z){return!an(z,m)});M==null||M(I,r)}else M==null||M(Za(Za([],N,!0),[m],!1),r)}}else y==null||y(m,r);i||((f=(d=s.props).onSelect)===null||f===void 0||f.call(d,m,r),s.setState({inputValue:null}))},s.setPreSelection=function(a){if(!s.props.readOnly){var r=tr(s.props.minDate),i=tr(s.props.maxDate),c=!0;if(a){var d=Qc(a);if(r&&i)c=so(a,s.props.minDate,s.props.maxDate);else if(r){var f=Qc(s.props.minDate);c=Or(a,f)||oo(d,f)}else if(i){var h=VC(s.props.maxDate);c=Ja(a,h)||oo(d,h)}}c&&s.setState({preSelection:a})}},s.toggleCalendar=function(){s.setOpen(!s.state.open)},s.handleTimeChange=function(a,r){var i,c;if(!s.props.selectsMultiple){var d=s.props,f=d.selectsRange,h=d.startDate,m=d.endDate,x=d.onChange,y=d.timeZone;if(f){var v=x;if(r==="start"){if(h){var S=Nr(h,{hour:bs(a),minute:xs(a)});s.setState({preSelection:S}),y&&(S=jr(S,y)),v==null||v([S,m?y?jr(m,y):m:null],void 0)}}else if(r==="end"){if(m){var C=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:C}),y&&(C=jr(C,y)),v==null||v([h?y?jr(h,y):h:null,C],void 0)}}else{var k=h&&!m;if(k){var S=Nr(h,{hour:bs(a),minute:xs(a)});s.setState({preSelection:S}),y&&(S=jr(S,y)),v==null||v([S,null],void 0)}else if(h&&m){var C=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:C}),y&&(C=jr(C,y)),v==null||v([y?jr(h,y):h,C],void 0)}else{var N=Nr(s.getPreSelection(),{hour:bs(a),minute:xs(a)});s.setState({preSelection:N})}}}else{var j=s.props.selected?s.props.selected:s.getPreSelection(),N=s.props.selected?a:Nr(j,{hour:bs(a),minute:xs(a)});s.setState({preSelection:N}),N&&y&&(N=jr(N,y)),(c=(i=s.props).onChange)===null||c===void 0||c.call(i,N)}s.props.shouldCloseOnSelect&&!s.props.showTimeInput&&(s.sendFocusBackToInput(),s.setOpen(!1)),s.props.showTimeInput&&s.setOpen(!0),(s.props.showTimeSelectOnly||s.props.showTimeSelect)&&s.setState({isRenderAriaLiveMessage:!0}),s.setState({inputValue:null})}},s.onInputClick=function(){var a,r;!s.props.disabled&&!s.props.readOnly&&s.setOpen(!0),(r=(a=s.props).onInputClick)===null||r===void 0||r.call(a)},s.handleTimeOnlyArrowKey=function(a){var r,i,c,d,f=io(s.props.selected)||s.state.preSelection||ln(),h=(r=s.props.timeIntervals)!==null&&r!==void 0?r:30,m=(i=s.props.dateFormat)!==null&&i!==void 0?i:e.defaultProps.dateFormat,x=Array.isArray(m)?m[0]:m,y=Qc(f),v=bs(f)*60+xs(f),S=1440-h,C;if(a===dt.ArrowUp){var k=Math.max(0,v-h);C=Su(y,k)}else{var k=Math.min(S,v+h);C=Su(y,k)}var N=Dn(C,x||e.defaultProps.dateFormat,s.props.locale);if(s.setState({preSelection:C,inputValue:N}),!(s.props.selectsRange||s.props.selectsMultiple)){var j=s.props.selected?s.props.selected:s.getPreSelection(),E=s.props.selected?C:Nr(j,{hour:bs(C),minute:xs(C)});(d=(c=s.props).onChange)===null||d===void 0||d.call(c,E),(s.props.showTimeSelectOnly||s.props.showTimeSelect)&&s.setState({isRenderAriaLiveMessage:!0}),requestAnimationFrame(function(){s.scrollToTimeOption(C)})}},s.handleTimeOnlyEnterKey=function(a){var r,i,c,d,f=a.target,h=f.value,m=(r=s.props.dateFormat)!==null&&r!==void 0?r:e.defaultProps.dateFormat,x=s.props.timeFormat||"p",y=s.state.preSelection||io(s.props.selected)||ln(),v=eo(h,m,s.props.locale,(i=s.props.strictParsing)!==null&&i!==void 0?i:!1,y),S=y;if(v&&Fs(v))S=v;else{var C=((c=s.calendar)===null||c===void 0?void 0:c.containerRef.current)instanceof Element&&s.calendar.containerRef.current.querySelector(".react-datepicker__time-list-item[tabindex='0']");if(C instanceof HTMLElement){var k=(d=C.textContent)===null||d===void 0?void 0:d.trim();if(k){var N=eo(k,x,s.props.locale,!1,y);N&&Fs(N)&&(S=N)}}}s.handleTimeChange(S),s.setOpen(!1),s.sendFocusBackToInput()},s.scrollToTimeOption=function(a){var r,i;if(!((r=s.calendar)===null||r===void 0)&&r.containerRef.current){for(var c=s.calendar.containerRef.current,d=Array.from(c.querySelectorAll(".react-datepicker__time-list-item")),f=null,h=1/0,m=s.props.timeFormat||"p",x=0,y=d;x<y.length;x++){var v=y[x],S=(i=v.textContent)===null||i===void 0?void 0:i.trim();if(S){var C=eo(S,m,s.props.locale,!1,a);if(C&&Fs(C)){if(K1(C,a)){f=v;break}var k=Math.abs(C.getTime()-a.getTime());k<h&&(h=k,f=v)}}}f&&(d.forEach(function(N){N.setAttribute("tabindex","-1")}),f.setAttribute("tabindex","0"),f.scrollIntoView({behavior:"smooth",block:"center"}))}},s.onInputKeyDown=function(a){var r,i,c,d,f,h;(i=(r=s.props).onKeyDown)===null||i===void 0||i.call(r,a);var m=a.key;if(!s.state.open&&!s.props.inline&&!s.props.preventOpenOnFocus){(m===dt.ArrowDown||m===dt.ArrowUp||m===dt.Enter)&&((c=s.onInputClick)===null||c===void 0||c.call(s));return}if(s.state.open&&s.props.showTimeSelectOnly){if(m===dt.ArrowDown||m===dt.ArrowUp){a.preventDefault(),s.handleTimeOnlyArrowKey(m);return}if(m===dt.Enter){a.preventDefault(),s.handleTimeOnlyEnterKey(a);return}}if(s.state.open){if(m===dt.ArrowDown||m===dt.ArrowUp){a.preventDefault();var x=s.props.showTimeSelectOnly?".react-datepicker__time-list-item[tabindex='0']":s.props.showWeekPicker&&s.props.showWeekNumbers?'.react-datepicker__week-number[tabindex="0"]':s.props.showFullMonthYearPicker||s.props.showMonthYearPicker?'.react-datepicker__month-text[tabindex="0"]':'.react-datepicker__day[tabindex="0"]',y=((d=s.calendar)===null||d===void 0?void 0:d.containerRef.current)instanceof Element&&s.calendar.containerRef.current.querySelector(x);y instanceof HTMLElement&&y.focus({preventScroll:!0});return}var v=ln(s.state.preSelection);m===dt.Enter?(a.preventDefault(),a.target.blur(),s.inputOk()&&s.state.lastPreSelectChange===Wg?(s.handleSelect(v,a),!s.props.shouldCloseOnSelect&&s.setPreSelection(v)):s.setOpen(!1)):m===dt.Escape?(a.preventDefault(),a.target.blur(),s.sendFocusBackToInput(),s.setOpen(!1)):m===dt.Tab&&s.setOpen(!1),s.inputOk()||(h=(f=s.props).onInputError)===null||h===void 0||h.call(f,{code:1,msg:Ug})}},s.onPortalKeyDown=function(a){var r=a.key;r===dt.Escape&&(a.preventDefault(),s.setState({preventFocus:!0},function(){s.setOpen(!1),setTimeout(function(){s.setFocus(),s.setState({preventFocus:!1})})}))},s.onDayKeyDown=function(a){var r,i,c,d,f,h,m=s.props,x=m.minDate,y=m.maxDate,v=m.disabledKeyboardNavigation,S=m.showWeekPicker,C=m.shouldCloseOnSelect,k=m.locale,N=m.calendarStartDay,j=m.adjustDateOnChange,E=m.inline;if((i=(r=s.props).onKeyDown)===null||i===void 0||i.call(r,a),!v){var D=a.key,_=a.shiftKey,P=ln(s.state.preSelection),O=function(R,I){var z=I;switch(R){case dt.ArrowRight:z=S?Xf(I,1):Da(I,1);break;case dt.ArrowLeft:z=S?_C(I):x3(I);break;case dt.ArrowUp:z=_C(I);break;case dt.ArrowDown:z=Xf(I,1);break;case dt.PageUp:z=_?Ci(I,1):lo(I,1);break;case dt.PageDown:z=_?Ra(I,1):Oa(I,1);break;case dt.Home:z=ki(I,k,N);break;case dt.End:z=eU(I);break}return z},T=function(R,I){for(var z=40,W=R,$=!1,F=0,H=O(R,I);!$;){if(F>=z){H=I;break}x&&H<x&&(W=dt.ArrowRight,H=xa(x,s.props)?O(W,H):x),y&&H>y&&(W=dt.ArrowLeft,H=xa(y,s.props)?O(W,H):y),xa(H,s.props)?((W===dt.PageUp||W===dt.Home)&&(W=dt.ArrowRight),(W===dt.PageDown||W===dt.End)&&(W=dt.ArrowLeft),H=O(W,H)):$=!0,F++}return H};if(D===dt.Enter){a.preventDefault(),s.handleSelect(P,a),!C&&s.setPreSelection(P);return}else if(D===dt.Escape){a.preventDefault(),s.setOpen(!1),s.inputOk()||(d=(c=s.props).onInputError)===null||d===void 0||d.call(c,{code:1,msg:Ug});return}var M=null;switch(D){case dt.ArrowLeft:case dt.ArrowRight:case dt.ArrowUp:case dt.ArrowDown:case dt.PageUp:case dt.PageDown:case dt.Home:case dt.End:M=T(D,P);break}if(!M){(h=(f=s.props).onInputError)===null||h===void 0||h.call(f,{code:1,msg:Ug});return}a.preventDefault(),s.setState({lastPreSelectChange:Wg}),j&&s.setSelected(M),s.setPreSelection(M),E&&s.setState({shouldFocusDayInline:!0})}},s.onPopperKeyDown=function(a){var r=a.key;r===dt.Escape&&(a.preventDefault(),s.sendFocusBackToInput(),s.setOpen(!1))},s.onClearClick=function(a){a&&a.preventDefault&&a.preventDefault(),s.sendFocusBackToInput();var r=s.props,i=r.selectsRange,c=r.onChange;i?c==null||c([null,null],a):c==null||c(null,a),s.setState({inputValue:null})},s.clear=function(){s.onClearClick()},s.onScroll=function(a){typeof s.props.closeOnScroll=="boolean"&&s.props.closeOnScroll?(a.target===document||a.target===document.documentElement||a.target===document.body)&&s.setOpen(!1):typeof s.props.closeOnScroll=="function"&&s.props.closeOnScroll(a)&&s.setOpen(!1)},s.handleMonthSelectedInChange=function(a){s.setState({monthSelectedIn:a})},s.renderCalendar=function(){var a,r;return!s.props.inline&&!s.isCalendarOpen()?null:Ce.createElement(DU,qt({showMonthYearDropdown:void 0,ref:function(i){s.calendar=i}},s.props,s.state,{setOpen:s.setOpen,dateFormat:(a=s.props.dateFormatCalendar)!==null&&a!==void 0?a:e.defaultProps.dateFormatCalendar,onSelect:s.handleSelect,onClickOutside:s.handleCalendarClickOutside,holidays:fU(s.modifyHolidays()),outsideClickIgnoreClass:s.props.outsideClickIgnoreClass,onDropdownFocus:s.handleDropdownFocus,onTimeChange:s.handleTimeChange,className:s.props.calendarClassName,container:s.props.calendarContainer,handleOnKeyDown:s.props.onKeyDown,handleOnDayKeyDown:s.onDayKeyDown,setPreSelection:s.setPreSelection,dropdownMode:(r=s.props.dropdownMode)!==null&&r!==void 0?r:e.defaultProps.dropdownMode,onMonthSelectedInChange:s.handleMonthSelectedInChange}),s.props.children)},s.renderAriaLiveRegion=function(){var a,r=s.props.locale,i=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,c=s.props.showTimeInput||s.props.showTimeSelect,d=c?"PPPPp":"PPPP",f;return s.props.selectsRange?f="Selected start date: ".concat(Bs(s.props.startDate,{dateFormat:d,locale:r}),". ").concat(s.props.endDate?"End date: "+Bs(s.props.endDate,{dateFormat:d,locale:r}):""):s.props.showTimeSelectOnly?f="Selected time: ".concat(Bs(s.props.selected,{dateFormat:i,locale:r})):s.props.showYearPicker?f="Selected year: ".concat(Bs(s.props.selected,{dateFormat:"yyyy",locale:r})):s.props.showMonthYearPicker?f="Selected month: ".concat(Bs(s.props.selected,{dateFormat:"MMMM yyyy",locale:r})):s.props.showQuarterYearPicker?f="Selected quarter: ".concat(Bs(s.props.selected,{dateFormat:"yyyy, QQQ",locale:r})):f="Selected date: ".concat(Bs(s.props.selected,{dateFormat:d,locale:r})),Ce.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},f)},s.renderDateInput=function(){var a,r,i,c,d,f,h,m=as(s.props.className,(a={},a[s.props.outsideClickIgnoreClass||e.defaultProps.outsideClickIgnoreClass]=s.state.open,a)),x=s.props.customInput||Ce.createElement("input",{type:"text"}),y=s.props.customInputRef||"ref",v={},S=(i=s.props["aria-describedby"])!==null&&i!==void 0?i:s.props.ariaDescribedBy,C=(c=s.props["aria-invalid"])!==null&&c!==void 0?c:s.props.ariaInvalid,k=(d=s.props["aria-label"])!==null&&d!==void 0?d:s.props.ariaLabel,N=(f=s.props["aria-labelledby"])!==null&&f!==void 0?f:s.props.ariaLabelledBy,j=(h=s.props["aria-required"])!==null&&h!==void 0?h:s.props.ariaRequired;return S!=null&&(v["aria-describedby"]=S),C!=null&&(v["aria-invalid"]=C),k!=null&&(v["aria-label"]=k),N!=null&&(v["aria-labelledby"]=N),j!=null&&(v["aria-required"]=j),b.cloneElement(x,qt((r={},r[y]=function(E){s.input=E},r.value=s.getInputValue(),r.onBlur=s.handleBlur,r.onChange=s.handleChange,r.onClick=s.onInputClick,r.onFocus=s.handleFocus,r.onKeyDown=s.onInputKeyDown,r.id=s.props.id,r.name=s.props.name,r.form=s.props.form,r.autoFocus=s.props.autoFocus,r.placeholder=s.props.placeholderText,r.disabled=s.props.disabled,r.autoComplete=s.props.autoComplete,r.className=as(x.props.className,m),r.title=s.props.title,r.readOnly=s.props.readOnly,r.required=s.props.required,r.tabIndex=s.props.tabIndex,r),v))},s.renderClearButton=function(){var a=s.props,r=a.isClearable,i=a.disabled,c=a.selected,d=a.startDate,f=a.endDate,h=a.clearButtonTitle,m=a.clearButtonClassName,x=m===void 0?"":m,y=a.ariaLabelClose,v=y===void 0?"Close":y,S=a.selectedDates,C=a.readOnly;return r&&!C&&(c!=null||d!=null||f!=null||S!=null&&S.length)?Ce.createElement("button",{type:"button",className:as("react-datepicker__close-icon",x,{"react-datepicker__close-icon--disabled":i}),disabled:i,"aria-label":v,onClick:s.onClearClick,title:h,tabIndex:-1}):null},s.state=s.calcInitialState(),s.preventFocusTimeout=void 0,s}return Object.defineProperty(e,"defaultProps",{get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",preventOpenOnFocus:!1,monthsShown:1,outsideClickIgnoreClass:X1,readOnly:!1,rangeSeparator:W1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,showWeekPicker:!1,strictParsing:!1,swapRange:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:Ou,focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0,toggleCalendarOnIconClick:!1,usePointerEvent:!1}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){window.addEventListener("scroll",this.onScroll,!0),document.addEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},e.prototype.componentDidUpdate=function(n,s){var a,r,i,c;this.props.selectsRange&&oA(n.startDate,this.props.startDate)?this.setPreSelection(this.props.startDate):oA(n.selected,this.props.selected)&&this.setPreSelection(this.props.selected),this.state.monthSelectedIn!==void 0&&n.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),this.props.selectsRange&&s.open===!1&&this.state.open===!0&&this.state.monthSelectedIn!==0&&this.setState({monthSelectedIn:0}),n.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:eA(this.props.highlightDates)}),!s.focused&&!oo(n.selected,this.props.selected)&&this.setState({inputValue:null}),s.open!==this.state.open&&(s.open===!1&&this.state.open===!0&&((r=(a=this.props).onCalendarOpen)===null||r===void 0||r.call(a)),s.open===!0&&this.state.open===!1&&((c=(i=this.props).onCalendarClose)===null||c===void 0||c.call(i)))},e.prototype.componentWillUnmount=function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0),document.removeEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},e.prototype.renderInputContainer=function(){var n=this.props,s=n.showIcon,a=n.icon,r=n.calendarIconClassname,i=n.calendarIconClassName,c=n.toggleCalendarOnIconClick,d=this.state.open;return r&&console.warn("calendarIconClassname props is deprecated. should use calendarIconClassName props."),Ce.createElement("div",{className:"react-datepicker__input-container".concat(s?" react-datepicker__view-calendar-icon":"")},s&&Ce.createElement(RU,qt({icon:a,className:as(i,!i&&r,d&&"react-datepicker-ignore-onclickoutside")},c?{onClick:this.toggleCalendar}:null)),this.state.isRenderAriaLiveMessage&&this.renderAriaLiveRegion(),this.renderDateInput(),this.renderClearButton())},e.prototype.render=function(){var n=this.renderCalendar();if(this.props.inline)return n;if(this.props.withPortal){var s=this.state.open?Ce.createElement(Z1,{enableTabLoop:this.props.enableTabLoop},Ce.createElement("div",{className:"react-datepicker__portal",tabIndex:-1,onKeyDown:this.onPortalKeyDown},n)):null;return this.state.open&&this.props.portalId&&(s=Ce.createElement(J1,qt({portalId:this.props.portalId},this.props),s)),Ce.createElement(Ce.Fragment,null,this.renderInputContainer(),s)}return Ce.createElement(BU,qt({},this.props,{className:this.props.popperClassName,hidePopper:!this.isCalendarOpen(),targetComponent:this.renderInputContainer(),popperComponent:n,popperOnKeyDown:this.onPopperKeyDown,showArrow:this.props.showPopperArrow,monthHeaderPosition:this.props.monthHeaderPosition}))},e})(b.Component),zU="input",Wg="navigate";const $U=[25,50,100,250,500,1e3],HU=250,Vc=t=>String(t).padStart(2,"0"),gf=t=>t?/(datetime|timestamp|timestamptz|datetime2|smalldatetime)/i.test(t):!1,lA=t=>`${t.getFullYear()}-${Vc(t.getMonth()+1)}-${Vc(t.getDate())} ${Vc(t.getHours())}:${Vc(t.getMinutes())}:${Vc(t.getSeconds())}`,cA=t=>{if(t==null)return null;if(t instanceof Date)return t;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?(\.\d+)?$/.test(e)){const s=e.replace(" ","T"),a=new Date(s);return Number.isNaN(a.getTime())?null:a}if(/^\d{4}-\d{2}-\d{2}T/.test(e)){const s=new Date(e.replace(/Z$/,""));return Number.isNaN(s.getTime())?null:s}const n=new Date(e);return Number.isNaN(n.getTime())?null:n},UU=t=>t===null?"NULL":t===void 0?"undefined":typeof t=="object"?JSON.stringify(t,null,2):String(t),WU=t=>t==null?"":typeof t=="object"?JSON.stringify(t):String(t),qU=t=>{const e=t.match(/FROM\s+(?:`?[\w]+`?\.)?`?([\w]+)`?(?:\s+(?:AS\s+)?\w+)?(?=\s|;|$)/i);return e!=null&&e[1]?e[1]:null},qg=t=>!t||!t.columns?[]:t.columns.filter(e=>e.primaryKey).map(e=>e.name),VU=(t,e,n,s,a,r,i=!0)=>{const c=x=>t==="mysql"?`\`${x}\``:t==="postgres"?`"${x}"`:x,d=x=>x===null?"NULL":typeof x=="boolean"?x?"1":"0":typeof x=="number"?String(x):typeof x=="object"?`'${JSON.stringify(x).replace(/'/g,"''")}'`:`'${String(x).replace(/'/g,"''")}'`,f=`${c(n)} = ${d(r)}`,h=[];for(const[x,y]of Object.entries(s))h.push(`${c(x)} = ${d(y)}`);i&&(a===null?h.push(`${c(n)} IS NULL`):typeof a=="object"||h.push(`${c(n)} = ${d(a)}`));const m=h.join(" AND ");return`UPDATE ${c(e)} SET ${f} WHERE ${m}`},GU=({result:t,buildingId:e,building:n})=>{var se,ke;const{t:s}=pt(["terminal"]),a=bx(e),[r,i]=b.useState(0),[c,d]=b.useState(HU),[f,h]=b.useState(null),[m,x]=b.useState("asc"),[y,v]=b.useState(null),[S,C]=b.useState(!1),[k,N]=b.useState({}),[j,E]=b.useState(null),[D,_]=b.useState(null),[P,O]=b.useState(null),[T,M]=b.useState(!1),[R,I]=b.useState(null),[z,W]=b.useState(null),[$,F]=b.useState(new Map),[H,V]=b.useState(null),[G,B]=b.useState(null),Q=b.useRef(null),K=b.useRef(null),q=b.useRef(null),xe=b.useRef(!1),de=t.status==="error",Z=!t.rows||t.rows.length===0;b.useEffect(()=>{var we,We;const J=qU(t.query||"");if(_(J),M(!1),O(null),F(new Map),J&&a.activeConnectionId&&a.activeDatabase){const Be=`${a.activeConnectionId}:${a.activeDatabase}:${J}`,ie=(We=(we=a.tableSchemas)==null?void 0:we.get)==null?void 0:We.call(we,Be);if(ie){O(ie);const Ie=qg(ie);M(Ie.length>0)}else U.getTableSchema(e,a.activeConnectionId,a.activeDatabase,J)}},[t.query,t.rows,e,a.activeConnectionId,a.activeDatabase]),b.useEffect(()=>{var J,we;if(D&&a.activeConnectionId&&a.activeDatabase){const We=`${a.activeConnectionId}:${a.activeDatabase}:${D}`,Be=(we=(J=a.tableSchemas)==null?void 0:J.get)==null?void 0:we.call(J,We);if(Be){O(Ie=>Ie===Be?Ie:Be);const ie=qg(Be);M(ie.length>0)}}},[a.tableSchemas,D,a.activeConnectionId,a.activeDatabase]);const be=b.useMemo(()=>!f||!t.rows?t.rows:[...t.rows].sort((J,we)=>{const We=J[f],Be=we[f];if(We===null&&Be===null)return 0;if(We===null)return m==="asc"?-1:1;if(Be===null)return m==="asc"?1:-1;if(typeof We=="number"&&typeof Be=="number")return m==="asc"?We-Be:Be-We;const ie=String(We),Ie=String(Be);return m==="asc"?ie.localeCompare(Ie):Ie.localeCompare(ie)}),[t.rows,f,m]),je=b.useMemo(()=>{if(!be)return[];const J=r*c;return be.slice(J,J+c)},[be,r,c]),ce=Math.ceil(((be==null?void 0:be.length)??0)/c),Ee=((se=t.fields)==null?void 0:se.map(J=>J.name))??Object.keys(((ke=t.rows)==null?void 0:ke[0])||{}),ze=b.useMemo(()=>{const J=new Map;return(t.fields??[]).forEach(we=>{we!=null&&we.name&&J.set(we.name,String(we.type??""))}),J},[t.fields]),Ge=b.useMemo(()=>qg(P),[P]),_e=b.useCallback((J,we)=>{const We=ze.get(J);if(gf(We)){const Be=cA(we);return Be?lA(Be):""}return WU(we)},[ze]),me=b.useMemo(()=>T?"Editable":!a.activeConnectionId||!a.activeDatabase?"Read-only: no active connection or database":D?P?Ge.length===0?"Read-only: table has no primary key":"Read-only: editing unavailable":"Read-only: loading table schema":"Read-only: query is not a single-table SELECT",[T,a.activeConnectionId,a.activeDatabase,D,P,Ge.length]),De=b.useCallback(J=>{if(xe.current){xe.current=!1;return}f===J?x(we=>we==="asc"?"desc":"asc"):(h(J),x("asc"))},[f]),te=b.useCallback((J,we,We,Be)=>{!T||j||G||E({rowIndex:We,rowKey:Be,columnName:J,originalValue:we,currentValue:_e(J,we),isUpdating:!1})},[T,j,G,_e]),He=b.useCallback((J,we)=>{v({column:J,value:we})},[]),ye=b.useCallback(J=>{var jt,ge;if(!D||!P||!a.activeConnectionId||!a.activeDatabase)return;const{rowIndex:we,columnName:We,originalValue:Be,currentValue:ie}=J,Ie=String(ie??"");if(ie!==null&&Ie===_e(We,Be)){E(null);return}const oe=r*c+we,he=be==null?void 0:be[oe];if(!he)return;const ne=Ge;if(ne.length===0){E(Te=>Te?{...Te,error:"No primary key found"}:null);return}const Le={};for(const Te of ne)Le[Te]=he[Te];let Qe=Ie;const $e=ze.get(We);if(ie===null)Qe=null;else if(gf($e))Qe=Ie.trim()===""?null:Ie.trim();else if(typeof Be=="number")if(Ie.trim()==="")Qe=null;else{const Te=Number(Ie);if(Number.isNaN(Te)){E(Ye=>Ye?{...Ye,isUpdating:!1,error:"Invalid number value"}:null);return}Qe=Te}else if(typeof Be=="boolean"){const Te=Ie.trim().toLowerCase();if(Te==="true"||Te==="1")Qe=!0;else if(Te==="false"||Te==="0")Qe=!1;else{E(Ye=>Ye?{...Ye,isUpdating:!1,error:"Invalid boolean value"}:null);return}}else if(Be!==null&&typeof Be=="object")try{Qe=JSON.parse(Ie)}catch{E(Te=>Te?{...Te,isUpdating:!1,error:"Invalid JSON value"}:null);return}E(Te=>Te?{...Te,isUpdating:!0}:null);const nt=(jt=n.database)==null?void 0:jt.connections.find(Te=>Te.id===a.activeConnectionId),ot=(nt==null?void 0:nt.engine)||"mysql",st=VU(ot,D,We,Le,Be,Qe,!gf($e));W(st);const lt=JSON.stringify(Le),it=((ge=t.query)==null?void 0:ge.trim())||"",ht=`${Date.now()}-${Math.random().toString(36).slice(2,10)}`;B({requestId:ht,query:st,rowKey:lt,columnName:We,parsedValue:Qe,startedAt:Date.now(),originalQuery:it}),U.executeSilentQuery(e,a.activeConnectionId,a.activeDatabase,st,ht)},[D,P,r,c,be,Ge,e,a.activeConnectionId,a.activeDatabase,t.query,_e,ze]);b.useEffect(()=>{const J=a.lastSilentQueryResult;if(!(!G||!J)&&!(J.requestId&&J.requestId!==G.requestId)&&!(J.timestamp<G.startedAt)){if(!J.success){I({message:J.error||"Update failed on backend",type:"error"}),setTimeout(()=>I(null),5e3),E(we=>we&&{...we,isUpdating:!1,error:J.error||"Update failed on backend"}),B(null);return}if(J.affectedRows===0){I({message:"No rows were updated",type:"error"}),setTimeout(()=>I(null),5e3),E(we=>we&&{...we,isUpdating:!1,error:"No rows were updated"}),B(null);return}F(we=>{const We=new Map(we),Be=We.get(G.rowKey)||{};return Be[G.columnName]=G.parsedValue,We.set(G.rowKey,Be),We}),E(null),I({message:"Row updated successfully",type:"success"}),setTimeout(()=>I(null),3e3),G.originalQuery&&a.activeConnectionId&&a.activeDatabase&&setTimeout(()=>{U.executeQuery(e,a.activeConnectionId,a.activeDatabase,G.originalQuery)},200),B(null)}},[G,a.lastSilentQueryResult,a.activeConnectionId,a.activeDatabase,e]),b.useEffect(()=>{if(!G)return;const J=window.setTimeout(()=>{I({message:"Update timed out waiting for backend",type:"error"}),setTimeout(()=>I(null),5e3),E(we=>we&&{...we,isUpdating:!1,error:"Update timed out waiting for backend"}),B(null)},1e4);return()=>window.clearTimeout(J)},[G]);const Re=b.useCallback(()=>{j&&ye(j)},[j,ye]),re=b.useCallback((J,we,We,Be,ie)=>{J.preventDefault(),J.stopPropagation(),V({position:{x:J.clientX,y:J.clientY},rowIndex:Be,rowKey:ie,columnName:we,value:We})},[j,D,P,r,c,be,Ge,e,a.activeConnectionId,a.activeDatabase]),pe=b.useMemo(()=>{if(!H)return[];const J=!T||!!j||!!G||!D||!P||!a.activeConnectionId||!a.activeDatabase;return[{id:"editability",label:T?"Cell actions":me,icon:T?"▣":"ℹ",disabled:!0,onClick:()=>{}},{id:"divider-1",label:"",divider:!0,onClick:()=>{}},{id:"edit-cell",label:"Edit Cell",icon:"✏️",disabled:J,onClick:()=>{E({rowIndex:H.rowIndex,rowKey:H.rowKey,columnName:H.columnName,originalValue:H.value,currentValue:_e(H.columnName,H.value),isUpdating:!1})}},{id:"set-null",label:"Set NULL",icon:"∅",disabled:J||H.value===null,onClick:()=>{ye({rowIndex:H.rowIndex,rowKey:H.rowKey,columnName:H.columnName,originalValue:H.value,currentValue:null,isUpdating:!1})}}]},[H,T,j,G,D,P,a.activeConnectionId,a.activeDatabase,me,ye,_e]),Ve=b.useCallback(J=>{J.key==="Enter"?(J.preventDefault(),Re()):J.key==="Escape"&&(J.preventDefault(),J.stopPropagation(),E(null))},[Re]),at=b.useCallback((J,we)=>{J.preventDefault(),J.stopPropagation();const We=J.target.closest("th");if(!We)return;const Be=We.getBoundingClientRect().width;q.current={column:we,startX:J.clientX,startWidth:Be};const ie=oe=>{if(!q.current)return;const he=oe.clientX-q.current.startX,ne=Math.max(50,q.current.startWidth+he);N(Le=>({...Le,[q.current.column]:ne}))},Ie=()=>{q.current=null,xe.current=!0,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",Ie),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",ie),document.addEventListener("mouseup",Ie),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);b.useEffect(()=>{if(!y)return;const J=We=>{We.key==="Escape"&&(We.stopPropagation(),v(null))},we=We=>{Q.current&&!Q.current.contains(We.target)&&v(null)};return document.addEventListener("keydown",J),document.addEventListener("mousedown",we),()=>{document.removeEventListener("keydown",J),document.removeEventListener("mousedown",we)}},[y]);const ut=j?`${j.rowKey}:${j.columnName}`:null;b.useEffect(()=>{K.current&&ut&&(K.current.focus(),K.current.select())},[ut]);const ue=b.useCallback(async()=>{var ie;if(!t.rows||t.rows.length===0)return;const J=((ie=t.fields)==null?void 0:ie.map(Ie=>Ie.name))??Object.keys(t.rows[0]||{}),we=be??t.rows,We=["<table><thead><tr>"];J.forEach(Ie=>We.push(`<th>${Ie}</th>`)),We.push("</tr></thead><tbody>"),we.forEach(Ie=>{We.push("<tr>"),J.forEach(oe=>{const he=Ie[oe];We.push(`<td>${he===null?"NULL":typeof he=="object"?JSON.stringify(he):String(he)}</td>`)}),We.push("</tr>")}),We.push("</tbody></table>");const Be=[J.join(" ")];we.forEach(Ie=>{Be.push(J.map(oe=>{const he=Ie[oe];return he===null?"NULL":typeof he=="object"?JSON.stringify(he):String(he)}).join(" "))});try{const Ie=new Blob([We.join("")],{type:"text/html"}),oe=new Blob([Be.join(`
|
|
110
|
-
`)],{type:"text/plain"});await navigator.clipboard.write([new ClipboardItem({"text/html":Ie,"text/plain":oe})]),C(!0),setTimeout(()=>C(!1),2e3)}catch{await navigator.clipboard.writeText(Be.join(`
|
|
111
|
-
`)),C(!0),setTimeout(()=>C(!1),2e3)}},[t,be]),X=J=>{if(J===null)return o.jsx("span",{className:"results-table__null",children:"NULL"});if(J===void 0)return o.jsx("span",{className:"results-table__null",children:"undefined"});if(typeof J=="boolean")return o.jsx("span",{className:`results-table__bool results-table__bool--${J}`,children:String(J)});if(typeof J=="number")return o.jsx("span",{className:"results-table__number",children:J.toLocaleString()});if(J instanceof Date)return o.jsx("span",{className:"results-table__date",children:J.toISOString()});if(typeof J=="object")return o.jsx("span",{className:"results-table__json",title:JSON.stringify(J,null,2),children:JSON.stringify(J)});const we=String(J);return we.length>100?o.jsxs("span",{className:"results-table__long",title:we,children:[we.substring(0,100),"..."]}):we};return de?o.jsx("div",{className:"results-table results-table--error",children:o.jsxs("div",{className:"results-table__error",children:[o.jsxs("div",{className:"results-table__error-header",children:[o.jsx("span",{className:"results-table__error-icon",children:"✗"}),s("terminal:database.queryError")]}),o.jsx("div",{className:"results-table__error-message",children:t.error}),t.errorCode&&o.jsx("div",{className:"results-table__error-code",children:s("terminal:database.errorCode",{code:t.errorCode})}),o.jsx("div",{className:"results-table__error-query",children:o.jsx("code",{children:t.query})})]})}):Z?o.jsx("div",{className:"results-table results-table--success",children:o.jsxs("div",{className:"results-table__success",children:[o.jsx("span",{className:"results-table__success-icon",children:"✓"}),s("terminal:database.querySuccess"),t.affectedRows!==void 0&&o.jsx("span",{className:"results-table__affected",children:s("terminal:database.rowsAffected",{count:t.affectedRows})}),o.jsxs("span",{className:"results-table__duration",children:[t.duration,"ms"]})]})}):o.jsxs("div",{className:"results-table",children:[o.jsxs("div",{className:"results-table__status-bar",children:[o.jsxs("div",{className:"results-table__status-info",children:[o.jsx("span",{className:"results-table__row-count",children:s("terminal:database.rowCount",{count:t.rowCount})}),o.jsxs("span",{className:"results-table__duration",children:[t.duration,"ms"]}),o.jsx("span",{className:`results-table__edit-status ${T?"results-table__edit-status--editable":"results-table__edit-status--readonly"}`,title:me,children:me}),o.jsx("button",{className:`results-table__copy-btn ${S?"results-table__copy-btn--success":""}`,onClick:ue,title:s("terminal:database.copyAllResults"),children:s(S?"terminal:database.copied":"terminal:database.copyAll")})]}),o.jsxs("div",{className:"results-table__pagination",children:[o.jsx("select",{className:"results-table__page-size",value:c,onChange:J=>{d(Number(J.target.value)),i(0)},children:$U.map(J=>o.jsx("option",{value:J,children:s("terminal:database.rowsPerPage",{count:J})},J))}),o.jsx("button",{className:"results-table__page-btn",disabled:r===0,onClick:()=>i(0),title:s("terminal:database.firstPage"),children:"«"}),o.jsx("button",{className:"results-table__page-btn",disabled:r===0,onClick:()=>i(J=>J-1),title:s("terminal:database.previousPage"),children:"‹"}),o.jsx("span",{className:"results-table__page-info",children:s("terminal:database.pageInfo",{current:r+1,total:ce})}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=ce-1,onClick:()=>i(J=>J+1),title:s("terminal:database.nextPage"),children:"›"}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=ce-1,onClick:()=>i(ce-1),title:s("terminal:database.lastPage"),children:"»"})]})]}),o.jsx("div",{className:"results-table__wrapper",children:o.jsxs("table",{className:`results-table__table ${Object.keys(k).length>0?"results-table__table--resized":""}`,children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"results-table__row-num",children:"#"}),Ee.map(J=>{var Be;const we=(Be=t.fields)==null?void 0:Be.find(ie=>ie.name===J),We=f===J;return o.jsxs("th",{className:`results-table__header ${We?"results-table__header--sorted":""}`,onClick:()=>De(J),title:we!=null&&we.type?`Type: ${we.type}`:void 0,style:k[J]?{width:k[J],minWidth:k[J],maxWidth:k[J]}:void 0,children:[o.jsx("span",{className:"results-table__header-name",children:J}),We&&o.jsx("span",{className:"results-table__sort-indicator",children:m==="asc"?"▲":"▼"}),o.jsx("span",{className:"results-table__resize-handle",onMouseDown:ie=>at(ie,J)})]},J)})]})}),o.jsx("tbody",{children:je.map((J,we)=>o.jsxs("tr",{className:"results-table__row",children:[o.jsx("td",{className:"results-table__row-num",children:r*c+we+1}),Ee.map(We=>{const Be=JSON.stringify(Object.fromEntries(Ge.map(he=>[he,J[he]]))),ie=(j==null?void 0:j.rowKey)===Be&&(j==null?void 0:j.columnName)===We,Ie=$.get(Be),oe=Ie?Ie[We]:J[We];return o.jsx("td",{className:`results-table__cell ${ie?"results-table__cell--editing":""} ${T?"results-table__cell--editable":""} ${Ie&&Ie[We]!==J[We]?"results-table__cell--updated":""}`,onClick:()=>te(We,oe,we,Be),onDoubleClick:()=>He(We,oe),onContextMenu:he=>re(he,We,oe,we,Be),children:ie?o.jsxs("div",{className:"results-table__cell-input-wrapper",children:[gf(ze.get(j.columnName))?o.jsx(FU,{selected:cA(j.currentValue),onChange:he=>{const ne=Array.isArray(he)?he[0]:he;E(Le=>Le?{...Le,currentValue:ne?lA(ne):""}:null)},onCalendarClose:Re,showTimeSelect:!0,showTimeInput:!0,timeIntervals:1,timeFormat:"HH:mm:ss",dateFormat:"yyyy-MM-dd HH:mm:ss",className:"results-table__cell-input results-table__cell-input--datetime",disabled:j.isUpdating,placeholderText:"Select date and time",autoFocus:!0}):o.jsx("input",{ref:K,type:"text",className:"results-table__cell-input",value:String(j.currentValue??""),onChange:he=>E(ne=>ne?{...ne,currentValue:he.target.value}:null),onBlur:Re,onKeyDown:Ve,disabled:j.isUpdating,autoFocus:!0}),j.isUpdating&&o.jsx("span",{className:"results-table__cell-feedback results-table__cell-feedback--loading",children:"⏳"}),j.error&&o.jsx("button",{type:"button",className:"results-table__cell-feedback results-table__cell-feedback--error results-table__cell-feedback-btn",title:`${j.error}. Click to cancel editing.`,onMouseDown:he=>{he.preventDefault(),he.stopPropagation()},onClick:he=>{he.preventDefault(),he.stopPropagation(),E(null)},children:"✕"})]}):X(oe)},We)})]},we))})]})}),y&&o.jsx("div",{className:"results-table__detail-backdrop",children:o.jsxs("div",{className:"results-table__detail",ref:Q,children:[o.jsxs("div",{className:"results-table__detail-header",children:[o.jsx("span",{className:"results-table__detail-column",children:y.column}),o.jsxs("div",{className:"results-table__detail-actions",children:[T&&o.jsx("button",{className:"results-table__detail-edit-btn",onClick:()=>{v(null);const J=je.find(we=>Ee.some(We=>we[We]===y.value&&We===y.column));if(J){const we=je.indexOf(J),We=JSON.stringify(Object.fromEntries(Ge.map(Be=>[Be,J[Be]])));E({rowIndex:we,rowKey:We,columnName:y.column,originalValue:y.value,currentValue:_e(y.column,y.value),isUpdating:!1})}},title:"Edit this cell",children:"✏️"}),o.jsx("button",{className:"results-table__detail-close",onClick:()=>v(null),children:"✕"})]})]}),o.jsx("textarea",{className:"results-table__detail-textarea",value:UU(y.value),readOnly:!0,onFocus:J=>J.target.select()})]})}),R&&o.jsx("div",{className:`results-table__toast results-table__toast--${R.type}`,children:R.message}),z&&o.jsxs("div",{className:"results-table__query-log",children:[o.jsx("div",{className:"results-table__query-log-label",children:"Executed Query:"}),o.jsx("code",{className:"results-table__query-log-code",children:z})]}),o.jsx(go,{isOpen:H!==null,position:(H==null?void 0:H.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:pe,onClose:()=>V(null)})]})};function Kx(t){const e=[];let n=!1,s=!1,a=!1,r=!1,i=0;for(let d=0;d<t.length;d++){const f=t[d],h=t[d+1];if(a){f===`
|
|
112
|
-
`&&(a=!1);continue}if(r){f==="*"&&h==="/"&&(r=!1,d++);continue}if(n){if(f==="'"&&h==="'"){d++;continue}f==="'"&&(n=!1);continue}if(s){if(f==='"'&&h==='"'){d++;continue}f==='"'&&(s=!1);continue}if(f==="-"&&h==="-"){a=!0,d++;continue}if(f==="/"&&h==="*"){r=!0,d++;continue}if(f==="'"){n=!0;continue}if(f==='"'){s=!0;continue}if(f===";"){const m=t.slice(i,d).trim();m&&e.push({sql:m,start:i,end:d}),i=d+1}}const c=t.slice(i).trim();return c&&e.push({sql:c,start:i,end:t.length}),e}function YU(t,e){const n=Kx(t);if(n.length===0)return null;for(const s of n)if(e>=s.start&&e<=s.end)return s.sql;return n[n.length-1].sql}const TV=({query:t,onChange:e,onExecute:n,isExecuting:s,disabled:a,autoFocus:r=!0})=>{const{t:i}=pt(["terminal"]),c=b.useRef(null),d=b.useRef(null),f=b.useRef(!1),h="query-editor-height",m=80,x=800,[y,v]=b.useState(()=>{try{const P=localStorage.getItem(h);if(P){const O=Number(P);if(O>=m&&O<=x)return O}}catch{}return 150}),S=b.useCallback(P=>{try{localStorage.setItem(h,String(P))}catch{}},[]),C=b.useCallback(P=>{P.preventDefault(),f.current=!0;const O=P.clientY,T=y,M=I=>{const z=I.clientY-O,W=Math.max(m,Math.min(x,T+z));v(W)},R=()=>{var z;f.current=!1,document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",R),document.body.style.cursor="",document.body.style.userSelect="";const I=(z=c.current)==null?void 0:z.parentElement;I&&S(I.getBoundingClientRect().height)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",R),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[y,S]);b.useEffect(()=>{if(r&&!a&&c.current){const P=setTimeout(()=>{var O;(O=c.current)==null||O.focus()},100);return()=>clearTimeout(P)}},[r,a]);const k=b.useCallback(P=>{const O=P.currentTarget;d.current&&(d.current.scrollLeft=O.scrollLeft,d.current.scrollTop=O.scrollTop)},[]),N=b.useMemo(()=>Kx(t).length>1,[t]),j=b.useCallback(P=>{if((P.ctrlKey||P.metaKey)&&P.shiftKey&&P.key==="Enter"){P.preventDefault(),!a&&!s&&n("all");return}if((P.ctrlKey||P.metaKey)&&P.key==="Enter"&&(P.preventDefault(),!a&&!s&&n("cursor")),P.key==="Tab"){P.preventDefault();const O=P.currentTarget,T=O.selectionStart,M=O.selectionEnd,R=t.substring(0,T)+" "+t.substring(M);e(R),setTimeout(()=>{O.selectionStart=O.selectionEnd=T+2},0)}},[t,e,n,a,s]),E=b.useMemo(()=>{if(!t)return"";try{return aa.highlight(t,aa.languages.sql,"sql")}catch{return t}},[t]),D=b.useMemo(()=>t.split(`
|
|
113
|
-
`).map((O,T)=>T+1),[t]),_=b.useCallback(()=>{var P;return((P=c.current)==null?void 0:P.selectionStart)??0},[]);return o.jsxs("div",{className:"query-editor",children:[o.jsxs("div",{className:"query-editor__toolbar",children:[o.jsxs("div",{className:"query-editor__buttons",children:[o.jsx("button",{className:"query-editor__execute",onClick:()=>n("cursor"),disabled:a||s||!t.trim(),title:i("terminal:database.executeShortcut"),children:s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"query-editor__spinner"}),i("common:status.running")]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"query-editor__play-icon",children:"▶"}),i(N?"terminal:database.runAtCursor":"terminal:database.runQuery")]})}),N&&o.jsxs("button",{className:"query-editor__execute-cursor",onClick:()=>n("all"),disabled:a||s||!t.trim(),title:i("terminal:database.executeCursorShortcut"),children:[o.jsx("span",{className:"query-editor__cursor-icon",children:"▶▶"}),i("terminal:database.runAll")]})]}),o.jsx("div",{className:"query-editor__hint",children:i(N?"terminal:database.pressCtrlEnterMulti":"terminal:database.pressCtrlEnter")})]}),o.jsxs("div",{className:"query-editor__input-wrapper",children:[o.jsx("div",{className:"query-editor__line-numbers",children:D.map(P=>o.jsx("span",{children:P},P))}),o.jsxs("div",{className:"query-editor__editor",style:{height:y},children:[o.jsx("pre",{ref:d,className:"query-editor__highlight","aria-hidden":"true",dangerouslySetInnerHTML:{__html:E+`
|
|
114
|
-
`}}),o.jsx("textarea",{ref:c,className:"query-editor__textarea",value:t,onChange:P=>e(P.target.value),onKeyDown:j,onScroll:k,placeholder:i(a?"terminal:database.selectDbPlaceholder":"terminal:database.enterQueryPlaceholder"),disabled:a,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off","data-cursor-pos":_()})]})]}),o.jsx("div",{className:"query-editor__resize-handle",onMouseDown:C})]})},uA=t=>`db-panel-${t}`,KU=({building:t})=>{var O,T,M,R,I,z;const e=bx(t.id),n=wL(t.id),s=kL(t.id),a=((O=t.database)==null?void 0:O.connections)??[],[r,i]=b.useState(""),[c,d]=b.useState(!1),f=b.useRef(null),h=b.useRef(null),m=b.useMemo(()=>{if(!r)return"";try{return aa.highlight(r,aa.languages.sql,"sql")}catch{return r}},[r]),x=b.useCallback(()=>{h.current&&f.current&&(h.current.scrollLeft=f.current.scrollLeft,h.current.scrollTop=f.current.scrollTop)},[]),y=e.activeConnectionId??((T=t.database)==null?void 0:T.activeConnectionId)??((M=a[0])==null?void 0:M.id),v=e.activeDatabase??((R=t.database)==null?void 0:R.activeDatabase),S=a.find(W=>W.id===y),C=y?((I=e.databases)==null?void 0:I.get(y))??[]:[],k=y&&v?((z=e.tables)==null?void 0:z.get(`${y}:${v}`))??[]:[];b.useEffect(()=>{if(!c&&a.length>0){try{const W=localStorage.getItem(uA(t.id));if(W){const $=JSON.parse(W);$.connectionId&&a.some(F=>F.id===$.connectionId)&&(U.setActiveConnection(t.id,$.connectionId),U.listDatabases(t.id,$.connectionId),$.database&&(U.setActiveDatabase(t.id,$.database),U.listTables(t.id,$.connectionId,$.database)),$.lastQuery&&i($.lastQuery))}}catch{}!e.activeConnectionId&&a[0]&&(U.setActiveConnection(t.id,a[0].id),U.listDatabases(t.id,a[0].id)),d(!0)}},[t.id,a,c,e.activeConnectionId]),b.useEffect(()=>{if(c)try{const W=uA(t.id),$=JSON.parse(localStorage.getItem(W)||"{}");$.lastQuery=r,y&&($.connectionId=y),v&&($.database=v),localStorage.setItem(W,JSON.stringify($))}catch{}},[t.id,r,y,v,c]);const N=b.useCallback(W=>{U.setActiveConnection(t.id,W),U.listDatabases(t.id,W)},[t.id]),j=b.useCallback(W=>{y&&(U.setActiveDatabase(t.id,W),U.listTables(t.id,y,W))},[t.id,y]),E=b.useCallback(()=>{var F;if(!y||!v||!r.trim()||s)return;const W=((F=f.current)==null?void 0:F.selectionStart)??0;if(Kx(r).length<=1)U.executeQuery(t.id,y,v,r.trim());else{const H=YU(r,W);H?U.executeQuery(t.id,y,v,H):U.executeQuery(t.id,y,v,r.trim())}},[t.id,y,v,r,s]),D=b.useCallback(W=>{(W.ctrlKey||W.metaKey)&&W.key==="Enter"&&(W.preventDefault(),E())},[E]),_=b.useCallback(W=>{const $=`SELECT * FROM ${W} LIMIT 100`;i($),y&&v&&U.executeQuery(t.id,y,v,$)},[t.id,y,v]),P=n[0];return a.length===0?o.jsx("div",{className:"db-inline",children:o.jsx("div",{className:"db-inline__empty",children:"🔌 No connections configured"})}):o.jsxs("div",{className:"db-inline",children:[o.jsxs("div",{className:"db-inline__toolbar",children:[a.length>1&&o.jsx("select",{className:"db-inline__select",value:y??"",onChange:W=>N(W.target.value),title:"Connection",children:a.map(W=>o.jsxs("option",{value:W.id,children:[W.engine==="mysql"?"🐬":"🐘"," ",W.name]},W.id))}),a.length===1&&S&&o.jsxs("span",{className:"db-inline__connection-badge",title:`${S.host}:${S.port}`,children:[S.engine==="mysql"?"🐬":"🐘"," ",S.name]}),o.jsxs("select",{className:"db-inline__select",value:v??"",onChange:W=>j(W.target.value),title:"Database",children:[o.jsx("option",{value:"",children:"Select database..."}),C.map(W=>o.jsx("option",{value:W,children:W},W))]}),k.length>0&&o.jsxs("select",{className:"db-inline__select db-inline__select--tables",value:"",onChange:W=>{W.target.value&&_(W.target.value)},title:"Quick query table",children:[o.jsxs("option",{value:"",children:["Tables (",k.length,")"]}),k.map(W=>o.jsx("option",{value:W.name,children:W.name},W.name))]}),o.jsx("button",{className:"db-inline__run",onClick:E,disabled:s||!v||!r.trim(),title:"Execute (Ctrl+Enter)",children:s?"⏳":"▶"})]}),o.jsxs("div",{className:"db-inline__editor",children:[o.jsx("pre",{ref:h,className:"db-inline__highlight","aria-hidden":"true",dangerouslySetInnerHTML:{__html:m+`
|
|
115
|
-
`}}),o.jsx("textarea",{ref:f,className:"db-inline__textarea",value:r,onChange:W=>i(W.target.value),onKeyDown:D,onScroll:x,placeholder:"SELECT * FROM ...",spellCheck:!1,rows:2})]}),o.jsx("div",{className:"db-inline__results",children:P?o.jsx(GU,{result:P,buildingId:t.id,building:t}):o.jsx("div",{className:"db-inline__empty",children:v?"Run a query or select a table above":"Select a database to get started"})})]})};function QU(){const t=b.useRef(!1),e=b.useRef(!1),n=b.useRef(null),s=b.useRef(0),a=b.useRef(!1),r=b.useRef(0),i=b.useRef(0),c=b.useRef(0),d=b.useCallback((v,S)=>{const C=document.querySelector(".app");C&&(C.style.setProperty("--keyboard-height",`${v}px`),C.style.setProperty("--keyboard-visible",S?"1":"0"),C.classList.toggle("keyboard-visible",S)),s.current=v,a.current=S},[]),f=b.useCallback(()=>{d(0,!1),e.current=!1},[d]),h=b.useCallback(()=>{r.current&&(cancelAnimationFrame(r.current),r.current=0),window.visualViewport&&n.current&&(window.visualViewport.removeEventListener("resize",n.current),window.visualViewport.removeEventListener("scroll",n.current),n.current=null)},[]),m=b.useCallback(()=>{if(t.current=!0,!(window.innerWidth<=768))return;if(h(),e.current=!0,!(typeof window.__nativeKeyboardHeight=="number")&&window.visualViewport){i.current=Math.max(0,window.innerHeight-(window.visualViewport.height+window.visualViewport.offsetTop)),c.current=window.innerHeight;const C=()=>{const k=window.visualViewport;k&&(r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(!t.current){f();return}const N=k.height+k.offsetTop,j=Math.max(0,window.innerHeight-N),E=Math.max(0,c.current-window.innerHeight),D=j>=120||E>=120;D||(i.current=j,c.current=window.innerHeight);const _=E>=120?0:D?Math.max(0,j):0;(_!==s.current||D!==a.current)&&d(_,D),D&&setTimeout(()=>{e.current=!1},300)}))};n.current=C,window.visualViewport.addEventListener("resize",C),window.visualViewport.addEventListener("scroll",C),C()}},[h,f,d]),x=b.useCallback(()=>{t.current=!1,window.innerWidth<=768&&setTimeout(()=>{t.current||(f(),h())},100)},[f,h]),y=b.useCallback(()=>{window.innerWidth<=768&&s.current>0&&(t.current=!1,f(),h())},[f,h]);return{isInputFocusedRef:t,keyboardScrollLockRef:e,handleInputFocus:m,handleInputBlur:x,cleanup:y}}function XU(){const[t,e]=b.useState(()=>{const d=Zb(ft.TERMINAL_HEIGHT,Hk);return d>=Uk&&d<=Wk?d:Hk}),n=b.useRef(!1),s=b.useRef(0),a=b.useRef(0),r=b.useRef(null),i=b.useRef(t);i.current=t;const c=b.useCallback(d=>{d.preventDefault(),n.current=!0,s.current=d.clientY,a.current=t,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",U.setTerminalResizing(!0)},[t]);return b.useEffect(()=>{const d=h=>{if(!n.current)return;const m=h.clientY-s.current,x=window.innerHeight,y=m/x*100,v=Math.min(Wk,Math.max(Uk,a.current+y));e(v)},f=()=>{n.current&&(n.current=!1,document.body.style.cursor="",document.body.style.userSelect="",ex(ft.TERMINAL_HEIGHT,i.current),U.setTerminalResizing(!1))};return document.addEventListener("mousemove",d),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",f)}},[]),{terminalHeight:t,terminalRef:r,handleResizeStart:c}}const JU=120,ZU=.7;function e6(){const[t,e]=b.useState(()=>Zb(ft.MOBILE_OVERVIEW_HEIGHT,0)),n=b.useRef(t);n.current=t;const s=b.useRef(0),a=b.useRef(0),r=()=>Math.floor(window.innerHeight*ZU),i=m=>Math.min(r(),Math.max(JU,m)),c=b.useCallback(m=>{e(m);const x=document.querySelector(".guake-terminal");x&&x.style.setProperty("--guake-mobile-overview-height",`${m}px`)},[]),d=b.useCallback(()=>{document.body.style.cursor="",document.body.style.userSelect="",ex(ft.MOBILE_OVERVIEW_HEIGHT,n.current),U.setTerminalResizing(!1)},[]),f=b.useCallback(m=>{m.preventDefault();const x=document.querySelector(".agent-overview-panel"),y=n.current>0?n.current:(x==null?void 0:x.getBoundingClientRect().height)??240;s.current=m.clientY,a.current=y,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",U.setTerminalResizing(!0);const v=C=>{const k=C.clientY-s.current;c(i(a.current+k))},S=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S),d()};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[c,d]),h=b.useCallback(m=>{if(m.touches.length!==1)return;const x=document.querySelector(".agent-overview-panel"),y=n.current>0?n.current:(x==null?void 0:x.getBoundingClientRect().height)??240;s.current=m.touches[0].clientY,a.current=y,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",U.setTerminalResizing(!0);const v=C=>{if(C.touches.length!==1)return;C.preventDefault();const k=C.touches[0].clientY-s.current;c(i(a.current+k))},S=()=>{document.removeEventListener("touchmove",v),document.removeEventListener("touchend",S),document.removeEventListener("touchcancel",S),d()};document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",S),document.addEventListener("touchcancel",S)},[c,d]);return{mobileOverviewHeight:t,handleResizeMouseDown:f,handleResizeTouchStart:h}}function t6({agents:t,selectedAgentId:e,isOpen:n,overviewPanelOpen:s,loadingHistory:a,hasModalOpen:r=!1,outputRef:i}){const c=rr(),d=gx(),h=Br().vibrationIntensity??1,m=()=>{if(typeof document>"u")return!1;const I=document.querySelector(".agent-bar");if(!I)return!1;const z=window.getComputedStyle(I);if(z.display==="none"||z.visibility==="hidden")return!1;const W=I.getBoundingClientRect();return W.width>0&&W.height>0},x=b.useMemo(()=>{const I=Array.from(t.values());if(!s&&m()){const K=XR(),q=I.filter(_e=>{if(U.isAgentInArchivedArea(_e.id))return!1;if(K){const me=U.getAreaForAgent(_e.id);if(!xp((me==null?void 0:me.id)??null))return!1}return!0}).sort((_e,me)=>(_e.createdAt||0)-(me.createdAt||0)),xe=ta(ft.AGENT_ORDER,[]),de=new Set(q.map(_e=>_e.id)),Z=xe.filter(_e=>de.has(_e)),be=q.filter(_e=>!Z.includes(_e.id)).map(_e=>_e.id),je=[...Z,...be],ce=new Map(q.map(_e=>[_e.id,_e])),Ee=je.map(_e=>ce.get(_e)).filter(_e=>_e!==void 0),ze=new Map;for(const _e of Ee){const me=U.getAreaForAgent(_e.id),De=(me==null?void 0:me.id)??null;ze.has(De)||ze.set(De,{name:(me==null?void 0:me.name)??"",agents:[]}),ze.get(De).agents.push(_e)}const Ge=Array.from(ze.entries());return Ge.sort(([_e,me],[De,te])=>_e===null&&De!==null?1:_e!==null&&De===null?-1:_e===null&&De===null?0:me.name.localeCompare(te.name)),Ge.flatMap(([,_e])=>_e.agents)}const z=ta(ft.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",sameAreaOnly:!1}),W=U.getState(),$=new Map;for(const K of d)$.has(K.agentId)||$.set(K.agentId,K.timestamp);const F=new Map;for(const K of I){const q=U.getAreaForAgent(K.id);!q||q.archived||F.set(K.id,q.id)}let H=I.filter(K=>{if(z.filterMode==="working"&&K.status!=="working"||z.filterMode==="idle"&&K.status!=="idle"||z.filterMode==="error"&&K.status!=="error")return!1;if(z.sameAreaOnly&&e){const q=F.get(e)??null,xe=F.get(K.id)??null;if(q!==xe)return!1}return!0});const V=K=>[...K].sort((q,xe)=>{const de=!!(q.isBoss||q.class==="boss"),Z=!!(xe.isBoss||xe.class==="boss");if(de!==Z)return de?-1:1;if(z.sortMode==="name")return q.name.localeCompare(xe.name);if(z.sortMode==="status"){const ce=["working","waiting_input","waiting_permission","error","idle","stopped"],Ee=ce.indexOf(q.status)-ce.indexOf(xe.status);if(Ee!==0)return Ee;const ze=W.agentsWithUnseenOutput.has(q.id),Ge=W.agentsWithUnseenOutput.has(xe.id);if(ze!==Ge)return ze?-1:1;if(q.status==="working"&&xe.status==="working")return q.name.localeCompare(xe.name);if(q.status==="idle"&&xe.status==="idle"){const _e=!!q.taskLabel,me=!!xe.taskLabel;return _e!==me?_e?-1:1:(xe.lastActivity||0)-(q.lastActivity||0)}return(xe.lastActivity||0)-(q.lastActivity||0)}const be=$.get(q.id)||0;return($.get(xe.id)||0)-be});if(!z.groupByArea)return V(H);const G=[],B=new Set;for(const[K,q]of c){if(q.archived)continue;const xe=H.filter(de=>F.get(de.id)===K);if(xe.length>0){const de=V(xe);G.push(...de);for(const Z of de)B.add(Z.id)}}const Q=V(H.filter(K=>!B.has(K.id)));return G.push(...Q),H=G,H},[t,c,d,e,s]),[y,v]=b.useState(0),[S,C]=b.useState(""),k=b.useRef(null),[N,j]=b.useState(null),E=e?x.findIndex(I=>I.id===e):-1,D=E>0?x[E-1]:x[x.length-1],_=E<x.length-1?x[E+1]:x[0],P=b.useRef(null),O=b.useCallback(()=>{if(!e||x.length<=1)return;const I=x.findIndex(W=>W.id===e);if(I===-1)return;const z=(I-1+x.length)%x.length;j("left"),v(0),C(""),U.setLastSelectionViaSwipe(!0),U.selectAgent(x[z].id)},[e,x]),T=b.useCallback(()=>{if(!e||x.length<=1)return;const I=x.findIndex(W=>W.id===e);if(I===-1)return;const z=(I+1)%x.length;j("right"),v(0),C(""),U.setLastSelectionViaSwipe(!0),U.selectAgent(x[z].id)},[e,x]),M=b.useCallback(I=>{v(I),C("is-swiping")},[]),R=b.useCallback(()=>{C("is-animating"),v(0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{C("")},100)},[]);return b.useEffect(()=>{if(!N||a)return;const I=N;j(null),requestAnimationFrame(()=>{C(I==="left"?"swipe-in-left":"swipe-in-right"),k.current=setTimeout(()=>{C("")},120)})},[N,a]),b.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),vk(P,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:40,maxVerticalMovement:50,vibrationIntensity:h}),vk(i,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:50,maxVerticalMovement:35,vibrationIntensity:h}),b.useEffect(()=>{const I=z=>{if(!n||x.length<=1||r)return;const W=U.getShortcuts(),$=W.find(Q=>Q.id==="prev-working-agent"),F=W.find(Q=>Q.id==="next-working-agent"),H=W.find(Q=>Q.id==="prev-agent-terminal"),V=W.find(Q=>Q.id==="next-agent-terminal"),G=z.altKey&&z.shiftKey&&!z.ctrlKey&&!z.metaKey&&z.code==="KeyJ",B=z.altKey&&z.shiftKey&&!z.ctrlKey&&!z.metaKey&&z.code==="KeyK";if(kn(z,$)){z.preventDefault();const Q=U.getState();let K=x.filter(de=>Q.agentsWithUnseenOutput.has(de.id));if(K.length===0&&(K=x.filter(de=>de.status==="working")),K.length===0)return;const q=e?K.findIndex(de=>de.id===e):-1,xe=q===-1?K.length-1:(q-1+K.length)%K.length;U.selectAgent(K[xe].id);return}if(kn(z,F)){z.preventDefault();const Q=U.getState();let K=x.filter(de=>Q.agentsWithUnseenOutput.has(de.id));if(K.length===0&&(K=x.filter(de=>de.status==="working")),K.length===0)return;const q=e?K.findIndex(de=>de.id===e):-1,xe=q===-1?0:(q+1)%K.length;U.selectAgent(K[xe].id);return}if(kn(z,H)||B){z.preventDefault(),O();return}if(kn(z,V)||G){z.preventDefault(),T();return}};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n,x,e,O,T,r]),{sortedAgents:x,swipeOffset:y,swipeAnimationClass:S,currentAgentIndex:E,prevAgent:D,nextAgent:_,headerRef:P,outputRef:i,handleSwipeLeft:O,handleSwipeRight:T}}const n6=3e4;function s6(t){const[e,n]=b.useState(new Map),[s,a]=b.useState(new Set),r=b.useRef(null),i=b.useMemo(()=>!t||t.length===0?null:[...new Set(t.map(h=>h.dir))].sort(),[t]),c=i?i.join(`
|
|
116
|
-
`):"",d=b.useCallback(async()=>{if(!i||i.length===0){n(new Map);return}const h=Ni(),m={};h&&(m.Authorization=`Bearer ${h}`);const x=Sa(),y=new Map;await Promise.all(i.map(async v=>{try{const S=await fetch(`${x}/api/files/git-branch?path=${encodeURIComponent(v)}`,{headers:m});if(S.ok){const C=await S.json();C.branch&&y.set(v,{branch:C.branch,ahead:C.ahead||0,behind:C.behind||0})}}catch{}})),n(y)},[i]);b.useEffect(()=>{if(!i||i.length===0){n(new Map);return}return d(),r.current=setInterval(d,n6),()=>{r.current&&clearInterval(r.current)}},[c,d]);const f=b.useCallback(async h=>{a(m=>new Set(m).add(h));try{await Lt(Mt("/api/files/git-fetch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:h})}),await d()}catch{}finally{a(m=>{const x=new Set(m);return x.delete(h),x})}},[d]);return{branches:e,fetchRemote:f,fetchingDirs:s,refetch:d}}const a6={id:"dracula",name:"Dracula",description:"Vampire purple with fangs pink",colors:{bgPrimary:"#282a36",bgSecondary:"#21222c",bgTertiary:"#343746",borderColor:"#44475a",textPrimary:"#f8f8f2",textSecondary:"#bfbfbf",textMuted:"#6272a4",accentBlue:"#8be9fd",accentGreen:"#50fa7b",accentOrange:"#ffb86c",accentRed:"#ff5555",accentPurple:"#bd93f9",accentCyan:"#8be9fd",accentClaude:"#50fa7b",accentClaudeLight:"#69ff94",accentPink:"#ff79c6",accentYellow:"#f1fa8c",msgUserBg:"rgba(189, 147, 249, 0.12)",msgUserBorder:"#bd93f9",msgUserText:"#bd93f9",msgAssistantBg:"rgba(255, 121, 198, 0.12)",msgAssistantBorder:"#ff79c6",msgAssistantText:"#ff79c6",toolUseBg:"rgba(255, 184, 108, 0.08)",toolUseBorder:"#ffb86c",toolUseText:"#ffb86c",toolUseName:"#8be9fd",toolResultBg:"rgba(80, 250, 123, 0.08)",toolResultBorder:"#50fa7b",toolResultText:"#50fa7b",outputLineBg:"rgba(189, 147, 249, 0.04)",contextBarBg:"rgba(189, 147, 249, 0.25)",contextBarFill:"#bd93f9",taskLabelColor:"#ff79c6"}},eT={id:"muted",name:"Muted",description:"Foggy dawn through frosted glass",colors:{bgPrimary:"#16181c",bgSecondary:"#1c1f24",bgTertiary:"#24282e",borderColor:"#33393f",textPrimary:"#c8ccd4",textSecondary:"#9099a4",textMuted:"#5c6670",accentBlue:"#7aa8c8",accentGreen:"#8ab898",accentOrange:"#c8a878",accentRed:"#c88888",accentPurple:"#a898b8",accentCyan:"#88b8c0",accentClaude:"#8ab898",accentClaudeLight:"#9ac8a8",accentPink:"#b898a8",accentYellow:"#c8c098",msgUserBg:"rgba(138, 184, 152, 0.06)",msgUserBorder:"rgba(138, 184, 152, 0.3)",msgUserText:"#8ab898",msgAssistantBg:"rgba(168, 152, 184, 0.06)",msgAssistantBorder:"rgba(168, 152, 184, 0.3)",msgAssistantText:"#a898b8",toolUseBg:"rgba(200, 168, 120, 0.05)",toolUseBorder:"rgba(200, 168, 120, 0.3)",toolUseText:"#c8a878",toolUseName:"#88b8c0",toolResultBg:"rgba(136, 184, 192, 0.05)",toolResultBorder:"rgba(136, 184, 192, 0.3)",toolResultText:"#88b8c0",outputLineBg:"rgba(144, 153, 164, 0.03)",contextBarBg:"rgba(168, 152, 184, 0.2)",contextBarFill:"#a898b8",taskLabelColor:"#c8a878"}},r6={id:"muted-red",name:"Rosewood",description:"Aged wine by candlelight",colors:{bgPrimary:"#1a1014",bgSecondary:"#221418",bgTertiary:"#2c1c20",borderColor:"#482830",textPrimary:"#f0e4e8",textSecondary:"#c8b0b8",textMuted:"#8c6878",accentBlue:"#8898c8",accentGreen:"#78a890",accentOrange:"#d8a068",accentRed:"#c85868",accentPurple:"#a878a0",accentCyan:"#88a8b0",accentClaude:"#78a890",accentClaudeLight:"#88b8a0",accentPink:"#d88898",accentYellow:"#d8c088",msgUserBg:"rgba(216, 136, 152, 0.10)",msgUserBorder:"#d88898",msgUserText:"#d88898",msgAssistantBg:"rgba(200, 88, 104, 0.10)",msgAssistantBorder:"#c85868",msgAssistantText:"#c85868",toolUseBg:"rgba(216, 160, 104, 0.08)",toolUseBorder:"#d8a068",toolUseText:"#d8a068",toolUseName:"#d8c088",toolResultBg:"rgba(168, 120, 160, 0.08)",toolResultBorder:"#a878a0",toolResultText:"#a878a0",outputLineBg:"rgba(200, 88, 104, 0.03)",contextBarBg:"rgba(216, 136, 152, 0.25)",contextBarFill:"#d88898",taskLabelColor:"#d8c088"}},i6={id:"nord",name:"Nord",description:"Polar night with aurora",colors:{bgPrimary:"#2e3440",bgSecondary:"#3b4252",bgTertiary:"#434c5e",borderColor:"#4c566a",textPrimary:"#eceff4",textSecondary:"#d8dee9",textMuted:"#7b88a1",accentBlue:"#81a1c1",accentGreen:"#a3be8c",accentOrange:"#d08770",accentRed:"#bf616a",accentPurple:"#b48ead",accentCyan:"#88c0d0",accentClaude:"#a3be8c",accentClaudeLight:"#b3ce9c",accentPink:"#b48ead",accentYellow:"#ebcb8b",msgUserBg:"rgba(136, 192, 208, 0.10)",msgUserBorder:"#88c0d0",msgUserText:"#88c0d0",msgAssistantBg:"rgba(163, 190, 140, 0.10)",msgAssistantBorder:"#a3be8c",msgAssistantText:"#a3be8c",toolUseBg:"rgba(208, 135, 112, 0.08)",toolUseBorder:"#d08770",toolUseText:"#d08770",toolUseName:"#ebcb8b",toolResultBg:"rgba(180, 142, 173, 0.08)",toolResultBorder:"#b48ead",toolResultText:"#b48ead",outputLineBg:"rgba(67, 76, 94, 0.3)",contextBarBg:"rgba(129, 161, 193, 0.25)",contextBarFill:"#81a1c1",taskLabelColor:"#ebcb8b"}},o6={id:"solarized-dark",name:"Solarized",description:"Precision-engineered contrast",colors:{bgPrimary:"#002b36",bgSecondary:"#073642",bgTertiary:"#094652",borderColor:"#586e75",textPrimary:"#93a1a1",textSecondary:"#839496",textMuted:"#657b83",accentBlue:"#268bd2",accentGreen:"#859900",accentOrange:"#cb4b16",accentRed:"#dc322f",accentPurple:"#6c71c4",accentCyan:"#2aa198",accentClaude:"#859900",accentClaudeLight:"#95a910",accentPink:"#d33682",accentYellow:"#b58900",msgUserBg:"rgba(42, 161, 152, 0.12)",msgUserBorder:"#2aa198",msgUserText:"#2aa198",msgAssistantBg:"rgba(133, 153, 0, 0.12)",msgAssistantBorder:"#859900",msgAssistantText:"#859900",toolUseBg:"rgba(203, 75, 22, 0.10)",toolUseBorder:"#cb4b16",toolUseText:"#cb4b16",toolUseName:"#b58900",toolResultBg:"rgba(108, 113, 196, 0.10)",toolResultBorder:"#6c71c4",toolResultText:"#6c71c4",outputLineBg:"rgba(7, 54, 66, 0.5)",contextBarBg:"rgba(38, 139, 210, 0.25)",contextBarFill:"#268bd2",taskLabelColor:"#b58900"}},l6={id:"monokai",name:"Monokai",description:"Neon jungle on warm charcoal",colors:{bgPrimary:"#272822",bgSecondary:"#1e1f1a",bgTertiary:"#3e3d32",borderColor:"#49483e",textPrimary:"#f8f8f2",textSecondary:"#cfcfc2",textMuted:"#75715e",accentBlue:"#66d9ef",accentGreen:"#a6e22e",accentOrange:"#fd971f",accentRed:"#f92672",accentPurple:"#ae81ff",accentCyan:"#66d9ef",accentClaude:"#a6e22e",accentClaudeLight:"#b6f23e",accentPink:"#f92672",accentYellow:"#e6db74",msgUserBg:"rgba(249, 38, 114, 0.10)",msgUserBorder:"#f92672",msgUserText:"#f92672",msgAssistantBg:"rgba(166, 226, 46, 0.10)",msgAssistantBorder:"#a6e22e",msgAssistantText:"#a6e22e",toolUseBg:"rgba(253, 151, 31, 0.08)",toolUseBorder:"#fd971f",toolUseText:"#fd971f",toolUseName:"#66d9ef",toolResultBg:"rgba(174, 129, 255, 0.08)",toolResultBorder:"#ae81ff",toolResultText:"#ae81ff",outputLineBg:"rgba(62, 61, 50, 0.3)",contextBarBg:"rgba(249, 38, 114, 0.25)",contextBarFill:"#f92672",taskLabelColor:"#fd971f"}},c6={id:"gruvbox",name:"Gruvbox",description:"Retro coffee shop warmth",colors:{bgPrimary:"#282828",bgSecondary:"#1d2021",bgTertiary:"#3c3836",borderColor:"#504945",textPrimary:"#ebdbb2",textSecondary:"#d5c4a1",textMuted:"#928374",accentBlue:"#83a598",accentGreen:"#b8bb26",accentOrange:"#fe8019",accentRed:"#fb4934",accentPurple:"#d3869b",accentCyan:"#8ec07c",accentClaude:"#b8bb26",accentClaudeLight:"#c8cb36",accentPink:"#d3869b",accentYellow:"#fabd2f",msgUserBg:"rgba(254, 128, 25, 0.10)",msgUserBorder:"#fe8019",msgUserText:"#fe8019",msgAssistantBg:"rgba(142, 192, 124, 0.10)",msgAssistantBorder:"#8ec07c",msgAssistantText:"#8ec07c",toolUseBg:"rgba(250, 189, 47, 0.08)",toolUseBorder:"#fabd2f",toolUseText:"#fabd2f",toolUseName:"#83a598",toolResultBg:"rgba(211, 134, 155, 0.08)",toolResultBorder:"#d3869b",toolResultText:"#d3869b",outputLineBg:"rgba(60, 56, 54, 0.4)",contextBarBg:"rgba(254, 128, 25, 0.25)",contextBarFill:"#fe8019",taskLabelColor:"#fabd2f"}},u6={id:"atom",name:"Atom",description:"Deep space exploration",colors:{bgPrimary:"#0c1014",bgSecondary:"#121820",bgTertiary:"#1a222c",borderColor:"#283040",textPrimary:"#d8e0f0",textSecondary:"#9ca8c0",textMuted:"#5a6880",accentBlue:"#5dade2",accentGreen:"#58d68d",accentOrange:"#f0b060",accentRed:"#ec7063",accentPurple:"#af7ac5",accentCyan:"#48c9b0",accentClaude:"#58d68d",accentClaudeLight:"#68e69d",accentPink:"#f1948a",accentYellow:"#f7dc6f",msgUserBg:"rgba(93, 173, 226, 0.10)",msgUserBorder:"#5dade2",msgUserText:"#5dade2",msgAssistantBg:"rgba(88, 214, 141, 0.10)",msgAssistantBorder:"#58d68d",msgAssistantText:"#58d68d",toolUseBg:"rgba(240, 176, 96, 0.08)",toolUseBorder:"#f0b060",toolUseText:"#f0b060",toolUseName:"#48c9b0",toolResultBg:"rgba(175, 122, 197, 0.08)",toolResultBorder:"#af7ac5",toolResultText:"#af7ac5",outputLineBg:"rgba(26, 34, 44, 0.5)",contextBarBg:"rgba(175, 122, 197, 0.25)",contextBarFill:"#af7ac5",taskLabelColor:"#f7dc6f"}},d6={id:"cyberpunk",name:"Cyberpunk",description:"Neon noir dystopia",colors:{bgPrimary:"#030308",bgSecondary:"#08080f",bgTertiary:"#101018",borderColor:"#181828",textPrimary:"#e8e8ff",textSecondary:"#a0a0c8",textMuted:"#5050a0",accentBlue:"#00f0ff",accentGreen:"#00ff9f",accentOrange:"#ff6600",accentRed:"#ff003c",accentPurple:"#bf00ff",accentCyan:"#00f0ff",accentClaude:"#00ff9f",accentClaudeLight:"#50ffbf",accentPink:"#ff00aa",accentYellow:"#fff000",msgUserBg:"rgba(255, 0, 170, 0.12)",msgUserBorder:"#ff00aa",msgUserText:"#ff00aa",msgAssistantBg:"rgba(0, 255, 159, 0.10)",msgAssistantBorder:"#00ff9f",msgAssistantText:"#00ff9f",toolUseBg:"rgba(191, 0, 255, 0.10)",toolUseBorder:"#bf00ff",toolUseText:"#bf00ff",toolUseName:"#00f0ff",toolResultBg:"rgba(0, 240, 255, 0.08)",toolResultBorder:"#00f0ff",toolResultText:"#00f0ff",outputLineBg:"rgba(191, 0, 255, 0.03)",contextBarBg:"rgba(255, 0, 170, 0.30)",contextBarFill:"#ff00aa",taskLabelColor:"#fff000"}},f6={id:"synthwave",name:"Synthwave",description:"Sunset over chrome horizon",colors:{bgPrimary:"#241b30",bgSecondary:"#1a1424",bgTertiary:"#2e2540",borderColor:"#4a3860",textPrimary:"#f8e8f8",textSecondary:"#c8a8d0",textMuted:"#7860a0",accentBlue:"#2de2e6",accentGreen:"#0abdc6",accentOrange:"#ff9e64",accentRed:"#ff3864",accentPurple:"#9d4edd",accentCyan:"#2de2e6",accentClaude:"#0abdc6",accentClaudeLight:"#2ad0d8",accentPink:"#f706cf",accentYellow:"#fede5d",msgUserBg:"rgba(247, 6, 207, 0.12)",msgUserBorder:"#f706cf",msgUserText:"#f706cf",msgAssistantBg:"rgba(45, 226, 230, 0.10)",msgAssistantBorder:"#2de2e6",msgAssistantText:"#2de2e6",toolUseBg:"rgba(255, 158, 100, 0.10)",toolUseBorder:"#ff9e64",toolUseText:"#ff9e64",toolUseName:"#fede5d",toolResultBg:"rgba(157, 78, 221, 0.10)",toolResultBorder:"#9d4edd",toolResultText:"#9d4edd",outputLineBg:"rgba(157, 78, 221, 0.05)",contextBarBg:"rgba(247, 6, 207, 0.25)",contextBarFill:"#f706cf",taskLabelColor:"#fede5d"}},p6={id:"abyss",name:"Abyss",description:"Pitch-black void, vivid accents",colors:{bgPrimary:"#08090c",bgSecondary:"#0e1014",bgTertiary:"#16181e",borderColor:"#242830",textPrimary:"#b0b4bc",textSecondary:"#808690",textMuted:"#4c5058",accentBlue:"#3d8ab8",accentGreen:"#3ea868",accentOrange:"#c07848",accentRed:"#b84848",accentPurple:"#8060b0",accentCyan:"#3ca8a8",accentClaude:"#3ea868",accentClaudeLight:"#50b878",accentPink:"#a85880",accentYellow:"#b8a840",msgUserBg:"#181c24",msgUserBorder:"#6a4e96",msgUserText:"#d0d4dc",msgAssistantBg:"#12161e",msgAssistantBorder:"#1c3838",msgAssistantText:"#a0a8b4",toolUseBg:"#161a22",toolUseBorder:"#3a2820",toolUseText:"#989ea8",toolUseName:"#c07848",toolResultBg:"#121824",toolResultBorder:"#202038",toolResultText:"#989ea8",outputLineBg:"#0a0c10",contextBarBg:"rgba(60, 68, 76, 0.25)",contextBarFill:"#4c5460",taskLabelColor:"#c07848"}},h6={id:"obsidian-bloom",name:"Obsidian Bloom",description:"Ultra-dark graphite with subtle cool borders",colors:{bgPrimary:"#050608",bgSecondary:"#0a0b0f",bgTertiary:"#111319",borderColor:"#2a2f3a",textPrimary:"#c4cad4",textSecondary:"#9aa3b1",textMuted:"#67707d",accentBlue:"#8aa3c7",accentGreen:"#82a39a",accentOrange:"#b39479",accentRed:"#ad7d8a",accentPurple:"#9a8fbd",accentCyan:"#86a8b7",accentClaude:"#9ca6c9",accentClaudeLight:"#bcc3df",accentPink:"#aa92bb",accentYellow:"#b8ac8f",msgUserBg:"rgba(21, 26, 35, 0.92)",msgUserBorder:"#4c627f",msgUserText:"#b8c8df",msgAssistantBg:"rgba(22, 20, 32, 0.92)",msgAssistantBorder:"#5d5479",msgAssistantText:"#c2bcdb",toolUseBg:"rgba(28, 23, 20, 0.9)",toolUseBorder:"#6b5646",toolUseText:"#c8b3a1",toolUseName:"#b8ac8f",toolResultBg:"rgba(20, 23, 30, 0.9)",toolResultBorder:"#4e5a73",toolResultText:"#b0bdd2",outputLineBg:"rgba(10, 11, 15, 0.7)",contextBarBg:"rgba(94, 106, 126, 0.22)",contextBarFill:"#6f7f99",taskLabelColor:"#9ea6b8"}},m6={id:"catppuccin",name:"Catppuccin",description:"Cozy pastel mocha cafe",colors:{bgPrimary:"#1e1e2e",bgSecondary:"#181825",bgTertiary:"#313244",borderColor:"#45475a",textPrimary:"#cdd6f4",textSecondary:"#bac2de",textMuted:"#6c7086",accentBlue:"#89b4fa",accentGreen:"#a6e3a1",accentOrange:"#fab387",accentRed:"#f38ba8",accentPurple:"#cba6f7",accentCyan:"#94e2d5",accentClaude:"#a6e3a1",accentClaudeLight:"#b6f3b1",accentPink:"#f5c2e7",accentYellow:"#f9e2af",msgUserBg:"rgba(180, 190, 254, 0.10)",msgUserBorder:"#b4befe",msgUserText:"#b4befe",msgAssistantBg:"rgba(148, 226, 213, 0.10)",msgAssistantBorder:"#94e2d5",msgAssistantText:"#94e2d5",toolUseBg:"rgba(250, 179, 135, 0.08)",toolUseBorder:"#fab387",toolUseText:"#fab387",toolUseName:"#f9e2af",toolResultBg:"rgba(203, 166, 247, 0.08)",toolResultBorder:"#cba6f7",toolResultText:"#cba6f7",outputLineBg:"rgba(49, 50, 68, 0.4)",contextBarBg:"rgba(245, 194, 231, 0.25)",contextBarFill:"#f5c2e7",taskLabelColor:"#fab387"}},g6={id:"github-dark",name:"GitHub Dark",description:"Developer professional minimal",colors:{bgPrimary:"#0d1117",bgSecondary:"#161b22",bgTertiary:"#21262d",borderColor:"#30363d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#484f58",accentBlue:"#58a6ff",accentGreen:"#3fb950",accentOrange:"#d29922",accentRed:"#f85149",accentPurple:"#a371f7",accentCyan:"#79c0ff",accentClaude:"#3fb950",accentClaudeLight:"#56d364",accentPink:"#f778ba",accentYellow:"#e3b341",msgUserBg:"rgba(88, 166, 255, 0.08)",msgUserBorder:"#58a6ff",msgUserText:"#58a6ff",msgAssistantBg:"rgba(63, 185, 80, 0.08)",msgAssistantBorder:"#3fb950",msgAssistantText:"#3fb950",toolUseBg:"rgba(210, 153, 34, 0.08)",toolUseBorder:"#d29922",toolUseText:"#d29922",toolUseName:"#79c0ff",toolResultBg:"rgba(163, 113, 247, 0.08)",toolResultBorder:"#a371f7",toolResultText:"#a371f7",outputLineBg:"rgba(33, 38, 45, 0.5)",contextBarBg:"rgba(88, 166, 255, 0.25)",contextBarFill:"#58a6ff",taskLabelColor:"#d29922"}},b6={id:"one-dark",name:"One Dark",description:"Moonlit late night coding",colors:{bgPrimary:"#282c34",bgSecondary:"#21252b",bgTertiary:"#2c323c",borderColor:"#3e4451",textPrimary:"#abb2bf",textSecondary:"#828997",textMuted:"#5c6370",accentBlue:"#61afef",accentGreen:"#98c379",accentOrange:"#d19a66",accentRed:"#e06c75",accentPurple:"#c678dd",accentCyan:"#56b6c2",accentClaude:"#98c379",accentClaudeLight:"#a8d389",accentPink:"#e06c75",accentYellow:"#e5c07b",msgUserBg:"rgba(86, 182, 194, 0.10)",msgUserBorder:"#56b6c2",msgUserText:"#56b6c2",msgAssistantBg:"rgba(152, 195, 121, 0.10)",msgAssistantBorder:"#98c379",msgAssistantText:"#98c379",toolUseBg:"rgba(209, 154, 102, 0.08)",toolUseBorder:"#d19a66",toolUseText:"#d19a66",toolUseName:"#e5c07b",toolResultBg:"rgba(198, 120, 221, 0.08)",toolResultBorder:"#c678dd",toolResultText:"#c678dd",outputLineBg:"rgba(44, 50, 60, 0.5)",contextBarBg:"rgba(97, 175, 239, 0.25)",contextBarFill:"#61afef",taskLabelColor:"#d19a66"}},x6={id:"midnight-harbor",name:"Midnight Harbor",description:"Low-glare ocean twilight",colors:{bgPrimary:"#0e141d",bgSecondary:"#151d28",bgTertiary:"#1f2a38",borderColor:"#33465a",textPrimary:"#d9e2ed",textSecondary:"#aebdce",textMuted:"#7f93a8",accentBlue:"#7baed6",accentGreen:"#7fc3b8",accentOrange:"#cfa77f",accentRed:"#c9879c",accentPurple:"#9b9fd1",accentCyan:"#79bccc",accentClaude:"#8ea8d9",accentClaudeLight:"#b2c2e8",accentPink:"#c79fbe",accentYellow:"#d7c28f",msgUserBg:"rgba(123, 174, 214, 0.12)",msgUserBorder:"#7baed6",msgUserText:"#9cc3e2",msgAssistantBg:"rgba(142, 168, 217, 0.12)",msgAssistantBorder:"#8ea8d9",msgAssistantText:"#b2c2e8",toolUseBg:"rgba(207, 167, 127, 0.10)",toolUseBorder:"#cfa77f",toolUseText:"#ddbf9f",toolUseName:"#d7c28f",toolResultBg:"rgba(155, 159, 209, 0.10)",toolResultBorder:"#9b9fd1",toolResultText:"#b9bbe2",outputLineBg:"rgba(31, 42, 56, 0.5)",contextBarBg:"rgba(123, 174, 214, 0.24)",contextBarFill:"#7baed6",taskLabelColor:"#d7c28f"}},y6={id:"ember-noir",name:"Ember Noir",description:"Soft plum dusk with rose-indigo accents",colors:{bgPrimary:"#151118",bgSecondary:"#1d1723",bgTertiary:"#292132",borderColor:"#473b56",textPrimary:"#e7deed",textSecondary:"#c4b4d0",textMuted:"#93839f",accentBlue:"#88a9d6",accentGreen:"#8ab9ad",accentOrange:"#cf9b79",accentRed:"#cb8a9b",accentPurple:"#ae8ec8",accentCyan:"#86b8c6",accentClaude:"#9ca7df",accentClaudeLight:"#bcc3ea",accentPink:"#cd9fbc",accentYellow:"#d5bf93",msgUserBg:"rgba(203, 138, 155, 0.12)",msgUserBorder:"#cb8a9b",msgUserText:"#d7a6b3",msgAssistantBg:"rgba(156, 167, 223, 0.12)",msgAssistantBorder:"#9ca7df",msgAssistantText:"#bcc3ea",toolUseBg:"rgba(213, 191, 147, 0.10)",toolUseBorder:"#d5bf93",toolUseText:"#e0cfad",toolUseName:"#88a9d6",toolResultBg:"rgba(174, 142, 200, 0.10)",toolResultBorder:"#ae8ec8",toolResultText:"#c6aed8",outputLineBg:"rgba(41, 33, 50, 0.52)",contextBarBg:"rgba(203, 138, 155, 0.24)",contextBarFill:"#cb8a9b",taskLabelColor:"#d5bf93"}},v6={id:"classic",name:"Classic",description:"Original transparent style",colors:{bgPrimary:"#0d0d14",bgSecondary:"#14141e",bgTertiary:"#1c1c28",borderColor:"#2a2a3a",textPrimary:"#d0d0d8",textSecondary:"#8a8a98",textMuted:"#5a6a8a",accentBlue:"#5a8fd4",accentGreen:"#50fa7b",accentOrange:"#c89a5a",accentRed:"#c85a5a",accentPurple:"#9a80c0",accentCyan:"#8be9fd",accentClaude:"#50fa7b",accentClaudeLight:"#69ff94",accentPink:"#c87a9a",accentYellow:"#c8c87a",msgUserBg:"rgba(139, 233, 253, 0.12)",msgUserBorder:"transparent",msgUserText:"#8be9fd",msgAssistantBg:"rgba(80, 250, 123, 0.12)",msgAssistantBorder:"transparent",msgAssistantText:"#50fa7b",toolUseBg:"rgba(255, 184, 108, 0.05)",toolUseBorder:"transparent",toolUseText:"#8be9fd",toolUseName:"#ffb86c",toolResultBg:"rgba(80, 250, 123, 0.06)",toolResultBorder:"transparent",toolResultText:"#50fa7b",outputLineBg:"transparent",contextBarBg:"rgba(106, 154, 120, 0.25)",contextBarFill:"#6a9a78",taskLabelColor:"#8be9fd"}},Js=[v6,p6,h6,a6,eT,r6,i6,o6,l6,c6,u6,d6,f6,m6,g6,b6,x6,y6];function du(t){return Js.find(e=>e.id===t)||eT}const w6="classic";function lp(t){const e=document.documentElement,{colors:n}=t;e.style.setProperty("--bg-primary",n.bgPrimary),e.style.setProperty("--bg-secondary",n.bgSecondary),e.style.setProperty("--bg-tertiary",n.bgTertiary),e.style.setProperty("--border-color",n.borderColor),e.style.setProperty("--text-primary",n.textPrimary),e.style.setProperty("--text-secondary",n.textSecondary),e.style.setProperty("--text-muted",n.textMuted),e.style.setProperty("--accent-blue",n.accentBlue),e.style.setProperty("--accent-green",n.accentGreen),e.style.setProperty("--accent-orange",n.accentOrange),e.style.setProperty("--accent-red",n.accentRed),e.style.setProperty("--accent-purple",n.accentPurple),e.style.setProperty("--accent-cyan",n.accentCyan),e.style.setProperty("--accent-claude",n.accentClaude),e.style.setProperty("--accent-claude-light",n.accentClaudeLight),e.style.setProperty("--accent-pink",n.accentPink),e.style.setProperty("--accent-yellow",n.accentYellow),e.style.setProperty("--msg-user-bg",n.msgUserBg),e.style.setProperty("--msg-user-border",n.msgUserBorder),e.style.setProperty("--msg-user-text",n.msgUserText),e.style.setProperty("--msg-assistant-bg",n.msgAssistantBg),e.style.setProperty("--msg-assistant-border",n.msgAssistantBorder),e.style.setProperty("--msg-assistant-text",n.msgAssistantText),e.style.setProperty("--tool-use-bg",n.toolUseBg),e.style.setProperty("--tool-use-border",n.toolUseBorder),e.style.setProperty("--tool-use-text",n.toolUseText),e.style.setProperty("--tool-use-name",n.toolUseName),e.style.setProperty("--tool-result-bg",n.toolResultBg),e.style.setProperty("--tool-result-border",n.toolResultBorder),e.style.setProperty("--tool-result-text",n.toolResultText),e.style.setProperty("--output-line-bg",n.outputLineBg),e.style.setProperty("--context-bar-bg",n.contextBarBg),e.style.setProperty("--context-bar-fill",n.contextBarFill),e.style.setProperty("--task-label-color",n.taskLabelColor);try{localStorage.setItem("tide-theme",t.id)}catch{}}function Qx(){try{const t=localStorage.getItem("tide-theme");if(t&&Js.some(e=>e.id===t))return t}catch{}return w6}function k6(){const t=Qx(),e=du(t);lp(e)}const S6=b.memo(function({selectedAgent:e,selectedAgentId:n,sortedAgents:s,swipeOffset:a,viewMode:r,setViewMode:i,searchMode:c,toggleSearch:d,closeSearch:f,debugPanelOpen:h,setDebugPanelOpen:m,debuggerEnabled:x,setDebuggerEnabled:y,outputsLength:v,setContextConfirm:S,headerRef:C,isSnapshotView:k=!1,onSaveSnapshot:N,overviewPanelOpen:j=!1,setOverviewPanelOpen:E,agentInfoOpen:D=!1,onToggleAgentInfo:_,isFullscreen:P=!1,onToggleFullscreen:O,onNavigateBack:T,onNavigateForward:M,canNavigateBack:R=!1,canNavigateForward:I=!1,gitPanelOpen:z=!1,setGitPanelOpen:W,buildingsPanelOpen:$=!1,setBuildingsPanelOpen:F,workflowPanelOpen:H=!1,setWorkflowPanelOpen:V,hasWorkflow:G=!1,trackingBoardVisible:B=!1,setTrackingBoardVisible:Q}){var oe,he;const{t:K}=pt(["terminal","common"]),q=oL();Br();const xe=Dj(n),de=()=>{const ne=rg.indexOf(r),Le=rg[(ne+1)%rg.length];i(Le),er(ft.VIEW_MODE,Le)},Z=()=>{const ne=!h;m(ne),ne&&!x&&(y(!0),hs.setEnabled(!0))},be=()=>{c?f():d()},je=()=>{window.confirm(K("common:confirm.removeAgent",{name:e.name}))&&U.removeAgentFromServer(n)},ce=e.currentTask||e.lastAssignedTask||(xe==null?void 0:xe.text),Ee=e.taskLabel||ce,ze=(oe=q.lastReport)==null?void 0:oe.agentSummaries.find(ne=>ne.agentId===e.id||ne.agentName===e.name),Ge={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888"},me=(e.class==="boss"||e.isBoss)&&e.subordinateIds&&e.subordinateIds.length>0,De=NL(n),te=Fj(e.class in po?null:e.class),He=(te==null?void 0:te.icon)||((he=po[e.class])==null?void 0:he.icon)||"🤖",ye=rr(),Re=Ce.useMemo(()=>{var ne;for(const Le of ye.values())if((ne=Le.assignedAgentIds)!=null&&ne.includes(n))return Le;return null},[ye,n]),[re,pe]=b.useState(!1),Ve=b.useRef(null),[at,ut]=b.useState(!1),[ue,X]=b.useState(!1),[se,ke]=b.useState(()=>Qx()),J=b.useRef(null),we=K(r==="simple"?"terminal:header.simpleView":r==="chat"?"terminal:header.chatView":"terminal:header.advancedView"),We=r==="simple"?"○":r==="chat"?"◐":"◉",Be=b.useCallback(()=>{pe(!1)},[]),ie=b.useCallback(()=>{ut(!1),X(!1)},[]),Ie=ne=>{const Le=du(ne);lp(Le),ke(ne)};return b.useEffect(()=>{if(!re)return;const ne=Le=>{Ve.current&&!Ve.current.contains(Le.target)&&Be()};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[re,Be]),b.useEffect(()=>{if(!at)return;const ne=Le=>{J.current&&!J.current.contains(Le.target)&&ie()};return document.addEventListener("mousedown",ne),document.addEventListener("touchstart",ne),()=>{document.removeEventListener("mousedown",ne),document.removeEventListener("touchstart",ne)}},[at,ie]),o.jsxs("div",{className:`guake-header ${s.length>1?"has-multiple-agents":""} ${a>.1?"swiping-right":""} ${a<-.1?"swiping-left":""}`,ref:C,style:Re?{borderBottomColor:`color-mix(in srgb, ${Re.color} 50%, var(--border-color))`}:void 0,children:[o.jsxs("div",{className:"guake-header-left",children:[o.jsxs("div",{className:"guake-header-title-row",children:[e.isDetached&&o.jsx(Jn,{content:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"tide-tooltip__title",children:"🔄 Reattaching Session..."}),o.jsxs("div",{className:"tide-tooltip__text",children:["This agent's Claude process is running independently. Tide Commander is automatically attempting to reattach to the existing session. If reattachment fails, send a new message to manually resume the session.",o.jsx("br",{}),o.jsx("br",{}),o.jsx("strong",{children:"Status:"})," Recovering session context and output history..."]})]}),position:"bottom",className:"tide-tooltip--detached",children:o.jsx("span",{className:"guake-detached-badge",title:"Agent is detached - reattaching...",children:o.jsx("span",{className:"guake-detached-spinner",children:"🔄"})})}),_?o.jsxs("button",{className:`guake-title-btn ${D?"active":""}`,onClick:_,title:K("terminal:header.showAgentInfo"),children:[o.jsx("span",{className:"guake-agent-avatar",children:He}),o.jsxs("span",{className:"guake-title-block",children:[o.jsxs("span",{className:"guake-title-main-row",children:[o.jsx("span",{className:"guake-title",children:e.name}),(e.taskLabel||ce)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||ce})]}),Ee&&o.jsx("span",{className:"guake-mobile-title-context",children:Ee})]}),o.jsx("span",{className:"guake-title-accessory",children:o.jsx("img",{src:e.provider==="codex"?"/assets/codex.png":e.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:e.provider,className:"guake-provider-icon",title:e.provider==="codex"?"Codex Agent":e.provider==="opencode"?"OpenCode Agent":"Claude Agent"})})]}):o.jsxs("div",{className:"guake-title-with-provider",children:[o.jsx("span",{className:"guake-agent-avatar",children:He}),o.jsxs("span",{className:"guake-title-block",children:[o.jsxs("span",{className:"guake-title-main-row",children:[o.jsx("span",{className:"guake-title",children:e.name}),(e.taskLabel||ce)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||ce})]}),Ee&&o.jsx("span",{className:"guake-mobile-title-context",children:Ee})]}),o.jsx("span",{className:"guake-title-accessory",children:o.jsx("img",{src:e.provider==="codex"?"/assets/codex.png":e.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:e.provider,className:"guake-provider-icon",title:e.provider==="codex"?"Codex Agent":e.provider==="opencode"?"OpenCode Agent":"Claude Agent"})})]})]}),o.jsxs("div",{className:"guake-header-meta",children:[ze&&o.jsx("span",{className:"guake-status-line",title:`${ze.statusDescription}
|
|
117
|
-
${ze.recentWorkSummary}`,children:o.jsx("span",{className:"guake-supervisor-badge",style:{color:Ge[ze.progress]||"#888"},children:ze.progress.replace("_"," ")})}),De.filter(ne=>ne.status==="spawning"||ne.status==="working").length>0&&o.jsx("span",{className:"guake-subagents-indicator",children:De.filter(ne=>ne.status==="spawning"||ne.status==="working").map(ne=>o.jsxs("span",{className:"guake-subagent-badge active",title:`${ne.name} (${ne.subagentType}) - ${ne.status}`,children:[o.jsx("span",{className:"guake-subagent-icon",children:"⑂"}),o.jsx("span",{className:"guake-subagent-name",children:ne.name})]},ne.id))})]})]}),o.jsxs("div",{className:"guake-actions",children:[o.jsxs("div",{className:"guake-action-cluster guake-action-cluster--compact hide-on-mobile",children:[!k&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"guake-icon-action guake-nav-btn",onClick:T,title:"Back (Alt+Left)",disabled:!R,children:o.jsx("span",{className:"guake-action-icon",children:"←"})}),o.jsx("button",{className:"guake-icon-action guake-nav-btn",onClick:M,title:"Forward (Alt+Right)",disabled:!I,children:o.jsx("span",{className:"guake-action-icon",children:"→"})})]}),!k&&E&&o.jsx("button",{className:`guake-icon-action guake-overview-toggle ${j?"active":""}`,onClick:()=>E(!j),title:K(j?"terminal:header.hideOverview":"terminal:header.showOverview"),children:o.jsx("span",{className:"guake-action-icon",children:"📊"})}),!k&&W&&o.jsx("button",{className:`guake-icon-action guake-git-toggle ${z?"active":""}`,onClick:()=>W(!z),title:z?"Hide Git Changes":"Show Git Changes",children:o.jsx("span",{className:"guake-action-icon",children:"🌿"})}),!k&&G&&V&&o.jsx("button",{className:`guake-icon-action guake-workflow-toggle ${H?"active":""}`,onClick:()=>V(!H),title:H?"Hide Workflow":"Show Workflow",children:o.jsx("span",{className:"guake-action-icon",children:"🔄"})}),!k&&Q&&o.jsx("button",{className:`guake-icon-action guake-tracking-board-toggle ${B?"active":""}`,onClick:()=>Q(!B),title:B?"Hide Tracking Board":"Show Tracking Board",children:o.jsx("span",{className:"guake-action-icon",children:"▥"})}),o.jsx("button",{className:`guake-icon-action guake-fullscreen-toggle ${P?"active":""}`,onClick:O,title:K(P?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen"),children:o.jsx("span",{className:"guake-action-icon",children:P?"🗗":"⛶"})}),o.jsx("button",{className:`guake-icon-action guake-search-toggle ${c?"active":""}`,onClick:be,title:K("terminal:header.search"),children:o.jsx("span",{className:"guake-action-icon",children:"🔍"})}),o.jsx("button",{className:"guake-icon-action danger",onClick:()=>S("clear"),title:K("terminal:header.clearContext"),children:o.jsx("span",{className:"guake-action-icon",children:"🧹"})})]}),!k&&o.jsxs("div",{className:"guake-desktop-more hide-on-mobile",ref:Ve,children:[o.jsx("button",{className:`guake-desktop-more-btn ${re?"active":""}`,onClick:()=>pe(!re),title:K("terminal:header.moreActions","More actions"),children:"⋮"}),re&&o.jsxs("div",{className:"guake-desktop-menu",children:[o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{de(),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:We}),"View: ",we]}),N&&v>0&&o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{N(),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"⭐"}),K("terminal:header.saveSnapshot")]}),F&&o.jsxs("button",{className:`guake-desktop-menu-item ${$?"active":""}`,onClick:()=>{F(!$),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"🏗️"}),$?"Hide Buildings":"Show Buildings"]}),o.jsxs("button",{className:`guake-desktop-menu-item ${h?"active":""}`,onClick:()=>{Z(),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"🐛"}),K(h?"terminal:header.hideDebug":"terminal:header.showDebug")]}),o.jsx("div",{className:"guake-desktop-menu-divider"}),o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{S("collapse"),Be()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"📦"}),K("terminal:header.collapseContext")]}),me&&o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{S("clear-subordinates"),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"👑"}),K("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-desktop-menu-divider"}),o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{je(),Be()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"❌"}),K("terminal:header.removeAgent")]})]})]}),!k&&o.jsxs("div",{className:"guake-mobile-more show-on-mobile",ref:J,children:[o.jsx("button",{className:`guake-mobile-more-btn ${at?"active":""}`,onClick:()=>ut(!at),title:K("terminal:header.moreActions","More actions"),children:"⋮"}),at&&o.jsxs("div",{className:"guake-mobile-menu",children:[o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{T==null||T(),ie()},disabled:!R,children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"←"}),"Back"]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{M==null||M(),ie()},disabled:!I,children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"→"}),"Forward"]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{de(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:r==="simple"?"○":r==="chat"?"◐":"◉"}),K(r==="simple"?"terminal:header.simpleView":r==="chat"?"terminal:header.chatView":"terminal:header.advancedView")]}),v>0&&o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{U.clearOutputs(n),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🗑"}),K("terminal:header.clearOutput")]}),N&&v>0&&o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{N(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"⭐"}),K("terminal:header.saveSnapshot")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${P?"active":""}`,onClick:()=>{O==null||O(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:P?"🗗":"⛶"}),K(P?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen")]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{be(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:c?"✕":"🔍"}),K("terminal:header.search")]}),E&&o.jsxs("button",{className:`guake-mobile-menu-item ${j?"active":""}`,onClick:()=>{E(!j),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📊"}),K(j?"terminal:header.hideOverview":"terminal:header.showOverview")]}),W&&o.jsxs("button",{className:`guake-mobile-menu-item ${z?"active":""}`,onClick:()=>{W(!z),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🌿"}),z?"Hide Git Changes":"Show Git Changes"]}),G&&V&&o.jsxs("button",{className:`guake-mobile-menu-item ${H?"active":""}`,onClick:()=>{V(!H),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🔄"}),H?"Hide Workflow":"Show Workflow"]}),F&&o.jsxs("button",{className:`guake-mobile-menu-item ${$?"active":""}`,onClick:()=>{F(!$),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🏗️"}),$?"Hide Buildings":"Show Buildings"]}),o.jsxs("button",{className:`guake-mobile-menu-item ${h?"active":""}`,onClick:()=>{Z(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🐛"}),K(h?"terminal:header.hideDebug":"terminal:header.showDebug")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${ue?"active":""}`,onClick:()=>X(!ue),children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🎨"}),K("terminal:themeSelector.selectTheme"),o.jsx("span",{className:"guake-mobile-theme-arrow",children:ue?"▲":"▼"})]}),ue&&o.jsx("div",{className:"guake-mobile-theme-list",children:Js.map(ne=>o.jsxs("button",{className:`guake-mobile-theme-option ${ne.id===se?"active":""}`,onClick:()=>Ie(ne.id),children:[o.jsx("span",{className:"guake-mobile-theme-preview",style:{background:`linear-gradient(135deg, ${ne.colors.bgPrimary} 0%, ${ne.colors.bgSecondary} 50%, ${ne.colors.accentPurple} 100%)`}}),o.jsx("span",{className:"guake-mobile-theme-name",children:ne.name}),ne.id===se&&o.jsx("span",{className:"guake-mobile-theme-check",children:"✓"})]},ne.id))}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{S("collapse"),ie()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📦"}),K("terminal:header.collapseContext")]}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear"),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🧹"}),K("terminal:header.clearContext")]}),me&&o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear-subordinates"),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"👑🗑️"}),K("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{je(),ie()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"❌"}),K("terminal:header.removeAgent")]})]})]}),o.jsx("button",{className:"guake-close-btn show-on-mobile",onClick:()=>U.setMobileView("3d"),title:K("terminal:header.closeTerminal"),children:"✕"})]})]})});function C6({searchInputRef:t,searchQuery:e,setSearchQuery:n,closeSearch:s,matchCount:a,currentMatch:r,navigateNext:i,navigatePrev:c,loadingFullHistory:d}){const{t:f}=pt(["terminal","common"]);return o.jsxs("div",{className:"guake-search",children:[o.jsx("input",{ref:t,type:"text",placeholder:f("terminal:header.searchPlaceholder"),value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"?(h.preventDefault(),s()):h.key==="Enter"&&(h.preventDefault(),h.shiftKey?c():i())}}),e.trim().length>=2&&o.jsx("span",{className:"guake-search-count",children:d?`${a>0?`${r+1} / ${a}`:"..."} loading`:a>0?`${r+1} / ${a}`:f("terminal:header.searchNoResults","No results")}),o.jsx("button",{className:"guake-search-nav",onClick:c,disabled:a===0,title:"Previous match (Shift+Enter)",children:"▲"}),o.jsx("button",{className:"guake-search-nav",onClick:i,disabled:a===0,title:"Next match (Enter)",children:"▼"}),o.jsx("button",{className:"guake-search-close",onClick:s,title:"Close search (Escape)",children:"✕"})]})}function A6({agent:t,content:e,isOpen:n,onClose:s}){const{t:a}=pt(["tools","common","terminal"]),r=b.useCallback(()=>{navigator.clipboard.writeText(e)},[e]),{handleMouseDown:i,handleClick:c}=wa(s);return n?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal agent-response-modal",children:[o.jsxs("div",{className:"modal-header agent-response-modal-header",children:[o.jsxs("div",{className:"agent-response-modal-title",children:[o.jsx("span",{className:"agent-response-modal-icon",children:"📝"}),o.jsxs("span",{children:[t.name," - ",a("terminal:modals.rawOutput")]})]}),o.jsx("button",{className:"agent-response-modal-close",onClick:s,title:a("common:buttons.close"),children:"×"})]}),o.jsx("div",{className:"modal-body agent-response-modal-body",children:e?o.jsx("pre",{className:"agent-response-raw",children:e}):o.jsxs("div",{className:"agent-response-empty",children:[o.jsx("span",{className:"agent-response-empty-icon",children:"📭"}),o.jsx("span",{children:a("tools:response.noContent")})]})}),o.jsxs("div",{className:"modal-footer agent-response-modal-footer",children:[o.jsx("button",{className:"btn btn-primary",onClick:r,children:a("common:buttons.copy")}),o.jsx("button",{className:"btn btn-secondary",onClick:s,children:a("common:buttons.close")})]})]})})}):null}function j6({url:t,name:e,onClose:n}){const{handleMouseDown:s,handleClick:a}=wa(n);return o.jsx(ir,{children:o.jsx("div",{className:"image-modal-overlay",onMouseDown:s,onClick:a,children:o.jsxs("div",{className:"image-modal",children:[o.jsxs("div",{className:"image-modal-header",children:[o.jsx("span",{className:"image-modal-title",children:e}),o.jsx("button",{className:"image-modal-close",onClick:n,children:"×"})]}),o.jsx("div",{className:"image-modal-content",children:o.jsx("img",{src:t,alt:e})})]})})})}function N6({state:t,onClose:e}){const{t:n}=pt(["terminal","common"]),{handleMouseDown:s,handleClick:a}=wa(e);return o.jsx(ir,{children:o.jsx("div",{className:"bash-modal-overlay",onMouseDown:s,onClick:a,children:o.jsxs("div",{className:"bash-modal",children:[o.jsxs("div",{className:"bash-modal-header",children:[o.jsx("span",{className:"bash-modal-icon",children:"$"}),o.jsx("span",{className:"bash-modal-title",children:n("terminal:modals.terminalOutput")}),o.jsx("button",{className:"bash-modal-close",onClick:e,children:"×"})]}),o.jsx("div",{className:"bash-modal-command",children:o.jsx("pre",{dangerouslySetInnerHTML:{__html:mo(t.command,"bash")}})}),o.jsx("div",{className:`bash-modal-content ${t.isLive?"is-loading":""}`,children:o.jsx("pre",{dangerouslySetInnerHTML:{__html:Sl(t.output)}})})]})})})}function T6({action:t,selectedAgentId:e,subordinateCount:n,onClose:s,onClearHistory:a}){const{t:r}=pt(["terminal","common"]),{handleMouseDown:i,handleClick:c}=wa(s),d=()=>{e&&(t==="collapse"?U.collapseContext(e):t==="clear-subordinates"?U.clearAllSubordinatesContext(e):(U.clearContext(e),a())),s()},f=()=>r(t==="collapse"?"terminal:modals.collapseContext":t==="clear-subordinates"?"terminal:modals.clearAllSubordinatesContext":"terminal:modals.clearContext");return o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible guake-context-confirm-overlay",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal confirm-modal guake-context-confirm-modal",children:[o.jsx("div",{className:"modal-header",children:f()}),o.jsx("div",{className:"modal-body confirm-modal-body",children:t==="collapse"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.collapseConfirm")}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.collapseNote")})]}):t==="clear-subordinates"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.clearSubordinatesConfirm",{count:n})}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.clearSubordinatesNote")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.clearConfirm")}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.clearNote")})]})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:s,children:r("common:buttons.cancel")}),o.jsx("button",{className:`btn ${t==="clear"||t==="clear-subordinates"?"btn-danger":"btn-primary"}`,onClick:d,autoFocus:!0,children:r(t==="collapse"?"common:buttons.collapse":t==="clear-subordinates"?"terminal:modals.clearAll":"terminal:modals.clearContext")})]})]})})})}function E6(){const t=mx(),e=Dl(),n=t?e.get(t):null;return n?o.jsx(Zj,{agent:n,isOpen:!!t,onClose:()=>U.closeContextModal(),onRefresh:()=>{t&&U.refreshAgentContext(t)}}):null}function _6(){const t=hx(),e=dL(),n=fL();return t?o.jsx(d1,{isOpen:!!t,onClose:()=>U.clearFileViewerPath(),filePath:t,action:e?"modified":"read",editData:e||void 0,searchRoot:n||void 0}):null}function M6({agent:t,content:e,onClose:n}){return t?o.jsx(A6,{agent:t,content:e||"",isOpen:!!e,onClose:n}):null}function dA(t){if(!t)return"N/A";try{return new Date(t).toLocaleString()}catch{return"N/A"}}function D6({agent:t,isOpen:e,onClose:n}){var j,E,D,_,P;const{t:s}=pt(["terminal","common"]),{handleMouseDown:a,handleClick:r}=wa(n),i=mL((t==null?void 0:t.id)||null),c=Fj((t==null?void 0:t.class)||null);if(!e||!t)return null;const d=t.provider==="codex"?t.codexModel||"gpt-5.3-codex":t.provider==="opencode"?t.opencodeModel||"minimax/MiniMax-M1-80k":t.model||"sonnet",f=((j=c==null?void 0:c.instructions)==null?void 0:j.trim())||"",h=((E=t.customInstructions)==null?void 0:E.trim())||"",m=f.length>0,x=h.length>0,y=m||x,v=m&&x,S=[f,h].filter(Boolean).join(`
|
|
118
|
-
|
|
119
|
-
`),C=Math.max(1,((D=t.contextStats)==null?void 0:D.contextWindow)||t.contextLimit||2e5),k=((_=t.contextStats)==null?void 0:_.totalTokens)||t.contextUsed||0,N=((P=t.contextStats)==null?void 0:P.usedPercent)||Math.round(k/C*100);return o.jsx(ir,{children:o.jsx("div",{className:"agent-info-modal-overlay",onMouseDown:a,onClick:r,children:o.jsxs("div",{className:"agent-info-modal",children:[o.jsxs("div",{className:"agent-info-modal-header",children:[o.jsxs("div",{className:"agent-info-modal-title",children:[o.jsx("span",{className:"icon",children:"ℹ️"}),o.jsx("span",{children:s("terminal:agentInfo.title",{name:t.name})})]}),o.jsx("button",{className:"agent-info-modal-close",onClick:n,children:"×"})]}),o.jsxs("div",{className:"agent-info-modal-body",children:[o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.runtime")}),o.jsxs("div",{className:"agent-info-grid",children:[o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.backend")}),o.jsxs("strong",{children:[o.jsx("img",{src:t.provider==="codex"?"/assets/codex.png":t.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:t.provider,className:"agent-info-provider-icon",title:t.provider==="codex"?"Codex Agent":t.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),t.provider==="codex"?"Codex":t.provider==="opencode"?"OpenCode":"Claude"]})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.model")}),o.jsx("strong",{children:d})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.status")}),o.jsx("strong",{children:t.status})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.class")}),o.jsx("strong",{children:t.class})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.permission")}),o.jsx("strong",{children:t.permissionMode})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.session")}),o.jsx("strong",{children:t.sessionId||s("terminal:agentInfo.notStarted")})]})]})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.promptAndInstructions")}),o.jsxs("div",{className:"agent-info-prompts",children:[v&&o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.customPrompt")}),o.jsx("pre",{children:S})]}),!y&&o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.customPrompt")}),o.jsx("strong",{className:"warn",children:s("terminal:agentInfo.notConfigured")})]}),o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.classPrompt")}),m?o.jsx("pre",{children:f}):o.jsx("strong",{children:s("terminal:agentInfo.none")})]}),o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.agentPrompt")}),x?o.jsx("pre",{children:h}):o.jsx("strong",{children:s("terminal:agentInfo.none")})]})]})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.skills",{count:i.length})}),i.length===0?o.jsx("div",{className:"agent-info-empty",children:s("terminal:agentInfo.noSkills")}):o.jsx("div",{className:"agent-info-skills",children:i.map(O=>o.jsxs("div",{className:"agent-info-skill",children:[o.jsx("div",{className:"agent-info-skill-name",children:O.name}),o.jsx("div",{className:"agent-info-skill-desc",children:O.description})]},O.id))})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.diagnostics")}),o.jsxs("div",{className:"agent-info-grid",children:[o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.context")}),o.jsxs("strong",{children:[k.toLocaleString()," / ",C.toLocaleString()," (",N,"%)"]})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.tasksSent")}),o.jsx("strong",{children:t.taskCount})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.workingDir")}),o.jsx("strong",{children:t.cwd})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.lastActivity")}),o.jsx("strong",{children:dA(t.lastActivity)})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.created")}),o.jsx("strong",{children:dA(t.createdAt)})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.detached")}),o.jsx("strong",{children:t.isDetached?s("terminal:agentInfo.yes"):s("terminal:agentInfo.no")})]})]})]})]})]})})})}function fA(t){const e=[];let n=0;try{JSON.parse(t)}catch(i){return e.push(o.jsxs("span",{className:"json-error",children:["[Invalid JSON: ",String(i).slice(0,50),"]"]},n++)),e.push(o.jsx("span",{children:t},n++)),e}const s=/("(?:\\.|[^"\\])*")\s*:|("(?:\\.|[^"\\])*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(\btrue\b|\bfalse\b)|(\bnull\b)|([{}[\],:])/g;let a=0,r;for(;(r=s.exec(t))!==null;){r.index>a&&e.push(o.jsx("span",{children:t.slice(a,r.index)},n++));const[i,c,d,f,h,m,x]=r;c?(e.push(o.jsx("span",{className:"json-key",children:c.slice(0,-1)},n++)),e.push(o.jsx("span",{className:"json-punct",children:":"},n++))):d?e.push(o.jsx("span",{className:"json-string",children:d},n++)):f?e.push(o.jsx("span",{className:"json-number",children:f},n++)):h?e.push(o.jsx("span",{className:"json-boolean",children:h},n++)):m?e.push(o.jsx("span",{className:"json-null",children:m},n++)):x&&e.push(o.jsx("span",{className:"json-punct",children:x},n++)),a=r.index+i.length}return a<t.length&&e.push(o.jsx("span",{children:t.slice(a)},n++)),e}function pA(t){const e=[],n=/\u001b\[([0-9;]*)m/g;let s={bold:!1,dim:!1},a=0,r=0;const i=f=>{if(f===0){s={bold:!1,dim:!1};return}if(f===1){s.bold=!0;return}if(f===2){s.dim=!0;return}if(f===22){s.bold=!1,s.dim=!1;return}if(f===39){s.color=void 0;return}const h={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"};h[f]&&(s.color=h[f])},c=()=>{const f=["ansi"];return s.color&&f.push(`ansi-fg-${s.color}`),s.bold&&f.push("ansi-bold"),s.dim&&f.push("ansi-dim"),f.join(" ")};let d;for(;(d=n.exec(t))!==null;){if(d.index>a){const h=t.slice(a,d.index);e.push(o.jsx("span",{className:c(),children:h},r++))}const f=(d[1]||"0").split(";").map(h=>h===""?0:Number(h)).filter(h=>Number.isFinite(h));f.length===0?i(0):f.forEach(i),a=n.lastIndex}return a<t.length&&e.push(o.jsx("span",{className:c(),children:t.slice(a)},r++)),e}const R6=({agentId:t,onClose:e})=>{const{t:n}=pt(["terminal","common","tools"]),[s,a]=b.useState("messages"),[r,i]=b.useState([]),[c,d]=b.useState([]),[f,h]=b.useState(null),[m,x]=b.useState(""),[y,v]=b.useState(!1),[S,C]=b.useState(!1),[k,N]=b.useState({total:0,sent:0,received:0,messageTypes:[]}),[j,E]=b.useState(new Set),[D,_]=b.useState(new Set),[P,O]=b.useState("all"),[T,M]=b.useState("all"),[R,I]=b.useState("all"),[z,W]=b.useState(!1),[$,F]=b.useState(""),[H,V]=b.useState(!0),G=b.useRef(null),B=b.useRef(null),Q=b.useCallback(()=>{const ye=hs.getMessages(t);i([...ye]),N(hs.getStats(t))},[t]),K=b.useCallback(()=>{const ye=hs.getLogs();d([...ye])},[]),q=b.useCallback(async()=>{v(!0),x("");try{const ye=await Lt(Mt(`/api/agents/${encodeURIComponent(t)}/process-output`)),Re=await ye.json();if(!ye.ok){h(null),x((Re==null?void 0:Re.error)||"Failed to load process output");return}h(Re)}catch(ye){h(null),x(ye instanceof Error?ye.message:"Failed to load process output")}finally{v(!1),C(!0)}},[t]);b.useEffect(()=>(Q(),hs.subscribe(Re=>{(Re===t||Re==="all")&&Q()})),[t,Q]),b.useEffect(()=>(K(),hs.subscribeLogs(()=>{K()})),[K]);const xe=b.useMemo(()=>r.filter(ye=>{if(z){const Re=ye.payload;if(!(Re!=null&&Re.text)||typeof Re.text!="string")return!1}if(P!=="all"&&ye.direction!==P||T!=="all"&&ye.type!==T)return!1;if($){const Re=$.toLowerCase(),re=ye.type.toLowerCase().includes(Re),pe=JSON.stringify(ye.payload).toLowerCase().includes(Re);return re||pe}return!0}),[r,P,T,z,$]),de=b.useMemo(()=>c.filter(ye=>{var Re;if(R!=="all"&&ye.level!==R)return!1;if($){const re=$.toLowerCase(),pe=ye.message.toLowerCase().includes(re),Ve=((Re=ye.source)==null?void 0:Re.toLowerCase().includes(re))||!1,at=ye.data?JSON.stringify(ye.data).toLowerCase().includes(re):!1;return pe||Ve||at}return!0}),[c,R,$]);b.useEffect(()=>{H&&G.current&&s==="messages"&&(G.current.scrollTop=G.current.scrollHeight)},[xe,H,s]),b.useEffect(()=>{H&&B.current&&s==="logs"&&(B.current.scrollTop=B.current.scrollHeight)},[de,H,s]),b.useEffect(()=>{s==="process"&&!S&&!y&&q()},[s,S,y,q]),b.useEffect(()=>{h(null),x(""),v(!1),C(!1)},[t]);const Z=ye=>{E(Re=>{const re=new Set(Re);return re.has(ye)?re.delete(ye):re.add(ye),re})},be=()=>{E(new Set(xe.map(ye=>ye.id)))},je=()=>{E(new Set)},ce=ye=>{navigator.clipboard.writeText(ye.raw)},Ee=()=>{const ye=xe.map(Re=>Re.raw).join(`
|
|
120
|
-
|
|
121
|
-
`);navigator.clipboard.writeText(ye)},ze=()=>{hs.clearMessages(t)},Ge=()=>{hs.clearLogs()},_e=()=>{if(!f)return;const ye=[`agentId: ${f.agentId}`,`pid: ${f.pid}`,`source: ${f.source}`,`command: ${f.command}`,`exitCode: ${f.exitCode??"null"}`,`fetchedAt: ${new Date(f.fetchedAt).toISOString()}`,"","[stdout]",f.output||"(empty)","","[stderr]",f.errorOutput||"(empty)"].join(`
|
|
122
|
-
`);navigator.clipboard.writeText(ye)},me=ye=>{_(Re=>{const re=new Set(Re);return re.has(ye)?re.delete(ye):re.add(ye),re})},De=ye=>{switch(ye){case"debug":return{icon:"🔍",className:"log-debug"};case"info":return{icon:"ℹ️",className:"log-info"};case"warn":return{icon:"⚠️",className:"log-warn"};case"error":return{icon:"❌",className:"log-error"}}},te=ye=>new Date(ye).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),He=ye=>ye<1024?`${ye}B`:ye<1024*1024?`${(ye/1024).toFixed(1)}KB`:`${(ye/(1024*1024)).toFixed(1)}MB`;return o.jsxs("div",{className:"agent-debug-panel",children:[o.jsxs("div",{className:"agent-debug-header",children:[o.jsxs("div",{className:"agent-debug-title",children:[o.jsx("span",{className:"icon",children:"🐛"}),n("terminal:debug.title")]}),o.jsx("button",{className:"close-btn",onClick:e,title:n("common:buttons.close"),children:"✕"})]}),o.jsxs("div",{className:"agent-debug-tabs",children:[o.jsxs("button",{className:`tab ${s==="messages"?"active":""}`,onClick:()=>a("messages"),children:["📨 ",n("terminal:debug.messages")," (",k.total,")"]}),o.jsxs("button",{className:`tab ${s==="logs"?"active":""}`,onClick:()=>a("logs"),children:["📋 ",n("terminal:debug.logs")," (",c.length,")"]}),o.jsxs("button",{className:`tab ${s==="process"?"active":""}`,onClick:()=>a("process"),children:["🧪 ",n("terminal:debug.processOutput")]})]}),s==="messages"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-stats",children:[o.jsxs("span",{className:"stat stat-sent",children:["↑ ",k.sent]}),o.jsxs("span",{className:"stat stat-received",children:["↓ ",k.received]}),o.jsxs("span",{className:"stat",children:["Types: ",k.messageTypes.length]}),o.jsxs("button",{className:`text-only-toggle ${z?"active":""}`,onClick:()=>W(!z),title:n(z?"terminal:debug.allMessages":"terminal:debug.textOnly"),children:["💬 ",n(z?"terminal:debug.textOnly":"terminal:debug.allMessages")]})]}),o.jsxs("div",{className:"agent-debug-controls",children:[o.jsxs("select",{value:P,onChange:ye=>O(ye.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allDirections")}),o.jsx("option",{value:"sent",children:n("terminal:debug.sentOnly")}),o.jsx("option",{value:"received",children:n("terminal:debug.receivedOnly")})]}),o.jsxs("select",{value:T,onChange:ye=>M(ye.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allTypes")}),k.messageTypes.map(ye=>o.jsx("option",{value:ye,children:ye},ye))]}),o.jsx("input",{type:"text",placeholder:n("terminal:debug.search"),value:$,onChange:ye=>F(ye.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:be,className:"action-btn",title:n("tools:display.expandAll"),children:n("tools:display.expandAll")}),o.jsx("button",{onClick:je,className:"action-btn",title:n("tools:display.collapseAll"),children:n("tools:display.collapseAll")}),o.jsx("button",{onClick:Ee,className:"action-btn",title:n("terminal:debug.copyAll"),children:n("terminal:debug.copyAll")}),o.jsx("button",{onClick:ze,className:"action-btn clear-btn",title:n("common:buttons.clear"),children:n("common:buttons.clear")}),o.jsxs("label",{className:"auto-scroll-label",children:[o.jsx("input",{type:"checkbox",checked:H,onChange:ye=>V(ye.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages",ref:G,children:xe.length===0?o.jsx("div",{className:"no-messages",children:r.length===0?n("terminal:debug.noMessagesCaptured"):n("terminal:debug.noMessagesMatch")}):xe.map(ye=>{const Re=j.has(ye.id),re=ye.payload,pe=re!=null&&re.text&&typeof re.text=="string"?re.text:"",Ve=ye.type==="event"&&(re==null?void 0:re.type)==="tool_start",at=ye.type==="event"&&(re==null?void 0:re.type)==="tool_result",ut=ye.type==="output"&&(pe.startsWith("Using tool:")||pe.startsWith("Tool input:")||pe.startsWith("Tool result:")),ue=pe.startsWith("Using tool:"),X=pe.startsWith("Tool input:"),se=pe.startsWith("Tool result:");let ke="",J=null,we="";if(ue)ke=pe.replace("Using tool:","").trim();else if(X)try{const lt=pe.replace("Tool input:","").trim();J=JSON.parse(lt)}catch{}else se&&(we=pe.replace("Tool result:","").trim());const Be=Ve||at||ut,ie=Ve||ue||X,Ie=at||se,oe=(re==null?void 0:re.toolName)||ke,he=(re==null?void 0:re.toolInput)||J,ne=(re==null?void 0:re.toolOutput)||we,Le=pe&&!ut,Qe=ye.type==="event"?re==null?void 0:re.type:null,nt=(()=>{var lt;if(ye.type!=="event"||!re)return null;switch(Qe){case"init":return re.model?`model: ${re.model}`:null;case"text":return re.text?re.text.slice(0,50)+(re.text.length>50?"...":""):null;case"step_complete":const it=re.tokens;return it?`${it.input||0} in / ${it.output||0} out`:null;case"error":return((lt=re.errorMessage)==null?void 0:lt.slice(0,40))||null;case"thinking":return re.text?`"${re.text.slice(0,30)}..."`:null;default:return null}})(),st=ie&&he?(()=>{if(!he)return null;const lt=Object.keys(he);if(lt.length===0)return null;const it=["file_path","path","pattern","command","content","query"];return lt.sort((jt,ge)=>{const Te=it.indexOf(jt),Ye=it.indexOf(ge);return Te===-1&&Ye===-1?0:Te===-1?1:Ye===-1?-1:Te-Ye}).slice(0,3).map(jt=>{let ge=he[jt];return typeof ge=="string"?ge.length>60&&(ge=ge.slice(0,60)+"..."):typeof ge=="object"&&(ge=JSON.stringify(ge).slice(0,40)+"..."),{key:jt,value:ge}})})():null;return o.jsxs("div",{className:`debug-message debug-message-${ye.direction} ${Le?"has-text-preview":""} ${Be?"is-tool-event":""} ${ie?"tool-start":""} ${Ie?"tool-result":""}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>Z(ye.id),children:[o.jsx("span",{className:"expand-icon",children:Re?"▼":"▶"}),o.jsx("span",{className:`direction direction-${ye.direction}`,children:ye.direction==="sent"?"↑ SENT":"↓ RECEIVED"}),o.jsx("span",{className:"message-type",children:Be?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tool-icon",children:ie?"🔧":"✅"}),ie?"tool_start":"tool_result"]}):Qe?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"event-base",children:ye.type}),o.jsx("span",{className:"event-subtype",children:Qe})]}):ye.type}),Be&&oe&&o.jsx("span",{className:"tool-name-inline",children:oe}),!Be&&nt&&o.jsx("span",{className:"event-summary",children:nt}),o.jsx("span",{className:"message-time",children:te(ye.timestamp)}),o.jsx("span",{className:"message-size",children:He(ye.size)}),o.jsx("button",{className:"copy-btn",onClick:lt=>{lt.stopPropagation(),ce(ye)},title:"Copy message",children:"📋"})]}),Re&&o.jsxs("div",{className:"message-body",children:[ie&&(he||X&&!J)&&o.jsxs("div",{className:"tool-preview",children:[st&&st.length>0&&o.jsx("div",{className:"tool-inputs",children:st.map(({key:lt,value:it})=>o.jsxs("div",{className:"tool-input-item",children:[o.jsxs("span",{className:"tool-input-key",children:[lt,":"]}),o.jsx("span",{className:"tool-input-value",children:String(it)})]},lt))}),X&&!J&&o.jsx("div",{className:"tool-raw-input",children:pe.replace("Tool input:","").trim().slice(0,200)})]}),Ie&&ne&&o.jsx("div",{className:"tool-preview tool-result-preview",children:o.jsx("div",{className:"tool-output-preview",children:typeof ne=="string"?ne.slice(0,200)+(ne.length>200?"...":""):JSON.stringify(ne).slice(0,200)})}),Le&&!Be&&o.jsx("div",{className:"message-text-preview expanded",children:o.jsx("span",{className:"text-content",children:re.text})}),o.jsx("pre",{children:fA(JSON.stringify(ye.payload,(lt,it)=>it===void 0?null:typeof it=="object"&&it!==null&&!(it instanceof Date)&&!Array.isArray(it)&&typeof it[Symbol.iterator]=="function"?Array.from(it):typeof it=="function"?`[Function: ${it.name||"anonymous"}]`:it,2))})]})]},ye.id)})})]}),s==="logs"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-controls",children:[o.jsxs("select",{value:R,onChange:ye=>I(ye.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allLevels")}),o.jsx("option",{value:"debug",children:n("terminal:debug.debug")}),o.jsx("option",{value:"info",children:n("terminal:debug.info")}),o.jsx("option",{value:"warn",children:n("terminal:debug.warning")}),o.jsx("option",{value:"error",children:n("terminal:debug.error")})]}),o.jsx("input",{type:"text",placeholder:n("terminal:debug.searchLogs"),value:$,onChange:ye=>F(ye.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:Ge,className:"action-btn clear-btn",title:n("terminal:debug.clearLogs"),children:n("terminal:debug.clearLogs")}),o.jsxs("label",{className:"auto-scroll-label",children:[o.jsx("input",{type:"checkbox",checked:H,onChange:ye=>V(ye.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages agent-debug-logs",ref:B,children:de.length===0?o.jsx("div",{className:"no-messages",children:c.length===0?n("terminal:debug.noLogsYet"):n("terminal:debug.noLogsMatch")}):de.map(ye=>{const Re=D.has(ye.id),re=De(ye.level);return o.jsxs("div",{className:`debug-message debug-log ${re.className}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>me(ye.id),children:[o.jsx("span",{className:"expand-icon",children:Re?"▼":"▶"}),o.jsx("span",{className:"log-level-icon",children:re.icon}),o.jsx("span",{className:"log-level",children:ye.level.toUpperCase()}),ye.source&&o.jsxs("span",{className:"log-source",children:["[",ye.source,"]"]}),o.jsx("span",{className:"log-message",children:ye.message}),o.jsx("span",{className:"message-time",children:te(ye.timestamp)})]}),Re&&ye.data!==void 0?o.jsx("div",{className:"message-body",children:o.jsx("pre",{children:o.jsx(o.Fragment,{children:fA(JSON.stringify(ye.data,(pe,Ve)=>Ve===void 0?null:typeof Ve=="object"&&Ve!==null&&!(Ve instanceof Date)&&!Array.isArray(Ve)&&typeof Ve[Symbol.iterator]=="function"?Array.from(Ve):typeof Ve=="function"?`[Function: ${Ve.name||"anonymous"}]`:Ve,2))})})}):null]},ye.id)})})]}),s==="process"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-actions process-actions",children:[o.jsx("button",{onClick:()=>{q()},className:"action-btn",title:"Refresh process output",disabled:y,children:n(y?"common:status.loading":"common:buttons.refresh")}),o.jsx("button",{onClick:_e,className:"action-btn",title:"Copy process output",disabled:!f,children:n("terminal:debug.copyOutput")})]}),o.jsx("div",{className:"agent-debug-messages agent-debug-process-output",children:m?o.jsx("div",{className:"process-error",children:m}):f?o.jsxs("div",{className:"process-output-block",children:[o.jsxs("div",{className:"process-meta-grid",children:[o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.pid")}),o.jsx("span",{className:"meta-value",children:f.pid})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("tools:metadata.source")}),o.jsx("span",{className:"meta-value",children:f.source})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.exit")}),o.jsx("span",{className:"meta-value",children:f.exitCode??"null"})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.fetched")}),o.jsx("span",{className:"meta-value",children:new Date(f.fetchedAt).toLocaleString("en-US",{hour12:!1})})]})]}),o.jsxs("div",{className:"process-command",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.command")}),o.jsx("code",{children:f.command})]}),o.jsx("div",{className:"process-stream-label",children:"stdout"}),o.jsx("pre",{className:"ansi-output",children:pA(f.output||"(empty)")}),o.jsx("div",{className:"process-stream-label",children:"stderr"}),o.jsx("pre",{className:"ansi-output",children:pA(f.errorOutput||"(empty)")})]}):o.jsx("div",{className:"no-messages",children:n(y?"terminal:debug.loadingProcessOutput":"terminal:debug.noProcessOutput")})})]})]})};function O6(t){return t.isDirectory?"":Kf[t.extension]||Kf.default}function Bp(t){return Kf[t]||Kf.default}function EV(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function L6(t,e){if(!e)return null;const n=t.toLowerCase().indexOf(e.toLowerCase());return n===-1?null:{start:n,end:n+e.length}}function Vg(t){if(t.length===0)return[];const e={isDirectory:!0,children:[],fileCount:0};for(const r of t){const i=r.path.split("/");let c=e;for(let d=0;d<i.length-1;d++){const f=i[d],h=i.slice(0,d+1).join("/");let m=c.children.find(x=>x.isDirectory&&x.name===f);m||(m={name:f,path:h,isDirectory:!0,children:[],fileCount:0},c.children.push(m)),c=m}c.children.push({name:r.name,path:r.path,isDirectory:!1,file:r,children:[],fileCount:1})}function n(r){for(r.children=r.children.map(n);r.isDirectory&&r.children.length===1&&r.children[0].isDirectory;){const i=r.children[0];r.name=r.name?r.name+"/"+i.name:i.name,r.path=i.path,r.children=i.children}return r}function s(r){return r.isDirectory?(r.fileCount=r.children.reduce((i,c)=>i+s(c),0),r.fileCount):1}function a(r){return[...r].sort((i,c)=>i.isDirectory&&!c.isDirectory?-1:!i.isDirectory&&c.isDirectory?1:i.name.toLowerCase().localeCompare(c.name.toLowerCase())).map(i=>(i.isDirectory&&(i.children=a(i.children)),i))}return e.children=e.children.map(n),s(e),e.children=a(e.children),e.children}function P6(t,e){for(const n of t)n.isDirectory&&(e.add(n.path),P6(n.children,e))}const I6=3,B6=3;function F6(t){const[e,n]=b.useState([]),[s,a]=b.useState(!1),[r,i]=b.useState(new Set),[c,d]=b.useState(new Set),f=b.useRef(e),h=b.useRef(c),m=b.useRef(r);b.useEffect(()=>{f.current=e},[e]),b.useEffect(()=>{h.current=c},[c]),b.useEffect(()=>{m.current=r},[r]);const x=b.useCallback(async()=>{if(t){a(!0);try{const N=await Lt(Mt(`/api/files/tree?path=${encodeURIComponent(t)}&depth=${I6}`)),j=await N.json();if(N.ok&&j.tree){const E=Mf(j.tree),D={name:j.name,path:t,isDirectory:!0,size:0,extension:"",children:E};n([D]);const _=new Set([t]);qb(E,_),d(_),i(new Set([t]))}}catch(N){console.error("[FileExplorer] Failed to load tree:",N),n([])}a(!1)}},[t]),y=b.useCallback(async N=>{try{const j=await Lt(Mt(`/api/files/tree?path=${encodeURIComponent(N)}&depth=${B6}`)),E=await j.json();if(j.ok&&E.tree){const D=Mf(E.tree);return n(_=>{const P=JSON.parse(JSON.stringify(_)),O=Jc(P,N);return O&&(O.children=D),P}),d(_=>{const P=new Set(_);return P.add(N),qb(E.tree,P),P}),D}}catch(j){console.error("[FileExplorer] Failed to load children:",j)}return null},[]),v=b.useCallback(async N=>{await y(N)},[y]),S=b.useCallback((N,j)=>{if(!N||!j||N===j)return;const E=_=>_===N?j:_.startsWith(`${N}/`)?`${j}${_.slice(N.length)}`:_,D=_=>{const P=_.map(O=>{const T=E(O.path),M=O.children?D(O.children):void 0;return{...O,path:T,name:T.split("/").pop()||O.name,extension:O.isDirectory?"":z6(T),children:M}});return Mf(P)};n(_=>D(_)),d(_=>{const P=new Set;for(const O of _)P.add(E(O));return P})},[]),C=b.useCallback(async N=>{if(m.current.has(N))i(E=>{const D=new Set(E);return D.delete(N),D});else{i(D=>{const _=new Set(D);return _.add(N),_});let E=Jc(f.current,N);for(;E&&E.isDirectory;){let D=E.children;if((!D||D.length===0)&&!h.current.has(E.path)&&(D=await y(E.path)||[]),!D||D.length===0)break;const _=D.filter(T=>T.isDirectory);if(D.some(T=>!T.isDirectory)||_.length!==1)break;const O=_[0];i(T=>{const M=new Set(T);return M.add(O.path),M}),E=O}}},[y]),k=b.useCallback(async N=>{var T;if(!N)return;const j=(t==null?void 0:t.replace(/\/+$/,""))||null,E=()=>new Promise(M=>{requestAnimationFrame(()=>M())}),D=async(M,R=20)=>{for(let I=0;I<R;I++){const z=Jc(f.current,M);if(z)return z;await E()}return null},_=[];if(j&&N.startsWith(j)){_.push(j);const R=N.substring(j.length).split("/").filter(Boolean);let I=j;for(const z of R)I=`${I}/${z}`,_.push(I)}else _.push(N);for(const M of _){const R=await D(M);R!=null&&R.isDirectory&&(h.current.has(R.path)||(await y(R.path),await E()))}const P=new Set(m.current);let O=0;for(;O<_.length;){const M=_[O],R=Jc(f.current,M);if(!(R!=null&&R.isDirectory)){O++;continue}let I=R;for(;I.children&&I.children.length===1&&((T=I.children[0])!=null&&T.isDirectory);)I=I.children[0];for(P.add(I.path);O<_.length;){if(_[O]===I.path){O++;break}O++}}i(P),await E()},[t,y]);return{tree:e,loading:s,expandedPaths:r,loadTree:x,reloadDirectory:v,renamePathInTree:S,togglePath:C,expandToPath:k,setExpandedPaths:i}}function z6(t){const e=t.lastIndexOf(".");return e===-1?"":t.slice(e).toLowerCase()}function Jc(t,e){for(const n of t){if(n.path===e)return n;if(n.children){const s=Jc(n.children,e);if(s)return s}}return null}function qb(t,e){for(const n of t)n.isDirectory&&n.children&&n.children.length>0&&(e.add(n.path),qb(n.children,e))}function $6(t){return[...t].sort((e,n)=>e.isDirectory&&!n.isDirectory?-1:!e.isDirectory&&n.isDirectory?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase()))}function Mf(t){return $6(t).map(n=>n.isDirectory&&n.children?{...n,children:Mf(n.children)}:n)}function hA(t){switch(t){case"modified":return"#c89a5a";case"added":return"#5cb88a";case"deleted":return"#c85a5a";case"untracked":return"#6ab8c8";case"renamed":return"#9a80c0";default:return}}function H6(t){return[...t].sort((e,n)=>e.isDirectory&&!n.isDirectory?-1:!e.isDirectory&&n.isDirectory?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase()))}function Vb(t){var s;if(!t.isDirectory)return{displayName:t.name,terminalNode:t,expansionPath:t.path};const e=[t.name];let n=t;for(;n.children&&n.children.length===1&&((s=n.children[0])!=null&&s.isDirectory);)n=n.children[0],e.push(n.name);return{displayName:e.join("/"),terminalNode:n,expansionPath:n.path}}function U6({text:t,query:e}){const n=L6(t,e);return n?o.jsxs(o.Fragment,{children:[t.slice(0,n.start),o.jsx("mark",{className:"search-highlight",children:t.slice(n.start,n.end)}),t.slice(n.end)]}):o.jsx(o.Fragment,{children:t})}function W6({node:t,depth:e,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c}){const d=b.useMemo(()=>Vb(t),[t]),f=s.has(d.expansionPath),h=n===t.path||n===d.expansionPath,m=hA(t.gitStatus),x=b.useMemo(()=>d.terminalNode.children?H6(d.terminalNode.children):[],[d]),y=S=>{S.stopPropagation(),t.isDirectory?r(d.expansionPath):a(t)},v=S=>{i&&(S.preventDefault(),S.stopPropagation(),i(S,d.terminalNode))};return o.jsxs("div",{className:"tree-node-wrapper",children:[o.jsxs("div",{className:`tree-node ${h?"selected":""} ${t.isDirectory?"directory":"file"} ${f?"expanded":""}`,style:{paddingLeft:`${e*16}px`},onClick:y,onContextMenu:v,"data-path":t.path,children:[t.isDirectory?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`tree-arrow ${f?"expanded":""}`,children:"▸"}),o.jsxs("span",{className:"tree-folder-icon-wrapper",children:[o.jsx("span",{className:"tree-folder-icon",style:{backgroundImage:`url('${f?"/assets/vscode-icons/default_folder_opened.svg":"/assets/vscode-icons/default_folder.svg"}')`},role:"img","aria-label":"folder"}),t.hasGitChanges&&o.jsx("span",{className:"tree-folder-git-dot",style:{backgroundColor:hA(t.gitStatus)||"#c89a5a"}})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tree-arrow-spacer"}),o.jsx("span",{className:"tree-icon",style:{backgroundImage:`url('${O6(t)}')`},role:"img","aria-label":"file"})]}),o.jsx("span",{className:"tree-name",style:m?{color:m}:void 0,children:o.jsx(U6,{text:d.displayName,query:c})})]}),t.isDirectory&&f&&x.length>0&&o.jsx("div",{className:"tree-children",children:x.map(S=>o.jsx(Xx,{node:S,depth:e+1,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c},S.path))})]})}const Xx=b.memo(W6,(t,e)=>{if(t.node!==e.node||t.depth!==e.depth||t.searchQuery!==e.searchQuery||t.onContextMenu!==e.onContextMenu)return!1;const n=Vb(t.node).expansionPath,s=Vb(e.node).expansionPath,a=t.selectedPath===t.node.path||t.selectedPath===n,r=e.selectedPath===e.node.path||e.selectedPath===s;if(a!==r)return!1;if(t.node.isDirectory){const i=t.expandedPaths.has(n),c=e.expandedPaths.has(s);if(i!==c||c&&(t.expandedPaths!==e.expandedPaths||t.selectedPath!==e.selectedPath))return!1}return!0});Xx.displayName="TreeNodeItem";function Gg(t){const e=t.lastIndexOf(".")>=0?t.substring(t.lastIndexOf(".")):"";return Af(e)}function q6(t,e){if(e.type==="circle"){const a=t.x-e.center.x,r=t.z-e.center.z,i=Math.max(e.width,e.height)/2;return a*a+r*r<=i*i}const n=e.width/2,s=e.height/2;return t.x>=e.center.x-n&&t.x<=e.center.x+n&&t.z>=e.center.z-s&&t.z<=e.center.z+s}function bf(t){return t==="modified"||t==="renamed"||t==="deleted"||t==="conflict"}function tT({node:t,depth:e,expandedDirs:n,onToggleDir:s,onFileClick:a,onContextMenu:r,onDiscard:i,repoDir:c}){if(t.isDirectory){const m=n.has(t.path),x=m?"/assets/vscode-icons/default_folder_opened.svg":"/assets/vscode-icons/default_folder.svg";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"guake-git-file guake-git-tree-dir",style:{paddingLeft:`${12+e*20}px`},onClick:()=>s(t.path),children:[o.jsx("span",{className:"guake-git-repo-arrow",style:{marginRight:4},children:m?"▼":"▶"}),o.jsx("img",{src:x,alt:"",className:"guake-git-file-icon guake-git-folder-icon"}),o.jsx("span",{className:"guake-git-file-name",children:t.name}),o.jsx("span",{className:"guake-git-repo-count",style:{marginLeft:"auto"},children:t.fileCount})]}),m&&t.children.map(y=>o.jsx(tT,{node:y,depth:e+1,expandedDirs:n,onToggleDir:s,onFileClick:a,onContextMenu:r,onDiscard:i,repoDir:c},y.path))]})}const d=t.file,f=i1[d.status],h=Bp(d.name);return o.jsxs("div",{className:"guake-git-file","data-status":d.status,style:{paddingLeft:`${28+e*20}px`},onClick:()=>a(d,c),onContextMenu:r?m=>r(m,d,c):void 0,title:d.path,children:[h&&o.jsx("img",{src:h,alt:"",className:"guake-git-file-icon"}),o.jsx("span",{className:"guake-git-file-name",children:d.name}),o.jsx("span",{className:"guake-git-file-status",style:{color:f.color,marginLeft:"auto"},title:f.label,children:f.icon}),i&&o.jsx("button",{className:"guake-git-discard-btn",title:d.status==="untracked"||d.status==="added"?"Delete file":"Discard changes",onClick:m=>i(m,d,c),children:"↩"})]})}function V6({agentId:t,agents:e,onClose:n,branchInfoMap:s,fetchRemote:a,fetchingDirs:r}){const{t:i}=pt(["terminal","common"]),c=rr(),[d,f]=b.useState([]),[h,m]=b.useState(!1),[x,y]=b.useState(new Set),[v,S]=b.useState(new Set),[C,k]=b.useState(null),[N,j]=b.useState(!1),[E,D]=b.useState(()=>va(ft.GIT_PANEL_VIEW_MODE,"flat")==="tree"?"tree":"flat"),[_,P]=b.useState(()=>va(ft.GIT_PANEL_MODE,"changes")==="explorer"?"explorer":"changes"),[O,T]=b.useState(()=>ta(ft.GIT_PANEL_FOLDER_IDX,0)),M=b.useCallback(ue=>{D(ue),er(ft.GIT_PANEL_VIEW_MODE,ue)},[]),R=b.useCallback(ue=>{P(ue),er(ft.GIT_PANEL_MODE,ue)},[]),I=b.useCallback(ue=>{T(ue),ya(ft.GIT_PANEL_FOLDER_IDX,ue)},[]),[z,W]=b.useState(null),[$,F]=b.useState(null),[H,V]=b.useState(null),G=Ce.useRef(!1),B=Ce.useRef(t),Q=b.useMemo(()=>{const ue=new Set,X=[];for(const ke of c.values())if(!(ke.archived||ke.directories.length===0)&&ke.assignedAgentIds.includes(t)){ue.add(ke.id);for(const J of ke.directories)J&&J.trim()&&X.push(J)}const se=e.get(t);if(se){for(const ke of c.values())if(!(ke.archived||ke.directories.length===0||ue.has(ke.id))&&q6({x:se.position.x,z:se.position.z},ke))for(const J of ke.directories)J&&J.trim()&&X.push(J)}return se!=null&&se.cwd&&!X.includes(se.cwd)&&X.unshift(se.cwd),[...new Set(X)]},[t,e,c]),K=Q.length>0?Q[O]||Q[0]:null,q=F6(_==="explorer"?K:null);b.useEffect(()=>{_==="explorer"&&K&&q.loadTree()},[_,K]);const xe=b.useMemo(()=>{if(q.tree.length===0||d.length===0||!K)return q.tree;const ue=new Map;for(const se of d)for(const ke of se.gitStatus.files){const J=ke.path.startsWith("/")?ke.path:`${se.dir.replace(/\/$/,"")}/${ke.path}`;ue.set(J,ke.status)}if(ue.size===0)return q.tree;const X=se=>se.map(ke=>{if(ke.isDirectory){const we=ke.children?X(ke.children):void 0,We=we?we.some(Be=>Be.gitStatus||Be.hasGitChanges):!1;return We||we!==ke.children?{...ke,children:we,hasGitChanges:We}:ke}const J=ue.get(ke.path);return J?{...ke,gitStatus:J}:ke});return X(q.tree)},[q.tree,d,K]);b.useEffect(()=>{B.current!==t&&(B.current=t,G.current=!1,f([]),y(new Set),S(new Set),k(null),I(0),W(null))},[t]);const de=Ce.useRef(0),Z=b.useCallback(async()=>{if(Q.length===0)return;const ue=++de.current;m(!0);try{const X=[];if(await Promise.all(Q.map(async se=>{try{const ke=await Lt(Mt(`/api/files/git-status?path=${encodeURIComponent(se)}`));if(ke.ok){const J=await ke.json();if(J.isGitRepo&&J.files.length>0){const we=se.split("/").filter(Boolean).pop()||se;X.push({dir:se,dirName:we,gitStatus:J})}}}catch{}})),ue!==de.current)return;X.sort((se,ke)=>se.dirName.localeCompare(ke.dirName)),f(X),!G.current&&X.length>0&&(G.current=!0,y(new Set(X.map(se=>se.dir))))}finally{ue===de.current&&m(!1)}},[Q]);b.useEffect(()=>{Z();const ue=setInterval(Z,15e3);return()=>clearInterval(ue)},[Z]);const be=b.useCallback(async()=>{Q.length!==0&&(await Promise.all(Q.map(ue=>a(ue))),await Z())},[Q,a,Z]),je=b.useCallback(ue=>{y(X=>{const se=new Set(X);return se.has(ue)?se.delete(ue):se.add(ue),se})},[]),ce=b.useCallback(ue=>{S(X=>{const se=new Set(X);return se.has(ue)?se.delete(ue):se.add(ue),se})},[]),Ee=b.useCallback(async(ue,X)=>{const se=ue.path.startsWith("/")?ue.path:`${X.replace(/\/$/,"")}/${ue.path}`;j(!0);try{if(bf(ue.status)){let ke="",J="";if(ue.status!=="deleted")try{const we=await Lt(Mt(`/api/files/read?path=${encodeURIComponent(se)}`));if(we.ok){const We=await we.json();We.content!=null&&(J=We.content)}}catch{}try{const we=await Lt(Mt(`/api/files/git-original?path=${encodeURIComponent(se)}`));if(we.ok){const We=await we.json();We.content!=null&&(ke=We.content)}}catch{}k({type:"diff",data:{filePath:se,fileName:ue.name,originalContent:ke,modifiedContent:J,language:Gg(ue.name)}})}else{let ke="";try{const J=await Lt(Mt(`/api/files/read?path=${encodeURIComponent(se)}`));if(J.ok){const we=await J.json();we.content!=null&&(ke=we.content)}}catch{}k({type:"content",data:{filePath:se,fileName:ue.name,content:ke,language:Gg(ue.name)},isNewFile:!0})}}catch{}finally{j(!1)}},[]),ze=b.useCallback(async ue=>{if(!ue.isDirectory){W(ue.path),j(!0);try{const X=ue.name,se=Gg(X);if(ue.gitStatus&&bf(ue.gitStatus)){let ke="",J="";if(ue.gitStatus!=="deleted")try{const we=await Lt(Mt(`/api/files/read?path=${encodeURIComponent(ue.path)}`));if(we.ok){const We=await we.json();We.content!=null&&(J=We.content)}}catch{}try{const we=await Lt(Mt(`/api/files/git-original?path=${encodeURIComponent(ue.path)}`));if(we.ok){const We=await we.json();We.content!=null&&(ke=We.content)}}catch{}k({type:"diff",data:{filePath:ue.path,fileName:X,originalContent:ke,modifiedContent:J,language:se}})}else{let ke="";try{const J=await Lt(Mt(`/api/files/read?path=${encodeURIComponent(ue.path)}`));if(J.ok){const we=await J.json();we.content!=null&&(ke=we.content)}}catch{}k({type:"content",data:{filePath:ue.path,fileName:X,content:ke,language:se},isNewFile:ue.gitStatus==="added"||ue.gitStatus==="untracked"})}}finally{j(!1)}}},[]),Ge=b.useMemo(()=>{const ue=[],X=(se,ke,J)=>{for(const we of se)if(we.isDirectory)X(we.children,ke,J);else{const We=ke.find(Be=>Be.path===we.path);We&&ue.push({file:We,repoDir:J})}};for(const se of d)if(x.has(se.dir))if(E==="tree"){const ke=Vg(se.gitStatus.files);X(ke,se.gitStatus.files,se.dir)}else for(const ke of se.gitStatus.files)ue.push({file:ke,repoDir:se.dir});return ue},[d,E,x]),_e=b.useCallback(async ue=>{if(!C)return;const X=C.data.filePath,se=Ge.findIndex(({file:We,repoDir:Be})=>(We.path.startsWith("/")?We.path:`${Be.replace(/\/$/,"")}/${We.path}`)===X);if(se<0)return;const ke=se+ue;if(ke<0||ke>=Ge.length)return;const{file:J,repoDir:we}=Ge[ke];await Ee(J,we)},[C,Ge,Ee]),me=b.useMemo(()=>{if(!C)return-1;const ue=C.data.filePath;return Ge.findIndex(({file:X,repoDir:se})=>(X.path.startsWith("/")?X.path:`${se.replace(/\/$/,"")}/${X.path}`)===ue)},[C,Ge]),De=b.useCallback(()=>k(null),[]),te=b.useCallback(()=>F(null),[]),He=b.useCallback(async ue=>{try{const X=await Lt(Mt("/api/files/delete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ue.path})});if(X.ok){if(ue.status==="added")try{await Lt(Mt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ue.path,status:"added"}],directory:ue.repoDir})})}catch{}}else{const se=await X.json().catch(()=>({error:"Unknown error"}));console.error("Delete failed:",se.error)}Z(),_==="explorer"&&q.loadTree()}catch(X){console.error("Delete request failed:",X)}finally{V(null)}},[Z,_,q]),[ye,Re]=b.useState(null),re=b.useCallback(async ue=>{try{await Lt(Mt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ue.path,status:ue.status}],directory:ue.repoDir})}),Z()}catch{}finally{Re(null)}},[Z]),pe=b.useCallback((ue,X,se)=>{ue.stopPropagation();const ke=X.path.startsWith("/")?X.path:`${se.replace(/\/$/,"")}/${X.path}`;X.status==="untracked"||X.status==="added"?V({path:ke,name:X.name,status:X.status,repoDir:se}):Re({path:ke,name:X.name,status:X.status,repoDir:se})},[]),Ve=b.useCallback((ue,X,se)=>{ue.preventDefault(),ue.stopPropagation();const ke=X.path.startsWith("/")?X.path:`${se.replace(/\/$/,"")}/${X.path}`,J=[];J.push({id:"view",label:bf(X.status)?"View Diff":"View File",icon:bf(X.status)?"📊":"📄",onClick:()=>Ee(X,se)}),J.push({id:"div1",label:"",divider:!0,onClick:()=>{}}),J.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(ke)}}),J.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(X.path)}}),X.status!=="deleted"&&(J.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),J.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Lt(Mt("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ke})})}catch{}}})),(X.status==="modified"||X.status==="deleted"||X.status==="renamed")&&(J.push({id:"div3",label:"",divider:!0,onClick:()=>{}}),J.push({id:"discard",label:"Discard Changes",icon:"↩️",danger:!0,onClick:async()=>{try{await Lt(Mt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ke,status:X.status}],directory:se})}),Z()}catch{}}})),X.status!=="deleted"&&(X.status==="modified"||X.status==="renamed"||J.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),J.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:ke,name:X.name,status:X.status,repoDir:se})})),F({isOpen:!0,position:{x:ue.clientX,y:ue.clientY},actions:J})},[Ee]),at=b.useCallback((ue,X)=>{ue.preventDefault(),ue.stopPropagation();const se=[];if(X.isDirectory||(se.push({id:"view",label:"View File",icon:"📄",onClick:()=>ze(X)}),se.push({id:"div1",label:"",divider:!0,onClick:()=>{}})),se.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(X.path)}}),K){const ke=X.path.startsWith(K)?X.path.slice(K.replace(/\/$/,"").length+1):X.path;se.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(ke)}})}X.isDirectory||(se.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),se.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Lt(Mt("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:X.path})})}catch{}}}),se.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),se.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:X.path,name:X.name,status:X.gitStatus||"untracked",repoDir:K||""})})),F({isOpen:!0,position:{x:ue.clientX,y:ue.clientY},actions:se})},[ze,K]),ut=d.reduce((ue,X)=>ue+X.gitStatus.files.length,0);return b.useEffect(()=>{if(!C&&!H&&!ye)return;const ue=X=>{X.key==="Escape"&&(X.stopImmediatePropagation(),X.preventDefault(),ye?Re(null):H?V(null):De())};return document.addEventListener("keydown",ue,!0),()=>document.removeEventListener("keydown",ue,!0)},[C,De,H,ye]),Qt("guake-git-diff-modal",C!==null,De),Qt("guake-git-delete-confirm",H!==null,()=>V(null)),Qt("guake-git-discard-confirm",ye!==null,()=>Re(null)),b.useEffect(()=>{if(E==="tree"&&v.size===0&&d.length>0){const ue=new Set;for(const X of d){const se=Vg(X.gitStatus.files),ke=J=>{for(const we of J)we.isDirectory&&(ue.add(we.path),ke(we.children))};ke(se)}S(ue)}},[E,d]),o.jsxs(o.Fragment,{children:[H&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:()=>V(null),children:o.jsxs("div",{className:"guake-git-delete-confirm",onClick:ue=>ue.stopPropagation(),children:[o.jsxs("p",{children:["Delete ",o.jsx("strong",{children:H.name}),"?"]}),o.jsx("p",{className:"guake-git-delete-path",children:H.path}),o.jsxs("div",{className:"guake-git-delete-actions",children:[o.jsx("button",{className:"guake-git-delete-cancel",onClick:()=>V(null),children:"Cancel"}),o.jsx("button",{className:"guake-git-delete-btn",onClick:()=>He(H),children:"Delete"})]})]})}),ye&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:()=>Re(null),children:o.jsxs("div",{className:"guake-git-delete-confirm",onClick:ue=>ue.stopPropagation(),children:[o.jsxs("p",{children:["Discard changes to ",o.jsx("strong",{children:ye.name}),"?"]}),o.jsx("p",{className:"guake-git-delete-path",children:ye.path}),o.jsxs("div",{className:"guake-git-delete-actions",children:[o.jsx("button",{className:"guake-git-delete-cancel",onClick:()=>Re(null),children:"Cancel"}),o.jsx("button",{className:"guake-git-delete-btn",onClick:()=>re(ye),children:"Discard"})]})]})}),C&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:De,children:o.jsxs("div",{className:"guake-git-diff-modal",onClick:ue=>ue.stopPropagation(),children:[o.jsxs("div",{className:"guake-git-diff-modal-header",children:[_==="changes"&&o.jsxs("div",{className:"guake-git-diff-nav",children:[o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>_e(-1),disabled:me<=0,title:"Previous file",children:"‹"}),o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>_e(1),disabled:me<0||me>=Ge.length-1,title:"Next file",children:"›"}),me>=0&&o.jsxs("span",{className:"guake-git-diff-nav-counter",children:[me+1," / ",Ge.length]})]}),o.jsxs("span",{className:"guake-git-diff-filename",title:C.data.filePath,children:[C.data.filePath,C.type==="content"&&C.isNewFile&&o.jsx("span",{className:"guake-git-content-badge",children:"new file"})]}),o.jsx("button",{className:"guake-git-close",onClick:De,title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"guake-git-diff-content",children:C.type==="diff"?o.jsx(Bb,{originalContent:C.data.originalContent,modifiedContent:C.data.modifiedContent,filename:C.data.fileName,language:C.data.language}):o.jsx(Bb,{originalContent:"",modifiedContent:C.data.content,filename:C.data.fileName,language:C.data.language,initialModifiedOnly:!0})})]})}),o.jsxs("div",{className:"guake-git-panel",children:[o.jsxs("div",{className:"guake-git-header",children:[o.jsx("div",{className:"guake-git-title",children:o.jsxs("div",{className:"guake-git-tabs",children:[o.jsxs("button",{className:`guake-git-tab ${_==="changes"?"active":""}`,onClick:()=>R("changes"),children:["🌿 Changes",ut>0&&o.jsx("span",{className:"guake-git-badge",children:ut})]}),o.jsx("button",{className:`guake-git-tab ${_==="explorer"?"active":""}`,onClick:()=>R("explorer"),children:"📁 Files"})]})}),o.jsxs("div",{className:"guake-git-header-actions",children:[o.jsx("button",{className:`guake-git-fetch-btn ${r.size>0?"fetching":""}`,onClick:be,title:"Git fetch",disabled:r.size>0,children:r.size>0?"⏳":"⇣"}),_==="changes"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`guake-git-view-toggle ${E==="flat"?"active":""}`,onClick:()=>M("flat"),title:"Flat view",children:"☰"}),o.jsx("button",{className:`guake-git-view-toggle ${E==="tree"?"active":""}`,onClick:()=>M("tree"),title:"Tree view",children:"🌲"}),o.jsx("button",{className:"guake-git-refresh",onClick:Z,title:"Refresh",disabled:h,children:h?"⏳":"↻"})]}),_==="explorer"&&o.jsx("button",{className:"guake-git-refresh",onClick:()=>q.loadTree(),title:"Refresh",disabled:q.loading,children:q.loading?"⏳":"↻"}),o.jsx("button",{className:"guake-git-close",onClick:n,title:"Close",children:"×"})]})]}),o.jsxs("div",{className:"guake-git-body",children:[_==="changes"&&o.jsxs(o.Fragment,{children:[h&&d.length===0&&o.jsx("div",{className:"guake-git-loading",children:"Loading git status..."}),!h&&d.length===0&&o.jsx("div",{className:"guake-git-empty",children:"No git changes found"}),d.map(({dir:ue,dirName:X,gitStatus:se})=>{const ke=s.get(ue);return o.jsxs("div",{className:"guake-git-repo",children:[o.jsxs("div",{className:`guake-git-repo-header ${x.has(ue)?"expanded":""}`,onClick:()=>je(ue),children:[o.jsx("span",{className:"guake-git-repo-arrow",children:x.has(ue)?"▼":"▶"}),o.jsx("span",{className:"guake-git-repo-name",children:X}),se.branch&&o.jsxs("span",{className:"guake-git-repo-branch",children:["⎇ ",se.branch]}),ke&&ke.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",ke.ahead]}),ke&&ke.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",ke.behind]}),o.jsx("span",{className:"guake-git-repo-count",children:se.files.length})]}),x.has(ue)&&E==="flat"&&o.jsx("div",{className:"guake-git-file-list",children:se.files.map(J=>{const we=i1[J.status],We=Bp(J.name);return o.jsxs("div",{className:"guake-git-file","data-status":J.status,onClick:()=>Ee(J,ue),onContextMenu:Be=>Ve(Be,J,ue),title:J.path,children:[We&&o.jsx("img",{src:We,alt:"",className:"guake-git-file-icon"}),o.jsx("span",{className:"guake-git-file-name",children:J.name}),o.jsx("span",{className:"guake-git-file-dir",children:J.path.includes("/")?J.path.substring(0,J.path.lastIndexOf("/")):""}),o.jsx("span",{className:"guake-git-file-status",style:{color:we.color},title:we.label,children:we.icon}),o.jsx("button",{className:"guake-git-discard-btn",title:J.status==="untracked"||J.status==="added"?"Delete file":"Discard changes",onClick:Be=>pe(Be,J,ue),children:"↩"})]},J.path)})}),x.has(ue)&&E==="tree"&&o.jsx("div",{className:"guake-git-file-list",children:Vg(se.files).map(J=>o.jsx(tT,{node:J,depth:0,expandedDirs:v,onToggleDir:ce,onFileClick:Ee,onContextMenu:Ve,onDiscard:pe,repoDir:ue},J.path))})]},ue)})]}),_==="explorer"&&o.jsxs(o.Fragment,{children:[Q.length>1&&o.jsx("div",{className:"guake-git-folder-selector",children:Q.map((ue,X)=>{const se=ue.split("/").filter(Boolean).pop()||ue,ke=s.get(ue);return o.jsxs("button",{className:`guake-git-folder-btn ${X===O?"active":""}`,onClick:()=>I(X),title:ue,children:["📂 ",se,ke&&o.jsxs("span",{className:"guake-git-folder-branch",children:[" ⎇ ",ke.branch]}),ke&&ke.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",ke.ahead]}),ke&&ke.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",ke.behind]})]},ue)})}),q.loading&&q.tree.length===0&&o.jsx("div",{className:"guake-git-loading",children:"Loading files..."}),!q.loading&&q.tree.length===0&&o.jsx("div",{className:"guake-git-empty",children:"No files found"}),o.jsx("div",{className:"guake-git-explorer-tree",children:xe.map(ue=>o.jsx(Xx,{node:ue,depth:0,selectedPath:z,expandedPaths:q.expandedPaths,onSelect:ze,onToggle:q.togglePath,onContextMenu:at,searchQuery:""},ue.path))})]})]})]}),$&&o.jsx(go,{isOpen:$.isOpen,position:$.position,worldPosition:{x:0,z:0},actions:$.actions,onClose:te})]})}const os={Read:"📖",Write:"✏️",Edit:"📝",Bash:"💻",Glob:"🔍",Grep:"🔎",Task:"📋",Agent:"🤖",WebFetch:"🌐",WebSearch:"🌍",TodoWrite:"✅",NotebookEdit:"📓",AskFollowupQuestion:"❓",AskUserQuestion:"❓",AttemptCompletion:"✨",ListFiles:"📂",SearchFiles:"🔎",ExecuteCommand:"⚙️",spawn_agent:"🧬",send_input:"📨",wait:"⏳",default:"⚡"},G6={Read:"tools:display.toolNames.read",Write:"tools:display.toolNames.write",Edit:"tools:display.toolNames.edit",Bash:"tools:display.toolNames.bash",Glob:"tools:display.toolNames.glob",Grep:"tools:display.toolNames.grep",Task:"tools:display.toolNames.task",Agent:"tools:display.toolNames.agent",WebFetch:"tools:display.toolNames.webFetch",WebSearch:"tools:display.toolNames.webSearch",TodoWrite:"tools:display.toolNames.todoWrite",NotebookEdit:"tools:display.toolNames.notebookEdit",AskFollowupQuestion:"tools:display.toolNames.askFollowupQuestion",AskUserQuestion:"tools:display.toolNames.askUserQuestion",AttemptCompletion:"tools:display.toolNames.attemptCompletion",ListFiles:"tools:display.toolNames.listFiles",SearchFiles:"tools:display.toolNames.searchFiles",ExecuteCommand:"tools:display.toolNames.executeCommand",spawn_agent:"tools:display.toolNames.spawnAgent",send_input:"tools:display.toolNames.sendInput",wait:"tools:display.toolNames.wait"};function nT(t,e){const n=G6[t];return n&&e(n,{defaultValue:t})||t}function cp(t){return(typeof t=="string"?new Date(t):new Date(t)).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function sT(t,e){var n;try{const s=JSON.parse(e);switch(t){case"Read":case"Write":case"Edit":case"NotebookEdit":{const a=s.file_path||s.path||s.notebook_path;if(a)return a;break}case"Bash":{const a=s.command;if(a)return rT(a);break}case"Grep":{const a=s.pattern,r=s.path;if(a&&r)return`"${a}" in ${r}`;if(a)return`"${a}"`;break}case"Glob":{const a=s.pattern,r=s.path;if(a&&r)return`${a} in ${r}`;if(a)return a;break}case"WebFetch":{const a=s.url;if(a)return a;break}case"WebSearch":{const a=s.query;if(a)return`"${a}"`;break}case"Task":case"Agent":{const a=s.description,r=s.subagent_type;if(a)return r?`[${r}] ${a}`:a;if(s.prompt)return s.prompt;break}case"ExitPlanMode":case"EnterPlanMode":{const a=s.allowedPrompts;return Array.isArray(a)&&a.length>0?a.map(r=>r.prompt||r.tool||"").filter(Boolean).join(", "):t==="ExitPlanMode"&&typeof s.plan=="string"&&s.plan.trim().length>0?s.plan.trim():t==="ExitPlanMode"?"Plan ready":"Entering plan mode"}case"TodoWrite":{const a=s.todos;if(Array.isArray(a)&&a.length>0){const r=a.filter(f=>f.status==="completed").length,i=a.filter(f=>f.status==="in_progress").length,c=a.filter(f=>f.status==="pending").length,d=[];return r>0&&d.push(`${r} done`),i>0&&d.push(`${i} active`),c>0&&d.push(`${c} pending`),`${a.length} items (${d.join(", ")})`}break}case"AskUserQuestion":case"AskFollowupQuestion":{const a=s.questions||s.question;if(a){const r=Array.isArray(a)?(n=a[0])==null?void 0:n.question:a;if(r)return r}break}default:{for(const[,a]of Object.entries(s))if(typeof a=="string"&&a.length>0)return a;break}}}catch{}return null}function aT(t){if(!t.includes("curl")||!t.includes("/api/exec"))return null;const e=[],n=[/(?:-d|--data|--data-raw)\s+'((?:\\'|[^'])*)'/g,/(?:-d|--data|--data-raw)\s+"((?:\\"|[^"])*)"/g];for(const s of n){let a;for(;(a=s.exec(t))!==null;)a[1]&&e.push(a[1])}for(const s of e){const a=[s,s.replace(/\\"/g,'"'),s.replace(/\\'/g,"'"),s.replace(/\\"/g,'"').replace(/\\\\/g,"\\")];for(const r of a){const i=r.trim();if(!(!i.startsWith("{")||!i.endsWith("}")))try{const c=JSON.parse(i);if(typeof c.command=="string"&&c.command.length>0)return c.command}catch{}}}return null}function rT(t){return aT(t)||t}const mA=/(^|[\s("'`])((?:\.{1,2}\/|~\/|\/)?[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\.[A-Za-z0-9._-]+(?::\d+(?::\d+)?)?)/g;function Y6(t){return!t||t.startsWith("-")||t.includes("://")||t.includes("*")?!1:t.includes(".")&&!t.endsWith(".")}function iT(t){if(!t)return[{text:""}];const e=[];let n=0;mA.lastIndex=0;let s;for(;(s=mA.exec(t))!==null;){const a=s[0],r=s[1]||"",i=s[2]||"",c=s.index;c>n&&e.push({text:t.slice(n,c)}),r&&e.push({text:r}),Y6(i)?e.push({text:i,fileRef:i}):e.push({text:i}),n=c+a.length}return n<t.length&&e.push({text:t.slice(n)}),e.length>0?e:[{text:t}]}const up="tide-file://",K6=/(^|[\s(>])((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)(?=$|[\s),.;])/g,Q6=/`((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)`/g,X6=/\.(com|org|net|io|dev|app|co|me|info|biz|us|uk|de|fr|jp|cn|ru|edu|gov|mil|int|xyz|tech|online|site|store|blog|cloud|ai|gg|tv|cc|sh|fm|to|ly|gl|so|is|it|at|nl|ch|se|no|fi|dk|be|cz|pl|pt|br|mx|ar|cl|in|au|nz|za|sg|hk|tw|kr|id|ph|th|vn|my)(?:[:/\s#?]|$)/i;function gA(t){if(!t||t.includes("://")||t.startsWith("www.")||t.includes("@"))return!1;const e=t.split("/")[0];return X6.test(e)?!1:t.includes(".")&&!t.endsWith(".")}function Df(t){if(!t||!t.includes("."))return t;const e=t.split(`
|
|
123
|
-
`);let n=!1;return e.map(a=>{if(a.trimStart().startsWith("```"))return n=!n,a;if(n)return a;const i=a.replace(Q6,(c,d)=>{if(!gA(d))return c;const f=encodeURIComponent(d);return`[\`${d}\`](${up}${f})`});return i.replace(K6,(c,d,f,h)=>{const m=h+d.length,x=m>0?i[m-1]:"",y=m+f.length<i.length?i[m+f.length]:"";if(x==="("&&m>1&&i[m-2]==="]"||x==="["||y==="]"||!gA(f))return c;const v=encodeURIComponent(f);return`${d}[${f}](${up}${v})`})}).join(`
|
|
124
|
-
`)}function J6(t){if(!t||!t.startsWith(up))return null;const e=t.slice(up.length);if(!e)return null;try{return decodeURIComponent(e)}catch{return e}}function ji(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function oT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=ji(a[2].trim())),!/\brg\s+--files\b/.test(s)||!/\|\s*rg\b/.test(s))return null;const r=s.match(/\|\s*rg\b\s+(.+)$/);if(!r)return null;const i=r[1].trim();if(!i)return null;const c=i.replace(/^(?:-\S+\s+)*/,"").trim(),d=ji(c||i);return d?{shellPrefix:n,commandBody:s,searchTerm:d}:null}function lT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);a&&(n=`${a[1]} -lc`,s=ji(a[2].trim()));const r=/\bcurl\b[\s\S]*\/api\/notify\b/.test(s),i=/\bgdbus\b[\s\S]*org\.freedesktop\.Notifications\.Notify\b/.test(s);if(!r&&!i)return null;let c,d;const f=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(f){const h=ji(f[1]).replace(/\\"/g,'"'),m=h.match(/"title"\s*:\s*"([^"]*)"/),x=h.match(/"message"\s*:\s*"([^"]*)"/);m!=null&&m[1]&&(c=m[1]),x!=null&&x[1]&&(d=x[1])}if(!c||!d){const h=s.match(/Notifications\.Notify[\s\S]*?\s'[^']*'\s+\d+\s+'[^']*'\s+'([^']*)'\s+'([^']*)'/);!c&&(h!=null&&h[1])&&(c=h[1]),!d&&(h!=null&&h[2])&&(d=h[2])}return{shellPrefix:n,commandBody:s,title:c,message:d,viaCurl:r,viaGdbus:i}}function cT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=ji(a[2].trim())),!/\bcurl\b/.test(s)||!/PATCH/.test(s)||!/\/api\/agents\//.test(s))return null;const r=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(!r)return null;const c=ji(r[1]).replace(/\\"/g,'"').match(/"taskLabel"\s*:\s*"([^"]*)"/);return c!=null&&c[1]?{shellPrefix:n,commandBody:s,taskLabel:c[1]}:null}function uT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=ji(a[2].trim())),!/\bcurl\b/.test(s)||!/\/api\/agents\/.*\/report-task\b/.test(s))return null;let r="",i="completed";const c=s.match(/<<'?EOF'?\s*\n([\s\S]*?)\nEOF/);if(c)try{const d=JSON.parse(c[1].trim());r=d.summary||"",i=d.status==="failed"?"failed":"completed"}catch{}else{const d=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(d){const f=ji(d[1]).replace(/\\"/g,'"'),h=f.match(/"summary"\s*:\s*"([^"]*)"/),m=f.match(/"status"\s*:\s*"([^"]*)"/);h&&(r=h[1]),(m==null?void 0:m[1])==="failed"&&(i="failed")}}return{shellPrefix:n,commandBody:s,summary:r,status:i}}async function Fp(t,e){const n=Ni(),s=await fetch(`${Sa()}${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":n},body:JSON.stringify(e)});if(!s.ok)throw new Error(`Bulk action failed: ${s.statusText}`);const a=await s.json(),r=a.failed||[];return{succeeded:a.deleted||a.stopped||a.cleared||a.moved||[],failed:r}}async function Z6(t){return Fp("/api/agents/bulk/delete",{agentIds:t})}async function e5(t){return Fp("/api/agents/bulk/stop",{agentIds:t})}async function t5(t){return Fp("/api/agents/bulk/clear-context",{agentIds:t})}async function n5(t,e){return Fp("/api/agents/bulk/move-area",{agentIds:t,areaId:e})}function s5(t){return Array.from(t.values())}const a5={">1h":3600*1e3,">6h":360*60*1e3,">1d":1440*60*1e3,">3d":4320*60*1e3,">7d":10080*60*1e3,">30d":720*60*60*1e3};function r5(t){const e=Date.now()-t;return e<6e4?"<1m":e<36e5?`${Math.floor(e/6e4)}m`:e<864e5?`${Math.floor(e/36e5)}h`:`${Math.floor(e/864e5)}d`}function bA(t,e){for(const n of e)if(n.assignedAgentIds.includes(t.id))return n;return null}function i5({isOpen:t,onClose:e}){const n=vp(),s=rr(),a=s5(s),[r,i]=b.useState("all"),[c,d]=b.useState("any"),[f,h]=b.useState("all"),[m,x]=b.useState("all"),[y,v]=b.useState("all"),[S,C]=b.useState(""),[k,N]=b.useState(new Set),[j,E]=b.useState(null),[D,_]=b.useState(""),[P,O]=b.useState(null),[T,M]=b.useState(null),[R,I]=b.useState(!1);b.useEffect(()=>{t&&(N(new Set),O(null),M(null),E(null))},[t]);const z=b.useMemo(()=>{const G=Date.now(),B=S.toLowerCase().trim();return n.filter(Q=>{if(r!=="all"&&Q.status!==r||c!=="any"&&G-Q.lastActivity<a5[c])return!1;if(f!=="all"){const K=bA(Q,a);if(f==="unassigned"){if(K!==null)return!1}else if(!K||K.id!==f)return!1}if(m!=="all"&&Q.provider!==m||y!=="all"&&(Q.model||"sonnet")!==y)return!1;if(B){const K=Q.name.toLowerCase().includes(B),q=Q.class.toLowerCase().includes(B);if(!K&&!q)return!1}return!0})},[n,a,r,c,f,m,y,S]);b.useEffect(()=>{const G=new Set(z.map(B=>B.id));N(B=>{const Q=new Set;for(const K of B)G.has(K)&&Q.add(K);return Q.size!==B.size?Q:B})},[z]);const W=b.useCallback(G=>{N(B=>{const Q=new Set(B);return Q.has(G)?Q.delete(G):Q.add(G),Q})},[]),$=b.useCallback(()=>{N(new Set(z.map(G=>G.id)))},[z]),F=b.useCallback(()=>{N(new Set)},[]),H=b.useCallback(async G=>{const B=Array.from(k);if(B.length!==0){I(!0),O(null),M(null);try{let Q,K="";switch(G){case"delete":Q=await Z6(B),K="Deleted",Q.failed.length===0&&N(new Set);break;case"stop":Q=await e5(B),K="Stopped";break;case"clear-context":Q=await t5(B),K="Cleared context for";break;case"move-area":Q=await n5(B,D||null),K="Moved";break}Q&&(Q.failed.length>0?M(`${K} ${Q.succeeded.length} agent(s). Failed: ${Q.failed.length}`):M(`${K} ${Q.succeeded.length} agent(s)`))}catch(Q){O(Q instanceof Error?Q.message:"Action failed")}finally{I(!1),E(null)}}},[k,D]),V=b.useCallback(G=>{G.key==="Escape"&&(j?E(null):e())},[j,e]);return t?o.jsx(ir,{children:o.jsx("div",{className:`modal-overlay ${t?"visible":""}`,onClick:e,children:o.jsxs("div",{className:"bulk-manage-modal",onClick:G=>G.stopPropagation(),onKeyDown:V,children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"Bulk Agent Management"}),o.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"✕"})]}),o.jsx("div",{className:"bulk-filters",children:o.jsxs("div",{className:"filter-row",children:[o.jsxs("select",{value:r,onChange:G=>i(G.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Status"}),o.jsx("option",{value:"idle",children:"Idle"}),o.jsx("option",{value:"working",children:"Working"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"stopped",children:"Stopped"})]}),o.jsxs("select",{value:c,onChange:G=>d(G.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"any",children:"Any Idle Time"}),o.jsx("option",{value:">1h",children:"> 1 hour"}),o.jsx("option",{value:">6h",children:"> 6 hours"}),o.jsx("option",{value:">1d",children:"> 1 day"}),o.jsx("option",{value:">3d",children:"> 3 days"}),o.jsx("option",{value:">7d",children:"> 7 days"}),o.jsx("option",{value:">30d",children:"> 30 days"})]}),o.jsxs("select",{value:f,onChange:G=>h(G.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Areas"}),o.jsx("option",{value:"unassigned",children:"Unassigned"}),a.map(G=>o.jsx("option",{value:G.id,children:G.name},G.id))]}),o.jsxs("select",{value:m,onChange:G=>x(G.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Providers"}),o.jsx("option",{value:"claude",children:"Claude"}),o.jsx("option",{value:"codex",children:"Codex"}),o.jsx("option",{value:"opencode",children:"OpenCode"})]}),o.jsxs("select",{value:y,onChange:G=>v(G.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Models"}),o.jsx("option",{value:"opus",children:"Opus"}),o.jsx("option",{value:"sonnet",children:"Sonnet"}),o.jsx("option",{value:"haiku",children:"Haiku"})]}),o.jsx("input",{type:"text",placeholder:"Search name/class...",value:S,onChange:G=>C(G.target.value),className:"bulk-filter-search"})]})}),o.jsxs("div",{className:"bulk-count-bar",children:[o.jsxs("span",{className:"bulk-count",children:[z.length," matched, ",k.size," selected"]}),o.jsxs("div",{className:"bulk-select-controls",children:[o.jsx("button",{className:"bulk-link-btn",onClick:$,children:"Select all"}),o.jsx("button",{className:"bulk-link-btn",onClick:F,children:"Select none"})]})]}),P&&o.jsxs("div",{className:"bulk-alert bulk-alert-error",children:[o.jsx("span",{className:"alert-icon",children:"!"}),P]}),T&&o.jsxs("div",{className:"bulk-alert bulk-alert-success",children:[o.jsx("span",{className:"alert-icon",children:"✓"}),T]}),o.jsx("div",{className:"bulk-agent-list",children:z.length===0?o.jsx("div",{className:"bulk-empty",children:"No agents match the current filters"}):o.jsxs("table",{className:"bulk-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"col-check",children:o.jsx("input",{type:"checkbox",checked:k.size===z.length&&z.length>0,onChange:()=>k.size===z.length?F():$()})}),o.jsx("th",{className:"col-name",children:"Name"}),o.jsx("th",{className:"col-class",children:"Class"}),o.jsx("th",{className:"col-status",children:"Status"}),o.jsx("th",{className:"col-idle",children:"Idle"}),o.jsx("th",{className:"col-area",children:"Area"})]})}),o.jsx("tbody",{children:z.map(G=>{const B=bA(G,a);return o.jsxs("tr",{className:k.has(G.id)?"selected":"",onClick:()=>W(G.id),children:[o.jsx("td",{className:"col-check",children:o.jsx("input",{type:"checkbox",checked:k.has(G.id),onChange:()=>W(G.id),onClick:Q=>Q.stopPropagation()})}),o.jsx("td",{className:"col-name",children:G.name}),o.jsx("td",{className:"col-class",children:G.class}),o.jsx("td",{className:"col-status",children:o.jsx("span",{className:`bulk-status bulk-status-${G.status}`,children:G.status})}),o.jsx("td",{className:"col-idle",children:r5(G.lastActivity)}),o.jsx("td",{className:"col-area",children:B?o.jsx("span",{className:"bulk-area-badge",style:{borderColor:B.color},children:B.name}):o.jsx("span",{className:"bulk-area-none",children:"--"})})]},G.id)})})]})}),j&&o.jsx("div",{className:"bulk-confirm-overlay",children:o.jsxs("div",{className:"bulk-confirm-box",children:[o.jsx("p",{children:j==="delete"?`Delete ${k.size} agent(s)? This cannot be undone.`:`Clear context for ${k.size} agent(s)? This will restart their sessions.`}),o.jsxs("div",{className:"bulk-confirm-actions",children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>E(null),disabled:R,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:()=>H(j),disabled:R,children:R?"Working...":"Confirm"})]})]})}),o.jsxs("div",{className:"modal-footer bulk-footer",children:[o.jsxs("div",{className:"footer-buttons-left",children:[o.jsx("button",{className:"btn btn-danger",disabled:k.size===0||R,onClick:()=>E("delete"),children:"Delete Selected"}),o.jsx("button",{className:"btn btn-secondary",disabled:k.size===0||R,onClick:()=>E("clear-context"),children:"Clear Context"})]}),o.jsxs("div",{className:"footer-buttons-right",children:[o.jsx("button",{className:"btn btn-secondary",disabled:k.size===0||R,onClick:()=>H("stop"),children:"Stop Selected"}),o.jsxs("select",{value:D,onChange:G=>_(G.target.value),className:"bulk-filter-select",disabled:k.size===0||R,children:[o.jsx("option",{value:"",children:"Unassign area"}),a.map(G=>o.jsx("option",{value:G.id,children:G.name},G.id))]}),o.jsx("button",{className:"btn btn-primary",disabled:k.size===0||R,onClick:()=>H("move-area"),children:"Move to Area"})]})]})]})})}):null}const o5={working:"🟢",idle:"💤",waiting_input:"🟡",waiting_permission:"🟠",error:"🔴",stopped:"⚫"},xA={working:"overview.statusLabels.working",idle:"overview.statusLabels.idle",waiting_input:"overview.statusLabels.waitingInput",waiting_permission:"overview.statusLabels.waitingPermission",error:"overview.statusLabels.error",stopped:"overview.statusLabels.stopped"};function l5(t){const e=U.getState().agentOutputs.get(t);if(!e||e.length===0)return null;for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.isStreaming)continue;const a=s.text;if(!(a.startsWith("Using tool:")||a.startsWith("Tool input:")||a.startsWith("Tool result:")||a.startsWith("Bash output:"))&&!(a.startsWith("Tokens:")||a.startsWith("Cost:")||a.startsWith("Context:"))&&a.trim().length!==0)return s}return null}function c5(t){const e=U.getState().agentOutputs.get(t);if(!e)return 0;let n=0;for(const s of e){if(s.isStreaming)continue;const a=s.text;a.startsWith("Using tool:")||a.startsWith("Tool input:")||a.startsWith("Tool result:")||a.startsWith("Bash output:")||a.startsWith("Tokens:")||a.startsWith("Cost:")||a.startsWith("Context:")||a.trim().length!==0&&n++}return n}function xf(t,e){const n=t.split(`
|
|
125
|
-
`)[0];return n.length>e?n.slice(0,e)+"...":n}function u5({activeAgentId:t,onClose:e,onSelectAgent:n,agentListRef:s,twoFingerState:a}){const{t:r}=pt(["terminal","common"]),i=vp(),[c]=ox(),d=b.useMemo(()=>c?i.filter(ge=>{const Te=U.getAreaForAgent(ge.id);return xp((Te==null?void 0:Te.id)??null)}):i,[i,c]),f=Uj(),h=gx(),m=jL(),x=rr(),y=Ij();b.useEffect(()=>{for(const ge of d)!U.hasHistoryBeenFetched(ge.id)&&!U.isLoadingHistoryForAgent(ge.id)&&U.requestAgentSupervisorHistory(ge.id)},[d]);const v=b.useMemo(()=>ta(ft.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",allExpanded:!1,sameAreaOnly:!1,showSubagents:!0,showRecentActivity:!0,visibleAreaIds:null}),[]),[S,C]=b.useState(()=>v.allExpanded?new Set(d.map(ge=>ge.id)):new Set),[k,N]=b.useState(new Set),[j,E]=b.useState(null),[D,_]=b.useState(""),[P,O]=b.useState(v.sortMode),[T,M]=b.useState(v.filterMode),[R,I]=b.useState(""),[z,W]=b.useState(v.groupByArea),[$,F]=b.useState(v.allExpanded),[H,V]=b.useState(v.sameAreaOnly),[G,B]=b.useState(v.showSubagents),[Q,K]=b.useState(v.showRecentActivity),[q,xe]=b.useState(v.visibleAreaIds?new Set(v.visibleAreaIds):null),[de,Z]=b.useState(!1),[be,je]=b.useState(""),[ce,Ee]=b.useState(!1),ze=b.useRef(null),[Ge,_e]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[me,De]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[te,He]=b.useState(null),[ye,Re]=b.useState(null),re=b.useRef(null),pe=b.useRef(null),Ve=s||pe,at=b.useRef(!1),ut=b.useRef(new Map),ue=a||{hoveredAgentId:null};b.useEffect(()=>{if(typeof window>"u")return;const ge=window.matchMedia("(max-width: 768px)"),Te=tt=>{_e(tt),De(tt)};Te(ge.matches);const Ye=tt=>Te(tt.matches);return ge.addEventListener("change",Ye),()=>ge.removeEventListener("change",Ye)},[]),b.useEffect(()=>{if(!de){je("");return}const ge=Te=>{ze.current&&!ze.current.contains(Te.target)&&(Z(!1),je(""))};return document.addEventListener("mousedown",ge),()=>document.removeEventListener("mousedown",ge)},[de]),b.useEffect(()=>{const ge=Te=>{var tt,Nt;Te.altKey&&Te.shiftKey&&!Te.ctrlKey&&!Te.metaKey&&Te.code==="KeyF"&&(Te.preventDefault(),(tt=re.current)==null||tt.focus(),(Nt=re.current)==null||Nt.select())};return document.addEventListener("keydown",ge,!0),()=>document.removeEventListener("keydown",ge,!0)},[]),b.useEffect(()=>{ya(ft.AOP_CONFIG,{groupByArea:z,sortMode:P,filterMode:T,allExpanded:$,sameAreaOnly:H,showSubagents:G,showRecentActivity:Q,visibleAreaIds:q?Array.from(q):null})},[z,P,T,$,H,G,Q,q]);const X=b.useMemo(()=>{const ge=[];for(const[,Te]of x)Te.archived||ge.push({id:Te.id,name:Te.name,color:Te.color});return ge.sort((Te,Ye)=>Te.name.localeCompare(Ye.name,void 0,{sensitivity:"base"})),ge},[x]),se=q===null,ke=b.useCallback(ge=>{xe(Te=>{if(Te===null){const tt=new Set(X.map(Nt=>Nt.id));return tt.add("__unassigned__"),tt.delete(ge),tt}const Ye=new Set(Te);return Ye.has(ge)?Ye.delete(ge):Ye.add(ge),Ye.size>=X.length+1?null:Ye})},[X]),J=b.useCallback(()=>xe(null),[]),we=b.useMemo(()=>{const ge=new Map;for(const Te of d){const Ye=U.getAreaForAgent(Te.id);!Ye||Ye.archived||ge.set(Te.id,{color:Ye.color,name:Ye.name})}return ge},[d,x]),We=b.useMemo(()=>{const ge=new Map;for(const Te of h){const Ye=ge.get(Te.agentId)||[];Ye.push(Te),ge.set(Te.agentId,Ye)}return ge},[h]),Be=b.useMemo(()=>{const ge=new Map;for(const[,Te]of m){const Ye=ge.get(Te.parentAgentId)||[];Ye.push(Te),ge.set(Te.parentAgentId,Ye)}return ge},[m]),ie=b.useMemo(()=>{const ge=new Map;for(const Te of d){const Ye=U.getAreaForAgent(Te.id);!Ye||Ye.archived||ge.set(Te.id,Ye.id)}return ge},[d,x]),[Ie,oe]=b.useMemo(()=>{const ge=ie.get(t)??null,Te=new Map;return[d.filter(tt=>{if(T==="working"&&tt.status!=="working"||T==="idle"&&tt.status!=="idle"||T==="error"&&tt.status!=="error"||H&&(ie.get(tt.id)??null)!==ge)return!1;if(R){const Nt=R.toLowerCase();if(tt.name.toLowerCase().includes(Nt)||tt.id.includes(Nt)||(tt.class||"").toLowerCase().includes(Nt)||(tt.taskLabel||"").toLowerCase().includes(Nt))return!0;const zt=tt.lastAssignedTask||"";if(zt.toLowerCase().includes(Nt))return Te.set(tt.id,{type:"task",text:zt}),!0;const Pt=U.getAgentSupervisorHistory(tt.id);for(const It of Pt){const Vt=It.analysis.recentWorkSummary,mt=It.analysis.statusDescription;if(Vt.toLowerCase().includes(Nt))return Te.set(tt.id,{type:"history",text:Vt}),!0;if(mt.toLowerCase().includes(Nt))return Te.set(tt.id,{type:"history",text:mt}),!0}for(const It of y)if(It.agentId===tt.id&&It.filePath.toLowerCase().includes(Nt))return Te.set(tt.id,{type:"file",text:It.filePath}),!0;return!1}return!0}),Te]},[d,T,R,H,ie,t,y]),he=b.useCallback((ge,Te="__default__")=>{const Ye=new Set(ge.map(ct=>ct.id)),tt=ut.current.get(Te),Nt=!tt||tt.length!==ge.length||tt.some(ct=>!Ye.has(ct)),zt=ct=>{const xt=!!(ct.isBoss||ct.class==="boss");if(P==="name")return`${xt?"0":"1"}`;if(P==="status"){const Sn=["working","waiting_input","waiting_permission","error","idle","stopped"].indexOf(ct.status),cn=f.has(ct.id)?"0":"1";return`${xt?"0":"1"}-${Sn}-${cn}`}return`${xt?"0":"1"}`};let Pt=!1;if(tt&&!Nt){const ct=ut.current.get(Te+"__buckets");if(ct)for(const xt of ge){const Dt=tt.indexOf(xt.id);if(Dt>=0&&ct[Dt]!==zt(xt)){Pt=!0;break}}else Pt=!0}let It;if(Nt||Pt||P==="recent")It=[...ge].sort((ct,xt)=>{var Ba,Ts;const Dt=!!(ct.isBoss||ct.class==="boss"),Sn=!!(xt.isBoss||xt.class==="boss");if(Dt!==Sn)return Dt?-1:1;if(P==="name")return ct.name.localeCompare(xt.name);if(P==="status"){const Hs=["working","waiting_input","waiting_permission","error","idle","stopped"],Fa=Hs.indexOf(ct.status)-Hs.indexOf(xt.status);if(Fa!==0)return Fa;const ks=f.has(ct.id),Zn=f.has(xt.id);if(ks!==Zn)return ks?-1:1;if(ct.status==="working"&&xt.status==="working")return ct.name.localeCompare(xt.name);if(ct.status==="idle"&&xt.status==="idle"){const _t=!!ct.taskLabel,rs=!!xt.taskLabel;return _t!==rs?_t?-1:1:(xt.lastActivity||0)-(ct.lastActivity||0)}return(xt.lastActivity||0)-(ct.lastActivity||0)}const cn=((Ba=(We.get(ct.id)||[])[0])==null?void 0:Ba.timestamp)||ct.lastActivity||0;return(((Ts=(We.get(xt.id)||[])[0])==null?void 0:Ts.timestamp)||xt.lastActivity||0)-cn});else{const ct=new Map(ge.map(xt=>[xt.id,xt]));It=tt.map(xt=>ct.get(xt)).filter(Boolean)}const Vt=It.map(ct=>ct.id),mt=It.map(ct=>zt(ct));return ut.current.set(Te,Vt),ut.current.set(Te+"__buckets",mt),It},[P,We,f]),ne=b.useMemo(()=>{if(!z)return[{area:null,agents:he(Ie,"__flat__")}];const ge=new Map,Te=[];for(const tt of Ie){const Nt=U.getAreaForAgent(tt.id);if(!Nt||Nt.archived){Te.push(tt);continue}const zt=ge.get(Nt.id);zt?zt.push(tt):ge.set(Nt.id,[tt])}const Ye=[];for(const[tt,Nt]of x){if(Nt.archived||q&&!q.has(tt))continue;const zt=ge.get(tt)||[];zt.length>0&&Ye.push({area:Nt,agents:he(zt,`area_${tt}`)})}return Te.length>0&&(!q||q.has("__unassigned__"))&&Ye.push({area:null,agents:he(Te,"__unassigned__")}),Ye},[x,Ie,he,z,q]),Le=b.useCallback(ge=>{const Te=Pt=>f.has(Pt.id),Ye=ge.findIndex(Pt=>Te(Pt)&&Pt.status!=="working"),tt=Ye>=0,Nt=ge.findIndex(Pt=>Pt.status==="idle"&&!Te(Pt)),zt=Nt>=0&&ge.slice(0,Nt).some(Pt=>Pt.status==="working"||Te(Pt));return ge.map((Pt,It)=>o.jsxs(Ce.Fragment,{children:[tt&&It===Ye&&o.jsx("div",{className:"aop-status-separator aop-status-separator--unread",role:"separator","aria-label":"unread notifications",children:o.jsx("span",{children:"Unread notifications"})}),zt&&It===Nt&&o.jsx("div",{className:"aop-status-separator",role:"separator","aria-label":"idle agents",children:o.jsx("span",{children:r("terminal:overview.statusLabels.idle")})}),o.jsx(d5,{agent:Pt,isActive:Pt.id===t,isExpanded:S.has(Pt.id),isMobile:Ge,hasPendingRead:f.has(Pt.id),isTwoFingerHovered:ue.hoveredAgentId===Pt.id,showSubagents:G,showRecentActivity:Q,showAreaChip:!z,toolExecs:We.get(Pt.id)||[],subagents:Be.get(Pt.id)||[],areaInfo:we.get(Pt.id),matchContext:oe.get(Pt.id),onToggle:()=>$e(Pt.id),onSelect:()=>n(Pt.id),onClearContext:()=>U.clearContext(Pt.id),onContextMenu:Vt=>Re({agentId:Pt.id,position:Vt})})]},Pt.id))},[r,t,S,f,ue.hoveredAgentId,G,Q,z,We,Be,we,oe,n]),Qe=b.useMemo(()=>{const ge={total:d.length,working:0,idle:0,error:0};for(const Te of d)Te.status==="working"?ge.working++:Te.status==="error"?ge.error++:Te.status==="idle"&&ge.idle++;return ge},[d]),$e=ge=>{C(Te=>{const Ye=new Set(Te);return Ye.has(ge)?Ye.delete(ge):Ye.add(ge),Ye})},nt=ge=>{N(Te=>{const Ye=new Set(Te);return Ye.has(ge)?Ye.delete(ge):Ye.add(ge),Ye})},ot=()=>{C(new Set(d.map(ge=>ge.id))),F(!0)},st=()=>{C(new Set),F(!1)},lt=b.useCallback(ge=>{window.dispatchEvent(new CustomEvent("tide:open-spawn-modal",{detail:{areaId:ge.id,position:{x:ge.center.x,z:ge.center.z}}}))},[]),it=b.useCallback((ge,Te)=>{He({areaId:ge.id,position:Te})},[]),ht=b.useMemo(()=>{if(!te)return[];const ge=x.get(te.areaId);return ge?[{id:"spawn-agent",label:r("common:agentBar.newAgent"),icon:"+",onClick:()=>lt(ge)}]:[]},[te,x,lt,r]),jt=b.useMemo(()=>{if(!ye)return[];const ge=d.find(Ye=>Ye.id===ye.agentId);if(!ge)return[];const Te=S.has(ge.id);return[{id:"toggle-expand",label:Te?r("terminal:overview.collapse",{defaultValue:"Collapse"}):r("terminal:overview.expand",{defaultValue:"Expand"}),icon:Te?"▾":"▸",onClick:()=>$e(ge.id)},{id:"clear-context",label:r("terminal:overview.clearContext",{defaultValue:"Clear context"}),icon:"🧹",onClick:()=>U.clearContext(ge.id)},{id:"remove-agent",label:r("terminal:overview.removeAgent",{defaultValue:"Remove agent"}),icon:"🗑",danger:!0,onClick:()=>U.removeAgent(ge.id)}]},[ye,d,S,r]);return b.useEffect(()=>{const ge=Ve.current;if(!ge)return;const Te=requestAnimationFrame(()=>{const Ye=ge.querySelector(".aop-agent-card.active");if(!Ye)return;const tt=ge.getBoundingClientRect(),Nt=Ye.getBoundingClientRect(),zt=Nt.top-tt.top,Pt=ge.scrollTop+zt-(tt.height-Nt.height)/2,It=Math.max(0,Pt);Math.abs(ge.scrollTop-It)<2||(ge.scrollTo({top:It,behavior:at.current?"smooth":"auto"}),at.current=!0)});return()=>cancelAnimationFrame(Te)},[t]),o.jsxs("div",{className:`agent-overview-panel${Ge&&me?" mobile-filters-collapsed":""}`,children:[o.jsxs("div",{className:"aop-stats-row",children:[o.jsx("span",{className:"stat",children:r("terminal:overview.agents",{count:Qe.total})}),Qe.working>0&&o.jsxs("span",{className:"stat stat-working",children:["🟢 ",Qe.working]}),Qe.idle>0&&o.jsxs("span",{className:"stat stat-idle",children:["💤 ",Qe.idle]}),Qe.error>0&&o.jsxs("span",{className:"stat stat-error",children:["🔴 ",Qe.error]}),o.jsxs("div",{className:"aop-row-controls",children:[o.jsx("button",{type:"button",className:"aop-search-toggle",onClick:()=>{De(!1),requestAnimationFrame(()=>{var ge;return(ge=re.current)==null?void 0:ge.focus()})},title:"Search agents",children:"🔍"}),o.jsx("button",{type:"button",className:`aop-filters-toggle${me?" collapsed":""}`,onClick:()=>De(ge=>!ge),title:me?"Show filters":"Hide filters",children:me?"Filters":"Hide filters"}),o.jsxs("select",{value:T,onChange:ge=>M(ge.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:r("terminal:overview.allStatus")}),o.jsx("option",{value:"working",children:r("terminal:overview.statusLabels.working")}),o.jsx("option",{value:"idle",children:r("terminal:overview.statusLabels.idle")}),o.jsx("option",{value:"error",children:r("terminal:overview.statusLabels.error")})]}),o.jsxs("select",{value:P,onChange:ge=>O(ge.target.value),className:"filter-select",children:[o.jsx("option",{value:"recent",children:r("terminal:overview.mostRecent")}),o.jsx("option",{value:"status",children:r("terminal:overview.byStatus")}),o.jsx("option",{value:"name",children:r("terminal:overview.byName")})]}),o.jsx("input",{ref:re,type:"text",placeholder:r("terminal:overview.searchAgents"),value:R,onChange:ge=>I(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"&&(ge.nativeEvent.isComposing||R.trim().length!==0&&Ie.length!==0&&(ge.preventDefault(),n(Ie[0].id),I("")))},className:"search-input"}),o.jsx("button",{className:"close-btn",onClick:e,title:r("common:buttons.close"),children:"✕"})]})]}),o.jsxs("div",{className:"aop-actions",children:[o.jsx(wj,{}),o.jsx("button",{onClick:ot,className:"action-btn",title:r("common:buttons.expand"),children:r("common:buttons.expand")}),o.jsx("button",{onClick:st,className:"action-btn",title:r("common:buttons.collapse"),children:r("common:buttons.collapse")}),o.jsx("button",{onClick:()=>W(ge=>!ge),className:`action-btn action-btn--toggle${z?" active":""}`,title:r("terminal:overview.areas"),children:r("terminal:overview.areas")}),z&&X.length>0&&o.jsxs("div",{className:"aop-area-filter",ref:ze,children:[o.jsxs("button",{className:`action-btn action-btn--toggle${se?"":" active"}`,onClick:()=>Z(ge=>!ge),title:"Filter areas",children:[se?"All areas":`${q.size} areas`,o.jsx("span",{className:"aop-area-filter-caret",children:de?"▴":"▾"})]}),de&&o.jsxs("div",{className:"aop-area-filter-dropdown",children:[X.length>=5&&o.jsx("div",{className:"aop-area-filter-search",children:o.jsx("input",{type:"text",placeholder:"Filter areas...",value:be,onChange:ge=>je(ge.target.value),onClick:ge=>ge.stopPropagation(),autoFocus:!0})}),(()=>{const ge=be.toLowerCase().trim(),Te=ge?X.filter(tt=>tt.name.toLowerCase().includes(ge)):X,Ye=!ge||"unassigned".includes(ge);return o.jsxs(o.Fragment,{children:[!ge&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"aop-area-filter-option",onClick:J,children:[o.jsx("input",{type:"checkbox",checked:se,readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:"#6272a4"}}),o.jsx("span",{children:"All"})]}),o.jsx("div",{className:"aop-area-filter-divider"})]}),Te.map(tt=>{const Nt=se||((q==null?void 0:q.has(tt.id))??!1);return o.jsxs("label",{className:"aop-area-filter-option",onClick:zt=>{zt.preventDefault(),ke(tt.id)},children:[o.jsx("input",{type:"checkbox",checked:Nt,readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:tt.color}}),o.jsx("span",{className:"aop-area-filter-name",children:tt.name})]},tt.id)}),Ye&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"aop-area-filter-divider"}),o.jsxs("label",{className:"aop-area-filter-option",onClick:tt=>{tt.preventDefault(),ke("__unassigned__")},children:[o.jsx("input",{type:"checkbox",checked:se||((q==null?void 0:q.has("__unassigned__"))??!1),readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:"#6272a4"}}),o.jsx("span",{className:"aop-area-filter-name",children:"Unassigned"})]})]}),ge&&Te.length===0&&!Ye&&o.jsx("div",{className:"aop-area-filter-empty",children:"No matching areas"})]})})()]})]}),o.jsx("button",{onClick:()=>V(ge=>!ge),className:`action-btn action-btn--toggle${H?" active":""}`,title:r("terminal:overview.sameAreaOnly"),children:r("terminal:overview.sameAreaOnly")}),o.jsx("button",{onClick:()=>B(ge=>!ge),className:`action-btn action-btn--toggle${G?" active":""}`,title:"Subagents",children:"Subagents"}),o.jsx("button",{onClick:()=>K(ge=>!ge),className:`action-btn action-btn--toggle${Q?" active":""}`,title:r("terminal:overview.recentActivity"),children:"Activity"}),o.jsx("button",{onClick:()=>Ee(!0),className:"action-btn",title:"Bulk manage agents",children:"Bulk Manage"})]}),o.jsx("div",{className:"aop-agent-list",ref:Ve,children:ne.length===0?o.jsx("div",{className:"aop-empty",children:d.length===0?r("terminal:overview.noAgentsDeployed"):r("terminal:overview.noAgentsMatch")}):ne.map(ge=>{var zt,Pt,It;const Te=((zt=ge.area)==null?void 0:zt.id)||"__unassigned__",Ye=((Pt=ge.area)==null?void 0:Pt.name)||(z?r("terminal:overview.unassigned"):""),tt=((It=ge.area)==null?void 0:It.color)||"#6272a4",Nt=k.has(Te);return o.jsxs("div",{className:"aop-area-group",children:[z&&o.jsxs("div",{className:"aop-area-header",onClick:()=>nt(Te),style:{borderLeftColor:tt},children:[o.jsx("span",{className:"aop-area-expand",children:Nt?"▸":"▾"}),o.jsx("span",{className:"aop-area-color",style:{background:tt}}),o.jsx("span",{className:"aop-area-name",onContextMenu:Vt=>{ge.area&&(Vt.preventDefault(),Vt.stopPropagation(),it(ge.area,{x:Vt.clientX,y:Vt.clientY}))},children:Ye}),o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Hide area",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation(),ke(Te)},children:"◉"}),ge.area&&o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Edit area prompt",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation();const mt=ge.area;j===mt.id?E(null):(_(mt.prompt||""),E(mt.id))},children:"✎"}),ge.area&&(()=>{const Vt=ge.area;return o.jsx("button",{type:"button",className:"aop-area-add-btn",title:r("common:agentBar.newAgent"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation();const ct=mt.currentTarget.getBoundingClientRect();it(Vt,{x:ct.left,y:ct.bottom+6})},children:"+"})})(),o.jsx("span",{className:"aop-area-count",children:ge.agents.length})]}),j===Te&&ge.area&&o.jsxs("div",{className:"aop-area-prompt-editor",onClick:Vt=>Vt.stopPropagation(),children:[o.jsx("textarea",{className:"aop-area-prompt-textarea",value:D,onChange:Vt=>_(Vt.target.value),placeholder:"System prompt for agents in this area...",rows:3,autoFocus:!0}),o.jsxs("div",{className:"aop-area-prompt-actions",children:[o.jsx("button",{className:"aop-area-prompt-save",onClick:()=>{U.updateArea(ge.area.id,{prompt:D}),E(null)},children:"Save"}),o.jsx("button",{className:"aop-area-prompt-cancel",onClick:()=>E(null),children:"Cancel"})]})]}),(!z||!Nt)&&o.jsx("div",{className:z?"aop-area-content":void 0,children:Le(ge.agents)})]},Te)})}),o.jsx(go,{isOpen:te!==null,position:(te==null?void 0:te.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:ht,onClose:()=>He(null)}),o.jsx(go,{isOpen:ye!==null,position:(ye==null?void 0:ye.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:jt,onClose:()=>Re(null)}),o.jsx(i5,{isOpen:ce,onClose:()=>Ee(!1)})]})}function d5({agent:t,isActive:e,isExpanded:n,isMobile:s,hasPendingRead:a,isTwoFingerHovered:r,showSubagents:i,showRecentActivity:c,showAreaChip:d,toolExecs:f,subagents:h,areaInfo:m,matchContext:x,onToggle:y,onSelect:v,onClearContext:S,onContextMenu:C}){const{t:k}=pt(["terminal","common"]),N=Pa(),j=Ia(t.class,N),E=t.isBoss||t.class==="boss",D=o5[t.status]||"❓",_=xA[t.status]?k(`terminal:${xA[t.status]}`):t.status,P=f.slice(0,s?4:8),O=l5(t.id),T=c5(t.id),M=s?40:80,R=b.useMemo(()=>{var Ve,at,ut,ue,X,se,ke;const re=[],pe=new Set;for(const J of h)re.push({id:J.id,name:J.name,type:J.subagentType,description:J.description,status:J.status,timestamp:J.startedAt}),pe.add(J.name);for(const J of f){if(J.toolName!=="Task"&&J.toolName!=="Agent")continue;const We=((Ve=J.toolInput)==null?void 0:Ve.description)||((at=J.toolInput)==null?void 0:at.name)||""||((ue=(ut=J.toolInput)==null?void 0:ut.prompt)==null?void 0:ue.slice(0,40))||"Task";pe.has(We)||(pe.add(We),re.push({id:`task-${J.timestamp}`,name:We,type:((X=J.toolInput)==null?void 0:X.subagent_type)||"unknown",description:(ke=(se=J.toolInput)==null?void 0:se.prompt)==null?void 0:ke.slice(0,100),status:"completed",timestamp:J.timestamp}))}return re.sort((J,we)=>we.timestamp-J.timestamp),re},[h,f]),I=R.filter(re=>re.status==="working"||re.status==="spawning"),z=i&&R.length>0,W=c&&P.length>0,$=z||W,F=t.contextLimit>0?t.contextUsed/t.contextLimit:0,H=Math.min(100,F*100),V=Math.min(1,Math.max(0,F)),B=`hsl(${Math.round((1-V)*120)} 80% 45% / 0.55)`,Q=112,K=56,[q,xe]=b.useState(0),[de,Z]=b.useState(!1),[be,je]=b.useState(!1),ce=b.useRef(0),Ee=b.useRef(0),ze=b.useRef(0),Ge=b.useRef(!1),_e=b.useRef(!1),me=b.useRef(!1);b.useEffect(()=>{s||(xe(0),Z(!1),je(!1))},[s]);const De=b.useCallback(()=>{if(me.current){me.current=!1;return}if(de){xe(0),Z(!1),me.current=!0;return}v()},[v,de]),te=b.useCallback(re=>{if(!s||re.touches.length!==1)return;const pe=re.touches[0];ce.current=pe.clientX,Ee.current=pe.clientY,ze.current=de?Q:0,Ge.current=!1,_e.current=!1,je(!0)},[s,de]),He=b.useCallback(re=>{if(!s||!be||re.touches.length!==1)return;const pe=re.touches[0],Ve=pe.clientX-ce.current,at=pe.clientY-Ee.current;if(!Ge.current){if(Math.abs(Ve)<8&&Math.abs(at)<8)return;Ge.current=!0,_e.current=Math.abs(Ve)>Math.abs(at)}if(!_e.current)return;re.preventDefault();const ut=Math.max(0,Math.min(Q,ze.current-Ve));xe(ut)},[s,be]),ye=b.useCallback(()=>{if(!s||!be)return;if(je(!1),!_e.current){de||xe(0);return}const re=q>=K,pe=re!==de||q!==(re?Q:0);Z(re),xe(re?Q:0),pe&&(me.current=!0)},[s,be,q,de]),Re=b.useCallback(re=>{re.stopPropagation(),S(),Z(!1),xe(0),me.current=!0},[S]);return o.jsxs("div",{className:`aop-agent-swipe${s?" swipe-enabled":""}${de?" revealed":""}`,children:[s&&o.jsxs("button",{type:"button",className:"aop-swipe-clear-action",onClick:Re,title:k("terminal:overview.clearContext",{defaultValue:"Clear context"}),children:["🧹 ",k("terminal:overview.clearContext",{defaultValue:"Clear"})]}),o.jsxs("div",{className:`aop-agent-card ${E?"boss":""} ${e?"active":""} ${t.status} ${a?"unread":""}${r?" two-finger-hover":""}`,"data-agent-id":t.id,draggable:!0,onDragStart:re=>{re.dataTransfer.setData("application/x-agent-id",t.id),re.dataTransfer.effectAllowed="copy",re.currentTarget.style.opacity="0.5"},onDragEnd:re=>{re.currentTarget.style.opacity=""},onClick:De,onTouchStart:te,onTouchMove:He,onTouchEnd:ye,onTouchCancel:ye,style:s?{transform:`translateX(-${q}px)`,transition:be?"none":"transform 0.18s ease"}:void 0,children:[o.jsxs("div",{className:"aop-agent-header",onContextMenu:re=>{re.preventDefault(),re.stopPropagation(),C({x:re.clientX,y:re.clientY})},children:[o.jsx("button",{type:"button",className:"aop-expand-icon","aria-label":n?"Collapse agent":"Expand agent",onClick:re=>{re.stopPropagation(),y()},children:n?"▾":"▸"}),o.jsx("span",{className:"aop-agent-status",title:_,children:D}),t.status==="working"&&o.jsx("span",{className:"aop-working-indicator","aria-label":k("terminal:overview.statusLabels.working"),title:k("terminal:overview.statusLabels.working")}),o.jsx("img",{src:t.provider==="codex"?"/assets/codex.png":t.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:t.provider,className:"aop-provider-icon",title:t.provider==="codex"?"Codex Agent":t.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),o.jsxs("span",{className:"aop-agent-name",title:k("terminal:overview.clickToSwitch"),style:m?{background:`${m.color}12`,borderColor:`${m.color}28`}:void 0,children:[E&&o.jsx("span",{className:"aop-boss-crown","aria-hidden":"true",children:"👑"}),t.name]}),o.jsx("span",{className:"aop-agent-class-icon",style:{color:`color-mix(in srgb, ${j.color} 60%, var(--text-muted))`},title:t.class||"agent",children:j.icon}),a&&o.jsx("span",{className:"aop-pending-read-indicator",title:"Pending read",children:"!"}),T>0&&o.jsx("span",{className:"aop-msg-count",title:k("terminal:overview.messages",{count:T}),children:T}),I.length>0&&o.jsxs("span",{className:"aop-subagent-count",title:I.map(re=>`${re.name}: ${re.description||re.type}`).join(`
|
|
126
|
-
`),children:["⑂",I.length]}),R.length>0&&I.length===0&&o.jsxs("span",{className:"aop-subagent-count",title:k("terminal:overview.subagentsCompleted",{count:R.length}),style:{opacity:.5},children:["⑂",R.length]}),t.class&&o.jsx("span",{className:"aop-agent-class",style:{color:`color-mix(in srgb, ${j.color} 65%, var(--text-muted))`,background:`${j.color}10`,borderColor:`${j.color}25`},children:t.class}),d&&m&&o.jsx("span",{className:"aop-area-chip",style:{background:`${m.color}10`,borderColor:`${m.color}25`,color:`color-mix(in srgb, ${m.color} 65%, var(--text-muted))`},children:m.name})]}),t.taskLabel&&o.jsxs("div",{className:"aop-task-label",title:t.taskLabel,children:[o.jsx("span",{className:"task-prefix",children:"📋"}),o.jsx("span",{className:"task-text",children:xf(t.taskLabel,M)})]}),O&&(n||O.isUserPrompt)&&o.jsxs("div",{className:`aop-last-message ${O.isUserPrompt?"user":"assistant"}`,title:O.text.split(`
|
|
127
|
-
`)[0],children:[o.jsx("span",{className:"lm-prefix",children:O.isUserPrompt?"▶":"◀"}),o.jsx("span",{className:"lm-text",children:xf(O.text,M)}),o.jsx("span",{className:"lm-time",children:cp(O.timestamp)})]}),x&&o.jsxs("div",{className:`aop-match-context aop-match-context--${x.type}`,title:x.text,children:[o.jsx("span",{className:"match-icon",children:x.type==="history"?"📜":x.type==="file"?"📄":"💬"}),o.jsx("span",{className:"match-label",children:x.type==="history"?"history":x.type==="file"?"file":"task"}),o.jsx("span",{className:"match-text",children:xf(x.text,M)})]}),n&&o.jsxs("div",{className:"aop-agent-body",children:[z&&o.jsxs("div",{className:"aop-subagents",children:[o.jsx("div",{className:"aop-section-label",children:k("terminal:overview.subagents",{count:R.length})}),R.map(re=>o.jsxs("div",{className:`aop-subagent-item ${re.status}`,children:[o.jsx("span",{className:"sub-icon",children:re.status==="completed"?"✅":re.status==="failed"?"❌":re.status==="unknown"?"⬜":"⑂"}),o.jsx("span",{className:"sub-name",children:re.name}),o.jsx("span",{className:"sub-type",children:re.type}),re.description&&o.jsx("span",{className:"sub-desc",title:re.description,children:xf(re.description,s?30:50)})]},re.id))]}),W&&o.jsxs("div",{className:"aop-tool-timeline",children:[o.jsx("div",{className:"aop-section-label",children:k("terminal:overview.recentActivity")}),P.map((re,pe)=>{var at,ut;const Ve=re.toolInput&&(re.toolInput.file_path||((at=re.toolInput.command)==null?void 0:at.slice(0,40))||re.toolInput.pattern||re.toolInput.description||((ut=re.toolInput.prompt)==null?void 0:ut.slice(0,50)))||"";return o.jsxs("div",{className:"aop-timeline-entry",children:[o.jsx("span",{className:"tl-time",children:cp(re.timestamp)}),o.jsx("span",{className:"tl-icon",children:os[re.toolName]||os.default}),o.jsx("span",{className:"tl-tool",children:re.toolName}),Ve&&o.jsx("span",{className:"tl-param",children:Ve})]},`${re.timestamp}-${pe}`)})]}),!$&&(i||c)&&o.jsx("div",{className:"aop-no-activity",children:k("terminal:overview.noToolActivity")})]}),t.contextLimit>0&&o.jsx("div",{className:"aop-context-bar",title:`${Math.round(F*100)}% context used (${Math.round(t.contextUsed/1e3)}k / ${Math.round(t.contextLimit/1e3)}k)`,children:o.jsx("div",{className:"aop-context-fill",style:{width:`${H}%`,backgroundColor:B}})})]})]})}function f5(t){if("type"in t&&"content"in t){const n=t;let s=n.content||"";return n._bashOutput&&(s+=" "+n._bashOutput),n._bashCommand&&(s+=" "+n._bashCommand),n.toolName&&(s+=" "+n.toolName),s}return t.text||""}function p5(t,e){if(e==="advanced")return!0;if("type"in t&&"content"in t){const a=t,r=a.content||"";return!(a.type==="user"&&(r.includes("<command-name>/cost</command-name>")||r.includes("<command-name>/compact</command-name>"))||a.type==="tool_result")}const n=t;if(e==="chat"){if(n.isUserPrompt)return!0;const a=n.text||"";return!(a.startsWith("Using tool:")||a.startsWith("Tool result:")||a.startsWith("Tool error:"))}return!(n.text||"").startsWith("Tool result:")}function h5({selectedAgentId:t,isOpen:e,allItems:n,viewMode:s,hasMoreHistory:a,loadAllHistory:r,loadingMore:i}){const[c,d]=b.useState(!1),[f,h]=b.useState(""),[m,x]=b.useState(0),[y,v]=b.useState(null),[S,C]=b.useState(!1),k=b.useRef(null),N=b.useRef(!1);b.useEffect(()=>{if(!c){N.current=!1;return}if(!a){C(!1);return}i||N.current||(N.current=!0,C(!0),r().finally(()=>{C(!1)}))},[c,a,i,r]);const j=b.useMemo(()=>{if(!f.trim()||f.trim().length<2)return[];const T=f.trim().toLowerCase(),M=[];for(let R=0;R<n.length;R++)f5(n[R]).toLowerCase().includes(T)&&p5(n[R],s)&&M.push(R);return M},[n,f,s]);b.useEffect(()=>{if(j.length>0){const T=j.length-1;x(T),v(j[T])}else x(0),v(null)},[j]),b.useEffect(()=>{c&&k.current&&requestAnimationFrame(()=>{var T;(T=k.current)==null||T.focus()})},[c]);const E=b.useCallback(()=>{if(j.length===0)return;const T=(m+1)%j.length;x(T),v(j[T])},[m,j]),D=b.useCallback(()=>{if(j.length===0)return;const T=(m-1+j.length)%j.length;x(T),v(j[T])},[m,j]),_=b.useCallback(()=>{d(T=>(T&&(h(""),x(0),v(null),C(!1)),!T))},[]),P=b.useCallback(()=>{d(!1),h(""),x(0),v(null),C(!1)},[]);b.useEffect(()=>{c&&(h(""),x(0),v(null))},[t]),b.useEffect(()=>{const T=M=>{var R;(M.ctrlKey||M.metaKey)&&M.key==="f"&&e&&(M.preventDefault(),c?(R=k.current)==null||R.focus():d(!0))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,c]);const O=c&&f.trim().length>=2&&j.length>0?f.trim():void 0;return{searchMode:c,searchQuery:f,setSearchQuery:h,searchInputRef:k,toggleSearch:_,closeSearch:P,highlightQuery:O,matchIndices:j,currentMatch:m,navigateNext:E,navigatePrev:D,scrollToIndex:y,loadingFullHistory:S}}const m5=new Map,g5=[];function b5({selectedAgentId:t}){const[e,n]=b.useState(new Map),[s,a]=b.useState(new Map),[r,i]=b.useState(new Map),[c,d]=b.useState(new Map),f=b.useRef(new Map),h=b.useRef(0);b.useEffect(()=>{if(!t||e.has(t))return;const I=va(`${ft.INPUT_TEXT_PREFIX}${t}`);I&&n(W=>new Map(W).set(t,I));const z=va(`${ft.PASTED_TEXTS_PREFIX}${t}`);if(z)try{const W=JSON.parse(z),$=new Map(W);i(H=>new Map(H).set(t,$));const F=Math.max(0,...W.map(([H])=>H));f.current.set(t,F)}catch{}},[t,e]);const m=t&&e.get(t)||"",x=t&&s.get(t)||!1,y=(t?r.get(t):void 0)||m5,v=(t?c.get(t):void 0)||g5,S=m.includes(`
|
|
128
|
-
`),k=typeof window<"u"&&window.innerWidth<=768||x||S||m.length>50,N=b.useCallback(I=>{t&&(n(z=>new Map(z).set(t,I)),I?er(`${ft.INPUT_TEXT_PREFIX}${t}`,I):xk(`${ft.INPUT_TEXT_PREFIX}${t}`))},[t]),j=b.useCallback(I=>{t&&a(z=>new Map(z).set(t,I))},[t]),E=b.useCallback(I=>{t&&i(z=>{const W=new Map(z),$=z.get(t)||new Map,F=typeof I=="function"?I($):I;if(W.set(t,F),F.size>0){const H=JSON.stringify(Array.from(F.entries()));er(`${ft.PASTED_TEXTS_PREFIX}${t}`,H)}else xk(`${ft.PASTED_TEXTS_PREFIX}${t}`);return W})},[t]),D=b.useCallback(I=>{t&&d(z=>{const W=new Map(z),$=z.get(t)||[],F=typeof I=="function"?I($):I;return W.set(t,F),W})},[t]),_=b.useCallback(()=>{if(!t)return 0;const z=(f.current.get(t)||0)+1;return f.current.set(t,z),z},[t]),P=b.useCallback(()=>{t&&f.current.set(t,0)},[t]),O=b.useCallback(I=>{D(z=>z.filter(W=>W.id!==I))},[D]),T=b.useCallback(async(I,z)=>{try{const W=z||(I instanceof File?I.name:""),$=encodeURIComponent(W),F=await Lt(Mt("/api/files/upload"),{method:"POST",headers:{"Content-Type":I.type||"application/octet-stream","X-Filename":$},body:I});if(!F.ok)return console.error("Upload failed:",await F.text()),null;const H=await F.json();return h.current+=1,{id:h.current,name:H.filename,path:H.absolutePath,isImage:H.isImage,size:H.size}}catch(W){return console.error("Upload error:",W),null}},[]),M=b.useCallback(I=>{let z=I;for(const[W,$]of y){const F=new RegExp(`\\[Pasted text #${W} \\+\\d+ lines\\]`,"g");z=z.replace(F,$)}return z},[y]),R=b.useCallback(()=>{const I=(m.match(/\n/g)||[]).length+1,z=Math.ceil(m.length/60),W=Math.max(I,z,2);return Math.min(W,10)},[m]);return b.useMemo(()=>({command:m,setCommand:N,forceTextarea:x,setForceTextarea:j,useTextarea:k,pastedTexts:y,setPastedTexts:E,incrementPastedCount:_,resetPastedCount:P,attachedFiles:v,setAttachedFiles:D,removeAttachedFile:O,uploadFile:T,expandPastedTexts:M,getTextareaRows:R}),[m,N,x,j,k,y,E,_,P,v,D,O,T,M,R])}const Yg=10;function x5({totalMessages:t,isOpen:e,hasModalOpen:n=!1,scrollContainerRef:s,selectedAgentId:a,inputRef:r,textareaRef:i,useTextarea:c=!1}){const[d,f]=b.useState(-1),h=b.useRef(null);b.useEffect(()=>{h.current!==a&&(f(-1),h.current=a)},[a]);const m=b.useCallback(()=>{f(-1)},[]),x=b.useRef(null),y=D=>1-Math.pow(1-D,3),v=b.useCallback((D,_,P=200)=>{x.current&&cancelAnimationFrame(x.current);const O=D.scrollTop,T=_-O,M=performance.now(),R=I=>{const z=I-M,W=Math.min(z/P,1),$=y(W);D.scrollTop=O+T*$,W<1?x.current=requestAnimationFrame(R):x.current=null};x.current=requestAnimationFrame(R)},[]),S=b.useCallback(D=>{if(!s.current)return;const _=s.current,P=_.querySelector(`[data-message-index="${D}"]`);if(P){const O=_.getBoundingClientRect(),T=P.getBoundingClientRect(),M=20;if(T.top<O.top+M){const R=_.scrollTop+(T.top-O.top)-M;v(_,R,180)}else if(T.bottom>O.bottom-M){const R=_.scrollTop+(T.bottom-O.bottom)+M;v(_,R,180)}}},[s,v]);b.useEffect(()=>()=>{x.current&&cancelAnimationFrame(x.current)},[]);const C=b.useCallback(()=>{t!==0&&f(D=>{let _;return D===-1?_=t-1:D>0?_=D-1:_=0,requestAnimationFrame(()=>S(_)),_})},[t,S]),k=b.useCallback(()=>{t!==0&&f(D=>{let _;if(D===-1)_=t-1;else if(D<t-1)_=D+1;else return-1;return requestAnimationFrame(()=>S(_)),_})},[t,S]),N=b.useCallback(()=>{t!==0&&f(D=>{let _;return D===-1?_=t-1:_=Math.max(0,D-Yg),requestAnimationFrame(()=>S(_)),_})},[t,S]),j=b.useCallback(()=>{t!==0&&f(D=>{let _;if(D===-1)_=t-1;else{if(D+Yg>=t)return-1;_=D+Yg}return requestAnimationFrame(()=>S(_)),_})},[t,S]),E=b.useCallback(D=>d===D,[d]);return b.useEffect(()=>{const D=_=>{if(!e||n)return;const P=U.getShortcuts(),O=P.find($=>$.id==="prev-message"),T=P.find($=>$.id==="next-message"),M=P.find($=>$.id==="page-up-messages"),R=P.find($=>$.id==="page-down-messages"),I=P.find($=>$.id==="activate-message");if(kn(_,O)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),C();return}if(kn(_,T)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),k();return}if(kn(_,M)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),N();return}if(kn(_,R)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),j();return}if(_.key==="Escape"&&d!==-1){_.preventDefault(),m();return}const z=_.target,W=z.tagName==="INPUT"||z.tagName==="TEXTAREA"||z.isContentEditable;if(kn(_,I)&&d!==-1&&!W){_.preventDefault();const $=s.current;if(!$)return;const F=$.querySelector(`[data-message-index="${d}"]`);if(!F)return;const H=[".clickable-path",".output-tool-use.bash-clickable",".clickable-bash",".history-view-md-btn"];for(const G of H){const B=F.querySelector(G);if(B){B.click();return}}const V=F.querySelector(".output-tool-use");V!=null&&V.classList.contains("bash-clickable")&&V.click();return}if(d!==-1&&!W){const $=kn(_,O)||kn(_,T)||kn(_,M)||kn(_,R),F=["Escape","Tab","Shift","Control","Alt","Meta","CapsLock"].includes(_.key),H=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(_.key),V=_.key.startsWith("F")&&_.key.length<=3;if(!$&&!F&&!H&&!V&&!_.ctrlKey&&!_.metaKey){const G=c?i==null?void 0:i.current:r==null?void 0:r.current;if(G){G.focus(),f(-1);return}}}};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,n,C,k,N,j,m,d,r,i,c]),b.useEffect(()=>{d>=t&&t>0?f(t-1):t===0&&f(-1)},[t,d]),{selectedIndex:d,setSelectedIndex:f,clearSelection:m,navigatePrev:C,navigateNext:k,navigatePageUp:N,navigatePageDown:j,isSelected:E}}const yA=300;function y5(t){if(!t)return!1;if(t.startsWith("Using tool:"))return!0;if(t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Bash output:")||t.startsWith("Tokens:")||t.startsWith("Cost:"))return!1;if(t.startsWith("[thinking]"))return!0;if(t.startsWith("[raw]")||t.startsWith("Session started:")||t.startsWith("Session initialized"))return!1;const e=t.trim();return!(e.startsWith("{")&&['"file_path"','"command"','"pattern"','"path"','"content"','"old_string"','"new_string"','"query"','"url"','"prompt"','"notebook_path"','"description"','"offset"','"limit"'].some(s=>e.includes(s)))}function v5(t){if(!t||t.startsWith("Using tool:")||t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Tokens:")||t.startsWith("Cost:")||t.startsWith("[thinking]")||t.startsWith("[raw]")||t.startsWith("Session started:")||t.startsWith("Session initialized"))return!1;const e=t.trim();return!(e.startsWith("{")&&['"file_path"','"command"','"pattern"','"path"','"content"','"old_string"','"new_string"','"query"','"url"','"prompt"','"notebook_path"','"description"','"offset"','"limit"'].some(a=>e.includes(a))||[/^(let me|i'll|i will|now i|first,? i|i need to|i should|i'm going to)/i,/^(looking at|reading|checking|searching|exploring|examining|investigating)/i,/^(based on|from what|according to|it (looks|seems|appears))/i,/^(this (shows|indicates|suggests|means|is))/i,/^(the (code|file|function|class|component|implementation))/i,/^(now (let|i))/i].some(s=>s.test(e)))}function dT({outputs:t,viewMode:e}){return b.useMemo(()=>{if(e==="advanced")return t;if(e==="chat")return t.filter(s=>s.isUserPrompt?!0:s.text?v5(s.text):!1);const n=[];for(let s=0;s<t.length;s++){const a=t[s];if(a.isUserPrompt){n.push(a);continue}if(!a.text){n.push(a);continue}if(a.text.startsWith("Using tool:")){const r=a.text.replace("Using tool:","").trim();let i=null,c,d,f,h;for(let x=s+1;x<t.length&&x<=s+20;x++){const y=t[x];if(y.text.startsWith("Tool input:")){const v=y.text.replace("Tool input:","").trim();if(i=sT(r,v),r==="Edit")try{const S=JSON.parse(v);(S.old_string!==void 0||S.new_string!==void 0||S.unified_diff!==void 0)&&(c={oldString:S.old_string||"",newString:S.new_string||"",operation:typeof S.operation=="string"?S.operation:void 0,unifiedDiff:typeof S.unified_diff=="string"?S.unified_diff:void 0})}catch{}if(r==="TodoWrite")try{const S=JSON.parse(v);Array.isArray(S.todos)&&(d=v)}catch{}if(r==="Bash")try{const S=JSON.parse(v);S.command&&(h=S.command)}catch{}}if(r==="Bash"&&y.text.startsWith("Bash output:")&&(f=y.text.replace("Bash output:","").trim()),y.text.startsWith("Using tool:"))break}r==="Bash"&&i&&i.length>yA&&(i=i.substring(0,yA-3)+"...");const m=r==="Bash"&&!f;n.push({...a,_toolKeyParam:i||void 0,_editData:c,_todoInput:d,_bashOutput:f,_bashCommand:h,_isRunning:m});continue}y5(a.text)&&n.push(a)}return n},[t,e])}function fT({outputs:t,viewMode:e}){const n=b.useRef(0),s=b.useRef(0),a=dT({outputs:t,viewMode:e});if(t.length!==n.current||a.length!==s.current){const r=t.length>0?t[t.length-1]:null,i=r!=null&&r.text?r.text.slice(0,40):null;bu.info(`Filter: in=${t.length} out=${a.length} mode=${e}`,{inputLen:t.length,outputLen:a.length,viewMode:e,lastInput:i},"useFilteredOutputs"),n.current=t.length,s.current=a.length}return a}function w5(t){const e=t.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F]+\s*/u,"").trim();if(!e)return null;const n=U.getState().agents;for(const[s,a]of n)if(a.name===e)return s;return null}function fu(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(fu).join(""):Ce.isValidElement(t)?fu(t.props.children):""}const k5=/\.(com|org|net|io|dev|app|co|me|info|biz|us|uk|de|fr|jp|cn|ru|edu|gov|mil|int|xyz|tech|online|site|store|blog|cloud|ai|gg|tv|cc|sh|fm|to|ly|gl|so|is|it|at|nl|ch|se|no|fi|dk|be|cz|pl|pt|br|mx|ar|cl|in|au|nz|za|sg|hk|tw|kr|id|ph|th|vn|my)$/i;function Jx(t){const e=t.split("/")[0].split("?")[0].split("#")[0];return k5.test(e)}function S5(t){return!t||t.startsWith("#")||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t)||Jx(t)?!1:t.includes(".")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")}function C5(t){if(!t||t.includes(`
|
|
129
|
-
`))return!1;const e=t.trim();return!e||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||Jx(e)?!1:e.includes(".")&&(e.includes("/")||/^[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+$/.test(e))}const Pu=({onFileClick:t}={})=>({h1:({children:e})=>o.jsx("h1",{style:{fontSize:"1.4em",color:"var(--accent-pink)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h2:({children:e})=>o.jsx("h2",{style:{fontSize:"1.25em",color:"var(--accent-purple)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h3:({children:e})=>o.jsx("h3",{style:{fontSize:"1.15em",color:"var(--accent-cyan)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h4:({children:e})=>o.jsx("h4",{style:{fontSize:"1.1em",color:"var(--accent-green)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h5:({children:e})=>o.jsx("h5",{style:{fontSize:"1.05em",color:"var(--accent-yellow)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h6:({children:e})=>o.jsx("h6",{style:{fontSize:"1em",color:"var(--accent-orange)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),p:({children:e})=>o.jsx("p",{style:{margin:"0.4em 0"},children:e}),strong:({children:e})=>{const n=fu(e),s=w5(n);return s?o.jsx("strong",{className:"clickable-agent-name",style:{color:"var(--accent-orange)",fontWeight:600,cursor:"pointer"},onClick:a=>{a.stopPropagation(),U.selectAgent(s),U.setTerminalOpen(!0)},children:e}):o.jsx("strong",{style:{color:"var(--accent-orange)",fontWeight:600},children:e})},em:({children:e})=>o.jsx("em",{style:{color:"var(--accent-yellow)",fontStyle:"italic"},children:e}),del:({children:e})=>o.jsx("del",{style:{color:"var(--accent-red)",textDecoration:"line-through"},children:e}),code:({children:e,className:n})=>{if(n==null?void 0:n.includes("language-")){const a=(n==null?void 0:n.replace("language-",""))??"",r=fu(e);if(a&&$4(a)){const i=mo(r,a);return o.jsx("code",{className:n,style:{background:"none",padding:0,fontSize:"12px",lineHeight:1.5},dangerouslySetInnerHTML:{__html:i}})}return o.jsx("code",{style:{background:"none",padding:0,color:"var(--text-primary)",fontSize:"12px",lineHeight:1.5},children:e})}return o.jsx("code",{style:{background:"color-mix(in srgb, var(--bg-tertiary) 80%, transparent)",color:"var(--accent-green)",padding:"0.15em 0.4em",borderRadius:"3px",fontSize:"0.9em"},children:e})},pre:({children:e})=>o.jsx("pre",{style:{background:"color-mix(in srgb, var(--bg-primary) 90%, transparent)",border:"1px solid var(--border-color)",borderRadius:"6px",padding:"12px",margin:"0.6em 0",overflowX:"auto"},children:e}),ul:({children:e})=>o.jsx("ul",{style:{margin:"0.5em 0",paddingLeft:"1.5em",lineHeight:1.5},children:e}),ol:({children:e})=>o.jsx("ol",{style:{margin:"0.5em 0",paddingLeft:"1.5em",lineHeight:1.5},children:e}),li:({children:e})=>o.jsx("li",{style:{margin:"0.2em 0",paddingLeft:"0.3em"},children:e}),blockquote:({children:e})=>o.jsx("blockquote",{style:{borderLeft:"3px solid var(--accent-purple)",margin:"0.5em 0",padding:"0.5em 1em",background:"color-mix(in srgb, var(--accent-purple) 10%, transparent)",borderRadius:"0 4px 4px 0"},children:e}),a:({children:e,href:n})=>{const s=typeof n=="string"?n.trim():"",a=J6(s),r=fu(e).trim(),i=a||(s&&S5(s)?s:null)||((!s||s==="#")&&C5(r)?r:null);if(i&&t)return o.jsx("a",{href:"#",onClick:d=>{d.preventDefault(),d.stopPropagation(),t(i)},className:"clickable-path",title:`Open ${i}`,children:e});if(!s)return o.jsx("span",{children:e});const c=!s.includes("://")&&Jx(s)?`https://${s}`:s;return o.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-cyan)",textDecoration:"underline"},children:e})},hr:()=>o.jsx("hr",{style:{border:"none",borderTop:"1px solid var(--border-color)",margin:"1em 0"}}),table:({children:e})=>o.jsx("table",{style:{width:"100%",borderCollapse:"collapse",margin:"0.6em 0",fontSize:"12px"},children:e}),th:({children:e})=>o.jsx("th",{style:{border:"1px solid var(--border-color)",padding:"6px 10px",textAlign:"left",background:"color-mix(in srgb, var(--bg-tertiary) 80%, transparent)",fontWeight:600,color:"var(--accent-pink)"},children:e}),td:({children:e})=>o.jsx("td",{style:{border:"1px solid var(--border-color)",padding:"6px 10px",textAlign:"left",background:"color-mix(in srgb, var(--bg-secondary) 50%, transparent)"},children:e}),input:({checked:e,type:n})=>n==="checkbox"?o.jsx("input",{type:"checkbox",checked:e,readOnly:!0,style:{marginRight:"0.5em",accentColor:"var(--accent-green)"}}):null});Pu();function Zx(t){const e=t.trimStart();if(!e.startsWith(Cb))return{hasContext:!1,context:null,userMessage:t};const n=e.lastIndexOf(Zk);if(n===-1)return{hasContext:!1,context:null,userMessage:t};const s=e.slice(Cb.length,n).trim(),a=e.slice(n+Zk.length).trim();return{hasContext:!0,context:s,userMessage:a}}function ey(t){const e=t.replace(/\r\n/g,`
|
|
130
|
-
`).trim(),n="Follow all instructions below for this task.",s="## User Request",a=e.lastIndexOf(s);if(a!==-1){const h=e.slice(0,a).trim(),m=e.slice(a+s.length).trim();if(m)return{hasInstructions:h.length>0,instructions:h.length>0?h:null,userMessage:m}}let r=e;const i=[],c=[/^(?:You)?# AGENTS\.md instructions[^\n]*\n[\s\S]*?<\/INSTRUCTIONS>\s*/i,/^(?:You)?<environment_context>\s*[\s\S]*?<\/environment_context>\s*/i,/^(?:You)?Follow all instructions below for this task\.\s*/i];let d=!1,f=!0;for(;f;){f=!1;for(const h of c){const m=r.match(h);if(m){i.push(m[0].trim()),r=r.slice(m[0].length).trimStart(),d=!0,f=!0;break}}}return d&&r?{hasInstructions:!0,instructions:i.join(`
|
|
131
|
-
|
|
132
|
-
`),userMessage:r.trim()}:e.includes(n)?{hasInstructions:!1,instructions:null,userMessage:t}:{hasInstructions:!1,instructions:null,userMessage:t}}function pT(t){const e=t.match(/^\[DELEGATED TASK from boss "([^"]+)" \(([^)]+)\)\]\s*\n\n([\s\S]*?)\n\n---\nThis task was delegated by your boss agent\./);return e?{isDelegatedTask:!0,bossName:e[1],bossId:e[2],taskCommand:e[3].trim()}:{isDelegatedTask:!1,bossName:"",bossId:"",taskCommand:""}}function hT(t){const e=t.match(/^\[TASK REPORT from ([^(]+?)\s*\(([^)]+)\)\]\s*\n\nStatus:\s*(\w+)\nOriginal task:\s*([\s\S]*?)\n(?:\nSummary:\s*([\s\S]*?))?\n\nYou may review/);return e?{isTaskReport:!0,agentName:e[1].trim(),agentId:e[2].trim(),status:e[3].trim(),originalTask:e[4].trim(),summary:(e[5]||"").trim()}:{isTaskReport:!1,agentName:"",agentId:"",status:"",originalTask:"",summary:""}}function mT(t){const e=t.match(/<subagent_notification>\s*([\s\S]*?)\s*<\/subagent_notification>/);if(!e)return{hasNotification:!1,agentId:"",status:{},contentWithoutNotification:t};try{const n=JSON.parse(e[1].trim()),s=n.agent_id||"",a={};if(n.status&&typeof n.status=="object")for(const[i,c]of Object.entries(n.status))a[i]=typeof c=="string"?c:JSON.stringify(c);const r=t.replace(/<subagent_notification>\s*[\s\S]*?<\/subagent_notification>\s*/g,"").trim();return{hasNotification:!0,agentId:s,status:a,contentWithoutNotification:r}}catch{return{hasNotification:!1,agentId:"",status:{},contentWithoutNotification:t}}}function gT(t){const e=t.match(/```delegation\s*\n([\s\S]*?)\n```/);if(!e)return{hasDelegation:!1,delegations:[],contentWithoutBlock:t};try{const n=JSON.parse(e[1].trim()),a=(Array.isArray(n)?n:[n]).map(i=>({selectedAgentId:i.selectedAgentId||"",selectedAgentName:i.selectedAgentName||"Unknown",taskCommand:i.taskCommand||"",reasoning:i.reasoning||"",alternativeAgents:i.alternativeAgents||[],confidence:i.confidence||"medium"})),r=t.replace(/```delegation\s*\n[\s\S]*?\n```/,"").trim();return{hasDelegation:!0,delegations:a,contentWithoutBlock:r}}catch{return{hasDelegation:!1,delegations:[],contentWithoutBlock:t}}}function bT(t){const e=t.match(/```work-plan\s*\n([\s\S]*?)\n```/);if(!e)return{hasWorkPlan:!1,workPlan:null,contentWithoutBlock:t};try{const n=JSON.parse(e[1].trim()),s={name:n.name||"Unnamed Plan",description:n.description||"",phases:(n.phases||[]).map(r=>({id:r.id||"",name:r.name||"",execution:r.execution||"sequential",dependsOn:r.dependsOn||[],tasks:(r.tasks||[]).map(i=>({id:i.id||"",description:i.description||"",suggestedClass:i.suggestedClass||"builder",assignToAgent:i.assignToAgent||null,assignToAgentName:i.assignToAgentName||null,priority:i.priority||"medium",blockedBy:i.blockedBy||[]}))}))},a=t.replace(/```work-plan\s*\n[\s\S]*?\n```/,"").trim();return{hasWorkPlan:!0,workPlan:s,contentWithoutBlock:a}}catch{return{hasWorkPlan:!1,workPlan:null,contentWithoutBlock:t}}}function dp({context:t,defaultCollapsed:e=!0,onFileClick:n}){const{t:s}=pt(["tools"]),[a,r]=b.useState(e),i=Pu({onFileClick:n}),c=t.match(/# YOUR TEAM \((\d+) agents?\)/),d=c?parseInt(c[1],10):0;return o.jsxs("div",{className:`boss-context ${a?"collapsed":"expanded"}`,children:[o.jsxs("div",{className:"boss-context-header",onClick:()=>r(!a),children:[o.jsx("span",{className:"boss-context-icon",children:"👑"}),o.jsx("span",{className:"boss-context-label",children:s("tools:bossContext.teamContext",{count:d})}),o.jsx("span",{className:"boss-context-toggle",children:a?"▶":"▼"})]}),!a&&o.jsx("div",{className:"boss-context-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:i,children:t})})]})}function xT({delegation:t}){const{t:e}=pt(["tools"]),n={high:"#22c55e",medium:"#f59e0b",low:"#ef4444"},s={high:"✅",medium:"⚠️",low:"❓"};return o.jsxs("div",{className:"delegation-block",children:[o.jsxs("div",{className:"delegation-header",children:[o.jsx("span",{className:"delegation-icon",children:"📨"}),o.jsx("span",{className:"delegation-title",children:e("tools:delegation.taskDelegated")}),o.jsxs("span",{className:"delegation-confidence",style:{color:n[t.confidence]},children:[s[t.confidence]," ",t.confidence]})]}),o.jsxs("div",{className:"delegation-details",children:[o.jsxs("div",{className:"delegation-target",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.to")}),o.jsx("span",{className:"delegation-agent-name clickable-agent-name",onClick:()=>{U.selectAgent(t.selectedAgentId),U.setTerminalOpen(!0)},children:t.selectedAgentName})]}),t.taskCommand&&o.jsxs("div",{className:"delegation-task-command",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.task")}),o.jsx("span",{className:"delegation-command-text",children:t.taskCommand})]}),t.reasoning&&o.jsxs("div",{className:"delegation-reasoning",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.why")}),o.jsx("span",{className:"delegation-reason-text",children:t.reasoning})]}),t.alternativeAgents.length>0&&o.jsxs("div",{className:"delegation-alternatives",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.alternatives")}),o.jsx("span",{className:"delegation-alt-list",children:t.alternativeAgents.map((a,r)=>o.jsxs("span",{className:"delegation-alt-agent",children:[a.name,a.reason?` (${a.reason})`:""]},a.id||r))})]})]}),o.jsx("div",{className:"delegation-footer",children:o.jsxs("span",{className:"delegation-auto-forward",children:["↗️ ",e("tools:delegation.autoForwarding",{name:t.selectedAgentName})]})})]})}function A5({bossName:t,taskCommand:e}){const{t:n}=pt(["tools"]),[s,a]=b.useState(!1),r=e.length>60?e.slice(0,60)+"...":e;return o.jsxs("div",{className:`delegated-task-header ${s?"expanded":"compact"}`,children:[o.jsxs("div",{className:"delegated-task-badge",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegated-task-icon",children:"👑"}),o.jsxs("span",{className:"delegated-task-label",children:[n("tools:delegation.via")," ",o.jsx("strong",{children:t})]}),o.jsx("span",{className:"delegated-task-toggle",children:s?"▼":"▶"})]}),s&&o.jsx("div",{className:"delegated-task-command",children:e}),!s&&o.jsx("div",{className:"delegated-task-preview",children:r})]})}function yT({bossName:t,bossId:e,taskCommand:n}){const[s,a]=b.useState(!0),r=n.length>80?n.slice(0,80)+"...":n;return o.jsxs("div",{className:`delegated-task-message ${s?"expanded":"compact"}`,children:[o.jsxs("div",{className:"delegated-task-message-badge",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegated-task-message-icon",children:"📋"}),o.jsxs("span",{className:"delegated-task-message-label",children:["Delegated by ",o.jsx("strong",{className:"clickable-agent-name",onClick:i=>{i.stopPropagation(),U.selectAgent(e),U.setTerminalOpen(!0)},children:t})]}),o.jsx("span",{className:"delegated-task-message-id",children:e.slice(0,8)}),o.jsx("span",{className:"delegated-task-message-toggle",children:s?"▼":"▶"})]}),s?o.jsx("div",{className:"delegated-task-message-command",children:n}):o.jsx("div",{className:"delegated-task-message-preview",children:r})]})}function vT({agentName:t,agentId:e,status:n,originalTask:s,summary:a}){const[r,i]=b.useState(!1),c=n==="COMPLETED";return o.jsxs("div",{className:`task-report-header ${r?"expanded":"compact"} status-${c?"completed":"failed"}`,children:[o.jsxs("div",{className:"task-report-badge",onClick:()=>i(!r),children:[o.jsx("span",{className:"task-report-icon",children:c?"✅":"❌"}),o.jsxs("span",{className:"task-report-label",children:[o.jsx("strong",{className:"clickable-agent-name",onClick:d=>{d.stopPropagation(),U.selectAgent(e),U.setTerminalOpen(!0)},children:t})," — Task ",c?"Completed":"Failed"]}),o.jsx("span",{className:"task-report-id",children:e.slice(0,8)}),o.jsx("span",{className:"task-report-toggle",children:r?"▼":"▶"})]}),a&&o.jsx("div",{className:"task-report-summary",children:a}),r&&o.jsx("div",{className:"task-report-details",children:o.jsxs("div",{className:"task-report-original-task",children:[o.jsx("span",{className:"task-report-detail-label",children:"Original task:"}),o.jsx("span",{className:"task-report-detail-value",children:s})]})})]})}function wT({agentId:t,status:e}){const n=Object.entries(e),s=n.some(([d])=>d==="errored"||d==="error"||d==="failed"),a=n.some(([d])=>d==="completed"),r=t.slice(-12),i=n.map(([,d])=>d).join("; "),c=i.replace(/Visit https?:\/\/[^\s]+/g,"").replace(/\s+/g," ").trim();return o.jsxs("div",{className:`subagent-notification ${s?"subagent-notification--error":a?"subagent-notification--completed":"subagent-notification--info"}`,children:[o.jsx("span",{className:"subagent-notification__icon",children:s?"⚠":a?"✓":"🧬"}),o.jsx("span",{className:"subagent-notification__label",children:"Subagent"}),o.jsx("span",{className:"subagent-notification__id",children:r}),o.jsx("span",{className:"subagent-notification__status",children:n.map(([d])=>d).join(", ")}),c&&o.jsx("span",{className:"subagent-notification__message",title:i,children:c})]})}const j5={high:"🔴",medium:"🟡",low:"🟢"},N5={scout:"🔍",builder:"🔨",debugger:"🐛",architect:"📐",warrior:"⚔️",support:"🛡️"};function kT({workPlan:t}){const{t:e}=pt(["tools"]),[n,s]=b.useState(new Set(t.phases.map(i=>i.id))),a=i=>{s(c=>{const d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d})},r=t.phases.reduce((i,c)=>i+c.tasks.length,0);return o.jsxs("div",{className:"work-plan-block",children:[o.jsxs("div",{className:"work-plan-header",children:[o.jsx("span",{className:"work-plan-icon",children:"📋"}),o.jsx("span",{className:"work-plan-title",children:t.name}),o.jsxs("span",{className:"work-plan-stats",children:[e("tools:workPlan.phases",{count:t.phases.length})," · ",e("tools:workPlan.tasks",{count:r})]})]}),t.description&&o.jsx("div",{className:"work-plan-description",children:t.description}),o.jsx("div",{className:"work-plan-phases",children:t.phases.map((i,c)=>o.jsxs("div",{className:`work-plan-phase ${n.has(i.id)?"expanded":"collapsed"}`,children:[o.jsxs("div",{className:"work-plan-phase-header",onClick:()=>a(i.id),children:[o.jsx("span",{className:"work-plan-phase-number",children:c+1}),o.jsx("span",{className:"work-plan-phase-name",children:i.name}),o.jsx("span",{className:`work-plan-phase-execution ${i.execution}`,children:i.execution==="parallel"?`⚡ ${e("tools:workPlan.parallel")}`:`→ ${e("tools:workPlan.sequential")}`}),i.dependsOn.length>0&&o.jsxs("span",{className:"work-plan-phase-depends",children:[e("tools:workPlan.dependsOn")," ",i.dependsOn.join(", ")]}),o.jsx("span",{className:"work-plan-phase-toggle",children:n.has(i.id)?"▼":"▶"})]}),n.has(i.id)&&o.jsx("div",{className:"work-plan-tasks",children:i.tasks.map(d=>o.jsxs("div",{className:`work-plan-task priority-${d.priority}`,children:[o.jsxs("div",{className:"work-plan-task-header",children:[o.jsx("span",{className:"work-plan-task-id",children:d.id}),o.jsx("span",{className:"work-plan-task-priority",title:`Priority: ${d.priority}`,children:j5[d.priority]}),o.jsxs("span",{className:"work-plan-task-class",title:`Suggested: ${d.suggestedClass}`,children:[N5[d.suggestedClass]||"👤"," ",d.suggestedClass]})]}),o.jsx("div",{className:"work-plan-task-description",children:d.description}),o.jsxs("div",{className:"work-plan-task-assignment",children:[o.jsx("span",{className:"work-plan-task-assignment-label",children:e("tools:workPlan.assignedTo")}),o.jsx("span",{className:`work-plan-task-agent ${d.assignToAgentName?"assigned":"auto"}`,children:d.assignToAgentName||e("tools:workPlan.autoAssign")})]}),d.blockedBy.length>0&&o.jsxs("div",{className:"work-plan-task-blocked",children:["⏳ ",e("tools:workPlan.blockedBy")," ",d.blockedBy.join(", ")]})]},d.id))})]},i.id))}),o.jsx("div",{className:"work-plan-footer",children:o.jsxs("span",{className:"work-plan-approval-hint",children:["💡 ",e("tools:workPlan.reviewHint")]})})]})}function T5({request:t,onApprove:e,onDeny:n}){const{t:s}=pt(["tools"]),a=os[t.tool]||os.default,r=c=>t.tool==="Bash"&&c.command?String(c.command):(t.tool==="Write"||t.tool==="Edit"||t.tool==="Read")&&c.file_path?String(c.file_path):t.tool==="WebFetch"&&c.url?String(c.url):t.tool,i=()=>{if(t.tool==="Write"||t.tool==="Edit"){const d=String(t.toolInput.file_path||"").split("/").slice(0,-1).join("/");return s("tools:permission.rememberAllowDir",{dir:d})}if(t.tool==="Bash"){const d=String(t.toolInput.command||"").split(/\s+/)[0];return s("tools:permission.rememberAllowCmd",{cmd:d})}return s("tools:permission.rememberAllowTool",{tool:t.tool})};return t.status!=="pending"?null:o.jsxs("div",{className:"permission-inline",children:[o.jsx("span",{className:"permission-inline-icon",children:a}),o.jsx("span",{className:"permission-inline-tool",children:t.tool}),o.jsx("span",{className:"permission-inline-target",children:r(t.toolInput)}),o.jsx("button",{className:"permission-inline-btn approve-remember",onClick:()=>e(!0),title:i(),children:"✓+"}),o.jsx("button",{className:"permission-inline-btn approve",onClick:()=>e(!1),title:s("tools:permission.approveOnce"),children:"✓"}),o.jsx("button",{className:"permission-inline-btn deny",onClick:n,title:s("tools:permission.deny"),children:"✕"})]})}function ll(t,e){return e?t.split(new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi")).map((s,a)=>s.toLowerCase()===e.toLowerCase()?o.jsx("mark",{className:"search-highlight",children:s},a):s):t}function ty(t){const e=Sa();if(t.startsWith("http"))return t;if(t.startsWith("/uploads/"))return`${e}${t}`;if(t.includes("tide-commander-uploads")){const n=t.split("/").pop()||"image";return`${e}/uploads/${n}`}else return t}function ST(t){var s;const e=((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"",n={pdf:"file_type_pdf.svg",doc:"file_type_word.svg",docx:"file_type_word.svg",xls:"file_type_excel.svg",xlsx:"file_type_excel.svg",ppt:"file_type_powerpoint.svg",pptx:"file_type_powerpoint.svg",txt:"file_type_text.svg",md:"file_type_markdown.svg",js:"file_type_javascript_official.svg",jsx:"file_type_javascript_official.svg",ts:"file_type_typescript_official.svg",tsx:"file_type_typescript_official.svg",py:"file_type_python.svg",java:"file_type_java.svg",cpp:"file_type_cpp.svg",c:"file_type_cpp.svg",h:"file_type_cpp.svg",hpp:"file_type_cpp.svg",cs:"file_type_csharp.svg",go:"file_type_go.svg",rs:"file_type_rust.svg",php:"file_type_php.svg",rb:"file_type_ruby.svg",swift:"file_type_swift.svg",kt:"file_type_kotlin.svg",scala:"file_type_scala.svg",r:"file_type_r.svg",html:"file_type_html.svg",htm:"file_type_html.svg",css:"file_type_css.svg",scss:"file_type_scss.svg",sass:"file_type_sass.svg",less:"file_type_less.svg",json:"file_type_json_official.svg",yaml:"file_type_yaml_official.svg",yml:"file_type_yaml_official.svg",xml:"file_type_xml.svg",toml:"file_type_toml.svg",ini:"file_type_ini.svg",env:"file_type_dotenv.svg",sh:"file_type_shell.svg",bash:"file_type_shell.svg",zsh:"file_type_shell.svg",fish:"file_type_shell.svg",png:"file_type_image.svg",jpg:"file_type_image.svg",jpeg:"file_type_image.svg",gif:"file_type_image.svg",svg:"file_type_image.svg",webp:"file_type_image.svg",zip:"file_type_zip.svg",tar:"file_type_tar.svg",gz:"file_type_gzip.svg",rar:"file_type_rar.svg","7z":"file_type_zip.svg",mp3:"file_type_audio.svg",mp4:"file_type_video.svg",wav:"file_type_audio.svg",mov:"file_type_video.svg",mkv:"file_type_video.svg",flv:"file_type_video.svg",avi:"file_type_video.svg",default:"default_file.svg"};return n[e]||n.default}function hl(t,e,n){const s=/\[(Image|File):\s*([^\]]+)\]/g,a=[];let r=0,i;const c=Pu({onFileClick:n});for(;(i=s.exec(t))!==null;){if(i.index>r){const m=Df(t.slice(r,i.index));a.push(o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:c,children:m})},`text-${r}`))}const d=i[1]==="Image",f=i[2].trim(),h=f.split("/").pop()||(d?"image":"file");if(d){const m=ty(f);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(m,h),title:En.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:m,alt:h,className:"image-reference-thumb"}),h]},`img-${i.index}`))}else{const m=ST(h);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(f),title:En.t("terminal:content.clickToViewFile",{path:f}),children:[o.jsx("img",{src:`/assets/vscode-icons/${m}`,alt:h,style:{width:"12px",height:"12px",display:"inline",marginRight:"4px"}}),h]},`file-${i.index}`))}r=i.index+i[0].length}if(r<t.length){const d=Df(t.slice(r));a.push(o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:c,children:d})},`text-${r}`))}return a.length===0?o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:c,children:Df(t)})}):o.jsx(o.Fragment,{children:a})}function pu(t,e,n){const s=/\[(Image|File):\s*([^\]]+)\]/g,a=[];let r=0,i;for(;(i=s.exec(t))!==null;){if(i.index>r){const h=t.slice(r,i.index);a.push(o.jsx("span",{className:"user-prompt-text",children:h},`text-${r}`))}const c=i[1]==="Image",d=i[2].trim(),f=d.split("/").pop()||(c?"image":"file");if(c){const h=ty(d);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(h,f),title:En.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:h,alt:f,className:"image-reference-thumb"}),f]},`img-${i.index}`))}else{const h=ST(f);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(d),title:En.t("terminal:content.clickToViewFile",{path:d}),children:[o.jsx("img",{src:`/assets/vscode-icons/${h}`,alt:f,style:{width:"12px",height:"12px",display:"inline",marginRight:"4px"}}),f]},`file-${i.index}`))}r=i.index+i[0].length}if(r<t.length){const c=t.slice(r);a.push(o.jsx("span",{className:"user-prompt-text",children:c},`text-${r}`))}return a.length===0?o.jsx("span",{className:"user-prompt-text",children:t}):o.jsx(o.Fragment,{children:a})}function E5({id:t,lineCount:e,fullText:n,onRemove:s}){const{t:a}=pt(["tools","common"]),[r,i]=b.useState(!1),c=d=>{d.stopPropagation(),i(!0)};return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"pasted-text-chip",onClick:c,title:a("tools:pastedText.clickToView"),children:[o.jsx("span",{className:"pasted-text-chip-icon",children:"📋"}),o.jsx("span",{className:"pasted-text-chip-label",children:a("tools:pastedText.pastedNumber",{id:t})}),o.jsx("span",{className:"pasted-text-chip-count",children:a("tools:pastedText.lineCount",{count:e})}),o.jsx("button",{className:"pasted-text-chip-remove",onClick:d=>{d.stopPropagation(),s()},title:a("common:buttons.remove"),children:"×"})]}),r&&o.jsx(_5,{id:t,lineCount:e,content:n,onClose:()=>i(!1)})]})}function _5({id:t,lineCount:e,content:n,onClose:s}){const{t:a}=pt(["tools","common"]),{handleMouseDown:r,handleClick:i}=wa(s),[c,d]=b.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(n),d(!0),setTimeout(()=>d(!1),2e3)}catch(h){console.error("Failed to copy:",h)}};return o.jsx("div",{className:"modal-overlay visible pasted-text-modal-overlay",onMouseDown:r,onClick:i,children:o.jsxs("div",{className:"modal pasted-text-modal",children:[o.jsxs("div",{className:"pasted-text-modal-header",children:[o.jsxs("div",{className:"pasted-text-modal-title",children:[o.jsx("span",{className:"pasted-text-modal-icon",children:"📋"}),o.jsx("span",{children:a("tools:pastedText.pastedTextTitle",{id:t})}),o.jsx("span",{className:"pasted-text-modal-count",children:a("tools:pastedText.lineCountFull",{count:e})})]}),o.jsxs("div",{className:"pasted-text-modal-actions",children:[o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:f,children:c?`✓ ${a("common:toast.copied")}`:a("common:buttons.copy")}),o.jsx("button",{className:"pasted-text-modal-close",onClick:s,children:"×"})]})]}),o.jsx("div",{className:"pasted-text-modal-body",children:o.jsx("pre",{className:"pasted-text-content",children:n})})]})})}const M5={language:"Spanish",model:"medium"};function CT(t={}){var v;const[e,n]=b.useState(!1),[s,a]=b.useState(!1),[r,i]=b.useState(null),c=b.useRef(null),d=b.useRef([]),f=b.useRef(null),h={...M5,...t},m=b.useCallback(async()=>{i(null);try{if(!window.isSecureContext){console.error("[STT] Not in secure context - microphone requires HTTPS"),i("Microphone requires HTTPS");return}const S=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});f.current=S,d.current=[];const C=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg",""];let k="";for(const E of C)if(!E||MediaRecorder.isTypeSupported(E)){k=E;break}console.log("[STT] Using MIME type:",k||"browser default");const N={};k&&(N.mimeType=k);const j=new MediaRecorder(S,N);j.ondataavailable=E=>{E.data.size>0&&d.current.push(E.data)},c.current=j,j.start(100),n(!0),console.log("[STT] Recording started")}catch(S){console.error("[STT] Failed to start recording:",S),S instanceof Error?S.name==="NotAllowedError"||S.name==="PermissionDeniedError"?i("Microphone permission denied"):S.name==="NotFoundError"||S.name==="DevicesNotFoundError"?i("No microphone found"):S.name==="NotReadableError"||S.name==="TrackStartError"?i("Microphone in use by another app"):S.name==="OverconstrainedError"?i("Microphone constraints not supported"):i(`Microphone error: ${S.message}`):i("Failed to access microphone")}},[]),x=b.useCallback(async()=>!c.current||!e?null:new Promise(S=>{const C=c.current;C.onstop=async()=>{var j,E;f.current&&(f.current.getTracks().forEach(D=>D.stop()),f.current=null);const k=((j=d.current[0])==null?void 0:j.type)||"audio/webm",N=new Blob(d.current,{type:k});if(d.current=[],console.log("[STT] Recording stopped, audio size:",N.size),N.size<1e3){i("Recording too short"),n(!1),S(null);return}a(!0);try{const D=await D5(N);console.log("[STT] Sending audio for transcription...");const P=await(await Lt(Mt("/api/stt/transcribe"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audio:D,language:h.language,model:h.model})})).json();P.success&&P.text?(console.log("[STT] Transcription:",P.text),(E=h.onTranscription)==null||E.call(h,P.text),S(P.text)):(console.error("[STT] Transcription failed:",P.error),i(P.error||"Transcription failed"),S(null))}catch(D){console.error("[STT] Failed to transcribe:",D),i("Failed to transcribe audio"),S(null)}finally{a(!1)}n(!1)},C.stop()}),[e,h]),y=b.useCallback(async()=>e?x():(await m(),null),[e,m,x]);return{recording:e,transcribing:s,error:r,startRecording:m,stopRecording:x,toggleRecording:y,supported:typeof navigator<"u"&&!!((v=navigator.mediaDevices)!=null&&v.getUserMedia)&&typeof MediaRecorder<"u"}}function D5(t){return new Promise((e,n)=>{const s=new FileReader;s.onloadend=()=>{const a=s.result.split(",")[1];e(a)},s.onerror=n,s.readAsDataURL(t)})}const R5=b.memo(function({agentId:e,isWorking:n,timestamp:s}){const{t:a}=pt(["terminal"]),[r,i]=b.useState(0);return b.useEffect(()=>{if(!n||!s){i(0);return}i(Date.now()-s);const c=setInterval(()=>{i(Date.now()-s)},1e3);return()=>clearInterval(c)},[n,s]),n?o.jsxs("div",{className:"guake-stop-bar",children:[o.jsx("span",{className:"guake-elapsed-timer",children:AT(r)}),o.jsxs("button",{className:"guake-stop-btn",onClick:()=>U.stopAgent(e),title:a("terminal:input.stopOperation"),children:[o.jsx("span",{className:"stop-icon",children:"■"}),o.jsx("span",{className:"stop-label",children:a("terminal:input.stop")})]})]}):null});function vA(t){const e={pdf:"file_type_pdf.svg",doc:"file_type_word.svg",docx:"file_type_word.svg",xls:"file_type_excel.svg",xlsx:"file_type_excel.svg",ppt:"file_type_powerpoint.svg",pptx:"file_type_powerpoint.svg",txt:"file_type_text.svg",md:"file_type_markdown.svg",js:"file_type_javascript_official.svg",jsx:"file_type_javascript_official.svg",ts:"file_type_typescript_official.svg",tsx:"file_type_typescript_official.svg",py:"file_type_python.svg",java:"file_type_java.svg",cpp:"file_type_cpp.svg",c:"file_type_cpp.svg",h:"file_type_cpp.svg",hpp:"file_type_cpp.svg",cs:"file_type_csharp.svg",go:"file_type_go.svg",rs:"file_type_rust.svg",php:"file_type_php.svg",rb:"file_type_ruby.svg",swift:"file_type_swift.svg",kt:"file_type_kotlin.svg",scala:"file_type_scala.svg",r:"file_type_r.svg",html:"file_type_html.svg",htm:"file_type_html.svg",css:"file_type_css.svg",scss:"file_type_scss.svg",sass:"file_type_sass.svg",less:"file_type_less.svg",json:"file_type_json_official.svg",yaml:"file_type_yaml_official.svg",yml:"file_type_yaml_official.svg",xml:"file_type_xml.svg",toml:"file_type_toml.svg",ini:"file_type_ini.svg",env:"file_type_dotenv.svg",sh:"file_type_shell.svg",bash:"file_type_shell.svg",zsh:"file_type_shell.svg",fish:"file_type_shell.svg",png:"file_type_image.svg",jpg:"file_type_image.svg",jpeg:"file_type_image.svg",gif:"file_type_image.svg",svg:"file_type_image.svg",webp:"file_type_image.svg",zip:"file_type_zip.svg",tar:"file_type_tar.svg",gz:"file_type_gzip.svg",rar:"file_type_rar.svg","7z":"file_type_zip.svg",mp3:"file_type_audio.svg",mp4:"file_type_video.svg",wav:"file_type_audio.svg",mov:"file_type_video.svg",mkv:"file_type_video.svg",flv:"file_type_video.svg",avi:"file_type_video.svg",default:"default_file.svg"};return e[t.toLowerCase()]||e.default}function AT(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),s=e%60;return`${n}:${s.toString().padStart(2,"0")}`}const wA=72,O5=128,L5=b.memo(function({selectedAgent:e,selectedAgentId:n,isOpen:s,command:a,setCommand:r,forceTextarea:i,setForceTextarea:c,useTextarea:d,attachedFiles:f,setAttachedFiles:h,removeAttachedFile:m,uploadFile:x,pastedTexts:y,expandPastedTexts:v,incrementPastedCount:S,setPastedTexts:C,resetPastedCount:k,handleInputFocus:N,handleInputBlur:j,pendingPermissions:E,showCompletion:D,completionElapsed:_,onImageClick:P,inputRef:O,textareaRef:T,isSnapshotView:M=!1,onClearHistory:R,onSendCommand:I,canSwipeClose:z=!1,onSwipeCloseOffsetChange:W,onSwipeClose:$}){const{t:F}=pt(["terminal","common"]),H=b.useRef(null),V=b.useRef(null),G=O||H,B=T||V,Q=b.useRef(null),K=b.useRef(null),q=b.useRef(d),xe=b.useRef(0),de=b.useRef(null),Z=b.useRef({isTracking:!1,startY:0,startX:0}),[be,je]=b.useState(0),[ce,Ee]=b.useState("idle"),ze=Br(),Ge=Dj(n),_e=e.status==="working",me=b.useCallback(()=>{const oe=Q.current,he=d?B.current:G.current;oe==null||oe.focus({preventScroll:!0}),he==null||he.focus({preventScroll:!0})},[G,B,d]),{recording:De,transcribing:te,toggleRecording:He}=CT({language:"Spanish",model:"medium",onTranscription:oe=>{oe.trim()&&n&&U.sendCommand(n,oe.trim())}}),ye=b.useCallback(()=>{de.current&&(clearTimeout(de.current),de.current=null)},[]),Re=b.useCallback((oe="idle")=>{ye(),je(0),Ee(oe),W==null||W(0),oe==="returning"&&(de.current=setTimeout(()=>{Ee("idle"),de.current=null},160))},[ye,W]),re=b.useCallback(oe=>{if(!z||!$||window.innerWidth>768||oe.touches.length!==1)return;ye();const he=oe.touches[0];Z.current={isTracking:!0,startY:he.clientY,startX:he.clientX},Ee("idle"),je(0),W==null||W(0)},[z,$,ye,W]),pe=b.useCallback(oe=>{if(!Z.current.isTracking)return;const he=oe.touches[0],ne=he.clientY-Z.current.startY,Le=Math.abs(he.clientX-Z.current.startX);if(Le>48&&Le>Math.abs(ne)){Z.current.isTracking=!1,Re("returning");return}if(ne>=0){je(0),Ee("idle");return}const Qe=Math.min(O5,Math.abs(ne));Qe>8&&oe.preventDefault(),je(Qe),Ee("dragging"),W==null||W(Qe)},[Re,W]),Ve=b.useCallback(()=>{if(Z.current.isTracking){if(Z.current.isTracking=!1,!z||!$){Re("returning");return}if(be>=wA){$();return}Re("returning")}},[z,$,be,Re,W]),at=b.useCallback(()=>{Z.current.isTracking=!1,Re("returning")},[Re]);b.useEffect(()=>()=>ye(),[ye]),b.useEffect(()=>{z||(Z.current.isTracking=!1,Re("idle"))},[z,Re]);const ut=oe=>{xe.current=oe.target.selectionStart||oe.target.value.length,r(oe.target.value)};b.useEffect(()=>{const oe=B.current;if(!oe||!d)return;const ne=window.innerWidth<=768?200:180;requestAnimationFrame(()=>{oe.style.height="0px",oe.style.overflow="hidden";const Le=oe.scrollHeight,Qe=Math.max(46,Math.min(Le,ne));oe.style.height=`${Qe}px`,oe.style.overflow=Qe>=ne?"auto":"hidden"})},[a,d]),b.useEffect(()=>{q.current!==d&&(q.current=d,requestAnimationFrame(()=>{const oe=xe.current;d&&B.current?(me(),B.current.setSelectionRange(oe,oe)):!d&&G.current&&(me(),G.current.setSelectionRange(oe,oe))}))},[me,G,B,d]);const ue=b.useRef(!1);b.useEffect(()=>{const oe=ue.current;ue.current=s;const he=typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches,ne=U.consumeSwipeSelectionFlag(),Le=U.consumeDirectClickSelectionFlag();if(s&&(!oe||n)&&!(he&&(ne||Le))){const $e=setTimeout(()=>{me()},50);return()=>clearTimeout($e)}},[s,me,n]);const X=oe=>{const he=new RegExp(`\\[Pasted text #${oe} \\+\\d+ lines\\]\\s*`,"g");r(a.replace(he,"").trim()),C(ne=>{const Le=new Map(ne);return Le.delete(oe),Le})},ke=(()=>{const oe=/\[Pasted text #(\d+) \+(\d+) lines\]/g,he=[];let ne;for(;(ne=oe.exec(a))!==null;)he.push({id:parseInt(ne[1],10),lineCount:parseInt(ne[2],10)});return he})(),J=()=>{var ne,Le;if(!a.trim()&&f.length===0||!n)return;if(a.trim()==="/clear"&&f.length===0){U.clearContext(n),R(),r(""),c(!1),C(new Map),h([]),k();return}let oe=v(a.trim());if(f.length>0){const Qe=f.map($e=>$e.isImage?`[Image: ${$e.path}]`:`[File: ${$e.path}]`).join(`
|
|
133
|
-
`);oe?oe=`${oe}
|
|
134
|
-
|
|
135
|
-
${Qe}`:oe=Qe}U.sendCommand(n,oe),I==null||I(),r(""),c(!1),C(new Map),h([]),k(),window.innerWidth<=768&&((ne=G.current)==null||ne.blur(),(Le=B.current)==null||Le.blur())},we=oe=>{const he=window.innerWidth<=768;if(oe.key==="Enter"){if(he){d||(oe.preventDefault(),c(!0),setTimeout(()=>{r(a+`
|
|
136
|
-
`)},0));return}if(oe.shiftKey){d||(oe.preventDefault(),c(!0));return}oe.preventDefault(),J()}},We=oe=>{},Be=oe=>{oe.button===1&&(oe.preventDefault(),oe.stopPropagation())},ie=async oe=>{const he=oe.clipboardData.items;for(const st of he){if(st.type.startsWith("image/")){oe.preventDefault();const lt=st.getAsFile();if(lt){const it=await x(lt);it&&h(ht=>[...ht,it])}return}if(st.kind==="file"){oe.preventDefault();const lt=st.getAsFile();if(lt){const it=await x(lt);it&&h(ht=>[...ht,it])}return}}const ne=oe.clipboardData.files;if(ne.length>0){oe.preventDefault();for(const st of ne){const lt=await x(st);lt&&h(it=>[...it,lt])}return}const Le=oe.clipboardData.getData("text"),Qe=!Le.includes(`
|
|
137
|
-
`),$e=/^[/~][^\s]*$|^[A-Za-z]:\\[^\s]*$/.test(Le.trim()),nt=/\.[a-zA-Z0-9]{1,5}$/.test(Le.trim());if(Qe&&$e&&nt){oe.preventDefault();try{const st=await fetch("/api/files/by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Le.trim()})});if(st.ok){const lt=await st.blob(),it=Le.trim().split(/[/\\]/).pop()||"file",ht=await x(lt,it);ht&&h(jt=>[...jt,ht]);return}}catch{}r(a+Le);return}const ot=(Le.match(/\n/g)||[]).length+1;if(ot>5){oe.preventDefault();const st=S();C(Ye=>new Map(Ye).set(st,Le));const lt=`[Pasted text #${st} +${ot} lines]`,it=oe.target,ht=it.selectionStart||0,jt=it.selectionEnd||0,ge=a.slice(0,ht)+lt+a.slice(jt),Te=ht+lt.length;xe.current=Te,r(ge),d?requestAnimationFrame(()=>{B.current&&B.current.setSelectionRange(Te,Te)}):c(!0)}},Ie=async oe=>{const he=oe.target.files;if(he){for(const ne of he){const Le=await x(ne);Le&&h(Qe=>[...Qe,Le])}K.current&&(K.current.value="")}};return o.jsxs(o.Fragment,{children:[E.length>0&&o.jsx("div",{className:"permission-bar",children:E.map(oe=>o.jsx(T5,{request:oe,onApprove:he=>U.respondToPermissionRequest(oe.id,!0,void 0,he),onDeny:()=>U.respondToPermissionRequest(oe.id,!1)},oe.id))}),ke.length>0&&o.jsx("div",{className:"guake-pasted-texts",children:ke.map(({id:oe,lineCount:he})=>{const ne=y.get(oe)||"";return o.jsx(E5,{id:oe,lineCount:he,fullText:ne,onRemove:()=>X(oe)},oe)})}),f.length>0&&o.jsx("div",{className:"guake-attachments",children:f.map(oe=>{var Qe;const he=oe.isImage?ty(oe.path):null,ne=((Qe=oe.name.split(".").pop())==null?void 0:Qe.toLowerCase())||"",Le=["pdf","doc","docx","xls","xlsx","ppt","pptx"].includes(ne);return o.jsxs("div",{className:`guake-attachment ${oe.isImage?"is-image clickable":""} ${Le?"is-document":""}`,onClick:()=>{oe.isImage&&P(he,oe.name)},children:[oe.isImage&&he?o.jsx("img",{src:he,alt:oe.name,className:"guake-attachment-thumb"}):o.jsx("img",{src:`/assets/vscode-icons/${vA(ne)}`,alt:oe.name,className:"guake-attachment-icon",style:{width:"24px",height:"24px"}}),o.jsxs("div",{className:"guake-attachment-info",children:[o.jsxs("div",{className:"guake-attachment-name-row",children:[o.jsx("img",{src:`/assets/vscode-icons/${vA(ne)}`,alt:ne,className:"guake-attachment-type-icon",style:{width:"11px",height:"11px"}}),o.jsx("span",{className:"guake-attachment-name",title:oe.path,children:oe.name})]}),o.jsxs("span",{className:"guake-attachment-size",children:["(",Math.round(oe.size/1024),"KB)"]})]}),o.jsx("button",{className:"guake-attachment-remove",onClick:$e=>{$e.stopPropagation(),m(oe.id)},title:F("terminal:input.removeAttachment"),children:"×"})]},oe.id)})}),o.jsx("div",{className:`guake-input-wrapper ${e.status==="working"?"has-stop-btn is-working":""} ${D?"is-completed":""} ${M?"is-snapshot-view":""}`,children:o.jsxs("div",{className:`guake-input-swipe-shell ${ce!=="idle"?"swipe-close-active":""} ${be>=wA?"swipe-close-ready":""}`,onTouchStart:re,onTouchMove:pe,onTouchEnd:Ve,onTouchCancel:at,children:[!M&&(()=>{const oe=e.contextStats,he=oe?oe.totalTokens:e.contextUsed||0,ne=oe?oe.contextWindow:e.contextLimit||2e5,Le=oe?oe.usedPercent:Math.round(he/ne*100),Qe=Math.max(0,Math.min(100,Le)),$e=Math.max(0,100-Qe),nt=Qe>=80?"#ff4a4a":Qe>=60?"#ff9e4a":Qe>=40?"#ffd700":"#4aff9e",ot=(he/1e3).toFixed(1),st=(ne/1e3).toFixed(1);return o.jsxs("div",{className:"mobile-context-bar show-on-mobile",onClick:()=>U.setContextModalAgentId(n),children:[o.jsx("span",{className:"mobile-context-bar-fill",style:{width:`${Math.min(100,Qe)}%`,backgroundColor:nt}}),o.jsxs("span",{className:"mobile-context-bar-text",children:[o.jsxs("span",{style:{color:nt},children:[ot,"k/",st,"k"]}),o.jsxs("span",{className:"mobile-context-bar-pct",children:["(",$e,"% free)"]})]})]})})(),o.jsx(R5,{agentId:n,isWorking:_e,timestamp:Ge==null?void 0:Ge.timestamp}),D&&_!==null&&o.jsx("div",{className:"guake-completion-time",children:AT(_)}),o.jsxs("div",{className:`guake-input ${d?"guake-input-expanded":""}`,children:[o.jsx("input",{ref:K,type:"file",multiple:!0,onChange:Ie,style:{display:"none"},accept:"*"}),o.jsxs("div",{ref:Q,className:"guake-input-container",tabIndex:-1,onAuxClick:Be,children:[o.jsx("button",{className:"guake-attach-btn",onClick:()=>{var oe;return(oe=K.current)==null?void 0:oe.click()},title:F("terminal:input.attachOrPaste"),children:"📎"}),ze.experimentalTTS&&o.jsx("button",{className:`guake-mic-btn ${De?"recording":""} ${te?"transcribing":""}`,onClick:He,title:F(De?"terminal:input.stopRecording":te?"terminal:input.transcribing":"terminal:input.voiceInput"),disabled:te,children:te?"⏳":De?"🔴":"🎤"}),d?o.jsx("textarea",{ref:B,placeholder:F("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ut,onKeyDown:we,onPaste:ie,onMouseDown:We,onFocus:N,onBlur:j}):o.jsx("input",{ref:G,type:"text",placeholder:F("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ut,onKeyDown:we,onPaste:ie,onMouseDown:We,onFocus:N,onBlur:j}),o.jsx("button",{onClick:J,disabled:!a.trim()&&f.length===0,title:F("terminal:input.send"),children:"➤"})]})]})]})})]})});function P5(t){var i;const e=t.split(`
|
|
138
|
-
`),n=[];let s=null,a=0,r=0;for(const c of e){if(c.startsWith("diff --git")||c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ ")||c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("similarity index")||c.startsWith("rename from")||c.startsWith("rename to")||c.startsWith("Binary files"))continue;const d=c.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(d){s={header:((i=d[5])==null?void 0:i.trim())||"",oldStart:parseInt(d[1],10),oldCount:parseInt(d[2]??"1",10),newStart:parseInt(d[3],10),newCount:parseInt(d[4]??"1",10),lines:[]},a=s.oldStart,r=s.newStart,n.push(s);continue}if(s){if(c.startsWith("+"))s.lines.push({type:"added",content:c.slice(1),newNum:r}),r++;else if(c.startsWith("-"))s.lines.push({type:"removed",content:c.slice(1),oldNum:a}),a++;else if(c.startsWith(" ")||c==="")s.lines.push({type:"context",content:c.startsWith(" ")?c.slice(1):c,oldNum:a,newNum:r}),a++,r++;else if(c.startsWith("\\"))continue}}return n}function I5(t,e){const n=t.split(`
|
|
139
|
-
`),s=e.split(`
|
|
140
|
-
`),a=n.length,r=s.length,i=Array(a+1).fill(null).map(()=>Array(r+1).fill(0));for(let v=1;v<=a;v++)for(let S=1;S<=r;S++)n[v-1]===s[S-1]?i[v][S]=i[v-1][S-1]+1:i[v][S]=Math.max(i[v-1][S],i[v][S-1]);const c=[];let d=a,f=r;for(;d>0||f>0;)d>0&&f>0&&n[d-1]===s[f-1]?(c.push({type:"equal",origIdx:d-1,modIdx:f-1}),d--,f--):f>0&&(d===0||i[d][f-1]>=i[d-1][f])?(c.push({type:"insert",modIdx:f-1}),f--):d>0&&(c.push({type:"delete",origIdx:d-1}),d--);c.reverse();const h=[],m=[];let x=0,y=0;for(const v of c)if(v.type==="equal"){const S=n[v.origIdx];h.push({num:v.origIdx+1,text:S,type:"unchanged"}),m.push({num:v.modIdx+1,text:S,type:"unchanged"})}else if(v.type==="delete"){const S=n[v.origIdx];h.push({num:v.origIdx+1,text:S,type:"removed"}),y++}else{const S=s[v.modIdx];m.push({num:v.modIdx+1,text:S,type:"added"}),x++}return{leftLines:h,rightLines:m,stats:{added:x,removed:y}}}function jT({content:t,onFileClick:e}){const{t:n}=pt(["tools","common","terminal"]),s=b.useRef(null),a=b.useRef(null),r=b.useRef(null),i=b.useCallback(c=>{const d=s.current,f=a.current;if(!d||!f||r.current&&r.current!==c)return;r.current=c;const h=c==="left"?d:f,m=c==="left"?f:d;m.scrollTop=h.scrollTop,m.scrollLeft=h.scrollLeft,requestAnimationFrame(()=>{r.current=null})},[]);b.useEffect(()=>{const c=s.current,d=a.current;if(!c||!d)return;const f=()=>i("left"),h=()=>i("right");return c.addEventListener("scroll",f),d.addEventListener("scroll",h),()=>{c.removeEventListener("scroll",f),d.removeEventListener("scroll",h)}},[i]);try{const c=JSON.parse(t),{file_path:d,old_string:f,new_string:h,replace_all:m,unified_diff:x}=c;if(!d)return o.jsx("pre",{className:"output-input-content",children:t});const y=d.split("/").pop()||d;if(x){const k=P5(x),N={added:0,removed:0};for(const j of k)for(const E of j.lines)E.type==="added"&&N.added++,E.type==="removed"&&N.removed++;return o.jsxs("div",{className:"edit-tool-diff",children:[o.jsxs("div",{className:"edit-tool-header",children:[o.jsx("span",{className:"edit-tool-file clickable",onClick:()=>e==null?void 0:e(d,{oldString:f||"",newString:h||"",unifiedDiff:x}),title:n("terminal:history.openFileWithDiff",{path:d}),children:y}),o.jsx("span",{className:"edit-tool-path",children:d}),o.jsxs("div",{className:"edit-tool-stats",children:[N.added>0&&o.jsxs("span",{className:"edit-stat added",children:["+",N.added]}),N.removed>0&&o.jsxs("span",{className:"edit-stat removed",children:["-",N.removed]})]}),m&&o.jsx("span",{className:"edit-tool-badge",children:n("tools:diff.replaceAll")})]}),o.jsxs("div",{className:"edit-tool-unified",children:[k.map((j,E)=>o.jsxs("div",{className:"diff-hunk",children:[o.jsxs("div",{className:"diff-hunk-header",children:[o.jsxs("span",{className:"diff-hunk-range",children:["@@ -",j.oldStart,",",j.oldCount," +",j.newStart,",",j.newCount," @@"]}),j.header&&o.jsx("span",{className:"diff-hunk-context",children:j.header})]}),j.lines.map((D,_)=>o.jsxs("div",{className:`diff-line diff-line-${D.type}`,children:[o.jsx("span",{className:"diff-line-num diff-line-num-old",children:D.type!=="added"?D.oldNum:""}),o.jsx("span",{className:"diff-line-num diff-line-num-new",children:D.type!=="removed"?D.newNum:""}),o.jsx("span",{className:"diff-line-marker",children:D.type==="added"?"+":D.type==="removed"?"-":" "}),o.jsx("span",{className:"diff-line-content",children:D.content||" "})]},_))]},E)),k.length===0&&o.jsx("div",{className:"diff-empty",children:"No changes detected"})]})]})}const{leftLines:v,rightLines:S,stats:C}=I5(f||"",h||"");return o.jsxs("div",{className:"edit-tool-diff",children:[o.jsxs("div",{className:"edit-tool-header",children:[o.jsx("span",{className:"edit-tool-file clickable",onClick:()=>e==null?void 0:e(d,{oldString:f||"",newString:h||""}),title:n("terminal:history.openFileWithDiff",{path:d}),children:y}),o.jsx("span",{className:"edit-tool-path",children:d}),o.jsxs("div",{className:"edit-tool-stats",children:[C.added>0&&o.jsxs("span",{className:"edit-stat added",children:["+",C.added]}),C.removed>0&&o.jsxs("span",{className:"edit-stat removed",children:["-",C.removed]})]}),m&&o.jsx("span",{className:"edit-tool-badge",children:n("tools:diff.replaceAll")})]}),o.jsxs("div",{className:"edit-tool-panels",children:[o.jsxs("div",{className:"edit-panel edit-panel-original",children:[o.jsx("div",{className:"edit-panel-header",children:o.jsx("span",{className:"edit-panel-label",children:n("tools:diff.original")})}),o.jsxs("div",{className:"edit-panel-content",ref:s,children:[v.map((k,N)=>o.jsxs("div",{className:`edit-line edit-line-${k.type}`,children:[o.jsx("span",{className:"edit-line-num",children:k.num}),o.jsx("span",{className:"edit-line-content",children:k.text||" "})]},N)),v.length===0&&o.jsxs("div",{className:"edit-line edit-line-empty",children:[o.jsx("span",{className:"edit-line-num",children:"-"}),o.jsx("span",{className:"edit-line-content edit-empty-text",children:n("common:status.empty")})]})]})]}),o.jsxs("div",{className:"edit-panel edit-panel-modified",children:[o.jsx("div",{className:"edit-panel-header",children:o.jsx("span",{className:"edit-panel-label",children:n("tools:diff.modified")})}),o.jsxs("div",{className:"edit-panel-content",ref:a,children:[S.map((k,N)=>o.jsxs("div",{className:`edit-line edit-line-${k.type}`,children:[o.jsx("span",{className:"edit-line-num",children:k.num}),o.jsx("span",{className:"edit-line-content",children:k.text||" "})]},N)),S.length===0&&o.jsxs("div",{className:"edit-line edit-line-empty",children:[o.jsx("span",{className:"edit-line-num",children:"-"}),o.jsx("span",{className:"edit-line-content edit-empty-text",children:n("common:status.empty")})]})]})]})]})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function NT({content:t,onFileClick:e}){try{const n=JSON.parse(t),{file_path:s,offset:a,limit:r}=n;if(!s)return o.jsx("pre",{className:"output-input-content",children:t});const i=s.split("/").pop()||s,c=a!==void 0&&r!==void 0,d=()=>{c?e==null||e(s,{highlightRange:{offset:a,limit:r}}):e==null||e(s)};return o.jsxs("div",{className:"read-tool-input",children:[o.jsxs("span",{className:"read-tool-file clickable",onClick:d,title:`Open ${s}${c?" (with highlighted lines)":""}`,children:["📄 ",i]}),o.jsx("span",{className:"read-tool-path",children:s}),(a!==void 0||r!==void 0)&&o.jsxs("span",{className:"read-tool-range",children:[a!==void 0&&`offset: ${a}`,a!==void 0&&r!==void 0&&", ",r!==void 0&&`limit: ${r}`]})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function fp({content:t}){const{t:e}=pt(["tools"]);try{const s=JSON.parse(t).todos;if(!Array.isArray(s)||s.length===0)return o.jsx("pre",{className:"output-input-content",children:t});const a={completed:s.filter(r=>r.status==="completed").length,in_progress:s.filter(r=>r.status==="in_progress").length,pending:s.filter(r=>r.status==="pending").length};return o.jsxs("div",{className:"todo-tool-input",children:[o.jsxs("div",{className:"todo-tool-header",children:[o.jsxs("span",{className:"todo-tool-title",children:["📋 ",e("tools:todoList.title")]}),o.jsxs("div",{className:"todo-tool-stats",children:[a.completed>0&&o.jsxs("span",{className:"todo-stat completed",children:["✓ ",a.completed]}),a.in_progress>0&&o.jsxs("span",{className:"todo-stat in-progress",children:["► ",a.in_progress]}),a.pending>0&&o.jsxs("span",{className:"todo-stat pending",children:["○ ",a.pending]})]})]}),o.jsx("div",{className:"todo-tool-list",children:s.map((r,i)=>o.jsxs("div",{className:`todo-item todo-${r.status}`,children:[o.jsx("span",{className:"todo-status-icon",children:r.status==="completed"?"✓":r.status==="in_progress"?"►":"○"}),o.jsx("span",{className:"todo-content",children:r.content})]},i))})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function TT({content:t}){const[e,n]=b.useState(null);try{const a=JSON.parse(t).questions;return!Array.isArray(a)||a.length===0?o.jsx("pre",{className:"output-input-content",children:t}):o.jsx("div",{className:"ask-question-input",children:a.map((r,i)=>o.jsxs("div",{className:"ask-question-block",children:[o.jsxs("div",{className:"ask-question-header",children:[r.header&&o.jsx("span",{className:"ask-question-badge",children:r.header}),o.jsx("span",{className:"ask-question-text",children:r.question}),r.multiSelect&&o.jsx("span",{className:"ask-question-multi",children:"multi"})]}),r.options&&r.options.length>0&&o.jsx("div",{className:"ask-question-options",children:r.options.map((c,d)=>{const f=i*100+d,h=e===f;return o.jsxs("div",{className:`ask-question-option ${h?"expanded":""}`,onClick:()=>n(h?null:f),children:[o.jsxs("div",{className:"ask-option-row",children:[o.jsx("span",{className:"ask-option-number",children:d+1}),o.jsx("span",{className:"ask-option-label",children:c.label}),c.markdown&&o.jsx("span",{className:"ask-option-preview-hint",children:h?"▼":"▶"})]}),c.description&&o.jsx("div",{className:"ask-option-desc",children:c.description}),c.markdown&&h&&o.jsx("pre",{className:"ask-option-markdown",children:c.markdown})]},d)})})]},i))})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function Gb({content:t}){const[e,n]=b.useState(!1);try{const s=JSON.parse(t),a=typeof s.plan=="string"?s.plan.trim():"";if(!a)return o.jsx("pre",{className:"output-input-content",children:t});const r=a.match(/^#+\s+(.+)$/m),i=((r==null?void 0:r[1])||a.split(`
|
|
141
|
-
`).find(c=>c.trim().length>0)||"Plan ready").trim();return o.jsxs("div",{className:"plan-tool-input",children:[o.jsxs("div",{className:"plan-tool-header",children:[o.jsx("span",{className:"plan-tool-title",children:"🗺 Plan"}),o.jsx("button",{type:"button",className:"plan-tool-toggle",onClick:()=>n(c=>!c),title:e?"Collapse plan":"Expand plan",children:e?"▼ Hide":"▶ Show"})]}),e?o.jsx("div",{className:"plan-tool-markdown markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],children:a})}):o.jsx("div",{className:"plan-tool-collapsed-preview",children:i})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function B5(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(e=>e.length>0):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(e=>e.length>0):[]}function F5(t){return Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>({key:e,value:typeof n=="string"?n:JSON.stringify(n)}))}function ET(t){const e=t.match(/(?:^|[\s,;])select\s*:\s*([^\n;]+)/i),n=t.match(/(?:^|[\s,;])fallback\s*:\s*([^\n;]+)/i),s=t.match(/(?:^|[\s,;])(?:show|show_hide|hide)\s*:\s*([^\n;]+)/i);return{selectedTools:e?e[1].split(",").map(r=>r.trim()).filter(Boolean):[],fallback:n?n[1].trim():null,showHide:s?s[1].trim():null}}function z5(t){const e=typeof t.tool=="string"?t.tool.toLowerCase():"",n=typeof t.type=="string"?t.type.toLowerCase():"",s=typeof t.label=="string"?t.label.toLowerCase():"";let a=B5(t.select??t.selected??t.selected_tools??t.tools),r=t.fallback??t.use_fallback??t.fallbackMode,i=t.show??t.show_hide??t.showHidden??t.hide;const c=t.query_params??t.query??t.params??t.arguments,d=Object.values(t).filter(x=>typeof x=="string").map(x=>x).join(" ; "),f=ET(d);if(a.length===0&&f.selectedTools.length>0&&(a=f.selectedTools),r===void 0&&f.fallback!==null&&(r=f.fallback),i===void 0&&f.showHide!==null&&(i=f.showHide),!(e.includes("toolsearch")||n.includes("toolsearch")||s.includes("toolsearch")||a.length>0||c!==void 0))return null;const m=c&&typeof c=="object"&&!Array.isArray(c)?F5(c):[];return{selectedTools:a,fallback:r!==void 0?String(r):null,showHide:i!==void 0?String(i):null,queryParams:m}}function $5(t){const e=ET(t),n=t.match(/(?:^|\s)(?:query|params|query_params)\s*:\s*(.+)$/i);if(e.selectedTools.length===0&&!n)return null;const s=[];return n&&n[1].split(/[;,]/).map(a=>a.trim()).filter(Boolean).forEach(a=>{const r=a.match(/^([^:=]+)\s*[:=]\s*(.+)$/);r?s.push({key:r[1].trim(),value:r[2].trim()}):s.push({key:"query",value:a})}),{selectedTools:e.selectedTools,fallback:e.fallback,showHide:e.showHide,queryParams:s}}function _T(t){try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return z5(e)}catch{}return $5(t)}function MT(t){return _T(t)!==null}function pp({content:t,agentName:e}){const[n,s]=b.useState(!1),a=_T(t);if(!a)return o.jsx("pre",{className:"output-input-content",children:t});const r=a.selectedTools.length>0?a.selectedTools.slice(0,4).join(", "):"-",c=a.selectedTools.length>4?`${r} +${a.selectedTools.length-4}`:r;return o.jsxs("div",{className:"toolsearch-input",children:[o.jsxs("div",{className:"toolsearch-header",children:[o.jsx("span",{className:"toolsearch-badge",children:"⚡ ToolSearch"}),e&&o.jsx("span",{className:"toolsearch-agent",children:e}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Tools: ",c]}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Fallback: ",a.fallback??"-"]}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Show/Hide: ",a.showHide??"-"]}),o.jsx("button",{type:"button",className:"toolsearch-toggle",onClick:()=>s(d=>!d),title:n?"Hide details":"Show details",children:n?"▼ Hide":"▶ Show"})]}),n?o.jsxs("div",{className:"toolsearch-query-block",children:[o.jsx("div",{className:"toolsearch-tools",children:a.selectedTools.length>0?a.selectedTools.map(d=>o.jsx("span",{className:"toolsearch-tool-chip",children:d},d)):o.jsx("span",{className:"toolsearch-empty",children:"No selected tools"})}),o.jsx("div",{className:"toolsearch-query-title",children:"Query Parameters"}),a.queryParams.length>0?o.jsx("div",{className:"toolsearch-query-list",children:a.queryParams.map((d,f)=>o.jsxs("div",{className:"toolsearch-query-row",children:[o.jsx("span",{className:"toolsearch-query-key",children:d.key}),o.jsx("span",{className:"toolsearch-query-value",children:d.value})]},`${d.key}-${f}`))}):o.jsx("div",{className:"toolsearch-empty",children:"No query parameters provided"})]}):o.jsx("div",{className:"toolsearch-preview",children:"Collapsed"})]})}function kA({toolName:t,content:e}){const[n,s]=b.useState(!1);if(!e||e.trim()==="{}")return null;const a=e.length>220?`${e.slice(0,220)}...`:e;return o.jsxs("div",{className:"unknown-tool-input",children:[o.jsx("div",{className:"unknown-tool-header",children:o.jsx("button",{type:"button",className:"unknown-tool-toggle",onClick:()=>s(r=>!r),title:n?"Collapse details":"Expand details",children:n?"▼ Hide":"▶ Show"})}),n?o.jsx("pre",{className:"output-input-content",children:e}):o.jsx("pre",{className:"unknown-tool-preview",children:a})]})}function ny(){const[t,e]=b.useState(!1),n=b.useRef(null),s=b.useCallback(async i=>{if(!i.trim()){console.warn("[TTS] No text to speak");return}n.current&&(n.current.pause(),n.current=null),console.log("[TTS] Requesting audio from server (auto-detect language):",i.substring(0,100)+"..."),e(!0);try{const c=await Lt(Mt("/api/tts/speak"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:i})});if(!c.ok){const m=await c.json();console.error("[TTS] Server error:",m),e(!1);return}const d=await c.blob(),f=URL.createObjectURL(d),h=new Audio(f);n.current=h,h.onended=()=>{e(!1),URL.revokeObjectURL(f),n.current=null},h.onerror=m=>{console.error("[TTS] Audio playback error:",m),e(!1),URL.revokeObjectURL(f),n.current=null},await h.play(),console.log("[TTS] Playing audio in browser")}catch(c){console.error("[TTS] Failed to get audio:",c),e(!1)}},[]),a=b.useCallback(()=>{n.current&&(n.current.pause(),n.current=null),e(!1)},[]),r=b.useCallback(i=>{console.log("[TTS] Toggle called, currently speaking:",t),t?a():s(i)},[t,s,a]);return{speak:s,stop:a,toggle:r,speaking:t,supported:!0}}function H5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}function U5(t){const e=t.content.slice(0,50),n=`H${t.type[0].toUpperCase()}`;let s=0;for(let a=0;a<e.length;a++)s=(s<<5)-s+e.charCodeAt(a),s|=0;return`${n}:${(s>>>0).toString(16).slice(0,6)}`}const DT=b.memo(function({message:e,agentId:n,highlight:s,simpleView:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var Ee,ze;const{t:f}=pt(["tools","common","terminal"]),[h,m]=b.useState(new Set),[x,y]=b.useState(!1),v=Oj(),S=Br(),{type:C,content:k,toolName:N,timestamp:j,_bashOutput:E,_bashCommand:D}=e,_=su(k,v),{toggle:P,speaking:O}=ny(),T=Pu({onFileClick:i?Ge=>i(Ge):void 0}),M=n?(Ee=U.getState().agents.get(n))==null?void 0:Ee.name:null,R=n?(ze=U.getState().agents.get(n))==null?void 0:ze.provider:void 0,I=R==="codex"?"Codex":R==="opencode"?"OpenCode":"Claude",W=C==="tool_use"&&(N==="Task"||N==="Agent")&&e.toolInput&&(e.toolInput.name||e.toolInput.description)||null||M,$=j?cp(new Date(j).getTime()):"",F=j?new Date(j).getTime():0,H=U5(e);if(C==="assistant"&&!_.trim())return o.jsxs("div",{className:"output-line output-empty-message",children:[$&&o.jsx("span",{className:"output-timestamp",title:`${F} | ${H}`,children:$}),o.jsxs("span",{className:"history-role",children:[R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon"}),I]}),o.jsx("span",{className:"empty-message-label",children:f("terminal:history.emptyMessage","empty message")})]});if(_.startsWith("This session is being continued from a previous conversation that ran out of context"))return o.jsxs("div",{className:`output-line output-session-continuation ${x?"expanded":""}`,onClick:()=>y(!x),title:f("terminal:history.clickToExpandCollapse"),children:[$&&o.jsx("span",{className:"output-timestamp",title:`${F} | ${H}`,children:$}),o.jsx("span",{className:"session-continuation-icon",children:"🔗"}),o.jsx("span",{className:"session-continuation-label",children:f("tools:display.sessionContinued")}),o.jsx("span",{className:"session-continuation-toggle",children:x?"▼":"▶"}),x&&o.jsx("div",{className:"session-continuation-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:T,children:_})})]});const G=_.trimStart().startsWith(Cb),B=!G&&_.includes("<local-command-stdout>")&&_.includes("Context Usage");if(!G&&(_.includes("## Context Usage")||_.includes("Context Usage")&&_.includes("Tokens:")&&_.includes("Free space")||B)){const Ge=_.match(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/),_e=Ge?Ge[1]:_,me=_e.match(/\*?\*?Tokens:\*?\*?\s*([\d.]+)k?\s*\/\s*([\d.]+)k?\s*\((\d+)%\)/),te=(re=>{const pe=new RegExp(`\\|\\s*${re}\\s*\\|\\s*([\\d.]+)k?\\s*\\|\\s*([\\d.]+)%`,"i"),Ve=_e.match(pe);if(Ve)return{tokens:Ve[1]+"k",percent:Ve[2]+"%"};const at=new RegExp(`${re}\\s+([\\d.]+)k?\\s+([\\d.]+)%`,"i"),ut=_e.match(at);return ut?{tokens:ut[1]+"k",percent:ut[2]+"%"}:null})("Messages"),He=me?parseInt(me[3]):0,ye=100-He,Re=()=>{n&&U.setContextModalAgentId(n)};return o.jsxs("div",{className:"output-line output-context-stats",style:{cursor:n?"pointer":"default"},onClick:Re,title:n?f("terminal:history.clickForContextStats"):void 0,children:[$&&o.jsxs("span",{className:"output-timestamp context-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{className:"context-debug-hash",children:["[",H,"]"]})]}),o.jsx("span",{className:"context-icon",children:"📊"}),o.jsx("span",{className:"context-label",children:f("terminal:history.contextLabel")}),o.jsx("div",{className:"context-bar",children:o.jsx("div",{className:"context-bar-fill",style:{width:`${He}%`}})}),o.jsx("span",{className:"context-tokens",children:me?`${me[1]}k/${me[2]}k`:"?"}),o.jsxs("span",{className:"context-free",children:["(",f("terminal:history.percentFree",{percent:ye.toFixed(0)}),")"]}),te&&o.jsx("span",{className:"context-msgs",children:f("terminal:history.msgsLabel",{tokens:te.tokens})})]})}if(!G&&(_.includes("<local-command-caveat>")||_.includes("<command-name>/context</command-name>")||_.includes("<command-name>/cost</command-name>")||_.includes("<command-name>/compact</command-name>")))return null;const K=C==="user"?Zx(_):null,q=Ge=>{if(!Ge)return null;let _e=Ge;if(_e.includes("<persisted-output>")){_e=_e.replace(/<\/?persisted-output>/g,"").trim();const Re=_e.match(/Preview \(first [^)]+\):\s*([\s\S]*)/);if(Re)_e=Re[1].trim();else{const re=_e.indexOf("{");re!==-1&&(_e=_e.slice(re))}}const me=Re=>{try{const re=JSON.parse(Re);if(re&&typeof re=="object"&&typeof re.output=="string")return re.output.split(`
|
|
142
|
-
`).filter(pe=>pe.length>0)}catch{}return null},De=me(_e);if(De)return De;const te=_e.indexOf("{"),He=_e.lastIndexOf("}");if(te!==-1&&He>te){const Re=me(_e.slice(te,He+1));if(Re)return Re}const ye=_e.match(/"output"\s*:\s*"([\s\S]*)/);if(ye){let Re=ye[1];const re=Re.match(/","(?:duration|exitCode|taskId|success)":/);re&&re.index!==void 0&&(Re=Re.slice(0,re.index)),Re=Re.replace(/\.\.\.\s*$/,"");try{Re=JSON.parse(`"${Re}"`)}catch{Re=Re.replace(/\\u([0-9a-fA-F]{4})/g,(Ve,at)=>String.fromCharCode(parseInt(at,16))).replace(/\\n/g,`
|
|
143
|
-
`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}const pe=Re.split(`
|
|
144
|
-
`).filter(Ve=>Ve.length>0);if(pe.length>0)return pe}return null};if(C==="tool_use"){const Ge=os[N||""]||os.default,_e=N?nT(N,f):"",me=e.toolInput?JSON.stringify(e.toolInput):_;if(a){let De=N&&me?sT(N,me):null;N==="Bash"&&De&&De.length>300&&(De=De.substring(0,297)+"...");const He=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(N||""),ye=De&&(He||De.startsWith("/")||De.includes("/")),Re=He&&ye&&i,re=N==="Bash"&&c,pe=D||De||"",Ve=re&&pe?oT(pe):null,at=re&&pe?lT(pe):null,ut=re&&pe?cT(pe):null,ue=re&&pe?uT(pe):null,X=()=>{if(Re&&De){if(N==="Edit"&&me)try{const Be=JSON.parse(me);if(Be.old_string!==void 0||Be.new_string!==void 0||Be.unified_diff!==void 0){i(De,{oldString:Be.old_string||"",newString:Be.new_string||"",operation:typeof Be.operation=="string"?Be.operation:void 0,unifiedDiff:typeof Be.unified_diff=="string"?Be.unified_diff:void 0});return}}catch{}if(N==="Read"&&me)try{const Be=JSON.parse(me);if(Be.offset!==void 0&&Be.limit!==void 0){i(De,{highlightRange:{offset:Be.offset,limit:Be.limit}});return}}catch{}i(De)}},se=()=>{re&&pe&&c(pe,E||f("tools:display.noOutputAvailable"))},ke=()=>{var Ie;if(!De)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(De,"bash")}});const Be=n?(Ie=U.getState().agents.get(n))==null?void 0:Ie.cwd:void 0;return iT(De).map((oe,he)=>{if(!oe.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(oe.text,"bash")}},`cmd-${he}`);const ne=Tp(oe.fileRef,Be);return o.jsx("span",{className:"clickable-path",onClick:Le=>{Le.stopPropagation(),i(ne.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:oe.text},`cmd-file-${he}`)})},J=re?f("tools:display.clickToViewOutput"):Re?f("tools:display.clickToViewFile"):void 0,we=/\bcurl\b[\s\S]*\/api\/exec\b/.test(pe);let We=null;if(we&&E){const Be=q(E);Be&&Be.length>0&&(We={output:Be})}if(N==="TodoWrite"&&me)return o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-todo-inline",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e}),o.jsx(fp,{content:me})]});if((N==="AskUserQuestion"||N==="AskFollowupQuestion")&&me){let Be=!1;try{const ie=JSON.parse(me);Be=Array.isArray(ie.questions)&&ie.questions.length>0}catch{}if(Be)return o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-ask-question-inline",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e}),o.jsx(TT,{content:me})]})}return N==="ExitPlanMode"&&me?o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-plan-inline",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e}),o.jsx(Gb,{content:me})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use output-tool-simple ${re?"clickable-bash":""} ${at?"bash-notify-use":""}`,onClick:re?se:void 0,style:re?{cursor:"pointer"}:void 0,title:re?f("tools:display.clickToViewOutput"):void 0,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e}),re&&at?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:se,title:at.commandBody,style:{cursor:"pointer"},children:[at.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:at.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),at.title&&o.jsx("span",{className:"bash-notify-title",children:at.title}),at.message&&o.jsx("span",{className:"bash-notify-message",children:at.message})]}):re&&ut?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:se,title:ut.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:ut.taskLabel})]}):re&&ue?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:se,title:ue.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${ue.status==="failed"?"status-failed":"status-completed"}`,children:ue.status==="failed"?"❌ report":"✅ report"}),ue.summary&&o.jsx("span",{className:"bash-report-task-summary",children:ue.summary})]}):re&&Ve?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:se,title:Ve.commandBody,style:{cursor:"pointer"},children:[Ve.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:Ve.shellPrefix}),o.jsx("span",{className:"bash-search-chip",children:"search"}),o.jsx("span",{className:"bash-search-term",children:Ve.searchTerm})]}):De&&o.jsxs("span",{className:`output-tool-param ${Re?"clickable-path":""}`,onClick:Re?X:void 0,title:J,style:Re?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[He&&ye&&(()=>{const Be=H5(De),ie=Be?Bp(Be):"";return ie?o.jsx("img",{className:"output-tool-file-icon",src:ie,alt:""}):null})(),re?ke():De]})]}),we&&We&&o.jsx("div",{className:"exec-task-output-container",children:o.jsx("div",{className:"exec-task-inline status-completed",children:(()=>{const Be=`history-curl-${j}`,ie=h.has(Be),Ie=We.output.slice(-6),oe=We.output.length>6,he=ie?We.output:Ie;return o.jsxs(o.Fragment,{children:[oe&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>m(ne=>{const Le=new Set(ne);return Le.has(Be)?Le.delete(Be):Le.add(Be),Le}),children:[o.jsx("span",{className:"exec-task-toggle-arrow",children:ie?"▼":"▶"}),o.jsx("span",{className:"exec-task-toggle-text",children:ie?f("tools:skills.hide"):f("tools:skills.showAll",{count:We.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsx("pre",{className:"exec-task-inline-output",children:he.map((ne,Le)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:Sl(ne)}},Le))})})]})})()})})]})}return N==="Edit"&&me?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(jT,{content:me,onFileClick:i})})]}):N==="Read"&&me?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(NT,{content:me,onFileClick:i})})]}):N==="TodoWrite"&&me?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(fp,{content:me})})]}):N==="ExitPlanMode"&&me?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(Gb,{content:me})})]}):N==="ToolSearch"&&me?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(pp,{content:me,agentName:W})})]}):me&&MT(me)?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(pp,{content:me,agentName:W})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),W&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${W}`,children:W}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:_e})]}),me&&o.jsx("div",{className:"output-line output-tool-input",children:o.jsx("pre",{className:"output-input-content",children:ll(me,s)})})]})}if(C==="tool_result"){if(a)return null;const Ge=_.toLowerCase().includes("error")||_.toLowerCase().includes("failed");if(N==="Bash"){const _e=Ge||_.toLowerCase().includes("command not found")||_.toLowerCase().includes("permission denied"),me=_.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${_e?"is-error":""}`,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsxs("div",{className:"bash-output-container",children:[o.jsxs("div",{className:"bash-output-header",children:[o.jsx("span",{className:"bash-output-icon",children:"$"}),o.jsx("span",{className:"bash-output-label",children:f("tools:display.terminalOutput")}),me&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:Sl(_)}})]})]})}return o.jsxs("div",{className:`output-line output-tool-result ${Ge?"is-error":""}`,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsx("span",{className:"output-result-icon",children:Ge?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:ll(_,s)})]})}const xe=C==="user",de=!xe&&/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(_),Z=xe?"history-line history-user":de?"history-line history-system":"history-line history-assistant",be=de?f("tools:display.system"):I;if(xe&&K){const _e=ey(K.userMessage).userMessage,me=pT(_e.trim());if(me.isDelegatedTask)return o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsx("span",{className:"history-content",children:o.jsx(yT,{bossName:me.bossName,bossId:me.bossId,taskCommand:me.taskCommand})})]});const De=hT(_e.trim());if(De.isTaskReport)return o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsxs("span",{className:"history-content",children:[K.hasContext&&K.context&&o.jsx(dp,{context:K.context,onFileClick:i?He=>i(He):void 0},`boss-${j||_.slice(0,50)}`),o.jsx(vT,{agentName:De.agentName,agentId:De.agentId,status:De.status,originalTask:De.originalTask,summary:De.summary})]})]});const te=mT(_e.trim());return te.hasNotification?o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsxs("span",{className:"history-content",children:[o.jsx(wT,{agentId:te.agentId,status:te.status}),te.contentWithoutNotification&&o.jsx("span",{className:"user-prompt-text",children:s?o.jsx("div",{children:ll(te.contentWithoutNotification,s)}):pu(te.contentWithoutNotification,r,i)})]})]}):o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsx("span",{className:"history-role history-role-chip",children:f("common:labels.you")}),o.jsxs("span",{className:"history-content user-prompt-text",children:[K.hasContext&&K.context&&o.jsx(dp,{context:K.context,onFileClick:i?He=>i(He):void 0},`boss-${j||_.slice(0,50)}`),s?o.jsx("div",{children:ll(_e,s)}):pu(_e,r,i)]})]})}const je=gT(_),ce=bT(je.contentWithoutBlock);return je.hasDelegation||ce.hasWorkPlan?o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsxs("span",{className:"history-role",children:[!de&&R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon",title:R==="codex"?f("terminal:history.codexAgent"):R==="opencode"?"OpenCode Agent":f("terminal:history.claudeAgent")}),be]}),o.jsxs("span",{className:"history-content markdown-content",children:[s?o.jsx("div",{children:ll(ce.contentWithoutBlock,s)}):hl(ce.contentWithoutBlock,r,i),ce.hasWorkPlan&&ce.workPlan&&o.jsx(kT,{workPlan:ce.workPlan}),je.hasDelegation&&je.delegations.map((Ge,_e)=>o.jsx(xT,{delegation:Ge},`del-${_e}`))]}),o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ge=>{Ge.stopPropagation(),P(_)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ge=>{Ge.stopPropagation(),d(_)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]}):o.jsxs("div",{className:Z,children:[$&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${H}`,children:[$," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",H,"]"]})]}),o.jsxs("span",{className:`history-role ${xe?"history-role-chip":""}`,children:[!xe&&!de&&R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon",title:R==="codex"?f("terminal:history.codexAgent"):R==="opencode"?"OpenCode Agent":f("terminal:history.claudeAgent")}),xe?f("common:labels.you"):be]}),o.jsx("span",{className:`history-content ${xe?"user-prompt-text":"markdown-content"}`,children:s?o.jsx("div",{children:ll(_,s)}):xe?pu(_,r,i):hl(_,r,i)}),!xe&&o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ge=>{Ge.stopPropagation(),P(_)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ge=>{Ge.stopPropagation(),d(_)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]})});function W5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}const q5=b.memo(function({entries:e,isWorking:n}){const[s,a]=b.useState(!1),r=b.useRef(null);b.useEffect(()=>{n&&s&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e.length,n,s]);const i=s?e:e.slice(-3);return o.jsxs("div",{className:"subagent-stream-panel",children:[o.jsxs("div",{className:"subagent-stream-toggle",onClick:()=>a(!s),children:[o.jsx("span",{className:"stream-toggle-arrow",children:s?"▼":"▶"}),o.jsx("span",{children:s?"Hide stream":`Stream (${e.length} events)`})]}),(s||e.length<=3)&&o.jsxs("div",{className:"subagent-stream-list",ref:r,children:[i.map((c,d)=>o.jsxs("div",{className:`subagent-stream-entry entry-${c.type}${c.isError?" entry-error":""}`,children:[c.type==="text"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:"🤖"}),o.jsx("span",{className:"stream-entry-text",children:c.text})]}),c.type==="tool_use"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:os[c.toolName||""]||os.default}),o.jsx("span",{className:"stream-entry-tool",children:c.toolName}),c.toolKeyParam&&o.jsx("span",{className:"stream-entry-param",children:c.toolKeyParam})]}),c.type==="tool_result"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:c.isError?"✗":"✓"}),o.jsx("span",{className:"stream-entry-result",children:c.resultPreview})]})]},d)),n&&o.jsx("span",{className:"subagent-cursor",children:"▌"})]})]})});function V5(t){const e=t.text.slice(0,50),n=`${t.isUserPrompt?"U":""}${t.isStreaming?"S":"F"}${t.isDelegation?"D":""}`;let s=0;for(let a=0;a<e.length;a++)s=(s<<5)-s+e.charCodeAt(a),s|=0;return`${n}:${(s>>>0).toString(16).slice(0,6)}`}function G5({output:t,debugHash:e,agentId:n,onClose:s}){const{t:a}=pt(["tools","common"]),r=b.useRef(null);b.useEffect(()=>{const C=k=>{r.current&&!r.current.contains(k.target)&&s()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const i=C=>{navigator.clipboard.writeText(C)},d=new Date(t.timestamp).toISOString();let f="assistant";t.isUserPrompt?f="user":t.text.startsWith("Using tool:")?f="tool_use":t.text.startsWith("Tool input:")?f="tool_input":t.text.startsWith("Tool result:")?f="tool_result":t.text.startsWith("Bash output:")?f="bash_output":t.text.startsWith("Tokens:")||t.text.startsWith("Cost:")?f="stats":t.text.startsWith("[thinking]")?f="thinking":t.skillUpdate&&(f="skill_update");const h=t.uuid?"server":t.isUserPrompt?"client (user)":"client/system",m=()=>{const C={uuid:t.uuid||null,hash:e,type:f,timestamp:t.timestamp,iso:d,agentId:n||null,isStreaming:t.isStreaming,source:h,textLen:t.text.length,textPreview:t.text.slice(0,120)};t.isDelegation&&(C.isDelegation=!0),t.toolName&&(C.toolName=t.toolName),t.toolInput&&(C.toolInput=t.toolInput),t.toolOutput&&(C.toolOutputLen=t.toolOutput.length),t.subagentName&&(C.subagentName=t.subagentName),t.isUserPrompt&&(C.isUserPrompt=!0),t.skillUpdate&&(C.skillUpdate=t.skillUpdate),navigator.clipboard.writeText(JSON.stringify(C,null,2))},x=n?U.getState().agentOutputs.get(n):null,y=x?x.indexOf(t):-1,v=x?x.length:0,S=[{label:"UUID",value:t.uuid||"(none)",mono:!0},{label:"Hash",value:e,mono:!0},{label:"Type",value:f},{label:"Source",value:h},{label:"Agent",value:n||"(none)",mono:!0},{label:"Time",value:d,mono:!0},{label:"Epoch",value:String(t.timestamp),mono:!0},{label:"Index",value:y>=0?`${y} / ${v}`:"(unknown)",mono:!0},{label:"Text",value:`[${t.text.length} chars] ${t.text.slice(0,120)}`,mono:!0}];return t.isStreaming&&S.push({label:"State",value:"streaming"}),t.isDelegation&&S.push({label:"Flag",value:"delegation"}),t.toolName&&S.push({label:"Tool",value:t.toolName}),t.toolInput&&S.push({label:"ToolIn",value:JSON.stringify(t.toolInput).slice(0,200),mono:!0}),t.toolOutput&&S.push({label:"ToolOut",value:`[${t.toolOutput.length} chars] ${t.toolOutput.slice(0,120)}`,mono:!0}),t.subagentName&&S.push({label:"Subagent",value:t.subagentName}),o.jsxs("div",{className:"msg-meta-tooltip",ref:r,children:[o.jsxs("div",{className:"msg-meta-tooltip__header",children:[o.jsx("span",{children:a("tools:metadata.messageInfo")}),o.jsxs("div",{className:"msg-meta-tooltip__actions",children:[o.jsx("button",{className:"msg-meta-tooltip__copy-all",onClick:m,title:a("tools:metadata.copyAllAsJSON"),children:"JSON"}),o.jsx("button",{className:"msg-meta-tooltip__close",onClick:s,children:"×"})]})]}),o.jsx("div",{className:"msg-meta-tooltip__body",children:S.map(({label:C,value:k,mono:N})=>o.jsxs("div",{className:"msg-meta-tooltip__row",children:[o.jsx("span",{className:"msg-meta-tooltip__label",children:C}),o.jsx("span",{className:`msg-meta-tooltip__value ${N?"mono":""}`,onClick:()=>i(k),title:a("tools:metadata.clickToCopy"),children:k})]},C))})]})}function Fn({output:t,timeStr:e,debugHash:n,agentId:s}){const{t:a}=pt(["tools"]),[r,i]=b.useState(!1),c=b.useCallback(f=>{f.stopPropagation(),i(h=>!h)},[]),d=b.useCallback(()=>i(!1),[]);return o.jsxs("span",{className:"output-timestamp-wrapper",children:[o.jsx("span",{className:"output-timestamp output-timestamp--clickable",onClick:c,title:a("tools:metadata.clickForMessageInfo"),children:e}),r&&o.jsx(G5,{output:t,debugHash:n,agentId:s||null,onClose:d})]})}const sy=b.memo(function({output:e,agentId:n,execTasks:s=[],subagents:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var ye,Re,re;const{t:f}=pt(["tools","common"]),h=Oj(),m=Br(),[x,y]=b.useState(new Set),{text:v,isStreaming:S,isUserPrompt:C,timestamp:k,skillUpdate:N,_toolKeyParam:j,_editData:E,_todoInput:D,_bashOutput:_,_bashCommand:P,_isRunning:O}=e,T=su(v,h),M=e.toolName,R=e.toolInput,I=e.toolOutput;let z=j;if(!z&&R&&typeof R=="object"){const pe=R;if(M==="Glob"&&pe.pattern)z=pe.path?`${pe.pattern} in ${pe.path}`:pe.pattern;else if(M==="Grep"&&pe.pattern)z=pe.path?`"${pe.pattern}" in ${pe.path}`:`"${pe.pattern}"`;else if((M==="AskUserQuestion"||M==="AskFollowupQuestion")&&pe.questions){const Ve=pe.questions;Array.isArray(Ve)&&((ye=Ve[0])!=null&&ye.question)&&(z=Ve[0].question)}else if((M==="Task"||M==="Agent")&&typeof pe.description=="string"){const Ve=pe.description,at=pe.subagent_type;z=at?`[${at}] ${Ve}`:Ve}else if(M==="ExitPlanMode"||M==="EnterPlanMode"){const Ve=pe.allowedPrompts;Array.isArray(Ve)&&Ve.length>0?z=Ve.map(at=>at.prompt||at.tool||"").filter(Boolean).join(", "):M==="ExitPlanMode"&&typeof pe.plan=="string"&&pe.plan.trim().length>0?z=pe.plan.trim():z=M==="ExitPlanMode"?"Plan ready":"Entering plan mode"}else if(M==="spawn_agent"||M==="send_input"||M==="wait"){const Ve=pe.prompt,at=pe.receiver_thread_ids;Ve?z=Ve.length>100?Ve.slice(0,97)+"...":Ve:at&&at.length>0?z=`waiting on ${at.length} thread(s)`:M==="wait"&&(z="waiting for subagents")}else if(M==="TodoWrite"&&Array.isArray(pe.todos)){const Ve=pe.todos,at=Ve.filter(se=>se.status==="completed").length,ut=Ve.filter(se=>se.status==="in_progress").length,ue=Ve.filter(se=>se.status==="pending").length,X=[];at>0&&X.push(`${at} done`),ut>0&&X.push(`${ut} active`),ue>0&&X.push(`${ue} pending`),z=`${Ve.length} items (${X.join(", ")})`}else if(z=pe.file_path||pe.path||pe.notebook_path||pe.command||pe.pattern||pe.url||pe.query||pe.description,!z)try{const Ve=JSON.stringify(pe);Ve&&Ve!=="{}"&&(z=Ve.length>200?Ve.slice(0,197)+"...":Ve)}catch{}}const W=n?(Re=U.getState().agents.get(n))==null?void 0:Re.name:null,$=e.subagentName||W,F=n?(re=U.getState().agents.get(n))==null?void 0:re.provider:void 0,H=F==="codex"?"Codex":F==="opencode"?"OpenCode":"Claude",[V,G]=b.useState(!1),[B,Q]=b.useState(!1),{toggle:K,speaking:q}=ny(),xe=cp(k||Date.now()),de=V5(e);if(N)return o.jsxs("div",{className:"output-line output-skill-update",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"skill-update-icon",children:"🔄"}),o.jsx("span",{className:"skill-update-label",children:f("tools:skills.skillsUpdated")}),o.jsx("span",{className:"skill-update-list",children:N.skills.map((pe,Ve)=>o.jsxs("span",{className:"skill-update-item",title:pe.description,children:[pe.name,Ve<N.skills.length-1?", ":""]},pe.name))})]});if(T.startsWith("This session is being continued from a previous conversation that ran out of context"))return o.jsxs("div",{className:`output-line output-session-continuation ${V?"expanded":""}`,onClick:()=>G(!V),title:"Click to expand/collapse",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"session-continuation-icon",children:"🔗"}),o.jsx("span",{className:"session-continuation-label",children:f("tools:display.sessionContinued")}),o.jsx("span",{className:"session-continuation-toggle",children:V?"▼":"▶"}),V&&o.jsx("div",{className:"session-continuation-content",children:hl(T,r,i)})]});const be=n?U.getLastDelegationReceived(n):null;if(C){const pe=T.trim();if(pe==="/context"||pe==="/cost"||pe==="/compact")return null;const Ve=Zx(T),at=ey(Ve.userMessage),ut=at.userMessage,ue=pT(ut.trim());if(ue.isDelegatedTask)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(yT,{bossName:ue.bossName,bossId:ue.bossId,taskCommand:ue.taskCommand})]});const X=hT(ut.trim());if(X.isTaskReport)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),Ve.hasContext&&Ve.context&&o.jsx(dp,{context:Ve.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),o.jsx(vT,{agentName:X.agentName,agentId:X.agentId,status:X.status,originalTask:X.originalTask,summary:X.summary})]});const se=mT(ut.trim());if(se.hasNotification)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(wT,{agentId:se.agentId,status:se.status}),se.contentWithoutNotification&&o.jsx("span",{className:"history-content user-prompt-text",children:pu(se.contentWithoutNotification,r,i)})]});const ke=be&&T.trim()===be.taskCommand.trim();return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),ke?o.jsx(A5,{bossName:be.bossName,taskCommand:be.taskCommand}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"output-role output-role-chip output-role-user-chip",children:f("common:labels.you")}),Ve.hasContext&&Ve.context&&o.jsx(dp,{context:Ve.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),pu(at.userMessage,r,i)]})]})}if(T.startsWith("Using tool:")){const pe=T.replace("Using tool:","").trim(),Ve=nT(pe,f),at=os[pe]||os.default,ut=new Set(["Bash","Read","Write","Edit","Glob","Grep","NotebookEdit","Task","Agent","TodoWrite","AskUserQuestion","AskFollowupQuestion","ExitPlanMode","EnterPlanMode","web_search","ToolSearch","spawn_agent","send_input","wait"]),ue=D||(pe==="TodoWrite"&&R&&typeof R=="object"&&Array.isArray(R.todos)?JSON.stringify(R):void 0);if(pe==="TodoWrite"&&ue)return o.jsxs("div",{className:`output-line output-tool-use output-todo-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-icon",children:at}),o.jsx("span",{className:"output-tool-name",children:Ve}),o.jsx(fp,{content:ue})]});const X=(pe==="AskUserQuestion"||pe==="AskFollowupQuestion")&&R&&typeof R=="object"&&Array.isArray(R.questions)?JSON.stringify(R):void 0;if((pe==="AskUserQuestion"||pe==="AskFollowupQuestion")&&X)return o.jsxs("div",{className:`output-line output-tool-use output-ask-question-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-icon",children:at}),o.jsx("span",{className:"output-tool-name",children:Ve}),o.jsx(TT,{content:X})]});const se=pe==="ExitPlanMode"&&R&&typeof R=="object"&&typeof R.plan=="string"?JSON.stringify(R):void 0;if(pe==="ExitPlanMode"&&se)return o.jsxs("div",{className:`output-line output-tool-use output-plan-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-icon",children:at}),o.jsx("span",{className:"output-tool-name",children:Ve}),o.jsx(Gb,{content:se})]});const ke=pe==="ToolSearch"&&R&&typeof R=="object"?JSON.stringify(R):void 0;if(pe==="ToolSearch"&&ke)return o.jsxs("div",{className:`output-line output-tool-use output-toolsearch-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"}),o.jsx(pp,{content:ke,agentName:$})]});if(["spawn_agent","send_input","wait"].includes(pe)){const mt=R,ct=mt==null?void 0:mt.prompt,xt=mt==null?void 0:mt.receiver_thread_ids,Dt=ct?ct.length>120?ct.slice(0,117)+"...":ct:void 0,Sn=pe==="spawn_agent"?"Spawn Agent":pe==="send_input"?"Send Input":"Wait";return o.jsxs("div",{className:`output-line output-tool-use output-collab-tool output-collab-${pe} ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-icon",children:at}),o.jsx("span",{className:"output-tool-name collab-tool-name",children:Sn}),xt&&xt.length>0&&o.jsx("span",{className:"collab-thread-ids",children:xt.map(cn=>cn.slice(-8)).join(", ")}),Dt&&o.jsx("span",{className:"collab-prompt-preview",title:ct,children:Dt})]})}const we=R&&typeof R=="object"?JSON.stringify(R,null,2):void 0,Be=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(pe),ie=R&&typeof R=="object"?R:null,Ie=ie?(typeof ie.file_path=="string"?ie.file_path:void 0)||(typeof ie.path=="string"?ie.path:void 0)||(typeof ie.notebook_path=="string"?ie.notebook_path:void 0):void 0,oe=j||Ie,he=!!oe&&(Be||oe.startsWith("/")||oe.includes("/")),ne=Be&&he&&i,Le=pe==="Edit"&&ie?{oldString:String(ie.old_string??""),newString:String(ie.new_string??""),operation:typeof ie.operation=="string"?ie.operation:void 0}:void 0,Qe=pe==="Read"&&ie&&typeof ie.offset=="number"&&typeof ie.limit=="number"?{highlightRange:{offset:ie.offset,limit:ie.limit}}:void 0,$e=pe==="Bash"&&c,nt=!!_||!!I,ot=P||j||z||"",st=rT(ot),lt=/\bcurl\b[\s\S]*\/api\/exec\b/.test(ot),it=k?new Date(k).getTime():0,ht=lt?aT(ot):null,jt=lt&&s.length>0?(()=>{if(ht){const ct=s.filter(xt=>xt.command===ht);if(ct.length>0)return[ct.reduce((Dt,Sn)=>Sn.startedAt>Dt.startedAt?Sn:Dt)]}const mt=s.filter(ct=>ct.startedAt>=it&&ct.startedAt<=it+5e3);return mt.length>0?[mt.reduce((xt,Dt)=>Dt.startedAt>xt.startedAt?Dt:xt)]:[]})():[],ge=!!($e&<&&jt.length>0),Te=(pe==="Task"||pe==="Agent")&&a&&e.uuid?(()=>{for(const[,mt]of a)if(mt.toolUseId===e.uuid)return mt})():void 0,Ye=$e&&ot?oT(ot):null,tt=$e&&ot?lT(ot):null,Nt=$e&&ot?cT(ot):null,zt=$e&&ot?uT(ot):null,Pt=mt=>{if(mt.stopPropagation(),ne&&oe){const ct=E||Le;pe==="Edit"&&ct?i(oe,ct):pe==="Read"&&Qe?i(oe,Qe):i(oe)}},It=()=>{if($e&&ot){const mt=O?f("tools:display.running"):_||f("tools:display.noOutputCaptured");c(ot,mt)}},Vt=()=>{var xt;if(!st)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(st,"bash")}});const mt=n?(xt=U.getState().agents.get(n))==null?void 0:xt.cwd:void 0;return iT(st).map((Dt,Sn)=>{if(!Dt.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(Dt.text,"bash")}},`cmd-${Sn}`);const cn=Tp(Dt.fileRef,mt);return o.jsx("span",{className:"clickable-path",onClick:ls=>{ls.stopPropagation(),i(cn.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:Dt.text},`cmd-file-${Sn}`)})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use ${S?"output-streaming":""} ${$e?"bash-clickable":""} ${tt?"bash-notify-use":""}`,onClick:$e?It:void 0,title:$e?f("tools:display.clickToViewOutput"):void 0,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-icon",children:at}),o.jsx("span",{className:"output-tool-name",children:Ve}),$e&&ot&&(tt?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:It,title:tt.commandBody,style:{cursor:"pointer"},children:[tt.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:tt.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),tt.title&&o.jsx("span",{className:"bash-notify-title",children:tt.title}),tt.message&&o.jsx("span",{className:"bash-notify-message",children:tt.message})]}):Nt?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:It,title:Nt.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:Nt.taskLabel})]}):zt?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:It,title:zt.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${zt.status==="failed"?"status-failed":"status-completed"}`,children:zt.status==="failed"?"❌ report":"✅ report"}),zt.summary&&o.jsx("span",{className:"bash-report-task-summary",children:zt.summary})]}):Ye?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:It,title:Ye.commandBody,style:{cursor:"pointer"},children:[Ye.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:Ye.shellPrefix}),o.jsx("span",{className:"bash-search-chip",children:"search"}),o.jsx("span",{className:"bash-search-term",children:Ye.searchTerm})]}):o.jsx("span",{className:"output-tool-param bash-command",onClick:It,title:f("tools:display.clickToViewOutput"),style:{cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em",color:"#888"},children:Vt()})),!$e&&z&&o.jsxs("span",{className:`output-tool-param ${ne?"clickable-path":""}`,onClick:ne?Pt:void 0,title:ne?f(pe==="Edit"&&(E||Le)?"tools:display.clickToViewDiff":"tools:display.clickToViewFile"):void 0,style:ne?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[Be&&he&&(()=>{const mt=W5(oe),ct=mt?Bp(mt):"";return ct?o.jsx("img",{className:"output-tool-file-icon",src:ct,alt:""}):null})(),z]}),$e&&!O&&o.jsx("span",{className:"bash-output-indicator",children:s.some(mt=>mt.status==="completed")?"✅":nt?"📄":"💻"}),S&&o.jsx("span",{className:"output-tool-loading",children:"..."})]}),!ut.has(pe)&&we&&o.jsxs("div",{className:"output-line output-tool-input output-tool-input-fallback",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(kA,{toolName:pe,content:we})]}),ge&&o.jsx("div",{className:"exec-task-output-container",children:jt.map(mt=>{const ct=x.has(mt.taskId),xt=mt.output.slice(-6),Dt=mt.output.length>6,Sn=ct?mt.output:xt;return o.jsxs("div",{className:`exec-task-inline status-${mt.status}`,children:[Dt&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>y(cn=>{const ls=new Set(cn);return ls.has(mt.taskId)?ls.delete(mt.taskId):ls.add(mt.taskId),ls}),children:[o.jsx("span",{className:"exec-task-toggle-arrow",children:ct?"▼":"▶"}),o.jsx("span",{className:"exec-task-toggle-text",children:ct?f("tools:skills.hide"):f("tools:skills.showAll",{count:mt.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsxs("pre",{className:"exec-task-inline-output",children:[Sn.map((cn,ls)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:Sl(cn)}},ls)),mt.status==="running"&&o.jsx("span",{className:"exec-task-cursor",children:"▌"})]})})]},mt.taskId)})}),Te&&(Te.status==="working"||Te.activities&&Te.activities.length>0||Te.stats)&&o.jsx("div",{className:"subagent-activity-container",children:o.jsxs("div",{className:`subagent-activity-inline status-${Te.status}`,children:[o.jsxs("div",{className:"subagent-activity-header",children:[o.jsx("span",{className:"subagent-type-badge",children:Te.subagentType}),o.jsx("span",{className:"subagent-elapsed",children:Te.completedAt?`${((Te.completedAt-Te.startedAt)/1e3).toFixed(0)}s`:`${((Date.now()-Te.startedAt)/1e3).toFixed(0)}s`})]}),Te.activities&&Te.activities.length>0&&o.jsxs("div",{className:"subagent-activity-list",children:[Te.activities.slice(-8).map((mt,ct)=>o.jsxs("div",{className:"subagent-activity-item",children:[o.jsx("span",{className:"activity-icon",children:os[mt.toolName]||os.default}),o.jsx("span",{className:"activity-tool",children:mt.toolName}),o.jsx("span",{className:"activity-desc",children:mt.description.length>80?mt.description.slice(0,77)+"...":mt.description})]},ct)),Te.status==="working"&&o.jsx("span",{className:"subagent-cursor",children:"▌"})]}),Te.stats&&o.jsxs("div",{className:"subagent-stats-bar",children:[o.jsxs("span",{children:[(Te.stats.durationMs/1e3).toFixed(0),"s"]}),o.jsxs("span",{children:[(Te.stats.tokensUsed/1e3).toFixed(1),"K tokens"]}),o.jsxs("span",{children:[Te.stats.toolUseCount," tools"]})]}),Te.streamEntries&&Te.streamEntries.length>0&&o.jsx(q5,{entries:Te.streamEntries,isWorking:Te.status==="working"})]})})]})}if(T.startsWith("Tool input:")){const pe=T.replace("Tool input:","").trim();if(MT(pe))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(pp,{content:pe,agentName:$})]});try{const Ve=JSON.parse(pe);if(Ve.file_path&&(Ve.old_string!==void 0||Ve.new_string!==void 0))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(jT,{content:pe,onFileClick:i})]});if(Ve.file_path&&Ve.old_string===void 0&&Ve.new_string===void 0)return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(NT,{content:pe,onFileClick:i})]});if(Array.isArray(Ve.todos))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(fp,{content:pe})]})}catch{}return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(kA,{toolName:M||"UnknownTool",content:pe})]})}if(T.startsWith("Tool result:")){const pe=T.replace("Tool result:","").trim(),Ve=pe.toLowerCase().includes("error")||pe.toLowerCase().includes("failed");return o.jsxs("div",{className:`output-line output-tool-result ${Ve?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"output-result-icon",children:Ve?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:pe})]})}if(T.startsWith("Bash output:")){const pe=T.replace("Bash output:","").trim(),Ve=pe.toLowerCase().includes("error")||pe.toLowerCase().includes("failed")||pe.toLowerCase().includes("command not found")||pe.toLowerCase().includes("permission denied"),at=pe.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${Ve?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsxs("div",{className:"bash-output-container",children:[o.jsxs("div",{className:"bash-output-header",children:[o.jsx("span",{className:"bash-output-icon",children:"$"}),o.jsx("span",{className:"bash-output-label",children:f("tools:display.terminalOutput")}),at&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:Sl(pe)}})]})]})}if(T.includes("## Context Usage")||T.includes("Context Usage")&&T.includes("Tokens:")&&T.includes("Free space")||T.includes("<local-command-caveat>")||T.includes("<command-name>/context</command-name>")||T.includes("<command-name>/cost</command-name>")||T.includes("<command-name>/compact</command-name>"))return null;const ce=T.startsWith("[thinking]"),Ee=ce?T.replace(/^\[thinking\]\s*/,""):"",ze=ce?(Ee||"(processing)").replace(/\*+/g,"").replace(/\s+/g," ").trim():"",Ge=/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(T),_e=!!(e.subagentName&&I&&/^[✅❌]\s*Subagent\s/.test(T));let me="output-line",De=!0,te=!1;if(T.startsWith("Session started:")||T.startsWith("Session initialized")?(me+=" output-session",De=!1):T.startsWith("Tokens:")||T.startsWith("Cost:")?(me+=" output-stats",De=!1):ce?(me+=" output-thinking output-tool-use",De=!1):T.startsWith("[raw]")?(me+=" output-raw",De=!1):Ge?me+=" output-text output-system markdown-content":(me+=" output-text output-claude markdown-content",te=!0),S&&(me+=" output-streaming"),te&&!S){const pe=gT(T),Ve=bT(pe.contentWithoutBlock);if(pe.hasDelegation||Ve.hasWorkPlan)return o.jsxs("div",{className:me,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsxs("span",{className:"output-role",children:[F&&o.jsx("img",{src:F==="codex"?"/assets/codex.png":F==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:F==="codex"?"Codex Agent":F==="opencode"?"OpenCode Agent":"Claude Agent"}),H]}),o.jsx("div",{className:"markdown-content",children:hl(Ve.contentWithoutBlock,r,i)}),Ve.hasWorkPlan&&Ve.workPlan&&o.jsx(kT,{workPlan:Ve.workPlan}),pe.hasDelegation&&pe.delegations.map((at,ut)=>o.jsx(xT,{delegation:at},`del-${ut}`)),o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:at=>{at.stopPropagation(),K(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:at=>{at.stopPropagation(),d(I||T)},title:"View as Markdown",children:"📄"})]})]})}const He=te?H:Ge?f("tools:display.system"):null;return o.jsxs("div",{className:me,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),He&&o.jsxs("span",{className:"output-role",children:[te&&F&&o.jsx("img",{src:F==="codex"?"/assets/codex.png":F==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:F==="codex"?"Codex Agent":F==="opencode"?"OpenCode Agent":"Claude Agent"}),He]}),De?o.jsx("div",{className:"markdown-content",children:hl(T,r,i)}):ce?o.jsxs(o.Fragment,{children:[$&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${$}`,children:$}),o.jsx("span",{className:"output-tool-name output-thinking-label",children:f(F==="codex"?"tools:display.codexThinking":"tools:display.thinking")}),o.jsx("span",{className:"output-tool-param output-thinking-content",title:ze,children:ze})]}):T,_e&&I&&o.jsxs("div",{className:"subagent-result-section",children:[o.jsxs("button",{className:"subagent-result-toggle",onClick:pe=>{pe.stopPropagation(),Q(!B)},children:[o.jsx("span",{className:"subagent-result-arrow",children:B?"▼":"▶"}),B?"Hide result":"Show result"]}),B&&o.jsx("div",{className:"subagent-result-content markdown-content",children:hl(I,r,i)})]}),te&&!S&&o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:pe=>{pe.stopPropagation(),K(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:pe=>{pe.stopPropagation(),d(I||T)},title:"View as Markdown",children:"📄"})]})]})}),cl={user:60,assistant:120,tool_use:40,tool_result:80,default:60};function Y5(t){var n,s;if("type"in t)return cl[t.type]||cl.default;const e=t;return e.isUserPrompt?cl.user:(n=e.text)!=null&&n.startsWith("Using tool:")?cl.tool_use:(s=e.text)!=null&&s.startsWith("Tool result:")?cl.tool_result:cl.assistant}const K5=b.memo(function({item:e,isHistory:n,agentId:s,execTasks:a,subagents:r,simpleView:i,isSelected:c,messageIndex:d,searchHighlight:f,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y}){return o.jsx("div",{"data-message-index":d,className:`message-nav-wrapper ${c?"message-selected":""}`,children:n?o.jsx(DT,{message:e,agentId:s,simpleView:i,highlight:f,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y}):o.jsx(sy,{output:e,agentId:s,execTasks:a,subagents:r,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y})})}),Q5=b.memo(function({historyMessages:e,liveOutputs:n,agentId:s,execTasks:a=[],subagents:r,viewMode:i,searchHighlight:c,searchActiveIndex:d,selectedMessageIndex:f,isMessageSelected:h,onImageClick:m,onFileClick:x,onBashClick:y,onViewMarkdown:v,scrollContainerRef:S,onScrollTopReached:C,isLoadingMore:k,hasMore:N,shouldAutoScroll:j,onUserScroll:E,pinToBottom:D=!1,onPinCancel:_,isLoadingHistory:P}){const O=b.useMemo(()=>[...e,...n],[e,n]),T=e.length,M=b.useRef(!1),R=b.useRef(O.length),I=b.useRef(!1),z=b.useRef(O.length);z.current=O.length;const W=b.useRef(0),$=p1({count:O.length,getScrollElement:()=>S.current,estimateSize:Q=>Y5(O[Q]),overscan:10,initialRect:{width:500,height:800},measureElement:Q=>Q.getBoundingClientRect().height});b.useEffect(()=>()=>{$.elementsCache.clear()},[$]);const F=b.useCallback(()=>{const Q=S.current;if(!Q)return;const K=z.current;K<=0||($.scrollToIndex(K-1,{align:"end"}),Q.scrollTop=Q.scrollHeight)},[S,$]);b.useLayoutEffect(()=>{D&&(P||O.length!==0&&(M.current=!0,I.current=!0,F()))},[D,P,O.length,F]),b.useEffect(()=>{if(!D){M.current=!1,I.current=!1;return}if(P||O.length===0)return;let Q;const K=()=>{M.current=!0,F(),Q=requestAnimationFrame(K)};return Q=requestAnimationFrame(K),()=>cancelAnimationFrame(Q)},[D,P,O.length,F]),b.useEffect(()=>{if(j&&O.length!==0){if(O.length<=R.current){R.current=O.length;return}R.current=O.length,M.current=!0,F(),requestAnimationFrame(()=>{M.current=!1})}},[O.length,j,F]);const H=$.getTotalSize();b.useEffect(()=>{const Q=W.current;W.current=H,j&&(D||H<=Q||H-Q<2||(M.current=!0,F(),requestAnimationFrame(()=>{M.current=!1})))},[H,j,D,F]);const V=b.useCallback(()=>{if(!S.current)return;const{scrollTop:Q,scrollHeight:K,clientHeight:q}=S.current;D&&!M.current&&(_==null||_()),!(K-Q-q<150)&&!M.current&&!I.current&&E&&E(),Q<200&&N&&!k&&C&&C()},[N,k,C,E,S,D,_]);b.useEffect(()=>{const Q=S.current;if(Q)return Q.addEventListener("scroll",V,{passive:!0}),()=>Q.removeEventListener("scroll",V)},[V,S]),b.useEffect(()=>{const Q=S.current;if(!Q)return;const K=new ResizeObserver(()=>{M.current=!0,Q.dispatchEvent(new Event("scroll")),requestAnimationFrame(()=>{M.current=!1})});return K.observe(Q),()=>K.disconnect()},[S]),b.useEffect(()=>{if(f!==null&&f>=0&&f<O.length){M.current=!0,$.scrollToIndex(f,{align:"center"});const Q=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(Q)}},[f,$,O.length]),b.useEffect(()=>{if(d!=null&&d>=0&&d<O.length){M.current=!0,$.scrollToIndex(d,{align:"center"});const Q=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(Q)}},[d,$,O.length]);const G=$.getVirtualItems(),B=i!=="advanced";return o.jsx("div",{style:{height:`${$.getTotalSize()}px`,width:"100%",position:"relative"},children:G.map(Q=>{const K=O[Q.index],q=Q.index<T;return o.jsx("div",{"data-index":Q.index,ref:$.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Q.start}px)`},children:o.jsx(K5,{item:K,isHistory:q,agentId:s,execTasks:a,subagents:r,simpleView:B,isSelected:h(Q.index),messageIndex:Q.index,searchHighlight:c,onImageClick:m,onFileClick:x,onBashClick:y,onViewMarkdown:v})},Q.key)})})});function X5({progress:t,defaultExpanded:e=!1,onAgentClick:n,onDismiss:s,onFileClick:a,onBashClick:r}){const[i,c]=b.useState(null),d=b.useRef(t.status),f=i!==null?!i:e;b.useEffect(()=>{d.current!==t.status&&(d.current==="working"&&(t.status==="completed"||t.status==="failed")&&c(!1),d.current=t.status)},[t.status]);const h={working:"#4a9eff",completed:"#22c55e",failed:"#ef4444"},m={working:"⚙️",completed:"✅",failed:"❌"},{t:x}=pt(["tools"]),y=b.useMemo(()=>Pu({onFileClick:a?N=>a(N):void 0}),[a]),v={working:x("tools:progress.workingOn"),completed:x("tools:progress.taskFinished"),failed:x("tools:progress.taskFailed")},S=t.taskDescription.length>80?t.taskDescription.slice(0,80)+"...":t.taskDescription,C=()=>{const N=t.completedAt||Date.now(),j=Math.floor((N-t.startedAt)/1e3);if(j<60)return`${j}s`;const E=Math.floor(j/60),D=j%60;return`${E}m ${D}s`},k=()=>{c(f)};return o.jsxs("div",{className:`agent-progress-indicator status-${t.status} ${f?"expanded":"collapsed"}`,children:[o.jsxs("div",{className:"agent-progress-header",onClick:k,children:[o.jsx("span",{className:"agent-progress-status-icon",style:{color:h[t.status]},children:m[t.status]}),o.jsx("span",{className:"agent-progress-agent-name",onClick:N=>{n&&(N.stopPropagation(),n(t.agentId))},children:t.agentName}),o.jsx("span",{className:"agent-progress-status-text",style:{color:h[t.status]},children:v[t.status]}),o.jsx("span",{className:"agent-progress-elapsed",children:C()}),s&&o.jsx("span",{className:"agent-progress-dismiss",title:"Dismiss",onClick:N=>{N.stopPropagation(),s(t.agentId)},children:"×"}),o.jsx("span",{className:"agent-progress-toggle",children:f?"▼":"▶"})]}),!f&&o.jsx("div",{className:"agent-progress-task-preview",children:S}),f&&o.jsxs("div",{className:"agent-progress-expanded",children:[o.jsx("div",{className:"agent-progress-task-full",children:o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:y,children:Df(t.taskDescription)})})}),t.output.length>0&&o.jsx("div",{className:"agent-progress-output-section",children:o.jsx(J5,{output:t.output,agentId:t.agentId,maxHeight:200,onFileClick:a,onBashClick:r})})]})]})}function J5({output:t,agentId:e,maxHeight:n=200,onFileClick:s,onBashClick:a}){const r=b.useRef(null),c=dT({outputs:t,viewMode:"simple"});return b.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[c]),c.length===0?null:o.jsx("div",{ref:r,className:"agent-progress-output",style:{maxHeight:`${n}px`},children:c.map((d,f)=>o.jsx(sy,{output:d,agentId:e,onFileClick:s,onBashClick:a},`progress-${f}`))})}const SA=1e4,Z5=3e4,eW=12e4;function Kg(t){const e=Zx(t);return ey(e.userMessage).userMessage.trim().replace(/\r\n/g,`
|
|
145
|
-
`)}function yf(t){return t.trim().replace(/\r\n/g,`
|
|
146
|
-
`)}function tW(t){return t.startsWith("Using tool:")||t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Bash output:")||t.startsWith("Session started:")||t.startsWith("[thinking]")||t.startsWith("Tokens:")||t.startsWith("Cost:")||t.startsWith("Context (estimated from Codex turn usage):")||t.startsWith("🔄 [System]")||t.startsWith("📋 [System]")||t.startsWith("[System]")}const CA=b.memo(b.forwardRef(function({agentId:e,agent:n,viewMode:s,isOpen:a,isSnapshotView:r,currentSnapshot:i,onImageClick:c,onFileClick:d,onBashClick:f,onViewMarkdown:h,keyboard:m,canSwipeClose:x,onSwipeCloseOffsetChange:y,onSwipeClose:v,hasModalOpen:S},C){var Le,Qe;const{t:k}=pt(["terminal","common"]),N=zj(),j=$j(),E=fx(),D=Mj(e),_=sL(e),P=!!(n!=null&&n.sessionId)&&!r,O=(n==null?void 0:n.class)==="boss"||(n==null?void 0:n.isBoss),T=bL(!r&&O?e:null),M=b.useMemo(()=>Array.from(T.values()).filter($e=>$e.status==="working"),[T]),R=b.useMemo(()=>Array.from(T.values()).filter($e=>$e.status==="completed"||$e.status==="failed").map($e=>$e.agentId),[T]),[I,z]=b.useState(!0),W=xL(r?null:e),$=TL(r?null:e),F=cL(),H=b.useMemo(()=>r||!e?[]:Array.from(F.values()).filter($e=>$e.agentId===e&&$e.status==="pending"),[r,e,F]),V=b.useRef(null),G=b.useRef(null),B=b.useRef(null),Q=b.useMemo(()=>r&&i?i.outputs.map($e=>({text:$e.text||"",timestamp:$e.timestamp,isStreaming:!1,isUserPrompt:!1})):D,[r,i,D]),K=jj({selectedAgentId:e,hasSessionId:P,reconnectCount:N,historyRefreshTrigger:j,lastPrompts:E,outputScrollRef:V}),q=b5({selectedAgentId:e}),xe=b.useMemo(()=>{const{history:$e}=K,nt=new Map;for(const st of $e)st.type==="tool_result"&&st.toolUseId&&nt.set(st.toolUseId,st.content);return(st=>st.map(lt=>{if(lt.type==="tool_use"&<.toolName==="Bash"&<.toolUseId){const it=nt.get(lt.toolUseId);let ht;try{ht=(lt.toolInput||(lt.content?JSON.parse(lt.content):{})).command}catch{}return{...lt,_bashOutput:it,_bashCommand:ht}}return lt}))($e)},[K.history]),de=fT({outputs:Q,viewMode:s}),Z=b.useMemo(()=>{const $e=[],nt=new Set,ot=new Set;let st=null,lt=0;for(const it of xe){if(it.type==="assistant"){const Te=it.uuid?`uuid:${it.uuid}:${yf(it.content)}`:`sig:${it.timestamp}:${yf(it.content)}`;if(nt.has(Te))continue;nt.add(Te),$e.push(it);continue}if(it.type!=="user"){$e.push(it);continue}const ht=Kg(it.content),jt=it.uuid?`uuid:${it.uuid}:${ht}`:null;if(jt&&ot.has(jt))continue;const ge=it.timestamp?new Date(it.timestamp).getTime():0;st===ht&&Math.abs(ge-lt)<=SA||($e.push(it),jt&&ot.add(jt),st=ht,lt=ge)}return $e},[xe]),be=b.useMemo(()=>{const $e=new Map,nt=new Set,ot=new Map;for(const ht of Z){const jt=ht.timestamp?new Date(ht.timestamp).getTime():0;if(ht.type==="user"){const Ye=Kg(ht.content),tt=$e.get(Ye)??0;jt>tt&&$e.set(Ye,jt);continue}if(ht.type!=="assistant")continue;ht.uuid&&nt.add(ht.uuid);const ge=yf(ht.content),Te=ot.get(ge)??0;jt>Te&&ot.set(ge,jt)}const st=[];let lt=null,it=0;for(const ht of de){if(!ht.isUserPrompt){if(!ht.isStreaming&&!tW(ht.text)){if(ht.uuid&&nt.has(ht.uuid))continue;const Ye=yf(ht.text),tt=ht.timestamp||0,Nt=ot.get(Ye);if(Nt&&Math.abs(tt-Nt)<=eW)continue}st.push(ht);continue}const jt=Kg(ht.text),ge=ht.timestamp||0,Te=$e.get(jt);Te&&ge>=Te&&ge-Te<=Z5||lt===jt&&Math.abs(ge-it)<=SA||(st.push(ht),lt=jt,it=ge)}return st},[de,Z]),je=b.useMemo(()=>[...Z,...be],[Z,be]),ce=h5({selectedAgentId:e,isOpen:a,allItems:je,viewMode:s,hasMoreHistory:K.hasMore,loadAllHistory:K.loadAllHistory,loadingMore:K.loadingMore}),Ee=Z.length+be.length,ze=x5({totalMessages:Ee,isOpen:a,hasModalOpen:S||ce.searchMode,scrollContainerRef:V,selectedAgentId:e,inputRef:G,textareaRef:B,useTextarea:q.useTextarea}),[Ge,_e]=b.useState(!1),[me,De]=b.useState(null),te=b.useRef(null),He=b.useRef(null);b.useEffect(()=>{const $e=n==null?void 0:n.status;if(te.current==="working"&&$e==="idle"){He.current&&clearTimeout(He.current);const ot=E.get(e);De(ot!=null&&ot.timestamp?Date.now()-ot.timestamp:null),_e(!0),He.current=setTimeout(()=>{_e(!1),De(null),He.current=null},4e3)}else $e==="working"&&(He.current&&(clearTimeout(He.current),He.current=null),_e(!1),De(null));return te.current=$e||null,()=>{He.current&&clearTimeout(He.current)}},[n==null?void 0:n.status]),b.useEffect(()=>{if(!e||!O||r||R.length===0)return;const $e=window.setTimeout(()=>{R.forEach(nt=>{U.clearAgentTaskProgress(e,nt)})},300);return()=>window.clearTimeout($e)},[e,O,r,R]);const[ye,Re]=b.useState(!0),re=b.useRef(!1),pe=b.useRef(!1),Ve=b.useRef(!1),at=b.useCallback(()=>{Ve.current||(re.current=!0,Re(!1))},[]),[ut,ue]=b.useState(!1),X=b.useCallback(()=>ue(!1),[]),se=b.useCallback(()=>{re.current=!1,Re(!0)},[]);b.useEffect(()=>{Re(!0),re.current=!1,pe.current=!0,Ve.current=!0;const $e=setTimeout(()=>{Ve.current=!1},3e3);return()=>clearTimeout($e)},[e]);const ke=b.useRef(K.handleScroll);ke.current=K.handleScroll;const J=b.useCallback(()=>{if(!V.current||m.keyboardScrollLockRef.current)return;const{scrollTop:$e,scrollHeight:nt,clientHeight:ot}=V.current,st=nt-$e-ot<150;Ve.current||(re.current=!st,st&&Re(!0)),ke.current(m.keyboardScrollLockRef)},[V,m.keyboardScrollLockRef]),we=D.length>0&&((Qe=(Le=D[D.length-1])==null?void 0:Le.text)==null?void 0:Qe.length)||0;b.useEffect(()=>{m.keyboardScrollLockRef.current||re.current||requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight)})},[D.length,we,m.keyboardScrollLockRef,V]);const[We,Be]=b.useState(!1),[ie,Ie]=b.useState(!1),oe=b.useRef(null);b.useLayoutEffect(()=>{const $e=oe.current;$e!==null&&$e!==e?(Be(!1),K.hasCachedHistory(e)||Ie(!0)):e||Be(!1),oe.current=e},[e]),b.useEffect(()=>{if(!ie||K.fetchingHistory)return;const $e=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),Ie(!1)});return()=>cancelAnimationFrame($e)},[ie,K.fetchingHistory,K.historyLoadVersion]),b.useEffect(()=>{if(!pe.current||!e||ie||K.fetchingHistory)return;let $e=0,nt=0;return $e=requestAnimationFrame(()=>{nt=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),pe.current=!1})}),()=>{cancelAnimationFrame($e),cancelAnimationFrame(nt)}},[e,ie,K.fetchingHistory,K.historyLoadVersion]);const he=b.useRef(!1);b.useEffect(()=>{he.current=!0,ue(!0)},[e,N]),b.useEffect(()=>{K.fetchingHistory&&(he.current=!0,ue(!0))},[K.fetchingHistory]),b.useEffect(()=>{if(!ut||!a||K.fetchingHistory)return;const $e=V.current;if(!$e)return;let nt=null;const ot=performance.now();let st=0,lt=-1;const it=()=>{const{scrollTop:jt,scrollHeight:ge,clientHeight:Te}=$e;return ge-jt-Te<=2},ht=()=>{const jt=performance.now(),ge=$e.scrollHeight,Te=Math.abs(ge-lt)<=1,Ye=it();if(Te&&Ye?st+=1:st=0,lt=ge,st>=3){ue(!1),nt=null;return}if(jt-ot>8e3){ue(!1),nt=null;return}nt=requestAnimationFrame(ht)};return nt=requestAnimationFrame(ht),()=>{nt!==null&&cancelAnimationFrame(nt)}},[ut,a,K.fetchingHistory,K.historyLoadVersion]);const ne=b.useRef(!1);return b.useEffect(()=>{ne.current&&!ut&&he.current&&(he.current=!1,Be(!0)),ne.current=ut},[ut]),b.useEffect(()=>{if(!a||!he.current||ut||K.fetchingHistory)return;const $e=requestAnimationFrame(()=>{he.current&&(he.current=!1,Be(!0))});return()=>cancelAnimationFrame($e)},[K.historyLoadVersion,a,ut,K.fetchingHistory]),b.useEffect(()=>{if(!ce.searchMode)return;const $e=nt=>{nt.key==="Escape"&&(nt.stopImmediatePropagation(),ce.closeSearch())};return document.addEventListener("keydown",$e,!0),()=>document.removeEventListener("keydown",$e,!0)},[ce.searchMode,ce.closeSearch]),b.useEffect(()=>()=>m.cleanup(),[e,m]),b.useImperativeHandle(C,()=>({outputScrollRef:V,inputRef:G,textareaRef:B,historyLoader:{loadingHistory:K.loadingHistory,fetchingHistory:K.fetchingHistory,historyLoadVersion:K.historyLoadVersion,loadingMore:K.loadingMore,hasMore:K.hasMore,totalCount:K.totalCount,loadMoreHistory:K.loadMoreHistory,clearHistory:K.clearHistory,hasCachedHistory:K.hasCachedHistory,history:K.history},search:ce,terminalInput:{uploadFile:q.uploadFile,setAttachedFiles:q.setAttachedFiles,useTextarea:q.useTextarea},getDedupedHistory:()=>Z,getDedupedOutputs:()=>be,outputsLength:Z.length+be.length}),[K,ce,q,Z,be]),o.jsxs(o.Fragment,{children:[ce.searchMode&&o.jsx(C6,{searchInputRef:ce.searchInputRef,searchQuery:ce.searchQuery,setSearchQuery:ce.setSearchQuery,closeSearch:ce.closeSearch,matchCount:ce.matchIndices.length,currentMatch:ce.currentMatch,navigateNext:ce.navigateNext,navigatePrev:ce.navigatePrev,loadingFullHistory:ce.loadingFullHistory}),o.jsx("div",{className:"guake-output",ref:V,onScroll:J,children:o.jsxs("div",{className:`guake-history-content ${We?"fade-in":""}`,children:[ie&&o.jsxs("div",{className:"guake-empty loading",children:[k("terminal:empty.loadingConversation"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]}),!ie&&K.loadingHistory&&K.history.length===0&&D.length===0&&o.jsxs("div",{className:"guake-empty loading",children:[k("terminal:empty.loadingConversation"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]}),!ie&&!K.loadingHistory&&K.history.length===0&&Q.length===0&&n.status!=="working"&&o.jsx("div",{className:"guake-empty",children:k("terminal:empty.noOutput")}),!ie&&K.hasMore&&!ce.searchMode&&o.jsx("div",{className:"guake-load-more",children:K.loadingMore?o.jsx("span",{children:k("terminal:empty.loadingOlder")}):o.jsx("button",{onClick:K.loadMoreHistory,children:k("terminal:empty.loadMore",{count:K.totalCount-K.history.length})})}),!ie&&o.jsx(Q5,{historyMessages:Z,liveOutputs:be,agentId:e,execTasks:W,subagents:$,viewMode:s,searchHighlight:ce.highlightQuery,searchActiveIndex:ce.scrollToIndex,selectedMessageIndex:ze.selectedIndex,isMessageSelected:ze.isSelected,onImageClick:c,onFileClick:d,onBashClick:f,onViewMarkdown:h,scrollContainerRef:V,onScrollTopReached:K.loadMoreHistory,isLoadingMore:K.loadingMore,hasMore:K.hasMore,shouldAutoScroll:ye,onUserScroll:at,pinToBottom:ut,onPinCancel:X,isLoadingHistory:K.fetchingHistory},e),!ie&&_&&o.jsxs("div",{className:"compacting-indicator",children:[o.jsx("div",{className:"compacting-bar",children:o.jsx("div",{className:"compacting-bar-fill"})}),o.jsx("span",{className:"compacting-label",children:"Compacting context..."})]}),!ie&&O&&M.length>0&&o.jsxs("div",{className:`agent-progress-container ${I?"collapsed":"expanded"}`,children:[o.jsxs("div",{className:"agent-progress-container-header",onClick:()=>z($e=>!$e),role:"button",tabIndex:0,onKeyDown:$e=>{($e.key==="Enter"||$e.key===" ")&&($e.preventDefault(),z(nt=>!nt))},children:[o.jsx("span",{className:"progress-crown",children:"👑"}),o.jsx("span",{children:k("terminal:empty.subordinateProgress")}),o.jsx("span",{className:"progress-count",children:k("terminal:empty.activeCount",{count:M.length})}),o.jsx("span",{className:"agent-progress-container-toggle",children:I?"▶":"▼"})]}),!I&&M.map($e=>o.jsx(X5,{progress:$e,defaultExpanded:$e.status==="working",onAgentClick:nt=>{U.selectAgent(nt),U.setTerminalOpen(!0)},onDismiss:nt=>{U.clearAgentTaskProgress(e,nt)},onFileClick:d,onBashClick:f},$e.agentId))]})]})}),o.jsx(L5,{selectedAgent:n,selectedAgentId:e,isOpen:a,command:q.command,setCommand:q.setCommand,forceTextarea:q.forceTextarea,setForceTextarea:q.setForceTextarea,useTextarea:q.useTextarea,attachedFiles:q.attachedFiles,setAttachedFiles:q.setAttachedFiles,removeAttachedFile:q.removeAttachedFile,uploadFile:q.uploadFile,pastedTexts:q.pastedTexts,expandPastedTexts:q.expandPastedTexts,incrementPastedCount:q.incrementPastedCount,setPastedTexts:q.setPastedTexts,resetPastedCount:q.resetPastedCount,handleInputFocus:m.handleInputFocus,handleInputBlur:m.handleInputBlur,pendingPermissions:H,showCompletion:Ge,completionElapsed:me,onImageClick:c,inputRef:G,textareaRef:B,isSnapshotView:r,onClearHistory:K.clearHistory,onSendCommand:se,canSwipeClose:x,onSwipeCloseOffsetChange:y,onSwipeClose:v})]})})),nW=b.memo(function({agentId:e,onClose:n}){const s=ux(e),{t:a}=pt("terminal");return o.jsxs("div",{className:"split-pane-header",children:[o.jsx("span",{className:"split-pane-agent-name",title:(s==null?void 0:s.name)||e,children:(s==null?void 0:s.name)||e}),o.jsx("button",{type:"button",className:"split-pane-close",onClick:n,title:a("overview.close",{defaultValue:"Close pane"}),children:"✕"})]})}),sW=b.memo(function(e){const{activeAgentId:n,activeAgent:s,paneRef:a,viewMode:r,isOpen:i,isSnapshotView:c,currentSnapshot:d,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,onSaveSnapshot:v,canSwipeClose:S,onSwipeCloseOffsetChange:C,onSwipeClose:k,hasModalOpen:N}=e,j=ML(),E=DL(),D=Dl(),[_,P]=b.useState(!1),{t:O}=pt("terminal"),T=b.useCallback(V=>{U.removeSplitPane(V)},[]),M=b.useCallback(V=>{V.dataTransfer.types.includes("application/x-agent-id")&&(V.preventDefault(),V.dataTransfer.dropEffect="copy",P(!0))},[]),R=b.useCallback(V=>{V.currentTarget.contains(V.relatedTarget)||P(!1)},[]),I=b.useCallback(V=>{V.preventDefault(),P(!1);const G=V.dataTransfer.getData("application/x-agent-id");G&&U.addSplitPane(G)},[]),z=b.useMemo(()=>j.filter(V=>D.has(V)),[j,D]),W=z.length>0,$=E==="horizontal",F=$?"horizontal":"vertical",H=b.useCallback(()=>{U.toggleSplitOrientation()},[]);return W?o.jsxs("div",{className:`split-terminal-layout multi ${$?"orientation-horizontal":"orientation-vertical"} ${_?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:I,children:[o.jsx("div",{className:"split-toolbar",children:o.jsx("button",{type:"button",className:"split-orientation-toggle",onClick:H,title:$?O("split.switchVertical",{defaultValue:"Switch to vertical split"}):O("split.switchHorizontal",{defaultValue:"Switch to horizontal split"}),children:o.jsx("span",{className:`split-orientation-icon ${$?"horizontal":"vertical"}`,children:$?"⬜⬜":`⬜
|
|
147
|
-
⬜`})})}),o.jsx("div",{className:`split-panes-container ${$?"horizontal":"vertical"}`,children:z.map((V,G)=>{const B=D.get(V);if(!B)return null;const Q=V===n;return o.jsxs(Ce.Fragment,{children:[G>0&&o.jsx("div",{className:`guake-split-divider ${F}`}),o.jsxs("div",{className:"split-terminal-pane",children:[o.jsx(nW,{agentId:V,onClose:()=>T(V)}),o.jsx(CA,{ref:Q?a:void 0,agentId:V,agent:B,viewMode:r,isOpen:i,isSnapshotView:!1,currentSnapshot:null,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,hasModalOpen:N})]})]},V)})})]}):o.jsx("div",{className:`split-terminal-layout single ${_?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:I,children:o.jsx(CA,{ref:a,agentId:n,agent:s,viewMode:r,isOpen:i,isSnapshotView:c,currentSnapshot:d,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,onSaveSnapshot:v,canSwipeClose:S,onSwipeCloseOffsetChange:C,onSwipeClose:k,hasModalOpen:N})})}),aW={running:"🟢",stopped:"⚫",error:"🔴",unknown:"❓",starting:"🟡",stopping:"🟠"};function Qg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(0)}KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(0)}MB`:`${(t/1024/1024/1024).toFixed(1)}GB`}function AA(t){const e=t.replace(/\/$/,"").split("/");return e.length<=2?t:`.../${e.slice(-2).join("/")}`}function Xg(t){const e=window.location.protocol,n=window.location.hostname;return`${e}//${n}:${t}`}function rW({agentId:t,onClose:e}){const{t:n}=pt(["terminal","common"]),s=px(),a=rr(),[r,i]=b.useState(null),c=b.useMemo(()=>U.getAreaForAgent(t),[t,a]),d=b.useMemo(()=>{if(!c)return[];const k=[];for(const N of s.values())U.isPositionInArea(N.position,c)&&k.push(N);return k.sort((N,j)=>N.status==="running"&&j.status!=="running"?-1:N.status!=="running"&&j.status==="running"?1:N.name.localeCompare(j.name)),k},[c,s]),f=b.useCallback(k=>{U.selectBuilding(k),window.dispatchEvent(new CustomEvent("tide:building-action",{detail:{buildingId:k}}))},[]),h=b.useCallback((k,N)=>{U.sendBuildingCommand(k,N)},[]),m=b.useCallback((k,N)=>{k.preventDefault(),k.stopPropagation(),i({buildingId:N,position:{x:k.clientX,y:k.clientY}})},[]),x=b.useCallback(()=>{i(null)},[]),y=b.useCallback(()=>{if(!c)return{x:0,z:0};const k=()=>(Math.random()-.5)*2;return{x:c.center.x+k(),z:c.center.z+k()}},[c]),v=b.useCallback(()=>{if(!c)return;const k=y();window.dispatchEvent(new CustomEvent("tide:building-create",{detail:{position:k}}))},[c,y]),S=b.useMemo(()=>{var _;if(!r)return[];const k=U.getState().buildings.get(r.buildingId);if(!k)return[];const N=[],j=k.type==="server"||k.type==="docker"||k.type==="terminal",E=k.status==="running",D=k.type==="boss";if(N.push({id:"open",label:k.type==="database"?"Open Database":k.type==="folder"?"Open Folder":k.type==="boss"?"View Boss Logs":k.type==="terminal"?"Open Terminal":k.type==="server"&&((_=k.pm2)!=null&&_.enabled)?"View PM2 Logs":"Open",icon:k.type==="database"?"🗄️":k.type==="folder"?"📁":k.type==="terminal"?"💻":"👁️",onClick:()=>f(k.id)}),j&&(E||N.push({id:"start",label:"Start",icon:"▶",onClick:()=>U.sendBuildingCommand(k.id,"start")}),E&&(N.push({id:"restart",label:"Restart",icon:"🔄",onClick:()=>U.sendBuildingCommand(k.id,"restart")}),N.push({id:"stop",label:"Stop",icon:"⏹",onClick:()=>U.sendBuildingCommand(k.id,"stop")}))),D&&k.subordinateBuildingIds&&k.subordinateBuildingIds.length>0&&(N.push({id:"start-all",label:"Start All Subordinates",icon:"🚀",onClick:()=>{for(const P of k.subordinateBuildingIds)U.sendBuildingCommand(P,"start")}}),N.push({id:"stop-all",label:"Stop All Subordinates",icon:"⏸️",onClick:()=>{for(const P of k.subordinateBuildingIds)U.sendBuildingCommand(P,"stop")}}),N.push({id:"restart-all",label:"Restart All Subordinates",icon:"♻️",onClick:()=>{for(const P of k.subordinateBuildingIds)U.sendBuildingCommand(P,"restart")}})),j&&N.push({id:"health-check",label:"Health Check",icon:"🩺",onClick:()=>U.sendBuildingCommand(k.id,"healthCheck")}),N.push({id:"divider-edit",label:"",divider:!0,onClick:()=>{}}),N.push({id:"edit",label:"Edit Building",icon:"✏️",onClick:()=>{window.dispatchEvent(new CustomEvent("tide:building-edit",{detail:{buildingId:k.id}}))}}),N.push({id:"clone",label:"Clone Building",icon:"📋",onClick:()=>{const P=y();U.createBuilding({name:`${k.name} (Copy)`,type:k.type,style:k.style,color:k.color,scale:k.scale,position:P,cwd:k.cwd,folderPath:k.folderPath,commands:k.commands,pm2:k.pm2,docker:k.docker,database:k.database,terminal:k.terminal,urls:k.urls,subordinateBuildingIds:k.subordinateBuildingIds})}}),k.urls&&k.urls.length>0)for(const P of k.urls)N.push({id:`url-${P.label}`,label:P.label,icon:"🔗",onClick:()=>window.open(P.url,"_blank","noopener,noreferrer")});return N.push({id:"divider-danger",label:"",divider:!0,onClick:()=>{}}),N.push({id:"delete",label:"Delete Building",icon:"🗑️",danger:!0,onClick:()=>U.deleteBuilding(k.id)}),N},[r,s,f,y]),C=b.useCallback(k=>{const N=[];if(k.pm2Status){const j=k.pm2Status;j.ports&&j.ports.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Ports"}),o.jsx("span",{className:"detail-value detail-ports",children:j.ports.map((E,D)=>o.jsxs("a",{className:"guake-building-port-link",href:Xg(E),target:"_blank",rel:"noopener noreferrer",onClick:_=>_.stopPropagation(),title:`Open :${E} in browser`,children:[":",E,D<j.ports.length-1?" ":""]},E))})]},"pm2-ports"))}if(k.dockerStatus){const j=k.dockerStatus,E=[];if(j.status&&E.push(o.jsx("span",{className:"detail-value",children:j.status},"st")),j.health&&j.health!=="none"){const D=j.health==="healthy"?"detail-ok":j.health==="unhealthy"?"detail-err":"";E.push(o.jsx("span",{className:`detail-value ${D}`,children:j.health},"h"))}if(j.memory!==void 0){const D=j.memoryLimit?`${Qg(j.memory)}/${Qg(j.memoryLimit)}`:Qg(j.memory);E.push(o.jsx("span",{className:"detail-value",children:D},"mem"))}j.cpu!==void 0&&E.push(o.jsxs("span",{className:"detail-value",children:[j.cpu.toFixed(1),"%"]},"cpu")),E.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Docker"}),E]},"docker")),j.image&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Image"}),o.jsx("span",{className:"detail-value detail-mono",children:j.image})]},"docker-img")),j.ports&&j.ports.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Ports"}),o.jsx("span",{className:"detail-value detail-ports",children:j.ports.map((D,_)=>o.jsxs("a",{className:"guake-building-port-link",href:Xg(D.host),target:"_blank",rel:"noopener noreferrer",onClick:P=>P.stopPropagation(),title:`Open :${D.host} in browser`,children:[D.host,":",D.container,_<j.ports.length-1?" ":""]},`${D.host}-${D.container}`))})]},"docker-ports")),j.services&&j.services.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Services"}),o.jsxs("span",{className:"detail-value",children:[j.services.length," svc"]})]},"docker-svc"))}if(k.type==="database"&&k.database){const j=k.database,E=j.activeConnectionId?j.connections.find(D=>D.id===j.activeConnectionId):j.connections[0];E&&(N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:E.engine.toUpperCase()}),o.jsxs("span",{className:"detail-value detail-mono",children:[E.host,":",E.port]})]},"db-conn")),(j.activeDatabase||E.database)&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"DB"}),o.jsx("span",{className:"detail-value",children:j.activeDatabase||E.database})]},"db-name"))),j.connections.length>1&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Connections"}),o.jsx("span",{className:"detail-value",children:j.connections.length})]},"db-count"))}if(k.type==="boss"&&k.subordinateBuildingIds&&k.subordinateBuildingIds.length>0){const j=k.subordinateBuildingIds;let E=0,D=0;for(const P of j){const O=s.get(P);(O==null?void 0:O.status)==="running"&&E++,(O==null?void 0:O.status)==="error"&&D++}const _=[];_.push(`${E}/${j.length} up`),D>0&&_.push(`${D} err`),N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Subs"}),o.jsx("span",{className:`detail-value ${D>0?"detail-err":E===j.length?"detail-ok":""}`,children:_.join(", ")})]},"boss-subs"))}if(k.terminalStatus){const j=k.terminalStatus;N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Terminal"}),o.jsx("span",{className:"detail-value detail-ports",children:j.port?o.jsxs("a",{className:"guake-building-port-link",href:Xg(j.port),target:"_blank",rel:"noopener noreferrer",onClick:E=>E.stopPropagation(),title:`Open :${j.port} in browser`,children:[":",j.port]}):o.jsx("span",{children:"—"})})]},"terminal")),j.tmuxSession&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Session"}),o.jsx("span",{className:"detail-value detail-mono",children:j.tmuxSession})]},"terminal-session"))}return k.type==="folder"&&k.folderPath&&(N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Path"}),o.jsx("span",{className:"detail-value detail-mono",title:k.folderPath,children:AA(k.folderPath)})]},"folder-path")),k.gitChangesCount!==void 0&&k.gitChangesCount>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Git"}),o.jsxs("span",{className:"detail-value detail-warn",children:[k.gitChangesCount," changes"]})]},"folder-git"))),k.cwd&&k.type!=="folder"&&!k.pm2Status&&!k.dockerStatus&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Dir"}),o.jsx("span",{className:"detail-value detail-mono",title:k.cwd,children:AA(k.cwd)})]},"cwd")),k.lastError&&k.status==="error"&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label detail-err",children:"Err"}),o.jsx("span",{className:"detail-value detail-err detail-ellipsis",title:k.lastError,children:k.lastError.length>40?k.lastError.slice(0,40)+"...":k.lastError})]},"error")),N},[s]);return o.jsxs("div",{className:"guake-buildings-panel",children:[o.jsxs("div",{className:"guake-buildings-header",children:[o.jsxs("div",{className:"guake-buildings-title",children:[o.jsx("span",{className:"guake-buildings-icon",children:"🏗️"}),o.jsx("span",{children:(c==null?void 0:c.name)||n("terminal:buildings.title",{defaultValue:"Buildings"})}),o.jsx("span",{className:"guake-buildings-count",children:d.length})]}),o.jsxs("div",{className:"guake-buildings-header-actions",children:[c&&o.jsx("button",{className:"guake-buildings-add",onClick:v,title:"Add building to area",children:"+"}),o.jsx("button",{className:"guake-buildings-close",onClick:e,title:n("common:buttons.close"),children:"✕"})]})]}),o.jsx("div",{className:"guake-buildings-body",children:c?d.length===0?o.jsx("div",{className:"guake-buildings-empty",children:n("terminal:buildings.noBuildings",{defaultValue:"No buildings in this area"})}):d.map(k=>{var _,P;const N=IL[k.type],j=aW[k.status]||"❓",E=k.type==="server"||k.type==="docker"||k.type==="terminal",D=k.status==="running";return o.jsxs("div",{className:`guake-building-item ${k.status}`,onClick:()=>f(k.id),onContextMenu:O=>m(O,k.id),children:[o.jsxs("div",{className:"guake-building-row",children:[o.jsx("span",{className:"guake-building-type-icon",title:N.description,children:N.icon}),o.jsx("span",{className:"guake-building-name",children:k.name}),o.jsx("span",{className:"guake-building-status",title:k.status,children:j})]}),C(k),k.urls&&k.urls.length>0&&o.jsx("div",{className:"guake-building-urls",children:k.urls.map((O,T)=>o.jsxs("a",{className:"guake-building-link",href:O.url,target:"_blank",rel:"noopener noreferrer",onClick:M=>M.stopPropagation(),children:["🔗 ",O.label]},T))}),E&&o.jsxs("div",{className:"guake-building-actions",children:[!D&&o.jsx("button",{className:"guake-building-action start",onClick:O=>{O.stopPropagation(),h(k.id,"start")},title:"Start",children:"▶"}),D&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"guake-building-action restart",onClick:O=>{O.stopPropagation(),h(k.id,"restart")},title:"Restart",children:"🔄"}),o.jsx("button",{className:"guake-building-action stop",onClick:O=>{O.stopPropagation(),h(k.id,"stop")},title:"Stop",children:"⏹"}),k.type==="terminal"&&((_=k.terminalStatus)==null?void 0:_.url)&&o.jsx("button",{className:"guake-building-action terminal-below",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-terminal",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"terminal",direction:"horizontal"}}))},title:"Open terminal below (right-click to split)",children:"⬇"}),k.type==="server"&&((P=k.pm2)==null?void 0:P.enabled)&&o.jsx("button",{className:"guake-building-action terminal-below",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-pm2-logs",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"pm2-logs",direction:"horizontal"}}))},title:"Show logs below (right-click to split)",children:"📜"}),k.type==="database"&&k.database&&o.jsx("button",{className:"guake-building-action-btn",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-database",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"database",direction:"horizontal"}}))},title:"Show database below (right-click to split)",children:"🗄️"})]})]})]},k.id)}):o.jsx("div",{className:"guake-buildings-empty",children:n("terminal:buildings.noArea",{defaultValue:"Agent is not in an area"})})}),o.jsx(go,{isOpen:r!==null,position:(r==null?void 0:r.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:S,onClose:x})]})}const Jg={action:"#cba6f7",wait:"#f9e2af",decision:"#89b4fa",end:"#a6e3a1"},hp={running:"#a6e3a1",paused:"#f9e2af",completed:"#89b4fa",failed:"#f38ba8",cancelled:"#6c7086"};function iW(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function oW(t){return new Date(t).toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function lW({agentId:t,onClose:e}){const[n,s]=b.useState([]),[a,r]=b.useState([]),[i,c]=b.useState(!0),[d,f]=b.useState(null),h=b.useRef(null),m=b.useCallback(async()=>{try{const[k,N]=await Promise.all([Lt(Mt("/api/workflows/definitions")),Lt(Mt("/api/workflows/instances"))]);if(k.ok){const j=await k.json();s(j)}if(N.ok){const j=await N.json();r(j.instances||j||[])}}catch{}finally{c(!1)}},[]);b.useEffect(()=>(m(),h.current=setInterval(m,1e4),()=>{h.current&&clearInterval(h.current)}),[m]);const x=n.filter(k=>k.states.some(N=>{var j;return((j=N.action)==null?void 0:j.type)==="agent_task"&&N.action.agentId===t})),y=new Set(x.map(k=>k.id)),v=a.filter(k=>y.has(k.workflowDefId)||k.agentId===t).sort((k,N)=>k.status==="running"&&N.status!=="running"?-1:N.status==="running"&&k.status!=="running"?1:N.updatedAt-k.updatedAt);b.useEffect(()=>{if(v.length===0){f(null);return}v.find(N=>N.id===d)||f(v[0].id)},[v,d]);const S=v.find(k=>k.id===d)??null,C=S?n.find(k=>k.id===S.workflowDefId)??null:null;return o.jsxs("div",{className:"guake-git-panel",children:[o.jsxs("div",{className:"guake-git-header",children:[o.jsxs("div",{className:"guake-git-title",children:[o.jsx("span",{style:{padding:"0 12px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Workflow"}),v.length>0&&o.jsx("span",{style:bt.headerBadge,children:v.length})]}),o.jsxs("div",{className:"guake-git-header-actions",children:[o.jsx("button",{className:"guake-git-refresh",onClick:m,title:"Refresh",disabled:i,children:i?"⏳":"↻"}),o.jsx("button",{className:"guake-git-close",onClick:e,title:"Close",children:"×"})]})]}),o.jsxs("div",{className:"guake-git-body",style:{display:"flex",flexDirection:"column",gap:0},children:[i&&v.length===0&&o.jsx("div",{style:bt.emptyState,children:o.jsx("span",{style:bt.loadingText,children:"Loading workflows..."})}),!i&&v.length===0&&o.jsxs("div",{style:bt.emptyState,children:[o.jsx("span",{style:bt.emptyIcon,children:"⊘"}),o.jsx("span",{children:"No workflow instances for this agent"})]}),v.length>0&&o.jsx("div",{style:bt.instanceList,children:v.map(k=>{const N=k.id===d,j=n.find(D=>D.id===k.workflowDefId),E=j==null?void 0:j.states.find(D=>D.id===k.currentStateId);return o.jsxs("button",{onClick:()=>f(k.id),style:{...bt.instanceRow,...N?bt.instanceRowSelected:{}},children:[o.jsxs("div",{style:bt.instanceRowTop,children:[o.jsx("span",{style:{...bt.statusDot,backgroundColor:hp[k.status]||"#6c7086"}}),o.jsx("span",{style:bt.instanceName,children:k.workflowName}),o.jsx("span",{style:{...bt.instanceStatus,color:hp[k.status]||"#6c7086"},children:k.status})]}),o.jsxs("div",{style:bt.instanceRowBottom,children:[o.jsx("span",{style:bt.instanceState,children:(E==null?void 0:E.name)||k.currentStateId}),o.jsx("span",{style:bt.instanceTime,children:oW(k.updatedAt)})]})]},k.id)})}),S&&C&&o.jsx(cW,{definition:C,instance:S,onRefresh:m})]})]})}function cW({definition:t,instance:e,onRefresh:n}){const s=t.states.find(i=>i.id===e.currentStateId),[a,r]=b.useState("states");return o.jsxs("div",{style:bt.instanceView,children:[o.jsxs("div",{style:bt.statusBar,children:[o.jsx("span",{style:{...bt.statusBadge,color:hp[e.status]||"#6c7086",borderColor:hp[e.status]||"#6c7086"},children:e.status}),o.jsxs("span",{style:bt.currentLabel,children:["Current: ",o.jsx("strong",{children:(s==null?void 0:s.name)||e.currentStateId})]})]}),o.jsx(uW,{definition:t,instance:e,onRefresh:n}),o.jsx("div",{style:bt.tabs,children:["states","timeline","variables"].map(i=>o.jsx("button",{onClick:()=>r(i),style:{...bt.tab,...a===i?bt.tabActive:{}},children:i==="states"?"States":i==="timeline"?"Timeline":"Variables"},i))}),o.jsxs("div",{style:bt.tabContent,children:[a==="states"&&o.jsx(dW,{definition:t,currentStateId:e.currentStateId}),a==="timeline"&&o.jsx(fW,{definition:t,instance:e}),a==="variables"&&o.jsx(pW,{variables:e.variables})]})]})}function uW({definition:t,instance:e,onRefresh:n}){const[s,a]=b.useState([]),[r,i]=b.useState(!1),[c,d]=b.useState(null),[f,h]=b.useState(null),m=b.useCallback(async()=>{if(e.status!=="running"){a([]);return}i(!0);try{const y=await Lt(Mt(`/api/workflows/instances/${e.id}/available-transitions`));if(y.ok){const S=((await y.json()).transitions||[]).map(C=>{const k=t.states.find(N=>N.id===C.targetStateId);return{...C,targetStateName:k==null?void 0:k.name}});a(S)}}catch{}finally{i(!1)}},[e.id,e.status,t]);b.useEffect(()=>{m()},[m,e.currentStateId]);const x=b.useCallback(async y=>{d(y),h(null);try{const v=await Lt(Mt(`/api/workflows/instances/${e.id}/transition`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStateId:y,reason:"Transitioned via UI panel"})});if(v.ok)setTimeout(()=>{m(),n()},500);else{const S=await v.json().catch(()=>({error:"Transition failed"}));h(S.error||"Transition failed")}}catch{h("Network error")}finally{d(null)}},[e.id,m,n]);return e.status!=="running"?null:r&&s.length===0?o.jsx("div",{style:bt.transitionSection,children:o.jsx("span",{style:bt.loadingText,children:"Loading transitions..."})}):s.length===0?null:o.jsxs("div",{style:bt.transitionSection,children:[o.jsx("div",{style:bt.transitionLabel,children:"Available Transitions"}),o.jsx("div",{style:bt.transitionButtons,children:s.map(y=>o.jsxs("button",{onClick:()=>x(y.targetStateId),disabled:c!==null,style:{...bt.transitionBtn,opacity:c===y.targetStateId?.6:1},title:`${y.name} → ${y.targetStateName||y.targetStateId}`,children:[c===y.targetStateId?"...":y.name,o.jsxs("span",{style:bt.transitionArrow,children:["→"," ",y.targetStateName||y.targetStateId]})]},y.id))}),f&&o.jsx("div",{style:bt.transitionError,children:f})]})}function dW({definition:t,currentStateId:e}){return o.jsx("div",{style:bt.stateList,children:t.states.map(n=>{const s=n.id===e;return o.jsxs("div",{style:{...bt.stateItem,...s?bt.stateItemCurrent:{}},children:[o.jsxs("div",{style:bt.stateHeader,children:[o.jsx("span",{style:{...bt.stateTypeBadge,backgroundColor:`${Jg[n.type]}22`,color:Jg[n.type],borderColor:`${Jg[n.type]}44`},children:n.type}),o.jsx("span",{style:bt.stateName,children:n.name}),s&&o.jsx("span",{style:bt.currentBadge,children:"CURRENT"})]}),n.description&&o.jsx("div",{style:bt.stateDescription,children:n.description}),n.transitions.length>0&&o.jsx("div",{style:bt.stateTransitions,children:n.transitions.map(a=>{var r;return o.jsxs("span",{style:bt.transitionChip,children:[a.name," ","→"," ",((r=t.states.find(i=>i.id===a.targetStateId))==null?void 0:r.name)||a.targetStateId]},a.id)})})]},n.id)})})}function fW({definition:t,instance:e}){return!e.history||e.history.length===0?o.jsx("div",{style:bt.emptyState,children:"No timeline events yet"}):o.jsx("div",{style:bt.timeline,children:(e.history??[]).map((n,s)=>{const a=t.states.find(i=>i.id===n.toStateId),r=n.fromStateId?t.states.find(i=>i.id===n.fromStateId):null;return o.jsxs("div",{style:bt.timelineEntry,children:[o.jsx("div",{style:bt.timelineDot}),o.jsxs("div",{style:bt.timelineContent,children:[o.jsxs("div",{style:bt.timelineHeader,children:[o.jsx("span",{style:bt.timelineTime,children:iW(n.timestamp)}),n.transitionName&&o.jsxs("span",{style:bt.timelineTransition,children:["via ",n.transitionName]})]}),o.jsxs("div",{style:bt.timelineStates,children:[r&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:bt.timelineStateName,children:r.name}),o.jsx("span",{style:bt.timelineArrow,children:"→"})]}),o.jsx("span",{style:{...bt.timelineStateName,fontWeight:600},children:(a==null?void 0:a.name)||n.toStateId})]}),n.details&&o.jsx("div",{style:bt.timelineDetails,children:n.details})]})]},s)})})}function pW({variables:t}){const e=Object.entries(t);if(e.length===0)return o.jsx("div",{style:bt.emptyState,children:"No variables set"});const n=e.filter(([a])=>!a.startsWith("wi_")),s=e.filter(([a])=>a.startsWith("wi_"));return o.jsxs("div",{style:bt.variablesSection,children:[n.length>0&&o.jsxs("div",{style:bt.varGroup,children:[o.jsx("div",{style:bt.varGroupLabel,children:"Variables"}),n.map(([a,r])=>o.jsxs("div",{style:bt.varRow,children:[o.jsx("span",{style:bt.varKey,children:a}),o.jsx("span",{style:bt.varValue,children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]}),s.length>0&&o.jsxs("div",{style:bt.varGroup,children:[o.jsx("div",{style:bt.varGroupLabel,children:"Internal"}),s.map(([a,r])=>o.jsxs("div",{style:bt.varRow,children:[o.jsx("span",{style:{...bt.varKey,opacity:.6},children:a}),o.jsx("span",{style:{...bt.varValue,opacity:.6},children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]})]})}const bt={headerBadge:{fontSize:10,fontWeight:700,background:"var(--accent-color, #cba6f7)",color:"#1e1e2e",borderRadius:8,padding:"0 5px",marginLeft:6,minWidth:16,textAlign:"center",lineHeight:"16px"},instanceList:{display:"flex",flexDirection:"column",gap:2,padding:"4px 4px 0",maxHeight:180,overflowY:"auto",flexShrink:0,borderBottom:"1px solid var(--border-color, #313244)"},instanceRow:{display:"flex",flexDirection:"column",gap:2,padding:"5px 8px",border:"1px solid transparent",borderRadius:4,background:"transparent",cursor:"pointer",textAlign:"left",width:"100%",color:"inherit"},instanceRowSelected:{background:"rgba(203, 166, 247, 0.08)",border:"1px solid var(--accent-color, #cba6f7)"},instanceRowTop:{display:"flex",alignItems:"center",gap:6},instanceRowBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:12},statusDot:{display:"inline-block",width:7,height:7,borderRadius:"50%",flexShrink:0},instanceName:{fontSize:11,fontWeight:600,color:"var(--text-primary, #cdd6f4)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},instanceStatus:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.3px",flexShrink:0},instanceState:{fontSize:10,color:"var(--text-secondary, #a6adc8)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},instanceTime:{fontSize:9,color:"var(--text-secondary, #a6adc8)",opacity:.7,flexShrink:0,whiteSpace:"nowrap"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:24,color:"var(--text-secondary, #a6adc8)",fontSize:12},emptyIcon:{fontSize:20,opacity:.5},loadingText:{fontSize:11,color:"var(--text-secondary, #a6adc8)",fontStyle:"italic"},instanceView:{display:"flex",flexDirection:"column",flex:1,minHeight:0},statusBar:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},statusBadge:{fontSize:10,fontWeight:700,textTransform:"uppercase",border:"1px solid",borderRadius:4,padding:"1px 6px",letterSpacing:"0.5px"},currentLabel:{fontSize:12,color:"var(--text-secondary, #a6adc8)"},transitionSection:{padding:"8px 12px",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},transitionLabel:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:"var(--text-secondary, #a6adc8)",marginBottom:6,letterSpacing:"0.5px"},transitionButtons:{display:"flex",flexDirection:"column",gap:4},transitionBtn:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",border:"1px solid var(--accent-color, #cba6f7)",borderRadius:4,background:"transparent",color:"var(--accent-color, #cba6f7)",cursor:"pointer",fontSize:12,fontWeight:500,transition:"background 0.15s"},transitionArrow:{fontSize:10,opacity:.7,fontWeight:400},transitionError:{fontSize:11,color:"#f38ba8",marginTop:4},tabs:{display:"flex",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},tab:{flex:1,padding:"6px 8px",border:"none",borderBottom:"2px solid transparent",background:"transparent",color:"var(--text-secondary, #a6adc8)",cursor:"pointer",fontSize:11,fontWeight:500,textAlign:"center"},tabActive:{color:"var(--text-primary, #cdd6f4)",borderBottomColor:"var(--accent-color, #cba6f7)"},tabContent:{flex:1,overflow:"auto",minHeight:0},stateList:{display:"flex",flexDirection:"column",gap:2,padding:4},stateItem:{padding:"6px 8px",borderRadius:4,border:"1px solid transparent"},stateItemCurrent:{border:"1px solid var(--accent-color, #cba6f7)",background:"rgba(203, 166, 247, 0.08)",boxShadow:"0 0 8px rgba(203, 166, 247, 0.15)"},stateHeader:{display:"flex",alignItems:"center",gap:6},stateTypeBadge:{fontSize:9,fontWeight:700,textTransform:"uppercase",border:"1px solid",borderRadius:3,padding:"0 4px",letterSpacing:"0.3px"},stateName:{fontSize:12,fontWeight:500,color:"var(--text-primary, #cdd6f4)"},currentBadge:{fontSize:8,fontWeight:700,color:"#cba6f7",background:"rgba(203, 166, 247, 0.15)",borderRadius:3,padding:"1px 4px",marginLeft:"auto",letterSpacing:"0.5px"},stateDescription:{fontSize:11,color:"var(--text-secondary, #a6adc8)",marginTop:3,paddingLeft:2},stateTransitions:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},transitionChip:{fontSize:9,color:"var(--text-secondary, #a6adc8)",background:"var(--surface-1, #313244)",borderRadius:3,padding:"1px 5px"},timeline:{padding:"4px 8px"},timelineEntry:{display:"flex",gap:8,paddingBottom:10,position:"relative"},timelineDot:{width:8,height:8,borderRadius:"50%",background:"var(--accent-color, #cba6f7)",flexShrink:0,marginTop:3},timelineContent:{flex:1,minWidth:0},timelineHeader:{display:"flex",alignItems:"center",gap:6,marginBottom:2},timelineTime:{fontSize:10,color:"var(--text-secondary, #a6adc8)",fontFamily:"monospace"},timelineTransition:{fontSize:10,color:"#89b4fa",fontStyle:"italic"},timelineStates:{display:"flex",alignItems:"center",gap:4,fontSize:11,color:"var(--text-primary, #cdd6f4)"},timelineStateName:{fontWeight:400},timelineArrow:{color:"var(--text-secondary, #a6adc8)",fontSize:10},timelineDetails:{fontSize:10,color:"var(--text-secondary, #a6adc8)",marginTop:2,whiteSpace:"pre-wrap",wordBreak:"break-word"},variablesSection:{padding:4},varGroup:{marginBottom:8},varGroupLabel:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:"var(--text-secondary, #a6adc8)",padding:"4px 8px",letterSpacing:"0.5px"},varRow:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,padding:"3px 8px",borderRadius:3},varKey:{fontSize:11,fontFamily:"monospace",color:"#cba6f7",flexShrink:0},varValue:{fontSize:11,fontFamily:"monospace",color:"var(--text-primary, #cdd6f4)",textAlign:"right",wordBreak:"break-all"}},hW=b.memo(function(){const{t:e}=pt(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(()=>Qx()),[i,c]=b.useState(-1),d=b.useRef(null),f=b.useRef(null),h=Js.findIndex(S=>S.id===a);b.useEffect(()=>{if(!n)return;const S=C=>{d.current&&!d.current.contains(C.target)&&s(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n]),b.useEffect(()=>{n&&c(h)},[n,h]);const m=S=>{const C=S==="next"?(h+1)%Js.length:(h-1+Js.length)%Js.length,k=Js[C],N=du(k.id);lp(N),r(k.id)},x=S=>{n||(S.key==="ArrowUp"||S.key==="ArrowLeft"?(S.preventDefault(),m("prev")):S.key==="ArrowDown"||S.key==="ArrowRight"?(S.preventDefault(),m("next")):(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),s(!0)))};b.useEffect(()=>{if(!n)return;const S=C=>{var k,N;C.key==="Escape"?(s(!1),(k=f.current)==null||k.focus()):C.key==="ArrowDown"?(C.preventDefault(),c(j=>(j+1)%Js.length)):C.key==="ArrowUp"?(C.preventDefault(),c(j=>(j-1+Js.length)%Js.length)):C.key==="Enter"&&i>=0&&(C.preventDefault(),y(Js[i].id),(N=f.current)==null||N.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[n,i]);const y=S=>{const C=du(S);lp(C),r(S),s(!1)},v=du(a);return o.jsxs("div",{className:"theme-selector",ref:d,children:[o.jsxs("button",{ref:f,className:"theme-selector-trigger",onClick:()=>s(!n),onKeyDown:x,title:e("terminal:themeSelector.themeTitle",{name:v.name}),children:[o.jsx("span",{className:"theme-selector-icon",children:"🎨"}),o.jsx("span",{className:"theme-selector-name",children:v.name}),o.jsx("span",{className:"theme-selector-arrow",children:n?"▲":"▼"})]}),n&&o.jsxs("div",{className:"theme-selector-dropdown",onMouseDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:[o.jsx("div",{className:"theme-selector-header",children:e("terminal:themeSelector.selectTheme")}),o.jsx("div",{className:"theme-selector-list",children:Js.map((S,C)=>o.jsxs("button",{className:`theme-selector-option ${S.id===a?"active":""} ${C===i?"highlighted":""}`,onClick:k=>{k.stopPropagation(),y(S.id)},onMouseDown:k=>k.stopPropagation(),onMouseEnter:()=>c(C),children:[o.jsx("span",{className:"theme-option-preview",style:{background:`linear-gradient(135deg, ${S.colors.bgPrimary} 0%, ${S.colors.bgSecondary} 50%, ${S.colors.accentPurple} 100%)`}}),o.jsxs("span",{className:"theme-option-info",children:[o.jsx("span",{className:"theme-option-name",children:S.name}),o.jsx("span",{className:"theme-option-desc",children:S.description})]}),S.id===a&&o.jsx("span",{className:"theme-option-check",children:"✓"})]},S.id))})]})]})}),jA=48,mW=49,gW=50,NA=48,bW={background:"#1a1a2e",foreground:"#f8f8f2",cursor:"#f8f8f2",cursorAccent:"#1a1a2e",selectionBackground:"#44475a",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"};function xW(t,e){let n=null;const s=(...a)=>{n&&clearTimeout(n),n=setTimeout(()=>t(...a),e)};return s.cancel=()=>{n&&clearTimeout(n)},s}const Gt=(...t)=>console.log("[TerminalEmbed]",...t);function TA(t){var e;Gt("copyToClipboard called, text:",t.slice(0,50)),Gt("navigator.clipboard available:",!!navigator.clipboard),Gt("document.hasFocus:",document.hasFocus()),(e=navigator.clipboard)!=null&&e.writeText?navigator.clipboard.writeText(t).then(()=>Gt("clipboard.writeText SUCCESS"),n=>{Gt("clipboard.writeText FAILED:",(n==null?void 0:n.message)||n),EA(t)}):(Gt("navigator.clipboard not available, using fallback"),EA(t))}function EA(t){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-9999px",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select();try{const n=document.execCommand("copy");Gt("execCommand fallback:",n?"SUCCESS":"FAILED")}catch(n){Gt("execCommand fallback error",n)}document.body.removeChild(e)}const Yb=b.memo(function({terminalUrl:e,visible:n}){const s=b.useRef(null),a=b.useRef(null),r=b.useRef(null),i=b.useRef(null),c=b.useRef(!1),d=b.useRef(new TextEncoder),f=b.useCallback(m=>{const x=i.current;if(!x||x.readyState!==WebSocket.OPEN)return;const y=d.current.encode(m),v=new Uint8Array(y.length+1);v[0]=NA,v.set(y,1),x.send(v)},[]),h=b.useCallback((m,x)=>{const y=i.current;!y||y.readyState!==WebSocket.OPEN||y.send("1"+JSON.stringify({columns:m,rows:x}))},[]);return b.useEffect(()=>{if(Gt("useEffect fired",{visible:n,init:c.current,hasContainer:!!s.current,terminalUrl:e}),!n||c.current||!s.current)return;c.current=!0;let m=!1,x=null,y=null,v=null,S=null,C=null,k=null;return(async()=>{Gt("Lazy-loading xterm.js modules...");const[N,j,E,D]=await Promise.all([vt(()=>import("./xterm-BqvuqXEL.js"),[]),vt(()=>import("./addon-fit-YJmn1quW.js"),[]),vt(()=>import("./addon-clipboard-Ckztrdv4.js"),[]),vt(()=>import("./addon-web-links-BWjmmSgS.js"),[])]);if(m){Gt("Destroyed after module load, aborting");return}if(await vt(()=>Promise.resolve({}),__vite__mapDeps([16])),Gt("Modules loaded, xterm exports:",Object.keys(N)),m||!s.current)return;const _=N.Terminal,P=j.FitAddon,O=E.ClipboardAddon,T=D.WebLinksAddon;x=new _({theme:bW,fontSize:13,scrollback:5e3,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Menlo', 'Monaco', 'Courier New', monospace",cursorBlink:!0,allowProposedApi:!0,disableStdin:!1,rightClickSelectsWord:!1}),a.current=x,y=new P,r.current=y,x.loadAddon(y),x.loadAddon(new O),x.loadAddon(new T),x.attachCustomKeyEventHandler(V=>!(V.ctrlKey&&V.key==="c"&&x.hasSelection()||V.ctrlKey&&V.key==="v"||V.ctrlKey&&V.shiftKey&&V.key==="C"||V.ctrlKey&&V.shiftKey&&V.key==="V"));const M=s.current.getBoundingClientRect();Gt("Container dimensions before open:",{w:M.width,h:M.height}),x.open(s.current),y.fit(),Gt("Terminal opened, cols:",x.cols,"rows:",x.rows),x.onSelectionChange(()=>{Gt(">>> onSelectionChange FIRED",{hasSelection:x.hasSelection()});const V=x.hasSelection()?x.getSelection():"";V&&(Gt("onSelectionChange copying text:",V.slice(0,50)),TA(V))}),s.current.addEventListener("mousedown",V=>{Gt("mousedown",{button:V.button,shiftKey:V.shiftKey,metaKey:V.metaKey,ctrlKey:V.ctrlKey})}),s.current.addEventListener("mouseup",V=>{Gt("mouseup",{button:V.button,shiftKey:V.shiftKey,hasSel:x.hasSelection()})}),Gt("Registering OSC 52 handler"),x.parser.registerOscHandler(52,V=>{Gt(">>> OSC 52 received",{dataLength:V.length,data:V.slice(0,80)});const G=V.split(";"),B=G.length>1?G.slice(1).join(";"):G[0];if(B)try{const Q=Uint8Array.from(atob(B),q=>q.charCodeAt(0)),K=new TextDecoder().decode(Q);Gt("OSC 52 decoded:",K.slice(0,50)),TA(K)}catch{}return!1}),k=V=>V.preventDefault(),s.current.addEventListener("contextmenu",k),x.onData(V=>f(V)),x.onBinary(V=>{const G=i.current;if(!G||G.readyState!==WebSocket.OPEN)return;const B=new Uint8Array(V.length+1);B[0]=NA;for(let Q=0;Q<V.length;Q++)B[Q+1]=V.charCodeAt(Q);G.send(B)}),S=xW(()=>{y&&x&&(y.fit(),h(x.cols,x.rows))},100),C=new ResizeObserver(()=>S()),C.observe(s.current);const R=e.endsWith("/")?e.slice(0,-1):e,I=mb(`${R}/token`);Gt("Fetching ttyd token from:",I);let z="";try{const V=await fetch(I);if(Gt("Token response status:",V.status,"content-type:",V.headers.get("content-type")),V.ok){const G=await V.text();Gt("Token raw response:",G);try{z=JSON.parse(G).token||""}catch{z=G.trim()}Gt("Parsed ttyd token:",z?z.slice(0,16)+"...":"(empty)")}else Gt("Token fetch failed:",V.status,V.statusText)}catch(V){Gt("Token fetch error:",V)}if(m)return;const W=window.location.protocol==="https:"?"wss:":"ws:",$=mb(`${R}/ws`),F=`${W}//${window.location.host}${$}`;Gt("Connecting WebSocket to:",F),v=new WebSocket(F,["tty"]),v.binaryType="arraybuffer",i.current=v,v.onopen=()=>{if(Gt("WebSocket OPEN"),x&&y){y.fit();const V=JSON.stringify({AuthToken:z,columns:x.cols,rows:x.rows});Gt("Sending init message (as binary):",V),v.send(d.current.encode(V))}};let H=0;v.onmessage=V=>{if(x){if(H++,H<=5){const G=V.data instanceof ArrayBuffer?"ArrayBuffer":typeof V.data,B=V.data instanceof ArrayBuffer?V.data.byteLength:V.data.length;if(Gt(`WS message #${H}: type=${G} size=${B}`),V.data instanceof ArrayBuffer){const Q=new Uint8Array(V.data).slice(0,20);Gt(` First bytes: [${Array.from(Q).join(", ")}]`)}}if(V.data instanceof ArrayBuffer){const G=new Uint8Array(V.data);if(G.length<1)return;const B=G[0];B===jA?x.write(G.subarray(1)):B===mW?Gt("Received SET_TITLE"):B===gW?Gt("Received SET_PREFS:",new TextDecoder().decode(G.subarray(1))):Gt("Unknown binary cmd:",B,"char:",String.fromCharCode(B))}else typeof V.data=="string"&&(H<=5&&Gt("String message, first char code:",V.data.charCodeAt(0)),V.data.charCodeAt(0)===jA&&x.write(V.data.slice(1)))}},v.onclose=V=>{Gt("WebSocket CLOSED, code:",V.code,"reason:",V.reason,"wasClean:",V.wasClean,"totalMessages:",H),x&&!m&&x.write(`\r
|
|
148
|
-
\x1B[90m[Terminal disconnected]\x1B[0m\r
|
|
149
|
-
`)},v.onerror=V=>{Gt("WebSocket ERROR:",V)},x.onResize(({cols:V,rows:G})=>h(V,G))})(),()=>{var N;m=!0,c.current=!1,S==null||S.cancel(),C==null||C.disconnect(),k&&((N=s.current)==null||N.removeEventListener("contextmenu",k)),v&&v.readyState<=WebSocket.OPEN&&v.close(),i.current=null,x==null||x.dispose(),a.current=null,r.current=null}},[n,e,f,h]),b.useEffect(()=>{n&&r.current&&a.current&&requestAnimationFrame(()=>{var m;(m=r.current)==null||m.fit(),a.current&&h(a.current.cols,a.current.rows)})},[n,h]),o.jsx("div",{ref:s,className:"guake-bottom-terminal-embed",style:{display:n?void 0:"none"}})}),yW=[{key:"working",title:"Working",emptyLabel:"No agents",toneClass:"working"},{key:"waiting-subordinates",title:"Waiting Subordinates",emptyLabel:"No agents",toneClass:"waiting-subordinates"},{key:"need-review",title:"Need Review",emptyLabel:"No agents",toneClass:"need-review"},{key:"blocked",title:"Blocked",emptyLabel:"No agents",toneClass:"blocked"},{key:"can-clear-context",title:"Can Clear Context",emptyLabel:"No agents",toneClass:"can-clear-context"}];function vW({activeAgentId:t,onSelectAgent:e}){const{t:n}=pt(["terminal","common"]),[s]=ox(),a=nL(),[r,i]=b.useState(new Set),c=b.useMemo(()=>yW.map(y=>{const v=a[y.key].filter(S=>{if(!s)return!0;const C=U.getAreaForAgent(S.id);return xp((C==null?void 0:C.id)??null)}).sort((S,C)=>(C.trackingStatusTimestamp||0)-(S.trackingStatusTimestamp||0));return{...y,agents:v}}),[s,a]),d=b.useCallback(async y=>{try{const v=await Lt(Mt(`/api/agents/${y}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({trackingStatus:null})});if(!v.ok)throw new Error(`Failed to clear tracking status: ${v.statusText}`);const S=U.getState().agents.get(y);S&&U.updateAgent({...S,trackingStatus:null,trackingStatusDetail:void 0,trackingStatusTimestamp:void 0})}catch(v){console.error("Failed to clear tracking status",v)}},[]),f=b.useCallback(async y=>{i(v=>new Set(v).add(y.id));try{await d(y.id)}finally{i(v=>{const S=new Set(v);return S.delete(y.id),S})}},[d]),[h,m]=b.useState(null),x=b.useCallback(async(y,v)=>{if(v.length!==0){m(y),i(S=>{const C=new Set(S);return v.forEach(k=>C.add(k.id)),C});try{for(const S of v)y==="can-clear-context"&&U.clearContext(S.id),await d(S.id)}finally{m(null),i(S=>{const C=new Set(S);return v.forEach(k=>C.delete(k.id)),C})}}},[d]);return o.jsx("div",{className:"tracking-board",children:c.map(y=>o.jsxs("section",{className:`tracking-board-column tracking-board-column--${y.toneClass}`,children:[o.jsxs("header",{className:"tracking-board-column-header",children:[o.jsx("span",{className:"tracking-board-column-indicator"}),o.jsx("span",{className:"tracking-board-column-title",children:y.title}),y.agents.length>0&&o.jsx("button",{type:"button",className:`tracking-board-column-action${y.key==="can-clear-context"?" tracking-board-column-action--context":""}`,onClick:()=>void x(y.key,y.agents),disabled:h===y.key,title:y.key==="can-clear-context"?"Clear context and status for all agents":"Clear status for all agents in this column",children:h===y.key?"Clearing...":y.key==="can-clear-context"?`Clear All (${y.agents.length})`:"Clear all"}),o.jsx("span",{className:"tracking-board-column-count",children:y.agents.length})]}),o.jsx("div",{className:"tracking-board-column-body",children:y.agents.length===0?o.jsx("div",{className:"tracking-board-empty",children:y.emptyLabel}):y.agents.map(v=>o.jsx(wW,{agent:v,isActive:v.id===t,isClearing:r.has(v.id),onSelectAgent:e,onClearStatus:f,timeLabel:v.trackingStatusTimestamp?gp(v.trackingStatusTimestamp):n("common:time.justNow",{defaultValue:"just now"})},v.id))})]},y.key))})}function wW({agent:t,isActive:e,isClearing:n,onSelectAgent:s,onClearStatus:a,timeLabel:r}){const i=Pa(),c=Ia(t.class,i);return o.jsxs("article",{className:`tracking-board-card${e?" active":""}`,onClick:()=>s(t.id),title:t.trackingStatusDetail||t.taskLabel||t.name,children:[o.jsxs("div",{className:"tracking-board-card-header",children:[o.jsxs("div",{className:"tracking-board-card-identity",children:[o.jsx("span",{className:"tracking-board-card-class-icon",style:{color:c.color},"aria-hidden":"true",children:c.icon}),o.jsx("span",{className:"tracking-board-card-name",children:t.name})]}),o.jsx("button",{type:"button",className:"tracking-board-card-clear",onClick:d=>{d.stopPropagation(),a(t)},disabled:n,title:"Clear tracking status","aria-label":"Clear tracking status",children:"×"})]}),t.taskLabel&&o.jsx("div",{className:"tracking-board-card-task",title:t.taskLabel,children:t.taskLabel}),o.jsx("div",{className:"tracking-board-card-detail",children:t.trackingStatusDetail||t.currentTask||"No detail provided"}),o.jsxs("div",{className:"tracking-board-card-footer",children:[o.jsx("span",{className:"tracking-board-card-class",children:t.class}),o.jsx("span",{className:"tracking-board-card-time",children:r})]})]})}const kW=128,SW=95;function CW(t,e){if(e.type==="rectangle"&&e.width&&e.height){const n=e.width/2,s=e.height/2;return t.x>=e.center.x-n&&t.x<=e.center.x+n&&t.z>=e.center.z-s&&t.z<=e.center.z+s}if(e.type==="circle"&&e.radius){const n=t.x-e.center.x,s=t.z-e.center.z;return n*n+s*s<=e.radius*e.radius}return!1}let AW=1;function vf(){return`bp-${AW++}`}const jW=b.memo(function({buildingId:e,filterText:n,maxRetention:s}){const{streamingBuildingLogs:a}=vs(),r=a.get(e)||"",i=b.useRef(null),c=b.useRef(!1),d=b.useRef(0),f=n.trim().toLowerCase(),h=30,m=b.useCallback(()=>{const j=i.current;if(!j)return;const E=j.scrollTop+j.clientHeight>=j.scrollHeight-h;c.current=!E},[]),x=b.useMemo(()=>Ej(r,s),[r,s]);b.useLayoutEffect(()=>{const j=i.current;if(!j)return;const E=d.current,D=j.scrollHeight;if(c.current){const _=E-D;_>0&&(j.scrollTop=Math.max(0,j.scrollTop-_))}else j.scrollTop=D;d.current=j.scrollHeight},[x,f]);const y=b.useMemo(()=>x?f?x.split(`
|
|
150
|
-
`).filter(j=>j.toLowerCase().includes(f)).join(`
|
|
151
|
-
`):x:"",[x,f]),v=b.useMemo(()=>y?y.split(`
|
|
152
|
-
`):[],[y]),S=b.useMemo(()=>v.map(j=>Sl(j||" ")),[v]),C=b.useMemo(()=>x?f&&!y?"No log lines match the current filter.":null:"Waiting for logs...",[x,f,y]),k=p1({count:S.length,getScrollElement:()=>i.current,estimateSize:()=>20,overscan:12,measureElement:j=>j.getBoundingClientRect().height}),N=k.getVirtualItems();return o.jsx("div",{ref:i,className:"guake-bottom-pm2-logs",onScroll:m,children:C?o.jsx("div",{className:"guake-bottom-pm2-logs-empty",children:C}):o.jsx("div",{className:"guake-bottom-pm2-logs-inner",style:{height:k.getTotalSize()},children:N.map(j=>o.jsx("div",{ref:k.measureElement,className:"guake-bottom-pm2-log-line","data-index":j.index,style:{transform:`translateY(${j.start}px)`},dangerouslySetInnerHTML:{__html:S[j.index]}},j.key))})})});b.memo(function({src:e,title:n}){const s=b.useRef(null),[a,r]=b.useState(!1),[i,c]=b.useState(null);b.useEffect(()=>{r(!1),c(null);const h=setTimeout(()=>c(e),400);return()=>clearTimeout(h)},[e]);const d=b.useCallback(()=>{var m;const h=s.current;if(h){document.activeElement===h&&h.blur();try{(m=h.contentWindow)==null||m.blur()}catch{}}},[]),f=b.useCallback(()=>{const h=document.querySelector(".guake-input-container"),m=h==null?void 0:h.querySelector("textarea, input");h==null||h.focus({preventScroll:!0}),m==null||m.focus({preventScroll:!0})},[]);return b.useEffect(()=>{if(!i)return;const h=Date.now(),m=()=>{Date.now()-h>1500||(d(),f())};return window.addEventListener("focus",m,!0),document.addEventListener("focusin",m,!0),()=>{window.removeEventListener("focus",m,!0),document.removeEventListener("focusin",m,!0)}},[f,d,i]),o.jsxs(o.Fragment,{children:[!a&&o.jsx("div",{className:"guake-bottom-terminal-starting",children:o.jsx("span",{children:"Loading terminal..."})}),o.jsx("iframe",{ref:s,src:i??void 0,className:`guake-bottom-terminal-iframe${a?"":" iframe-loading"}`,title:n,allow:"clipboard-read; clipboard-write",loading:"lazy",tabIndex:-1,onLoad:()=>{r(!0),d(),f()}})]})});const NW=b.memo(function({onSaveSnapshot:e}={}){var ur,$l,So,Hl,Gr,oa,Co,Yr,Na,Ao,Mi,Ul,Di;const{t:n}=pt(["terminal","common"]),s=Dl(),a=dx(),r=Lj(),i=Pj(),c=hx(),d=mx(),f=SL(),h=!!f,m=b.useMemo(()=>f?{id:f.agentId,name:f.agentName,class:f.agentClass,status:"idle",provider:"claude",position:{x:0,y:0,z:0},cwd:f.cwd,permissionMode:"interactive",tokensUsed:0,contextUsed:0,contextLimit:2e5,taskCount:0,createdAt:f.createdAt,lastActivity:f.createdAt}:null,[f]),x=Array.from(a),v=x.length===1?x[0]:null,C=(ux(v)||null)??(h?m:null),k=v??(h?(f==null?void 0:f.agentId)??null:null),N=_L(),j=rr(),E=px(),D=b.useMemo(()=>{if(!k)return null;const ee=new Set,Ne=[];for(const Ue of j.values())Ue.archived||Ue.directories.length===0||Ue.assignedAgentIds.includes(k)&&(ee.add(Ue.id),Ne.push(Ue));const fe=s.get(k);if(fe)for(const Ue of j.values())Ue.archived||Ue.directories.length===0||ee.has(Ue.id)||CW({x:fe.position.x,z:fe.position.z},Ue)&&(ee.add(Ue.id),Ne.push(Ue));return Ne.length===0?null:Ne.flatMap(Ue=>Ue.directories.filter(gt=>gt&>.trim().length>0).map(gt=>({areaId:Ue.id,areaName:Ue.name,dir:gt})))},[k,j,s]),_=b.useMemo(()=>{var fe;if(!k)return[];const ee=U.getAreaForAgent(k);if(!ee)return[];const Ne=[];for(const Ue of E.values())Ue.type==="terminal"&&U.isPositionInArea(Ue.position,ee)&&Ne.push({id:Ue.id,name:Ue.name,hasUrl:!!((fe=Ue.terminalStatus)!=null&&fe.url)});return Ne},[k,E,j]),P=b.useMemo(()=>{var fe;if(!k)return[];const ee=U.getAreaForAgent(k);if(!ee)return[];const Ne=[];for(const Ue of E.values())Ue.type==="server"&&((fe=Ue.pm2)!=null&&fe.enabled)&&U.isPositionInArea(Ue.position,ee)&&Ne.push({id:Ue.id,name:Ue.name});return Ne},[k,E,j]),O=b.useMemo(()=>{if(!k)return[];const ee=U.getAreaForAgent(k);if(!ee)return[];const Ne=[];for(const fe of E.values())fe.type==="database"&&fe.database&&U.isPositionInArea(fe.position,ee)&&Ne.push({id:fe.id,name:fe.name});return Ne},[k,E,j]),{branches:T,fetchRemote:M,fetchingDirs:R}=s6(D),{terminalHeight:I,terminalRef:z,handleResizeStart:W}=XU(),{mobileOverviewHeight:$,handleResizeMouseDown:F,handleResizeTouchStart:H}=e6(),V=QU(),[G,B]=b.useState(()=>{const ee=Zb(ft.SIDE_PANEL_WIDTH,420);return Math.max(280,Math.min(700,ee))}),Q=b.useRef(null),K=b.useCallback((ee,Ne)=>{ee.preventDefault(),Q.current={startX:ee.clientX,startW:G},document.body.style.cursor="ew-resize",document.body.style.userSelect="none",U.setTerminalResizing(!0);let fe=G;const Ue=Tt=>{if(!Q.current)return;const Cn=Tt.clientX-Q.current.startX,tn=Ne==="left"?-Cn:Cn;fe=Math.max(280,Math.min(700,Q.current.startW+tn)),B(fe)},gt=()=>{Q.current=null,document.body.style.cursor="",document.body.style.userSelect="",U.setTerminalResizing(!1),document.removeEventListener("mousemove",Ue),document.removeEventListener("mouseup",gt),ex(ft.SIDE_PANEL_WIDTH,fe)};document.addEventListener("mousemove",Ue),document.addEventListener("mouseup",gt)},[G]),q=b.useRef(null),xe=b.useRef(null),[de,Z]=b.useState(()=>{const ee=va(ft.VIEW_MODE);return ee==="simple"||ee==="chat"||ee==="advanced"?ee:va(ft.ADVANCED_VIEW)==="true"?"advanced":"simple"}),[be,je]=b.useState(()=>Er(ft.TERMINAL_FULLSCREEN,!1)),[ce,Ee]=b.useState(null),[ze,Ge]=b.useState(null),[_e,me]=b.useState(null),[De,te]=b.useState(null),[He,ye]=b.useState(!1);Qt("guake-image-modal",ce!==null,()=>Ee(null)),Qt("guake-bash-modal",ze!==null,()=>Ge(null)),Qt("guake-response-modal",De!==null,()=>te(null)),Qt("guake-context-confirm",_e!==null,()=>me(null)),Qt("guake-agent-info",He,()=>ye(!1));const[Re,re]=b.useState(!1),[pe,Ve]=b.useState(()=>hs.isEnabled()),[at,ut]=b.useState(()=>Er(ft.GIT_PANEL_OPEN,!1)),ue=b.useCallback(ee=>{ut(ee),Qa(ft.GIT_PANEL_OPEN,ee)},[]),[X,se]=b.useState(()=>Er(ft.BUILDINGS_PANEL_OPEN,!1)),ke=b.useCallback(ee=>{se(ee),Qa(ft.BUILDINGS_PANEL_OPEN,ee)},[]),[J,we]=b.useState(()=>Er(ft.WORKFLOW_PANEL_OPEN,!1)),We=b.useCallback(ee=>{we(ee),Qa(ft.WORKFLOW_PANEL_OPEN,ee)},[]),[Be,ie]=b.useState(!1);b.useEffect(()=>{if(!k){ie(!1);return}let ee=!1;return(async()=>{try{const Ne=await Lt(Mt("/api/workflows/definitions"));if(ee||!Ne.ok)return;const Ue=(await Ne.json()).some(gt=>gt.states.some(Tt=>{var Cn,tn;return((Cn=Tt.action)==null?void 0:Cn.type)==="agent_task"&&((tn=Tt.action)==null?void 0:tn.agentId)===k}));ee||ie(Ue)}catch{ee||ie(!1)}})(),()=>{ee=!0}},[k]);const Ie=EL(),oe=b.useCallback(ee=>U.setOverviewPanelOpen(ee),[]),[he,ne]=b.useState([]),[Le,Qe]=b.useState({}),[$e,nt]=b.useState(()=>Tj()),[ot,st]=b.useState(()=>{try{return localStorage.getItem("tide:bottom-split-direction")==="vertical"?"vertical":"horizontal"}catch{return"horizontal"}}),[lt,it]=b.useState(()=>{try{const ee=localStorage.getItem("tide:bottom-terminal-height");return ee?Math.max(120,Math.min(600,Number(ee))):250}catch{return 250}}),ht=b.useRef(null),[jt,ge]=b.useState([1]),Te=b.useRef(null),Ye=b.useRef(null),[tt,Nt]=b.useState(null),[zt,Pt]=b.useState(null),It=b.useMemo(()=>he.filter(ee=>ee.areaId===zt),[he,zt]),Vt=b.useMemo(()=>new Set(It.map(ee=>ee.buildingId)),[It]),mt=b.useRef(new Map);b.useEffect(()=>{try{const ee=localStorage.getItem("tide:bottom-panels-v2");if(ee){const Ne=JSON.parse(ee);mt.current=new Map(Ne.map(([fe,Ue])=>[fe,Ue.map(gt=>({id:gt.id??vf(),type:gt.type,buildingId:gt.buildingId}))]))}else{const Ne=localStorage.getItem("tide:bottom-terminals");if(Ne){const fe=JSON.parse(Ne);for(const[Ue,gt]of fe)mt.current.set(Ue,[{id:vf(),type:"terminal",buildingId:gt}])}}}catch{}},[]);const ct=b.useCallback(ee=>{if(!k)return;const Ne=U.getAreaForAgent(k);if(Ne)try{ee.length>0?mt.current.set(Ne.id,ee.map(Ue=>({id:Ue.id,type:Ue.type,buildingId:Ue.buildingId}))):mt.current.delete(Ne.id);const fe=Array.from(mt.current.entries());localStorage.setItem("tide:bottom-panels-v2",JSON.stringify(fe))}catch{}},[k]),xt=b.useCallback(()=>{if(!k)return null;const ee=U.getAreaForAgent(k);return(ee==null?void 0:ee.id)??null},[k]),Dt=b.useCallback((ee,Ne)=>{const fe=xt();Qe({}),ne(Ue=>{for(const tn of Ue)tn.areaId===fe&&tn.type==="pm2-logs"&&U.stopLogStreaming(tn.buildingId);const gt=Ue.filter(tn=>tn.areaId!==fe),Tt={id:vf(),type:Ne,buildingId:ee,areaId:fe??void 0},Cn=[...gt,Tt];return ct([Tt]),Cn})},[ct,xt]),Sn=b.useCallback((ee,Ne,fe)=>{const Ue=xt();st(fe);try{localStorage.setItem("tide:bottom-split-direction",fe)}catch{}ne(gt=>{const Tt=gt.filter($n=>$n.areaId===Ue);if(Tt.length>=4||Tt.some($n=>$n.buildingId===ee))return gt;const Cn={id:vf(),type:Ne,buildingId:ee,areaId:Ue??void 0},tn=[...gt,Cn];return ct(Tt.concat(Cn)),tn})},[ct,xt]),cn=b.useCallback(ee=>{Qe(Ne=>{if(!(ee in Ne))return Ne;const fe={...Ne};return delete fe[ee],fe}),ne(Ne=>{const fe=Ne.find(Tt=>Tt.id===ee);(fe==null?void 0:fe.type)==="pm2-logs"&&U.stopLogStreaming(fe.buildingId);const Ue=Ne.filter(Tt=>Tt.id!==ee),gt=fe==null?void 0:fe.areaId;return gt&&ct(Ue.filter(Tt=>Tt.areaId===gt)),Ue})},[ct]);b.useCallback(()=>{Qe({}),ne(ee=>{for(const Ne of ee)Ne.type==="pm2-logs"&&U.stopLogStreaming(Ne.buildingId);return ct([]),[]})},[ct]),b.useEffect(()=>{if(!k){Pt(null);return}const ee=U.getAreaForAgent(k);if(!ee){Pt(null);return}Pt(ee.id),ne(Ne=>{if(Ne.filter(Tt=>Tt.areaId===ee.id).length>0)return Ne;const Ue=mt.current.get(ee.id);if(!Ue||Ue.length===0)return Ne;const gt=Ue.map(Tt=>({id:Tt.id,type:Tt.type,buildingId:Tt.buildingId,areaId:ee.id}));return[...Ne,...gt]})},[k]),b.useEffect(()=>{const ee=Ne=>{const fe=Ne.detail;fe!=null&&fe.buildingId&&Dt(fe.buildingId,"terminal")};return window.addEventListener("tide:open-bottom-terminal",ee),()=>window.removeEventListener("tide:open-bottom-terminal",ee)},[Dt]),b.useEffect(()=>{const ee=Ne=>{const fe=Ne.detail;fe!=null&&fe.buildingId&&Dt(fe.buildingId,"pm2-logs")};return window.addEventListener("tide:open-bottom-pm2-logs",ee),()=>window.removeEventListener("tide:open-bottom-pm2-logs",ee)},[Dt]),b.useEffect(()=>{const ee=Ne=>{const fe=Ne.detail;fe!=null&&fe.buildingId&&Dt(fe.buildingId,"database")};return window.addEventListener("tide:open-bottom-database",ee),()=>window.removeEventListener("tide:open-bottom-database",ee)},[Dt]),b.useEffect(()=>{const ee=Ne=>{const fe=Ne.detail;fe!=null&&fe.buildingId&&(fe!=null&&fe.type)&&(fe!=null&&fe.direction)&&(It.length===0?Dt(fe.buildingId,fe.type):Sn(fe.buildingId,fe.type,fe.direction))};return window.addEventListener("tide:split-bottom-panel",ee),()=>window.removeEventListener("tide:split-bottom-panel",ee)},[It.length,Dt,Sn]),b.useEffect(()=>{ge(ee=>ee.length===It.length?ee:It.length<=1?[1]:(It.length>ee.length,Array(It.length).fill(1)))},[It.length]);const ls=b.useCallback((ee,Ne)=>{var $n;ee.preventDefault();const fe=ot==="horizontal";Te.current={index:Ne,startPos:fe?ee.clientX:ee.clientY,startRatios:[...jt]},document.body.style.cursor=fe?"col-resize":"row-resize",document.body.style.userSelect="none";const Ue=($n=Ye.current)==null?void 0:$n.querySelectorAll("iframe");Ue==null||Ue.forEach(es=>es.style.pointerEvents="none");const gt=Ye.current,Tt=gt?fe?gt.offsetWidth:gt.offsetHeight:1,Cn=es=>{const Ms=Te.current;if(!Ms||!gt)return;const $p=(fe?es.clientX:es.clientY)-Ms.startPos,zu=Ms.startRatios.reduce((Hp,Up)=>Hp+Up,0),$u=$p/Tt*zu,Ri=[...Ms.startRatios],Hu=.1*zu;Ri[Ne]=Math.max(Hu,Ms.startRatios[Ne]+$u),Ri[Ne+1]=Math.max(Hu,Ms.startRatios[Ne+1]-$u),ge(Ri)},tn=()=>{Te.current=null,document.body.style.cursor="",document.body.style.userSelect="",Ue==null||Ue.forEach(es=>es.style.pointerEvents=""),document.removeEventListener("mousemove",Cn),document.removeEventListener("mouseup",tn)};document.addEventListener("mousemove",Cn),document.addEventListener("mouseup",tn)},[ot,jt]),Ba=b.useRef(new Set);b.useEffect(()=>{const ee=new Set(he.filter(Ne=>Ne.type==="pm2-logs").map(Ne=>Ne.buildingId));for(const Ne of ee)Ba.current.has(Ne)||U.startLogStreaming(Ne,200);Ba.current=ee},[he]);const Ts=b.useRef(new Set);b.useEffect(()=>{var fe;const ee=he.filter(Ue=>Ue.type==="terminal");for(const Ue of ee){const gt=E.get(Ue.buildingId);!!((fe=gt==null?void 0:gt.terminalStatus)!=null&&fe.url)?Ts.current.add(Ue.buildingId):Ts.current.has(Ue.buildingId)&&(Ts.current.delete(Ue.buildingId),cn(Ue.id))}const Ne=new Set(ee.map(Ue=>Ue.buildingId));for(const Ue of Ts.current)Ne.has(Ue)||Ts.current.delete(Ue)},[he,E,cn]);const Hs=b.useCallback(ee=>{ee.preventDefault(),ht.current={startY:ee.clientY,startH:lt};let Ne=lt;const fe=gt=>{if(!ht.current)return;const Tt=ht.current.startY-gt.clientY;Ne=Math.max(120,Math.min(600,ht.current.startH+Tt)),it(Ne)},Ue=()=>{ht.current=null,document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Ue);try{localStorage.setItem("tide:bottom-terminal-height",String(Ne))}catch{}};document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Ue)},[lt]),[Fa,ks]=b.useState(!1),Zn=b.useRef(0),_t=r&&C!==null,rs=b.useRef([]),fn=b.useRef(-1),cr=b.useRef(!1),Hr=b.useRef(!1),Es=b.useRef(!1),_s=b.useRef(null),[Ei,wo]=b.useState(!1),[Ur,Il]=b.useState(!1),gs=b.useCallback(()=>{const ee=rs.current,Ne=fn.current;wo(Ne>0),Il(Ne>=0&&Ne<ee.length-1)},[]),Ca=b.useCallback(ee=>{const Ne=rs.current;if(Ne.length===0)return;let fe=fn.current+ee;for(;fe>=0&&fe<Ne.length;){const Ue=Ne[fe];if(s.has(Ue)){cr.current=!0,fn.current=fe,gs(),U.selectAgent(Ue);return}fe+=ee}},[s,gs]),cs=b.useCallback(()=>{Ca(-1)},[Ca]),Vn=b.useCallback(()=>{Ca(1)},[Ca]),Wr=b.useCallback((ee,Ne)=>{if(typeof window>"u")return;const fe=window.history.state,gt={...typeof fe=="object"&&fe!==null?fe:{},__guakeAgentNav:{agentId:ee}};Ne==="replace"?window.history.replaceState(gt,"",window.location.href):window.history.pushState(gt,"",window.location.href)},[]),Ae=b.useCallback(()=>{je(ee=>{const Ne=!ee;return Qa(ft.TERMINAL_FULLSCREEN,Ne),Ne})},[]),Je=t6({agents:s,selectedAgentId:k,isOpen:_t,overviewPanelOpen:Ie,loadingHistory:((ur=q.current)==null?void 0:ur.historyLoader.fetchingHistory)??!1,hasModalOpen:!!(ce||ze||De||c||d),outputRef:(($l=q.current)==null?void 0:$l.outputScrollRef)??{current:null}});b.useEffect(()=>{const ee=z.current;if(!ee||!_t)return;const Ne=Ue=>{Ue.button===3?(Ue.preventDefault(),Ue.stopPropagation(),cs()):Ue.button===4&&(Ue.preventDefault(),Ue.stopPropagation(),Vn())},fe=Ue=>{(Ue.button===3||Ue.button===4)&&Ue.preventDefault()};return ee.addEventListener("mouseup",Ne),ee.addEventListener("mousedown",fe),()=>{ee.removeEventListener("mouseup",Ne),ee.removeEventListener("mousedown",fe)}},[_t,cs,Vn]);const Ct=b.useCallback(ee=>{U.setLastSelectionViaDirectClick(!0),U.selectAgent(ee)},[]),en=typeof window<"u"&&window.innerWidth<=768&&Ie&&_t,Ln=rR({gestureRef:((So=q.current)==null?void 0:So.outputScrollRef)??{current:null},agentListRef:xe,enabled:en,onSelect:Ct});b.useEffect(()=>{Re&&!pe&&(Ve(!0),hs.setEnabled(!0))},[Re,pe]),b.useEffect(()=>{_t||ye(!1)},[_t]),b.useEffect(()=>{var Ne;if(!(ze!=null&&ze.isLive)||!ze.command)return;const ee=((Ne=q.current)==null?void 0:Ne.getDedupedHistory())??[];for(const fe of ee)if(fe._bashCommand===ze.command&&fe._bashOutput){Ge({command:ze.command,output:fe._bashOutput,isLive:!1});return}},[ze]);const $t=b.useCallback((ee,Ne)=>{Ee({url:ee,name:Ne})},[]),At=b.useCallback((ee,Ne)=>{const fe=Tp(ee,C==null?void 0:C.cwd),Ue=fe.line?{...Ne||{},targetLine:fe.line}:Ne;U.setFileViewerPath(fe.path,Ue,C==null?void 0:C.cwd)},[C==null?void 0:C.cwd]),Nn=b.useCallback((ee,Ne)=>{Ge({command:ee,output:Ne,isLive:Ne==="Running..."})},[]),Ss=b.useCallback(ee=>{te(ee)},[]),Pn=b.useCallback(()=>{ye(ee=>!ee)},[]),[Us,Aa]=b.useState(0),[ia,Bl]=b.useState(!1),Iu=b.useCallback(()=>{typeof window>"u"||window.innerWidth>768||(Bl(!0),Aa(kW),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),setTimeout(()=>{U.setMobileView("3d"),Bl(!1),Aa(0)},SW))},[]),Bu=b.useCallback(ee=>{ia||Aa(ee)},[ia]);b.useEffect(()=>{Aa(0),Bl(!1)},[k]),b.useEffect(()=>{if(!k){rs.current=[],fn.current=-1,gs(),Es.current=!1,_s.current=null;return}const ee=rs.current;if(cr.current){cr.current=!1,gs();return}const Ne=fn.current;if(Ne>=0&&ee[Ne]===k){gs();return}const fe=Ne<ee.length-1?ee.slice(0,Ne+1):ee.slice();fe.push(k),fe.length>100&&fe.shift(),rs.current=fe,fn.current=fe.length-1,gs()},[k,gs]),b.useEffect(()=>{if(!(!_t||!k)){if(!Es.current){Wr(k,"replace"),Es.current=!0,_s.current=k;return}if(Hr.current){Hr.current=!1,_s.current=k;return}_s.current!==k&&(Wr(k,"push"),_s.current=k)}},[_t,k,Wr]),b.useEffect(()=>{if(!_t)return;const ee=Ne=>{var Tt,Cn;const fe=(Cn=(Tt=Ne.state)==null?void 0:Tt.__guakeAgentNav)==null?void 0:Cn.agentId;if(!fe||typeof fe!="string"||!s.has(fe)||fe===v)return;Hr.current=!0,cr.current=!0;const Ue=rs.current,gt=Ue.lastIndexOf(fe);gt>=0?fn.current=gt:(Ue.push(fe),fn.current=Ue.length-1),gs(),U.selectAgent(fe)};return window.addEventListener("popstate",ee),()=>window.removeEventListener("popstate",ee)},[_t,s,v,gs]),b.useEffect(()=>{_t&&v&&U.clearUnseenForAgent(v)},[_t,v]);const ko=b.useRef(null);b.useLayoutEffect(()=>{const ee=ko.current;ee!==null&&ee!==v&&U.getState().currentSnapshot&&U.setCurrentSnapshot(null),ko.current=v},[v]),b.useEffect(()=>{const ee=Ne=>{if(Ne.key==="`"&&!Ne.ctrlKey&&!Ne.altKey&&C){const fe=Ne.target;fe.tagName!=="INPUT"&&fe.tagName!=="TEXTAREA"&&(Ne.preventDefault(),U.toggleTerminal())}};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[C]),b.useEffect(()=>{if(!_t)return;const ee=Ne=>{Ne.altKey&&(Ne.key!=="ArrowLeft"&&Ne.key!=="ArrowRight"||(Ne.key==="ArrowLeft"&&Ei?(Ne.preventDefault(),cs()):Ne.key==="ArrowRight"&&Ur&&(Ne.preventDefault(),Vn())))};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[_t,Ei,Ur,cs,Vn]),b.useEffect(()=>{const ee=Ne=>{var fe;Ne.key==="Escape"&&(c?(Ne.stopImmediatePropagation(),U.clearFileViewerPath()):d?(Ne.stopImmediatePropagation(),U.closeContextModal()):De?(Ne.stopImmediatePropagation(),te(null)):ze?(Ne.stopImmediatePropagation(),Ge(null)):ce?(Ne.stopImmediatePropagation(),Ee(null)):(fe=q.current)!=null&&fe.search.searchMode&&(Ne.stopImmediatePropagation(),q.current.search.closeSearch()))};return document.addEventListener("keydown",ee,!0),()=>document.removeEventListener("keydown",ee,!0)},[ce,ze,De,c,d]);const Fu=b.useRef(_t),_i=b.useRef(!1);b.useEffect(()=>{Fu.current=_t},[_t]),b.useEffect(()=>{if(window.innerWidth<=768)return;const Ne=gt=>{var $n;if(!(gt instanceof Element))return!1;const Tt=($n=z.current)==null?void 0:$n.contains(gt),Cn=gt.closest(".agent-bar"),tn=!!gt.closest(".modal-overlay, .modal, .image-modal-overlay, .image-modal, .bash-modal-overlay, .bash-modal, .agent-info-modal-overlay, .agent-info-modal, .agent-response-modal, .pasted-text-modal-overlay, .pasted-text-modal, .file-viewer-overlay, .file-viewer-modal, .context-view-modal, .guake-context-confirm-overlay, .guake-context-confirm-modal, .pm2-logs-modal-overlay, .pm2-logs-modal, .database-panel-modal, .context-menu, .guake-git-diff-modal-overlay, .guake-git-delete-confirm");return!!Tt||!!Cn||tn},fe=gt=>{if(!Fu.current){_i.current=!1;return}if(tR("terminal")){_i.current=!1;return}_i.current=!Ne(gt.target)},Ue=gt=>{_i.current&&(Ne(gt.target)||U.setTerminalOpen(!1),_i.current=!1)};return document.addEventListener("mousedown",fe,!0),document.addEventListener("mouseup",Ue,!0),()=>{document.removeEventListener("mousedown",fe,!0),document.removeEventListener("mouseup",Ue,!0)}},[]),b.useEffect(()=>{const ee=()=>{document.hidden&&V.cleanup()};return document.addEventListener("visibilitychange",ee),()=>document.removeEventListener("visibilitychange",ee)},[V]),b.useEffect(()=>()=>V.cleanup(),[k,V]);const qr=typeof window<"u"&&window.innerWidth<=768;if(!C)return qr&&i==="terminal"&&a.size===0?o.jsx("div",{ref:z,className:`guake-terminal open ${be?"fullscreen":""}`,style:{"--terminal-height":`${I}%`},children:o.jsx("div",{className:"guake-content",children:o.jsx("div",{className:"guake-output",style:{display:"flex",alignItems:"center",justifyContent:"center",color:"#6272a4"},children:o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"👆"}),o.jsx("div",{style:{fontSize:"16px"},children:n("terminal:empty.tapAgent")}),o.jsx("div",{style:{fontSize:"14px",marginTop:"8px",opacity:.7},children:n("terminal:empty.switchTo3D")})]})})})}):qr&&i==="terminal"&&a.size>0?o.jsx("div",{ref:z,className:`guake-terminal open ${be?"fullscreen":""}`,style:{"--terminal-height":`${I}%`},children:o.jsx("div",{className:"guake-content",children:o.jsx("div",{className:"guake-output",style:{display:"flex",alignItems:"center",justifyContent:"center",color:"#6272a4"},children:o.jsxs("div",{className:"guake-empty loading",children:[n("terminal:empty.loadingTerminal"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]})})})}):null;if(!k)return null;const ja=ee=>{ee.preventDefault(),ee.stopPropagation(),Zn.current++,ee.dataTransfer.types.includes("Files")&&ks(!0)},Fl=ee=>{ee.preventDefault(),ee.stopPropagation()},zl=ee=>{ee.preventDefault(),ee.stopPropagation(),Zn.current--,Zn.current===0&&ks(!1)},Vr=async ee=>{var fe,Ue;ee.preventDefault(),ee.stopPropagation(),Zn.current=0,ks(!1);const Ne=ee.dataTransfer.files;if(Ne.length)for(const gt of Ne){const Tt=await((fe=q.current)==null?void 0:fe.terminalInput.uploadFile(gt));Tt&&((Ue=q.current)==null||Ue.terminalInput.setAttachedFiles(Cn=>[...Cn,Tt]))}};return o.jsxs("div",{ref:z,className:`guake-terminal ${_t?"open":"collapsed"} ${be&&_t?"fullscreen":""} ${Re&&_t?"with-debug-panel":""} ${at&&_t?"with-git-panel":""} ${X&&_t?"with-buildings-panel":""} ${J&&_t?"with-workflow-panel":""} ${N&&_t?"with-tracking-board":""} ${Ie&&_t?"with-overview-panel":""} ${Fa?"drag-over":""} ${Us>0?"mobile-swipe-close-active":""} ${ia?"mobile-swipe-close-closing":""}`,style:{"--terminal-height":`${I}%`,"--mobile-swipe-close-offset":`${Us}px`,"--guake-side-panel-width":`${G}px`,...$>0?{"--guake-mobile-overview-height":`${$}px`}:{}},onDragEnter:ja,onDragOver:Fl,onDragLeave:zl,onDrop:Vr,children:[o.jsxs("div",{className:"guake-drop-overlay",children:[o.jsx("div",{className:"drop-border"}),o.jsx("span",{className:"drop-icon",children:"📎"}),o.jsx("span",{className:"drop-label",children:n("terminal:input.dropToAttach")})]}),!h&&Re&&_t&&k&&o.jsx(R6,{agentId:k,onClose:()=>re(!1)}),!h&&at&&_t&&k&&o.jsx(V6,{agentId:k,agents:s,onClose:()=>ue(!1),branchInfoMap:T,fetchRemote:M,fetchingDirs:R}),!h&&X&&_t&&k&&o.jsx(rW,{agentId:k,onClose:()=>ke(!1)}),!h&&J&&_t&&k&&o.jsx(lW,{agentId:k,onClose:()=>We(!1)}),!h&&N&&_t&&k&&o.jsxs("div",{className:"guake-tracking-board-panel",children:[o.jsxs("div",{className:"guake-tracking-board-header",children:[o.jsxs("div",{className:"guake-tracking-board-title",children:[o.jsx("span",{className:"guake-tracking-board-icon",children:"▥"}),o.jsx("span",{children:"Tracking Board"})]}),o.jsx("button",{type:"button",className:"guake-tracking-board-close",onClick:()=>U.setTrackingBoardVisible(!1),title:"Close tracking board",children:"✕"})]}),o.jsx("div",{className:"guake-tracking-board-body",children:o.jsx(vW,{activeAgentId:k,onSelectAgent:ee=>{U.setLastSelectionViaDirectClick(!0),U.selectAgent(ee)}})})]}),!h&&(Re||at||X||J||N)&&_t&&o.jsx("div",{className:"guake-side-panel-resize right",onMouseDown:ee=>K(ee,"right")}),!h&&Ie&&_t&&k&&o.jsx(u5,{activeAgentId:k,onClose:()=>oe(!1),onSelectAgent:ee=>{U.setLastSelectionViaDirectClick(!0),U.selectAgent(ee)},agentListRef:xe,twoFingerState:Ln}),!h&&Ie&&_t&&k&&o.jsx("div",{className:"guake-side-panel-resize left",onMouseDown:ee=>K(ee,"left")}),!h&&Ie&&_t&&k&&o.jsx("div",{className:"aop-resize-handle",onMouseDown:F,onTouchStart:H}),o.jsxs("div",{className:"guake-content",children:[o.jsx(S6,{selectedAgent:C,selectedAgentId:k,sortedAgents:Je.sortedAgents,swipeOffset:Je.swipeOffset,viewMode:de,setViewMode:Z,searchMode:((Hl=q.current)==null?void 0:Hl.search.searchMode)??!1,toggleSearch:((Gr=q.current)==null?void 0:Gr.search.toggleSearch)??(()=>{}),closeSearch:((oa=q.current)==null?void 0:oa.search.closeSearch)??(()=>{}),debugPanelOpen:Re,setDebugPanelOpen:re,debuggerEnabled:pe,setDebuggerEnabled:Ve,gitPanelOpen:at,setGitPanelOpen:ue,buildingsPanelOpen:X,setBuildingsPanelOpen:ke,workflowPanelOpen:J,setWorkflowPanelOpen:We,hasWorkflow:Be,trackingBoardVisible:N,setTrackingBoardVisible:ee=>U.setTrackingBoardVisible(ee),overviewPanelOpen:Ie,setOverviewPanelOpen:oe,agentInfoOpen:He,onToggleAgentInfo:Pn,isFullscreen:be,onToggleFullscreen:Ae,onNavigateBack:cs,onNavigateForward:Vn,canNavigateBack:Ei,canNavigateForward:Ur,outputsLength:((Co=q.current)==null?void 0:Co.outputsLength)??0,setContextConfirm:me,headerRef:Je.headerRef,onSaveSnapshot:h?void 0:e,isSnapshotView:h}),o.jsxs("div",{className:`guake-swipe-container ${Je.swipeAnimationClass}`,style:Je.swipeOffset!==0?{transform:`translateX(${Je.swipeOffset*40}%)`}:void 0,children:[Je.sortedAgents.length>1&&Je.swipeOffset!==0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`swipe-indicator left ${Je.swipeOffset>.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-icon",children:"←"}),o.jsx("span",{className:"indicator-name",children:(Yr=Je.nextAgent)==null?void 0:Yr.name})]}),o.jsxs("div",{className:`swipe-indicator right ${Je.swipeOffset<-.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-name",children:(Na=Je.prevAgent)==null?void 0:Na.name}),o.jsx("span",{className:"indicator-icon",children:"→"})]})]}),Je.sortedAgents.length>1&&Je.sortedAgents.length<=8&&Je.swipeOffset!==0&&o.jsx("div",{className:`swipe-dots ${Math.abs(Je.swipeOffset)>.1?"visible":""}`,children:Je.sortedAgents.map((ee,Ne)=>o.jsx("div",{className:`swipe-dot ${Ne===Je.currentAgentIndex?"active":""}`},ee.id))}),o.jsx(sW,{activeAgentId:k,activeAgent:C,paneRef:q,viewMode:de,isOpen:_t,isSnapshotView:h,currentSnapshot:f,onImageClick:$t,onFileClick:At,onBashClick:Nn,onViewMarkdown:Ss,keyboard:V,onSaveSnapshot:h?void 0:e,canSwipeClose:qr&&i==="terminal"&&!((Ao=q.current)!=null&&Ao.search.searchMode)&&!((Mi=q.current)!=null&&Mi.historyLoader.fetchingHistory),onSwipeCloseOffsetChange:Bu,onSwipeClose:Iu,hasModalOpen:!!(ce||ze||De||c)})]}),o.jsxs("div",{className:"guake-agent-status-bar",children:[!h&&(C==null?void 0:C.isDetached)&&o.jsx(Jn,{content:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"tide-tooltip__title",children:["🔄 ",n("terminal:empty.reattachingSessionTitle")]}),o.jsxs("div",{className:"tide-tooltip__text",children:[n("terminal:empty.reattachingSessionDesc"),o.jsx("br",{}),o.jsx("br",{}),o.jsxs("strong",{children:[n("common:labels.status"),":"]})," ",n("terminal:empty.reattachingSessionStatus")]})]}),position:"top",className:"tide-tooltip--detached",children:o.jsxs("span",{className:"guake-detached-badge",title:n("terminal:empty.reattachingBadge"),children:[o.jsx("span",{className:"guake-detached-spinner",children:"🔄"})," ",n("terminal:empty.reattaching")]})}),(C==null?void 0:C.cwd)&&o.jsxs("span",{className:"guake-agent-cwd",title:C.cwd,children:["📁 ",C.cwd.split("/").filter(Boolean).slice(-2).join("/")||C.cwd]}),D&&D.map(({areaId:ee,areaName:Ne,dir:fe})=>{const Ue=T.get(fe),gt=R.has(fe);return o.jsxs("span",{className:"guake-agent-area-dir",title:`${Ne}: ${fe}${Ue?` (${Ue.branch}${Ue.ahead?` ↑${Ue.ahead}`:""}${Ue.behind?` ↓${Ue.behind}`:""})`:""}`,onClick:()=>U.openFileExplorerForAreaFolder(ee,fe),children:["📂 ",fe.split("/").filter(Boolean).pop()||fe,Ue&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"guake-agent-area-branch",children:[" ⎇ ",Ue.branch]}),Ue.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",title:`${Ue.ahead} ahead`,children:["↑",Ue.ahead]}),Ue.behind>0&&o.jsxs("span",{className:"guake-branch-behind",title:`${Ue.behind} behind`,children:["↓",Ue.behind]}),o.jsx("span",{className:`guake-area-fetch-btn ${gt?"fetching":""}`,title:"Git fetch",onClick:Tt=>{Tt.stopPropagation(),M(fe)},children:gt?"⏳":"⇣"})]})]},`${ee}:${fe}`)}),!h&&C&&(()=>{const ee=C.contextStats,Ne=!!ee,fe=ee?ee.totalTokens:C.contextUsed||0,Ue=ee?ee.contextWindow:C.contextLimit||2e5,gt=ee?ee.usedPercent:Math.round(fe/Ue*100),Tt=Math.max(0,Math.min(100,gt)),Cn=Math.max(0,100-Tt),tn=Tt>=80?"#ff4a4a":Tt>=60?"#ff9e4a":Tt>=40?"#ffd700":"#4aff9e",$n=(fe/1e3).toFixed(1),es=(Ue/1e3).toFixed(1);return o.jsxs("span",{className:"guake-agent-context",onClick:()=>U.setContextModalAgentId(k),title:n(Ne?"terminal:context.clickToViewStats":"terminal:context.clickToFetchStats"),children:[o.jsx("span",{className:"context-icon",children:"📊"}),o.jsxs("span",{className:"context-label",children:[n("terminal:agentInfo.context"),":"]}),o.jsx("span",{className:"context-bar-mini",children:o.jsx("span",{className:"context-bar-mini-fill",style:{width:`${Math.min(100,Tt)}%`,backgroundColor:tn}})}),o.jsxs("span",{className:"context-tokens",style:{color:tn},children:[$n,"k/",es,"k"]}),o.jsxs("span",{className:"context-free",children:["(",n("terminal:context.percentFree",{percent:Cn}),")"]}),!Ne&&o.jsx("span",{className:"context-warning",title:n("terminal:context.clickToFetchStats"),children:"⚠️"})]})})(),o.jsxs("span",{className:"guake-status-right",children:[_.length>0&&o.jsx("span",{className:"guake-status-terminals",children:_.map(ee=>{const Ne=Vt.has(ee.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""} ${ee.hasUrl?"":"offline"}`,title:`${Ne?"Hide":"Show"} terminal: ${ee.name}${ee.hasUrl?"":" (starting...)"}`,onClick:()=>{if(Ne){const fe=he.find(Ue=>Ue.buildingId===ee.id);fe&&cn(fe.id)}else ee.hasUrl||U.sendBuildingCommand(ee.id,"start"),Dt(ee.id,"terminal")},onContextMenu:fe=>{fe.preventDefault(),fe.stopPropagation(),Vt.has(ee.id)||Nt({position:{x:fe.clientX,y:fe.clientY},buildingId:ee.id,type:"terminal"})},children:"💻"},ee.id)})}),P.length>0&&o.jsx("span",{className:"guake-status-terminals",children:P.map(ee=>{const Ne=Vt.has(ee.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""}`,title:`${Ne?"Hide":"Show"} logs: ${ee.name}`,onClick:()=>{if(Ne){const fe=he.find(Ue=>Ue.buildingId===ee.id);fe&&cn(fe.id)}else Dt(ee.id,"pm2-logs")},onContextMenu:fe=>{fe.preventDefault(),fe.stopPropagation(),Vt.has(ee.id)||Nt({position:{x:fe.clientX,y:fe.clientY},buildingId:ee.id,type:"pm2-logs"})},children:"📜"},ee.id)})}),O.length>0&&o.jsx("span",{className:"guake-status-terminals",children:O.map(ee=>{const Ne=Vt.has(ee.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""}`,title:`${Ne?"Hide":"Show"} database: ${ee.name}`,onClick:()=>{if(Ne){const fe=he.find(Ue=>Ue.buildingId===ee.id);fe&&cn(fe.id)}else Dt(ee.id,"database")},onContextMenu:fe=>{fe.preventDefault(),fe.stopPropagation(),Vt.has(ee.id)||Nt({position:{x:fe.clientX,y:fe.clientY},buildingId:ee.id,type:"database"})},children:"🗄️"},ee.id)})}),o.jsx(hW,{})]})]}),(()=>{const ee=[];return tt&&(ee.push({id:"open",label:"Open",icon:"⬇",onClick:()=>Dt(tt.buildingId,tt.type)}),It.length>0&&(ee.push({id:"split-right",label:"Split Right",icon:"↔",onClick:()=>Sn(tt.buildingId,tt.type,"horizontal")}),ee.push({id:"split-below",label:"Split Below",icon:"↕",onClick:()=>Sn(tt.buildingId,tt.type,"vertical")}))),o.jsx(ir,{children:o.jsx(go,{isOpen:tt!==null,position:(tt==null?void 0:tt.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:ee,onClose:()=>Nt(null)})})})(),It.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Hs}),o.jsx("div",{ref:Ye,className:`guake-bottom-panels-container ${ot}`,style:{height:lt},onWheel:ee=>ee.stopPropagation(),children:It.map((ee,Ne)=>{const fe=E.get(ee.buildingId);if(!fe)return null;const Ue=jt[Ne]??1,gt=(()=>{var Tt;if(ee.type==="terminal")return(Tt=fe.terminalStatus)!=null&&Tt.url?o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ue},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",fe.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ee.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(Yb,{terminalUrl:fe.terminalStatus.url,visible:!0})]},ee.id):o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ue},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",fe.name," (starting...)"]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ee.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"guake-bottom-terminal-starting",children:o.jsx("span",{children:"Starting terminal..."})})]},ee.id);if(ee.type==="pm2-logs"){const Cn=Le[ee.id]||"";return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ue},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["📜 ",fe.name]}),o.jsxs("div",{className:"guake-bottom-terminal-controls",children:[o.jsx("input",{type:"text",className:"guake-bottom-terminal-filter",value:Cn,onChange:tn=>{const $n=tn.target.value;Qe(es=>{if(!$n.trim()){if(!(ee.id in es))return es;const Ms={...es};return delete Ms[ee.id],Ms}return{...es,[ee.id]:$n}})},placeholder:"Filter logs","aria-label":`Filter logs for ${fe.name}`,spellCheck:!1}),o.jsx("select",{className:"guake-bottom-terminal-retention",value:$e===null?"unlimited":String($e),onChange:tn=>{const $n=tn.target.value==="unlimited"?null:Number(tn.target.value);nt($n),FO($n)},"aria-label":`Max log retention for ${fe.name}`,children:BO.map(tn=>o.jsx("option",{value:tn===null?"unlimited":String(tn),children:tn===null?"Unlimited":`${tn.toLocaleString()} lines`},tn===null?"unlimited":tn))}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>U.clearStreamingLogs(ee.buildingId),title:"Clear logs",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6"})})}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>U.sendBuildingCommand(ee.buildingId,"restart"),title:"Restart",children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M1 4v6h6"}),o.jsx("path",{d:"M3.51 15a9 9 0 105.64-11.36L3 10"})]})}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ee.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),o.jsx(jW,{buildingId:ee.buildingId,filterText:Cn,maxRetention:$e})]},ee.id)}return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ue},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["🗄️ ",fe.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ee.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(KU,{building:fe})]},ee.id)})();return Ne>0?o.jsxs(Ce.Fragment,{children:[o.jsx("div",{className:`guake-split-divider ${ot}`,onMouseDown:Tt=>ls(Tt,Ne-1)}),gt]},ee.id):gt})})]}),he.filter(ee=>ee.areaId!==zt&&ee.type==="terminal").map(ee=>{var fe;const Ne=E.get(ee.buildingId);return(fe=Ne==null?void 0:Ne.terminalStatus)!=null&&fe.url?o.jsx(Yb,{terminalUrl:Ne.terminalStatus.url,visible:!1},ee.id):null})]}),_t&&!be&&o.jsx("div",{className:"guake-resize-handle",onMouseDown:W,title:n("common:rightPanel.dragToResize")}),!(_t&&be)&&o.jsxs("div",{className:"guake-handle",onClick:()=>{_t&&U.toggleTerminal()},onDoubleClick:()=>{_t||U.toggleTerminal()},style:{top:_t?`min(${I}%, calc(100vh - 72px))`:"0"},children:[o.jsx("span",{className:"guake-handle-icon",children:_t?"▲":"▼"}),o.jsx("span",{className:"guake-handle-text",children:C.name})]}),ce&&o.jsx(j6,{url:ce.url,name:ce.name,onClose:()=>Ee(null)}),ze&&o.jsx(N6,{state:ze,onClose:()=>Ge(null)}),_e&&o.jsx(T6,{action:_e,selectedAgentId:k,subordinateCount:((Ul=C==null?void 0:C.subordinateIds)==null?void 0:Ul.length)||0,onClose:()=>me(null),onClearHistory:((Di=q.current)==null?void 0:Di.historyLoader.clearHistory)??(()=>{})}),o.jsx(E6,{}),o.jsx(_6,{}),o.jsx(D6,{agent:C,isOpen:He,onClose:()=>ye(!1)}),!h&&o.jsx(M6,{agent:C,content:De,onClose:()=>te(null)})]})});function TW(t){return t.trim().replace(/^v/i,"")}function _A(t){const n=TW(t).match(/^(\d+(?:\.\d+)*)(?:-([0-9A-Za-z.-]+))?/);if(!n)return null;const s=n[1].split(".").map(r=>Number.parseInt(r,10));if(s.some(Number.isNaN))return null;const a=n[2]?n[2].split("."):[];return{core:s,prerelease:a}}function EW(t,e){if(t.length===0&&e.length===0)return 0;if(t.length===0)return 1;if(e.length===0)return-1;const n=Math.max(t.length,e.length);for(let s=0;s<n;s+=1){const a=t[s],r=e[s];if(a===void 0)return-1;if(r===void 0)return 1;const i=/^\d+$/.test(a)?Number.parseInt(a,10):null,c=/^\d+$/.test(r)?Number.parseInt(r,10):null;if(i!==null&&c!==null){if(i>c)return 1;if(i<c)return-1;continue}if(i!==null)return-1;if(c!==null)return 1;const d=a.localeCompare(r);if(d!==0)return d>0?1:-1}return 0}function _W(t,e){const n=_A(t),s=_A(e);if(!n||!s)return null;const a=Math.max(n.core.length,s.core.length);for(let r=0;r<a;r+=1){const i=n.core[r]??0,c=s.core[r]??0;if(i>c)return 1;if(i<c)return-1}return EW(n.prerelease,s.prerelease)}function MW(t,e){const n=_W(t,e);return n===null?"unknown":n<0?"behind":n>0?"ahead":"equal"}async function DW(t,e={}){const{timeoutMs:n=5e3,fetchImpl:s=fetch}=e;try{const a=new AbortController,r=setTimeout(()=>a.abort(),n),i=Date.now(),c=await s(`https://registry.npmjs.org/${encodeURIComponent(t)}/latest?t=${i}`,{signal:a.signal,headers:{Accept:"application/json"}});if(clearTimeout(r),!c.ok)return null;const d=await c.json();return typeof d.version=="string"?d.version:null}catch{return null}}async function RW(t,e,n={}){const s=await DW(t,n);return s?{currentVersion:e,latestVersion:s,relation:MW(e,s)}:{currentVersion:e,latestVersion:null,relation:"unknown"}}const OW="tide-commander",Zg="1.45.0";function LW(){const[t,e]=b.useState({currentVersion:Zg,latestVersion:null,relation:"unknown",isChecking:!1}),n=b.useCallback(async()=>{e(a=>({...a,isChecking:!0}));const s=await RW(OW,Zg);e({currentVersion:Zg,latestVersion:s.latestVersion,relation:s.relation,isChecking:!1})},[]);return b.useEffect(()=>{n()},[n]),{...t,refresh:n}}const PW=b.memo(function({agent:e,currentIndex:n,agentIndex:s,isTouchInput:a,isTouchDragEnabled:r,isSelected:i,hasUnseenOutput:c,isDragging:d,isDragOver:f,customClasses:h,onDragStart:m,onDragEnd:x,onDragOver:y,onDragEnter:v,onDragLeave:S,onDrop:C,onAgentClick:k,onAgentDoubleClick:N,onTouchStart:j,onTouchMove:E,onTouchEnd:D,onTouchCancel:_,onHoverEnter:P,onHoverLeave:O,onItemRef:T}){const M=b.useMemo(()=>Ia(e.class,h),[e.class,h]),R=!a||r,I=b.useCallback(z=>{T(e.id,z)},[e.id,T]);return o.jsxs("div",{ref:I,className:`agent-bar-item ${i?"selected":""} ${e.status} ${e.isBoss?"is-boss":""} ${d?"dragging":""} ${f?"drag-over":""} ${r?"touch-drag-enabled":""}`,draggable:R,onDragStart:z=>m(z,e),onDragEnd:x,onDragOver:z=>y(z,s),onDragEnter:z=>v(z,s),onDragLeave:S,onDrop:z=>C(z,s),onTouchStart:z=>j(z,e.id),onTouchMove:E,onTouchEnd:D,onTouchCancel:_,onClick:z=>k(e,z),onDoubleClick:()=>N(e),onMouseEnter:()=>P(e),onMouseLeave:O,title:a?`${e.name} (${n+1}) - Long press to reorder`:`${e.name} (${n+1}) - Drag to reorder within group`,children:[o.jsxs("div",{className:"agent-bar-avatar",children:[o.jsx("span",{className:"agent-bar-icon",children:M.icon}),o.jsx("span",{className:"agent-bar-status",style:{backgroundColor:Jb(e.status)}}),c&&o.jsx("span",{className:"agent-bar-notification-badge",title:"New output available - click to view"}),e.status==="idle"&&e.lastActivity>0&&o.jsx("span",{className:"agent-bar-idle-clock",style:{color:Xb(e.lastActivity)},title:gp(e.lastActivity),children:"⏱"})]}),o.jsxs("span",{className:"agent-bar-hotkey",title:`Ctrl+${n+1}`,children:["^",n+1]})]})}),IW=b.memo(function({onFocusAgent:e,onSpawnClick:n,onSpawnBossClick:s,onNewBuildingClick:a,onNewAreaClick:r}){const{t:i}=pt(["common"]),c=Dl(),d=rr(),f=dx(),h=ZO(),m=fx(),x=Br(),y=Pa(),v=Uj(),[S]=ox(),[C,k]=b.useState(!1);hj("AgentBar");const N=b.useRef(null),j=b.useRef(null),E=b.useRef(null),D=b.useRef(new Map);b.useEffect(()=>{{k(!1);return}},[x.experimental2DView]),b.useEffect(()=>{const ne=j.current;if(!ne)return;const Le=Qe=>{ne.scrollWidth<=ne.clientWidth||(Qe.preventDefault(),Math.abs(Qe.deltaX)>Math.abs(Qe.deltaY)?ne.scrollLeft+=Qe.deltaX:ne.scrollLeft+=Qe.deltaY)};return ne.addEventListener("wheel",Le,{passive:!1}),()=>ne.removeEventListener("wheel",Le)},[]);const[_,P]=b.useState(null),[O,T]=b.useState(new Map),[M,R]=b.useState(null),[I,z]=b.useState(null),W=b.useRef(0),[$,F]=b.useState(null),H=b.useRef(null),V=b.useRef(null),G=b.useRef(null),B=b.useRef(null),Q=350,K=8,q=b.useMemo(()=>typeof window>"u"?!1:"ontouchstart"in window||window.matchMedia("(pointer: coarse)").matches,[]),xe=b.useMemo(()=>Array.from(c.values()).filter(ne=>{if(U.isAgentInArchivedArea(ne.id))return!1;if(S){const Le=U.getAreaForAgent(ne.id);if(!xp((Le==null?void 0:Le.id)??null))return!1}return!0}).sort((ne,Le)=>(ne.createdAt||0)-(Le.createdAt||0)),[c,d,S]),{orderedAgents:de,moveAgent:Z}=SO(xe),be=de,je=b.useMemo(()=>{const ne=new Map;for(const Le of be)ne.set(Le.id,U.getAreaForAgent(Le.id));return ne},[be,d]),ce=b.useMemo(()=>{const ne=new Map;for(const Qe of be){const $e=je.get(Qe.id)||null,nt=($e==null?void 0:$e.id)||null;ne.has(nt)||ne.set(nt,{area:$e,agents:[]}),ne.get(nt).agents.push(Qe)}const Le=Array.from(ne.values());return Le.sort((Qe,$e)=>{var nt,ot;return!Qe.area&&$e.area?1:Qe.area&&!$e.area?-1:!Qe.area&&!$e.area?0:(((nt=Qe.area)==null?void 0:nt.name)||"").localeCompare(((ot=$e.area)==null?void 0:ot.name)||"")}),Le},[be,je]),Ee=b.useRef(e);Ee.current=e;const ze=b.useRef(M);ze.current=M;const Ge=b.useRef(be);Ge.current=be;const _e=b.useRef(je);_e.current=je;const me=b.useRef(Z);me.current=Z,b.useEffect(()=>{const ne=new Map(O);let Le=!1;for(const Qe of be){const $e=O.get(Qe.id);Qe.currentTool?(!$e||$e.tool!==Qe.currentTool)&&(ne.set(Qe.id,{tool:Qe.currentTool,key:Date.now()}),Le=!0):$e&&setTimeout(()=>{T(nt=>{const ot=new Map(nt);return ot.delete(Qe.id),ot})},1500)}Le&&T(ne)},[be.map(ne=>ne.currentTool).join(",")]),b.useEffect(()=>{const ne=h;if(!ne)return;const Le=D.current.get(ne),Qe=j.current;Le&&Qe&&requestAnimationFrame(()=>{const $e=Le.getBoundingClientRect(),nt=Qe.getBoundingClientRect(),st=$e.left-nt.left+Qe.scrollLeft+$e.width/2,lt=Qe.clientWidth;Qe.scrollTo({left:st-lt/2,behavior:"smooth"})})},[h]);const De=b.useCallback((ne,Le)=>{if(G.current===ne.id){G.current=null,Le.preventDefault(),Le.stopPropagation();return}U.setLastSelectionViaDirectClick(!0),Le.shiftKey?U.addToSelection(ne.id):U.selectAgent(ne.id),U.setTerminalOpen(!0)},[]),te=b.useCallback(ne=>{var Le;(Le=Ee.current)==null||Le.call(Ee,ne.id),U.setTerminalOpen(!0)},[]),He=b.useCallback(()=>P(null),[]),ye=b.useCallback((ne,Le)=>{Le?D.current.set(ne,Le):D.current.delete(ne)},[]),Re=b.useCallback((ne,Le)=>{R(Le),F(Le.id),ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("text/plain",Le.id),requestAnimationFrame(()=>{ne.target.classList.add("dragging")})},[]),re=b.useCallback(ne=>{R(null),z(null),F(null),W.current=0,ne.target.classList.remove("dragging")},[]),pe=b.useCallback((ne,Le)=>{ne.preventDefault();const Qe=ze.current;if(Qe){const $e=_e.current.get(Qe.id),nt=Ge.current[Le],ot=nt?_e.current.get(nt.id):null,st=($e==null?void 0:$e.id)??null,lt=(ot==null?void 0:ot.id)??null;ne.dataTransfer.dropEffect=st===lt?"move":"none"}else ne.dataTransfer.dropEffect="move"},[]),Ve=b.useCallback((ne,Le)=>{ne.preventDefault(),W.current++;const Qe=ze.current;if(Qe){const $e=_e.current.get(Qe.id),nt=Ge.current[Le],ot=nt?_e.current.get(nt.id):null,st=($e==null?void 0:$e.id)??null,lt=(ot==null?void 0:ot.id)??null;z(st===lt?Le:null)}else z(Le)},[]),at=b.useCallback(ne=>{W.current--,W.current===0&&z(null)},[]),ut=b.useCallback((ne,Le)=>{ne.preventDefault();const Qe=ze.current;if(!Qe)return;const $e=Ge.current,nt=_e.current,ot=$e.findIndex(st=>st.id===Qe.id);if(ot!==-1&&ot!==Le){const st=nt.get(Qe.id),lt=$e[Le],it=lt?nt.get(lt.id):null,ht=(st==null?void 0:st.id)??null,jt=(it==null?void 0:it.id)??null;ht===jt&&me.current(ot,Le)}R(null),z(null),F(null),W.current=0},[]),ue=b.useCallback(()=>{H.current&&(clearTimeout(H.current),H.current=null)},[]),X=b.useCallback(()=>{B.current&&(clearTimeout(B.current),B.current=null)},[]),se=b.useCallback((ne,Le)=>{if(!q||ne.touches.length!==1)return;ue(),X(),F(null);const Qe=ne.touches[0];V.current={agentId:Le,x:Qe.clientX,y:Qe.clientY},H.current=setTimeout(()=>{F(Le),G.current=Le,H.current=null},Q)},[ue,X,q]),ke=b.useCallback(ne=>{if(!q||ne.touches.length!==1)return;const Le=V.current;if(!Le||!H.current)return;const Qe=ne.touches[0],$e=Qe.clientX-Le.x,nt=Qe.clientY-Le.y;Math.sqrt($e*$e+nt*nt)>K&&(ue(),V.current=null)},[ue,q]),J=b.useCallback(()=>{ue(),V.current=null,ze.current||F(null),X(),B.current=setTimeout(()=>{G.current=null,B.current=null},450)},[ue,X]);b.useEffect(()=>()=>{ue(),X()},[ue,X]);const we=ne=>{const Le=`common:status.${ne}`;return i(Le,{defaultValue:i("common:status.unknown")})},{currentVersion:We,latestVersion:Be,relation:ie,isChecking:Ie}=LW(),oe=We;let he=0;return o.jsxs("div",{className:"agent-bar",ref:N,children:[o.jsxs("div",{className:"agent-bar-scroll",ref:j,children:[o.jsxs("div",{className:"agent-bar-version",title:Be?`Tide Commander v${oe} (npm: v${Be})`:`Tide Commander v${oe}`,children:[o.jsxs("span",{children:["v",oe]}),ie==="behind"&&Be?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-behind",title:`Behind npm latest v${Be}`,children:["npm v",Be]}):ie==="ahead"&&Be?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-ahead",title:`Ahead of npm latest v${Be}`,children:["npm v",Be]}):null,ie==="behind"?o.jsx("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"agent-bar-version-status agent-bar-version-status-behind",title:i("common:agentBar.behindNpmTooltip",{defaultValue:"Current version is behind npm latest"}),children:i("common:agentBar.behindNpm",{defaultValue:"(behind npm)"})}):ie==="ahead"?o.jsx("span",{className:"agent-bar-version-status agent-bar-version-status-ahead",title:i("common:agentBar.aheadNpmTooltip",{defaultValue:"Current version is newer than npm latest"}),children:i("common:agentBar.aheadNpm",{defaultValue:"(ahead of npm)"})}):ie==="equal"?o.jsx("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"agent-bar-version-status",children:i("common:agentBar.updated")}):Ie?o.jsx("span",{className:"agent-bar-version-status",children:i("common:agentBar.checkingNpm",{defaultValue:"(checking npm)"})}):o.jsx("span",{className:"agent-bar-version-status",children:i("common:agentBar.unknownNpm",{defaultValue:"(npm unknown)"})}),C&&o.jsx(Jn,{content:"Refresh 3D Scene (HMR changes pending)",position:"bottom",children:o.jsx("button",{className:"agent-bar-hmr-refresh",onClick:Aj,children:"↻"})})]}),o.jsxs("div",{className:"agent-bar-list",ref:E,children:[o.jsx(Jn,{content:i("common:agentBar.spawnNewAgent"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn",onClick:n,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"+"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newAgent")})]})}),o.jsx(Jn,{content:i("common:agentBar.spawnBoss"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-boss-btn",onClick:s,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"👑"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newBoss")})]})}),o.jsx(Jn,{content:i("common:agentBar.addNewBuilding"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-building-btn",onClick:a,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"🏢"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newBuilding")})]})}),o.jsx(Jn,{content:i("common:agentBar.drawNewArea"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-area-btn",onClick:r,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"🔲"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newArea")})]})}),ce.map(ne=>{var $e,nt,ot,st,lt;const Le=ne.agents,Qe=!ne.area;return o.jsxs("div",{className:`agent-bar-group ${Qe?"unassigned":""}`,style:{borderColor:(($e=ne.area)==null?void 0:$e.color)||void 0,background:ne.area?`${ne.area.color}15`:void 0},children:[o.jsx("div",{className:"agent-bar-area-label",children:o.jsx("span",{className:"agent-bar-area-name",style:{color:((nt=ne.area)==null?void 0:nt.color)||"#888"},children:((ot=ne.area)==null?void 0:ot.name)||i("common:agentBar.unassigned")})}),((st=ne.area)==null?void 0:st.directories)&&ne.area.directories.length>0&&o.jsx("div",{className:"agent-bar-folders",children:ne.area.directories.map((it,ht)=>o.jsxs("div",{className:"agent-bar-folder-item",onClick:jt=>{jt.stopPropagation(),U.openFileExplorer(it)},children:[o.jsx("span",{className:"agent-bar-folder-icon",children:"📁"}),o.jsxs("div",{className:"agent-bar-folder-tooltip",children:[o.jsx("div",{className:"agent-bar-folder-tooltip-path",children:it}),o.jsx("div",{className:"agent-bar-folder-tooltip-hint",children:i("common:agentBar.clickToOpen")})]})]},ht))}),Le.map(it=>{const ht=he++,jt=be.findIndex(ge=>ge.id===it.id);return o.jsx(PW,{agent:it,currentIndex:ht,agentIndex:jt,isTouchInput:q,isTouchDragEnabled:$===it.id,isSelected:f.has(it.id),hasUnseenOutput:v.has(it.id),isDragging:(M==null?void 0:M.id)===it.id,isDragOver:I===jt,customClasses:y,onDragStart:Re,onDragEnd:re,onDragOver:pe,onDragEnter:Ve,onDragLeave:at,onDrop:ut,onAgentClick:De,onAgentDoubleClick:te,onTouchStart:se,onTouchMove:ke,onTouchEnd:J,onTouchCancel:J,onHoverEnter:P,onHoverLeave:He,onItemRef:ye},it.id)})]},((lt=ne.area)==null?void 0:lt.id)||"unassigned")})]})]}),Array.from(O.entries()).map(([ne,Le])=>{const Qe=D.current.get(ne);if(!Qe)return null;const $e=Qe.getBoundingClientRect(),nt=os[Le.tool]||os.default;return o.jsxs("div",{className:"agent-bar-tool-bubble",title:Le.tool,style:{position:"fixed",left:$e.left+$e.width/2,bottom:window.innerHeight-$e.top+8},children:[o.jsx("span",{className:"agent-bar-tool-icon",children:nt}),o.jsx("span",{className:"agent-bar-tool-name",children:Le.tool})]},`tool-${ne}-${Le.key}`)}),_&&(()=>{const ne=U.getAreaForAgent(_.id),Le=m.get(_.id),Qe=Ia(_.class,y),$e=U.getAgentSupervisorHistory(_.id),nt=$e.length>0?$e[$e.length-1]:void 0,ot=Date.now()-(_.createdAt||Date.now()),st=Math.floor(ot/6e4),lt=Math.floor(st/60),it=lt>0?`${lt}h ${st%60}m`:`${st}m`,ht=tt=>tt>=1e6?`${(tt/1e6).toFixed(1)}M`:tt>=1e3?`${(tt/1e3).toFixed(1)}K`:tt.toString(),jt=_.contextLimit>0?Math.round(_.contextUsed/_.contextLimit*100):0,ge=tt=>{switch(tt){case"on_track":return"#4aff9e";case"completed":return"#4a9eff";case"stalled":return"#ff9e4a";case"blocked":return"#ff4a4a";case"idle":return"#888888";default:return"#888888"}},Te=D.current.get(_.id),Ye={};if(Te){const tt=Te.getBoundingClientRect();Ye.position="fixed",Ye.left=tt.left+tt.width/2,Ye.bottom=window.innerHeight-tt.top+12}return o.jsxs("div",{className:"agent-bar-tooltip",style:Ye,children:[o.jsxs("div",{className:"agent-bar-tooltip-header",children:[o.jsx("span",{className:"agent-bar-tooltip-icon",children:Qe.icon}),o.jsxs("span",{className:"agent-bar-tooltip-name",children:[o.jsx("img",{src:_.provider==="codex"?"/assets/codex.png":_.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:_.provider,className:"agent-bar-provider-icon",title:_.provider==="codex"?"Codex Agent":_.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),_.name]}),o.jsx("span",{className:"agent-bar-tooltip-status",style:{color:Jb(_.status)},children:we(_.status)})]}),o.jsxs("div",{className:"agent-bar-tooltip-info",children:[o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.class"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[_.class," — ",Qe.description]})]}),ne&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.area"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-area",style:{color:ne.color},children:ne.name})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.directory"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-path",children:_.cwd})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.uptime"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",children:it})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.tokens"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[ht(_.tokensUsed)," ",i("common:agentPopup.used")]})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.context"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",style:{color:jt>80?"#ff4a4a":jt>60?"#ff9e4a":void 0},children:[ht(_.contextUsed)," / ",ht(_.contextLimit)," (",jt,"%)"]})]}),_.currentTool&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.tool"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:[os[_.currentTool]||os.default," ",_.currentTool]})]}),_.taskLabel&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsx("span",{className:"agent-bar-tooltip-label",children:"📋 Task:"}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:_.taskLabel})]}),_.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.task"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[_.currentTask.substring(0,150),_.currentTask.length>150?"...":""]})]}),_.lastAssignedTask&&!_.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.assignedTask"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[_.lastAssignedTask.substring(0,200),_.lastAssignedTask.length>200?"...":""]})]}),Le&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.lastQuery"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[Le.text.substring(0,300),Le.text.length>300?"...":""]})]}),nt&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"agent-bar-tooltip-divider"}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.supervisor"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",style:{color:ge(nt.analysis.progress)},children:nt.analysis.progress.replace("_"," ")})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.status"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:nt.analysis.statusDescription})]}),nt.analysis.recentWorkSummary&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.summary"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:[nt.analysis.recentWorkSummary.substring(0,300),nt.analysis.recentWorkSummary.length>300?"...":""]})]}),nt.analysis.concerns&&nt.analysis.concerns.length>0&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.concerns"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-concerns",children:nt.analysis.concerns.join("; ")})]})]})]})]})})()]})});function BW({activeTool:t,onExit:e}){const{t:n}=pt(["notifications","terminal"]);if(!t||t==="select")return null;const s=n(t==="rectangle"?"notifications:drawing.rectangleTool":"notifications:drawing.circleTool"),a=t==="rectangle"?"▭":"○";return o.jsxs("div",{className:"drawing-mode-indicator",children:[o.jsxs("div",{className:"drawing-mode-content",children:[o.jsx("span",{className:"drawing-mode-icon",children:a}),o.jsxs("div",{className:"drawing-mode-text",children:[o.jsxs("span",{className:"drawing-mode-title",children:[n("terminal:drawingMode.drawingArea"),": ",s]}),o.jsxs("span",{className:"drawing-mode-hint",children:[n("terminal:drawingMode.clickAndDrag")," • ",n("terminal:drawingMode.pressEscape")]})]})]}),o.jsx("button",{className:"drawing-mode-exit",onClick:e,title:n("terminal:drawingMode.exitDrawingMode"),children:"✕"})]})}const FW={idle:"common:status.idle",working:"common:status.working",waiting:"common:status.waiting",error:"common:status.error",offline:"common:status.offline"},eb=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),zW=t=>{switch(t){case"on_track":return"#4aff9e";case"completed":return"#4a9eff";case"stalled":return"#ff9e4a";case"blocked":return"#ff4a4a";case"idle":return"#888888";default:return"#888888"}},$W=b.memo(function({agent:e,screenPos:n,onClose:s}){const{t:a}=pt(["common"]),r=Pa(),i=U.getAreaForAgent(e.id),c=U.getState().lastPrompts.get(e.id),d=Ia(e.class,r),f=U.getAgentSupervisorHistory(e.id),h=f.length>0?f[f.length-1]:void 0,m=Date.now()-(e.createdAt||Date.now()),x=Math.floor(m/6e4),y=Math.floor(x/60),v=y>0?`${y}h ${x%60}m`:`${x}m`,S=e.contextLimit>0?Math.round(e.contextUsed/e.contextLimit*100):0,C=b.useMemo(()=>{let j=n.x-150,E=n.y-320-10;return typeof window<"u"&&(j<10?j=10:j+300>window.innerWidth-10&&(j=window.innerWidth-300-10),E<10&&(E=n.y+10)),{position:"fixed",left:j,top:E,zIndex:1e4,maxWidth:300,maxHeight:320,fontSize:"0.85em"}},[n.x,n.y]);return o.jsxs("div",{className:"agent-hover-popup",style:C,onMouseLeave:s,children:[o.jsxs("div",{className:"agent-bar-tooltip-header",children:[o.jsx("span",{className:"agent-bar-tooltip-icon",children:d.icon}),o.jsx("span",{className:"agent-bar-tooltip-name",children:e.name}),o.jsx("span",{className:"agent-bar-tooltip-status",style:{color:Jb(e.status)},children:a(FW[e.status]||"common:status.unknown")})]}),o.jsxs("div",{className:"agent-bar-tooltip-info",children:[o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.class"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[e.class," — ",d.description]})]}),i&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.area"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-area",style:{color:i.color},children:i.name})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.directory"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-path",children:e.cwd})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.uptime"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",children:v})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.tokens"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[eb(e.tokensUsed)," ",a("common:agentPopup.used")]})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.context"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",style:{color:S>80?"#ff4a4a":S>60?"#ff9e4a":void 0},children:[eb(e.contextUsed)," / ",eb(e.contextLimit)," (",S,"%)"]})]}),e.currentTool&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.tool"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:[os[e.currentTool]||os.default," ",e.currentTool]})]}),e.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.task"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[e.currentTask.substring(0,150),e.currentTask.length>150?"...":""]})]}),e.lastAssignedTask&&!e.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.assignedTask"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[e.lastAssignedTask.substring(0,200),e.lastAssignedTask.length>200?"...":""]})]}),c&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.lastQuery"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[c.text.substring(0,300),c.text.length>300?"...":""]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"agent-bar-tooltip-divider"}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.supervisor"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",style:{color:zW(h.analysis.progress)},children:h.analysis.progress.replace("_"," ")})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.status"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:h.analysis.statusDescription})]}),h.analysis.recentWorkSummary&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.summary"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:[h.analysis.recentWorkSummary.substring(0,300),h.analysis.recentWorkSummary.length>300?"...":""]})]}),h.analysis.concerns&&h.analysis.concerns.length>0&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.concerns"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-concerns",children:h.analysis.concerns.join("; ")})]})]})]})]})});function MA(t){if(t===0)return"0 B";const e=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,s)).toFixed(1))+" "+n[s]}function DA(t){const n=Date.now()-t,s=Math.floor(n/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return s>0?`${s}h ${a}m`:`${a}m`}const RA={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function HW(t){const e=[],n=/\x1B\[([0-9;]*)m/g;let s=0,a=null,r;for(;(r=n.exec(t))!==null;){if(r.index>s){const c=t.slice(s,r.index);a?e.push(o.jsx("span",{style:{color:a},children:c},e.length)):e.push(c)}const i=r[1].split(";").map(Number);for(const c of i)c===0||c===39?a=null:RA[c]&&(a=RA[c]);s=n.lastIndex}if(s<t.length){const i=t.slice(s);a?e.push(o.jsx("span",{style:{color:a},children:i},e.length)):e.push(i)}return e.length>0?e:[t]}const UW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){var F,H,V,G,B,Q,K,q,xe,de,Z,be,je,ce,Ee,ze,Ge,_e,me,De;const{t:c}=pt(["terminal","common"]),[d,f]=b.useState(!1),[h,m]=b.useState(null),[x,y]=b.useState(!1),v=b.useRef(null),S=b.useRef(h);S.current=h;const{buildingLogs:C}=vs(),k=U.getBuildingLogs(e.id),N=(F=e.pm2)==null?void 0:F.enabled,j=(H=e.docker)==null?void 0:H.enabled,E=b.useRef(null),D=b.useRef(null),_=b.useCallback(te=>{te.preventDefault();const He=S.current?S.current.x:0,ye=S.current?S.current.y:0;v.current={mouseX:te.clientX,mouseY:te.clientY,popupX:He,popupY:ye},y(!0),E.current=Re=>{if(!v.current)return;const re=Re.clientX-v.current.mouseX,pe=Re.clientY-v.current.mouseY;m({x:v.current.popupX+re,y:v.current.popupY+pe})},D.current=()=>{y(!1),v.current=null,E.current&&document.removeEventListener("mousemove",E.current),D.current&&document.removeEventListener("mouseup",D.current)},document.addEventListener("mousemove",E.current),document.addEventListener("mouseup",D.current)},[]);b.useEffect(()=>()=>{E.current&&document.removeEventListener("mousemove",E.current),D.current&&document.removeEventListener("mouseup",D.current)},[]);const P=te=>{if(te==="logs"){if((N||j)&&r){r();return}U.sendBuildingCommand(e.id,te),f(!0)}else U.sendBuildingCommand(e.id,te)},O=(te,He)=>{if(te){const ye=`http://localhost:${te}`;He&&i?i(ye):window.open(ye,"_blank")}},T=((V=e.pm2Status)==null?void 0:V.ports)||[],M=((B=(G=e.dockerStatus)==null?void 0:G.ports)==null?void 0:B.map(te=>te.host))||[],R=N?T:j?M:[],I=N?!!((Q=e.pm2)!=null&&Q.script):j?!!((K=e.docker)!=null&&K.image)||((q=e.docker)==null?void 0:q.mode)==="compose"||((xe=e.docker)==null?void 0:xe.mode)==="existing":!!((de=e.commands)!=null&&de.start),z=N?!!((Z=e.pm2)!=null&&Z.script):j?!0:!!((be=e.commands)!=null&&be.stop),W=N?!!((je=e.pm2)!=null&&je.script):j?!0:!!((ce=e.commands)!=null&&ce.restart),$=b.useMemo(()=>{const He=d?400:250;let ye=n.x+20,Re=n.y-80;return typeof window<"u"&&!h&&(n.x+20+280>window.innerWidth&&(ye=n.x-280-20),n.y-80<0?Re=10:n.y-80+He>window.innerHeight&&(Re=window.innerHeight-He-10)),{position:"fixed",left:ye+((h==null?void 0:h.x)||0),top:Re+((h==null?void 0:h.y)||0),zIndex:1e3,cursor:x?"grabbing":void 0}},[n.x,n.y,d,h,x]);return o.jsxs("div",{className:"building-action-popup",style:$,onClick:te=>te.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header ${x?"dragging":""}`,onMouseDown:_,children:[o.jsx("span",{className:"building-popup-name",children:e.name}),R.length>0&&o.jsx("span",{className:"building-popup-ports",children:R.map(te=>o.jsxs("a",{href:`http://localhost:${te}`,className:"building-popup-port-link",onClick:He=>{He.preventDefault(),He.stopPropagation(),O(te,He.altKey)},onMouseDown:He=>He.stopPropagation(),title:`Open http://localhost:${te} (Alt+Click for modal)`,children:[":",te]},te))}),o.jsx("span",{className:"building-popup-status",style:{backgroundColor:pb[e.status]},children:e.status}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),N&&e.pm2Status&&o.jsxs("div",{className:"building-popup-metrics",children:[o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"PID"}),o.jsx("span",{className:"value",children:e.pm2Status.pid||"-"})]}),o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"CPU"}),o.jsxs("span",{className:"value",children:[((Ee=e.pm2Status.cpu)==null?void 0:Ee.toFixed(1))||"0","%"]})]}),o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"MEM"}),o.jsx("span",{className:"value",children:MA(e.pm2Status.memory||0)})]}),e.pm2Status.restarts!==void 0&&e.pm2Status.restarts>0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"RST"}),o.jsx("span",{className:"value",children:e.pm2Status.restarts})]}),e.pm2Status.uptime&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"UP"}),o.jsx("span",{className:"value",children:DA(e.pm2Status.uptime)})]})]}),j&&e.dockerStatus&&o.jsxs("div",{className:"building-popup-metrics",children:[o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"ID"}),o.jsx("span",{className:"value",children:e.dockerStatus.containerId||"-"})]}),e.dockerStatus.cpu!==void 0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"CPU"}),o.jsxs("span",{className:"value",children:[e.dockerStatus.cpu.toFixed(1),"%"]})]}),e.dockerStatus.memory!==void 0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"MEM"}),o.jsx("span",{className:"value",children:MA(e.dockerStatus.memory)})]}),e.dockerStatus.health&&e.dockerStatus.health!=="none"&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"HEALTH"}),o.jsx("span",{className:"value",style:{color:e.dockerStatus.health==="healthy"?"#4ade80":e.dockerStatus.health==="unhealthy"?"#f87171":"#fbbf24"},children:e.dockerStatus.health==="healthy"?"✓":e.dockerStatus.health==="unhealthy"?"✗":"..."})]}),e.dockerStatus.startedAt&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"UP"}),o.jsx("span",{className:"value",children:DA(e.dockerStatus.startedAt)})]})]}),j&&((ze=e.dockerStatus)==null?void 0:ze.services)&&e.dockerStatus.services.length>0&&o.jsx("div",{className:"building-popup-services",children:e.dockerStatus.services.map((te,He)=>o.jsxs("span",{className:"service-item",title:`${te.name}: ${te.status}`,children:[o.jsx("span",{className:"service-indicator",style:{backgroundColor:te.status==="running"?"#4ade80":"#f87171"}}),o.jsx("span",{className:"service-name",children:te.name})]},He))}),(e.lastError||N&&((Ge=e.pm2Status)==null?void 0:Ge.status)==="errored"||j&&((_e=e.dockerStatus)==null?void 0:_e.status)==="dead")&&o.jsxs("div",{className:"building-popup-error",children:[e.lastError||c("terminal:building.processFailedToStart"),N&&((me=e.pm2Status)==null?void 0:me.restarts)&&e.pm2Status.restarts>5&&o.jsxs("span",{className:"error-hint",children:[" - ",c("terminal:building.checkLogsOrConfig")]}),j&&((De=e.dockerStatus)==null?void 0:De.health)==="unhealthy"&&o.jsxs("span",{className:"error-hint",children:[" - ",c("terminal:building.healthCheckFailing")]})]}),o.jsxs("div",{className:"building-popup-actions",children:[o.jsxs("button",{className:"action-btn start",onClick:()=>P("start"),disabled:!I||e.status==="running"||e.status==="starting",title:c(I?"terminal:buildingAction.start":"terminal:buildingAction.noStartCommand"),children:[o.jsx("span",{className:"icon",children:"▶"}),c("terminal:buildingAction.start")]}),o.jsxs("button",{className:"action-btn stop",onClick:()=>P("stop"),disabled:!z||e.status==="stopped"||e.status==="stopping",title:c(z?"terminal:buildingAction.stop":"terminal:buildingAction.noStopCommand"),children:[o.jsx("span",{className:"icon",children:"■"}),c("terminal:buildingAction.stop")]}),o.jsxs("button",{className:"action-btn restart",onClick:()=>P("restart"),disabled:!W,title:c(W?"terminal:buildingAction.restart":"terminal:buildingAction.noRestartCommand"),children:[o.jsx("span",{className:"icon",children:"↺"}),c("terminal:buildingAction.restart")]}),o.jsxs("button",{className:"action-btn logs",onClick:()=>P("logs"),title:c("terminal:buildingAction.viewLogs"),children:[o.jsx("span",{className:"icon",children:"📄"}),c("terminal:logs.title")]}),R.length===1&&o.jsxs("button",{className:"action-btn open-url",onClick:te=>O(R[0],te.altKey),title:`Open http://localhost:${R[0]} (Alt+Click for modal)`,children:[o.jsx("span",{className:"icon",children:"🔗"}),c("terminal:buildingAction.openInBrowser")]}),R.length>1&&o.jsxs("div",{className:"action-btn-group",children:[o.jsxs("span",{className:"action-btn-label",children:[c("terminal:buildingAction.openInBrowser"),":"]}),R.map(te=>o.jsxs("button",{className:"action-btn open-url port-btn",onClick:He=>O(te,He.altKey),title:`Open http://localhost:${te} (Alt+Click for modal)`,children:[":",te]},te))]})]}),d&&k.length>0&&o.jsxs("div",{className:"building-popup-logs",children:[o.jsxs("div",{className:"logs-header",children:[o.jsx("span",{children:c("terminal:logs.title")}),o.jsx("button",{onClick:()=>U.clearBuildingLogs(e.id),children:c("terminal:logs.clear")})]}),o.jsx("div",{className:"logs-content",children:k.slice(-50).map((te,He)=>o.jsx("pre",{children:HW(te)},He))})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:c("terminal:buildingAction.fullSettings")})]})});function WW(t){if(t===0)return"0 B";const e=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,s)).toFixed(1))+" "+n[s]}function qW(t){const n=Date.now()-t,s=Math.floor(n/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return s>0?`${s}h ${a}m`:`${a}m`}const VW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){const{t:c}=pt(["terminal","common"]),[d,f]=b.useState(null),[h,m]=b.useState(!1),x=b.useRef(null),y=b.useRef(d);y.current=d;const{buildings:v}=vs(),C=(e.subordinateBuildingIds||[]).map(T=>v.get(T)).filter(T=>T!==void 0),k=b.useRef(null),N=b.useRef(null),j=b.useCallback(T=>{T.preventDefault();const M=y.current?y.current.x:0,R=y.current?y.current.y:0;x.current={mouseX:T.clientX,mouseY:T.clientY,popupX:M,popupY:R},m(!0),k.current=I=>{if(!x.current)return;const z=I.clientX-x.current.mouseX,W=I.clientY-x.current.mouseY;f({x:x.current.popupX+z,y:x.current.popupY+W})},N.current=()=>{m(!1),x.current=null,k.current&&document.removeEventListener("mousemove",k.current),N.current&&document.removeEventListener("mouseup",N.current)},document.addEventListener("mousemove",k.current),document.addEventListener("mouseup",N.current)},[]);b.useEffect(()=>()=>{k.current&&document.removeEventListener("mousemove",k.current),N.current&&document.removeEventListener("mouseup",N.current)},[]);const E=T=>{U.sendBossBuildingCommand(e.id,T)},D=C.reduce((T,M)=>(T[M.status]=(T[M.status]||0)+1,T),{}),_=C.some(T=>{var M;return(M=T.pm2)==null?void 0:M.enabled}),P=(T,M)=>{const R=`http://localhost:${T}`;M&&i?i(R):window.open(R,"_blank")},O=b.useMemo(()=>{let R=n.x+20,I=n.y-80;return typeof window<"u"&&!d&&(n.x+20+340>window.innerWidth&&(R=n.x-340-20),n.y-80<0?I=10:n.y-80+350>window.innerHeight&&(I=window.innerHeight-350-10)),{position:"fixed",left:R+((d==null?void 0:d.x)||0),top:I+((d==null?void 0:d.y)||0),zIndex:1e3,cursor:h?"grabbing":void 0}},[n.x,n.y,d,h]);return o.jsxs("div",{className:"building-action-popup boss-building-popup",style:O,onClick:T=>T.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header boss-header ${h?"dragging":""}`,onMouseDown:j,children:[o.jsx("span",{className:"boss-icon",children:"👑"}),o.jsx("span",{className:"building-popup-name",children:e.name}),o.jsx("span",{className:"subordinate-count",children:c("terminal:building.unitsCount",{count:C.length})}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),o.jsxs("div",{className:"boss-status-overview",children:[Object.entries(D).map(([T,M])=>o.jsxs("span",{className:"status-badge",style:{backgroundColor:pb[T]||"#666"},children:[M," ",T]},T)),C.length===0&&o.jsx("span",{className:"no-subordinates",children:c("terminal:building.noSubordinates")})]}),C.length>0&&o.jsx("div",{className:"subordinate-list",children:C.map(T=>{var M,R,I;return o.jsxs("div",{className:"subordinate-item",children:[o.jsx("span",{className:"sub-status-dot",style:{backgroundColor:pb[T.status]}}),o.jsx("span",{className:"sub-name",children:T.name}),((M=T.pm2Status)==null?void 0:M.ports)&&T.pm2Status.ports.length>0&&o.jsx("span",{className:"sub-port",children:T.pm2Status.ports.map(z=>o.jsxs("a",{href:`http://localhost:${z}`,className:"building-popup-port-link",onClick:W=>{W.preventDefault(),W.stopPropagation(),P(z,W.altKey)},title:`Open http://localhost:${z} (Alt+Click for modal)`,children:[":",z]},z))}),T.pm2Status&&o.jsxs("span",{className:"sub-metrics",children:[(R=T.pm2Status.cpu)==null?void 0:R.toFixed(0),"% | ",WW(T.pm2Status.memory||0)]}),((I=T.pm2Status)==null?void 0:I.uptime)&&o.jsx("span",{className:"sub-uptime",children:qW(T.pm2Status.uptime)})]},T.id)})}),o.jsxs("div",{className:"building-popup-actions boss-actions",children:[o.jsxs("button",{className:"action-btn start",onClick:()=>E("start_all"),disabled:C.length===0,title:c("terminal:building.startAllSubs"),children:[o.jsx("span",{className:"icon",children:"▶"}),c("terminal:building.startAll")]}),o.jsxs("button",{className:"action-btn stop",onClick:()=>E("stop_all"),disabled:C.length===0,title:c("terminal:building.stopAllSubs"),children:[o.jsx("span",{className:"icon",children:"■"}),c("terminal:building.stopAll")]}),o.jsxs("button",{className:"action-btn restart",onClick:()=>E("restart_all"),disabled:C.length===0,title:c("terminal:building.restartAllSubs"),children:[o.jsx("span",{className:"icon",children:"↺"}),c("terminal:building.restartAll")]}),_&&o.jsxs("button",{className:"action-btn logs",onClick:r,title:c("terminal:building.viewUnifiedLogs"),children:[o.jsx("span",{className:"icon",children:"📄"}),c("terminal:building.logs")]})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:c("terminal:building.fullSettings")})]})}),GW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenDatabasePanel:r}){var D;const{t:i}=pt(["terminal","common"]),[c,d]=b.useState(null),[f,h]=b.useState(!1),m=b.useRef(null),x=b.useRef(c);x.current=c;const y=bx(e.id),v=((D=e.database)==null?void 0:D.connections)??[],S=b.useRef(null),C=b.useRef(null),k=b.useCallback(_=>{_.preventDefault();const P=x.current?x.current.x:0,O=x.current?x.current.y:0;m.current={mouseX:_.clientX,mouseY:_.clientY,popupX:P,popupY:O},h(!0),S.current=T=>{if(!m.current)return;const M=T.clientX-m.current.mouseX,R=T.clientY-m.current.mouseY;d({x:m.current.popupX+M,y:m.current.popupY+R})},C.current=()=>{h(!1),m.current=null,S.current&&document.removeEventListener("mousemove",S.current),C.current&&document.removeEventListener("mouseup",C.current)},document.addEventListener("mousemove",S.current),document.addEventListener("mouseup",C.current)},[]);b.useEffect(()=>()=>{S.current&&document.removeEventListener("mousemove",S.current),C.current&&document.removeEventListener("mouseup",C.current)},[]);const N=_=>{U.testDatabaseConnection(e.id,_)},j=_=>y.connectionStatus.get(_),E=b.useMemo(()=>{let O=n.x+20,T=n.y-80;return typeof window<"u"&&!c&&(n.x+20+320>window.innerWidth&&(O=n.x-320-20),n.y-80<0?T=10:n.y-80+300>window.innerHeight&&(T=window.innerHeight-300-10)),{position:"fixed",left:O+((c==null?void 0:c.x)||0),top:T+((c==null?void 0:c.y)||0),zIndex:1e3,cursor:f?"grabbing":void 0}},[n.x,n.y,c,f]);return o.jsxs("div",{className:"building-action-popup database-building-popup",style:E,onClick:_=>_.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header database-header ${f?"dragging":""}`,onMouseDown:k,children:[o.jsx("span",{className:"database-icon",children:"🗄️"}),o.jsx("span",{className:"building-popup-name",children:e.name}),o.jsx("span",{className:"connection-count",children:i("terminal:building.connCount",{count:v.length})}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),v.length>0?o.jsx("div",{className:"database-connection-list",children:v.map(_=>{var O;const P=j(_.id);return o.jsxs("div",{className:"database-connection-item",children:[o.jsx("span",{className:"conn-engine",children:((O=BL[_.engine])==null?void 0:O.icon)??"🗄️"}),o.jsx("span",{className:"conn-name",children:_.name}),o.jsx("span",{className:"conn-host",children:_.engine==="sqlite"?_.filepath||_.database||":memory:":`${_.host}:${_.port}`}),P&&o.jsx("span",{className:`conn-status ${P.connected?"connected":"disconnected"}`,children:P.connected?"●":"○"}),o.jsx("button",{className:"conn-test-btn",onClick:()=>N(_.id),title:i("terminal:building.testConnection"),children:"↻"})]},_.id)})}):o.jsxs("div",{className:"database-no-connections",children:[o.jsx("p",{children:i("terminal:building.noConnections")}),o.jsx("p",{className:"hint",children:i("terminal:building.clickSettingsToAdd")})]}),o.jsxs("div",{className:"building-popup-actions database-actions",children:[o.jsxs("button",{className:"action-btn query",onClick:r,disabled:v.length===0,title:i("terminal:building.openDbExplorer"),children:[o.jsx("span",{className:"icon",children:"⌨"}),i("terminal:building.query")]}),o.jsxs("button",{className:"action-btn test-all",onClick:()=>v.forEach(_=>N(_.id)),disabled:v.length===0,title:i("terminal:building.testAllConnections"),children:[o.jsx("span",{className:"icon",children:"↻"}),i("terminal:building.testAll")]})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:i("common:buttons.settings")})]})});function YW({visible:t=!0,position:e="top-right"}){const[n,s]=b.useState(0),[a,r]=b.useState([]),[i,c]=b.useState(null),[d,f]=b.useState([]),[h,m]=b.useState(null),[x,y]=b.useState(null),[v,S]=b.useState(!1),[C,k]=b.useState("fps"),[N,j]=b.useState(null),[E,D]=b.useState(null),[_,P]=b.useState(null),[O,T]=b.useState(typeof window<"u"?window.innerWidth:1024),[M,R]=b.useState(null);b.useEffect(()=>{const Z=()=>T(window.innerWidth);return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]);const I=vp(),z=b.useMemo(()=>{const Z=I.filter(je=>je.memoryUsageMB!==void 0&&je.memoryUsageMB>0);return{totalMB:Z.reduce((je,ce)=>je+(ce.memoryUsageMB||0),0),agentCount:Z.length,agents:Z.map(je=>({name:je.name,memoryMB:je.memoryUsageMB||0,status:je.status})).sort((je,ce)=>ce.memoryMB-je.memoryMB)}},[I]),W=b.useRef([]),$=b.useRef(null);if(b.useEffect(()=>{W.current=d},[d]),b.useEffect(()=>{$.current=h},[h]),b.useEffect(()=>{if(!t)return;const Z=async()=>{try{const je=await Lt(Mt("/api/perf"));if(je.ok){const ce=await je.json();D(ce)}}catch{}};Z();const be=setInterval(Z,v?3e3:1e4);return()=>clearInterval(be)},[t,v]),b.useEffect(()=>{if(!t)return;const Z=Dc.getUsage();Z&&M===null&&R(Z.usedMB);const be=setInterval(()=>{var He,ye;Kd.update();const je=Kd.getStats();s(je.current),r(Re=>[...Re,je.current].slice(-60));const ce=Dc.getUsage();ce&&c(ce);const Ee=window.__tideScene;if(Ee){const Re=(He=Ee.getMemoryDiagnostics)==null?void 0:He.call(Ee);Re!=null&&Re.threeJs&&m(Re.threeJs);const re=Ee.renderer;if((ye=re==null?void 0:re.info)!=null&&ye.memory){const pe=re.info.memory.textures||0,Ve=Math.round(pe*1);P({count:pe,estimatedMB:Ve})}}const ze=document.getElementsByTagName("*"),Ge=document.getElementsByTagName("canvas"),_e=document.getElementsByTagName("img"),me=document.getElementsByTagName("video");let De=0;for(let Re=0;Re<Math.min(ze.length,500);Re++){const re=ze[Re];re.onclick&&De++,re.onmousedown&&De++,re.onkeydown&&De++}De+=10,j({nodeCount:ze.length,listenerCount:De,canvasCount:Ge.length,imageCount:_e.length,videoCount:me.length}),ce&&f(Re=>{const re=$.current,pe={timestamp:Date.now(),heapMB:ce.usedMB,geometries:(re==null?void 0:re.geometries)??0,textures:(re==null?void 0:re.textures)??0};return[...Re,pe].slice(-120)});const te=W.current;if(te.length>=10){const Re=te[0],re=te[te.length-1],pe=(re.timestamp-Re.timestamp)/1e3/60;pe>.1&&y((re.heapMB-Re.heapMB)/pe)}},1e3);return()=>{clearInterval(be)}},[t,M]),!t)return null;const F=Z=>{const be=Math.floor(Z/3600),je=Math.floor(Z%3600/60),ce=Z%60;return be>0?`${be}h ${je}m`:je>0?`${je}m ${ce}s`:`${ce}s`},H=Z=>Z>=55?"#4aff9e":Z>=30?"#ffcc00":"#ff4a4a",V=(Z,be)=>{const je=Z/be;return je<.5?"#4aff9e":je<.8?"#ffcc00":"#ff4a4a"},G=Z=>Z===null?"#888":Z<1?"#4aff9e":Z<5?"#ffcc00":"#ff4a4a",B=Kd.getStats(),K=O<=768?80:10,q={"top-left":{top:10,left:10},"top-right":{top:10,right:10},"bottom-left":{bottom:K,left:10},"bottom-right":{bottom:K,right:10}},xe=M&&i?i.usedMB-M:0,de=Z=>({padding:"2px 8px",fontSize:"9px",border:"none",background:C===Z?"rgba(74, 158, 255, 0.4)":"rgba(255, 255, 255, 0.1)",color:C===Z?"#4a9eff":"#888",borderRadius:"3px",cursor:"pointer"});return o.jsxs("div",{style:{position:"fixed",...q[e],zIndex:99999,fontFamily:"monospace",fontSize:"11px",background:"rgba(0, 0, 0, 0.9)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"4px",padding:"6px 10px",color:"#fff",userSelect:"none",minWidth:v?"260px":"120px",maxWidth:"calc(100vw - 20px)",maxHeight:v?"calc(100vh - 100px)":"auto",overflowY:v?"auto":"visible",transition:"all 0.2s ease"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>S(!v),children:[o.jsx("span",{style:{color:H(n),fontWeight:"bold",fontSize:"14px"},children:n}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"FPS"}),i&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#444"},children:"|"}),o.jsx("span",{style:{color:V(i.usedMB,i.totalMB),fontWeight:"bold"},children:i.usedMB}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"MB"})]}),x!==null&&Math.abs(x)>.5&&o.jsxs("span",{style:{color:G(x),fontSize:"10px",marginLeft:"4px"},children:[x>0?"+":"",x.toFixed(1),"/m"]}),E&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#444"},children:"|"}),o.jsx("span",{style:{color:"#ff9e4a",fontWeight:"bold"},children:E.process.rssMB}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"SRV"})]}),o.jsx("span",{style:{color:"#444",marginLeft:"auto",fontSize:"10px"},children:v?"▼":"▶"})]}),v&&o.jsxs("div",{style:{marginTop:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"},children:[o.jsxs("div",{style:{display:"flex",gap:"4px",marginBottom:"8px",flexWrap:"wrap"},children:[o.jsx("button",{style:de("fps"),onClick:()=>k("fps"),children:"FPS"}),o.jsx("button",{style:de("memory"),onClick:()=>k("memory"),children:"Memory"}),o.jsx("button",{style:de("threejs"),onClick:()=>k("threejs"),children:"3D"}),o.jsx("button",{style:de("dom"),onClick:()=>k("dom"),children:"DOM"}),o.jsx("button",{style:de("server"),onClick:()=>k("server"),children:"Server"}),o.jsx("button",{style:de("http"),onClick:()=>k("http"),children:"HTTP"})]}),C==="fps"&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Current:"}),o.jsx("span",{style:{color:H(B.current)},children:B.current}),o.jsx("span",{style:{color:"#888"},children:"Min:"}),o.jsx("span",{style:{color:H(B.min)},children:B.min}),o.jsx("span",{style:{color:"#888"},children:"Max:"}),o.jsx("span",{style:{color:H(B.max)},children:B.max}),o.jsx("span",{style:{color:"#888"},children:"Avg:"}),o.jsx("span",{style:{color:H(B.avg)},children:B.avg})]}),o.jsxs("div",{style:{marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"60s History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"30px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:a.slice(-60).map((Z,be)=>o.jsx("div",{style:{width:"3px",height:`${Math.min(100,Z/60*100)}%`,background:H(Z),opacity:.8}},be))})]})]}),C==="memory"&&i&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Used:"}),o.jsxs("span",{style:{color:V(i.usedMB,i.totalMB)},children:[i.usedMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Total:"}),o.jsxs("span",{children:[i.totalMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Limit:"}),o.jsxs("span",{children:[i.limitMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Baseline:"}),o.jsxs("span",{children:[M??"—"," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Growth:"}),o.jsxs("span",{style:{color:xe>50?"#ff4a4a":xe>20?"#ffcc00":"#4aff9e"},children:[xe>0?"+":"",xe," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Rate:"}),o.jsx("span",{style:{color:G(x)},children:x!==null?`${x.toFixed(2)} MB/min`:"—"})]}),o.jsx("div",{style:{marginBottom:"8px"},children:o.jsx("div",{style:{height:"8px",background:"rgba(255,255,255,0.1)",borderRadius:"4px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${i.usedMB/i.limitMB*100}%`,background:V(i.usedMB,i.totalMB),transition:"width 0.3s ease"}})})}),d.length>1&&o.jsxs("div",{children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"Memory History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"40px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:d.slice(-60).map((Z,be)=>{const je=Math.min(...d.map(Ge=>Ge.heapMB)),Ee=Math.max(...d.map(Ge=>Ge.heapMB))-je||1,ze=(Z.heapMB-je)/Ee*100;return o.jsx("div",{style:{width:"3px",height:`${Math.max(5,ze)}%`,background:Z.heapMB>(M??0)+50?"#ff4a4a":"#4a9eff",opacity:.8},title:`${Z.heapMB}MB`},be)})})]}),z.agentCount>0&&o.jsxs("div",{style:{marginTop:"8px"},children:[o.jsxs("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:["Agent Memory (",z.agentCount,"):"]}),o.jsxs("div",{style:{fontSize:"10px"},children:[o.jsxs("div",{style:{color:"#4aff9e",fontWeight:"bold",marginBottom:"2px"},children:["Total: ",z.totalMB,"MB"]}),o.jsx("div",{style:{maxHeight:"50px",overflowY:"auto"},children:z.agents.slice(0,4).map((Z,be)=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:Z.status==="working"?"#4aff9e":"#666",maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:Z.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[Z.memoryMB,"MB"]})]},be))})]})]}),o.jsxs("div",{style:{marginTop:"8px",padding:"6px",background:"rgba(0,0,0,0.3)",borderRadius:"4px"},children:[o.jsx("div",{style:{color:"#888",fontSize:"9px",marginBottom:"4px"},children:"Memory Breakdown (estimated):"}),o.jsxs("div",{style:{fontSize:"9px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#4a9eff"},children:"JS Heap"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[i.usedMB," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#ff9e4a"},children:"GPU/Textures"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:["~",(_==null?void 0:_.estimatedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsxs("span",{style:{color:"#9e4aff"},children:["DOM (",(N==null?void 0:N.nodeCount.toLocaleString())??0," nodes)"]}),o.jsxs("span",{style:{color:"#9e4aff"},children:["~",Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"4px",marginTop:"4px"},children:[o.jsx("span",{style:{color:"#fff",fontWeight:"bold"},children:"Est. Total"}),o.jsxs("span",{style:{color:"#fff",fontWeight:"bold"},children:["~",i.usedMB+((_==null?void 0:_.estimatedMB)??0)+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)," MB"]})]})]})]})]}),C==="threejs"&&o.jsx("div",{children:h?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Geometries:"}),o.jsx("span",{style:{color:"#4aff9e"},children:h.geometries}),o.jsx("span",{style:{color:"#888"},children:"Textures:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:h.textures}),o.jsx("span",{style:{color:"#888"},children:"Programs:"}),o.jsx("span",{style:{color:"#9e4aff"},children:h.programs})]}),d.length>1&&o.jsxs("div",{children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"Resource History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"40px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:d.slice(-60).map((Z,be)=>{const je=Math.max(...d.map(ce=>ce.textures))||1;return o.jsx("div",{style:{width:"3px",height:`${Z.textures/je*100}%`,background:"#ff9e4a",opacity:.8},title:`${Z.textures} textures`},be)})})]}),o.jsx("div",{style:{color:"#666",fontSize:"9px",marginTop:"8px"},children:"Tip: Watch textures count. If it keeps increasing, there's a leak."})]}):o.jsxs("div",{style:{color:"#666",fontSize:"10px"},children:["Three.js stats unavailable.",o.jsx("br",{}),"SceneManager not exposed."]})}),C==="dom"&&o.jsx("div",{children:N?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"DOM Nodes:"}),o.jsx("span",{style:{color:N.nodeCount>5e3?"#ff4a4a":N.nodeCount>2e3?"#ffcc00":"#4aff9e"},children:N.nodeCount.toLocaleString()}),o.jsx("span",{style:{color:"#888"},children:"Canvases:"}),o.jsx("span",{style:{color:"#4a9eff"},children:N.canvasCount}),o.jsx("span",{style:{color:"#888"},children:"Images:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:N.imageCount}),o.jsx("span",{style:{color:"#888"},children:"Videos:"}),o.jsx("span",{style:{color:"#9e4aff"},children:N.videoCount})]}),_&&o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsx("span",{style:{color:"#888"},children:"GPU Textures:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:_.count}),o.jsx("span",{style:{color:"#888"},children:"Est. VRAM:"}),o.jsxs("span",{style:{color:_.estimatedMB>100?"#ff4a4a":"#4aff9e"},children:["~",_.estimatedMB," MB"]})]}),o.jsxs("div",{style:{marginTop:"8px",padding:"6px",background:"rgba(0,0,0,0.3)",borderRadius:"4px"},children:[o.jsx("div",{style:{color:"#888",fontSize:"9px",marginBottom:"4px"},children:"Memory Breakdown (estimated):"}),o.jsxs("div",{style:{fontSize:"9px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#4a9eff"},children:"JS Heap"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[(i==null?void 0:i.usedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#ff9e4a"},children:"GPU/Textures"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:["~",(_==null?void 0:_.estimatedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#9e4aff"},children:"DOM (~0.5KB/node)"}),o.jsxs("span",{style:{color:"#9e4aff"},children:["~",Math.round(N.nodeCount*.5/1024)," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"4px",marginTop:"4px"},children:[o.jsx("span",{style:{color:"#fff",fontWeight:"bold"},children:"Est. Total"}),o.jsxs("span",{style:{color:"#fff",fontWeight:"bold"},children:["~",((i==null?void 0:i.usedMB)??0)+((_==null?void 0:_.estimatedMB)??0)+Math.round(N.nodeCount*.5/1024)," MB"]})]})]})]}),o.jsx("div",{style:{color:"#666",fontSize:"9px",marginTop:"8px"},children:"Note: Task Manager shows more due to browser overhead, decoded images, and WebGL buffers."})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading DOM stats..."})}),C==="server"&&o.jsx("div",{children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Uptime:"}),o.jsx("span",{style:{color:"#4aff9e"},children:F(E.uptime)}),o.jsx("span",{style:{color:"#888"},children:"Heap Used:"}),o.jsxs("span",{style:{color:E.process.heapUsedMB>500?"#ff4a4a":"#4aff9e"},children:[E.process.heapUsedMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Heap Total:"}),o.jsxs("span",{children:[E.process.heapTotalMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"RSS:"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[E.process.rssMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"External:"}),o.jsxs("span",{children:[E.process.externalMB," MB"]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px",marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"System:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"Load Avg:"}),o.jsx("span",{style:{color:E.system.loadAvg[0]>E.system.cpuCount?"#ff4a4a":"#4aff9e"},children:E.system.loadAvg.join(" ")}),o.jsx("span",{style:{color:"#888"},children:"CPUs:"}),o.jsx("span",{children:E.system.cpuCount}),o.jsx("span",{style:{color:"#888"},children:"Sys Memory:"}),o.jsxs("span",{children:[E.system.totalMemMB-E.system.freeMemMB," / ",E.system.totalMemMB," MB"]})]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px",marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"WebSocket:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"Clients:"}),o.jsx("span",{style:{color:"#4a9eff"},children:E.websocket.clients}),o.jsx("span",{style:{color:"#888"},children:"Sent:"}),o.jsx("span",{children:E.websocket.messagesSent.toLocaleString()}),o.jsx("span",{style:{color:"#888"},children:"Received:"}),o.jsx("span",{children:E.websocket.messagesReceived.toLocaleString()})]})]}),E.agents.total>0&&o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsxs("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:["Agents (",E.agents.working,"w / ",E.agents.idle,"i / ",E.agents.total,"t):"]}),o.jsx("div",{style:{maxHeight:"80px",overflowY:"auto",fontSize:"10px"},children:E.agents.processes.map(Z=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:Z.status==="working"?"#4aff9e":Z.status==="idle"?"#888":"#ff4a4a",maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Z.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[Z.memoryMB!=null?`${Z.memoryMB}MB`:"—",Z.pid?` (${Z.pid})`:""]})]},Z.id))})]})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading server metrics..."})}),C==="http"&&o.jsx("div",{children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Req/sec (30s):"}),o.jsx("span",{style:{color:"#4aff9e"},children:E.http.reqPerSec}),o.jsx("span",{style:{color:"#888"},children:"Avg Latency:"}),o.jsxs("span",{style:{color:E.http.avgLatencyMs>100?"#ff4a4a":E.http.avgLatencyMs>50?"#ffcc00":"#4aff9e"},children:[E.http.avgLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Max Latency:"}),o.jsxs("span",{style:{color:E.http.maxLatencyMs>500?"#ff4a4a":E.http.maxLatencyMs>200?"#ffcc00":"#4aff9e"},children:[E.http.maxLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Recent Reqs:"}),o.jsx("span",{children:E.http.recentRequests})]}),o.jsxs("div",{style:{marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"Avg Latency:"}),o.jsx("div",{style:{height:"8px",background:"rgba(255,255,255,0.1)",borderRadius:"4px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${Math.min(100,E.http.avgLatencyMs/500*100)}%`,background:E.http.avgLatencyMs>100?"#ff4a4a":E.http.avgLatencyMs>50?"#ffcc00":"#4aff9e",transition:"width 0.3s ease"}})}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"8px",color:"#444",marginTop:"2px"},children:[o.jsx("span",{children:"0ms"}),o.jsx("span",{children:"500ms"})]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"Server Process:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"CPU (user):"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[E.process.cpuUser," ms"]}),o.jsx("span",{style:{color:"#888"},children:"CPU (system):"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:[E.process.cpuSystem," ms"]}),o.jsx("span",{style:{color:"#888"},children:"WS Clients:"}),o.jsx("span",{style:{color:"#4aff9e"},children:E.websocket.clients})]})]})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading HTTP metrics..."})}),o.jsxs("div",{style:{display:"flex",gap:"4px",marginTop:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px",flexWrap:"wrap"},children:[o.jsx("button",{onClick:Z=>{Z.stopPropagation();const be=["=== Tide Commander Performance Stats ===",`Timestamp: ${new Date().toISOString()}`,"","--- FPS ---",`Current: ${B.current}`,`Min: ${B.min}`,`Max: ${B.max}`,`Avg: ${B.avg}`];i&&be.push("","--- Memory ---",`Heap Used: ${i.usedMB} MB`,`Heap Total: ${i.totalMB} MB`,`Heap Limit: ${i.limitMB} MB`,`Baseline: ${M??"N/A"} MB`,`Growth: ${xe>0?"+":""}${xe} MB`,`Growth Rate: ${x!==null?`${x.toFixed(2)} MB/min`:"N/A"}`),h&&be.push("","--- Three.js ---",`Geometries: ${h.geometries}`,`Textures: ${h.textures}`,`Programs: ${h.programs}`),z.agentCount>0&&(be.push("","--- Agent Memory ---",`Total: ${z.totalMB} MB`,`Agents: ${z.agentCount}`),z.agents.slice(0,5).forEach(ce=>{be.push(` ${ce.name}: ${ce.memoryMB} MB (${ce.status})`)})),N&&be.push("","--- DOM ---",`DOM Nodes: ${N.nodeCount.toLocaleString()}`,`Canvases: ${N.canvasCount}`,`Images: ${N.imageCount}`,`Videos: ${N.videoCount}`),_&&be.push("","--- Estimated Memory ---",`GPU Textures: ${_.count}`,`Est. VRAM: ~${_.estimatedMB} MB`,`Est. DOM: ~${Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)} MB`,`Est. Total: ~${((i==null?void 0:i.usedMB)??0)+_.estimatedMB+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)} MB`),E&&(be.push("","--- Server ---",`Uptime: ${F(E.uptime)}`,`Heap: ${E.process.heapUsedMB}/${E.process.heapTotalMB} MB`,`RSS: ${E.process.rssMB} MB`,`Load Avg: ${E.system.loadAvg.join(" ")}`,`System Memory: ${E.system.totalMemMB-E.system.freeMemMB}/${E.system.totalMemMB} MB`,"","--- WebSocket ---",`Clients: ${E.websocket.clients}`,`Sent: ${E.websocket.messagesSent}`,`Received: ${E.websocket.messagesReceived}`,"","--- HTTP ---",`Req/sec: ${E.http.reqPerSec}`,`Avg Latency: ${E.http.avgLatencyMs} ms`,`Max Latency: ${E.http.maxLatencyMs} ms`),E.agents.processes.length>0&&(be.push("","--- Agent Processes ---",`Total: ${E.agents.total} (${E.agents.working} working, ${E.agents.idle} idle)`),E.agents.processes.forEach(ce=>{be.push(` ${ce.name}: ${ce.memoryMB!=null?`${ce.memoryMB}MB`:"N/A"} (${ce.status})${ce.pid?` PID:${ce.pid}`:""}`)})));const je=be.join(`
|
|
153
|
-
`);navigator.clipboard.writeText(je).then(()=>{const ce=Z.currentTarget,Ee=ce.textContent;ce.textContent="Copied!",setTimeout(()=>{ce.textContent=Ee},1e3)})},style:{flex:1,background:"rgba(74, 255, 158, 0.3)",border:"1px solid rgba(74, 255, 158, 0.5)",color:"#4aff9e",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Copy Stats"}),o.jsx("button",{onClick:Z=>{Z.stopPropagation(),Dc.report();const be=window.__tideScene;be!=null&&be.logMemoryDiagnostics&&be.logMemoryDiagnostics()},style:{flex:1,background:"rgba(74, 158, 255, 0.3)",border:"1px solid rgba(74, 158, 255, 0.5)",color:"#4a9eff",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Console"}),o.jsx("button",{onClick:Z=>{Z.stopPropagation(),yb.clear(),Kd.reset(),Dc.reset(),r([]),f([]);const be=Dc.getUsage();be&&R(be.usedMB)},style:{flex:1,background:"rgba(255, 74, 74, 0.3)",border:"1px solid rgba(255, 74, 74, 0.5)",color:"#ff4a4a",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Reset"})]})]})]})}function KW(){const t=Hj(),e=b.useCallback(n=>{U.setViewMode(n)},[]);return[t,e]}const QW=["3d","2d","dashboard"],XW=b.memo(function({className:e=""}){const{t:n}=pt(["common"]),[s,a]=KW(),r=b.useRef(null),[i,c]=b.useState(null);b.useLayoutEffect(()=>{const f=r.current;if(!f)return;const h=f.querySelector(".view-mode-toggle__btn--active");h&&c({left:h.offsetLeft,width:h.offsetWidth})},[s]);const d=b.useCallback(f=>{if(f!==s){if(typeof window<"u"&&window.dispatchEvent(new CustomEvent("tide:viewmode-switch-pressed",{detail:{mode:f}})),f==="3d"){requestAnimationFrame(()=>a(f));return}a(f)}},[s,a]);return o.jsxs("div",{className:`view-mode-toggle ${e}`,ref:r,children:[i&&o.jsx("div",{className:"view-mode-toggle__indicator",style:{left:i.left,width:i.width}}),QW.map(f=>o.jsxs("button",{className:`view-mode-toggle__btn ${s===f?"view-mode-toggle__btn--active":""}`,onClick:()=>d(f),title:n(`common:viewMode.descriptions.${f}`),children:[o.jsxs("span",{className:"view-mode-toggle__icon",children:[f==="2d"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]}),f==="3d"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),o.jsx("path",{d:"M2 17l10 5 10-5"}),o.jsx("path",{d:"M2 12l10 5 10-5"})]}),f==="dashboard"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"7",height:"9",rx:"1"}),o.jsx("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"14",y:"12",width:"7",height:"9",rx:"1"}),o.jsx("rect",{x:"3",y:"16",width:"7",height:"5",rx:"1"})]})]}),o.jsx("span",{className:"view-mode-toggle__label",children:n(`common:viewMode.labels.${f}`)})]},f))]})});function RT({className:t}){const{t:e}=pt(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(null),i=ny(),c=b.useCallback(async y=>{if(y.trim()){console.log("[VoiceAssistant] Transcribed:",y),s(!0),r(null);try{const S=await(await Lt(Mt("/api/voice-assistant/process"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:y})})).json();if(S.success&&S.response)console.log("[VoiceAssistant] Response:",S.response),i.speak(S.response);else{const C=S.error||e("terminal:voiceAssistant.failedToProcess");console.error("[VoiceAssistant] Error:",C),r(C),i.speak(C)}}catch(v){console.error("[VoiceAssistant] Request failed:",v);const S=e("terminal:voiceAssistant.unavailable");r(S),i.speak(S)}finally{s(!1)}}},[i]),d=CT({language:"Spanish",model:"medium",onTranscription:c}),f=d.recording||d.transcribing||n||i.speaking,h=()=>d.error?`${e("terminal:voiceAssistant.error")}: ${d.error}`:a?`${e("terminal:voiceAssistant.error")}: ${a}`:d.recording?e("terminal:voiceAssistant.recording"):d.transcribing?e("terminal:voiceAssistant.transcribing"):n?e("terminal:voiceAssistant.processing"):i.speaking?e("terminal:voiceAssistant.speaking"):e("terminal:voiceAssistant.title"),m=()=>{const y=["voice-assistant-btn",t].filter(Boolean);return d.recording&&y.push("recording"),(d.transcribing||n)&&y.push("processing"),i.speaking&&y.push("speaking"),(a||d.error)&&y.push("error"),y.join(" ")},x=()=>{if(r(null),i.speaking){i.stop();return}d.transcribing||n||d.toggleRecording()};return o.jsxs("button",{className:m(),onClick:x,title:d.supported?h():e("terminal:voiceAssistant.notSupported"),disabled:!d.supported||d.transcribing||n,children:[d.recording?o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[o.jsx("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),o.jsx("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"})]}):i.speaking?o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",fill:"currentColor"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),o.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),o.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),o.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),f&&o.jsx("span",{className:"voice-assistant-indicator"})]})}const JW=b.memo(function({isOpen:e,onToggle:n,onShowTerminal:s,onOpenSidebar:a,onOpenToolbox:r,onOpenCommander:i,onOpenSupervisor:c,onOpenControls:d,onOpenSkills:f,onOpenSnapshots:h,onTakeSnapshot:m,canTakeSnapshot:x,mobileView:y}){const{t:v}=pt(["terminal","common"]),S=Br(),C=k=>{k(),n()};return o.jsxs(o.Fragment,{children:[S.experimentalVoiceAssistant&&o.jsx(RT,{className:"mobile-voice-assistant"}),y!=="terminal"&&o.jsx("button",{className:`mobile-fab-toggle ${e?"open":""}`,onClick:n,onTouchStart:k=>k.stopPropagation(),title:v(e?"terminal:mobileFab.closeMenu":"terminal:mobileFab.openMenu"),children:e?"✕":"☰"}),y==="3d"&&o.jsxs("div",{className:`mobile-fab-menu ${e?"open":""}`,children:[o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(s),onTouchEnd:k=>{k.preventDefault(),C(s)},title:v("terminal:mobileFab.showTerminal"),children:"💬"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(a),onTouchEnd:k=>{k.preventDefault(),C(a)},title:v("terminal:header.openSidebar"),children:"📋"}),x&&o.jsx("button",{className:"mobile-fab-option mobile-fab-option--highlight",onClick:()=>C(m),onTouchEnd:k=>{k.preventDefault(),C(m)},title:v("terminal:mobileFab.takeSnapshot"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(r),onTouchEnd:k=>{k.preventDefault(),C(r)},title:v("common:floatingButtons.settingsAndTools"),children:"⚙️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(i),onTouchEnd:k=>{k.preventDefault(),C(i)},title:v("common:floatingButtons.commanderView"),children:"📊"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(c),onTouchEnd:k=>{k.preventDefault(),C(c)},title:v("common:floatingButtons.supervisorOverview"),children:"🎖️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(d),onTouchEnd:k=>{k.preventDefault(),C(d)},title:v("common:floatingButtons.controls"),children:"⌨️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(f),onTouchEnd:k=>{k.preventDefault(),C(f)},title:v("common:floatingButtons.manageSkills"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(h),onTouchEnd:k=>{k.preventDefault(),C(h)},title:v("common:floatingButtons.viewSnapshots"),children:"📸"})]})]})}),ZW=b.memo(function({onOpenToolbox:e,onOpenCommander:n,onOpenSupervisor:s,onOpenControls:a,onOpenSkills:r,onOpenSnapshots:i,isGeneratingReport:c,pip:d}){const{t:f}=pt(["common","terminal"]),h=Br();return o.jsxs(o.Fragment,{children:[h.experimentalVoiceAssistant&&o.jsx(RT,{}),o.jsx(Jn,{content:f("common:floatingButtons.settingsAndTools"),position:"left",children:o.jsx("button",{className:"floating-settings-btn",onClick:e,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("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"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.commanderView"),position:"left",children:o.jsx("button",{className:"commander-toggle-btn",onClick:n,children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),o.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),o.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),o.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.viewSnapshots"),position:"left",children:o.jsx("button",{className:"snapshots-toggle-btn",onClick:i,children:"📸"})}),o.jsx(Jn,{content:f(c?"terminal:supervisor.generating":"common:floatingButtons.supervisorOverview"),position:"left",children:o.jsxs("button",{className:`supervisor-toggle-btn ${c?"generating":""}`,onClick:s,children:["🎖️",c&&o.jsx("span",{className:"supervisor-generating-indicator"})]})}),o.jsx(Jn,{content:f("common:floatingButtons.controls"),position:"left",children:o.jsx("button",{className:"shortcuts-toggle-btn",onClick:a,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),o.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),o.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),o.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),o.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),o.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),o.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.manageSkills"),position:"left",children:o.jsx("button",{className:"skills-toggle-btn",onClick:r,children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})})})}),o.jsx(Jn,{content:d.isSupported?d.isOpen?f("common:floatingButtons.closePip"):f("common:floatingButtons.openPip"):f("common:floatingButtons.pipNotSupported"),position:"left",disabled:!d.isSupported,children:o.jsx("button",{className:`pip-toggle-btn ${d.isOpen?"active":""}`,onClick:()=>d.isSupported&&d.toggle({width:320,height:400}),disabled:!d.isSupported,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o.jsx("rect",{x:"12",y:"9",width:"8",height:"6",rx:"1"})]})})})]})}),eq=Ce.lazy(()=>vt(()=>import("./SpawnModal-C_e6q2uv.js"),__vite__mapDeps([17,3,1,4])).then(t=>({default:t.SpawnModal}))),tq=Ce.lazy(()=>vt(()=>import("./BossSpawnModal-4CPjS2xn.js"),__vite__mapDeps([18,3,1,4])).then(t=>({default:t.BossSpawnModal}))),nq=Ce.lazy(()=>vt(()=>import("./SubordinateAssignmentModal-BZdSk9WL.js"),__vite__mapDeps([19,3,1,4])).then(t=>({default:t.SubordinateAssignmentModal}))),sq=Ce.lazy(()=>vt(()=>import("./index-8WVMR823.js"),__vite__mapDeps([20,3,1,4,21])).then(t=>({default:t.Toolbox}))),aq=Ce.lazy(()=>vt(()=>import("./index-CcYTUJp1.js"),__vite__mapDeps([22,3,1,4])).then(t=>({default:t.BuildingConfigModal}))),rq=Ce.lazy(()=>vt(()=>import("./index-Sej69v19.js"),__vite__mapDeps([23,24,3,1,4])).then(t=>({default:t.CommanderView}))),iq=Ce.lazy(()=>vt(()=>import("./SupervisorPanel-CxId5lI7.js"),__vite__mapDeps([25,3,1,4])).then(t=>({default:t.SupervisorPanel}))),oq=Ce.lazy(()=>vt(()=>import("./index-Bhb-rse9.js").then(t=>t.y),[]).then(t=>({default:t.FileExplorerPanel}))),lq=Ce.lazy(()=>vt(()=>import("./index-COBkxsEU.js"),__vite__mapDeps([26,3,1,4])).then(t=>({default:t.Spotlight}))),cq=Ce.lazy(()=>vt(()=>import("./ControlsModal-Cr5klRxS.js"),__vite__mapDeps([27,3,1,4])).then(t=>({default:t.ControlsModal}))),uq=Ce.lazy(()=>vt(()=>import("./SkillsPanel-DZC0Im2z.js"),__vite__mapDeps([28,3,1,4])).then(t=>({default:t.SkillsPanel}))),dq=Ce.lazy(()=>vt(()=>Promise.resolve().then(()=>$2),void 0).then(t=>({default:t.AgentEditModal}))),fq=Ce.lazy(()=>vt(()=>import("./SnapshotManager-3LQMRFLh.js"),__vite__mapDeps([29,3,1,4])).then(t=>({default:t.SnapshotManager}))),pq=Ce.lazy(()=>vt(()=>import("./RestoreArchivedAreaModal-KCCSJy3B.js"),__vite__mapDeps([30,3,1,4])).then(t=>({default:t.RestoreArchivedAreaModal}))),hq=Ce.lazy(()=>vt(()=>import("./IntegrationsPanel-C9hWD7mO.js"),__vite__mapDeps([31,3,1,4])).then(t=>({default:t.IntegrationsPanel}))),mq=Ce.lazy(()=>vt(()=>import("./MonitoringModal-BspW74kP.js"),__vite__mapDeps([32,3,1,4])).then(t=>({default:t.MonitoringModal}))),gq=Ce.lazy(()=>vt(()=>import("./WorkflowEditorPanel-BmNCGmxP.js"),__vite__mapDeps([33,3,1,4])).then(t=>({default:t.WorkflowEditorPanel}))),bq=Ce.lazy(()=>vt(()=>import("./TriggerManagerPanel-BCzGGCPD.js"),__vite__mapDeps([34,3,1,4])).then(t=>({default:t.TriggerManagerPanel})));function xq({spawnModal:t,bossSpawnModal:e,subordinateModal:n,toolboxModal:s,commanderModal:a,deleteConfirmModal:r,supervisorModal:i,spotlightModal:c,controlsModal:d,skillsModal:f,integrationsModal:h,monitoringModal:m,workflowEditorModal:x,triggerManagerModal:y,buildingModal:v,agentEditModal:S,snapshotsModal:C,restoreArchivedModal:k,explorerModal:N,contextMenu:j,spawnPosition:E,spawnAreaId:D,explorerFolderPath:_,contextMenuActions:P,buildingInitialPosition:O,sceneConfig:T,onConfigChange:M,onToolChange:R,onOpenAreaExplorer:I,onDeleteSelectedAgents:z,pendingBuildingDelete:W,onCancelBuildingDelete:$,onConfirmBuildingDelete:F,showBackNavModal:H,onCloseBackNavModal:V,onLeave:G,onOpenPM2LogsModal:B,onOpenBossLogsModal:Q,onOpenDatabasePanel:K,onSyncScene:q}){const xe=vs(),de=Array.from(xe.snapshots.values()),Z=xe.snapshotsLoading;xe.currentSnapshot,b.useEffect(()=>{C.isOpen&&U.fetchSnapshots()},[C.isOpen]);const be=W==="selected",je=W&&W!=="selected"?xe.buildings.get(W):null,ce=xe.selectedBuildingIds.size;return o.jsxs(b.Suspense,{fallback:null,children:[o.jsx(sq,{config:T,onConfigChange:M,onToolChange:R,isOpen:s.isOpen,onClose:s.close,onOpenBuildingModal:Ee=>v.open(Ee||null),onOpenAreaExplorer:I,onOpenIntegrationsModal:Ee=>h.open(Ee),onOpenMonitoringModal:()=>m.open(),onOpenWorkflowEditor:()=>x.open(),onOpenTriggerManager:()=>y.open()}),o.jsx(aq,{isOpen:v.isOpen,onClose:v.close,buildingId:v.data,initialPosition:O||void 0}),o.jsx(eq,{isOpen:t.isOpen,onClose:t.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:E,spawnAreaId:D}),o.jsx(tq,{isOpen:e.isOpen,onClose:e.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:E}),o.jsx(nq,{isOpen:n.isOpen,bossId:n.data||"",onClose:n.close}),S.isOpen&&S.data&&(()=>{const Ee=xe.agents.get(S.data);return Ee?o.jsx(dq,{agent:Ee,isOpen:S.isOpen,onClose:S.close}):null})(),r.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:r.close,onKeyDown:Ee=>{Ee.key==="Escape"&&r.close(),Ee.key==="Enter"&&z()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ee=>Ee.stopPropagation(),children:[o.jsx("div",{className:"modal-header",children:"Remove Agents"}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[o.jsxs("p",{children:["Remove ",xe.selectedAgentIds.size," selected agent",xe.selectedAgentIds.size>1?"s":""," from the battlefield?"]}),o.jsx("p",{className:"confirm-modal-note",children:"Claude Code sessions will continue running in the background."})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r.close,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:z,autoFocus:!0,children:"Remove"})]})]})}),(je||be)&&o.jsx("div",{className:"modal-overlay visible",onClick:$,onKeyDown:Ee=>{Ee.key==="Escape"&&$(),Ee.key==="Enter"&&F()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ee=>Ee.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:["Delete Building",be&&ce>1?"s":""]}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[be?o.jsxs("p",{children:["Delete ",ce," selected building",ce>1?"s":"","?"]}):o.jsxs("p",{children:["Delete ",o.jsx("strong",{children:je==null?void 0:je.name}),"?"]}),o.jsxs("p",{className:"confirm-modal-note",children:["This will permanently remove the building",be&&ce>1?"s":""," and ",be&&ce>1?"their":"its"," configuration."]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:$,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:F,autoFocus:!0,children:"Delete"})]})]})}),H&&o.jsx("div",{className:"modal-overlay navigation-confirm-overlay visible",onClick:V,onKeyDown:Ee=>{Ee.key==="Escape"&&V()},children:o.jsxs("div",{className:"modal confirm-modal navigation-confirm-modal",onClick:Ee=>Ee.stopPropagation(),children:[o.jsx("div",{className:"modal-header",children:"Leave Tide Commander?"}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[o.jsx("p",{children:"Are you sure you want to leave this page?"}),o.jsx("p",{className:"confirm-modal-note",children:"Active Claude Code sessions will continue running in the background."})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:V,autoFocus:!0,children:"Stay"}),o.jsx("button",{className:"btn btn-danger",onClick:G,children:"Leave"})]})]})}),o.jsx(b.Profiler,{id:"CommanderView",onRender:Yc,children:o.jsx(rq,{isOpen:a.isOpen,onClose:a.close})}),o.jsx(iq,{isOpen:i.isOpen,onClose:i.close}),o.jsx(oq,{isOpen:N.isOpen||_!==null||xe.explorerAreaId!==null,areaId:N.id||xe.explorerAreaId||null,folderPath:_,onChangeArea:Ee=>N.open(Ee),onClose:()=>{N.close(),U.closeFileExplorer()}}),o.jsx(lq,{isOpen:c.isOpen,onClose:c.close,onOpenSpawnModal:()=>t.open(),onOpenCommanderView:()=>a.open(),onOpenToolbox:()=>s.open(),onOpenSupervisor:()=>i.open(),onOpenFileExplorer:Ee=>N.open(Ee),onOpenPM2LogsModal:B,onOpenBossLogsModal:Q,onOpenDatabasePanel:K,onOpenMonitoringModal:()=>m.open()}),o.jsx(cq,{isOpen:d.isOpen,onClose:d.close}),o.jsx(uq,{isOpen:f.isOpen,onClose:f.close}),o.jsx(hq,{isOpen:h.isOpen,onClose:h.close,initialTab:h.data}),o.jsx(mq,{isOpen:m.isOpen,onClose:m.close}),o.jsx(gq,{isOpen:x.isOpen,onClose:x.close}),o.jsx(bq,{isOpen:y.isOpen,onClose:y.close}),o.jsx(pq,{isOpen:k.isOpen,restorePosition:k.data??null,onClose:k.close,onRestored:q}),C.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:C.close,children:o.jsx("div",{className:"modal snapshot-manager-modal",onClick:Ee=>Ee.stopPropagation(),children:o.jsx(fq,{snapshots:de,isLoading:Z,onViewSnapshot:async Ee=>{await U.loadSnapshot(Ee),xe.selectedAgentIds.clear(),U.setTerminalOpen(!0),C.close()},onDeleteSnapshot:async Ee=>{await U.deleteSnapshot(Ee),await U.fetchSnapshots()},onRestoreSnapshot:async Ee=>{await U.restoreFiles(Ee)},onExportSnapshot:async Ee=>{await U.loadSnapshot(Ee),C.close()},onClose:C.close})})}),o.jsx(go,{isOpen:j.isOpen,position:j.screenPosition,worldPosition:j.worldPosition,actions:P,onClose:j.close})]})}function yq({pip:t,title:e="Tide Commander",children:n}){return b.useEffect(()=>{t.pipWindow&&e&&(t.pipWindow.document.title=e)},[t.pipWindow,e]),!t.isOpen||!t.pipContainer?null:Rl.createPortal(n,t.pipContainer)}function ay(t){switch(t){case"working":return"⚡";case"waiting":return"⏳";case"waiting_permission":return"🔐";case"error":return"❌";case"offline":return"💤";case"orphaned":return"👻";case"idle":default:return"●"}}function ry(t){switch(t){case"working":return"#4aff9e";case"waiting":return"#ff9e4a";case"waiting_permission":return"#ff4a9e";case"error":return"#ff4a4a";case"offline":return"#666";case"orphaned":return"#9e4aff";case"idle":default:return"#888"}}function iy(t){const e=po[t.class];return(e==null?void 0:e.icon)||"🤖"}function tb({agent:t,onClick:e}){const n=ry(t.status),s=ay(t.status),a=iy(t);return o.jsxs("div",{className:`pip-agent-card pip-status-${t.status}`,onClick:()=>e(t.id),title:"Click to view conversation",children:[o.jsxs("div",{className:"pip-agent-header",children:[o.jsx("span",{className:"pip-agent-icon",children:a}),o.jsx("span",{className:"pip-agent-name",children:t.name}),o.jsx("span",{className:"pip-agent-status",style:{color:n},children:s})]}),t.taskLabel&&o.jsxs("div",{className:"pip-agent-task",children:["📋 ",t.taskLabel]}),!t.taskLabel&&t.status==="working"&&t.currentTask&&o.jsx("div",{className:"pip-agent-task",children:t.currentTask.length>60?t.currentTask.slice(0,60)+"...":t.currentTask}),t.currentTool&&o.jsxs("div",{className:"pip-agent-tool",children:[o.jsx("span",{className:"pip-tool-label",children:"Tool:"})," ",t.currentTool]}),o.jsxs("div",{className:"pip-agent-context",children:[o.jsx("div",{className:"pip-context-bar",children:o.jsx("div",{className:"pip-context-fill",style:{width:`${Math.min(Math.round(t.contextUsed/t.contextLimit*100),100)}%`,backgroundColor:t.contextUsed/t.contextLimit*100>80?"#ff4a4a":t.contextUsed/t.contextLimit*100>50?"#ff9e4a":"#4aff9e"}})}),o.jsxs("span",{className:"pip-context-percent",children:[Math.round(t.contextUsed/t.contextLimit*100),"%"]})]})]})}function Gc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}const OA={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},LA={systemPrompt:"System Prompt",systemTools:"System Tools",messages:"Messages",freeSpace:"Free Space",autocompactBuffer:"Autocompact Buffer"};function vq({agent:t,onBack:e}){const n=iy(t),s=ry(t.status),a=t.contextStats,r=Math.round(t.contextUsed/t.contextLimit*100),i=t.contextUsed/t.contextLimit*100>80?"#ff4a4a":t.contextUsed/t.contextLimit*100>50?"#ff9e4a":"#4aff9e",c=["systemPrompt","systemTools","messages","autocompactBuffer","freeSpace"];return o.jsxs("div",{className:"pip-container pip-stats-container",children:[o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to conversation",children:"←"}),o.jsx("span",{className:"pip-agent-icon",children:n}),o.jsx("span",{className:"pip-title",children:t.name}),o.jsx("span",{className:"pip-agent-status-small",style:{color:s},children:ay(t.status)})]}),o.jsx("div",{className:"pip-stats-content",children:a?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"pip-model-info",children:[o.jsxs("div",{className:"pip-model-info-item",children:[o.jsx("div",{className:"pip-model-info-label",children:"Model"}),o.jsx("div",{className:"pip-model-info-value",children:a.model})]}),o.jsxs("div",{className:"pip-model-info-item",children:[o.jsx("div",{className:"pip-model-info-label",children:"Window"}),o.jsx("div",{className:"pip-model-info-value",children:Gc(a.contextWindow)})]})]}),o.jsxs("div",{className:"pip-stats-section",children:[o.jsxs("div",{className:"pip-usage-header",children:[o.jsx("span",{className:"pip-usage-label",children:"Context Usage"}),o.jsxs("span",{className:"pip-usage-value",style:{color:i},children:[Gc(a.totalTokens)," / ",Gc(a.contextWindow)," (",a.usedPercent,"%)"]})]}),o.jsx("div",{className:"pip-stacked-bar",children:c.map(d=>{const f=a.categories[d];return!f||f.percent<=0?null:o.jsx("div",{className:"pip-stacked-bar-segment",style:{width:`${f.percent}%`,backgroundColor:OA[d]},title:`${LA[d]}: ${Gc(f.tokens)}`},d)})})]}),o.jsxs("div",{className:"pip-stats-section",children:[o.jsx("h3",{className:"pip-stats-title",children:"Token Breakdown"}),o.jsx("div",{className:"pip-category-list",children:c.map(d=>{const f=a.categories[d];if(!f)return null;const h=d==="freeSpace";return o.jsxs("div",{className:`pip-category-item ${h?"free-space":""}`,children:[o.jsx("div",{className:"pip-category-color",style:{backgroundColor:OA[d]}}),o.jsxs("div",{className:"pip-category-info",children:[o.jsx("div",{className:"pip-category-name",children:LA[d]}),o.jsxs("div",{className:"pip-category-tokens",children:[Gc(f.tokens)," (",f.percent.toFixed(1),"%)"]})]})]},d)})})]}),o.jsxs("div",{className:"pip-stats-updated",children:["Updated: ",new Date(a.lastUpdated).toLocaleTimeString()]})]}):o.jsxs("div",{className:"pip-stats-section",children:[o.jsx("h3",{className:"pip-stats-title",children:"Context Usage"}),o.jsxs("div",{className:"pip-stats-bar-container",children:[o.jsx("div",{className:"pip-stats-bar",children:o.jsx("div",{className:"pip-stats-bar-fill",style:{width:`${Math.min(r,100)}%`,backgroundColor:i}})}),o.jsxs("span",{className:"pip-stats-percent",style:{color:i},children:[r,"%"]})]}),o.jsx("div",{className:"pip-stats-info",children:o.jsx("p",{className:"pip-stats-info-text",children:"Context usage represents how much of the conversation window is filled. Detailed breakdown not available yet."})})]})})]})}function wq({agentId:t,onBack:e}){const n=ux(t),s=Mj(t),a=zj(),r=$j(),i=fx(),c=b.useRef(null),d=b.useRef(null),[f,h]=b.useState(""),[m,x]=b.useState(!1),[y]=b.useState("simple"),v=!!(n!=null&&n.sessionId),S=jj({selectedAgentId:t,hasSessionId:v,reconnectCount:a,historyRefreshTrigger:r,lastPrompts:i,outputScrollRef:c}),C=fT({outputs:s,viewMode:y}),k=b.useMemo(()=>{const{history:z}=S,W=new Map;for(const F of z)F.type==="tool_result"&&F.toolUseId&&W.set(F.toolUseId,F.content);return(F=>F.map(H=>{if(H.type==="tool_use"&&H.toolName==="Bash"&&H.toolUseId){const V=W.get(H.toolUseId);let G;try{G=(H.toolInput||(H.content?JSON.parse(H.content):{})).command}catch{}return{...H,_bashOutput:V,_bashCommand:G}}return H}))(z.filter(F=>F.type==="user"||F.type==="assistant"||F.type==="tool_use"))},[S.history]),[N,j]=b.useState({top:!1,bottom:!0}),E=b.useCallback(()=>{if(!c.current)return;const{scrollTop:z,scrollHeight:W,clientHeight:$}=c.current;j({top:z>20,bottom:z<W-$-20})},[]);b.useEffect(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight,E())},[s.length,k.length,E]);const D=b.useCallback(()=>{c.current&&c.current.scrollBy({top:-200,behavior:"smooth"})},[]),_=b.useCallback(()=>{c.current&&c.current.scrollBy({top:200,behavior:"smooth"})},[]),P=b.useCallback(()=>{const z=f.trim();!z||!n||(U.sendCommand(t,z),h(""),setTimeout(()=>{var W;return(W=d.current)==null?void 0:W.focus()},50))},[f,t,n]),O=b.useCallback(z=>{h(z.target.value)},[]),T=b.useCallback(z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),P())},[P]);b.useEffect(()=>{const z=setTimeout(()=>{var W;return(W=d.current)==null?void 0:W.focus()},100);return()=>clearTimeout(z)},[t]);const M=b.useCallback((z,W)=>{const $=Tp(z,n==null?void 0:n.cwd),F=$.line?{...W||{},targetLine:$.line}:W;U.setFileViewerPath($.path,F,n==null?void 0:n.cwd)},[n==null?void 0:n.cwd]);if(!n)return o.jsx("div",{className:"pip-container",children:o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to agents list",children:"←"}),o.jsx("span",{className:"pip-title",children:"Agent not found"})]})});const R=iy(n),I=ry(n.status);return m?o.jsx(vq,{agent:n,onBack:()=>x(!1)}):o.jsxs("div",{className:"pip-container pip-conversation-container",children:[o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to agents list",children:"←"}),o.jsx("span",{className:"pip-agent-icon",children:R}),o.jsx("span",{className:"pip-title",children:n.name}),o.jsx("span",{className:"pip-agent-status-small",style:{color:I},children:ay(n.status)})]}),o.jsx("div",{className:"pip-context-section",children:o.jsx(eN,{contextInfo:kp(n),onClick:()=>x(!0)})}),o.jsxs("div",{className:"pip-conversation-wrapper",children:[o.jsxs("div",{className:"pip-conversation guake-output",ref:c,onScroll:E,children:[!S.loadingHistory&&S.hasMore&&o.jsx("div",{className:"guake-load-more pip-load-more",children:S.loadingMore?o.jsx("span",{children:"Loading older messages..."}):o.jsxs("button",{onClick:S.loadMoreHistory,children:["Load more (",S.totalCount-S.history.length," older)"]})}),S.loadingHistory&&o.jsx("div",{className:"pip-loading-indicator",children:o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]})}),k.map((z,W)=>o.jsx(DT,{message:z,agentId:t,simpleView:!0,onFileClick:M},`h-${W}`)),C.map((z,W)=>o.jsx(sy,{output:z,agentId:t,onFileClick:M},`o-${W}`)),!S.loadingHistory&&k.length===0&&C.length===0&&n.status!=="working"&&o.jsx("div",{className:"pip-empty",children:o.jsx("p",{children:"No conversation yet"})})]}),o.jsxs("div",{className:"pip-scroll-controls",children:[N.top&&o.jsx("button",{className:"pip-scroll-btn pip-scroll-up",onClick:D,title:"Scroll up",children:"↑"}),N.bottom&&o.jsx("button",{className:"pip-scroll-btn pip-scroll-down",onClick:_,title:"Scroll down",children:"↓"})]})]}),n.currentTool&&o.jsx("div",{className:"pip-current-tool",children:o.jsxs("span",{className:"pip-tool-indicator",children:["Using: ",n.currentTool]})}),o.jsxs("div",{className:"pip-input-area",children:[o.jsx("input",{ref:d,type:"text",className:"pip-input",placeholder:`Message ${n.name}...`,value:f,onChange:O,onKeyDown:T,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),o.jsx("button",{className:"pip-send-btn",onClick:P,disabled:!f.trim(),title:"Send message",children:"➤"})]})]})}function kq({onSelectAgent:t}){const e=vp(),n=e.filter(c=>c.status==="working"),s=e.filter(c=>c.status==="waiting"||c.status==="waiting_permission"),a=e.filter(c=>c.status!=="working"&&c.status!=="waiting"&&c.status!=="waiting_permission"),r=e.length,i=n.length+s.length;return o.jsxs("div",{className:"pip-container",children:[o.jsxs("div",{className:"pip-header",children:[o.jsx("span",{className:"pip-title",children:"Tide Commander"}),o.jsxs("span",{className:"pip-stats",children:[i,"/",r," active"]})]}),o.jsxs("div",{className:"pip-agents-list",children:[n.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Working (",n.length,")"]}),n.map(c=>o.jsx(tb,{agent:c,onClick:t},c.id))]}),s.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Waiting (",s.length,")"]}),s.map(c=>o.jsx(tb,{agent:c,onClick:t},c.id))]}),a.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Idle (",a.length,")"]}),a.map(c=>o.jsx(tb,{agent:c,onClick:t},c.id))]}),e.length===0&&o.jsx("div",{className:"pip-empty",children:o.jsx("p",{children:"No agents spawned yet"})})]})]})}function Sq(){const[t,e]=b.useState(null),n=a=>{e(a)},s=()=>{e(null)};return t?o.jsx(wq,{agentId:t,onBack:s}):o.jsx(kq,{onSelectAgent:n})}function Cq(t){const e=t.trim();if(!e)return{ok:!0,normalizedUrl:""};let n;try{n=new URL(e)}catch{return{ok:!1,normalizedUrl:"",error:"Invalid URL format. Use http://host:port"}}return n.protocol!=="http:"&&n.protocol!=="https:"?{ok:!1,normalizedUrl:"",error:"Unsupported protocol. Use http or https"}:{ok:!0,normalizedUrl:e}}async function Aq(t,e=5e3,n=fetch){if(!t)return{ok:!0};const a=`${t.replace(/\/$/,"")}/api/health`,r=new AbortController,i=setTimeout(()=>r.abort(),e);try{const c=await n(a,{method:"GET",cache:"no-store",signal:r.signal});return c.ok?{ok:!0}:{ok:!1,error:`Host reachable but unhealthy (${c.status})`}}catch(c){return c instanceof Error&&c.name==="AbortError"?{ok:!1,error:"Connection timed out while checking host"}:{ok:!1,error:"Host unreachable. Check URL, host, and port"}}finally{clearTimeout(i)}}const jq=4e3;function Nq(){const t=Rj(),[e,n]=b.useState(!1),[s,a]=b.useState(!1),[r,i]=b.useState(!0),[c,d]=b.useState(!1),[f,h]=b.useState(()=>tx()),[m,x]=b.useState(!1),[y,v]=b.useState(null),[S,C]=b.useState(null),k=b.useRef(!0),N=b.useRef(!1),j=b.useCallback((O=7e3)=>U.getState().isConnected?Promise.resolve(!0):new Promise(T=>{let M=!1;const R=W=>{M||(M=!0,clearTimeout(z),I(),T(W))},I=U.subscribe(()=>{U.getState().isConnected&&R(!0)}),z=setTimeout(()=>R(!1),O)}),[]);b.useEffect(()=>{const O=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(O)},[]),b.useEffect(()=>{if(t){N.current=!0,d(!1);return}if(N.current){i(!0),d(!0);const O=setTimeout(()=>{i(!1),d(!1)},1e4);return()=>clearTimeout(O)}},[t]),b.useEffect(()=>()=>{k.current=!1},[]),b.useEffect(()=>QD(O=>{h(O)}),[]);const E=b.useCallback(()=>{navigator.clipboard.writeText("bunx tide-commander").then(()=>{a(!0),setTimeout(()=>a(!1),2e3)}).catch(()=>{})},[]),D=b.useCallback(async()=>{if(m)return;const O=Date.now(),T=()=>jq-(Date.now()-O);v(null),C("Validating URL");const M=f.trim()||"http://localhost:6200",R=Cq(M);if(!R.ok){C(null),v(R.error||"Invalid backend URL");return}x(!0),C("Checking host reachability");const I=T();if(I<=0){x(!1),C(null),v("Connection timeout after 4 seconds");return}const z=await Aq(R.normalizedUrl,I);if(!z.ok){if(!k.current)return;x(!1),C(null),T()<=0?v("Connection timeout after 4 seconds"):v(z.error||"Failed to reach host");return}KD(R.normalizedUrl),C("Connecting to server"),WR();const W=T();if(W<=0){x(!1),C(null),v("Connection timeout after 4 seconds");return}const $=await j(W);if(k.current){if(!$){x(!1),C(null),T()<=0?v("Connection timeout after 4 seconds"):v("Could not establish WebSocket connection. Verify host and auth token, then retry");return}x(!1),C("Connected"),v(null)}},[f,m,j]),_=b.useCallback(O=>{O.key==="Enter"&&!m&&D()},[D,m]),P=b.useCallback(()=>{n(!0)},[]);return t||e?null:r&&c?o.jsxs("div",{className:"reconnecting-toast",children:[o.jsx("span",{className:"reconnecting-spinner"}),"Reconnecting..."]}):r?null:o.jsx("div",{className:"not-connected-overlay",children:o.jsxs("div",{className:"not-connected-panel",children:[o.jsx("h2",{className:"not-connected-title",children:"Tide Commander"}),o.jsx("p",{className:"not-connected-description",children:"A visual multi-agent orchestrator for Claude Code and Codex. Deploy, control, and monitor your AI team from an RTS-inspired interface."}),o.jsx("p",{className:"not-connected-privacy",children:"Tide Commander syncs with Claude Code instances running on your local machine. No files or code are sent to this server."}),o.jsxs("div",{className:"not-connected-setup",children:[o.jsx("p",{className:"not-connected-setup-label",children:"Get started:"}),o.jsxs("div",{className:"not-connected-code",onClick:E,title:"Click to copy",children:[o.jsx("span",{children:"bunx tide-commander"}),o.jsx("span",{className:"not-connected-copy-icon",children:s?"✓":"⧉"})]})]}),o.jsxs("div",{className:"not-connected-url-section",children:[o.jsx("label",{className:"not-connected-url-label",htmlFor:"backend-url",children:"Backend URL"}),o.jsx("div",{className:"not-connected-url-row",children:o.jsx("input",{id:"backend-url",type:"text",className:"not-connected-url-input",placeholder:"http://localhost:6200",value:f,disabled:m,onChange:O=>{const T=O.target.value;h(T),y&&v(null)},onKeyDown:_})}),o.jsx("span",{className:"config-hint",children:"Leave empty for auto-detect"}),S&&!y&&o.jsx("div",{className:"not-connected-status","aria-live":"polite",children:S}),y&&o.jsx("div",{className:"not-connected-error","aria-live":"assertive",children:y})]}),o.jsxs("div",{className:"not-connected-actions",children:[o.jsx("button",{className:"not-connected-btn not-connected-btn-retry",onClick:()=>{D()},disabled:m,children:m?"Connecting...":"↻ Connect"}),o.jsx("button",{className:"not-connected-btn not-connected-btn-explore",onClick:P,children:"Explore"})]})]})})}const PA="tide-onboarding-dismissed";function Tq({onCreateAgent:t}){const{t:e}=pt("common"),n=Rj(),s=_j(),[a,r]=b.useState(()=>sessionStorage.getItem(PA)==="1"),i=n&&!a&&s===0,c=b.useCallback(()=>{r(!0),sessionStorage.setItem(PA,"1")},[]),d=b.useCallback(()=>{c(),t()},[c,t]),f=b.useCallback(h=>{h.key==="Escape"&&c()},[c]);return i?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onClick:c,onKeyDown:f,children:o.jsxs("div",{className:"modal onboarding-modal",onClick:h=>h.stopPropagation(),children:[o.jsxs("div",{className:"onboarding-header",children:[o.jsx("h2",{children:e("onboarding.title")}),o.jsx("p",{className:"onboarding-subtitle",children:e("onboarding.subtitle")})]}),o.jsxs("div",{className:"onboarding-steps",children:[o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"1"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step1Title")}),o.jsx("p",{children:e("onboarding.step1Desc")})]})]}),o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"2"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step2Title")}),o.jsx("p",{children:e("onboarding.step2Desc")})]})]}),o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"3"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step3Title")}),o.jsx("p",{children:e("onboarding.step3Desc")})]})]})]}),o.jsxs("div",{className:"onboarding-actions",children:[o.jsx("button",{className:"btn onboarding-cta",onClick:d,autoFocus:!0,children:e("onboarding.createFirst")}),o.jsx("button",{className:"btn btn-secondary",onClick:c,children:e("onboarding.explore")})]})]})})}):null}function OT(){return{"Content-Type":"application/json","X-Auth-Token":Ni()}}async function Eq(t){const e=await fetch(`${Sa()}/api/areas/${t}/organize`,{method:"POST",headers:OT()});if(!e.ok)throw new Error(`Failed to organize area: ${e.statusText}`);const n=await e.json();return{organized:Array.isArray(n.organized)?n.organized:[],buildings:Array.isArray(n.buildings)?n.buildings:[]}}async function _q(){const t=await fetch(`${Sa()}/api/areas/organize-all`,{method:"POST",headers:OT()});if(!t.ok)throw new Error(`Failed to organize all areas: ${t.statusText}`);const e=await t.json();return Array.isArray(e.organized)?{organized:e.organized,buildings:Array.isArray(e.buildings)?e.buildings:[]}:(Array.isArray(e.results)?e.results:[]).reduce((n,s)=>(n.organized.push(...s.organized),n.buildings.push(...s.buildings),n),{organized:[],buildings:[]})}function LT(t,e){var s,a;const n=U.getState();for(const r of t.organized){const i=n.agents.get(r.agentId);if(i){const c={...i,position:r.position};U.updateAgent(c),(s=e.current)==null||s.updateAgent(c,!0)}}for(const r of t.buildings){const i=n.buildings.get(r.buildingId);i&&(U.updateBuilding(r.buildingId,{position:r.position}),(a=e.current)==null||a.updateBuilding({...i,position:r.position}))}}function Mq(t,e,n,s,a,r){const i=[];if(e.type==="agent"&&e.id){const d=n.get(e.id);if(d)return i.push({id:"select-agent",label:`Select ${d.name}`,icon:"👆",onClick:()=>{var f;U.selectAgent(e.id),(f=r.sceneRef.current)==null||f.refreshSelectionVisuals()}}),i.push({id:"focus-agent",label:"Focus Camera",icon:"🎯",onClick:()=>{var f;(f=r.sceneRef.current)==null||f.focusAgent(e.id)}}),i.push({id:"open-terminal",label:"Open Terminal",icon:"💬",onClick:()=>{U.selectAgent(e.id),U.setTerminalOpen(!0)}}),i.push({id:"edit-agent",label:"Edit Agent",icon:"✏️",onClick:()=>{r.openAgentEditModal(e.id)}}),i.push({id:"divider-agent",label:"",divider:!0,onClick:()=>{}}),i.push({id:"delete-agent",label:`Remove ${d.name}`,icon:"❌",danger:!0,onClick:()=>{var f;U.removeAgentFromServer(e.id),(f=r.sceneRef.current)==null||f.removeAgent(e.id),r.showToast("info","Agent Removed",`${d.name} removed from view`)}}),i}if(e.type==="area"&&e.id){const d=s.get(e.id);if(d)return i.push({id:"select-area",label:`Select "${d.name}"`,icon:"📐",onClick:()=>{U.selectArea(e.id),r.openToolboxModal()}}),d.directories&&d.directories.length>0&&i.push({id:"open-explorer",label:"Open File Explorer",icon:"📁",onClick:()=>{r.openExplorerModal(e.id)}}),i.push({id:"spawn-in-area",label:"Spawn Agent",icon:"🤖",onClick:()=>{window.dispatchEvent(new CustomEvent("tide:open-spawn-modal",{detail:{areaId:e.id,position:{x:d.center.x,z:d.center.z}}}))}}),i.push({id:"divider-area-layer",label:"",divider:!0,onClick:()=>{}}),i.push({id:"bring-to-front",label:"Bring to Front",icon:"⬆️",onClick:()=>{var f;U.bringAreaToFront(e.id),(f=r.sceneRef.current)==null||f.syncAreas()}}),i.push({id:"send-to-back",label:"Send to Back",icon:"⬇️",onClick:()=>{var f;U.sendAreaToBack(e.id),(f=r.sceneRef.current)==null||f.syncAreas()}}),d.assignedAgentIds.length>0&&i.push({id:"organize-area",label:"Organize Area",icon:"✨",onClick:()=>{Eq(e.id).then(f=>{LT(f,r.sceneRef),r.showToast("success","Area Organized",`Arranged ${f.organized.length} agent${f.organized.length!==1?"s":""} in "${d.name}"`)}).catch(f=>{console.error("organize area error:",f),r.showToast("error","Organize Failed",f.message||"Failed to organize area")})}}),i.push({id:"divider-area",label:"",divider:!0,onClick:()=>{}}),i.push({id:"archive-area",label:`Archive "${d.name}"`,icon:"📦",onClick:()=>{var m,x;const f=d.assignedAgentIds.length;U.archiveArea(e.id,y=>U.stopAgent(y)),(m=r.sceneRef.current)==null||m.syncAreas(),(x=r.sceneRef.current)==null||x.syncAgents(Array.from(U.getState().agents.values()));const h=f>0?` (${f} agent${f>1?"s":""} stopped)`:"";r.showToast("info","Zone Archived",`"${d.name}" has been archived${h}`)}}),i.push({id:"delete-area",label:`Delete "${d.name}"`,icon:"🗑️",danger:!0,onClick:()=>{var f;U.deleteArea(e.id),(f=r.sceneRef.current)==null||f.syncAreas(),r.showToast("info","Area Deleted",`"${d.name}" has been deleted`)}}),i}if(e.type==="building"&&e.id){const d=a.get(e.id);if(d)return i.push({id:"select-building",label:`Select "${d.name}"`,icon:"🏢",onClick:()=>{U.selectBuilding(e.id),r.openToolboxModal()}}),i.push({id:"edit-building",label:"Edit Building",icon:"✏️",onClick:()=>{r.openBuildingModal(e.id)}}),i.push({id:"clone-building",label:"Clone Building",icon:"📋",onClick:()=>{const f={name:`${d.name} (Copy)`,type:d.type,style:d.style,color:d.color,scale:d.scale,position:{x:d.position.x+2,z:d.position.z+2},cwd:d.cwd,folderPath:d.folderPath,commands:d.commands,pm2:d.pm2,docker:d.docker,database:d.database,urls:d.urls,subordinateBuildingIds:d.subordinateBuildingIds};U.createBuilding(f),r.showToast("success","Building Cloned",`Created "${f.name}"`)}}),d.type==="folder"&&d.folderPath&&i.push({id:"open-folder",label:"Open Folder",icon:"📁",onClick:()=>{U.openFileExplorer(d.folderPath)}}),i.push({id:"divider-building",label:"",divider:!0,onClick:()=>{}}),i.push({id:"delete-building",label:`Delete "${d.name}"`,icon:"🗑️",danger:!0,onClick:()=>{r.requestBuildingDelete(e.id)}}),i}i.push({id:"spawn-agent",label:"Spawn Agent Here",icon:"🤖",shortcut:"N",onClick:()=>{r.setSpawnPosition(t),r.openSpawnModal()}}),i.push({id:"spawn-boss",label:"Spawn Boss Here",icon:"👑",onClick:()=>{r.setSpawnPosition(t),r.openBossSpawnModal()}}),i.push({id:"divider-1",label:"",divider:!0,onClick:()=>{}}),i.push({id:"draw-area",label:"Draw Area",icon:"📐",onClick:()=>{var d;(d=r.sceneRef.current)==null||d.setDrawingTool("rectangle"),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool("rectangle"),r.showToast("info","Rectangle Tool","Click and drag on the battlefield to draw an area")}}),i.push({id:"new-building",label:"Place Building",icon:"🏢",onClick:()=>{r.openBuildingModal(null)}});const c=Array.from(s.values()).filter(d=>d.archived).length;return c>0&&i.push({id:"restore-archived",label:`Restore Archived Zone (${c})`,icon:"📦",onClick:()=>{r.openRestoreArchivedModal(t)}}),i.push({id:"divider-2",label:"",divider:!0,onClick:()=>{}}),i.push({id:"open-settings",label:"Settings",icon:"⚙️",onClick:()=>{r.openToolboxModal()}}),i.push({id:"open-commander",label:"Commander View",icon:"📊",shortcut:"⌘K",onClick:()=>{r.openCommanderModal()}}),i}const Dq=Ce.lazy(()=>vt(()=>import("./index-C9B8kaWK.js"),__vite__mapDeps([35,3,1,4,36])).then(t=>({default:t.DatabasePanel}))),Rq=Ce.lazy(()=>vt(()=>import("./PM2LogsModal-Cz4GZtyl.js"),__vite__mapDeps([37,38,3,1,4])).then(t=>({default:t.PM2LogsModal}))),Oq=Ce.lazy(()=>vt(()=>import("./DockerLogsModal-D6U9obTe.js"),__vite__mapDeps([39,38,3,1,4])).then(t=>({default:t.DockerLogsModal}))),Lq=Ce.lazy(()=>vt(()=>import("./BossLogsModal-N4CnX-0x.js"),__vite__mapDeps([40,38,3,1,4])).then(t=>({default:t.BossLogsModal}))),Pq=Ce.lazy(()=>vt(()=>import("./Scene2DCanvas-MRhWT6EA.js"),__vite__mapDeps([41,3,1,4,42])).then(t=>({default:t.Scene2DCanvas}))),Iq=Ce.lazy(()=>vt(()=>import("./index-B8SWRPUd.js"),__vite__mapDeps([43,3,1,4,44])).then(t=>({default:t.DashboardView}))),Bq=Ce.lazy(()=>vt(()=>import("./IframeModal-DQqev6_V.js"),__vite__mapDeps([45,3,1,4,46])).then(t=>({default:t.IframeModal}))),Fq=Ce.lazy(()=>vt(()=>import("./SaveSnapshotModal-DqZ1JedM.js"),__vite__mapDeps([47,3,1,4])).then(t=>({default:t.SaveSnapshotModal})));function zq(){const{t}=pt(["common","notifications"]),e=b.useRef(null),n=b.useRef(null),s=ns(),a=ns(),r=ns(),i=ns(),c=ns(),d=ns(),f=ns(),h=ns(),m=ns(),x=ns(),y=ns(),v=ns(),S=ns(),C=ns(),k=ns(),N=ns(),j=ns(),E=ns(),D=ns(),_=XD(),P=pL(),O=JD(),T=cR(),[M,R]=b.useState(null),I=ZR(),[z,W]=b.useState(!1),[$,F]=b.useState(null),[H,V]=b.useState(null),[G,B]=b.useState(null),[Q,K]=b.useState(null),[q,xe]=b.useState(null),[de,Z]=b.useState(null),[be,je]=b.useState(null),[ce,Ee]=b.useState(null),[ze,Ge]=b.useState(null),[_e,me]=b.useState(null),De=b.useCallback(Ae=>{me(Ae),Ae&&localStorage.setItem("tide-commander-last-database-building",Ae)},[]),te=b.useCallback(()=>De(null),[De]),{handleMouseDown:He,handleClick:ye}=wa(te),Re=b.useCallback(()=>Ge(null),[]),{handleMouseDown:re,handleClick:pe}=wa(Re),Ve=b.useRef(de);Ve.current=de;const at=b.useCallback(Ae=>{Z(Ae)},[]),ut=b.useCallback(()=>Ve.current,[]),ue=b.useRef(null),[X,se]=b.useState(Cj),[ke,J]=b.useState(0),[we,We]=b.useState(!1),[Be,ie]=b.useState(()=>localStorage.getItem("tide-commander-sidebar-collapsed")==="true"),[Ie,oe]=b.useState(!1),[he,ne]=b.useState(!1),Le=Pj(),Qe=Hj(),$e=hx(),nt=mx(),ot=Lj(),{showToast:st}=qj(),{showAgentNotification:lt}=UL(),{showBackNavModal:it,setShowBackNavModal:ht,handleLeave:jt}=kO();cO({showToast:st,showAgentNotification:lt});const[ge,Te]=b.useState(!1);b.useEffect(()=>{const Ae=Je=>{var en;((en=Je.detail)==null?void 0:en.mode)==="3d"&&Te(!0)};return window.addEventListener("tide:viewmode-switch-pressed",Ae),()=>{window.removeEventListener("tide:viewmode-switch-pressed",Ae)}},[]),b.useEffect(()=>{Qe==="3d"&&Te(!0)},[Qe]);const Ye=lO({canvasRef:e,selectionBoxRef:n,viewMode:Qe,sceneMountKey:ke,showToast:st,showAgentNotification:lt,toolboxModal:i,contextMenu:O,setHoveredAgentPopup:xe,setBuildingPopup:at,getBuildingPopup:ut,openBuildingModal:Ae=>k.open(Ae),openPM2LogsModal:Ae=>je(Ae),openBossLogsModal:Ae=>Ee(Ae),openDatabasePanel:Ae=>De(Ae),onSceneLoadingChange:Te}),tt=_j(),Nt=rr(),zt=px(),Pt=dx(),It=iL(),Vt=rL(),mt=aL(),ct=Br(),xt=lL(),Dt=CL(),Sn=AL(),cn=b.useMemo(()=>Array.from(Pt),[Pt]),ls=b.useRef(!1);hj("AppContent"),uO(Ye),dO(Ye),fO(Ye),AO(),pO(Ye,Vt),hO(Ye,ct.powerSaving),b.useEffect(()=>{var Ae;document.title=((Ae=ct.tabTitle)==null?void 0:Ae.trim())||"Tide Commander"},[ct.tabTitle]),b.useEffect(()=>{var Pn,Us;if(ls.current||typeof window>"u")return;const Ae=new URLSearchParams(window.location.search),Je=(Pn=Ae.get("agentId"))==null?void 0:Pn.trim(),Ct=(Us=Ae.get("agentName"))==null?void 0:Us.trim();if(!Je&&!Ct||tt===0)return;const en=U.getState().agents,Ln=Ae.get("openTerminal"),$t=Ln?["1","true","yes"].includes(Ln.toLowerCase()):!0;let At=Je?en.get(Je):void 0;if(!At&&Ct){const Aa=Ct.toLowerCase();At=Array.from(en.values()).find(ia=>ia.name.toLowerCase()===Aa)}if(!At){console.warn("[DeepLink] No matching agent found for query params",{rawAgentId:Je,rawAgentName:Ct}),ls.current=!0;return}U.selectAgent(At.id),$t&&U.setTerminalOpen(!0),Ae.delete("agentId"),Ae.delete("agentName"),Ae.delete("openTerminal");const Nn=Ae.toString(),Ss=`${window.location.pathname}${Nn?`?${Nn}`:""}${window.location.hash}`;window.history.replaceState({},document.title,Ss),ls.current=!0},[tt]),wO({sceneRef:Ye,spawnModal:s,commanderModal:c,explorerModal:_,spotlightModal:h,deleteConfirmModal:d,onRequestBuildingDelete:()=>K("selected"),onOpenDatabasePanel:De,onCloseDatabasePanel:te,databasePanelOpen:_e!==null}),Qt("spawn-modal",s.isOpen,s.close),Qt("boss-spawn-modal",a.isOpen,a.close),Qt("subordinate-modal",r.isOpen,r.close),Qt("toolbox-modal",i.isOpen,i.close),Qt("commander-modal",c.isOpen,c.close),Qt("delete-confirm-modal",d.isOpen,d.close),Qt("supervisor-modal",f.isOpen,f.close),Qt("spotlight-modal",h.isOpen,h.close),Qt("controls-modal",m.isOpen,m.close),Qt("skills-modal",x.isOpen,x.close),Qt("integrations-modal",y.isOpen,y.close),Qt("monitoring-modal",v.isOpen,v.close),Qt("workflow-editor-modal",S.isOpen,S.close),Qt("trigger-manager-modal",C.isOpen,C.close),Qt("building-modal",k.isOpen,k.close),Qt("agent-edit-modal",N.isOpen,N.close),Qt("snapshots-modal",j.isOpen,j.close),Qt("save-snapshot-modal",E.isOpen,E.close),Qt("explorer-modal",_.isOpen||P!==null,()=>{_.close(),U.closeFileExplorer()}),Qt("context-menu",O.isOpen,O.close),Qt("mobile-sidebar",we,()=>We(!1)),Qt("mobile-fab-menu",he,()=>ne(!1)),Qt("file-viewer",$e!==null,()=>U.clearFileViewerPath()),Qt("context-modal",nt!==null,()=>U.closeContextModal()),Qt("terminal",ot,()=>U.setTerminalOpen(!1)),Qt("pm2-logs-modal",be!==null,()=>je(null)),Qt("boss-logs-modal",ce!==null,()=>Ee(null)),Qt("database-panel",_e!==null,te),Qt("terminal-modal",ze!==null,Re);const Ba=b.useRef(ot),Ts=b.useRef(x),Hs=b.useRef(m);Ts.current=x,Hs.current=m,b.useEffect(()=>{Ba.current&&!ot&&(Ts.current.close(),Hs.current.close()),Ba.current=ot},[ot]),b.useEffect(()=>{},[]),b.useEffect(()=>{if(Le!=="3d"||Qe!=="3d")return;const Ae=setTimeout(()=>window.dispatchEvent(new Event("resize")),80);return()=>clearTimeout(Ae)},[Le,Qe]);const Fa=b.useCallback(Ae=>{var Je,Ct,en,Ln,$t,At,Nn,Ss,Pn,Us;se(Ae),iO(Ae),(Je=Ye.current)==null||Je.setCharacterScale(Ae.characterScale),(Ct=Ye.current)==null||Ct.setScale3D(Ae.scale3d),(en=Ye.current)==null||en.setTimeMode(Ae.timeMode),(Ln=Ye.current)==null||Ln.setTerrainConfig(Ae.terrain),($t=Ye.current)==null||$t.setFloorStyle(Ae.terrain.floorStyle),(At=Ye.current)==null||At.setGridVisible(Ae.gridVisible),(Nn=Ye.current)==null||Nn.setAgentModelStyle(Ae.modelStyle),(Ss=Ye.current)==null||Ss.setIdleAnimation(Ae.animations.idleAnimation),(Pn=Ye.current)==null||Pn.setWorkingAnimation(Ae.animations.workingAnimation),(Us=Ye.current)==null||Us.setFpsLimit(Ae.fpsLimit)},[Ye]),ks=b.useCallback(Ae=>{var Je;if((Je=Ye.current)==null||Je.setDrawingTool(Ae),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(Ae),Ae==="rectangle"||Ae==="circle"){const Ct=t(Ae==="rectangle"?"notifications:drawing.rectangleTool":"notifications:drawing.circleTool");st("info",Ct,t("notifications:drawing.clickAndDrag"),3e3)}},[Ye,st]),Zn=b.useCallback(Ae=>{var Je;(Je=Ye.current)==null||Je.focusAgent(Ae)},[Ye]),_t=b.useCallback(Ae=>{U.killAgent(Ae)},[]),rs=b.useCallback(Ae=>{var Je;(Je=Ye.current)==null||Je.callSubordinates(Ae)},[Ye]),fn=b.useCallback(Ae=>{_.open(Ae)},[_]),cr=b.useCallback(()=>{k.open(null)},[k]),Hr=b.useCallback(()=>{var Ae;(Ae=Ye.current)==null||Ae.setDrawingTool("rectangle"),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool("rectangle"),st("info",t("notifications:drawing.rectangleTool"),t("notifications:drawing.clickAndDrag"),3e3)},[Ye,st]),Es=b.useCallback(Ae=>{R(Ae)},[]),_s=b.useCallback(()=>{R(null)},[]),Ei=b.useCallback(()=>{const Ae=Array.from(U.getState().selectedAgentIds);Ae.forEach(Je=>{var Ct;U.removeAgentFromServer(Je),(Ct=Ye.current)==null||Ct.removeAgent(Je)}),d.close(),st("info",t("notifications:toast.agentsRemoved"),t("notifications:toast.agentsRemovedMsg",{count:Ae.length}))},[st,d,Ye,t]),wo=b.useCallback(()=>{var Ae,Je;if(Q==="selected"){const Ct=It.size;U.deleteSelectedBuildings(),(Ae=Ye.current)==null||Ae.syncBuildings(),st("info",t("notifications:toast.buildingsDeleted"),t("notifications:toast.buildingsDeletedMsg",{count:Ct}))}else if(Q){const Ct=zt.get(Q);U.deleteBuilding(Q),(Je=Ye.current)==null||Je.syncBuildings(),st("info",t("notifications:toast.buildingDeleted"),t("notifications:toast.buildingDeletedMsg",{name:(Ct==null?void 0:Ct.name)||"Building"}))}K(null)},[Q,zt,It.size,st,Ye,t]),Ur=b.useMemo(()=>Mq(O.worldPosition,O.target,U.getState().agents,Nt,zt,{showToast:st,openSpawnModal:()=>s.open(),openBossSpawnModal:()=>a.open(),openToolboxModal:()=>i.open(),openCommanderModal:()=>c.open(),openExplorerModal:Ae=>_.open(Ae),openBuildingModal:Ae=>k.open(Ae),openAgentEditModal:Ae=>N.open(Ae),requestBuildingDelete:Ae=>K(Ae),setSpawnPosition:F,openRestoreArchivedModal:Ae=>D.open(Ae),sceneRef:Ye}),[O.worldPosition,O.target,Nt,zt,s,a,k,i,c,_,N,D,st,Ye]);b.useEffect(()=>{!s.isOpen&&!a.isOpen&&(F(null),B(null))},[s.isOpen,a.isOpen]),b.useEffect(()=>{const Ae=$t=>{const At=$t.detail;B((At==null?void 0:At.areaId)||null),F((At==null?void 0:At.position)||null),s.open()},Je=$t=>{var Ss,Pn;const At=$t.detail;if(!(At!=null&&At.buildingId))return;const Nn=U.getState().buildings.get(At.buildingId);Nn&&(Nn.type==="server"&&((Ss=Nn.pm2)!=null&&Ss.enabled)?je(At.buildingId):Nn.type==="boss"?Ee(At.buildingId):Nn.type==="database"?De(At.buildingId):Nn.type==="folder"&&Nn.folderPath?U.openFileExplorer(Nn.folderPath):Nn.type==="terminal"&&((Pn=Nn.terminalStatus)!=null&&Pn.url)?Ge(At.buildingId):k.open(At.buildingId))},Ct=$t=>{const At=$t.detail;At!=null&&At.buildingId&&k.open(At.buildingId)},en=$t=>{const At=$t.detail;V((At==null?void 0:At.position)||null),k.open(null)},Ln=$t=>{const At=$t.detail;At!=null&&At.buildingId?Ge(At.buildingId):At!=null&&At.url&&R(At.url)};return window.addEventListener("tide:open-spawn-modal",Ae),window.addEventListener("tide:building-action",Je),window.addEventListener("tide:building-edit",Ct),window.addEventListener("tide:building-create",en),window.addEventListener("tide:open-iframe-modal",Ln),()=>{window.removeEventListener("tide:open-spawn-modal",Ae),window.removeEventListener("tide:building-action",Je),window.removeEventListener("tide:building-edit",Ct),window.removeEventListener("tide:building-create",en),window.removeEventListener("tide:open-iframe-modal",Ln)}},[s,k]);const Il=mt==="rectangle"||mt==="circle",gs=b.useCallback(()=>{var Ae;(Ae=Ye.current)==null||Ae.setDrawingTool(null),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(null)},[Ye]),Ca=b.useCallback(()=>ne(Ae=>!Ae),[]),cs=b.useCallback(()=>U.setMobileView("terminal"),[]),Vn=b.useCallback(()=>We(!0),[]),Wr=cn.length===1&&U.getOutputs(cn[0]).length>0;return o.jsxs("div",{className:`app ${ot?"terminal-open":""} ${Il?"drawing-mode":""} ${Be?"sidebar-collapsed":""} mobile-view-${Le} view-mode-${Qe}`,children:[o.jsx(Nq,{}),o.jsx(Tq,{onCreateAgent:s.open}),o.jsx(YW,{visible:ct.showFPS,position:"bottom-right"}),o.jsxs("div",{className:"app-top-bar",children:[o.jsx(XW,{className:"app-view-mode-toggle"}),o.jsx(wj,{}),o.jsxs("button",{className:"app-organize-all-btn",disabled:z,title:"Auto-organize all agents in their areas",onClick:()=>{W(!0),_q().then(Ae=>{LT(Ae,Ye),st("success","Organized",`Arranged ${Ae.organized.length} agent${Ae.organized.length!==1?"s":""}`)}).catch(Ae=>{console.error("organize all error:",Ae),st("error","Organize Failed",Ae.message||"Failed to organize")}).finally(()=>W(!1))},children:[z?"⏳":"✨"," Organize"]})]}),o.jsxs("main",{className:"main-content",children:[o.jsxs("div",{className:"battlefield-container",children:[I&&o.jsxs("div",{className:"workspace-switch-overlay",children:[o.jsx("div",{className:"workspace-switch-spinner"}),o.jsx("span",{className:"workspace-switch-text",children:"Switching workspace..."})]}),o.jsx(Ce.Suspense,{fallback:null,children:Qe==="dashboard"?o.jsx(Iq,{onSelectAgent:Ae=>U.selectAgent(Ae),onFocusAgent:Ae=>{U.setViewMode("3d"),Zn(Ae)},onKillAgent:_t,onSelectBuilding:Ae=>U.selectBuilding(Ae),onOpenTerminal:Ae=>{U.selectAgent(Ae),U.setTerminalOpen(!0)},onFocusZone:Ae=>{U.setViewMode("3d");const Je=U.getState().areas.get(Ae);Je&&Je.assignedAgentIds.length>0&&Zn(Je.assignedAgentIds[0])}}):Qe==="2d"?o.jsx(Pq,{onAgentClick:(Ae,Je)=>{Je?U.addToSelection(Ae):U.selectAgent(Ae)},onAgentDoubleClick:Ae=>{if(window.innerWidth<=768){U.openTerminalOnMobile(Ae);return}U.selectAgent(Ae),U.setTerminalOpen(!0)},onBuildingClick:(Ae,Je)=>{U.selectBuilding(Ae);const Ct=U.getState().buildings.get(Ae);(Ct==null?void 0:Ct.type)==="folder"&&Ct.folderPath?U.openFileExplorer(Ct.folderPath):((Ct==null?void 0:Ct.type)==="server"||(Ct==null?void 0:Ct.type)==="boss"||(Ct==null?void 0:Ct.type)==="database")&&(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{at({buildingId:Ae,screenPos:Je,fromClick:!0}),ue.current=null},150))},onBuildingDoubleClick:Ae=>{var Ct;ue.current&&(clearTimeout(ue.current),ue.current=null),at(null);const Je=U.getState().buildings.get(Ae);(Je==null?void 0:Je.type)==="server"&&((Ct=Je.pm2)!=null&&Ct.enabled)?je(Ae):(Je==null?void 0:Je.type)==="boss"?Ee(Ae):(Je==null?void 0:Je.type)==="database"?De(Ae):(Je==null?void 0:Je.type)==="folder"&&Je.folderPath?U.openFileExplorer(Je.folderPath):k.open(Ae)},onGroundClick:()=>{U.selectAgent(null),U.selectBuilding(null)},onAreaDoubleClick:Ae=>{U.selectArea(Ae),i.open()},onContextMenu:(Ae,Je,Ct)=>{const en=Ct?{type:Ct.type,id:Ct.id}:{type:"ground"};O.open(Ae,Je,en)},onMoveCommand:(Ae,Je)=>{const en=Ae.length,Ln=[];if(en===1)Ln.push({x:Je.x,y:0,z:Je.z});else if(en<=6){const $t=1.2*Math.max(1,en/3);for(let At=0;At<en;At++){const Nn=At/en*Math.PI*2-Math.PI/2;Ln.push({x:Je.x+Math.cos(Nn)*$t,y:0,z:Je.z+Math.sin(Nn)*$t})}}else{const $t=Math.ceil(Math.sqrt(en)),At=Math.ceil(en/$t),Nn=($t-1)*1.2/2,Ss=(At-1)*1.2/2;for(let Pn=0;Pn<en;Pn++){const Us=Pn%$t,Aa=Math.floor(Pn/$t);Ln.push({x:Je.x+Us*1.2-Nn,y:0,z:Je.z+Aa*1.2-Ss})}}Ae.forEach(($t,At)=>{U.moveAgent($t,Ln[At])})},onBuildingDragMove:(Ae,Je)=>{var en;const Ct=U.getState().buildings.get(Ae);Ct&&(U.getState().buildings.set(Ae,{...Ct,position:{x:Je.x,z:Je.z}}),(en=window.__tideScene2D)==null||en.syncBuildings())},onBuildingDragEnd:(Ae,Je)=>{U.updateBuildingPosition(Ae,Je)},scale2d:X.scale2d,showTaskLabels:X.show2DTaskLabels,showGrid:X.gridVisible,fpsLimit:X.fpsLimit}):o.jsxs(Ce.Fragment,{children:[o.jsx("canvas",{ref:e,id:"battlefield",tabIndex:0}),o.jsx("div",{ref:n,id:"selection-box"})]},ke)}),ge&&o.jsxs("div",{className:"scene-loading-overlay",children:[o.jsx("div",{className:"scene-loading-overlay__spinner"}),o.jsx("span",{className:"scene-loading-overlay__label",children:"Loading 3D scene…"})]})]}),o.jsx(JW,{isOpen:he,onToggle:Ca,onShowTerminal:cs,onOpenSidebar:Vn,onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,onTakeSnapshot:E.open,canTakeSnapshot:Wr,mobileView:Le}),we&&o.jsx("div",{className:"sidebar-overlay",onClick:()=>We(!1)}),!1,o.jsx("button",{className:`sidebar-collapse-edge-btn ${Be?"is-collapsed":""} ${Ie?"can-pin":""}`,onClick:()=>{if(window.innerWidth<=768)We(!we);else{const Je=!Be;ie(Je),localStorage.setItem("tide-commander-sidebar-collapsed",String(Je))}},title:Be?"Open sidebar":"Close sidebar",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Ie?o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"10",r:"3"}),o.jsx("line",{x1:"12",y1:"13",x2:"12",y2:"21"}),o.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]}):o.jsx("polyline",{points:Be?"15 18 9 12 15 6":"9 18 15 12 9 6"})})}),o.jsxs("aside",{className:`sidebar ${we?"sidebar-open":""} ${Be?"sidebar-collapsed":""}`,children:[o.jsx("button",{className:"sidebar-close-btn show-on-mobile",onClick:()=>We(!1),title:"Close sidebar",children:"✕"}),cn.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Yc,children:o.jsx(dS,{onFocusAgent:Zn,onKillAgent:_t,onCallSubordinates:rs,onOpenAreaExplorer:fn})})}),o.jsx("div",{className:"sidebar-section tool-history-section",children:o.jsx(b.Profiler,{id:"ToolHistory",onRender:Yc,children:o.jsx(Y4,{agentIds:cn})})})]}):o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Yc,children:o.jsx(dS,{onFocusAgent:Zn,onKillAgent:_t,onCallSubordinates:rs,onOpenAreaExplorer:fn})})})]}),o.jsx(b.Profiler,{id:"GuakeOutputPanel",onRender:Yc,children:o.jsx(NW,{onSaveSnapshot:E.open})})]}),o.jsx(ZW,{onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,isGeneratingReport:xt,pip:T}),o.jsx(BW,{activeTool:mt,onExit:gs}),q&&(()=>{const Ae=U.getState().agents.get(q.agentId);return Ae?o.jsx($W,{agent:Ae,screenPos:q.screenPos,onClose:()=>xe(null)}):null})(),de&&(()=>{const Ae=zt.get(de.buildingId);if(!Ae)return null;const Je=()=>at(null);return Ae.type==="boss"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Je}),o.jsx(VW,{building:Ae,screenPos:de.screenPos,onClose:Je,onOpenSettings:()=>{Je(),k.open(de.buildingId)},onOpenLogsModal:()=>{Je(),Ee(de.buildingId)},onOpenUrlInModal:Es})]}):Ae.type==="database"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Je}),o.jsx(GW,{building:Ae,screenPos:de.screenPos,onClose:Je,onOpenSettings:()=>{Je(),k.open(de.buildingId)},onOpenDatabasePanel:()=>{Je(),De(de.buildingId)}})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Je}),o.jsx(UW,{building:Ae,screenPos:de.screenPos,onClose:Je,onOpenSettings:()=>{Je(),k.open(de.buildingId)},onOpenLogsModal:()=>{je(de.buildingId)},onOpenUrlInModal:Es})]})})(),be&&(()=>{var Je;const Ae=zt.get(be);return Ae?(Je=Ae.docker)!=null&&Je.enabled?o.jsx(Oq,{building:Ae,isOpen:!0,onClose:()=>je(null)}):o.jsx(Rq,{building:Ae,isOpen:!0,onClose:()=>je(null)}):null})(),ce&&(()=>{const Ae=zt.get(ce);return Ae?o.jsx(Lq,{building:Ae,isOpen:!0,onClose:()=>Ee(null)}):null})(),_e&&(()=>{const Ae=zt.get(_e);return Ae?o.jsx("div",{className:"modal-overlay visible",onMouseDown:He,onClick:ye,children:o.jsx("div",{className:"database-panel-modal",children:o.jsx(Dq,{building:Ae,onClose:te})})}):null})(),ze&&(()=>{var Je;const Ae=zt.get(ze);return!Ae||!((Je=Ae.terminalStatus)!=null&&Je.url)?null:o.jsx("div",{className:"modal-overlay visible",onMouseDown:re,onClick:pe,children:o.jsxs("div",{className:"terminal-modal-container",children:[o.jsxs("div",{className:"terminal-modal-header",children:[o.jsxs("span",{className:"terminal-modal-title",children:["Terminal - ",Ae.name]}),o.jsx("button",{className:"terminal-modal-close",onClick:Re,children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(Yb,{terminalUrl:Ae.terminalStatus.url,visible:!0})]})})})(),o.jsx(yq,{pip:T,title:"Tide Commander - Agents",children:o.jsx(Sq,{})}),o.jsx(Bq,{url:M||"",title:M?`Preview - ${M}`:"",isOpen:!!M,onClose:_s}),E.isOpen&&cn.length===1&&(()=>{const Ae=cn[0],Je=U.getState().agents.get(Ae);if(!Je)return null;const Ct=U.getOutputs(Ae);return o.jsx(Fq,{isOpen:E.isOpen,onClose:E.close,agent:Je,outputCount:Ct.length,onSave:async en=>{try{const Ln=Ct.map($t=>({type:"message",content:$t.text,timestamp:new Date($t.timestamp).toISOString()}));await U.createSnapshot(en.agentId,Je.name,en.title,en.description,Ln,[]),E.close(),st("success",t("notifications:toast.snapshotSaved"),t("notifications:toast.snapshotSavedMsg"))}catch(Ln){const $t=Ln instanceof Error?Ln.message:t("notifications:toast.snapshotFailedMsg");st("error",t("notifications:toast.snapshotFailed"),$t)}},isSaving:Dt,error:Sn||void 0})})(),o.jsx(IW,{onFocusAgent:Zn,onSpawnClick:s.open,onSpawnBossClick:a.open,onNewBuildingClick:cr,onNewAreaClick:Hr}),o.jsx(xq,{spawnModal:s,bossSpawnModal:a,subordinateModal:r,toolboxModal:i,commanderModal:c,deleteConfirmModal:d,supervisorModal:f,spotlightModal:h,controlsModal:m,skillsModal:x,integrationsModal:y,monitoringModal:v,workflowEditorModal:S,triggerManagerModal:C,buildingModal:k,buildingInitialPosition:H,agentEditModal:N,snapshotsModal:j,restoreArchivedModal:D,explorerModal:_,contextMenu:O,spawnPosition:$,spawnAreaId:G,explorerFolderPath:P,contextMenuActions:Ur,sceneConfig:X,onConfigChange:Fa,onToolChange:ks,onOpenAreaExplorer:fn,onDeleteSelectedAgents:Ei,pendingBuildingDelete:Q,onCancelBuildingDelete:()=>K(null),onConfirmBuildingDelete:wo,showBackNavModal:it,onCloseBackNavModal:()=>ht(!1),onLeave:jt,onOpenPM2LogsModal:Ae=>je(Ae),onOpenBossLogsModal:Ae=>Ee(Ae),onOpenDatabasePanel:Ae=>De(Ae),onSyncScene:()=>{var Ae,Je;(Ae=Ye.current)==null||Ae.syncAreas(),(Je=Ye.current)==null||Je.syncAgents(Array.from(U.getState().agents.values()))}})]})}function $q(){return o.jsx(PL,{children:o.jsx(HL,{children:o.jsx(zq,{})})})}class Hq extends b.Component{constructor(n){super(n);et(this,"handleReload",()=>{window.location.reload()});et(this,"handleDismiss",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){console.error("[Tide] React Error:",n,s),this.setState({errorInfo:s})}render(){if(this.state.hasError){const{error:n,errorInfo:s}=this.state;return o.jsx("div",{style:{position:"fixed",inset:0,background:"#1a1a2e",color:"#fff",fontFamily:"monospace",padding:"32px",overflow:"auto",zIndex:99999},children:o.jsxs("div",{style:{maxWidth:"900px",margin:"0 auto"},children:[o.jsxs("h1",{style:{color:"#ff4a4a",fontSize:"24px",marginBottom:"16px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("span",{style:{fontSize:"32px"},children:"💥"}),En.t("errors:crash.title")]}),o.jsx("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:o.jsxs("div",{style:{color:"#ff6b6b",fontSize:"18px",marginBottom:"8px"},children:[n==null?void 0:n.name,": ",n==null?void 0:n.message]})}),o.jsxs("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[o.jsx("div",{style:{color:"#888",marginBottom:"8px",fontSize:"12px"},children:En.t("errors:crash.stackTrace")}),o.jsx("pre",{style:{color:"#ccc",fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:n==null?void 0:n.stack})]}),(s==null?void 0:s.componentStack)&&o.jsxs("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[o.jsx("div",{style:{color:"#888",marginBottom:"8px",fontSize:"12px"},children:En.t("errors:crash.componentStack")}),o.jsx("pre",{style:{color:"#ccc",fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:s.componentStack})]}),o.jsxs("div",{style:{display:"flex",gap:"12px"},children:[o.jsx("button",{onClick:this.handleReload,style:{background:"#4a9eff",color:"#fff",border:"none",borderRadius:"6px",padding:"12px 24px",fontSize:"14px",cursor:"pointer"},children:En.t("common:buttons.reloadPage")}),o.jsx("button",{onClick:this.handleDismiss,style:{background:"#444",color:"#fff",border:"none",borderRadius:"6px",padding:"12px 24px",fontSize:"14px",cursor:"pointer"},children:En.t("common:buttons.tryToContinue")})]}),o.jsx("div",{style:{marginTop:"24px",color:"#666",fontSize:"12px"},children:En.t("errors:crash.checkConsole")})]})})}return this.props.children}}k6();document.addEventListener("wheel",t=>{if(Math.abs(t.deltaX)>Math.abs(t.deltaY)&&Math.abs(t.deltaX)>0){const e=t.target;if(e.tagName==="CANVAS"){t.preventDefault();return}let n=e;for(;n&&n!==document.documentElement;){if(n.scrollWidth>n.clientWidth)return;n=n.parentElement}t.preventDefault()}},{passive:!1});const PT=document.getElementById("app");if(!PT)throw new Error("Could not find #app container");const Uq=NM.createRoot(PT);Uq.render(o.jsx(Ce.StrictMode,{children:o.jsx(b.Suspense,{fallback:o.jsx("div",{style:{background:"#0a0a0a",height:"100vh"}}),children:o.jsx(Hq,{children:o.jsx($q,{})})})}));console.log("[Tide] Tide Commander initialized");export{ef as $,WL as A,Uj as B,YD as C,BL as D,gp as E,AV as F,Xb as G,Dl as H,px as I,rr as J,dx as K,hL as L,Pa as M,aV as N,qL as O,va as P,TV as Q,GU as R,ft as S,os as T,yV as U,Lt as V,Xj as W,NV as X,z2 as Y,iu as Z,tf as _,bx as a,Bp as a$,ug as a0,er as a1,wp as a2,xV as a3,ux as a4,Hf as a5,Kq as a6,IL as a7,pb as a8,hV as a9,GD as aA,Q5 as aB,j6 as aC,N6 as aD,M6 as aE,oV as aF,Mj as aG,cV as aH,uV as aI,Zb as aJ,ex as aK,Af as aL,EV as aM,vt as aN,o1 as aO,jV as aP,l1 as aQ,c1 as aR,uu as aS,Dr as aT,Rr as aU,O6 as aV,L6 as aW,qj as aX,Vg as aY,P6 as aZ,go as a_,Ni as aa,Yq as ab,dV as ac,Qx as ad,Js as ae,du as af,lp as ag,Sa as ah,ir as ai,tx as aj,QD as ak,En as al,WR as am,KD as an,mV as ao,gV as ap,bV as aq,pV as ar,zj as as,$k as at,sV as au,Dj as av,Qt as aw,b5 as ax,dT as ay,Tp as az,wL as b,i1 as b0,aa as b1,p1 as b2,F6 as b3,Xx as b4,Bb as b5,F4 as b6,Ij as b7,kb as b8,rV as b9,iV as ba,xO as bb,yO as bc,F2 as bd,nV as be,eV as bf,lV as bg,vp as bh,e2 as bi,L2 as bj,I2 as bk,vV as bl,po as bm,Nu as bn,VL as bo,wV as bp,CV as bq,kV as br,tV as bs,Zq as bt,SV as bu,qR as bv,VR as bw,Dc as bx,nx as by,fV as c,kL as d,Kx as e,vs as f,YU as g,wa as h,Sl as i,o as j,tS as k,ta as l,kn as m,Xq as n,Qq as o,Kd as p,xp as q,b as r,U as s,Jq as t,pt as u,mb as v,Mt as w,XR as x,JR as y,Ce as z};
|