@deepseekcode/cli 1.0.23 → 1.0.24
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/cli.js +1095 -1074
- package/package.json +2 -2
- package/web/dist/assets/{AutomationView-BbLzZ7Db.js → AutomationView-MOGwMs0s.js} +1 -1
- package/web/dist/assets/{ChannelConfigView-CjcMwBSL.js → ChannelConfigView-CHWC4ETy.js} +1 -1
- package/web/dist/assets/{ConnectorsView-CTFoG0sF.js → ConnectorsView-DaP_wB0W.js} +1 -1
- package/web/dist/assets/{FileTreeView-_N5eobgO.js → FileTreeView-N64-Dser.js} +1 -1
- package/web/dist/assets/{HookConfigView-DM6IVFGm.js → HookConfigView-DsZDeVFi.js} +1 -1
- package/web/dist/assets/ModelsView-C1cE2wMN.js +2 -0
- package/web/dist/assets/PluginsView-CsSjjfrn.js +1 -0
- package/web/dist/assets/SessionGrid-Bg-UTI2P.js +37 -0
- package/web/dist/assets/{SettingsPanel-D9kr-sFj.js → SettingsPanel-pZbjabYJ.js} +3 -3
- package/web/dist/assets/{SkillsView-CS0XvZ4N.js → SkillsView-BrQY_vgT.js} +1 -1
- package/web/dist/assets/{TemplatesTab-Pwfjxer7.js → TemplatesTab-DSfCryw2.js} +1 -1
- package/web/dist/assets/{TerminalView-C__4-QSL.js → TerminalView-Drr72DaP.js} +1 -1
- package/web/dist/assets/{ToolsView-Y5MpTnXY.js → ToolsView-ByqbKwqW.js} +1 -1
- package/web/dist/assets/{icons-BXecaLRH.js → icons-B9mi2ie6.js} +114 -104
- package/web/dist/assets/index-DCj9TkXV.css +1 -0
- package/web/dist/assets/index-PcXINYWS.js +68 -0
- package/web/dist/assets/{markdown-BASfeONY.js → markdown-BrFQfawv.js} +1 -1
- package/web/dist/assets/{panels-Bod3sKnK.js → panels-BX-TtLOU.js} +1 -1
- package/web/dist/assets/{react-vendor-7At16BnY.js → react-vendor-CiRFOYk_.js} +1 -1
- package/web/dist/assets/{state-D4zgKwQs.js → state-BcoCffxz.js} +1 -1
- package/web/dist/index.html +7 -7
- package/web/dist/assets/ModelsView-CPm2WAbG.js +0 -2
- package/web/dist/assets/PluginsView-D9pzIe-R.js +0 -1
- package/web/dist/assets/SessionGrid-C-Z-kzmG.js +0 -35
- package/web/dist/assets/index-CFxV9r1K.css +0 -1
- package/web/dist/assets/index-CcPIw0Dj.js +0 -68
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-CPm2WAbG.js","assets/markdown-BASfeONY.js","assets/icons-BXecaLRH.js","assets/react-vendor-7At16BnY.js","assets/state-D4zgKwQs.js","assets/panels-Bod3sKnK.js","assets/ToolsView-Y5MpTnXY.js","assets/SkillsView-CS0XvZ4N.js","assets/TemplatesTab-Pwfjxer7.js","assets/HookConfigView-DM6IVFGm.js","assets/FileTreeView-_N5eobgO.js","assets/TerminalView-C__4-QSL.js","assets/terminal-DgJRGhIz.js","assets/TerminalView-C1Mzzh8g.css","assets/SessionGrid-C-Z-kzmG.js","assets/SettingsPanel-D9kr-sFj.js","assets/ChannelConfigView-CjcMwBSL.js","assets/ConnectorsView-CTFoG0sF.js","assets/AutomationView-BbLzZ7Db.js","assets/PluginsView-D9pzIe-R.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var u0=Object.defineProperty;var d0=(a,t,s)=>t in a?u0(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var He=(a,t,s)=>d0(a,typeof t!="symbol"?t+"":t,s);import{r as f0,j as m,M as p0,d as h0}from"./markdown-BASfeONY.js";import{r as m0,g as jf,a as _,F as Bi,C as lb,b as ob,d as oa,P as Qd,e as g0,X as Ts,L as Rn,f as cb,h as Rf,G as ub,i as db,S as y0,j as Of,M as b0,k as ac,l as ic,m as fb,n as x0,o as pb,A as v0,p as Mf,q as S0,s as k0,t as w0,u as hb,v as _0,w as C0,x as E0,y as Bf,E as Og,D as cl,z as qo,B as N0,H as rc,I as Vo,J as mb,K as gb,N as T0,O as Mg,Q as A0,T as j0,U as R0,V as Xd,Y as el,Z as O0,_ as Df,$ as M0,a0 as B0,a1 as D0,a2 as Bg,a3 as L0,a4 as Dg,a5 as z0,a6 as U0,a7 as $0,a8 as yb,a9 as H0,aa as I0,ab as P0,ac as F0,ad as G0,ae as q0,af as V0,ag as W0,ah as K0,ai as Y0,aj as Z0,ak as Q0,al as X0,am as J0,an as eS,ao as tS,W as nS}from"./icons-BXecaLRH.js";import{r as sS}from"./react-vendor-7At16BnY.js";import{r as aS,c as Bt}from"./state-D4zgKwQs.js";import{P as bb,a as Jd,b as xb}from"./panels-Bod3sKnK.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();var wd={exports:{}},Ir={},_d={exports:{}},Cd={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.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 Lg;function iS(){return Lg||(Lg=1,(function(a){function t($,X){var ne=$.length;$.push(X);e:for(;0<ne;){var Oe=ne-1>>>1,Me=$[Oe];if(0<l(Me,X))$[Oe]=X,$[ne]=Me,ne=Oe;else break e}}function s($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var X=$[0],ne=$.pop();if(ne!==X){$[0]=ne;e:for(var Oe=0,Me=$.length,Pe=Me>>>1;Oe<Pe;){var je=2*(Oe+1)-1,Ee=$[je],nt=je+1,st=$[nt];if(0>l(Ee,ne))nt<Me&&0>l(st,Ee)?($[Oe]=st,$[nt]=ne,Oe=nt):($[Oe]=Ee,$[je]=ne,Oe=je);else if(nt<Me&&0>l(st,ne))$[Oe]=st,$[nt]=ne,Oe=nt;else break e}}return X}function l($,X){var ne=$.sortIndex-X.sortIndex;return ne!==0?ne:$.id-X.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;a.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();a.unstable_now=function(){return u.now()-d}}var p=[],g=[],y=1,b=null,v=3,S=!1,k=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function z($){for(var X=s(g);X!==null;){if(X.callback===null)r(g);else if(X.startTime<=$)r(g),X.sortIndex=X.expirationTime,t(p,X);else break;X=s(g)}}function R($){if(C=!1,z($),!k)if(s(p)!==null)k=!0,Z||(Z=!0,de());else{var X=s(g);X!==null&&ge(R,X.startTime-$)}}var Z=!1,Q=-1,te=5,he=-1;function me(){return E?!0:!(a.unstable_now()-he<te)}function lt(){if(E=!1,Z){var $=a.unstable_now();he=$;var X=!0;try{e:{k=!1,C&&(C=!1,j(Q),Q=-1),S=!0;var ne=v;try{t:{for(z($),b=s(p);b!==null&&!(b.expirationTime>$&&me());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var Me=Oe(b.expirationTime<=$);if($=a.unstable_now(),typeof Me=="function"){b.callback=Me,z($),X=!0;break t}b===s(p)&&r(p),z($)}else r(p);b=s(p)}if(b!==null)X=!0;else{var Pe=s(g);Pe!==null&&ge(R,Pe.startTime-$),X=!1}}break e}finally{b=null,v=ne,S=!1}X=void 0}}finally{X?de():Z=!1}}}var de;if(typeof T=="function")de=function(){T(lt)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,K=W.port2;W.port1.onmessage=lt,de=function(){K.postMessage(null)}}else de=function(){O(lt,0)};function ge($,X){Q=O(function(){$(a.unstable_now())},X)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function($){$.callback=null},a.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<$?Math.floor(1e3/$):5},a.unstable_getCurrentPriorityLevel=function(){return v},a.unstable_next=function($){switch(v){case 1:case 2:case 3:var X=3;break;default:X=v}var ne=v;v=X;try{return $()}finally{v=ne}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function($,X){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=v;v=$;try{return X()}finally{v=ne}},a.unstable_scheduleCallback=function($,X,ne){var Oe=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?Oe+ne:Oe):ne=Oe,$){case 1:var Me=-1;break;case 2:Me=250;break;case 5:Me=1073741823;break;case 4:Me=1e4;break;default:Me=5e3}return Me=ne+Me,$={id:y++,callback:X,priorityLevel:$,startTime:ne,expirationTime:Me,sortIndex:-1},ne>Oe?($.sortIndex=ne,t(g,$),s(p)===null&&$===s(g)&&(C?(j(Q),Q=-1):C=!0,ge(R,ne-Oe))):($.sortIndex=Me,t(p,$),k||S||(k=!0,Z||(Z=!0,de()))),$},a.unstable_shouldYield=me,a.unstable_wrapCallback=function($){var X=v;return function(){var ne=v;v=X;try{return $.apply(this,arguments)}finally{v=ne}}}})(Cd)),Cd}var zg;function rS(){return zg||(zg=1,_d.exports=iS()),_d.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-dom-client.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 Ug;function lS(){if(Ug)return Ir;Ug=1;var a=rS(),t=m0(),s=sS();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function d(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,o=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(o=f.return,o!==null){i=o;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return p(f),e;if(h===o)return p(f),n;h=h.sibling}throw Error(r(188))}if(i.return!==o.return)i=f,o=h;else{for(var x=!1,w=f.child;w;){if(w===i){x=!0,i=f,o=h;break}if(w===o){x=!0,o=f,i=h;break}w=w.sibling}if(!x){for(w=h.child;w;){if(w===i){x=!0,i=h,o=f;break}if(w===o){x=!0,o=h,i=f;break}w=w.sibling}if(!x)throw Error(r(189))}}if(i.alternate!==o)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),T=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),me=Symbol.for("react.memo_cache_sentinel"),lt=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=lt&&e[lt]||e["@@iterator"],typeof e=="function"?e:null)}var W=Symbol.for("react.client.reference");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case E:return"StrictMode";case R:return"Suspense";case Z:return"SuspenseList";case he:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case T:return e.displayName||"Context";case j:return(e._context.displayName||"Context")+".Consumer";case z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return n=e.displayName||null,n!==null?n:K(e.type)||"Memo";case te:n=e._payload,e=e._init;try{return K(e(n))}catch{}}return null}var ge=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},Oe=[],Me=-1;function Pe(e){return{current:e}}function je(e){0>Me||(e.current=Oe[Me],Oe[Me]=null,Me--)}function Ee(e,n){Me++,Oe[Me]=e.current,e.current=n}var nt=Pe(null),st=Pe(null),Kt=Pe(null),Mn=Pe(null);function sn(e,n){switch(Ee(Kt,n),Ee(st,e),Ee(nt,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?tg(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=tg(n),e=ng(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(nt),Ee(nt,e)}function bn(){je(nt),je(st),je(Kt)}function Jn(e){e.memoizedState!==null&&Ee(Mn,e);var n=nt.current,i=ng(n,e.type);n!==i&&(Ee(st,e),Ee(nt,i))}function Y(e){st.current===e&&(je(nt),je(st)),Mn.current===e&&(je(Mn),zr._currentValue=ne)}var Je,ke;function oe(e){if(Je===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Je=n&&n[1]||"",ke=-1<i.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Je+e+ke}var ot=!1;function se(e,n){if(!e||ot)return"";ot=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(I){var U=I}Reflect.construct(e,[],V)}else{try{V.call()}catch(I){U=I}e.call(V.prototype)}}else{try{throw Error()}catch(I){U=I}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(I){if(I&&U&&typeof I.stack=="string")return[I.stack,U.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),x=h[0],w=h[1];if(x&&w){var N=x.split(`
|
|
21
|
-
`),L=w.split(`
|
|
22
|
-
`);for(f=o=0;o<N.length&&!N[o].includes("DetermineComponentFrameRoot");)o++;for(;f<L.length&&!L[f].includes("DetermineComponentFrameRoot");)f++;if(o===N.length||f===L.length)for(o=N.length-1,f=L.length-1;1<=o&&0<=f&&N[o]!==L[f];)f--;for(;1<=o&&0<=f;o--,f--)if(N[o]!==L[f]){if(o!==1||f!==1)do if(o--,f--,0>f||N[o]!==L[f]){var F=`
|
|
23
|
-
`+N[o].replace(" at new "," at ");return e.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",e.displayName)),F}while(1<=o&&0<=f);break}}}finally{ot=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?oe(i):""}function Pn(e,n){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe("Lazy");case 13:return e.child!==n&&n!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("SuspenseList");case 0:case 15:return se(e.type,!1);case 11:return se(e.type.render,!1);case 1:return se(e.type,!0);case 31:return oe("Activity");default:return""}}function Yt(e){try{var n="",i=null;do n+=Pn(e,i),i=e,e=e.return;while(e);return n}catch(o){return`
|
|
24
|
-
Error generating stack: `+o.message+`
|
|
25
|
-
`+o.stack}}var bt=Object.prototype.hasOwnProperty,St=a.unstable_scheduleCallback,qt=a.unstable_cancelCallback,za=a.unstable_shouldYield,Pi=a.unstable_requestPaint,Dt=a.unstable_now,Fi=a.unstable_getCurrentPriorityLevel,Gi=a.unstable_ImmediatePriority,Pt=a.unstable_UserBlockingPriority,Ua=a.unstable_NormalPriority,an=a.unstable_LowPriority,qi=a.unstable_IdlePriority,bl=a.log,$a=a.unstable_setDisableYieldValue,es=null,Ft=null;function Bn(e){if(typeof bl=="function"&&$a(e),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(es,e)}catch{}}var Vt=Math.clz32?Math.clz32:Ha,dc=Math.log,fc=Math.LN2;function Ha(e){return e>>>=0,e===0?32:31-(dc(e)/fc|0)|0}var Ia=256,fa=262144,ts=4194304;function ns(e){var n=e&42;if(n!==0)return n;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pa(e,n,i){var o=e.pendingLanes;if(o===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var w=o&134217727;return w!==0?(o=w&~h,o!==0?f=ns(o):(x&=w,x!==0?f=ns(x):i||(i=w&~e,i!==0&&(f=ns(i))))):(w=o&~h,w!==0?f=ns(w):x!==0?f=ns(x):i||(i=o&~e,i!==0&&(f=ns(i)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,i=n&-n,h>=i||h===32&&(i&4194048)!==0)?n:f}function ss(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function xl(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 as(){var e=ts;return ts<<=1,(ts&62914560)===0&&(ts=4194304),e}function Vi(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function is(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Wi(e,n,i,o,f,h){var x=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,N=e.expirationTimes,L=e.hiddenUpdates;for(i=x&~i;0<i;){var F=31-Vt(i),V=1<<F;w[F]=0,N[F]=-1;var U=L[F];if(U!==null)for(L[F]=null,F=0;F<U.length;F++){var I=U[F];I!==null&&(I.lane&=-536870913)}i&=~V}o!==0&&vl(e,o,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function vl(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Vt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|i&261930}function Ki(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var o=31-Vt(i),f=1<<o;f&n|e[o]&n&&(e[o]|=n),i&=~f}}function Yi(e,n){var i=n&-n;return i=(i&42)!==0?1:Pa(i),(i&(e.suspendedLanes|n))!==0?0:i}function Pa(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Fa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Zi(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:Cg(e.type))}function Ga(e,n){var i=X.p;try{return X.p=e,n()}finally{X.p=i}}var xn=Math.random().toString(36).slice(2),jt="__reactFiber$"+xn,Gt="__reactProps$"+xn,js="__reactContainer$"+xn,Qi="__reactEvents$"+xn,pc="__reactListeners$"+xn,hc="__reactHandles$"+xn,Xi="__reactResources$"+xn,ha="__reactMarker$"+xn;function ma(e){delete e[jt],delete e[Gt],delete e[Qi],delete e[pc],delete e[hc]}function Rs(e){var n=e[jt];if(n)return n;for(var i=e.parentNode;i;){if(n=i[js]||i[jt]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=cg(e);e!==null;){if(i=e[jt])return i;e=cg(e)}return n}e=i,i=e.parentNode}return null}function B(e){if(e=e[jt]||e[js]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function G(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function ee(e){var n=e[Xi];return n||(n=e[Xi]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function ie(e){e[ha]=!0}var xe=new Set,Fe={};function qe(e,n){ft(e,n),ft(e+"Capture",n)}function ft(e,n){for(Fe[e]=n,e=0;e<n.length;e++)xe.add(n[e])}var Ue=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]*$"),We={},rs={};function Sl(e){return bt.call(rs,e)?!0:bt.call(We,e)?!1:Ue.test(e)?rs[e]=!0:(We[e]=!0,!1)}function rn(e,n,i){if(Sl(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function qa(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function Lt(e,n,i,o){if(o===null)e.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+o)}}function _t(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ji(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function mc(e,n,i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){i=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function gc(e){if(!e._valueTracker){var n=Ji(e)?"checked":"value";e._valueTracker=mc(e,n,""+e[n])}}function Kf(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),o="";return e&&(o=Ji(e)?e.checked?"true":"false":e.value),e=o,e!==i?(n.setValue(e),!0):!1}function kl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ax=/[\n"\\]/g;function vn(e){return e.replace(ax,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function yc(e,n,i,o,f,h,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+_t(n)):e.value!==""+_t(n)&&(e.value=""+_t(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?bc(e,x,_t(n)):i!=null?bc(e,x,_t(i)):o!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+_t(w):e.removeAttribute("name")}function Yf(e,n,i,o,f,h,x,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){gc(e);return}i=i!=null?""+_t(i):"",n=n!=null?""+_t(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=w?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),gc(e)}function bc(e,n,i){n==="number"&&kl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Va(e,n,i,o){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&o&&(e[i].defaultSelected=!0)}else{for(i=""+_t(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,o&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Zf(e,n,i){if(n!=null&&(n=""+_t(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+_t(i):""}function Qf(e,n,i,o){if(n==null){if(o!=null){if(i!=null)throw Error(r(92));if(ge(o)){if(1<o.length)throw Error(r(93));o=o[0]}i=o}i==null&&(i=""),n=i}i=_t(n),e.defaultValue=i,o=e.textContent,o===i&&o!==""&&o!==null&&(e.value=o),gc(e)}function Wa(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var ix=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 Xf(e,n,i){var o=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,i):typeof i!="number"||i===0||ix.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function Jf(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var o in i)!i.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var f in n)o=n[f],n.hasOwnProperty(f)&&i[f]!==o&&Xf(e,f,o)}else for(var h in n)n.hasOwnProperty(h)&&Xf(e,h,n[h])}function xc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 rx=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"]]),lx=/^[\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 wl(e){return lx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ls(){}var vc=null;function Sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ka=null,Ya=null;function ep(e){var n=B(e);if(n&&(e=n.stateNode)){var i=e[Gt]||null;e:switch(e=n.stateNode,n.type){case"input":if(yc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+vn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var o=i[n];if(o!==e&&o.form===e.form){var f=o[Gt]||null;if(!f)throw Error(r(90));yc(o,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<i.length;n++)o=i[n],o.form===e.form&&Kf(o)}break e;case"textarea":Zf(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Va(e,!!i.multiple,n,!1)}}}var kc=!1;function tp(e,n,i){if(kc)return e(n,i);kc=!0;try{var o=e(n);return o}finally{if(kc=!1,(Ka!==null||Ya!==null)&&(uo(),Ka&&(n=Ka,e=Ya,Ya=Ka=null,ep(n),e)))for(n=0;n<e.length;n++)ep(e[n])}}function er(e,n){var i=e.stateNode;if(i===null)return null;var o=i[Gt]||null;if(o===null)return null;i=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var os=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wc=!1;if(os)try{var tr={};Object.defineProperty(tr,"passive",{get:function(){wc=!0}}),window.addEventListener("test",tr,tr),window.removeEventListener("test",tr,tr)}catch{wc=!1}var Os=null,_c=null,_l=null;function np(){if(_l)return _l;var e,n=_c,i=n.length,o,f="value"in Os?Os.value:Os.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var x=i-e;for(o=1;o<=x&&n[i-o]===f[h-o];o++);return _l=f.slice(e,1<o?1-o:void 0)}function Cl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function El(){return!0}function sp(){return!1}function Zt(e){function n(i,o,f,h,x){this._reactName=i,this._targetInst=f,this.type=o,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?El:sp,this.isPropagationStopped=sp,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=El)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=El)},persist:function(){},isPersistent:El}),n}var ga={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nl=Zt(ga),nr=b({},ga,{view:0,detail:0}),ox=Zt(nr),Cc,Ec,sr,Tl=b({},nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==sr&&(sr&&e.type==="mousemove"?(Cc=e.screenX-sr.screenX,Ec=e.screenY-sr.screenY):Ec=Cc=0,sr=e),Cc)},movementY:function(e){return"movementY"in e?e.movementY:Ec}}),ap=Zt(Tl),cx=b({},Tl,{dataTransfer:0}),ux=Zt(cx),dx=b({},nr,{relatedTarget:0}),Nc=Zt(dx),fx=b({},ga,{animationName:0,elapsedTime:0,pseudoElement:0}),px=Zt(fx),hx=b({},ga,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mx=Zt(hx),gx=b({},ga,{data:0}),ip=Zt(gx),yx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bx={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"},xx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=xx[e])?!!n[e]:!1}function Tc(){return vx}var Sx=b({},nr,{key:function(e){if(e.key){var n=yx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Cl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?bx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tc,charCode:function(e){return e.type==="keypress"?Cl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Cl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kx=Zt(Sx),wx=b({},Tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rp=Zt(wx),_x=b({},nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tc}),Cx=Zt(_x),Ex=b({},ga,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nx=Zt(Ex),Tx=b({},Tl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ax=Zt(Tx),jx=b({},ga,{newState:0,oldState:0}),Rx=Zt(jx),Ox=[9,13,27,32],Ac=os&&"CompositionEvent"in window,ar=null;os&&"documentMode"in document&&(ar=document.documentMode);var Mx=os&&"TextEvent"in window&&!ar,lp=os&&(!Ac||ar&&8<ar&&11>=ar),op=" ",cp=!1;function up(e,n){switch(e){case"keyup":return Ox.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Za=!1;function Bx(e,n){switch(e){case"compositionend":return dp(n);case"keypress":return n.which!==32?null:(cp=!0,op);case"textInput":return e=n.data,e===op&&cp?null:e;default:return null}}function Dx(e,n){if(Za)return e==="compositionend"||!Ac&&up(e,n)?(e=np(),_l=_c=Os=null,Za=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return lp&&n.locale!=="ko"?null:n.data;default:return null}}var Lx={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 fp(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Lx[e.type]:n==="textarea"}function pp(e,n,i,o){Ka?Ya?Ya.push(o):Ya=[o]:Ka=o,n=bo(n,"onChange"),0<n.length&&(i=new Nl("onChange","change",null,i,o),e.push({event:i,listeners:n}))}var ir=null,rr=null;function zx(e){Ym(e,0)}function Al(e){var n=G(e);if(Kf(n))return e}function hp(e,n){if(e==="change")return n}var mp=!1;if(os){var jc;if(os){var Rc="oninput"in document;if(!Rc){var gp=document.createElement("div");gp.setAttribute("oninput","return;"),Rc=typeof gp.oninput=="function"}jc=Rc}else jc=!1;mp=jc&&(!document.documentMode||9<document.documentMode)}function yp(){ir&&(ir.detachEvent("onpropertychange",bp),rr=ir=null)}function bp(e){if(e.propertyName==="value"&&Al(rr)){var n=[];pp(n,rr,e,Sc(e)),tp(zx,n)}}function Ux(e,n,i){e==="focusin"?(yp(),ir=n,rr=i,ir.attachEvent("onpropertychange",bp)):e==="focusout"&&yp()}function $x(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Al(rr)}function Hx(e,n){if(e==="click")return Al(n)}function Ix(e,n){if(e==="input"||e==="change")return Al(n)}function Px(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var ln=typeof Object.is=="function"?Object.is:Px;function lr(e,n){if(ln(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),o=Object.keys(n);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var f=i[o];if(!bt.call(n,f)||!ln(e[f],n[f]))return!1}return!0}function xp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vp(e,n){var i=xp(e);e=0;for(var o;i;){if(i.nodeType===3){if(o=e+i.textContent.length,e<=n&&o>=n)return{node:i,offset:n-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=xp(i)}}function Sp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Sp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function kp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=kl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=kl(e.document)}return n}function Oc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Fx=os&&"documentMode"in document&&11>=document.documentMode,Qa=null,Mc=null,or=null,Bc=!1;function wp(e,n,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Bc||Qa==null||Qa!==kl(o)||(o=Qa,"selectionStart"in o&&Oc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),or&&lr(or,o)||(or=o,o=bo(Mc,"onSelect"),0<o.length&&(n=new Nl("onSelect","select",null,n,i),e.push({event:n,listeners:o}),n.target=Qa)))}function ya(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Xa={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},Dc={},_p={};os&&(_p=document.createElement("div").style,"AnimationEvent"in window||(delete Xa.animationend.animation,delete Xa.animationiteration.animation,delete Xa.animationstart.animation),"TransitionEvent"in window||delete Xa.transitionend.transition);function ba(e){if(Dc[e])return Dc[e];if(!Xa[e])return e;var n=Xa[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in _p)return Dc[e]=n[i];return e}var Cp=ba("animationend"),Ep=ba("animationiteration"),Np=ba("animationstart"),Gx=ba("transitionrun"),qx=ba("transitionstart"),Vx=ba("transitioncancel"),Tp=ba("transitionend"),Ap=new Map,Lc="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(" ");Lc.push("scrollEnd");function Dn(e,n){Ap.set(e,n),qe(n,[e])}var jl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Sn=[],Ja=0,zc=0;function Rl(){for(var e=Ja,n=zc=Ja=0;n<e;){var i=Sn[n];Sn[n++]=null;var o=Sn[n];Sn[n++]=null;var f=Sn[n];Sn[n++]=null;var h=Sn[n];if(Sn[n++]=null,o!==null&&f!==null){var x=o.pending;x===null?f.next=f:(f.next=x.next,x.next=f),o.pending=f}h!==0&&jp(i,f,h)}}function Ol(e,n,i,o){Sn[Ja++]=e,Sn[Ja++]=n,Sn[Ja++]=i,Sn[Ja++]=o,zc|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Uc(e,n,i,o){return Ol(e,n,i,o),Ml(e)}function xa(e,n){return Ol(e,null,null,n),Ml(e)}function jp(e,n,i){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i);for(var f=!1,h=e.return;h!==null;)h.childLanes|=i,o=h.alternate,o!==null&&(o.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Vt(i),e=h.hiddenUpdates,o=e[f],o===null?e[f]=[n]:o.push(n),n.lane=i|536870912),h):null}function Ml(e){if(50<jr)throw jr=0,Wu=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ei={};function Wx(e,n,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function on(e,n,i,o){return new Wx(e,n,i,o)}function $c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cs(e,n){var i=e.alternate;return i===null?(i=on(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Rp(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Bl(e,n,i,o,f,h){var x=0;if(o=e,typeof e=="function")$c(e)&&(x=1);else if(typeof e=="string")x=Xv(e,i,nt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case he:return e=on(31,i,n,f),e.elementType=he,e.lanes=h,e;case C:return va(i.children,f,h,n);case E:x=8,f|=24;break;case O:return e=on(12,i,n,f|2),e.elementType=O,e.lanes=h,e;case R:return e=on(13,i,n,f),e.elementType=R,e.lanes=h,e;case Z:return e=on(19,i,n,f),e.elementType=Z,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T:x=10;break e;case j:x=9;break e;case z:x=11;break e;case Q:x=14;break e;case te:x=16,o=null;break e}x=29,i=Error(r(130,e===null?"null":typeof e,"")),o=null}return n=on(x,i,n,f),n.elementType=e,n.type=o,n.lanes=h,n}function va(e,n,i,o){return e=on(7,e,o,n),e.lanes=i,e}function Hc(e,n,i){return e=on(6,e,null,n),e.lanes=i,e}function Op(e){var n=on(18,null,null,0);return n.stateNode=e,n}function Ic(e,n,i){return n=on(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Mp=new WeakMap;function kn(e,n){if(typeof e=="object"&&e!==null){var i=Mp.get(e);return i!==void 0?i:(n={value:e,source:n,stack:Yt(n)},Mp.set(e,n),n)}return{value:e,source:n,stack:Yt(n)}}var ti=[],ni=0,Dl=null,cr=0,wn=[],_n=0,Ms=null,Fn=1,Gn="";function us(e,n){ti[ni++]=cr,ti[ni++]=Dl,Dl=e,cr=n}function Bp(e,n,i){wn[_n++]=Fn,wn[_n++]=Gn,wn[_n++]=Ms,Ms=e;var o=Fn;e=Gn;var f=32-Vt(o)-1;o&=~(1<<f),i+=1;var h=32-Vt(n)+f;if(30<h){var x=f-f%5;h=(o&(1<<x)-1).toString(32),o>>=x,f-=x,Fn=1<<32-Vt(n)+f|i<<f|o,Gn=h+e}else Fn=1<<h|i<<f|o,Gn=e}function Pc(e){e.return!==null&&(us(e,1),Bp(e,1,0))}function Fc(e){for(;e===Dl;)Dl=ti[--ni],ti[ni]=null,cr=ti[--ni],ti[ni]=null;for(;e===Ms;)Ms=wn[--_n],wn[_n]=null,Gn=wn[--_n],wn[_n]=null,Fn=wn[--_n],wn[_n]=null}function Dp(e,n){wn[_n++]=Fn,wn[_n++]=Gn,wn[_n++]=Ms,Fn=n.id,Gn=n.overflow,Ms=e}var zt=null,ut=null,$e=!1,Bs=null,Cn=!1,Gc=Error(r(519));function Ds(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ur(kn(n,e)),Gc}function Lp(e){var n=e.stateNode,i=e.type,o=e.memoizedProps;switch(n[jt]=e,n[Gt]=o,i){case"dialog":De("cancel",n),De("close",n);break;case"iframe":case"object":case"embed":De("load",n);break;case"video":case"audio":for(i=0;i<Or.length;i++)De(Or[i],n);break;case"source":De("error",n);break;case"img":case"image":case"link":De("error",n),De("load",n);break;case"details":De("toggle",n);break;case"input":De("invalid",n),Yf(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":De("invalid",n);break;case"textarea":De("invalid",n),Qf(n,o.value,o.defaultValue,o.children)}i=o.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||o.suppressHydrationWarning===!0||Jm(n.textContent,i)?(o.popover!=null&&(De("beforetoggle",n),De("toggle",n)),o.onScroll!=null&&De("scroll",n),o.onScrollEnd!=null&&De("scrollend",n),o.onClick!=null&&(n.onclick=ls),n=!0):n=!1,n||Ds(e,!0)}function zp(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:zt=zt.return}}function si(e){if(e!==zt)return!1;if(!$e)return zp(e),$e=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||od(e.type,e.memoizedProps)),i=!i),i&&ut&&Ds(e),zp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));ut=og(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));ut=og(e)}else n===27?(n=ut,Ys(e.type)?(e=pd,pd=null,ut=e):ut=n):ut=zt?Nn(e.stateNode.nextSibling):null;return!0}function Sa(){ut=zt=null,$e=!1}function qc(){var e=Bs;return e!==null&&(en===null?en=e:en.push.apply(en,e),Bs=null),e}function ur(e){Bs===null?Bs=[e]:Bs.push(e)}var Vc=Pe(null),ka=null,ds=null;function Ls(e,n,i){Ee(Vc,n._currentValue),n._currentValue=i}function fs(e){e._currentValue=Vc.current,je(Vc)}function Wc(e,n,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===i)break;e=e.return}}function Kc(e,n,i,o){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var N=0;N<n.length;N++)if(w.context===n[N]){h.lanes|=i,w=h.alternate,w!==null&&(w.lanes|=i),Wc(h.return,i,e),o||(x=null);break e}h=w.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=i,h=x.alternate,h!==null&&(h.lanes|=i),Wc(x,i,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function ai(e,n,i,o){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var w=f.type;ln(f.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(f===Mn.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(zr):e=[zr])}f=f.return}e!==null&&Kc(n,e,i,o),n.flags|=262144}function Ll(e){for(e=e.firstContext;e!==null;){if(!ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function wa(e){ka=e,ds=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ut(e){return Up(ka,e)}function zl(e,n){return ka===null&&wa(e),Up(e,n)}function Up(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},ds===null){if(e===null)throw Error(r(308));ds=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else ds=ds.next=n;return i}var Kx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},Yx=a.unstable_scheduleCallback,Zx=a.unstable_NormalPriority,Ct={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yc(){return{controller:new Kx,data:new Map,refCount:0}}function dr(e){e.refCount--,e.refCount===0&&Yx(Zx,function(){e.controller.abort()})}var fr=null,Zc=0,ii=0,ri=null;function Qx(e,n){if(fr===null){var i=fr=[];Zc=0,ii=Ju(),ri={status:"pending",value:void 0,then:function(o){i.push(o)}}}return Zc++,n.then($p,$p),n}function $p(){if(--Zc===0&&fr!==null){ri!==null&&(ri.status="fulfilled");var e=fr;fr=null,ii=0,ri=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Xx(e,n){var i=[],o={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var f=0;f<i.length;f++)(0,i[f])(n)},function(f){for(o.status="rejected",o.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),o}var Hp=$.S;$.S=function(e,n){wm=Dt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Qx(e,n),Hp!==null&&Hp(e,n)};var _a=Pe(null);function Qc(){var e=_a.current;return e!==null?e:ct.pooledCache}function Ul(e,n){n===null?Ee(_a,_a.current):Ee(_a,n.pool)}function Ip(){var e=Qc();return e===null?null:{parent:Ct._currentValue,pool:e}}var li=Error(r(460)),Xc=Error(r(474)),$l=Error(r(542)),Hl={then:function(){}};function Pp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Fp(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(ls,ls),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,qp(e),e;default:if(typeof n.status=="string")n.then(ls,ls);else{if(e=ct,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=o}},function(o){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,qp(e),e}throw Ea=n,li}}function Ca(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ea=i,li):i}}var Ea=null;function Gp(){if(Ea===null)throw Error(r(459));var e=Ea;return Ea=null,e}function qp(e){if(e===li||e===$l)throw Error(r(483))}var oi=null,pr=0;function Il(e){var n=pr;return pr+=1,oi===null&&(oi=[]),Fp(oi,e,n)}function hr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Pl(e,n){throw n.$$typeof===v?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Vp(e){function n(M,A){if(e){var D=M.deletions;D===null?(M.deletions=[A],M.flags|=16):D.push(A)}}function i(M,A){if(!e)return null;for(;A!==null;)n(M,A),A=A.sibling;return null}function o(M){for(var A=new Map;M!==null;)M.key!==null?A.set(M.key,M):A.set(M.index,M),M=M.sibling;return A}function f(M,A){return M=cs(M,A),M.index=0,M.sibling=null,M}function h(M,A,D){return M.index=D,e?(D=M.alternate,D!==null?(D=D.index,D<A?(M.flags|=67108866,A):D):(M.flags|=67108866,A)):(M.flags|=1048576,A)}function x(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function w(M,A,D,q){return A===null||A.tag!==6?(A=Hc(D,M.mode,q),A.return=M,A):(A=f(A,D),A.return=M,A)}function N(M,A,D,q){var fe=D.type;return fe===C?F(M,A,D.props.children,q,D.key):A!==null&&(A.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===te&&Ca(fe)===A.type)?(A=f(A,D.props),hr(A,D),A.return=M,A):(A=Bl(D.type,D.key,D.props,null,M.mode,q),hr(A,D),A.return=M,A)}function L(M,A,D,q){return A===null||A.tag!==4||A.stateNode.containerInfo!==D.containerInfo||A.stateNode.implementation!==D.implementation?(A=Ic(D,M.mode,q),A.return=M,A):(A=f(A,D.children||[]),A.return=M,A)}function F(M,A,D,q,fe){return A===null||A.tag!==7?(A=va(D,M.mode,q,fe),A.return=M,A):(A=f(A,D),A.return=M,A)}function V(M,A,D){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Hc(""+A,M.mode,D),A.return=M,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case S:return D=Bl(A.type,A.key,A.props,null,M.mode,D),hr(D,A),D.return=M,D;case k:return A=Ic(A,M.mode,D),A.return=M,A;case te:return A=Ca(A),V(M,A,D)}if(ge(A)||de(A))return A=va(A,M.mode,D,null),A.return=M,A;if(typeof A.then=="function")return V(M,Il(A),D);if(A.$$typeof===T)return V(M,zl(M,A),D);Pl(M,A)}return null}function U(M,A,D,q){var fe=A!==null?A.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return fe!==null?null:w(M,A,""+D,q);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===fe?N(M,A,D,q):null;case k:return D.key===fe?L(M,A,D,q):null;case te:return D=Ca(D),U(M,A,D,q)}if(ge(D)||de(D))return fe!==null?null:F(M,A,D,q,null);if(typeof D.then=="function")return U(M,A,Il(D),q);if(D.$$typeof===T)return U(M,A,zl(M,D),q);Pl(M,D)}return null}function I(M,A,D,q,fe){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return M=M.get(D)||null,w(A,M,""+q,fe);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return M=M.get(q.key===null?D:q.key)||null,N(A,M,q,fe);case k:return M=M.get(q.key===null?D:q.key)||null,L(A,M,q,fe);case te:return q=Ca(q),I(M,A,D,q,fe)}if(ge(q)||de(q))return M=M.get(D)||null,F(A,M,q,fe,null);if(typeof q.then=="function")return I(M,A,D,Il(q),fe);if(q.$$typeof===T)return I(M,A,D,zl(A,q),fe);Pl(A,q)}return null}function re(M,A,D,q){for(var fe=null,Ke=null,ce=A,Te=A=0,ze=null;ce!==null&&Te<D.length;Te++){ce.index>Te?(ze=ce,ce=null):ze=ce.sibling;var Ye=U(M,ce,D[Te],q);if(Ye===null){ce===null&&(ce=ze);break}e&&ce&&Ye.alternate===null&&n(M,ce),A=h(Ye,A,Te),Ke===null?fe=Ye:Ke.sibling=Ye,Ke=Ye,ce=ze}if(Te===D.length)return i(M,ce),$e&&us(M,Te),fe;if(ce===null){for(;Te<D.length;Te++)ce=V(M,D[Te],q),ce!==null&&(A=h(ce,A,Te),Ke===null?fe=ce:Ke.sibling=ce,Ke=ce);return $e&&us(M,Te),fe}for(ce=o(ce);Te<D.length;Te++)ze=I(ce,M,Te,D[Te],q),ze!==null&&(e&&ze.alternate!==null&&ce.delete(ze.key===null?Te:ze.key),A=h(ze,A,Te),Ke===null?fe=ze:Ke.sibling=ze,Ke=ze);return e&&ce.forEach(function(ea){return n(M,ea)}),$e&&us(M,Te),fe}function ye(M,A,D,q){if(D==null)throw Error(r(151));for(var fe=null,Ke=null,ce=A,Te=A=0,ze=null,Ye=D.next();ce!==null&&!Ye.done;Te++,Ye=D.next()){ce.index>Te?(ze=ce,ce=null):ze=ce.sibling;var ea=U(M,ce,Ye.value,q);if(ea===null){ce===null&&(ce=ze);break}e&&ce&&ea.alternate===null&&n(M,ce),A=h(ea,A,Te),Ke===null?fe=ea:Ke.sibling=ea,Ke=ea,ce=ze}if(Ye.done)return i(M,ce),$e&&us(M,Te),fe;if(ce===null){for(;!Ye.done;Te++,Ye=D.next())Ye=V(M,Ye.value,q),Ye!==null&&(A=h(Ye,A,Te),Ke===null?fe=Ye:Ke.sibling=Ye,Ke=Ye);return $e&&us(M,Te),fe}for(ce=o(ce);!Ye.done;Te++,Ye=D.next())Ye=I(ce,M,Te,Ye.value,q),Ye!==null&&(e&&Ye.alternate!==null&&ce.delete(Ye.key===null?Te:Ye.key),A=h(Ye,A,Te),Ke===null?fe=Ye:Ke.sibling=Ye,Ke=Ye);return e&&ce.forEach(function(c0){return n(M,c0)}),$e&&us(M,Te),fe}function rt(M,A,D,q){if(typeof D=="object"&&D!==null&&D.type===C&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var fe=D.key;A!==null;){if(A.key===fe){if(fe=D.type,fe===C){if(A.tag===7){i(M,A.sibling),q=f(A,D.props.children),q.return=M,M=q;break e}}else if(A.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===te&&Ca(fe)===A.type){i(M,A.sibling),q=f(A,D.props),hr(q,D),q.return=M,M=q;break e}i(M,A);break}else n(M,A);A=A.sibling}D.type===C?(q=va(D.props.children,M.mode,q,D.key),q.return=M,M=q):(q=Bl(D.type,D.key,D.props,null,M.mode,q),hr(q,D),q.return=M,M=q)}return x(M);case k:e:{for(fe=D.key;A!==null;){if(A.key===fe)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){i(M,A.sibling),q=f(A,D.children||[]),q.return=M,M=q;break e}else{i(M,A);break}else n(M,A);A=A.sibling}q=Ic(D,M.mode,q),q.return=M,M=q}return x(M);case te:return D=Ca(D),rt(M,A,D,q)}if(ge(D))return re(M,A,D,q);if(de(D)){if(fe=de(D),typeof fe!="function")throw Error(r(150));return D=fe.call(D),ye(M,A,D,q)}if(typeof D.then=="function")return rt(M,A,Il(D),q);if(D.$$typeof===T)return rt(M,A,zl(M,D),q);Pl(M,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,A!==null&&A.tag===6?(i(M,A.sibling),q=f(A,D),q.return=M,M=q):(i(M,A),q=Hc(D,M.mode,q),q.return=M,M=q),x(M)):i(M,A)}return function(M,A,D,q){try{pr=0;var fe=rt(M,A,D,q);return oi=null,fe}catch(ce){if(ce===li||ce===$l)throw ce;var Ke=on(29,ce,null,M.mode);return Ke.lanes=q,Ke.return=M,Ke}finally{}}}var Na=Vp(!0),Wp=Vp(!1),zs=!1;function Jc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Us(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $s(e,n,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Xe&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=Ml(e),jp(e,null,i),n}return Ol(e,o,n,i),Ml(e)}function mr(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,Ki(e,i)}}function tu(e,n){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var f=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var nu=!1;function gr(){if(nu){var e=ri;if(e!==null)throw e}}function yr(e,n,i,o){nu=!1;var f=e.updateQueue;zs=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var N=w,L=N.next;N.next=null,x===null?h=L:x.next=L,x=N;var F=e.alternate;F!==null&&(F=F.updateQueue,w=F.lastBaseUpdate,w!==x&&(w===null?F.firstBaseUpdate=L:w.next=L,F.lastBaseUpdate=N))}if(h!==null){var V=f.baseState;x=0,F=L=N=null,w=h;do{var U=w.lane&-536870913,I=U!==w.lane;if(I?(Le&U)===U:(o&U)===U){U!==0&&U===ii&&(nu=!0),F!==null&&(F=F.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var re=e,ye=w;U=n;var rt=i;switch(ye.tag){case 1:if(re=ye.payload,typeof re=="function"){V=re.call(rt,V,U);break e}V=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ye.payload,U=typeof re=="function"?re.call(rt,V,U):re,U==null)break e;V=b({},V,U);break e;case 2:zs=!0}}U=w.callback,U!==null&&(e.flags|=64,I&&(e.flags|=8192),I=f.callbacks,I===null?f.callbacks=[U]:I.push(U))}else I={lane:U,tag:w.tag,payload:w.payload,callback:w.callback,next:null},F===null?(L=F=I,N=V):F=F.next=I,x|=U;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;I=w,w=I.next,I.next=null,f.lastBaseUpdate=I,f.shared.pending=null}}while(!0);F===null&&(N=V),f.baseState=N,f.firstBaseUpdate=L,f.lastBaseUpdate=F,h===null&&(f.shared.lanes=0),Gs|=x,e.lanes=x,e.memoizedState=V}}function Kp(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Yp(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Kp(i[e],n)}var ci=Pe(null),Fl=Pe(0);function Zp(e,n){e=Ss,Ee(Fl,e),Ee(ci,n),Ss=e|n.baseLanes}function su(){Ee(Fl,Ss),Ee(ci,ci.current)}function au(){Ss=Fl.current,je(ci),je(Fl)}var cn=Pe(null),En=null;function Hs(e){var n=e.alternate;Ee(kt,kt.current&1),Ee(cn,e),En===null&&(n===null||ci.current!==null||n.memoizedState!==null)&&(En=e)}function iu(e){Ee(kt,kt.current),Ee(cn,e),En===null&&(En=e)}function Qp(e){e.tag===22?(Ee(kt,kt.current),Ee(cn,e),En===null&&(En=e)):Is()}function Is(){Ee(kt,kt.current),Ee(cn,cn.current)}function un(e){je(cn),En===e&&(En=null),je(kt)}var kt=Pe(0);function Gl(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||dd(i)||fd(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ps=0,Ne=null,at=null,Et=null,ql=!1,ui=!1,Ta=!1,Vl=0,br=0,di=null,Jx=0;function xt(){throw Error(r(321))}function ru(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!ln(e[i],n[i]))return!1;return!0}function lu(e,n,i,o,f,h){return ps=h,Ne=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,$.H=e===null||e.memoizedState===null?Bh:ku,Ta=!1,h=i(o,f),Ta=!1,ui&&(h=Jp(n,i,o,f)),Xp(e),h}function Xp(e){$.H=Sr;var n=at!==null&&at.next!==null;if(ps=0,Et=at=Ne=null,ql=!1,br=0,di=null,n)throw Error(r(300));e===null||Nt||(e=e.dependencies,e!==null&&Ll(e)&&(Nt=!0))}function Jp(e,n,i,o){Ne=e;var f=0;do{if(ui&&(di=null),br=0,ui=!1,25<=f)throw Error(r(301));if(f+=1,Et=at=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}$.H=Dh,h=n(i,o)}while(ui);return h}function ev(){var e=$.H,n=e.useState()[0];return n=typeof n.then=="function"?xr(n):n,e=e.useState()[0],(at!==null?at.memoizedState:null)!==e&&(Ne.flags|=1024),n}function ou(){var e=Vl!==0;return Vl=0,e}function cu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function uu(e){if(ql){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}ql=!1}ps=0,Et=at=Ne=null,ui=!1,br=Vl=0,di=null}function Wt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Et===null?Ne.memoizedState=Et=e:Et=Et.next=e,Et}function wt(){if(at===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=at.next;var n=Et===null?Ne.memoizedState:Et.next;if(n!==null)Et=n,at=e;else{if(e===null)throw Ne.alternate===null?Error(r(467)):Error(r(310));at=e,e={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},Et===null?Ne.memoizedState=Et=e:Et=Et.next=e}return Et}function Wl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xr(e){var n=br;return br+=1,di===null&&(di=[]),e=Fp(di,e,n),n=Ne,(Et===null?n.memoizedState:Et.next)===null&&(n=n.alternate,$.H=n===null||n.memoizedState===null?Bh:ku),e}function Kl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return xr(e);if(e.$$typeof===T)return Ut(e)}throw Error(r(438,String(e)))}function du(e){var n=null,i=Ne.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var o=Ne.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=Wl(),Ne.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),o=0;o<e;o++)i[o]=me;return n.index++,i}function hs(e,n){return typeof n=="function"?n(e):n}function Yl(e){var n=wt();return fu(n,at,e)}function fu(e,n,i){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var f=e.baseQueue,h=o.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,o.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=x=null,N=null,L=n,F=!1;do{var V=L.lane&-536870913;if(V!==L.lane?(Le&V)===V:(ps&V)===V){var U=L.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),V===ii&&(F=!0);else if((ps&U)===U){L=L.next,U===ii&&(F=!0);continue}else V={lane:0,revertLane:L.revertLane,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},N===null?(w=N=V,x=h):N=N.next=V,Ne.lanes|=U,Gs|=U;V=L.action,Ta&&i(h,V),h=L.hasEagerState?L.eagerState:i(h,V)}else U={lane:V,revertLane:L.revertLane,gesture:L.gesture,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},N===null?(w=N=U,x=h):N=N.next=U,Ne.lanes|=V,Gs|=V;L=L.next}while(L!==null&&L!==n);if(N===null?x=h:N.next=w,!ln(h,e.memoizedState)&&(Nt=!0,F&&(i=ri,i!==null)))throw i;e.memoizedState=h,e.baseState=x,e.baseQueue=N,o.lastRenderedState=h}return f===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function pu(e){var n=wt(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var o=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);ln(h,n.memoizedState)||(Nt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,o]}function eh(e,n,i){var o=Ne,f=wt(),h=$e;if(h){if(i===void 0)throw Error(r(407));i=i()}else i=n();var x=!ln((at||f).memoizedState,i);if(x&&(f.memoizedState=i,Nt=!0),f=f.queue,gu(sh.bind(null,o,f,e),[e]),f.getSnapshot!==n||x||Et!==null&&Et.memoizedState.tag&1){if(o.flags|=2048,fi(9,{destroy:void 0},nh.bind(null,o,f,i,n),null),ct===null)throw Error(r(349));h||(ps&127)!==0||th(o,n,i)}return i}function th(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Ne.updateQueue,n===null?(n=Wl(),Ne.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function nh(e,n,i,o){n.value=i,n.getSnapshot=o,ah(n)&&ih(e)}function sh(e,n,i){return i(function(){ah(n)&&ih(e)})}function ah(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!ln(e,i)}catch{return!0}}function ih(e){var n=xa(e,2);n!==null&&tn(n,e,2)}function hu(e){var n=Wt();if(typeof e=="function"){var i=e;if(e=i(),Ta){Bn(!0);try{i()}finally{Bn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},n}function rh(e,n,i,o){return e.baseState=i,fu(e,at,typeof o=="function"?o:hs)}function tv(e,n,i,o,f){if(Xl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};$.T!==null?i(!0):h.isTransition=!1,o(h),i=n.pending,i===null?(h.next=n.pending=h,lh(n,h)):(h.next=i.next,n.pending=i.next=h)}}function lh(e,n){var i=n.action,o=n.payload,f=e.state;if(n.isTransition){var h=$.T,x={};$.T=x;try{var w=i(f,o),N=$.S;N!==null&&N(x,w),oh(e,n,w)}catch(L){mu(e,n,L)}finally{h!==null&&x.types!==null&&(h.types=x.types),$.T=h}}else try{h=i(f,o),oh(e,n,h)}catch(L){mu(e,n,L)}}function oh(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(o){ch(e,n,o)},function(o){return mu(e,n,o)}):ch(e,n,i)}function ch(e,n,i){n.status="fulfilled",n.value=i,uh(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,lh(e,i)))}function mu(e,n,i){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=i,uh(n),n=n.next;while(n!==o)}e.action=null}function uh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function dh(e,n){return n}function fh(e,n){if($e){var i=ct.formState;if(i!==null){e:{var o=Ne;if($e){if(ut){t:{for(var f=ut,h=Cn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Nn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){ut=Nn(f.nextSibling),o=f.data==="F!";break e}}Ds(o)}o=!1}o&&(n=i[0])}}return i=Wt(),i.memoizedState=i.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dh,lastRenderedState:n},i.queue=o,i=Rh.bind(null,Ne,o),o.dispatch=i,o=hu(!1),h=Su.bind(null,Ne,!1,o.queue),o=Wt(),f={state:n,dispatch:null,action:e,pending:null},o.queue=f,i=tv.bind(null,Ne,f,h,i),f.dispatch=i,o.memoizedState=e,[n,i,!1]}function ph(e){var n=wt();return hh(n,at,e)}function hh(e,n,i){if(n=fu(e,n,dh)[0],e=Yl(hs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=xr(n)}catch(x){throw x===li?$l:x}else o=n;n=wt();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(Ne.flags|=2048,fi(9,{destroy:void 0},nv.bind(null,f,i),null)),[o,h,e]}function nv(e,n){e.action=n}function mh(e){var n=wt(),i=at;if(i!==null)return hh(n,i,e);wt(),n=n.memoizedState,i=wt();var o=i.queue.dispatch;return i.memoizedState=e,[n,o,!1]}function fi(e,n,i,o){return e={tag:e,create:i,deps:o,inst:n,next:null},n=Ne.updateQueue,n===null&&(n=Wl(),Ne.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(o=i.next,i.next=e,e.next=o,n.lastEffect=e),e}function gh(){return wt().memoizedState}function Zl(e,n,i,o){var f=Wt();Ne.flags|=e,f.memoizedState=fi(1|n,{destroy:void 0},i,o===void 0?null:o)}function Ql(e,n,i,o){var f=wt();o=o===void 0?null:o;var h=f.memoizedState.inst;at!==null&&o!==null&&ru(o,at.memoizedState.deps)?f.memoizedState=fi(n,h,i,o):(Ne.flags|=e,f.memoizedState=fi(1|n,h,i,o))}function yh(e,n){Zl(8390656,8,e,n)}function gu(e,n){Ql(2048,8,e,n)}function sv(e){Ne.flags|=4;var n=Ne.updateQueue;if(n===null)n=Wl(),Ne.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function bh(e){var n=wt().memoizedState;return sv({ref:n,nextImpl:e}),function(){if((Xe&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function xh(e,n){return Ql(4,2,e,n)}function vh(e,n){return Ql(4,4,e,n)}function Sh(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function kh(e,n,i){i=i!=null?i.concat([e]):null,Ql(4,4,Sh.bind(null,n,e),i)}function yu(){}function wh(e,n){var i=wt();n=n===void 0?null:n;var o=i.memoizedState;return n!==null&&ru(n,o[1])?o[0]:(i.memoizedState=[e,n],e)}function _h(e,n){var i=wt();n=n===void 0?null:n;var o=i.memoizedState;if(n!==null&&ru(n,o[1]))return o[0];if(o=e(),Ta){Bn(!0);try{e()}finally{Bn(!1)}}return i.memoizedState=[o,n],o}function bu(e,n,i){return i===void 0||(ps&1073741824)!==0&&(Le&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=Cm(),Ne.lanes|=e,Gs|=e,i)}function Ch(e,n,i,o){return ln(i,n)?i:ci.current!==null?(e=bu(e,i,o),ln(e,n)||(Nt=!0),e):(ps&42)===0||(ps&1073741824)!==0&&(Le&261930)===0?(Nt=!0,e.memoizedState=i):(e=Cm(),Ne.lanes|=e,Gs|=e,n)}function Eh(e,n,i,o,f){var h=X.p;X.p=h!==0&&8>h?h:8;var x=$.T,w={};$.T=w,Su(e,!1,n,i);try{var N=f(),L=$.S;if(L!==null&&L(w,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var F=Xx(N,o);vr(e,n,F,pn(e))}else vr(e,n,o,pn(e))}catch(V){vr(e,n,{then:function(){},status:"rejected",reason:V},pn())}finally{X.p=h,x!==null&&w.types!==null&&(x.types=w.types),$.T=x}}function av(){}function xu(e,n,i,o){if(e.tag!==5)throw Error(r(476));var f=Nh(e).queue;Eh(e,f,n,ne,i===null?av:function(){return Th(e),i(o)})}function Nh(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:ne},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Th(e){var n=Nh(e);n.next===null&&(n=e.alternate.memoizedState),vr(e,n.next.queue,{},pn())}function vu(){return Ut(zr)}function Ah(){return wt().memoizedState}function jh(){return wt().memoizedState}function iv(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=pn();e=Us(i);var o=$s(n,e,i);o!==null&&(tn(o,n,i),mr(o,n,i)),n={cache:Yc()},e.payload=n;return}n=n.return}}function rv(e,n,i){var o=pn();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Xl(e)?Oh(n,i):(i=Uc(e,n,i,o),i!==null&&(tn(i,e,o),Mh(i,n,o)))}function Rh(e,n,i){var o=pn();vr(e,n,i,o)}function vr(e,n,i,o){var f={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xl(e))Oh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,w=h(x,i);if(f.hasEagerState=!0,f.eagerState=w,ln(w,x))return Ol(e,n,f,0),ct===null&&Rl(),!1}catch{}finally{}if(i=Uc(e,n,f,o),i!==null)return tn(i,e,o),Mh(i,n,o),!0}return!1}function Su(e,n,i,o){if(o={lane:2,revertLane:Ju(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Xl(e)){if(n)throw Error(r(479))}else n=Uc(e,i,o,2),n!==null&&tn(n,e,2)}function Xl(e){var n=e.alternate;return e===Ne||n!==null&&n===Ne}function Oh(e,n){ui=ql=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Mh(e,n,i){if((i&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,Ki(e,i)}}var Sr={readContext:Ut,use:Kl,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};Sr.useEffectEvent=xt;var Bh={readContext:Ut,use:Kl,useCallback:function(e,n){return Wt().memoizedState=[e,n===void 0?null:n],e},useContext:Ut,useEffect:yh,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Zl(4194308,4,Sh.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Zl(4194308,4,e,n)},useInsertionEffect:function(e,n){Zl(4,2,e,n)},useMemo:function(e,n){var i=Wt();n=n===void 0?null:n;var o=e();if(Ta){Bn(!0);try{e()}finally{Bn(!1)}}return i.memoizedState=[o,n],o},useReducer:function(e,n,i){var o=Wt();if(i!==void 0){var f=i(n);if(Ta){Bn(!0);try{i(n)}finally{Bn(!1)}}}else f=n;return o.memoizedState=o.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},o.queue=e,e=e.dispatch=rv.bind(null,Ne,e),[o.memoizedState,e]},useRef:function(e){var n=Wt();return e={current:e},n.memoizedState=e},useState:function(e){e=hu(e);var n=e.queue,i=Rh.bind(null,Ne,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:yu,useDeferredValue:function(e,n){var i=Wt();return bu(i,e,n)},useTransition:function(){var e=hu(!1);return e=Eh.bind(null,Ne,e.queue,!0,!1),Wt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var o=Ne,f=Wt();if($e){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),ct===null)throw Error(r(349));(Le&127)!==0||th(o,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,yh(sh.bind(null,o,h,e),[e]),o.flags|=2048,fi(9,{destroy:void 0},nh.bind(null,o,h,i,n),null),i},useId:function(){var e=Wt(),n=ct.identifierPrefix;if($e){var i=Gn,o=Fn;i=(o&~(1<<32-Vt(o)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Vl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=Jx++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:vu,useFormState:fh,useActionState:fh,useOptimistic:function(e){var n=Wt();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=Su.bind(null,Ne,!0,i),i.dispatch=n,[e,n]},useMemoCache:du,useCacheRefresh:function(){return Wt().memoizedState=iv.bind(null,Ne)},useEffectEvent:function(e){var n=Wt(),i={impl:e};return n.memoizedState=i,function(){if((Xe&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},ku={readContext:Ut,use:Kl,useCallback:wh,useContext:Ut,useEffect:gu,useImperativeHandle:kh,useInsertionEffect:xh,useLayoutEffect:vh,useMemo:_h,useReducer:Yl,useRef:gh,useState:function(){return Yl(hs)},useDebugValue:yu,useDeferredValue:function(e,n){var i=wt();return Ch(i,at.memoizedState,e,n)},useTransition:function(){var e=Yl(hs)[0],n=wt().memoizedState;return[typeof e=="boolean"?e:xr(e),n]},useSyncExternalStore:eh,useId:Ah,useHostTransitionStatus:vu,useFormState:ph,useActionState:ph,useOptimistic:function(e,n){var i=wt();return rh(i,at,e,n)},useMemoCache:du,useCacheRefresh:jh};ku.useEffectEvent=bh;var Dh={readContext:Ut,use:Kl,useCallback:wh,useContext:Ut,useEffect:gu,useImperativeHandle:kh,useInsertionEffect:xh,useLayoutEffect:vh,useMemo:_h,useReducer:pu,useRef:gh,useState:function(){return pu(hs)},useDebugValue:yu,useDeferredValue:function(e,n){var i=wt();return at===null?bu(i,e,n):Ch(i,at.memoizedState,e,n)},useTransition:function(){var e=pu(hs)[0],n=wt().memoizedState;return[typeof e=="boolean"?e:xr(e),n]},useSyncExternalStore:eh,useId:Ah,useHostTransitionStatus:vu,useFormState:mh,useActionState:mh,useOptimistic:function(e,n){var i=wt();return at!==null?rh(i,at,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:du,useCacheRefresh:jh};Dh.useEffectEvent=bh;function wu(e,n,i,o){n=e.memoizedState,i=i(o,n),i=i==null?n:b({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var _u={enqueueSetState:function(e,n,i){e=e._reactInternals;var o=pn(),f=Us(o);f.payload=n,i!=null&&(f.callback=i),n=$s(e,f,o),n!==null&&(tn(n,e,o),mr(n,e,o))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var o=pn(),f=Us(o);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=$s(e,f,o),n!==null&&(tn(n,e,o),mr(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=pn(),o=Us(i);o.tag=2,n!=null&&(o.callback=n),n=$s(e,o,i),n!==null&&(tn(n,e,i),mr(n,e,i))}};function Lh(e,n,i,o,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,x):n.prototype&&n.prototype.isPureReactComponent?!lr(i,o)||!lr(f,h):!0}function zh(e,n,i,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,o),n.state!==e&&_u.enqueueReplaceState(n,n.state,null)}function Aa(e,n){var i=n;if("ref"in n){i={};for(var o in n)o!=="ref"&&(i[o]=n[o])}if(e=e.defaultProps){i===n&&(i=b({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function Uh(e){jl(e)}function $h(e){console.error(e)}function Hh(e){jl(e)}function Jl(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Ih(e,n,i){try{var o=e.onCaughtError;o(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Cu(e,n,i){return i=Us(i),i.tag=3,i.payload={element:null},i.callback=function(){Jl(e,n)},i}function Ph(e){return e=Us(e),e.tag=3,e}function Fh(e,n,i,o){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var h=o.value;e.payload=function(){return f(h)},e.callback=function(){Ih(n,i,o)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Ih(n,i,o),typeof f!="function"&&(qs===null?qs=new Set([this]):qs.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})})}function lv(e,n,i,o,f){if(i.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=i.alternate,n!==null&&ai(n,i,f,!0),i=cn.current,i!==null){switch(i.tag){case 31:case 13:return En===null?fo():i.alternate===null&&vt===0&&(vt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,o===Hl?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([o]):n.add(o),Zu(e,o,f)),!1;case 22:return i.flags|=65536,o===Hl?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([o]):i.add(o)),Zu(e,o,f)),!1}throw Error(r(435,i.tag))}return Zu(e,o,f),fo(),!1}if($e)return n=cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,o!==Gc&&(e=Error(r(422),{cause:o}),ur(kn(e,i)))):(o!==Gc&&(n=Error(r(423),{cause:o}),ur(kn(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,o=kn(o,i),f=Cu(e.stateNode,o,f),tu(e,f),vt!==4&&(vt=2)),!1;var h=Error(r(520),{cause:o});if(h=kn(h,i),Ar===null?Ar=[h]:Ar.push(h),vt!==4&&(vt=2),n===null)return!0;o=kn(o,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=f&-f,i.lanes|=e,e=Cu(i.stateNode,o,e),tu(i,e),!1;case 1:if(n=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(qs===null||!qs.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=Ph(f),Fh(f,e,i,o),tu(i,f),!1}i=i.return}while(i!==null);return!1}var Eu=Error(r(461)),Nt=!1;function $t(e,n,i,o){n.child=e===null?Wp(n,null,i,o):Na(n,e.child,i,o)}function Gh(e,n,i,o,f){i=i.render;var h=n.ref;if("ref"in o){var x={};for(var w in o)w!=="ref"&&(x[w]=o[w])}else x=o;return wa(n),o=lu(e,n,i,x,h,f),w=ou(),e!==null&&!Nt?(cu(e,n,f),ms(e,n,f)):($e&&w&&Pc(n),n.flags|=1,$t(e,n,o,f),n.child)}function qh(e,n,i,o,f){if(e===null){var h=i.type;return typeof h=="function"&&!$c(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,Vh(e,n,h,o,f)):(e=Bl(i.type,null,o,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Bu(e,f)){var x=h.memoizedProps;if(i=i.compare,i=i!==null?i:lr,i(x,o)&&e.ref===n.ref)return ms(e,n,f)}return n.flags|=1,e=cs(h,o),e.ref=n.ref,e.return=n,n.child=e}function Vh(e,n,i,o,f){if(e!==null){var h=e.memoizedProps;if(lr(h,o)&&e.ref===n.ref)if(Nt=!1,n.pendingProps=o=h,Bu(e,f))(e.flags&131072)!==0&&(Nt=!0);else return n.lanes=e.lanes,ms(e,n,f)}return Nu(e,n,i,o,f)}function Wh(e,n,i,o){var f=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(o=n.child=e.child,f=0;o!==null;)f=f|o.lanes|o.childLanes,o=o.sibling;o=f&~h}else o=0,n.child=null;return Kh(e,n,h,i,o)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ul(n,h!==null?h.cachePool:null),h!==null?Zp(n,h):su(),Qp(n);else return o=n.lanes=536870912,Kh(e,n,h!==null?h.baseLanes|i:i,i,o)}else h!==null?(Ul(n,h.cachePool),Zp(n,h),Is(),n.memoizedState=null):(e!==null&&Ul(n,null),su(),Is());return $t(e,n,f,i),n.child}function kr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Kh(e,n,i,o,f){var h=Qc();return h=h===null?null:{parent:Ct._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&Ul(n,null),su(),Qp(n),e!==null&&ai(e,n,o,!0),n.childLanes=f,null}function eo(e,n){return n=no({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Yh(e,n,i){return Na(n,e.child,null,i),e=eo(n,n.pendingProps),e.flags|=2,un(n),n.memoizedState=null,e}function ov(e,n,i){var o=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if($e){if(o.mode==="hidden")return e=eo(n,o),n.lanes=536870912,kr(null,e);if(iu(n),(e=ut)?(e=lg(e,Cn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ms!==null?{id:Fn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},i=Op(e),i.return=n,n.child=i,zt=n,ut=null)):e=null,e===null)throw Ds(n);return n.lanes=536870912,null}return eo(n,o)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(iu(n),f)if(n.flags&256)n.flags&=-257,n=Yh(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Nt||ai(e,n,i,!1),f=(i&e.childLanes)!==0,Nt||f){if(o=ct,o!==null&&(x=Yi(o,i),x!==0&&x!==h.retryLane))throw h.retryLane=x,xa(e,x),tn(o,e,x),Eu;fo(),n=Yh(e,n,i)}else e=h.treeContext,ut=Nn(x.nextSibling),zt=n,$e=!0,Bs=null,Cn=!1,e!==null&&Dp(n,e),n=eo(n,o),n.flags|=4096;return n}return e=cs(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function to(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function Nu(e,n,i,o,f){return wa(n),i=lu(e,n,i,o,void 0,f),o=ou(),e!==null&&!Nt?(cu(e,n,f),ms(e,n,f)):($e&&o&&Pc(n),n.flags|=1,$t(e,n,i,f),n.child)}function Zh(e,n,i,o,f,h){return wa(n),n.updateQueue=null,i=Jp(n,o,i,f),Xp(e),o=ou(),e!==null&&!Nt?(cu(e,n,h),ms(e,n,h)):($e&&o&&Pc(n),n.flags|=1,$t(e,n,i,h),n.child)}function Qh(e,n,i,o,f){if(wa(n),n.stateNode===null){var h=ei,x=i.contextType;typeof x=="object"&&x!==null&&(h=Ut(x)),h=new i(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=_u,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},Jc(n),x=i.contextType,h.context=typeof x=="object"&&x!==null?Ut(x):ei,h.state=n.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(wu(n,i,x,o),h.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&_u.enqueueReplaceState(h,h.state,null),yr(n,o,h,f),gr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,N=Aa(i,w);h.props=N;var L=h.context,F=i.contextType;x=ei,typeof F=="object"&&F!==null&&(x=Ut(F));var V=i.getDerivedStateFromProps;F=typeof V=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,F||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||L!==x)&&zh(n,h,o,x),zs=!1;var U=n.memoizedState;h.state=U,yr(n,o,h,f),gr(),L=n.memoizedState,w||U!==L||zs?(typeof V=="function"&&(wu(n,i,V,o),L=n.memoizedState),(N=zs||Lh(n,i,N,o,U,L,x))?(F||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=L),h.props=o,h.state=L,h.context=x,o=N):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,eu(e,n),x=n.memoizedProps,F=Aa(i,x),h.props=F,V=n.pendingProps,U=h.context,L=i.contextType,N=ei,typeof L=="object"&&L!==null&&(N=Ut(L)),w=i.getDerivedStateFromProps,(L=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==V||U!==N)&&zh(n,h,o,N),zs=!1,U=n.memoizedState,h.state=U,yr(n,o,h,f),gr();var I=n.memoizedState;x!==V||U!==I||zs||e!==null&&e.dependencies!==null&&Ll(e.dependencies)?(typeof w=="function"&&(wu(n,i,w,o),I=n.memoizedState),(F=zs||Lh(n,i,F,o,U,I,N)||e!==null&&e.dependencies!==null&&Ll(e.dependencies))?(L||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,I,N),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,I,N)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=I),h.props=o,h.state=I,h.context=N,o=F):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,to(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,i=o&&typeof i.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Na(n,e.child,null,f),n.child=Na(n,null,i,f)):$t(e,n,i,f),n.memoizedState=h.state,e=n.child):e=ms(e,n,f),e}function Xh(e,n,i,o){return Sa(),n.flags|=256,$t(e,n,i,o),n.child}var Tu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Au(e){return{baseLanes:e,cachePool:Ip()}}function ju(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=fn),e}function Jh(e,n,i){var o=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(kt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if($e){if(f?Hs(n):Is(),(e=ut)?(e=lg(e,Cn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Ms!==null?{id:Fn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},i=Op(e),i.return=n,n.child=i,zt=n,ut=null)):e=null,e===null)throw Ds(n);return fd(e)?n.lanes=32:n.lanes=536870912,null}var w=o.children;return o=o.fallback,f?(Is(),f=n.mode,w=no({mode:"hidden",children:w},f),o=va(o,f,i,null),w.return=n,o.return=n,w.sibling=o,n.child=w,o=n.child,o.memoizedState=Au(i),o.childLanes=ju(e,x,i),n.memoizedState=Tu,kr(null,o)):(Hs(n),Ru(n,w))}var N=e.memoizedState;if(N!==null&&(w=N.dehydrated,w!==null)){if(h)n.flags&256?(Hs(n),n.flags&=-257,n=Ou(e,n,i)):n.memoizedState!==null?(Is(),n.child=e.child,n.flags|=128,n=null):(Is(),w=o.fallback,f=n.mode,o=no({mode:"visible",children:o.children},f),w=va(w,f,i,null),w.flags|=2,o.return=n,w.return=n,o.sibling=w,n.child=o,Na(n,e.child,null,i),o=n.child,o.memoizedState=Au(i),o.childLanes=ju(e,x,i),n.memoizedState=Tu,n=kr(null,o));else if(Hs(n),fd(w)){if(x=w.nextSibling&&w.nextSibling.dataset,x)var L=x.dgst;x=L,o=Error(r(419)),o.stack="",o.digest=x,ur({value:o,source:null,stack:null}),n=Ou(e,n,i)}else if(Nt||ai(e,n,i,!1),x=(i&e.childLanes)!==0,Nt||x){if(x=ct,x!==null&&(o=Yi(x,i),o!==0&&o!==N.retryLane))throw N.retryLane=o,xa(e,o),tn(x,e,o),Eu;dd(w)||fo(),n=Ou(e,n,i)}else dd(w)?(n.flags|=192,n.child=e.child,n=null):(e=N.treeContext,ut=Nn(w.nextSibling),zt=n,$e=!0,Bs=null,Cn=!1,e!==null&&Dp(n,e),n=Ru(n,o.children),n.flags|=4096);return n}return f?(Is(),w=o.fallback,f=n.mode,N=e.child,L=N.sibling,o=cs(N,{mode:"hidden",children:o.children}),o.subtreeFlags=N.subtreeFlags&65011712,L!==null?w=cs(L,w):(w=va(w,f,i,null),w.flags|=2),w.return=n,o.return=n,o.sibling=w,n.child=o,kr(null,o),o=n.child,w=e.child.memoizedState,w===null?w=Au(i):(f=w.cachePool,f!==null?(N=Ct._currentValue,f=f.parent!==N?{parent:N,pool:N}:f):f=Ip(),w={baseLanes:w.baseLanes|i,cachePool:f}),o.memoizedState=w,o.childLanes=ju(e,x,i),n.memoizedState=Tu,kr(e.child,o)):(Hs(n),i=e.child,e=i.sibling,i=cs(i,{mode:"visible",children:o.children}),i.return=n,i.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=i,n.memoizedState=null,i)}function Ru(e,n){return n=no({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function no(e,n){return e=on(22,e,null,n),e.lanes=0,e}function Ou(e,n,i){return Na(n,e.child,null,i),e=Ru(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function em(e,n,i){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Wc(e.return,n,i)}function Mu(e,n,i,o,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=i,x.tailMode=f,x.treeForkCount=h)}function tm(e,n,i){var o=n.pendingProps,f=o.revealOrder,h=o.tail;o=o.children;var x=kt.current,w=(x&2)!==0;if(w?(x=x&1|2,n.flags|=128):x&=1,Ee(kt,x),$t(e,n,o,i),o=$e?cr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&em(e,i,n);else if(e.tag===19)em(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(i=n.child,f=null;i!==null;)e=i.alternate,e!==null&&Gl(e)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),Mu(n,!1,f,i,h,o);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Gl(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}Mu(n,!0,i,null,h,o);break;case"together":Mu(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function ms(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Gs|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(ai(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=cs(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=cs(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Bu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ll(e)))}function cv(e,n,i){switch(n.tag){case 3:sn(n,n.stateNode.containerInfo),Ls(n,Ct,e.memoizedState.cache),Sa();break;case 27:case 5:Jn(n);break;case 4:sn(n,n.stateNode.containerInfo);break;case 10:Ls(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,iu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Hs(n),n.flags|=128,null):(i&n.child.childLanes)!==0?Jh(e,n,i):(Hs(n),e=ms(e,n,i),e!==null?e.sibling:null);Hs(n);break;case 19:var f=(e.flags&128)!==0;if(o=(i&n.childLanes)!==0,o||(ai(e,n,i,!1),o=(i&n.childLanes)!==0),f){if(o)return tm(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ee(kt,kt.current),o)break;return null;case 22:return n.lanes=0,Wh(e,n,i,n.pendingProps);case 24:Ls(n,Ct,e.memoizedState.cache)}return ms(e,n,i)}function nm(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Nt=!0;else{if(!Bu(e,i)&&(n.flags&128)===0)return Nt=!1,cv(e,n,i);Nt=(e.flags&131072)!==0}else Nt=!1,$e&&(n.flags&1048576)!==0&&Bp(n,cr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Ca(n.elementType),n.type=e,typeof e=="function")$c(e)?(o=Aa(e,o),n.tag=1,n=Qh(null,n,e,o,i)):(n.tag=0,n=Nu(null,n,e,o,i));else{if(e!=null){var f=e.$$typeof;if(f===z){n.tag=11,n=Gh(null,n,e,o,i);break e}else if(f===Q){n.tag=14,n=qh(null,n,e,o,i);break e}}throw n=K(e)||e,Error(r(306,n,""))}}return n;case 0:return Nu(e,n,n.type,n.pendingProps,i);case 1:return o=n.type,f=Aa(o,n.pendingProps),Qh(e,n,o,f,i);case 3:e:{if(sn(n,n.stateNode.containerInfo),e===null)throw Error(r(387));o=n.pendingProps;var h=n.memoizedState;f=h.element,eu(e,n),yr(n,o,null,i);var x=n.memoizedState;if(o=x.cache,Ls(n,Ct,o),o!==h.cache&&Kc(n,[Ct],i,!0),gr(),o=x.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=Xh(e,n,o,i);break e}else if(o!==f){f=kn(Error(r(424)),n),ur(f),n=Xh(e,n,o,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ut=Nn(e.firstChild),zt=n,$e=!0,Bs=null,Cn=!0,i=Wp(n,null,o,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Sa(),o===f){n=ms(e,n,i);break e}$t(e,n,o,i)}n=n.child}return n;case 26:return to(e,n),e===null?(i=pg(n.type,null,n.pendingProps,null))?n.memoizedState=i:$e||(i=n.type,e=n.pendingProps,o=xo(Kt.current).createElement(i),o[jt]=n,o[Gt]=e,Ht(o,i,e),ie(o),n.stateNode=o):n.memoizedState=pg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Jn(n),e===null&&$e&&(o=n.stateNode=ug(n.type,n.pendingProps,Kt.current),zt=n,Cn=!0,f=ut,Ys(n.type)?(pd=f,ut=Nn(o.firstChild)):ut=f),$t(e,n,n.pendingProps.children,i),to(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&$e&&((f=o=ut)&&(o=$v(o,n.type,n.pendingProps,Cn),o!==null?(n.stateNode=o,zt=n,ut=Nn(o.firstChild),Cn=!1,f=!0):f=!1),f||Ds(n)),Jn(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,o=h.children,od(f,h)?o=null:x!==null&&od(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=lu(e,n,ev,null,null,i),zr._currentValue=f),to(e,n),$t(e,n,o,i),n.child;case 6:return e===null&&$e&&((e=i=ut)&&(i=Hv(i,n.pendingProps,Cn),i!==null?(n.stateNode=i,zt=n,ut=null,e=!0):e=!1),e||Ds(n)),null;case 13:return Jh(e,n,i);case 4:return sn(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Na(n,null,o,i):$t(e,n,o,i),n.child;case 11:return Gh(e,n,n.type,n.pendingProps,i);case 7:return $t(e,n,n.pendingProps,i),n.child;case 8:return $t(e,n,n.pendingProps.children,i),n.child;case 12:return $t(e,n,n.pendingProps.children,i),n.child;case 10:return o=n.pendingProps,Ls(n,n.type,o.value),$t(e,n,o.children,i),n.child;case 9:return f=n.type._context,o=n.pendingProps.children,wa(n),f=Ut(f),o=o(f),n.flags|=1,$t(e,n,o,i),n.child;case 14:return qh(e,n,n.type,n.pendingProps,i);case 15:return Vh(e,n,n.type,n.pendingProps,i);case 19:return tm(e,n,i);case 31:return ov(e,n,i);case 22:return Wh(e,n,i,n.pendingProps);case 24:return wa(n),o=Ut(Ct),e===null?(f=Qc(),f===null&&(f=ct,h=Yc(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:o,cache:f},Jc(n),Ls(n,Ct,f)):((e.lanes&i)!==0&&(eu(e,n),yr(n,null,null,i),gr()),f=e.memoizedState,h=n.memoizedState,f.parent!==o?(f={parent:o,cache:o},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Ls(n,Ct,o)):(o=h.cache,Ls(n,Ct,o),o!==f.cache&&Kc(n,[Ct],i,!0))),$t(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function gs(e){e.flags|=4}function Du(e,n,i,o,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Am())e.flags|=8192;else throw Ea=Hl,Xc}else e.flags&=-16777217}function sm(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!bg(n))if(Am())e.flags|=8192;else throw Ea=Hl,Xc}function so(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?as():536870912,e.lanes|=n,gi|=n)}function wr(e,n){if(!$e)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function dt(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,o=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,o|=f.subtreeFlags&65011712,o|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,o|=f.subtreeFlags,o|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=o,e.childLanes=i,n}function uv(e,n,i){var o=n.pendingProps;switch(Fc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(n),null;case 1:return dt(n),null;case 3:return i=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),fs(Ct),bn(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(si(n)?gs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,qc())),dt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(gs(n),h!==null?(dt(n),sm(n,h)):(dt(n),Du(n,f,null,o,i))):h?h!==e.memoizedState?(gs(n),dt(n),sm(n,h)):(dt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&gs(n),dt(n),Du(n,f,e,o,i)),null;case 27:if(Y(n),i=Kt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&gs(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return dt(n),null}e=nt.current,si(n)?Lp(n):(e=ug(f,o,i),n.stateNode=e,gs(n))}return dt(n),null;case 5:if(Y(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&gs(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return dt(n),null}if(h=nt.current,si(n))Lp(n);else{var x=xo(Kt.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?x.createElement(f,{is:o.is}):x.createElement(f)}}h[jt]=n,h[Gt]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Ht(h,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&gs(n)}}return dt(n),Du(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&gs(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(r(166));if(e=Kt.current,si(n)){if(e=n.stateNode,i=n.memoizedProps,o=null,f=zt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}e[jt]=n,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||Jm(e.nodeValue,i)),e||Ds(n,!0)}else e=xo(e).createTextNode(o),e[jt]=n,n.stateNode=e}return dt(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(o=si(n),i!==null){if(e===null){if(!o)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[jt]=n}else Sa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dt(n),e=!1}else i=qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(un(n),n):(un(n),null);if((n.flags&128)!==0)throw Error(r(558))}return dt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=si(n),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[jt]=n}else Sa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dt(n),f=!1}else f=qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(un(n),n):(un(n),null)}return un(n),(n.flags&128)!==0?(n.lanes=i,n):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==f&&(o.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),so(n,n.updateQueue),dt(n),null);case 4:return bn(),e===null&&sd(n.stateNode.containerInfo),dt(n),null;case 10:return fs(n.type),dt(n),null;case 19:if(je(kt),o=n.memoizedState,o===null)return dt(n),null;if(f=(n.flags&128)!==0,h=o.rendering,h===null)if(f)wr(o,!1);else{if(vt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Gl(e),h!==null){for(n.flags|=128,wr(o,!1),e=h.updateQueue,n.updateQueue=e,so(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)Rp(i,e),i=i.sibling;return Ee(kt,kt.current&1|2),$e&&us(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&Dt()>oo&&(n.flags|=128,f=!0,wr(o,!1),n.lanes=4194304)}else{if(!f)if(e=Gl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,so(n,e),wr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!$e)return dt(n),null}else 2*Dt()-o.renderingStartTime>oo&&i!==536870912&&(n.flags|=128,f=!0,wr(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Dt(),e.sibling=null,i=kt.current,Ee(kt,f?i&1|2:i&1),$e&&us(n,o.treeForkCount),e):(dt(n),null);case 22:case 23:return un(n),au(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(i&536870912)!==0&&(n.flags&128)===0&&(dt(n),n.subtreeFlags&6&&(n.flags|=8192)):dt(n),i=n.updateQueue,i!==null&&so(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==i&&(n.flags|=2048),e!==null&&je(_a),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),fs(Ct),dt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function dv(e,n){switch(Fc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return fs(Ct),bn(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Y(n),null;case 31:if(n.memoizedState!==null){if(un(n),n.alternate===null)throw Error(r(340));Sa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(un(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Sa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return je(kt),null;case 4:return bn(),null;case 10:return fs(n.type),null;case 22:case 23:return un(n),au(),e!==null&&je(_a),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return fs(Ct),null;case 25:return null;default:return null}}function am(e,n){switch(Fc(n),n.tag){case 3:fs(Ct),bn();break;case 26:case 27:case 5:Y(n);break;case 4:bn();break;case 31:n.memoizedState!==null&&un(n);break;case 13:un(n);break;case 19:je(kt);break;case 10:fs(n.type);break;case 22:case 23:un(n),au(),e!==null&&je(_a);break;case 24:fs(Ct)}}function _r(e,n){try{var i=n.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var f=o.next;i=f;do{if((i.tag&e)===e){o=void 0;var h=i.create,x=i.inst;o=h(),x.destroy=o}i=i.next}while(i!==f)}}catch(w){tt(n,n.return,w)}}function Ps(e,n,i){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var h=f.next;o=h;do{if((o.tag&e)===e){var x=o.inst,w=x.destroy;if(w!==void 0){x.destroy=void 0,f=n;var N=i,L=w;try{L()}catch(F){tt(f,N,F)}}}o=o.next}while(o!==h)}}catch(F){tt(n,n.return,F)}}function im(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Yp(n,i)}catch(o){tt(e,e.return,o)}}}function rm(e,n,i){i.props=Aa(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){tt(e,n,o)}}function Cr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof i=="function"?e.refCleanup=i(o):i.current=o}}catch(f){tt(e,n,f)}}function qn(e,n){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(f){tt(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){tt(e,n,f)}else i.current=null}function lm(e){var n=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(f){tt(e,e.return,f)}}function Lu(e,n,i){try{var o=e.stateNode;Mv(o,e.type,i,n),o[Gt]=n}catch(f){tt(e,e.return,f)}}function om(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ys(e.type)||e.tag===4}function zu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||om(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ys(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Uu(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=ls));else if(o!==4&&(o===27&&Ys(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(Uu(e,n,i),e=e.sibling;e!==null;)Uu(e,n,i),e=e.sibling}function ao(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(o!==4&&(o===27&&Ys(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(ao(e,n,i),e=e.sibling;e!==null;)ao(e,n,i),e=e.sibling}function cm(e){var n=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Ht(n,o,i),n[jt]=e,n[Gt]=i}catch(h){tt(e,e.return,h)}}var ys=!1,Tt=!1,$u=!1,um=typeof WeakSet=="function"?WeakSet:Set,Mt=null;function fv(e,n){if(e=e.containerInfo,rd=Eo,e=kp(e),Oc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var f=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var x=0,w=-1,N=-1,L=0,F=0,V=e,U=null;t:for(;;){for(var I;V!==i||f!==0&&V.nodeType!==3||(w=x+f),V!==h||o!==0&&V.nodeType!==3||(N=x+o),V.nodeType===3&&(x+=V.nodeValue.length),(I=V.firstChild)!==null;)U=V,V=I;for(;;){if(V===e)break t;if(U===i&&++L===f&&(w=x),U===h&&++F===o&&(N=x),(I=V.nextSibling)!==null)break;V=U,U=V.parentNode}V=I}i=w===-1||N===-1?null:{start:w,end:N}}else i=null}i=i||{start:0,end:0}}else i=null;for(ld={focusedElem:e,selectionRange:i},Eo=!1,Mt=n;Mt!==null;)if(n=Mt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Mt=e;else for(;Mt!==null;){switch(n=Mt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)f=e[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,i=n,f=h.memoizedProps,h=h.memoizedState,o=i.stateNode;try{var re=Aa(i.type,f);e=o.getSnapshotBeforeUpdate(re,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(ye){tt(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)ud(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ud(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,Mt=e;break}Mt=n.return}}function dm(e,n,i){var o=i.flags;switch(i.tag){case 0:case 11:case 15:xs(e,i),o&4&&_r(5,i);break;case 1:if(xs(e,i),o&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(x){tt(i,i.return,x)}else{var f=Aa(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){tt(i,i.return,x)}}o&64&&im(i),o&512&&Cr(i,i.return);break;case 3:if(xs(e,i),o&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Yp(e,n)}catch(x){tt(i,i.return,x)}}break;case 27:n===null&&o&4&&cm(i);case 26:case 5:xs(e,i),n===null&&o&4&&lm(i),o&512&&Cr(i,i.return);break;case 12:xs(e,i);break;case 31:xs(e,i),o&4&&hm(e,i);break;case 13:xs(e,i),o&4&&mm(e,i),o&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Sv.bind(null,i),Iv(e,i))));break;case 22:if(o=i.memoizedState!==null||ys,!o){n=n!==null&&n.memoizedState!==null||Tt,f=ys;var h=Tt;ys=o,(Tt=n)&&!h?vs(e,i,(i.subtreeFlags&8772)!==0):xs(e,i),ys=f,Tt=h}break;case 30:break;default:xs(e,i)}}function fm(e){var n=e.alternate;n!==null&&(e.alternate=null,fm(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ma(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var pt=null,Qt=!1;function bs(e,n,i){for(i=i.child;i!==null;)pm(e,n,i),i=i.sibling}function pm(e,n,i){if(Ft&&typeof Ft.onCommitFiberUnmount=="function")try{Ft.onCommitFiberUnmount(es,i)}catch{}switch(i.tag){case 26:Tt||qn(i,n),bs(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Tt||qn(i,n);var o=pt,f=Qt;Ys(i.type)&&(pt=i.stateNode,Qt=!1),bs(e,n,i),Br(i.stateNode),pt=o,Qt=f;break;case 5:Tt||qn(i,n);case 6:if(o=pt,f=Qt,pt=null,bs(e,n,i),pt=o,Qt=f,pt!==null)if(Qt)try{(pt.nodeType===9?pt.body:pt.nodeName==="HTML"?pt.ownerDocument.body:pt).removeChild(i.stateNode)}catch(h){tt(i,n,h)}else try{pt.removeChild(i.stateNode)}catch(h){tt(i,n,h)}break;case 18:pt!==null&&(Qt?(e=pt,ig(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),_i(e)):ig(pt,i.stateNode));break;case 4:o=pt,f=Qt,pt=i.stateNode.containerInfo,Qt=!0,bs(e,n,i),pt=o,Qt=f;break;case 0:case 11:case 14:case 15:Ps(2,i,n),Tt||Ps(4,i,n),bs(e,n,i);break;case 1:Tt||(qn(i,n),o=i.stateNode,typeof o.componentWillUnmount=="function"&&rm(i,n,o)),bs(e,n,i);break;case 21:bs(e,n,i);break;case 22:Tt=(o=Tt)||i.memoizedState!==null,bs(e,n,i),Tt=o;break;default:bs(e,n,i)}}function hm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{_i(e)}catch(i){tt(n,n.return,i)}}}function mm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{_i(e)}catch(i){tt(n,n.return,i)}}function pv(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new um),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new um),n;default:throw Error(r(435,e.tag))}}function io(e,n){var i=pv(e);n.forEach(function(o){if(!i.has(o)){i.add(o);var f=kv.bind(null,e,o);o.then(f,f)}})}function Xt(e,n){var i=n.deletions;if(i!==null)for(var o=0;o<i.length;o++){var f=i[o],h=e,x=n,w=x;e:for(;w!==null;){switch(w.tag){case 27:if(Ys(w.type)){pt=w.stateNode,Qt=!1;break e}break;case 5:pt=w.stateNode,Qt=!1;break e;case 3:case 4:pt=w.stateNode.containerInfo,Qt=!0;break e}w=w.return}if(pt===null)throw Error(r(160));pm(h,x,f),pt=null,Qt=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)gm(n,e),n=n.sibling}var Ln=null;function gm(e,n){var i=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Xt(n,e),Jt(e),o&4&&(Ps(3,e,e.return),_r(3,e),Ps(5,e,e.return));break;case 1:Xt(n,e),Jt(e),o&512&&(Tt||i===null||qn(i,i.return)),o&64&&ys&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?o:i.concat(o))));break;case 26:var f=Ln;if(Xt(n,e),Jt(e),o&512&&(Tt||i===null||qn(i,i.return)),o&4){var h=i!==null?i.memoizedState:null;if(o=e.memoizedState,i===null)if(o===null)if(e.stateNode===null){e:{o=e.type,i=e.memoizedProps,f=f.ownerDocument||f;t:switch(o){case"title":h=f.getElementsByTagName("title")[0],(!h||h[ha]||h[jt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(o),f.head.insertBefore(h,f.querySelector("head > title"))),Ht(h,o,i),h[jt]=e,ie(h),o=h;break e;case"link":var x=gg("link","href",f).get(o+(i.href||""));if(x){for(var w=0;w<x.length;w++)if(h=x[w],h.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&h.getAttribute("rel")===(i.rel==null?null:i.rel)&&h.getAttribute("title")===(i.title==null?null:i.title)&&h.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(w,1);break t}}h=f.createElement(o),Ht(h,o,i),f.head.appendChild(h);break;case"meta":if(x=gg("meta","content",f).get(o+(i.content||""))){for(w=0;w<x.length;w++)if(h=x[w],h.getAttribute("content")===(i.content==null?null:""+i.content)&&h.getAttribute("name")===(i.name==null?null:i.name)&&h.getAttribute("property")===(i.property==null?null:i.property)&&h.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&h.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(w,1);break t}}h=f.createElement(o),Ht(h,o,i),f.head.appendChild(h);break;default:throw Error(r(468,o))}h[jt]=e,ie(h),o=h}e.stateNode=o}else yg(f,e.type,e.stateNode);else e.stateNode=mg(f,o,e.memoizedProps);else h!==o?(h===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):h.count--,o===null?yg(f,e.type,e.stateNode):mg(f,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Lu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Xt(n,e),Jt(e),o&512&&(Tt||i===null||qn(i,i.return)),i!==null&&o&4&&Lu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Xt(n,e),Jt(e),o&512&&(Tt||i===null||qn(i,i.return)),e.flags&32){f=e.stateNode;try{Wa(f,"")}catch(re){tt(e,e.return,re)}}o&4&&e.stateNode!=null&&(f=e.memoizedProps,Lu(e,f,i!==null?i.memoizedProps:f)),o&1024&&($u=!0);break;case 6:if(Xt(n,e),Jt(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,i=e.stateNode;try{i.nodeValue=o}catch(re){tt(e,e.return,re)}}break;case 3:if(ko=null,f=Ln,Ln=vo(n.containerInfo),Xt(n,e),Ln=f,Jt(e),o&4&&i!==null&&i.memoizedState.isDehydrated)try{_i(n.containerInfo)}catch(re){tt(e,e.return,re)}$u&&($u=!1,ym(e));break;case 4:o=Ln,Ln=vo(e.stateNode.containerInfo),Xt(n,e),Jt(e),Ln=o;break;case 12:Xt(n,e),Jt(e);break;case 31:Xt(n,e),Jt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,io(e,o)));break;case 13:Xt(n,e),Jt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(lo=Dt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,io(e,o)));break;case 22:f=e.memoizedState!==null;var N=i!==null&&i.memoizedState!==null,L=ys,F=Tt;if(ys=L||f,Tt=F||N,Xt(n,e),Tt=F,ys=L,Jt(e),o&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(i===null||N||ys||Tt||ja(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){N=i=n;try{if(h=N.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{w=N.stateNode;var V=N.memoizedProps.style,U=V!=null&&V.hasOwnProperty("display")?V.display:null;w.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(re){tt(N,N.return,re)}}}else if(n.tag===6){if(i===null){N=n;try{N.stateNode.nodeValue=f?"":N.memoizedProps}catch(re){tt(N,N.return,re)}}}else if(n.tag===18){if(i===null){N=n;try{var I=N.stateNode;f?rg(I,!0):rg(N.stateNode,!1)}catch(re){tt(N,N.return,re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,io(e,i))));break;case 19:Xt(n,e),Jt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,io(e,o)));break;case 30:break;case 21:break;default:Xt(n,e),Jt(e)}}function Jt(e){var n=e.flags;if(n&2){try{for(var i,o=e.return;o!==null;){if(om(o)){i=o;break}o=o.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var f=i.stateNode,h=zu(e);ao(e,h,f);break;case 5:var x=i.stateNode;i.flags&32&&(Wa(x,""),i.flags&=-33);var w=zu(e);ao(e,w,x);break;case 3:case 4:var N=i.stateNode.containerInfo,L=zu(e);Uu(e,L,N);break;default:throw Error(r(161))}}catch(F){tt(e,e.return,F)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function ym(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;ym(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function xs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)dm(e,n.alternate,n),n=n.sibling}function ja(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ps(4,n,n.return),ja(n);break;case 1:qn(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&rm(n,n.return,i),ja(n);break;case 27:Br(n.stateNode);case 26:case 5:qn(n,n.return),ja(n);break;case 22:n.memoizedState===null&&ja(n);break;case 30:ja(n);break;default:ja(n)}e=e.sibling}}function vs(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:vs(f,h,i),_r(4,h);break;case 1:if(vs(f,h,i),o=h,f=o.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(L){tt(o,o.return,L)}if(o=h,f=o.updateQueue,f!==null){var w=o.stateNode;try{var N=f.shared.hiddenCallbacks;if(N!==null)for(f.shared.hiddenCallbacks=null,f=0;f<N.length;f++)Kp(N[f],w)}catch(L){tt(o,o.return,L)}}i&&x&64&&im(h),Cr(h,h.return);break;case 27:cm(h);case 26:case 5:vs(f,h,i),i&&o===null&&x&4&&lm(h),Cr(h,h.return);break;case 12:vs(f,h,i);break;case 31:vs(f,h,i),i&&x&4&&hm(f,h);break;case 13:vs(f,h,i),i&&x&4&&mm(f,h);break;case 22:h.memoizedState===null&&vs(f,h,i),Cr(h,h.return);break;case 30:break;default:vs(f,h,i)}n=n.sibling}}function Hu(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&dr(i))}function Iu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e))}function zn(e,n,i,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)bm(e,n,i,o),n=n.sibling}function bm(e,n,i,o){var f=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n,i,o),f&2048&&_r(9,n);break;case 1:zn(e,n,i,o);break;case 3:zn(e,n,i,o),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e)));break;case 12:if(f&2048){zn(e,n,i,o),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,w=h.onPostCommit;typeof w=="function"&&w(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){tt(n,n.return,N)}}else zn(e,n,i,o);break;case 31:zn(e,n,i,o);break;case 13:zn(e,n,i,o);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?zn(e,n,i,o):Er(e,n):h._visibility&2?zn(e,n,i,o):(h._visibility|=2,pi(e,n,i,o,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Hu(x,n);break;case 24:zn(e,n,i,o),f&2048&&Iu(n.alternate,n);break;default:zn(e,n,i,o)}}function pi(e,n,i,o,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,w=i,N=o,L=x.flags;switch(x.tag){case 0:case 11:case 15:pi(h,x,w,N,f),_r(8,x);break;case 23:break;case 22:var F=x.stateNode;x.memoizedState!==null?F._visibility&2?pi(h,x,w,N,f):Er(h,x):(F._visibility|=2,pi(h,x,w,N,f)),f&&L&2048&&Hu(x.alternate,x);break;case 24:pi(h,x,w,N,f),f&&L&2048&&Iu(x.alternate,x);break;default:pi(h,x,w,N,f)}n=n.sibling}}function Er(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,o=n,f=o.flags;switch(o.tag){case 22:Er(i,o),f&2048&&Hu(o.alternate,o);break;case 24:Er(i,o),f&2048&&Iu(o.alternate,o);break;default:Er(i,o)}n=n.sibling}}var Nr=8192;function hi(e,n,i){if(e.subtreeFlags&Nr)for(e=e.child;e!==null;)xm(e,n,i),e=e.sibling}function xm(e,n,i){switch(e.tag){case 26:hi(e,n,i),e.flags&Nr&&e.memoizedState!==null&&Jv(i,Ln,e.memoizedState,e.memoizedProps);break;case 5:hi(e,n,i);break;case 3:case 4:var o=Ln;Ln=vo(e.stateNode.containerInfo),hi(e,n,i),Ln=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Nr,Nr=16777216,hi(e,n,i),Nr=o):hi(e,n,i));break;default:hi(e,n,i)}}function vm(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Tr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];Mt=o,km(o,e)}vm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sm(e),e=e.sibling}function Sm(e){switch(e.tag){case 0:case 11:case 15:Tr(e),e.flags&2048&&Ps(9,e,e.return);break;case 3:Tr(e);break;case 12:Tr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,ro(e)):Tr(e);break;default:Tr(e)}}function ro(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];Mt=o,km(o,e)}vm(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ps(8,n,n.return),ro(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,ro(n));break;default:ro(n)}e=e.sibling}}function km(e,n){for(;Mt!==null;){var i=Mt;switch(i.tag){case 0:case 11:case 15:Ps(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var o=i.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:dr(i.memoizedState.cache)}if(o=i.child,o!==null)o.return=i,Mt=o;else e:for(i=e;Mt!==null;){o=Mt;var f=o.sibling,h=o.return;if(fm(o),o===i){Mt=null;break e}if(f!==null){f.return=h,Mt=f;break e}Mt=h}}}var hv={getCacheForType:function(e){var n=Ut(Ct),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return Ut(Ct).controller.signal}},mv=typeof WeakMap=="function"?WeakMap:Map,Xe=0,ct=null,Be=null,Le=0,et=0,dn=null,Fs=!1,mi=!1,Pu=!1,Ss=0,vt=0,Gs=0,Ra=0,Fu=0,fn=0,gi=0,Ar=null,en=null,Gu=!1,lo=0,wm=0,oo=1/0,co=null,qs=null,Rt=0,Vs=null,yi=null,ks=0,qu=0,Vu=null,_m=null,jr=0,Wu=null;function pn(){return(Xe&2)!==0&&Le!==0?Le&-Le:$.T!==null?Ju():Zi()}function Cm(){if(fn===0)if((Le&536870912)===0||$e){var e=fa;fa<<=1,(fa&3932160)===0&&(fa=262144),fn=e}else fn=536870912;return e=cn.current,e!==null&&(e.flags|=32),fn}function tn(e,n,i){(e===ct&&(et===2||et===9)||e.cancelPendingCommit!==null)&&(bi(e,0),Ws(e,Le,fn,!1)),is(e,i),((Xe&2)===0||e!==ct)&&(e===ct&&((Xe&2)===0&&(Ra|=i),vt===4&&Ws(e,Le,fn,!1)),Vn(e))}function Em(e,n,i){if((Xe&6)!==0)throw Error(r(327));var o=!i&&(n&127)===0&&(n&e.expiredLanes)===0||ss(e,n),f=o?bv(e,n):Yu(e,n,!0),h=o;do{if(f===0){mi&&!o&&Ws(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!gv(i)){f=Yu(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var w=e;f=Ar;var N=w.current.memoizedState.isDehydrated;if(N&&(bi(w,x).flags|=256),x=Yu(w,x,!1),x!==2){if(Pu&&!N){w.errorRecoveryDisabledLanes|=h,Ra|=h,f=4;break e}h=en,en=f,h!==null&&(en===null?en=h:en.push.apply(en,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){bi(e,0),Ws(e,n,0,!0);break}e:{switch(o=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Ws(o,n,fn,!Fs);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=lo+300-Dt(),10<f)){if(Ws(o,n,fn,!Fs),pa(o,0,!0)!==0)break e;ks=n,o.timeoutHandle=sg(Nm.bind(null,o,i,en,co,Gu,n,fn,Ra,gi,Fs,h,"Throttled",-0,0),f);break e}Nm(o,i,en,co,Gu,n,fn,Ra,gi,Fs,h,null,-0,0)}}break}while(!0);Vn(e)}function Nm(e,n,i,o,f,h,x,w,N,L,F,V,U,I){if(e.timeoutHandle=-1,V=n.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ls},xm(n,h,V);var re=(h&62914560)===h?lo-Dt():(h&4194048)===h?wm-Dt():0;if(re=e0(V,re),re!==null){ks=h,e.cancelPendingCommit=re(Dm.bind(null,e,n,h,i,o,f,x,w,N,F,V,null,U,I)),Ws(e,h,x,!L);return}}Dm(e,n,h,i,o,f,x,w,N)}function gv(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var o=0;o<i.length;o++){var f=i[o],h=f.getSnapshot;f=f.value;try{if(!ln(h(),f))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ws(e,n,i,o){n&=~Fu,n&=~Ra,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var f=n;0<f;){var h=31-Vt(f),x=1<<h;o[h]=-1,f&=~x}i!==0&&vl(e,i,n)}function uo(){return(Xe&6)===0?(Rr(0),!1):!0}function Ku(){if(Be!==null){if(et===0)var e=Be.return;else e=Be,ds=ka=null,uu(e),oi=null,pr=0,e=Be;for(;e!==null;)am(e.alternate,e),e=e.return;Be=null}}function bi(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Lv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ks=0,Ku(),ct=e,Be=i=cs(e.current,null),Le=n,et=0,dn=null,Fs=!1,mi=ss(e,n),Pu=!1,gi=fn=Fu=Ra=Gs=vt=0,en=Ar=null,Gu=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var f=31-Vt(o),h=1<<f;n|=e[f],o&=~h}return Ss=n,Rl(),i}function Tm(e,n){Ne=null,$.H=Sr,n===li||n===$l?(n=Gp(),et=3):n===Xc?(n=Gp(),et=4):et=n===Eu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,dn=n,Be===null&&(vt=1,Jl(e,kn(n,e.current)))}function Am(){var e=cn.current;return e===null?!0:(Le&4194048)===Le?En===null:(Le&62914560)===Le||(Le&536870912)!==0?e===En:!1}function jm(){var e=$.H;return $.H=Sr,e===null?Sr:e}function Rm(){var e=$.A;return $.A=hv,e}function fo(){vt=4,Fs||(Le&4194048)!==Le&&cn.current!==null||(mi=!0),(Gs&134217727)===0&&(Ra&134217727)===0||ct===null||Ws(ct,Le,fn,!1)}function Yu(e,n,i){var o=Xe;Xe|=2;var f=jm(),h=Rm();(ct!==e||Le!==n)&&(co=null,bi(e,n)),n=!1;var x=vt;e:do try{if(et!==0&&Be!==null){var w=Be,N=dn;switch(et){case 8:Ku(),x=6;break e;case 3:case 2:case 9:case 6:cn.current===null&&(n=!0);var L=et;if(et=0,dn=null,xi(e,w,N,L),i&&mi){x=0;break e}break;default:L=et,et=0,dn=null,xi(e,w,N,L)}}yv(),x=vt;break}catch(F){Tm(e,F)}while(!0);return n&&e.shellSuspendCounter++,ds=ka=null,Xe=o,$.H=f,$.A=h,Be===null&&(ct=null,Le=0,Rl()),x}function yv(){for(;Be!==null;)Om(Be)}function bv(e,n){var i=Xe;Xe|=2;var o=jm(),f=Rm();ct!==e||Le!==n?(co=null,oo=Dt()+500,bi(e,n)):mi=ss(e,n);e:do try{if(et!==0&&Be!==null){n=Be;var h=dn;t:switch(et){case 1:et=0,dn=null,xi(e,n,h,1);break;case 2:case 9:if(Pp(h)){et=0,dn=null,Mm(n);break}n=function(){et!==2&&et!==9||ct!==e||(et=7),Vn(e)},h.then(n,n);break e;case 3:et=7;break e;case 4:et=5;break e;case 7:Pp(h)?(et=0,dn=null,Mm(n)):(et=0,dn=null,xi(e,n,h,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var w=Be;if(x?bg(x):w.stateNode.complete){et=0,dn=null;var N=w.sibling;if(N!==null)Be=N;else{var L=w.return;L!==null?(Be=L,po(L)):Be=null}break t}}et=0,dn=null,xi(e,n,h,5);break;case 6:et=0,dn=null,xi(e,n,h,6);break;case 8:Ku(),vt=6;break e;default:throw Error(r(462))}}xv();break}catch(F){Tm(e,F)}while(!0);return ds=ka=null,$.H=o,$.A=f,Xe=i,Be!==null?0:(ct=null,Le=0,Rl(),vt)}function xv(){for(;Be!==null&&!za();)Om(Be)}function Om(e){var n=nm(e.alternate,e,Ss);e.memoizedProps=e.pendingProps,n===null?po(e):Be=n}function Mm(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Zh(i,n,n.pendingProps,n.type,void 0,Le);break;case 11:n=Zh(i,n,n.pendingProps,n.type.render,n.ref,Le);break;case 5:uu(n);default:am(i,n),n=Be=Rp(n,Ss),n=nm(i,n,Ss)}e.memoizedProps=e.pendingProps,n===null?po(e):Be=n}function xi(e,n,i,o){ds=ka=null,uu(n),oi=null,pr=0;var f=n.return;try{if(lv(e,f,n,i,Le)){vt=1,Jl(e,kn(i,e.current)),Be=null;return}}catch(h){if(f!==null)throw Be=f,h;vt=1,Jl(e,kn(i,e.current)),Be=null;return}n.flags&32768?($e||o===1?e=!0:mi||(Le&536870912)!==0?e=!1:(Fs=e=!0,(o===2||o===9||o===3||o===6)&&(o=cn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Bm(n,e)):po(n)}function po(e){var n=e;do{if((n.flags&32768)!==0){Bm(n,Fs);return}e=n.return;var i=uv(n.alternate,n,Ss);if(i!==null){Be=i;return}if(n=n.sibling,n!==null){Be=n;return}Be=n=e}while(n!==null);vt===0&&(vt=5)}function Bm(e,n){do{var i=dv(e.alternate,e);if(i!==null){i.flags&=32767,Be=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Be=e;return}Be=e=i}while(e!==null);vt=6,Be=null}function Dm(e,n,i,o,f,h,x,w,N){e.cancelPendingCommit=null;do ho();while(Rt!==0);if((Xe&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=zc,Wi(e,i,h,x,w,N),e===ct&&(Be=ct=null,Le=0),yi=n,Vs=e,ks=i,qu=h,Vu=f,_m=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,wv(Ua,function(){return Hm(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=$.T,$.T=null,f=X.p,X.p=2,x=Xe,Xe|=4;try{fv(e,n,i)}finally{Xe=x,X.p=f,$.T=o}}Rt=1,Lm(),zm(),Um()}}function Lm(){if(Rt===1){Rt=0;var e=Vs,n=yi,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var o=X.p;X.p=2;var f=Xe;Xe|=4;try{gm(n,e);var h=ld,x=kp(e.containerInfo),w=h.focusedElem,N=h.selectionRange;if(x!==w&&w&&w.ownerDocument&&Sp(w.ownerDocument.documentElement,w)){if(N!==null&&Oc(w)){var L=N.start,F=N.end;if(F===void 0&&(F=L),"selectionStart"in w)w.selectionStart=L,w.selectionEnd=Math.min(F,w.value.length);else{var V=w.ownerDocument||document,U=V&&V.defaultView||window;if(U.getSelection){var I=U.getSelection(),re=w.textContent.length,ye=Math.min(N.start,re),rt=N.end===void 0?ye:Math.min(N.end,re);!I.extend&&ye>rt&&(x=rt,rt=ye,ye=x);var M=vp(w,ye),A=vp(w,rt);if(M&&A&&(I.rangeCount!==1||I.anchorNode!==M.node||I.anchorOffset!==M.offset||I.focusNode!==A.node||I.focusOffset!==A.offset)){var D=V.createRange();D.setStart(M.node,M.offset),I.removeAllRanges(),ye>rt?(I.addRange(D),I.extend(A.node,A.offset)):(D.setEnd(A.node,A.offset),I.addRange(D))}}}}for(V=[],I=w;I=I.parentNode;)I.nodeType===1&&V.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<V.length;w++){var q=V[w];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Eo=!!rd,ld=rd=null}finally{Xe=f,X.p=o,$.T=i}}e.current=n,Rt=2}}function zm(){if(Rt===2){Rt=0;var e=Vs,n=yi,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var o=X.p;X.p=2;var f=Xe;Xe|=4;try{dm(e,n.alternate,n)}finally{Xe=f,X.p=o,$.T=i}}Rt=3}}function Um(){if(Rt===4||Rt===3){Rt=0,Pi();var e=Vs,n=yi,i=ks,o=_m;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Rt=5:(Rt=0,yi=Vs=null,$m(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(qs=null),Fa(i),n=n.stateNode,Ft&&typeof Ft.onCommitFiberRoot=="function")try{Ft.onCommitFiberRoot(es,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=$.T,f=X.p,X.p=2,$.T=null;try{for(var h=e.onRecoverableError,x=0;x<o.length;x++){var w=o[x];h(w.value,{componentStack:w.stack})}}finally{$.T=n,X.p=f}}(ks&3)!==0&&ho(),Vn(e),f=e.pendingLanes,(i&261930)!==0&&(f&42)!==0?e===Wu?jr++:(jr=0,Wu=e):jr=0,Rr(0)}}function $m(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,dr(n)))}function ho(){return Lm(),zm(),Um(),Hm()}function Hm(){if(Rt!==5)return!1;var e=Vs,n=qu;qu=0;var i=Fa(ks),o=$.T,f=X.p;try{X.p=32>i?32:i,$.T=null,i=Vu,Vu=null;var h=Vs,x=ks;if(Rt=0,yi=Vs=null,ks=0,(Xe&6)!==0)throw Error(r(331));var w=Xe;if(Xe|=4,Sm(h.current),bm(h,h.current,x,i),Xe=w,Rr(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(es,h)}catch{}return!0}finally{X.p=f,$.T=o,$m(e,n)}}function Im(e,n,i){n=kn(i,n),n=Cu(e.stateNode,n,2),e=$s(e,n,2),e!==null&&(is(e,2),Vn(e))}function tt(e,n,i){if(e.tag===3)Im(e,e,i);else for(;n!==null;){if(n.tag===3){Im(n,e,i);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(qs===null||!qs.has(o))){e=kn(i,e),i=Ph(2),o=$s(n,i,2),o!==null&&(Fh(i,o,n,e),is(o,2),Vn(o));break}}n=n.return}}function Zu(e,n,i){var o=e.pingCache;if(o===null){o=e.pingCache=new mv;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(i)||(Pu=!0,f.add(i),e=vv.bind(null,e,n,i),n.then(e,e))}function vv(e,n,i){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ct===e&&(Le&i)===i&&(vt===4||vt===3&&(Le&62914560)===Le&&300>Dt()-lo?(Xe&2)===0&&bi(e,0):Fu|=i,gi===Le&&(gi=0)),Vn(e)}function Pm(e,n){n===0&&(n=as()),e=xa(e,n),e!==null&&(is(e,n),Vn(e))}function Sv(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),Pm(e,i)}function kv(e,n){var i=0;switch(e.tag){case 31:case 13:var o=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(n),Pm(e,i)}function wv(e,n){return St(e,n)}var mo=null,vi=null,Qu=!1,go=!1,Xu=!1,Ks=0;function Vn(e){e!==vi&&e.next===null&&(vi===null?mo=vi=e:vi=vi.next=e),go=!0,Qu||(Qu=!0,Cv())}function Rr(e,n){if(!Xu&&go){Xu=!0;do for(var i=!1,o=mo;o!==null;){if(e!==0){var f=o.pendingLanes;if(f===0)var h=0;else{var x=o.suspendedLanes,w=o.pingedLanes;h=(1<<31-Vt(42|e)+1)-1,h&=f&~(x&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,Vm(o,h))}else h=Le,h=pa(o,o===ct?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||ss(o,h)||(i=!0,Vm(o,h));o=o.next}while(i);Xu=!1}}function _v(){Fm()}function Fm(){go=Qu=!1;var e=0;Ks!==0&&Dv()&&(e=Ks);for(var n=Dt(),i=null,o=mo;o!==null;){var f=o.next,h=Gm(o,n);h===0?(o.next=null,i===null?mo=f:i.next=f,f===null&&(vi=i)):(i=o,(e!==0||(h&3)!==0)&&(go=!0)),o=f}Rt!==0&&Rt!==5||Rr(e),Ks!==0&&(Ks=0)}function Gm(e,n){for(var i=e.suspendedLanes,o=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Vt(h),w=1<<x,N=f[x];N===-1?((w&i)===0||(w&o)!==0)&&(f[x]=xl(w,n)):N<=n&&(e.expiredLanes|=w),h&=~w}if(n=ct,i=Le,i=pa(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,i===0||e===n&&(et===2||et===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&qt(o),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ss(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(o!==null&&qt(o),Fa(i)){case 2:case 8:i=Pt;break;case 32:i=Ua;break;case 268435456:i=qi;break;default:i=Ua}return o=qm.bind(null,e),i=St(i,o),e.callbackPriority=n,e.callbackNode=i,n}return o!==null&&o!==null&&qt(o),e.callbackPriority=2,e.callbackNode=null,2}function qm(e,n){if(Rt!==0&&Rt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(ho()&&e.callbackNode!==i)return null;var o=Le;return o=pa(e,e===ct?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Em(e,o,n),Gm(e,Dt()),e.callbackNode!=null&&e.callbackNode===i?qm.bind(null,e):null)}function Vm(e,n){if(ho())return null;Em(e,n,!0)}function Cv(){zv(function(){(Xe&6)!==0?St(Gi,_v):Fm()})}function Ju(){if(Ks===0){var e=ii;e===0&&(e=Ia,Ia<<=1,(Ia&261888)===0&&(Ia=256)),Ks=e}return Ks}function Wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:wl(""+e)}function Km(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function Ev(e,n,i,o,f){if(n==="submit"&&i&&i.stateNode===f){var h=Wm((f[Gt]||null).action),x=o.submitter;x&&(n=(n=x[Gt]||null)?Wm(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var w=new Nl("action","action",null,o,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ks!==0){var N=x?Km(f,x):new FormData(f);xu(i,{pending:!0,data:N,method:f.method,action:h},null,N)}}else typeof h=="function"&&(w.preventDefault(),N=x?Km(f,x):new FormData(f),xu(i,{pending:!0,data:N,method:f.method,action:h},h,N))},currentTarget:f}]})}}for(var ed=0;ed<Lc.length;ed++){var td=Lc[ed],Nv=td.toLowerCase(),Tv=td[0].toUpperCase()+td.slice(1);Dn(Nv,"on"+Tv)}Dn(Cp,"onAnimationEnd"),Dn(Ep,"onAnimationIteration"),Dn(Np,"onAnimationStart"),Dn("dblclick","onDoubleClick"),Dn("focusin","onFocus"),Dn("focusout","onBlur"),Dn(Gx,"onTransitionRun"),Dn(qx,"onTransitionStart"),Dn(Vx,"onTransitionCancel"),Dn(Tp,"onTransitionEnd"),ft("onMouseEnter",["mouseout","mouseover"]),ft("onMouseLeave",["mouseout","mouseover"]),ft("onPointerEnter",["pointerout","pointerover"]),ft("onPointerLeave",["pointerout","pointerover"]),qe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qe("onBeforeInput",["compositionend","keypress","textInput","paste"]),qe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Or="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(" "),Av=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Or));function Ym(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var o=e[i],f=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var x=o.length-1;0<=x;x--){var w=o[x],N=w.instance,L=w.currentTarget;if(w=w.listener,N!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=L;try{h(f)}catch(F){jl(F)}f.currentTarget=null,h=N}else for(x=0;x<o.length;x++){if(w=o[x],N=w.instance,L=w.currentTarget,w=w.listener,N!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=L;try{h(f)}catch(F){jl(F)}f.currentTarget=null,h=N}}}}function De(e,n){var i=n[Qi];i===void 0&&(i=n[Qi]=new Set);var o=e+"__bubble";i.has(o)||(Zm(n,e,2,!1),i.add(o))}function nd(e,n,i){var o=0;n&&(o|=4),Zm(i,e,o,n)}var yo="_reactListening"+Math.random().toString(36).slice(2);function sd(e){if(!e[yo]){e[yo]=!0,xe.forEach(function(i){i!=="selectionchange"&&(Av.has(i)||nd(i,!1,e),nd(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[yo]||(n[yo]=!0,nd("selectionchange",!1,n))}}function Zm(e,n,i,o){switch(Cg(n)){case 2:var f=s0;break;case 8:f=a0;break;default:f=bd}i=f.bind(null,n,i,e),f=void 0,!wc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),o?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function ad(e,n,i,o,f){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var w=o.stateNode.containerInfo;if(w===f)break;if(x===4)for(x=o.return;x!==null;){var N=x.tag;if((N===3||N===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;w!==null;){if(x=Rs(w),x===null)return;if(N=x.tag,N===5||N===6||N===26||N===27){o=h=x;continue e}w=w.parentNode}}o=o.return}tp(function(){var L=h,F=Sc(i),V=[];e:{var U=Ap.get(e);if(U!==void 0){var I=Nl,re=e;switch(e){case"keypress":if(Cl(i)===0)break e;case"keydown":case"keyup":I=kx;break;case"focusin":re="focus",I=Nc;break;case"focusout":re="blur",I=Nc;break;case"beforeblur":case"afterblur":I=Nc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":I=ap;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=ux;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=Cx;break;case Cp:case Ep:case Np:I=px;break;case Tp:I=Nx;break;case"scroll":case"scrollend":I=ox;break;case"wheel":I=Ax;break;case"copy":case"cut":case"paste":I=mx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=rp;break;case"toggle":case"beforetoggle":I=Rx}var ye=(n&4)!==0,rt=!ye&&(e==="scroll"||e==="scrollend"),M=ye?U!==null?U+"Capture":null:U;ye=[];for(var A=L,D;A!==null;){var q=A;if(D=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||D===null||M===null||(q=er(A,M),q!=null&&ye.push(Mr(A,q,D))),rt)break;A=A.return}0<ye.length&&(U=new I(U,re,null,i,F),V.push({event:U,listeners:ye}))}}if((n&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",I=e==="mouseout"||e==="pointerout",U&&i!==vc&&(re=i.relatedTarget||i.fromElement)&&(Rs(re)||re[js]))break e;if((I||U)&&(U=F.window===F?F:(U=F.ownerDocument)?U.defaultView||U.parentWindow:window,I?(re=i.relatedTarget||i.toElement,I=L,re=re?Rs(re):null,re!==null&&(rt=c(re),ye=re.tag,re!==rt||ye!==5&&ye!==27&&ye!==6)&&(re=null)):(I=null,re=L),I!==re)){if(ye=ap,q="onMouseLeave",M="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(ye=rp,q="onPointerLeave",M="onPointerEnter",A="pointer"),rt=I==null?U:G(I),D=re==null?U:G(re),U=new ye(q,A+"leave",I,i,F),U.target=rt,U.relatedTarget=D,q=null,Rs(F)===L&&(ye=new ye(M,A+"enter",re,i,F),ye.target=D,ye.relatedTarget=rt,q=ye),rt=q,I&&re)t:{for(ye=jv,M=I,A=re,D=0,q=M;q;q=ye(q))D++;q=0;for(var fe=A;fe;fe=ye(fe))q++;for(;0<D-q;)M=ye(M),D--;for(;0<q-D;)A=ye(A),q--;for(;D--;){if(M===A||A!==null&&M===A.alternate){ye=M;break t}M=ye(M),A=ye(A)}ye=null}else ye=null;I!==null&&Qm(V,U,I,ye,!1),re!==null&&rt!==null&&Qm(V,rt,re,ye,!0)}}e:{if(U=L?G(L):window,I=U.nodeName&&U.nodeName.toLowerCase(),I==="select"||I==="input"&&U.type==="file")var Ke=hp;else if(fp(U))if(mp)Ke=Ix;else{Ke=$x;var ce=Ux}else I=U.nodeName,!I||I.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?L&&xc(L.elementType)&&(Ke=hp):Ke=Hx;if(Ke&&(Ke=Ke(e,L))){pp(V,Ke,i,F);break e}ce&&ce(e,U,L),e==="focusout"&&L&&U.type==="number"&&L.memoizedProps.value!=null&&bc(U,"number",U.value)}switch(ce=L?G(L):window,e){case"focusin":(fp(ce)||ce.contentEditable==="true")&&(Qa=ce,Mc=L,or=null);break;case"focusout":or=Mc=Qa=null;break;case"mousedown":Bc=!0;break;case"contextmenu":case"mouseup":case"dragend":Bc=!1,wp(V,i,F);break;case"selectionchange":if(Fx)break;case"keydown":case"keyup":wp(V,i,F)}var Te;if(Ac)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Za?up(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(lp&&i.locale!=="ko"&&(Za||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Za&&(Te=np()):(Os=F,_c="value"in Os?Os.value:Os.textContent,Za=!0)),ce=bo(L,ze),0<ce.length&&(ze=new ip(ze,e,null,i,F),V.push({event:ze,listeners:ce}),Te?ze.data=Te:(Te=dp(i),Te!==null&&(ze.data=Te)))),(Te=Mx?Bx(e,i):Dx(e,i))&&(ze=bo(L,"onBeforeInput"),0<ze.length&&(ce=new ip("onBeforeInput","beforeinput",null,i,F),V.push({event:ce,listeners:ze}),ce.data=Te)),Ev(V,e,L,i,F)}Ym(V,n)})}function Mr(e,n,i){return{instance:e,listener:n,currentTarget:i}}function bo(e,n){for(var i=n+"Capture",o=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=er(e,i),f!=null&&o.unshift(Mr(e,f,h)),f=er(e,n),f!=null&&o.push(Mr(e,f,h))),e.tag===3)return o;e=e.return}return[]}function jv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Qm(e,n,i,o,f){for(var h=n._reactName,x=[];i!==null&&i!==o;){var w=i,N=w.alternate,L=w.stateNode;if(w=w.tag,N!==null&&N===o)break;w!==5&&w!==26&&w!==27||L===null||(N=L,f?(L=er(i,h),L!=null&&x.unshift(Mr(i,L,N))):f||(L=er(i,h),L!=null&&x.push(Mr(i,L,N)))),i=i.return}x.length!==0&&e.push({event:n,listeners:x})}var Rv=/\r\n?/g,Ov=/\u0000|\uFFFD/g;function Xm(e){return(typeof e=="string"?e:""+e).replace(Rv,`
|
|
26
|
-
`).replace(Ov,"")}function Jm(e,n){return n=Xm(n),Xm(e)===n}function it(e,n,i,o,f,h){switch(i){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Wa(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Wa(e,""+o);break;case"className":qa(e,"class",o);break;case"tabIndex":qa(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":qa(e,i,o);break;case"style":Jf(e,o,h);break;case"data":if(n!=="object"){qa(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=wl(""+o),e.setAttribute(i,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(i==="formAction"?(n!=="input"&&it(e,n,"name",f.name,f,null),it(e,n,"formEncType",f.formEncType,f,null),it(e,n,"formMethod",f.formMethod,f,null),it(e,n,"formTarget",f.formTarget,f,null)):(it(e,n,"encType",f.encType,f,null),it(e,n,"method",f.method,f,null),it(e,n,"target",f.target,f,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=wl(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=ls);break;case"onScroll":o!=null&&De("scroll",e);break;case"onScrollEnd":o!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}i=wl(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""+o):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":o===!0?e.setAttribute(i,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,o):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(i,o):e.removeAttribute(i);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(i):e.setAttribute(i,o);break;case"popover":De("beforetoggle",e),De("toggle",e),rn(e,"popover",o);break;case"xlinkActuate":Lt(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Lt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Lt(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Lt(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Lt(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Lt(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Lt(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Lt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Lt(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":rn(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=rx.get(i)||i,rn(e,i,o))}}function id(e,n,i,o,f,h){switch(i){case"style":Jf(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof o=="string"?Wa(e,o):(typeof o=="number"||typeof o=="bigint")&&Wa(e,""+o);break;case"onScroll":o!=null&&De("scroll",e);break;case"onScrollEnd":o!=null&&De("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ls);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Fe.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),n=i.slice(2,f?i.length-7:void 0),h=e[Gt]||null,h=h!=null?h[i]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof o=="function")){typeof h!="function"&&h!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,o,f);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):rn(e,i,o)}}}function Ht(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var o=!1,f=!1,h;for(h in i)if(i.hasOwnProperty(h)){var x=i[h];if(x!=null)switch(h){case"src":o=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:it(e,n,h,x,i,null)}}f&&it(e,n,"srcSet",i.srcSet,i,null),o&&it(e,n,"src",i.src,i,null);return;case"input":De("invalid",e);var w=h=x=f=null,N=null,L=null;for(o in i)if(i.hasOwnProperty(o)){var F=i[o];if(F!=null)switch(o){case"name":f=F;break;case"type":x=F;break;case"checked":N=F;break;case"defaultChecked":L=F;break;case"value":h=F;break;case"defaultValue":w=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,n));break;default:it(e,n,o,F,i,null)}}Yf(e,h,w,N,L,x,f,!1);return;case"select":De("invalid",e),o=x=h=null;for(f in i)if(i.hasOwnProperty(f)&&(w=i[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":x=w;break;case"multiple":o=w;default:it(e,n,f,w,i,null)}n=h,i=x,e.multiple=!!o,n!=null?Va(e,!!o,n,!1):i!=null&&Va(e,!!o,i,!0);return;case"textarea":De("invalid",e),h=f=o=null;for(x in i)if(i.hasOwnProperty(x)&&(w=i[x],w!=null))switch(x){case"value":o=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:it(e,n,x,w,i,null)}Qf(e,o,f,h);return;case"option":for(N in i)if(i.hasOwnProperty(N)&&(o=i[N],o!=null))switch(N){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:it(e,n,N,o,i,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(o=0;o<Or.length;o++)De(Or[o],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(L in i)if(i.hasOwnProperty(L)&&(o=i[L],o!=null))switch(L){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:it(e,n,L,o,i,null)}return;default:if(xc(n)){for(F in i)i.hasOwnProperty(F)&&(o=i[F],o!==void 0&&id(e,n,F,o,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(o=i[w],o!=null&&it(e,n,w,o,i,null))}function Mv(e,n,i,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,w=null,N=null,L=null,F=null;for(I in i){var V=i[I];if(i.hasOwnProperty(I)&&V!=null)switch(I){case"checked":break;case"value":break;case"defaultValue":N=V;default:o.hasOwnProperty(I)||it(e,n,I,null,o,V)}}for(var U in o){var I=o[U];if(V=i[U],o.hasOwnProperty(U)&&(I!=null||V!=null))switch(U){case"type":h=I;break;case"name":f=I;break;case"checked":L=I;break;case"defaultChecked":F=I;break;case"value":x=I;break;case"defaultValue":w=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(137,n));break;default:I!==V&&it(e,n,U,I,o,V)}}yc(e,x,w,N,L,F,h,f);return;case"select":I=x=w=U=null;for(h in i)if(N=i[h],i.hasOwnProperty(h)&&N!=null)switch(h){case"value":break;case"multiple":I=N;default:o.hasOwnProperty(h)||it(e,n,h,null,o,N)}for(f in o)if(h=o[f],N=i[f],o.hasOwnProperty(f)&&(h!=null||N!=null))switch(f){case"value":U=h;break;case"defaultValue":w=h;break;case"multiple":x=h;default:h!==N&&it(e,n,f,h,o,N)}n=w,i=x,o=I,U!=null?Va(e,!!i,U,!1):!!o!=!!i&&(n!=null?Va(e,!!i,n,!0):Va(e,!!i,i?[]:"",!1));return;case"textarea":I=U=null;for(w in i)if(f=i[w],i.hasOwnProperty(w)&&f!=null&&!o.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:it(e,n,w,null,o,f)}for(x in o)if(f=o[x],h=i[x],o.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":U=f;break;case"defaultValue":I=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&it(e,n,x,f,o,h)}Zf(e,U,I);return;case"option":for(var re in i)if(U=i[re],i.hasOwnProperty(re)&&U!=null&&!o.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:it(e,n,re,null,o,U)}for(N in o)if(U=o[N],I=i[N],o.hasOwnProperty(N)&&U!==I&&(U!=null||I!=null))switch(N){case"selected":e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:it(e,n,N,U,o,I)}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 ye in i)U=i[ye],i.hasOwnProperty(ye)&&U!=null&&!o.hasOwnProperty(ye)&&it(e,n,ye,null,o,U);for(L in o)if(U=o[L],I=i[L],o.hasOwnProperty(L)&&U!==I&&(U!=null||I!=null))switch(L){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(r(137,n));break;default:it(e,n,L,U,o,I)}return;default:if(xc(n)){for(var rt in i)U=i[rt],i.hasOwnProperty(rt)&&U!==void 0&&!o.hasOwnProperty(rt)&&id(e,n,rt,void 0,o,U);for(F in o)U=o[F],I=i[F],!o.hasOwnProperty(F)||U===I||U===void 0&&I===void 0||id(e,n,F,U,o,I);return}}for(var M in i)U=i[M],i.hasOwnProperty(M)&&U!=null&&!o.hasOwnProperty(M)&&it(e,n,M,null,o,U);for(V in o)U=o[V],I=i[V],!o.hasOwnProperty(V)||U===I||U==null&&I==null||it(e,n,V,U,o,I)}function eg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var f=i[o],h=f.transferSize,x=f.initiatorType,w=f.duration;if(h&&w&&eg(x)){for(x=0,w=f.responseEnd,o+=1;o<i.length;o++){var N=i[o],L=N.startTime;if(L>w)break;var F=N.transferSize,V=N.initiatorType;F&&eg(V)&&(N=N.responseEnd,x+=F*(N<w?1:(w-L)/(N-L)))}if(--o,n+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var rd=null,ld=null;function xo(e){return e.nodeType===9?e:e.ownerDocument}function tg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ng(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function od(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var cd=null;function Dv(){var e=window.event;return e&&e.type==="popstate"?e===cd?!1:(cd=e,!0):(cd=null,!1)}var sg=typeof setTimeout=="function"?setTimeout:void 0,Lv=typeof clearTimeout=="function"?clearTimeout:void 0,ag=typeof Promise=="function"?Promise:void 0,zv=typeof queueMicrotask=="function"?queueMicrotask:typeof ag<"u"?function(e){return ag.resolve(null).then(e).catch(Uv)}:sg;function Uv(e){setTimeout(function(){throw e})}function Ys(e){return e==="head"}function ig(e,n){var i=n,o=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(o===0){e.removeChild(f),_i(n);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")Br(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Br(i);for(var h=i.firstChild;h;){var x=h.nextSibling,w=h.nodeName;h[ha]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=x}}else i==="body"&&Br(e.ownerDocument.body);i=f}while(i);_i(n)}function rg(e,n){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=o}while(i)}function ud(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":ud(i),ma(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function $v(e,n,i,o){for(;e.nodeType===1;){var f=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[ha])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Nn(e.nextSibling),e===null)break}return null}function Hv(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Nn(e.nextSibling),e===null))return null;return e}function lg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Nn(e.nextSibling),e===null))return null;return e}function dd(e){return e.data==="$?"||e.data==="$~"}function fd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Iv(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var o=function(){n(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Nn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var pd=null;function og(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return Nn(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function cg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function ug(e,n,i){switch(n=xo(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Br(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ma(e)}var Tn=new Map,dg=new Set;function vo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ws=X.d;X.d={f:Pv,r:Fv,D:Gv,C:qv,L:Vv,m:Wv,X:Yv,S:Kv,M:Zv};function Pv(){var e=ws.f(),n=uo();return e||n}function Fv(e){var n=B(e);n!==null&&n.tag===5&&n.type==="form"?Th(n):ws.r(e)}var Si=typeof document>"u"?null:document;function fg(e,n,i){var o=Si;if(o&&typeof n=="string"&&n){var f=vn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),dg.has(f)||(dg.add(f),e={rel:e,crossOrigin:i,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),Ht(n,"link",e),ie(n),o.head.appendChild(n)))}}function Gv(e){ws.D(e),fg("dns-prefetch",e,null)}function qv(e,n){ws.C(e,n),fg("preconnect",e,n)}function Vv(e,n,i){ws.L(e,n,i);var o=Si;if(o&&e&&n){var f='link[rel="preload"][as="'+vn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+vn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+vn(i.imageSizes)+'"]')):f+='[href="'+vn(e)+'"]';var h=f;switch(n){case"style":h=ki(e);break;case"script":h=wi(e)}Tn.has(h)||(e=b({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),Tn.set(h,e),o.querySelector(f)!==null||n==="style"&&o.querySelector(Dr(h))||n==="script"&&o.querySelector(Lr(h))||(n=o.createElement("link"),Ht(n,"link",e),ie(n),o.head.appendChild(n)))}}function Wv(e,n){ws.m(e,n);var i=Si;if(i&&e){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+vn(o)+'"][href="'+vn(e)+'"]',h=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=wi(e)}if(!Tn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Tn.set(h,e),i.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Lr(h)))return}o=i.createElement("link"),Ht(o,"link",e),ie(o),i.head.appendChild(o)}}}function Kv(e,n,i){ws.S(e,n,i);var o=Si;if(o&&e){var f=ee(o).hoistableStyles,h=ki(e);n=n||"default";var x=f.get(h);if(!x){var w={loading:0,preload:null};if(x=o.querySelector(Dr(h)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},i),(i=Tn.get(h))&&hd(e,i);var N=x=o.createElement("link");ie(N),Ht(N,"link",e),N._p=new Promise(function(L,F){N.onload=L,N.onerror=F}),N.addEventListener("load",function(){w.loading|=1}),N.addEventListener("error",function(){w.loading|=2}),w.loading|=4,So(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:w},f.set(h,x)}}}function Yv(e,n){ws.X(e,n);var i=Si;if(i&&e){var o=ee(i).hoistableScripts,f=wi(e),h=o.get(f);h||(h=i.querySelector(Lr(f)),h||(e=b({src:e,async:!0},n),(n=Tn.get(f))&&md(e,n),h=i.createElement("script"),ie(h),Ht(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function Zv(e,n){ws.M(e,n);var i=Si;if(i&&e){var o=ee(i).hoistableScripts,f=wi(e),h=o.get(f);h||(h=i.querySelector(Lr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Tn.get(f))&&md(e,n),h=i.createElement("script"),ie(h),Ht(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function pg(e,n,i,o){var f=(f=Kt.current)?vo(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=ki(i.href),i=ee(f).hoistableStyles,o=i.get(n),o||(o={type:"style",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=ki(i.href);var h=ee(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(Dr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Tn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Tn.set(e,i),h||Qv(f,e,i,x.state))),n&&o===null)throw Error(r(528,""));return x}if(n&&o!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=wi(i),i=ee(f).hoistableScripts,o=i.get(n),o||(o={type:"script",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function ki(e){return'href="'+vn(e)+'"'}function Dr(e){return'link[rel="stylesheet"]['+e+"]"}function hg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Qv(e,n,i,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Ht(n,"link",i),ie(n),e.head.appendChild(n))}function wi(e){return'[src="'+vn(e)+'"]'}function Lr(e){return"script[async]"+e}function mg(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+vn(i.href)+'"]');if(o)return n.instance=o,ie(o),o;var f=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),ie(o),Ht(o,"style",f),So(o,i.precedence,e),n.instance=o;case"stylesheet":f=ki(i.href);var h=e.querySelector(Dr(f));if(h)return n.state.loading|=4,n.instance=h,ie(h),h;o=hg(i),(f=Tn.get(f))&&hd(o,f),h=(e.ownerDocument||e).createElement("link"),ie(h);var x=h;return x._p=new Promise(function(w,N){x.onload=w,x.onerror=N}),Ht(h,"link",o),n.state.loading|=4,So(h,i.precedence,e),n.instance=h;case"script":return h=wi(i.src),(f=e.querySelector(Lr(h)))?(n.instance=f,ie(f),f):(o=i,(f=Tn.get(h))&&(o=b({},i),md(o,f)),e=e.ownerDocument||e,f=e.createElement("script"),ie(f),Ht(f,"link",o),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,So(o,i.precedence,e));return n.instance}function So(e,n,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,h=f,x=0;x<o.length;x++){var w=o[x];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function hd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function md(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var ko=null;function gg(e,n,i){if(ko===null){var o=new Map,f=ko=new Map;f.set(i,o)}else f=ko,o=f.get(i),o||(o=new Map,f.set(i,o));if(o.has(e))return o;for(o.set(e,null),i=i.getElementsByTagName(e),f=0;f<i.length;f++){var h=i[f];if(!(h[ha]||h[jt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var w=o.get(x);w?w.push(h):o.set(x,[h])}}return o}function yg(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function Xv(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function bg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Jv(e,n,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=ki(o.href),h=n.querySelector(Dr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=wo.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,ie(h);return}h=n.ownerDocument||n,o=hg(o),(f=Tn.get(f))&&hd(o,f),h=h.createElement("link"),ie(h);var x=h;x._p=new Promise(function(w,N){x.onload=w,x.onerror=N}),Ht(h,"link",o),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=wo.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var gd=0;function e0(e,n){return e.stylesheets&&e.count===0&&Co(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&Co(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&gd===0&&(gd=62500*Bv());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Co(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>gd?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Co(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var _o=null;function Co(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_o=new Map,n.forEach(t0,e),_o=null,wo.call(e))}function t0(e,n){if(!(n.state.loading&4)){var i=_o.get(e);if(i)var o=i.get(null);else{i=new Map,_o.set(e,i);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(i.set(x.dataset.precedence,x),o=x)}o&&i.set(null,o)}f=n.instance,x=f.getAttribute("data-precedence"),h=i.get(x)||o,h===o&&i.set(null,f),i.set(x,f),this.count++,o=wo.bind(this),f.addEventListener("load",o),f.addEventListener("error",o),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var zr={$$typeof:T,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function n0(e,n,i,o,f,h,x,w,N){this.tag=1,this.containerInfo=e,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=Vi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vi(0),this.hiddenUpdates=Vi(null),this.identifierPrefix=o,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function xg(e,n,i,o,f,h,x,w,N,L,F,V){return e=new n0(e,n,i,x,N,L,F,V,w),n=1,h===!0&&(n|=24),h=on(3,null,null,n),e.current=h,h.stateNode=e,n=Yc(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:i,cache:n},Jc(h),e}function vg(e){return e?(e=ei,e):ei}function Sg(e,n,i,o,f,h){f=vg(f),o.context===null?o.context=f:o.pendingContext=f,o=Us(n),o.payload={element:i},h=h===void 0?null:h,h!==null&&(o.callback=h),i=$s(e,o,n),i!==null&&(tn(i,e,n),mr(i,e,n))}function kg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function yd(e,n){kg(e,n),(e=e.alternate)&&kg(e,n)}function wg(e){if(e.tag===13||e.tag===31){var n=xa(e,67108864);n!==null&&tn(n,e,67108864),yd(e,67108864)}}function _g(e){if(e.tag===13||e.tag===31){var n=pn();n=Pa(n);var i=xa(e,n);i!==null&&tn(i,e,n),yd(e,n)}}var Eo=!0;function s0(e,n,i,o){var f=$.T;$.T=null;var h=X.p;try{X.p=2,bd(e,n,i,o)}finally{X.p=h,$.T=f}}function a0(e,n,i,o){var f=$.T;$.T=null;var h=X.p;try{X.p=8,bd(e,n,i,o)}finally{X.p=h,$.T=f}}function bd(e,n,i,o){if(Eo){var f=xd(o);if(f===null)ad(e,n,o,No,i),Eg(e,o);else if(r0(f,e,n,i,o))o.stopPropagation();else if(Eg(e,o),n&4&&-1<i0.indexOf(e)){for(;f!==null;){var h=B(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=ns(h.pendingLanes);if(x!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var N=1<<31-Vt(x);w.entanglements[1]|=N,x&=~N}Vn(h),(Xe&6)===0&&(oo=Dt()+500,Rr(0))}}break;case 31:case 13:w=xa(h,2),w!==null&&tn(w,h,2),uo(),yd(h,2)}if(h=xd(o),h===null&&ad(e,n,o,No,i),h===f)break;f=h}f!==null&&o.stopPropagation()}else ad(e,n,o,null,i)}}function xd(e){return e=Sc(e),vd(e)}var No=null;function vd(e){if(No=null,e=Rs(e),e!==null){var n=c(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=d(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return No=e,null}function Cg(e){switch(e){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(Fi()){case Gi:return 2;case Pt:return 8;case Ua:case an:return 32;case qi:return 268435456;default:return 32}default:return 32}}var Sd=!1,Zs=null,Qs=null,Xs=null,Ur=new Map,$r=new Map,Js=[],i0="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 Eg(e,n){switch(e){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":Qs=null;break;case"mouseover":case"mouseout":Xs=null;break;case"pointerover":case"pointerout":Ur.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":$r.delete(n.pointerId)}}function Hr(e,n,i,o,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:o,nativeEvent:h,targetContainers:[f]},n!==null&&(n=B(n),n!==null&&wg(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function r0(e,n,i,o,f){switch(n){case"focusin":return Zs=Hr(Zs,e,n,i,o,f),!0;case"dragenter":return Qs=Hr(Qs,e,n,i,o,f),!0;case"mouseover":return Xs=Hr(Xs,e,n,i,o,f),!0;case"pointerover":var h=f.pointerId;return Ur.set(h,Hr(Ur.get(h)||null,e,n,i,o,f)),!0;case"gotpointercapture":return h=f.pointerId,$r.set(h,Hr($r.get(h)||null,e,n,i,o,f)),!0}return!1}function Ng(e){var n=Rs(e.target);if(n!==null){var i=c(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,Ga(e.priority,function(){_g(i)});return}}else if(n===31){if(n=d(i),n!==null){e.blockedOn=n,Ga(e.priority,function(){_g(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function To(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=xd(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);vc=o,i.target.dispatchEvent(o),vc=null}else return n=B(i),n!==null&&wg(n),e.blockedOn=i,!1;n.shift()}return!0}function Tg(e,n,i){To(e)&&i.delete(n)}function l0(){Sd=!1,Zs!==null&&To(Zs)&&(Zs=null),Qs!==null&&To(Qs)&&(Qs=null),Xs!==null&&To(Xs)&&(Xs=null),Ur.forEach(Tg),$r.forEach(Tg)}function Ao(e,n){e.blockedOn===n&&(e.blockedOn=null,Sd||(Sd=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,l0)))}var jo=null;function Ag(e){jo!==e&&(jo=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){jo===e&&(jo=null);for(var n=0;n<e.length;n+=3){var i=e[n],o=e[n+1],f=e[n+2];if(typeof o!="function"){if(vd(o||i)===null)continue;break}var h=B(i);h!==null&&(e.splice(n,3),n-=3,xu(h,{pending:!0,data:f,method:i.method,action:o},o,f))}}))}function _i(e){function n(N){return Ao(N,e)}Zs!==null&&Ao(Zs,e),Qs!==null&&Ao(Qs,e),Xs!==null&&Ao(Xs,e),Ur.forEach(n),$r.forEach(n);for(var i=0;i<Js.length;i++){var o=Js[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Js.length&&(i=Js[0],i.blockedOn===null);)Ng(i),i.blockedOn===null&&Js.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var f=i[o],h=i[o+1],x=f[Gt]||null;if(typeof h=="function")x||Ag(i);else if(x){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[Gt]||null)w=x.formAction;else if(vd(f)!==null)continue}else w=x.action;typeof w=="function"?i[o+1]=w:(i.splice(o,3),o-=3),Ag(i)}}}function jg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),o||setTimeout(i,20)}function i(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function kd(e){this._internalRoot=e}Ro.prototype.render=kd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,o=pn();Sg(i,o,e,n,null,null)},Ro.prototype.unmount=kd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Sg(e.current,2,null,e,null,null),uo(),n[js]=null}};function Ro(e){this._internalRoot=e}Ro.prototype.unstable_scheduleHydration=function(e){if(e){var n=Zi();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Js.length&&n!==0&&n<Js[i].priority;i++);Js.splice(i,0,e),i===0&&Ng(e)}};var Rg=t.version;if(Rg!=="19.2.7")throw Error(r(527,Rg,"19.2.7"));X.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var o0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oo.isDisabled&&Oo.supportsFiber)try{es=Oo.inject(o0),Ft=Oo}catch{}}return Ir.createRoot=function(e,n){if(!l(e))throw Error(r(299));var i=!1,o="",f=Uh,h=$h,x=Hh;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=xg(e,1,!1,null,null,i,o,null,f,h,x,jg),e[js]=n.current,sd(e),new kd(n)},Ir.hydrateRoot=function(e,n,i){if(!l(e))throw Error(r(299));var o=!1,f="",h=Uh,x=$h,w=Hh,N=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(N=i.formState)),n=xg(e,1,!0,n,i??null,o,f,N,h,x,w,jg),n.context=vg(null),i=n.current,o=pn(),o=Pa(o),f=Us(o),f.callback=null,$s(i,f,o),i=o,n.current.lanes=i,is(n,i),Vn(n),e[js]=n.current,sd(e),new Ro(n)},Ir.version="19.2.7",Ir}var $g;function oS(){if($g)return wd.exports;$g=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(t){console.error(t)}}return a(),wd.exports=lS(),wd.exports}var cS=oS();const uS=jf(cS),dS="modulepreload",fS=function(a){return"/"+a},Hg={},mn=function(t,s,r){let l=Promise.resolve();if(s&&s.length>0){let u=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));l=u(s.map(g=>{if(g=fS(g),g in Hg)return;Hg[g]=!0;const y=g.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":dS,y||(v.as="script"),v.crossOrigin="",v.href=g,p&&v.setAttribute("nonce",p),document.head.appendChild(v),y)return new Promise((S,k)=>{v.addEventListener("load",S),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return l.then(u=>{for(const d of u||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},be=a=>typeof a=="string",Pr=()=>{let a,t;const s=new Promise((r,l)=>{a=r,t=l});return s.resolve=a,s.reject=t,s},Ig=a=>a==null?"":String(a),pS=(a,t,s)=>{a.forEach(r=>{t[r]&&(s[r]=t[r])})},hS=/###/g,Pg=a=>a&&a.includes("###")?a.replace(hS,"."):a,Fg=a=>!a||be(a),tl=(a,t,s)=>{const r=be(t)?t.split("."):t;let l=0;for(;l<r.length-1;){if(Fg(a))return{};const c=Pg(r[l]);!a[c]&&s&&(a[c]=new s),Object.prototype.hasOwnProperty.call(a,c)?a=a[c]:a={},++l}return Fg(a)?{}:{obj:a,k:Pg(r[l])}},Gg=(a,t,s)=>{const{obj:r,k:l}=tl(a,t,Object);if(r!==void 0||t.length===1){r[l]=s;return}let c=t[t.length-1],u=t.slice(0,t.length-1),d=tl(a,u,Object);for(;d.obj===void 0&&u.length;)c=`${u[u.length-1]}.${c}`,u=u.slice(0,u.length-1),d=tl(a,u,Object),d!=null&&d.obj&&typeof d.obj[`${d.k}.${c}`]<"u"&&(d.obj=void 0);d.obj[`${d.k}.${c}`]=s},mS=(a,t,s,r)=>{const{obj:l,k:c}=tl(a,t,Object);l[c]=l[c]||[],l[c].push(s)},Wo=(a,t)=>{const{obj:s,k:r}=tl(a,t);if(s&&Object.prototype.hasOwnProperty.call(s,r))return s[r]},gS=(a,t,s)=>{const r=Wo(a,s);return r!==void 0?r:Wo(t,s)},vb=(a,t,s)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(Object.prototype.hasOwnProperty.call(a,r)?be(a[r])||a[r]instanceof String||be(t[r])||t[r]instanceof String?s&&(a[r]=t[r]):vb(a[r],t[r],s):a[r]=t[r]);return a},_s=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),yS={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},bS=a=>be(a)?a.replace(/[&<>"'\/]/g,t=>yS[t]):a;class xS{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const s=this.regExpMap.get(t);if(s!==void 0)return s;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const vS=[" ",",","?","!",";"],SS=new xS(20),kS=(a,t,s)=>{t=t||"",s=s||"";const r=vS.filter(u=>!t.includes(u)&&!s.includes(u));if(r.length===0)return!0;const l=SS.getRegExp(`(${r.map(u=>u==="?"?"\\?":u).join("|")})`);let c=!l.test(a);if(!c){const u=a.indexOf(s);u>0&&!l.test(a.substring(0,u))&&(c=!0)}return c},ef=(a,t,s=".")=>{if(!a)return;if(a[t])return Object.prototype.hasOwnProperty.call(a,t)?a[t]:void 0;const r=t.split(s);let l=a;for(let c=0;c<r.length;){if(!l||typeof l!="object")return;let u,d="";for(let p=c;p<r.length;++p)if(p!==c&&(d+=s),d+=r[p],u=l[d],u!==void 0){if(["string","number","boolean"].includes(typeof u)&&p<r.length-1)continue;c+=p-c+1;break}l=u}return l},ul=a=>a==null?void 0:a.replace(/_/g,"-"),wS={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,t){var s,r;(r=(s=console==null?void 0:console[a])==null?void 0:s.apply)==null||r.call(s,console,t)}};class Ko{constructor(t,s={}){this.init(t,s)}init(t,s={}){this.prefix=s.prefix||"i18next:",this.logger=t||wS,this.options=s,this.debug=s.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,s,r,l){return l&&!this.debug?null:(t=t.map(c=>be(c)?c.replace(/[\r\n\x00-\x1F\x7F]/g," "):c),be(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[s](t))}create(t){return new Ko(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ko(this.logger,t)}}var Yn=new Ko;class lc{constructor(){this.observers={}}on(t,s){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const l=this.observers[r].get(s)||0;this.observers[r].set(s,l+1)}),this}off(t,s){if(this.observers[t]){if(!s){delete this.observers[t];return}this.observers[t].delete(s)}}once(t,s){const r=(...l)=>{s(...l),this.off(t,r)};return this.on(t,r),this}emit(t,...s){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([l,c])=>{for(let u=0;u<c;u++)l(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([l,c])=>{for(let u=0;u<c;u++)l(t,...s)})}}class qg extends lc{constructor(t,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const s=this.options.ns.indexOf(t);s>-1&&this.options.ns.splice(s,1)}getResource(t,s,r,l={}){var g,y;const c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,u=l.ignoreJSONStructure!==void 0?l.ignoreJSONStructure:this.options.ignoreJSONStructure;let d;t.includes(".")?d=t.split("."):(d=[t,s],r&&(Array.isArray(r)?d.push(...r):be(r)&&c?d.push(...r.split(c)):d.push(r)));const p=Wo(this.data,d);return!p&&!s&&!r&&t.includes(".")&&(t=d[0],s=d[1],r=d.slice(2).join(".")),p||!u||!be(r)?p:ef((y=(g=this.data)==null?void 0:g[t])==null?void 0:y[s],r,c)}addResource(t,s,r,l,c={silent:!1}){const u=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let d=[t,s];r&&(d=d.concat(u?r.split(u):r)),t.includes(".")&&(d=t.split("."),l=s,s=d[1]),this.addNamespaces(s),Gg(this.data,d,l),c.silent||this.emit("added",t,s,r,l)}addResources(t,s,r,l={silent:!1}){for(const c in r)(be(r[c])||Array.isArray(r[c]))&&this.addResource(t,s,c,r[c],{silent:!0});l.silent||this.emit("added",t,s,r)}addResourceBundle(t,s,r,l,c,u={silent:!1,skipCopy:!1}){let d=[t,s];t.includes(".")&&(d=t.split("."),l=r,r=s,s=d[1]),this.addNamespaces(s);let p=Wo(this.data,d)||{};u.skipCopy||(r=JSON.parse(JSON.stringify(r))),l?vb(p,r,c):p={...p,...r},Gg(this.data,d,p),u.silent||this.emit("added",t,s,r)}removeResourceBundle(t,s){this.hasResourceBundle(t,s)&&delete this.data[t][s],this.removeNamespaces(s),this.emit("removed",t,s)}hasResourceBundle(t,s){return this.getResource(t,s)!==void 0}getResourceBundle(t,s){return s||(s=this.options.defaultNS),this.getResource(t,s)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const s=this.getDataByLanguage(t);return!!(s&&Object.keys(s)||[]).find(l=>s[l]&&Object.keys(s[l]).length>0)}toJSON(){return this.data}}var Sb={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,t,s,r,l){return a.forEach(c=>{var u;t=((u=this.processors[c])==null?void 0:u.process(t,s,r,l))??t}),t}};const kb=Symbol("i18next/PATH_KEY");function _S(){const a=[],t=Object.create(null);let s;return t.get=(r,l)=>{var c;return(c=s==null?void 0:s.revoke)==null||c.call(s),l===kb?a:(a.push(l),s=Proxy.revocable(r,t),s.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Oi(a,t){const{[kb]:s}=a(_S()),r=(t==null?void 0:t.keySeparator)??".",l=(t==null?void 0:t.nsSeparator)??":",c=(t==null?void 0:t.enableSelector)==="strict";if(s.length>1&&l){const u=t==null?void 0:t.ns,d=c?Array.isArray(u)?u:u?[u]:null:Array.isArray(u)?u:null;if(d&&(c?d:d.length>1?d.slice(1):[]).includes(s[0]))return`${s[0]}${l}${s.slice(1).join(r)}`}return s.join(r)}const Ed=a=>!be(a)&&typeof a!="boolean"&&typeof a!="number";class Yo extends lc{constructor(t,s={}){super(),pS(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Yn.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,s={interpolation:{}}){const r={...s};if(t==null)return!1;const l=this.resolve(t,r);if((l==null?void 0:l.res)===void 0)return!1;const c=Ed(l.res);return!(r.returnObjects===!1&&c)}extractFromKey(t,s){let r=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const l=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=s.ns||this.options.defaultNS||[];const u=r&&t.includes(r),d=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!kS(t,r,l);if(u&&!d){const p=t.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:t,namespaces:be(c)?[c]:c};const g=t.split(r);(r!==l||r===l&&this.options.ns.includes(g[0]))&&(c=g.shift()),t=g.join(l)}return{key:t,namespaces:be(c)?[c]:c}}translate(t,s,r){let l=typeof s=="object"?{...s}:s;if(typeof l!="object"&&this.options.overloadTranslationOptionHandler&&(l=this.options.overloadTranslationOptionHandler(arguments)),typeof l=="object"&&(l={...l}),l||(l={}),t==null)return"";typeof t=="function"&&(t=Oi(t,{...this.options,...l})),Array.isArray(t)||(t=[String(t)]),t=t.map(W=>typeof W=="function"?Oi(W,{...this.options,...l}):String(W));const c=l.returnDetails!==void 0?l.returnDetails:this.options.returnDetails,u=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,{key:d,namespaces:p}=this.extractFromKey(t[t.length-1],l),g=p[p.length-1];let y=l.nsSeparator!==void 0?l.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const b=l.lng||this.language,v=l.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((b==null?void 0:b.toLowerCase())==="cimode")return v?c?{res:`${g}${y}${d}`,usedKey:d,exactUsedKey:d,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(l)}:`${g}${y}${d}`:c?{res:d,usedKey:d,exactUsedKey:d,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(l)}:d;const S=this.resolve(t,l);let k=S==null?void 0:S.res;const C=(S==null?void 0:S.usedKey)||d,E=(S==null?void 0:S.exactUsedKey)||d,O=["[object Number]","[object Function]","[object RegExp]"],j=l.joinArrays!==void 0?l.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject,z=l.count!==void 0&&!be(l.count),R=Yo.hasDefaultValue(l),Z=z?this.pluralResolver.getSuffix(b,l.count,l):"",Q=l.ordinal&&z?this.pluralResolver.getSuffix(b,l.count,{ordinal:!1}):"",te=z&&!l.ordinal&&l.count===0,he=te&&l[`defaultValue${this.options.pluralSeparator}zero`]||l[`defaultValue${Z}`]||l[`defaultValue${Q}`]||l.defaultValue;let me=k;T&&!k&&R&&(me=he);const lt=Ed(me),de=Object.prototype.toString.apply(me);if(T&&me&<&&!O.includes(de)&&!(be(j)&&Array.isArray(me))){if(!l.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,me,{...l,ns:p}):`key '${d} (${this.language})' returned an object instead of string.`;return c?(S.res=W,S.usedParams=this.getUsedParamsDetails(l),S):W}if(u){const W=Array.isArray(me),K=W?[]:{},ge=W?E:C;for(const $ in me)if(Object.prototype.hasOwnProperty.call(me,$)){const X=`${ge}${u}${$}`;R&&!k?K[$]=this.translate(X,{...l,defaultValue:Ed(he)?he[$]:void 0,joinArrays:!1,ns:p}):K[$]=this.translate(X,{...l,joinArrays:!1,ns:p}),K[$]===X&&(K[$]=me[$])}k=K}}else if(T&&be(j)&&Array.isArray(k))k=k.join(j),k&&(k=this.extendTranslation(k,t,l,r));else{let W=!1,K=!1;!this.isValidLookup(k)&&R&&(W=!0,k=he),this.isValidLookup(k)||(K=!0,k=d);const $=(l.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:k,X=R&&he!==k&&this.options.updateMissing;if(K||W||X){if(this.logger.log(X?"updateKey":"missingKey",b,g,z&&!X?`${d}${this.pluralResolver.getSuffix(b,l.count,l)}`:d,X?he:k),u){const Pe=this.resolve(d,{...l,keySeparator:!1});Pe&&Pe.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 ne=[];const Oe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,l.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Oe&&Oe[0])for(let Pe=0;Pe<Oe.length;Pe++)ne.push(Oe[Pe]);else this.options.saveMissingTo==="all"?ne=this.languageUtils.toResolveHierarchy(l.lng||this.language):ne.push(l.lng||this.language);const Me=(Pe,je,Ee)=>{var st;const nt=R&&Ee!==k?Ee:$;this.options.missingKeyHandler?this.options.missingKeyHandler(Pe,g,je,nt,X,l):(st=this.backendConnector)!=null&&st.saveMissing&&this.backendConnector.saveMissing(Pe,g,je,nt,X,l),this.emit("missingKey",Pe,g,je,k)};this.options.saveMissing&&(this.options.saveMissingPlurals&&z?ne.forEach(Pe=>{const je=this.pluralResolver.getSuffixes(Pe,l);te&&l[`defaultValue${this.options.pluralSeparator}zero`]&&!je.includes(`${this.options.pluralSeparator}zero`)&&je.push(`${this.options.pluralSeparator}zero`),je.forEach(Ee=>{Me([Pe],d+Ee,l[`defaultValue${Ee}`]||he)})}):Me(ne,d,he))}k=this.extendTranslation(k,t,l,S,r),K&&k===d&&this.options.appendNamespaceToMissingKey&&(k=`${g}${y}${d}`),(K||W)&&this.options.parseMissingKeyHandler&&(k=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}${y}${d}`:d,W?k:void 0,l))}return c?(S.res=k,S.usedParams=this.getUsedParamsDetails(l),S):k}extendTranslation(t,s,r,l,c){var p,g;if((p=this.i18nFormat)!=null&&p.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||l.usedLng,l.usedNS,l.usedKey,{resolved:l});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const y=be(t)&&(((g=r==null?void 0:r.interpolation)==null?void 0:g.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let b;if(y){const S=t.match(this.interpolator.nestingRegexp);b=S&&S.length}let v=r.replace&&!be(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(v={...this.options.interpolation.defaultVariables,...v}),t=this.interpolator.interpolate(t,v,r.lng||this.language||l.usedLng,r),y){const S=t.match(this.interpolator.nestingRegexp),k=S&&S.length;b<k&&(r.nest=!1)}!r.lng&&l&&l.res&&(r.lng=this.language||l.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>(c==null?void 0:c[0])===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${s[0]}`),null):this.translate(...S,s),r)),r.interpolation&&this.interpolator.reset()}const u=r.postProcess||this.options.postProcess,d=be(u)?[u]:u;return t!=null&&(d!=null&&d.length)&&r.applyPostProcessor!==!1&&(t=Sb.handle(d,t,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...l,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,s={}){let r,l,c,u,d;return be(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(p=>typeof p=="function"?Oi(p,{...this.options,...s}):p)),t.forEach(p=>{if(this.isValidLookup(r))return;const g=this.extractFromKey(p,s),y=g.key;l=y;let b=g.namespaces;this.options.fallbackNS&&(b=b.concat(this.options.fallbackNS));const v=s.count!==void 0&&!be(s.count),S=v&&!s.ordinal&&s.count===0,k=s.context!==void 0&&(be(s.context)||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);b.forEach(E=>{var O,j;this.isValidLookup(r)||(d=E,!this.checkedLoadedFor[`${C[0]}-${E}`]&&((O=this.utils)!=null&&O.hasLoadedNamespace)&&!((j=this.utils)!=null&&j.hasLoadedNamespace(d))&&(this.checkedLoadedFor[`${C[0]}-${E}`]=!0,this.logger.warn(`key "${l}" for languages "${C.join(", ")}" won't get resolved as namespace "${d}" 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!!!")),C.forEach(T=>{var Z;if(this.isValidLookup(r))return;u=T;const z=[y];if((Z=this.i18nFormat)!=null&&Z.addLookupKeys)this.i18nFormat.addLookupKeys(z,y,T,E,s);else{let Q;v&&(Q=this.pluralResolver.getSuffix(T,s.count,s));const te=`${this.options.pluralSeparator}zero`,he=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(s.ordinal&&Q.startsWith(he)&&z.push(y+Q.replace(he,this.options.pluralSeparator)),z.push(y+Q),S&&z.push(y+te)),k){const me=`${y}${this.options.contextSeparator||"_"}${s.context}`;z.push(me),v&&(s.ordinal&&Q.startsWith(he)&&z.push(me+Q.replace(he,this.options.pluralSeparator)),z.push(me+Q),S&&z.push(me+te))}}let R;for(;R=z.pop();)this.isValidLookup(r)||(c=R,r=this.getResource(T,E,R,s))}))})}),{res:r,usedKey:l,exactUsedKey:c,usedLng:u,usedNS:d}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,s,r,l={}){var c;return(c=this.i18nFormat)!=null&&c.getResource?this.i18nFormat.getResource(t,s,r,l):this.resourceStore.getResource(t,s,r,l)}getUsedParamsDetails(t={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!be(t.replace);let l=r?t.replace:t;if(r&&typeof t.count<"u"&&(l={...l,count:t.count}),this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),!r){l={...l};for(const c of s)delete l[c]}return l}static hasDefaultValue(t){const s="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith(s)&&t[r]!==void 0)return!0;return!1}}class Vg{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Yn.create("languageUtils")}getScriptPartFromCode(t){if(t=ul(t),!t||!t.includes("-"))return null;const s=t.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(t){if(t=ul(t),!t||!t.includes("-"))return t;const s=t.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(t){if(be(t)&&t.includes("-")){let s;try{s=Intl.getCanonicalLocales(t)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let s;return t.forEach(r=>{if(s)return;const l=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(l))&&(s=l)}),!s&&this.options.supportedLngs&&t.forEach(r=>{if(s)return;const l=this.getScriptPartFromCode(r);if(this.isSupportedCode(l))return s=l;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return s=c;s=this.options.supportedLngs.find(u=>u===c?!0:!u.includes("-")&&!c.includes("-")?!1:!!(u.includes("-")&&!c.includes("-")&&u.slice(0,u.indexOf("-"))===c||u.startsWith(c)&&c.length>1))}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(t,s){if(!t)return[];if(typeof t=="function"&&(t=t(s)),be(t)&&(t=[t]),Array.isArray(t))return t;if(!s)return t.default||[];let r=t[s];return r||(r=t[this.getScriptPartFromCode(s)]),r||(r=t[this.formatLanguageCode(s)]),r||(r=t[this.getLanguagePartFromCode(s)]),r||(r=t.default),r||[]}toResolveHierarchy(t,s){const r=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],t),l=[],c=u=>{u&&(this.isSupportedCode(u)?l.push(u):this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`))};return be(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):be(t)&&c(this.formatLanguageCode(t)),r.forEach(u=>{l.includes(u)||c(this.formatLanguageCode(u))}),l}}const Wg={zero:0,one:1,two:2,few:3,many:4,other:5},Kg={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class CS{constructor(t,s={}){this.languageUtils=t,this.options=s,this.logger=Yn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,s={}){const r=ul(t==="dev"?"en":t),l=s.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:l});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let u;try{u=new Intl.PluralRules(r,{type:l})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Kg;if(!t.match(/-|_/))return Kg;const p=this.languageUtils.getLanguagePartFromCode(t);u=this.getRule(p,s)}return this.pluralRulesCache[c]=u,u}needsPlural(t,s={}){let r=this.getRule(t,s);return r||(r=this.getRule("dev",s)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,s,r={}){return this.getSuffixes(t,r).map(l=>`${s}${l}`)}getSuffixes(t,s={}){let r=this.getRule(t,s);return r||(r=this.getRule("dev",s)),r?r.resolvedOptions().pluralCategories.sort((l,c)=>Wg[l]-Wg[c]).map(l=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${l}`):[]}getSuffix(t,s,r={}){const l=this.getRule(t,r);return l?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${l.select(s)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",s,r))}}const Yg=(a,t,s,r=".",l=!0)=>{let c=gS(a,t,s);return!c&&l&&be(s)&&(c=ef(a,s,r),c===void 0&&(c=ef(t,s,r))),c},ES=a=>a.replace(/\$/g,"$$$$");class Zg{constructor(t={}){var s;this.logger=Yn.create("interpolator"),this.options=t,this.format=((s=t==null?void 0:t.interpolation)==null?void 0:s.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:s,escapeValue:r,useRawValueToEscape:l,prefix:c,prefixEscaped:u,suffix:d,suffixEscaped:p,formatSeparator:g,unescapeSuffix:y,unescapePrefix:b,nestingPrefix:v,nestingPrefixEscaped:S,nestingSuffix:k,nestingSuffixEscaped:C,nestingOptionsSeparator:E,maxReplaces:O,alwaysFormat:j}=t.interpolation;this.escape=s!==void 0?s:bS,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=l!==void 0?l:!1,this.prefix=c?_s(c):u||"{{",this.suffix=d?_s(d):p||"}}",this.formatSeparator=g||",",this.unescapePrefix=y?"":b?_s(b):"-",this.unescapeSuffix=this.unescapePrefix?"":y?_s(y):"",this.nestingPrefix=v?_s(v):S||_s("$t("),this.nestingSuffix=k?_s(k):C||_s(")"),this.nestingOptionsSeparator=E||",",this.maxReplaces=O||1e3,this.alwaysFormat=j!==void 0?j:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(s,r)=>(s==null?void 0:s.source)===r?(s.lastIndex=0,s):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,s,r,l){var S;let c,u,d;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},g=k=>{if(!k.includes(this.formatSeparator)){const j=Yg(s,p,k,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(j,void 0,r,{...l,...s,interpolationkey:k}):j}const C=k.split(this.formatSeparator),E=C.shift().trim(),O=C.join(this.formatSeparator).trim();return this.format(Yg(s,p,E,this.options.keySeparator,this.options.ignoreJSONStructure),O,r,{...l,...s,interpolationkey:E})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const y=(l==null?void 0:l.missingInterpolationHandler)||this.options.missingInterpolationHandler,b=((S=l==null?void 0:l.interpolation)==null?void 0:S.skipOnVariables)!==void 0?l.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:k=>k},{regex:this.regexp,safeValue:k=>this.escapeValue?this.escape(k):k}].forEach(k=>{for(d=0;c=k.regex.exec(t);){const C=c[1].trim();if(u=g(C),u===void 0)if(typeof y=="function"){const O=y(t,c,l);u=be(O)?O:""}else if(l&&Object.prototype.hasOwnProperty.call(l,C))u="";else if(b){u=c[0];continue}else this.logger.warn(`missed to pass in variable ${C} for interpolating ${t}`),u="";else!be(u)&&!this.useRawValueToEscape&&(u=Ig(u));const E=k.safeValue(u);if(t=t.replace(c[0],ES(E)),b?(k.regex.lastIndex+=E.length,k.regex.lastIndex-=c[0].length):k.regex.lastIndex=0,d++,d>=this.maxReplaces)break}}),t}nest(t,s,r={}){let l,c,u;const d=(p,g)=>{const y=this.nestingOptionsSeparator;if(!p.includes(y))return p;const b=p.split(new RegExp(`${_s(y)}[ ]*{`));let v=`{${b[1]}`;p=b[0],v=this.interpolate(v,u);const S=v.match(/'/g),k=v.match(/"/g);(((S==null?void 0:S.length)??0)%2===0&&!k||((k==null?void 0:k.length)??0)%2!==0)&&(v=v.replace(/'/g,'"'));try{u=JSON.parse(v),g&&(u={...g,...u})}catch(C){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,C),`${p}${y}${v}`}return u.defaultValue&&u.defaultValue.includes(this.prefix)&&delete u.defaultValue,p};for(;l=this.nestingRegexp.exec(t);){let p=[];u={...r},u=u.replace&&!be(u.replace)?u.replace:u,u.applyPostProcessor=!1,delete u.defaultValue;const g=/{.*}/s.test(l[1])?l[1].lastIndexOf("}")+1:l[1].indexOf(this.formatSeparator);if(g!==-1&&(p=l[1].slice(g).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),l[1]=l[1].slice(0,g)),c=s(d.call(this,l[1].trim(),u),u),c&&l[0]===t&&!be(c))return c;be(c)||(c=Ig(c)),c||(this.logger.warn(`missed to resolve ${l[1]} for nesting ${t}`),c=""),p.length&&(c=p.reduce((y,b)=>this.format(y,b,r.lng,{...r,interpolationkey:l[1].trim()}),c.trim())),t=t.replace(l[0],c),this.regexp.lastIndex=0}return t}}const NS=a=>{let t=a.toLowerCase().trim();const s={};if(a.includes("(")){const r=a.split("(");t=r[0].toLowerCase().trim();const l=r[1].slice(0,-1);t==="currency"&&!l.includes(":")?s.currency||(s.currency=l.trim()):t==="relativetime"&&!l.includes(":")?s.range||(s.range=l.trim()):l.split(";").forEach(u=>{if(u){const[d,...p]=u.split(":"),g=p.join(":").trim().replace(/^'+|'+$/g,""),y=d.trim();s[y]||(s[y]=g),g==="false"&&(s[y]=!1),g==="true"&&(s[y]=!0),isNaN(g)||(s[y]=parseInt(g,10))}})}return{formatName:t,formatOptions:s}},Qg=a=>{const t={};return(s,r,l)=>{let c=l;l&&l.interpolationkey&&l.formatParams&&l.formatParams[l.interpolationkey]&&l[l.interpolationkey]&&(c={...c,[l.interpolationkey]:void 0});const u=r+JSON.stringify(c);let d=t[u];return d||(d=a(ul(r),l),t[u]=d),d(s)}},TS=a=>(t,s,r)=>a(ul(s),r)(t);class AS{constructor(t={}){this.logger=Yn.create("formatter"),this.options=t,this.init(t)}init(t,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const r=s.cacheInBuiltFormats?Qg:TS;this.formats={number:r((l,c)=>{const u=new Intl.NumberFormat(l,{...c});return d=>u.format(d)}),currency:r((l,c)=>{const u=new Intl.NumberFormat(l,{...c,style:"currency"});return d=>u.format(d)}),datetime:r((l,c)=>{const u=new Intl.DateTimeFormat(l,{...c});return d=>u.format(d)}),relativetime:r((l,c)=>{const u=new Intl.RelativeTimeFormat(l,{...c});return d=>u.format(d,c.range||"day")}),list:r((l,c)=>{const u=new Intl.ListFormat(l,{...c});return d=>u.format(d)})}}add(t,s){this.formats[t.toLowerCase().trim()]=s}addCached(t,s){this.formats[t.toLowerCase().trim()]=Qg(s)}format(t,s,r,l={}){if(!s||t==null)return t;const c=s.split(this.formatSeparator),u=[];for(let p=0;p<c.length;p++){let g=c[p];for(;g.indexOf("(")>-1&&!g.includes(")")&&p+1<c.length;)g=`${g}${this.formatSeparator}${c[++p]}`;u.push(g)}return u.reduce((p,g)=>{var v;const{formatName:y,formatOptions:b}=NS(g);if(this.formats[y]){let S=p;try{const k=((v=l==null?void 0:l.formatParams)==null?void 0:v[l.interpolationkey])||{},C=k.locale||k.lng||l.locale||l.lng||r;S=this.formats[y](p,C,{...b,...l,...k})}catch(k){this.logger.warn(k)}return S}else this.logger.warn(`there was no format function for ${y}`);return p},t)}}const jS=(a,t)=>{a.pending[t]!==void 0&&(delete a.pending[t],a.pendingCount--)};class RS extends lc{constructor(t,s,r,l={}){var c,u;super(),this.backend=t,this.store=s,this.services=r,this.languageUtils=r.languageUtils,this.options=l,this.logger=Yn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=l.maxParallelReads||10,this.readingCalls=0,this.maxRetries=l.maxRetries>=0?l.maxRetries:5,this.retryTimeout=l.retryTimeout>=1?l.retryTimeout:350,this.state={},this.queue=[],(u=(c=this.backend)==null?void 0:c.init)==null||u.call(c,r,l.backend,l)}queueLoad(t,s,r,l){const c={},u={},d={},p={};return t.forEach(g=>{let y=!0;s.forEach(b=>{const v=`${g}|${b}`;!r.reload&&this.store.hasResourceBundle(g,b)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?u[v]===void 0&&(u[v]=!0):(this.state[v]=1,y=!1,u[v]===void 0&&(u[v]=!0),c[v]===void 0&&(c[v]=!0),p[b]===void 0&&(p[b]=!0)))}),y||(d[g]=!0)}),(Object.keys(c).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:l}),{toLoad:Object.keys(c),pending:Object.keys(u),toLoadLanguages:Object.keys(d),toLoadNamespaces:Object.keys(p)}}loaded(t,s,r){const l=t.split("|"),c=l[0],u=l[1];s&&this.emit("failedLoading",c,u,s),!s&&r&&this.store.addResourceBundle(c,u,r,void 0,void 0,{skipCopy:!0}),this.state[t]=s?-1:2,s&&r&&(this.state[t]=0);const d={};this.queue.forEach(p=>{mS(p.loaded,[c],u),jS(p,t),s&&p.errors.push(s),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(g=>{d[g]||(d[g]={});const y=p.loaded[g];y.length&&y.forEach(b=>{d[g][b]===void 0&&(d[g][b]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",d),this.queue=this.queue.filter(p=>!p.done)}read(t,s,r,l=0,c=this.retryTimeout,u){if(!t.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:s,fcName:r,tried:l,wait:c,callback:u});return}this.readingCalls++;const d=(g,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const b=this.waitingReads.shift();this.read(b.lng,b.ns,b.fcName,b.tried,b.wait,b.callback)}if(g&&y&&l<this.maxRetries){setTimeout(()=>{this.read(t,s,r,l+1,c*2,u)},c);return}u(g,y)},p=this.backend[r].bind(this.backend);if(p.length===2){try{const g=p(t,s);g&&typeof g.then=="function"?g.then(y=>d(null,y)).catch(d):d(null,g)}catch(g){d(g)}return}return p(t,s,d)}prepareLoading(t,s,r={},l){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();be(t)&&(t=this.languageUtils.toResolveHierarchy(t)),be(s)&&(s=[s]);const c=this.queueLoad(t,s,r,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(u=>{this.loadOne(u)})}load(t,s,r){this.prepareLoading(t,s,{},r)}reload(t,s,r){this.prepareLoading(t,s,{reload:!0},r)}loadOne(t,s=""){const r=t.split("|"),l=r[0],c=r[1];this.read(l,c,"read",void 0,void 0,(u,d)=>{u&&this.logger.warn(`${s}loading namespace ${c} for language ${l} failed`,u),!u&&d&&this.logger.log(`${s}loaded namespace ${c} for language ${l}`,d),this.loaded(t,u,d)})}saveMissing(t,s,r,l,c,u={},d=()=>{}){var p,g,y,b,v;if((g=(p=this.services)==null?void 0:p.utils)!=null&&g.hasLoadedNamespace&&!((b=(y=this.services)==null?void 0:y.utils)!=null&&b.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${r}" as the namespace "${s}" 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(!(r==null||r==="")){if((v=this.backend)!=null&&v.create){const S={...u,isUpdate:c},k=this.backend.create.bind(this.backend);if(k.length<6)try{let C;k.length===5?C=k(t,s,r,l,S):C=k(t,s,r,l),C&&typeof C.then=="function"?C.then(E=>d(null,E)).catch(d):d(null,C)}catch(C){d(C)}else k(t,s,r,l,d,S)}!t||!t[0]||this.store.addResource(t[0],s,r,l)}}}const Nd=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,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:a=>{let t={};if(typeof a[1]=="object"&&(t=a[1]),be(a[1])&&(t.defaultValue=a[1]),be(a[2])&&(t.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const s=a[3]||a[2];Object.keys(s).forEach(r=>{t[r]=s[r]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Xg=a=>(be(a.ns)&&(a.ns=[a.ns]),be(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),be(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),a.supportedLngs&&!a.supportedLngs.includes("cimode")&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),a),Mo=()=>{},OS=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(s=>{typeof a[s]=="function"&&(a[s]=a[s].bind(a))})};class nl extends lc{constructor(t={},s){if(super(),this.options=Xg(t),this.services={},this.logger=Yn,this.modules={external:[]},OS(this),s&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,s),this;setTimeout(()=>{this.init(t,s)},0)}}init(t={},s){this.isInitializing=!0,typeof t=="function"&&(s=t,t={}),t.defaultNS==null&&t.ns&&(be(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const r=Nd();this.options={...r,...this.options,...Xg(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const l=g=>g?typeof g=="function"?new g:g:null;if(!this.options.isClone){this.modules.logger?Yn.init(l(this.modules.logger),this.options):Yn.init(null,this.options);let g;this.modules.formatter?g=this.modules.formatter:g=AS;const y=new Vg(this.options);this.store=new qg(this.options.resources,this.options);const b=this.services;b.logger=Yn,b.resourceStore=this.store,b.languageUtils=y,b.pluralResolver=new CS(y,{prepend:this.options.pluralSeparator}),g&&(b.formatter=l(g),b.formatter.init&&b.formatter.init(b,this.options),this.options.interpolation.format=b.formatter.format.bind(b.formatter)),b.interpolator=new Zg(this.options),b.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},b.backendConnector=new RS(l(this.modules.backend),b.resourceStore,b,this.options),b.backendConnector.on("*",(v,...S)=>{this.emit(v,...S)}),this.modules.languageDetector&&(b.languageDetector=l(this.modules.languageDetector),b.languageDetector.init&&b.languageDetector.init(b,this.options.detection,this.options)),this.modules.i18nFormat&&(b.i18nFormat=l(this.modules.i18nFormat),b.i18nFormat.init&&b.i18nFormat.init(this)),this.translator=new Yo(this.services,this.options),this.translator.on("*",(v,...S)=>{this.emit(v,...S)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Mo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const g=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);g.length>0&&g[0]!=="dev"&&(this.options.lng=g[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(g=>{this[g]=(...y)=>this.store[g](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(g=>{this[g]=(...y)=>(this.store[g](...y),this)});const d=Pr(),p=()=>{const g=(y,b)=>{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),d.resolve(b),s(y,b)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return g(null,this.t.bind(this));this.changeLanguage(this.options.lng,g)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),d}loadResources(t,s=Mo){var c,u;let r=s;const l=be(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((l==null?void 0:l.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const d=[],p=g=>{if(!g||g==="cimode")return;this.services.languageUtils.toResolveHierarchy(g).forEach(b=>{b!=="cimode"&&(d.includes(b)||d.push(b))})};l?p(l):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(y=>p(y)),(u=(c=this.options.preload)==null?void 0:c.forEach)==null||u.call(c,g=>p(g)),this.services.backendConnector.load(d,this.options.ns,g=>{!g&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(g)})}else r(null)}reloadResources(t,s,r){const l=Pr();return typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=void 0),t||(t=this.languages),s||(s=this.options.ns),r||(r=Mo),this.services.backendConnector.reload(t,s,c=>{l.resolve(),r(c)}),l}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Sb.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let s=0;s<this.languages.length;s++){const r=this.languages[s];if(!["cimode","dev"].includes(r)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,s){this.isLanguageChangingTo=t;const r=Pr();this.emit("languageChanging",t);const l=d=>{this.language=d,this.languages=this.services.languageUtils.toResolveHierarchy(d),this.resolvedLanguage=void 0,this.setResolvedLanguage(d)},c=(d,p)=>{p?this.isLanguageChangingTo===t&&(l(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,r.resolve((...g)=>this.t(...g)),s&&s(d,(...g)=>this.t(...g))},u=d=>{var y,b;!t&&!d&&this.services.languageDetector&&(d=[]);const p=be(d)?d:d&&d[0],g=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(be(d)?[d]:d);g&&(this.language||l(g),this.translator.language||this.translator.changeLanguage(g),(b=(y=this.services.languageDetector)==null?void 0:y.cacheUserLanguage)==null||b.call(y,g)),this.loadResources(g,v=>{c(v,g)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),r}getFixedT(t,s,r,l){const c=l==null?void 0:l.scopeNs,u=(d,p,...g)=>{let y;typeof p!="object"?y=this.options.overloadTranslationOptionHandler([d,p].concat(g)):y={...p},y.lng=y.lng||u.lng,y.lngs=y.lngs||u.lngs;const b=y.ns!==void 0&&y.ns!==null;y.ns=y.ns||u.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||r||u.keyPrefix);const v={...this.options,...y};Array.isArray(c)&&!b&&(v.ns=c),typeof y.keyPrefix=="function"&&(y.keyPrefix=Oi(y.keyPrefix,v));const S=this.options.keySeparator||".";let k;return y.keyPrefix&&Array.isArray(d)?k=d.map(C=>(typeof C=="function"&&(C=Oi(C,v)),`${y.keyPrefix}${S}${C}`)):(typeof d=="function"&&(d=Oi(d,v)),k=y.keyPrefix?`${y.keyPrefix}${S}${d}`:d),this.t(k,y)};return be(t)?u.lng=t:u.lngs=t,u.ns=s,u.keyPrefix=r,u}t(...t){var s;return(s=this.translator)==null?void 0:s.translate(...t)}exists(...t){var s;return(s=this.translator)==null?void 0:s.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,s={}){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 r=s.lng||this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const u=(d,p)=>{const g=this.services.backendConnector.state[`${d}|${p}`];return g===-1||g===0||g===2};if(s.precheck){const d=s.precheck(this,u);if(d!==void 0)return d}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(r,t)&&(!l||u(c,t)))}loadNamespaces(t,s){const r=Pr();return this.options.ns?(be(t)&&(t=[t]),t.forEach(l=>{this.options.ns.includes(l)||this.options.ns.push(l)}),this.loadResources(l=>{r.resolve(),s&&s(l)}),r):(s&&s(),Promise.resolve())}loadLanguages(t,s){const r=Pr();be(t)&&(t=[t]);const l=this.options.preload||[],c=t.filter(u=>!l.includes(u)&&this.services.languageUtils.isSupportedCode(u));return c.length?(this.options.preload=l.concat(c),this.loadResources(u=>{r.resolve(),s&&s(u)}),r):(s&&s(),Promise.resolve())}dir(t){var l,c;if(t||(t=this.resolvedLanguage||(((l=this.languages)==null?void 0:l.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const u=new Intl.Locale(t);if(u&&u.getTextInfo){const d=u.getTextInfo();if(d&&d.direction)return d.direction}}catch{}const s=["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"],r=((c=this.services)==null?void 0:c.languageUtils)||new Vg(Nd());return t.toLowerCase().indexOf("-latn")>1?"ltr":s.includes(r.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},s){const r=new nl(t,s);return r.createInstance=nl.createInstance,r}cloneInstance(t={},s=Mo){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const l={...this.options,...t,isClone:!0},c=new nl(l);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(d=>{c[d]=this[d]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const d=Object.keys(this.store.data).reduce((p,g)=>(p[g]={...this.store.data[g]},p[g]=Object.keys(p[g]).reduce((y,b)=>(y[b]={...p[g][b]},y),p[g]),p),{});c.store=new qg(d,l),c.services.resourceStore=c.store}if(t.interpolation){const p={...Nd().interpolation,...this.options.interpolation,...t.interpolation},g={...l,interpolation:p};c.services.interpolator=new Zg(g)}return c.translator=new Yo(c.services,l),c.translator.on("*",(d,...p)=>{c.emit(d,...p)}),c.init(l,s),c.translator.options=l,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ot=nl.createInstance();Ot.createInstance;Ot.dir;Ot.init;Ot.loadResources;Ot.reloadResources;Ot.use;Ot.changeLanguage;Ot.getFixedT;Ot.t;Ot.exists;Ot.setDefaultNamespace;Ot.hasLoadedNamespace;Ot.loadNamespaces;Ot.loadLanguages;const MS=(a,t,s,r)=>{var c,u,d,p;const l=[s,{code:t,...r||{}}];if((u=(c=a==null?void 0:a.services)==null?void 0:c.logger)!=null&&u.forward)return a.services.logger.forward(l,"warn","react-i18next::",!0);Ba(l[0])&&(l[0]=`react-i18next:: ${l[0]}`),(p=(d=a==null?void 0:a.services)==null?void 0:d.logger)!=null&&p.warn?a.services.logger.warn(...l):console!=null&&console.warn&&console.warn(...l)},Jg={},tf=(a,t,s,r)=>{Ba(s)&&Jg[s]||(Ba(s)&&(Jg[s]=new Date),MS(a,t,s,r))},wb=(a,t)=>()=>{if(a.isInitialized)t();else{const s=()=>{setTimeout(()=>{a.off("initialized",s)},0),t()};a.on("initialized",s)}},nf=(a,t,s)=>{a.loadNamespaces(t,wb(a,s))},ey=(a,t,s,r)=>{if(Ba(s)&&(s=[s]),a.options.preload&&a.options.preload.indexOf(t)>-1)return nf(a,s,r);s.forEach(l=>{a.options.ns.indexOf(l)<0&&a.options.ns.push(l)}),a.loadLanguages(t,wb(a,r))},BS=(a,t,s={})=>!t.languages||!t.languages.length?(tf(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(a,{lng:s.lng,precheck:(r,l)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!l(r.isLanguageChangingTo,a))return!1}}),Ba=a=>typeof a=="string",DS=a=>typeof a=="object"&&a!==null,LS=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,zS={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},US=a=>zS[a],$S=a=>a.replace(LS,US);let sf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$S,transDefaultProps:void 0};const HS=(a={})=>{sf={...sf,...a}},IS=()=>sf;let _b;const PS=a=>{_b=a},FS=()=>_b,GS={type:"3rdParty",init(a){HS(a.options.react),PS(a)}},qS=_.createContext();class VS{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var WS=aS();const KS=(a,t)=>{if(Ba(t))return t;if(DS(t)&&Ba(t.defaultValue))return t.defaultValue;if(typeof a=="function")return"";if(Array.isArray(a)){const s=a[a.length-1];return typeof s=="function"?"":s}return a},YS={t:KS,ready:!1},ZS=()=>()=>{},gn=(a,t={})=>{var he,me,lt;const{i18n:s}=t,{i18n:r,defaultNS:l}=_.useContext(qS)||{},c=s||r||FS();c&&!c.reportNamespaces&&(c.reportNamespaces=new VS),c||tf(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=_.useMemo(()=>{var de;return{...IS(),...(de=c==null?void 0:c.options)==null?void 0:de.react,...t}},[c,t]),{useSuspense:d,keyPrefix:p}=u,g=a||l||((he=c==null?void 0:c.options)==null?void 0:he.defaultNS),y=Ba(g)?[g]:g||["translation"],b=_.useMemo(()=>y,y);(lt=(me=c==null?void 0:c.reportNamespaces)==null?void 0:me.addUsedNamespaces)==null||lt.call(me,b);const v=_.useRef(0),S=_.useCallback(de=>{if(!c)return ZS;const{bindI18n:W,bindI18nStore:K}=u,ge=()=>{v.current+=1,de()};return W&&c.on(W,ge),K&&c.store.on(K,ge),()=>{W&&W.split(" ").forEach($=>c.off($,ge)),K&&K.split(" ").forEach($=>c.store.off($,ge))}},[c,u]),k=_.useRef(),C=_.useCallback(()=>{if(!c)return YS;const de=!!(c.isInitialized||c.initializedStoreOnce)&&b.every(ne=>BS(ne,c,u)),W=t.lng||c.language,K=v.current,ge=k.current;if(ge&&ge.ready===de&&ge.lng===W&&ge.keyPrefix===p&&ge.revision===K)return ge;const X={t:c.getFixedT(W,u.nsMode==="fallback"?b:b[0],p,{scopeNs:b}),ready:de,lng:W,keyPrefix:p,revision:K};return k.current=X,X},[c,b,p,u,t.lng]),[E,O]=_.useState(0),{t:j,ready:T}=WS.useSyncExternalStore(S,C,C);_.useEffect(()=>{if(c&&!T&&!d){const de=()=>O(W=>W+1);t.lng?ey(c,t.lng,b,de):nf(c,b,de)}},[c,t.lng,b,T,d,E]);const z=c||{},R=_.useRef(null),Z=_.useRef(),Q=de=>{const W=Object.getOwnPropertyDescriptors(de);W.__original&&delete W.__original;const K=Object.create(Object.getPrototypeOf(de),W);if(!Object.prototype.hasOwnProperty.call(K,"__original"))try{Object.defineProperty(K,"__original",{value:de,writable:!1,enumerable:!1,configurable:!1})}catch{}return K},te=_.useMemo(()=>{const de=z,W=de==null?void 0:de.language;let K=de;de&&(R.current&&R.current.__original===de?Z.current!==W?(K=Q(de),R.current=K,Z.current=W):K=R.current:(K=Q(de),R.current=K,Z.current=W));const ge=!T&&!d?(...X)=>(tf(c,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),j(...X)):j,$=[ge,K,T];return $.t=ge,$.i18n=K,$.ready=T,$},[j,z,T,z.resolvedLanguage,z.language,z.languages]);if(c&&d&&!T)throw new Promise(de=>{const W=()=>de();t.lng?ey(c,t.lng,b,W):nf(c,b,W)});return te},QS={};function XS(a,t){let s;try{s=a()}catch{return}return{getItem:l=>{var c;const u=p=>p===null?null:JSON.parse(p,void 0),d=(c=s.getItem(l))!=null?c:null;return d instanceof Promise?d.then(u):u(d)},setItem:(l,c)=>s.setItem(l,JSON.stringify(c,void 0)),removeItem:l=>s.removeItem(l)}}const dl=a=>t=>{try{const s=a(t);return s instanceof Promise?s:{then(r){return dl(r)(s)},catch(r){return this}}}catch(s){return{then(r){return this},catch(r){return dl(r)(s)}}}},JS=(a,t)=>(s,r,l)=>{let c={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,O)=>({...O,...E}),...t},u=!1;const d=new Set,p=new Set;let g;try{g=c.getStorage()}catch{}if(!g)return a((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),s(...E)},r,l);const y=dl(c.serialize),b=()=>{const E=c.partialize({...r()});let O;const j=y({state:E,version:c.version}).then(T=>g.setItem(c.name,T)).catch(T=>{O=T});if(O)throw O;return j},v=l.setState;l.setState=(E,O)=>{v(E,O),b()};const S=a((...E)=>{s(...E),b()},r,l);let k;const C=()=>{var E;if(!g)return;u=!1,d.forEach(j=>j(r()));const O=((E=c.onRehydrateStorage)==null?void 0:E.call(c,r()))||void 0;return dl(g.getItem.bind(g))(c.name).then(j=>{if(j)return c.deserialize(j)}).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==c.version){if(c.migrate)return c.migrate(j.state,j.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return j.state}).then(j=>{var T;return k=c.merge(j,(T=r())!=null?T:S),s(k,!0),b()}).then(()=>{O==null||O(k,void 0),u=!0,p.forEach(j=>j(k))}).catch(j=>{O==null||O(void 0,j)})};return l.persist={setOptions:E=>{c={...c,...E},E.getStorage&&(g=E.getStorage())},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>C(),hasHydrated:()=>u,onHydrate:E=>(d.add(E),()=>{d.delete(E)}),onFinishHydration:E=>(p.add(E),()=>{p.delete(E)})},C(),k||S},ek=(a,t)=>(s,r,l)=>{let c={storage:XS(()=>localStorage),partialize:C=>C,version:0,merge:(C,E)=>({...E,...C}),...t},u=!1;const d=new Set,p=new Set;let g=c.storage;if(!g)return a((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),s(...C)},r,l);const y=()=>{const C=c.partialize({...r()});return g.setItem(c.name,{state:C,version:c.version})},b=l.setState;l.setState=(C,E)=>{b(C,E),y()};const v=a((...C)=>{s(...C),y()},r,l);l.getInitialState=()=>v;let S;const k=()=>{var C,E;if(!g)return;u=!1,d.forEach(j=>{var T;return j((T=r())!=null?T:v)});const O=((E=c.onRehydrateStorage)==null?void 0:E.call(c,(C=r())!=null?C:v))||void 0;return dl(g.getItem.bind(g))(c.name).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==c.version){if(c.migrate)return[!0,c.migrate(j.state,j.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,j.state];return[!1,void 0]}).then(j=>{var T;const[z,R]=j;if(S=c.merge(R,(T=r())!=null?T:v),s(S,!0),z)return y()}).then(()=>{O==null||O(S,void 0),S=r(),u=!0,p.forEach(j=>j(S))}).catch(j=>{O==null||O(void 0,j)})};return l.persist={setOptions:C=>{c={...c,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>k(),hasHydrated:()=>u,onHydrate:C=>(d.add(C),()=>{d.delete(C)}),onFinishHydration:C=>(p.add(C),()=>{p.delete(C)})},c.skipHydration||k(),S||v},tk=(a,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((QS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),JS(a,t)):ek(a,t),da=tk;let ty=!1;function Zn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():(ty||(ty=!0,console.warn("[uuid] crypto.randomUUID unavailable (non-secure context) — using Math.random fallback")),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a==="x"?t:t&3|8).toString(16)}))}const nk=4e3,sa=Bt(a=>({toasts:[],addToast:(t,s,r)=>{const l=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,c={id:l,type:t,message:s,duration:r??nk,createdAt:Date.now()};a(u=>({toasts:[...u.toasts.slice(-9),c]})),c.duration>0&&setTimeout(()=>{a(u=>({toasts:u.toasts.filter(d=>d.id!==l)}))},c.duration)},dismissToast:t=>a(s=>({toasts:s.toasts.filter(r=>r.id!==t)})),clearAll:()=>a({toasts:[]})})),Se={info:(a,t)=>sa.getState().addToast("info",a,t),success:(a,t)=>sa.getState().addToast("success",a,t),warning:(a,t)=>sa.getState().addToast("warning",a,t),error:(a,t)=>sa.getState().addToast("error",a,t??6e3)},Ai=24;function af(a){if(a.preview){const l=String(a.preview).replace(/\s+/g," ").trim();return l.length>Ai?l.slice(0,Ai)+"…":l}const t=ve.getState().getMessages(a.id);if(!t||t.length===0)return"";const s=t.find(l=>l.type==="user"&&!l.deleted)||t.find(l=>!l.deleted)||t[0],r=String((s==null?void 0:s.content)||"").replace(/\s+/g," ").trim();return r?r.length>Ai?r.slice(0,Ai)+"…":r:""}function Cb(a,t){if(!t)return!1;const s=a.replace(/\s+/g," ").replace(/\.\.\.$/,"");return s?!t.startsWith(s):!0}const sk=3e4;function Lf(a){let t=0;function s(u,d){try{return localStorage.setItem(u,JSON.stringify(d)),t=0,!0}catch{return!1}}return{getItem:u=>{const d=localStorage.getItem(u);if(!d)return null;try{const p=JSON.parse(d);return p&&typeof p=="object"&&"state"in p?p:{state:p,version:0}}catch{return null}},setItem:(u,d)=>{var y;if(s(u,d))return;let p=d;for(const b of a.trims??[]){try{p=b(p)}catch{continue}if(s(u,p))return}const g=Date.now();if(g-t>sk){t=g;const b=new Error(`localStorage 配额已满或不可用(${a.key}),已降级为仅内存持久化,刷新页面将丢失部分历史。`);console.warn(`[${a.key}] 持久化失败:`,b);try{(y=a.onFailure)==null||y.call(a,b)}catch{}}},removeItem:u=>{try{localStorage.removeItem(u)}catch{}}}}const rf=6,Po=50,ny=60;let ak=0;const ik=100,Fr=2e3,Gr=(a,t)=>a&&(a.length>t?`${a.slice(0,t)}…`:a),Eb=a=>{const{logs:t,...s}=a;return{...s,description:Gr(s.description,Fr),result:Gr(s.result,Fr),error:Gr(s.error,Fr),stepPrompt:Gr(s.stepPrompt,Fr),context:s.context?Object.fromEntries(Object.entries(s.context).map(([r,l])=>[r,Gr(l,Fr)??""])):void 0,children:s.children?s.children.map(Eb):void 0}},Td=a=>[...a].sort((t,s)=>(s.lastActiveAt??s.createdAt??0)-(t.lastActiveAt??t.createdAt??0)),we=Bt()(da((a,t)=>({sessions:[],activeSessionId:null,sessionTabs:[],layout:"single",sessionWorkspaceDirs:{},tasksBySession:{},historySessions:[],addSession:s=>a(r=>({sessions:[s,...r.sessions].slice(0,ny),activeSessionId:s.id})),removeSession:s=>a(r=>{var l;return{sessions:r.sessions.filter(c=>c.id!==s),activeSessionId:r.activeSessionId===s?((l=r.sessions[0])==null?void 0:l.id)||null:r.activeSessionId}}),updateSession:(s,r)=>a(l=>({sessions:l.sessions.map(c=>c.id===s?{...c,...r}:c)})),setActiveSession:s=>a({activeSessionId:s}),setSessionWorkspaceDir:(s,r)=>a(l=>({sessionWorkspaceDirs:{...l.sessionWorkspaceDirs,[s]:r}})),getSessionWorkspaceDir:s=>t().sessionWorkspaceDirs[s]||"",addSessionTab:(s,r)=>{const l=t();if(l.sessionTabs.length>=rf){const v=l.sessionTabs.reduce((S,k)=>S.createdAt<k.createdAt?S:k);t().closeSessionTab(v.id)}const c=`session-${Date.now()}-${++ak}`,u=r&&r.split(/[\\/]/).filter(Boolean).pop()||void 0,d={id:c,title:s||`对话 ${l.sessionTabs.length+1}`,createdAt:Date.now(),lastActiveAt:Date.now(),project:u,status:"done"},p={id:c,title:s||`对话 ${l.sessionTabs.length+1}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0},g={...l.sessionWorkspaceDirs};r&&(g[c]=r);const y={...l.tasksBySession};y[c]||(y[c]=[]);const b=[d,...l.historySessions.filter(v=>v.id!==c)].slice(0,Po);return a({sessionTabs:Td([d,...l.sessionTabs]),sessions:[...l.sessions,p].slice(-ny),sessionWorkspaceDirs:g,tasksBySession:y,activeSessionId:c,historySessions:b}),c},closeSessionTab:s=>{var p;const r=t(),l=r.sessionTabs.find(g=>g.id===s),c=r.sessionTabs.filter(g=>g.id!==s);if(c.length===0)return;let u=r.historySessions;l&&(u=[l,...u.filter(g=>g.id!==s)].slice(0,Po));const d=c[c.length-1];a({sessionTabs:c,historySessions:u,activeSessionId:r.activeSessionId===s?d?d.id:((p=c[0])==null?void 0:p.id)||null:r.activeSessionId})},renameSessionTab:(s,r)=>a(l=>({sessionTabs:l.sessionTabs.map(c=>c.id===s?{...c,title:r}:c),sessions:l.sessions.map(c=>c.id===s?{...c,title:r,updatedAt:new Date().toISOString()}:c),historySessions:l.historySessions.map(c=>c.id===s?{...c,title:r}:c)})),getActiveSessionTab:()=>{const s=t();return s.sessionTabs.find(r=>r.id===s.activeSessionId)||null},getVisibleSessionTabs:()=>{const s=t(),r=s.sessionTabs.find(l=>l.id===s.activeSessionId);return r?[r]:s.sessionTabs.slice(0,1)},addSessionTask:(s,r,l,c)=>a(u=>{const d=u.tasksBySession[s]||[],p={id:`session-task-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:r.trim(),completed:!1,createdAt:Date.now(),backendId:l,description:c};return{tasksBySession:{...u.tasksBySession,[s]:[...d,p]}}}),toggleSessionTask:(s,r)=>a(l=>{const c=l.tasksBySession[s]||[];return{tasksBySession:{...l.tasksBySession,[s]:c.map(u=>u.id===r?{...u,completed:!u.completed}:u)}}}),removeSessionTask:(s,r)=>a(l=>({tasksBySession:{...l.tasksBySession,[s]:(l.tasksBySession[s]||[]).filter(c=>c.id!==r)}})),updateSessionTask:(s,r,l)=>a(c=>{const u=c.tasksBySession[s]||[];return{tasksBySession:{...c.tasksBySession,[s]:u.map(d=>d.id===r?{...d,title:l.trim()}:d)}}}),getSessionTasks:s=>t().tasksBySession[s]||[],setSessionTasks:(s,r)=>a(l=>({tasksBySession:{...l.tasksBySession,[s]:r}})),updateTaskPlanStatus:(s,r,l)=>a(c=>{const u=c.tasksBySession[s]||[];return{tasksBySession:{...c.tasksBySession,[s]:u.map(d=>d.id===r?{...d,...l}:d)}}}),autoNameSession:(s,r)=>{const c=t().sessionTabs.find(p=>p.id===s);if(!c||!/^对话 \d+$/.test(c.title))return;const u=r.replace(/\s+/g," ").trim(),d=u.slice(0,20)+(u.length>20?"...":"");d&&t().renameSessionTab(s,d)},updateSessionStatus:(s,r)=>a(l=>({sessionTabs:l.sessionTabs.map(c=>c.id===s?{...c,status:r}:c)})),touchSession:(s,r)=>a(l=>{const c=Date.now();let u;if(r){const p=r.replace(/\s+/g," ").trim();u=p.length>Ai?p.slice(0,Ai)+"…":p}const d=p=>({...p,lastActiveAt:c,...u&&!p.preview?{preview:u}:{}});return{sessionTabs:Td(l.sessionTabs.map(p=>p.id===s?d(p):p)),sessions:l.sessions.map(p=>p.id===s?{...p,updatedAt:new Date(c).toISOString()}:p),historySessions:l.historySessions.map(p=>p.id===s?d(p):p)}}),getHistorySessions:()=>t().historySessions,restoreHistorySession:s=>{const r=t(),l=r.historySessions.find(d=>d.id===s);if(!l)return;const c=r.historySessions.filter(d=>d.id!==s);if(r.sessionTabs.some(d=>d.id===s)){a({historySessions:c,activeSessionId:s});return}let u=r.sessionTabs;if(u.length>=rf){const d=u.reduce((p,g)=>p.createdAt<g.createdAt?p:g);u=u.filter(p=>p.id!==d.id),c.unshift(d)}a({sessionTabs:Td([l,...u]),historySessions:c.slice(0,Po),activeSessionId:s})},clearHistorySessions:()=>a({historySessions:[]}),removeHistorySession:s=>a(r=>({historySessions:r.historySessions.filter(l=>l.id!==s)}))}),{name:"deepseekcode-session-storage",storage:Lf({key:"sessionStore",trims:[a=>({...a,state:{...a.state,tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).map(([t,s])=>[t,s.map(r=>({id:r.id,title:r.title,completed:r.completed,createdAt:r.createdAt,planStatus:r.planStatus,backendId:r.backendId,backendStatus:r.backendStatus,agentType:r.agentType,progress:r.progress}))]))}}),a=>{const t=new Set([...a.state.sessionTabs.map(s=>s.id),...a.state.historySessions.map(s=>s.id)]);return a.state.activeSessionId&&t.add(a.state.activeSessionId),{...a,state:{...a.state,tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).filter(([s])=>t.has(s)))}}},a=>({...a,state:{...a.state,tasksBySession:{}}})],onFailure:()=>{try{sa.getState().addToast("warning","会话数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失,建议清理旧会话或导出数据。",8e3)}catch{}}}),partialize:a=>{const t=new Set;for(const l of a.sessionTabs)t.add(l.id);for(const l of a.historySessions)t.add(l.id);a.activeSessionId&&t.add(a.activeSessionId);const s=a.sessions.filter(l=>t.has(l.id)),r={};for(const[l,c]of Object.entries(a.tasksBySession))t.has(l)&&(r[l]=c.slice(0,ik).map(Eb));return{sessions:s,sessionTabs:a.sessionTabs,activeSessionId:a.activeSessionId,layout:a.layout,sessionWorkspaceDirs:a.sessionWorkspaceDirs,tasksBySession:r,historySessions:a.historySessions}}})),rk="deepseekcode-chat-store",lk=500,ok=3e4,ck=2e4,Zo=4e3;let Kn=null,Ad=0,sl=null;const al=(a,t)=>!a||a.length<=t?a:a.slice(0,t)+"…",sy=a=>({...a,args:typeof a.args=="string"?al(a.args,Zo)??a.args:a.args,result:typeof a.result=="string"?al(a.result,Zo)??a.result:a.result}),uk=a=>{const t={...a,thinkingBlocks:void 0,content:al(a.content,ck)??a.content};return a.steps&&(t.steps=a.steps.map(s=>{var r;return{...s,thought:al(s.thought,Zo),result:al(s.result,Zo),toolCalls:(r=s.toolCalls)==null?void 0:r.map(sy)}})),a.toolCalls&&(t.toolCalls=a.toolCalls.map(sy)),t},dk=[a=>{const t=we.getState(),s=new Set;for(const l of t.sessionTabs)s.add(l.id);for(const l of t.historySessions)s.add(l.id);t.activeSessionId&&s.add(t.activeSessionId);const r={};for(const[l,c]of Object.entries(a.state.messagesBySession||{}))s.has(l)&&Array.isArray(c)&&c.length>0&&(r[l]=c);return{...a,state:{...a.state,messagesBySession:r}}},a=>{const t={};for(const[s,r]of Object.entries(a.state.messagesBySession||{}))t[s]=(Array.isArray(r)?r:[]).slice(-60).map(uk);return{...a,state:{...a.state,messagesBySession:t}}},a=>{const t=we.getState().activeSessionId||"",s=(a.state.messagesBySession||{})[t]||[],r=(Array.isArray(s)?s:[]).slice(-30).map(l=>({id:l.id,type:l.type,content:l.content,timestamp:l.timestamp,...l.thinking?{thinking:l.thinking}:{}}));return{...a,state:{...a.state,messagesBySession:t?{[t]:r}:{}}}}];function Nb(a,t){const s=c=>{try{return localStorage.setItem(a,JSON.stringify(c)),Ad=0,!0}catch{return!1}};if(s(t))return;let r=t;for(const c of dk){try{r=c(r)}catch{continue}if(s(r))return}const l=Date.now();if(l-Ad>ok){Ad=l,console.error("[chatStore] localStorage 持久化失败,刷新页面将丢失历史消息:",new Error("quota exceeded or storage unavailable"));try{sa.getState().addToast("warning","聊天记录保存失败:浏览器本地存储已满或不可用。刷新页面将丢失历史消息,建议导出会话或清理旧会话。",8e3)}catch{}}}function fk(){Kn&&(clearTimeout(Kn),Kn=null);const a=sl;sl=null,a&&Nb(a.name,a.value)}const pk={getItem:a=>{const t=localStorage.getItem(a);if(!t)return null;try{const s=JSON.parse(t);return s&&typeof s=="object"&&"state"in s?s:{state:s,version:0}}catch{return null}},setItem:(a,t)=>{sl={name:a,value:t},Kn&&clearTimeout(Kn),Kn=setTimeout(()=>{Kn=null,sl=null,Nb(a,t)},lk)},removeItem:a=>{sl=null,Kn&&(clearTimeout(Kn),Kn=null);try{localStorage.removeItem(a)}catch{}}};if(typeof window<"u"){const a=()=>fk();window.addEventListener("pagehide",a),window.addEventListener("beforeunload",a)}function ay(a,t,s){const r=a.thinkingBlocks?a.thinkingBlocks.map(l=>({...l})):a.thinking?[{index:Number.MIN_SAFE_INTEGER,text:a.thinking}]:[];if(typeof s=="number"){const l=r.find(c=>c.index===s);l?l.text+=t:r.push({index:s,text:t})}else if(r.length>0){const l=r.length-1,c=r[l];c?r[l]={...c,text:c.text+t}:r.push({index:0,text:t})}else r.push({index:0,text:t});return r.sort((l,c)=>l.index-c.index),{...a,thinkingBlocks:r,thinking:r.map(l=>l.text).join("")}}const ve=Bt()(da((a,t)=>({messagesBySession:{},generatingSessions:[],pausedSessions:[],sessionInputs:{},getMessages:s=>t().messagesBySession[s]||[],replaceMessages:(s,r)=>a(l=>({messagesBySession:{...l.messagesBySession,[s]:r.slice(-200)}})),addMessage:(s,r)=>a(l=>{const u=[...l.messagesBySession[s]||[],r].slice(-200);return{messagesBySession:{...l.messagesBySession,[s]:u}}}),updateLastMessage:(s,r)=>a(l=>{const c=(l.messagesBySession[s]||[]).map((u,d,p)=>d===p.length-1&&u.type==="assistant"?{...u,content:r}:u);return{messagesBySession:{...l.messagesBySession,[s]:c}}}),appendToLastMessage:(s,r)=>a(l=>{const c=l.messagesBySession[s];if(!c||c.length===0)return l;const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const p=c.slice();return p[u]={...d,content:d.content+r},{messagesBySession:{...l.messagesBySession,[s]:p}}}return{messagesBySession:{...l.messagesBySession,[s]:[...c,{id:Zn(),type:"assistant",content:r,timestamp:Date.now()}].slice(-200)}}}),setThinking:(s,r)=>a(l=>{const c=(l.messagesBySession[s]||[]).map((u,d,p)=>{var y;if(d!==p.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((v,S)=>S===g?{...v,thought:r}:v);return{...u,steps:b}}return{...u,thinking:r,thinkingBlocks:r?[{index:0,text:r}]:[]}});return{messagesBySession:{...l.messagesBySession,[s]:c}}}),appendToLastMessageThinking:(s,r,l)=>a(c=>{var v,S;const u=c.messagesBySession[s];if(!u||u.length===0)return c;const d=u.length-1,p=u[d];if(!p||p.type!=="assistant")return{messagesBySession:{...c.messagesBySession,[s]:[...u,ay({id:Zn(),type:"assistant",content:"",timestamp:Date.now()},r,l)].slice(-200)}};let g;const y=(v=p.steps)==null?void 0:v.findIndex(k=>k.status==="running");if(y!==void 0&&y!==-1&&((S=p.steps)!=null&&S[y])){const k=p.steps.slice(),C=k[y];k[y]={...C,thought:(C.thought||"")+r},g={...p,steps:k}}else if(p.steps&&p.steps.length>0){const k=p.steps.length-1,C=p.steps.slice(),E=C[k];C[k]={...E,thought:(E.thought||"")+r},g={...p,steps:C}}else g=ay(p,r,l);const b=u.slice();return b[d]=g,{messagesBySession:{...c.messagesBySession,[s]:b}}}),addStep:(s,r)=>a(l=>{const c=(l.messagesBySession[s]||[]).map((u,d,p)=>{var v,S;if(d!==p.length-1||u.type!=="assistant")return u;const g=(v=u.toolCalls)==null?void 0:v.filter(k=>{var C;return!((C=u.steps)!=null&&C.some(E=>{var O;return(O=E.toolCalls)==null?void 0:O.some(j=>j.id===k.id)}))}),y={...r};g!=null&&g.length&&(y.toolCalls=[...y.toolCalls||[],...g]);let b=u.thinking||"";return b.trim().length>0&&(y.thought=(y.thought||"")+b,b=""),{...u,thinking:b,thinkingBlocks:[],toolCalls:g!=null&&g.length?(S=u.toolCalls)==null?void 0:S.filter(k=>!g.some(C=>C.id===k.id)):u.toolCalls,steps:[...u.steps||[],y]}});return{messagesBySession:{...l.messagesBySession,[s]:c}}}),updateStep:(s,r,l)=>a(c=>{const u=(c.messagesBySession[s]||[]).map((d,p,g)=>{if(p!==g.length-1||!d.steps)return d;const y=d.steps.findIndex(v=>v.id===r);if(y===-1)return d;const b=d.steps.map((v,S)=>S===y?{...v,...l}:v);return{...d,steps:b}});return{messagesBySession:{...c.messagesBySession,[s]:u}}}),addToolCall:(s,r)=>a(l=>{const c=(l.messagesBySession[s]||[]).map((u,d,p)=>{var y;if(d!==p.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((v,S)=>S===g?{...v,toolCalls:[...v.toolCalls||[],r]}:v);return{...u,steps:b}}if(u.steps&&u.steps.length>0){const b=u.steps.length-1,v=u.steps.map((S,k)=>k===b?{...S,toolCalls:[...S.toolCalls||[],r]}:S);return{...u,steps:v}}return{...u,toolCalls:[...u.toolCalls||[],r]}});return{messagesBySession:{...l.messagesBySession,[s]:c}}}),updateToolCall:(s,r,l)=>a(c=>{const u=p=>{if(!p)return null;const g=p.findIndex(y=>y.id===r);return g===-1?null:p.map((y,b)=>b===g?{...y,...l}:y)},d=(c.messagesBySession[s]||[]).map((p,g,y)=>{var S,k;if(g!==y.length-1||p.type!=="assistant")return p;const b=(S=p.steps)==null?void 0:S.findIndex(C=>C.status==="running");if(b!==void 0&&b!==-1&&p.steps&&p.steps[b]){const C=u((k=p.steps[b])==null?void 0:k.toolCalls);if(C){const E=p.steps.map((O,j)=>j===b?{...O,toolCalls:C}:O);return{...p,steps:E}}}if(p.steps){let C=!1;const E=p.steps.map(O=>{if(C)return O;const j=u(O.toolCalls);return j?(C=!0,{...O,toolCalls:j}):O});if(C)return{...p,steps:E}}const v=u(p.toolCalls);return v?{...p,toolCalls:v}:p});return{messagesBySession:{...c.messagesBySession,[s]:d}}}),appendToLastToolCallArgs:(s,r,l,c)=>a(u=>{const d=y=>{let b=y.args;if(typeof b=="string")b=b+l;else if(typeof b=="object"&&b!==null){const v=l.trim();if(v.startsWith("{")&&v.endsWith("}"))try{const S=JSON.parse(v);typeof b=="string"?b={...S}:b={...b,...S}}catch{b=JSON.stringify(b).slice(0,-1)+","+v.slice(1)}else typeof b=="string"?b=b+v:b=JSON.stringify(b)+v}else b=l;return{...y,args:b}},p=y=>{if(!y)return null;const b=y.findIndex(v=>c!==void 0&&v.index===c||v.id===r);return b===-1?null:y.map((v,S)=>S===b?d(v):v)},g=(u.messagesBySession[s]||[]).map((y,b,v)=>{var C,E;if(b!==v.length-1||y.type!=="assistant")return y;const S=(C=y.steps)==null?void 0:C.findIndex(O=>O.status==="running");if(S!==void 0&&S!==-1&&y.steps&&y.steps[S]){const O=p((E=y.steps[S])==null?void 0:E.toolCalls);if(O){const j=y.steps.map((T,z)=>z===S?{...T,toolCalls:O}:T);return{...y,steps:j}}}if(y.steps){let O=!1;const j=y.steps.map(T=>{if(O)return T;const z=p(T.toolCalls);return z?(O=!0,{...T,toolCalls:z}):T});if(O)return{...y,steps:j}}const k=p(y.toolCalls);return k?{...y,toolCalls:k}:y});return{messagesBySession:{...u.messagesBySession,[s]:g}}}),startGeneration:s=>a(r=>({generatingSessions:r.generatingSessions.includes(s)?r.generatingSessions:[...r.generatingSessions,s]})),endGeneration:(s,r)=>a(l=>{var g,y,b;const c=l.messagesBySession[s]||[],u=Date.now(),d=c.map(v=>{var E,O;let S=!1;const k=(E=v.steps)==null?void 0:E.map(j=>{if(!j.toolCalls)return j;const T=j.toolCalls.map(z=>z.status!=="running"?z:(S=!0,{...z,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(z.timestamp||u))/1e3)}));return T!==j.toolCalls?{...j,toolCalls:T}:j}),C=(O=v.toolCalls)==null?void 0:O.map(j=>j.status!=="running"?j:(S=!0,{...j,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(j.timestamp||u))/1e3)}));return S?{...v,steps:k,toolCalls:C}:v}),p=d[d.length-1];if(p&&p.type==="assistant"&&!p.content&&!p.thinking&&!((g=p.thinkingBlocks)!=null&&g.length)&&!((y=p.steps)!=null&&y.length)&&!((b=p.toolCalls)!=null&&b.length)&&!p.hookApproval){const{[s]:v,...S}=l.messagesBySession;return{generatingSessions:l.generatingSessions.filter(k=>k!==s),pausedSessions:l.pausedSessions.filter(k=>k!==s),messagesBySession:{...S,[s]:d.slice(0,-1)}}}return{generatingSessions:l.generatingSessions.filter(v=>v!==s),pausedSessions:l.pausedSessions.filter(v=>v!==s),messagesBySession:{...l.messagesBySession,[s]:d}}}),pauseGeneration:s=>a(r=>({pausedSessions:r.pausedSessions.includes(s)?r.pausedSessions:[...r.pausedSessions,s]})),resumeGeneration:s=>a(r=>({pausedSessions:r.pausedSessions.filter(l=>l!==s)})),clearMessages:s=>a(r=>{const{[s]:l,...c}=r.messagesBySession;return{messagesBySession:c}}),removeSession:s=>a(r=>{const{[s]:l,...c}=r.messagesBySession,{[s]:u,...d}=r.sessionInputs;return{messagesBySession:c,sessionInputs:d,generatingSessions:r.generatingSessions.filter(p=>p!==s)}}),setSessionInput:(s,r)=>a(l=>({sessionInputs:{...l.sessionInputs,[s]:r}})),getSessionInput:s=>t().sessionInputs[s]||"",attachHookApproval:(s,r)=>a(l=>{const c=l.messagesBySession[s]||[];if(c.length===0){const g={id:`hook-approval-${r.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:r};return{messagesBySession:{...l.messagesBySession,[s]:[g]}}}const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const g=c.slice();return g[u]={...d,hookApproval:r},{messagesBySession:{...l.messagesBySession,[s]:g}}}const p={id:`hook-approval-${r.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:r};return{messagesBySession:{...l.messagesBySession,[s]:[...c,p].slice(-200)}}}),updateHookApprovalStatus:(s,r,l)=>a(c=>{const u=c.messagesBySession[s];if(!u)return c;const d=u.map(p=>{var g;return((g=p.hookApproval)==null?void 0:g.approvalId)===r?{...p,hookApproval:{...p.hookApproval,status:l}}:p});return{messagesBySession:{...c.messagesBySession,[s]:d}}}),setMessageFileJob:(s,r)=>a(l=>{const c=l.messagesBySession[s]||[];if(c.length===0){const g={id:`filejob-${r.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:r};return{messagesBySession:{...l.messagesBySession,[s]:[g]}}}const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const g=c.slice();return g[u]={...d,fileJob:d.fileJob?{...d.fileJob,...r,attachments:r.attachments??d.fileJob.attachments,jobId:d.fileJob.jobId,updatedAt:Date.now()}:{...r,updatedAt:Date.now()}},{messagesBySession:{...l.messagesBySession,[s]:g}}}const p={id:`filejob-${r.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:r};return{messagesBySession:{...l.messagesBySession,[s]:[...c,p].slice(-200)}}}),attachErrorCard:(s,r)=>a(l=>{const c=l.messagesBySession[s];if(!c||c.length===0)return l;const u=c.length-1,d=c[u];if(d&&d.type==="assistant"){const p=c.slice();return p[u]={...d,errorCard:r},{messagesBySession:{...l.messagesBySession,[s]:p}}}return l}),setTurnSummary:(s,r)=>a(l=>{const c=l.messagesBySession[s];if(!c||c.length===0)return l;const u=c.length-1,d=c[u];if(!d||d.type!=="assistant")return l;const p=c.slice();return p[u]={...d,summary:r},{messagesBySession:{...l.messagesBySession,[s]:p}}}),applyTombstone:(s,r)=>a(l=>{const c=l.messagesBySession[s];if(!c||c.length===0)return l;const u=new Set(r),d=c.map(p=>u.has(p.id)?{...p,deleted:!0}:p);return{messagesBySession:{...l.messagesBySession,[s]:d}}}),isGenerating:s=>t().generatingSessions.includes(s),isPaused:s=>t().pausedSessions.includes(s)}),{name:rk,storage:pk,partialize:a=>({messagesBySession:a.messagesBySession,sessionInputs:a.sessionInputs})})),hk=Bt(a=>({isOpen:!1,status:"idle",port:null,wsUrl:null,errorMessage:null,openTerminal:()=>a({isOpen:!0}),closeTerminal:()=>a({isOpen:!1}),toggleTerminal:()=>a(t=>({isOpen:!t.isOpen})),setStarting:()=>a({status:"starting",errorMessage:null}),setRunning:(t,s)=>a({status:"running",port:t,wsUrl:s}),setStopping:()=>a({status:"stopping"}),setIdle:()=>a({status:"idle",port:null,wsUrl:null,errorMessage:null}),setError:t=>a({status:"error",errorMessage:t})})),iy={bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},mN=["off","low","medium","high","extra_high","max"],mk=8,Da=Bt()(da(a=>({theme:"light",themePresetId:"linear",language:"zh-CN",fontSize:14,streamingEnabled:!0,workspaceDir:"",recentDirs:[],effort:"medium",customTheme:iy,customThemeEnabled:!1,developerView:!1,setTheme:t=>a({theme:t}),setThemePreset:t=>a({themePresetId:t,customThemeEnabled:!1}),setLanguage:t=>a({language:t}),setFontSize:t=>a({fontSize:t}),setStreamingEnabled:t=>a({streamingEnabled:t}),setCustomTheme:t=>a(s=>({customTheme:{...s.customTheme,...t}})),setCustomThemeEnabled:t=>a({customThemeEnabled:t}),resetCustomTheme:()=>a({customTheme:iy}),setDeveloperView:t=>a({developerView:t}),setWorkspaceDir:t=>a(s=>{const r=t.trim();if(!r)return{workspaceDir:""};const l=[r,...s.recentDirs.filter(c=>c!==r)].slice(0,mk);return{workspaceDir:r,recentDirs:l}}),setEffort:t=>a({effort:t})}),{name:"deepseekcode-settings-storage",version:5,migrate:(a,t)=>{const s=a;return t<2&&s&&typeof s=="object"&&((s.themePresetId==="github"||s.themePresetId==="mimo")&&(s.themePresetId="linear"),s.theme==="dark"&&(s.theme="light")),t<3&&s&&typeof s=="object"&&(s.recentDirs=Array.isArray(s.recentDirs)?s.recentDirs:[]),t<4&&s&&typeof s=="object"&&(delete s.yolo,delete s.autoSwarm,delete s.workspaceGuardBypass),t<5&&s&&typeof s=="object"&&(s.developerView=s.developerView===!0),s}}));var Qe;(function(a){a.assertEqual=l=>{};function t(l){}a.assertIs=t;function s(l){throw new Error}a.assertNever=s,a.arrayToEnum=l=>{const c={};for(const u of l)c[u]=u;return c},a.getValidEnumValues=l=>{const c=a.objectKeys(l).filter(d=>typeof l[l[d]]!="number"),u={};for(const d of c)u[d]=l[d];return a.objectValues(u)},a.objectValues=l=>a.objectKeys(l).map(function(c){return l[c]}),a.objectKeys=typeof Object.keys=="function"?l=>Object.keys(l):l=>{const c=[];for(const u in l)Object.prototype.hasOwnProperty.call(l,u)&&c.push(u);return c},a.find=(l,c)=>{for(const u of l)if(c(u))return u},a.isInteger=typeof Number.isInteger=="function"?l=>Number.isInteger(l):l=>typeof l=="number"&&Number.isFinite(l)&&Math.floor(l)===l;function r(l,c=" | "){return l.map(u=>typeof u=="string"?`'${u}'`:u).join(c)}a.joinValues=r,a.jsonStringifyReplacer=(l,c)=>typeof c=="bigint"?c.toString():c})(Qe||(Qe={}));var ry;(function(a){a.mergeShapes=(t,s)=>({...t,...s})})(ry||(ry={}));const le=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),na=a=>{switch(typeof a){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(a)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(a)?le.array:a===null?le.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?le.promise:typeof Map<"u"&&a instanceof Map?le.map:typeof Set<"u"&&a instanceof Set?le.set:typeof Date<"u"&&a instanceof Date?le.date:le.object;default:return le.unknown}},J=Qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class As extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(c){return c.message},r={_errors:[]},l=c=>{for(const u of c.issues)if(u.code==="invalid_union")u.unionErrors.map(l);else if(u.code==="invalid_return_type")l(u.returnTypeError);else if(u.code==="invalid_arguments")l(u.argumentsError);else if(u.path.length===0)r._errors.push(s(u));else{let d=r,p=0;for(;p<u.path.length;){const g=u.path[p];p===u.path.length-1?(d[g]=d[g]||{_errors:[]},d[g]._errors.push(s(u))):d[g]=d[g]||{_errors:[]},d=d[g],p++}}};return l(this),r}static assert(t){if(!(t instanceof As))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},r=[];for(const l of this.issues)if(l.path.length>0){const c=l.path[0];s[c]=s[c]||[],s[c].push(t(l))}else r.push(t(l));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}As.create=a=>new As(a);const lf=(a,t)=>{let s;switch(a.code){case J.invalid_type:a.received===le.undefined?s="Required":s=`Expected ${a.expected}, received ${a.received}`;break;case J.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(a.expected,Qe.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:s=`Unrecognized key(s) in object: ${Qe.joinValues(a.keys,", ")}`;break;case J.invalid_union:s="Invalid input";break;case J.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${Qe.joinValues(a.options)}`;break;case J.invalid_enum_value:s=`Invalid enum value. Expected ${Qe.joinValues(a.options)}, received '${a.received}'`;break;case J.invalid_arguments:s="Invalid function arguments";break;case J.invalid_return_type:s="Invalid function return type";break;case J.invalid_date:s="Invalid date";break;case J.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(s=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?s=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?s=`Invalid input: must end with "${a.validation.endsWith}"`:Qe.assertNever(a.validation):a.validation!=="regex"?s=`Invalid ${a.validation}`:s="Invalid";break;case J.too_small:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:s="Invalid input";break;case J.too_big:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?s=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:s="Invalid input";break;case J.custom:s="Invalid input";break;case J.invalid_intersection_types:s="Intersection results could not be merged";break;case J.not_multiple_of:s=`Number must be a multiple of ${a.multipleOf}`;break;case J.not_finite:s="Number must be finite";break;default:s=t.defaultError,Qe.assertNever(a)}return{message:s}};let gk=lf;function yk(){return gk}const bk=a=>{const{data:t,path:s,errorMaps:r,issueData:l}=a,c=[...s,...l.path||[]],u={...l,path:c};if(l.message!==void 0)return{...l,path:c,message:l.message};let d="";const p=r.filter(g=>!!g).slice().reverse();for(const g of p)d=g(u,{data:t,defaultError:d}).message;return{...l,path:c,message:d}};function ae(a,t){const s=yk(),r=bk({issueData:t,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,s,s===lf?void 0:lf].filter(l=>!!l)});a.common.issues.push(r)}class hn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const r=[];for(const l of s){if(l.status==="aborted")return _e;l.status==="dirty"&&t.dirty(),r.push(l.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,s){const r=[];for(const l of s){const c=await l.key,u=await l.value;r.push({key:c,value:u})}return hn.mergeObjectSync(t,r)}static mergeObjectSync(t,s){const r={};for(const l of s){const{key:c,value:u}=l;if(c.status==="aborted"||u.status==="aborted")return _e;c.status==="dirty"&&t.dirty(),u.status==="dirty"&&t.dirty(),c.value!=="__proto__"&&(typeof u.value<"u"||l.alwaysSet)&&(r[c.value]=u.value)}return{status:t.value,value:r}}}const _e=Object.freeze({status:"aborted"}),Qr=a=>({status:"dirty",value:a}),On=a=>({status:"valid",value:a}),ly=a=>a.status==="aborted",oy=a=>a.status==="dirty",Di=a=>a.status==="valid",Qo=a=>typeof Promise<"u"&&a instanceof Promise;var ue;(function(a){a.errToObj=t=>typeof t=="string"?{message:t}:t||{},a.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ue||(ue={}));class ca{constructor(t,s,r,l){this._cachedPath=[],this.parent=t,this.data=s,this._path=r,this._key=l}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cy=(a,t)=>{if(Di(t))return{success:!0,data:t.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new As(a.common.issues);return this._error=s,this._error}}};function Re(a){if(!a)return{};const{errorMap:t,invalid_type_error:s,required_error:r,description:l}=a;if(t&&(s||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:l}:{errorMap:(u,d)=>{const{message:p}=a;return u.code==="invalid_enum_value"?{message:p??d.defaultError}:typeof d.data>"u"?{message:p??r??d.defaultError}:u.code!=="invalid_type"?{message:d.defaultError}:{message:p??s??d.defaultError}},description:l}}class Ve{get description(){return this._def.description}_getType(t){return na(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:na(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new hn,ctx:{common:t.parent.common,data:t.data,parsedType:na(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(Qo(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const r=this.safeParse(t,s);if(r.success)return r.data;throw r.error}safeParse(t,s){const r={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:na(t)},l=this._parseSync({data:t,path:r.path,parent:r});return cy(r,l)}"~validate"(t){var r,l;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:na(t)};if(!this["~standard"].async)try{const c=this._parseSync({data:t,path:[],parent:s});return Di(c)?{value:c.value}:{issues:s.common.issues}}catch(c){(l=(r=c==null?void 0:c.message)==null?void 0:r.toLowerCase())!=null&&l.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(c=>Di(c)?{value:c.value}:{issues:s.common.issues})}async parseAsync(t,s){const r=await this.safeParseAsync(t,s);if(r.success)return r.data;throw r.error}async safeParseAsync(t,s){const r={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:na(t)},l=this._parse({data:t,path:r.path,parent:r}),c=await(Qo(l)?l:Promise.resolve(l));return cy(r,c)}refine(t,s){const r=l=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(l):s;return this._refinement((l,c)=>{const u=t(l),d=()=>c.addIssue({code:J.custom,...r(l)});return typeof Promise<"u"&&u instanceof Promise?u.then(p=>p?!0:(d(),!1)):u?!0:(d(),!1)})}refinement(t,s){return this._refinement((r,l)=>t(r)?!0:(l.addIssue(typeof s=="function"?s(r,l):s),!1))}_refinement(t){return new Ui({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return la.create(this,this._def)}nullable(){return $i.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qn.create(this)}promise(){return tc.create(this,this._def)}or(t){return Jo.create([this,t],this._def)}and(t){return ec.create(this,t,this._def)}transform(t){return new Ui({...Re(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new pf({...Re(this._def),innerType:this,defaultValue:s,typeName:Ce.ZodDefault})}brand(){return new Ik({typeName:Ce.ZodBranded,type:this,...Re(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new hf({...Re(this._def),innerType:this,catchValue:s,typeName:Ce.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return zf.create(this,t)}readonly(){return mf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xk=/^c[^\s-]{8,}$/i,vk=/^[0-9a-z]+$/,Sk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wk=/^[a-z0-9_-]{21}$/i,_k=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ck=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ek=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jd;const Tk=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ak=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Rk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ok=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Tb="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Bk=new RegExp(`^${Tb}$`);function Ab(a){let t="[0-5]\\d";a.precision?t=`${t}\\.\\d{${a.precision}}`:a.precision==null&&(t=`${t}(\\.\\d+)?`);const s=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function Dk(a){return new RegExp(`^${Ab(a)}$`)}function Lk(a){let t=`${Tb}T${Ab(a)}`;const s=[];return s.push(a.local?"Z?":"Z"),a.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function zk(a,t){return!!((t==="v4"||!t)&&Tk.test(a)||(t==="v6"||!t)&&jk.test(a))}function Uk(a,t){if(!_k.test(a))return!1;try{const[s]=a.split(".");if(!s)return!1;const r=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),l=JSON.parse(atob(r));return!(typeof l!="object"||l===null||"typ"in l&&(l==null?void 0:l.typ)!=="JWT"||!l.alg||t&&l.alg!==t)}catch{return!1}}function $k(a,t){return!!((t==="v4"||!t)&&Ak.test(a)||(t==="v6"||!t)&&Rk.test(a))}class aa extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){const c=this._getOrReturnCtx(t);return ae(c,{code:J.invalid_type,expected:le.string,received:c.parsedType}),_e}const r=new hn;let l;for(const c of this._def.checks)if(c.kind==="min")t.data.length<c.value&&(l=this._getOrReturnCtx(t,l),ae(l,{code:J.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),r.dirty());else if(c.kind==="max")t.data.length>c.value&&(l=this._getOrReturnCtx(t,l),ae(l,{code:J.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),r.dirty());else if(c.kind==="length"){const u=t.data.length>c.value,d=t.data.length<c.value;(u||d)&&(l=this._getOrReturnCtx(t,l),u?ae(l,{code:J.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&ae(l,{code:J.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),r.dirty())}else if(c.kind==="email")Ek.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"email",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="emoji")jd||(jd=new RegExp(Nk,"u")),jd.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"emoji",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="uuid")kk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"uuid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="nanoid")wk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"nanoid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="cuid")xk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"cuid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="cuid2")vk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"cuid2",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="ulid")Sk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"ulid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="url")try{new URL(t.data)}catch{l=this._getOrReturnCtx(t,l),ae(l,{validation:"url",code:J.invalid_string,message:c.message}),r.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"regex",code:J.invalid_string,message:c.message}),r.dirty())):c.kind==="trim"?t.data=t.data.trim():c.kind==="includes"?t.data.includes(c.value,c.position)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),r.dirty()):c.kind==="toLowerCase"?t.data=t.data.toLowerCase():c.kind==="toUpperCase"?t.data=t.data.toUpperCase():c.kind==="startsWith"?t.data.startsWith(c.value)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:{startsWith:c.value},message:c.message}),r.dirty()):c.kind==="endsWith"?t.data.endsWith(c.value)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:{endsWith:c.value},message:c.message}),r.dirty()):c.kind==="datetime"?Lk(c).test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:"datetime",message:c.message}),r.dirty()):c.kind==="date"?Bk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:"date",message:c.message}),r.dirty()):c.kind==="time"?Dk(c).test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{code:J.invalid_string,validation:"time",message:c.message}),r.dirty()):c.kind==="duration"?Ck.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"duration",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="ip"?zk(t.data,c.version)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"ip",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="jwt"?Uk(t.data,c.alg)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"jwt",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="cidr"?$k(t.data,c.version)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"cidr",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="base64"?Ok.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"base64",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="base64url"?Mk.test(t.data)||(l=this._getOrReturnCtx(t,l),ae(l,{validation:"base64url",code:J.invalid_string,message:c.message}),r.dirty()):Qe.assertNever(c);return{status:r.value,value:t.data}}_regex(t,s,r){return this.refinement(l=>t.test(l),{validation:s,code:J.invalid_string,...ue.errToObj(r)})}_addCheck(t){return new aa({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ue.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ue.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ue.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ue.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ue.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ue.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ue.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...ue.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s==null?void 0:s.position,...ue.errToObj(s==null?void 0:s.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...ue.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...ue.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...ue.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...ue.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...ue.errToObj(s)})}nonempty(t){return this.min(1,ue.errToObj(t))}trim(){return new aa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}aa.create=a=>new aa({checks:[],typeName:Ce.ZodString,coerce:(a==null?void 0:a.coerce)??!1,...Re(a)});function Hk(a,t){const s=(a.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,l=s>r?s:r,c=Number.parseInt(a.toFixed(l).replace(".","")),u=Number.parseInt(t.toFixed(l).replace(".",""));return c%u/10**l}class Li extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==le.number){const c=this._getOrReturnCtx(t);return ae(c,{code:J.invalid_type,expected:le.number,received:c.parsedType}),_e}let r;const l=new hn;for(const c of this._def.checks)c.kind==="int"?Qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ae(r,{code:J.invalid_type,expected:"integer",received:"float",message:c.message}),l.dirty()):c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),l.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),l.dirty()):c.kind==="multipleOf"?Hk(t.data,c.value)!==0&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.not_multiple_of,multipleOf:c.value,message:c.message}),l.dirty()):c.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ae(r,{code:J.not_finite,message:c.message}),l.dirty()):Qe.assertNever(c);return{status:l.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,ue.toString(s))}gt(t,s){return this.setLimit("min",t,!1,ue.toString(s))}lte(t,s){return this.setLimit("max",t,!0,ue.toString(s))}lt(t,s){return this.setLimit("max",t,!1,ue.toString(s))}setLimit(t,s,r,l){return new Li({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:r,message:ue.toString(l)}]})}_addCheck(t){return new Li({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Qe.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(s===null||r.value>s)&&(s=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(s)&&Number.isFinite(t)}}Li.create=a=>new Li({checks:[],typeName:Ce.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Re(a)});class fl extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==le.bigint)return this._getInvalidInput(t);let r;const l=new hn;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),l.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),l.dirty()):c.kind==="multipleOf"?t.data%c.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ae(r,{code:J.not_multiple_of,multipleOf:c.value,message:c.message}),l.dirty()):Qe.assertNever(c);return{status:l.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return ae(s,{code:J.invalid_type,expected:le.bigint,received:s.parsedType}),_e}gte(t,s){return this.setLimit("min",t,!0,ue.toString(s))}gt(t,s){return this.setLimit("min",t,!1,ue.toString(s))}lte(t,s){return this.setLimit("max",t,!0,ue.toString(s))}lt(t,s){return this.setLimit("max",t,!1,ue.toString(s))}setLimit(t,s,r,l){return new fl({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:r,message:ue.toString(l)}]})}_addCheck(t){return new fl({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}fl.create=a=>new fl({checks:[],typeName:Ce.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,...Re(a)});class of extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.boolean,received:r.parsedType}),_e}return On(t.data)}}of.create=a=>new of({typeName:Ce.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Re(a)});class Xo extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){const c=this._getOrReturnCtx(t);return ae(c,{code:J.invalid_type,expected:le.date,received:c.parsedType}),_e}if(Number.isNaN(t.data.getTime())){const c=this._getOrReturnCtx(t);return ae(c,{code:J.invalid_date}),_e}const r=new hn;let l;for(const c of this._def.checks)c.kind==="min"?t.data.getTime()<c.value&&(l=this._getOrReturnCtx(t,l),ae(l,{code:J.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),r.dirty()):c.kind==="max"?t.data.getTime()>c.value&&(l=this._getOrReturnCtx(t,l),ae(l,{code:J.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),r.dirty()):Qe.assertNever(c);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Xo({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:ue.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:ue.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}Xo.create=a=>new Xo({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:Ce.ZodDate,...Re(a)});class uy extends Ve{_parse(t){if(this._getType(t)!==le.symbol){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.symbol,received:r.parsedType}),_e}return On(t.data)}}uy.create=a=>new uy({typeName:Ce.ZodSymbol,...Re(a)});class dy extends Ve{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.undefined,received:r.parsedType}),_e}return On(t.data)}}dy.create=a=>new dy({typeName:Ce.ZodUndefined,...Re(a)});class fy extends Ve{_parse(t){if(this._getType(t)!==le.null){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.null,received:r.parsedType}),_e}return On(t.data)}}fy.create=a=>new fy({typeName:Ce.ZodNull,...Re(a)});class cf extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return On(t.data)}}cf.create=a=>new cf({typeName:Ce.ZodAny,...Re(a)});class uf extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return On(t.data)}}uf.create=a=>new uf({typeName:Ce.ZodUnknown,...Re(a)});class ua extends Ve{_parse(t){const s=this._getOrReturnCtx(t);return ae(s,{code:J.invalid_type,expected:le.never,received:s.parsedType}),_e}}ua.create=a=>new ua({typeName:Ce.ZodNever,...Re(a)});class py extends Ve{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.void,received:r.parsedType}),_e}return On(t.data)}}py.create=a=>new py({typeName:Ce.ZodVoid,...Re(a)});class Qn extends Ve{_parse(t){const{ctx:s,status:r}=this._processInputParams(t),l=this._def;if(s.parsedType!==le.array)return ae(s,{code:J.invalid_type,expected:le.array,received:s.parsedType}),_e;if(l.exactLength!==null){const u=s.data.length>l.exactLength.value,d=s.data.length<l.exactLength.value;(u||d)&&(ae(s,{code:u?J.too_big:J.too_small,minimum:d?l.exactLength.value:void 0,maximum:u?l.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:l.exactLength.message}),r.dirty())}if(l.minLength!==null&&s.data.length<l.minLength.value&&(ae(s,{code:J.too_small,minimum:l.minLength.value,type:"array",inclusive:!0,exact:!1,message:l.minLength.message}),r.dirty()),l.maxLength!==null&&s.data.length>l.maxLength.value&&(ae(s,{code:J.too_big,maximum:l.maxLength.value,type:"array",inclusive:!0,exact:!1,message:l.maxLength.message}),r.dirty()),s.common.async)return Promise.all([...s.data].map((u,d)=>l.type._parseAsync(new ca(s,u,s.path,d)))).then(u=>hn.mergeArray(r,u));const c=[...s.data].map((u,d)=>l.type._parseSync(new ca(s,u,s.path,d)));return hn.mergeArray(r,c)}get element(){return this._def.type}min(t,s){return new Qn({...this._def,minLength:{value:t,message:ue.toString(s)}})}max(t,s){return new Qn({...this._def,maxLength:{value:t,message:ue.toString(s)}})}length(t,s){return new Qn({...this._def,exactLength:{value:t,message:ue.toString(s)}})}nonempty(t){return this.min(1,t)}}Qn.create=(a,t)=>new Qn({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Re(t)});function Ti(a){if(a instanceof At){const t={};for(const s in a.shape){const r=a.shape[s];t[s]=la.create(Ti(r))}return new At({...a._def,shape:()=>t})}else return a instanceof Qn?new Qn({...a._def,type:Ti(a.element)}):a instanceof la?la.create(Ti(a.unwrap())):a instanceof $i?$i.create(Ti(a.unwrap())):a instanceof La?La.create(a.items.map(t=>Ti(t))):a}class At extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=Qe.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==le.object){const g=this._getOrReturnCtx(t);return ae(g,{code:J.invalid_type,expected:le.object,received:g.parsedType}),_e}const{status:r,ctx:l}=this._processInputParams(t),{shape:c,keys:u}=this._getCached(),d=[];if(!(this._def.catchall instanceof ua&&this._def.unknownKeys==="strip"))for(const g in l.data)u.includes(g)||d.push(g);const p=[];for(const g of u){const y=c[g],b=l.data[g];p.push({key:{status:"valid",value:g},value:y._parse(new ca(l,b,l.path,g)),alwaysSet:g in l.data})}if(this._def.catchall instanceof ua){const g=this._def.unknownKeys;if(g==="passthrough")for(const y of d)p.push({key:{status:"valid",value:y},value:{status:"valid",value:l.data[y]}});else if(g==="strict")d.length>0&&(ae(l,{code:J.unrecognized_keys,keys:d}),r.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const y of d){const b=l.data[y];p.push({key:{status:"valid",value:y},value:g._parse(new ca(l,b,l.path,y)),alwaysSet:y in l.data})}}return l.common.async?Promise.resolve().then(async()=>{const g=[];for(const y of p){const b=await y.key,v=await y.value;g.push({key:b,value:v,alwaysSet:y.alwaysSet})}return g}).then(g=>hn.mergeObjectSync(r,g)):hn.mergeObjectSync(r,p)}get shape(){return this._def.shape()}strict(t){return ue.errToObj,new At({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,r)=>{var c,u;const l=((u=(c=this._def).errorMap)==null?void 0:u.call(c,s,r).message)??r.defaultError;return s.code==="unrecognized_keys"?{message:ue.errToObj(t).message??l}:{message:l}}}:{}})}strip(){return new At({...this._def,unknownKeys:"strip"})}passthrough(){return new At({...this._def,unknownKeys:"passthrough"})}extend(t){return new At({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new At({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ce.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new At({...this._def,catchall:t})}pick(t){const s={};for(const r of Qe.objectKeys(t))t[r]&&this.shape[r]&&(s[r]=this.shape[r]);return new At({...this._def,shape:()=>s})}omit(t){const s={};for(const r of Qe.objectKeys(this.shape))t[r]||(s[r]=this.shape[r]);return new At({...this._def,shape:()=>s})}deepPartial(){return Ti(this)}partial(t){const s={};for(const r of Qe.objectKeys(this.shape)){const l=this.shape[r];t&&!t[r]?s[r]=l:s[r]=l.optional()}return new At({...this._def,shape:()=>s})}required(t){const s={};for(const r of Qe.objectKeys(this.shape))if(t&&!t[r])s[r]=this.shape[r];else{let c=this.shape[r];for(;c instanceof la;)c=c._def.innerType;s[r]=c}return new At({...this._def,shape:()=>s})}keyof(){return jb(Qe.objectKeys(this.shape))}}At.create=(a,t)=>new At({shape:()=>a,unknownKeys:"strip",catchall:ua.create(),typeName:Ce.ZodObject,...Re(t)});At.strictCreate=(a,t)=>new At({shape:()=>a,unknownKeys:"strict",catchall:ua.create(),typeName:Ce.ZodObject,...Re(t)});At.lazycreate=(a,t)=>new At({shape:a,unknownKeys:"strip",catchall:ua.create(),typeName:Ce.ZodObject,...Re(t)});class Jo extends Ve{_parse(t){const{ctx:s}=this._processInputParams(t),r=this._def.options;function l(c){for(const d of c)if(d.result.status==="valid")return d.result;for(const d of c)if(d.result.status==="dirty")return s.common.issues.push(...d.ctx.common.issues),d.result;const u=c.map(d=>new As(d.ctx.common.issues));return ae(s,{code:J.invalid_union,unionErrors:u}),_e}if(s.common.async)return Promise.all(r.map(async c=>{const u={...s,common:{...s.common,issues:[]},parent:null};return{result:await c._parseAsync({data:s.data,path:s.path,parent:u}),ctx:u}})).then(l);{let c;const u=[];for(const p of r){const g={...s,common:{...s.common,issues:[]},parent:null},y=p._parseSync({data:s.data,path:s.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!c&&(c={result:y,ctx:g}),g.common.issues.length&&u.push(g.common.issues)}if(c)return s.common.issues.push(...c.ctx.common.issues),c.result;const d=u.map(p=>new As(p));return ae(s,{code:J.invalid_union,unionErrors:d}),_e}}get options(){return this._def.options}}Jo.create=(a,t)=>new Jo({options:a,typeName:Ce.ZodUnion,...Re(t)});function df(a,t){const s=na(a),r=na(t);if(a===t)return{valid:!0,data:a};if(s===le.object&&r===le.object){const l=Qe.objectKeys(t),c=Qe.objectKeys(a).filter(d=>l.indexOf(d)!==-1),u={...a,...t};for(const d of c){const p=df(a[d],t[d]);if(!p.valid)return{valid:!1};u[d]=p.data}return{valid:!0,data:u}}else if(s===le.array&&r===le.array){if(a.length!==t.length)return{valid:!1};const l=[];for(let c=0;c<a.length;c++){const u=a[c],d=t[c],p=df(u,d);if(!p.valid)return{valid:!1};l.push(p.data)}return{valid:!0,data:l}}else return s===le.date&&r===le.date&&+a==+t?{valid:!0,data:a}:{valid:!1}}class ec extends Ve{_parse(t){const{status:s,ctx:r}=this._processInputParams(t),l=(c,u)=>{if(ly(c)||ly(u))return _e;const d=df(c.value,u.value);return d.valid?((oy(c)||oy(u))&&s.dirty(),{status:s.value,value:d.data}):(ae(r,{code:J.invalid_intersection_types}),_e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([c,u])=>l(c,u)):l(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ec.create=(a,t,s)=>new ec({left:a,right:t,typeName:Ce.ZodIntersection,...Re(s)});class La extends Ve{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.array)return ae(r,{code:J.invalid_type,expected:le.array,received:r.parsedType}),_e;if(r.data.length<this._def.items.length)return ae(r,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_e;!this._def.rest&&r.data.length>this._def.items.length&&(ae(r,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const c=[...r.data].map((u,d)=>{const p=this._def.items[d]||this._def.rest;return p?p._parse(new ca(r,u,r.path,d)):null}).filter(u=>!!u);return r.common.async?Promise.all(c).then(u=>hn.mergeArray(s,u)):hn.mergeArray(s,c)}get items(){return this._def.items}rest(t){return new La({...this._def,rest:t})}}La.create=(a,t)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new La({items:a,typeName:Ce.ZodTuple,rest:null,...Re(t)})};class hy extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.map)return ae(r,{code:J.invalid_type,expected:le.map,received:r.parsedType}),_e;const l=this._def.keyType,c=this._def.valueType,u=[...r.data.entries()].map(([d,p],g)=>({key:l._parse(new ca(r,d,r.path,[g,"key"])),value:c._parse(new ca(r,p,r.path,[g,"value"]))}));if(r.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const p of u){const g=await p.key,y=await p.value;if(g.status==="aborted"||y.status==="aborted")return _e;(g.status==="dirty"||y.status==="dirty")&&s.dirty(),d.set(g.value,y.value)}return{status:s.value,value:d}})}else{const d=new Map;for(const p of u){const g=p.key,y=p.value;if(g.status==="aborted"||y.status==="aborted")return _e;(g.status==="dirty"||y.status==="dirty")&&s.dirty(),d.set(g.value,y.value)}return{status:s.value,value:d}}}}hy.create=(a,t,s)=>new hy({valueType:t,keyType:a,typeName:Ce.ZodMap,...Re(s)});class pl extends Ve{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.set)return ae(r,{code:J.invalid_type,expected:le.set,received:r.parsedType}),_e;const l=this._def;l.minSize!==null&&r.data.size<l.minSize.value&&(ae(r,{code:J.too_small,minimum:l.minSize.value,type:"set",inclusive:!0,exact:!1,message:l.minSize.message}),s.dirty()),l.maxSize!==null&&r.data.size>l.maxSize.value&&(ae(r,{code:J.too_big,maximum:l.maxSize.value,type:"set",inclusive:!0,exact:!1,message:l.maxSize.message}),s.dirty());const c=this._def.valueType;function u(p){const g=new Set;for(const y of p){if(y.status==="aborted")return _e;y.status==="dirty"&&s.dirty(),g.add(y.value)}return{status:s.value,value:g}}const d=[...r.data.values()].map((p,g)=>c._parse(new ca(r,p,r.path,g)));return r.common.async?Promise.all(d).then(p=>u(p)):u(d)}min(t,s){return new pl({...this._def,minSize:{value:t,message:ue.toString(s)}})}max(t,s){return new pl({...this._def,maxSize:{value:t,message:ue.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}pl.create=(a,t)=>new pl({valueType:a,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Re(t)});class my extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}my.create=(a,t)=>new my({getter:a,typeName:Ce.ZodLazy,...Re(t)});class ff extends Ve{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return ae(s,{received:s.data,code:J.invalid_literal,expected:this._def.value}),_e}return{status:"valid",value:t.data}}get value(){return this._def.value}}ff.create=(a,t)=>new ff({value:a,typeName:Ce.ZodLiteral,...Re(t)});function jb(a,t){return new zi({values:a,typeName:Ce.ZodEnum,...Re(t)})}class zi extends Ve{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),r=this._def.values;return ae(s,{expected:Qe.joinValues(r),received:s.parsedType,code:J.invalid_type}),_e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),r=this._def.values;return ae(s,{received:s.data,code:J.invalid_enum_value,options:r}),_e}return On(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return zi.create(t,{...this._def,...s})}exclude(t,s=this._def){return zi.create(this.options.filter(r=>!t.includes(r)),{...this._def,...s})}}zi.create=jb;class gy extends Ve{_parse(t){const s=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==le.string&&r.parsedType!==le.number){const l=Qe.objectValues(s);return ae(r,{expected:Qe.joinValues(l),received:r.parsedType,code:J.invalid_type}),_e}if(this._cache||(this._cache=new Set(Qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const l=Qe.objectValues(s);return ae(r,{received:r.data,code:J.invalid_enum_value,options:l}),_e}return On(t.data)}get enum(){return this._def.values}}gy.create=(a,t)=>new gy({values:a,typeName:Ce.ZodNativeEnum,...Re(t)});class tc extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==le.promise&&s.common.async===!1)return ae(s,{code:J.invalid_type,expected:le.promise,received:s.parsedType}),_e;const r=s.parsedType===le.promise?s.data:Promise.resolve(s.data);return On(r.then(l=>this._def.type.parseAsync(l,{path:s.path,errorMap:s.common.contextualErrorMap})))}}tc.create=(a,t)=>new tc({type:a,typeName:Ce.ZodPromise,...Re(t)});class Ui extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:r}=this._processInputParams(t),l=this._def.effect||null,c={addIssue:u=>{ae(r,u),u.fatal?s.abort():s.dirty()},get path(){return r.path}};if(c.addIssue=c.addIssue.bind(c),l.type==="preprocess"){const u=l.transform(r.data,c);if(r.common.async)return Promise.resolve(u).then(async d=>{if(s.value==="aborted")return _e;const p=await this._def.schema._parseAsync({data:d,path:r.path,parent:r});return p.status==="aborted"?_e:p.status==="dirty"||s.value==="dirty"?Qr(p.value):p});{if(s.value==="aborted")return _e;const d=this._def.schema._parseSync({data:u,path:r.path,parent:r});return d.status==="aborted"?_e:d.status==="dirty"||s.value==="dirty"?Qr(d.value):d}}if(l.type==="refinement"){const u=d=>{const p=l.refinement(d,c);if(r.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(r.common.async===!1){const d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return d.status==="aborted"?_e:(d.status==="dirty"&&s.dirty(),u(d.value),{status:s.value,value:d.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>d.status==="aborted"?_e:(d.status==="dirty"&&s.dirty(),u(d.value).then(()=>({status:s.value,value:d.value}))))}if(l.type==="transform")if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Di(u))return _e;const d=l.transform(u.value,c);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:d}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Di(u)?Promise.resolve(l.transform(u.value,c)).then(d=>({status:s.value,value:d})):_e);Qe.assertNever(l)}}Ui.create=(a,t,s)=>new Ui({schema:a,typeName:Ce.ZodEffects,effect:t,...Re(s)});Ui.createWithPreprocess=(a,t,s)=>new Ui({schema:t,effect:{type:"preprocess",transform:a},typeName:Ce.ZodEffects,...Re(s)});class la extends Ve{_parse(t){return this._getType(t)===le.undefined?On(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}la.create=(a,t)=>new la({innerType:a,typeName:Ce.ZodOptional,...Re(t)});class $i extends Ve{_parse(t){return this._getType(t)===le.null?On(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}$i.create=(a,t)=>new $i({innerType:a,typeName:Ce.ZodNullable,...Re(t)});class pf extends Ve{_parse(t){const{ctx:s}=this._processInputParams(t);let r=s.data;return s.parsedType===le.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}pf.create=(a,t)=>new pf({innerType:a,typeName:Ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Re(t)});class hf extends Ve{_parse(t){const{ctx:s}=this._processInputParams(t),r={...s,common:{...s.common,issues:[]}},l=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Qo(l)?l.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new As(r.common.issues)},input:r.data})})):{status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new As(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hf.create=(a,t)=>new hf({innerType:a,typeName:Ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Re(t)});class yy extends Ve{_parse(t){if(this._getType(t)!==le.nan){const r=this._getOrReturnCtx(t);return ae(r,{code:J.invalid_type,expected:le.nan,received:r.parsedType}),_e}return{status:"valid",value:t.data}}}yy.create=a=>new yy({typeName:Ce.ZodNaN,...Re(a)});class Ik extends Ve{_parse(t){const{ctx:s}=this._processInputParams(t),r=s.data;return this._def.type._parse({data:r,path:s.path,parent:s})}unwrap(){return this._def.type}}class zf extends Ve{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?_e:c.status==="dirty"?(s.dirty(),Qr(c.value)):this._def.out._parseAsync({data:c.value,path:r.path,parent:r})})();{const l=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?_e:l.status==="dirty"?(s.dirty(),{status:"dirty",value:l.value}):this._def.out._parseSync({data:l.value,path:r.path,parent:r})}}static create(t,s){return new zf({in:t,out:s,typeName:Ce.ZodPipeline})}}class mf extends Ve{_parse(t){const s=this._def.innerType._parse(t),r=l=>(Di(l)&&(l.value=Object.freeze(l.value)),l);return Qo(s)?s.then(l=>r(l)):r(s)}unwrap(){return this._def.innerType}}mf.create=(a,t)=>new mf({innerType:a,typeName:Ce.ZodReadonly,...Re(t)});var Ce;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const Ae=aa.create,ia=Li.create,Rb=of.create,Ob=cf.create,gl=uf.create;ua.create;const Uf=Qn.create,gt=At.create,Pk=Jo.create;ec.create;La.create;const $f=ff.create,Fk=zi.create;tc.create;la.create;$i.create;function P(a){return{schema:gl(),...a}}const oc=[];let by=new Set;function yn(a){for(const t of a){if(by.has(t.type))throw new Error(`[protocol] duplicate event type: ${t.type}`);by.add(t.type),oc.push(t)}return a}function Bo(a){return oc.find(t=>t.type===a)}new Proxy({},{get:(a,t)=>{var s;return typeof t=="string"?(s=Bo(t))==null?void 0:s.schema:void 0},has:(a,t)=>{var s;return typeof t=="string"?!!((s=Bo(t))!=null&&s.schema):!1},ownKeys:()=>oc.map(a=>a.type),getOwnPropertyDescriptor:(a,t)=>{var s;return typeof t=="string"&&Bo(t)?{enumerable:!0,configurable:!0,value:(s=Bo(t))==null?void 0:s.schema}:void 0}});yn([P({type:"connected",description:"WebSocket 已连接",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"session_created",description:"新会话已创建",category:"session",emittedBy:["server","core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_created)",schema:gt({id:Ae(),title:Ae().optional()}).partial()}),P({type:"session_resumed",description:"会话从存储中恢复",category:"session",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_resumed)",schema:gt({id:Ae()}).partial()}),P({type:"auth_required",description:"需要认证",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_success",description:"认证成功",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_failed",description:"认证失败",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"message_ack",description:"消息确认",category:"session",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"CLI 发送给服务器的入站事件,无需 handler"}),P({type:"workspace_changed",description:"工作空间已切换",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,schema:gt({workspaceDir:Ae()}).partial()}),P({type:"session_switched",description:"会话已切换",category:"session",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(切换 activeSessionId)",schema:gt({id:Ae()}).partial()}),P({type:"disconnected",description:"连接断开",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0})]);yn([P({type:"start",description:"AI 开始生成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"content",description:"生成内容增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:gt({content:Ae()}).partial()}),P({type:"thinking",description:"思考过程增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:gt({thinking:Ae()}).partial()}),P({type:"tool_call",description:"工具调用流式增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_result",description:"工具执行结果",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_execution_start",description:"工具执行阶段开始(无流事件时段开始)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"纯 core 内部遥测:供运行时暂停/恢复 stall 心跳与全局看门狗;CLI/Web 无 handler(前端无需展示),仅 queryEngine 消费"}),P({type:"tool_execution_end",description:"工具执行阶段结束(恢复 stall 心跳与全局看门狗)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"配合 tool_execution_start:防止 180s 心跳把合法长等待误判为流挂起而 abort + 重放整轮工具调用;CLI/Web 无 handler"}),P({type:"tool_diff",description:"工具执行中的参数 diff 增量(P0-2 diffConsumer 生产者推送)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_start",description:"步骤开始",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_thinking",description:"步骤思考",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_action",description:"步骤动作",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_complete",description:"步骤完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"turn_summary",description:"回合结束摘要(思考时长+工具计数+头条)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 渲染为折叠摘要行(Thought for Ns, ran N …)"}),P({type:"cache_stats",description:"本轮 run 前缀缓存命中统计(命中/未命中 token、命中率、调用次数)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"run 结束时由 queryEngine 发送;CLI/Web 在模型名旁展示命中率",schema:gt({cacheHitTokens:ia(),cacheMissTokens:ia(),cacheHitRate:ia().optional(),cacheStatsCalls:ia()}).partial()}),P({type:"web_search",description:"模型内置联网搜索状态(DeepSeek Responses web_search_call:searching/completed/failed)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由服务端执行搜索,客户端仅展示状态(🔍搜索中 → ✅完成)",schema:gt({state:Ae()}).partial()}),P({type:"progress",description:"通用进度(当前未使用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已定义但从未发送;SendMessageTool 的 progress 是消息类型而非 WS 事件"}),P({type:"complete",description:"生成完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"error",description:"生成错误",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:gt({message:Ae()}).partial()}),P({type:"generation_paused",description:"生成已暂停",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"generation_resumed",description:"生成已恢复",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"stall_detected",description:"流级卡死检测(自动重试/通知)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 StreamHeartbeat 或 StallDetector 触发;CLI/Web 显示重试进度"}),P({type:"task_interrupted",description:"任务中断(服务重启/异常退出)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"服务启动扫描时将 running activeRun 标记为 interrupted 后触发;提示用户使用 /continue 恢复生成,或用 /resume 切换会话"}),P({type:"step_prompt",description:"步骤提示(Web 路由用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,note:"Web 路由的内部事件,不通过 WS 发送"})]);yn([P({type:"plan_start",description:"计划开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 EnterPlanMode 工具 emit"}),P({type:"plan_thinking",description:"计划思考",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_tasks",description:"计划任务列表生成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(解析计划内容为任务列表);CLI handler 解析 data.tasks",schema:gt({tasks:Uf(Ob())}).partial()}),P({type:"plan_task_start",description:"计划任务开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_update",description:"计划任务更新",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_result",description:"计划任务结果",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_complete",description:"计划完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(携带 currentPlan/proposedPlan)"}),P({type:"plan_error",description:"计划错误",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_mode_change",description:"计划模式切换",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01);Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_mode_enter",description:"进入计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_mode_exit",description:"退出计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_confirm",description:"计划等待确认",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_waiting",description:"计划等待用户输入",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_continue",description:"计划继续执行",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_settled",description:"计划已定稿",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_cleared",description:"计划已清除",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"user_exit_plan_mode",description:"用户手动退出计划模式",category:"plan",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),客户端无需 handler"}),P({type:"plan_task_complete",description:"计划任务完成(单个)",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core TaskUpdateTool 在 completed/failed 时 emit,data 携带 id/title/status/result/error;CLI 与 Web 均更新看板并输出通知(toast / 状态区)",schema:gt({id:Ae(),title:Ae(),status:Ae(),result:Ae().optional(),error:Ae().optional()}).partial()}),P({type:"plan_subagent_start",description:"Plan 设计子代理启动",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 启动只读设计子代理时 emit;data 携带 scope/agentId/planSlug/title",schema:gt({scope:Ae(),agentId:Ae(),planSlug:Ae().optional(),title:Ae().optional()}).partial()}),P({type:"plan_subagent_done",description:"Plan 设计子代理完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 子代理完成(成功或失败)时 emit;data 携带 scope/agentId/status/designDocPath/error",schema:gt({scope:Ae(),agentId:Ae(),status:Ae(),designDocPath:Ae().optional(),error:Ae().optional()}).partial()})]);yn([P({type:"token_update",description:"Token 用量更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_compressed",description:"上下文已压缩",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_progress",description:"压缩进度更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_analysis",description:"上下文分布分析",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_warning",description:"Token 阈值警告",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_error",description:"Token 阈值错误",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"功能存在但被 context_blocked 覆盖,事件未使用"}),P({type:"context_blocked",description:"上下文已满,生成被阻止",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"blocking_limit",description:"已达到阻止极限",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"compaction_started",description:"压缩任务已启动(phase/trigger)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_finished",description:"压缩任务结束(done/failed/aborted)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_retry",description:"工具重试",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"重试信息已含于 tool_result/error,Web handler 保留但路由不可达"}),P({type:"model_fallback",description:"模型回退",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"降级信息已含于 degradation_update,Web handler 保留但路由不可达"}),P({type:"usage",description:"Token 用量",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_breakdown",description:"上下文容量分类占比(系统提示词/消息/工具/技能/MCP),供 Web 底部上下文条抽屉展示",category:"context",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"每轮 query 上下文组装后估算各组件 token,Web 端点状态栏上下文条上拉展示"})]);yn([P({type:"workflow_started",description:"工作流已启动",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_event",description:"工作流事件",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_progress",description:"工作流进度",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_finished",description:"工作流完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_error",description:"工作流错误",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_checkpoint",description:"工作流检查点",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_node_start",description:"工作流节点开始",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_node_complete",description:"工作流节点完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_paused",description:"工作流已暂停",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_resumed",description:"工作流已恢复",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_cancelled",description:"工作流已取消",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_recovered",description:"工作流已恢复(从故障)",category:"workflow",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已被 workflow_resumed 覆盖,核心从未发送"}),P({type:"workflow_handoff",description:"ReAct 转交 workflow(范式切换)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_status",description:"workflow run 状态查询响应(状态对账:连接/重连后拉取终态)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 配合 get_workflow_status 请求,修复一次性事件流漏终态导致的 UI 卡死"})]);yn([P({type:"task_update",description:"任务更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_output",description:"任务输出",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_finished",description:"任务完成",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_error",description:"任务错误",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"filejob_start",description:"文件处理任务开始(解析/渲染)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"对话内嵌文件处理面板;Web 已处理,CLI 已处理(2026-08-07 状态行)"}),P({type:"filejob_progress",description:"文件处理进度更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"解析/渲染进度百分比",schema:gt({progress:ia()}).partial()}),P({type:"filejob_result",description:"文件处理完成(结果文件列表)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"携带 RenderedFileResult[]",schema:Uf(Ob())}),P({type:"filejob_error",description:"文件处理失败",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"脱敏错误详情"})]);yn([P({type:"goal_created",description:"目标已创建",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web handled via goal_tasks/goal_task_update"}),P({type:"goal_tasks",description:"目标任务列表(批量初始化看板)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: 统一看板数据源"}),P({type:"goal_task_update",description:"目标任务更新",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web 已添加 handler"}),P({type:"goal_completed",description:"目标已完成(workflow 终态自动推导)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 此前 goals.complete() 无任何调用点,goal 工作流跑完后 goal 永远停在 active —— 新增终态事件供两端对账"})]);yn([P({type:"hook_ask",description:"Hook 审批请求",category:"hook",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"hook_allow",description:"Hook 允许响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({type:"hook_deny",description:"Hook 拒绝响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({type:"hook_response_ack",description:"Hook 响应确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01); Web systemHandlers 已处理(2026-08-07)"}),P({type:"ask_user_question",description:"向用户提问",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"question_answer_ack",description:"提问回答确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web useWebSocket 已处理(dismiss 提问弹窗)"}),P({type:"hook_auto_ack",description:"Hook 自动模式确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"})]);yn([P({type:"mcp_update",description:"MCP 状态更新",category:"mcp",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"})]);yn([P({type:"doctor_result",description:"诊断完成",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation",description:"降级状态更新(遗留)",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation_update",description:"降级状态更新",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0})]);yn([P({type:"commands_list",description:"命令列表(服务器→客户端)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(setDynamicCommands); Web systemHandlers 已处理(2026-08-07)"}),P({type:"ping",description:"心跳 Ping",category:"system",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"由 Server 的 WS 层自动处理"}),P({type:"pong",description:"心跳 Pong",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"由 Client 的 WS 层自动处理"}),P({type:"log",description:"服务端日志",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"notification",description:"通知消息",category:"system",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"channel_message",description:"频道入站消息(转发到 Web UI)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"channel_status",description:"频道连接状态变更",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(channelsStore)"}),P({type:"channel_error",description:"频道运行时错误",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"todo_update",description:"待办事项更新",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"todo_item_done",description:"待办项完成",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"todo_progress",description:"待办进度",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"tombstone",description:"消息已删除/墓碑",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"Web/CLI 本地消息删除渲染概念,无 WS 发射端"}),P({type:"status",description:"状态更新(modelName/connected/statusText)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:gt({modelName:Ae(),connected:Rb(),statusText:Ae()}).partial()}),P({type:"model_name",description:"当前模型名称",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:gt({model:Ae()}).partial()}),P({type:"throttle",description:"速率限制状态",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"code_review_ready",description:"代码审查结果就绪",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"pdca_phase",description:"PDCA 循环阶段",category:"system",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,deprecated:!0,note:"已退役:5-phase light pipeline 被 WorkflowRuntime 取代"}),P({type:"command_start",description:"命令开始(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_complete",description:"命令完成(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_error",description:"命令错误(Web 路由用)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core index.ts:1270 真实 emit;CLI useStreamHandlers:741 与 Web systemHandlers 均已处理"})]);yn([P({type:"tool.approval_required",description:"工具调用需要审批(无人值守运行触发,未放行即拒绝)",category:"inbox",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"无人值守/定时运行时写操作需审批的通知;Inbox 审批队列已移除,CLI/Web 仅提示状态"})]);yn([P({type:"automation.update",description:"自动化任务新增/更新/删除/状态变更",category:"automation",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"REST /api/automations 已可用;Web 自动化视图消费"}),P({type:"automation.run",description:"自动化触发运行(started/finished/error)",category:"automation",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web RunDetail 消费"})]);const Gk=/^[a-z][a-z0-9._-]*$/,nc=Ae().min(1).max(128).regex(Gk,"command id must match ^[a-z][a-z0-9._-]*$");gt({id:Ae().min(1).max(128),command:nc,payload:gl().optional(),timeoutMs:ia().int().positive().max(3e5).optional(),sender:Ae().max(128).optional()});gt({success:Rb(),requestId:Ae(),command:nc,result:gl().optional(),error:Ae().optional(),durationMs:ia().min(0).optional()});const qk=gt({capability:nc,command:nc,description:Ae().max(500).optional(),provider:Ae().max(128).optional()});gt({version:$f("1"),capabilities:Uf(qk)});const Vk="1",Wk=["ready","select","inspect","screenshot","highlight","command","event"],Kk=gt({version:$f(Vk),type:Fk(Wk),requestId:Ae().min(1).max(128),payload:gl().optional()}).passthrough();gt({type:Ae().min(1).max(128).regex(/^[a-z][a-z0-9._-]*$/,"event type must match ^[a-z][a-z0-9._-]*$"),payload:gl().optional(),source:Ae().max(128).optional(),timestamp:ia().nonnegative().optional()});const Yk="workspace_event";gt({type:$f(Yk),sessionId:Ae().optional(),data:Pk([Ae(),Kk]).optional(),traceId:Ae().optional()});const Zk=oc.map(a=>({eventType:a.type,description:a.description,category:a.category,emittedBy:a.emittedBy,handledByCli:a.handledByCli,handledByWeb:a.handledByWeb,...a.deprecated!==void 0?{deprecated:a.deprecated}:{},...a.note!==void 0?{note:a.note}:{}}));function An(a){return a==="auto-plan"?"plan":a==="auto-act"?"act":a==="auto-goal"?"goal":a}function ji(a){return a==="auto-plan"||a==="auto-act"||a==="auto-goal"}function Qk(a){switch(a){case"plan":return"auto-plan";case"auto-plan":return"plan";case"act":return"auto-act";case"auto-act":return"act";case"goal":return"auto-goal";case"auto-goal":return"goal"}}const gN=["plan","act","goal"];function gf(a,t){return t?a==="plan"?"auto-plan":a==="act"?"auto-act":"auto-goal":a}function Xk(a){const t=["plan","act","goal"],s=t.indexOf(An(a)),r=t[(s+1)%t.length]??"act";return gf(r,ji(a))}const Jk={plan:{label:"Plan",accent:"blue"},"auto-plan":{label:"Auto-Plan",accent:"cyan"},act:{label:"Act",accent:"green"},"auto-act":{label:"Auto-Act",accent:"yellow"},goal:{label:"Goal",accent:"magenta"},"auto-goal":{label:"Auto-Goal",accent:"red"}},yN={low:{label:"Low",accent:"green"},medium:{label:"Medium",accent:"cyan"},high:{label:"High",accent:"yellow"},critical:{label:"Critical",accent:"red"}},bN={allow:{label:"Allow"},deny:{label:"Deny"},allow_session:{label:"Allow session"},auto:{label:"Auto mode"}};function e1(a){return a==="plan"||a==="auto-plan"||a==="act"||a==="auto-act"||a==="goal"||a==="auto-goal"?a:"auto-act"}function qr(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${Math.round(a/1e3)}K`:String(a)}function t1(a){return a<=0?"":a>=100?`${Math.round(a)}t/s`:`${a.toFixed(1)}t/s`}function Mb(a){if(a<=0)return"";if(a>=60){const t=Math.floor(a/60),s=a%60;return`${t}m${s}s`}return`${a}s`}function n1(a,t){switch(a){case"bash":case"shell":case"PowerShell":return`ran ${t} shell command${t>1?"s":""}`;case"read_file":return`read ${t} file${t>1?"s":""}`;case"write_file":return`wrote ${t} file${t>1?"s":""}`;case"edit_file":return`edited ${t} file${t>1?"s":""}`;default:return`ran ${t} ${a}${t>1?"s":""}`}}function xN(a){const t=Object.entries(a.toolCounts).filter(([,l])=>l>0).sort((l,c)=>c[1]-l[1]),s=a.headline||`Thought for ${Mb(Math.max(1,Math.round(a.durationMs/1e3)))}`,r=t.map(([l,c])=>n1(l,c));return r.length>0?`${s}, ${r.join(", ")}`:s}function s1(a,t){const s=a.toLowerCase();return/\b(rm|del|delete|drop|truncate|format|mkfs)\b/.test(s)?"critical":/\b(bash|shell|exec|cmd|powershell|terminal)\b/.test(s)?/\b(rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs)\b/i.test(t)?"critical":"high":/\b(write|edit|save|upload|deploy|publish)\b/i.test(s)||/\b(install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf)\b/i.test(s)?"high":/\b(git|commit|push|merge|rebase)\b/i.test(s)?/\b(push|force|hard\s*reset|rebase)\b/i.test(t)?"high":"medium":/\b(http|fetch|curl|wget|api|request|download)\b/i.test(s)?"medium":/\b(read|open|list|ls|dir|cat|view|search|find|grep|glob)\b/i.test(s)?"low":"medium"}function a1(a,t){if(t==null)return null;if(/\b(bash|shell|exec|cmd|powershell|terminal)\b/i.test(a))return t||null;if(/\b(write|edit|save|create)\b/i.test(a)){const s=t.match(/(?:file_path|path|file)["\s:=]+([^\s",}]+)/i);return s?`${s[1]}
|
|
27
|
-
${t.slice(0,200)}`:t.slice(0,200)||null}return t&&t.length>0?t.length>200?`${t.slice(0,200)}...`:t:null}const vN=["openai-chat-completions","openai-completions","openai-responses","anthropic-messages"];Zk.map(a=>a.eventType);function i1(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}const Ri=Bt(a=>({errors:[],push:(t,s,r,l,c)=>{const u=i1(),d={id:u,level:t,title:s,detail:r,action:l,timestamp:Date.now(),dismissed:!1,durationMs:c};return a(p=>({errors:[...p.errors.slice(-49),d]})),u},dismiss:t=>a(s=>({errors:s.errors.map(r=>r.id===t?{...r,dismissed:!0}:r)})),clearAll:()=>a({errors:[]})})),Hn={info:(a,t,s)=>Ri.getState().push("info",a,t,void 0,s),warn:(a,t,s)=>Ri.getState().push("warning",a,t,void 0,s),error:(a,t,s)=>Ri.getState().push("error",a,t,void 0,s),critical:(a,t,s)=>Ri.getState().push("critical",a,t,void 0,s)},Vr=20,r1=()=>{const a=window.location.protocol==="https:"?"wss:":"ws:",t=window.location.hostname,s=window.location.port,r=s?String(Number(s)+1):"",l=r?`${t}:${r}`:t;return`${a}//${l}/ws`},l1=r1(),xy="dscode_client_id";function o1(){try{const a=localStorage.getItem(xy);if(a)return a;const t=`web-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(xy,t),t}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}class c1{constructor(t){He(this,"ws",null);He(this,"url");He(this,"clientId",o1());He(this,"messageHandlers",new Set);He(this,"openHandlers",new Set);He(this,"closeHandlers",new Set);He(this,"errorHandlers",new Set);He(this,"reconnectAttempts",0);He(this,"reconnectHandlers",new Set);He(this,"reconnectSuccessHandlers",new Set);He(this,"reconnectGiveUpHandlers",new Set);He(this,"isManualClose",!1);He(this,"authenticated",!1);He(this,"sessionId",null);He(this,"heartbeatInterval",null);He(this,"reconnectTimer",null);He(this,"lastPongTime",0);He(this,"HEARTBEAT_INTERVAL",15e3);He(this,"HEARTBEAT_TIMEOUT",45e3);this.url=t||l1}setSessionId(t){this.sessionId=t}getSessionId(){return this.sessionId}getReconnectState(){var t;return{attempts:this.reconnectAttempts,maxAttempts:Vr,reconnecting:this.reconnectAttempts>0&&((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN}}onReconnectAttempt(t){return this.reconnectHandlers.add(t),()=>this.reconnectHandlers.delete(t)}onReconnectSuccess(t){return this.reconnectSuccessHandlers.add(t),()=>this.reconnectSuccessHandlers.delete(t)}onReconnectGiveUp(t){return this.reconnectGiveUpHandlers.add(t),()=>this.reconnectGiveUpHandlers.delete(t)}connect(){var r,l;if(((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN||((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING)return;this.isManualClose=!1;const t=new URLSearchParams;this.sessionId&&t.set("sessionId",this.sessionId),t.set("clientId",this.clientId);const s=t.toString()?`${this.url}?${t.toString()}`:this.url;this.ws=new WebSocket(s),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{var u;console.log("WebSocket connected");const c=this.reconnectAttempts>0;this.reconnectAttempts=0,this.lastPongTime=Date.now(),c&&this.reconnectSuccessHandlers.forEach(d=>d()),((u=this.ws)==null?void 0:u.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"})),this.startHeartbeat(),this.openHandlers.forEach(d=>d())},this.ws.onclose=()=>{console.log("WebSocket closed"),this.stopHeartbeat(),this.closeHandlers.forEach(c=>c()),this.isManualClose||this.scheduleReconnect()},this.ws.onerror=c=>{Hn.error("WebSocket connection error",c.message||"Connection failed"),this.errorHandlers.forEach(u=>u())},this.ws.onmessage=c=>{this._onMessage(c)}}async _onMessage(t){var s,r;try{let l;if(t.data instanceof Blob?l=await t.data.text():t.data instanceof ArrayBuffer?l=new TextDecoder().decode(t.data):typeof t.data=="string"?l=t.data:l=String(t.data),l=l.trim(),!l)return;const c=JSON.parse(l);if(console.log("[WS←]",c.type,c.sessionId,JSON.stringify(c.data||c.message||"").slice(0,200)),(c.type==="pong"||c.type==="ping")&&(this.lastPongTime=Date.now(),c.type==="pong"))return;c.seq!==void 0&&c.seq>=0&&this.send({type:"message_ack",data:JSON.stringify({seq:c.seq})}),this.messageHandlers.forEach(u=>u(c))}catch(l){const c=((r=(s=t.data)==null?void 0:s.constructor)==null?void 0:r.name)||typeof t.data;let u;if(t.data instanceof Blob?u=`[Blob ${t.data.size} bytes]`:t.data instanceof ArrayBuffer?u=`[ArrayBuffer ${t.data.byteLength} bytes]`:u=String(t.data).slice(0,500),typeof t.data=="string"&&t.data.trim()){const d=t.data.trim();try{this.messageHandlers.forEach(p=>p({type:"log",data:JSON.stringify({level:"info",message:d})}));return}catch{}}Hn.error("Failed to parse WebSocket message",`type=${c} data=${u} error=${l}`)}}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatInterval=setInterval(()=>{var t,s;if(Date.now()-this.lastPongTime>this.HEARTBEAT_TIMEOUT){console.warn("[WS] Heartbeat timeout, reconnecting..."),this.stopHeartbeat(),this.isManualClose=!0,(t=this.ws)==null||t.close(),this.ws=null,this.scheduleReconnect();return}((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&this.send({type:"ping"})},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>Vr){console.error(`[WS] Max reconnect attempts (${Vr}) reached — giving up.`),Hn.error("WebSocket",`Connection lost — max reconnect attempts (${Vr}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(l=>l());return}const t=Math.min(3e3*Math.pow(2,this.reconnectAttempts),3e4),s=Math.random()*1e3-500,r=Math.max(100,Math.round(t+s));console.log(`[WS] Reconnecting... Attempt ${this.reconnectAttempts}, delay=${r}ms`),this.reconnectHandlers.forEach(l=>l(this.reconnectAttempts,Vr)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},r)}disconnect(){var t;this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}send(t){var s,r;if(((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN){const l=JSON.stringify(t);console.log("[WS→]",t.type,t.sessionId,l.slice(0,200)),this.ws.send(l)}else console.warn("[WS] NOT CONNECTED — dropping:",t.type,t.sessionId,"readyState=",(r=this.ws)==null?void 0:r.readyState)}onMessage(t){return this.messageHandlers.add(t),()=>this.messageHandlers.delete(t)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onClose(t){return this.closeHandlers.add(t),()=>this.closeHandlers.delete(t)}onError(t){return this.errorHandlers.add(t),()=>this.errorHandlers.delete(t)}get isConnected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}setToken(t){try{sessionStorage.setItem("auth_token",t)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(t){this.authenticated=t}}const pe=new c1;function vy(a,t){return`ext:${a}:${t.toLowerCase()}`}const Ns=Bt()(da((a,t)=>({pendingApprovals:[],autoMode:!0,sessionAllowList:[],showConfigHint:!0,addApproval:s=>a(r=>({pendingApprovals:[...r.pendingApprovals,s]})),removeApproval:s=>a(r=>({pendingApprovals:r.pendingApprovals.filter(l=>l.approvalId!==s)})),clearApprovals:()=>a({pendingApprovals:[]}),setAutoMode:s=>a({autoMode:s}),addToSessionAllowList:(s,r)=>a(l=>{const c=r?vy(s,r):s;return l.sessionAllowList.includes(c)?l:{sessionAllowList:[...l.sessionAllowList,c]}}),isSessionAllowed:(s,r)=>{const l=t().sessionAllowList;return r?l.includes(vy(s,r)):l.includes(s)},setShowConfigHint:s=>a({showConfigHint:s})}),{name:"deepseekcode-hook-approval",partialize:a=>({autoMode:a.autoMode,showConfigHint:a.showConfigHint})}));function u1(a){if(!a)return 0;const t=(a.match(/[\u4e00-\u9fff]/g)||[]).length,s=a.length-t;return Math.ceil(t*1.5+s*.25)}const Ge=Bt((a,t)=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},maxContextTokens:1e6,degradation:null,compactingUntil:0,lastCompactInfo:null,compactionProgress:null,cacheStats:null,showTokenInfo:!1,model:"",history:[],_hasBackendData:!1,tokenRate:0,sessionBaseTotal:0,workflowTokens:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,retryState:null,contextBreakdown:null,setContextDistribution:s=>a({contextDistribution:s}),setContextBreakdown:s=>a({contextBreakdown:s}),setThresholdWarning:s=>a({thresholdWarning:s}),setRetryState:s=>a({retryState:s}),updateUsage:s=>a(r=>{const l=s.totalTokens??r.currentUsage.totalTokens,c=Date.now(),u=r._lastTotal,d=r._lastTotalTs;let p=r.tokenRate;if(d>0&&u>0&&c>d&&l>u){const g=l-u,y=(c-d)/1e3,b=g/y;p=p>0?p*.6+b*.4:b}return{currentUsage:{...r.currentUsage,...s},_hasBackendData:!0,tokenRate:p,_lastTotal:l,_lastTotalTs:c}}),setModel:s=>a({model:s}),addWorkflowTokens:s=>a(r=>({workflowTokens:r.workflowTokens+(Number(s)||0)})),setMaxContextTokens:s=>a({maxContextTokens:s}),setDegradation:s=>a({degradation:s}),setCompacting:s=>a({compactingUntil:Date.now()+3e3,lastCompactInfo:s}),setCompactionProgress:s=>a({compactionProgress:s}),setCacheStats:s=>a({cacheStats:s}),accumulateCacheStats:(s,r)=>a(l=>{const c=l.cacheStats,u=((c==null?void 0:c.cacheHitTokens)??0)+s,d=((c==null?void 0:c.cacheMissTokens)??0)+r;return{cacheStats:{cacheHitTokens:u,cacheMissTokens:d,cacheHitRate:u+d>0?u/(u+d):void 0,cacheStatsCalls:((c==null?void 0:c.cacheStatsCalls)??0)+1}}}),setShowTokenInfo:s=>a({showTokenInfo:s}),addToHistory:s=>a(r=>({history:[...r.history.slice(-100),{timestamp:Date.now(),usage:s}]})),estimateTokens:s=>u1(s),recalculateFromMessages:s=>{if(!s||s.length===0){a({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1});return}if(t()._hasBackendData)return;const r=t().estimateTokens;let l=0,c=0;for(const p of s){let g=p.content||"";if(p.thinking&&(g+=" "+p.thinking),p.steps)for(const b of p.steps)b.thought&&(g+=" "+b.thought),b.action&&(g+=" "+b.action),b.result&&(g+=" "+b.result);if(p.toolCalls)for(const b of p.toolCalls)b.args&&(g+=" "+(typeof b.args=="string"?b.args:JSON.stringify(b.args)));const y=r(g);p.type==="user"?l+=y:c+=y}const u=l+c,d=l/1e6*.15+c/1e6*.6;a({currentUsage:{promptTokens:l,completionTokens:c,totalTokens:u,estimatedCost:d}})},resetUsage:()=>a(s=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1,sessionBaseTotal:s.currentUsage.totalTokens,workflowTokens:0,tokenRate:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,contextBreakdown:null}))})),Bb="";function Fo(a){return`${Bb}${a}`}class d1{constructor(t){He(this,"baseUrl");this.baseUrl=t}async request(t,s={}){try{const r=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token"),l={"Content-Type":"application/json",...s.headers};r&&(l.Authorization=`Bearer ${r}`);const c=await fetch(`${this.baseUrl}${t}`,{headers:l,...s}),u=await c.json();return c.ok?u&&typeof u.success=="boolean"?{success:u.success,data:u.data,error:u.error}:{success:!0,data:u}:{success:!1,error:u.error||`HTTP ${c.status}`,data:u.data}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Network error"}}}get(t){return this.request(t,{method:"GET"})}post(t,s){return this.request(t,{method:"POST",body:s?JSON.stringify(s):void 0})}put(t,s){return this.request(t,{method:"PUT",body:s?JSON.stringify(s):void 0})}delete(t,s){return this.request(t,{method:"DELETE",body:s?JSON.stringify(s):void 0})}patch(t,s){return this.request(t,{method:"PATCH",body:s?JSON.stringify(s):void 0})}}const H=new d1(Bb),Ie={providers:{presets:()=>H.get("/api/providers/presets"),refresh:()=>H.post("/api/providers/refresh")},models:{list:async()=>{var t;const a=await H.get("/api/models");return a.success&&((t=a.data)!=null&&t.models)&&(a.data.models=a.data.models.map(s=>({...s,isGlobalDefault:s.isDefault===!0,isPlanDefault:s.defaultFor==="plan",isActDefault:s.defaultFor==="act",isGoalDefault:s.defaultFor==="goal"}))),a},get:a=>H.get(`/api/models/${a}`),create:a=>H.post("/api/models",a),update:(a,t,s)=>H.post("/api/models/update",{provider:a,modelId:t,...s}),delete:(a,t)=>H.post("/api/models/delete",{provider:a,modelId:t}),test:a=>H.post(`/api/models/${a}/test`),fetch:(a,t)=>H.post("/api/models/fetch",{baseUrl:a,apiKey:t}),catalogSearch:a=>{const t=new URLSearchParams;a.q&&t.set("q",a.q),a.toolCall&&t.set("toolCall","1"),a.reasoning&&t.set("reasoning","1"),a.minContext&&t.set("minContext",String(a.minContext)),a.limit&&t.set("limit",String(a.limit));const s=t.toString();return H.get(`/api/models/catalog${s?`?${s}`:""}`)},toggle:(a,t)=>H.post("/api/models/toggle",{provider:a,modelId:t}),setDefaults:a=>H.post("/api/models/defaults",a)},tools:{list:()=>H.get("/api/tools"),get:a=>H.get(`/api/tools/${a}`),update:(a,t)=>H.put(`/api/tools/${a}`,t),toggle:(a,t)=>H.post(`/api/tools/${a}/toggle`,{enabled:t})},connectors:{list:()=>H.get("/api/connectors"),get:a=>H.get(`/api/connectors/${encodeURIComponent(a)}`),toggle:(a,t,s)=>H.post(`/api/connectors/${encodeURIComponent(a)}/toggle`,{enabled:t,env:s}),addCustom:a=>H.post("/api/connectors/custom",a),removeCustom:a=>H.delete(`/api/connectors/custom/${encodeURIComponent(a)}`)},skills:{list:()=>H.get("/api/skills"),get:a=>H.get(`/api/skills/${a}`),create:a=>H.post("/api/skills",a),update:(a,t)=>H.put(`/api/skills/${a}`,t),toggle:(a,t)=>H.post(`/api/skills/${a}/toggle`,{enabled:t}),delete:a=>H.delete(`/api/skills/${a}`),import:a=>H.post("/api/skills/import",a),marketplaces:{list:()=>H.get("/api/skills/marketplaces"),add:a=>H.post("/api/skills/marketplaces",a),remove:a=>H.delete(`/api/skills/marketplaces/${a}`),get:a=>H.get(`/api/skills/marketplaces/${a}`),refresh:a=>H.post(`/api/skills/marketplaces/${a}/refresh`,{}),install:(a,t)=>H.post(`/api/skills/marketplaces/${a}/install`,{skillId:t})},workshop:{list:a=>H.get(`/api/skills/workshop${a?`?status=${a}`:""}`),propose:a=>H.post("/api/skills/workshop",a),apply:a=>H.post(`/api/skills/workshop/${a}/apply`,{}),reject:a=>H.post(`/api/skills/workshop/${a}/reject`,{})},config:{get:a=>H.get(`/api/skills/${a}/config`),update:(a,t)=>H.put(`/api/skills/${a}/config`,t)}},files:{list:a=>H.get(`/api/files${a?`?path=${encodeURIComponent(a)}`:""}`),read:a=>H.get(`/api/files/read?path=${encodeURIComponent(a)}`),create:(a,t)=>H.post("/api/files",{path:a,content:t}),update:(a,t)=>H.put("/api/files/write",{path:a,content:t}),delete:a=>H.delete(`/api/files?path=${encodeURIComponent(a)}`),download:async a=>{try{const t={},s=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token");s&&(t.Authorization=`Bearer ${s}`);const r=await fetch(Fo(`/api/files/download?path=${encodeURIComponent(a)}`),{headers:t});if(!r.ok){let d=`HTTP ${r.status}`;try{const p=await r.json();p!=null&&p.error&&(d=p.error)}catch{}return{success:!1,error:d}}const l=await r.blob(),c=URL.createObjectURL(l),u=document.createElement("a");return u.href=c,u.download=a.split(/[\\/]/).pop()||"download",u.click(),URL.revokeObjectURL(c),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Download failed"}}},upload:async(a,t)=>{try{const s=await f1(a);return H.post("/api/files/upload",{path:t,content:s,base64:!0})}catch(s){return{success:!1,error:s instanceof Error?s.message:"Upload failed"}}}},dirs:{list:a=>H.get(`/api/dirs${a?`?path=${encodeURIComponent(a)}`:""}`)},sessions:{list:()=>H.get("/api/sessions"),get:a=>H.get(`/api/sessions/${a}`),create:a=>H.post("/api/sessions",{title:a}),delete:a=>H.delete(`/api/sessions/${a}`),resume:a=>H.get(`/api/sessions/${encodeURIComponent(a)}/resume`)},tasks:{list:a=>H.get(a?`/api/tasks?sessionId=${encodeURIComponent(a)}`:"/api/tasks"),get:a=>H.get(`/api/tasks/${a}`),create:a=>H.post("/api/tasks",a),update:(a,t)=>H.put(`/api/tasks/${a}`,t),updateStatus:(a,t)=>H.patch(`/api/tasks/${a}/status`,{status:t}),delete:a=>H.delete(`/api/tasks/${a}`),clearCompleted:()=>H.delete("/api/tasks")},config:{provider:{get:()=>H.get("/api/config/provider"),save:a=>H.post("/api/config/provider",a),delete:a=>H.post("/api/config/provider/remove",{provider:a}),setDefault:a=>H.post("/api/config/provider",{provider:a,setDefault:!0})},files:{list:()=>H.get("/api/config/files"),read:a=>H.get(`/api/config/files/read?file=${encodeURIComponent(a)}`),write:(a,t)=>H.put("/api/config/files/write",{file:a,content:t})}},git:{status:()=>H.get("/api/git/status"),branches:()=>H.get("/api/git/branches"),commit:a=>H.post("/api/git/commit",a),push:()=>H.post("/api/git/push"),checkout:a=>H.post("/api/git/checkout",{branch:a}),prStatus:()=>H.get("/api/repos/pr")},fileJob:{parse:a=>H.post("/api/filejob/parse",{files:a}),parsePaths:a=>H.post("/api/filejob/parse",{paths:a}),importPaths:a=>H.post("/api/filejob/import",{paths:a}),render:a=>H.post("/api/filejob/render",a)},system:{status:()=>H.get("/api/system/status"),restart:()=>H.post("/api/system/restart"),shutdown:()=>H.post("/api/system/shutdown")},observability:{summary:()=>H.get("/api/observability/summary"),costs:()=>H.get("/api/observability/costs"),listRuns:()=>H.get("/api/observability/runs"),getRun:a=>H.get(`/api/observability/runs/${encodeURIComponent(a)}`),getRunEvents:(a,t=0,s=50)=>H.get(`/api/observability/runs/${encodeURIComponent(a)}/events?page=${t}&size=${s}`)},templates:{list:()=>H.get("/api/templates"),get:a=>H.get(`/api/templates/${encodeURIComponent(a)}`),create:a=>H.post("/api/templates",a),update:(a,t)=>H.put(`/api/templates/${encodeURIComponent(a)}`,t),remove:a=>H.delete(`/api/templates/${encodeURIComponent(a)}`),versions:a=>H.get(`/api/templates/${encodeURIComponent(a)}/versions`),getVersion:(a,t)=>H.get(`/api/templates/${encodeURIComponent(a)}/versions/${t}`),render:(a,t)=>H.post(`/api/templates/${encodeURIComponent(a)}/render`,{inputs:t}),createFromRun:(a,t)=>H.post("/api/templates",{sourceRunId:a,generalize:(t==null?void 0:t.generalize)===!0,name:t==null?void 0:t.name,message:t==null?void 0:t.message})},workflows:{list:()=>H.get("/api/workflows"),start:a=>H.post("/api/workflows",a),get:a=>H.get(`/api/workflows/${encodeURIComponent(a)}`),synthesize:a=>H.post("/api/workflows/synthesize",{message:a})},plans:{list:()=>H.get("/api/plans"),read:a=>H.get(`/api/plans/${encodeURIComponent(a)}`),delete:a=>H.delete(`/api/plans/${encodeURIComponent(a)}`)},logs:{list:()=>H.get("/api/logs"),read:(a,t)=>H.get(`/api/logs/read?file=${encodeURIComponent(a)}${t?`&maxLines=${t}`:""}`),downloadUrl:a=>`/api/logs/download?file=${encodeURIComponent(a)}`},stt:{status:()=>H.get("/api/stt/status"),transcribe:(a,t,s="wav")=>H.post("/api/stt/transcribe",{language:a,audio:t,format:s}),install:a=>H.post("/api/stt/install",{backend:a}),installStatus:()=>H.get("/api/stt/install/status"),cancelInstall:()=>H.post("/api/stt/install/cancel")},hooks:{list:()=>H.get("/api/hooks/rules"),get:a=>H.get(`/api/hooks/rules/${encodeURIComponent(a)}`),create:a=>H.post("/api/hooks/rules",a),update:(a,t)=>H.put(`/api/hooks/rules/${encodeURIComponent(a)}`,t),delete:a=>H.delete(`/api/hooks/rules/${encodeURIComponent(a)}`),batchDelete:a=>H.post("/api/hooks/rules/batch-delete",{names:a}),toggle:(a,t)=>H.patch(`/api/hooks/rules/${encodeURIComponent(a)}/toggle`,{enabled:t}),batchToggle:(a,t)=>H.post("/api/hooks/rules/batch-toggle",{names:a,enabled:t}),dryRun:a=>H.post("/api/hooks/dry-run",a),stats:()=>H.get("/api/hooks/stats"),events:()=>H.get("/api/hooks/events"),agents:()=>H.get("/api/hooks/agents"),export:()=>H.get("/api/hooks/export"),import:a=>H.post("/api/hooks/import",a)},channels:{list:()=>H.get("/api/channels"),types:()=>H.get("/api/channels/types"),create:a=>H.post("/api/channels",a),update:(a,t)=>H.put(`/api/channels/${encodeURIComponent(a)}`,t),delete:a=>H.delete(`/api/channels/${encodeURIComponent(a)}`),toggle:(a,t)=>H.patch(`/api/channels/${encodeURIComponent(a)}/toggle`,{enabled:t}),test:a=>H.post(`/api/channels/${encodeURIComponent(a)}/test`),wechat:{qrcode:(a,t)=>H.get(`/api/channels/${encodeURIComponent(a)}/wechat/qrcode?token=${encodeURIComponent(t)}`),qrcodeStatus:(a,t,s)=>H.get(`/api/channels/${encodeURIComponent(a)}/wechat/qrcode/status?token=${encodeURIComponent(t)}&qrcode=${encodeURIComponent(s)}`)},weixin:{bind:()=>H.get("/api/weixin/bind"),bindStatus:a=>H.get(`/api/weixin/bind/status?qrcode=${encodeURIComponent(a)}`)}},automations:{list:()=>H.get("/api/automations"),create:a=>H.post("/api/automations",a),update:(a,t)=>H.put(`/api/automations/${encodeURIComponent(a)}`,t),remove:a=>H.delete(`/api/automations/${encodeURIComponent(a)}`),toggle:(a,t)=>H.post(`/api/automations/${encodeURIComponent(a)}/toggle`,{enabled:t}),run:a=>H.post(`/api/automations/${encodeURIComponent(a)}/run`),runs:a=>H.get(`/api/automations/${encodeURIComponent(a)}/runs`),addPermission:(a,t,s)=>H.post(`/api/automations/${encodeURIComponent(a)}/permissions`,{tool:t,target:s}),revokePermission:(a,t)=>H.delete(`/api/automations/${encodeURIComponent(a)}/permissions`,{entry:t})}};function f1(a){return new Promise((t,s)=>{const r=new FileReader;r.onload=()=>{const l=r.result,c=l.indexOf(",");t(c>=0?l.slice(c+1):l)},r.onerror=()=>s(r.error||new Error("Failed to read file")),r.readAsDataURL(a)})}const Rd=a=>a==="normal"?"act":a;let Do=0;const p1=a=>a==="normal"?"normal":a==="auto"?"auto-act":e1(typeof a=="string"?a:void 0),Wr=a=>a==="normal"?"act":ji(a)?"auto":An(a),Mi=Bt()(da((a,t)=>({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null,setMode:s=>{const r=t().mode;if(r===s)return;a(g=>({mode:s,modeHistory:[...g.modeHistory,{previousMode:r,newMode:s,description:`Mode changed: ${r} -> ${s}`,timestamp:Date.now()}]})),Ns.getState().setAutoMode(s!=="normal"&&ji(s));const l=Wr(r),c=Wr(s),u=r==="normal"?"act":An(r),d=s==="normal"?"act":An(s);if(u===d&&l===c)return;try{const g=we.getState().activeSessionId||pe.getSessionId();g&&pe.send({type:"plan_mode_change",sessionId:g,data:JSON.stringify({previousMode:Wr(r),newMode:Wr(s),frontendMode:s,timestamp:Date.now()})})}catch(g){console.warn("[ExecutionModeStore] Failed to notify mode change via WS:",g)}const p=++Do;Ie.models.list().then(g=>{var C,E;if(p!==Do||!g.success||!((C=g.data)!=null&&C.models))return;const y=g.data.models.filter(O=>O.enabled!==!1),b=An(Rd(s)),v=y.find(O=>O.defaultFor===b),S=y.find(O=>O.isDefault||O.defaultFor==="global"),k=(v==null?void 0:v.id)||(S==null?void 0:S.id)||((E=y[0])==null?void 0:E.id)||"";k&&Ge.getState().setModel(k)}).catch(g=>{console.warn("[ExecutionModeStore] Failed to refresh models:",g)})},applyBackendMode:s=>{const r=t().mode;if(r===s)return;a(c=>({mode:s,prePlanMode:s!=="plan"?null:c.prePlanMode,modeHistory:[...c.modeHistory,{previousMode:r,newMode:s,description:`Backend mode changed: ${r} -> ${s}`,timestamp:Date.now()}]})),Ns.getState().setAutoMode(s!=="normal"&&ji(s));const l=++Do;Ie.models.list().then(c=>{var b,v;if(l!==Do||!c.success||!((b=c.data)!=null&&b.models))return;const u=c.data.models.filter(S=>S.enabled!==!1),d=An(Rd(s)),p=u.find(S=>S.defaultFor===d),g=u.find(S=>S.isDefault||S.defaultFor==="global"),y=(p==null?void 0:p.id)||(g==null?void 0:g.id)||((v=u[0])==null?void 0:v.id)||"";y&&Ge.getState().setModel(y)}).catch(c=>{console.warn("[ExecutionModeStore] Failed to refresh models after backend mode change:",c)})},toggleMode:()=>{const s=t().mode,r=s==="normal"?"act":Xk(s);t().setMode(r)},setBaseMode:s=>{const r=t().mode,l=r!=="normal"&&ji(r);t().setMode(gf(s,l))},setAuto:s=>{t().setMode(gf(An(Rd(t().mode)),s))},toggleAuto:()=>{const s=t().mode;t().setMode(s==="normal"?"auto-act":Qk(s))},enterPlanMode:(s,r)=>{const l=t().mode,c=l!=="normal"&&An(l)!=="plan"?l:t().prePlanMode,u=l!=="normal"&&An(l)==="goal"?"goal":"plan";a(d=>({mode:u,prePlanMode:c,modeHistory:[...d.modeHistory,{previousMode:l,newMode:u,description:`Enter ${u} mode: ${r}`,timestamp:Date.now()}]})),Ns.getState().setAutoMode(!1)},exitPlanMode:(s,r)=>{const l=t().mode,c=t().prePlanMode,u=c&&(c==="normal"||An(c)!=="plan")?c:"act";a(d=>({mode:u,prePlanMode:null,modeHistory:[...d.modeHistory,{previousMode:l,newMode:u,description:`Exit to ${u} mode: ${r}`,timestamp:Date.now()}]})),Ns.getState().setAutoMode(u!=="normal"&&ji(u))},enterGoalMode:(s,r)=>{const l=t().mode;a(c=>({mode:"goal",modeHistory:[...c.modeHistory,{previousMode:l,newMode:"goal",description:`Enter Goal mode: ${r}`,timestamp:Date.now()}]})),Ns.getState().setAutoMode(!1);try{const c=we.getState().activeSessionId||pe.getSessionId()||void 0;pe.send({type:"plan_mode_change",sessionId:c,data:JSON.stringify({previousMode:Wr(l),newMode:"goal",frontendMode:"goal",goalDescription:r,timestamp:Date.now()})})}catch(c){console.warn("[ExecutionModeStore] Failed to notify goal mode change via WS:",c)}},exitGoalMode:()=>{const s=t().mode;a(r=>({mode:"act",modeHistory:[...r.modeHistory,{previousMode:s,newMode:"act",description:"Exit Goal mode",timestamp:Date.now()}]})),Ns.getState().setAutoMode(!1)},setPlanContent:s=>a({currentPlanContent:s}),setThinkingStatus:(s,r)=>a(l=>({thinkingStatusBySession:{...l.thinkingStatusBySession,[s]:r}})),getThinkingStatus:s=>t().thinkingStatusBySession[s]||"",reset:()=>a({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null})}),{name:"deepseekcode-plan-storage",version:1,migrate:a=>a,merge:(a,t)=>{const s=a??{};return{...t,...s,mode:p1(s.mode)}},partialize:a=>({mode:a.mode,currentPlanContent:a.currentPlanContent,modeHistory:a.modeHistory})}));function Db(a){var t,s,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var l=a.length;for(t=0;t<l;t++)a[t]&&(s=Db(a[t]))&&(r&&(r+=" "),r+=s)}else for(s in a)a[s]&&(r&&(r+=" "),r+=s);return r}function h1(){for(var a,t,s=0,r="",l=arguments.length;s<l;s++)(a=arguments[s])&&(t=Db(a))&&(r&&(r+=" "),r+=t);return r}function mt(...a){return h1(a)}const Od=200,Sy=(a,t)=>({runId:t,sessionId:a,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,updatedAt:Date.now()}),$n=()=>Date.now(),Xn=(a,t)=>{const s=String(a||"").toLowerCase();return t||s==="done"||s==="success"||s==="completed"||s==="complete"?"completed":s==="running"||s==="in_progress"||s==="started"?"running":s==="failed"||s==="error"?"failed":s==="skipped"||s==="cancelled"||s==="canceled"?"skipped":"pending"},ky=a=>a.id||`${a.type||"event"}-${a.timestamp||$n()}-${Math.random().toString(36).slice(2,8)}`;function Md(a){if(!Array.isArray(a)||a.length===0)return{totalPhases:0,completedNodes:0};const t=a.length,s=a.filter(r=>r.status==="completed"||r.status==="skipped"||r.status==="failed").length;return{totalPhases:t,completedNodes:s}}const Ze=Bt()(da((a,t)=>({bySession:{},byRun:{},agentsBySession:{},tasksBySession:{},eventsBySession:{},plansBySession:{},upsert:(s,r)=>a(l=>{const c=r.runId,u=l.byRun[c]||l.bySession[s]||Sy(s,c),d={...u.agentNodes||{}};r.agentNode&&(d[r.agentNode.nodeId]=r.agentNode);const{agentNode:p,...g}=r,y={...u,...g,agentNodes:d,sessionId:s,runId:c,updatedAt:$n()},b={...l.agentsBySession[s]||{}};p&&(b[p.nodeId]={...b[p.nodeId]||{},id:p.nodeId,sessionId:s,name:p.role,role:p.role,source:"workflow",runId:c,phase:p.phase,status:p.status,tokens:p.tokens,error:p.error,updatedAt:p.updatedAt||$n()});const v=r.lastEventType||r.status||"workflow_update",k=[{id:ky({type:v}),sessionId:s,type:v,source:"workflow",timestamp:$n(),status:y.status,runId:c,agentId:p==null?void 0:p.nodeId,message:y.error,data:g},...l.eventsBySession[s]||[]].slice(0,Od);return{bySession:{...l.bySession,[s]:y},byRun:{...l.byRun,[c]:y},agentsBySession:{...l.agentsBySession,[s]:b},eventsBySession:{...l.eventsBySession,[s]:k}}}),fail:(s,r,l)=>t().upsert(s,{runId:r,status:"ERROR",error:l,lastEventType:"workflow_error"}),getForSession:s=>t().bySession[s],setPlan:(s,r)=>a(l=>({plansBySession:{...l.plansBySession,[s]:r}})),clearPlan:s=>a(r=>{if(!r.plansBySession[s])return{};const l={...r.plansBySession};return delete l[s],{plansBySession:l}}),getPlanForSession:s=>t().plansBySession[s],setNodes:(s,r,l)=>a(c=>{const u=c.byRun[r],d=u||c.bySession[s]||Sy(s,r),p=l.map(v=>{var S;return((S=d.nodes)==null?void 0:S.find(k=>k.id===v.id))||v}),{totalPhases:g,completedNodes:y}=Md(p),b={...d,runId:r,sessionId:s,nodes:p,totalPhases:g||d.totalPhases,completedPhases:u?y||d.completedPhases:y,updatedAt:$n()};return{bySession:{...c.bySession,[s]:b},byRun:{...c.byRun,[r]:b}}}),setNodeStatus:(s,r,l,c)=>a(u=>{const d=u.byRun[r],p=d||u.bySession[s];if(!p)return{};const g=(p.nodes||[]).map(S=>S.id===l?{...S,...c}:S),{totalPhases:y,completedNodes:b}=Md(g),v={...p,nodes:g,totalPhases:y||p.totalPhases,completedPhases:d?b||p.completedPhases:b,updatedAt:$n()};return{bySession:{...u.bySession,[s]:v},byRun:{...u.byRun,[r]:v}}}),finalizeNodes:(s,r,l)=>a(c=>{const u=c.byRun[r]||c.bySession[s];if(!u||!Array.isArray(u.nodes))return{};const d=u.nodes.map(b=>b.status==="pending"||b.status==="ready"||b.status==="blocked"?{...b,status:"skipped"}:b),{totalPhases:p,completedNodes:g}=Md(d),y={...u,nodes:d,completedPhases:g||u.completedPhases,totalPhases:p||u.totalPhases,updatedAt:$n()};return{bySession:{...c.bySession,[s]:y},byRun:{...c.byRun,[r]:y}}}),upsertAgent:(s,r)=>a(l=>{var d;const c=(d=l.agentsBySession[s])==null?void 0:d[r.id],u={id:r.id,sessionId:s,name:r.name||r.role||(c==null?void 0:c.name)||r.id,role:r.role||(c==null?void 0:c.role)||r.name||r.id,source:r.source||(c==null?void 0:c.source)||"agent",status:r.status||(c==null?void 0:c.status)||"idle",runId:r.runId??(c==null?void 0:c.runId),phase:r.phase??(c==null?void 0:c.phase),taskId:r.taskId??(c==null?void 0:c.taskId),currentTask:r.currentTask??(c==null?void 0:c.currentTask),tokens:r.tokens??(c==null?void 0:c.tokens),error:r.error??(c==null?void 0:c.error),updatedAt:r.updatedAt||$n()};return{agentsBySession:{...l.agentsBySession,[s]:{...l.agentsBySession[s]||{},[r.id]:u}}}}),upsertTask:(s,r)=>a(l=>{var g;const c=(g=l.tasksBySession[s])==null?void 0:g[r.id],u=$n(),d=r.status||(c==null?void 0:c.status)||"pending",p={id:r.id,sessionId:s,title:r.title||(c==null?void 0:c.title)||r.description||r.id,status:d,source:r.source||(c==null?void 0:c.source)||"task",description:r.description??(c==null?void 0:c.description),agentType:r.agentType??(c==null?void 0:c.agentType),progress:r.progress??(c==null?void 0:c.progress),result:r.result??(c==null?void 0:c.result),error:r.error??(c==null?void 0:c.error),runId:r.runId??(c==null?void 0:c.runId),dependencies:r.dependencies??(c==null?void 0:c.dependencies),startedAt:r.startedAt??(c==null?void 0:c.startedAt)??(d==="running"?u:void 0),completedAt:r.completedAt??(c==null?void 0:c.completedAt)??(d==="completed"||d==="failed"?u:void 0),createdAt:r.createdAt||(c==null?void 0:c.createdAt)||u,updatedAt:r.updatedAt||u,raw:r.raw??(c==null?void 0:c.raw)};return{tasksBySession:{...l.tasksBySession,[s]:{...l.tasksBySession[s]||{},[r.id]:p}}}}),setTasks:(s,r,l="plan")=>a(c=>{const u=c.tasksBySession[s]||{},d=Object.fromEntries(Object.entries(u).filter(([,y])=>y.source!==l)),p=$n(),g=Object.fromEntries(r.map((y,b)=>{const v=u[y.id],S=y.status||(v==null?void 0:v.status)||"pending",k={id:y.id,sessionId:s,title:y.title||(v==null?void 0:v.title)||y.description||`Task ${b+1}`,status:S,source:y.source||l,description:y.description??(v==null?void 0:v.description),agentType:y.agentType??(v==null?void 0:v.agentType),progress:y.progress??(v==null?void 0:v.progress),result:y.result??(v==null?void 0:v.result),error:y.error??(v==null?void 0:v.error),runId:y.runId??(v==null?void 0:v.runId),dependencies:y.dependencies??(v==null?void 0:v.dependencies),startedAt:y.startedAt??(v==null?void 0:v.startedAt),completedAt:y.completedAt??(v==null?void 0:v.completedAt),createdAt:y.createdAt||(v==null?void 0:v.createdAt)||p+b,updatedAt:y.updatedAt||p,raw:y.raw??(v==null?void 0:v.raw)};return[k.id,k]}));return{tasksBySession:{...c.tasksBySession,[s]:{...d,...g}}}}),recordEvent:(s,r)=>a(l=>{const c={id:ky(r),sessionId:s,type:r.type,source:r.source||"system",timestamp:r.timestamp||$n(),title:r.title,message:r.message,status:r.status,runId:r.runId,agentId:r.agentId,taskId:r.taskId,data:r.data};return{eventsBySession:{...l.eventsBySession,[s]:[c,...l.eventsBySession[s]||[]].slice(0,Od)}}}),getAgentsForSession:s=>Object.values(t().agentsBySession[s]||{}).sort((r,l)=>l.updatedAt-r.updatedAt),getTasksForSession:s=>Object.values(t().tasksBySession[s]||{}).sort((r,l)=>{const c={running:0,pending:1,failed:2,completed:3,skipped:4};return c[r.status]-c[l.status]||r.createdAt-l.createdAt}),getEventsForSession:s=>t().eventsBySession[s]||[],getAgentTree:s=>{const r=Object.values(t().agentsBySession[s]||{}),l=new Map(r.map(p=>[p.id,p])),c=r.filter(p=>!p.parentId||!l.has(p.parentId)),u=p=>r.filter(g=>g.parentId===p),d=p=>({agent:p,children:u(p.id).map(d),isRunning:p.status==="running",tokensUsed:p.tokens||0});return c.map(d)},getRunningAgentCount:s=>Object.values(t().agentsBySession[s]||{}).filter(l=>l.status==="running").length}),{name:"deepseekcode-workflow-store",storage:Lf({key:"workflowStore",trims:[a=>({...a,state:{...a.state,eventsBySession:Object.fromEntries(Object.entries(a.state.eventsBySession).map(([t,s])=>[t,s.slice(-50)])),tasksBySession:Object.fromEntries(Object.entries(a.state.tasksBySession).map(([t,s])=>[t,Object.fromEntries(Object.entries(s).map(([r,l])=>[r,{...l,result:l.result?String(l.result).slice(0,1e3):void 0,error:l.error?String(l.error).slice(0,1e3):void 0}]))]))}}),a=>({...a,state:{...a.state,eventsBySession:{}}}),a=>({...a,state:{...a.state,tasksBySession:{},agentsBySession:{}}})],onFailure:()=>{try{sa.getState().addToast("warning","任务看板数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失。",8e3)}catch{}}}),partialize:a=>({bySession:a.bySession,byRun:a.byRun,agentsBySession:a.agentsBySession,plansBySession:a.plansBySession,tasksBySession:Object.fromEntries(Object.entries(a.tasksBySession).map(([t,s])=>[t,Object.fromEntries(Object.entries(s).map(([r,l])=>{const{raw:c,...u}=l;return[r,u]}))])),eventsBySession:Object.fromEntries(Object.entries(a.eventsBySession).map(([t,s])=>[t,s.slice(-Od).map(r=>{const{data:l,...c}=r;return c})]))})}));var m1=f0();const g1=jf(m1);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 wy={},_y;function y1(){return _y||(_y=1,(function(a){a.languages.typescript=a.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/}),a.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 a.languages.typescript.parameter,delete a.languages.typescript["literal-property"];var t=a.languages.extend("typescript",{});delete t["class-name"],a.languages.typescript["class-name"].inside=t,a.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:t}}}}),a.languages.ts=a.languages.typescript})(Prism)),wy}y1();(function(a){var t=a.util.clone(a.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,l=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function c(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return l}),RegExp(p,g)}l=c(l).source,a.languages.jsx=a.languages.extend("markup",t),a.languages.jsx.tag.pattern=c(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),a.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,a.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,a.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,a.languages.jsx.tag.inside.comment=t.comment,a.languages.insertBefore("inside","attr-name",{spread:{pattern:c(/<SPREAD>/.source),inside:a.languages.jsx}},a.languages.jsx.tag),a.languages.insertBefore("inside","special-attr",{script:{pattern:c(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:a.languages.jsx}}},a.languages.jsx.tag);var u=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(u).join(""):""},d=function(p){for(var g=[],y=0;y<p.length;y++){var b=p[y],v=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===u(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:u(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:v=!0),(v||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var S=u(b);y<p.length-1&&(typeof p[y+1]=="string"||p[y+1].type==="plain-text")&&(S+=u(p[y+1]),p.splice(y+1,1)),y>0&&(typeof p[y-1]=="string"||p[y-1].type==="plain-text")&&(S=u(p[y-1])+S,p.splice(y-1,1),y--),p[y]=new a.Token("plain-text",S,null,S)}b.content&&typeof b.content!="string"&&d(b.content)}};a.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(Prism);(function(a){var t=a.util.clone(a.languages.typescript);a.languages.tsx=a.languages.extend("jsx",t),delete a.languages.tsx.parameter,delete a.languages.tsx["literal-property"];var s=a.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(Prism);(function(a){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;a.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.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\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,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:/[(){};:,]/},a.languages.css.atrule.inside.rest=a.languages.css;var s=a.languages.markup;s&&(s.tag.addInlined("style","css"),s.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(a){var t="\\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",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:s,environment:{pattern:RegExp("\\$"+t),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("(\\{)"+t),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})/};a.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;|&]|[<>]\\()"+t),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:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.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}},s.inside=a.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=r.variable[1].inside,u=0;u<l.length;u++)c[l[u]]=a.languages.bash[l[u]];a.languages.sh=a.languages.bash,a.languages.shell=a.languages.bash})(Prism);var Cy={},Ey;function b1(){return Ey||(Ey=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),Cy}b1();(function(a){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(y){return y=y.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+y+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;a.languages.markdown=a.languages.extend("markup",{}),a.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:a.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+c+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+c+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:a.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:a.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:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<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:s(/!?\[(?:(?!\])<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(y){["url","bold","italic","strike","code-snippet"].forEach(function(b){y!==b&&(a.languages.markdown[y].inside.content.inside[b]=a.languages.markdown[b])})}),a.hooks.add("after-tokenize",function(y){if(y.language!=="markdown"&&y.language!=="md")return;function b(v){if(!(!v||typeof v=="string"))for(var S=0,k=v.length;S<k;S++){var C=v[S];if(C.type!=="code"){b(C.content);continue}var E=C.content[1],O=C.content[3];if(E&&O&&E.type==="code-language"&&O.type==="code-block"&&typeof E.content=="string"){var j=E.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");j=(/[a-z][\w-]*/i.exec(j)||[""])[0].toLowerCase();var T="language-"+j;O.alias?typeof O.alias=="string"?O.alias=[O.alias,T]:O.alias.push(T):O.alias=[T]}}}b(y.tokens)}),a.hooks.add("wrap",function(y){if(y.type==="code-block"){for(var b="",v=0,S=y.classes.length;v<S;v++){var k=y.classes[v],C=/language-(.+)/.exec(k);if(C){b=C[1];break}}var E=a.languages[b];if(E)y.content=a.highlight(g(y.content),E,b);else if(b&&b!=="none"&&a.plugins.autoloader){var O="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);y.attributes.id=O,a.plugins.autoloader.loadLanguages(b,function(){var j=document.getElementById(O);j&&(j.innerHTML=a.highlight(j.textContent,a.languages[b],b))})}}});var u=RegExp(a.languages.markup.tag.pattern.source,"gi"),d={amp:"&",lt:"<",gt:">",quot:'"'},p=String.fromCodePoint||String.fromCharCode;function g(y){var b=y.replace(u,"");return b=b.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(v,S){if(S=S.toLowerCase(),S[0]==="#"){var k;return S[1]==="x"?k=parseInt(S.slice(2),16):k=Number(S.slice(1)),p(k)}else{var C=d[S];return C||v}}),b}a.languages.md=a.languages.markdown})(Prism);(function(a){var t=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+s.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+s.source+")?)",l=/(?:[^\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}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function u(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}a.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 r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+l+"|"+c+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:u(/\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:u(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:u(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:u(c),lookbehind:!0,greedy:!0},number:{pattern:u(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},a.languages.yml=a.languages.yaml})(Prism);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:/[;[\]()`,.]/};function Lb(a){window.dispatchEvent(new CustomEvent("preview-file",{detail:{path:a}}))}const x1={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function v1({language:a,code:t}){const[s,r]=_.useState(!1),l=_.useRef(null);_.useEffect(()=>{if(l.current)try{g1.highlightElement(l.current)}catch{}},[t,a]);const c=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(d){console.error("Failed to copy:",d)}},u=x1[a]||a.toUpperCase();return m.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[m.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[m.jsx("span",{className:"text-xs text-dark-muted font-mono",children:u}),m.jsx("button",{onClick:c,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:s?m.jsxs(m.Fragment,{children:[m.jsx(lb,{size:12,className:"text-accent-green"}),m.jsx("span",{className:"text-accent-green",children:"已复制"})]}):m.jsxs(m.Fragment,{children:[m.jsx(ob,{size:12}),m.jsx("span",{children:"复制"})]})})]}),m.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:m.jsx("code",{ref:l,className:`language-${a}`,children:t})})]})}const Ny=80;function S1({path:a,title:t}){const s=a.split(/[\\/]/).pop()||a;return m.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 mx-0.5 my-1 rounded-lg border border-dark-border bg-dark-surface px-2.5 py-1.5 text-left align-middle transition-colors hover:border-accent-blue/40 hover:bg-dark-hover",title:a,onClick:()=>Lb(a),children:[m.jsx("span",{className:"grid w-6 h-6 shrink-0 place-items-center rounded-md bg-accent-blue/10 text-accent-blue",children:m.jsx(Bi,{size:13})}),m.jsxs("span",{className:"min-w-0 flex flex-col leading-tight",children:[m.jsx("b",{className:"text-xs font-semibold text-dark-text truncate max-w-[14rem]",children:t||s}),t&&t!==s&&m.jsx("span",{className:"text-[10px] font-mono text-dark-muted truncate max-w-[14rem]",children:s})]}),m.jsx("span",{className:"ml-1 shrink-0 text-[11px] font-medium text-accent-blue",children:"打开 ›"})]})}function Ty(a){return typeof a=="string"&&a.startsWith("artifact:")}function k1(a){const t=a.slice(9);try{return decodeURIComponent(t)}catch{return t}}function Ay(a){return typeof a=="string"&&a.startsWith("dscfile:")}function w1(a){const t=a.slice(8);try{return decodeURIComponent(t)}catch{return t}}function _1(a){return a.replace(/%/g,"%25")}const C1=/((?:[A-Za-z]:[\\/])?[\w@.()[\]{}$%-]+(?:[\\/][\w@.()[\]{}$%-]+)+)/;function E1(a){if(a.length<3||a.length>400||/^[a-z][a-z0-9+.-]*:\/\//i.test(a)||/^www\./i.test(a)||/^\/\//.test(a))return!1;const t=a.split(/[\\/]/);if(t.length>=2&&t.every(l=>/^\d+$/.test(l)))return!1;const s=(t[t.length-1]||"").replace(/[.,;:!?)\]}]+$/g,"");return s?/^(?:[A-Za-z]:|~|\.{1,2})[\\/]/.test(a)||/\.[A-Za-z0-9]{1,12}$/.test(s):!1}function N1(a){const t=a.match(/^(.*?)([.,;:!?)\]}]+)$/);if(!t)return{path:a,tail:""};const s=t[1]??"",r=t[2]??"";if(r==="."){const l=s.split(/[\\/]/).pop()||"";if(!/\.[A-Za-z0-9]{1,12}$/.test(l))return{path:a,tail:""}}return{path:s,tail:r}}function T1({path:a}){return m.jsxs("button",{type:"button",onClick:()=>Lb(a),title:a,className:"inline-flex max-w-full items-center gap-1 align-baseline rounded px-1 font-mono text-[0.9em] text-accent-blue underline decoration-accent-blue/40 underline-offset-2 hover:bg-accent-blue/10 hover:decoration-accent-blue transition-colors cursor-pointer",children:[m.jsx(Bi,{size:10,className:"shrink-0"}),m.jsx("span",{className:"break-all",children:a})]})}function A1(){const a=new Set(["code","inlineCode","html","link","linkReference","image","imageReference"]);function t(r){const l=r.split(C1);if(l.length<=1)return[{type:"text",value:r}];const c=[];return l.forEach((u,d)=>{if(d%2===1){const{path:p,tail:g}=N1(u);if(p&&E1(p)){c.push({type:"link",url:`dscfile:${_1(p)}`,title:null,children:[{type:"text",value:p}]}),g&&c.push({type:"text",value:g});return}}c.push({type:"text",value:u})}),c}function s(r){if(!r||typeof r!="object"||a.has(r.type))return;const l=r.children;if(!Array.isArray(l))return;const c=[];for(const u of l)u&&u.type==="text"&&typeof u.value=="string"?c.push(...t(u.value)):(s(u),c.push(u));r.children=c}return function(l){s(l)}}const j1=[A1];function R1({content:a,className:t=""}){const[s,r]=_.useState(a),l=_.useRef(0),c=_.useRef(null),u=_.useRef(a);u.current=a,_.useEffect(()=>{if(a===s)return;const p=Date.now(),g=p-l.current;g>=Ny?(r(a),l.current=p):c.current||(c.current=setTimeout(()=>{c.current=null,r(u.current),l.current=Date.now()},Ny-g))},[a]),_.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const d=(s||"").replace(/\\n/g,`
|
|
28
|
-
`).replace(/\n{3,}/g,`
|
|
29
|
-
|
|
30
|
-
`);return m.jsx("div",{className:`markdown-content ${t}`,style:{wordBreak:"break-word"},children:m.jsx(p0,{remarkPlugins:j1,urlTransform:p=>Ty(p)||Ay(p)?p:h0(p),components:{code({className:p,children:g,...y}){const b=/language-(\w+)/.exec(p||""),v=String(g).replace(/\n$/,"");return b&&b[1]?m.jsx(v1,{language:b[1],code:v}):m.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...y,children:g})},a({href:p,children:g}){if(Ty(p)){const y=Array.isArray(g)?g.join(""):String(g??"");return m.jsx(S1,{path:k1(p),title:y})}return Ay(p)?m.jsx(T1,{path:w1(p)}):m.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:g})},table({children:p}){return m.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:m.jsx("table",{className:"w-full border-collapse border border-dark-border",children:p})})},th({children:p}){return m.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:p})},td({children:p}){return m.jsx("td",{className:"border border-dark-border px-3 py-2",children:p})},p({children:p}){return m.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:p})},blockquote({children:p}){return m.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:p})},h1({children:p}){return m.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:p})},h2({children:p}){return m.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:p})},h3({children:p}){return m.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:p})}},children:d})})}const Bd=Bt()(da(a=>({hidden:{},pinned:{},hide:t=>a(s=>({hidden:{...s.hidden,[t]:!0}})),show:t=>a(s=>{const r={...s.hidden};return delete r[t],{hidden:r}}),togglePin:t=>a(s=>{const r=!s.pinned[t],l={...s.hidden};return r&&delete l[t],{pinned:{...s.pinned,[t]:r},hidden:l}}),reset:()=>a({hidden:{},pinned:{}})}),{name:"deepseekcode-widget-store",storage:Lf({key:"widgetStore",trims:[]}),partialize:a=>({hidden:a.hidden,pinned:a.pinned})})),yl=_.memo(function({id:t,title:s,icon:r,action:l,children:c,defaultOpen:u=!0}){const d=Bd(v=>v.pinned[t]),p=Bd(v=>v.togglePin),g=Bd(v=>v.hide),[y,b]=_.useState(u);return m.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-surface overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1.5",children:[m.jsxs("button",{type:"button",onClick:()=>b(v=>!v),className:"flex-1 min-w-0 flex items-center gap-1.5 text-left transition-colors","aria-expanded":y,title:y?"折叠":"展开",children:[m.jsx(oa,{size:11,className:mt("text-dark-muted shrink-0 transition-transform duration-200",!y&&"-rotate-90")}),r,m.jsx("span",{className:"text-[11px] font-semibold text-dark-text truncate",children:s}),!d&&m.jsx("span",{className:"text-[8px] text-dark-muted/50 border border-dark-border rounded px-1 py-px shrink-0",children:"自动"})]}),l,m.jsx("button",{type:"button",onClick:()=>p(t),className:mt("p-1 rounded transition-colors shrink-0",d?"text-accent-blue":"text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover"),title:d?"取消固定":"固定(不自动收起)","aria-label":d?"取消固定":"固定",children:d?m.jsx(Qd,{size:11}):m.jsx(g0,{size:11})}),m.jsx("button",{type:"button",onClick:()=>g(t),className:"p-1 rounded text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover transition-colors shrink-0",title:"关闭此小组件","aria-label":"关闭此小组件",children:m.jsx(Ts,{size:11})})]}),y&&m.jsx("div",{className:"px-2.5 pb-2.5",children:c})]})}),O1=_.memo(function({sessionId:t}){const s=Ze(c=>t?c.getPlanForSession(t):void 0);if(!s||!s.confirm)return null;const r=s.nodes??[],l=c=>{Ze.getState().clearPlan(t),pe.send({type:"workflow_confirm",sessionId:t,data:JSON.stringify({planId:s.planId,action:c})})};return m.jsx(yl,{id:"plan-card",title:"AI 计划",icon:m.jsx(ub,{size:13,className:"text-accent-purple shrink-0"}),children:m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-dark-text",children:[m.jsx(Rn,{size:11,className:"animate-spin text-accent-blue shrink-0"}),m.jsx("span",{className:"truncate flex-1",children:s.title||"工作流计划"}),m.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:[r.length," 步"]})]}),r.length>0&&m.jsxs("ol",{className:"space-y-0.5",children:[r.slice(0,8).map((c,u)=>m.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] text-dark-muted",children:[m.jsx("span",{className:"w-4 h-4 rounded-full grid place-items-center bg-dark-border/60 text-dark-muted text-[9px] font-semibold shrink-0 mt-0.5",children:u+1}),m.jsx("span",{className:"min-w-0 flex-1 leading-snug break-words",children:c.title})]},c.id)),r.length>8&&m.jsxs("li",{className:"text-[10px] text-dark-muted/60 pl-6",children:["+",r.length-8," 步"]})]}),m.jsxs("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:[m.jsxs("button",{type:"button",onClick:()=>l("start"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-accent-blue/40 bg-accent-blue/10 text-[10px] text-accent-blue hover:bg-accent-blue/20 transition-colors",children:[m.jsx(cb,{size:10})," 开始执行"]}),m.jsxs("button",{type:"button",onClick:()=>l("change"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:"取消此方案,换个说法重新描述",children:[m.jsx(Rf,{size:10})," 更换流程"]}),m.jsxs("button",{type:"button",onClick:()=>l("cancel"),className:"flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:"取消工作流",children:[m.jsx(Ts,{size:10})," 取消"]})]})]})})}),M1=["RUNNING","RESUMING"];function B1(a){switch(a){case"running":return m.jsx(Rn,{size:12,className:"animate-spin text-accent-blue shrink-0"});case"completed":return m.jsx(ic,{size:12,className:"text-accent-green shrink-0"});case"failed":return m.jsx(ac,{size:12,className:"text-accent-red shrink-0"});case"skipped":return m.jsx(b0,{size:12,className:"text-dark-muted shrink-0"});case"blocked":return m.jsx(db,{size:12,className:"text-dark-muted shrink-0"});default:return m.jsx(Of,{size:12,className:"text-dark-muted/70 shrink-0"})}}function D1(a){switch(a){case"running":return"运行中";case"completed":return"完成";case"failed":return"失败";case"skipped":return"跳过";case"blocked":return"等待";default:return"待执行"}}const L1=_.memo(function({sessionId:t}){const s=Ze(y=>t?y.getForSession(t):void 0),r=s==null?void 0:s.nodes;if(!r||r.length===0)return null;const l=r.length,c=r.filter(y=>y.status==="completed"||y.status==="skipped"||y.status==="failed").length,u=r.filter(y=>y.status==="running").length,d=r.filter(y=>y.status==="failed").length,p=Math.round(c/l*100),g=M1.includes(String(s==null?void 0:s.status));return m.jsx(yl,{id:"workflow-strip",title:(s==null?void 0:s.title)||"工作流",icon:m.jsx(ub,{size:13,className:"text-accent-blue shrink-0"}),action:m.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0 px-1",children:[c,"/",l]}),children:m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:"flex-1 h-1.5 bg-dark-surface rounded-full overflow-hidden",children:m.jsx("div",{className:mt("h-full rounded-full transition-all duration-500",d>0?"bg-accent-red":u>0?"bg-accent-blue":"bg-accent-green"),style:{width:`${p}%`}})}),m.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:[p,"%"]})]}),m.jsx("ul",{className:"space-y-0.5",children:r.map(y=>m.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[m.jsx("span",{className:"mt-0.5 shrink-0",children:B1(y.status)}),m.jsxs("span",{className:mt("min-w-0 flex-1 text-[11px] leading-snug break-words",y.status==="completed"&&"text-dark-muted/70",y.status==="failed"&&"text-accent-red/90",y.status==="running"&&"text-dark-text font-medium",(y.status==="pending"||y.status==="ready")&&"text-dark-muted"),title:y.error||y.title,children:[y.title,m.jsx("span",{className:"ml-1 text-[8px] text-dark-muted/50 align-middle",children:D1(y.status)})]})]},y.id))}),(g||(s==null?void 0:s.status)==="PAUSED")&&m.jsx("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:m.jsx(z1,{sessionId:t,runId:s.runId,status:String(s==null?void 0:s.status)})})]})})});function z1({sessionId:a,runId:t,status:s}){const r=s==="PAUSED";return m.jsxs(m.Fragment,{children:[m.jsxs("button",{type:"button",onClick:()=>pe.send(r?{type:"workflow_resume",sessionId:a,runId:t}:{type:"workflow_pause",sessionId:a,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[r?m.jsx(cb,{size:10,className:"text-accent-green"}):m.jsx(db,{size:10,className:"text-accent-blue"}),r?"恢复":"暂停"]}),m.jsxs("button",{type:"button",onClick:()=>pe.send({type:"workflow_cancel",sessionId:a,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[m.jsx(y0,{size:9,className:"text-accent-red"}),"取消"]})]})}const U1=_.memo(function({sessionId:t}){return Ze(r=>t?r.getTasksForSession(t).length:0)===0?null:m.jsx(yl,{id:"task-board",title:"任务看板",icon:m.jsx(fb,{size:13,className:"text-accent-blue shrink-0"}),children:m.jsx(Vw,{sessionId:t})})}),$1=_.memo(function({messages:t,onPreview:s}){const{t:r}=gn(),l=_.useMemo(()=>Fb(t),[t]);return l.length===0?null:m.jsx(yl,{id:"artifacts",title:`${r("chat.sidebarArtifacts")} (${l.length})`,icon:m.jsx(pb,{size:13,className:"text-accent-blue shrink-0"}),action:m.jsx("button",{type:"button",onClick:()=>{const c=l[0];c&&s(c.path)},className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:r("chat.sidebarOpenFolder"),"aria-label":r("chat.sidebarOpenFolder"),children:m.jsx(x0,{size:12})}),children:m.jsx("div",{className:"space-y-0.5",children:l.map(c=>{const u=vf(c.path);return m.jsxs("button",{type:"button",onClick:()=>s(c.path),className:"w-full flex items-center gap-2 px-1.5 py-1.5 rounded-lg text-left transition-colors group hover:bg-dark-hover",title:c.path,children:[m.jsx("span",{className:mt("w-1.5 h-6 rounded-full shrink-0",c.source==="filejob"?"bg-accent-green":"bg-accent-blue")}),m.jsx(Gw,{kind:u,size:15}),m.jsxs("span",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"block text-xs text-dark-text truncate",children:c.name}),m.jsx("span",{className:"block text-[10px] font-mono text-dark-muted truncate",children:c.path})]}),m.jsx("span",{className:"shrink-0 text-[10.5px] font-medium text-dark-muted opacity-0 group-hover:opacity-100 transition-opacity",children:r("chat.sidebarOpen")})]},c.path)})})})}),H1=["Orchestrator","Explorer","Architect","Coder","Tester","Reviewer","Debug","Documenter","Evaluator"];function I1(a){return a==="running"||a==="scheduled"?m.jsx(Rn,{size:11,className:"animate-spin text-accent-blue shrink-0"}):a==="completed"?m.jsx(ic,{size:11,className:"text-accent-green shrink-0"}):a==="failed"?m.jsx(ac,{size:11,className:"text-accent-red shrink-0"}):m.jsx(Of,{size:11,className:"text-dark-muted shrink-0"})}const P1=a=>a==="running"||a==="scheduled"?"运行中":a==="completed"?"完成":a==="failed"?"失败":"空闲",jy=a=>a.toLowerCase(),F1=_.memo(function({sessionId:t}){const s=Ze(p=>t?p.getAgentsForSession(t):[]),r=Ze(p=>t?p.getEventsForSession(t).filter(g=>g.source==="agent"||g.source==="plan").slice(0,30):[]),[l,c]=_.useState(!1),u=_.useMemo(()=>{if(s.length===0)return[];const p=new Map(s.map(b=>[jy(b.name),b])),g=H1.map(b=>p.get(jy(b))).filter(Boolean),y=s.filter(b=>!g.some(v=>v.id===b.id));return[...g,...y]},[s]),d=u.filter(p=>p.status==="running"||p.status==="scheduled").length;return u.length===0?null:m.jsx(yl,{id:"agent-flow",title:"Agent",icon:m.jsx(v0,{size:13,className:"text-accent-purple shrink-0"}),action:d>0?m.jsx("span",{className:"w-1.5 h-1.5 bg-accent-blue rounded-full animate-pulse shrink-0"}):void 0,children:m.jsxs("div",{className:"space-y-1",children:[u.slice(0,8).map(p=>m.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[I1(p.status),m.jsxs("span",{className:mt("min-w-0 flex-1 text-[11px] leading-snug break-words",p.status==="running"||p.status==="scheduled"?"text-dark-text":"text-dark-muted"),children:[p.name,p.currentTask&&m.jsxs("span",{className:"text-dark-muted/70",children:[" · ",p.currentTask]})]}),m.jsx("span",{className:"text-[8px] text-dark-muted/50 shrink-0",children:P1(p.status)})]},p.id)),u.length>8&&m.jsxs("div",{className:"text-[10px] text-dark-muted text-center pt-0.5",children:["+",u.length-8," 个 Agent"]}),r.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{type:"button",onClick:()=>c(p=>!p),className:"w-full flex items-center gap-1 pt-1 text-[10px] text-dark-muted hover:text-dark-text transition-colors",children:[m.jsx(oa,{size:10,className:mt("transition-transform",l&&"rotate-180")}),"事件日志(",r.length,")"]}),l&&m.jsx("div",{className:"space-y-1 pt-1 max-h-32 overflow-y-auto custom-scrollbar",children:r.map(p=>m.jsxs("div",{className:"px-1.5 py-1 rounded border border-dark-border bg-dark-surface text-[9px] text-dark-muted",children:[m.jsx("span",{className:"font-medium text-dark-text",children:p.title||p.type}),p.message&&m.jsx("span",{className:"block text-dark-muted/80 truncate",children:p.message})]},p.id))})]})]})})}),G1=_.memo(function({sessionId:t,messages:s,onPreview:r}){return m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar",children:m.jsxs("div",{className:"p-2 space-y-2",children:[m.jsx(O1,{sessionId:t}),m.jsx(L1,{sessionId:t}),m.jsx(F1,{sessionId:t}),m.jsx(U1,{sessionId:t}),m.jsx($1,{messages:s,onPreview:r})]})})});function Ry(a,t){var s,r,l;return{artifactMatch:!!((s=t.artifact)!=null&&s.kind&&((r=a.artifactKinds)!=null&&r.includes(t.artifact.kind))),capabilityMatch:!!((l=t.requiredCapabilities)!=null&&l.includes(a.capability)),priority:a.priority??0}}function q1(a,t){return a.artifactMatch!==t.artifactMatch?a.artifactMatch?1:-1:a.capabilityMatch!==t.capabilityMatch?a.capabilityMatch?1:-1:a.priority-t.priority}function V1(a,t){const s=a.filter(c=>c.slots.includes(t.slotId));if(s.length===0)return;if(t.preferredComponentId){const c=s.find(u=>u.id===t.preferredComponentId);if(c)return c}let r=s[0],l=Ry(r,t);for(let c=1;c<s.length;c+=1){const u=Ry(s[c],t);q1(u,l)>0&&(r=s[c],l=u)}return r}const Dd=/^[a-z][a-z0-9._-]*$/;class Oa extends Error{}class W1{constructor(){He(this,"defs",new Map);He(this,"listeners",new Set);He(this,"versionCounter",0)}getVersion(){return this.versionCounter}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}register(t){return this.assertValid(t),this.defs.set(t.id,t),this.notify(),()=>this.unregister(t.id)}unregister(t){const s=this.defs.delete(t);return s&&this.notify(),s}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()].sort((s,r)=>(r.priority??0)-(s.priority??0))}listForSlot(t){return this.list().filter(s=>s.slots.includes(t))}resolve(t){return V1(this.list(),t)}capabilities(){return[...new Set(this.list().map(t=>t.capability))]}clear(){this.defs.size!==0&&(this.defs.clear(),this.notify())}get size(){return this.defs.size}notify(){this.versionCounter+=1;for(const t of[...this.listeners])try{t()}catch(s){console.error("[workspace] registry listener error:",s)}}assertValid(t){var s;if(!t||typeof t!="object")throw new Oa("[workspace] component def must be an object");if(!Dd.test(t.id))throw new Oa(`[workspace] invalid component id: ${JSON.stringify(t.id)} (expected ${Dd})`);if(this.defs.has(t.id))throw new Oa(`[workspace] duplicate component id: "${t.id}"`);if(!Dd.test(t.capability))throw new Oa(`[workspace] invalid capability id: ${JSON.stringify(t.capability)}`);if(!Array.isArray(t.slots)||t.slots.length===0||t.slots.some(r=>typeof r!="string"||r.length===0))throw new Oa(`[workspace] component "${t.id}" must declare at least one non-empty slot`);if(typeof t.component!="function"&&typeof((s=t.component)==null?void 0:s.render)!="function")throw new Oa(`[workspace] component "${t.id}" has no renderable component`);if(t.priority!==void 0&&(typeof t.priority!="number"||!Number.isFinite(t.priority)))throw new Oa(`[workspace] component "${t.id}" priority must be a finite number`)}}const Hf=new W1,Oy=32;function Ld(a){if(typeof a!="object"||a===null)return!1;const t=a;return t.type==="slot"||t.type==="split"||t.type==="stack"}function zb(a,t=0){if(!Ld(a))return["layout root must be a slot/split/stack node"];const s=[],r=(l,c,u)=>{if(u>Oy){s.push(`${c}: exceeds max nesting depth ${Oy}`);return}switch(l.type){case"slot":{(typeof l.id!="string"||l.id.length===0)&&s.push(`${c}: slot requires a non-empty id`);break}case"split":{l.direction!=="horizontal"&&l.direction!=="vertical"&&s.push(`${c}: split requires direction "horizontal"|"vertical"`),!Array.isArray(l.children)||l.children.length<2?s.push(`${c}: split requires at least 2 children`):l.sizes!==void 0&&(!Array.isArray(l.sizes)||l.sizes.length!==l.children.length?s.push(`${c}: split sizes must match children count`):l.sizes.some(d=>typeof d!="number"||!Number.isFinite(d)||d<=0)&&s.push(`${c}: split sizes must be positive finite numbers`)),Array.isArray(l.children)&&l.children.forEach((d,p)=>{Ld(d)?r(d,`${c}.children[${p}]`,u+1):s.push(`${c}.children[${p}]: invalid node`)});break}case"stack":{!Array.isArray(l.children)||l.children.length<1?s.push(`${c}: stack requires at least 1 child`):l.children.forEach((d,p)=>{Ld(d)?r(d,`${c}.children[${p}]`,u+1):s.push(`${c}.children[${p}]: invalid node`)});break}}};return r(a,"$",t),s}class K1{constructor(t={}){He(this,"listeners",new Map);He(this,"onError");this.onError=t.onError??((s,r)=>{console.error(`[workspace] EventBus handler error for "${String(r)}":`,s)})}on(t,s){let r=this.listeners.get(t);return r||(r=new Set,this.listeners.set(t,r)),r.add(s),()=>this.off(t,s)}once(t,s){const r=l=>{this.off(t,r),s(l)};return this.on(t,r)}off(t,s){const r=this.listeners.get(t);r&&(r.delete(s),r.size===0&&this.listeners.delete(t))}emit(t,s){const r=this.listeners.get(t);if(!(!r||r.size===0))for(const l of[...r])try{l(s)}catch(c){this.onError(c,String(t),l)}}listenerCount(t){var r;if(t!==void 0)return((r=this.listeners.get(t))==null?void 0:r.size)??0;let s=0;for(const l of this.listeners.values())s+=l.size;return s}clear(){this.listeners.clear()}}const Y1=/^[a-z][a-z0-9._-]*$/;function zd(a){return typeof a=="string"&&Y1.test(a)}const Lo="";let My=0;function Z1(a="cmd"){const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return My+=1,`${a}-${My}-${t}`}const Q1=1e4;class X1{constructor(t={}){He(this,"handlers",new Map);He(this,"capabilityToCommand",new Map);He(this,"pending",new Map);He(this,"defaultTimeoutMs");He(this,"onError");this.defaultTimeoutMs=t.defaultTimeoutMs??Q1,this.onError=t.onError??((s,r)=>{console.error(`[workspace] CommandBus handler error for "${r}":`,s)})}register(t,s,r={}){if(!zd(t))throw new Error(`[workspace] invalid command id: ${JSON.stringify(t)}`);const l=r.scope??Lo;if(l!==Lo&&!zd(l))throw new Error(`[workspace] invalid command scope: ${JSON.stringify(l)}`);let c=this.handlers.get(t);if(c||(c=new Map,this.handlers.set(t,c)),c.has(l))throw new Error(`[workspace] duplicate command handler: "${t}"${l?` (scope: ${l})`:""}`);if(r.capability!==void 0){if(!zd(r.capability))throw new Error(`[workspace] invalid capability id: ${JSON.stringify(r.capability)}`);if(this.capabilityToCommand.has(r.capability))throw new Error(`[workspace] duplicate capability mapping: "${r.capability}"`);this.capabilityToCommand.set(r.capability,t)}c.set(l,s);let u=!1;return()=>{if(u)return;u=!0;const d=this.handlers.get(t);d&&(d.delete(l),d.size===0&&this.handlers.delete(t)),r.capability!==void 0&&this.capabilityToCommand.delete(r.capability)}}has(t){return this.handlers.has(t)}listCommands(){return[...this.handlers.keys()]}resolveCapability(t){return this.capabilityToCommand.get(t)}capabilities(){return[...this.capabilityToCommand.entries()].map(([t,s])=>({capability:t,command:s}))}async execute(t,s,r={}){const l=r.requestId??Z1(),c=this.resolveHandler(t,r.scope);if(!c)return{success:!1,requestId:l,command:t,error:`unknown command: "${t}"`,durationMs:0};const u=r.timeoutMs??this.defaultTimeoutMs,d=Date.now(),p=`command "${t}" timed out after ${u}ms`;return await new Promise(g=>{const y=setTimeout(()=>{this.pending.delete(l),g({success:!1,requestId:l,command:t,error:p,durationMs:Date.now()-d})},u);this.pending.set(l,{resolve:g,timer:y,startedAt:d,command:t}),Promise.resolve().then(()=>c(s,{requestId:l,command:t})).then(b=>{this.settle(l,{success:!0,requestId:l,command:t,result:b,durationMs:Date.now()-d})},b=>{this.onError(b,t),this.settle(l,{success:!1,requestId:l,command:t,error:b instanceof Error?b.message:String(b),durationMs:Date.now()-d})})})}handle(t){return this.execute(t.command,t.payload,{timeoutMs:t.timeoutMs,requestId:t.id,scope:t.scope})}resolveHandler(t,s){const r=this.handlers.get(t);if(r){if(s&&s!==Lo){const l=r.get(s);if(l)return l}return r.get(Lo)}}cancel(t,s="cancelled"){const r=this.pending.get(t);return r?(this.pending.delete(t),r.timer&&clearTimeout(r.timer),r.resolve({success:!1,requestId:t,command:r.command,error:s,durationMs:Date.now()-r.startedAt}),!0):!1}pendingCount(){return this.pending.size}settle(t,s){const r=this.pending.get(t);r&&(this.pending.delete(t),r.timer&&clearTimeout(r.timer),r.resolve(s))}}const J1=/^[a-zA-Z]:[\\/]/,ew=/\0/;function tw(a){if(typeof a!="string"||a.length===0||ew.test(a)||J1.test(a)||a.startsWith("/")||a.startsWith("\\"))return!1;const t=a.replace(/\\/g,"/").split("/");let s=0;for(const r of t)if(!(r===""||r==="."))if(r===".."){if(s-=1,s<0)return!1}else s+=1;return!0}function By(a,t=""){if(!tw(a))throw new Error(`[workspace] unsafe path rejected: ${JSON.stringify(a)}`);const s=a.replace(/\\/g,"/").split("/"),r=[];for(const u of s)u===""||u==="."||(u===".."?r.pop():r.push(u));const l=r.join("/");return t?`${t.replace(/[\\/]+$/,"")}/${l}`:l}class nw{diff(t,s,r={}){let l;typeof r=="function"?(l=r,r={}):"callback"in r&&(l=r.callback);const c=this.castInput(t,r),u=this.castInput(s,r),d=this.removeEmpty(this.tokenize(c,r)),p=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(d,p,r,l)}diffWithOptionsObj(t,s,r,l){var c;const u=j=>{if(j=this.postProcess(j,r),l){setTimeout(function(){l(j)},0);return}else return j},d=s.length,p=t.length;let g=1,y=d+p;r.maxEditLength!=null&&(y=Math.min(y,r.maxEditLength));const b=(c=r.timeout)!==null&&c!==void 0?c:1/0,v=Date.now()+b,S=[{oldPos:-1,lastComponent:void 0}];let k=this.extractCommon(S[0],s,t,0,r);if(S[0].oldPos+1>=p&&k+1>=d)return u(this.buildValues(S[0].lastComponent,s,t));let C=-1/0,E=1/0;const O=()=>{for(let j=Math.max(C,-g);j<=Math.min(E,g);j+=2){let T;const z=S[j-1],R=S[j+1];z&&(S[j-1]=void 0);let Z=!1;if(R){const te=R.oldPos-j;Z=R&&0<=te&&te<d}const Q=z&&z.oldPos+1<p;if(!Z&&!Q){S[j]=void 0;continue}if(!Q||Z&&z.oldPos<R.oldPos?T=this.addToPath(R,!0,!1,0,r):T=this.addToPath(z,!1,!0,1,r),k=this.extractCommon(T,s,t,j,r),T.oldPos+1>=p&&k+1>=d)return u(this.buildValues(T.lastComponent,s,t))||!0;S[j]=T,T.oldPos+1>=p&&(E=Math.min(E,j-1)),k+1>=d&&(C=Math.max(C,j+1))}g++};if(l)(function j(){setTimeout(function(){if(g>y||Date.now()>v)return l(void 0);O()||j()},0)})();else for(;g<=y&&Date.now()<=v;){const j=O();if(j)return j}}addToPath(t,s,r,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===s&&u.removed===r?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:s,removed:r,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:s,removed:r,previousComponent:u}}}extractCommon(t,s,r,l,c){const u=s.length,d=r.length;let p=t.oldPos,g=p-l,y=0;for(;g+1<u&&p+1<d&&this.equals(r[p+1],s[g+1],c);)g++,p++,y++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return y&&!c.oneChangePerToken&&(t.lastComponent={count:y,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=p,g}equals(t,s,r){return r.comparator?r.comparator(t,s):t===s||!!r.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let r=0;r<t.length;r++)t[r]&&s.push(t[r]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,r){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let d=0,p=0,g=0;for(;d<u;d++){const y=l[d];if(y.removed)y.value=this.join(r.slice(g,g+y.count)),g+=y.count;else{if(!y.added&&this.useLongestToken){let b=s.slice(p,p+y.count);b=b.map(function(v,S){const k=r[g+S];return k.length>v.length?k:v}),y.value=this.join(b)}else y.value=this.join(s.slice(p,p+y.count));p+=y.count,y.added||(g+=y.count)}}return l}}class sw extends nw{constructor(){super(...arguments),this.tokenize=iw}equals(t,s,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
31
|
-
`))&&(t=t.trim()),(!r.newlineIsToken||!s.includes(`
|
|
32
|
-
`))&&(s=s.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
33
|
-
`)&&(t=t.slice(0,-1)),s.endsWith(`
|
|
34
|
-
`)&&(s=s.slice(0,-1))),super.equals(t,s,r)}}const aw=new sw;function yf(a,t,s){return aw.diff(a,t,s)}function iw(a,t){t.stripTrailingCr&&(a=a.replace(/\r\n/g,`
|
|
35
|
-
`));const s=[],r=a.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let l=0;l<r.length;l++){const c=r[l];l%2&&!t.newlineIsToken?s[s.length-1]+=c:s.push(c)}return s}function rw(a){for(let t=0;t<a.length;t++)if(a[t]<" "||a[t]>"~"||a[t]==='"'||a[t]==="\\")return!0;return!1}function ta(a){if(!rw(a))return a;let t='"';const s=new TextEncoder().encode(a);let r=0;for(;r<s.length;){const l=s[r];l===7?t+="\\a":l===8?t+="\\b":l===9?t+="\\t":l===10?t+="\\n":l===11?t+="\\v":l===12?t+="\\f":l===13?t+="\\r":l===34?t+='\\"':l===92?t+="\\\\":l>=32&&l<=126?t+=String.fromCharCode(l):t+="\\"+l.toString(8).padStart(3,"0"),r++}return t+='"',t}const Dy={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function lw(a,t,s,r,l,c,u){let d;d={},typeof d.context>"u"&&(d.context=4);const p=d.context;if(d.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(d.callback){const{callback:y}=d;yf(s,r,Object.assign(Object.assign({},d),{callback:b=>{const v=g(b);y(v)}}))}else return g(yf(s,r,d));function g(y){if(!y)return;y.push({value:"",lines:[]});function b(j){return j.map(function(T){return" "+T})}const v=[];let S=0,k=0,C=[],E=1,O=1;for(let j=0;j<y.length;j++){const T=y[j],z=T.lines||ow(T.value);if(T.lines=z,T.added||T.removed){if(!S){const R=y[j-1];S=E,k=O,R&&(C=p>0?b(R.lines.slice(-p)):[],S-=C.length,k-=C.length)}for(const R of z)C.push((T.added?"+":"-")+R);T.added?O+=z.length:E+=z.length}else{if(S)if(z.length<=p*2&&j<y.length-2)for(const R of b(z))C.push(R);else{const R=Math.min(z.length,p);for(const Q of b(z.slice(0,R)))C.push(Q);const Z={oldStart:S,oldLines:E-S+R,newStart:k,newLines:O-k+R,lines:C};v.push(Z),S=0,k=0,C=[]}E+=z.length,O+=z.length}}for(const j of v)for(let T=0;T<j.lines.length;T++)j.lines[T].endsWith(`
|
|
36
|
-
`)?j.lines[T]=j.lines[T].slice(0,-1):(j.lines.splice(T+1,0,"\"),T++);return{oldFileName:a,newFileName:t,oldHeader:l,newHeader:c,hunks:v}}}function Ub(a,t){var s,r,l,c,u,d;if(t||(t=Dy),Array.isArray(a)){if(a.length>1&&!t.includeFileHeaders&&!a.every(y=>y.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return a.map(y=>Ub(y,t)).join(`
|
|
37
|
-
`)}const p=[];if(a.isGit){if(t=Dy,!a.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!a.newFileName)throw new Error("newFileName must be specified for Git patches");let y=a.oldFileName,b=a.newFileName;a.isCreate&&y==="/dev/null"?y=b.replace(/^b\//,"a/"):a.isDelete&&b==="/dev/null"&&(b=y.replace(/^a\//,"b/")),p.push("diff --git "+ta(y)+" "+ta(b)),a.isDelete&&p.push("deleted file mode "+((s=a.oldMode)!==null&&s!==void 0?s:"100644")),a.isCreate&&p.push("new file mode "+((r=a.newMode)!==null&&r!==void 0?r:"100644")),a.oldMode&&a.newMode&&!a.isDelete&&!a.isCreate&&(p.push("old mode "+a.oldMode),p.push("new mode "+a.newMode)),a.isRename&&(p.push("rename from "+ta(((l=a.oldFileName)!==null&&l!==void 0?l:"").replace(/^a\//,""))),p.push("rename to "+ta(((c=a.newFileName)!==null&&c!==void 0?c:"").replace(/^b\//,"")))),a.isCopy&&(p.push("copy from "+ta(((u=a.oldFileName)!==null&&u!==void 0?u:"").replace(/^a\//,""))),p.push("copy to "+ta(((d=a.newFileName)!==null&&d!==void 0?d:"").replace(/^b\//,""))))}else t.includeIndex&&a.oldFileName==a.newFileName&&a.oldFileName!==void 0&&p.push("Index: "+a.oldFileName),t.includeUnderline&&p.push("===================================================================");const g=a.hunks.length>0;t.includeFileHeaders&&a.oldFileName!==void 0&&a.newFileName!==void 0&&(!a.isGit||g)&&(p.push("--- "+ta(a.oldFileName)+(a.oldHeader?" "+a.oldHeader:"")),p.push("+++ "+ta(a.newFileName)+(a.newHeader?" "+a.newHeader:"")));for(let y=0;y<a.hunks.length;y++){const b=a.hunks[y],v=b.oldLines===0?b.oldStart-1:b.oldStart,S=b.newLines===0?b.newStart-1:b.newStart;p.push("@@ -"+v+","+b.oldLines+" +"+S+","+b.newLines+" @@");for(const k of b.lines)p.push(k)}return p.join(`
|
|
38
|
-
`)+`
|
|
39
|
-
`}function Ud(a,t,s,r,l,c,u){{const d=lw(a,t,s,r,l,c);return d?Ub(d,void 0):void 0}}function ow(a){const t=a.endsWith(`
|
|
40
|
-
`),s=a.split(`
|
|
41
|
-
`).map(r=>r+`
|
|
42
|
-
`);return t?s.pop():s.push(s.pop().slice(0,-1)),s}function cw(a,t){const s=a?new Map(a.files.map(d=>[d.path,d.content])):new Map,r=new Map(t.files.map(d=>[d.path,d.content])),c=[...new Set([...s.keys(),...r.keys()])].sort().map(d=>{const p=s.get(d)??"",g=r.get(d)??"",y=s.has(d),b=r.has(d);if(!y&&b){const C=g.length===0?0:(g.match(/\n/g)??[]).length;return{path:d,change:"added",addedLines:C,removedLines:0,patch:Ud(d,d,"",g)}}if(y&&!b){const C=p.length===0?0:(p.match(/\n/g)??[]).length;return{path:d,change:"removed",addedLines:0,removedLines:C,patch:Ud(d,d,p,"")}}if(p===g)return{path:d,change:"unchanged",addedLines:0,removedLines:0};const v=yf(p,g);let S=0,k=0;for(const C of v){const E=(C.value.match(/\n/g)??[]).length;C.added?S+=E:C.removed&&(k+=E)}return{path:d,change:"modified",addedLines:S,removedLines:k,patch:Ud(d,d,p,g)}}),u=c.filter(d=>d.change!=="unchanged");return{fromId:(a==null?void 0:a.id)??null,toId:t.id,files:c,totalAdded:u.reduce((d,p)=>d+p.addedLines,0),totalRemoved:u.reduce((d,p)=>d+p.removedLines,0),changedFileCount:u.length}}const $b=_.createContext(null);function If(){const a=_.useContext($b);if(!a)throw new Error("[workspace] useArtifactContext must be used inside <ArtifactProvider>");return a}let Ly=0;function uw(){return Ly+=1,`v${Ly}-${Date.now().toString(36)}`}function dw({children:a,initial:t,versionStore:s}){const[r,l]=_.useState((t==null?void 0:t.artifactId)??null),[c,u]=_.useState((t==null?void 0:t.kind)??"unknown"),[d,p]=_.useState((t==null?void 0:t.files)??{}),[g,y]=_.useState((t==null?void 0:t.versions)??[]),[b,v]=_.useState((t==null?void 0:t.previewUrl)??null),S=_.useCallback((T,z)=>{const R=By(T);p(Z=>({...Z,[R]:z}))},[]),k=_.useCallback(T=>{const z=By(T);p(R=>{if(!(z in R))return R;const Z={...R};return delete Z[z],Z})},[]),C=_.useCallback(T=>{if(Object.keys(d).length===0)return null;const z={id:uw(),createdAt:Date.now(),files:Object.entries(d).map(([R,Z])=>({path:R,content:Z})),message:T};return y(R=>[...R,z]),s&&r&&s.persistVersion(r,z).then(R=>{R.ok||console.warn("[workspace] failed to persist version snapshot",R.error)}),z},[d,r,s]),E=_.useCallback(T=>{const z=g.find(R=>R.id===T);return z?(p(Object.fromEntries(z.files.map(R=>[R.path,R.content]))),!0):!1},[g]),O=_.useCallback((T,z)=>{const R=g.find(Q=>Q.id===z);if(!R)return null;const Z=T===null?null:g.find(Q=>Q.id===T)??null;return cw(Z,R)},[g]),j=_.useMemo(()=>({artifactId:r,kind:c,files:d,versions:g,previewUrl:b,setArtifactId:l,setKind:u,saveFile:S,deleteFile:k,addVersion:C,restoreVersion:E,diffVersions:O,setPreviewUrl:v}),[r,c,d,g,b,S,k,C,E,O]);return m.jsx($b.Provider,{value:j,children:a})}const Ci=Bt()(a=>({layout:null,device:"desktop",activeSlot:null,setLayout:t=>a({layout:t}),setDevice:t=>a({device:t}),setActiveSlot:t=>a({activeSlot:t})})),Hb=_.createContext(null);function fw(){const a=_.useContext(Hb);if(!a)throw new Error("[workspace] useViewContext must be used inside <ViewProvider>");return a}function pw({children:a,layout:t,syncOnMount:s=!0}){const r=Ci(y=>y.layout),l=Ci(y=>y.device),c=Ci(y=>y.activeSlot),u=Ci(y=>y.setLayout),d=Ci(y=>y.setDevice),p=Ci(y=>y.setActiveSlot);_.useEffect(()=>{s&&t!==void 0&&t!==r&&u(t)},[]);const g=_.useMemo(()=>({layout:t??r,device:l,activeSlot:c,setLayout:u,setDevice:d,setActiveSlot:p}),[t,r,l,c,u,d,p]);return m.jsx(Hb.Provider,{value:g,children:a})}const Ib=_.createContext(null);function hw(){const a=_.useContext(Ib);if(!a)throw new Error("[workspace] useSessionContext must be used inside <SessionProvider>");return a}function mw({children:a,initial:t}){const[s,r]=_.useState((t==null?void 0:t.conversationId)??null),[l,c]=_.useState((t==null?void 0:t.task)??""),[u,d]=_.useState((t==null?void 0:t.toolCalls)??[]),p=_.useCallback(b=>{d(v=>[...v,b])},[]),g=_.useCallback((b,v)=>{d(S=>S.map(k=>k.id===b?{...k,...v}:k))},[]),y=_.useMemo(()=>({conversationId:s,task:l,toolCalls:u,setConversationId:r,setTask:c,appendToolCall:p,updateToolCall:g}),[s,l,u,p,g]);return m.jsx(Ib.Provider,{value:y,children:a})}class gw{constructor(){He(this,"providers",new Map)}register(t,s,r){if(this.providers.has(t))throw new Error(`[workspace] duplicate context provider: "${t}"`);return this.providers.set(t,{provider:s,value:r}),()=>this.unregister(t)}unregister(t){return this.providers.delete(t)}get(t){var s;return(s=this.providers.get(t))==null?void 0:s.provider}valueOf(t){var s;return(s=this.providers.get(t))==null?void 0:s.value}entries(){return[...this.providers.entries()].map(([t,s])=>[t,s.provider,s.value])}clear(){this.providers.clear()}}const yw=new gw,Pb=_.createContext(null);function bw(){const a=_.useContext(Pb);if(!a)throw new Error("[workspace] useWorkspace must be used inside <WorkspaceProvider>");return a}function xw({children:a,registry:t=Hf,layout:s,artifact:r,session:l,mountExtraContexts:c=!0}){const u=_.useRef(null);u.current===null&&(u.current={registry:t,eventBus:new K1,commandBus:new X1,registryVersion:0});const[d,p]=_.useState(0);_.useEffect(()=>t.onChange(()=>p(v=>v+1)),[t]);const g=_.useMemo(()=>({...u.current,registryVersion:d}),[d]),y=_.useMemo(()=>c?yw.entries():[],[c]);let b=a;for(const[v,S,k]of y)b=m.jsx(S,{value:k,children:b},v);return m.jsx(Pb.Provider,{value:g,children:m.jsx(dw,{initial:r,children:m.jsx(pw,{layout:s,children:m.jsx(mw,{initial:l,children:b})})})})}function cc(){const a=bw(),t=If(),s=fw(),r=hw();return _.useMemo(()=>({...a,artifact:t,view:s,session:r}),[a,t,s,r])}function vw({label:a}){return m.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-slot-loading",children:a?`Loading ${a}…`:"Loading…"})}function Sw({slotId:a}){return m.jsxs("div",{className:"flex h-full w-full items-center justify-center border border-dashed border-dark-border text-xs text-dark-muted","data-testid":`workspace-empty-slot-${a}`,children:["No component for slot “",a,"”"]})}function uc({message:a}){return m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-red-950/30 p-3 text-xs text-red-300","data-testid":"workspace-slot-error",children:a})}class kw extends _.Component{constructor(){super(...arguments);He(this,"state",{error:null})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error("[workspace] slot component crashed:",s,r.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):uc({message:this.state.error.message}):this.props.children}}function ww({slotId:a,componentId:t,requiredCapabilities:s,preferredComponentId:r}){const{registry:l,artifact:c}=cc(),u=(t?l.get(t):void 0)??l.resolve({slotId:a,artifact:c.artifactId?{kind:c.kind}:null,requiredCapabilities:s,preferredComponentId:r});return m.jsx(_w,{slotId:a,def:u})}function _w({slotId:a,def:t}){const{eventBus:s,commandBus:r,artifact:l}=cc(),c=t==null?void 0:t.component;return _.useEffect(()=>{var u;if((u=t==null?void 0:t.lifecycle)!=null&&u.mount)return t.lifecycle.mount({artifactId:l.artifactId??void 0,eventBus:s,commandBus:r}),()=>{var d,p;return(p=(d=t.lifecycle)==null?void 0:d.unmount)==null?void 0:p.call(d,{artifactId:l.artifactId??void 0,eventBus:s,commandBus:r})}},[t,s,r,l.artifactId]),!t||!c?m.jsx(Sw,{slotId:a}):m.jsx(kw,{children:m.jsx(_.Suspense,{fallback:m.jsx(vw,{label:t.id}),children:m.jsx(c,{slotId:a,defId:t.id})})})}function Cw({layout:a}){if(!a)return m.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-empty",children:"Workspace is empty — no layout configured"});const t=zb(a);return t.length>0?m.jsx(uc,{message:`Invalid workspace layout: ${t.join("; ")}`}):m.jsx(bf,{node:a})}function bf({node:a}){switch(a.type){case"slot":return m.jsx(ww,{slotId:a.id,componentId:a.componentId});case"split":return m.jsxs(bb,{direction:a.direction==="horizontal"?"horizontal":"vertical",className:"h-full w-full overflow-hidden",children:[a.children.map((t,s)=>{var r;return m.jsx(Jd,{defaultSize:((r=a.sizes)==null?void 0:r[s])??50,className:"min-h-0 min-w-0",children:m.jsx(bf,{node:t})},s)}),a.children.slice(0,-1).map((t,s)=>m.jsx(xb,{className:"w-px bg-dark-border transition-colors hover:bg-accent-blue data-[resize-handle-state=hover]:bg-accent-blue data-[resize-handle-state=drag]:bg-accent-blue"},`h-${s}`))]});case"stack":return m.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden",children:a.children.map((t,s)=>m.jsx("div",{className:"min-h-0 min-w-0 flex-1 border-b border-dark-border last:border-b-0",children:m.jsx(bf,{node:t})},s))});default:return m.jsx(uc,{message:`Unknown layout node: ${JSON.stringify(a)}`})}}const Ew="1",Nw=["ready","select","inspect","screenshot","highlight","command","event"];function Tw(a){return typeof a=="string"&&Nw.includes(a)}function Aw(a){if(typeof a!="object"||a===null||Array.isArray(a))return{ok:!1,error:"workspace message must be a plain object"};const t=a;return t.version!==Ew?{ok:!1,error:`unsupported workspace protocol version: ${JSON.stringify(t.version)}`}:Tw(t.type)?typeof t.requestId!="string"||t.requestId.length===0?{ok:!1,error:"workspace message requires a non-empty requestId"}:{ok:!0,data:{version:t.version,type:t.type,requestId:t.requestId,payload:t.payload}}:{ok:!1,error:`unknown workspace message type: ${JSON.stringify(t.type)}`}}function jw({layout:a=null,registry:t=Hf,artifact:s,session:r,onRegister:l,toolbar:c,statusBar:u,onLayoutError:d}){_.useEffect(()=>{if(l)return l(t)},[]);const p=a?zb(a):[];return p.length>0?(d==null||d(p),m.jsx("div",{className:"flex h-full w-full flex-col bg-dark-surface","data-testid":"workspace-runtime",children:m.jsx(uc,{message:`Invalid workspace layout: ${p.join("; ")}`})})):m.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-dark-surface","data-testid":"workspace-runtime",children:m.jsxs(xw,{registry:t,layout:a,artifact:s,session:r,children:[c&&m.jsx("div",{className:"shrink-0 border-b border-dark-border",children:c}),m.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:m.jsx(Cw,{layout:a})}),u&&m.jsx("div",{className:"shrink-0 border-t border-dark-border",children:u})]})})}const il="demo.ping",xf="demo.pong",Rw=`<!doctype html>
|
|
43
|
-
<html>
|
|
44
|
-
<head><meta charset="utf-8"><title>Demo Artifact</title></head>
|
|
45
|
-
<body style="font-family:system-ui;padding:24px;background:#0f172a;color:#e2e8f0">
|
|
46
|
-
<h2>AI 生成的工作台工件</h2>
|
|
47
|
-
<p>这个页面运行在 <code>sandbox="allow-scripts allow-forms allow-modals"</code> 的 iframe 中。</p>
|
|
48
|
-
<button id="say" onclick="parent.postMessage({version:'1',type:'event',requestId:'demo-1',payload:{event:'preview.interaction',data:{clicked:true}}},'*')">点击向宿主发送事件</button>
|
|
49
|
-
<script>document.getElementById('say').textContent='✓ 已就绪(blob: opaque origin)'<\/script>
|
|
50
|
-
</body>
|
|
51
|
-
</html>`;function zy({slotId:a,defId:t}){const{eventBus:s,commandBus:r}=cc(),l=If(),[c,u]=_.useState(0),[d,p]=_.useState(null);return _.useEffect(()=>{const g=s.on(il,()=>u(v=>v+1));let y;t==="panel-b"&&(y=r.register(xf,()=>(p(new Date().toISOString()),{pong:!0,slotId:a})));let b;return t==="panel-a"&&(b=setTimeout(()=>s.emit(il,{from:t}),0)),()=>{g(),y==null||y(),b&&clearTimeout(b)}},[s,r,t,a]),m.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-3","data-testid":`test-panel-${t}`,children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-xs font-semibold text-dark-text",children:t}),m.jsxs("span",{className:"text-[10px] text-dark-muted",children:["slot: ",a]})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[m.jsx("span",{"data-testid":`ping-count-${t}`,children:c}),m.jsx("button",{type:"button",onClick:()=>s.emit(il,{from:t}),className:"rounded bg-accent-blue/10 px-2 py-0.5 text-accent-blue hover:bg-accent-blue/20",children:"emit ping"}),t==="panel-b"&&m.jsx("button",{type:"button",onClick:()=>{const g=URL.createObjectURL(new Blob([Rw],{type:"text/html"}));l.setArtifactId("demo/index.html"),l.setKind("web"),l.setPreviewUrl(g)},className:"rounded bg-accent-green/10 px-2 py-0.5 text-accent-green hover:bg-accent-green/20","data-testid":"demo-preview-button",children:"preview demo"})]}),d&&m.jsxs("div",{className:"text-[10px] text-emerald-400","data-testid":`pong-${t}`,children:["pong @ ",d]})]})}function Ow(a=Hf){const t=a.register({id:"panel-a",capability:"demo.panel.a",component:zy,slots:["left"],priority:10,metadata:{label:"Panel A"},lifecycle:{mount:()=>{},unmount:()=>{}}}),s=a.register({id:"panel-b",capability:"demo.panel.b",component:zy,slots:["right"],priority:10,metadata:{label:"Panel B"},aiManifest:{description:"Demo panel that responds to demo.pong commands",commands:[xf],capabilities:[{capability:"demo.panel.b.pong",command:xf,description:"Ping back from panel-b",parameters:[{name:"from",type:"string",description:"who is pinging",required:!1}]}],events:{listen:[il],emit:[il]}}});return()=>{t(),s()}}const Mw={select:"preview.element.select",inspect:"preview.element.inspect",screenshot:"preview.element.screenshot",highlight:"preview.element.highlight"};function Bw(a,t){const s=t??{},r=typeof s.selector=="string"&&s.selector.trim()!==""?s.selector:void 0,l=typeof s.elementId=="string"&&s.elementId.trim()!==""?s.elementId:void 0;return!r&&!l?{ok:!1,error:`interactive "${a}" message requires a non-empty selector or elementId`}:{ok:!0,elementRef:{selector:r,elementId:l}}}function Dw(a,t){var l,c,u,d,p,g,y,b,v;const s=Aw(a);if(!s.ok)return(l=t.onError)==null||l.call(t,s.error),!1;const r=s.data;switch(r.type){case"ready":return(c=t.onReady)==null||c.call(t,r),!0;case"event":{const S=r.payload??{};return typeof S.event!="string"?((u=t.onError)==null||u.call(t,`iframe event message requires payload.event string, got ${JSON.stringify(S.event)}`),!1):((d=t.onEvent)==null||d.call(t,S.event,S.data,r),!0)}case"command":{const S=r.payload??{};return typeof S.command!="string"?((p=t.onError)==null||p.call(t,`iframe command message requires payload.command string, got ${JSON.stringify(S.command)}`),!1):((g=t.onCommand)==null||g.call(t,S.command,S.payload,r),!0)}case"select":case"inspect":case"screenshot":case"highlight":{const S=Bw(r.type,r.payload);return S.ok?((b=t.onEvent)==null||b.call(t,Mw[r.type],{...r.payload??{},elementRef:S.elementRef},r),!0):((y=t.onError)==null||y.call(t,S.error),!1)}default:return(v=t.onError)==null||v.call(t,`unsupported message type: ${JSON.stringify(r.type)}`),!1}}function Lw(a,t){const s=_.useRef(t);s.current=t;const r=l=>{var u;const c=(u=a.current)==null?void 0:u.contentWindow;c&&c.postMessage(l,"*")};return _.useEffect(()=>{const l=c=>{var b;const u=(b=a.current)==null?void 0:b.contentWindow;if(u&&c.source!==u||u===void 0&&c.source!==null)return;const{eventBus:d,onCommand:p,onReady:g,onError:y}=s.current;Dw(c.data,{onEvent:(v,S)=>d.emit(v,S),onCommand:p??(()=>{}),onReady:g,onError:y})};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[a]),{post:r}}function zw(a,t){const s=(a.split(".").pop()||"").toLowerCase();return t==="web"||s==="html"||s==="htm"?"html":["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(s)||t==="document"?"image":"text"}function Uw({slotId:a}){const{artifactId:t,kind:s,previewUrl:r}=If(),{eventBus:l}=cc(),[c,u]=_.useState(null),[d,p]=_.useState(null),[g,y]=_.useState(null),b=_.useRef(null),v=t??null,S=v?zw(v,s):"text";return Lw(b,{eventBus:l,onError:k=>y(k)}),_.useEffect(()=>{if(S!=="html"||!v)return;if(r&&r.startsWith("blob:")){p(r),y(null);return}let k=!1;return y(null),u(null),(async()=>{try{const C=await Ie.files.read(v);if(k)return;if(!C.success||C.data===void 0){y(C.error||"failed to read artifact");return}const E=new Blob([String(C.data)],{type:"text/html"}),O=URL.createObjectURL(E);u(String(C.data)),p(O)}catch(C){k||y(C instanceof Error?C.message:String(C))}})(),()=>{k=!0,d&&URL.revokeObjectURL(d)}},[S,v,r]),m.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col","data-testid":`web-preview-${a}`,children:[m.jsxs("div",{className:"shrink-0 flex items-center gap-2 border-b border-dark-border/60 px-2 py-1 text-[10px] text-dark-muted",children:[m.jsx("span",{className:"truncate font-mono",children:v??"no artifact"}),m.jsx("span",{className:"ml-auto shrink-0 uppercase",children:S})]}),g&&m.jsx("div",{className:"m-2 rounded border border-accent-red/30 bg-accent-red/5 px-2 py-1.5 text-[11px] text-accent-red",children:g}),m.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:v?S==="html"&&d?m.jsx("iframe",{ref:b,title:`preview-${v}`,sandbox:"allow-scripts allow-forms allow-modals",src:d,className:"h-full w-full border-0 bg-white","data-testid":"web-preview-iframe"}):S==="image"?m.jsx("img",{src:r??void 0,alt:v,className:"mx-auto max-h-full max-w-full object-contain","data-testid":"web-preview-image"}):m.jsx("pre",{className:"whitespace-pre-wrap break-all p-3 font-mono text-[11px] leading-relaxed text-dark-text",children:c??(r?`Loading ${v}…`:`Preview ${v}`)}):m.jsx("div",{className:"grid h-full place-items-center p-4 text-center text-xs text-dark-muted/70",children:"Select an artifact to preview it here."})})]})}function $w(a){return a.register({id:"web-preview",capability:"preview.artifact",component:Uw,slots:["preview"],priority:10,metadata:{label:"Preview"},aiManifest:{description:"Renders the current artifact (HTML in a sandboxed iframe, images, text)",commands:[],events:{listen:[],emit:[]}}})}const Hw=["write_file","edit_file","file_write","file_edit","file_create","file_append","notebook_edit","notebook_write","apply_patch","git_apply_patch","git_commit","FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],Iw=/(?:^|[_\W])(write|edit|save|create|update|modify|patch|output|export|render|generate|build)(?:[_\W]|$)/i,Pw=/(?:^|[_\W])(read|open|cat|view|list|ls|dir|find|grep|glob|search)(?:[_\W]|$)/i;function Hi(a){return Hw.includes(a)?!0:Iw.test(a)&&!Pw.test(a)}function Fw(a){let t=null;if(typeof a=="string")try{const s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(t=s)}catch{return}else a&&typeof a=="object"&&!Array.isArray(a)&&(t=a);if(t)return t.filePath||t.path||t.file||t.file_path||t.outputPath||t.output}function rl(a){const t=a.split(/[\\/]/);return t[t.length-1]||a}function vf(a){const t=(a.split(".").pop()||"").toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(t)?"image":["md","markdown","mdown"].includes(t)?"markdown":["ts","tsx","js","jsx","json","css","html","htm","py","sh","yaml","yml","go","rs","toml","sql","java","c","cpp","h","rb","php"].includes(t)?"code":"file"}function Gw({kind:a,size:t=14}){return a==="image"?m.jsx(k0,{size:t,className:"text-dark-muted shrink-0"}):a==="markdown"?m.jsx(Bi,{size:t,className:"text-dark-muted shrink-0"}):a==="code"?m.jsx(w0,{size:t,className:"text-dark-muted shrink-0"}):m.jsx(hb,{size:t,className:"text-dark-muted shrink-0"})}function Fb(a){var s;const t=new Map;for(const r of a){if((s=r.fileJob)!=null&&s.result)for(const l of r.fileJob.result)l.path&&!t.has(l.path)&&t.set(l.path,{path:l.path,name:l.fileName||rl(l.path),source:"filejob"});for(const l of r.toolCalls??[]){if(l.status==="error")continue;const c=Fw(l.args);c&&Hi(l.name)&&!t.has(c)&&t.set(c,{path:c,name:rl(c),source:"toolcall"})}}return Array.from(t.values())}function qw({status:a}){return a==="running"?m.jsx(Rn,{size:12,className:"animate-spin text-accent-blue shrink-0 mt-0.5"}):a==="completed"?m.jsx(ic,{size:12,className:"text-accent-green shrink-0 mt-0.5"}):a==="failed"?m.jsx(Mf,{size:12,className:"text-accent-red shrink-0 mt-0.5"}):a==="skipped"?m.jsx(S0,{size:12,className:"text-dark-muted shrink-0 mt-0.5"}):m.jsx(Of,{size:12,className:"text-dark-muted shrink-0 mt-0.5"})}function Vw({sessionId:a}){const{t}=gn(),s=Ze(y=>a?y.getTasksForSession(a):[]),r=Ze(y=>a?y.getRunningAgentCount(a):0),l=Ze(y=>a?y.getForSession(a):void 0),u=ve(y=>a?y.isGenerating(a):!1)||r>0||(l==null?void 0:l.status)==="RUNNING"||(l==null?void 0:l.status)==="RESUMING",d=_.useMemo(()=>a?Ze.getState().getEventsForSession(a).filter(b=>b.type==="tool_call"||b.title).length:0,[a,s.length,r,l==null?void 0:l.updatedAt]);if(s.length===0)return u?m.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-0.5",children:[m.jsx(Rn,{size:13,className:"animate-spin text-accent-blue shrink-0"}),m.jsx("span",{className:"truncate",children:r>0?t("chat.sidebarWorkingWithAgents",{n:r}):d>0?t("chat.sidebarWorkingToolcalls",{n:d}):t("chat.sidebarWorking")})]}):m.jsx("p",{className:"text-[11px] leading-relaxed text-dark-muted/70",children:t("chat.sidebarIdle")});const p=s.slice(0,12),g=s.length-p.length;return m.jsxs("div",{className:"space-y-1.5",children:[p.map(y=>m.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[m.jsx(qw,{status:y.status}),m.jsxs("span",{className:mt("min-w-0 flex-1 leading-snug break-words",y.status==="completed"&&"text-dark-muted/70 line-through decoration-dark-muted/40",y.status==="failed"&&"text-accent-red/90"),children:[y.title,y.status==="running"&&y.progress!==void 0&&m.jsx("span",{className:"block mt-1",children:m.jsx("span",{className:"block w-full h-1 bg-dark-surface rounded-full overflow-hidden",children:m.jsx("span",{className:"block h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,y.progress))}%`}})})})]})]},y.id)),g>0&&m.jsxs("p",{className:"text-[10px] text-dark-muted/70",children:["+",g," ",t("chat.sidebarMoreTasks")]}),u&&m.jsx("p",{className:"text-[10px] text-dark-muted/70 pt-0.5",children:r>0?t("chat.sidebarRunningAgents",{n:r}):t("chat.sidebarToolcallsSoFar",{n:d})})]})}function Gb({sessionId:a,messages:t,previewFile:s,onPreview:r,onClosePreview:l}){const{t:c}=gn(),[u,d]=_.useState(null),[p,g]=_.useState(!1),[y,b]=_.useState(null),v=_.useCallback(async E=>{g(!0),b(null),d(null);try{const O=await Ie.files.read(E);O.success&&O.data!==void 0&&O.data!==null?d(String(O.data)):b(O.error||c("chat.fileReadError"))}catch(O){b(O instanceof Error?O.message:c("chat.fileReadError"))}finally{g(!1)}},[c]);_.useEffect(()=>{if(!s){d(null),g(!1),b(null);return}if(vf(s)==="file"){d(null),g(!1),b(null);return}v(s)},[s,v]);const S=_.useCallback(async E=>{const O=await Ie.files.download(E);O.success||Se.error(O.error||c("chat.fileReadError"))},[c]),k=_.useCallback(async E=>{try{await navigator.clipboard.writeText(E),Se.success(c("chat.copiedPath"))}catch{Se.error(c("chat.copyPathFailed"))}},[c]),C=s?vf(s):"file";return m.jsx("div",{className:"flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden",children:s?m.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[m.jsx("div",{className:"shrink-0 px-2 py-2 border-b border-dark-border/60",children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-dark-hover transition-colors text-dark-muted shrink-0",title:c("chat.backToArtifacts"),"aria-label":c("chat.backToArtifacts"),children:m.jsx(Bf,{size:15})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-1 text-xs font-semibold text-dark-text truncate",children:[m.jsx("span",{className:"text-dark-muted font-normal shrink-0",children:c("chat.artifactPanel")}),m.jsx("span",{className:"text-dark-muted/50 shrink-0",children:"/"}),m.jsx("span",{className:"truncate",children:rl(s)})]}),m.jsx("div",{className:"text-[10px] font-mono text-dark-muted truncate mt-0.5",title:s,children:s})]}),m.jsx("button",{onClick:()=>void k(s),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("chat.copyPath"),"aria-label":c("chat.copyPath"),children:m.jsx(ob,{size:14})}),m.jsx("a",{href:Fo(`/api/files/read?path=${encodeURIComponent(s)}`),target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("chat.openInNewTab"),"aria-label":c("chat.openInNewTab"),children:m.jsx(Og,{size:14})}),m.jsx("button",{onClick:()=>void S(s),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("fileJob.download"),"aria-label":c("fileJob.download"),children:m.jsx(cl,{size:14})})]})}),m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar p-3",children:p?m.jsx("div",{className:"flex items-center justify-center py-10 text-dark-muted",children:m.jsx(Rn,{size:18,className:"animate-spin text-accent-blue"})}):y?m.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5 text-xs text-accent-red",children:[m.jsx(ac,{size:14,className:"shrink-0 mt-0.5"}),m.jsx("span",{className:"break-words",children:y})]}):C==="image"?m.jsx("img",{src:Fo(`/api/files/download?path=${encodeURIComponent(s)}`),alt:rl(s),className:"max-w-full h-auto rounded-lg border border-dark-border"}):C==="markdown"&&u!=null?m.jsx(R1,{content:u}):C==="code"?m.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-all text-dark-text",children:u??""}):m.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[m.jsx("span",{className:"grid w-16 h-16 shrink-0 place-items-center rounded-2xl bg-dark-surface border border-dark-border shadow-sm",children:m.jsx(hb,{size:30,className:"text-accent-blue"})}),m.jsxs("div",{className:"min-w-0 w-full max-w-sm",children:[m.jsx("div",{className:"text-sm font-semibold text-dark-text break-all leading-snug",children:rl(s)}),m.jsx("div",{className:"mt-1.5 text-[11px] font-mono text-dark-muted break-all leading-relaxed",title:s,children:s})]}),m.jsx("p",{className:"text-[11px] text-dark-muted/70 leading-relaxed max-w-xs",children:c("chat.filePreviewHint")}),m.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[m.jsxs("a",{href:Fo(`/api/files/read?path=${encodeURIComponent(s)}`),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-accent-blue/10 text-accent-blue px-3 py-1.5 text-xs font-medium hover:bg-accent-blue/20 transition-colors",title:c("chat.openInNewTab"),children:[m.jsx(Og,{size:13}),c("chat.openInNewTab")]}),m.jsxs("button",{onClick:()=>void S(s),className:"inline-flex items-center gap-1 rounded-lg bg-dark-surface border border-dark-border text-dark-text px-3 py-1.5 text-xs hover:bg-dark-hover transition-colors",title:c("fileJob.download"),children:[m.jsx(cl,{size:13}),c("fileJob.download")]})]})]})})]}):m.jsx(G1,{sessionId:a,messages:t,onPreview:r})})}function Ww({sessionId:a,messages:t,previewFile:s,onPreview:r,onClosePreview:l,isMaximized:c,onToggleMaximize:u}){const{t:d}=gn(),p=_.useMemo(()=>Fb(t),[t]),[g,y]=_.useState("artifacts"),b=_.useMemo(()=>({type:"split",direction:"horizontal",children:[{type:"slot",id:"left"},{type:"split",direction:"vertical",children:[{type:"slot",id:"right"},{type:"slot",id:"preview"}]}]}),[]);return m.jsxs("div",{className:"w-full h-full border-l border-dark-border bg-dark-surface flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"shrink-0 px-3 py-2.5 border-b border-dark-border bg-dark-surface flex items-center gap-2",children:[m.jsx(pb,{size:14,className:"text-accent-blue shrink-0"}),m.jsx("span",{className:"text-xs font-semibold text-dark-text truncate",children:d(g==="workspace"?"chat.workspaceTitle":"chat.artifactPanel")}),m.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[g==="artifacts"&&!s&&p.length>0&&m.jsx("span",{className:"text-[10px] text-dark-muted tabular-nums",children:p.length}),m.jsx("button",{onClick:()=>y(v=>v==="workspace"?"artifacts":"workspace"),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:d(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"aria-label":d(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"data-testid":"sidebar-view-toggle",children:m.jsx(_0,{size:14})}),u&&m.jsx("button",{onClick:u,className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:d(c?"chat.sidebarRestore":"chat.sidebarMaximize"),"aria-label":d(c?"chat.sidebarRestore":"chat.sidebarMaximize"),children:c?m.jsx(C0,{size:14}):m.jsx(E0,{size:14})})]})]}),g==="workspace"?m.jsx(jw,{layout:b,onRegister:v=>{const S=[Ow(v),$w(v)];return()=>S.forEach(k=>k())}}):m.jsx(Gb,{sessionId:a,messages:t,previewFile:s,onPreview:r,onClosePreview:l}),m.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-dark-border/60",children:m.jsx("p",{className:"text-[10px] text-dark-muted/60 leading-relaxed",children:d(g==="workspace"?"chat.workspaceHint":"chat.artifactHint")})})]})}_.createContext(null);function Pf({isOpen:a,onClose:t,title:s,children:r,size:l="md",className:c}){if(_.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),t())};return a&&(document.addEventListener("keydown",d),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}},[a,t]),!a)return null;const u={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-3xl","3xl":"max-w-5xl"};return m.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),m.jsxs("div",{className:mt("relative w-full mx-4 bg-dark-surface border border-dark-border rounded-xl shadow-2xl animate-fade-in","max-h-[calc(100vh-2rem)] flex flex-col overflow-hidden",u[l],c),children:[s&&m.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-4 border-b border-dark-border",children:[m.jsx("h2",{className:"text-lg font-semibold text-dark-text",children:s}),m.jsx("button",{onClick:t,"aria-label":"Close",className:"p-1 rounded-lg text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(Ts,{className:"w-5 h-5","aria-hidden":"true"})})]}),m.jsx("div",{className:"min-h-0 overflow-y-auto custom-scrollbar p-6",children:r})]})]})}function SN({isOpen:a,onClose:t,onConfirm:s,title:r="确认",message:l,confirmText:c="确认",cancelText:u="取消",variant:d="default"}){const p=()=>{s(),t()};return m.jsxs(Pf,{isOpen:a,onClose:t,title:r,size:"sm",children:[m.jsx("p",{className:"text-dark-muted mb-6",children:l}),m.jsxs("div",{className:"flex gap-3 justify-end",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:u}),m.jsx("button",{onClick:p,className:mt("px-4 py-2 rounded-lg text-white transition-colors",d==="danger"?"bg-accent-red hover:bg-accent-red/90":"bg-accent-blue hover:bg-accent-blue/90"),children:c})]})]})}function Uy({children:a,variant:t="default",size:s="md",className:r}){const l={default:"bg-dark-border text-dark-muted",success:"bg-accent-green/20 text-accent-green",warning:"bg-accent-yellow/20 text-accent-yellow",error:"bg-accent-red/20 text-accent-red",info:"bg-accent-blue/20 text-accent-blue"},c={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs"};return m.jsx("span",{className:mt("inline-flex items-center rounded-full font-medium",l[t],c[s],r),children:a})}const Kw={string:"文本",number:"数字",select:"选择",boolean:"开关",folder:"目录",connector:"连接器"};function Yw({template:a,onCancel:t,onSubmit:s,submitLabel:r="启动",busy:l=!1}){const c=a.inputs??[],u=_.useMemo(()=>{const S={};for(const k of c)k.default!==void 0&&k.default!==null&&(S[k.name]=k.default);return S},[c]),[d,p]=_.useState(u),[g,y]=_.useState({});if(c.length===0)return m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"text-sm text-dark-muted",children:"该模板无需参数,直接启动。"}),m.jsx("div",{className:"text-xs text-dark-muted/80 break-all",children:a.description||"—"}),m.jsxs("div",{className:"flex justify-end gap-3",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:"取消"}),m.jsx("button",{onClick:()=>s({}),disabled:l,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:l?"启动中…":r})]})]});const b=(S,k)=>{p(C=>({...C,[S]:k})),y(C=>{if(!C[S])return C;const E={...C};return delete E[S],E})},v=()=>{const S={},k={};for(const C of c){let E=d[C.name];typeof E=="string"&&(E=E.trim());const O=E==null||E==="";if(C.required&&O){S[C.name]="必填";continue}if(!O)if(C.type==="number"){const j=Number(E);if(!Number.isFinite(j)){S[C.name]="请输入数字";continue}k[C.name]=j}else k[C.name]=E}if(Object.keys(S).length>0){y(S);return}s(k)};return m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"text-sm text-dark-muted",children:a.description||""}),c.map(S=>m.jsxs("div",{children:[m.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-dark-text mb-1.5",children:[m.jsx("span",{children:S.label||S.name}),S.required&&m.jsx("span",{className:"text-accent-red",children:"*"}),S.type!=="boolean"&&m.jsx("span",{className:"text-[10px] text-dark-muted/70",children:Kw[S.type]})]}),Zw(S,d[S.name],b),S.description&&m.jsx("div",{className:"mt-1 text-xs text-dark-muted/70",children:S.description}),g[S.name]&&m.jsx("div",{className:"mt-1 text-xs text-accent-red",children:g[S.name]})]},S.name)),m.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[m.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:"取消"}),m.jsx("button",{onClick:v,disabled:l,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:l?"启动中…":r})]})]})}function Zw(a,t,s){const r="w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm text-dark-text focus:outline-none focus:ring-1 focus:ring-accent-blue placeholder:text-dark-muted/50";switch(a.type){case"select":return m.jsxs("select",{value:typeof t=="string"?t:a.default||"",onChange:l=>s(a.name,l.target.value),className:r,children:[!a.required&&m.jsx("option",{value:"",children:"(不选)"}),(a.options||[]).map(l=>m.jsx("option",{value:l,children:l},l))]});case"boolean":return m.jsx("button",{type:"button",onClick:()=>s(a.name,t!==!0),className:mt("h-6 w-11 rounded-full transition-colors relative flex items-center px-0.5",t===!0?"bg-accent-blue":"bg-dark-border"),"aria-pressed":t===!0,children:m.jsx("span",{className:mt("h-5 w-5 rounded-full bg-white transition-transform",t===!0&&"translate-x-5")})});case"number":return m.jsx("input",{type:"number",value:typeof t=="number"||typeof t=="string"?t:"",onChange:l=>s(a.name,l.target.value),placeholder:typeof a.default=="number"?String(a.default):"0",className:r});default:return m.jsx("input",{type:"text",value:typeof t=="string"?t:"",onChange:l=>s(a.name,l.target.value),placeholder:typeof a.default=="string"?a.default:"",className:r})}}function Qw({collapsed:a=!1,onDirect:t,onStartTemplate:s,onManageTemplates:r}){const[l,c]=_.useState(!1),[u,d]=_.useState({kind:"list"}),[p,g]=_.useState([]),[y,b]=_.useState(!1),[v,S]=_.useState(""),[k,C]=_.useState({top:0,left:0}),E=_.useRef(null),O=_.useCallback(()=>{d({kind:"list"}),c(!0)},[]);_.useEffect(()=>{var Q;if(!l)return;const Z=(Q=E.current)==null?void 0:Q.getBoundingClientRect();Z&&C({top:Z.bottom+6,left:Math.max(8,Z.left)})},[l,a]),_.useEffect(()=>{if(!l||u.kind!=="list")return;let Z=!1;return b(!0),S(""),Ie.templates.list().then(Q=>{Z||(Q.success&&Q.data?g(Q.data):S(Q.error||"加载模板失败"))}).catch(()=>{Z||S("加载模板失败")}).finally(()=>{Z||b(!1)}),()=>{Z=!0}},[l,u.kind]);const j=_.useMemo(()=>{const Z=new Map;for(const Q of p){const te=Q.category||"其他",he=Z.get(te)||[];he.push(Q),Z.set(te,he)}return[...Z.entries()]},[p]),T=async Z=>{const Q=await Ie.templates.get(Z.id);Q.success&&Q.data?d({kind:"form",template:Q.data}):S(Q.error||"加载模板失败")},z=Z=>{u.kind==="form"&&(s(u.template,Z),c(!1),d({kind:"list"}))},R={top:k.top,left:k.left,width:Math.min(360,typeof window<"u"?window.innerWidth-16:360)};return m.jsxs("div",{ref:E,className:"relative",children:[m.jsx("div",{className:"flex",children:a?m.jsx("button",{onClick:O,className:"btn btn-primary w-full !px-0 aspect-square",title:"新建会话","aria-label":"新建会话",children:m.jsx(qo,{size:16,"aria-hidden":"true"})}):m.jsxs(m.Fragment,{children:[m.jsxs("button",{onClick:t,className:"btn btn-primary flex-1 !px-3 py-2 rounded-l-lg",children:[m.jsx(qo,{size:15,"aria-hidden":"true"}),"新建会话"]}),m.jsx("button",{onClick:()=>l?c(!1):O(),className:"px-2.5 rounded-r-lg bg-accent-blue text-white border-l border-white/25 hover:opacity-95 flex items-center",title:"用模板新建","aria-label":"选择模板新建会话",children:m.jsx(oa,{size:13,"aria-hidden":"true"})})]})}),l&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(!1)}),m.jsx("div",{className:"fixed z-50 bg-dark-surface border border-dark-border rounded-xl shadow-2xl p-1.5 max-h-[70vh] overflow-y-auto custom-scrollbar",style:R,children:u.kind==="form"?m.jsxs("div",{className:"p-2",children:[m.jsxs("button",{onClick:()=>d({kind:"list"}),className:"mb-2 inline-flex items-center gap-1 text-xs text-dark-muted hover:text-dark-text transition-colors",children:[m.jsx(N0,{className:"w-3.5 h-3.5"})," 返回模板列表"]}),m.jsx("div",{className:"text-sm font-medium text-dark-text mb-3",children:u.template.name}),m.jsx(Yw,{template:u.template,onCancel:()=>d({kind:"list"}),onSubmit:z,submitLabel:"启动"})]}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"px-2 py-1 text-[10.5px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:"开始一个会话"}),m.jsxs("button",{onClick:()=>{c(!1),t()},className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[m.jsx("span",{className:"w-6 h-6 rounded-md bg-accent-blue/10 border border-accent-blue/30 grid place-items-center text-accent-blue shrink-0",children:m.jsx(rc,{className:"w-3.5 h-3.5"})}),m.jsxs("span",{className:"min-w-0",children:[m.jsx("span",{className:"block text-[13px] font-medium text-dark-text",children:"直接对话"}),m.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:"不选模板,AI 现场拆解任务(动态工作流)"})]})]}),y&&m.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-xs text-dark-muted",children:[m.jsx(Rn,{className:"w-3.5 h-3.5 animate-spin"})," 加载模板…"]}),v&&!y&&m.jsx("div",{className:"px-2 py-2 text-xs text-accent-red",children:v}),!y&&!v&&j.length===0&&m.jsx("div",{className:"px-2 py-2 text-xs text-dark-muted",children:"暂无已保存模板。"}),j.map(([Z,Q])=>m.jsxs("div",{className:"mt-1",children:[m.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[m.jsx(Vo,{className:"w-3 h-3 text-dark-muted/70"}),m.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:Z}),m.jsx(Uy,{size:"sm",children:Q.length})]}),Q.map(te=>m.jsxs("button",{onClick:()=>void T(te),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[m.jsx("span",{className:"w-6 h-6 rounded-md bg-dark-border/60 border border-dark-border grid place-items-center text-dark-muted shrink-0",children:m.jsx(Vo,{className:"w-3.5 h-3.5"})}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"block text-[13px] font-medium text-dark-text truncate",children:te.name}),m.jsxs(Uy,{size:"sm",variant:"info",children:["v",te.version]})]}),te.description&&m.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:te.description})]})]},te.id))]},Z)),m.jsx("div",{className:"border-t border-dark-border mt-1 pt-1",children:m.jsx("button",{onClick:()=>{c(!1),r()},className:"w-full px-2 py-1.5 rounded-lg hover:bg-dark-hover text-left text-[12.5px] text-dark-muted",children:"模板库…"})})]})})]})]})}function Sf(a,t=Date.now(),s){const r=typeof a=="number"?a:new Date(a).getTime();if(!Number.isFinite(r))return"";const l=t-r;if(l<6e4)return s?s("time.justNow"):"刚刚";const c=Math.floor(l/6e4);if(c<60)return s?s("time.minutesAgo",{count:c}):`${c}分钟前`;const u=Math.floor(c/60);if(u<24)return s?s("time.hoursAgo",{count:u}):`${u}小时前`;const d=Math.floor(u/24);if(d<7)return s?s("time.daysAgo",{count:d}):`${d}天前`;const p=new Date(r);return`${p.getFullYear()}-${String(p.getMonth()+1).padStart(2,"0")}-${String(p.getDate()).padStart(2,"0")}`}const Kr=10;function Xw({isOpen:a,onClose:t,onSwitchSession:s}){const{t:r}=gn(),l=we(E=>E.sessionTabs),c=we(E=>E.activeSessionId),u=ve(E=>E.generatingSessions),[d,p]=_.useState(0),g=_.useMemo(()=>[...l].sort((E,O)=>(O.lastActiveAt??O.createdAt??0)-(E.lastActiveAt??E.createdAt??0)),[l]),y=Math.max(1,Math.ceil(g.length/Kr)),b=Math.min(d,y-1),v=_.useMemo(()=>{const E=new Map,O=b*Kr;for(const j of g.slice(O,O+Kr)){const T=j.project||"default",z=E.get(T)||[];z.push(j),E.set(T,z)}return Array.from(E.entries())},[g,b]),S=g.length===0?0:b*Kr+1,k=Math.min((b+1)*Kr,g.length),C=E=>u.includes(E.id)?"running":E.status||"done";return m.jsx(Pf,{isOpen:a,onClose:t,title:r("chat.sessionPickerTitle"),size:"lg",children:m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"max-h-[320px] overflow-y-auto custom-scrollbar rounded-lg border border-dark-border bg-dark-bg p-1.5",children:g.length===0?m.jsx("div",{className:"px-3 py-6 text-center text-xs text-dark-muted/60",children:r("chat.noSessions")}):v.map(([E,O])=>m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 text-[10px] text-dark-muted/70",children:[m.jsx(mb,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsx("span",{className:"truncate",children:E==="default"?r("nav.mySessions"):E}),m.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:O.length})]}),m.jsx("div",{className:"space-y-0.5",children:O.map(j=>{const T=j.id===c,z=C(j),R=Sf(j.lastActiveAt??j.createdAt,Date.now(),r),Z=af(j),Q=Cb(j.title,Z);return m.jsxs("button",{onClick:()=>{s(j.id),t()},title:r("chat.clickToOpenSession"),className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[7px] text-left text-[13px] transition-colors ${T?"bg-accent-blue/10 font-medium text-accent-blue":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[m.jsx(rc,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.title}),z==="running"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red animate-pulse",title:r("nav.sessionRunning")}),z==="waiting"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-yellow",title:r("nav.sessionWaiting")}),z==="failed"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red",title:r("nav.sessionFailed")}),z==="done"&&m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-green",title:r("nav.sessionDone")})]}),m.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/60",children:[Q&&m.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z}),m.jsx("span",{className:`shrink-0 ${Q?"":"ml-auto"}`,children:R})]})]})]},j.id)})})]},E))}),m.jsxs("div",{className:"flex items-center justify-between text-xs text-dark-muted",children:[m.jsx("span",{children:r("common.pageInfo",{start:S,end:k,total:g.length})}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs("button",{onClick:()=>p(E=>Math.max(0,E-1)),disabled:b===0,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[m.jsx(Bf,{size:13,"aria-hidden":"true"}),r("common.prevPage")]}),m.jsxs("span",{className:"min-w-[48px] text-center font-mono",children:[b+1,"/",y]}),m.jsxs("button",{onClick:()=>p(E=>Math.min(y-1,E+1)),disabled:b>=y-1,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[r("common.nextPage"),m.jsx(gb,{size:13,"aria-hidden":"true"})]})]})]})]})})}function Jw(){return{activities:{},order:[],taskTitles:{},artifacts:[]}}const nn=Bt()(a=>({bySession:{},applyEvent:(t,s)=>a(r=>{const l=r.bySession[t]??Jw();switch(s.type){case"activity_started":return l.activities[s.activity.id]?r:{...r,bySession:{...r.bySession,[t]:{...l,activities:{...l.activities,[s.activity.id]:s.activity},order:[...l.order,s.activity.id]}}};case"activity_updated":{const c=l.activities[s.activityId];return c?{...r,bySession:{...r.bySession,[t]:{...l,activities:{...l.activities,[s.activityId]:{...c,...s.patch}}}}}:r}case"activity_finalized":{const c=l.activities[s.activityId];return c?{...r,bySession:{...r.bySession,[t]:{...l,activities:{...l.activities,[s.activityId]:{...c,status:s.status,endedAt:s.endedAt}}}}}:r}case"artifact_produced":return l.artifacts.some(c=>c.id===s.artifact.id)?r:{...r,bySession:{...r.bySession,[t]:{...l,artifacts:[...l.artifacts,s.artifact]}}};case"task_title_set":return{...r,bySession:{...r.bySession,[t]:{...l,taskTitles:{...l.taskTitles,[s.messageId]:s.title}}}};case"next_action_set":return{...r,bySession:{...r.bySession,[t]:{...l,nextAction:s.text??void 0}}};default:return r}}),resetSession:t=>a(s=>{if(!s.bySession[t])return s;const r={...s.bySession};return delete r[t],{bySession:r}}),finalizeSession:(t,s)=>a(r=>{const l=r.bySession[t];if(!l)return r;const c=Date.now(),u=["pending","running","paused","waiting_user"];let d=!1;const p={};for(const[g,y]of Object.entries(l.activities))u.includes(y.status)?(p[g]={...y,status:s,endedAt:c},d=!0):p[g]=y;return d?{...r,bySession:{...r.bySession,[t]:{...l,activities:p}}}:r}),markStatus:(t,s,r)=>a(l=>{const c=l.bySession[t];if(!c)return l;let u=!1;const d={};for(const[p,g]of Object.entries(c.activities))s.includes(g.status)?(d[p]={...g,status:r},u=!0):d[p]=g;return u?{...l,bySession:{...l.bySession,[t]:{...c,activities:d}}}:l})}));function kN(a,t,s){if(!t)return[];const r=a.bySession[t];if(!r)return[];const l=[];for(const c of r.order){const u=r.activities[c];u&&u.messageId===s&&l.push(u)}return l.sort((c,u)=>c.blockRange[0]-u.blockRange[0])}function e_(a,t){if(!t)return;const s=a.bySession[t];if(s)for(let r=s.order.length-1;r>=0;r--){const l=s.order[r];if(!l)continue;const c=s.activities[l];if(c&&(c.status==="running"||c.status==="waiting_user"||c.status==="paused"||c.status==="blocked"))return c}}function t_(a,t,s){var r;if(!(!t||!s))return(r=a.bySession[t])==null?void 0:r.taskTitles[s]}function n_(a){const t=nn(r=>{var l;return a?(l=r.bySession[a])==null?void 0:l.taskTitles:void 0}),s=ve(r=>a?r.messagesBySession[a]??[]:[]);if(!a||!t)return null;for(let r=s.length-1;r>=0;r--){const l=s[r];if(!l||l.type!=="assistant")continue;const c=t[l.id];if(c)return c}return null}const s_=["templates","plugins","connectors","skills","channels"],Ei=Bt()(da(a=>({pinned:s_,moreExpanded:!1,morePinned:!1,togglePin:t=>a(s=>({pinned:s.pinned.includes(t)?s.pinned.filter(r=>r!==t):[...s.pinned,t]})),setMoreExpanded:t=>a({moreExpanded:t}),toggleMorePinned:()=>a(t=>({morePinned:!t.morePinned}))}),{name:"deepseekcode-nav-storage"})),zo=20;function a_({sessionId:a,fallback:t}){const s=n_(a);return m.jsx("span",{className:"min-w-0 flex-1 truncate",title:s??t,children:s??t})}const $y=["chat","plan","agentflow"],Hy=_.memo(function({collapsed:t,onToggleCollapse:s,tabs:r,activeTab:l,onTabChange:c,isConnected:u,onNewSession:d,onStartTemplate:p,onManageTemplates:g,onSwitchSession:y,onCloseSession:b,onRenameSession:v,getTabTitle:S}){const{t:k}=gn(),C=we(Y=>Y.sessionTabs),E=we(Y=>Y.activeSessionId),O=we(Y=>Y.historySessions),j=we(Y=>Y.restoreHistorySession),T=we(Y=>Y.removeHistorySession),[z,R]=_.useState(!1),[Z,Q]=_.useState(!1),[te,he]=_.useState(null),[me,lt]=_.useState(""),de=_.useRef(null),W=Ei(Y=>Y.pinned),K=Ei(Y=>Y.moreExpanded),ge=Ei(Y=>Y.morePinned),$=Ei(Y=>Y.togglePin),X=Ei(Y=>Y.setMoreExpanded),ne=Ei(Y=>Y.toggleMorePinned),Oe=_.useMemo(()=>W.filter(Y=>!$y.includes(Y)).map(Y=>r.find(Je=>Je.id===Y)).filter(Y=>!!Y),[r,W]),Me=_.useMemo(()=>r.filter(Y=>!$y.includes(Y.id)&&!W.includes(Y.id)),[r,W]),Pe=_.useCallback((Y,Je)=>{he(Y),lt(Je),setTimeout(()=>{var ke;return(ke=de.current)==null?void 0:ke.select()},50)},[]),je=_.useCallback(()=>{te&&me.trim()&&v(te,me.trim()),he(null)},[te,me,v]),Ee=_.useCallback((Y,Je)=>{var Yt;const ke=ve.getState().getMessages(Y),oe=[];oe.push(`# ${Je||k("nav.chat")}`),oe.push(""),oe.push(`> ${k("chat.exportMd")} · ${new Date().toLocaleString()}`),oe.push(""),oe.push("---"),oe.push(""),(!ke||ke.length===0)&&(oe.push(k("chat.noSessions")),oe.push(""));for(const bt of ke){if(bt.deleted)continue;const St=bt.type==="user"?k("chat.you"):k("chat.assistantLabel");if(oe.push(`## ${St} · ${new Date(bt.timestamp).toLocaleString()}`),oe.push(""),bt.thinking&&bt.thinking.trim()&&(oe.push("<details>"),oe.push(`<summary>💭 ${k("chat.thoughtProcess")}</summary>`),oe.push(""),oe.push(bt.thinking.trim()),oe.push(""),oe.push("</details>"),oe.push("")),bt.content&&bt.content.trim()&&(oe.push(bt.content.trim()),oe.push("")),bt.steps&&bt.steps.length>0){oe.push(`**${k("chat.runningSteps")}:**`),oe.push("");for(const qt of bt.steps){if(oe.push(`- **${qt.title}**${qt.status?` (\`${qt.status}\`)`:""}`),qt.thought&&oe.push(` - 💭 ${qt.thought}`),(Yt=qt.toolCalls)!=null&&Yt.length)for(const za of qt.toolCalls)oe.push(` - 🛠 \`${za.name}\``);qt.result&&oe.push(` - ${qt.result}`)}oe.push("")}oe.push("---"),oe.push("")}const ot=new Blob([oe.join(`
|
|
52
|
-
`)],{type:"text/markdown;charset=utf-8"}),se=URL.createObjectURL(ot),Pn=document.createElement("a");Pn.href=se,Pn.download=`${(Je||"session").replace(/[\\/:*?"<>|]/g,"_").slice(0,80)}.md`,Pn.click(),URL.revokeObjectURL(se)},[k]),nt=_.useCallback(Y=>{j(Y),pe.setSessionId(Y)},[j]),st=_.useCallback(Y=>{y(Y),l!=="chat"&&c("chat")},[y,c,l]),Kt=ve(Y=>Y.generatingSessions),Mn=_.useCallback(Y=>Kt.includes(Y.id)?"running":Y.status||"done",[Kt]),sn=_.useMemo(()=>{const Y=new Map,Je=[...C].sort((oe,ot)=>(ot.lastActiveAt??ot.createdAt??0)-(oe.lastActiveAt??oe.createdAt??0));let ke=Je;if(Je.length>zo){const oe=Je.slice(0,zo),ot=Je.find(se=>se.id===E);ot&&!oe.some(se=>se.id===ot.id)?ke=[ot,...oe.filter(se=>se.id!==ot.id)].slice(0,zo):ke=oe}for(const oe of ke){const ot=oe.project||"default",se=Y.get(ot)||[];se.push(oe),Y.set(ot,se)}return Array.from(Y.entries())},[C,E]),bn=(Y,Je)=>{const ke=l===Y.id,oe=Y.iconComponent,ot=k(Je?"nav.unpin":"nav.pin");return t?m.jsx("button",{onClick:()=>c(Y.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${ke?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:S(Y.id,Y.title),"aria-label":S(Y.id,Y.title),"aria-current":ke?"page":void 0,children:oe&&m.jsx(oe,{size:17,"aria-hidden":"true"})},Y.id):m.jsxs("button",{onClick:()=>c(Y.id),className:"side-nav-item group","data-active":ke,"aria-current":ke?"page":void 0,children:[oe&&m.jsx(oe,{size:15,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"truncate",children:S(Y.id,Y.title)}),m.jsx("span",{role:"button",tabIndex:0,onClick:se=>{se.stopPropagation(),$(Y.id)},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.stopPropagation(),$(Y.id))},className:"ml-auto shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:ot,"aria-label":ot,children:m.jsx(Qd,{size:11,"aria-hidden":"true",className:Je?"fill-current text-accent-blue":""})})]},Y.id)},Jn=Y=>{if(Me.length===0)return null;const Je=`${k("nav.moreOptions")} (${Me.length})`,ke=k(ge?"nav.unpinMore":"nav.pinMore"),oe=t?m.jsx("button",{onClick:()=>X(!K),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${K?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:Je,"aria-label":Je,"aria-expanded":K,children:m.jsx(Xd,{size:17,"aria-hidden":"true"})},"more"):m.jsxs("div",{className:"group flex items-center",children:[m.jsxs("button",{onClick:()=>X(!K),className:`side-nav-item flex-1 ${K?"bg-dark-hover text-dark-text":""}`,"data-active":!1,"aria-expanded":K,children:[m.jsx(Xd,{size:15,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"truncate",children:k("nav.moreOptions")}),m.jsx("span",{className:"ml-auto rounded bg-dark-bg px-1.5 py-px text-[10px] text-dark-muted/70",children:Me.length}),m.jsx(oa,{size:13,"aria-hidden":"true",className:`shrink-0 text-dark-muted/70 transition-transform duration-150 ${K?"rotate-180":""}`})]}),m.jsx("span",{role:"button",tabIndex:0,onClick:se=>{se.stopPropagation(),ne()},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.stopPropagation(),ne())},className:"mr-1 shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:ke,"aria-label":ke,children:m.jsx(Qd,{size:11,"aria-hidden":"true",className:ge?"fill-current text-accent-blue":""})})]},"more"),ot=K&&m.jsx("div",{className:`mt-0.5 space-y-0.5 ${t?"flex flex-col items-center":""}`,children:Me.map(se=>bn(se,!1))});return m.jsxs("div",{className:`${Y?"mt-1 border-t border-dark-border/40 pt-1":"mt-1.5 border-t border-dark-border/40 pt-1.5"}`,children:[oe,ot]},"more-section")};return m.jsxs("div",{className:"flex h-full flex-col",children:[m.jsxs("div",{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-dark-border/70 ${t?"justify-center px-2":"px-4"}`,children:[m.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"h-7 w-7 rounded-lg shadow-sm"}),!t&&m.jsx("span",{className:"flex-1 truncate text-[15px] font-semibold tracking-tight text-dark-text",children:"deepseekcode"}),m.jsx("button",{onClick:s,className:`rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text ${t?"hidden":""}`,title:k("nav.collapseSidebar"),"aria-label":k("nav.collapseSidebar"),children:m.jsx(T0,{size:16,"aria-hidden":"true"})})]}),m.jsx("div",{className:t?"p-2":"px-3 pt-3",children:p&&g?m.jsx(Qw,{collapsed:t,onDirect:d,onStartTemplate:p,onManageTemplates:g}):m.jsxs("button",{onClick:d,className:"btn btn-primary w-full",children:[m.jsx(qo,{size:15,"aria-hidden":"true"}),k("chat.newSession")]})}),m.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-3 pb-2 min-h-0",children:[m.jsxs("nav",{className:"sticky top-0 z-10 border-b border-dark-border/50 bg-dark-surface pt-2",children:[(Oe.length>0||ge)&&m.jsxs("div",{className:`space-y-0.5 ${t?"flex flex-col items-center":""}`,children:[Oe.map(Y=>bn(Y,!0)),ge&&Jn(!0)]}),!ge&&Jn(!1)]}),!t&&m.jsxs("div",{className:"pt-2",children:[m.jsxs("div",{className:"side-group-label flex items-center justify-between",children:[m.jsx("span",{children:k("nav.sessions")}),O.length>0&&m.jsxs("button",{onClick:()=>R(Y=>!Y),className:"flex items-center gap-0.5 rounded px-1 py-0.5 text-dark-muted/70 transition-colors hover:text-dark-text",title:k("chat.sessionHistory"),"aria-expanded":z,children:[m.jsx(Mg,{size:11,"aria-hidden":"true"}),m.jsx(oa,{size:11,"aria-hidden":"true",className:`transition-transform ${z?"":"-rotate-90"}`})]})]}),m.jsxs("div",{className:"space-y-1.5",children:[sn.map(([Y,Je])=>m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[10px] text-dark-muted/70",children:[m.jsx(mb,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),m.jsx("span",{className:"truncate",children:Y==="default"?k("nav.mySessions"):Y}),m.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:Je.length})]}),m.jsx("div",{className:"space-y-0.5",children:Je.map(ke=>{const oe=ke.id===E,ot=te===ke.id,se=Mn(ke),Pn=Sf(ke.lastActiveAt??ke.createdAt,Date.now(),k),Yt=af(ke),bt=Cb(ke.title,Yt);return m.jsxs("div",{onClick:()=>!ot&&st(ke.id),onDoubleClick:()=>Pe(ke.id,ke.title),className:`group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[6px] text-[13px] transition-colors ${oe?"bg-dark-hover font-medium text-dark-text":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[m.jsx(rc,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),ot?m.jsx("input",{ref:de,value:me,onChange:St=>lt(St.target.value),onBlur:je,onKeyDown:St=>{St.key==="Enter"?je():St.key==="Escape"&&he(null)},onClick:St=>St.stopPropagation(),className:"min-w-0 flex-1 rounded border border-accent-blue bg-dark-bg px-1 py-0.5 text-xs text-dark-text outline-none",autoFocus:!0}):m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(a_,{sessionId:ke.id,fallback:ke.title}),se==="running"&&m.jsxs("span",{className:"pixel-spinner shrink-0 text-accent-red",title:k("nav.sessionRunning"),"aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]}),se==="waiting"&&m.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-yellow",title:k("nav.sessionWaiting")}),se==="failed"&&m.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-red",title:k("nav.sessionFailed")}),se==="done"&&m.jsxs("span",{className:"pixel-grid shrink-0 text-accent-green",title:k("nav.sessionDone"),"aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})]}),m.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/50",children:[bt&&m.jsx("span",{className:"min-w-0 flex-1 truncate",children:Yt}),m.jsx("span",{className:`shrink-0 ${bt?"":"ml-auto"}`,children:Pn})]})]}),!ot&&m.jsxs(m.Fragment,{children:[m.jsx("button",{onClick:St=>{St.stopPropagation(),Pe(ke.id,ke.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.renameSession"),"aria-label":k("chat.renameSession"),children:m.jsx(A0,{size:11,"aria-hidden":"true"})}),m.jsx("button",{onClick:St=>{St.stopPropagation(),Ee(ke.id,ke.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.exportMd"),"aria-label":k("chat.exportMd"),children:m.jsx(cl,{size:11,"aria-hidden":"true"})}),C.length>1&&m.jsx("button",{onClick:St=>{St.stopPropagation(),b(ke.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("a11y.close"),children:m.jsx(Ts,{size:12,"aria-hidden":"true"})})]})]},ke.id)})})]},Y)),C.length===0&&m.jsx("div",{className:"px-2.5 py-2 text-xs text-dark-muted/60",children:k("chat.noSessions")})]}),C.length>zo&&m.jsxs("button",{onClick:()=>Q(!0),className:"mt-1.5 flex w-full items-center justify-center gap-1 rounded-lg border border-dashed border-dark-border px-2 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:k("chat.viewAllSessions"),children:[m.jsx(j0,{size:12,"aria-hidden":"true"}),k("chat.viewAllSessions"),m.jsxs("span",{className:"text-dark-muted/50",children:["(",C.length,")"]})]}),z&&O.length>0&&m.jsx("div",{className:"mt-1 space-y-0.5 border-t border-dark-border/50 pt-1",children:O.slice(0,10).map(Y=>{const Je=af(Y);return m.jsxs("div",{onClick:()=>nt(Y.id),className:"group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover/60 hover:text-dark-text",children:[m.jsx(Mg,{size:11,"aria-hidden":"true",className:"shrink-0 opacity-50"}),m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsx("span",{className:"block truncate",children:Y.title}),Je&&m.jsx("span",{className:"block truncate text-[10px] text-dark-muted/50",children:Je})]}),m.jsx("span",{className:"shrink-0 text-[10px] text-dark-muted/50",children:Sf(Y.lastActiveAt??Y.createdAt,Date.now(),k)}),m.jsx("button",{onClick:ke=>{ke.stopPropagation(),T(Y.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("chat.removeFromHistory"),children:m.jsx(Ts,{size:11,"aria-hidden":"true"})})]},Y.id)})})]})]}),m.jsxs("div",{className:`shrink-0 border-t border-dark-border/70 ${t?"p-2":"p-3"}`,children:[t&&m.jsx("button",{onClick:s,className:"mb-2 flex w-full items-center justify-center rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:k("nav.expandSidebar"),"aria-label":k("nav.expandSidebar"),children:m.jsx(R0,{size:16,"aria-hidden":"true"})}),m.jsxs("div",{className:`flex items-center gap-2 text-xs text-dark-muted ${t?"justify-center":"px-1.5"}`,role:"status","aria-label":k("a11y.connectionStatus"),children:[m.jsx("span",{className:`h-2 w-2 shrink-0 rounded-[1px] ${u?"bg-accent-green":"bg-accent-red"}`,"aria-hidden":"true"}),!t&&m.jsx("span",{className:"truncate",children:k(u?"chat.connected":"chat.disconnected")})]})]}),m.jsx(Xw,{isOpen:Z,onClose:()=>Q(!1),onSwitchSession:Y=>st(Y)})]})}),i_={info:"bg-accent-blue",warn:"bg-accent-yellow",error:"bg-accent-red",success:"bg-accent-green",tool:"bg-accent-purple"};function r_(a){return a==null||a===""?"-":new Date(a).toLocaleString()}function l_(){const[a,t]=_.useState([]),[s,r]=_.useState(!0),[l,c]=_.useState(null),[u,d]=_.useState(null),[p,g]=_.useState(!1),y=_.useCallback(async()=>{r(!0);try{const k=await Ie.logs.list();k.success&&Array.isArray(k.data)&&t(k.data)}catch(k){console.error("Failed to load log files:",k)}r(!1)},[]);_.useEffect(()=>{y()},[y]);const b=_.useCallback(async k=>{if(!k.previewable)return;c(k),g(!0);const C=await Ie.logs.read(k.name,500);C.success&&C.data&&d(C.data),g(!1)},[]),v=_.useCallback(()=>{c(null),d(null)},[]),S=k=>k<1024?`${k} B`:k<1024*1024?`${(k/1024).toFixed(1)} KB`:`${(k/(1024*1024)).toFixed(1)} MB`;return l&&u?m.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2 shrink-0",children:[m.jsx("button",{onClick:v,className:"p-1 rounded hover:bg-dark-hover transition-colors",title:"返回文件列表",children:m.jsx(Bf,{size:16})}),m.jsx("span",{className:"text-sm font-medium text-dark-text truncate flex-1",children:l.name}),m.jsxs("a",{href:Ie.logs.downloadUrl(l.name),download:l.name,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent-blue text-white rounded hover:opacity-90 transition-opacity",children:[m.jsx(cl,{size:12}),"下载"]})]}),p?m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(Rn,{size:20,className:"animate-spin text-accent-blue"})}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"text-[10px] text-dark-muted mb-1 shrink-0",children:[S(u.size)," · ",u.totalLines," 行",u.startLine>1&&` (显示最新 ${u.totalLines-u.startLine+1} 行)`]}),m.jsx("div",{className:`flex-1 overflow-y-auto min-h-0 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all
|
|
53
|
-
bg-dark-bg border border-dark-border rounded p-3 custom-scrollbar`,style:{scrollbarWidth:"thin",scrollbarColor:"#30363d transparent"},children:u.content||m.jsx("span",{className:"text-dark-muted italic",children:"(空文件)"})})]})]}):m.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[m.jsx("span",{className:"text-xs font-medium text-dark-text",children:"日志文件"}),m.jsx("button",{onClick:y,className:"px-2 py-1 text-[10px] bg-dark-hover rounded hover:bg-dark-border transition-colors",disabled:s,children:s?"刷新中...":"刷新"})]}),s?m.jsx("div",{className:"flex items-center justify-center py-8",children:m.jsx(Rn,{size:16,className:"animate-spin text-accent-blue"})}):a.length===0?m.jsxs("div",{className:"text-center py-8 text-dark-muted",children:[m.jsx(Bi,{size:32,className:"mx-auto mb-1 opacity-50"}),m.jsx("p",{className:"text-xs",children:"暂无日志文件"})]}):m.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1 custom-scrollbar",children:a.map(k=>m.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-dark-hover transition-colors group",children:[m.jsx(Bi,{size:14,className:"text-accent-blue shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-xs text-dark-text truncate",children:k.name}),m.jsxs("div",{className:"text-[10px] text-dark-muted",children:[S(k.size)," · ",r_(k.modified)]})]}),m.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[k.previewable&&m.jsx("button",{onClick:()=>b(k),className:"p-1.5 rounded hover:bg-dark-border transition-colors",title:"预览",children:m.jsx(O0,{size:14})}),m.jsx("a",{href:Ie.logs.downloadUrl(k.name),download:k.name,className:"p-1.5 rounded hover:bg-dark-border transition-colors block",title:"下载",children:m.jsx(cl,{size:14})})]})]},k.name))})]})}const Iy=_.memo(_.forwardRef(function({logs:t},s){return m.jsx("div",{ref:s,className:"flex-1 overflow-y-auto min-h-0 font-mono text-xs space-y-0.5 custom-scrollbar",children:t.length===0?m.jsxs("div",{className:"text-center text-dark-muted py-12",children:[m.jsx(el,{size:48,className:"mx-auto mb-2 opacity-50"}),m.jsx("p",{children:"暂无实时日志"})]}):t.map(r=>m.jsxs("div",{className:`p-2 rounded hover:bg-dark-surface transition-colors ${r.level==="error"?"bg-accent-red/10":r.level==="warn"?"bg-accent-yellow/10":r.level==="success"?"bg-accent-green/10":""}`,children:[m.jsx("span",{className:"text-dark-muted text-xs",children:new Date(r.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})," ",m.jsx("span",{className:`px-1.5 py-0.5 rounded text-white text-xs ${i_[r.level]}`,children:r.level.toUpperCase()})," ",m.jsxs("span",{className:"text-dark-muted text-xs",children:["[",r.source,"]"]})," ",m.jsx("span",{className:"text-dark-text whitespace-pre-wrap break-all",children:r.message})]},r.id))})})),o_=_.memo(function({logs:t,onClear:s,compact:r}){const[l,c]=_.useState("stream"),u=_.useRef(null),d=_.useRef(!0),p=_.useCallback(()=>{const y=u.current;return y?y.scrollHeight-y.scrollTop-y.clientHeight<50:!0},[]),g=_.useCallback(()=>{const y=u.current;y&&(y.scrollTop=y.scrollHeight)},[]);return _.useEffect(()=>{const y=u.current;if(!y)return;const b=()=>{d.current=p()};return y.addEventListener("scroll",b,{passive:!0}),()=>y.removeEventListener("scroll",b)},[p]),_.useEffect(()=>{d.current&&g()},[t,g]),_.useEffect(()=>{const y=u.current;if(!y)return;let b=y.clientHeight;const v=new ResizeObserver(()=>{const S=y.clientHeight;S>0&&b===0&&g(),b=S});return v.observe(y),()=>v.disconnect()},[g]),r?m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 p-2",children:[m.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[m.jsxs("h2",{className:"flex items-center gap-2 text-xs font-semibold",children:[m.jsx(el,{size:14,className:"text-accent-blue"}),"日志",m.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",t.length,")"]})]}),m.jsx("button",{onClick:s,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-2 py-1 text-[10px]",children:"清空"})]}),m.jsx(Iy,{ref:u,logs:t})]}):m.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden p-4",children:[m.jsx("div",{className:"flex items-center justify-between mb-3 shrink-0",children:m.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[m.jsx(el,{size:18,className:"text-accent-blue"}),"后台日志"]})}),m.jsx("div",{className:"flex gap-1 mb-3 shrink-0 border-b border-dark-border",children:[["stream","实时日志流",el],["files","日志文件",Bi]].map(([y,b,v])=>m.jsxs("button",{onClick:()=>c(y),className:`flex items-center gap-1.5 px-4 py-2 text-sm rounded-t transition-colors border-b-2 ${l===y?"border-accent-blue text-accent-blue bg-accent-blue/5":"border-transparent text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:[m.jsx(v,{size:14}),b,y==="stream"&&t.length>0&&m.jsxs("span",{className:"ml-1 text-[10px] text-dark-muted",children:["(",t.length,")"]})]},y))}),l==="stream"&&m.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[m.jsx("div",{className:"flex items-center justify-end mb-2 shrink-0",children:m.jsx("button",{onClick:s,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-3 py-1.5 text-sm",children:"清空"})}),m.jsx(Iy,{ref:u,logs:t})]}),l==="files"&&m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:m.jsx("div",{className:"border border-dark-border rounded-lg p-3 bg-dark-surface h-full",children:m.jsx(l_,{})})})]})}),c_=a=>{if(a==null||a==="")return{};if(typeof a!="string")return a;try{return JSON.parse(a)}catch{return a}},Yr=(a,t="")=>typeof a=="string"?a:String((a==null?void 0:a.content)||(a==null?void 0:a.message)||(a==null?void 0:a.text)||(a==null?void 0:a.error)||t||""),u_=a=>Array.isArray(a)?a:Array.isArray(a==null?void 0:a.tasks)?a.tasks:Array.isArray(a==null?void 0:a.items)?a.items:Array.isArray(a==null?void 0:a.planTasks)?a.planTasks:[],$d=(a,t,s=0)=>{const r=String(a.id||a.taskId||a.backendId||`plan-task-${s+1}`),l=Xn(a.status||a.planStatus,a.completed),c=Date.now()+s;return{id:r,sessionId:t,title:String(a.title||a.name||a.content||a.description||`Task ${s+1}`),description:a.description||a.details||a.content,status:l,source:"plan",agentType:a.agentType||a.agent||a.role,progress:a.progress!=null?Number(a.progress):void 0,result:a.result,error:a.error,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(String):void 0,startedAt:a.startedAt?Number(a.startedAt):l==="running"?c:void 0,completedAt:a.completedAt?Number(a.completedAt):l==="completed"||l==="failed"?c:void 0,createdAt:a.createdAt&&Number(a.createdAt)||c,updatedAt:c,raw:a}},Py=(a,t,s=0)=>{const r=String(a.id||a.taskId||a.backendId||`goal-task-${s+1}`),l=Xn(a.status),c=Date.now()+s;return{id:r,sessionId:t,title:String(a.title||a.name||a.content||a.description||`Task ${s+1}`),description:a.description||a.details||a.content,status:l,source:"goal",agentType:a.agentType||a.agent||a.role,progress:a.progress!=null?Number(a.progress):void 0,result:a.result,error:a.error,dependencies:Array.isArray(a.parentIds)?a.parentIds.map(String):void 0,startedAt:a.startedAt?Number(a.startedAt):l==="running"?c:void 0,completedAt:a.completedAt?Number(a.completedAt):l==="completed"||l==="failed"?c:void 0,createdAt:a.createdAt&&Number(a.createdAt)||c,updatedAt:a.updatedAt?Number(a.updatedAt):c,raw:a}},d_=(a,t)=>{const s=String((t==null?void 0:t.taskId)||(t==null?void 0:t.id)||"");if(!s)return;const r=Ze.getState().getTasksForSession(a).find(d=>d.id===s),l=we.getState().getSessionTasks(a).find(d=>d.id===s||d.backendId===s),c=t!=null&&t.status?Xn(t.status):(r==null?void 0:r.status)||"pending",u={id:s,sessionId:a,title:(t==null?void 0:t.title)||(r==null?void 0:r.title)||(l==null?void 0:l.title)||s,description:(t==null?void 0:t.description)??(r==null?void 0:r.description)??(l==null?void 0:l.description),status:c,source:"goal",agentType:(t==null?void 0:t.agentType)||(r==null?void 0:r.agentType),progress:(t==null?void 0:t.progress)!=null?Number(t.progress):r==null?void 0:r.progress,result:(t==null?void 0:t.result)??(r==null?void 0:r.result),error:(t==null?void 0:t.error)??(r==null?void 0:r.error),startedAt:c==="running"?Date.now():r==null?void 0:r.startedAt,completedAt:c==="completed"||c==="failed"?Date.now():r==null?void 0:r.completedAt,createdAt:(r==null?void 0:r.createdAt)||Date.now(),updatedAt:Date.now(),raw:t};return Ze.getState().upsertTask(a,u),kf(a,u),u},Xr=a=>({id:a.id,title:a.title,completed:a.status==="completed",createdAt:a.createdAt,description:a.description,planStatus:a.status,agentType:a.agentType,dependencies:a.dependencies,result:a.result,error:a.error,startedAt:a.startedAt,completedAt:a.completedAt,progress:a.progress}),kf=(a,t)=>{const s=we.getState(),r=s.getSessionTasks(a),l=Xr(t);if(r.some(c=>c.id===t.id||c.backendId===t.id)){s.updateTaskPlanStatus(a,t.id,l);return}s.setSessionTasks(a,[...r,l])},Uo=a=>{const t=ve.getState(),s=t.getMessages(a),r=s[s.length-1];(!r||r.type!=="assistant")&&t.addMessage(a,{id:`plan-${Date.now()}`,type:"assistant",content:"",timestamp:Date.now()})};function Hd(a,t,s){const r=Mi.getState(),l=ve.getState(),c=Ze.getState(),u=c_(t);switch(a){case"plan_start":{l.startGeneration(s),Uo(s);const d=Yr(u,"Plan started");d&&r.setThinkingStatus(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan started",message:d,status:"running",data:u});break}case"plan_thinking":{const d=Yr(u,"Analyzing request...");r.setThinkingStatus(s,d),Uo(s),l.setThinking(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan thinking",message:d,status:"running",data:u});break}case"plan_complete":{const d=(u==null?void 0:u.plan)||(u==null?void 0:u.content)||(u==null?void 0:u.result)||(u==null?void 0:u.markdown);if(d){r.setPlanContent(String(d)),Uo(s);const p=l.getMessages(s),g=p[p.length-1];(g==null?void 0:g.type)==="assistant"&&!g.content.trim()&&l.updateLastMessage(s,String(d))}else{const p=[...l.getMessages(s)].reverse().find(g=>g.type==="assistant");p!=null&&p.content&&r.setPlanContent(p.content)}l.endGeneration(s),c.recordEvent(s,{type:a,source:"plan",title:"Plan complete",message:Yr(u,"Plan complete"),status:"completed",data:u});break}case"plan_error":{const d=Yr(u,"Plan failed");Uo(s),l.updateLastMessage(s,`Plan failed: ${d}`),l.endGeneration(s,d),c.recordEvent(s,{type:a,source:"plan",title:"Plan failed",message:d,status:"failed",data:u});break}case"plan_tasks":{const d=u_(u).map((p,g)=>$d(p,s,g));c.setTasks(s,d,"plan"),we.getState().setSessionTasks(s,d.map(Xr)),c.recordEvent(s,{type:a,source:"plan",title:"Plan tasks updated",message:`${d.length} tasks`,status:"pending",data:u});break}case"plan_task_start":case"plan_task_update":case"plan_task_result":{const d=$d(u,s),p=a==="plan_task_start"?"running":Xn(a==="plan_task_result"?u.status||(u.error?"failed":"completed"):u.status||u.planStatus),g={...d,status:p,startedAt:d.startedAt||(p==="running"?Date.now():void 0),completedAt:d.completedAt||(p==="completed"||p==="failed"?Date.now():void 0)};c.upsertTask(s,g),kf(s,g),c.recordEvent(s,{type:a,source:"plan",title:g.title,message:g.result||g.error||g.description,status:g.status,taskId:g.id,data:u});break}case"plan_task_complete":{const d=$d(u,s),p=String(u.status||"")==="failed"||!!u.error,y={...d,status:p?"failed":"completed",completedAt:d.completedAt||Date.now()};c.upsertTask(s,y),kf(s,y),c.recordEvent(s,{type:a,source:"plan",title:y.title,message:y.result||y.error||y.description,status:y.status,taskId:y.id,data:u});const b=y.title||`task ${y.id}`;p?Se.error(`✘ ${b} 失败`,6e3):Se.success(`✓ ${b} 完成`,4e3);break}case"plan_subagent_start":{const d=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent";c.recordEvent(s,{type:a,source:"plan",title:`设计子代理: ${d}`,message:(u==null?void 0:u.title)||"Reading codebase and designing implementation details...",status:"running",data:u});break}case"plan_subagent_done":{const d=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent",p=(u==null?void 0:u.status)==="error"||(u==null?void 0:u.status)==="timeout"||(u==null?void 0:u.status)==="max_iterations"||!!(u!=null&&u.error);c.recordEvent(s,{type:a,source:"plan",title:`设计子代理: ${d}`,message:p?`设计失败: ${(u==null?void 0:u.error)||(u==null?void 0:u.status)||"error"}`:u!=null&&u.designDocPath?`设计完成 → ${u.designDocPath}`:"设计完成",status:p?"failed":"completed",data:u});break}case"step_prompt":{const d=Yr(u),p=(u==null?void 0:u.taskId)||(u==null?void 0:u.id);p&&c.upsertTask(s,{id:String(p),title:u.title||u.step||String(p),status:"running",source:"plan",description:d}),c.recordEvent(s,{type:a,source:"plan",title:(u==null?void 0:u.step)||"Step prompt",message:d,status:"running",taskId:p?String(p):void 0,data:u});break}case"plan_mode_change":{const d=(u==null?void 0:u.frontendMode)||(u==null?void 0:u.newMode),p=u==null?void 0:u.planPath;d==="normal"?r.applyBackendMode("normal"):d==="auto"?r.setAuto(!0):(d==="plan"||d==="act"||d==="goal"||d==="auto-plan"||d==="auto-act"||d==="auto-goal")&&r.applyBackendMode(d);const g=p?` [plan: ${p}]`:"";c.recordEvent(s,{type:a,source:"system",title:"Mode changed",message:`${(u==null?void 0:u.previousMode)||"unknown"} -> ${d||"unknown"}${g}`,status:(u==null?void 0:u.success)===!1?"failed":"completed",data:u});break}case"goal_created":{c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal created",message:u!=null&&u.goalId?`Goal ${u.goalId}`:"Goal created",status:"pending",data:u});break}case"goal_tasks":{const d=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((p,g)=>Py(p,s,g)):[];c.setTasks(s,d,"goal"),we.getState().setSessionTasks(s,d.map(Xr)),c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||"Goal tasks",message:`${d.length} tasks`,status:"pending",data:u});break}case"goal_task_update":{const d=String((u==null?void 0:u.taskId)||(u==null?void 0:u.id)||""),p=d_(s,u);c.recordEvent(s,{type:a,source:"goal",title:(p==null?void 0:p.title)||d||"Goal task update",message:(u==null?void 0:u.result)||(u==null?void 0:u.error)||(u!=null&&u.status?`status: ${u.status}`:"updated"),status:p==null?void 0:p.status,taskId:d||void 0,data:u});break}case"goal_update":{const d=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((p,g)=>Py(p,s,g)):[];c.setTasks(s,d,"goal"),we.getState().setSessionTasks(s,d.map(Xr)),c.recordEvent(s,{type:a,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal update",message:(u==null?void 0:u.status)||(u!=null&&u.id?`Goal ${u.id}`:"Goal updated"),status:u!=null&&u.status?Xn(u.status):void 0,data:u});break}case"goal_completed":{const d=String((u==null?void 0:u.goalId)||""),p=c.getTasksForSession(s).filter(g=>g.source==="goal");if(p.length>0){const g=p.map(y=>y.status==="pending"||y.status==="running"?{...y,status:"completed",completedAt:Date.now(),updatedAt:Date.now()}:y);c.setTasks(s,g,"goal"),we.getState().setSessionTasks(s,g.map(Xr))}c.recordEvent(s,{type:a,source:"goal",title:u!=null&&u.goalTitle?`Goal 完成: ${String(u.goalTitle).slice(0,60)}`:"Goal completed",message:u!=null&&u.result?String(u.result).slice(0,200):d?`Goal ${d} completed`:"Goal completed",status:"completed",data:u});break}}}const f_={confirm:"确认",cancel:"取消",save:"保存",saving:"保存中...",delete:"删除",close:"关闭",refresh:"刷新",retry:"重试",loading:"加载中...",collapse:"折叠",expand:"展开",collapse_short:"收起",clear:"清空",noData:"暂无数据",noResults:"暂无结果",unknown:"未知",unknownError:"未知错误",connecting:"连接中…",back:"返回",send:"发送",copy:"复制",copied:"已复制",search:"搜索...",filter:"全部",pageInfo:"显示 {{start}}-{{end}} 条,共 {{total}} 条",prevPage:"上一页",nextPage:"下一页",enabled:"已启用",disabled:"已禁用",online:"在线",offline:"离线",busy:"忙碌",away:"离开",default:"默认"},p_={chat:"对话",terminal:"终端",files:"文件",models:"模型",tools:"工具",skills:"技能",templates:"预设",hooks:"Hooks",agentFlow:"Agent Flow",settings:"设置",logs:"日志",channels:"频道",sessions:"会话",groupWorkspace:"工作台",groupConfig:"配置",groupSystem:"系统",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",moreOptions:"更多",scheduled:"定时任务",plugins:"插件",mySessions:"我的会话",sessionRunning:"运行中",sessionWaiting:"待确认",sessionFailed:"失败",sessionDone:"已完成",connectors:"连接器",pin:"置顶",unpin:"取消置顶",pinMore:"置顶「更多」",unpinMore:"取消置顶「更多」"},h_={newSession:"新建会话",noSessions:"暂无会话",renameSession:"重命名会话",exportMd:"导出为 Markdown",you:"你",thinkingEllipsis:"思考中…",messageRail:"消息导航",messageIndex:"对话索引",backToBottom:"回到最新消息",generatingPlaceholder:"AI 正在生成中…",defaultSessionTitle:"对话 {{n}}",welcome:"欢迎使用 deepseekcode",welcomeDesc:"我可以帮你编写代码、分析项目、自动化任务。试试发送一条消息吧!",suggestionCode:"代码编写",suggestionCodePrompt:"用 Python 实现快速排序,并解释它的时间复杂度",suggestionAnalyze:"代码分析",suggestionAnalyzePrompt:"分析当前项目的目录结构,告诉我它是如何组织的",suggestionAutomate:"自动化任务",suggestionAutomatePrompt:"帮我写一个脚本,自动整理当前目录下的文件",quickCommands:"查看快捷命令",refFiles:"引用文件",inputPlaceholder:"输入消息... Shift+Enter 换行,/ 命令,@ 引用文件,↑ 历史",charTokens:"{{chars}} 字符 · ~{{tokens}} tokens",nearLimit:"接近上限",shiftEnter:"Shift+Enter 换行",escHint:"Esc 暂停 · 双击 Esc 停止",resume:"恢复",resumeGen:"恢复生成",stop:"终止",stopGen:"终止生成",pause:"暂停",pauseGen:"暂停生成",sendBtn:"发送",voiceInput:"语音输入",voiceListening:"正在聆听...",voiceTranscribing:"识别中...",voiceUnsupported:"当前浏览器不支持语音输入",voiceError:"语音识别出错,请重试",connected:"已连接",disconnected:"未连接",sessionHistory:"会话历史",noHistory:"暂无历史会话",clearHistory:"清空历史",clearHistoryTitle:"清空历史",restoreSession:"点击恢复「{{title}}」",removeFromHistory:"从历史移除",viewAllSessions:"更多会话",allSessions:"全部会话",sessionPickerTitle:"选择会话",clickToOpenSession:"打开会话",workingDir:"工作目录",switchDir:"切换",clickToSwitchDir:"点击切换工作目录",switchDirPrompt:"请输入新的工作目录路径:",addTask:"添加",addTaskPlaceholder:"添加任务...",noTasks:"暂无任务,在上方输入添加",taskBoardDragHint:"下拉展开 · 上推收起 · 点击切换",doubleClickEdit:"双击编辑",deleteTask:"删除任务",backgroundLogs:"后台日志",effort:"推理力度",effortOff:"关闭思考",effortLow:"低",effortMedium:"中",effortHigh:"高",effortExtraHigh:"超高",effortMax:"最高",noWorkspaceDir:"未设置工作目录",recentDirs:"最近记录",noRecentDirs:"暂无最近目录",chooseOtherDir:"选择其他目录…",dirPickerTitle:"选择工作目录",dirPickerEnterPath:"输入完整路径后回车跳转",dirPickerGo:"跳转",dirPickerUp:"上一级",dirPickerNoDirs:"无子目录",dirPickerConfirm:"选择此目录",dirPickerLoadError:"目录读取失败",artifactPanel:"AI 输出物",workspaceTitle:"工作台",workspaceToggle:"切换到工作台",artifactsToggle:"切换到输出物",workspaceHint:"工作台为 AI Agent 工作区:组件按动态布局加载,可响应事件与命令。",artifactEmpty:"暂无输出文件。点击聊天中的文件 / 路径链接即可在右侧预览。",artifactHint:"点击聊天中的文件 / 路径链接即可在右侧预览;拖拽边缘可调整宽度,右上角可最大化",previewInPanel:"预览",backToArtifacts:"返回清单",openInNewTab:"新标签页打开",copyPath:"复制路径",copiedPath:"已复制路径",copyPathFailed:"复制失败",filePreviewHint:"该文件类型不支持内嵌预览,可下载或在新标签页中打开。",sidebarProgress:"进度",sidebarArtifacts:"AI 输出物",sidebarOpen:"打开",sidebarOpenFolder:"打开首个输出文件",sidebarExpandAll:"展开全部",sidebarMaximize:"最大化",sidebarRestore:"恢复大小",sidebarWorking:"正在处理…",sidebarWorkingWithAgents:"正在处理({{n}} 个 Agent 运行中)…",sidebarWorkingToolcalls:"正在处理(已调用 {{n}} 次工具)…",sidebarIdle:"多步骤任务运行时,进度会显示在这里:计划、工具调用、审批与产出文件。",sidebarMoreTasks:"更多任务",sidebarRunningAgents:"{{n}} 个 Agent 运行中",sidebarToolcallsSoFar:"已调用 {{n}} 次工具",tokenPrompt:"提示词",tokenCompletion:"补全",tokenTotal:"总计",totalChars:"总字符数",avgTokens:"平均 token/条",estimatedCost:"预估成本: ${{cost}}",contextTrimming:"上下文裁剪",keepMore:"保留更多",trimMore:"裁剪更多",trimContext:"裁剪上下文 (保留 ~{{n}} 条消息)",currentMessages:"当前 {{n}} 条消息",totalCharsInfo:"· 共 {{n}} 字符",contextManager:"上下文管理",showContext:"显示上下文信息",taskBoard:"任务看板",morePending:"还有 {{n}} 个待处理任务...",moreCompleted:"还有 {{n}} 个已完成任务...",dependencyCount:"🔗 依赖 {{n}} 个任务",contextSuggestions:"展开 ({{n}}条建议)",collapseSuggestions:"收起",toolRequest:"工具请求: ",toolResult:"工具结果: ",memory:"记忆: ",filesCount:"({{n}}文件)",saveTokens:"可节省 ~{{n}}",ignoreSuggestion:"忽略此建议",fileMention:"@ 引用文件",fileMentionSearch:'@ 搜索: "{{query}}"',fileMentionHelp:"↑↓ 选择 · Enter 插入 · Esc 关闭",fileBrowser:"文件浏览器",fileSaved:"文件已保存",fileReadError:"读取文件失败",fileSaveError:"保存失败",fileModified:"● 已修改",selectFilePreview:"选择文件以预览或编辑",kbdHint:"命令面板",clickToSwitchMode:"点击切换模式 (Plan → Goal → Act)",selectModel:"选择模型",clickToSelectModel:"选择模型 / 推理力度",noEnabledModels:"暂无可用模型",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",assistantLabel:"DeepSeekCode",thoughtProcess:"思维过程",runningSteps:"执行中",stepCount:"步",stepCountPlural:"步",copyMessage:"复制",regenerate:"重新生成",deleteMessage:"删除消息",historyCount:"{{n}} 条",startChatHint:"请先开始对话",panelTitle:"面板",messageDeleted:"消息已删除",thinking:"思考中"},m_={title:"键盘快捷键",commandPalette:"打开命令面板",clearLogs:"清空日志",help:"显示快捷键帮助",submit:"提交输入",newline:"换行",closeDialog:"关闭弹窗 / 暂停生成",slashCommand:"快捷命令",fileRef:"引用文件",stopGen:"终止生成(连按两次 Esc)"},g_={placeholder:"搜索命令或跳转面板...",navGroup:"导航",commandGroup:"命令",empty:"没有匹配的命令",hint:"↑↓ 选择 · Enter 执行 · Esc 关闭",running:"执行中..."},y_={openMenu:"打开菜单",closeMenu:"关闭菜单",close:"关闭",expand:"展开",collapse:"折叠",delete:"删除",remove:"移除",send:"发送消息",newSession:"新建会话",messageInput:"消息输入框",connectionStatus:"连接状态",loading:"加载中",toggleAgentFlow:"切换 Agent 信息流",commandPalette:"命令面板",shortcutsHelp:"快捷键帮助"},b_={mode:"模式",planMode:"Plan 模式 — 只读分析",planModeDesc:"在 Plan 模式下,AI 将使用只读工具分析需求和代码,不会修改任何文件。",planModeHint:"分析完成后,请切换到 Act 模式执行具体实现。",switchToAct:"切换到 Act 模式执行",actMode:"Act 模式",actModeDesc:"在 Act 模式下,AI 可以读取、修改文件并执行命令。",actModeHint:"需要先分析需求?切换到 Plan 模式进行只读探索。",switchToPlan:"切换到 Plan 模式分析",readOnlyMode:"只读模式",planTitle:"Plan Mode:只读探索,不能修改代码",actTitle:"Act Mode:可以读写和执行",switchToPlanMode:"切换到规划模式",switchToActMode:"切换到执行模式",autoMode:"自动模式:自动批准工具调用",goalMode:"Goal 模式",planModeShort:"只读分析与规划,不修改文件",actModeShort:"读写文件并执行命令",goalModeShort:"围绕目标持续推进直到完成",autoApprove:"Auto 自动批准",autoApproveShort:"自动批准所有工具调用",planContent:"Plan 文件内容",analyzing:"正在分析需求..."},x_={title:"设置",theme:"主题",themeDark:"🌙 深色",themeLight:"☀️ 浅色",themeAuto:"🔄 自动",themePresets:"主题预设",themePresetLinear:"极简 Linear",themePresetLinearDesc:"中性灰 + 单一强调色 — 极简专业",themePresetGithub:"GitHub 默认",themePresetGithubDesc:"中性暗/亮色 — 简洁专业",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"蓝色渐变 — 清爽科技感",themePresetOcean:"海洋 Ocean",themePresetOceanDesc:"深蓝/青色 — 冷静专业",themePresetMint:"薄荷 Mint",themePresetMintDesc:"青绿/薄荷 — 清新爽朗",themePresetLavender:"薰衣草 Lavender",themePresetLavenderDesc:"柔紫 — 优雅精致",themePresetMidnight:"午夜 Midnight",themePresetMidnightDesc:"深海军蓝 — 极简高对比",themePresetSunset:"日落 Sunset",themePresetSunsetDesc:"暖橙/金色 — 活力充沛",themePresetForest:"森林 Forest",themePresetForestDesc:"自然绿 — 大地色系宁静",themePresetCandy:"糖果 Candy",themePresetCandyDesc:"明亮多彩 — 活泼生动",themePresetNord:"Nord",themePresetNordDesc:"北极蓝 — 流行精心设计",customOverrides:"自定义覆盖",customOverridesHint:"调整单个颜色以覆盖当前主题预设",customColors:"自定义配色",colorBg:"背景色",colorSurface:"面板色",colorBorder:"边框色",colorText:"文字色",colorMuted:"次要文字",colorAccentBlue:"强调蓝",colorAccentGreen:"强调绿",colorAccentRed:"强调红",colorAccentYellow:"强调黄",colorAccentPurple:"强调紫",resetColors:"重置为默认配色",about:"关于",aboutDesc:"基于 Web 的 AI 编码助手界面",language:"语言",languageZh:"中文",languageEn:"English",display:"界面",developerView:"开发者视图(显示原始工具调用)",developerViewHint:"默认显示 AI 活动摘要;开启后显示原始工具日志"},v_={title:"模型配置",providerConfig:"Provider 配置",configured:"已配置",notConfigured:"未配置",modelsCount:"{{n}} 个模型 · {{apiType}}",clickToConfig:"点击配置 →",apiKeyHint:"已配置 API Key,输入新 Key 将覆盖旧配置。",apiKeyPlaceholder:"输入新 Key 以覆盖...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"请输入 API Key",removeConfirm:'确定要移除 "{{providerKey}}" 的配置吗?这将删除其 API Key 和模型。',loadFailed:"加载模型失败",saveFailed:"保存失败",overallStatus:"总体状态",healthy:"健康",degraded:"降级",abnormal:"异常",healthRate:"健康率",onlineInstances:"在线实例",totalRequests:"总请求数",configuredModels:"已配置模型",addModel:"添加模型",provider_qwen:"通义千问 (Qwen)",provider_glm:"智谱 (GLM)",provider_baichuan:"百川 (Baichuan)",provider_minimax:"MiniMax / 海螺",provider_doubao:"豆包 (Doubao)",provider_hunyuan:"腾讯混元 (Hunyuan)",provider_spark:"讯飞星火 (Spark)",provider_custom:"Custom (自定义)"},S_={title:"工具列表",searchTools:"搜索工具...",disabled:"禁用",enabled:"启用",params:"参数",loadFailed:"加载工具失败",noTools:"暂无工具"},k_={title:"技能管理",list:"技能列表",noSkills:"暂无技能",loadFailed:"加载技能失败",loadFailedFallback:"加载失败",enable:"启用",disable:"禁用",enabled:"已启用",disabled:"已关闭",new:"新建技能",import:"导入",importTitle:"导入技能",edit:"编辑",save:"保存",cancel:"取消",retry:"重试",refresh:"刷新",tags:"标签",none:"无",source:"来源",localSkill:"本地技能",systemPrompt:"系统提示词",selectSkill:"选择一个技能",fieldId:"ID",fieldName:"名称",fieldCategory:"分类",fieldTrigger:"触发词",fieldTools:"所需工具",description:"描述",saving:"保存中",chooseFile:"选择技能文件",importHint:"支持 .skill.md 文件",marketplace:"技能市场",marketplaceDesc:"从远程市场浏览并安装技能",marketplaceTitle:"技能市场",addMarketplace:"添加市场",addMarketplaceTitle:"添加技能市场",marketplaceUrl:"市场地址",marketplaceUrlPlaceholder:"GitHub 仓库 / index.json 链接 / 本地技能文件夹,如 https://github.com/obra/superpowers 或 D:\\agent\\agentic-awesome-skills",marketplaceName:"市场名称(可选)",marketplaceHint:"支持 GitHub 仓库(自动扫描 skills/ 目录)、返回 index.json 的 URL、或本机技能文件夹(完全离线,直接浏览/安装磁盘上的技能库)。GitHub 无法访问时可设置 DEEPSEEKCODE_GITHUB_MIRROR 镜像加速。",marketFilterPlaceholder:"在当前市场搜索技能...",marketCategoryAll:"全部分类",riskCritical:"高危",riskUnknown:"风险未知",refreshMarketplace:"刷新",removeMarketplace:"移除市场",installSkill:"安装",installed:"已安装",installFail:"安装失败",loadMarketplaceFail:"加载技能市场失败",noMarketplaces:"暂无市场,先添加一个",noSkillsInMarket:"该市场暂无技能",marketplaceError:"市场索引加载失败:{{error}}",retryMarket:"重试",presets:"内置市场",marketplaces:"已添加的市场",skillCount:"{{count}} 个技能",installedSkills:"已安装技能",addFail:"添加市场失败",installing:"安装中...",adding:"添加中...",marketplaceTab:"技能市场",mineTab:"我的技能",installedTab:"已安装",workshopTab:"技能工坊",workshopHint:"技能提案:从会话/手动生成,审核后一键应用为技能",workshopPropose:"新建提案",workshopName:"技能名 (skill-name) 如 format-json",workshopTrigger:"触发关键词(可选)",workshopDescription:"一句话描述",workshopContent:"技能正文(系统提示 / 工作流指令)",workshopSubmit:"提交提案",workshopApply:"应用",workshopEmpty:"暂无技能提案",workshopFormRequired:"技能名和正文为必填",uninstall:"卸载",uninstallConfirm:"确定卸载已安装技能「{{name}}」?",uninstalling:"卸载中...",uninstallFail:"卸载失败",pagePrev:"上一页",pageNext:"下一页",pageOf:"第 {{page}} / {{total}} 页",emptyInstalled:"还没有已安装的市场技能",emptyInstalledHint:"前往「技能市场」浏览并下载安装",browseMarket:"去市场逛逛",use:"使用",useHint:"使用此技能:将 $技能名 插入输入框,补充任务描述后发送",pickTitle:"选择技能",pickPlaceholder:"搜索技能...",pickEmpty:"没有可用的技能",pickUse:"点击使用"},w_={permissionRequest:"权限申请",hookApproval:"Hook 拦截审批",hookConfirm:"Hook 请求确认",morePending:"还有 {{n}} 项待审批",tool:"工具:",reason:"原因:",needConfirm:"需要用户确认此操作",allow:"允许",deny:"拒绝",allowAlways:"本次会话始终允许",allowAlwaysDesc:"当前会话中不再询问此工具",autoMode:"自动模式",autoModeLabel:"自动模式(全部允许)",autoModeDesc:"自动批准所有 Hook 请求",moreOptions:"更多选项",highRiskWarning:"此操作可能造成不可逆的影响,请仔细确认",mediumRiskConfirm:"请确认此操作为预期行为",alreadyAllowed:"已允许:",alreadyDenied:"已拒绝:",risk_critical:"破坏性操作 - 可能删除数据",risk_critical_cmd:"高危命令 - 包含系统级操作",risk_high_shell:"Shell 命令执行",risk_high_file:"文件写入操作",risk_high_pkg:"包管理操作",risk_git_force:"Git 强制操作",risk_git:"Git 操作",risk_network:"网络请求",risk_low:"只读操作",risk_default:"工具调用",hookConfigTitle:"自定义 Hook 配置说明",hookConfigDesc:"你可以在项目根目录的 .agent/hooks.json 文件中添加或修改 Hook 拦截规则。",hookConfigDetail:"Hook 支持 SHELL(外部脚本)和 HTTP(REST 端点)两种类型,可以在工具执行前(PRE_TOOL_USE)或执行后(POST_TOOL_USE)触发。",hookConfigBuiltin:"内置了 BashSafetyHook(危险命令拦截)、FileWriteAuditHook(文件写入审计)、ToolUsageStatsHook(工具调用统计)三套 Hook。设置 enabled: false 可禁用任意 Hook。",optionAllow:"允许 — 执行此操作",optionAllowHint:"点击或按 Enter 确认",optionDeny:"拒绝 — 取消此操作",optionDenyHint:"点击或按 Esc 取消",optionAllowAlways:"本次会话始终允许",optionAllowAlwaysHint:"不再询问 {{tool}}",optionAllowPathHint:"不再询问该外部路径",timeoutWaitUser:"等待用户输入(无超时)",optionAutoMode:"自动模式 — 全部允许",optionAutoModeHint:"之后所有 Hook 将自动批准",shortcutHint:"快捷键: 1-4 选择 · Enter 允许 · Esc 拒绝",lastItem:"最后一项",modalHint:"请在弹窗中处理此审批请求",clickToSelect:"点击选择 · 1/2/3/4 键盘快捷键",verbRunCommand:"运行命令",verbWriteFile:"写入文件",verbEditFile:"编辑文件",verbReadFile:"读取文件",verbDeleteFile:"删除文件",verbFindFiles:"查找文件",verbSearchContents:"搜索内容",verbFetchUrl:"请求网络",verbSearchWeb:"搜索网络",verbGit:"Git 操作",verbInstall:"安装依赖",verbSendMessage:"发送消息",verbRunTool:"执行操作",scopeLocal:"作用于当前工作区",scopeExternal:"外部路径",showAllLines:"展开全部 {{n}} 行",showAll:"显示完整内容",showLess:"收起"},__={pending:"等待",thinking:"思考",action:"执行",result:"结果",running:"运行中",error:"错误",completed:"完成",params:"参数"},C_={linesTotal:"… (共 {{n}} 行)",expandAll:"展开全部 ({{n}} 行)",collapse:"收起"},E_={quickCommands:"快捷命令",search:'搜索: "{{filter}}"',help:"↑↓ 选择 · Enter 执行 · Esc 关闭",backend:"后端",backendCommand:"后端命令",chat_desc:"切换到对话面板",chat_result:"已切换到对话面板",terminal_desc:"切换到终端面板",terminal_result:"已切换到终端面板",files_desc:"切换到文件面板",files_result:"已切换到文件面板",models_desc:"切换到模型面板",models_result:"已切换到模型面板",tools_desc:"列出可用工具",tools_result:"已切换到工具面板",skills_desc:"列出可用技能",skills_result:"已切换到技能面板",settings_desc:"切换到设置面板",settings_result:"已切换到设置面板",logs_desc:"切换到日志面板",logs_result:"已切换到日志面板",new_desc:"创建新会话",new_result:"新会话已创建",clear_desc:"清空当前会话消息",clear_result:"消息已清空",theme_desc:"切换主题 (dark/light/auto)",theme_error:"用法: /theme <dark|light|auto>",theme_result:"主题已切换为 ",theme_preset_result:"主题预设已切换为 ",theme_preset_unavailable:"主题预设切换不可用",toggle_terminal_desc:"切换底部终端面板显示",toggle_terminal_result:"终端面板已切换",logs_clear_desc:"清空日志",logs_clear_result:"日志已清空",doctor_desc:"系统自诊断 (Config/API Key/Network/Docker/Disk)",compact_desc:"压缩当前会话上下文",help_desc:"显示所有快捷命令",token_desc:"显示 token 使用量和 API 费用统计",review_desc:"代码审查 — 检查变更的正确性、安全性和代码质量",security_review_desc:"安全审查 — OWASP Top 10 + 命令注入/路径遍历/权限提升",memory_desc:"管理 AI 持久记忆 (list/add/delete/clear)",ps_desc:"查看和管理后台任务、子代理和 shell 进程",model_desc:"查看或切换 AI 模型",status_desc:"显示当前会话状态 (会话ID/消息数/模型/工作目录)",config_desc:"管理应用程序配置 (get/set/list/delete)",exit_desc:"退出应用",exit_result:"正在关闭服务...",benchmark_desc:"运行 DeepSeekCode 能力评测 (simple/medium/complex/full/list)",goal_desc:"设置多步工作目标",goal_list_desc:"列出活跃目标",goal_status_desc:"查看目标进度",workflow_list_desc:"列出工作流运行记录",workflow_status_desc:"查看工作流状态",workflow_checkpoints_desc:"列出工作流检查点",mcp_desc:"列出或重新加载 MCP 服务器",sessions_desc:"列出会话",resume_desc:"按 ID 恢复会话",permissions_desc:"显示权限规则和待审批项",init_desc:"生成 agent.md 项目指导文件",self_test_desc:"运行工具能力自测并生成报告",context_desc:"显示上下文分析报告",version_desc:"显示版本信息","check-update_desc":"检查可用更新",upgrade_desc:"升级到最新版本",acceptance_desc:"运行或检查验收工作流 (quick/full/list/report)",diff_desc:"查看未提交的 Git 变更",summary_desc:"总结当前会话内容",effort_desc:"显示或设置推理力度 (low|medium|high)",export_desc:"导出当前会话为 JSON",rename_desc:"重命名当前会话",hooks_desc:"显示活跃钩子配置",cost_desc:"显示预估会话成本",sent_command:"已发送命令 ",noActiveSession:"无活跃会话",unknownCommand:"未知命令 {{cmd}} — 输入 /help 查看可用命令"},N_={pageError:"页面出现错误",unknownError:"发生了未知错误,请尝试刷新页面",refreshPage:"刷新页面",genEnded:"生成已结束(工具执行超时或连接中断)"},T_={backendConnected:"后端已连接",backendDisconnected:"后端连接断开,正在重连...",paused:"已暂停,再按 ESC 终止",terminated:"已终止 (ESC×2)",contextCompressed:"上下文压缩: {{original}} → {{compressed}} 条消息, 释放 {{saved}} tokens",errorPrefix:"❌ 错误: {{error}}",uncaughtError:"未捕获错误:",uncaughtRejection:"未捕获的 Promise 拒绝: ",unknownReason:"未知原因",diagnosing:"⏳ 诊断中...",runDiagnostic:"🔍 运行诊断",inspectorOn:"开启检查模式 (Ctrl+Shift+Alt+C)",inspectorOff:"关闭检查模式"},A_={title:"频道管理",subtitle:"接入外部 IM 平台,通过微信、飞书、钉钉等与 AI 交互",newChannel:"新建频道",editChannel:"编辑频道",table:{name:"频道名称",type:"类型",appId:"App ID",status:"连接状态",enabled:"启用",actions:"操作"},status:{connected:"已连接",disconnected:"未连接",connecting:"连接中",error:"错误"},empty:"还没有配置任何频道",emptyHint:"点击「新建频道」添加一个 IM 平台机器人",form:{basicInfo:"基础信息",name:"频道名称",namePlaceholder:"例如:公司群机器人",type:"频道类型",credentials:"凭证信息",appId:"App ID / 企业ID",appIdPlaceholder:"填写应用 AppID",appSecret:"App Secret",appSecretPlaceholder:"填写应用密钥",token:"Token / Bot Token",tokenPlaceholder:"填写机器人 Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"仅微信需要,可选",enabled:"启用频道",wechatQrHint:"保存后可使用微信扫码登录",feishuWsHint:"飞书使用 WebSocket 连接,自动接收消息"},actions:{scanQr:"扫码",edit:"编辑",delete:"删除",deleteConfirm:"确定要删除此频道?",test:"测试连接",save:"保存频道",cancel:"取消"},errors:{loadFailed:"加载频道列表失败",createFailed:"创建频道失败",updateFailed:"更新频道失败",deleteFailed:"删除频道失败",notFound:"频道未找到",notImplemented:"尚未实现",nameRequired:"频道名称不能为空"},qr:{title:"微信扫码登录",generating:"二维码生成中...",waiting:"请使用微信扫描二维码",scanned:"已扫描,请在手机上确认",confirmed:"登录成功",expired:"二维码已失效",expiredHint:"点击重试重新生成二维码",error:"获取二维码失败",openInNewTab:"在新标签页打开"},typeLabels:{wechat:"微信",feishu:"飞书",dingtalk:"钉钉",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"}},j_={stageUploaded:"等待处理",stageParsing:"正在解析数据文件",stageMapping:"模板映射",stageRendering:"正在生成文件",stageComplete:"文件处理完成",stageError:"文件处理失败",parsing:"正在解析 {{file}} …",parsedSummary:"{{rows}} 行 · {{fields}} 个字段",mappingTitle:"模板 ↔ 数据字段映射",templatePlaceholder:"模板占位符",dataField:"数据字段",mappingMore:"另有 {{n}} 个映射",rendering:"正在逐条生成 {{current}}/{{total}} …",download:"下载",downloadFailed:"下载失败",error:"处理失败",roleData:"数据文件",roleTemplate:"模板文件",attach:"上传文件或图片,支持多选",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed"},R_={reconnecting:"重连中 {{attempt}}/{{max}}",hint:"正在重新连接后端…"},O_={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},M_={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"变更统计",clean:"工作区干净",branch:"分支",upstream:"相对上游",commit:"提交",push:"推送",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},B_={retry:"重试",details:"详情",modelSettings:"模型设置"},D_={comingSoon:"即将上线"},L_={lspGroup:"语言服务器 (LSP)",mcpGroup:"MCP 服务器",notInstalled:"未安装",installed:"已安装",ready:"已连接",connecting:"连接中",installing:"安装中…",error:"错误",disabled:"已禁用",toolCount:"{{count}} 个工具",docs:"文档",official:"官方",cloud:"云端",local:"本地",needCredentials:"此连接器需要凭据才能启动:",connect:"连接",missing:"未配置",envConfigured:"已配置",searchPlaceholder:"搜索连接器(名称、id、描述)…",all:"全部",noResults:"没有匹配的连接器。",custom:"自定义",addCustom:"添加自定义",customTitle:"添加自定义 MCP 服务器(来自 awesome-mcp-servers 或自建)",customName:"名称 (id)",customCommand:"启动命令",customArgs:"参数(空格分隔)",customEnv:"环境变量(KEY=value,逗号分隔)",customUrl:"MCP 端点 URL",customHeaders:"请求头(KEY=value,逗号分隔)",customLocal:"本地命令",customFormRequired:"名称和启动命令/URL 必填。",removeCustom:"删除此自定义连接器",add:"添加"},z_={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",daysAgo:"{{count}}天前"},U_={title:"语音输入(英语 whisper / 中文 FunASR)",stopTitle:"停止录音并转写",langToggle:"切换识别语言:英语(whisper)/ 中文(FunASR)",noSpeech:"未识别到语音内容,请重试",backendMissing:"语音服务未就绪,已打开设置页引导安装",setup:{title:"语音服务",envCard:"运行环境检测",envChecking:"检测中…",recheck:"重新检测",pythonOk:"Python {{version}} 已就绪",pythonMissing:"未检测到 Python,请先安装 Python 3.10+",pythonGuide:"下载安装 Python",pipOk:"pip 可用",pipMissing:"pip 缺失,请先安装 pip 后再安装语音引擎",pipGuide:"执行以下命令修复 pip(再失败可参考 get-pip.py 官方方案):",whisperTitle:"Whisper · 英语",whisperDesc:"英语语音识别",funasrTitle:"FunASR · 中文",funasrDesc:"中文语音识别",installed:"已安装",notInstalled:"未安装",install:"一键安装",installing:"安装中…",cancel:"取消安装",installDone:"安装完成,可回到聊天页使用语音输入",installFailed:"安装失败",installTimeout:"安装超时",installCancelled:"安装已取消",jobInProgress:"已有安装任务进行中,正在接管进度",manualCommand:"手动安装命令",copyCommand:"复制命令",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",torchHint:"中文引擎需安装 torch,体积较大,请耐心等待",logWaiting:"正在准备安装…",chooseHint:"环境已就绪,请选择上方引擎进行安装",defaultEngine:"默认识别引擎",defaultEngineHint:"选择语音输入默认使用的引擎,可在聊天输入框随时切换",inUse:"使用中",engineNotInstalledHint:"该引擎尚未安装,选中后录音时会引导安装"}},$_={verb:{researching:"分析代码",coding:"修改代码",validating:"运行验证",summarizing:"整理结果"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} 项"},evidenceMore:"等 {{count}} 项",toolCallCount:"{{count}} 次工具调用",toolNamesMore:"等 {{count}} 个工具",waitingUser:"等待你的回答",blocked:"被阻塞:{{reason}}",paused:"已暂停,可恢复",viewAndAnswer:"查看并回答",evidence:"执行明细",phase:{analysis:"分析",implementation:"实现",optimization:"优化"}},H_={next:"下一步",idle:"空闲"},Fy={common:f_,nav:p_,chat:h_,shortcuts:m_,palette:g_,a11y:y_,plan:b_,settings:x_,models:v_,tools:S_,skills:k_,hook:w_,step:__,toolCall:C_,slashCommands:E_,error:N_,toast:T_,channels:A_,fileJob:j_,reconnect:R_,autoAccess:O_,git:M_,errorCard:B_,placeholder:D_,connectors:L_,time:z_,stt:U_,activity:$_,taskbar:H_},I_={confirm:"Confirm",cancel:"Cancel",save:"Save",saving:"Saving...",delete:"Delete",close:"Close",refresh:"Refresh",retry:"Retry",loading:"Loading...",collapse:"Collapse",expand:"Expand",collapse_short:"Collapse",clear:"Clear",noData:"No data",noResults:"No results",unknown:"Unknown",unknownError:"Unknown error",connecting:"Connecting…",back:"Back",send:"Send",copy:"Copy",copied:"Copied",search:"Search...",filter:"All",pageInfo:"Showing {{start}}-{{end}} of {{total}}",prevPage:"Previous",nextPage:"Next",enabled:"Enabled",disabled:"Disabled",online:"Online",offline:"Offline",busy:"Busy",away:"Away",default:"Default"},P_={chat:"Chat",terminal:"Terminal",files:"Files",models:"Models",tools:"Tools",skills:"Skills",templates:"Presets",hooks:"Hooks",agentFlow:"Agent Flow",settings:"Settings",logs:"Logs",channels:"Channels",sessions:"Sessions",groupWorkspace:"Workspace",groupConfig:"Configuration",groupSystem:"System",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",moreOptions:"More",scheduled:"Scheduled",plugins:"Plugins",mySessions:"My sessions",sessionRunning:"Running",sessionWaiting:"Awaiting confirmation",sessionFailed:"Failed",sessionDone:"Completed",connectors:"Connectors",pin:"Pin to top",unpin:"Unpin",pinMore:"Pin 'More' to top",unpinMore:"Unpin 'More'"},F_={newSession:"New Session",noSessions:"No sessions yet",renameSession:"Rename session",exportMd:"Export as Markdown",you:"You",thinkingEllipsis:"Thinking…",messageRail:"Message navigation",messageIndex:"Conversation index",backToBottom:"Back to latest",generatingPlaceholder:"AI is generating…",defaultSessionTitle:"Chat {{n}}",welcome:"Welcome to deepseekcode",welcomeDesc:"I can help you write code, analyze projects, and automate tasks. Try sending a message!",suggestionCode:"Code Writing",suggestionCodePrompt:"Implement quicksort in Python and explain its time complexity",suggestionAnalyze:"Code Analysis",suggestionAnalyzePrompt:"Analyze the current project structure and explain how it is organized",suggestionAutomate:"Automation",suggestionAutomatePrompt:"Write a script to organize the files in the current directory",quickCommands:"View quick commands",refFiles:"Reference files",inputPlaceholder:"Type a message... Shift+Enter for newline, / commands, @ file refs, ↑ history",charTokens:"{{chars}} chars · ~{{tokens}} tokens",nearLimit:"Near limit",shiftEnter:"Shift+Enter newline",escHint:"Esc to pause · Double-Esc to stop",resume:"Resume",resumeGen:"Resume generation",stop:"Stop",stopGen:"Stop generation",pause:"Pause",pauseGen:"Pause generation",sendBtn:"Send",voiceInput:"Voice Input",voiceListening:"Listening...",voiceTranscribing:"Transcribing...",voiceUnsupported:"Voice input is not supported in this browser",voiceError:"Voice recognition error, please try again",connected:"Connected",disconnected:"Disconnected",sessionHistory:"Session History",noHistory:"No history sessions",clearHistory:"Clear history",clearHistoryTitle:"Clear history",restoreSession:'Click to restore "{{title}}"',removeFromHistory:"Remove from history",viewAllSessions:"More sessions",allSessions:"All sessions",sessionPickerTitle:"Select session",clickToOpenSession:"Open session",workingDir:"Working Directory",switchDir:"Switch",clickToSwitchDir:"Click to switch working directory",switchDirPrompt:"Enter new working directory path:",addTask:"Add",addTaskPlaceholder:"Add task...",noTasks:"No tasks, add one above",taskBoardDragHint:"Drag down to expand · drag up to collapse · click to toggle",doubleClickEdit:"Double-click to edit",deleteTask:"Delete task",backgroundLogs:"Background Logs",effort:"Effort",effortOff:"Thinking off",effortLow:"Low",effortMedium:"Medium",effortHigh:"High",effortExtraHigh:"Extra high",effortMax:"Max",noWorkspaceDir:"No working directory",recentDirs:"Recent directories",noRecentDirs:"No recent directories",chooseOtherDir:"Choose another directory…",dirPickerTitle:"Select working directory",dirPickerEnterPath:"Type a full path and press Enter",dirPickerGo:"Go",dirPickerUp:"Up",dirPickerNoDirs:"No subdirectories",dirPickerConfirm:"Select this directory",dirPickerLoadError:"Failed to load directory",artifactPanel:"AI Outputs",workspaceTitle:"Workspace",workspaceToggle:"Switch to workspace",artifactsToggle:"Switch to outputs",workspaceHint:"AI Agent workspace: components load into a dynamic layout and respond to events and commands.",artifactEmpty:"No output files yet. Click a file/path link in the chat to preview it here.",artifactHint:"Click a file/path link in the chat to preview it here — drag the panel edge to resize, or use the maximize button in the corner",previewInPanel:"Preview",backToArtifacts:"Back to list",openInNewTab:"Open in new tab",copyPath:"Copy path",copiedPath:"Path copied",copyPathFailed:"Failed to copy",filePreviewHint:"This file type can't be previewed inline — download it or open it in a new tab.",sidebarProgress:"Progress",sidebarArtifacts:"AI Outputs",sidebarOpen:"Open",sidebarOpenFolder:"Open first output file",sidebarExpandAll:"Expand all",sidebarMaximize:"Maximize",sidebarRestore:"Restore size",sidebarWorking:"Working on this…",sidebarWorkingWithAgents:"Working ({{n}} agent(s) running)…",sidebarWorkingToolcalls:"Working ({{n}} tool call(s))…",sidebarIdle:"Progress for multi-step tasks shows up here: planning, tool calls, approvals, and produced files.",sidebarMoreTasks:"more tasks",sidebarRunningAgents:"{{n}} agent(s) running",sidebarToolcallsSoFar:"{{n}} tool call(s) so far",tokenPrompt:"Prompt",tokenCompletion:"Completion",tokenTotal:"Total",totalChars:"Total chars",avgTokens:"Avg tokens/msg",estimatedCost:"Est. cost: ${{cost}}",contextTrimming:"Context Trimming",keepMore:"Keep more",trimMore:"Trim more",trimContext:"Trim context (keep ~{{n}} messages)",currentMessages:"{{n}} messages",totalCharsInfo:"· {{n}} chars total",contextManager:"Context Manager",showContext:"Show context info",taskBoard:"Task Board",morePending:"{{n}} more pending...",moreCompleted:"{{n}} more completed...",dependencyCount:"🔗 {{n}} dependencies",contextSuggestions:"Expand ({{n}} suggestions)",collapseSuggestions:"Collapse",toolRequest:"Tool request: ",toolResult:"Tool result: ",memory:"Memory: ",filesCount:"({{n}} files)",saveTokens:"Save ~{{n}}",ignoreSuggestion:"Ignore suggestion",fileMention:"@ Reference file",fileMentionSearch:'@ Search: "{{query}}"',fileMentionHelp:"↑↓ Select · Enter Insert · Esc Close",fileBrowser:"File Browser",fileSaved:"File saved",fileReadError:"Failed to read file",fileSaveError:"Save failed",fileModified:"● Modified",selectFilePreview:"Select a file to preview or edit",kbdHint:"command palette",clickToSwitchMode:"Click to toggle mode (Plan → Goal → Act)",selectModel:"Select model",clickToSelectModel:"Select model / reasoning effort",noEnabledModels:"No enabled models",globalDefault:"Global default",planDefault:"Plan default",actDefault:"Act default",goalDefault:"Goal default",assistantLabel:"DeepSeekCode",thoughtProcess:"Thought process",runningSteps:"Running",stepCount:"step",stepCountPlural:"steps",copyMessage:"Copy",regenerate:"Regenerate",deleteMessage:"Delete message",historyCount:"{{n}} items",startChatHint:"Start a conversation first",panelTitle:"Panel",messageDeleted:"Message deleted",thinking:"Thinking"},G_={title:"Keyboard Shortcuts",commandPalette:"Open command palette",clearLogs:"Clear logs",help:"Show shortcuts help",submit:"Submit input",newline:"New line",closeDialog:"Close dialog / pause generation",slashCommand:"Quick commands",fileRef:"Reference files",stopGen:"Stop generation (double Esc)"},q_={placeholder:"Search commands or jump to panel...",navGroup:"Navigation",commandGroup:"Commands",empty:"No matching commands",hint:"↑↓ Select · Enter Run · Esc Close",running:"Running..."},V_={openMenu:"Open menu",closeMenu:"Close menu",close:"Close",expand:"Expand",collapse:"Collapse",delete:"Delete",remove:"Remove",send:"Send message",newSession:"New session",messageInput:"Message input",connectionStatus:"Connection status",loading:"Loading",toggleAgentFlow:"Toggle agent flow",commandPalette:"Command palette",shortcutsHelp:"Shortcuts help"},W_={mode:"Mode",planMode:"Plan Mode — Read-only analysis",planModeDesc:"In Plan mode, AI uses read-only tools to analyze requirements and code without modifying any files.",planModeHint:"After analysis, switch to Act mode to implement changes.",switchToAct:"Switch to Act mode",actMode:"Act Mode",actModeDesc:"In Act mode, AI can read, modify files, and execute commands.",actModeHint:"Need to analyze first? Switch to Plan mode for read-only exploration.",switchToPlan:"Switch to Plan mode",readOnlyMode:"Read-only",planTitle:"Plan Mode: Read-only exploration, cannot modify code",actTitle:"Act Mode: Full read/write access",switchToPlanMode:"Switch to plan mode",switchToActMode:"Switch to act mode",autoMode:"Auto mode: auto-approve tool calls",goalMode:"Goal Mode",planModeShort:"Read-only analysis and planning",actModeShort:"Read/write files and run commands",goalModeShort:"Keep working toward the goal until done",autoApprove:"Auto Approve",autoApproveShort:"Auto-approve all tool calls",planContent:"Plan file content",analyzing:"Analyzing requirements..."},K_={title:"Settings",theme:"Theme",themeDark:"🌙 Dark",themeLight:"☀️ Light",themeAuto:"🔄 Auto",themePresets:"Theme Presets",themePresetLinear:"Linear (minimal)",themePresetLinearDesc:"Neutral grays with a single accent — clean and focused",themePresetGithub:"GitHub",themePresetGithubDesc:"Neutral dark/light — clean and professional",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"Blue gradient inspired — clean tech feel",themePresetOcean:"Ocean",themePresetOceanDesc:"Deep blue/cyan — calm and professional",themePresetMint:"Mint",themePresetMintDesc:"Teal/mint green — fresh and refreshing",themePresetLavender:"Lavender",themePresetLavenderDesc:"Soft purple — elegant and sophisticated",themePresetMidnight:"Midnight",themePresetMidnightDesc:"Deep navy — minimal and high contrast",themePresetSunset:"Sunset",themePresetSunsetDesc:"Warm orange/golden — energetic",themePresetForest:"Forest",themePresetForestDesc:"Natural green — earthy and calm",themePresetCandy:"Candy",themePresetCandyDesc:"Bright multi-color — vibrant and lively",themePresetNord:"Nord",themePresetNordDesc:"Arctic blue — popular well-designed palette",customOverrides:"Custom Overrides",customOverridesHint:"Tweak individual colors to override the active preset",customColors:"Custom Colors",colorBg:"Background",colorSurface:"Surface",colorBorder:"Border",colorText:"Text",colorMuted:"Muted Text",colorAccentBlue:"Accent Blue",colorAccentGreen:"Accent Green",colorAccentRed:"Accent Red",colorAccentYellow:"Accent Yellow",colorAccentPurple:"Accent Purple",resetColors:"Reset to default",about:"About",aboutDesc:"Web-based AI coding assistant interface",language:"Language",languageZh:"中文",languageEn:"English",display:"Display",developerView:"Developer view (show raw tool calls)",developerViewHint:"Shows the AI activity feed by default; enable to see raw tool logs"},Y_={title:"Model Configuration",providerConfig:"Provider Config",configured:"Configured",notConfigured:"Not configured",modelsCount:"{{n}} models · {{apiType}}",clickToConfig:"Click to configure →",apiKeyHint:"API Key configured. Enter new key to overwrite.",apiKeyPlaceholder:"Enter new key to overwrite...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"Please enter API Key",removeConfirm:'Are you sure you want to remove "{{providerKey}}" configuration? This will delete its API Key and models.',loadFailed:"Failed to load models",saveFailed:"Save failed",overallStatus:"Overall Status",healthy:"Healthy",degraded:"Degraded",abnormal:"Abnormal",healthRate:"Health Rate",onlineInstances:"Online Instances",totalRequests:"Total Requests",configuredModels:"Configured Models",addModel:"Add Model",provider_qwen:"Qwen (Tongyi Qianwen)",provider_glm:"GLM (Zhipu)",provider_baichuan:"Baichuan",provider_minimax:"MiniMax / Hailuo",provider_doubao:"Doubao",provider_hunyuan:"Tencent Hunyuan",provider_spark:"iFlytek Spark",provider_custom:"Custom"},Z_={title:"Tool List",searchTools:"Search tools...",disabled:"Disable",enabled:"Enable",params:"Parameters",loadFailed:"Failed to load tools",noTools:"No tools available"},Q_={title:"Skills Manager",list:"Skill List",noSkills:"No skills available",loadFailed:"Failed to load skills",loadFailedFallback:"Load failed",enable:"Enable",disable:"Disable",enabled:"Enabled",disabled:"Disabled",new:"New Skill",import:"Import",importTitle:"Import Skill",edit:"Edit",save:"Save",cancel:"Cancel",retry:"Retry",refresh:"Refresh",tags:"Tags",none:"None",source:"Source",localSkill:"Local skill",systemPrompt:"System Prompt",selectSkill:"Select a skill",fieldId:"ID",fieldName:"Name",fieldCategory:"Category",fieldTrigger:"Trigger",fieldTools:"Tools",description:"Description",saving:"Saving",chooseFile:"Choose skill file",importHint:"Supports `.skill.md` files.",marketplace:"Marketplace",marketplaceDesc:"Browse and install skills from remote marketplaces",marketplaceTitle:"Skill Marketplace",addMarketplace:"Add Marketplace",addMarketplaceTitle:"Add Skill Marketplace",marketplaceUrl:"Marketplace URL",marketplaceUrlPlaceholder:"GitHub repo / index.json link / local skills folder, e.g. https://github.com/obra/superpowers or D:\\agent\\agentic-awesome-skills",marketplaceName:"Marketplace name (optional)",marketplaceHint:"Supports GitHub repos (auto-scans skills/ dir), an index.json URL, or a local skills folder (fully offline — browse & install from disk). If GitHub is unreachable, set the DEEPSEEKCODE_GITHUB_MIRROR env var to a mirror prefix.",marketFilterPlaceholder:"Search skills in this marketplace...",marketCategoryAll:"All categories",riskCritical:"High risk",riskUnknown:"Risk unknown",refreshMarketplace:"Refresh",removeMarketplace:"Remove",installSkill:"Install",installed:"Installed",installFail:"Install failed",loadMarketplaceFail:"Failed to load skill marketplace",noMarketplaces:"No marketplaces yet — add one",noSkillsInMarket:"No skills in this marketplace",marketplaceError:"Marketplace index failed to load: {{error}}",retryMarket:"Retry",presets:"Built-in marketplaces",marketplaces:"Added marketplaces",skillCount:"{{count}} skills",installedSkills:"Installed skills",addFail:"Failed to add marketplace",installing:"Installing...",adding:"Adding...",marketplaceTab:"Marketplace",mineTab:"My Skills",installedTab:"Installed",workshopTab:"Workshop",workshopHint:"Skill proposals: generated from sessions or manually, apply as skills after review",workshopPropose:"New Proposal",workshopName:"Skill name (skill-name) e.g. format-json",workshopTrigger:"Trigger keywords (optional)",workshopDescription:"One-line description",workshopContent:"Skill body (system prompt / workflow instructions)",workshopSubmit:"Submit",workshopApply:"Apply",workshopEmpty:"No skill proposals yet",workshopFormRequired:"Skill name and content are required",uninstall:"Uninstall",uninstallConfirm:'Uninstall installed skill "{{name}}"?',uninstalling:"Uninstalling...",uninstallFail:"Uninstall failed",pagePrev:"Prev",pageNext:"Next",pageOf:"Page {{page}} / {{total}}",emptyInstalled:"No marketplace skills installed yet",emptyInstalledHint:"Head to the Marketplace tab to browse and install",browseMarket:"Go to Marketplace",use:"Use",useHint:"Insert $skill into the input box, then add your task and send",pickTitle:"Pick a Skill",pickPlaceholder:"Search skills...",pickEmpty:"No usable skills",pickUse:"Use it"},X_={permissionRequest:"Permission Request",hookApproval:"Hook Interception Approval",hookConfirm:"Hook Request Confirmation",morePending:"{{n}} more pending",tool:"Tool: ",reason:"Reason: ",needConfirm:"Requires user confirmation",allow:"Allow",deny:"Deny",allowAlways:"Always allow this session",allowAlwaysDesc:"Don't ask again for this tool in current session",autoMode:"Auto Mode",autoModeLabel:"Auto mode (allow all)",autoModeDesc:"Auto-approve all hook requests",moreOptions:"More options",highRiskWarning:"This action may cause irreversible effects, please confirm carefully",mediumRiskConfirm:"Please confirm this is the intended action",alreadyAllowed:"Allowed: ",alreadyDenied:"Denied: ",risk_critical:"Destructive operation - may delete data",risk_critical_cmd:"High-risk command - system-level operations",risk_high_shell:"Shell command execution",risk_high_file:"File write operation",risk_high_pkg:"Package management operation",risk_git_force:"Git force operation",risk_git:"Git operation",risk_network:"Network request",risk_low:"Read-only operation",risk_default:"Tool call",hookConfigTitle:"Custom Hook Configuration",hookConfigDesc:"You can add or modify hook interception rules in the .agent/hooks.json file in the project root directory.",hookConfigDetail:"Hooks support SHELL (external scripts) and HTTP (REST endpoints) types, and can be triggered before (PRE_TOOL_USE) or after (POST_TOOL_USE) tool execution.",hookConfigBuiltin:"Built-in hooks: BashSafetyHook (dangerous command interception), FileWriteAuditHook (file write audit), ToolUsageStatsHook (tool usage statistics). Set enabled: false to disable any hook.",optionAllow:"Allow — execute this operation",optionAllowHint:"Click or press Enter to confirm",optionDeny:"Deny — cancel this operation",optionDenyHint:"Click or press Esc to cancel",optionAllowAlways:"Allow always this session",optionAllowAlwaysHint:"Don't ask again for {{tool}}",optionAllowPathHint:"Don't ask again for this external path",timeoutWaitUser:"waiting for user (no timeout)",optionAutoMode:"Auto mode — allow all hooks",optionAutoModeHint:"All future hooks will be auto-approved",shortcutHint:"Shortcuts: 1-4 select · Enter allow · Esc deny",lastItem:"Last item",modalHint:"Please handle this approval request in the popup modal",clickToSelect:"Click to select · 1/2/3/4 keyboard shortcuts",verbRunCommand:"Run command",verbWriteFile:"Write file",verbEditFile:"Edit file",verbReadFile:"Read file",verbDeleteFile:"Delete file",verbFindFiles:"Find files",verbSearchContents:"Search contents",verbFetchUrl:"Fetch URL",verbSearchWeb:"Search web",verbGit:"Git operation",verbInstall:"Install package",verbSendMessage:"Send message",verbRunTool:"Run operation",scopeLocal:"acts on this workspace",scopeExternal:"external path",showAllLines:"Show all {{n}} lines",showAll:"Show the full message",showLess:"Show less"},J_={pending:"Waiting",thinking:"Thinking",action:"Action",result:"Result",running:"Running",error:"Error",completed:"Completed",params:"Parameters"},eC={linesTotal:"… ({{n}} lines total)",expandAll:"Expand all ({{n}} lines)",collapse:"Collapse"},tC={quickCommands:"Quick Commands",search:'Search: "{{filter}}"',help:"↑↓ Select · Enter Execute · Esc Close",backend:"Backend",backendCommand:"Backend command",chat_desc:"Switch to chat panel",chat_result:"Switched to chat panel",terminal_desc:"Switch to terminal panel",terminal_result:"Switched to terminal panel",files_desc:"Switch to file panel",files_result:"Switched to file panel",models_desc:"Switch to model panel",models_result:"Switched to model panel",tools_desc:"List available tools",tools_result:"Switched to tool panel",skills_desc:"List available skills",skills_result:"Switched to skills panel",settings_desc:"Switch to settings panel",settings_result:"Switched to settings panel",logs_desc:"Switch to logs panel",logs_result:"Switched to logs panel",new_desc:"Create new session",new_result:"New session created",clear_desc:"Clear current session messages",clear_result:"Messages cleared",theme_desc:"Toggle theme (dark/light/auto)",theme_error:"Usage: /theme <dark|light|auto|{{presets}}>",theme_result:"Theme switched to ",theme_preset_result:"Theme preset switched to ",theme_preset_unavailable:"Theme preset switching not available",toggle_terminal_desc:"Toggle terminal panel display",toggle_terminal_result:"Terminal panel toggled",logs_clear_desc:"Clear logs",logs_clear_result:"Logs cleared",doctor_desc:"System diagnostics (Config/API Key/Network/Docker/Disk)",compact_desc:"Compact current session context",help_desc:"Show all quick commands",token_desc:"Show token usage and API cost statistics",review_desc:"Code review — check correctness, security, and code quality",security_review_desc:"Security review — OWASP Top 10 + command injection/path traversal/privilege escalation",memory_desc:"Manage AI persistent memory (list/add/delete/clear)",ps_desc:"View and manage background tasks, sub-agents, and shell processes",model_desc:"View or switch AI models",status_desc:"Show current session status (session ID/message count/model/working directory)",config_desc:"Manage application configuration (get/set/list/delete)",exit_desc:"Exit application",exit_result:"Shutting down...",benchmark_desc:"Run DeepSeekCode capability benchmark (simple/medium/complex/full/list)",goal_desc:"Set a goal for multi-step work",goal_list_desc:"List active goals",goal_status_desc:"Show goal progress",workflow_list_desc:"List workflow runs",workflow_status_desc:"Show workflow status",workflow_checkpoints_desc:"List workflow checkpoints",mcp_desc:"List or reload MCP servers",sessions_desc:"List sessions",resume_desc:"Resume a session by id",permissions_desc:"Show permission rules and pending approvals",init_desc:"Generate agent.md project guidance file",self_test_desc:"Run tool capability self-test and generate a report",context_desc:"Show context analysis report",version_desc:"Show version information","check-update_desc":"Check for available updates",upgrade_desc:"Upgrade to the latest version",acceptance_desc:"Run or inspect acceptance workflows (quick/full/list/report)",diff_desc:"View uncommitted git changes in the workspace",summary_desc:"Summarize the current session conversation",effort_desc:"Show or set reasoning effort level (low|medium|high)",export_desc:"Export the current conversation as JSON",rename_desc:"Rename the current session",hooks_desc:"Show active hook configurations",cost_desc:"Show estimated session cost and duration",sent_command:"Command sent: ",noActiveSession:"No active session",unknownCommand:"Unknown command {{cmd}} — type /help to see available commands"},nC={pageError:"Page error",unknownError:"An unknown error occurred, please try refreshing the page",refreshPage:"Refresh page",genEnded:"Generation ended (tool execution timeout or connection lost)"},sC={backendConnected:"Backend connected",backendDisconnected:"Backend disconnected, reconnecting...",paused:"Paused, press ESC again to stop",terminated:"Stopped (ESC×2)",contextCompressed:"Context compressed: {{original}} → {{compressed}} messages, saved {{saved}} tokens",errorPrefix:"❌ Error: {{error}}",uncaughtError:"Uncaught error: ",uncaughtRejection:"Uncaught Promise rejection: ",unknownReason:"Unknown reason",diagnosing:"⏳ Diagnosing...",runDiagnostic:"🔍 Run Diagnostic",inspectorOn:"Enable inspector (Ctrl+Shift+Alt+C)",inspectorOff:"Disable inspector"},aC={title:"Channel Management",subtitle:"Connect external IM platforms to interact with AI via WeChat, Feishu, DingTalk, etc.",newChannel:"New Channel",editChannel:"Edit Channel",table:{name:"Channel Name",type:"Type",appId:"App ID",status:"Status",enabled:"Enabled",actions:"Actions"},status:{connected:"Connected",disconnected:"Disconnected",connecting:"Connecting",error:"Error"},empty:"No channels configured yet",emptyHint:'Click "New Channel" to add an IM platform bot',form:{basicInfo:"Basic Info",name:"Channel Name",namePlaceholder:"e.g. Office Group Bot",type:"Channel Type",credentials:"Credentials",appId:"App ID",appIdPlaceholder:"Enter App ID",appSecret:"App Secret",appSecretPlaceholder:"Enter App Secret",token:"Token",tokenPlaceholder:"Enter Bot Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"WeChat only, optional",enabled:"Enable Channel",wechatQrHint:"Save first, then scan QR code to login",feishuWsHint:"Feishu uses WebSocket to receive messages automatically"},actions:{scanQr:"Scan QR",edit:"Edit",delete:"Delete",deleteConfirm:"Are you sure you want to delete this channel?",test:"Test Connection",save:"Save Channel",cancel:"Cancel"},errors:{loadFailed:"Failed to load channels",createFailed:"Failed to create channel",updateFailed:"Failed to update channel",deleteFailed:"Failed to delete channel",notFound:"Channel not found",notImplemented:"Not implemented",nameRequired:"Channel name is required"},qr:{title:"WeChat QR Login",generating:"Generating QR code...",waiting:"Scan the QR code with WeChat",scanned:"Scanned, please confirm on your phone",confirmed:"Login successful",expired:"QR code expired",expiredHint:"Click retry to generate a new QR code",error:"Failed to get QR code",openInNewTab:"Open in new tab"},typeLabels:{wechat:"WeChat",feishu:"Feishu",dingtalk:"DingTalk",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"}},iC={stageUploaded:"等待处理",stageParsing:"正在解析数据文件",stageMapping:"模板映射",stageRendering:"正在生成文件",stageComplete:"文件处理完成",stageError:"文件处理失败",parsing:"正在解析 {{file}} …",parsedSummary:"{{rows}} 行 · {{fields}} 个字段",mappingTitle:"模板 ↔ 数据字段映射",templatePlaceholder:"模板占位符",dataField:"数据字段",mappingMore:"另有 {{n}} 个映射",rendering:"正在逐条生成 {{current}}/{{total}} …",download:"下载",downloadFailed:"下载失败",error:"处理失败",roleData:"数据文件",roleTemplate:"模板文件",attach:"Upload files or images (multi-select supported)",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed"},rC={reconnecting:"Reconnecting {{attempt}}/{{max}}",hint:"正在重新连接后端…"},lC={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},oC={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"Changes",clean:"工作区干净",branch:"分支",upstream:"提交领先上游",commit:"Commit",push:"Push",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},cC={retry:"重试",details:"详情",modelSettings:"模型设置"},uC={comingSoon:"即将上线"},dC={lspGroup:"Language Servers (LSP)",mcpGroup:"MCP Servers",notInstalled:"Not installed",installed:"Installed",ready:"Ready",connecting:"Connecting",installing:"Installing…",error:"Error",disabled:"Disabled",toolCount:"{{count}} tools",docs:"Docs",official:"Official",cloud:"Cloud",local:"Local",needCredentials:"This connector needs credentials to start:",connect:"Connect",missing:"missing",envConfigured:"credentials set",searchPlaceholder:"Search connectors (name, id, description)…",all:"All",noResults:"No connectors match your search/filter.",custom:"Custom",addCustom:"Add custom",customTitle:"Add custom MCP server (from awesome-mcp-servers or your own)",customName:"Name (id)",customCommand:"Command",customArgs:"Args (space separated)",customEnv:"Env (KEY=value, comma separated)",customUrl:"MCP endpoint URL",customHeaders:"Headers (KEY=value, comma separated)",customLocal:"Local command",customFormRequired:"Name and command/URL are required.",removeCustom:"Remove this custom connector",add:"Add"},fC={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},pC={title:"Voice input (English: whisper / Chinese: FunASR)",stopTitle:"Stop recording and transcribe",langToggle:"Switch recognition language: English (whisper) / Chinese (FunASR)",noSpeech:"No speech detected, please try again",backendMissing:"STT service not ready — opened settings to guide installation",setup:{title:"Voice Service",envCard:"Environment check",envChecking:"Checking…",recheck:"Re-check",pythonOk:"Python {{version}} ready",pythonMissing:"Python not detected. Please install Python 3.10+ first",pythonGuide:"Download Python",pipOk:"pip available",pipMissing:"pip is missing. Install pip first, then install the speech engine",pipGuide:"Run the command below to repair pip (see get-pip.py docs if it fails):",whisperTitle:"Whisper · English",whisperDesc:"English speech recognition",funasrTitle:"FunASR · Chinese",funasrDesc:"Chinese speech recognition",installed:"Installed",notInstalled:"Not installed",install:"Install",installing:"Installing…",cancel:"Cancel install",installDone:"Install complete — voice input is ready",installFailed:"Install failed",installTimeout:"Install timed out",installCancelled:"Install cancelled",jobInProgress:"An install task is already running, taking over its progress",manualCommand:"Manual install command",copyCommand:"Copy",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",torchHint:"Chinese engine requires torch — large download, please wait",logWaiting:"Preparing install…",chooseHint:"Environment ready — pick an engine above to install",defaultEngine:"Default recognition engine",defaultEngineHint:"Choose the default engine for voice input. You can switch anytime in the chat input.",inUse:"In use",engineNotInstalledHint:"This engine is not installed yet. Recording will guide you to install it."}},hC={verb:{researching:"Analyzing code",coding:"Editing code",validating:"Running checks",summarizing:"Wrapping up"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} items"},evidenceMore:"+ {{count}} more",toolCallCount:"{{count}} tool calls",toolNamesMore:"+{{count}} more tools",waitingUser:"Waiting for your answer",blocked:"Blocked: {{reason}}",paused:"Paused — resumable",viewAndAnswer:"View & answer",evidence:"Execution details",phase:{analysis:"Analysis",implementation:"Implement",optimization:"Optimize"}},mC={next:"Next",idle:"Idle"},Gy={common:I_,nav:P_,chat:F_,shortcuts:G_,palette:q_,a11y:V_,plan:W_,settings:K_,models:Y_,tools:Z_,skills:Q_,hook:X_,step:J_,toolCall:eC,slashCommands:tC,error:nC,toast:sC,channels:aC,fileJob:iC,reconnect:rC,autoAccess:lC,git:oC,errorCard:cC,placeholder:uC,connectors:dC,time:fC,stt:pC,activity:hC,taskbar:mC},gC=Da.getState().language||"zh-CN";Ot.use(GS).init({resources:{"zh-CN":{translation:Fy,hook:Fy.hook},en:{translation:Gy,hook:Gy.hook}},lng:gC,fallbackLng:"zh-CN",interpolation:{escapeValue:!1}});Da.subscribe((a,t)=>{a.language!==t.language&&Ot.changeLanguage(a.language)});function wf(a){let t=null;if(typeof a=="string")try{const s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(t=s)}catch{return}else a&&typeof a=="object"&&!Array.isArray(a)&&(t=a);if(t)return t.filePath||t.path||t.file||t.file_path}const qb=/(?:^|\s|\/|\\)(test|tests|lint|build|tsc|vitest|jest|pytest|typecheck|check)(?:\s|\.|"|'|`|$)/i,Vb=/bash|shell|run|exec|terminal|command/i,yC=/read|grep|glob|search|list|find|open|view|web_search|fetch/i;function _f(a){return a.some(t=>Hi(t.name))?"coding":a.some(t=>Vb.test(t.name))&&a.some(t=>{const s=typeof t.args=="string"?t.args:JSON.stringify(t.args??"");return qb.test(s)})?"validating":a.some(t=>yC.test(t.name))?"researching":"summarizing"}function Cf(a){return a.some(t=>Hi(t.name))?"implementation":a.some(t=>Vb.test(t.name))&&a.some(t=>{const s=typeof t.args=="string"?t.args:JSON.stringify(t.args??"");return qb.test(s)})?"optimization":"analysis"}function Ef(a){return Ot.t(`activity.verb.${a}`)}function Wb(a){const t=a.replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1)||a}function Kb(a,t){const s=Ef(a);for(const r of t){const l=wf(r.args);if(l)return Ot.t("activity.title.withFile",{verb:s,file:Wb(l)})}return t.length>1?Ot.t("activity.title.withCount",{verb:s,count:t.length}):s}const bC=1500,xC=3,vC=3,qy=24;let Go=!1,ra=[],sc=0,Ma=null;function Nf(){return sc>=vC}function Vy(){Ma==null||Ma.abort(),Ma=null;const a=ra;ra=[],Go=!1,sc=0;for(const t of a)t.resolve(null)}function SC(a){const t=a.replace(/[\r\n]+/g," ").replace(/^["'「『]+|["'」』。.,,、]+$/g,"").trim();return t?t.length>qy?`${t.slice(0,qy-1)}…`:t:null}async function kC(a){var r,l,c;const t=new AbortController;Ma=t;const s=setTimeout(()=>t.abort(),bC);try{const u=[`行为类型: ${a.kind}`,a.files.length>0?`涉及文件: ${a.files.map(Wb).join(", ")}`:"",`工具调用数: ${a.toolCount}`].filter(Boolean).join(`
|
|
54
|
-
`),d=await fetch("/v1/chat/completions",{method:"POST",headers:{"content-type":"application/json"},signal:t.signal,body:JSON.stringify({messages:[{role:"system",content:"你是标题生成器。根据给定的行为类型、涉及文件和工具数,生成一句不超过 16 字的中文活动标题(动词开头,不要标点结尾,不要引号)。只输出标题本身。"},{role:"user",content:u}],max_tokens:60,temperature:.3,stream:!1})});if(!d.ok)return null;const g=(c=(l=(r=(await d.json()).choices)==null?void 0:r[0])==null?void 0:l.message)==null?void 0:c.content;return typeof g=="string"?SC(g):null}catch{return null}finally{clearTimeout(s),Ma===t&&(Ma=null)}}async function Yb(){if(Go)return;const a=ra.shift();if(a){Go=!0;try{const t=await kC(a.req);t?(sc=0,a.resolve(t)):(sc+=1,a.resolve(null))}finally{if(Go=!1,ra.length>0&&!Nf())Yb();else if(Nf()){const t=ra;ra=[];for(const s of t)s.resolve(null)}}}}function wC(a){return Nf()||ra.length>=xC?Promise.resolve(null):new Promise(t=>{ra.push({req:a,resolve:t}),Yb()})}const _C=new Set(["content","thinking","tool_call","tool_result"]),CC=/api ?key|unauthorized|401|no such file|not found|eacces|permission denied|file (?:does not exist|not exist)|missing (?:api key|file|dependency)|command not found|is not a function|ENOENT/i;function EC(a){return CC.test(a)?"blocked":"failed"}const NC=6;function TC(a,t){const s=a[a.length-1];if(!s)return!1;const r=Hi(s.name),l=/bash|shell|run|exec|terminal/i.test(t);return r&&l||!r&&l&&Hi(t)}class AC{constructor(){He(this,"sessions",new Map)}session(t){let s=this.sessions.get(t);return s||(s={messageId:null,batch:null,lastBlockIndex:Number.NEGATIVE_INFINITY,seq:0},this.sessions.set(t,s)),s}currentMessageId(t){const s=this.session(t);if(s.messageId)return s.messageId;const r=ve.getState().messagesBySession[t]||[],l=r[r.length-1];return(l==null?void 0:l.id)??null}resetSession(t){this.sessions.delete(t),nn.getState().resetSession(t)}onWsEvent(t,s,r,l){if(!(l&&_C.has(s)))switch(s){case"start":this.onStart(t);break;case"thinking":this.onThinking(t,r);break;case"content":this.onContent(t);break;case"tool_call":this.onToolCall(t,r);break;case"tool_result":this.onToolResult(t,r);break;case"turn_summary":this.onTurnSummary(t,r);break;case"ask_user_question":case"hook_ask":this.onWaitingUser(t);break;case"generation_paused":nn.getState().markStatus(t,["running","waiting_user"],"paused");break;case"generation_resumed":nn.getState().markStatus(t,["paused"],"running");break;case"error":this.finalizeAll(t,"failed"),Vy();break;case"complete":this.finalizeAll(t,"completed"),Vy();break}}onStart(t){const s=this.session(t),r=ve.getState().messagesBySession[t]||[],l=r[r.length-1];s.messageId=(l==null?void 0:l.id)??null,s.batch=null,s.seq=0,s.lastBlockIndex=Number.NEGATIVE_INFINITY}onThinking(t,s){const r=this.session(t);if(!r.batch||r.batch.toolCallIds.length===0){this.advanceBlockIndex(r,s);return}const l=this.parseIndex(s);typeof l=="number"&&l>r.lastBlockIndex&&this.sealBatch(r.batch),this.advanceBlockIndex(r,s)}onContent(t){const s=this.session(t);s.batch&&this.sealBatch(s.batch)}onToolCall(t,s){const r=this.session(t),l=this.parseObj(s);if(!l)return;const c=typeof l.id=="string"?l.id:void 0,u=typeof l.index=="number"?l.index:void 0,d=typeof l.name=="string"?l.name:"Unknown",p=l.args??l.arguments??"",g=this.currentMessageId(t)??`session:${t}`;let y=r.batch;if(!y||y.messageId!==g||y.sealed){y&&!y.sealed&&y.toolCallIds.length>0&&this.finalizeBatch(t,y,y.hadError?this.errorStatus(y):"completed"),r.seq+=1;const E=`${g}:act:${r.seq}`,O=_f([{name:d,args:p}]),j=Cf([{name:d,args:p}]),T=Date.now(),z=u??(r.lastBlockIndex===Number.NEGATIVE_INFINITY?0:r.lastBlockIndex+1);y={sessionId:t,messageId:g,activityId:E,kind:O,phase:j,tools:[],toolCallIds:[],pending:new Set,hadError:!1,blockRange:[z,z],startedAt:T,sealed:!1},r.batch=y,nn.getState().applyEvent(t,{type:"activity_started",activity:{id:E,sessionId:t,messageId:g,kind:O,phase:j,status:"running",title:Ef(O),titleSource:"rule",toolCallIds:[],blockRange:y.blockRange,startedAt:T}})}if(!y.sealed&&y.toolCallIds.length>=NC&&TC(y.tools,d)){this.finalizeBatch(t,y,y.hadError?"failed":"completed"),r.batch=null,this.onToolCall(t,s);return}const b={name:d,args:p};y.tools.push(b);const v=c??`tc-${y.toolCallIds.length}-${y.activityId}`;y.toolCallIds.push(v),y.pending.add(v),u!==void 0&&(y.blockRange=[Math.min(y.blockRange[0],u),Math.max(y.blockRange[1],u)],r.lastBlockIndex=Math.max(r.lastBlockIndex,u));const S=_f(y.tools),k=Cf(y.tools),C=nn.getState();if(C.applyEvent(t,{type:"activity_updated",activityId:y.activityId,patch:{kind:S,phase:k,toolCallIds:[...y.toolCallIds],...S!==y.kind?{title:Ef(S)}:{}}}),y.kind=S,y.phase=k,Hi(d)){const E=wf(p);E&&C.applyEvent(t,{type:"artifact_produced",artifact:{id:`${y.activityId}:${E}`,path:E,action:"modified",activityId:y.activityId}})}}onToolResult(t,s){const r=this.session(t);if(!r.batch)return;const l=this.parseObj(s);if(!l)return;const c=r.batch,u=typeof l.id=="string"?l.id:void 0,d=typeof l.index=="number"?l.index:void 0;if(!(u!==void 0&&c.toolCallIds.includes(u)||u===void 0&&d!==void 0&&d>=c.blockRange[0]&&d<=c.blockRange[1]))return;if(u!==void 0)c.pending.delete(u);else{const b=[...c.pending][0];b&&c.pending.delete(b)}const g=l.result;typeof g=="string"&&g.startsWith("Error:")&&(c.hadError=!0,c.lastError=String(g).slice(0,200)),c.sealed&&c.pending.size===0&&this.finalizeBatch(t,c,c.hadError?"failed":"completed")}onTurnSummary(t,s){const r=this.parseObj(s);if(!r)return;const l=typeof r.headline=="string"?r.headline:void 0;if(!l)return;const c=this.currentMessageId(t);c&&nn.getState().applyEvent(t,{type:"task_title_set",messageId:c,title:l})}onWaitingUser(t){const s=nn.getState(),r=s.bySession[t];if(r)for(let l=r.order.length-1;l>=0;l--){const c=r.order[l];if(!c)continue;const u=r.activities[c];if(u&&u.status==="running"){s.applyEvent(t,{type:"activity_updated",activityId:u.id,patch:{status:"waiting_user"}});return}}}finalizeAll(t,s){const r=this.session(t);r.batch&&(this.finalizeBatch(t,r.batch,r.batch.hadError?this.errorStatus(r.batch):s),r.batch=null),nn.getState().finalizeSession(t,s)}errorStatus(t){return t.lastError?EC(t.lastError):"failed"}sealBatch(t){!t||t.sealed||(t.sealed=!0,this.finalizeBatch(t.sessionId,t,t.hadError?this.errorStatus(t):"completed"))}finalizeBatch(t,s,r){if(!s)return;const l=nn.getState(),c=s.kind,u=s.tools,d=Kb(c,u);if(l.applyEvent(t,{type:"activity_finalized",activityId:s.activityId,status:r,endedAt:Date.now()}),l.applyEvent(t,{type:"activity_updated",activityId:s.activityId,patch:{title:d,titleSource:"inferred",...(r==="failed"||r==="blocked")&&s.lastError?{blockedReason:s.lastError}:{}}}),r==="completed"&&u.length>=2){const p=u.map(g=>wf(g.args)).filter(g=>typeof g=="string");wC({kind:c,files:p,toolCount:u.length}).then(g=>{g&&nn.getState().applyEvent(t,{type:"activity_updated",activityId:s.activityId,patch:{title:g,titleSource:"llm"}})})}}parseObj(t){if(t&&typeof t=="object"&&!Array.isArray(t))return t;if(typeof t=="string")try{const s=JSON.parse(t);return s&&typeof s=="object"&&!Array.isArray(s)?s:null}catch{return null}return null}parseIndex(t){const s=this.parseObj(t),r=s==null?void 0:s.index;return typeof r=="number"?r:void 0}advanceBlockIndex(t,s){const r=this.parseIndex(s);typeof r=="number"&&(t.lastBlockIndex=Math.max(t.lastBlockIndex,r))}}const jC=new AC;function wN(a,t){const s=[];for(const u of t.thinkingBlocks??[])s.push({index:u.index,kind:"thinking"});for(const u of t.toolCalls??[])s.push({index:u.index??Number.MAX_SAFE_INTEGER,kind:"tool",tc:u});s.sort((u,d)=>u.index-d.index);const r=[];let l=[];for(const u of s)u.kind==="thinking"?l.length>0&&(r.push(l),l=[]):u.tc&&l.push(u.tc);if(l.length>0&&r.push(l),r.length===0)return[];const c=t.timestamp??Date.now();return r.map((u,d)=>{const p=_f(u),g=u.map(C=>C.index??Number.MAX_SAFE_INTEGER),y=Math.min(...g),b=Math.max(...g),v=u.some(C=>C.status==="error"),S=Math.min(...u.map(C=>C.timestamp),c),k=Math.max(...u.map(C=>C.timestamp+(C.duration??0)*1e3),c);return{id:`${t.id}:act:${d+1}`,sessionId:a,messageId:t.id,kind:p,phase:Cf(u),status:v?"failed":"completed",title:Kb(p,u),titleSource:"inferred",toolCallIds:u.map(C=>C.id),blockRange:y===Number.MAX_SAFE_INTEGER?[d,d]:[y,b===Number.MAX_SAFE_INTEGER?y:b],startedAt:S,endedAt:k}})}function RC(a){const t=a.toLowerCase();let s="unknown";return t.includes("401")||t.includes("unauthorized")||t.includes("invalid api key")||/api ?key.*invalid/.test(t)?s="auth":t.includes("429")||t.includes("rate limit")||t.includes("quota")||t.includes("insufficient_quota")?s="rate_limit":t.includes("timeout")||t.includes("timed out")||t.includes("timedout")?s="timeout":t.includes("network")||t.includes("econnrefused")||t.includes("fetch failed")||t.includes("socket")||t.includes("websocket")?s="network":t.includes("tool")||t.includes("bash")||t.includes("command failed")?s="tool":(t.includes("model")||t.includes("api")||t.includes("provider")||t.includes("response"))&&(s="model"),{id:`error-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,category:s,summary:OC(a,s),detail:a,retryable:s!=="auth",timestamp:Date.now()}}function OC(a,t){const s={auth:"API Key 无效或已失效(401 Unauthorized)",rate_limit:"请求频率超限或配额不足(429)",timeout:"请求超时",network:"网络连接异常",tool:"工具执行失败",model:"模型调用失败",unknown:"发生未知错误"},r=(a.split(`
|
|
55
|
-
`)[0]||"").trim().slice(0,120);return r?`${s[t]}: ${r}`:s[t]}function MC(a,t,s,r){var c,u;const l=ve.getState();if(!(r&&(a==="content"||a==="thinking"||a==="tool_call"||a==="tool_result"))){switch(a){case"start":l.startGeneration(s),l.addMessage(s,{id:Zn(),type:"assistant",content:"",timestamp:Date.now()}),we.getState().touchSession(s);break;case"content":{let d=String(t||"");try{const g=JSON.parse(t);d=g.text||g.content||d}catch{}const p=d.replace(/\[FINISH\]/g,"");p&&l.appendToLastMessage(s,p)}break;case"thinking":{let d=String(t||""),p;try{const g=JSON.parse(t);d=g.text||g.content||d,p=typeof g.index=="number"?g.index:void 0}catch{}d&&l.appendToLastMessageThinking(s,d,p)}break;case"tool_call":try{const d=JSON.parse(t||"{}"),p=d.id||Zn(),g=typeof d.index=="number"?d.index:void 0,y=d.args||d.arguments||"",b=l.messagesBySession[s]||[],v=b[b.length-1];[...((c=v==null?void 0:v.steps)==null?void 0:c.flatMap(C=>C.toolCalls||[]))||[],...(v==null?void 0:v.toolCalls)||[]].find(C=>g!==void 0&&C.index===g||C.id===p)?l.updateToolCall(s,p,{args:y}):l.addToolCall(s,{id:p,index:g,name:d.name||"Unknown",args:y,status:"running",timestamp:Date.now()})}catch(d){console.warn("Failed to parse tool call",String(d))}break;case"tool_result":try{const d=JSON.parse(t||"{}"),g=ve.getState().messagesBySession[s]||[],y=[];for(const C of g){const E=C.steps||[];for(const O of E)O.toolCalls&&y.push(...O.toolCalls);C.toolCalls&&y.push(...C.toolCalls)}const b=d.toolName,v=d.id,S=typeof d.index=="number"?d.index:void 0;let k;if(v&&(k=y.find(C=>C.id===v)),!k&&S!==void 0&&(k=y.find(C=>C.index===S&&C.name===b)),!k){const C=y.filter(E=>E.name===b&&E.status==="running");C.sort((E,O)=>(E.timestamp||0)-(O.timestamp||0)),k=C[0]}if(!k){const C=y.filter(E=>E.name===b&&E.status==="error"&&E.result==="生成已结束(工具执行超时或连接中断)");C.sort((E,O)=>(O.timestamp||0)-(E.timestamp||0)),k=C[0]}if(k){const C=Math.floor((Date.now()-(k.timestamp||Date.now()))/1e3),E=typeof d.result=="string"&&d.result.startsWith("Error:");l.updateToolCall(s,k.id,{status:E?"error":"completed",result:d.result,duration:C,...d.diff!==void 0?{diff:String(d.diff)}:{}})}}catch(d){console.warn("Failed to parse tool result",String(d))}break;case"tool_diff":try{const d=JSON.parse(t||"{}"),g=ve.getState().messagesBySession[s]||[],y=[];for(const S of g){const k=S.steps||[];for(const C of k)C.toolCalls&&y.push(...C.toolCalls);S.toolCalls&&y.push(...S.toolCalls)}const b=y.filter(S=>S.name===d.toolName&&S.status==="running");b.sort((S,k)=>(S.timestamp||0)-(k.timestamp||0));const v=b[0];v&&typeof d.diff=="string"&&l.updateToolCall(s,v.id,{diff:d.diff})}catch(d){console.warn("Failed to parse tool diff",String(d))}break;case"turn_summary":{try{const d=JSON.parse(t||"{}"),p={};if(d.toolCounts&&typeof d.toolCounts=="object"&&!Array.isArray(d.toolCounts))for(const[g,y]of Object.entries(d.toolCounts)){const b=Number(y);Number.isFinite(b)&&b>0&&(p[g]=b)}l.setTurnSummary(s,{thoughtMs:Number(d.thoughtMs??d.durationMs??0)||0,durationMs:Number(d.durationMs??d.thoughtMs??0)||0,toolCounts:p,...typeof d.headline=="string"&&d.headline?{headline:d.headline}:{}})}catch(d){console.warn("Failed to parse turn_summary",String(d))}break}case"web_search":try{const d=JSON.parse(t||"{}"),p=d.callId||`web-search-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,g=typeof d.index=="number"?d.index:void 0,y=d.status==="searching"||d.status==="in_progress",b=d.status==="failed",v=l.messagesBySession[s]||[],S=v[v.length-1],C=[...((u=S==null?void 0:S.steps)==null?void 0:u.flatMap(E=>E.toolCalls||[]))||[],...(S==null?void 0:S.toolCalls)||[]].find(E=>E.id===p||g!==void 0&&E.index===g&&E.name==="web_search");C?y||l.updateToolCall(s,C.id,{status:b?"error":"completed",result:b?"❌ 联网搜索失败":d.searchUrl?`✅ 搜索完成:${d.searchUrl}`:"✅ 搜索完成"}):l.addToolCall(s,{id:p,index:g,name:"web_search",args:"{}",status:y?"running":"completed",result:y?void 0:b?"❌ 联网搜索失败":d.searchUrl?`✅ 搜索完成:${d.searchUrl}`:"✅ 搜索完成",timestamp:Date.now()})}catch(d){console.warn("Failed to parse web_search",String(d))}break;case"cache_stats":try{const d=JSON.parse(t||"{}");Ge.getState().setCacheStats({cacheHitTokens:Number(d.cacheHitTokens)||0,cacheMissTokens:Number(d.cacheMissTokens)||0,cacheHitRate:d.cacheHitRate!==void 0?Number(d.cacheHitRate):void 0,cacheStatsCalls:Number(d.cacheStatsCalls)||0})}catch(d){console.warn("Failed to parse cache_stats",String(d))}break;case"complete":l.endGeneration(s);{const d=ve.getState().messagesBySession[s]||[];d.length>0&&Ge.getState().recalculateFromMessages(d)}we.getState().touchSession(s);break;case"generation_paused":l.pauseGeneration(s);break;case"generation_resumed":l.resumeGeneration(s);break;case"compaction_progress":try{const d=JSON.parse(t||"{}");Ge.getState().setCompactionProgress({stage:d.stage||"",percent:d.percent||0,message:d.message||""})}catch(d){console.error("Failed to parse compaction_progress:",d)}break;case"context_compressed":try{const d=JSON.parse(t||"{}"),p=`Context compressed: ${d.originalCount} -> ${d.compressedCount} msgs, freed ${d.tokensSaved} tokens`;l.appendToLastMessage(s,`
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
${p}
|
|
59
|
-
|
|
60
|
-
`),Se.info(p,5e3),Ge.getState().setCompacting({originalCount:d.originalCount||0,compressedCount:d.compressedCount||0,tokensSaved:d.tokensSaved||0}),Ge.getState().setCompactionProgress(null)}catch(d){console.error("Failed to parse context_compressed:",d)}break;case"error":{l.endGeneration(s);const d=typeof t=="string"?t:String(t||"Error occurred"),p=RC(d),g=l.messagesBySession[s]||[],y=g[g.length-1];y&&y.type==="assistant"&&!y.errorCard?l.attachErrorCard(s,p):l.addMessage(s,{id:Zn(),type:"assistant",content:"",timestamp:Date.now(),errorCard:p}),we.getState().touchSession(s);break}case"context_analysis":try{const d=JSON.parse(t||"{}");d&&d.total!==void 0&&Ge.getState().setContextDistribution(d)}catch(d){console.error("Failed to parse context_analysis:",d)}break;case"threshold_warning":try{const d=JSON.parse(t||"{}");Ge.getState().setThresholdWarning(d);const p=d.percentLeft!==void 0?d.percentLeft:0;p<=5?console.warn(`Context nearly full (${p}% remaining)`):p<=15&&console.info(`Context running low (${p}% remaining)`)}catch(d){console.error("Failed to parse threshold_warning:",d)}break;case"blocking_limit":try{const d=JSON.parse(t||"{}");Ge.getState().setThresholdWarning(d),console.error(d.message||"Context blocked")}catch(d){console.error("Failed to parse blocking_limit:",d)}break;case"context_blocked":try{const d=JSON.parse(t||"{}");Ge.getState().setThresholdWarning(d),console.error(d.message||"Context is full — generation blocked")}catch(d){console.error("Failed to parse context_blocked:",d)}break;case"tool_retry":try{const d=JSON.parse(t||"{}");Ge.getState().setRetryState({active:d.attempt<(d.maxRetries||3),attempt:d.attempt||0,maxRetries:d.maxRetries||3,errorCategory:d.errorCategory||"unknown",toolName:d.toolName})}catch(d){console.error("Failed to parse tool_retry:",d)}break;case"model_fallback":try{const d=JSON.parse(t||"{}");console.warn(`Model fallback: ${d.fromModel||"?"} → ${d.toModel||"?"}`)}catch(d){console.error("Failed to parse model_fallback:",d)}break;case"tombstone":try{const p=JSON.parse(t||"{}").messageIds||[];p.length>0&&l.applyTombstone(s,p)}catch(d){console.warn("Failed to parse tombstone",String(d))}break;case"stall_detected":try{const d=JSON.parse(t||"{}"),p=d.attempt||0,g=d.maxRetries||3,y=d.reason||"no response from model";d.recovering?Se.warning(`⚠ Generation stalled (${y}) — retrying ${p}/${g}`,8e3):Se.error(`⚠ Generation stalled (${y}) — giving up`,1e4)}catch(d){console.warn("Failed to parse stall_detected",String(d))}break}jC.onWsEvent(s,a,t,r)}}const Ff=Bt()((a,t)=>({backendCommands:[],loaded:!1,setBackendCommands:s=>{a({backendCommands:s,loaded:!0})},getAllCommands:()=>t().backendCommands}));async function BC(a="",t){try{let s=`${a}/api/commands`;t&&(s+=`?lang=${encodeURIComponent(t)}`);const r=await fetch(s);if(!r.ok)return[];const l=await r.json(),c=Array.isArray(l==null?void 0:l.data)?l.data:[];return Ff.getState().setBackendCommands(c),c}catch{return[]}}function Id(a,t,s,r,l){var c,u,d;switch(a){case"token_update":try{const g=typeof t=="string"?JSON.parse(t):t||{};if(g.source==="workflow"){Ge.getState().addWorkflowTokens(Number(g.workflowNodeTokens)||0);break}g.totalTokens>0&&Ge.getState().updateUsage({promptTokens:g.promptTokens||0,completionTokens:g.completionTokens||0,totalTokens:g.totalTokens||0});const y=g.promptCacheHitTokens??g.prompt_cache_hit_tokens,b=g.promptCacheMissTokens??g.prompt_cache_miss_tokens;(y!==void 0||b!==void 0)&&Ge.getState().accumulateCacheStats(Number(y)||0,Number(b)||0),g.model&&Ge.getState().setModel(g.model)}catch{}break;case"context_breakdown":try{const g=typeof t=="string"?JSON.parse(t):t||{};Ge.getState().setContextBreakdown({systemPromptTokens:Number(g.systemPromptTokens)||0,messagesTokens:Number(g.messagesTokens)||0,toolContentTokens:Number(g.toolContentTokens)||0,toolDefTokens:Number(g.toolDefTokens)||0,mcpToolTokens:Number(g.mcpToolTokens)||0,skillTokens:Number(g.skillTokens)||0,dynamicTokens:Number(g.dynamicTokens)||0,total:Number(g.total)||0})}catch{}break;case"model_name":try{const g=l&&typeof l.model=="string"&&l.model||(typeof t=="string"?t:(t==null?void 0:t.model)||"");g&&Ge.getState().setModel(g)}catch{}break;case"auth_required":let p=localStorage.getItem("auth_token");p||(p="default-token",localStorage.setItem("auth_token",p)),pe.setToken(p),pe.setAuthenticated(!1),pe.send({type:"auth",token:p});break;case"auth_success":pe.setAuthenticated(!0),pe.send({type:"subscribe_logs"});{const g=Da.getState();BC("",(c=g.language)!=null&&c.startsWith("zh")?"zh":"en");const y=g.workspaceDir;y&&pe.send({type:"workspace",message:y})}break;case"auth_failed":Hn.error("Auth failed",String(t));break;case"log":try{const g=typeof t=="string"?JSON.parse(t):t,y={id:`log-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,level:g.level||"info",source:g.source||"System",message:g.message||"",timestamp:g.timestamp||Date.now()};r.setLogs(b=>[...b,y].slice(-500)),r.activeTab!=="logs"&&r.setUnreadLogs(b=>b+1)}catch(g){console.warn("Failed to parse log entry",String(g))}break;case"commands_list":try{const g=JSON.parse(t||"[]");Ff.getState().setBackendCommands(Array.isArray(g)?g:[])}catch(g){console.warn("Failed to parse commands list",String(g))}break;case"command_start":break;case"command_complete":try{const y=((typeof t=="string"?JSON.parse(t):t||{}).result||"").toString();Se.success(y.length>120?y.slice(0,120)+"...":y||"Command completed",4e3)}catch{}break;case"command_error":try{const g=typeof t=="string"?JSON.parse(t):t||{};Se.error((g.error||"Command failed").toString(),6e3)}catch{}break;case"ping":pe.send({type:"pong",data:Date.now().toString()});break;case"workspace_changed":try{const g=JSON.parse(t||"{}");g.newDir&&Da.getState().setWorkspaceDir(g.newDir)}catch{}break;case"degradation_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.active,b=g.mode||"normal",v=Number(g.retryCount)||0,S=Number(g.maxRetries)||0,k=g.message||"",E={normal:"normal",retrying:"retrying",alternative:"alternative model",degraded:"degraded",verifying:"verifying",verified_fail:"verify failed"}[b]||b;if(Ge.getState().setDegradation({active:y,retryCount:v,maxRetries:S,mode:b,message:k,label:E}),y){const O=v>0?` (${v}/${S})`:"";Se.warning(k||`API Degraded: ${E}${O}`,8e3),r.setLogs(j=>[...j,{id:`deg-${Date.now()}`,level:"warn",source:"Infrastructure",message:`Degradation: ${E} | ${k||"no details"}`,timestamp:Date.now()}].slice(-500))}else Se.success("API Normal")}catch(g){console.warn("Degradation update parse error",String(g))}break;case"doctor_result":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.overallStatus||g.status||"unknown",b=g.healthRate,v=g.issues||[],k={healthy:"healthy",degraded:"degraded",unhealthy:"unhealthy",unknown:"unknown"}[y]||y,C=typeof b=="number"?` (${Math.round(b*100)}%)`:"";if(y==="healthy")Se.success(`Doctor: ${k}${C}`);else if(Se.warning(`Doctor: ${k}${C}`,1e4),v&&v.length>0)for(const E of v)r.setLogs(O=>[...O,{id:`doctor-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,level:"warn",source:"Doctor",message:typeof E=="string"?E:E.message||JSON.stringify(E),timestamp:Date.now()}].slice(-500))}catch(g){console.warn("Doctor result parse error",String(g))}break;case"session_created":{try{const g=typeof t=="string"?JSON.parse(t):t||{};g.id&&(pe.setSessionId(g.id),we.getState().updateSession(g.id,g))}catch{}typeof t=="string"&&t&&Hn.info(`Session event: ${a}`);break}case"session_resumed":{try{const g=typeof t=="string"?JSON.parse(t):t||{};if((u=g.session)!=null&&u.id&&(pe.setSessionId(g.session.id),we.getState().updateSession(g.session.id,g.session)),g.messages&&Array.isArray(g.messages)){const y=((d=g.session)==null?void 0:d.id)||s;ve.getState().replaceMessages(y,g.messages.map(S=>({id:S.id||`msg-${S.timestamp||Date.now()}`,type:S.type==="user"?"user":"assistant",content:S.content||"",timestamp:S.timestamp||Date.now(),thinking:S.thinking||void 0})));const b=g.messages.find(S=>S.type==="user"&&!S.deleted),v=typeof(b==null?void 0:b.content)=="string"?b.content.replace(/\s+/g," ").trim():"";we.getState().touchSession(y,v||void 0)}}catch(g){console.warn("Failed to process session_resumed",String(g))}typeof t=="string"&&t&&Hn.info(`Session event: ${a}`);break}case"mcp_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.server||g.name||"MCP",b=g.action||g.status||"updated";Hn.info(`MCP ${y}: ${b}`)}catch{}break}}function _N(a,t){switch(s1(a,t)){case"critical":return{level:"CRITICAL",reasonKey:"risk_critical"};case"high":return{level:"HIGH",reasonKey:/rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs/i.test(t)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(a)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(a)?"risk_high_pkg":"risk_high_shell"};case"low":return{level:"LOW",reasonKey:"risk_low"};default:return{level:"MEDIUM",reasonKey:/git|commit|push|merge|rebase/i.test(a)?"risk_git":"risk_network"}}}const CN={CRITICAL:{bg:"bg-red-900/20",border:"border-red-500/40",text:"text-red-400",badge:"bg-red-500/20 text-red-400 border-red-500/30",icon:"🚨"},HIGH:{bg:"bg-orange-900/15",border:"border-orange-500/30",text:"text-orange-400",badge:"bg-orange-500/20 text-orange-400 border-orange-500/30",icon:"⚠️"},MEDIUM:{bg:"bg-yellow-900/10",border:"border-yellow-500/25",text:"text-yellow-400",badge:"bg-yellow-500/15 text-yellow-400 border-yellow-500/25",icon:"📋"},LOW:{bg:"bg-blue-900/10",border:"border-blue-500/25",text:"text-blue-400",badge:"bg-blue-500/15 text-blue-400 border-blue-500/25",icon:"✅"}};function EN(a,t){return a1(a,t)}function DC(a){try{const t=JSON.parse(a),s=t.payload&&typeof t.payload=="object"?t.payload:t,r=s.resolvedPath;if(typeof r=="string"&&r)return r;const l=s.requestedPath;return typeof l=="string"&&l?l:null}catch{return null}}function LC(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},r=Ns.getState(),{approvalId:l,toolName:c,askPayload:u,timeoutMs:d,timeoutAction:p}=s,g=DC(String(u||""));if(r.isSessionAllowed(c,g??void 0)){pe.send({type:"hook_allow",data:JSON.stringify({approvalId:l})});return}if(r.autoMode&&c!=="exit_plan_mode"){pe.send({type:"hook_allow",data:JSON.stringify({approvalId:l})});return}ve.getState().addMessage(t,{id:`hook-approval-${l||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:{approvalId:l||"",toolName:c||"unknown",askPayload:u||"",status:"pending",timestamp:Date.now(),timeoutMs:typeof d=="number"?d:void 0,timeoutAction:p==="allow"||p==="deny"?p:void 0}}),r.addApproval({approvalId:l||"",toolName:c||"unknown",askPayload:u||"",timestamp:Date.now(),timeoutMs:typeof d=="number"?d:void 0,timeoutAction:p==="allow"||p==="deny"?p:void 0}),window.dispatchEvent(new CustomEvent("hook-approval-required"))}catch{}}function Pd(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{};typeof s.sessionId=="string"&&s.sessionId&&(t=s.sessionId);const r=we.getState(),l=Ze.getState(),{action:c,taskId:u,data:d}=s;if(c==="created"&&d){const p={id:u||`task-${Date.now()}`,title:d.title||"",completed:d.status==="COMPLETED",createdAt:Date.parse(d.createdAt)||Date.now(),backendId:u,backendStatus:d.status,description:d.description},g=r.tasksBySession[t]||[];r.setSessionTasks(t,[...g,p]),l.upsertTask(t,{id:p.id,title:p.title,description:p.description,status:Xn(d.status),source:"task",progress:d.progress!=null?Number(d.progress):void 0,raw:s})}else if((c==="updated"||c==="status_changed")&&d)r.updateTaskPlanStatus(t,u,{backendStatus:d.status,progress:d.progress}),l.upsertTask(t,{id:u,title:d.title||u,description:d.description,status:Xn(d.status),source:"task",progress:d.progress!=null?Number(d.progress):void 0,raw:s});else if(c==="deleted"){const p=r.tasksBySession[t]||[];r.setSessionTasks(t,p.filter(g=>g.id!==u&&g.backendId!==u))}else if(s&&!c&&(s.id||s.taskId)){const p=String(s.id||s.taskId),g=s,y=String(g.status||"").toUpperCase()==="COMPLETED",b={id:p,title:String(g.title||g.name||p),completed:y,createdAt:Date.parse(g.createdAt)||Date.now(),backendId:p,backendStatus:g.status,description:g.description,progress:g.progress!=null?Number(g.progress):void 0},v=r.getSessionTasks(t);v.some(S=>S.id===p||S.backendId===p)?r.updateTaskPlanStatus(t,p,{backendStatus:g.status,progress:b.progress,completed:y}):r.setSessionTasks(t,[...v,b]),l.upsertTask(t,{id:p,title:b.title,description:b.description,status:Xn(g.status),source:"task",progress:b.progress,raw:s})}l.recordEvent(t,{type:"task_update",source:"task",title:(d==null?void 0:d.title)||s&&(s.title||s.id||s.taskId)||u||"Task update",message:c||"updated",status:(d==null?void 0:d.status)||(s==null?void 0:s.status),taskId:u||(s==null?void 0:s.id)||(s==null?void 0:s.taskId),data:s})}catch{}}function zC(a,t,s,r){try{const l=JSON.parse(t||"{}"),c=r(s,a,l);if(c){const u=ve.getState();switch(a){case"step_start":u.updateStep(s,c.id,{title:l.step||c.title,description:l.description||c.description,status:l.status==="start"?"running":l.status||"running"});break;case"step_thinking":u.updateStep(s,c.id,{thought:l.thought});break;case"step_action":u.updateStep(s,c.id,{action:l.action});break;case"step_complete":u.updateStep(s,c.id,{status:l.status??"success",result:l.result});break}}}catch(l){console.warn("Failed to parse "+a,String(l))}}function UC(a,t){var s,r;try{const l=typeof a=="string"?JSON.parse(a):a||{};let c=[];if(Array.isArray(l)?c=l:(s=l.tasks)!=null&&s.length?c=l.tasks:(r=l.items)!=null&&r.length&&(c=l.items),c.length>0&&t){const u=we.getState(),d=Ze.getState();c.forEach(p=>{const g=p.content||p.title||p.name||"";if(g.trim()){if(!u.getSessionTasks(t).find(k=>k.title===g.trim())&&(u.addSessionTask(t,g.trim()),p.completed||p.status==="completed"||p.status==="COMPLETED"||p.status==="done"||p.activeForm==="completed")){const E=u.getSessionTasks(t).find(O=>O.title===g.trim());E&&u.toggleSessionTask(t,E.id)}const v=String(p.id||p.taskId||g.trim()),S=p.completed||p.status==="completed"||p.status==="COMPLETED"||p.status==="done"||p.activeForm==="completed";d.upsertTask(t,{id:v,title:g.trim(),description:p.description,status:Xn(p.status,S),source:"todo",raw:p})}}),d.recordEvent(t,{type:"todo_update",source:"todo",title:"Todo list updated",message:`${c.length} items`,status:"updated",data:l})}}catch{}}function $C(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},r=s.questionId||"",l=s.question||"";if(!r||!l)return;const c=Array.isArray(s.questions)?s.questions.map(p=>({question:String(p.question||""),header:p.header?String(p.header):void 0,options:Array.isArray(p.options)?p.options:void 0,multiSelect:p.multiSelect===!0})).filter(p=>p.question):[{question:l,header:s.header||void 0,options:Array.isArray(s.options)?s.options:void 0,multiSelect:s.multiSelect===!0}],u=window;u.__answeredQuestionIds=u.__answeredQuestionIds||new Set,u.__pendingQuestions=u.__pendingQuestions||{};const d={questionId:r,question:l,header:s.header||void 0,options:Array.isArray(s.options)?s.options:void 0,multiSelect:s.multiSelect===!0,autoResolutionMs:typeof s.autoResolutionMs=="number"?s.autoResolutionMs:void 0,questions:c,sessionId:t};u.__pendingQuestions[t]=d,u.__pendingQuestion=d,window.dispatchEvent(new CustomEvent("ask-question-required",{detail:t}))}catch{}}function HC(a,t){try{const s=typeof a=="string"?JSON.parse(a):a||{},r=s.title||s.name||"";if(r&&t){const c=we.getState().getSessionTasks(t).find(u=>u.title===r&&!u.completed);c&&we.getState().toggleSessionTask(t,c.id),Ze.getState().upsertTask(t,{id:(c==null?void 0:c.id)||r,title:r,status:"completed",source:"todo"}),Ze.getState().recordEvent(t,{type:"todo_item_done",source:"todo",title:r,status:"completed",taskId:(c==null?void 0:c.id)||r,data:s})}}catch{}}function Wy(a){if(!a)return null;try{return JSON.parse(a)}catch{return null}}const Ky=Bt((a,t)=>({automations:[],runsByAutomation:{},loading:!1,error:null,fetchAutomations:async()=>{const s=await Ie.automations.list();s.success&&s.data?a({automations:s.data}):a({error:s.error||"加载自动化失败"})},createAutomation:async s=>{const r=await Ie.automations.create(s);return r.success&&r.data?(await t().fetchAutomations(),r.data):(a({error:r.error||"创建自动化失败"}),null)},deleteAutomation:async s=>{const r=await Ie.automations.remove(s);return r.success?(await t().fetchAutomations(),!0):(a({error:r.error||"删除失败"}),!1)},toggleAutomation:async(s,r)=>{const l=await Ie.automations.toggle(s,r);l.success?await t().fetchAutomations():a({error:l.error||"切换失败"})},runAutomation:async s=>{const r=await Ie.automations.run(s);r.success?(await t().fetchRuns(s),await t().fetchAutomations()):a({error:r.error||"触发失败"})},fetchRuns:async s=>{const r=await Ie.automations.runs(s);r.success&&r.data&&a(l=>({runsByAutomation:{...l.runsByAutomation,[s]:r.data}}))},onAutomationUpdate:s=>{a(r=>({automations:r.automations.some(c=>c.id===s.id)?r.automations.map(c=>c.id===s.id?s:c):[...r.automations,s]}))},onAutomationRun:s=>{a(r=>({runsByAutomation:{...r.runsByAutomation,[s.automationId]:[s,...r.runsByAutomation[s.automationId]||[]].slice(0,50)}}))}})),Yy={automationUpdate:a=>{const t=Wy(a);t!=null&&t.automation&&Ky.getState().onAutomationUpdate(t.automation)},automationRun:a=>{const t=Wy(a);t!=null&&t.run&&Ky.getState().onAutomationRun(t.run)}};function IC(a,t,s){let r={};if(t&&typeof t=="object")r=t;else try{r=JSON.parse(String(t||"{}"))}catch{}const l=String(r.jobId||`fjob-${Date.now()}`),c=r.stage||(a==="filejob_result"?"complete":a==="filejob_error"?"error":"uploaded"),u={jobId:l,stage:c,parseProgress:r.parseProgress,parsedFiles:r.parsedFiles,mapping:r.mapping,renderProgress:r.renderProgress,currentRow:r.currentRow,totalRows:r.totalRows,result:r.result,error:r.error,errorDetail:r.errorDetail};r.attachments&&(u.attachments=r.attachments),ve.getState().setMessageFileJob(s,u)}const PC=Bt((a,t)=>({channels:[],availableTypes:[],loading:!1,error:null,formOpen:!1,editing:null,qrOpen:!1,qrChannel:null,selectedType:null,loadTypes:async()=>{const s=await Ie.channels.types(),r=s.success&&Array.isArray(s.data)?s.data:[];a({availableTypes:r})},load:async()=>{a({loading:!0,error:null});const s=await Ie.channels.list(),r=s.success&&Array.isArray(s.data)?s.data:[];if(a({loading:!1,channels:r,...s.success&&!Array.isArray(s.data)?{error:"服务端返回的频道数据格式异常"}:s.success?{}:{error:s.error??"Failed to load"}}),!t().selectedType&&r.length>0){const c=r[0].type;a({selectedType:c})}},create:async s=>{const r=await Ie.channels.create(s);return r.success?(await t().load(),a({formOpen:!1,editing:null}),!0):(a({error:r.error??"Create failed"}),!1)},update:async(s,r)=>{const l=await Ie.channels.update(s,r);return l.success?(await t().load(),a({formOpen:!1,editing:null}),!0):(a({error:l.error??"Update failed"}),!1)},remove:async s=>{const r=await Ie.channels.delete(s);return r.success?(a(l=>({channels:l.channels.filter(c=>c.id!==s)})),!0):(a({error:r.error??"Delete failed"}),!1)},toggle:async(s,r)=>(await Ie.channels.toggle(s,r)).success?(a(c=>({channels:c.channels.map(u=>u.id===s?{...u,enabled:r}:u)})),!0):(await t().load(),!1),openForm:s=>a({formOpen:!0,editing:s??null,error:null}),closeForm:()=>a({formOpen:!1,editing:null,error:null}),openQr:s=>a({qrOpen:!0,qrChannel:s??null}),closeQr:()=>{a({qrOpen:!1,qrChannel:null}),t().load()},clearError:()=>a({error:null}),selectType:s=>a({selectedType:s,error:null}),updateChannelStatus:s=>{a(r=>({channels:r.channels.map(l=>l.id===s.channelId?{...l,connected:s.connected,_state:s.state}:l)}))}})),FC=["start","content","thinking","tool_call","tool_result","tool_diff","turn_summary","web_search","cache_stats","complete","generation_paused","generation_resumed","error","context_compressed","compaction_progress","tombstone","context_analysis","threshold_warning","blocking_limit","tool_retry","model_fallback","context_blocked","stall_detected"],Tf=(a,t=[])=>{if(!a)return t;if(Array.isArray(a))return a.forEach(l=>Tf(l,t)),t;if(typeof a!="object")return t;const s=a,r=s.content;return typeof r=="string"&&r.trim()&&t.push(r.trim()),Object.entries(s).forEach(([l,c])=>{l!=="content"&&l!=="structuredOutput"&&Tf(c,t)}),t},GC=a=>{const t=Tf(a);return t[t.length-1]||""};function qC({activeTab:a,setLogs:t,setUnreadLogs:s}){const r=ve,l=_.useCallback(y=>{if(!y)return{};if(typeof y=="object")return y;if(typeof y!="string")return{};try{return JSON.parse(y)}catch{return{}}},[]),c=_.useCallback((y,b,v)=>{const S=l(b),k=Ze.getState(),C=ve.getState();if(y==="workflow_plan_ready"&&S.planId){k.setPlan(v,{planId:String(S.planId),title:typeof S.title=="string"&&S.title?String(S.title):"工作流计划",reason:typeof S.reason=="string"?String(S.reason):void 0,confirm:S.confirm===!0,nodes:Array.isArray(S.nodes)?S.nodes:void 0,createdAt:Date.now()});return}if(y==="workflow_confirm_ack"){k.clearPlan(v);return}const E=S.runId||"";if(!E)return;if(y==="workflow_error"){k.fail(v,E,S.error||"Workflow failed"),(C.isGenerating(v)||C.isPaused(v))&&C.endGeneration(v,S.error||"Workflow failed");return}const O=y==="workflow_finished"?S.status||"COMPLETED":y==="workflow_started"?S.status||"RUNNING":y==="workflow_paused"?S.status||"PAUSED":y==="workflow_resumed"?S.status||"RESUMING":y==="workflow_cancelled"?S.status||"CANCELLED":y==="workflow_recovered"?S.status||"RUNNING":S.status||void 0,j=S.type||y,T=S.data&&typeof S.data=="object"?S.data:{},z=String(S.kind||T.kind||""),R=S.nodeId||S.node_id||T.nodeId||T.node_id,Z=S.role||S.agentRole||S.agent_role||T.role||T.agentRole||T.agent_role,Q=S.phase||S.phaseId||T.phase||T.phaseId,te=S.effectId||T.effectId||R,he=S.toolName||S.tool_name||T.toolName||T.tool_name,me=S.error||T.error,lt=["effect.scheduled","effect.completed","effect.failed"].includes(j)&&R&&z!=="tool",de=["effect.scheduled","effect.completed","effect.failed"].includes(j)&&z==="tool"&&(he||R),W=R?k.getAgentsForSession(v).find(K=>K.id===String(R)):void 0;if(k.upsert(v,{runId:E,status:O,title:typeof S.title=="string"&&S.title?String(S.title):void 0,completedPhases:Number(S.completedPhases||0),totalPhases:Number(S.totalPhases||0),completedEffects:Number(S.completedEffects||0),totalEffects:Number(S.totalEffects||0),tokensUsed:Number(S.tokensUsed||0),tokensRemaining:Number(S.tokensRemaining||0),lastEventType:j,agentNode:lt?{nodeId:String(R),role:String(Z||(W==null?void 0:W.role)||(W==null?void 0:W.name)||"agent"),phase:Q?String(Q):W==null?void 0:W.phase,status:j==="effect.failed"?"failed":j==="effect.completed"?"completed":"scheduled",tokens:S.tokensUsed!=null?Number(S.tokensUsed):T.tokens!=null&&typeof T.tokens=="number"?Number(T.tokens):void 0,error:me?String(me):void 0,updatedAt:Date.now()}:void 0}),de){const K=j==="effect.failed"?"failed":j==="effect.completed"?"completed":"running",ge=String(te||`${E}-${he||R}`);k.upsertTask(v,{id:ge,title:String(he||R),description:R?String(R):void 0,status:K,source:"workflow",runId:E,result:T.artifactRef?String(T.artifactRef):void 0,error:me?String(me):void 0,raw:S}),k.recordEvent(v,{type:j,source:"workflow",title:String(he||R),status:K,runId:E,taskId:ge,message:me?String(me):void 0,data:S})}if((y==="workflow_started"||y==="workflow_handoff")&&Array.isArray(S.nodes)?k.setNodes(v,E,S.nodes):y==="workflow_node_start"&&R?k.setNodeStatus(v,E,String(R),{status:"running"}):y==="workflow_node_complete"&&R&&k.setNodeStatus(v,E,String(R),{status:String(T.status||S.status||"completed"),result:T.result!=null?String(T.result):void 0,error:me?String(me):void 0}),y==="workflow_started")k.clearPlan(v),C.startGeneration(v);else if(y==="workflow_finished"){k.finalizeNodes(v,E,String(O||"COMPLETED"));const K=GC(S.output);if(K){const ge=C.getMessages(v),$=ge[ge.length-1];($==null?void 0:$.type)==="assistant"?C.appendToLastMessage(v,K):C.addMessage(v,{id:Zn(),type:"assistant",content:K,timestamp:Date.now()})}C.endGeneration(v)}else O==="PAUSED"?C.pauseGeneration(v):(O==="RUNNING"||O==="RESUMING")&&C.resumeGeneration(v)},[l]),u=_.useCallback((y,b)=>{const v=l(y),S=Array.isArray(v.runs)?v.runs:[];if(S.length===0)return;const k=S.slice().sort((j,T)=>String(T.updatedAt||"").localeCompare(String(j.updatedAt||"")))[0],C=String(k.status||"").toUpperCase();if(!C)return;const E=Ze.getState(),O=String(k.runId||"");E.upsert(b,{runId:O,status:C,title:k.workflowId?`workflow: ${String(k.workflowId)}`:void 0,totalPhases:Number(k.totalNodes||0),completedPhases:Number(k.completedNodes||0),lastEventType:"workflow_status",error:k.error?String(k.error):void 0}),["COMPLETED","FAILED","ERROR","CANCELLED","CANCELED","PAUSED"].includes(C)&&E.recordEvent(b,{type:"workflow_status",source:"workflow",title:`Workflow ${C}`,message:k.output?String(k.output).slice(0,200):k.error?String(k.error):void 0,status:C==="COMPLETED"?"completed":"failed",runId:O,data:k})},[l]),d=_.useCallback(y=>{var k;const v=r.getState().messagesBySession[y]||[],S=v[v.length-1];return(k=S==null?void 0:S.steps)==null?void 0:k[S.steps.length-1]},[r]),p=_.useCallback((y,b,v)=>{const S=d(y),k=b==="step_complete",C=S&&(S.status==="success"||S.status==="error");if(!S||C&&!k){const E=(v==null?void 0:v.step)||b.replace("step_","").replace("_"," ");return r.getState().addStep(y,{id:`step-${Date.now()}`,title:E,description:(v==null?void 0:v.description)||"Executing...",status:"running",timestamp:Date.now()}),d(y)}return S},[d,r]),g=_.useCallback(y=>{var k,C;const b=y.type,v=y.data;if(b==="model_name"){Id(b,v,y.sessionId||"",{activeTab:a,setLogs:t,setUnreadLogs:s},y);return}if(b==="models_updated"||b==="models.updated"){window.dispatchEvent(new CustomEvent("models-updated"));return}if(b==="workspace_changed"){Id(b,v,y.sessionId||"",{activeTab:a,setLogs:t,setUnreadLogs:s});return}if(b==="question_answer_ack"){const E=l(v),O=E==null?void 0:E.questionId;if(O){const j=window;j.__answeredQuestionIds=j.__answeredQuestionIds||new Set,j.__answeredQuestionIds.add(O);const T=j.__pendingQuestions||{};for(const z of Object.keys(T))((k=T[z])==null?void 0:k.questionId)===O&&delete T[z];((C=j.__pendingQuestion)==null?void 0:C.questionId)===O&&(j.__pendingQuestion=null)}window.dispatchEvent(new CustomEvent("ask-question-dismiss",{detail:E==null?void 0:E.questionId}));return}const S=y.sessionId||"";if(!S){if(b==="task_update"||b==="task_finished"||b==="task_error"){const E=l(v);E&&typeof E.sessionId=="string"&&E.sessionId&&Pd(v,E.sessionId)}return}if(b==="hook_ask"){LC(v,S);return}if(b==="ask_user_question"){$C(v,S);return}if(b==="task_update"){Pd(v,S);return}if(b==="task_output"){try{r.getState().appendToLastMessage(S,String(v||""))}catch{}return}if(b==="task_finished"||b==="task_error"){b==="task_error"?Hn.error("Task error",String(v)):Pd(v,S);return}if(b==="filejob_start"||b==="filejob_progress"||b==="filejob_result"||b==="filejob_error"){IC(b,v,S);return}if(b.startsWith("step_")){zC(b,v,S,p);return}if(b.startsWith("plan_")){try{Hd(b,v,S)}catch(E){Hn.error(`Failed to handle ${b}`,String(E))}return}if(b.startsWith("goal_")){try{Hd(b,v,S)}catch(E){Hn.error(`Failed to handle ${b}`,String(E))}return}if(b==="step_prompt"){try{Hd(b,v,S)}catch(E){Hn.error(`Failed to handle ${b}`,String(E))}return}if(b==="todo_update"){UC(v,S);return}if(b==="todo_item_done"){HC(v,S);return}if(b!=="todo_progress"){if(b==="automation.update"){Yy.automationUpdate(v);return}if(b==="automation.run"){Yy.automationRun(v);return}if(b!=="tool.approval_required"){if(["workflow_started","workflow_event","workflow_progress","workflow_finished","workflow_error","workflow_checkpoint","workflow_node_start","workflow_node_complete","workflow_paused","workflow_resumed","workflow_cancelled","workflow_handoff","workflow_plan_ready","workflow_confirm_ack","workflow_recovered"].includes(b)){c(b,v,S);return}if(b==="workflow_status"){u(v,S);return}if(FC.includes(b)){MC(b,v,S,y.nodeId);return}if(b==="channel_status"){try{const E=JSON.parse(v||"{}");PC.getState().updateChannelStatus(E)}catch{}return}if(b==="channel_message"||b==="channel_error"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.channel||E.platform||"Channel";if(b==="channel_error")Se.error(`${O}: ${E.error||E.message||"channel error"}`);else{const j=E.from||E.sender||"",T=E.text||E.content||E.message||"";T&&Se.info(`📨 ${O}${j?` · ${j}`:""}: ${String(T).slice(0,120)}`)}}catch{}return}if(b==="session_switched"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.id||E.sessionId||(typeof v=="string"?v:"");O&&we.getState().setActiveSession(String(O))}catch{}return}if(b==="task_interrupted"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.title||E.taskId||"Task";Se.warning(`⏸ ${O} interrupted — 使用 /continue 恢复生成`,1e4)}catch{Se.warning("A running task was interrupted",1e4)}return}if(b==="code_review_ready"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.title||E.skillId||"Code Review",j=E.summary||"";Se.success(`🔍 ${O} ready${j?`: ${String(j).slice(0,120)}`:""}`,8e3)}catch{Se.success("🔍 Code review ready",8e3)}return}if(b==="hook_auto_ack"){try{const E=typeof v=="string"?JSON.parse(v):v||{};Se.info(`Hook auto-approved: ${E.tool||E.name||"tool"}`,4e3)}catch{}return}if(b==="throttle"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.limit||E.remaining!=null?` (${E.remaining} left)`:"";Se.warning(`⚠ Rate limited${O}`,6e3)}catch{}return}if(["token_update","context_breakdown","auth_required","auth_success","auth_failed","log","commands_list","ping","degradation_update","doctor_result","session_created","session_resumed","mcp_update","hook_response_ack"].includes(b)){Id(b,v,S,{activeTab:a,setLogs:t,setUnreadLogs:s});return}}}},[a,p,c,u,l,t,s]);_.useEffect(()=>{pe.connect();const y=pe.onMessage(g),b=pe.onClose(()=>{const S=ve.getState();for(const k of S.generatingSessions)S.endGeneration(k,"WebSocket disconnected")}),v=pe.onOpen(()=>{var k;const S=((k=pe.getSessionId)==null?void 0:k.call(pe))||we.getState().activeSessionId;if(S){pe.send({type:"get_workflow_status",sessionId:S,data:JSON.stringify({sessionId:S})});const C=Mi.getState().mode;pe.send({type:"plan_mode_change",sessionId:S,data:JSON.stringify({mode:C})})}});return()=>{y(),b(),v()}},[g])}const ll={linear:{id:"linear",nameKey:"settings.themePresetLinear",descriptionKey:"settings.themePresetLinearDesc",dark:{bg:"#0a0a0c",surface:"#121215",border:"#26262b",text:"#e4e4e7",muted:"#8e8e96",accentBlue:"#7c83f8",accentGreen:"#4ade80",accentRed:"#f87171",accentYellow:"#fbbf24",accentPurple:"#c084fc"},light:{bg:"#ffffff",surface:"#f6f6f7",border:"#e4e4e8",text:"#18181b",muted:"#71717a",accentBlue:"#5e6ad2",accentGreen:"#16a34a",accentRed:"#dc2626",accentYellow:"#b45309",accentPurple:"#7c3aed"}},mimo:{id:"mimo",nameKey:"settings.themePresetMimo",descriptionKey:"settings.themePresetMimoDesc",dark:{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"},light:{bg:"#ffffff",surface:"#f8f4ef",border:"#e2d8cd",text:"#24221c",muted:"#605b52",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"}},github:{id:"github",nameKey:"settings.themePresetGithub",descriptionKey:"settings.themePresetGithubDesc",dark:{bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},light:{bg:"#ffffff",surface:"#f6f8fa",border:"#d0d7de",text:"#24292f",muted:"#57606a",accentBlue:"#0969da",accentGreen:"#1a7f37",accentRed:"#cf222e",accentYellow:"#9a6700",accentPurple:"#8250df"}},cherry:{id:"cherry",nameKey:"settings.themePresetCherry",descriptionKey:"settings.themePresetCherryDesc",dark:{bg:"#0f1419",surface:"#1a2332",border:"#2d3f50",text:"#e1e8ed",muted:"#8899aa",accentBlue:"#01a9ff",accentGreen:"#00c853",accentRed:"#ff5252",accentYellow:"#ffab00",accentPurple:"#7c4dff"},light:{bg:"#f5f9ff",surface:"#ffffff",border:"#cce0ff",text:"#1a2332",muted:"#5c6f87",accentBlue:"#0160ff",accentGreen:"#00a844",accentRed:"#e53935",accentYellow:"#f9a825",accentPurple:"#651fff"}},ocean:{id:"ocean",nameKey:"settings.themePresetOcean",descriptionKey:"settings.themePresetOceanDesc",dark:{bg:"#0b1e2e",surface:"#122b3d",border:"#1e4057",text:"#d4e6f5",muted:"#7a9bb5",accentBlue:"#00bcd4",accentGreen:"#26a69a",accentRed:"#ef5350",accentYellow:"#ffca28",accentPurple:"#ab47bc"},light:{bg:"#edf7fc",surface:"#ffffff",border:"#b3d9e8",text:"#0b1e2e",muted:"#4f7a94",accentBlue:"#00838f",accentGreen:"#00897b",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#8e24aa"}},mint:{id:"mint",nameKey:"settings.themePresetMint",descriptionKey:"settings.themePresetMintDesc",dark:{bg:"#0d1f1c",surface:"#162d28",border:"#264b41",text:"#d1f0e8",muted:"#7dafa3",accentBlue:"#26c6da",accentGreen:"#66bb6a",accentRed:"#ef5350",accentYellow:"#ffd54f",accentPurple:"#ad8aff"},light:{bg:"#edf7f4",surface:"#ffffff",border:"#b8d9cf",text:"#0d1f1c",muted:"#4a7f72",accentBlue:"#0097a7",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#7c4dff"}},lavender:{id:"lavender",nameKey:"settings.themePresetLavender",descriptionKey:"settings.themePresetLavenderDesc",dark:{bg:"#1a1428",surface:"#261f38",border:"#3c3354",text:"#e2daf2",muted:"#9387b5",accentBlue:"#86bef5",accentGreen:"#81c784",accentRed:"#ef9a9a",accentYellow:"#ffe082",accentPurple:"#ce93d8"},light:{bg:"#f5f0ff",surface:"#ffffff",border:"#d4c8e8",text:"#1a1428",muted:"#6c5b8a",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#f57f17",accentPurple:"#7b1fa2"}},midnight:{id:"midnight",nameKey:"settings.themePresetMidnight",descriptionKey:"settings.themePresetMidnightDesc",dark:{bg:"#0a0e1a",surface:"#111726",border:"#1e2740",text:"#c8d2e8",muted:"#6a7596",accentBlue:"#4fc3f7",accentGreen:"#4caf50",accentRed:"#e57373",accentYellow:"#ffd54f",accentPurple:"#b39ddb"},light:{bg:"#eef1f7",surface:"#ffffff",border:"#c0c9dc",text:"#0a0e1a",muted:"#4f5a78",accentBlue:"#0288d1",accentGreen:"#2e7d32",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#5e35b1"}},sunset:{id:"sunset",nameKey:"settings.themePresetSunset",descriptionKey:"settings.themePresetSunsetDesc",dark:{bg:"#1e1410",surface:"#2a1d16",border:"#443124",text:"#f0dfcf",muted:"#b8957a",accentBlue:"#5fa5e8",accentGreen:"#81c784",accentRed:"#ff7043",accentYellow:"#ffb74d",accentPurple:"#e0a0e0"},light:{bg:"#fff6f0",surface:"#ffffff",border:"#f0d5c0",text:"#2a1d16",muted:"#8a6e5a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#e64a19",accentYellow:"#ef6c00",accentPurple:"#8e24aa"}},forest:{id:"forest",nameKey:"settings.themePresetForest",descriptionKey:"settings.themePresetForestDesc",dark:{bg:"#0e1a12",surface:"#172a1d",border:"#2a4733",text:"#d1e8d6",muted:"#7da684",accentBlue:"#5bb8e8",accentGreen:"#66bb6a",accentRed:"#ef9a9a",accentYellow:"#e6c35c",accentPurple:"#ae8ad9"},light:{bg:"#f0f7f0",surface:"#ffffff",border:"#b8d9be",text:"#0e1a12",muted:"#477a50",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#827717",accentPurple:"#6a1b9a"}},candy:{id:"candy",nameKey:"settings.themePresetCandy",descriptionKey:"settings.themePresetCandyDesc",dark:{bg:"#16101a",surface:"#22182a",border:"#3d284a",text:"#f0def5",muted:"#b28dc2",accentBlue:"#5fc3f5",accentGreen:"#81e080",accentRed:"#ff6b6b",accentYellow:"#ffd93d",accentPurple:"#e066ff"},light:{bg:"#faf0ff",surface:"#ffffff",border:"#e0cce8",text:"#1a0a24",muted:"#7a5c8a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#8e24aa"}},nord:{id:"nord",nameKey:"settings.themePresetNord",descriptionKey:"settings.themePresetNordDesc",dark:{bg:"#2e3440",surface:"#3b4252",border:"#4c566a",text:"#eceff4",muted:"#81a1c1",accentBlue:"#88c0d0",accentGreen:"#a3be8c",accentRed:"#bf616a",accentYellow:"#ebcb8b",accentPurple:"#b48ead"},light:{bg:"#f5f7fa",surface:"#ffffff",border:"#d8dee9",text:"#2e3440",muted:"#5e6d85",accentBlue:"#5e81ac",accentGreen:"#6f9e6f",accentRed:"#bf616a",accentYellow:"#b48d56",accentPurple:"#8f6f9e"}}},Af="linear";function Zy(a,t,s){const r=ll[a]||ll[Af];if(!r)return{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"};const l={...t==="dark"?r.dark:r.light};return s&&Object.assign(l,s),l}const Wn=a=>{const t=parseInt(a.slice(1,3),16),s=parseInt(a.slice(3,5),16),r=parseInt(a.slice(5,7),16);return`${t} ${s} ${r}`},VC=(a,t,s)=>{const r=[parseInt(a.slice(1,3),16),parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)],l=[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)];return r.map((c,u)=>Math.round(c+((l[u]??c)-c)*s)).join(" ")};function Qy(a,t,s,r,l){s.classList.toggle("dark",a==="dark"),s.classList.toggle("light",a==="light"),s.style.setProperty("--color-bg",Wn(t.bg)),s.style.setProperty("--color-surface",Wn(t.surface)),s.style.setProperty("--color-border",Wn(t.border)),s.style.setProperty("--color-text",Wn(t.text)),s.style.setProperty("--color-muted",Wn(t.muted)),s.style.setProperty("--color-accent-blue",Wn(t.accentBlue)),s.style.setProperty("--color-accent-green",Wn(t.accentGreen)),s.style.setProperty("--color-accent-red",Wn(t.accentRed)),s.style.setProperty("--color-accent-yellow",Wn(t.accentYellow)),s.style.setProperty("--color-accent-purple",Wn(t.accentPurple)),s.style.setProperty("--color-hover",VC(t.surface,t.text,.06)),r&&r.setAttribute("content",t.bg),l&&l.setAttribute("content",a)}function WC({theme:a,themePresetId:t,customTheme:s,customThemeEnabled:r}){_.useEffect(()=>{const l=document.documentElement,c=document.querySelector('meta[name="theme-color"]'),u=document.querySelector('meta[name="color-scheme"]'),d=a==="dark"?"dark":a==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",p=r?s:void 0,g=Zy(t||Af,d,p);if(Qy(d,g,l,c,u),a==="auto"){const y=window.matchMedia("(prefers-color-scheme: dark)"),b=()=>{const v=y.matches?"dark":"light",S=Zy(t||Af,v,p);Qy(v,S,l,c,u)};return y.addEventListener("change",b),()=>y.removeEventListener("change",b)}},[a,t,s,r])}class Xy extends _.Component{constructor(s){super(s);He(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error("[ErrorBoundary] Caught error:",s,r)}render(){var s;return this.state.hasError?this.props.fallback?this.props.fallback:m.jsx("div",{className:"flex items-center justify-center h-full w-full bg-dark-bg",children:m.jsxs("div",{className:"max-w-md p-8 text-center",children:[m.jsx("div",{className:"flex justify-center mb-4",children:m.jsx("div",{className:"w-16 h-16 rounded-full bg-accent-red/10 flex items-center justify-center",children:m.jsx(Df,{size:32,className:"text-accent-red"})})}),m.jsx("h2",{className:"text-xl font-semibold text-dark-text mb-2",children:"页面出现错误"}),m.jsx("p",{className:"text-sm text-dark-muted mb-6",children:((s=this.state.error)==null?void 0:s.message)||"发生了未知错误,请尝试刷新页面"}),m.jsxs("div",{className:"flex items-center justify-center gap-3",children:[m.jsxs("button",{onClick:this.handleRetry,className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity",children:[m.jsx(Rf,{size:16}),"重试"]}),m.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dark-hover text-dark-text rounded-lg hover:bg-dark-border transition-colors",children:"刷新页面"})]})]})}):this.props.children}}const KC=10;function YC(a,t=KC){return a.filter(s=>s&&!!s.id&&(s.messageCount??0)>0).sort((s,r)=>String(r.updatedAt||"").localeCompare(String(s.updatedAt||""))).slice(0,t).map(s=>{const r=new Date(s.createdAt).getTime()||Date.now(),l=new Date(s.updatedAt).getTime()||r;return{id:s.id,title:s.title||s.id,createdAt:r,lastActiveAt:l,messageCount:s.messageCount??0,...s.preview?{preview:s.preview}:{}}})}function Jy(a){if(a>=1e8)return`${(a/1e8).toFixed(1)}亿`;if(a>=1e4){const t=a/1e4;return`${t>=100?t.toFixed(0):t.toFixed(1)}万`}return String(Math.round(a))}function ZC(a){return`${a>=10?a.toFixed(0):a.toFixed(1)}%`}const QC=_.memo(function({open:t,onClose:s}){const r=Ge(T=>T.currentUsage),l=Ge(T=>T.maxContextTokens),c=Ge(T=>T.contextBreakdown),u=Ge(T=>T.cacheStats),d=Ge(T=>T.estimateTokens),p=ve(T=>T.messagesBySession),g=we(T=>T.activeSessionId),y=g?p[g]||[]:[];_.useEffect(()=>{if(!t)return;const T=z=>{z.key==="Escape"&&s()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[t,s]);const b=_.useMemo(()=>{if(c)return null;let T=0,z=0;for(const R of y){let Z=R.content||"",Q="";if(R.thinking&&(Z+=" "+R.thinking),R.steps)for(const te of R.steps)te.thought&&(Z+=" "+te.thought),te.action&&(Q+=" "+te.action),te.result&&(Q+=" "+te.result);if(R.toolCalls)for(const te of R.toolCalls)Q+=" "+(typeof te.args=="string"?te.args:JSON.stringify(te.args));T+=d(Z),z+=d(Q)}return{messagesTokens:T,toolTokens:z,total:T+z}},[c,y,d]),S=_.useMemo(()=>{const T=c,z=T?T.messagesTokens:(b==null?void 0:b.messagesTokens)??0,R=T?T.toolContentTokens+T.toolDefTokens:(b==null?void 0:b.toolTokens)??0,Z=T?T.systemPromptTokens:0,Q=T?T.skillTokens:0,te=T?T.mcpToolTokens:0,he=T?T.dynamicTokens:0,me=T?T.total:(b==null?void 0:b.total)??0,lt=Math.max(0,r.totalTokens-me)+he,de=Math.max(r.totalTokens,me,1);return[{key:"system",label:"系统提示词",tokens:Z,color:"bg-dark-text/70"},{key:"tools",label:"系统工具",tokens:R,color:"bg-accent-purple"},{key:"mcp",label:"MCP 工具",tokens:te,color:"bg-accent-cyan"},{key:"skills",label:"技能",tokens:Q,color:"bg-accent-yellow"},{key:"messages",label:"消息",tokens:z,color:"bg-accent-blue"},{key:"other",label:"其他",tokens:lt,color:"bg-dark-muted/60"}].map(W=>({...W,pct:W.tokens/de*100}))},[c,b,r.totalTokens]).filter(T=>T.pct>=.05||T.tokens>0),k=r.totalTokens,C=l>0?Math.min(100,k/l*100):0,E=C>=90?"bg-accent-red":C>=70?"bg-accent-yellow":"bg-dark-text/70",O=C>=90?"text-accent-red":C>=70?"text-accent-yellow":"text-dark-text",j=u&&u.cacheStatsCalls>0&&u.cacheHitRate!==void 0?u.cacheHitRate:null;return t?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",onClick:s,"aria-hidden":"true"}),m.jsx("div",{className:"fixed inset-x-0 bottom-9 z-50 mx-auto max-w-lg px-2 pb-2",children:m.jsxs("div",{className:"animate-slide-up rounded-t-xl rounded-b-md border border-dark-border bg-dark-surface/95 backdrop-blur shadow-[0_-12px_40px_-10px_rgba(0,0,0,0.6)] overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(M0,{size:15,className:O}),m.jsx("span",{className:"text-sm font-semibold text-dark-text",children:"上下文容量"})]}),m.jsx("button",{type:"button","aria-label":"关闭",onClick:s,className:"p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(Ts,{size:15})})]}),m.jsxs("div",{className:"px-4 pb-1",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-xl font-bold font-mono text-dark-text",children:[Jy(k),m.jsxs("span",{className:"text-dark-muted text-sm font-normal",children:[" / ",Jy(l)]})]}),m.jsxs("span",{className:`text-xs font-mono ${O}`,children:["(",C.toFixed(1),"%)"]})]}),m.jsx("div",{className:"mt-1.5 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${E}`,style:{width:`${C}%`}})})]}),m.jsxs("div",{className:"flex items-center justify-between px-4 pt-2 pb-1",children:[m.jsx("span",{className:"text-[11px] font-medium text-dark-muted",children:"分类占比"}),m.jsx("span",{className:"text-[10px] text-dark-muted/50 select-none",title:"按后端上下文组装顺序(上→下):系统提示词 → 系统工具 → MCP 工具 → 技能 → 消息 → 其他(估算差额)",children:"按组装顺序 ↓"})]}),m.jsx("div",{className:"px-4 pb-2 space-y-1.5",children:S.map(T=>m.jsxs("div",{"data-row-key":T.key,className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[11px] text-dark-muted w-16 shrink-0",children:T.label}),m.jsx("div",{className:"flex-1 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("div",{className:`h-full ${T.color} rounded-full`,style:{width:`${Math.max(.5,T.pct)}%`}})}),m.jsx("span",{className:"text-[11px] font-mono text-dark-text w-12 text-right shrink-0",children:ZC(T.pct)})]},T.key))}),m.jsxs("div",{className:"mx-4 mb-3 mt-1 flex items-center justify-between rounded-md bg-dark-bg/70 px-3 py-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-dark-muted",children:[m.jsx(B0,{size:11}),"平均缓存命中率"]}),j!==null?m.jsxs("span",{className:`text-[11px] font-mono font-semibold ${j>=.5?"text-accent-green":"text-accent-yellow"}`,children:[(j*100).toFixed(0),"%"]}):m.jsx("span",{className:"text-[11px] font-mono text-dark-muted/60",children:"–"})]})]})})]}):null}),XC=_.memo(function(t){const{t:s}=gn(),r=Ge(K=>K.currentUsage),l=Ge(K=>K.maxContextTokens),c=Ge(K=>K.model),u=Ge(K=>K.tokenRate),d=Ge(K=>K.compactingUntil),p=Ge(K=>K.lastCompactInfo),g=Ge(K=>K.degradation),y=Ge(K=>K.compactionProgress),b=Ge(K=>K.cacheStats),v=we(K=>K.activeSessionId),S=ve(K=>v?K.isGenerating(v):!1),k=Ze(K=>v?K.bySession[v]:void 0),C=Ze(K=>v?K.getRunningAgentCount(v):0),E=Mi(K=>K.mode),O=Ns(K=>K.autoMode),[j,T]=_.useState(0),z=_.useRef(0),[R,Z]=_.useState(!1);_.useEffect(()=>{if(S&&!z.current&&(z.current=Date.now()),!S){z.current=0,T(0);return}const K=setInterval(()=>T(Math.floor((Date.now()-z.current)/1e3)),1e3);return()=>clearInterval(K)},[S]);const Q=r.totalTokens,te=l>0?Math.min(100,Math.round(r.totalTokens/l*100)):0,he=t1(u),me=E==="normal"?"act":E,lt=Jk[me],de=An(me),W=de==="plan"?"border-accent-blue/30 text-accent-blue":de==="goal"?"border-accent-purple/30 text-accent-purple":"border-accent-green/30 text-accent-green";return m.jsxs("div",{className:"h-9 border-t border-dark-border bg-dark-bg flex items-center px-3 gap-2 shrink-0 select-none text-xs overflow-hidden",children:[m.jsx("span",{className:"font-semibold text-dark-text whitespace-nowrap",children:"DeepSeekCode"}),m.jsx("span",{className:`px-2 py-0.5 rounded-full border whitespace-nowrap ${W}`,children:lt.label}),O&&m.jsx("span",{className:"px-2 py-0.5 rounded-full border border-accent-yellow/30 text-accent-yellow whitespace-nowrap",children:"Auto"}),m.jsx("span",{className:"text-dark-muted truncate max-w-[14rem]",children:c||s("common.connecting")}),m.jsxs("span",{className:"inline-flex items-center text-[11px] whitespace-nowrap shrink-0",title:b&&b.cacheStatsCalls>0?`缓存命中 ${qr(b.cacheHitTokens)} / 未命中 ${qr(b.cacheMissTokens)}(${b.cacheStatsCalls} 次调用)`:"暂无缓存统计(本轮 run 未收到 provider 的 prompt_cache_hit/miss 字段)",children:[m.jsx("span",{className:"text-dark-muted",children:"cache"})," ",b&&b.cacheStatsCalls>0?m.jsx("span",{className:b.cacheHitRate!==void 0&&b.cacheHitRate>=.5?"text-accent-green":"text-accent-yellow",children:b.cacheHitRate!==void 0?`${(b.cacheHitRate*100).toFixed(0)}%`:"n/a"}):m.jsx("span",{className:"text-dark-muted/60",children:"–"})]}),m.jsxs("button",{type:"button",onClick:()=>Z(!0),title:"查看上下文容量详情",className:"group inline-flex items-center gap-1.5 shrink-0 -mx-1 px-1 rounded transition-colors cursor-pointer hover:bg-dark-hover/60",children:[m.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 text-dark-muted whitespace-nowrap",children:[m.jsx("span",{className:"text-dark-text",children:qr(Q)}),m.jsx("span",{className:"text-dark-muted/60",children:"/"}),m.jsx("span",{children:qr(l)})]}),m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"w-16 lg:w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden inline-flex",children:m.jsx("span",{className:`h-full transition-all rounded-full ${te>=90?"bg-accent-red":te>=70?"bg-accent-yellow":"bg-dark-text/70"}`,style:{width:`${te}%`}})}),m.jsxs("span",{className:te>=90?"text-accent-red font-bold":te>=70?"text-accent-yellow":"",children:[te,"%"]})]}),m.jsx(D0,{size:12,className:"text-dark-muted/50 group-hover:text-dark-text transition-colors"})]}),S&&m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-dark-text flex items-center gap-1 whitespace-nowrap",children:[m.jsx(Rn,{size:12,className:"animate-spin"}),Mb(j)]}),he&&m.jsx("span",{className:"text-accent-purple whitespace-nowrap",children:he})]}),C>0&&m.jsxs("span",{className:"text-dark-text whitespace-nowrap",children:[C," agent",C>1?"s":""]}),m.jsx("div",{className:"flex-1"}),k&&m.jsxs("span",{className:"hidden xl:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[m.jsx("span",{className:"text-dark-muted",children:"wf"}),m.jsx("span",{className:"font-mono",children:k.status}),m.jsxs("span",{children:[k.completedPhases,"/",k.totalPhases||0]}),m.jsx("span",{className:"text-dark-muted",children:qr(k.tokensUsed)})]}),y&&m.jsxs("span",{className:"hidden lg:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[m.jsx("span",{children:"compact"}),m.jsxs("span",{children:[y.percent,"%"]}),m.jsx("span",{className:"w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:m.jsx("span",{className:"h-full bg-dark-text/70 rounded-full block",style:{width:`${y.percent}%`}})})]}),!y&&Date.now()<d&&p&&m.jsxs("span",{className:"hidden lg:inline text-dark-muted text-[11px] whitespace-nowrap",children:[p.originalCount," ","->"," ",p.compressedCount]}),(g==null?void 0:g.active)&&m.jsxs("span",{className:"text-accent-yellow text-[11px] whitespace-nowrap",children:[g.label," ",g.retryCount>0?`${g.retryCount}/${g.maxRetries}`:""]}),m.jsx(QC,{open:R,onClose:()=>Z(!1)})]})}),JC=_.memo(function({sessionId:t}){const{t:s}=gn(),r=ve(S=>{if(!t)return;const k=S.messagesBySession[t]??[];for(let C=k.length-1;C>=0;C--){const E=k[C];if(E&&E.type==="assistant")return E.id}}),l=nn(S=>e_(S,t)),c=nn(S=>t_(S,t,r)),u=ve(S=>{if(!t)return;const k=S.messagesBySession[t]??[];for(let C=k.length-1;C>=0;C--){const E=k[C];if(E&&E.type==="user")return E.content}}),d=ve(S=>t?S.generatingSessions.includes(t):!1),p=Ze(S=>t?S.getForSession(t):void 0),g=c||(u?u.replace(/\s+/g," ").trim().slice(0,20):void 0),y=_.useMemo(()=>{const S=p==null?void 0:p.nodes;if(!S)return;const k=S.find(C=>C.status==="pending"||C.status==="scheduled"||C.status==="running");return k==null?void 0:k.title},[p==null?void 0:p.nodes]);if(!t||!g&&!l&&!y&&!d)return null;const b=(l==null?void 0:l.status)==="waiting_user"?"text-accent-yellow":(l==null?void 0:l.status)==="blocked"?"text-accent-red":(l==null?void 0:l.status)==="paused"?"text-dark-300":(l==null?void 0:l.status)==="failed"?"text-accent-red":"text-accent-blue",v=(l==null?void 0:l.status)==="waiting_user"?"bg-accent-yellow":(l==null?void 0:l.status)==="blocked"?"bg-accent-red":(l==null?void 0:l.status)==="paused"?"bg-dark-300":(l==null?void 0:l.status)==="failed"?"bg-accent-red":(l==null?void 0:l.status)==="running"?"bg-accent-blue animate-pulse":"bg-accent-blue";return m.jsxs("div",{className:"h-7 shrink-0 flex items-center gap-2.5 px-3 border-b border-dark-border bg-dark-bg/80 text-[11px] select-none","data-testid":"task-status-bar",children:[g&&m.jsx("span",{className:"min-w-0 truncate font-medium text-dark-text","data-testid":"taskbar-title",children:g}),l&&m.jsxs("span",{title:(l==null?void 0:l.status)==="blocked"?l.blockedReason:void 0,className:`flex min-w-0 items-center gap-1.5 shrink-0 ${b}`,"data-testid":"taskbar-current",children:[m.jsx("span",{className:`inline-block w-1.5 h-1.5 shrink-0 rounded-full ${v}`}),m.jsx("span",{className:"truncate max-w-[18rem]",children:l.title})]}),y&&m.jsxs("span",{className:"shrink-0 min-w-0 truncate text-dark-muted","data-testid":"taskbar-next",children:[s("taskbar.next"),": ",y]}),!l&&d&&m.jsxs("span",{className:"shrink-0 text-dark-muted",children:[s("chat.thinking"),"…"]})]})}),Un=Bt()((a,t)=>({status:null,branches:null,loading:!1,refreshing:!1,lastAction:null,busy:!1,refreshStatus:async()=>{const s=await Ie.git.status();return s.success&&s.data?(a({status:s.data}),s.data):(a({status:{available:!1,error:s.error||"Failed to load git status"}}),null)},refreshBranches:async()=>{const s=await Ie.git.branches();s.success&&s.data?a({branches:s.data}):a({branches:null})},refreshAll:async()=>{if(!t().refreshing){a({refreshing:!0,loading:t().status===null});try{await t().refreshStatus(),await t().refreshBranches()}finally{a({refreshing:!1,loading:!1})}}},commit:async s=>{a({busy:!0});const r=await Ie.git.commit({message:s});return a({busy:!1,lastAction:r.success&&r.data?r.data:{ok:!1,error:r.error||"Commit failed"}}),t().refreshStatus(),t().lastAction},push:async()=>{a({busy:!0});const s=await Ie.git.push();return a({busy:!1,lastAction:s.success&&s.data?s.data:{ok:!1,error:s.error||"Push failed"}}),t().refreshStatus(),t().lastAction},checkout:async s=>{a({busy:!0});const r=await Ie.git.checkout(s);return a({busy:!1,lastAction:r.success&&r.data?r.data:{ok:!1,error:r.error||"Checkout failed"}}),t().refreshAll(),t().lastAction}})),Fd="dsc-git-commit-draft",eE=_.memo(function(){const{t}=gn(),s=Un(R=>R.status),r=Un(R=>R.branches),l=Un(R=>R.busy),c=Un(R=>R.lastAction),u=Da(R=>R.workspaceDir),[d,p]=_.useState(!1),[g,y]=_.useState(""),[b,v]=_.useState(!1),[S,k]=_.useState(null),C=_.useRef(null);_.useEffect(()=>{Un.getState().refreshAll();const R=setInterval(()=>{document.visibilityState==="visible"&&Un.getState().refreshStatus()},3e4);return()=>clearInterval(R)},[]),_.useEffect(()=>{const R=localStorage.getItem(Fd);R&&y(R)},[]);const E=_.useCallback(async()=>{try{const R=await Ie.git.prStatus();R.success&&k(R.data||{available:!1,message:""})}catch{}},[]);_.useEffect(()=>{E()},[E]),_.useEffect(()=>{if(!d)return;const R=Z=>{C.current&&!C.current.contains(Z.target)&&p(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[d]);const O=_.useCallback(async()=>{const R=g.trim();if(!R){Se.warning(t("git.emptyCommitMsg"));return}const Q=await Un.getState().commit(R);Q.ok?(Se.success(t("git.commitSuccess")),v(!1),localStorage.removeItem(Fd),y("")):Se.error(Q.error||t("git.commitFailed"))},[g,t]),j=_.useCallback(async()=>{const Z=await Un.getState().push();Z.ok?Se.success(t("git.pushSuccess")):Se.error(Z.error||t("git.pushFailed"))},[t]),T=_.useCallback(async R=>{const Q=await Un.getState().checkout(R);Q.ok?Se.success(t("git.checkoutSuccess",{branch:R})):Se.error(Q.error||t("git.checkoutFailed"))},[t]),z=s&&s.available===!1;return m.jsxs("div",{ref:C,className:"relative",children:[m.jsxs("button",{onClick:()=>p(R=>!R),className:mt("flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs transition-colors",d?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:t("git.panelTitle"),"aria-expanded":d,children:[m.jsx(Bg,{size:13,className:mt(z?"text-dark-muted/50":"text-accent-blue")}),m.jsx("span",{className:"max-w-[120px] truncate font-mono",children:z?t("git.noRepo"):(s==null?void 0:s.branch)||"—"}),(s==null?void 0:s.dirty)&&m.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-[10px] font-mono tabular-nums",children:[m.jsxs("span",{className:"text-accent-green",children:["+",s.totalAdded??0]}),m.jsxs("span",{className:"text-accent-red",children:["−",s.totalRemoved??0]})]}),m.jsx(oa,{size:11,className:mt("transition-transform",d&&"rotate-180")})]}),d&&m.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-[380px] max-w-[90vw] rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border bg-dark-surface",children:[m.jsx(Bg,{size:14,className:"text-accent-blue"}),m.jsx("span",{className:"text-xs font-medium text-dark-text",children:t("git.panelTitle")}),m.jsx("div",{className:"flex-1"}),m.jsx("button",{onClick:()=>void Un.getState().refreshAll(),className:"rounded p-1 text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",title:t("git.refresh"),children:m.jsx(Rf,{size:12,className:mt(Un.getState().refreshing&&"animate-spin")})})]}),z?m.jsxs("div",{className:"px-3.5 py-4 text-center",children:[m.jsx(L0,{size:20,className:"mx-auto mb-2 text-dark-muted/50"}),m.jsx("div",{className:"text-xs text-dark-muted",children:t("git.notGitDesc")}),m.jsx("div",{className:"mt-1 text-[10px] font-mono text-dark-muted/60 break-all",children:u})]}):s?m.jsxs("div",{className:"p-3.5 space-y-3 max-h-[60vh] overflow-y-auto custom-scrollbar",children:[m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[m.jsx("span",{className:"text-[11px] text-dark-muted",children:t("git.changes")}),m.jsxs("span",{className:"text-[11px] font-mono tabular-nums",children:[m.jsxs("span",{className:"text-accent-green",children:["+",s.totalAdded??0]}),m.jsx("span",{className:"text-dark-muted/40",children:" / "}),m.jsxs("span",{className:"text-accent-red",children:["−",s.totalRemoved??0]})]})]}),m.jsxs("div",{className:"space-y-0.5 max-h-40 overflow-y-auto custom-scrollbar",children:[(s.changes||[]).slice(0,30).map(R=>m.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[m.jsx("span",{className:mt("w-6 shrink-0 rounded px-1 text-center text-[9px]",R.status.includes("?")?"bg-accent-purple/15 text-accent-purple":R.status===R.status.toUpperCase()&&R.status.trim()?"bg-accent-green/15 text-accent-green":"bg-accent-yellow/15 text-accent-yellow"),children:R.status}),m.jsx("span",{className:"flex-1 truncate text-dark-text",children:R.path}),m.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-dark-muted/60",children:[R.added>0&&m.jsxs("span",{className:"text-accent-green",children:["+",R.added]}),R.removed>0&&m.jsxs("span",{className:"text-accent-red",children:["−",R.removed]})]})]},R.path)),(s.changes||[]).length===0&&m.jsx("div",{className:"py-2 text-center text-[11px] text-dark-muted/60",children:t("git.clean")})]})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-dark-muted mb-1",children:t("git.branch")}),m.jsx("div",{className:"flex flex-wrap gap-1",children:((r==null?void 0:r.branches)||[s.branch||""]).slice(0,8).map(R=>m.jsx("button",{onClick:()=>R!==s.branch&&T(R),disabled:R===s.branch,className:mt("rounded-md px-2 py-1 text-[11px] font-mono transition-colors",R===s.branch?"bg-accent-blue/10 text-accent-blue cursor-default":"bg-dark-bg border border-dark-border text-dark-muted hover:border-accent-blue/40 hover:text-dark-text"),children:R},R))}),(s.ahead??0)>0||(s.behind??0)>0?m.jsxs("div",{className:"mt-1 text-[10px] text-dark-muted/70",children:[(s.ahead??0)>0&&m.jsxs("span",{className:"text-accent-green",children:["↑ ",s.ahead," "]}),(s.behind??0)>0&&m.jsxs("span",{className:"text-accent-yellow",children:["↓ ",s.behind]}),t("git.upstream")]}):null]}),m.jsx("div",{children:b?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("textarea",{value:g,onChange:R=>{y(R.target.value),localStorage.setItem(Fd,R.target.value)},placeholder:t("git.commitPlaceholder"),rows:2,className:"w-full rounded-md border border-dark-border bg-dark-bg px-2.5 py-1.5 text-xs text-dark-text placeholder-dark-muted/50 resize-none focus:outline-none focus:border-accent-blue/50"}),m.jsxs("div",{className:"flex gap-1.5",children:[m.jsxs("button",{onClick:O,disabled:l||!g.trim(),className:"flex flex-1 items-center justify-center gap-1 rounded-md bg-accent-green/15 text-accent-green px-2.5 py-1.5 text-xs hover:bg-accent-green/25 transition-colors disabled:opacity-40",children:[l?m.jsx(Rn,{size:12,className:"animate-spin"}):m.jsx(Dg,{size:12}),t("git.commitConfirm")]}),m.jsx("button",{onClick:()=>v(!1),className:"rounded-md px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover transition-colors",children:t("common.cancel")})]})]}):m.jsxs("div",{className:"flex gap-1.5",children:[m.jsxs("button",{onClick:()=>v(!0),disabled:l,className:"flex flex-1 items-center justify-center gap-1.5 rounded-md bg-accent-blue/10 text-accent-blue px-2.5 py-1.5 text-xs hover:bg-accent-blue/20 transition-colors disabled:opacity-50",children:[m.jsx(Dg,{size:13}),t("git.commit")]}),m.jsxs("button",{onClick:j,disabled:l||!s.dirty,className:"flex items-center justify-center gap-1.5 rounded-md bg-dark-bg border border-dark-border text-dark-muted px-2.5 py-1.5 text-xs hover:border-accent-green/40 hover:text-accent-green transition-colors disabled:opacity-40",children:[m.jsx(z0,{size:13}),t("git.push")]})]})}),m.jsxs("div",{className:"flex items-center gap-1.5 rounded-md bg-dark-bg border border-dark-border px-2.5 py-2",children:[m.jsx(U0,{size:13,className:"text-accent-purple shrink-0"}),m.jsx("span",{className:"text-[11px] text-dark-muted truncate",children:S?S.available?t("git.prReady"):S.message||t("git.prUnavailable"):t("git.prLoading")})]}),m.jsxs("div",{className:"rounded-md bg-dark-bg border border-dark-border px-2.5 py-2 space-y-0.5",children:[m.jsx("div",{className:"text-[10px] text-dark-muted",children:t("git.environment")}),m.jsx("div",{className:"text-[11px] font-mono text-dark-text/80 break-all",children:u||"—"}),s.lastCommit&&m.jsxs("div",{className:"text-[10px] font-mono text-dark-muted/60 truncate",children:[s.lastCommit.hash.slice(0,7)," ",s.lastCommit.subject]})]}),c&&m.jsxs("div",{className:mt("flex items-center gap-1.5 text-[11px]",c.ok?"text-accent-green":"text-accent-red"),children:[c.ok?m.jsx(ic,{size:12}):m.jsx(ac,{size:12}),m.jsx("span",{className:"truncate",children:c.ok?t("git.ok"):c.error||""})]})]}):m.jsx("div",{className:"px-3.5 py-4 text-center text-xs text-dark-muted",children:t("git.loading")})]})]})});function tE({onOpenTemplates:a,onSaveAsTemplate:t,saveAsBusy:s}){const[r,l]=_.useState(!1),c=_.useRef(null);return _.useEffect(()=>{if(!r)return;const u=d=>{c.current&&!c.current.contains(d.target)&&l(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),m.jsxs("div",{ref:c,className:"relative",children:[m.jsx("button",{onClick:()=>l(u=>!u),className:"p-1.5 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",title:"更多","aria-label":"更多","aria-expanded":r,children:m.jsx(Xd,{size:16,"aria-hidden":"true"})}),r&&m.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-44 rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden py-1",children:[m.jsxs("button",{onClick:()=>{l(!1),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors",children:[m.jsx(Vo,{size:13,className:"text-dark-muted shrink-0"})," 模板库"]}),m.jsxs("button",{onClick:()=>{l(!1),t()},disabled:s,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors disabled:opacity-40",children:[s?m.jsx(Rn,{size:13,className:"animate-spin shrink-0"}):m.jsx($0,{size:13,className:"text-dark-muted shrink-0"}),"保存为模板"]})]})]})}const nE={info:yb,success:lb,warning:Df,error:Mf},sE={info:"border-accent-blue/30 bg-accent-blue/10 text-accent-blue",success:"border-accent-green/30 bg-accent-green/10 text-accent-green",warning:"border-accent-yellow/30 bg-accent-yellow/10 text-accent-yellow",error:"border-accent-red/30 bg-accent-red/10 text-accent-red"},aE=_.memo(function(){const{toasts:t,dismissToast:s}=sa();return t.length===0?null:m.jsx("div",{className:"fixed bottom-20 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:t.map(r=>{const l=nE[r.type];return m.jsxs("div",{className:`flex items-start gap-2 px-3 py-2.5 rounded-lg border shadow-lg animate-fade-in-up ${sE[r.type]}`,children:[m.jsx(l,{size:16,className:"shrink-0 mt-0.5"}),m.jsx("span",{className:"text-xs flex-1",children:r.message}),m.jsx("button",{onClick:()=>s(r.id),className:"shrink-0 p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:m.jsx(Ts,{size:12})})]},r.id)})})}),iE={critical:{icon:H0,border:"border-accent-red",bg:"bg-accent-red/10",text:"text-accent-red"},error:{icon:Mf,border:"border-accent-red/60",bg:"bg-accent-red/5",text:"text-accent-red"},warning:{icon:Df,border:"border-accent-yellow/60",bg:"bg-accent-yellow/5",text:"text-accent-yellow"},info:{icon:yb,border:"border-accent-blue/60",bg:"bg-accent-blue/5",text:"text-accent-blue"}},rE={info:6e3,warning:1e4},lE=_.memo(function(){const t=Ri(l=>l.errors),s=Ri(l=>l.dismiss),r=t.filter(l=>!l.dismissed);return _.useEffect(()=>{const l=r.filter(c=>!c.action).map(c=>{const u=c.durationMs??rE[c.level];return u?setTimeout(()=>s(c.id),u):null}).filter(c=>c!==null);return()=>l.forEach(clearTimeout)},[r,s]),r.length===0?null:m.jsx("div",{className:"fixed bottom-4 right-4 z-[110] flex flex-col gap-2 max-w-sm",children:r.map(l=>{const c=iE[l.level],u=c.icon;return m.jsx(oE,{entry:l,icon:u,config:c,onDismiss:()=>s(l.id)},l.id)})})});function oE({entry:a,icon:t,config:s,onDismiss:r}){const[l,c]=_.useState(!1);return m.jsxs("div",{className:`flex flex-col px-3 py-2.5 rounded-lg border shadow-lg animate-fade-in-up ${s.bg} ${s.border}`,children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(t,{size:16,className:`shrink-0 mt-0.5 ${s.text}`}),m.jsx("span",{className:`text-xs flex-1 ${s.text}`,children:a.title}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.detail&&m.jsx("button",{onClick:()=>c(!l),className:"p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:l?m.jsx(oa,{size:12}):m.jsx(gb,{size:12})}),m.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:m.jsx(Ts,{size:12})})]})]}),l&&a.detail&&m.jsx("div",{className:"mt-1.5 ml-6 text-[11px] text-dark-muted whitespace-pre-wrap break-words leading-relaxed border-t border-dark-border/50 pt-1.5",children:a.detail}),a.action&&m.jsx("button",{onClick:a.action.onClick,className:"mt-1.5 ml-6 self-start text-[11px] px-2 py-0.5 rounded bg-dark-hover hover:bg-dark-border transition-colors",children:a.action.label})]})}function cE(a){const{t}=gn(),{setActiveTab:s,createNewSession:r,clearMessages:l,setTheme:c,setThemePreset:u,toggleTerminal:d,setLogs:p,setUnreadLogs:g}=a,y=Ff(W=>W.backendCommands),b=Array.isArray(y)?y:[],[v,S]=_.useState(!1),[k,C]=_.useState(""),[E,O]=_.useState(0),j=_.useRef(null),T=_.useCallback((W,K)=>{const ge=we.getState().activeSessionId;return ge?(pe.setSessionId(ge),pe.send({type:"command_execute",sessionId:ge,data:JSON.stringify({command:`/${W}`,args:K||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${W}`}):{success:!1,message:t("slashCommands.noActiveSession")}},[t]),z=_.useMemo(()=>[{id:"chat",name:"chat",description:t("slashCommands.chat_desc"),icon:"💬",local:!0,action:()=>(s("chat"),{success:!0,message:t("slashCommands.chat_result")})},{id:"terminal",name:"terminal",description:t("slashCommands.terminal_desc"),icon:"💻",local:!0,action:()=>(s("terminal"),{success:!0,message:t("slashCommands.terminal_result")})},{id:"files",name:"files",description:t("slashCommands.files_desc"),icon:"📁",local:!0,action:()=>(s("files"),{success:!0,message:t("slashCommands.files_result")})},{id:"models",name:"models",description:t("slashCommands.models_desc"),icon:"🧠",local:!0,action:()=>(s("models"),{success:!0,message:t("slashCommands.models_result")})},{id:"tools",name:"tools",description:t("slashCommands.tools_desc"),icon:"🔧",local:!0,action:()=>(s("tools"),{success:!0,message:t("slashCommands.tools_result")})},{id:"skills",name:"skills",description:t("slashCommands.skills_desc"),icon:"🎯",local:!0,action:()=>(s("skills"),{success:!0,message:t("slashCommands.skills_result")})},{id:"settings",name:"settings",description:t("slashCommands.settings_desc"),icon:"⚙️",local:!0,action:()=>(s("settings"),{success:!0,message:t("slashCommands.settings_result")})},{id:"logs",name:"logs",description:t("slashCommands.logs_desc"),icon:"📜",local:!0,action:()=>(s("logs"),g(0),{success:!0,message:t("slashCommands.logs_result")})},{id:"new",name:"new",description:t("slashCommands.new_desc"),icon:"✨",local:!0,action:()=>(r(),{success:!0,message:t("slashCommands.new_result")})},{id:"clear",name:"clear",description:t("slashCommands.clear_desc"),icon:"🗑️",local:!0,action:()=>(l(),{success:!0,message:t("slashCommands.clear_result")})},{id:"theme",name:"theme",description:t("slashCommands.theme_desc"),args:"<dark|light|auto|preset-name>",icon:"🎨",local:!0,action:W=>{const K=W.trim().toLowerCase();if(["dark","light","auto"].includes(K))return c(K),{success:!0,message:t("slashCommands.theme_result")+K};if(ll[K])return u?(u(K),{success:!0,message:t("slashCommands.theme_preset_result")+ll[K].nameKey}):{success:!1,message:t("slashCommands.theme_preset_unavailable")};const ge=Object.keys(ll).join("|");return{success:!1,message:t("slashCommands.theme_error",{presets:ge})}}},{id:"terminal-toggle",name:"terminal-toggle",description:t("slashCommands.toggle_terminal_desc"),icon:"🔲",local:!0,action:()=>(d(),{success:!0,message:t("slashCommands.toggle_terminal_result")})},{id:"clear-logs",name:"clear-logs",description:t("slashCommands.logs_clear_desc"),icon:"📭",local:!0,action:()=>(p([]),g(0),{success:!0,message:t("slashCommands.logs_clear_result")})},{id:"doctor",name:"doctor",description:t("slashCommands.doctor_desc"),icon:"🩺",local:!1,action:()=>T("doctor")},{id:"compact",name:"compact",description:t("slashCommands.compact_desc"),args:"[aggressive|summary]",icon:"🗜️",local:!1,action:W=>T("compact",W)},{id:"help",name:"help",description:t("slashCommands.help_desc"),icon:"❓",local:!1,action:()=>T("help")},{id:"cost",name:"cost",description:t("slashCommands.token_desc"),args:"[detail|reset]",icon:"💰",local:!1,action:W=>T("cost",W)},{id:"model",name:"model",description:t("slashCommands.model_desc"),args:"[model-name]",icon:"🤖",local:!1,action:W=>T("model",W)},{id:"status",name:"status",description:t("slashCommands.status_desc"),icon:"📊",local:!1,action:()=>T("status")},{id:"config",name:"config",description:t("slashCommands.config_desc"),args:"<get|set|list|delete> [key] [value]",icon:"🔧",local:!1,action:W=>T("config",W)},{id:"exit",name:"exit",description:t("slashCommands.exit_desc"),icon:"🚪",local:!1,action:()=>{const W=we.getState().activeSessionId;return W&&(pe.setSessionId(W),pe.send({type:"exit",sessionId:W})),{success:!0,message:t("slashCommands.exit_result")}}},{id:"test",name:"test",description:t("slashCommands.benchmark_desc"),args:"[simple|medium|complex|full|list]",icon:"🧪",local:!1,action:W=>T("test",W)}],[s,r,l,c,u,d,p,g,T,t]),R=_.useMemo(()=>b.map(W=>{const K=t(`slashCommands.${W.name}_desc`,W.description||W.usage||"");return{id:`backend-${W.name}`,name:W.name,description:K,icon:"🔌",local:!1,action:ge=>{const $=we.getState().activeSessionId;return $?(pe.setSessionId($),pe.send({type:"command_execute",sessionId:$,data:JSON.stringify({command:`/${W.name}`,args:ge||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${W.name}`}):{success:!1,message:t("slashCommands.noActiveSession")}}}}),[b,t]),Z=_.useMemo(()=>{const W=new Set;return[...z,...R].filter(K=>W.has(K.name)?!1:(W.add(K.name),!0))},[z,R]),Q=_.useMemo(()=>{if(!k)return Z;const W=k.toLowerCase();return Z.filter(K=>K.name.toLowerCase().includes(W)||K.description.toLowerCase().includes(W))},[Z,k]),te=_.useCallback(()=>{S(!0),C(""),O(0)},[]),he=_.useCallback(()=>{S(!1),C(""),O(0)},[]),me=_.useCallback(()=>{O(W=>W>=Q.length-1?0:W+1)},[Q.length]),lt=_.useCallback(()=>{O(W=>W<=0?Q.length-1:W-1)},[Q.length]),de=_.useCallback((W,K)=>{const ge=W.action(K);return he(),ge},[he]);return _.useEffect(()=>{if(v&&j.current){const W=j.current.querySelector(`[data-index="${E}"]`);W&&W.scrollIntoView({block:"nearest"})}},[E,v]),{isOpen:v,filter:k,setFilter:C,selectedIndex:E,setSelectedIndex:O,filteredCommands:Q,allCommands:Z,openMenu:te,closeMenu:he,selectNext:me,selectPrev:lt,executeCommand:de,containerRef:j,commands:z}}function NN(a){const t=a.trim();if(!t.startsWith("/"))return null;const r=t.slice(1).split(/\s+/),l=r[0]||"",c=r.slice(1).join(" ");return{command:l,args:c}}function uE({open:a,onClose:t,options:s}){const{t:r}=gn(),{filter:l,setFilter:c,filteredCommands:u,selectedIndex:d,setSelectedIndex:p,selectNext:g,selectPrev:y,executeCommand:b,openMenu:v,closeMenu:S}=cE(s),k=_.useRef(null),C=_.useRef(null),[E,O]=_.useState(!1);if(_.useEffect(()=>{a?(v(),O(!1),setTimeout(()=>{var z;return(z=k.current)==null?void 0:z.focus()},0)):S()},[a,v,S]),_.useEffect(()=>{if(!a||!C.current)return;const z=C.current.querySelector(`[data-cmd-index="${d}"]`);z&&z.scrollIntoView({block:"nearest"})},[d,a]),!a)return null;const j=z=>{z.local||(O(!0),Se.info(r("palette.running")));const R=b(z,"");z.local&&(R!=null&&R.message)&&Se.success(R.message),t()},T=z=>{if(z.key==="ArrowDown")z.preventDefault(),g();else if(z.key==="ArrowUp")z.preventDefault(),y();else if(z.key==="Enter"){z.preventDefault();const R=u[d];R&&j(R)}else z.key==="Escape"&&(z.preventDefault(),t())};return m.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center bg-black/50 backdrop-blur-sm pt-[12vh] px-4 animate-fade-in",onClick:t,role:"dialog","aria-modal":"true","aria-label":r("a11y.commandPalette"),children:m.jsxs("div",{className:"w-full max-w-xl bg-dark-surface border border-dark-border rounded-xl shadow-2xl overflow-hidden",onClick:z=>z.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-dark-border",children:[m.jsx(I0,{size:16,className:"text-dark-muted shrink-0","aria-hidden":"true"}),m.jsx("input",{ref:k,value:l,onChange:z=>{c(z.target.value),p(0)},onKeyDown:T,placeholder:r("palette.placeholder"),"aria-label":r("palette.placeholder"),className:"flex-1 bg-transparent text-sm text-dark-text placeholder-dark-muted outline-none"}),E&&m.jsx("span",{className:"text-[10px] text-accent-blue animate-pulse-soft shrink-0",children:r("palette.running")})]}),m.jsx("div",{ref:C,className:"max-h-[50vh] overflow-y-auto custom-scrollbar py-1",children:u.length===0?m.jsx("div",{className:"px-4 py-8 text-center text-sm text-dark-muted",children:r("palette.empty")}):u.map((z,R)=>m.jsxs("button",{"data-cmd-index":R,onClick:()=>j(z),onMouseEnter:()=>p(R),className:`w-full px-4 py-2.5 flex items-center gap-3 text-left transition-colors ${R===d?"bg-accent-blue/10 border-l-2 border-accent-blue":"border-l-2 border-transparent hover:bg-dark-hover"}`,children:[m.jsx("span",{className:"text-lg shrink-0","aria-hidden":"true",children:z.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",z.name]}),z.args&&m.jsx("span",{className:"text-xs text-dark-muted",children:z.args}),!z.local&&m.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:r("slashCommands.backend")})]}),m.jsx("div",{className:"text-xs text-dark-muted truncate",children:z.description})]}),R===d&&m.jsx(P0,{size:14,className:"text-dark-muted shrink-0","aria-hidden":"true"})]},z.id))}),m.jsx("div",{className:"px-4 py-2 border-t border-dark-border text-[10px] text-dark-muted bg-dark-bg",children:r("palette.hint")})]})})}function Cs({keys:a,label:t}){return m.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-dark-border/50 last:border-0",children:[m.jsx("span",{className:"text-sm text-dark-text",children:t}),m.jsx("span",{className:"flex items-center gap-1",children:a.map(s=>m.jsx("kbd",{className:"px-2 py-0.5 text-xs font-mono bg-dark-bg rounded border border-dark-border text-dark-muted",children:s},s))})]})}function dE({open:a,onClose:t}){const{t:s}=gn(),r=navigator.platform.toLowerCase().includes("mac")?"⌘":"Ctrl";return m.jsx(Pf,{isOpen:a,onClose:t,title:s("shortcuts.title"),size:"md",children:m.jsxs("div",{className:"space-y-0.5",children:[m.jsx(Cs,{keys:[r,"K"],label:s("shortcuts.commandPalette")}),m.jsx(Cs,{keys:[r,"L"],label:s("shortcuts.clearLogs")}),m.jsx(Cs,{keys:[r,"/"],label:s("shortcuts.help")}),m.jsx(Cs,{keys:[r,"Enter"],label:s("shortcuts.submit")}),m.jsx(Cs,{keys:["Shift","Enter"],label:s("shortcuts.newline")}),m.jsx(Cs,{keys:["/"],label:s("shortcuts.slashCommand")}),m.jsx(Cs,{keys:["@"],label:s("shortcuts.fileRef")}),m.jsx(Cs,{keys:["Esc"],label:s("shortcuts.closeDialog")}),m.jsx(Cs,{keys:["Esc","Esc"],label:s("shortcuts.stopGen")})]})})}function fE({isOpen:a,onClose:t,title:s,collapsedSummary:r,badge:l,children:c,maxHeight:u="45vh",onExpandedChange:d,className:p}){const[g,y]=_.useState(!0);_.useEffect(()=>{a&&y(!0)},[a]),_.useEffect(()=>{d==null||d(g)},[g,d]);const b=_.useCallback(()=>{y(v=>!v)},[]);return a?m.jsxs("div",{className:mt("shrink-0 bg-dark-surface/95 backdrop-blur border-t border-dark-border shadow-[0_-10px_30px_-15px_rgba(0,0,0,0.5)]",p),children:[m.jsxs("div",{role:"button","aria-expanded":g,tabIndex:0,onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b())},title:g?"折叠抽屉,查看消息":"展开抽屉,做出选择",className:mt("flex items-center gap-2 px-4 py-2 cursor-pointer select-none transition-colors","hover:bg-dark-hover/60"),children:[m.jsx("span",{className:mt("shrink-0 text-dark-muted transition-transform duration-200",!g&&"rotate-180"),children:m.jsx(oa,{size:16})}),m.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[m.jsx("span",{className:"text-sm font-semibold text-dark-text truncate",children:s}),l,!g&&r&&m.jsx("span",{className:"min-w-0 flex items-center gap-1.5 text-xs text-dark-muted truncate",children:r})]}),m.jsx("button",{type:"button","aria-label":"关闭",onClick:v=>{v.stopPropagation(),t()},className:"shrink-0 p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:m.jsx(Ts,{size:15})})]}),g&&m.jsx("div",{className:"animate-slide-up border-t border-dark-border/60 overflow-y-auto custom-scrollbar p-4",style:{maxHeight:u},children:c})]}):null}const pE=_.lazy(()=>mn(()=>import("./ModelsView-CPm2WAbG.js"),__vite__mapDeps([0,1,2,3,4,5])).then(a=>({default:a.ModelsView}))),hE=_.lazy(()=>mn(()=>import("./ToolsView-Y5MpTnXY.js"),__vite__mapDeps([6,1,2,3,4,5])).then(a=>({default:a.ToolsView}))),mE=_.lazy(()=>mn(()=>import("./SkillsView-CS0XvZ4N.js"),__vite__mapDeps([7,1,2,3,4,5])).then(a=>({default:a.SkillsView}))),gE=_.lazy(()=>mn(()=>import("./TemplatesTab-Pwfjxer7.js"),__vite__mapDeps([8,1,2,3,4,5])).then(a=>({default:a.TemplatesTab}))),yE=_.lazy(()=>mn(()=>import("./HookConfigView-DM6IVFGm.js"),__vite__mapDeps([9,1,2,4,3,5])).then(a=>({default:a.HookConfigView}))),bE=_.lazy(()=>mn(()=>import("./FileTreeView-_N5eobgO.js"),__vite__mapDeps([10,1,2,3,4,5])).then(a=>({default:a.FileTreeView}))),xE=_.lazy(()=>mn(()=>import("./TerminalView-C__4-QSL.js"),__vite__mapDeps([11,1,2,12,3,4,5,13])).then(a=>({default:a.TerminalView}))),vE=_.lazy(()=>mn(()=>import("./SessionGrid-C-Z-kzmG.js"),__vite__mapDeps([14,1,2,3,4,5])).then(a=>({default:a.SessionGrid}))),SE=_.lazy(()=>mn(()=>import("./SettingsPanel-D9kr-sFj.js"),__vite__mapDeps([15,1,2,3,4,5])).then(a=>({default:a.SettingsPanel}))),kE=_.lazy(()=>mn(()=>import("./ChannelConfigView-CjcMwBSL.js"),__vite__mapDeps([16,1,2,3,4,5])).then(a=>({default:a.ChannelConfigView}))),wE=_.lazy(()=>mn(()=>import("./ConnectorsView-CTFoG0sF.js"),__vite__mapDeps([17,1,2,3,4,5])).then(a=>({default:a.ConnectorsView}))),_E=_.lazy(()=>mn(()=>import("./AutomationView-BbLzZ7Db.js"),__vite__mapDeps([18,1,2,3,4,5])).then(a=>({default:a.AutomationView}))),CE=_.lazy(()=>mn(()=>import("./PluginsView-D9pzIe-R.js"),__vite__mapDeps([19,1,2,3,4,5])).then(a=>({default:a.PluginsView}))),EE=()=>m.jsx("div",{className:"flex-1 flex items-center justify-center bg-dark-bg",children:m.jsx("div",{className:"w-5 h-5 border-2 border-accent-blue border-t-transparent rounded-full animate-spin"})}),Gf=[{id:"chat",labelKey:"nav.chat",icon:rc},{id:"terminal",labelKey:"nav.terminal",icon:F0},{id:"files",labelKey:"nav.files",icon:G0},{id:"models",labelKey:"nav.models",icon:q0},{id:"tools",labelKey:"nav.tools",icon:V0},{id:"skills",labelKey:"nav.skills",icon:W0},{id:"templates",labelKey:"nav.templates",icon:Vo},{id:"hooks",labelKey:"nav.hooks",icon:K0},{id:"channels",labelKey:"nav.channels",icon:Y0},{id:"connectors",labelKey:"nav.connectors",icon:Z0},{id:"scheduled",labelKey:"nav.scheduled",icon:Q0},{id:"logs",labelKey:"nav.logs",icon:el},{id:"settings",labelKey:"nav.settings",icon:X0},{id:"plugins",labelKey:"nav.plugins",icon:J0}],Gd=Object.fromEntries(Gf.map(a=>[a.id,a.labelKey])),NE=Gf.map(a=>({id:a.id,title:a.labelKey})),TE=Object.fromEntries(Gf.map(a=>[a.id,a.icon]));function AE(){const[a,t]=_.useState("chat"),[s,r]=_.useState(!1),[l,c]=_.useState([]),[,u]=_.useState(0),[d,p]=_.useState(!1),[g,y]=_.useState(!1),[b,v]=_.useState(!1),[S,k]=_.useState(null),[C,E]=_.useState(!1),[O,j]=_.useState(!1),[T,z]=_.useState({}),[R,Z]=_.useState(!1),[Q,te]=_.useState(null),[he,me]=_.useState(!1),lt=_.useRef(null),de=_.useRef(null),[W,K]=_.useState(()=>localStorage.getItem("dsc-sidebar-collapsed")==="1"),ge=_.useCallback(()=>{K(B=>(localStorage.setItem("dsc-sidebar-collapsed",B?"0":"1"),!B))},[]),$=_.useCallback(()=>{Z(B=>!B),me(!1)},[]),X=_.useCallback(()=>{const B=lt.current;B&&(he?B.resize(de.current??20):(de.current=B.getSize(),B.resize(68)),me(G=>!G))},[he]);_.useEffect(()=>{const B=window.matchMedia("(min-width: 1400px)"),G=ee=>{ee.matches||Z(!1)};return B.addEventListener("change",G),()=>B.removeEventListener("change",G)},[]);const{t:ne,i18n:Oe}=gn(),{toggleTerminal:Me}=hk(),{theme:Pe,setTheme:je,setThemePreset:Ee,language:nt,workspaceDir:st,setWorkspaceDir:Kt,effort:Mn}=Da(),sn=Ns();_.useEffect(()=>{nt&&Oe.language!==nt&&Oe.changeLanguage(nt)},[nt,Oe]);const bn=_.useMemo(()=>NE.filter(B=>!(B.id==="terminal"&&S===!1)),[S]),Jn=_.useMemo(()=>bn.map(B=>({...B,iconComponent:TE[B.id]})),[bn]),Y=_.useCallback(B=>{_.startTransition(()=>{t(B)})},[]),[Je,ke]=_.useState(null),oe=_.useCallback(B=>{ke({section:B,nonce:Date.now()})},[]);_.useEffect(()=>{const B=ee=>{const ie=ee.message||ne("common.unknownError"),xe=ee.filename||"global";xe.includes("chrome-extension://")||xe.includes("moz-extension://")||c(Fe=>[...Fe,{id:`error-${Date.now()}-${Zn()}`,level:"error",source:"Browser",message:`${ne("toast.uncaughtError")}${ie}`,timestamp:Date.now()}].slice(-500))},G=ee=>{var xe;const ie=((xe=ee.reason)==null?void 0:xe.message)||ee.reason||ne("toast.unknownReason");c(Fe=>[...Fe,{id:`rejection-${Date.now()}-${Zn()}`,level:"error",source:"Promise",message:`${ne("toast.uncaughtRejection")}${ie}`,timestamp:Date.now()}].slice(-500))};return window.addEventListener("error",B),window.addEventListener("unhandledrejection",G),()=>{window.removeEventListener("error",B),window.removeEventListener("unhandledrejection",G)}},[ne]);const{sessionTabs:ot,activeSessionId:se,setActiveSession:Pn,addSessionTab:Yt,closeSessionTab:bt,renameSessionTab:St,getVisibleSessionTabs:qt,autoNameSession:za,touchSession:Pi}=we(),Dt=se?T[se]??!0:!0,Fi=Ze(B=>se?Object.keys(B.tasksBySession[se]||{}).length:0),Gi=_.useCallback(()=>{z(B=>se?{...B,[se]:!(B[se]??!0)}:B)},[se]),[Pt,Ua]=_.useState(()=>typeof window<"u"&&window.innerWidth<768);_.useEffect(()=>{const B=window.matchMedia("(max-width: 767px)"),G=ee=>Ua(ee.matches);return B.addEventListener("change",G),()=>B.removeEventListener("change",G)},[]);const an=Ze(B=>se?B.getForSession(se):void 0),qi=_.useRef(null),bl=_.useRef(null);_.useEffect(()=>{if(Pt)return;const B=an&&["RUNNING","RESUMING","PAUSED"].includes(String(an.status)),G=Fi>0;B&&an&&qi.current!==an.runId?(qi.current=an.runId,Z(!0)):G&&bl.current!==se&&(bl.current=se??null,Z(!0))},[an==null?void 0:an.runId,an==null?void 0:an.status,Fi,se,Pt]);const $a=nn(B=>{var G;return se?((G=B.bySession[se])==null?void 0:G.artifacts.length)??0:0}),es=_.useRef({sessionId:null,count:0});_.useEffect(()=>{const B=es.current;if(se!==B.sessionId){es.current={sessionId:se??null,count:$a};return}!Pt&&$a>B.count&&Z(!0),es.current={sessionId:se??null,count:Math.max($a,B.count)}},[$a,se,Pt]);const{clearMessages:Ft}=ve(),Bn=ve(B=>se?B.messagesBySession[se]||[]:[]),{customTheme:Vt,customThemeEnabled:dc,themePresetId:fc}=Da();WC({theme:Pe,themePresetId:fc,customTheme:Vt,customThemeEnabled:dc}),qC({activeTab:a,setLogs:c,setUnreadLogs:u}),_.useEffect(()=>{H.get("/api/terminal/status").then(B=>k(B.success&&B.data?B.data.ttydAvailable!==!1:!1)).catch(()=>k(!1))},[]),_.useEffect(()=>{const B=G=>{const ee=G.detail,ie=typeof ee=="string"?ee:ee==null?void 0:ee.tab,xe=typeof ee=="string"||ee==null?void 0:ee.section;ie&&ie!==a&&Y(ie),ie==="settings"&&xe&&oe(xe)};return window.addEventListener("switch-tab",B),()=>window.removeEventListener("switch-tab",B)},[a,Y,oe]),_.useEffect(()=>{const B=G=>{var ie;const ee=(ie=G.detail)==null?void 0:ie.path;ee&&(te(ee),Z(!0))};return window.addEventListener("preview-file",B),()=>window.removeEventListener("preview-file",B)},[]);const Ha=_.useCallback(()=>{const B=window.location.hash.replace(/^#\/?/,"");if(!B)return;const[G,ee]=B.split("/");G&&G in Gd&&Y(G),G==="settings"&&ee==="stt"&&oe("stt")},[Y,oe]);_.useEffect(()=>(Ha(),window.addEventListener("hashchange",Ha),()=>window.removeEventListener("hashchange",Ha)),[Ha]),_.useEffect(()=>{const B=pe.onOpen(()=>{r(!0),Se.success(ne("toast.backendConnected"))}),G=pe.onClose(()=>{s&&Se.warning(ne("toast.backendDisconnected")),r(!1)});return()=>{B(),G()}},[s,ne]);const Ia=_.useCallback(async()=>{try{const B=await Ie.sessions.list();if(!B.success||!Array.isArray(B.data))return!1;const G=YC(B.data);if(G.length===0)return!1;const ee=G[0],ie=xe=>({id:xe.id,title:xe.title,createdAt:xe.createdAt,lastActiveAt:xe.lastActiveAt,preview:xe.preview,status:"done"});return we.setState(xe=>{const Fe=xe.sessionTabs.some(We=>We.id===ee.id)?xe.sessionTabs:[ie(ee),...xe.sessionTabs].slice(0,rf),qe=new Set(Fe.map(We=>We.id)),ft=[...G.map(ie).filter(We=>!qe.has(We.id)),...xe.historySessions.filter(We=>!G.some(rs=>rs.id===We.id))].slice(0,Po),Ue=[...G.map(We=>({id:We.id,title:We.title,createdAt:new Date(We.createdAt).toISOString(),updatedAt:new Date(We.lastActiveAt??We.createdAt).toISOString(),messageCount:We.messageCount??0})),...xe.sessions.filter(We=>!G.some(rs=>rs.id===We.id))];return{sessionTabs:Fe,historySessions:ft,sessions:Ue,activeSessionId:ee.id}}),!0}catch{return!1}},[]);_.useEffect(()=>{if(we.getState().sessionTabs.length>0)return;let B=!1;return Ia().then(G=>{B||G||Yt(ne("chat.defaultSessionTitle",{n:1}))}),()=>{B=!0}},[]),_.useEffect(()=>{const B=()=>y(!0);return window.addEventListener("hook-approval-required",B),()=>window.removeEventListener("hook-approval-required",B)},[]);const fa=_.useRef(se);_.useEffect(()=>{fa.current=se},[se]);const ts=_.useCallback(B=>{var ie,xe,Fe;if(!B)return!1;const G=window,ee=(ie=G.__pendingQuestions)==null?void 0:ie[B];return ee?(xe=G.__answeredQuestionIds)!=null&&xe.has(ee.questionId)?(delete G.__pendingQuestions[B],((Fe=G.__pendingQuestion)==null?void 0:Fe.questionId)===ee.questionId&&(G.__pendingQuestion=null),!1):(G.__pendingQuestion=ee,v(!0),!0):!1},[]);_.useEffect(()=>{const B=G=>{const ee=G.detail||fa.current;ts(ee)};return window.addEventListener("ask-question-required",B),()=>window.removeEventListener("ask-question-required",B)},[ts]),_.useEffect(()=>{se&&ts(se)},[se,ts]);const ns=_.useCallback(()=>{var ee;const B=window,G=B.__pendingQuestion;if(G!=null&&G.questionId){B.__answeredQuestionIds=B.__answeredQuestionIds||new Set,B.__answeredQuestionIds.add(G.questionId);const ie=B.__pendingQuestions||{};for(const xe of Object.keys(ie))((ee=ie[xe])==null?void 0:ee.questionId)===G.questionId&&delete ie[xe];B.__pendingQuestion=null}v(!1)},[]);_.useEffect(()=>{sn.autoMode&&sn.pendingApprovals.length>0&&y(!1),sn.pendingApprovals.length>0&&!sn.autoMode&&y(!0)},[sn.autoMode,sn.pendingApprovals.length]);const pa=_.useRef(0);_.useEffect(()=>{const B=G=>{var Ue,We;if(G.key!=="Escape"||G.defaultPrevented)return;const ee=(Ue=G.target)==null?void 0:Ue.tagName;if(ee==="INPUT"||ee==="TEXTAREA"||(We=G.target)!=null&&We.isContentEditable)return;const ie=ve.getState(),Fe=we.getState().activeSessionId;if(!Fe||!ie.isGenerating(Fe))return;G.preventDefault();const qe=Date.now(),ft=pa.current;pa.current=qe,ft>0&&qe-ft<500?(pe.send({type:"stop",sessionId:Fe}),Se.info(ne("toast.terminated"))):(pe.send({type:"pause",sessionId:Fe}),Se.info(ne("toast.paused")))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[ne]);const[ss,xl]=_.useState(!1),as=_.useCallback(()=>{_.startTransition(()=>{const B=Yt(void 0,st);pe.setSessionId(B),Mi.getState().setMode("auto-act"),Y("chat")})},[Yt,st,Y]),Vi=_.useCallback(B=>{_.startTransition(()=>{const G=we.getState();let ee=G.activeSessionId;ee||(ee=G.addSessionTab(void 0,st),pe.setSessionId(ee)),ve.getState().setSessionInput(ee,`$${B.id} `),Y("chat")})},[st,Y]),is=_.useCallback(()=>Y("templates"),[Y]),Wi=_.useCallback(async(B,G)=>{var ft;const ee=await Ie.templates.render(B.id,G);if(!ee.success||!ee.data){Se.error(ee.error||"模板渲染失败");return}const ie=ee.data,xe=Yt(B.name,st);pe.setSessionId(xe),Mi.getState().setMode("auto-act"),Y("chat");const Fe=`wf-${Date.now()}-${Zn()}`;Ze.getState().upsert(xe,{runId:Fe,status:"RUNNING",completedPhases:0,totalPhases:((ft=ie.nodes)==null?void 0:ft.length)??0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"});const qe=await Ie.workflows.start({sessionId:xe,runId:Fe,workflow:ie,message:`[模板] ${B.name}`});if(!qe.success||!qe.data){Se.error(qe.error||"工作流启动失败"),Ze.getState().fail(xe,Fe,qe.error||"启动失败");return}if(qe.data.status==="FAILED"){const Ue=qe.data.error||"模板定义无效";Se.error(`工作流启动失败: ${Ue}`),Ze.getState().fail(xe,Fe,Ue)}},[Yt,st,Y]),vl=_.useCallback(async()=>{if(ss||!se)return;const B=Ze.getState().getForSession(se),G=B==null?void 0:B.runId;if(!G){Se.info("当前会话没有可保存的工作流运行");return}xl(!0),Se.info("正在泛化为模板…");try{const ee=await Ie.templates.createFromRun(G,{generalize:!0});ee.success&&ee.data?ee.data.degraded?Se.warning(`已保存为模板「${ee.data.name}」(v${ee.data.version}),但 LLM 泛化失败,已原样保存${ee.data.degradeReason?`:${ee.data.degradeReason}`:""}`):Se.success(`已保存为模板「${ee.data.name}」(v${ee.data.version})`):Se.error(ee.error||"保存模板失败")}finally{xl(!1)}},[se,ss]),Ki=_.useRef(0),Yi=_.useCallback(async B=>{if(!B)return;const G=++Ki.current;try{const ee=await Ie.sessions.resume(B);if(G!==Ki.current||!ee.success||!ee.data)return;const ie=ee.data;ie.session&&we.getState().updateSession(B,ie.session);const xe=ie.messages||[];if(xe.length>0){const Fe=xe.flatMap(Ue=>Ue.type!=="user"&&Ue.type!=="assistant"&&Ue.type!=="system"?[]:[{id:Ue.id||`msg-${Ue.timestamp||Date.now()}`,type:Ue.type,content:Ue.content||"",timestamp:Ue.timestamp||Date.now(),thinking:Ue.thinking||void 0}]);ve.getState().replaceMessages(B,Fe);const qe=xe.find(Ue=>Ue.type==="user"),ft=typeof(qe==null?void 0:qe.content)=="string"?qe.content.replace(/\s+/g," ").trim():"";we.getState().touchSession(B,ft||void 0)}}catch{}},[]),Pa=_.useCallback(B=>{Pn(B),pe.setSessionId(B)},[Pn]),Fa=_.useCallback(B=>{bt(B)},[bt]),Zi=_.useCallback((B,G)=>{St(B,G)},[St]),Ga=_.useCallback(()=>{se&&Ft(se)},[se,Ft]);_.useEffect(()=>{if(!se)return;const B=ve.getState().messagesBySession[se];B&&B.length>0&&Ge.getState().recalculateFromMessages(B)},[se]),_.useEffect(()=>{if(!se)return;ve.getState().getMessages(se).length===0&&Yi(se)},[se,Yi]);const xn=_.useCallback(async(B,G,ee,ie)=>{if(!G.trim())return;ve.getState().isGenerating(B)&&(console.warn(`[sendMessage] Session ${B} stuck in generating state — force-ending`),ve.getState().endGeneration(B,"Force-ended: new message"));const Fe=Mi.getState();ve.getState().resumeGeneration(B),pe.setSessionId(B),ve.getState().getMessages(B).some(rn=>rn.type==="user")?Pi(B):(za(B,G.trim()),Pi(B,G.trim()));let Ue=G.trim();if(ee&&ee.length>0){const rn=[],qa=[...ee].sort((Lt,_t)=>_t.length-Lt.length);for(const Lt of qa){Ue=Ue.split(`@${Lt}`).join("").trim();try{const _t=await Ie.files.read(Lt),Ji=_t.success&&_t.data?_t.data:null;if(Ji){const mc=Lt.split(".").pop()||"";rn.push(`<context ref="${Lt}">
|
|
61
|
-
\`\`\`${mc}
|
|
62
|
-
${Ji}
|
|
63
|
-
\`\`\`
|
|
64
|
-
</context>`)}}catch(_t){console.warn(`Failed to read @-referenced file: ${Lt}`,_t)}}rn.length>0&&(Ue=rn.join(`
|
|
65
|
-
|
|
66
|
-
`)+`
|
|
67
|
-
|
|
68
|
-
`+Ue.trim(),Ue=Ue.trim())}ie!=null&&ie.skipAddUserMessage||ve.getState().addMessage(B,{id:`msg-${Date.now()}`,type:"user",content:Ue,timestamp:Date.now()});const We=Fe.mode,rs=An(We==="normal"?"act":We),Sl=Mn==="off"?!1:void 0;if(rs==="plan")pe.send({type:"plan",sessionId:B,message:Ue,effort:Mn,thinking:Sl});else if(rs==="goal"){const rn=`wf-${Date.now()}-${Zn()}`;ve.getState().startGeneration(B),Ze.getState().upsert(B,{runId:rn,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"}),pe.send({type:"workflow_start",sessionId:B,runId:rn,message:Ue,projectId:st,memoryEnabled:!0,checkpointPolicy:"phase-and-token"})}else pe.send({type:"chat",sessionId:B,message:Ue,effort:Mn,thinking:Sl})},[za,Pi,st,Mn]),jt=_.useCallback((B,G)=>{var ft,Ue;const ee=ve.getState(),ie=ee.getMessages(B),xe=ie.findIndex(We=>We.id===G);if(xe===-1)return;let Fe=-1;for(let We=xe-1;We>=0;We--)if(((ft=ie[We])==null?void 0:ft.type)==="user"){Fe=We;break}if(Fe===-1)return;const qe=ie[Fe];(Ue=qe==null?void 0:qe.content)!=null&&Ue.trim()&&(ee.replaceMessages(B,ie.slice(0,Fe+1)),xn(B,qe.content,void 0,{skipAddUserMessage:!0}))},[xn]),Gt=_.useCallback((B,G)=>{ve.getState().applyTombstone(B,[G]),Se.success(ne("chat.messageDeleted"))},[ne]),js=_.useCallback(B=>{const G=Ze.getState().getForSession(B);G&&!["COMPLETED","CANCELLED","ERROR","FAILED"].includes(G.status)?pe.send({type:"workflow_cancel",sessionId:B,runId:G.runId}):pe.send({type:"stop",sessionId:B}),ve.getState().endGeneration(B)},[]),Qi=_.useCallback(B=>{const G=Ze.getState().getForSession(B);G&&["RUNNING","RESUMING"].includes(G.status)?pe.send({type:"workflow_pause",sessionId:B,runId:G.runId}):pe.send({type:"pause",sessionId:B}),ve.getState().pauseGeneration(B)},[]),pc=_.useCallback(B=>{const G=Ze.getState().getForSession(B);G&&G.status==="PAUSED"?pe.send({type:"workflow_resume",sessionId:B,runId:G.runId}):pe.send({type:"resume",sessionId:B}),ve.getState().resumeGeneration(B)},[]),hc=_.useCallback(B=>{const G=B.trim();if(!G||G===st)return;Kt(G),pe.send({type:"workspace",message:G}),we.getState().sessionTabs.forEach(ie=>{ve.getState().clearMessages(ie.id)}),we.setState({sessionTabs:[],sessions:[],sessionWorkspaceDirs:{},activeSessionId:null}),setTimeout(()=>{we.getState().addSessionTab(ne("chat.defaultSessionTitle",{n:1}),G)},0)},[st,Kt,ne]),Xi=()=>{c([]),u(0)},ha=_.useMemo(()=>({setActiveTab:Y,createNewSession:as,clearMessages:Ga,setTheme:je,setThemePreset:Ee,toggleTerminal:Me,setLogs:c,setUnreadLogs:u}),[Y,as,Ga,je,Ee,Me]);_.useEffect(()=>{const B=G=>{var Fe,qe;const ee=G.ctrlKey||G.metaKey,ie=(Fe=G.target)==null?void 0:Fe.tagName,xe=ie==="INPUT"||ie==="TEXTAREA"||((qe=G.target)==null?void 0:qe.isContentEditable);if(G.key==="Escape"){if(C){G.preventDefault(),E(!1);return}if(O){G.preventDefault(),j(!1);return}if(d){G.preventDefault(),p(!1);return}return}if(ee)if(G.key==="k"||G.key==="K")G.preventDefault(),j(!1),E(ft=>!ft);else if(G.key==="l"||G.key==="L"){if(xe)return;G.preventDefault(),Xi(),Se.success(ne("slashCommands.logs_clear_result"))}else G.key==="/"&&(G.preventDefault(),E(!1),j(ft=>!ft))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[C,O,d,ne]);const ma=(B,G)=>Gd[B]?ne(Gd[B]):G,Rs=B=>{switch(B){case"chat":{const G=qt(),ee=ot.find(ie=>ie.id===se);return m.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[m.jsxs("div",{className:"h-11 flex items-center gap-1 px-3 border-b border-dark-border bg-dark-bg shrink-0 select-none",children:[m.jsx("span",{className:"truncate text-[13px] font-medium text-dark-text",children:(ee==null?void 0:ee.title)||ne("nav.chat")}),m.jsx("div",{className:"flex-1"}),m.jsx(eE,{}),m.jsx(tE,{onOpenTemplates:is,onSaveAsTemplate:()=>void vl(),saveAsBusy:ss}),Fi>0&&m.jsx("button",{onClick:Pt?Gi:$,className:`p-1.5 rounded-lg transition-colors ${Pt?Dt?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text":R?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:Pt?"Task Board":"任务看板(右侧)","aria-label":Pt?"Task Board":"任务看板(右侧)","aria-expanded":Pt?Dt:R,children:m.jsx(fb,{size:16,"aria-hidden":"true"})}),m.jsx("button",{onClick:$,className:`p-1.5 rounded-lg transition-colors ${R?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:"右侧面板","aria-label":"切换右侧面板","aria-expanded":R,children:m.jsx(tS,{size:16,"aria-hidden":"true"})})]}),m.jsx(JC,{sessionId:se??void 0}),m.jsx(vE,{tabs:G,activeSessionId:se,onSend:xn,onStop:js,onPause:Qi,onResume:pc,activeTab:a,setActiveTab:Y,createNewSession:as,clearMessages:Ga,setTheme:je,setThemePreset:Ee,toggleTerminal:Me,setLogs:c,setUnreadLogs:u,showTaskBoard:Dt&&Pt,onToggleTaskBoard:Gi,onRegenerate:jt,onDeleteMessage:Gt,hookDrawerOpen:g,onCloseHookDrawer:()=>y(!1),questionDrawerOpen:b,onCloseQuestionDrawer:ns,workspaceDir:st,onWorkspaceSelect:hc})]})}case"terminal":return m.jsx(xE,{});case"files":return m.jsx(bE,{});case"models":return m.jsx(pE,{});case"tools":return m.jsx(hE,{});case"skills":return m.jsx(mE,{onUseSkill:Vi});case"templates":return m.jsx(gE,{onLaunch:Wi});case"hooks":return m.jsx(yE,{});case"channels":return m.jsx(kE,{});case"connectors":return m.jsx(wE,{});case"scheduled":return m.jsx(_E,{});case"logs":return m.jsx(o_,{logs:l,onClear:Xi});case"settings":return m.jsx(SE,{onNavigate:Y,focusSection:Je});case"plugins":return m.jsx(CE,{});default:return null}};return m.jsxs(Xy,{children:[m.jsxs("div",{className:"h-screen w-full flex bg-dark-bg text-dark-text overflow-hidden",children:[m.jsx("aside",{className:`hidden md:block shrink-0 border-r border-dark-border bg-dark-surface transition-[width] duration-200 ease-in-out overflow-hidden ${W?"w-14":"w-60"}`,children:m.jsx(Hy,{collapsed:W,onToggleCollapse:ge,tabs:Jn,activeTab:a,onTabChange:Y,isConnected:s,onNewSession:as,onStartTemplate:Wi,onManageTemplates:is,onSwitchSession:Pa,onCloseSession:Fa,onRenameSession:Zi,getTabTitle:ma})}),d&&m.jsxs("div",{className:"md:hidden fixed inset-0 z-50",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>p(!1)}),m.jsx("aside",{className:"absolute left-0 top-0 h-full w-64 bg-dark-surface border-r border-dark-border shadow-2xl animate-slide-in",children:m.jsx(Hy,{collapsed:!1,onToggleCollapse:()=>p(!1),tabs:Jn,activeTab:a,onTabChange:B=>{Y(B),p(!1)},isConnected:s,onNewSession:()=>{as(),p(!1)},onStartTemplate:Wi,onManageTemplates:()=>{is(),p(!1)},onSwitchSession:B=>{Pa(B),p(!1)},onCloseSession:Fa,onRenameSession:Zi,getTabTitle:ma})})]}),m.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[m.jsxs("header",{className:"md:hidden h-12 bg-dark-surface border-b border-dark-border flex items-center gap-1 px-2 shrink-0",children:[m.jsx("button",{className:"p-2 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",onClick:()=>p(!0),"aria-label":ne("a11y.openMenu"),children:m.jsx(eS,{size:18,"aria-hidden":"true"})}),m.jsx("span",{className:"text-sm font-semibold truncate",children:ma(a,"")}),m.jsx("div",{className:"flex-1"}),a==="chat"&&m.jsx("button",{onClick:as,className:"p-2 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors","aria-label":ne("chat.newSession"),children:m.jsx(qo,{size:18,"aria-hidden":"true"})})]}),m.jsx("div",{className:"flex-1 flex overflow-hidden min-h-0",children:m.jsxs(bb,{direction:"horizontal",children:[m.jsx(Jd,{id:"chat-main",minSize:30,className:"min-w-0",children:m.jsx("div",{className:"flex h-full flex-col min-w-0 min-h-0",children:m.jsx(_.Suspense,{fallback:m.jsx(EE,{}),children:m.jsx(Xy,{children:Rs(a)})})})}),a==="chat"&&R&&!Pt&&m.jsx(xb,{className:"w-1 bg-dark-border hover:bg-accent-blue transition-colors cursor-col-resize"}),a==="chat"&&R&&!Pt&&m.jsx(Jd,{id:"rightrail",ref:lt,defaultSize:20,minSize:14,maxSize:70,className:"min-w-0",children:m.jsx(Ww,{sessionId:se??"",messages:Bn,previewFile:Q,onPreview:te,onClosePreview:()=>te(null),isMaximized:he,onToggleMaximize:X})})]})}),a==="chat"&&R&&Pt&&m.jsx(fE,{isOpen:!0,onClose:()=>Z(!1),title:"输出物 · 任务",maxHeight:"60vh",children:m.jsx("div",{className:"h-[52vh]",children:m.jsx(Gb,{sessionId:se??"",messages:Bn,previewFile:Q,onPreview:te,onClosePreview:()=>te(null)})})}),m.jsx(XC,{activeTab:a})]})]}),m.jsx(uE,{open:C,onClose:()=>E(!1),options:ha}),m.jsx(dE,{open:O,onClose:()=>j(!1)}),m.jsx(aE,{}),m.jsx(lE,{})]})}let $o=new Set;function jE(a){function t(){s(window)}function s(y){y&&typeof y.addEventListener=="function"&&(y.addEventListener("click",c,!0),y.addEventListener("mousedown",u,!0),y.addEventListener("mouseover",u,!0),y.addEventListener("mouseup",u,!0),y.addEventListener("pointerdown",d,!0),y.addEventListener("pointerover",p,!0),y.addEventListener("pointerup",g,!0))}function r(){l(window),$o.forEach(y=>{try{l(y.contentWindow)}catch{}}),$o=new Set}function l(y){y&&typeof y.removeEventListener=="function"&&(y.removeEventListener("click",c,!0),y.removeEventListener("mousedown",u,!0),y.removeEventListener("mouseover",u,!0),y.removeEventListener("mouseup",u,!0),y.removeEventListener("pointerdown",d,!0),y.removeEventListener("pointerover",p,!0),y.removeEventListener("pointerup",g,!0))}function c(y){var b;y.preventDefault(),y.stopPropagation(),r(),(b=a.onClick)===null||b===void 0||b.call(a,y.target)}function u(y){y.preventDefault(),y.stopPropagation()}function d(y){y.preventDefault(),y.stopPropagation()}function p(y){var b;y.preventDefault(),y.stopPropagation();const v=y.target;if(v.tagName==="IFRAME"){const S=v;try{if(!$o.has(S)){const k=S.contentWindow;s(k),$o.add(S)}}catch{}}(b=a.onPointerOver)===null||b===void 0||b.call(a,y.target)}function g(y){y.preventDefault(),y.stopPropagation()}return t(),r}const RE=a=>typeof(a==null?void 0:a.type)=="string",Zb=a=>{var t;return typeof((t=a==null?void 0:a.type)===null||t===void 0?void 0:t.$$typeof)=="symbol"},OE=a=>{var t;return((t=a==null?void 0:a.type)===null||t===void 0?void 0:t.$$typeof)===Symbol.for("react.forward_ref")},ME=a=>{const t=Object.keys(a).find(s=>s.startsWith("__reactInternalInstance$")||s.startsWith("__reactFiber$"));if(t)return a[t]},qf=a=>{if(!a)return;const t=ME(a);return t||qf(a.parentElement)},BE=a=>{let t=a.return;for(;t;){if(!Zb(t))return t;t=t.return}return null},Qb=a=>{const t=a==null?void 0:a.type;if(!t)return;const{displayName:s,name:r}=t;if(typeof s=="string")return s;if(typeof r=="string")return r},DE=a=>{var t,s;if(!a)return;const r=(t=a._debugSource)!==null&&t!==void 0?t:(s=a._debugOwner)===null||s===void 0?void 0:s._debugSource;if(!r)return;const{fileName:l,lineNumber:c,columnNumber:u}=r;if(l&&c)return{lineNumber:String(c),columnNumber:String(u??1),absolutePath:l.match(/^<.*>$/)?l.replace(/^<|>$/g,""):l}},LE=a=>{if(!(a!=null&&a.pendingProps))return;const{"data-inspector-line":t,"data-inspector-column":s,"data-inspector-relative-path":r}=a.pendingProps;if(t&&s&&r)return{lineNumber:t,columnNumber:s,relativePath:r}},Vf=a=>{const t=[DE(a),LE(a)].filter(Boolean);if(t.length)return Object.assign({},...t)},Xb=a=>{if(!a)return;const t=BE(a);if(!t)return;const s=RE(t),r=!t.child.sibling;let l=!s&&r?t:a;const c=l;for(;l;){if(Vf(l))return l;l=l.return}return c},eb=a=>{const t=qf(a),s=Xb(t);return Vf(s)},zE=a=>{var t,s;let r=a,l;for(;r;){let c=(t=r.return)!==null&&t!==void 0?t:void 0,u;for(;Zb(c);)OE(c)&&(u=c),c=(s=c==null?void 0:c.return)!==null&&s!==void 0?s:void 0;if(u&&(r=u),Qb(r)&&(l||(l=r),Vf(r)))return r;r=c}return l},tb=a=>{const t=qf(a),s=Xb(t),r=zE(s),l=Qb(r),c=a.nodeName.toLowerCase(),u=l?`${c} in <${l}>`:c;return{fiber:s,name:l,title:u}};function nb(a){return a.getBoundingClientRect()}function UE(a){const t=window.getComputedStyle(a);return{borderLeft:Number.parseInt(t.borderLeftWidth,10),borderRight:Number.parseInt(t.borderRightWidth,10),borderTop:Number.parseInt(t.borderTopWidth,10),borderBottom:Number.parseInt(t.borderBottomWidth,10),marginLeft:Number.parseInt(t.marginLeft,10),marginRight:Number.parseInt(t.marginRight,10),marginTop:Number.parseInt(t.marginTop,10),marginBottom:Number.parseInt(t.marginBottom,10),paddingLeft:Number.parseInt(t.paddingLeft,10),paddingRight:Number.parseInt(t.paddingRight,10),paddingTop:Number.parseInt(t.paddingTop,10),paddingBottom:Number.parseInt(t.paddingBottom,10)}}var qd,sb;function $E(){return sb||(sb=1,qd="/__open-stack-frame-in-editor"),qd}var HE=$E();const ab=jf(HE),IE=a=>"codeInfo"in a?a.codeInfo:a,PE=a=>{if(!a)return;const t=IE(a),{lineNumber:s,columnNumber:r,relativePath:l,absolutePath:c}=t,u=!!l,d=u?l:c;if(!d){console.error("[react-dev-inspector] Cannot open editor without source fileName",t);return}const p={fileName:d,lineNumber:s,colNumber:r},g=u?`${ab}/relative`:ab;fetch(`${g}?${new URLSearchParams(p)}`)},Vd=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Wd(a,t,s,r){a.addEventListener?a.addEventListener(t,s,r):a.attachEvent&&a.attachEvent("on".concat(t),s)}function Zr(a,t,s,r){a.removeEventListener?a.removeEventListener(t,s,r):a.detachEvent&&a.detachEvent("on".concat(t),s)}function Jb(a,t){const s=t.slice(0,t.length-1);for(let r=0;r<s.length;r++)s[r]=a[s[r].toLowerCase()];return s}function ex(a){typeof a!="string"&&(a=""),a=a.replace(/\s/g,"");const t=a.split(",");let s=t.lastIndexOf("");for(;s>=0;)t[s-1]+=",",t.splice(s,1),s=t.lastIndexOf("");return t}function FE(a,t){const s=a.length>=t.length?a:t,r=a.length>=t.length?t:a;let l=!0;for(let c=0;c<s.length;c++)r.indexOf(s[c])===-1&&(l=!1);return l}const hl={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Vd?173:189,"=":Vd?61:187,";":Vd?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},In={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},Jr={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},It={16:!1,18:!1,17:!1,91:!1},yt={};for(let a=1;a<20;a++)hl["f".concat(a)]=111+a;let ht=[],ol=null,tx="all";const Es=new Map,Ii=a=>hl[a.toLowerCase()]||In[a.toLowerCase()]||a.toUpperCase().charCodeAt(0),GE=a=>Object.keys(hl).find(t=>hl[t]===a),qE=a=>Object.keys(In).find(t=>In[t]===a);function nx(a){tx=a||"all"}function ml(){return tx||"all"}function VE(){return ht.slice(0)}function WE(){return ht.map(a=>GE(a)||qE(a)||String.fromCharCode(a))}function KE(){const a=[];return Object.keys(yt).forEach(t=>{yt[t].forEach(s=>{let{key:r,scope:l,mods:c,shortcut:u}=s;a.push({scope:l,shortcut:u,mods:c,keys:r.split("+").map(d=>Ii(d))})})}),a}function YE(a){const t=a.target||a.srcElement,{tagName:s}=t;let r=!0;const l=s==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(l||s==="TEXTAREA"||s==="SELECT")&&!t.readOnly)&&(r=!1),r}function ZE(a){return typeof a=="string"&&(a=Ii(a)),ht.indexOf(a)!==-1}function QE(a,t){let s,r;a||(a=ml());for(const l in yt)if(Object.prototype.hasOwnProperty.call(yt,l))for(s=yt[l],r=0;r<s.length;)s[r].scope===a?s.splice(r,1).forEach(u=>{let{element:d}=u;return Wf(d)}):r++;ml()===a&&nx(t||"all")}function XE(a){let t=a.keyCode||a.which||a.charCode;a.key&&a.key.toLowerCase()==="capslock"&&(t=Ii(a.key));const s=ht.indexOf(t);if(s>=0&&ht.splice(s,1),a.key&&a.key.toLowerCase()==="meta"&&ht.splice(0,ht.length),(t===93||t===224)&&(t=91),t in It){It[t]=!1;for(const r in In)In[r]===t&&(jn[r]=!1)}}function sx(a){if(typeof a>"u")Object.keys(yt).forEach(l=>{Array.isArray(yt[l])&&yt[l].forEach(c=>Ho(c)),delete yt[l]}),Wf(null);else if(Array.isArray(a))a.forEach(l=>{l.key&&Ho(l)});else if(typeof a=="object")a.key&&Ho(a);else if(typeof a=="string"){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];let[l,c]=s;typeof l=="function"&&(c=l,l=""),Ho({key:a,scope:l,method:c,splitKey:"+"})}}const Ho=a=>{let{key:t,scope:s,method:r,splitKey:l="+"}=a;ex(t).forEach(u=>{const d=u.split(l),p=d.length,g=d[p-1],y=g==="*"?"*":Ii(g);if(!yt[y])return;s||(s=ml());const b=p>1?Jb(In,d):[],v=[];yt[y]=yt[y].filter(S=>{const C=(r?S.method===r:!0)&&S.scope===s&&FE(S.mods,b);return C&&v.push(S.element),!C}),v.forEach(S=>Wf(S))})};function ib(a,t,s,r){if(t.element!==r)return;let l;if(t.scope===s||t.scope==="all"){l=t.mods.length>0;for(const c in It)Object.prototype.hasOwnProperty.call(It,c)&&(!It[c]&&t.mods.indexOf(+c)>-1||It[c]&&t.mods.indexOf(+c)===-1)&&(l=!1);(t.mods.length===0&&!It[16]&&!It[18]&&!It[17]&&!It[91]||l||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(ht),t.method(a,t)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0)))}}function rb(a,t){const s=yt["*"];let r=a.keyCode||a.which||a.charCode;if(a.key&&a.key.toLowerCase()==="capslock"||!jn.filter.call(this,a))return;if((r===93||r===224)&&(r=91),ht.indexOf(r)===-1&&r!==229&&ht.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(d=>{const p=Jr[d];a[d]&&ht.indexOf(p)===-1?ht.push(p):!a[d]&&ht.indexOf(p)>-1?ht.splice(ht.indexOf(p),1):d==="metaKey"&&a[d]&&(ht=ht.filter(g=>g in Jr||g===r))}),r in It){It[r]=!0;for(const d in In)if(Object.prototype.hasOwnProperty.call(In,d)){const p=Jr[In[d]];jn[d]=a[p]}if(!s)return}for(const d in It)Object.prototype.hasOwnProperty.call(It,d)&&(It[d]=a[Jr[d]]);a.getModifierState&&!(a.altKey&&!a.ctrlKey)&&a.getModifierState("AltGraph")&&(ht.indexOf(17)===-1&&ht.push(17),ht.indexOf(18)===-1&&ht.push(18),It[17]=!0,It[18]=!0);const l=ml();if(s)for(let d=0;d<s.length;d++)s[d].scope===l&&(a.type==="keydown"&&s[d].keydown||a.type==="keyup"&&s[d].keyup)&&ib(a,s[d],l,t);if(!(r in yt))return;const c=yt[r],u=c.length;for(let d=0;d<u;d++)if((a.type==="keydown"&&c[d].keydown||a.type==="keyup"&&c[d].keyup)&&c[d].key){const p=c[d],{splitKey:g}=p,y=p.key.split(g),b=[];for(let v=0;v<y.length;v++)b.push(Ii(y[v]));b.sort().join("")===ht.sort().join("")&&ib(a,p,l,t)}}function jn(a,t,s){ht=[];const r=ex(a);let l=[],c="all",u=document,d=0,p=!1,g=!0,y="+",b=!1,v=!1;for(s===void 0&&typeof t=="function"&&(s=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(c=t.scope),t.element&&(u=t.element),t.keyup&&(p=t.keyup),t.keydown!==void 0&&(g=t.keydown),t.capture!==void 0&&(b=t.capture),typeof t.splitKey=="string"&&(y=t.splitKey),t.single===!0&&(v=!0)),typeof t=="string"&&(c=t),v&&sx(a,c);d<r.length;d++)a=r[d].split(y),l=[],a.length>1&&(l=Jb(In,a)),a=a[a.length-1],a=a==="*"?"*":Ii(a),a in yt||(yt[a]=[]),yt[a].push({keyup:p,keydown:g,scope:c,mods:l,shortcut:r[d],method:s,key:r[d],splitKey:y,element:u});if(typeof u<"u"&&window){if(!Es.has(u)){const S=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return rb(C,u)},k=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;rb(C,u),XE(C)};Es.set(u,{keydownListener:S,keyupListenr:k,capture:b}),Wd(u,"keydown",S,b),Wd(u,"keyup",k,b)}if(!ol){const S=()=>{ht=[]};ol={listener:S,capture:b},Wd(window,"focus",S,b)}}}function JE(a){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(yt).forEach(s=>{yt[s].filter(l=>l.scope===t&&l.shortcut===a).forEach(l=>{l&&l.method&&l.method()})})}function Wf(a){const t=Object.values(yt).flat();if(t.findIndex(r=>{let{element:l}=r;return l===a})<0){const{keydownListener:r,keyupListenr:l,capture:c}=Es.get(a)||{};r&&l&&(Zr(a,"keyup",l,c),Zr(a,"keydown",r,c),Es.delete(a))}if((t.length<=0||Es.size<=0)&&(Object.keys(Es).forEach(l=>{const{keydownListener:c,keyupListenr:u,capture:d}=Es.get(l)||{};c&&u&&(Zr(l,"keyup",u,d),Zr(l,"keydown",c,d),Es.delete(l))}),Es.clear(),Object.keys(yt).forEach(l=>delete yt[l]),ol)){const{listener:l,capture:c}=ol;Zr(window,"focus",l,c),ol=null}}const Kd={getPressedKeyString:WE,setScope:nx,getScope:ml,deleteScope:QE,getPressedKeyCodes:VE,getAllKeyCodes:KE,isPressed:ZE,filter:YE,trigger:JE,unbind:sx,keyMap:hl,modifier:In,modifierMap:Jr};for(const a in Kd)Object.prototype.hasOwnProperty.call(Kd,a)&&(jn[a]=Kd[a]);if(typeof window<"u"){const a=window.hotkeys;jn.noConflict=t=>(t&&window.hotkeys===jn&&(window.hotkeys=a),jn),window.hotkeys=jn}var Yd;const eN=typeof window<"u"&&(!((Yd=window==null?void 0:window.document)===null||Yd===void 0)&&Yd.createElement)?_.useLayoutEffect:_.useEffect,Ni=a=>{const t=_.useRef(a);t.current=_.useMemo(()=>a,[a]);const s=_.useRef();return s.current||(s.current=(function(...r){var l;return(l=t.current)===null||l===void 0?void 0:l.apply(this,r)})),s.current},tN=({disable:a})=>{const t=_.useRef({x:0,y:0}),s=r=>{t.current.x=r.clientX,t.current.y=r.clientY};return _.useEffect(()=>(a||document.addEventListener("mousemove",s,!0),()=>{document.removeEventListener("mousemove",s,!0)}),[a]),t};class nN{constructor(t,s){Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"border",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.node=t.createElement("div"),this.border=t.createElement("div"),this.padding=t.createElement("div"),this.content=t.createElement("div"),this.border.style.borderColor=Io.border,this.padding.style.borderColor=Io.padding,this.content.style.backgroundColor=Io.background,Object.assign(this.node.style,{borderColor:Io.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),s.prepend(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(t,s){Zd(s,"margin",this.node),Zd(s,"border",this.border),Zd(s,"padding",this.padding),Object.assign(this.content.style,{height:`${t.height-s.borderTop-s.borderBottom-s.paddingTop-s.paddingBottom}px`,width:`${t.width-s.borderLeft-s.borderRight-s.paddingLeft-s.paddingRight}px`}),Object.assign(this.node.style,{top:`${t.top-s.marginTop}px`,left:`${t.left-s.marginLeft}px`})}}class sN{constructor(t,s){Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nameSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"infoDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dimSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tip=t.createElement("div"),Object.assign(this.tip.style,{display:"flex",flexFlow:"row nowrap",alignItems:"center",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"6px 8px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=t.createElement("span"),this.tip.appendChild(this.nameSpan),Object.assign(this.nameSpan.style,{display:"flex",flexDirection:"column",borderRight:"1px solid #aaaaaa",paddingRight:"0.8rem",marginRight:"0.8rem"}),this.titleDiv=t.createElement("div"),this.nameSpan.appendChild(this.titleDiv),Object.assign(this.titleDiv.style,{color:"#ee78e6",fontSize:"16px"}),this.infoDiv=t.createElement("div"),this.nameSpan.appendChild(this.infoDiv),Object.assign(this.infoDiv.style,{color:"#ee78e6",fontSize:"14px"}),this.dimSpan=t.createElement("span"),this.tip.appendChild(this.dimSpan),Object.assign(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",s.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(t,s,r,l){this.titleDiv.textContent=t,this.infoDiv.textContent=s??"",this.dimSpan.textContent=`${Math.round(r)}px × ${Math.round(l)}px`}updatePosition(t,s){const r=this.tip.getBoundingClientRect(),l=iN(t,s,{width:r.width,height:r.height});Object.assign(this.tip.style,l.style)}}class aN{constructor(){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tipBoundsWindow",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"removeCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.window=t;const s=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.tipBoundsWindow=s;const r=t.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new sN(r,this.container),this.rects=[],this.removeCallback=()=>{},r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach(t=>{t.remove()}),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.removeCallback()}setRemoveCallback(t){this.removeCallback=t.bind(this)}inspect(t,s,r){var l;const c=t.filter(p=>p.nodeType===Node.ELEMENT_NODE);for(;this.rects.length>c.length;){const p=this.rects.pop();p==null||p.remove()}if(c.length===0)return;for(;this.rects.length<c.length;)this.rects.push(new nN(this.window.document,this.container));const u={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};if(c.forEach((p,g)=>{const y=nb(p,this.window),b=UE(p);u.top=Math.min(u.top,y.top-b.marginTop),u.right=Math.max(u.right,y.left+y.width+b.marginRight),u.bottom=Math.max(u.bottom,y.top+y.height+b.marginBottom),u.left=Math.min(u.left,y.left-b.marginLeft),this.rects[g].update(y,b)}),!s){s=c[0].nodeName.toLowerCase();const p=c[0],g=(l=p.ownerDocument.defaultView)===null||l===void 0?void 0:l.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g!=null&&g.rendererInterfaces){let y=null;for(const b of g.rendererInterfaces.values()){const v=b.getFiberIDForNative(p,!0);if(v!==null){y=b.getDisplayNameForFiberID(v,!0);break}}y&&(s+=` (in ${y})`)}}this.tip.updateText(s,r,u.right-u.left,u.bottom-u.top);const d=nb(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:u.top,left:u.left,height:u.bottom-u.top,width:u.right-u.left},{top:d.top+this.tipBoundsWindow.scrollY,left:d.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function iN(a,t,s){const r=Math.max(s.height,20),l=Math.max(s.width,60),c=5;let u;a.top+a.height+r<=t.top+t.height?a.top+a.height<t.top+0?u=t.top+c:u=a.top+a.height+c:a.top-r<=t.top+t.height?a.top-r-c<t.top+c?u=t.top+c:u=a.top-r-c:u=t.top+t.height-r-c;let d=a.left+c;return a.left<t.left&&(d=t.left+c),a.left+l>t.left+t.width&&(d=t.left+t.width-l-c),{style:{top:`${u}px`,left:`${d}px`}}}function Zd(a,t,s){Object.assign(s.style,{borderTopWidth:`${a[`${t}Top`]}px`,borderLeftWidth:`${a[`${t}Left`]}px`,borderRightWidth:`${a[`${t}Right`]}px`,borderBottomWidth:`${a[`${t}Bottom`]}px`,borderStyle:"solid"})}const Io={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"},rN=()=>{var a;return!((a=navigator.platform)===null||a===void 0)&&a.startsWith("Mac")?["Ctrl","Shift","Command","C"]:["Ctrl","Shift","Alt","C"]},lN=a=>{const{keys:t,onHoverElement:s,onClickElement:r,onInspectElement:l,active:c,onActiveChange:u,disableLaunchEditor:d,disable:p=!0,children:g}=a,[y,b]=_.useState(c??!1);eN(()=>{c!==void 0&&b(c)},[c]),_.useEffect(()=>(y?O():j(),j),[y]);const v=t===null?null:(t??[]).join("+"),S=_.useRef(),k=tN({disable:p}),C=Ni(()=>{u==null||u(!0),c===void 0&&b(!0)}),E=Ni(()=>{u==null||u(!1),c===void 0&&b(!1)}),O=Ni(()=>{if(S.current||p)return;const R=new aN;S.current=R,jn("esc",E);const Z=jE({onPointerOver:T,onClick:z});R.setRemoveCallback(Z);const Q=k.current,te=document.elementFromPoint(Q.x,Q.y);te&&T(te)}),j=Ni(()=>{var R;(R=S.current)===null||R===void 0||R.remove(),S.current=void 0,jn.unbind("esc",E)}),T=Ni(R=>{var Z;const Q=S.current,te=eb(R),he=te==null?void 0:te.relativePath,me=te==null?void 0:te.absolutePath,{fiber:lt,name:de,title:W}=tb(R);(Z=Q==null?void 0:Q.inspect)===null||Z===void 0||Z.call(Q,[R],W,he??me),s==null||s({element:R,fiber:lt,codeInfo:te,name:de})}),z=Ni(R=>{E();const Z=eb(R),{fiber:Q,name:te}=tb(R);r==null||r({element:R,fiber:Q,codeInfo:Z,name:te}),Q&&Z&&(l==null||l({element:R,fiber:Q,codeInfo:Z,name:te}),!l&&!d&&PE(Z))});return _.useEffect(()=>{const R=()=>{S.current?E():C()},Z=v===null||p?null:v||rN().join("+");if(Z)return jn(Z,R),()=>{jn.unbind(Z,R)}},[v,p]),m.jsx(m.Fragment,{children:g??null})};function oN(){const[a,t]=_.useState(!1);return _.useEffect(()=>{const s=r=>{r.ctrlKey&&r.shiftKey&&r.altKey&&(r.key==="c"||r.key==="C")&&(r.preventDefault(),t(l=>!l))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),m.jsxs(m.Fragment,{children:[m.jsx(lN,{active:a,onActiveChange:t}),m.jsx("button",{onClick:()=>t(s=>!s),title:a?"关闭检查模式":"开启检查模式 (Ctrl+Shift+Alt+C)",style:{position:"fixed",bottom:"20px",right:"20px",zIndex:99999,width:"44px",height:"44px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",boxShadow:"0 2px 12px rgba(0,0,0,0.25)",transition:"all 0.2s ease",background:a?"#22c55e":"#1e293b",color:"#fff"},children:m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("circle",{cx:"12",cy:"12",r:"3"}),m.jsx("path",{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10z"}),m.jsx("path",{d:"M12 2v20"}),m.jsx("path",{d:"M2 12h20"})]})})]})}uS.createRoot(document.getElementById("root")).render(m.jsxs(nS.StrictMode,{children:[m.jsx(oN,{}),m.jsx(AE,{})]}));export{cE as A,Uy as B,SN as C,nw as D,mN as E,NN as F,fE as G,yN as H,Yw as I,EN as J,we as K,bN as L,Pf as M,Mb as N,Ze as O,vN as P,Af as Q,CN as R,PC as S,ll as T,Ky as U,gN as W,Ie as a,An as b,gn as c,mt as d,hk as e,Da as f,H as g,g1 as h,Hi as i,wf as j,DC as k,_N as l,Ns as m,nn as n,Lb as o,ve as p,R1 as q,wN as r,kN as s,Se as t,Mi as u,xN as v,pe as w,Jk as x,ji as y,Ge as z};
|