@jingyi0605/codingns 0.1.2 → 0.1.4
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/bin/codingns.mjs +47 -8
- package/dist/public/assets/{TerminalPage-Dr7knYq2.js → TerminalPage-4ulgBhv9.js} +19 -19
- package/dist/public/assets/index-C5lu52cQ.css +1 -0
- package/dist/public/assets/index-WpdUo_Vs.js +108 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +1 -0
- package/dist/server/config/env.js +2 -1
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/modules/auth/auth-service.d.ts +7 -1
- package/dist/server/modules/auth/auth-service.js +23 -3
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/bootstrap/bootstrap-service.d.ts +3 -1
- package/dist/server/modules/bootstrap/bootstrap-service.js +7 -2
- package/dist/server/modules/bootstrap/bootstrap-service.js.map +1 -1
- package/dist/server/modules/demo/demo-cleanup-service.d.ts +41 -0
- package/dist/server/modules/demo/demo-cleanup-service.js +111 -0
- package/dist/server/modules/demo/demo-cleanup-service.js.map +1 -0
- package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +1 -0
- package/dist/server/modules/sessions/codex-app-server-helper-client.js +24 -1
- package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.js +16 -15
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +2 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js +13 -7
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/terminal/command-template-service.d.ts +4 -0
- package/dist/server/modules/terminal/command-template-service.js +88 -2
- package/dist/server/modules/terminal/command-template-service.js.map +1 -1
- package/dist/server/modules/terminal/template-reverse-proxy-service.d.ts +10 -0
- package/dist/server/modules/terminal/template-reverse-proxy-service.js +320 -0
- package/dist/server/modules/terminal/template-reverse-proxy-service.js.map +1 -0
- package/dist/server/modules/terminal/terminal-controller.d.ts +1 -0
- package/dist/server/modules/terminal/terminal-controller.js +16 -0
- package/dist/server/modules/terminal/terminal-controller.js.map +1 -1
- package/dist/server/modules/terminal/terminal-service.js +2 -2
- package/dist/server/modules/terminal/terminal-service.js.map +1 -1
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +7 -2
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
- package/dist/server/routes/proxy.d.ts +3 -0
- package/dist/server/routes/proxy.js +24 -0
- package/dist/server/routes/proxy.js.map +1 -0
- package/dist/server/routes/sessions.d.ts +1 -0
- package/dist/server/routes/sessions.js +12 -3
- package/dist/server/routes/sessions.js.map +1 -1
- package/dist/server/server/create-server.js +39 -6
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/storage/repositories/terminal-command-template-repository.d.ts +1 -0
- package/dist/server/storage/repositories/terminal-command-template-repository.js +34 -3
- package/dist/server/storage/repositories/terminal-command-template-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +27 -0
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +2 -0
- package/dist/server/types/domain.d.ts +2 -0
- package/dist/server/ws/ws-server.js +3 -1
- package/dist/server/ws/ws-server.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +165 -6
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +10 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +4 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +2 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +30 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +2 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +16 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +3 -0
- package/package.json +1 -1
- package/dist/public/assets/index-BpUi6zoT.js +0 -108
- package/dist/public/assets/index-NMtdQNda.css +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-4ulgBhv9.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var mj=Object.defineProperty;var pj=(e,t,n)=>t in e?mj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Be=(e,t,n)=>pj(e,typeof t!="symbol"?t+"":t,n);function Cx(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const c=Object.getOwnPropertyDescriptor(s,a);c&&Object.defineProperty(e,a,c.get?c:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();function Ja(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh={exports:{}},wa={},ah={exports:{}},Ht={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its 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 Ly;function gj(){if(Ly)return Ht;Ly=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function b(B){return B===null||typeof B!="object"?null:(B=g&&B[g]||B["@@iterator"],typeof B=="function"?B:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function j(B,te,T){this.props=B,this.context=te,this.refs=C,this.updater=T||x}j.prototype.isReactComponent={},j.prototype.setState=function(B,te){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,te,"setState")},j.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=j.prototype;function L(B,te,T){this.props=B,this.context=te,this.refs=C,this.updater=T||x}var A=L.prototype=new R;A.constructor=L,S(A,j.prototype),A.isPureReactComponent=!0;var K=Array.isArray,H=Object.prototype.hasOwnProperty,F={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function _(B,te,T){var we,me={},Ce=null,_e=null;if(te!=null)for(we in te.ref!==void 0&&(_e=te.ref),te.key!==void 0&&(Ce=""+te.key),te)H.call(te,we)&&!M.hasOwnProperty(we)&&(me[we]=te[we]);var Ge=arguments.length-2;if(Ge===1)me.children=T;else if(1<Ge){for(var ot=Array(Ge),mt=0;mt<Ge;mt++)ot[mt]=arguments[mt+2];me.children=ot}if(B&&B.defaultProps)for(we in Ge=B.defaultProps,Ge)me[we]===void 0&&(me[we]=Ge[we]);return{$$typeof:e,type:B,key:Ce,ref:_e,props:me,_owner:F.current}}function I(B,te){return{$$typeof:e,type:B.type,key:te,ref:B.ref,props:B.props,_owner:B._owner}}function P(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function U(B){var te={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(T){return te[T]})}var G=/\/+/g;function X(B,te){return typeof B=="object"&&B!==null&&B.key!=null?U(""+B.key):te.toString(36)}function Z(B,te,T,we,me){var Ce=typeof B;(Ce==="undefined"||Ce==="boolean")&&(B=null);var _e=!1;if(B===null)_e=!0;else switch(Ce){case"string":case"number":_e=!0;break;case"object":switch(B.$$typeof){case e:case t:_e=!0}}if(_e)return _e=B,me=me(_e),B=we===""?"."+X(_e,0):we,K(me)?(T="",B!=null&&(T=B.replace(G,"$&/")+"/"),Z(me,te,T,"",function(mt){return mt})):me!=null&&(P(me)&&(me=I(me,T+(!me.key||_e&&_e.key===me.key?"":(""+me.key).replace(G,"$&/")+"/")+B)),te.push(me)),1;if(_e=0,we=we===""?".":we+":",K(B))for(var Ge=0;Ge<B.length;Ge++){Ce=B[Ge];var ot=we+X(Ce,Ge);_e+=Z(Ce,te,T,ot,me)}else if(ot=b(B),typeof ot=="function")for(B=ot.call(B),Ge=0;!(Ce=B.next()).done;)Ce=Ce.value,ot=we+X(Ce,Ge++),_e+=Z(Ce,te,T,ot,me);else if(Ce==="object")throw te=String(B),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.");return _e}function $(B,te,T){if(B==null)return B;var we=[],me=0;return Z(B,we,"","",function(Ce){return te.call(T,Ce,me++)}),we}function se(B){if(B._status===-1){var te=B._result;te=te(),te.then(function(T){(B._status===0||B._status===-1)&&(B._status=1,B._result=T)},function(T){(B._status===0||B._status===-1)&&(B._status=2,B._result=T)}),B._status===-1&&(B._status=0,B._result=te)}if(B._status===1)return B._result.default;throw B._result}var Y={current:null},q={transition:null},oe={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:q,ReactCurrentOwner:F};function E(){throw Error("act(...) is not supported in production builds of React.")}return Ht.Children={map:$,forEach:function(B,te,T){$(B,function(){te.apply(this,arguments)},T)},count:function(B){var te=0;return $(B,function(){te++}),te},toArray:function(B){return $(B,function(te){return te})||[]},only:function(B){if(!P(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},Ht.Component=j,Ht.Fragment=n,Ht.Profiler=a,Ht.PureComponent=L,Ht.StrictMode=s,Ht.Suspense=f,Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=oe,Ht.act=E,Ht.cloneElement=function(B,te,T){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var we=S({},B.props),me=B.key,Ce=B.ref,_e=B._owner;if(te!=null){if(te.ref!==void 0&&(Ce=te.ref,_e=F.current),te.key!==void 0&&(me=""+te.key),B.type&&B.type.defaultProps)var Ge=B.type.defaultProps;for(ot in te)H.call(te,ot)&&!M.hasOwnProperty(ot)&&(we[ot]=te[ot]===void 0&&Ge!==void 0?Ge[ot]:te[ot])}var ot=arguments.length-2;if(ot===1)we.children=T;else if(1<ot){Ge=Array(ot);for(var mt=0;mt<ot;mt++)Ge[mt]=arguments[mt+2];we.children=Ge}return{$$typeof:e,type:B.type,key:me,ref:Ce,props:we,_owner:_e}},Ht.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},B.Provider={$$typeof:c,_context:B},B.Consumer=B},Ht.createElement=_,Ht.createFactory=function(B){var te=_.bind(null,B);return te.type=B,te},Ht.createRef=function(){return{current:null}},Ht.forwardRef=function(B){return{$$typeof:d,render:B}},Ht.isValidElement=P,Ht.lazy=function(B){return{$$typeof:y,_payload:{_status:-1,_result:B},_init:se}},Ht.memo=function(B,te){return{$$typeof:p,type:B,compare:te===void 0?null:te}},Ht.startTransition=function(B){var te=q.transition;q.transition={};try{B()}finally{q.transition=te}},Ht.unstable_act=E,Ht.useCallback=function(B,te){return Y.current.useCallback(B,te)},Ht.useContext=function(B){return Y.current.useContext(B)},Ht.useDebugValue=function(){},Ht.useDeferredValue=function(B){return Y.current.useDeferredValue(B)},Ht.useEffect=function(B,te){return Y.current.useEffect(B,te)},Ht.useId=function(){return Y.current.useId()},Ht.useImperativeHandle=function(B,te,T){return Y.current.useImperativeHandle(B,te,T)},Ht.useInsertionEffect=function(B,te){return Y.current.useInsertionEffect(B,te)},Ht.useLayoutEffect=function(B,te){return Y.current.useLayoutEffect(B,te)},Ht.useMemo=function(B,te){return Y.current.useMemo(B,te)},Ht.useReducer=function(B,te,T){return Y.current.useReducer(B,te,T)},Ht.useRef=function(B){return Y.current.useRef(B)},Ht.useState=function(B){return Y.current.useState(B)},Ht.useSyncExternalStore=function(B,te,T){return Y.current.useSyncExternalStore(B,te,T)},Ht.useTransition=function(){return Y.current.useTransition()},Ht.version="18.3.1",Ht}var Iy;function sm(){return Iy||(Iy=1,ah.exports=gj()),ah.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its 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 Dy;function yj(){if(Dy)return wa;Dy=1;var e=sm(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(d,f,p){var y,g={},b=null,x=null;p!==void 0&&(b=""+p),f.key!==void 0&&(b=""+f.key),f.ref!==void 0&&(x=f.ref);for(y in f)s.call(f,y)&&!c.hasOwnProperty(y)&&(g[y]=f[y]);if(d&&d.defaultProps)for(y in f=d.defaultProps,f)g[y]===void 0&&(g[y]=f[y]);return{$$typeof:t,type:d,key:b,ref:x,props:g,_owner:a.current}}return wa.Fragment=n,wa.jsx=l,wa.jsxs=l,wa}var _y;function vj(){return _y||(_y=1,oh.exports=yj()),oh.exports}var i=vj(),dc={},lh={exports:{}},gr={},ch={exports:{}},uh={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.min.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var Fy;function wj(){return Fy||(Fy=1,(function(e){function t(q,oe){var E=q.length;q.push(oe);e:for(;0<E;){var B=E-1>>>1,te=q[B];if(0<a(te,oe))q[B]=oe,q[E]=te,E=B;else break e}}function n(q){return q.length===0?null:q[0]}function s(q){if(q.length===0)return null;var oe=q[0],E=q.pop();if(E!==oe){q[0]=E;e:for(var B=0,te=q.length,T=te>>>1;B<T;){var we=2*(B+1)-1,me=q[we],Ce=we+1,_e=q[Ce];if(0>a(me,E))Ce<te&&0>a(_e,me)?(q[B]=_e,q[Ce]=E,B=Ce):(q[B]=me,q[we]=E,B=we);else if(Ce<te&&0>a(_e,E))q[B]=_e,q[Ce]=E,B=Ce;else break e}}return oe}function a(q,oe){var E=q.sortIndex-oe.sortIndex;return E!==0?E:q.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var f=[],p=[],y=1,g=null,b=3,x=!1,S=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(q){for(var oe=n(p);oe!==null;){if(oe.callback===null)s(p);else if(oe.startTime<=q)s(p),oe.sortIndex=oe.expirationTime,t(f,oe);else break;oe=n(p)}}function K(q){if(C=!1,A(q),!S)if(n(f)!==null)S=!0,se(H);else{var oe=n(p);oe!==null&&Y(K,oe.startTime-q)}}function H(q,oe){S=!1,C&&(C=!1,R(_),_=-1),x=!0;var E=b;try{for(A(oe),g=n(f);g!==null&&(!(g.expirationTime>oe)||q&&!U());){var B=g.callback;if(typeof B=="function"){g.callback=null,b=g.priorityLevel;var te=B(g.expirationTime<=oe);oe=e.unstable_now(),typeof te=="function"?g.callback=te:g===n(f)&&s(f),A(oe)}else s(f);g=n(f)}if(g!==null)var T=!0;else{var we=n(p);we!==null&&Y(K,we.startTime-oe),T=!1}return T}finally{g=null,b=E,x=!1}}var F=!1,M=null,_=-1,I=5,P=-1;function U(){return!(e.unstable_now()-P<I)}function G(){if(M!==null){var q=e.unstable_now();P=q;var oe=!0;try{oe=M(!0,q)}finally{oe?X():(F=!1,M=null)}}else F=!1}var X;if(typeof L=="function")X=function(){L(G)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,$=Z.port2;Z.port1.onmessage=G,X=function(){$.postMessage(null)}}else X=function(){j(G,0)};function se(q){M=q,F||(F=!0,X())}function Y(q,oe){_=j(function(){q(e.unstable_now())},oe)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,se(H))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var oe=3;break;default:oe=b}var E=b;b=oe;try{return q()}finally{b=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,oe){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var E=b;b=q;try{return oe()}finally{b=E}},e.unstable_scheduleCallback=function(q,oe,E){var B=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?B+E:B):E=B,q){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=E+te,q={id:y++,callback:oe,priorityLevel:q,startTime:E,expirationTime:te,sortIndex:-1},E>B?(q.sortIndex=E,t(p,q),n(f)===null&&q===n(p)&&(C?(R(_),_=-1):C=!0,Y(K,E-B))):(q.sortIndex=te,t(f,q),S||x||(S=!0,se(H))),q},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(q){var oe=b;return function(){var E=b;b=oe;try{return q.apply(this,arguments)}finally{b=E}}}})(uh)),uh}var Oy;function bj(){return Oy||(Oy=1,ch.exports=wj()),ch.exports}/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var By;function xj(){if(By)return gr;By=1;var e=sm(),t=bj();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function c(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(a[r]=o,r=0;r<o.length;r++)s.add(o[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[: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]*$/,y={},g={};function b(r){return f.call(g,r)?!0:f.call(y,r)?!1:p.test(r)?g[r]=!0:(y[r]=!0,!1)}function x(r,o,u,m){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function S(r,o,u,m){if(o===null||typeof o>"u"||x(r,o,u,m))return!0;if(m)return!1;if(u!==null)switch(u.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function C(r,o,u,m,w,k,N){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=w,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=k,this.removeEmptyString=N}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){j[r]=new C(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];j[o]=new C(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){j[r]=new C(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){j[r]=new C(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){j[r]=new C(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){j[r]=new C(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){j[r]=new C(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){j[r]=new C(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){j[r]=new C(r,5,!1,r.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function L(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(R,L);j[o]=new C(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(R,L);j[o]=new C(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(R,L);j[o]=new C(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){j[r]=new C(r,1,!1,r.toLowerCase(),null,!1,!1)}),j.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){j[r]=new C(r,1,!1,r.toLowerCase(),null,!0,!0)});function A(r,o,u,m){var w=j.hasOwnProperty(o)?j[o]:null;(w!==null?w.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(S(o,u,w,m)&&(u=null),m||w===null?b(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):w.mustUseProperty?r[w.propertyName]=u===null?w.type===3?!1:"":u:(o=w.attributeName,m=w.attributeNamespace,u===null?r.removeAttribute(o):(w=w.type,u=w===3||w===4&&u===!0?"":""+u,m?r.setAttributeNS(m,o,u):r.setAttribute(o,u))))}var K=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,H=Symbol.for("react.element"),F=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),U=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),q=Symbol.iterator;function oe(r){return r===null||typeof r!="object"?null:(r=q&&r[q]||r["@@iterator"],typeof r=="function"?r:null)}var E=Object.assign,B;function te(r){if(B===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);B=o&&o[1]||""}return`
|
|
35
|
+
`+B+r}var T=!1;function we(r,o){if(!r||T)return"";T=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(pe){var m=pe}Reflect.construct(r,[],o)}else{try{o.call()}catch(pe){m=pe}r.call(o.prototype)}else{try{throw Error()}catch(pe){m=pe}r()}}catch(pe){if(pe&&m&&typeof pe.stack=="string"){for(var w=pe.stack.split(`
|
|
36
|
+
`),k=m.stack.split(`
|
|
37
|
+
`),N=w.length-1,W=k.length-1;1<=N&&0<=W&&w[N]!==k[W];)W--;for(;1<=N&&0<=W;N--,W--)if(w[N]!==k[W]){if(N!==1||W!==1)do if(N--,W--,0>W||w[N]!==k[W]){var J=`
|
|
38
|
+
`+w[N].replace(" at new "," at ");return r.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",r.displayName)),J}while(1<=N&&0<=W);break}}}finally{T=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?te(r):""}function me(r){switch(r.tag){case 5:return te(r.type);case 16:return te("Lazy");case 13:return te("Suspense");case 19:return te("SuspenseList");case 0:case 2:case 15:return r=we(r.type,!1),r;case 11:return r=we(r.type.render,!1),r;case 1:return r=we(r.type,!0),r;default:return""}}function Ce(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case M:return"Fragment";case F:return"Portal";case I:return"Profiler";case _:return"StrictMode";case X:return"Suspense";case Z:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case U:return(r.displayName||"Context")+".Consumer";case P:return(r._context.displayName||"Context")+".Provider";case G:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case $:return o=r.displayName||null,o!==null?o:Ce(r.type)||"Memo";case se:o=r._payload,r=r._init;try{return Ce(r(o))}catch{}}return null}function _e(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ce(o);case 8:return o===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Ge(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function ot(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function mt(r){var o=ot(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,k=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(N){m=""+N,k.call(this,N)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return m},setValue:function(N){m=""+N},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function jt(r){r._valueTracker||(r._valueTracker=mt(r))}function yt(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=ot(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function St(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Lt(r,o){var u=o.checked;return E({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function vt(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=Ge(o.value!=null?o.value:u),r._wrapperState={initialChecked:m,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function zt(r,o){o=o.checked,o!=null&&A(r,"checked",o,!1)}function Rt(r,o){zt(r,o);var u=Ge(o.value),m=o.type;if(u!=null)m==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?tn(r,o.type,u):o.hasOwnProperty("defaultValue")&&tn(r,o.type,Ge(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function ft(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function tn(r,o,u){(o!=="number"||St(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var qt=Array.isArray;function Ot(r,o,u,m){if(r=r.options,o){o={};for(var w=0;w<u.length;w++)o["$"+u[w]]=!0;for(u=0;u<r.length;u++)w=o.hasOwnProperty("$"+r[u].value),r[u].selected!==w&&(r[u].selected=w),w&&m&&(r[u].defaultSelected=!0)}else{for(u=""+Ge(u),o=null,w=0;w<r.length;w++){if(r[w].value===u){r[w].selected=!0,m&&(r[w].defaultSelected=!0);return}o!==null||r[w].disabled||(o=r[w])}o!==null&&(o.selected=!0)}}function tt(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return E({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function $t(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(qt(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:Ge(u)}}function gt(r,o){var u=Ge(o.value),m=Ge(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),m!=null&&(r.defaultValue=""+m)}function Vt(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function ue(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ve(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?ue(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Le,Ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,m,w){MSApp.execUnsafeLocalFunction(function(){return r(o,u,m,w)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Le.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function nt(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var wt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dt=["Webkit","ms","Moz","O"];Object.keys(wt).forEach(function(r){Dt.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),wt[o]=wt[r]})});function Pt(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||wt.hasOwnProperty(r)&&wt[r]?(""+o).trim():o+"px"}function Ze(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,w=Pt(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,w):r[u]=w}}var Wt=E({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ct(r,o){if(o){if(Wt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function It(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 Mt=null;function Xt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ee=null,Ie=null,at=null;function Nt(r){if(r=ia(r)){if(typeof ee!="function")throw Error(n(280));var o=r.stateNode;o&&(o=Nl(o),ee(r.stateNode,r.type,o))}}function Se(r){Ie?at?at.push(r):at=[r]:Ie=r}function Ye(){if(Ie){var r=Ie,o=at;if(at=Ie=null,Nt(r),o)for(r=0;r<o.length;r++)Nt(o[r])}}function Ut(r,o){return r(o)}function nn(){}var fn=!1;function Nn(r,o,u){if(fn)return r(o,u);fn=!0;try{return Ut(r,o,u)}finally{fn=!1,(Ie!==null||at!==null)&&(nn(),Ye())}}function wn(r,o){var u=r.stateNode;if(u===null)return null;var m=Nl(u);if(m===null)return null;u=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var V=!1;if(d)try{var re={};Object.defineProperty(re,"passive",{get:function(){V=!0}}),window.addEventListener("test",re,re),window.removeEventListener("test",re,re)}catch{V=!1}function de(r,o,u,m,w,k,N,W,J){var pe=Array.prototype.slice.call(arguments,3);try{o.apply(u,pe)}catch(Pe){this.onError(Pe)}}var be=!1,Ee=null,We=!1,$e=null,Re={onError:function(r){be=!0,Ee=r}};function De(r,o,u,m,w,k,N,W,J){be=!1,Ee=null,de.apply(Re,arguments)}function Fe(r,o,u,m,w,k,N,W,J){if(De.apply(this,arguments),be){if(be){var pe=Ee;be=!1,Ee=null}else throw Error(n(198));We||(We=!0,$e=pe)}}function Oe(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function dt(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function ut(r){if(Oe(r)!==r)throw Error(n(188))}function Gt(r){var o=r.alternate;if(!o){if(o=Oe(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,m=o;;){var w=u.return;if(w===null)break;var k=w.alternate;if(k===null){if(m=w.return,m!==null){u=m;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===u)return ut(w),r;if(k===m)return ut(w),o;k=k.sibling}throw Error(n(188))}if(u.return!==m.return)u=w,m=k;else{for(var N=!1,W=w.child;W;){if(W===u){N=!0,u=w,m=k;break}if(W===m){N=!0,m=w,u=k;break}W=W.sibling}if(!N){for(W=k.child;W;){if(W===u){N=!0,u=k,m=w;break}if(W===m){N=!0,m=k,u=w;break}W=W.sibling}if(!N)throw Error(n(189))}}if(u.alternate!==m)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function Tt(r){return r=Gt(r),r!==null?Ue(r):null}function Ue(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Ue(r);if(o!==null)return o;r=r.sibling}return null}var ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Xe=t.unstable_shouldYield,rt=t.unstable_requestPaint,He=t.unstable_now,At=t.unstable_getCurrentPriorityLevel,Ct=t.unstable_ImmediatePriority,Q=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,D=t.unstable_LowPriority,he=t.unstable_IdlePriority,ie=null,it=null;function _t(r){if(it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(ie,r,void 0,(r.current.flags&128)===128)}catch{}}var O=Math.clz32?Math.clz32:ze,xe=Math.log,ge=Math.LN2;function ze(r){return r>>>=0,r===0?32:31-(xe(r)/ge|0)|0}var ht=64,on=4194304;function cn(r){switch(r&-r){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:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ir(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,w=r.suspendedLanes,k=r.pingedLanes,N=u&268435455;if(N!==0){var W=N&~w;W!==0?m=cn(W):(k&=N,k!==0&&(m=cn(k)))}else N=u&~w,N!==0?m=cn(N):k!==0&&(m=cn(k));if(m===0)return 0;if(o!==0&&o!==m&&(o&w)===0&&(w=m&-m,k=o&-o,w>=k||w===16&&(k&4194240)!==0))return o;if((m&4)!==0&&(m|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)u=31-O(o),w=1<<u,m|=r[u],o&=~w;return m}function hs(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yi(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,w=r.expirationTimes,k=r.pendingLanes;0<k;){var N=31-O(k),W=1<<N,J=w[N];J===-1?((W&u)===0||(W&m)!==0)&&(w[N]=hs(W,o)):J<=o&&(r.expiredLanes|=W),k&=~W}}function Li(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function dl(){var r=ht;return ht<<=1,(ht&4194240)===0&&(ht=64),r}function Uo(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Sr(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-O(o),r[o]=u}function zs(r,o){var u=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<u;){var w=31-O(u),k=1<<w;o[w]=0,m[w]=-1,r[w]=-1,u&=~k}}function Ii(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-O(u),w=1<<m;w&o|r[m]&o&&(r[m]|=o),u&=~w}}var rn=0;function zo(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Ho,fs,qo,hl,$o,Di=!1,Hs=[],qr=null,ii=null,si=null,_i=new Map,Fi=new Map,$r=[],fl="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 submit".split(" ");function Vo(r,o){switch(r){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":ii=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":_i.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fi.delete(o.pointerId)}}function z(r,o,u,m,w,k){return r===null||r.nativeEvent!==k?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:k,targetContainers:[w]},o!==null&&(o=ia(o),o!==null&&fs(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function le(r,o,u,m,w){switch(o){case"focusin":return qr=z(qr,r,o,u,m,w),!0;case"dragenter":return ii=z(ii,r,o,u,m,w),!0;case"mouseover":return si=z(si,r,o,u,m,w),!0;case"pointerover":var k=w.pointerId;return _i.set(k,z(_i.get(k)||null,r,o,u,m,w)),!0;case"gotpointercapture":return k=w.pointerId,Fi.set(k,z(Fi.get(k)||null,r,o,u,m,w)),!0}return!1}function qe(r){var o=ms(r.target);if(o!==null){var u=Oe(o);if(u!==null){if(o=u.tag,o===13){if(o=dt(u),o!==null){r.blockedOn=o,$o(r.priority,function(){qo(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function pt(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=qs(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);Mt=m,u.target.dispatchEvent(m),Mt=null}else return o=ia(u),o!==null&&fs(o),r.blockedOn=u,!1;o.shift()}return!0}function Jt(r,o,u){pt(r)&&u.delete(o)}function $n(){Di=!1,qr!==null&&pt(qr)&&(qr=null),ii!==null&&pt(ii)&&(ii=null),si!==null&&pt(si)&&(si=null),_i.forEach(Jt),Fi.forEach(Jt)}function Bn(r,o){r.blockedOn===o&&(r.blockedOn=null,Di||(Di=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,$n)))}function Vn(r){function o(w){return Bn(w,r)}if(0<Hs.length){Bn(Hs[0],r);for(var u=1;u<Hs.length;u++){var m=Hs[u];m.blockedOn===r&&(m.blockedOn=null)}}for(qr!==null&&Bn(qr,r),ii!==null&&Bn(ii,r),si!==null&&Bn(si,r),_i.forEach(o),Fi.forEach(o),u=0;u<$r.length;u++)m=$r[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<$r.length&&(u=$r[0],u.blockedOn===null);)qe(u),u.blockedOn===null&&$r.shift()}var an=K.ReactCurrentBatchConfig,Ft=!0;function An(r,o,u,m){var w=rn,k=an.transition;an.transition=null;try{rn=1,sr(r,o,u,m)}finally{rn=w,an.transition=k}}function vi(r,o,u,m){var w=rn,k=an.transition;an.transition=null;try{rn=4,sr(r,o,u,m)}finally{rn=w,an.transition=k}}function sr(r,o,u,m){if(Ft){var w=qs(r,o,u,m);if(w===null)Yu(r,o,m,oi,u),Vo(r,m);else if(le(w,r,o,u,m))m.stopPropagation();else if(Vo(r,m),o&4&&-1<fl.indexOf(r)){for(;w!==null;){var k=ia(w);if(k!==null&&Ho(k),k=qs(r,o,u,m),k===null&&Yu(r,o,m,oi,u),k===w)break;w=k}w!==null&&m.stopPropagation()}else Yu(r,o,m,null,u)}}var oi=null;function qs(r,o,u,m){if(oi=null,r=Xt(m),r=ms(r),r!==null)if(o=Oe(r),o===null)r=null;else if(u=o.tag,u===13){if(r=dt(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return oi=r,null}function ml(r){switch(r){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(At()){case Ct:return 1;case Q:return 4;case ke:case D:return 16;case he:return 536870912;default:return 16}default:return 16}}var Oi=null,Iu=null,pl=null;function bp(){if(pl)return pl;var r,o=Iu,u=o.length,m,w="value"in Oi?Oi.value:Oi.textContent,k=w.length;for(r=0;r<u&&o[r]===w[r];r++);var N=u-r;for(m=1;m<=N&&o[u-m]===w[k-m];m++);return pl=w.slice(r,1<m?1-m:void 0)}function gl(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function yl(){return!0}function xp(){return!1}function Cr(r){function o(u,m,w,k,N){this._reactName=u,this._targetInst=w,this.type=m,this.nativeEvent=k,this.target=N,this.currentTarget=null;for(var W in r)r.hasOwnProperty(W)&&(u=r[W],this[W]=u?u(k):k[W]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?yl:xp,this.isPropagationStopped=xp,this}return E(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=yl)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),o}var $s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Du=Cr($s),Go=E({},$s,{view:0,detail:0}),U0=Cr(Go),_u,Fu,Ko,vl=E({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bu,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ko&&(Ko&&r.type==="mousemove"?(_u=r.screenX-Ko.screenX,Fu=r.screenY-Ko.screenY):Fu=_u=0,Ko=r),_u)},movementY:function(r){return"movementY"in r?r.movementY:Fu}}),kp=Cr(vl),z0=E({},vl,{dataTransfer:0}),H0=Cr(z0),q0=E({},Go,{relatedTarget:0}),Ou=Cr(q0),$0=E({},$s,{animationName:0,elapsedTime:0,pseudoElement:0}),V0=Cr($0),G0=E({},$s,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),K0=Cr(G0),Q0=E({},$s,{data:0}),Sp=Cr(Q0),Y0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X0={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"},J0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z0(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=J0[r])?!!o[r]:!1}function Bu(){return Z0}var e1=E({},Go,{key:function(r){if(r.key){var o=Y0[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=gl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?X0[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bu,charCode:function(r){return r.type==="keypress"?gl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?gl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),t1=Cr(e1),n1=E({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cp=Cr(n1),r1=E({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bu}),i1=Cr(r1),s1=E({},$s,{propertyName:0,elapsedTime:0,pseudoElement:0}),o1=Cr(s1),a1=E({},vl,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),l1=Cr(a1),c1=[9,13,27,32],Wu=d&&"CompositionEvent"in window,Qo=null;d&&"documentMode"in document&&(Qo=document.documentMode);var u1=d&&"TextEvent"in window&&!Qo,jp=d&&(!Wu||Qo&&8<Qo&&11>=Qo),Np=" ",Pp=!1;function Tp(r,o){switch(r){case"keyup":return c1.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ep(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Vs=!1;function d1(r,o){switch(r){case"compositionend":return Ep(o);case"keypress":return o.which!==32?null:(Pp=!0,Np);case"textInput":return r=o.data,r===Np&&Pp?null:r;default:return null}}function h1(r,o){if(Vs)return r==="compositionend"||!Wu&&Tp(r,o)?(r=bp(),pl=Iu=Oi=null,Vs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return jp&&o.locale!=="ko"?null:o.data;default:return null}}var f1={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 Rp(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!f1[r.type]:o==="textarea"}function Mp(r,o,u,m){Se(m),o=Sl(o,"onChange"),0<o.length&&(u=new Du("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var Yo=null,Xo=null;function m1(r){Qp(r,0)}function wl(r){var o=Xs(r);if(yt(o))return r}function p1(r,o){if(r==="change")return o}var Ap=!1;if(d){var Uu;if(d){var zu="oninput"in document;if(!zu){var Lp=document.createElement("div");Lp.setAttribute("oninput","return;"),zu=typeof Lp.oninput=="function"}Uu=zu}else Uu=!1;Ap=Uu&&(!document.documentMode||9<document.documentMode)}function Ip(){Yo&&(Yo.detachEvent("onpropertychange",Dp),Xo=Yo=null)}function Dp(r){if(r.propertyName==="value"&&wl(Xo)){var o=[];Mp(o,Xo,r,Xt(r)),Nn(m1,o)}}function g1(r,o,u){r==="focusin"?(Ip(),Yo=o,Xo=u,Yo.attachEvent("onpropertychange",Dp)):r==="focusout"&&Ip()}function y1(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return wl(Xo)}function v1(r,o){if(r==="click")return wl(o)}function w1(r,o){if(r==="input"||r==="change")return wl(o)}function b1(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Vr=typeof Object.is=="function"?Object.is:b1;function Jo(r,o){if(Vr(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var w=u[m];if(!f.call(o,w)||!Vr(r[w],o[w]))return!1}return!0}function _p(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Fp(r,o){var u=_p(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=_p(u)}}function Op(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Op(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Bp(){for(var r=window,o=St();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=St(r.document)}return o}function Hu(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function x1(r){var o=Bp(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Op(u.ownerDocument.documentElement,u)){if(m!==null&&Hu(u)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var w=u.textContent.length,k=Math.min(m.start,w);m=m.end===void 0?k:Math.min(m.end,w),!r.extend&&k>m&&(w=m,m=k,k=w),w=Fp(u,k);var N=Fp(u,m);w&&N&&(r.rangeCount!==1||r.anchorNode!==w.node||r.anchorOffset!==w.offset||r.focusNode!==N.node||r.focusOffset!==N.offset)&&(o=o.createRange(),o.setStart(w.node,w.offset),r.removeAllRanges(),k>m?(r.addRange(o),r.extend(N.node,N.offset)):(o.setEnd(N.node,N.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var k1=d&&"documentMode"in document&&11>=document.documentMode,Gs=null,qu=null,Zo=null,$u=!1;function Wp(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;$u||Gs==null||Gs!==St(m)||(m=Gs,"selectionStart"in m&&Hu(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Zo&&Jo(Zo,m)||(Zo=m,m=Sl(qu,"onSelect"),0<m.length&&(o=new Du("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=Gs)))}function bl(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Ks={animationend:bl("Animation","AnimationEnd"),animationiteration:bl("Animation","AnimationIteration"),animationstart:bl("Animation","AnimationStart"),transitionend:bl("Transition","TransitionEnd")},Vu={},Up={};d&&(Up=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function xl(r){if(Vu[r])return Vu[r];if(!Ks[r])return r;var o=Ks[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Up)return Vu[r]=o[u];return r}var zp=xl("animationend"),Hp=xl("animationiteration"),qp=xl("animationstart"),$p=xl("transitionend"),Vp=new Map,Gp="abort auxClick 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(" ");function Bi(r,o){Vp.set(r,o),c(o,[r])}for(var Gu=0;Gu<Gp.length;Gu++){var Ku=Gp[Gu],S1=Ku.toLowerCase(),C1=Ku[0].toUpperCase()+Ku.slice(1);Bi(S1,"on"+C1)}Bi(zp,"onAnimationEnd"),Bi(Hp,"onAnimationIteration"),Bi(qp,"onAnimationStart"),Bi("dblclick","onDoubleClick"),Bi("focusin","onFocus"),Bi("focusout","onBlur"),Bi($p,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ea="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(" "),j1=new Set("cancel close invalid load scroll toggle".split(" ").concat(ea));function Kp(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Fe(m,o,void 0,r),r.currentTarget=null}function Qp(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],w=m.event;m=m.listeners;e:{var k=void 0;if(o)for(var N=m.length-1;0<=N;N--){var W=m[N],J=W.instance,pe=W.currentTarget;if(W=W.listener,J!==k&&w.isPropagationStopped())break e;Kp(w,W,pe),k=J}else for(N=0;N<m.length;N++){if(W=m[N],J=W.instance,pe=W.currentTarget,W=W.listener,J!==k&&w.isPropagationStopped())break e;Kp(w,W,pe),k=J}}}if(We)throw r=$e,We=!1,$e=null,r}function mn(r,o){var u=o[nd];u===void 0&&(u=o[nd]=new Set);var m=r+"__bubble";u.has(m)||(Yp(o,r,2,!1),u.add(m))}function Qu(r,o,u){var m=0;o&&(m|=4),Yp(u,r,m,o)}var kl="_reactListening"+Math.random().toString(36).slice(2);function ta(r){if(!r[kl]){r[kl]=!0,s.forEach(function(u){u!=="selectionchange"&&(j1.has(u)||Qu(u,!1,r),Qu(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[kl]||(o[kl]=!0,Qu("selectionchange",!1,o))}}function Yp(r,o,u,m){switch(ml(o)){case 1:var w=An;break;case 4:w=vi;break;default:w=sr}u=w.bind(null,o,u,r),w=void 0,!V||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),m?w!==void 0?r.addEventListener(o,u,{capture:!0,passive:w}):r.addEventListener(o,u,!0):w!==void 0?r.addEventListener(o,u,{passive:w}):r.addEventListener(o,u,!1)}function Yu(r,o,u,m,w){var k=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var N=m.tag;if(N===3||N===4){var W=m.stateNode.containerInfo;if(W===w||W.nodeType===8&&W.parentNode===w)break;if(N===4)for(N=m.return;N!==null;){var J=N.tag;if((J===3||J===4)&&(J=N.stateNode.containerInfo,J===w||J.nodeType===8&&J.parentNode===w))return;N=N.return}for(;W!==null;){if(N=ms(W),N===null)return;if(J=N.tag,J===5||J===6){m=k=N;continue e}W=W.parentNode}}m=m.return}Nn(function(){var pe=k,Pe=Xt(u),Te=[];e:{var Ne=Vp.get(r);if(Ne!==void 0){var Ve=Du,et=r;switch(r){case"keypress":if(gl(u)===0)break e;case"keydown":case"keyup":Ve=t1;break;case"focusin":et="focus",Ve=Ou;break;case"focusout":et="blur",Ve=Ou;break;case"beforeblur":case"afterblur":Ve=Ou;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ve=kp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ve=H0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ve=i1;break;case zp:case Hp:case qp:Ve=V0;break;case $p:Ve=o1;break;case"scroll":Ve=U0;break;case"wheel":Ve=l1;break;case"copy":case"cut":case"paste":Ve=K0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ve=Cp}var st=(o&4)!==0,Cn=!st&&r==="scroll",ce=st?Ne!==null?Ne+"Capture":null:Ne;st=[];for(var ne=pe,fe;ne!==null;){fe=ne;var Ae=fe.stateNode;if(fe.tag===5&&Ae!==null&&(fe=Ae,ce!==null&&(Ae=wn(ne,ce),Ae!=null&&st.push(na(ne,Ae,fe)))),Cn)break;ne=ne.return}0<st.length&&(Ne=new Ve(Ne,et,null,u,Pe),Te.push({event:Ne,listeners:st}))}}if((o&7)===0){e:{if(Ne=r==="mouseover"||r==="pointerover",Ve=r==="mouseout"||r==="pointerout",Ne&&u!==Mt&&(et=u.relatedTarget||u.fromElement)&&(ms(et)||et[wi]))break e;if((Ve||Ne)&&(Ne=Pe.window===Pe?Pe:(Ne=Pe.ownerDocument)?Ne.defaultView||Ne.parentWindow:window,Ve?(et=u.relatedTarget||u.toElement,Ve=pe,et=et?ms(et):null,et!==null&&(Cn=Oe(et),et!==Cn||et.tag!==5&&et.tag!==6)&&(et=null)):(Ve=null,et=pe),Ve!==et)){if(st=kp,Ae="onMouseLeave",ce="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(st=Cp,Ae="onPointerLeave",ce="onPointerEnter",ne="pointer"),Cn=Ve==null?Ne:Xs(Ve),fe=et==null?Ne:Xs(et),Ne=new st(Ae,ne+"leave",Ve,u,Pe),Ne.target=Cn,Ne.relatedTarget=fe,Ae=null,ms(Pe)===pe&&(st=new st(ce,ne+"enter",et,u,Pe),st.target=fe,st.relatedTarget=Cn,Ae=st),Cn=Ae,Ve&&et)t:{for(st=Ve,ce=et,ne=0,fe=st;fe;fe=Qs(fe))ne++;for(fe=0,Ae=ce;Ae;Ae=Qs(Ae))fe++;for(;0<ne-fe;)st=Qs(st),ne--;for(;0<fe-ne;)ce=Qs(ce),fe--;for(;ne--;){if(st===ce||ce!==null&&st===ce.alternate)break t;st=Qs(st),ce=Qs(ce)}st=null}else st=null;Ve!==null&&Xp(Te,Ne,Ve,st,!1),et!==null&&Cn!==null&&Xp(Te,Cn,et,st,!0)}}e:{if(Ne=pe?Xs(pe):window,Ve=Ne.nodeName&&Ne.nodeName.toLowerCase(),Ve==="select"||Ve==="input"&&Ne.type==="file")var lt=p1;else if(Rp(Ne))if(Ap)lt=w1;else{lt=y1;var bt=g1}else(Ve=Ne.nodeName)&&Ve.toLowerCase()==="input"&&(Ne.type==="checkbox"||Ne.type==="radio")&&(lt=v1);if(lt&&(lt=lt(r,pe))){Mp(Te,lt,u,Pe);break e}bt&&bt(r,Ne,pe),r==="focusout"&&(bt=Ne._wrapperState)&&bt.controlled&&Ne.type==="number"&&tn(Ne,"number",Ne.value)}switch(bt=pe?Xs(pe):window,r){case"focusin":(Rp(bt)||bt.contentEditable==="true")&&(Gs=bt,qu=pe,Zo=null);break;case"focusout":Zo=qu=Gs=null;break;case"mousedown":$u=!0;break;case"contextmenu":case"mouseup":case"dragend":$u=!1,Wp(Te,u,Pe);break;case"selectionchange":if(k1)break;case"keydown":case"keyup":Wp(Te,u,Pe)}var xt;if(Wu)e:{switch(r){case"compositionstart":var Et="onCompositionStart";break e;case"compositionend":Et="onCompositionEnd";break e;case"compositionupdate":Et="onCompositionUpdate";break e}Et=void 0}else Vs?Tp(r,u)&&(Et="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Et="onCompositionStart");Et&&(jp&&u.locale!=="ko"&&(Vs||Et!=="onCompositionStart"?Et==="onCompositionEnd"&&Vs&&(xt=bp()):(Oi=Pe,Iu="value"in Oi?Oi.value:Oi.textContent,Vs=!0)),bt=Sl(pe,Et),0<bt.length&&(Et=new Sp(Et,r,null,u,Pe),Te.push({event:Et,listeners:bt}),xt?Et.data=xt:(xt=Ep(u),xt!==null&&(Et.data=xt)))),(xt=u1?d1(r,u):h1(r,u))&&(pe=Sl(pe,"onBeforeInput"),0<pe.length&&(Pe=new Sp("onBeforeInput","beforeinput",null,u,Pe),Te.push({event:Pe,listeners:pe}),Pe.data=xt))}Qp(Te,o)})}function na(r,o,u){return{instance:r,listener:o,currentTarget:u}}function Sl(r,o){for(var u=o+"Capture",m=[];r!==null;){var w=r,k=w.stateNode;w.tag===5&&k!==null&&(w=k,k=wn(r,u),k!=null&&m.unshift(na(r,k,w)),k=wn(r,o),k!=null&&m.push(na(r,k,w))),r=r.return}return m}function Qs(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Xp(r,o,u,m,w){for(var k=o._reactName,N=[];u!==null&&u!==m;){var W=u,J=W.alternate,pe=W.stateNode;if(J!==null&&J===m)break;W.tag===5&&pe!==null&&(W=pe,w?(J=wn(u,k),J!=null&&N.unshift(na(u,J,W))):w||(J=wn(u,k),J!=null&&N.push(na(u,J,W)))),u=u.return}N.length!==0&&r.push({event:o,listeners:N})}var N1=/\r\n?/g,P1=/\u0000|\uFFFD/g;function Jp(r){return(typeof r=="string"?r:""+r).replace(N1,`
|
|
39
|
+
`).replace(P1,"")}function Cl(r,o,u){if(o=Jp(o),Jp(r)!==o&&u)throw Error(n(425))}function jl(){}var Xu=null,Ju=null;function Zu(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var ed=typeof setTimeout=="function"?setTimeout:void 0,T1=typeof clearTimeout=="function"?clearTimeout:void 0,Zp=typeof Promise=="function"?Promise:void 0,E1=typeof queueMicrotask=="function"?queueMicrotask:typeof Zp<"u"?function(r){return Zp.resolve(null).then(r).catch(R1)}:ed;function R1(r){setTimeout(function(){throw r})}function td(r,o){var u=o,m=0;do{var w=u.nextSibling;if(r.removeChild(u),w&&w.nodeType===8)if(u=w.data,u==="/$"){if(m===0){r.removeChild(w),Vn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=w}while(u);Vn(o)}function Wi(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function eg(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var Ys=Math.random().toString(36).slice(2),ai="__reactFiber$"+Ys,ra="__reactProps$"+Ys,wi="__reactContainer$"+Ys,nd="__reactEvents$"+Ys,M1="__reactListeners$"+Ys,A1="__reactHandles$"+Ys;function ms(r){var o=r[ai];if(o)return o;for(var u=r.parentNode;u;){if(o=u[wi]||u[ai]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=eg(r);r!==null;){if(u=r[ai])return u;r=eg(r)}return o}r=u,u=r.parentNode}return null}function ia(r){return r=r[ai]||r[wi],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Xs(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function Nl(r){return r[ra]||null}var rd=[],Js=-1;function Ui(r){return{current:r}}function pn(r){0>Js||(r.current=rd[Js],rd[Js]=null,Js--)}function dn(r,o){Js++,rd[Js]=r.current,r.current=o}var zi={},Xn=Ui(zi),dr=Ui(!1),ps=zi;function Zs(r,o){var u=r.type.contextTypes;if(!u)return zi;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var w={},k;for(k in u)w[k]=o[k];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function hr(r){return r=r.childContextTypes,r!=null}function Pl(){pn(dr),pn(Xn)}function tg(r,o,u){if(Xn.current!==zi)throw Error(n(168));dn(Xn,o),dn(dr,u)}function ng(r,o,u){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return u;m=m.getChildContext();for(var w in m)if(!(w in o))throw Error(n(108,_e(r)||"Unknown",w));return E({},u,m)}function Tl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||zi,ps=Xn.current,dn(Xn,r),dn(dr,dr.current),!0}function rg(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=ng(r,o,ps),m.__reactInternalMemoizedMergedChildContext=r,pn(dr),pn(Xn),dn(Xn,r)):pn(dr),dn(dr,u)}var bi=null,El=!1,id=!1;function ig(r){bi===null?bi=[r]:bi.push(r)}function L1(r){El=!0,ig(r)}function Hi(){if(!id&&bi!==null){id=!0;var r=0,o=rn;try{var u=bi;for(rn=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}bi=null,El=!1}catch(w){throw bi!==null&&(bi=bi.slice(r+1)),ae(Ct,Hi),w}finally{rn=o,id=!1}}return null}var eo=[],to=0,Rl=null,Ml=0,Lr=[],Ir=0,gs=null,xi=1,ki="";function ys(r,o){eo[to++]=Ml,eo[to++]=Rl,Rl=r,Ml=o}function sg(r,o,u){Lr[Ir++]=xi,Lr[Ir++]=ki,Lr[Ir++]=gs,gs=r;var m=xi;r=ki;var w=32-O(m)-1;m&=~(1<<w),u+=1;var k=32-O(o)+w;if(30<k){var N=w-w%5;k=(m&(1<<N)-1).toString(32),m>>=N,w-=N,xi=1<<32-O(o)+w|u<<w|m,ki=k+r}else xi=1<<k|u<<w|m,ki=r}function sd(r){r.return!==null&&(ys(r,1),sg(r,1,0))}function od(r){for(;r===Rl;)Rl=eo[--to],eo[to]=null,Ml=eo[--to],eo[to]=null;for(;r===gs;)gs=Lr[--Ir],Lr[Ir]=null,ki=Lr[--Ir],Lr[Ir]=null,xi=Lr[--Ir],Lr[Ir]=null}var jr=null,Nr=null,gn=!1,Gr=null;function og(r,o){var u=Or(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function ag(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jr=r,Nr=Wi(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jr=r,Nr=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=gs!==null?{id:xi,overflow:ki}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Or(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,jr=r,Nr=null,!0):!1;default:return!1}}function ad(r){return(r.mode&1)!==0&&(r.flags&128)===0}function ld(r){if(gn){var o=Nr;if(o){var u=o;if(!ag(r,o)){if(ad(r))throw Error(n(418));o=Wi(u.nextSibling);var m=jr;o&&ag(r,o)?og(m,u):(r.flags=r.flags&-4097|2,gn=!1,jr=r)}}else{if(ad(r))throw Error(n(418));r.flags=r.flags&-4097|2,gn=!1,jr=r}}}function lg(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jr=r}function Al(r){if(r!==jr)return!1;if(!gn)return lg(r),gn=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Zu(r.type,r.memoizedProps)),o&&(o=Nr)){if(ad(r))throw cg(),Error(n(418));for(;o;)og(r,o),o=Wi(o.nextSibling)}if(lg(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(o===0){Nr=Wi(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}Nr=null}}else Nr=jr?Wi(r.stateNode.nextSibling):null;return!0}function cg(){for(var r=Nr;r;)r=Wi(r.nextSibling)}function no(){Nr=jr=null,gn=!1}function cd(r){Gr===null?Gr=[r]:Gr.push(r)}var I1=K.ReactCurrentBatchConfig;function sa(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var m=u.stateNode}if(!m)throw Error(n(147,r));var w=m,k=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===k?o.ref:(o=function(N){var W=w.refs;N===null?delete W[k]:W[k]=N},o._stringRef=k,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Ll(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function ug(r){var o=r._init;return o(r._payload)}function dg(r){function o(ce,ne){if(r){var fe=ce.deletions;fe===null?(ce.deletions=[ne],ce.flags|=16):fe.push(ne)}}function u(ce,ne){if(!r)return null;for(;ne!==null;)o(ce,ne),ne=ne.sibling;return null}function m(ce,ne){for(ce=new Map;ne!==null;)ne.key!==null?ce.set(ne.key,ne):ce.set(ne.index,ne),ne=ne.sibling;return ce}function w(ce,ne){return ce=Xi(ce,ne),ce.index=0,ce.sibling=null,ce}function k(ce,ne,fe){return ce.index=fe,r?(fe=ce.alternate,fe!==null?(fe=fe.index,fe<ne?(ce.flags|=2,ne):fe):(ce.flags|=2,ne)):(ce.flags|=1048576,ne)}function N(ce){return r&&ce.alternate===null&&(ce.flags|=2),ce}function W(ce,ne,fe,Ae){return ne===null||ne.tag!==6?(ne=eh(fe,ce.mode,Ae),ne.return=ce,ne):(ne=w(ne,fe),ne.return=ce,ne)}function J(ce,ne,fe,Ae){var lt=fe.type;return lt===M?Pe(ce,ne,fe.props.children,Ae,fe.key):ne!==null&&(ne.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===se&&ug(lt)===ne.type)?(Ae=w(ne,fe.props),Ae.ref=sa(ce,ne,fe),Ae.return=ce,Ae):(Ae=rc(fe.type,fe.key,fe.props,null,ce.mode,Ae),Ae.ref=sa(ce,ne,fe),Ae.return=ce,Ae)}function pe(ce,ne,fe,Ae){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==fe.containerInfo||ne.stateNode.implementation!==fe.implementation?(ne=th(fe,ce.mode,Ae),ne.return=ce,ne):(ne=w(ne,fe.children||[]),ne.return=ce,ne)}function Pe(ce,ne,fe,Ae,lt){return ne===null||ne.tag!==7?(ne=js(fe,ce.mode,Ae,lt),ne.return=ce,ne):(ne=w(ne,fe),ne.return=ce,ne)}function Te(ce,ne,fe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=eh(""+ne,ce.mode,fe),ne.return=ce,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case H:return fe=rc(ne.type,ne.key,ne.props,null,ce.mode,fe),fe.ref=sa(ce,null,ne),fe.return=ce,fe;case F:return ne=th(ne,ce.mode,fe),ne.return=ce,ne;case se:var Ae=ne._init;return Te(ce,Ae(ne._payload),fe)}if(qt(ne)||oe(ne))return ne=js(ne,ce.mode,fe,null),ne.return=ce,ne;Ll(ce,ne)}return null}function Ne(ce,ne,fe,Ae){var lt=ne!==null?ne.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number")return lt!==null?null:W(ce,ne,""+fe,Ae);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case H:return fe.key===lt?J(ce,ne,fe,Ae):null;case F:return fe.key===lt?pe(ce,ne,fe,Ae):null;case se:return lt=fe._init,Ne(ce,ne,lt(fe._payload),Ae)}if(qt(fe)||oe(fe))return lt!==null?null:Pe(ce,ne,fe,Ae,null);Ll(ce,fe)}return null}function Ve(ce,ne,fe,Ae,lt){if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number")return ce=ce.get(fe)||null,W(ne,ce,""+Ae,lt);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case H:return ce=ce.get(Ae.key===null?fe:Ae.key)||null,J(ne,ce,Ae,lt);case F:return ce=ce.get(Ae.key===null?fe:Ae.key)||null,pe(ne,ce,Ae,lt);case se:var bt=Ae._init;return Ve(ce,ne,fe,bt(Ae._payload),lt)}if(qt(Ae)||oe(Ae))return ce=ce.get(fe)||null,Pe(ne,ce,Ae,lt,null);Ll(ne,Ae)}return null}function et(ce,ne,fe,Ae){for(var lt=null,bt=null,xt=ne,Et=ne=0,zn=null;xt!==null&&Et<fe.length;Et++){xt.index>Et?(zn=xt,xt=null):zn=xt.sibling;var sn=Ne(ce,xt,fe[Et],Ae);if(sn===null){xt===null&&(xt=zn);break}r&&xt&&sn.alternate===null&&o(ce,xt),ne=k(sn,ne,Et),bt===null?lt=sn:bt.sibling=sn,bt=sn,xt=zn}if(Et===fe.length)return u(ce,xt),gn&&ys(ce,Et),lt;if(xt===null){for(;Et<fe.length;Et++)xt=Te(ce,fe[Et],Ae),xt!==null&&(ne=k(xt,ne,Et),bt===null?lt=xt:bt.sibling=xt,bt=xt);return gn&&ys(ce,Et),lt}for(xt=m(ce,xt);Et<fe.length;Et++)zn=Ve(xt,ce,Et,fe[Et],Ae),zn!==null&&(r&&zn.alternate!==null&&xt.delete(zn.key===null?Et:zn.key),ne=k(zn,ne,Et),bt===null?lt=zn:bt.sibling=zn,bt=zn);return r&&xt.forEach(function(Ji){return o(ce,Ji)}),gn&&ys(ce,Et),lt}function st(ce,ne,fe,Ae){var lt=oe(fe);if(typeof lt!="function")throw Error(n(150));if(fe=lt.call(fe),fe==null)throw Error(n(151));for(var bt=lt=null,xt=ne,Et=ne=0,zn=null,sn=fe.next();xt!==null&&!sn.done;Et++,sn=fe.next()){xt.index>Et?(zn=xt,xt=null):zn=xt.sibling;var Ji=Ne(ce,xt,sn.value,Ae);if(Ji===null){xt===null&&(xt=zn);break}r&&xt&&Ji.alternate===null&&o(ce,xt),ne=k(Ji,ne,Et),bt===null?lt=Ji:bt.sibling=Ji,bt=Ji,xt=zn}if(sn.done)return u(ce,xt),gn&&ys(ce,Et),lt;if(xt===null){for(;!sn.done;Et++,sn=fe.next())sn=Te(ce,sn.value,Ae),sn!==null&&(ne=k(sn,ne,Et),bt===null?lt=sn:bt.sibling=sn,bt=sn);return gn&&ys(ce,Et),lt}for(xt=m(ce,xt);!sn.done;Et++,sn=fe.next())sn=Ve(xt,ce,Et,sn.value,Ae),sn!==null&&(r&&sn.alternate!==null&&xt.delete(sn.key===null?Et:sn.key),ne=k(sn,ne,Et),bt===null?lt=sn:bt.sibling=sn,bt=sn);return r&&xt.forEach(function(fj){return o(ce,fj)}),gn&&ys(ce,Et),lt}function Cn(ce,ne,fe,Ae){if(typeof fe=="object"&&fe!==null&&fe.type===M&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case H:e:{for(var lt=fe.key,bt=ne;bt!==null;){if(bt.key===lt){if(lt=fe.type,lt===M){if(bt.tag===7){u(ce,bt.sibling),ne=w(bt,fe.props.children),ne.return=ce,ce=ne;break e}}else if(bt.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===se&&ug(lt)===bt.type){u(ce,bt.sibling),ne=w(bt,fe.props),ne.ref=sa(ce,bt,fe),ne.return=ce,ce=ne;break e}u(ce,bt);break}else o(ce,bt);bt=bt.sibling}fe.type===M?(ne=js(fe.props.children,ce.mode,Ae,fe.key),ne.return=ce,ce=ne):(Ae=rc(fe.type,fe.key,fe.props,null,ce.mode,Ae),Ae.ref=sa(ce,ne,fe),Ae.return=ce,ce=Ae)}return N(ce);case F:e:{for(bt=fe.key;ne!==null;){if(ne.key===bt)if(ne.tag===4&&ne.stateNode.containerInfo===fe.containerInfo&&ne.stateNode.implementation===fe.implementation){u(ce,ne.sibling),ne=w(ne,fe.children||[]),ne.return=ce,ce=ne;break e}else{u(ce,ne);break}else o(ce,ne);ne=ne.sibling}ne=th(fe,ce.mode,Ae),ne.return=ce,ce=ne}return N(ce);case se:return bt=fe._init,Cn(ce,ne,bt(fe._payload),Ae)}if(qt(fe))return et(ce,ne,fe,Ae);if(oe(fe))return st(ce,ne,fe,Ae);Ll(ce,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ne!==null&&ne.tag===6?(u(ce,ne.sibling),ne=w(ne,fe),ne.return=ce,ce=ne):(u(ce,ne),ne=eh(fe,ce.mode,Ae),ne.return=ce,ce=ne),N(ce)):u(ce,ne)}return Cn}var ro=dg(!0),hg=dg(!1),Il=Ui(null),Dl=null,io=null,ud=null;function dd(){ud=io=Dl=null}function hd(r){var o=Il.current;pn(Il),r._currentValue=o}function fd(r,o,u){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===u)break;r=r.return}}function so(r,o){Dl=r,ud=io=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fr=!0),r.firstContext=null)}function Dr(r){var o=r._currentValue;if(ud!==r)if(r={context:r,memoizedValue:o,next:null},io===null){if(Dl===null)throw Error(n(308));io=r,Dl.dependencies={lanes:0,firstContext:r}}else io=io.next=r;return o}var vs=null;function md(r){vs===null?vs=[r]:vs.push(r)}function fg(r,o,u,m){var w=o.interleaved;return w===null?(u.next=u,md(o)):(u.next=w.next,w.next=u),o.interleaved=u,Si(r,m)}function Si(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var qi=!1;function pd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mg(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Ci(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function $i(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(en&2)!==0){var w=m.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),m.pending=o,Si(r,u)}return w=m.interleaved,w===null?(o.next=o,md(m)):(o.next=w.next,w.next=o),m.interleaved=o,Si(r,u)}function _l(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ii(r,u)}}function pg(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var w=null,k=null;if(u=u.firstBaseUpdate,u!==null){do{var N={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};k===null?w=k=N:k=k.next=N,u=u.next}while(u!==null);k===null?w=k=o:k=k.next=o}else w=k=o;u={baseState:m.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:m.shared,effects:m.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Fl(r,o,u,m){var w=r.updateQueue;qi=!1;var k=w.firstBaseUpdate,N=w.lastBaseUpdate,W=w.shared.pending;if(W!==null){w.shared.pending=null;var J=W,pe=J.next;J.next=null,N===null?k=pe:N.next=pe,N=J;var Pe=r.alternate;Pe!==null&&(Pe=Pe.updateQueue,W=Pe.lastBaseUpdate,W!==N&&(W===null?Pe.firstBaseUpdate=pe:W.next=pe,Pe.lastBaseUpdate=J))}if(k!==null){var Te=w.baseState;N=0,Pe=pe=J=null,W=k;do{var Ne=W.lane,Ve=W.eventTime;if((m&Ne)===Ne){Pe!==null&&(Pe=Pe.next={eventTime:Ve,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var et=r,st=W;switch(Ne=o,Ve=u,st.tag){case 1:if(et=st.payload,typeof et=="function"){Te=et.call(Ve,Te,Ne);break e}Te=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=st.payload,Ne=typeof et=="function"?et.call(Ve,Te,Ne):et,Ne==null)break e;Te=E({},Te,Ne);break e;case 2:qi=!0}}W.callback!==null&&W.lane!==0&&(r.flags|=64,Ne=w.effects,Ne===null?w.effects=[W]:Ne.push(W))}else Ve={eventTime:Ve,lane:Ne,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Pe===null?(pe=Pe=Ve,J=Te):Pe=Pe.next=Ve,N|=Ne;if(W=W.next,W===null){if(W=w.shared.pending,W===null)break;Ne=W,W=Ne.next,Ne.next=null,w.lastBaseUpdate=Ne,w.shared.pending=null}}while(!0);if(Pe===null&&(J=Te),w.baseState=J,w.firstBaseUpdate=pe,w.lastBaseUpdate=Pe,o=w.shared.interleaved,o!==null){w=o;do N|=w.lane,w=w.next;while(w!==o)}else k===null&&(w.shared.lanes=0);xs|=N,r.lanes=N,r.memoizedState=Te}}function gg(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],w=m.callback;if(w!==null){if(m.callback=null,m=u,typeof w!="function")throw Error(n(191,w));w.call(m)}}}var oa={},li=Ui(oa),aa=Ui(oa),la=Ui(oa);function ws(r){if(r===oa)throw Error(n(174));return r}function gd(r,o){switch(dn(la,o),dn(aa,r),dn(li,oa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ve(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ve(o,r)}pn(li),dn(li,o)}function oo(){pn(li),pn(aa),pn(la)}function yg(r){ws(la.current);var o=ws(li.current),u=ve(o,r.type);o!==u&&(dn(aa,r),dn(li,u))}function yd(r){aa.current===r&&(pn(li),pn(aa))}var bn=Ui(0);function Ol(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var vd=[];function wd(){for(var r=0;r<vd.length;r++)vd[r]._workInProgressVersionPrimary=null;vd.length=0}var Bl=K.ReactCurrentDispatcher,bd=K.ReactCurrentBatchConfig,bs=0,xn=null,Ln=null,Wn=null,Wl=!1,ca=!1,ua=0,D1=0;function Jn(){throw Error(n(321))}function xd(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Vr(r[u],o[u]))return!1;return!0}function kd(r,o,u,m,w,k){if(bs=k,xn=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Bl.current=r===null||r.memoizedState===null?B1:W1,r=u(m,w),ca){k=0;do{if(ca=!1,ua=0,25<=k)throw Error(n(301));k+=1,Wn=Ln=null,o.updateQueue=null,Bl.current=U1,r=u(m,w)}while(ca)}if(Bl.current=Hl,o=Ln!==null&&Ln.next!==null,bs=0,Wn=Ln=xn=null,Wl=!1,o)throw Error(n(300));return r}function Sd(){var r=ua!==0;return ua=0,r}function ci(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wn===null?xn.memoizedState=Wn=r:Wn=Wn.next=r,Wn}function _r(){if(Ln===null){var r=xn.alternate;r=r!==null?r.memoizedState:null}else r=Ln.next;var o=Wn===null?xn.memoizedState:Wn.next;if(o!==null)Wn=o,Ln=r;else{if(r===null)throw Error(n(310));Ln=r,r={memoizedState:Ln.memoizedState,baseState:Ln.baseState,baseQueue:Ln.baseQueue,queue:Ln.queue,next:null},Wn===null?xn.memoizedState=Wn=r:Wn=Wn.next=r}return Wn}function da(r,o){return typeof o=="function"?o(r):o}function Cd(r){var o=_r(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=Ln,w=m.baseQueue,k=u.pending;if(k!==null){if(w!==null){var N=w.next;w.next=k.next,k.next=N}m.baseQueue=w=k,u.pending=null}if(w!==null){k=w.next,m=m.baseState;var W=N=null,J=null,pe=k;do{var Pe=pe.lane;if((bs&Pe)===Pe)J!==null&&(J=J.next={lane:0,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),m=pe.hasEagerState?pe.eagerState:r(m,pe.action);else{var Te={lane:Pe,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null};J===null?(W=J=Te,N=m):J=J.next=Te,xn.lanes|=Pe,xs|=Pe}pe=pe.next}while(pe!==null&&pe!==k);J===null?N=m:J.next=W,Vr(m,o.memoizedState)||(fr=!0),o.memoizedState=m,o.baseState=N,o.baseQueue=J,u.lastRenderedState=m}if(r=u.interleaved,r!==null){w=r;do k=w.lane,xn.lanes|=k,xs|=k,w=w.next;while(w!==r)}else w===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function jd(r){var o=_r(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,w=u.pending,k=o.memoizedState;if(w!==null){u.pending=null;var N=w=w.next;do k=r(k,N.action),N=N.next;while(N!==w);Vr(k,o.memoizedState)||(fr=!0),o.memoizedState=k,o.baseQueue===null&&(o.baseState=k),u.lastRenderedState=k}return[k,m]}function vg(){}function wg(r,o){var u=xn,m=_r(),w=o(),k=!Vr(m.memoizedState,w);if(k&&(m.memoizedState=w,fr=!0),m=m.queue,Nd(kg.bind(null,u,m,r),[r]),m.getSnapshot!==o||k||Wn!==null&&Wn.memoizedState.tag&1){if(u.flags|=2048,ha(9,xg.bind(null,u,m,w,o),void 0,null),Un===null)throw Error(n(349));(bs&30)!==0||bg(u,o,w)}return w}function bg(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=xn.updateQueue,o===null?(o={lastEffect:null,stores:null},xn.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function xg(r,o,u,m){o.value=u,o.getSnapshot=m,Sg(o)&&Cg(r)}function kg(r,o,u){return u(function(){Sg(o)&&Cg(r)})}function Sg(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Vr(r,u)}catch{return!0}}function Cg(r){var o=Si(r,1);o!==null&&Xr(o,r,1,-1)}function jg(r){var o=ci();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:r},o.queue=r,r=r.dispatch=O1.bind(null,xn,r),[o.memoizedState,r]}function ha(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=xn.updateQueue,o===null?(o={lastEffect:null,stores:null},xn.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r)),r}function Ng(){return _r().memoizedState}function Ul(r,o,u,m){var w=ci();xn.flags|=r,w.memoizedState=ha(1|o,u,void 0,m===void 0?null:m)}function zl(r,o,u,m){var w=_r();m=m===void 0?null:m;var k=void 0;if(Ln!==null){var N=Ln.memoizedState;if(k=N.destroy,m!==null&&xd(m,N.deps)){w.memoizedState=ha(o,u,k,m);return}}xn.flags|=r,w.memoizedState=ha(1|o,u,k,m)}function Pg(r,o){return Ul(8390656,8,r,o)}function Nd(r,o){return zl(2048,8,r,o)}function Tg(r,o){return zl(4,2,r,o)}function Eg(r,o){return zl(4,4,r,o)}function Rg(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function Mg(r,o,u){return u=u!=null?u.concat([r]):null,zl(4,4,Rg.bind(null,o,r),u)}function Pd(){}function Ag(r,o){var u=_r();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&xd(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function Lg(r,o){var u=_r();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&xd(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function Ig(r,o,u){return(bs&21)===0?(r.baseState&&(r.baseState=!1,fr=!0),r.memoizedState=u):(Vr(u,o)||(u=dl(),xn.lanes|=u,xs|=u,r.baseState=!0),o)}function _1(r,o){var u=rn;rn=u!==0&&4>u?u:4,r(!0);var m=bd.transition;bd.transition={};try{r(!1),o()}finally{rn=u,bd.transition=m}}function Dg(){return _r().memoizedState}function F1(r,o,u){var m=Qi(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},_g(r))Fg(o,u);else if(u=fg(r,o,u,m),u!==null){var w=ar();Xr(u,r,m,w),Og(u,o,m)}}function O1(r,o,u){var m=Qi(r),w={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(_g(r))Fg(o,w);else{var k=r.alternate;if(r.lanes===0&&(k===null||k.lanes===0)&&(k=o.lastRenderedReducer,k!==null))try{var N=o.lastRenderedState,W=k(N,u);if(w.hasEagerState=!0,w.eagerState=W,Vr(W,N)){var J=o.interleaved;J===null?(w.next=w,md(o)):(w.next=J.next,J.next=w),o.interleaved=w;return}}catch{}finally{}u=fg(r,o,w,m),u!==null&&(w=ar(),Xr(u,r,m,w),Og(u,o,m))}}function _g(r){var o=r.alternate;return r===xn||o!==null&&o===xn}function Fg(r,o){ca=Wl=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function Og(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ii(r,u)}}var Hl={readContext:Dr,useCallback:Jn,useContext:Jn,useEffect:Jn,useImperativeHandle:Jn,useInsertionEffect:Jn,useLayoutEffect:Jn,useMemo:Jn,useReducer:Jn,useRef:Jn,useState:Jn,useDebugValue:Jn,useDeferredValue:Jn,useTransition:Jn,useMutableSource:Jn,useSyncExternalStore:Jn,useId:Jn,unstable_isNewReconciler:!1},B1={readContext:Dr,useCallback:function(r,o){return ci().memoizedState=[r,o===void 0?null:o],r},useContext:Dr,useEffect:Pg,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Ul(4194308,4,Rg.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Ul(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ul(4,2,r,o)},useMemo:function(r,o){var u=ci();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=ci();return o=u!==void 0?u(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=F1.bind(null,xn,r),[m.memoizedState,r]},useRef:function(r){var o=ci();return r={current:r},o.memoizedState=r},useState:jg,useDebugValue:Pd,useDeferredValue:function(r){return ci().memoizedState=r},useTransition:function(){var r=jg(!1),o=r[0];return r=_1.bind(null,r[1]),ci().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=xn,w=ci();if(gn){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Un===null)throw Error(n(349));(bs&30)!==0||bg(m,o,u)}w.memoizedState=u;var k={value:u,getSnapshot:o};return w.queue=k,Pg(kg.bind(null,m,k,r),[r]),m.flags|=2048,ha(9,xg.bind(null,m,k,u,o),void 0,null),u},useId:function(){var r=ci(),o=Un.identifierPrefix;if(gn){var u=ki,m=xi;u=(m&~(1<<32-O(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=ua++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=D1++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},W1={readContext:Dr,useCallback:Ag,useContext:Dr,useEffect:Nd,useImperativeHandle:Mg,useInsertionEffect:Tg,useLayoutEffect:Eg,useMemo:Lg,useReducer:Cd,useRef:Ng,useState:function(){return Cd(da)},useDebugValue:Pd,useDeferredValue:function(r){var o=_r();return Ig(o,Ln.memoizedState,r)},useTransition:function(){var r=Cd(da)[0],o=_r().memoizedState;return[r,o]},useMutableSource:vg,useSyncExternalStore:wg,useId:Dg,unstable_isNewReconciler:!1},U1={readContext:Dr,useCallback:Ag,useContext:Dr,useEffect:Nd,useImperativeHandle:Mg,useInsertionEffect:Tg,useLayoutEffect:Eg,useMemo:Lg,useReducer:jd,useRef:Ng,useState:function(){return jd(da)},useDebugValue:Pd,useDeferredValue:function(r){var o=_r();return Ln===null?o.memoizedState=r:Ig(o,Ln.memoizedState,r)},useTransition:function(){var r=jd(da)[0],o=_r().memoizedState;return[r,o]},useMutableSource:vg,useSyncExternalStore:wg,useId:Dg,unstable_isNewReconciler:!1};function Kr(r,o){if(r&&r.defaultProps){o=E({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function Td(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:E({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var ql={isMounted:function(r){return(r=r._reactInternals)?Oe(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=ar(),w=Qi(r),k=Ci(m,w);k.payload=o,u!=null&&(k.callback=u),o=$i(r,k,w),o!==null&&(Xr(o,r,w,m),_l(o,r,w))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=ar(),w=Qi(r),k=Ci(m,w);k.tag=1,k.payload=o,u!=null&&(k.callback=u),o=$i(r,k,w),o!==null&&(Xr(o,r,w,m),_l(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=ar(),m=Qi(r),w=Ci(u,m);w.tag=2,o!=null&&(w.callback=o),o=$i(r,w,m),o!==null&&(Xr(o,r,m,u),_l(o,r,m))}};function Bg(r,o,u,m,w,k,N){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,k,N):o.prototype&&o.prototype.isPureReactComponent?!Jo(u,m)||!Jo(w,k):!0}function Wg(r,o,u){var m=!1,w=zi,k=o.contextType;return typeof k=="object"&&k!==null?k=Dr(k):(w=hr(o)?ps:Xn.current,m=o.contextTypes,k=(m=m!=null)?Zs(r,w):zi),o=new o(u,k),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=ql,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=k),o}function Ug(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&ql.enqueueReplaceState(o,o.state,null)}function Ed(r,o,u,m){var w=r.stateNode;w.props=u,w.state=r.memoizedState,w.refs={},pd(r);var k=o.contextType;typeof k=="object"&&k!==null?w.context=Dr(k):(k=hr(o)?ps:Xn.current,w.context=Zs(r,k)),w.state=r.memoizedState,k=o.getDerivedStateFromProps,typeof k=="function"&&(Td(r,o,k,u),w.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(o=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),o!==w.state&&ql.enqueueReplaceState(w,w.state,null),Fl(r,u,w,m),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function ao(r,o){try{var u="",m=o;do u+=me(m),m=m.return;while(m);var w=u}catch(k){w=`
|
|
40
|
+
Error generating stack: `+k.message+`
|
|
41
|
+
`+k.stack}return{value:r,source:o,stack:w,digest:null}}function Rd(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Md(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var z1=typeof WeakMap=="function"?WeakMap:Map;function zg(r,o,u){u=Ci(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Xl||(Xl=!0,Vd=m),Md(r,o)},u}function Hg(r,o,u){u=Ci(-1,u),u.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var w=o.value;u.payload=function(){return m(w)},u.callback=function(){Md(r,o)}}var k=r.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(u.callback=function(){Md(r,o),typeof m!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var N=o.stack;this.componentDidCatch(o.value,{componentStack:N!==null?N:""})}),u}function qg(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new z1;var w=new Set;m.set(o,w)}else w=m.get(o),w===void 0&&(w=new Set,m.set(o,w));w.has(u)||(w.add(u),r=nj.bind(null,r,o,u),o.then(r,r))}function $g(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function Vg(r,o,u,m,w){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=Ci(-1,1),o.tag=2,$i(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var H1=K.ReactCurrentOwner,fr=!1;function or(r,o,u,m){o.child=r===null?hg(o,null,u,m):ro(o,r.child,u,m)}function Gg(r,o,u,m,w){u=u.render;var k=o.ref;return so(o,w),m=kd(r,o,u,m,k,w),u=Sd(),r!==null&&!fr?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ji(r,o,w)):(gn&&u&&sd(o),o.flags|=1,or(r,o,m,w),o.child)}function Kg(r,o,u,m,w){if(r===null){var k=u.type;return typeof k=="function"&&!Zd(k)&&k.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=k,Qg(r,o,k,m,w)):(r=rc(u.type,null,m,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(k=r.child,(r.lanes&w)===0){var N=k.memoizedProps;if(u=u.compare,u=u!==null?u:Jo,u(N,m)&&r.ref===o.ref)return ji(r,o,w)}return o.flags|=1,r=Xi(k,m),r.ref=o.ref,r.return=o,o.child=r}function Qg(r,o,u,m,w){if(r!==null){var k=r.memoizedProps;if(Jo(k,m)&&r.ref===o.ref)if(fr=!1,o.pendingProps=m=k,(r.lanes&w)!==0)(r.flags&131072)!==0&&(fr=!0);else return o.lanes=r.lanes,ji(r,o,w)}return Ad(r,o,u,m,w)}function Yg(r,o,u){var m=o.pendingProps,w=m.children,k=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},dn(co,Pr),Pr|=u;else{if((u&1073741824)===0)return r=k!==null?k.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,dn(co,Pr),Pr|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=k!==null?k.baseLanes:u,dn(co,Pr),Pr|=m}else k!==null?(m=k.baseLanes|u,o.memoizedState=null):m=u,dn(co,Pr),Pr|=m;return or(r,o,w,u),o.child}function Xg(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Ad(r,o,u,m,w){var k=hr(u)?ps:Xn.current;return k=Zs(o,k),so(o,w),u=kd(r,o,u,m,k,w),m=Sd(),r!==null&&!fr?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ji(r,o,w)):(gn&&m&&sd(o),o.flags|=1,or(r,o,u,w),o.child)}function Jg(r,o,u,m,w){if(hr(u)){var k=!0;Tl(o)}else k=!1;if(so(o,w),o.stateNode===null)Vl(r,o),Wg(o,u,m),Ed(o,u,m,w),m=!0;else if(r===null){var N=o.stateNode,W=o.memoizedProps;N.props=W;var J=N.context,pe=u.contextType;typeof pe=="object"&&pe!==null?pe=Dr(pe):(pe=hr(u)?ps:Xn.current,pe=Zs(o,pe));var Pe=u.getDerivedStateFromProps,Te=typeof Pe=="function"||typeof N.getSnapshotBeforeUpdate=="function";Te||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(W!==m||J!==pe)&&Ug(o,N,m,pe),qi=!1;var Ne=o.memoizedState;N.state=Ne,Fl(o,m,N,w),J=o.memoizedState,W!==m||Ne!==J||dr.current||qi?(typeof Pe=="function"&&(Td(o,u,Pe,m),J=o.memoizedState),(W=qi||Bg(o,u,W,m,Ne,J,pe))?(Te||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(o.flags|=4194308)):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=J),N.props=m,N.state=J,N.context=pe,m=W):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{N=o.stateNode,mg(r,o),W=o.memoizedProps,pe=o.type===o.elementType?W:Kr(o.type,W),N.props=pe,Te=o.pendingProps,Ne=N.context,J=u.contextType,typeof J=="object"&&J!==null?J=Dr(J):(J=hr(u)?ps:Xn.current,J=Zs(o,J));var Ve=u.getDerivedStateFromProps;(Pe=typeof Ve=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(W!==Te||Ne!==J)&&Ug(o,N,m,J),qi=!1,Ne=o.memoizedState,N.state=Ne,Fl(o,m,N,w);var et=o.memoizedState;W!==Te||Ne!==et||dr.current||qi?(typeof Ve=="function"&&(Td(o,u,Ve,m),et=o.memoizedState),(pe=qi||Bg(o,u,pe,m,Ne,et,J)||!1)?(Pe||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(m,et,J),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(m,et,J)),typeof N.componentDidUpdate=="function"&&(o.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof N.componentDidUpdate!="function"||W===r.memoizedProps&&Ne===r.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||W===r.memoizedProps&&Ne===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=et),N.props=m,N.state=et,N.context=J,m=pe):(typeof N.componentDidUpdate!="function"||W===r.memoizedProps&&Ne===r.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||W===r.memoizedProps&&Ne===r.memoizedState||(o.flags|=1024),m=!1)}return Ld(r,o,u,m,k,w)}function Ld(r,o,u,m,w,k){Xg(r,o);var N=(o.flags&128)!==0;if(!m&&!N)return w&&rg(o,u,!1),ji(r,o,k);m=o.stateNode,H1.current=o;var W=N&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&N?(o.child=ro(o,r.child,null,k),o.child=ro(o,null,W,k)):or(r,o,W,k),o.memoizedState=m.state,w&&rg(o,u,!0),o.child}function Zg(r){var o=r.stateNode;o.pendingContext?tg(r,o.pendingContext,o.pendingContext!==o.context):o.context&&tg(r,o.context,!1),gd(r,o.containerInfo)}function ey(r,o,u,m,w){return no(),cd(w),o.flags|=256,or(r,o,u,m),o.child}var Id={dehydrated:null,treeContext:null,retryLane:0};function Dd(r){return{baseLanes:r,cachePool:null,transitions:null}}function ty(r,o,u){var m=o.pendingProps,w=bn.current,k=!1,N=(o.flags&128)!==0,W;if((W=N)||(W=r!==null&&r.memoizedState===null?!1:(w&2)!==0),W?(k=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),dn(bn,w&1),r===null)return ld(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(N=m.children,r=m.fallback,k?(m=o.mode,k=o.child,N={mode:"hidden",children:N},(m&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=N):k=ic(N,m,0,null),r=js(r,m,u,null),k.return=o,r.return=o,k.sibling=r,o.child=k,o.child.memoizedState=Dd(u),o.memoizedState=Id,r):_d(o,N));if(w=r.memoizedState,w!==null&&(W=w.dehydrated,W!==null))return q1(r,o,N,m,W,w,u);if(k){k=m.fallback,N=o.mode,w=r.child,W=w.sibling;var J={mode:"hidden",children:m.children};return(N&1)===0&&o.child!==w?(m=o.child,m.childLanes=0,m.pendingProps=J,o.deletions=null):(m=Xi(w,J),m.subtreeFlags=w.subtreeFlags&14680064),W!==null?k=Xi(W,k):(k=js(k,N,u,null),k.flags|=2),k.return=o,m.return=o,m.sibling=k,o.child=m,m=k,k=o.child,N=r.child.memoizedState,N=N===null?Dd(u):{baseLanes:N.baseLanes|u,cachePool:null,transitions:N.transitions},k.memoizedState=N,k.childLanes=r.childLanes&~u,o.memoizedState=Id,m}return k=r.child,r=k.sibling,m=Xi(k,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=u),m.return=o,m.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=m,o.memoizedState=null,m}function _d(r,o){return o=ic({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function $l(r,o,u,m){return m!==null&&cd(m),ro(o,r.child,null,u),r=_d(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function q1(r,o,u,m,w,k,N){if(u)return o.flags&256?(o.flags&=-257,m=Rd(Error(n(422))),$l(r,o,N,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(k=m.fallback,w=o.mode,m=ic({mode:"visible",children:m.children},w,0,null),k=js(k,w,N,null),k.flags|=2,m.return=o,k.return=o,m.sibling=k,o.child=m,(o.mode&1)!==0&&ro(o,r.child,null,N),o.child.memoizedState=Dd(N),o.memoizedState=Id,k);if((o.mode&1)===0)return $l(r,o,N,null);if(w.data==="$!"){if(m=w.nextSibling&&w.nextSibling.dataset,m)var W=m.dgst;return m=W,k=Error(n(419)),m=Rd(k,m,void 0),$l(r,o,N,m)}if(W=(N&r.childLanes)!==0,fr||W){if(m=Un,m!==null){switch(N&-N){case 4:w=2;break;case 16:w=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(m.suspendedLanes|N))!==0?0:w,w!==0&&w!==k.retryLane&&(k.retryLane=w,Si(r,w),Xr(m,r,w,-1))}return Jd(),m=Rd(Error(n(421))),$l(r,o,N,m)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=rj.bind(null,r),w._reactRetry=o,null):(r=k.treeContext,Nr=Wi(w.nextSibling),jr=o,gn=!0,Gr=null,r!==null&&(Lr[Ir++]=xi,Lr[Ir++]=ki,Lr[Ir++]=gs,xi=r.id,ki=r.overflow,gs=o),o=_d(o,m.children),o.flags|=4096,o)}function ny(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),fd(r.return,o,u)}function Fd(r,o,u,m,w){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:w}:(k.isBackwards=o,k.rendering=null,k.renderingStartTime=0,k.last=m,k.tail=u,k.tailMode=w)}function ry(r,o,u){var m=o.pendingProps,w=m.revealOrder,k=m.tail;if(or(r,o,m.children,u),m=bn.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&ny(r,u,o);else if(r.tag===19)ny(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(dn(bn,m),(o.mode&1)===0)o.memoizedState=null;else switch(w){case"forwards":for(u=o.child,w=null;u!==null;)r=u.alternate,r!==null&&Ol(r)===null&&(w=u),u=u.sibling;u=w,u===null?(w=o.child,o.child=null):(w=u.sibling,u.sibling=null),Fd(o,!1,w,u,k);break;case"backwards":for(u=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Ol(r)===null){o.child=w;break}r=w.sibling,w.sibling=u,u=w,w=r}Fd(o,!0,u,null,k);break;case"together":Fd(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Vl(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function ji(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),xs|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Xi(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Xi(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function $1(r,o,u){switch(o.tag){case 3:Zg(o),no();break;case 5:yg(o);break;case 1:hr(o.type)&&Tl(o);break;case 4:gd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,w=o.memoizedProps.value;dn(Il,m._currentValue),m._currentValue=w;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(dn(bn,bn.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?ty(r,o,u):(dn(bn,bn.current&1),r=ji(r,o,u),r!==null?r.sibling:null);dn(bn,bn.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return ry(r,o,u);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),dn(bn,bn.current),m)break;return null;case 22:case 23:return o.lanes=0,Yg(r,o,u)}return ji(r,o,u)}var iy,Od,sy,oy;iy=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Od=function(){},sy=function(r,o,u,m){var w=r.memoizedProps;if(w!==m){r=o.stateNode,ws(li.current);var k=null;switch(u){case"input":w=Lt(r,w),m=Lt(r,m),k=[];break;case"select":w=E({},w,{value:void 0}),m=E({},m,{value:void 0}),k=[];break;case"textarea":w=tt(r,w),m=tt(r,m),k=[];break;default:typeof w.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=jl)}ct(u,m);var N;u=null;for(pe in w)if(!m.hasOwnProperty(pe)&&w.hasOwnProperty(pe)&&w[pe]!=null)if(pe==="style"){var W=w[pe];for(N in W)W.hasOwnProperty(N)&&(u||(u={}),u[N]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(a.hasOwnProperty(pe)?k||(k=[]):(k=k||[]).push(pe,null));for(pe in m){var J=m[pe];if(W=w!=null?w[pe]:void 0,m.hasOwnProperty(pe)&&J!==W&&(J!=null||W!=null))if(pe==="style")if(W){for(N in W)!W.hasOwnProperty(N)||J&&J.hasOwnProperty(N)||(u||(u={}),u[N]="");for(N in J)J.hasOwnProperty(N)&&W[N]!==J[N]&&(u||(u={}),u[N]=J[N])}else u||(k||(k=[]),k.push(pe,u)),u=J;else pe==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,W=W?W.__html:void 0,J!=null&&W!==J&&(k=k||[]).push(pe,J)):pe==="children"?typeof J!="string"&&typeof J!="number"||(k=k||[]).push(pe,""+J):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(pe)?(J!=null&&pe==="onScroll"&&mn("scroll",r),k||W===J||(k=[])):(k=k||[]).push(pe,J))}u&&(k=k||[]).push("style",u);var pe=k;(o.updateQueue=pe)&&(o.flags|=4)}},oy=function(r,o,u,m){u!==m&&(o.flags|=4)};function fa(r,o){if(!gn)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Zn(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var w=r.child;w!==null;)u|=w.lanes|w.childLanes,m|=w.subtreeFlags&14680064,m|=w.flags&14680064,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)u|=w.lanes|w.childLanes,m|=w.subtreeFlags,m|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function V1(r,o,u){var m=o.pendingProps;switch(od(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zn(o),null;case 1:return hr(o.type)&&Pl(),Zn(o),null;case 3:return m=o.stateNode,oo(),pn(dr),pn(Xn),wd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Al(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Gr!==null&&(Qd(Gr),Gr=null))),Od(r,o),Zn(o),null;case 5:yd(o);var w=ws(la.current);if(u=o.type,r!==null&&o.stateNode!=null)sy(r,o,u,m,w),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Zn(o),null}if(r=ws(li.current),Al(o)){m=o.stateNode,u=o.type;var k=o.memoizedProps;switch(m[ai]=o,m[ra]=k,r=(o.mode&1)!==0,u){case"dialog":mn("cancel",m),mn("close",m);break;case"iframe":case"object":case"embed":mn("load",m);break;case"video":case"audio":for(w=0;w<ea.length;w++)mn(ea[w],m);break;case"source":mn("error",m);break;case"img":case"image":case"link":mn("error",m),mn("load",m);break;case"details":mn("toggle",m);break;case"input":vt(m,k),mn("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!k.multiple},mn("invalid",m);break;case"textarea":$t(m,k),mn("invalid",m)}ct(u,k),w=null;for(var N in k)if(k.hasOwnProperty(N)){var W=k[N];N==="children"?typeof W=="string"?m.textContent!==W&&(k.suppressHydrationWarning!==!0&&Cl(m.textContent,W,r),w=["children",W]):typeof W=="number"&&m.textContent!==""+W&&(k.suppressHydrationWarning!==!0&&Cl(m.textContent,W,r),w=["children",""+W]):a.hasOwnProperty(N)&&W!=null&&N==="onScroll"&&mn("scroll",m)}switch(u){case"input":jt(m),ft(m,k,!0);break;case"textarea":jt(m),Vt(m);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(m.onclick=jl)}m=w,o.updateQueue=m,m!==null&&(o.flags|=4)}else{N=w.nodeType===9?w:w.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ue(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=N.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=N.createElement(u,{is:m.is}):(r=N.createElement(u),u==="select"&&(N=r,m.multiple?N.multiple=!0:m.size&&(N.size=m.size))):r=N.createElementNS(r,u),r[ai]=o,r[ra]=m,iy(r,o,!1,!1),o.stateNode=r;e:{switch(N=It(u,m),u){case"dialog":mn("cancel",r),mn("close",r),w=m;break;case"iframe":case"object":case"embed":mn("load",r),w=m;break;case"video":case"audio":for(w=0;w<ea.length;w++)mn(ea[w],r);w=m;break;case"source":mn("error",r),w=m;break;case"img":case"image":case"link":mn("error",r),mn("load",r),w=m;break;case"details":mn("toggle",r),w=m;break;case"input":vt(r,m),w=Lt(r,m),mn("invalid",r);break;case"option":w=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},w=E({},m,{value:void 0}),mn("invalid",r);break;case"textarea":$t(r,m),w=tt(r,m),mn("invalid",r);break;default:w=m}ct(u,w),W=w;for(k in W)if(W.hasOwnProperty(k)){var J=W[k];k==="style"?Ze(r,J):k==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&Ke(r,J)):k==="children"?typeof J=="string"?(u!=="textarea"||J!=="")&&nt(r,J):typeof J=="number"&&nt(r,""+J):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(a.hasOwnProperty(k)?J!=null&&k==="onScroll"&&mn("scroll",r):J!=null&&A(r,k,J,N))}switch(u){case"input":jt(r),ft(r,m,!1);break;case"textarea":jt(r),Vt(r);break;case"option":m.value!=null&&r.setAttribute("value",""+Ge(m.value));break;case"select":r.multiple=!!m.multiple,k=m.value,k!=null?Ot(r,!!m.multiple,k,!1):m.defaultValue!=null&&Ot(r,!!m.multiple,m.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=jl)}switch(u){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Zn(o),null;case 6:if(r&&o.stateNode!=null)oy(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=ws(la.current),ws(li.current),Al(o)){if(m=o.stateNode,u=o.memoizedProps,m[ai]=o,(k=m.nodeValue!==u)&&(r=jr,r!==null))switch(r.tag){case 3:Cl(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Cl(m.nodeValue,u,(r.mode&1)!==0)}k&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[ai]=o,o.stateNode=m}return Zn(o),null;case 13:if(pn(bn),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gn&&Nr!==null&&(o.mode&1)!==0&&(o.flags&128)===0)cg(),no(),o.flags|=98560,k=!1;else if(k=Al(o),m!==null&&m.dehydrated!==null){if(r===null){if(!k)throw Error(n(318));if(k=o.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[ai]=o}else no(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zn(o),k=!1}else Gr!==null&&(Qd(Gr),Gr=null),k=!0;if(!k)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(bn.current&1)!==0?In===0&&(In=3):Jd())),o.updateQueue!==null&&(o.flags|=4),Zn(o),null);case 4:return oo(),Od(r,o),r===null&&ta(o.stateNode.containerInfo),Zn(o),null;case 10:return hd(o.type._context),Zn(o),null;case 17:return hr(o.type)&&Pl(),Zn(o),null;case 19:if(pn(bn),k=o.memoizedState,k===null)return Zn(o),null;if(m=(o.flags&128)!==0,N=k.rendering,N===null)if(m)fa(k,!1);else{if(In!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(N=Ol(r),N!==null){for(o.flags|=128,fa(k,!1),m=N.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)k=u,r=m,k.flags&=14680066,N=k.alternate,N===null?(k.childLanes=0,k.lanes=r,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=N.childLanes,k.lanes=N.lanes,k.child=N.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=N.memoizedProps,k.memoizedState=N.memoizedState,k.updateQueue=N.updateQueue,k.type=N.type,r=N.dependencies,k.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return dn(bn,bn.current&1|2),o.child}r=r.sibling}k.tail!==null&&He()>uo&&(o.flags|=128,m=!0,fa(k,!1),o.lanes=4194304)}else{if(!m)if(r=Ol(N),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),fa(k,!0),k.tail===null&&k.tailMode==="hidden"&&!N.alternate&&!gn)return Zn(o),null}else 2*He()-k.renderingStartTime>uo&&u!==1073741824&&(o.flags|=128,m=!0,fa(k,!1),o.lanes=4194304);k.isBackwards?(N.sibling=o.child,o.child=N):(u=k.last,u!==null?u.sibling=N:o.child=N,k.last=N)}return k.tail!==null?(o=k.tail,k.rendering=o,k.tail=o.sibling,k.renderingStartTime=He(),o.sibling=null,u=bn.current,dn(bn,m?u&1|2:u&1),o):(Zn(o),null);case 22:case 23:return Xd(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Pr&1073741824)!==0&&(Zn(o),o.subtreeFlags&6&&(o.flags|=8192)):Zn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function G1(r,o){switch(od(o),o.tag){case 1:return hr(o.type)&&Pl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return oo(),pn(dr),pn(Xn),wd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return yd(o),null;case 13:if(pn(bn),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));no()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pn(bn),null;case 4:return oo(),null;case 10:return hd(o.type._context),null;case 22:case 23:return Xd(),null;case 24:return null;default:return null}}var Gl=!1,er=!1,K1=typeof WeakSet=="function"?WeakSet:Set,Je=null;function lo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(m){Sn(r,o,m)}else u.current=null}function Bd(r,o,u){try{u()}catch(m){Sn(r,o,m)}}var ay=!1;function Q1(r,o){if(Xu=Ft,r=Bp(),Hu(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var w=m.anchorOffset,k=m.focusNode;m=m.focusOffset;try{u.nodeType,k.nodeType}catch{u=null;break e}var N=0,W=-1,J=-1,pe=0,Pe=0,Te=r,Ne=null;t:for(;;){for(var Ve;Te!==u||w!==0&&Te.nodeType!==3||(W=N+w),Te!==k||m!==0&&Te.nodeType!==3||(J=N+m),Te.nodeType===3&&(N+=Te.nodeValue.length),(Ve=Te.firstChild)!==null;)Ne=Te,Te=Ve;for(;;){if(Te===r)break t;if(Ne===u&&++pe===w&&(W=N),Ne===k&&++Pe===m&&(J=N),(Ve=Te.nextSibling)!==null)break;Te=Ne,Ne=Te.parentNode}Te=Ve}u=W===-1||J===-1?null:{start:W,end:J}}else u=null}u=u||{start:0,end:0}}else u=null;for(Ju={focusedElem:r,selectionRange:u},Ft=!1,Je=o;Je!==null;)if(o=Je,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Je=r;else for(;Je!==null;){o=Je;try{var et=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(et!==null){var st=et.memoizedProps,Cn=et.memoizedState,ce=o.stateNode,ne=ce.getSnapshotBeforeUpdate(o.elementType===o.type?st:Kr(o.type,st),Cn);ce.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var fe=o.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ae){Sn(o,o.return,Ae)}if(r=o.sibling,r!==null){r.return=o.return,Je=r;break}Je=o.return}return et=ay,ay=!1,et}function ma(r,o,u){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var w=m=m.next;do{if((w.tag&r)===r){var k=w.destroy;w.destroy=void 0,k!==void 0&&Bd(o,u,k)}w=w.next}while(w!==m)}}function Kl(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var m=u.create;u.destroy=m()}u=u.next}while(u!==o)}}function Wd(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function ly(r){var o=r.alternate;o!==null&&(r.alternate=null,ly(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[ai],delete o[ra],delete o[nd],delete o[M1],delete o[A1])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function cy(r){return r.tag===5||r.tag===3||r.tag===4}function uy(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||cy(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Ud(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=jl));else if(m!==4&&(r=r.child,r!==null))for(Ud(r,o,u),r=r.sibling;r!==null;)Ud(r,o,u),r=r.sibling}function zd(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(zd(r,o,u),r=r.sibling;r!==null;)zd(r,o,u),r=r.sibling}var Gn=null,Qr=!1;function Vi(r,o,u){for(u=u.child;u!==null;)dy(r,o,u),u=u.sibling}function dy(r,o,u){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(ie,u)}catch{}switch(u.tag){case 5:er||lo(u,o);case 6:var m=Gn,w=Qr;Gn=null,Vi(r,o,u),Gn=m,Qr=w,Gn!==null&&(Qr?(r=Gn,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Gn.removeChild(u.stateNode));break;case 18:Gn!==null&&(Qr?(r=Gn,u=u.stateNode,r.nodeType===8?td(r.parentNode,u):r.nodeType===1&&td(r,u),Vn(r)):td(Gn,u.stateNode));break;case 4:m=Gn,w=Qr,Gn=u.stateNode.containerInfo,Qr=!0,Vi(r,o,u),Gn=m,Qr=w;break;case 0:case 11:case 14:case 15:if(!er&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){w=m=m.next;do{var k=w,N=k.destroy;k=k.tag,N!==void 0&&((k&2)!==0||(k&4)!==0)&&Bd(u,o,N),w=w.next}while(w!==m)}Vi(r,o,u);break;case 1:if(!er&&(lo(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(W){Sn(u,o,W)}Vi(r,o,u);break;case 21:Vi(r,o,u);break;case 22:u.mode&1?(er=(m=er)||u.memoizedState!==null,Vi(r,o,u),er=m):Vi(r,o,u);break;default:Vi(r,o,u)}}function hy(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new K1),o.forEach(function(m){var w=ij.bind(null,r,m);u.has(m)||(u.add(m),m.then(w,w))})}}function Yr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var w=u[m];try{var k=r,N=o,W=N;e:for(;W!==null;){switch(W.tag){case 5:Gn=W.stateNode,Qr=!1;break e;case 3:Gn=W.stateNode.containerInfo,Qr=!0;break e;case 4:Gn=W.stateNode.containerInfo,Qr=!0;break e}W=W.return}if(Gn===null)throw Error(n(160));dy(k,N,w),Gn=null,Qr=!1;var J=w.alternate;J!==null&&(J.return=null),w.return=null}catch(pe){Sn(w,o,pe)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)fy(o,r),o=o.sibling}function fy(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Yr(o,r),ui(r),m&4){try{ma(3,r,r.return),Kl(3,r)}catch(st){Sn(r,r.return,st)}try{ma(5,r,r.return)}catch(st){Sn(r,r.return,st)}}break;case 1:Yr(o,r),ui(r),m&512&&u!==null&&lo(u,u.return);break;case 5:if(Yr(o,r),ui(r),m&512&&u!==null&&lo(u,u.return),r.flags&32){var w=r.stateNode;try{nt(w,"")}catch(st){Sn(r,r.return,st)}}if(m&4&&(w=r.stateNode,w!=null)){var k=r.memoizedProps,N=u!==null?u.memoizedProps:k,W=r.type,J=r.updateQueue;if(r.updateQueue=null,J!==null)try{W==="input"&&k.type==="radio"&&k.name!=null&&zt(w,k),It(W,N);var pe=It(W,k);for(N=0;N<J.length;N+=2){var Pe=J[N],Te=J[N+1];Pe==="style"?Ze(w,Te):Pe==="dangerouslySetInnerHTML"?Ke(w,Te):Pe==="children"?nt(w,Te):A(w,Pe,Te,pe)}switch(W){case"input":Rt(w,k);break;case"textarea":gt(w,k);break;case"select":var Ne=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!k.multiple;var Ve=k.value;Ve!=null?Ot(w,!!k.multiple,Ve,!1):Ne!==!!k.multiple&&(k.defaultValue!=null?Ot(w,!!k.multiple,k.defaultValue,!0):Ot(w,!!k.multiple,k.multiple?[]:"",!1))}w[ra]=k}catch(st){Sn(r,r.return,st)}}break;case 6:if(Yr(o,r),ui(r),m&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,k=r.memoizedProps;try{w.nodeValue=k}catch(st){Sn(r,r.return,st)}}break;case 3:if(Yr(o,r),ui(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{Vn(o.containerInfo)}catch(st){Sn(r,r.return,st)}break;case 4:Yr(o,r),ui(r);break;case 13:Yr(o,r),ui(r),w=r.child,w.flags&8192&&(k=w.memoizedState!==null,w.stateNode.isHidden=k,!k||w.alternate!==null&&w.alternate.memoizedState!==null||($d=He())),m&4&&hy(r);break;case 22:if(Pe=u!==null&&u.memoizedState!==null,r.mode&1?(er=(pe=er)||Pe,Yr(o,r),er=pe):Yr(o,r),ui(r),m&8192){if(pe=r.memoizedState!==null,(r.stateNode.isHidden=pe)&&!Pe&&(r.mode&1)!==0)for(Je=r,Pe=r.child;Pe!==null;){for(Te=Je=Pe;Je!==null;){switch(Ne=Je,Ve=Ne.child,Ne.tag){case 0:case 11:case 14:case 15:ma(4,Ne,Ne.return);break;case 1:lo(Ne,Ne.return);var et=Ne.stateNode;if(typeof et.componentWillUnmount=="function"){m=Ne,u=Ne.return;try{o=m,et.props=o.memoizedProps,et.state=o.memoizedState,et.componentWillUnmount()}catch(st){Sn(m,u,st)}}break;case 5:lo(Ne,Ne.return);break;case 22:if(Ne.memoizedState!==null){gy(Te);continue}}Ve!==null?(Ve.return=Ne,Je=Ve):gy(Te)}Pe=Pe.sibling}e:for(Pe=null,Te=r;;){if(Te.tag===5){if(Pe===null){Pe=Te;try{w=Te.stateNode,pe?(k=w.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(W=Te.stateNode,J=Te.memoizedProps.style,N=J!=null&&J.hasOwnProperty("display")?J.display:null,W.style.display=Pt("display",N))}catch(st){Sn(r,r.return,st)}}}else if(Te.tag===6){if(Pe===null)try{Te.stateNode.nodeValue=pe?"":Te.memoizedProps}catch(st){Sn(r,r.return,st)}}else if((Te.tag!==22&&Te.tag!==23||Te.memoizedState===null||Te===r)&&Te.child!==null){Te.child.return=Te,Te=Te.child;continue}if(Te===r)break e;for(;Te.sibling===null;){if(Te.return===null||Te.return===r)break e;Pe===Te&&(Pe=null),Te=Te.return}Pe===Te&&(Pe=null),Te.sibling.return=Te.return,Te=Te.sibling}}break;case 19:Yr(o,r),ui(r),m&4&&hy(r);break;case 21:break;default:Yr(o,r),ui(r)}}function ui(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(cy(u)){var m=u;break e}u=u.return}throw Error(n(160))}switch(m.tag){case 5:var w=m.stateNode;m.flags&32&&(nt(w,""),m.flags&=-33);var k=uy(r);zd(r,k,w);break;case 3:case 4:var N=m.stateNode.containerInfo,W=uy(r);Ud(r,W,N);break;default:throw Error(n(161))}}catch(J){Sn(r,r.return,J)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function Y1(r,o,u){Je=r,my(r)}function my(r,o,u){for(var m=(r.mode&1)!==0;Je!==null;){var w=Je,k=w.child;if(w.tag===22&&m){var N=w.memoizedState!==null||Gl;if(!N){var W=w.alternate,J=W!==null&&W.memoizedState!==null||er;W=Gl;var pe=er;if(Gl=N,(er=J)&&!pe)for(Je=w;Je!==null;)N=Je,J=N.child,N.tag===22&&N.memoizedState!==null?yy(w):J!==null?(J.return=N,Je=J):yy(w);for(;k!==null;)Je=k,my(k),k=k.sibling;Je=w,Gl=W,er=pe}py(r)}else(w.subtreeFlags&8772)!==0&&k!==null?(k.return=w,Je=k):py(r)}}function py(r){for(;Je!==null;){var o=Je;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:er||Kl(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!er)if(u===null)m.componentDidMount();else{var w=o.elementType===o.type?u.memoizedProps:Kr(o.type,u.memoizedProps);m.componentDidUpdate(w,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var k=o.updateQueue;k!==null&&gg(o,k,m);break;case 3:var N=o.updateQueue;if(N!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}gg(o,N,u)}break;case 5:var W=o.stateNode;if(u===null&&o.flags&4){u=W;var J=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":J.autoFocus&&u.focus();break;case"img":J.src&&(u.src=J.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var pe=o.alternate;if(pe!==null){var Pe=pe.memoizedState;if(Pe!==null){var Te=Pe.dehydrated;Te!==null&&Vn(Te)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}er||o.flags&512&&Wd(o)}catch(Ne){Sn(o,o.return,Ne)}}if(o===r){Je=null;break}if(u=o.sibling,u!==null){u.return=o.return,Je=u;break}Je=o.return}}function gy(r){for(;Je!==null;){var o=Je;if(o===r){Je=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Je=u;break}Je=o.return}}function yy(r){for(;Je!==null;){var o=Je;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Kl(4,o)}catch(J){Sn(o,u,J)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var w=o.return;try{m.componentDidMount()}catch(J){Sn(o,w,J)}}var k=o.return;try{Wd(o)}catch(J){Sn(o,k,J)}break;case 5:var N=o.return;try{Wd(o)}catch(J){Sn(o,N,J)}}}catch(J){Sn(o,o.return,J)}if(o===r){Je=null;break}var W=o.sibling;if(W!==null){W.return=o.return,Je=W;break}Je=o.return}}var X1=Math.ceil,Ql=K.ReactCurrentDispatcher,Hd=K.ReactCurrentOwner,Fr=K.ReactCurrentBatchConfig,en=0,Un=null,Pn=null,Kn=0,Pr=0,co=Ui(0),In=0,pa=null,xs=0,Yl=0,qd=0,ga=null,mr=null,$d=0,uo=1/0,Ni=null,Xl=!1,Vd=null,Gi=null,Jl=!1,Ki=null,Zl=0,ya=0,Gd=null,ec=-1,tc=0;function ar(){return(en&6)!==0?He():ec!==-1?ec:ec=He()}function Qi(r){return(r.mode&1)===0?1:(en&2)!==0&&Kn!==0?Kn&-Kn:I1.transition!==null?(tc===0&&(tc=dl()),tc):(r=rn,r!==0||(r=window.event,r=r===void 0?16:ml(r.type)),r)}function Xr(r,o,u,m){if(50<ya)throw ya=0,Gd=null,Error(n(185));Sr(r,u,m),((en&2)===0||r!==Un)&&(r===Un&&((en&2)===0&&(Yl|=u),In===4&&Yi(r,Kn)),pr(r,m),u===1&&en===0&&(o.mode&1)===0&&(uo=He()+500,El&&Hi()))}function pr(r,o){var u=r.callbackNode;yi(r,o);var m=ir(r,r===Un?Kn:0);if(m===0)u!==null&&je(u),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(u!=null&&je(u),o===1)r.tag===0?L1(wy.bind(null,r)):ig(wy.bind(null,r)),E1(function(){(en&6)===0&&Hi()}),u=null;else{switch(zo(m)){case 1:u=Ct;break;case 4:u=Q;break;case 16:u=ke;break;case 536870912:u=he;break;default:u=ke}u=Py(u,vy.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function vy(r,o){if(ec=-1,tc=0,(en&6)!==0)throw Error(n(327));var u=r.callbackNode;if(ho()&&r.callbackNode!==u)return null;var m=ir(r,r===Un?Kn:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=nc(r,m);else{o=m;var w=en;en|=2;var k=xy();(Un!==r||Kn!==o)&&(Ni=null,uo=He()+500,Ss(r,o));do try{ej();break}catch(W){by(r,W)}while(!0);dd(),Ql.current=k,en=w,Pn!==null?o=0:(Un=null,Kn=0,o=In)}if(o!==0){if(o===2&&(w=Li(r),w!==0&&(m=w,o=Kd(r,w))),o===1)throw u=pa,Ss(r,0),Yi(r,m),pr(r,He()),u;if(o===6)Yi(r,m);else{if(w=r.current.alternate,(m&30)===0&&!J1(w)&&(o=nc(r,m),o===2&&(k=Li(r),k!==0&&(m=k,o=Kd(r,k))),o===1))throw u=pa,Ss(r,0),Yi(r,m),pr(r,He()),u;switch(r.finishedWork=w,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:Cs(r,mr,Ni);break;case 3:if(Yi(r,m),(m&130023424)===m&&(o=$d+500-He(),10<o)){if(ir(r,0)!==0)break;if(w=r.suspendedLanes,(w&m)!==m){ar(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=ed(Cs.bind(null,r,mr,Ni),o);break}Cs(r,mr,Ni);break;case 4:if(Yi(r,m),(m&4194240)===m)break;for(o=r.eventTimes,w=-1;0<m;){var N=31-O(m);k=1<<N,N=o[N],N>w&&(w=N),m&=~k}if(m=w,m=He()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*X1(m/1960))-m,10<m){r.timeoutHandle=ed(Cs.bind(null,r,mr,Ni),m);break}Cs(r,mr,Ni);break;case 5:Cs(r,mr,Ni);break;default:throw Error(n(329))}}}return pr(r,He()),r.callbackNode===u?vy.bind(null,r):null}function Kd(r,o){var u=ga;return r.current.memoizedState.isDehydrated&&(Ss(r,o).flags|=256),r=nc(r,o),r!==2&&(o=mr,mr=u,o!==null&&Qd(o)),r}function Qd(r){mr===null?mr=r:mr.push.apply(mr,r)}function J1(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var m=0;m<u.length;m++){var w=u[m],k=w.getSnapshot;w=w.value;try{if(!Vr(k(),w))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Yi(r,o){for(o&=~qd,o&=~Yl,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-O(o),m=1<<u;r[u]=-1,o&=~m}}function wy(r){if((en&6)!==0)throw Error(n(327));ho();var o=ir(r,0);if((o&1)===0)return pr(r,He()),null;var u=nc(r,o);if(r.tag!==0&&u===2){var m=Li(r);m!==0&&(o=m,u=Kd(r,m))}if(u===1)throw u=pa,Ss(r,0),Yi(r,o),pr(r,He()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,Cs(r,mr,Ni),pr(r,He()),null}function Yd(r,o){var u=en;en|=1;try{return r(o)}finally{en=u,en===0&&(uo=He()+500,El&&Hi())}}function ks(r){Ki!==null&&Ki.tag===0&&(en&6)===0&&ho();var o=en;en|=1;var u=Fr.transition,m=rn;try{if(Fr.transition=null,rn=1,r)return r()}finally{rn=m,Fr.transition=u,en=o,(en&6)===0&&Hi()}}function Xd(){Pr=co.current,pn(co)}function Ss(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,T1(u)),Pn!==null)for(u=Pn.return;u!==null;){var m=u;switch(od(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Pl();break;case 3:oo(),pn(dr),pn(Xn),wd();break;case 5:yd(m);break;case 4:oo();break;case 13:pn(bn);break;case 19:pn(bn);break;case 10:hd(m.type._context);break;case 22:case 23:Xd()}u=u.return}if(Un=r,Pn=r=Xi(r.current,null),Kn=Pr=o,In=0,pa=null,qd=Yl=xs=0,mr=ga=null,vs!==null){for(o=0;o<vs.length;o++)if(u=vs[o],m=u.interleaved,m!==null){u.interleaved=null;var w=m.next,k=u.pending;if(k!==null){var N=k.next;k.next=w,m.next=N}u.pending=m}vs=null}return r}function by(r,o){do{var u=Pn;try{if(dd(),Bl.current=Hl,Wl){for(var m=xn.memoizedState;m!==null;){var w=m.queue;w!==null&&(w.pending=null),m=m.next}Wl=!1}if(bs=0,Wn=Ln=xn=null,ca=!1,ua=0,Hd.current=null,u===null||u.return===null){In=1,pa=o,Pn=null;break}e:{var k=r,N=u.return,W=u,J=o;if(o=Kn,W.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var pe=J,Pe=W,Te=Pe.tag;if((Pe.mode&1)===0&&(Te===0||Te===11||Te===15)){var Ne=Pe.alternate;Ne?(Pe.updateQueue=Ne.updateQueue,Pe.memoizedState=Ne.memoizedState,Pe.lanes=Ne.lanes):(Pe.updateQueue=null,Pe.memoizedState=null)}var Ve=$g(N);if(Ve!==null){Ve.flags&=-257,Vg(Ve,N,W,k,o),Ve.mode&1&&qg(k,pe,o),o=Ve,J=pe;var et=o.updateQueue;if(et===null){var st=new Set;st.add(J),o.updateQueue=st}else et.add(J);break e}else{if((o&1)===0){qg(k,pe,o),Jd();break e}J=Error(n(426))}}else if(gn&&W.mode&1){var Cn=$g(N);if(Cn!==null){(Cn.flags&65536)===0&&(Cn.flags|=256),Vg(Cn,N,W,k,o),cd(ao(J,W));break e}}k=J=ao(J,W),In!==4&&(In=2),ga===null?ga=[k]:ga.push(k),k=N;do{switch(k.tag){case 3:k.flags|=65536,o&=-o,k.lanes|=o;var ce=zg(k,J,o);pg(k,ce);break e;case 1:W=J;var ne=k.type,fe=k.stateNode;if((k.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||fe!==null&&typeof fe.componentDidCatch=="function"&&(Gi===null||!Gi.has(fe)))){k.flags|=65536,o&=-o,k.lanes|=o;var Ae=Hg(k,W,o);pg(k,Ae);break e}}k=k.return}while(k!==null)}Sy(u)}catch(lt){o=lt,Pn===u&&u!==null&&(Pn=u=u.return);continue}break}while(!0)}function xy(){var r=Ql.current;return Ql.current=Hl,r===null?Hl:r}function Jd(){(In===0||In===3||In===2)&&(In=4),Un===null||(xs&268435455)===0&&(Yl&268435455)===0||Yi(Un,Kn)}function nc(r,o){var u=en;en|=2;var m=xy();(Un!==r||Kn!==o)&&(Ni=null,Ss(r,o));do try{Z1();break}catch(w){by(r,w)}while(!0);if(dd(),en=u,Ql.current=m,Pn!==null)throw Error(n(261));return Un=null,Kn=0,In}function Z1(){for(;Pn!==null;)ky(Pn)}function ej(){for(;Pn!==null&&!Xe();)ky(Pn)}function ky(r){var o=Ny(r.alternate,r,Pr);r.memoizedProps=r.pendingProps,o===null?Sy(r):Pn=o,Hd.current=null}function Sy(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=V1(u,o,Pr),u!==null){Pn=u;return}}else{if(u=G1(u,o),u!==null){u.flags&=32767,Pn=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{In=6,Pn=null;return}}if(o=o.sibling,o!==null){Pn=o;return}Pn=o=r}while(o!==null);In===0&&(In=5)}function Cs(r,o,u){var m=rn,w=Fr.transition;try{Fr.transition=null,rn=1,tj(r,o,u,m)}finally{Fr.transition=w,rn=m}return null}function tj(r,o,u,m){do ho();while(Ki!==null);if((en&6)!==0)throw Error(n(327));u=r.finishedWork;var w=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var k=u.lanes|u.childLanes;if(zs(r,k),r===Un&&(Pn=Un=null,Kn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Jl||(Jl=!0,Py(ke,function(){return ho(),null})),k=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||k){k=Fr.transition,Fr.transition=null;var N=rn;rn=1;var W=en;en|=4,Hd.current=null,Q1(r,u),fy(u,r),x1(Ju),Ft=!!Xu,Ju=Xu=null,r.current=u,Y1(u),rt(),en=W,rn=N,Fr.transition=k}else r.current=u;if(Jl&&(Jl=!1,Ki=r,Zl=w),k=r.pendingLanes,k===0&&(Gi=null),_t(u.stateNode),pr(r,He()),o!==null)for(m=r.onRecoverableError,u=0;u<o.length;u++)w=o[u],m(w.value,{componentStack:w.stack,digest:w.digest});if(Xl)throw Xl=!1,r=Vd,Vd=null,r;return(Zl&1)!==0&&r.tag!==0&&ho(),k=r.pendingLanes,(k&1)!==0?r===Gd?ya++:(ya=0,Gd=r):ya=0,Hi(),null}function ho(){if(Ki!==null){var r=zo(Zl),o=Fr.transition,u=rn;try{if(Fr.transition=null,rn=16>r?16:r,Ki===null)var m=!1;else{if(r=Ki,Ki=null,Zl=0,(en&6)!==0)throw Error(n(331));var w=en;for(en|=4,Je=r.current;Je!==null;){var k=Je,N=k.child;if((Je.flags&16)!==0){var W=k.deletions;if(W!==null){for(var J=0;J<W.length;J++){var pe=W[J];for(Je=pe;Je!==null;){var Pe=Je;switch(Pe.tag){case 0:case 11:case 15:ma(8,Pe,k)}var Te=Pe.child;if(Te!==null)Te.return=Pe,Je=Te;else for(;Je!==null;){Pe=Je;var Ne=Pe.sibling,Ve=Pe.return;if(ly(Pe),Pe===pe){Je=null;break}if(Ne!==null){Ne.return=Ve,Je=Ne;break}Je=Ve}}}var et=k.alternate;if(et!==null){var st=et.child;if(st!==null){et.child=null;do{var Cn=st.sibling;st.sibling=null,st=Cn}while(st!==null)}}Je=k}}if((k.subtreeFlags&2064)!==0&&N!==null)N.return=k,Je=N;else e:for(;Je!==null;){if(k=Je,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:ma(9,k,k.return)}var ce=k.sibling;if(ce!==null){ce.return=k.return,Je=ce;break e}Je=k.return}}var ne=r.current;for(Je=ne;Je!==null;){N=Je;var fe=N.child;if((N.subtreeFlags&2064)!==0&&fe!==null)fe.return=N,Je=fe;else e:for(N=ne;Je!==null;){if(W=Je,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Kl(9,W)}}catch(lt){Sn(W,W.return,lt)}if(W===N){Je=null;break e}var Ae=W.sibling;if(Ae!==null){Ae.return=W.return,Je=Ae;break e}Je=W.return}}if(en=w,Hi(),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(ie,r)}catch{}m=!0}return m}finally{rn=u,Fr.transition=o}}return!1}function Cy(r,o,u){o=ao(u,o),o=zg(r,o,1),r=$i(r,o,1),o=ar(),r!==null&&(Sr(r,1,o),pr(r,o))}function Sn(r,o,u){if(r.tag===3)Cy(r,r,u);else for(;o!==null;){if(o.tag===3){Cy(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Gi===null||!Gi.has(m))){r=ao(u,r),r=Hg(o,r,1),o=$i(o,r,1),r=ar(),o!==null&&(Sr(o,1,r),pr(o,r));break}}o=o.return}}function nj(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=ar(),r.pingedLanes|=r.suspendedLanes&u,Un===r&&(Kn&u)===u&&(In===4||In===3&&(Kn&130023424)===Kn&&500>He()-$d?Ss(r,0):qd|=u),pr(r,o)}function jy(r,o){o===0&&((r.mode&1)===0?o=1:(o=on,on<<=1,(on&130023424)===0&&(on=4194304)));var u=ar();r=Si(r,o),r!==null&&(Sr(r,o,u),pr(r,u))}function rj(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),jy(r,u)}function ij(r,o){var u=0;switch(r.tag){case 13:var m=r.stateNode,w=r.memoizedState;w!==null&&(u=w.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),jy(r,u)}var Ny;Ny=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||dr.current)fr=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return fr=!1,$1(r,o,u);fr=(r.flags&131072)!==0}else fr=!1,gn&&(o.flags&1048576)!==0&&sg(o,Ml,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Vl(r,o),r=o.pendingProps;var w=Zs(o,Xn.current);so(o,u),w=kd(null,o,m,r,w,u);var k=Sd();return o.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,hr(m)?(k=!0,Tl(o)):k=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,pd(o),w.updater=ql,o.stateNode=w,w._reactInternals=o,Ed(o,m,r,u),o=Ld(null,o,m,!0,k,u)):(o.tag=0,gn&&k&&sd(o),or(null,o,w,u),o=o.child),o;case 16:m=o.elementType;e:{switch(Vl(r,o),r=o.pendingProps,w=m._init,m=w(m._payload),o.type=m,w=o.tag=oj(m),r=Kr(m,r),w){case 0:o=Ad(null,o,m,r,u);break e;case 1:o=Jg(null,o,m,r,u);break e;case 11:o=Gg(null,o,m,r,u);break e;case 14:o=Kg(null,o,m,Kr(m.type,r),u);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:Kr(m,w),Ad(r,o,m,w,u);case 1:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:Kr(m,w),Jg(r,o,m,w,u);case 3:e:{if(Zg(o),r===null)throw Error(n(387));m=o.pendingProps,k=o.memoizedState,w=k.element,mg(r,o),Fl(o,m,null,u);var N=o.memoizedState;if(m=N.element,k.isDehydrated)if(k={element:m,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},o.updateQueue.baseState=k,o.memoizedState=k,o.flags&256){w=ao(Error(n(423)),o),o=ey(r,o,m,u,w);break e}else if(m!==w){w=ao(Error(n(424)),o),o=ey(r,o,m,u,w);break e}else for(Nr=Wi(o.stateNode.containerInfo.firstChild),jr=o,gn=!0,Gr=null,u=hg(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(no(),m===w){o=ji(r,o,u);break e}or(r,o,m,u)}o=o.child}return o;case 5:return yg(o),r===null&&ld(o),m=o.type,w=o.pendingProps,k=r!==null?r.memoizedProps:null,N=w.children,Zu(m,w)?N=null:k!==null&&Zu(m,k)&&(o.flags|=32),Xg(r,o),or(r,o,N,u),o.child;case 6:return r===null&&ld(o),null;case 13:return ty(r,o,u);case 4:return gd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=ro(o,null,m,u):or(r,o,m,u),o.child;case 11:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:Kr(m,w),Gg(r,o,m,w,u);case 7:return or(r,o,o.pendingProps,u),o.child;case 8:return or(r,o,o.pendingProps.children,u),o.child;case 12:return or(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,w=o.pendingProps,k=o.memoizedProps,N=w.value,dn(Il,m._currentValue),m._currentValue=N,k!==null)if(Vr(k.value,N)){if(k.children===w.children&&!dr.current){o=ji(r,o,u);break e}}else for(k=o.child,k!==null&&(k.return=o);k!==null;){var W=k.dependencies;if(W!==null){N=k.child;for(var J=W.firstContext;J!==null;){if(J.context===m){if(k.tag===1){J=Ci(-1,u&-u),J.tag=2;var pe=k.updateQueue;if(pe!==null){pe=pe.shared;var Pe=pe.pending;Pe===null?J.next=J:(J.next=Pe.next,Pe.next=J),pe.pending=J}}k.lanes|=u,J=k.alternate,J!==null&&(J.lanes|=u),fd(k.return,u,o),W.lanes|=u;break}J=J.next}}else if(k.tag===10)N=k.type===o.type?null:k.child;else if(k.tag===18){if(N=k.return,N===null)throw Error(n(341));N.lanes|=u,W=N.alternate,W!==null&&(W.lanes|=u),fd(N,u,o),N=k.sibling}else N=k.child;if(N!==null)N.return=k;else for(N=k;N!==null;){if(N===o){N=null;break}if(k=N.sibling,k!==null){k.return=N.return,N=k;break}N=N.return}k=N}or(r,o,w.children,u),o=o.child}return o;case 9:return w=o.type,m=o.pendingProps.children,so(o,u),w=Dr(w),m=m(w),o.flags|=1,or(r,o,m,u),o.child;case 14:return m=o.type,w=Kr(m,o.pendingProps),w=Kr(m.type,w),Kg(r,o,m,w,u);case 15:return Qg(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:Kr(m,w),Vl(r,o),o.tag=1,hr(m)?(r=!0,Tl(o)):r=!1,so(o,u),Wg(o,m,w),Ed(o,m,w,u),Ld(null,o,m,!0,r,u);case 19:return ry(r,o,u);case 22:return Yg(r,o,u)}throw Error(n(156,o.tag))};function Py(r,o){return ae(r,o)}function sj(r,o,u,m){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(r,o,u,m){return new sj(r,o,u,m)}function Zd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function oj(r){if(typeof r=="function")return Zd(r)?1:0;if(r!=null){if(r=r.$$typeof,r===G)return 11;if(r===$)return 14}return 2}function Xi(r,o){var u=r.alternate;return u===null?(u=Or(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function rc(r,o,u,m,w,k){var N=2;if(m=r,typeof r=="function")Zd(r)&&(N=1);else if(typeof r=="string")N=5;else e:switch(r){case M:return js(u.children,w,k,o);case _:N=8,w|=8;break;case I:return r=Or(12,u,o,w|2),r.elementType=I,r.lanes=k,r;case X:return r=Or(13,u,o,w),r.elementType=X,r.lanes=k,r;case Z:return r=Or(19,u,o,w),r.elementType=Z,r.lanes=k,r;case Y:return ic(u,w,k,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case P:N=10;break e;case U:N=9;break e;case G:N=11;break e;case $:N=14;break e;case se:N=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Or(N,u,o,w),o.elementType=r,o.type=m,o.lanes=k,o}function js(r,o,u,m){return r=Or(7,r,m,o),r.lanes=u,r}function ic(r,o,u,m){return r=Or(22,r,m,o),r.elementType=Y,r.lanes=u,r.stateNode={isHidden:!1},r}function eh(r,o,u){return r=Or(6,r,null,o),r.lanes=u,r}function th(r,o,u){return o=Or(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function aj(r,o,u,m,w){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=m,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function nh(r,o,u,m,w,k,N,W,J){return r=new aj(r,o,u,W,J),o===1?(o=1,k===!0&&(o|=8)):o=0,k=Or(3,null,null,o),r.current=k,k.stateNode=r,k.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},pd(k),r}function lj(r,o,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:F,key:m==null?null:""+m,children:r,containerInfo:o,implementation:u}}function Ty(r){if(!r)return zi;r=r._reactInternals;e:{if(Oe(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(hr(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(hr(u))return ng(r,u,o)}return o}function Ey(r,o,u,m,w,k,N,W,J){return r=nh(u,m,!0,r,w,k,N,W,J),r.context=Ty(null),u=r.current,m=ar(),w=Qi(u),k=Ci(m,w),k.callback=o??null,$i(u,k,w),r.current.lanes=w,Sr(r,w,m),pr(r,m),r}function sc(r,o,u,m){var w=o.current,k=ar(),N=Qi(w);return u=Ty(u),o.context===null?o.context=u:o.pendingContext=u,o=Ci(k,N),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=$i(w,o,N),r!==null&&(Xr(r,w,N,k),_l(r,w,N)),N}function oc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Ry(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function rh(r,o){Ry(r,o),(r=r.alternate)&&Ry(r,o)}function cj(){return null}var My=typeof reportError=="function"?reportError:function(r){console.error(r)};function ih(r){this._internalRoot=r}ac.prototype.render=ih.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));sc(r,o,null,null)},ac.prototype.unmount=ih.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;ks(function(){sc(null,r,null,null)}),o[wi]=null}};function ac(r){this._internalRoot=r}ac.prototype.unstable_scheduleHydration=function(r){if(r){var o=hl();r={blockedOn:null,target:r,priority:o};for(var u=0;u<$r.length&&o!==0&&o<$r[u].priority;u++);$r.splice(u,0,r),u===0&&qe(r)}};function sh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function lc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Ay(){}function uj(r,o,u,m,w){if(w){if(typeof m=="function"){var k=m;m=function(){var pe=oc(N);k.call(pe)}}var N=Ey(o,m,r,0,null,!1,!1,"",Ay);return r._reactRootContainer=N,r[wi]=N.current,ta(r.nodeType===8?r.parentNode:r),ks(),N}for(;w=r.lastChild;)r.removeChild(w);if(typeof m=="function"){var W=m;m=function(){var pe=oc(J);W.call(pe)}}var J=nh(r,0,!1,null,null,!1,!1,"",Ay);return r._reactRootContainer=J,r[wi]=J.current,ta(r.nodeType===8?r.parentNode:r),ks(function(){sc(o,J,u,m)}),J}function cc(r,o,u,m,w){var k=u._reactRootContainer;if(k){var N=k;if(typeof w=="function"){var W=w;w=function(){var J=oc(N);W.call(J)}}sc(o,N,r,w)}else N=uj(u,o,r,w,m);return oc(N)}Ho=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=cn(o.pendingLanes);u!==0&&(Ii(o,u|1),pr(o,He()),(en&6)===0&&(uo=He()+500,Hi()))}break;case 13:ks(function(){var m=Si(r,1);if(m!==null){var w=ar();Xr(m,r,1,w)}}),rh(r,1)}},fs=function(r){if(r.tag===13){var o=Si(r,134217728);if(o!==null){var u=ar();Xr(o,r,134217728,u)}rh(r,134217728)}},qo=function(r){if(r.tag===13){var o=Qi(r),u=Si(r,o);if(u!==null){var m=ar();Xr(u,r,o,m)}rh(r,o)}},hl=function(){return rn},$o=function(r,o){var u=rn;try{return rn=r,o()}finally{rn=u}},ee=function(r,o,u){switch(o){case"input":if(Rt(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var m=u[o];if(m!==r&&m.form===r.form){var w=Nl(m);if(!w)throw Error(n(90));yt(m),Rt(m,w)}}}break;case"textarea":gt(r,u);break;case"select":o=u.value,o!=null&&Ot(r,!!u.multiple,o,!1)}},Ut=Yd,nn=ks;var dj={usingClientEntryPoint:!1,Events:[ia,Xs,Nl,Se,Ye,Yd]},va={findFiberByHostInstance:ms,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hj={bundleType:va.bundleType,version:va.version,rendererPackageName:va.rendererPackageName,rendererConfig:va.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:K.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Tt(r),r===null?null:r.stateNode},findFiberByHostInstance:va.findFiberByHostInstance||cj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uc.isDisabled&&uc.supportsFiber)try{ie=uc.inject(hj),it=uc}catch{}}return gr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dj,gr.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sh(o))throw Error(n(200));return lj(r,o,null,u)},gr.createRoot=function(r,o){if(!sh(r))throw Error(n(299));var u=!1,m="",w=My;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=nh(r,1,!1,null,null,u,!1,m,w),r[wi]=o.current,ta(r.nodeType===8?r.parentNode:r),new ih(o)},gr.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Tt(o),r=r===null?null:r.stateNode,r},gr.flushSync=function(r){return ks(r)},gr.hydrate=function(r,o,u){if(!lc(o))throw Error(n(200));return cc(null,r,o,!0,u)},gr.hydrateRoot=function(r,o,u){if(!sh(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,w=!1,k="",N=My;if(u!=null&&(u.unstable_strictMode===!0&&(w=!0),u.identifierPrefix!==void 0&&(k=u.identifierPrefix),u.onRecoverableError!==void 0&&(N=u.onRecoverableError)),o=Ey(o,null,r,1,u??null,w,!1,k,N),r[wi]=o.current,ta(r),m)for(r=0;r<m.length;r++)u=m[r],w=u._getVersion,w=w(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,w]:o.mutableSourceEagerHydrationData.push(u,w);return new ac(o)},gr.render=function(r,o,u){if(!lc(o))throw Error(n(200));return cc(null,r,o,!1,u)},gr.unmountComponentAtNode=function(r){if(!lc(r))throw Error(n(40));return r._reactRootContainer?(ks(function(){cc(null,null,r,!1,function(){r._reactRootContainer=null,r[wi]=null})}),!0):!1},gr.unstable_batchedUpdates=Yd,gr.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!lc(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return cc(r,o,u,!1,m)},gr.version="18.3.1-next-f1338f8080-20240426",gr}var Wy;function jx(){if(Wy)return lh.exports;Wy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lh.exports=xj(),lh.exports}var Uy;function kj(){if(Uy)return dc;Uy=1;var e=jx();return dc.createRoot=e.createRoot,dc.hydrateRoot=e.hydrateRoot,dc}var Sj=kj();const Cj=Ja(Sj);var v=sm();const jj=Ja(v),Nj=Cx({__proto__:null,default:jj},[v]);function Pj(e){return e==="http:"||e==="https:"}function Ri(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const n=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,s=new URL(n);if(!Pj(s.protocol))throw new Error("INVALID_SERVER_PROTOCOL");s.hash="",s.search="";const a=s.pathname.replace(/\/+$/,"");return`${s.origin}${a==="/"?"":a}`}const ko="codingns.auth.remembered-login";function om(){return typeof window<"u"&&typeof window.localStorage<"u"}function Tj(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function Nx(){if(!om())return null;const e=window.localStorage.getItem(ko);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return window.localStorage.removeItem(ko),null;const n=t.username.trim(),s=t.password,a=Ri(t.serverBaseUrl);return!n||!s?(window.localStorage.removeItem(ko),null):{username:n,password:s,serverBaseUrl:a}}catch{return window.localStorage.removeItem(ko),null}}function Px(e){if(!om())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:Ri(e.serverBaseUrl)};window.localStorage.setItem(ko,JSON.stringify(t))}function Ej(e){const t=Nx();t&&Px({...t,serverBaseUrl:e})}function Rj(){om()&&window.localStorage.removeItem(ko)}function Tx(e={}){return{x:e.x??null,y:e.y??null,width:e.width??1200,height:e.height??780,minWidth:e.minWidth??720,minHeight:e.minHeight??480}}function Mj(e){return{windowId:e.windowId,kind:e.kind,workspaceId:e.workspaceId??null,sessionId:e.sessionId??null,mode:e.mode??"docked",bounds:Tx(e.bounds),focusOwner:e.focusOwner??null}}function bo(e){return{...e,bounds:{...e.bounds}}}function Aj(e){return{descriptors:Object.fromEntries(Object.entries(e.descriptors).map(([n,s])=>[n,bo(s)])),openWindowIds:[...e.openWindowIds],lastActiveWindowId:e.lastActiveWindowId}}function zy(){return{descriptors:{},openWindowIds:[],lastActiveWindowId:null}}function Lj(e,t){return{...e,...t,windowId:e.windowId,bounds:Tx({...e.bounds,...t.bounds})}}class Ij{constructor(){Be(this,"state",zy());Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>Aj(this.state))}registerDescriptor(t){const n=bo(t),s=this.state.openWindowIds.includes(n.windowId);return this.state={...this.state,descriptors:{...this.state.descriptors,[n.windowId]:n},lastActiveWindowId:s?n.windowId:this.state.lastActiveWindowId},this.emit(),bo(n)}updateDescriptor(t,n){const s=this.state.descriptors[t];if(!s)return null;const a=Lj(s,n);return this.state={...this.state,descriptors:{...this.state.descriptors,[t]:a}},this.emit(),bo(a)}getDescriptor(t){const n=this.state.descriptors[t];return n?bo(n):null}getWindows(){return Object.values(this.state.descriptors).map(t=>({descriptor:bo(t),isOpen:this.state.openWindowIds.includes(t.windowId)}))}markWindowOpen(t){if(!this.state.descriptors[t])return!1;const n=this.state.openWindowIds.filter(s=>s!==t);return this.state={...this.state,openWindowIds:[...n,t],lastActiveWindowId:t},this.emit(),!0}markWindowClosed(t){if(!this.state.openWindowIds.includes(t))return!1;const n=this.state.openWindowIds.filter(s=>s!==t);return this.state={...this.state,openWindowIds:n,lastActiveWindowId:this.state.lastActiveWindowId===t?n.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}isWindowOpen(t){return this.state.openWindowIds.includes(t)}removeWindow(t){if(!this.state.descriptors[t])return!1;const n={...this.state.descriptors};delete n[t];const s=this.state.openWindowIds.filter(a=>a!==t);return this.state={descriptors:n,openWindowIds:s,lastActiveWindowId:this.state.lastActiveWindowId===t?s.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}clear(){const t=this.state.openWindowIds.length>0||this.state.lastActiveWindowId!==null||Object.keys(this.state.descriptors).length>0;this.state=zy(),t&&this.emit()}emit(){for(const t of this.listeners)t()}}function Dj(){return new Ij}const _j=Dj();function Fj(){return _j}const Oj=Fj();function Ex(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function Rx(){var c,l;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,n=((c=t==null?void 0:t.platform)==null?void 0:c.toLowerCase())??((l=navigator.platform)==null?void 0:l.toLowerCase())??"",s=`${n} ${e}`,a=n.includes("mac")&&navigator.maxTouchPoints>1;return s.includes("android")?"android":s.includes("iphone")||s.includes("ipad")||s.includes("ipod")||a?"ios":s.includes("mac")?"macos":s.includes("win")?"windows":s.includes("linux")?"linux":"unknown"}function Bj(e){var t;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:typeof window<"u"&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:typeof document<"u"&&Number.isFinite((t=document.documentElement)==null?void 0:t.clientWidth)&&document.documentElement.clientWidth>0?document.documentElement.clientWidth:1280}function Wj(e){const t=Bj(e);return t<768?"compact":t<1024?"medium":"expanded"}function Uj(e){const t=Rx();return e==="desktop"?{osFamily:t,windowControlsStyle:t==="macos"?"traffic-lights":t==="windows"?"windows":"none",prefersDesktopChrome:!0,prefersOverlayTitlebar:t==="macos",prefersSystemFontStack:!0}:{osFamily:t,windowControlsStyle:"none",prefersDesktopChrome:!1,prefersOverlayTitlebar:!1,prefersSystemFontStack:!0}}function jn(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Tn(e,t){return Mx(e,t)}async function Mx(e,t){if(!Ex())return jn("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(n){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:n instanceof Error?n.message:"桌面壳调用失败。"}}}function zj(e){switch(e){case"selection":return 10;case"action":return[12];case"gesture":return[10,18,10];case"success":return[16,30,20];case"warning":return[20,36,18];case"error":return[24,40,24,40,20];default:return 10}}function Ax(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function Lx(e){if(Ax())try{navigator.vibrate(zj(e))}catch{return}}async function Ix(e,t){if(typeof window>"u"||typeof Notification>"u")return jn("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return jn("系统通知权限未授予。");const n=new Notification(e,{body:t});return n.onerror=()=>{},{ok:!0}}catch(n){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:n instanceof Error?n.message:"系统通知发送失败。"}}}class Hj{constructor(){Be(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(jn("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,n){return Ix(t,n)}writeClipboardText(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(jn("当前不是桌面端运行环境。"))}}class qj{constructor(){Be(this,"supported",Ax())}trigger(t){return Lx(t)}}class $j{constructor(){Be(this,"supported",!0)}openExternal(t){return Tn("open_external",{url:t})}async showNotification(t,n){const s=await Ix(t,n);return s.ok?s:Tn("show_notification",{title:t,body:n})}writeClipboardText(t){return Tn("copy_text",{text:t})}setWindowState(t){return Tn("set_window_state",{state:t})}readDesktopConfig(){return Tn("read_desktop_config")}writeDesktopConfig(t){return Tn("write_desktop_config",{patch:t})}getRuntimeInfo(){return Tn("get_runtime_info")}checkForUpdate(t){return Tn("check_for_update",{channel:t})}async installUpdate(t){const n=await Tn("install_update",{manifest:t});return n.ok?n.value??{ok:!0}:{ok:!1,errorCode:n.errorCode,detail:n.detail}}rollbackToPreviousVersion(){return Tn("rollback_to_previous_version")}pickDirectory(){return Tn("pick_directory")}createWindow(t){return Tn("create_window",{descriptor:t})}closeWindow(t){return Tn("close_window",{windowId:t})}focusWindow(t){return Tn("focus_window",{windowId:t})}listWindows(){return Tn("list_windows")}isWindowOpen(t){return Tn("is_window_open",{windowId:t})}getWindowDescriptor(t){return typeof t=="string"?Tn("get_window_descriptor",{windowId:t}):Tn("get_window_descriptor")}syncWindowDescriptor(t){return Tn("sync_window_descriptor",{descriptor:t})}updateWindowBounds(t,n){return Tn("update_window_bounds",{windowId:t,bounds:n})}}class Vj{constructor(){Be(this,"supported",!0)}async trigger(t){(await Mx("perform_haptic_feedback",{kind:t})).ok||await Lx(t)}}function Dx(){if(!Ex())return"web";const e=Rx();return e==="ios"?"ios":e==="android"?"android":"desktop"}function pi(e={}){const t=Dx(),n=Wj(e.viewportWidth),s=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:n!=="expanded",isNativeMobile:s,viewportClass:n,ui:Uj(t),bridge:t==="desktop"?new $j:new Hj,windows:Oj,haptics:s?new Vj:new qj}}const vf="codingns.client.runtime-config";function am(e){return e==="desktop"||e==="ios"||e==="android"}function _x(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function Gj(){return typeof navigator>"u"?"zh-CN":_x(navigator.language)}function Kj(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function Fx(){return typeof window<"u"&&typeof window.localStorage<"u"}function Qj(){if(!Fx())return null;const e=window.localStorage.getItem(vf);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(vf),null}}function Ox(e){Fx()&&window.localStorage.setItem(vf,JSON.stringify(e))}function Yj(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function Xj(e){if(!e)return null;try{return Ri(e)}catch{return null}}function lm(e){if(e==="web"){const t=Xj(Yj());if(t)return t}return Ri("http://127.0.0.1:3002")}function Jj(e){return{platform:e,hostBaseUrl:lm(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:Gj(),defaultPermissionMode:"default"}}function wf(e,t){if(!t)return e;const n=t.platform??e.platform;return{...e,...t,hostBaseUrl:am(n)?t.hostBaseUrl?Ri(t.hostBaseUrl):e.hostBaseUrl:lm(n),platform:n,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:_x(t.language??e.language),defaultPermissionMode:Kj(t.defaultPermissionMode??e.defaultPermissionMode)}}async function Zj(){const e=pi(),t=Jj(e.platform),n=Qj();let s=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(s=c.value)}const a=wf(wf(t,n),s);return Ox(a),a}async function eN(e,t){const n=wf(e,t);Ox(n),Ej(n.hostBaseUrl);const s=pi();return s.isDesktop&&await s.bridge.writeDesktopConfig(n),n}function tN(){const e=Dx();return{platform:e,hostBaseUrl:lm(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class nN{constructor(){Be(this,"state",tN());Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await Zj();return this.hydrate(t),t}async update(t){const n=await eN(this.state,t);return this.hydrate(n),n}emit(){for(const t of this.listeners)t()}}const Fn=new nN;function rN(e){return v.useSyncExternalStore(Fn.subscribe,()=>e(Fn.getState()))}function iN(e){return e.endsWith("/")?e:`${e}/`}function sN(e){return e.replace(/^\/+/,"")}function za(){return Fn.getState().hostBaseUrl}function cm(e,t=za()){return new URL(sN(e),iN(t)).toString()}function Bx(e,t=za()){const n=new URL(cm(e,t));return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.toString()}class lr extends Error{constructor(n,s){super(s.detail);Be(this,"status");Be(this,"errorCode");Be(this,"field");this.name="ApiError",this.status=n,this.errorCode=s.error_code,this.field=s.field}}class oN{async request(t,n={}){const s=await this.performRequest(t,n);if(s.status===204||s.status===205)return;const a=await s.text();if(a)return JSON.parse(a)}async requestBlob(t,n={}){return(await this.performRequest(t,n)).blob()}async performRequest(t,n){var d;const s=new Headers(n.headers),a=n.body!==void 0&&n.body!==null,c=cm(t,n.baseUrl??za());if(a&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),!n.skipAuth){const f=(d=vn.getState().session)==null?void 0:d.accessToken;if(!f)throw vn.clear(),new lr(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});s.set("Authorization",`Bearer ${f}`)}let l;try{l=await fetch(c,{...n,headers:s})}catch(f){const p=f instanceof Error?f.message:"未知网络错误";throw new lr(0,{detail:`请求 ${c} 失败:${p}`,error_code:"NETWORK_ERROR"})}if(!l.ok){const f=await aN(l);if(Wx(l.status,f.error_code)&&!n.skipAuth&&!n.retryAfterRefresh){const p=await vn.refresh();if(p.status==="refreshed")return this.performRequest(t,{...n,retryAfterRefresh:!0});throw p.status==="invalid"?new lr(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new lr(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!n.skipAuth&&lN(l.status,f.error_code)&&(sessionStorage.setItem(bf,String(Date.now())),vn.clear()),new lr(l.status,f)}return l}}const Qe=new oN;async function aN(e){const t=await e.text();if(!t)return Hy(e.status);try{const n=JSON.parse(t);if(typeof n.detail=="string"&&typeof n.error_code=="string")return{detail:n.detail,error_code:n.error_code,field:typeof n.field=="string"?n.field:void 0,timestamp:typeof n.timestamp=="string"?n.timestamp:void 0}}catch{}return Hy(e.status,t)}function Hy(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function Wx(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function lN(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:Wx(e,t)}const bf="codingns.auth_expired_at";function cN(){const e=sessionStorage.getItem(bf);return e?(sessionStorage.removeItem(bf),Date.now()-Number(e)<5e3):!1}function uN(e){return Qe.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function dN(e,t){return Qe.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function hN(e,t){return Qe.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function fN(e,t){return Qe.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const ba="codingns.auth.session";class mN{constructor(){Be(this,"state",{status:"anonymous",session:this.readSession()});Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,n,s){const a=await hN({username:t,password:n},s);return this.setSession(a),a}async bootstrap(t,n,s){await dN({username:t,password:n},s)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,n=t==null?void 0:t.refreshToken;if(!n)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const s=await fN({refreshToken:n});return this.setSession(s),{status:"refreshed",session:s}}catch(s){return gN(s)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:s})}}clear(){this.state={status:"anonymous",session:null},window.localStorage.removeItem(ba),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const n={serverBaseUrl:za(),session:t};window.localStorage.setItem(ba,JSON.stringify(n)),this.emit()}readSession(){const t=window.localStorage.getItem(ba);if(!t)return null;try{const n=JSON.parse(t),s=za();return pN(n)?(n.serverBaseUrl&&n.serverBaseUrl!==s,n.session):zx(n)?n:(window.localStorage.removeItem(ba),null)}catch{return window.localStorage.removeItem(ba),null}}emit(){for(const t of this.listeners)t()}}const vn=new mN;function Ux(e){return v.useSyncExternalStore(vn.subscribe,()=>e(vn.getState()))}function pN(e){return typeof e!="object"||e===null?!1:"session"in e&&zx(e.session)}function zx(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&typeof t.refreshToken=="string"&&typeof t.expiresIn=="number"&&typeof t.user=="object"&&t.user!==null}function gN(e){return e instanceof lr?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const Hx="/api/preferences/profile";async function yN(){return Qe.request(Hx)}async function qx(e){return Qe.request(Hx,{method:"PUT",body:JSON.stringify(e)})}const yu=["claude-code","codex","opencode"],$x="codingns.account.preferences.shadow",vN="codingns.client.runtime-config",wN="codingns-theme",bN="composer-selected-model:",xN="composer-reasoning-level:";function Za(){return typeof window<"u"&&typeof window.localStorage<"u"}function um(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function kN(){return typeof navigator>"u"?"zh-CN":um(navigator.language)??"zh-CN"}function Vx(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function SN(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Gx(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function Kx(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function Qx(){return{"claude-code":{defaultModel:null,defaultReasoningLevel:null},codex:{defaultModel:null,defaultReasoningLevel:null},opencode:{defaultModel:null,defaultReasoningLevel:null}}}function Yx(){return{initialized:!0,profile:{language:kN(),theme:SN(),defaultPermissionMode:"default"},providers:Qx(),updatedAt:null,source:"default"}}function CN(){const e=Fn.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!Za())return t;const n=window.localStorage.getItem(vN);if(!n)return t;try{const s=JSON.parse(n);return{language:um(s.language)??t.language,defaultPermissionMode:Gx(s.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function jN(){return Za()?Vx(window.localStorage.getItem(wN)):null}function NN(){var t;if(!Za())return;const e={};for(const n of yu){const s=((t=window.localStorage.getItem(`${bN}${n}`))==null?void 0:t.trim())||null,a=Kx(window.localStorage.getItem(`${xN}${n}`));s===null&&a===null||(e[n]={defaultModel:s,defaultReasoningLevel:a})}return Object.keys(e).length>0?e:void 0}function Xx(){const e=CN(),t=jN(),n=NN(),s={};return e.language&&(s.language=e.language),t&&(s.theme=t),e.defaultPermissionMode&&(s.defaultPermissionMode=e.defaultPermissionMode),n&&(s.providers=n),Jx(s)?s:null}function Jx(e){return e?e.language!==void 0||e.theme!==void 0||e.defaultPermissionMode!==void 0||e.providers!==void 0&&Object.keys(e.providers).length>0:!1}function Kc(e){var s;const t=Yx(),n=Qx();for(const a of yu){const c=(s=e==null?void 0:e.providers)==null?void 0:s[a];n[a]={defaultModel:typeof(c==null?void 0:c.defaultModel)=="string"&&c.defaultModel.trim()||null,defaultReasoningLevel:Kx(c==null?void 0:c.defaultReasoningLevel)??null}}return{language:um(e==null?void 0:e.language)??t.profile.language,theme:Vx(e==null?void 0:e.theme)??t.profile.theme,defaultPermissionMode:Gx(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:n,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function PN(){var t,n,s;if(!Za())return null;const e=window.localStorage.getItem($x);if(!e)return null;try{const a=JSON.parse(e),c=Kc({language:(t=a.profile)==null?void 0:t.language,theme:(n=a.profile)==null?void 0:n.theme,defaultPermissionMode:(s=a.profile)==null?void 0:s.defaultPermissionMode,providers:a.providers,updatedAt:a.updatedAt});return{profile:{language:c.language,theme:c.theme,defaultPermissionMode:c.defaultPermissionMode},providers:c.providers,updatedAt:c.updatedAt}}catch{return null}}function Qc(e){if(!Za())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem($x,JSON.stringify(t))}function fo(){const e=Yx(),t=Xx(),n=t?Zx(e,t,"default"):e,s=PN();return s?{initialized:!0,profile:s.profile,providers:s.providers,updatedAt:s.updatedAt,source:"shadow"}:n}function xf(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function Zx(e,t,n){const s={...e.providers};if(t.providers)for(const a of yu){const c=t.providers[a];c&&(s[a]={defaultModel:c.defaultModel!==void 0?c.defaultModel??null:e.providers[a].defaultModel,defaultReasoningLevel:c.defaultReasoningLevel!==void 0?c.defaultReasoningLevel??null:e.providers[a].defaultReasoningLevel})}return{initialized:!0,profile:{language:t.language??e.profile.language,theme:t.theme??e.profile.theme,defaultPermissionMode:t.defaultPermissionMode??e.profile.defaultPermissionMode},providers:s,updatedAt:e.updatedAt,source:n}}async function TN(){const e=Kc(await yN());if(e.updatedAt===null){const n=Xx();if(Jx(n)){const s=Kc(await qx(n)),a=xf(s,"remote");return Qc(a),a}}const t=xf(e,"remote");return Qc(t),t}class EN{constructor(){Be(this,"state",fo());Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state);Fn.subscribe(()=>{vn.getState().session||this.state.source==="remote"||this.hydrate(fo())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(fo())}async initialize(){if(!vn.getState().session){const t=fo();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!vn.getState().session){const t=fo();return this.hydrate(t),t}try{const t=await TN();return this.hydrate(t),t}catch{const t=fo();return this.hydrate(t),t}}async updateProfile(t){const n=this.state,s=Zx(n,t,n.source);if(this.hydrate(s),!vn.getState().session)return Qc(s),s;try{const a=Kc(await qx(t)),c=xf(a,"remote");return Qc(c),this.hydrate(c),c}catch(a){throw this.hydrate(n),a}}async updateProviderPreference(t,n){return this.updateProfile({providers:{[t]:n}})}emit(){for(const t of this.listeners)t()}}const ni=new EN;function kf(e){return v.useSyncExternalStore(ni.subscribe,()=>e(ni.getState()))}function dh(e){return yu.includes(e)}function RN(){return ni.initialize()}function Yc(e){return ni.updateProfile(e)}function Ao(e){return kf(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function MN(){const e=pi();return await Fn.initialize(),await RN(),{platform:e.platform}}var Hn=jx();const AN=Ja(Hn),LN=Cx({__proto__:null,default:AN},[Hn]);/**
|
|
42
|
+
* @remix-run/router v1.23.2
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Remix Software Inc.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
48
|
+
*
|
|
49
|
+
* @license MIT
|
|
50
|
+
*/function yn(){return yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},yn.apply(this,arguments)}var Rn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Rn||(Rn={}));const qy="popstate";function IN(e){e===void 0&&(e={});function t(s,a){let{pathname:c,search:l,hash:d}=s.location;return Ha("",{pathname:c,search:l,hash:d},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(s,a){return typeof a=="string"?a:el(a)}return _N(t,n,null,e)}function Yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DN(){return Math.random().toString(36).substr(2,8)}function $y(e,t){return{usr:e.state,key:e.key,idx:t}}function Ha(e,t,n,s){return n===void 0&&(n=null),yn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?cs(t):t,{state:n,key:t&&t.key||s||DN()})}function el(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function cs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function _N(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:c=!1}=s,l=a.history,d=Rn.Pop,f=null,p=y();p==null&&(p=0,l.replaceState(yn({},l.state,{idx:p}),""));function y(){return(l.state||{idx:null}).idx}function g(){d=Rn.Pop;let j=y(),R=j==null?null:j-p;p=j,f&&f({action:d,location:C.location,delta:R})}function b(j,R){d=Rn.Push;let L=Ha(C.location,j,R);p=y()+1;let A=$y(L,p),K=C.createHref(L);try{l.pushState(A,"",K)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;a.location.assign(K)}c&&f&&f({action:d,location:C.location,delta:1})}function x(j,R){d=Rn.Replace;let L=Ha(C.location,j,R);p=y();let A=$y(L,p),K=C.createHref(L);l.replaceState(A,"",K),c&&f&&f({action:d,location:C.location,delta:0})}function S(j){let R=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof j=="string"?j:el(j);return L=L.replace(/ $/,"%20"),Yt(R,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,R)}let C={get action(){return d},get location(){return e(a,l)},listen(j){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(qy,g),f=j,()=>{a.removeEventListener(qy,g),f=null}},createHref(j){return t(a,j)},createURL:S,encodeLocation(j){let R=S(j);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:b,replace:x,go(j){return l.go(j)}};return C}var ln;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ln||(ln={}));const FN=new Set(["lazy","caseSensitive","path","id","index","children"]);function ON(e){return e.index===!0}function Xc(e,t,n,s){return n===void 0&&(n=[]),s===void 0&&(s={}),e.map((a,c)=>{let l=[...n,String(c)],d=typeof a.id=="string"?a.id:l.join("-");if(Yt(a.index!==!0||!a.children,"Cannot specify children on an index route"),Yt(!s[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),ON(a)){let f=yn({},a,t(a),{id:d});return s[d]=f,f}else{let f=yn({},a,t(a),{id:d,children:void 0});return s[d]=f,a.children&&(f.children=Xc(a.children,t,l,s)),f}})}function As(e,t,n){return n===void 0&&(n="/"),Lc(e,t,n,!1)}function Lc(e,t,n,s){let a=typeof t=="string"?cs(t):t,c=tl(a.pathname||"/",n);if(c==null)return null;let l=ek(e);WN(l);let d=null;for(let f=0;d==null&&f<l.length;++f){let p=XN(c);d=QN(l[f],p,s)}return d}function BN(e,t){let{route:n,pathname:s,params:a}=e;return{id:n.id,pathname:s,params:a,data:t[n.id],handle:n.handle}}function ek(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let a=(c,l,d)=>{let f={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:l,route:c};f.relativePath.startsWith("/")&&(Yt(f.relativePath.startsWith(s),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(s.length));let p=as([s,f.relativePath]),y=n.concat(f);c.children&&c.children.length>0&&(Yt(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),ek(c.children,t,y,p)),!(c.path==null&&!c.index)&&t.push({path:p,score:GN(p,c.index),routesMeta:y})};return e.forEach((c,l)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))a(c,l);else for(let f of tk(c.path))a(c,l,f)}),t}function tk(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),c=n.replace(/\?$/,"");if(s.length===0)return a?[c,""]:[c];let l=tk(s.join("/")),d=[];return d.push(...l.map(f=>f===""?c:[c,f].join("/"))),a&&d.push(...l),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function WN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:KN(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const UN=/^:[\w-]+$/,zN=3,HN=2,qN=1,$N=10,VN=-2,Vy=e=>e==="*";function GN(e,t){let n=e.split("/"),s=n.length;return n.some(Vy)&&(s+=VN),t&&(s+=HN),n.filter(a=>!Vy(a)).reduce((a,c)=>a+(UN.test(c)?zN:c===""?qN:$N),s)}function KN(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function QN(e,t,n){n===void 0&&(n=!1);let{routesMeta:s}=e,a={},c="/",l=[];for(let d=0;d<s.length;++d){let f=s[d],p=d===s.length-1,y=c==="/"?t:t.slice(c.length)||"/",g=_n({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},y),b=f.route;if(!g&&p&&n&&!s[s.length-1].route.index&&(g=_n({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},y)),!g)return null;Object.assign(a,g.params),l.push({params:a,pathname:as([c,g.pathname]),pathnameBase:tP(as([c,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(c=as([c,g.pathnameBase]))}return l}function _n(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=YN(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let c=a[0],l=c.replace(/(.)\/+$/,"$1"),d=a.slice(1);return{params:s.reduce((p,y,g)=>{let{paramName:b,isOptional:x}=y;if(b==="*"){let C=d[g]||"";l=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const S=d[g];return x&&!S?p[b]=void 0:p[b]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:l,pattern:e}}function YN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Fs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,d,f)=>(s.push({paramName:d,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function XN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fs(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function tl(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}const JN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ZN=e=>JN.test(e);function eP(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?cs(e):e,c;if(n)if(ZN(n))c=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Fs(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?c=Gy(n.substring(1),"/"):c=Gy(n,t)}else c=t;return{pathname:c,search:nP(s),hash:rP(a)}}function Gy(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function hh(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function nk(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function dm(e,t){let n=nk(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function hm(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=cs(e):(a=yn({},e),Yt(!a.pathname||!a.pathname.includes("?"),hh("?","pathname","search",a)),Yt(!a.pathname||!a.pathname.includes("#"),hh("#","pathname","hash",a)),Yt(!a.search||!a.search.includes("#"),hh("#","search","hash",a)));let c=e===""||a.pathname==="",l=c?"/":a.pathname,d;if(l==null)d=n;else{let g=t.length-1;if(!s&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),g-=1;a.pathname=b.join("/")}d=g>=0?t[g]:"/"}let f=eP(a,d),p=l&&l!=="/"&&l.endsWith("/"),y=(c||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||y)&&(f.pathname+="/"),f}const as=e=>e.join("/").replace(/\/\/+/g,"/"),tP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),nP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,rP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Jc{constructor(t,n,s,a){a===void 0&&(a=!1),this.status=t,this.statusText=n||"",this.internal=a,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}}function qa(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const rk=["post","put","patch","delete"],iP=new Set(rk),sP=["get",...rk],oP=new Set(sP),aP=new Set([301,302,303,307,308]),lP=new Set([307,308]),fh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},cP={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},xa={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uP=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ik="remix-router-transitions";function dP(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",s=!n;Yt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let V=e.detectErrorBoundary;a=re=>({hasErrorBoundary:V(re)})}else a=uP;let c={},l=Xc(e.routes,a,void 0,c),d,f=e.basename||"/",p=e.dataStrategy||pP,y=e.patchRoutesOnNavigation,g=yn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),b=null,x=new Set,S=null,C=null,j=null,R=e.hydrationData!=null,L=As(l,e.history.location,f),A=!1,K=null;if(L==null&&!y){let V=br(404,{pathname:e.history.location.pathname}),{matches:re,route:de}=iv(l);L=re,K={[de.id]:V}}L&&!e.hydrationData&&nn(L,l,e.history.location.pathname).active&&(L=null);let H;if(L)if(L.some(V=>V.route.lazy))H=!1;else if(!L.some(V=>V.route.loader))H=!0;else if(g.v7_partialHydration){let V=e.hydrationData?e.hydrationData.loaderData:null,re=e.hydrationData?e.hydrationData.errors:null;if(re){let de=L.findIndex(be=>re[be.route.id]!==void 0);H=L.slice(0,de+1).every(be=>!Cf(be.route,V,re))}else H=L.every(de=>!Cf(de.route,V,re))}else H=e.hydrationData!=null;else if(H=!1,L=[],g.v7_partialHydration){let V=nn(null,l,e.history.location.pathname);V.active&&V.matches&&(A=!0,L=V.matches)}let F,M={historyAction:e.history.action,location:e.history.location,matches:L,initialized:H,navigation:fh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||K,fetchers:new Map,blockers:new Map},_=Rn.Pop,I=!1,P,U=!1,G=new Map,X=null,Z=!1,$=!1,se=[],Y=new Set,q=new Map,oe=0,E=-1,B=new Map,te=new Set,T=new Map,we=new Map,me=new Set,Ce=new Map,_e=new Map,Ge;function ot(){if(b=e.history.listen(V=>{let{action:re,location:de,delta:be}=V;if(Ge){Ge(),Ge=void 0;return}Fs(_e.size===0||be!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ee=ee({currentLocation:M.location,nextLocation:de,historyAction:re});if(Ee&&be!=null){let We=new Promise($e=>{Ge=$e});e.history.go(be*-1),Xt(Ee,{state:"blocked",location:de,proceed(){Xt(Ee,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),We.then(()=>e.history.go(be))},reset(){let $e=new Map(M.blockers);$e.set(Ee,xa),yt({blockers:$e})}});return}return zt(re,de)}),n){EP(t,G);let V=()=>RP(t,G);t.addEventListener("pagehide",V),X=()=>t.removeEventListener("pagehide",V)}return M.initialized||zt(Rn.Pop,M.location,{initialHydration:!0}),F}function mt(){b&&b(),X&&X(),x.clear(),P&&P.abort(),M.fetchers.forEach((V,re)=>wt(re)),M.blockers.forEach((V,re)=>Mt(re))}function jt(V){return x.add(V),()=>x.delete(V)}function yt(V,re){re===void 0&&(re={}),M=yn({},M,V);let de=[],be=[];g.v7_fetcherPersist&&M.fetchers.forEach((Ee,We)=>{Ee.state==="idle"&&(me.has(We)?be.push(We):de.push(We))}),me.forEach(Ee=>{!M.fetchers.has(Ee)&&!q.has(Ee)&&be.push(Ee)}),[...x].forEach(Ee=>Ee(M,{deletedFetchers:be,viewTransitionOpts:re.viewTransitionOpts,flushSync:re.flushSync===!0})),g.v7_fetcherPersist?(de.forEach(Ee=>M.fetchers.delete(Ee)),be.forEach(Ee=>wt(Ee))):be.forEach(Ee=>me.delete(Ee))}function St(V,re,de){var be,Ee;let{flushSync:We}=de===void 0?{}:de,$e=M.actionData!=null&&M.navigation.formMethod!=null&&ei(M.navigation.formMethod)&&M.navigation.state==="loading"&&((be=V.state)==null?void 0:be._isRedirect)!==!0,Re;re.actionData?Object.keys(re.actionData).length>0?Re=re.actionData:Re=null:$e?Re=M.actionData:Re=null;let De=re.loaderData?nv(M.loaderData,re.loaderData,re.matches||[],re.errors):M.loaderData,Fe=M.blockers;Fe.size>0&&(Fe=new Map(Fe),Fe.forEach((ut,Gt)=>Fe.set(Gt,xa)));let Oe=I===!0||M.navigation.formMethod!=null&&ei(M.navigation.formMethod)&&((Ee=V.state)==null?void 0:Ee._isRedirect)!==!0;d&&(l=d,d=void 0),Z||_===Rn.Pop||(_===Rn.Push?e.history.push(V,V.state):_===Rn.Replace&&e.history.replace(V,V.state));let dt;if(_===Rn.Pop){let ut=G.get(M.location.pathname);ut&&ut.has(V.pathname)?dt={currentLocation:M.location,nextLocation:V}:G.has(V.pathname)&&(dt={currentLocation:V,nextLocation:M.location})}else if(U){let ut=G.get(M.location.pathname);ut?ut.add(V.pathname):(ut=new Set([V.pathname]),G.set(M.location.pathname,ut)),dt={currentLocation:M.location,nextLocation:V}}yt(yn({},re,{actionData:Re,loaderData:De,historyAction:_,location:V,initialized:!0,navigation:fh,revalidation:"idle",restoreScrollPosition:Ut(V,re.matches||M.matches),preventScrollReset:Oe,blockers:Fe}),{viewTransitionOpts:dt,flushSync:We===!0}),_=Rn.Pop,I=!1,U=!1,Z=!1,$=!1,se=[]}async function Lt(V,re){if(typeof V=="number"){e.history.go(V);return}let de=Sf(M.location,M.matches,f,g.v7_prependBasename,V,g.v7_relativeSplatPath,re==null?void 0:re.fromRouteId,re==null?void 0:re.relative),{path:be,submission:Ee,error:We}=Ky(g.v7_normalizeFormMethod,!1,de,re),$e=M.location,Re=Ha(M.location,be,re&&re.state);Re=yn({},Re,e.history.encodeLocation(Re));let De=re&&re.replace!=null?re.replace:void 0,Fe=Rn.Push;De===!0?Fe=Rn.Replace:De===!1||Ee!=null&&ei(Ee.formMethod)&&Ee.formAction===M.location.pathname+M.location.search&&(Fe=Rn.Replace);let Oe=re&&"preventScrollReset"in re?re.preventScrollReset===!0:void 0,dt=(re&&re.flushSync)===!0,ut=ee({currentLocation:$e,nextLocation:Re,historyAction:Fe});if(ut){Xt(ut,{state:"blocked",location:Re,proceed(){Xt(ut,{state:"proceeding",proceed:void 0,reset:void 0,location:Re}),Lt(V,re)},reset(){let Gt=new Map(M.blockers);Gt.set(ut,xa),yt({blockers:Gt})}});return}return await zt(Fe,Re,{submission:Ee,pendingError:We,preventScrollReset:Oe,replace:re&&re.replace,enableViewTransition:re&&re.viewTransition,flushSync:dt})}function vt(){if(ve(),yt({revalidation:"loading"}),M.navigation.state!=="submitting"){if(M.navigation.state==="idle"){zt(M.historyAction,M.location,{startUninterruptedRevalidation:!0});return}zt(_||M.historyAction,M.navigation.location,{overrideNavigation:M.navigation,enableViewTransition:U===!0})}}async function zt(V,re,de){P&&P.abort(),P=null,_=V,Z=(de&&de.startUninterruptedRevalidation)===!0,Ye(M.location,M.matches),I=(de&&de.preventScrollReset)===!0,U=(de&&de.enableViewTransition)===!0;let be=d||l,Ee=de&&de.overrideNavigation,We=de!=null&&de.initialHydration&&M.matches&&M.matches.length>0&&!A?M.matches:As(be,re,f),$e=(de&&de.flushSync)===!0;if(We&&M.initialized&&!$&&xP(M.location,re)&&!(de&&de.submission&&ei(de.submission.formMethod))){St(re,{matches:We},{flushSync:$e});return}let Re=nn(We,be,re.pathname);if(Re.active&&Re.matches&&(We=Re.matches),!We){let{error:Tt,notFoundMatches:Ue,route:ae}=Ie(re.pathname);St(re,{matches:Ue,loaderData:{},errors:{[ae.id]:Tt}},{flushSync:$e});return}P=new AbortController;let De=mo(e.history,re,P.signal,de&&de.submission),Fe;if(de&&de.pendingError)Fe=[Ls(We).route.id,{type:ln.error,error:de.pendingError}];else if(de&&de.submission&&ei(de.submission.formMethod)){let Tt=await Rt(De,re,de.submission,We,Re.active,{replace:de.replace,flushSync:$e});if(Tt.shortCircuited)return;if(Tt.pendingActionResult){let[Ue,ae]=Tt.pendingActionResult;if(Er(ae)&&qa(ae.error)&&ae.error.status===404){P=null,St(re,{matches:Tt.matches,loaderData:{},errors:{[Ue]:ae.error}});return}}We=Tt.matches||We,Fe=Tt.pendingActionResult,Ee=mh(re,de.submission),$e=!1,Re.active=!1,De=mo(e.history,De.url,De.signal)}let{shortCircuited:Oe,matches:dt,loaderData:ut,errors:Gt}=await ft(De,re,We,Re.active,Ee,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,$e,Fe);Oe||(P=null,St(re,yn({matches:dt||We},rv(Fe),{loaderData:ut,errors:Gt})))}async function Rt(V,re,de,be,Ee,We){We===void 0&&(We={}),ve();let $e=PP(re,de);if(yt({navigation:$e},{flushSync:We.flushSync===!0}),Ee){let Fe=await fn(be,re.pathname,V.signal);if(Fe.type==="aborted")return{shortCircuited:!0};if(Fe.type==="error"){let Oe=Ls(Fe.partialMatches).route.id;return{matches:Fe.partialMatches,pendingActionResult:[Oe,{type:ln.error,error:Fe.error}]}}else if(Fe.matches)be=Fe.matches;else{let{notFoundMatches:Oe,error:dt,route:ut}=Ie(re.pathname);return{matches:Oe,pendingActionResult:[ut.id,{type:ln.error,error:dt}]}}}let Re,De=Ma(be,re);if(!De.route.action&&!De.route.lazy)Re={type:ln.error,error:br(405,{method:V.method,pathname:re.pathname,routeId:De.route.id})};else if(Re=(await Vt("action",M,V,[De],be,null))[De.route.id],V.signal.aborted)return{shortCircuited:!0};if(Ds(Re)){let Fe;return We&&We.replace!=null?Fe=We.replace:Fe=Zy(Re.response.headers.get("Location"),new URL(V.url),f,e.history)===M.location.pathname+M.location.search,await gt(V,Re,!0,{submission:de,replace:Fe}),{shortCircuited:!0}}if(is(Re))throw br(400,{type:"defer-action"});if(Er(Re)){let Fe=Ls(be,De.route.id);return(We&&We.replace)!==!0&&(_=Rn.Push),{matches:be,pendingActionResult:[Fe.route.id,Re]}}return{matches:be,pendingActionResult:[De.route.id,Re]}}async function ft(V,re,de,be,Ee,We,$e,Re,De,Fe,Oe){let dt=Ee||mh(re,We),ut=We||$e||ov(dt),Gt=!Z&&(!g.v7_partialHydration||!De);if(be){if(Gt){let ie=tn(Oe);yt(yn({navigation:dt},ie!==void 0?{actionData:ie}:{}),{flushSync:Fe})}let he=await fn(de,re.pathname,V.signal);if(he.type==="aborted")return{shortCircuited:!0};if(he.type==="error"){let ie=Ls(he.partialMatches).route.id;return{matches:he.partialMatches,loaderData:{},errors:{[ie]:he.error}}}else if(he.matches)de=he.matches;else{let{error:ie,notFoundMatches:it,route:_t}=Ie(re.pathname);return{matches:it,loaderData:{},errors:{[_t.id]:ie}}}}let Tt=d||l,[Ue,ae]=Yy(e.history,M,de,ut,re,g.v7_partialHydration&&De===!0,g.v7_skipActionErrorRevalidation,$,se,Y,me,T,te,Tt,f,Oe);if(at(he=>!(de&&de.some(ie=>ie.route.id===he))||Ue&&Ue.some(ie=>ie.route.id===he)),E=++oe,Ue.length===0&&ae.length===0){let he=Wt();return St(re,yn({matches:de,loaderData:{},errors:Oe&&Er(Oe[1])?{[Oe[0]]:Oe[1].error}:null},rv(Oe),he?{fetchers:new Map(M.fetchers)}:{}),{flushSync:Fe}),{shortCircuited:!0}}if(Gt){let he={};if(!be){he.navigation=dt;let ie=tn(Oe);ie!==void 0&&(he.actionData=ie)}ae.length>0&&(he.fetchers=qt(ae)),yt(he,{flushSync:Fe})}ae.forEach(he=>{Pt(he.key),he.controller&&q.set(he.key,he.controller)});let je=()=>ae.forEach(he=>Pt(he.key));P&&P.signal.addEventListener("abort",je);let{loaderResults:Xe,fetcherResults:rt}=await ue(M,de,Ue,ae,V);if(V.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",je),ae.forEach(he=>q.delete(he.key));let He=hc(Xe);if(He)return await gt(V,He.result,!0,{replace:Re}),{shortCircuited:!0};if(He=hc(rt),He)return te.add(He.key),await gt(V,He.result,!0,{replace:Re}),{shortCircuited:!0};let{loaderData:At,errors:Ct}=tv(M,de,Xe,Oe,ae,rt,Ce);Ce.forEach((he,ie)=>{he.subscribe(it=>{(it||he.done)&&Ce.delete(ie)})}),g.v7_partialHydration&&De&&M.errors&&(Ct=yn({},M.errors,Ct));let Q=Wt(),ke=ct(E),D=Q||ke||ae.length>0;return yn({matches:de,loaderData:At,errors:Ct},D?{fetchers:new Map(M.fetchers)}:{})}function tn(V){if(V&&!Er(V[1]))return{[V[0]]:V[1].data};if(M.actionData)return Object.keys(M.actionData).length===0?null:M.actionData}function qt(V){return V.forEach(re=>{let de=M.fetchers.get(re.key),be=ka(void 0,de?de.data:void 0);M.fetchers.set(re.key,be)}),new Map(M.fetchers)}function Ot(V,re,de,be){if(s)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Pt(V);let Ee=(be&&be.flushSync)===!0,We=d||l,$e=Sf(M.location,M.matches,f,g.v7_prependBasename,de,g.v7_relativeSplatPath,re,be==null?void 0:be.relative),Re=As(We,$e,f),De=nn(Re,We,$e);if(De.active&&De.matches&&(Re=De.matches),!Re){Ke(V,re,br(404,{pathname:$e}),{flushSync:Ee});return}let{path:Fe,submission:Oe,error:dt}=Ky(g.v7_normalizeFormMethod,!0,$e,be);if(dt){Ke(V,re,dt,{flushSync:Ee});return}let ut=Ma(Re,Fe),Gt=(be&&be.preventScrollReset)===!0;if(Oe&&ei(Oe.formMethod)){tt(V,re,Fe,ut,Re,De.active,Ee,Gt,Oe);return}T.set(V,{routeId:re,path:Fe}),$t(V,re,Fe,ut,Re,De.active,Ee,Gt,Oe)}async function tt(V,re,de,be,Ee,We,$e,Re,De){ve(),T.delete(V);function Fe(O){if(!O.route.action&&!O.route.lazy){let xe=br(405,{method:De.formMethod,pathname:de,routeId:re});return Ke(V,re,xe,{flushSync:$e}),!0}return!1}if(!We&&Fe(be))return;let Oe=M.fetchers.get(V);Le(V,TP(De,Oe),{flushSync:$e});let dt=new AbortController,ut=mo(e.history,de,dt.signal,De);if(We){let O=await fn(Ee,new URL(ut.url).pathname,ut.signal,V);if(O.type==="aborted")return;if(O.type==="error"){Ke(V,re,O.error,{flushSync:$e});return}else if(O.matches){if(Ee=O.matches,be=Ma(Ee,de),Fe(be))return}else{Ke(V,re,br(404,{pathname:de}),{flushSync:$e});return}}q.set(V,dt);let Gt=oe,Ue=(await Vt("action",M,ut,[be],Ee,V))[be.route.id];if(ut.signal.aborted){q.get(V)===dt&&q.delete(V);return}if(g.v7_fetcherPersist&&me.has(V)){if(Ds(Ue)||Er(Ue)){Le(V,ns(void 0));return}}else{if(Ds(Ue))if(q.delete(V),E>Gt){Le(V,ns(void 0));return}else return te.add(V),Le(V,ka(De)),gt(ut,Ue,!1,{fetcherSubmission:De,preventScrollReset:Re});if(Er(Ue)){Ke(V,re,Ue.error);return}}if(is(Ue))throw br(400,{type:"defer-action"});let ae=M.navigation.location||M.location,je=mo(e.history,ae,dt.signal),Xe=d||l,rt=M.navigation.state!=="idle"?As(Xe,M.navigation.location,f):M.matches;Yt(rt,"Didn't find any matches after fetcher action");let He=++oe;B.set(V,He);let At=ka(De,Ue.data);M.fetchers.set(V,At);let[Ct,Q]=Yy(e.history,M,rt,De,ae,!1,g.v7_skipActionErrorRevalidation,$,se,Y,me,T,te,Xe,f,[be.route.id,Ue]);Q.filter(O=>O.key!==V).forEach(O=>{let xe=O.key,ge=M.fetchers.get(xe),ze=ka(void 0,ge?ge.data:void 0);M.fetchers.set(xe,ze),Pt(xe),O.controller&&q.set(xe,O.controller)}),yt({fetchers:new Map(M.fetchers)});let ke=()=>Q.forEach(O=>Pt(O.key));dt.signal.addEventListener("abort",ke);let{loaderResults:D,fetcherResults:he}=await ue(M,rt,Ct,Q,je);if(dt.signal.aborted)return;dt.signal.removeEventListener("abort",ke),B.delete(V),q.delete(V),Q.forEach(O=>q.delete(O.key));let ie=hc(D);if(ie)return gt(je,ie.result,!1,{preventScrollReset:Re});if(ie=hc(he),ie)return te.add(ie.key),gt(je,ie.result,!1,{preventScrollReset:Re});let{loaderData:it,errors:_t}=tv(M,rt,D,void 0,Q,he,Ce);if(M.fetchers.has(V)){let O=ns(Ue.data);M.fetchers.set(V,O)}ct(He),M.navigation.state==="loading"&&He>E?(Yt(_,"Expected pending action"),P&&P.abort(),St(M.navigation.location,{matches:rt,loaderData:it,errors:_t,fetchers:new Map(M.fetchers)})):(yt({errors:_t,loaderData:nv(M.loaderData,it,rt,_t),fetchers:new Map(M.fetchers)}),$=!1)}async function $t(V,re,de,be,Ee,We,$e,Re,De){let Fe=M.fetchers.get(V);Le(V,ka(De,Fe?Fe.data:void 0),{flushSync:$e});let Oe=new AbortController,dt=mo(e.history,de,Oe.signal);if(We){let Ue=await fn(Ee,new URL(dt.url).pathname,dt.signal,V);if(Ue.type==="aborted")return;if(Ue.type==="error"){Ke(V,re,Ue.error,{flushSync:$e});return}else if(Ue.matches)Ee=Ue.matches,be=Ma(Ee,de);else{Ke(V,re,br(404,{pathname:de}),{flushSync:$e});return}}q.set(V,Oe);let ut=oe,Tt=(await Vt("loader",M,dt,[be],Ee,V))[be.route.id];if(is(Tt)&&(Tt=await mm(Tt,dt.signal,!0)||Tt),q.get(V)===Oe&&q.delete(V),!dt.signal.aborted){if(me.has(V)){Le(V,ns(void 0));return}if(Ds(Tt))if(E>ut){Le(V,ns(void 0));return}else{te.add(V),await gt(dt,Tt,!1,{preventScrollReset:Re});return}if(Er(Tt)){Ke(V,re,Tt.error);return}Yt(!is(Tt),"Unhandled fetcher deferred data"),Le(V,ns(Tt.data))}}async function gt(V,re,de,be){let{submission:Ee,fetcherSubmission:We,preventScrollReset:$e,replace:Re}=be===void 0?{}:be;re.response.headers.has("X-Remix-Revalidate")&&($=!0);let De=re.response.headers.get("Location");Yt(De,"Expected a Location header on the redirect Response"),De=Zy(De,new URL(V.url),f,e.history);let Fe=Ha(M.location,De,{_isRedirect:!0});if(n){let Ue=!1;if(re.response.headers.has("X-Remix-Reload-Document"))Ue=!0;else if(fm.test(De)){const ae=e.history.createURL(De);Ue=ae.origin!==t.location.origin||tl(ae.pathname,f)==null}if(Ue){Re?t.location.replace(De):t.location.assign(De);return}}P=null;let Oe=Re===!0||re.response.headers.has("X-Remix-Replace")?Rn.Replace:Rn.Push,{formMethod:dt,formAction:ut,formEncType:Gt}=M.navigation;!Ee&&!We&&dt&&ut&&Gt&&(Ee=ov(M.navigation));let Tt=Ee||We;if(lP.has(re.response.status)&&Tt&&ei(Tt.formMethod))await zt(Oe,Fe,{submission:yn({},Tt,{formAction:De}),preventScrollReset:$e||I,enableViewTransition:de?U:void 0});else{let Ue=mh(Fe,Ee);await zt(Oe,Fe,{overrideNavigation:Ue,fetcherSubmission:We,preventScrollReset:$e||I,enableViewTransition:de?U:void 0})}}async function Vt(V,re,de,be,Ee,We){let $e,Re={};try{$e=await gP(p,V,re,de,be,Ee,We,c,a)}catch(De){return be.forEach(Fe=>{Re[Fe.route.id]={type:ln.error,error:De}}),Re}for(let[De,Fe]of Object.entries($e))if(kP(Fe)){let Oe=Fe.result;Re[De]={type:ln.redirect,response:wP(Oe,de,De,Ee,f,g.v7_relativeSplatPath)}}else Re[De]=await vP(Fe);return Re}async function ue(V,re,de,be,Ee){let We=V.matches,$e=Vt("loader",V,Ee,de,re,null),Re=Promise.all(be.map(async Oe=>{if(Oe.matches&&Oe.match&&Oe.controller){let ut=(await Vt("loader",V,mo(e.history,Oe.path,Oe.controller.signal),[Oe.match],Oe.matches,Oe.key))[Oe.match.route.id];return{[Oe.key]:ut}}else return Promise.resolve({[Oe.key]:{type:ln.error,error:br(404,{pathname:Oe.path})}})})),De=await $e,Fe=(await Re).reduce((Oe,dt)=>Object.assign(Oe,dt),{});return await Promise.all([jP(re,De,Ee.signal,We,V.loaderData),NP(re,Fe,be)]),{loaderResults:De,fetcherResults:Fe}}function ve(){$=!0,se.push(...at()),T.forEach((V,re)=>{q.has(re)&&Y.add(re),Pt(re)})}function Le(V,re,de){de===void 0&&(de={}),M.fetchers.set(V,re),yt({fetchers:new Map(M.fetchers)},{flushSync:(de&&de.flushSync)===!0})}function Ke(V,re,de,be){be===void 0&&(be={});let Ee=Ls(M.matches,re);wt(V),yt({errors:{[Ee.route.id]:de},fetchers:new Map(M.fetchers)},{flushSync:(be&&be.flushSync)===!0})}function nt(V){return we.set(V,(we.get(V)||0)+1),me.has(V)&&me.delete(V),M.fetchers.get(V)||cP}function wt(V){let re=M.fetchers.get(V);q.has(V)&&!(re&&re.state==="loading"&&B.has(V))&&Pt(V),T.delete(V),B.delete(V),te.delete(V),g.v7_fetcherPersist&&me.delete(V),Y.delete(V),M.fetchers.delete(V)}function Dt(V){let re=(we.get(V)||0)-1;re<=0?(we.delete(V),me.add(V),g.v7_fetcherPersist||wt(V)):we.set(V,re),yt({fetchers:new Map(M.fetchers)})}function Pt(V){let re=q.get(V);re&&(re.abort(),q.delete(V))}function Ze(V){for(let re of V){let de=nt(re),be=ns(de.data);M.fetchers.set(re,be)}}function Wt(){let V=[],re=!1;for(let de of te){let be=M.fetchers.get(de);Yt(be,"Expected fetcher: "+de),be.state==="loading"&&(te.delete(de),V.push(de),re=!0)}return Ze(V),re}function ct(V){let re=[];for(let[de,be]of B)if(be<V){let Ee=M.fetchers.get(de);Yt(Ee,"Expected fetcher: "+de),Ee.state==="loading"&&(Pt(de),B.delete(de),re.push(de))}return Ze(re),re.length>0}function It(V,re){let de=M.blockers.get(V)||xa;return _e.get(V)!==re&&_e.set(V,re),de}function Mt(V){M.blockers.delete(V),_e.delete(V)}function Xt(V,re){let de=M.blockers.get(V)||xa;Yt(de.state==="unblocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="proceeding"||de.state==="blocked"&&re.state==="unblocked"||de.state==="proceeding"&&re.state==="unblocked","Invalid blocker state transition: "+de.state+" -> "+re.state);let be=new Map(M.blockers);be.set(V,re),yt({blockers:be})}function ee(V){let{currentLocation:re,nextLocation:de,historyAction:be}=V;if(_e.size===0)return;_e.size>1&&Fs(!1,"A router only supports one blocker at a time");let Ee=Array.from(_e.entries()),[We,$e]=Ee[Ee.length-1],Re=M.blockers.get(We);if(!(Re&&Re.state==="proceeding")&&$e({currentLocation:re,nextLocation:de,historyAction:be}))return We}function Ie(V){let re=br(404,{pathname:V}),de=d||l,{matches:be,route:Ee}=iv(de);return at(),{notFoundMatches:be,route:Ee,error:re}}function at(V){let re=[];return Ce.forEach((de,be)=>{(!V||V(be))&&(de.cancel(),re.push(be),Ce.delete(be))}),re}function Nt(V,re,de){if(S=V,j=re,C=de||null,!R&&M.navigation===fh){R=!0;let be=Ut(M.location,M.matches);be!=null&&yt({restoreScrollPosition:be})}return()=>{S=null,j=null,C=null}}function Se(V,re){return C&&C(V,re.map(be=>BN(be,M.loaderData)))||V.key}function Ye(V,re){if(S&&j){let de=Se(V,re);S[de]=j()}}function Ut(V,re){if(S){let de=Se(V,re),be=S[de];if(typeof be=="number")return be}return null}function nn(V,re,de){if(y)if(V){if(Object.keys(V[0].params).length>0)return{active:!0,matches:Lc(re,de,f,!0)}}else return{active:!0,matches:Lc(re,de,f,!0)||[]};return{active:!1,matches:null}}async function fn(V,re,de,be){if(!y)return{type:"success",matches:V};let Ee=V;for(;;){let We=d==null,$e=d||l,Re=c;try{await y({signal:de,path:re,matches:Ee,fetcherKey:be,patch:(Oe,dt)=>{de.aborted||Jy(Oe,dt,$e,Re,a)}})}catch(Oe){return{type:"error",error:Oe,partialMatches:Ee}}finally{We&&!de.aborted&&(l=[...l])}if(de.aborted)return{type:"aborted"};let De=As($e,re,f);if(De)return{type:"success",matches:De};let Fe=Lc($e,re,f,!0);if(!Fe||Ee.length===Fe.length&&Ee.every((Oe,dt)=>Oe.route.id===Fe[dt].route.id))return{type:"success",matches:null};Ee=Fe}}function Nn(V){c={},d=Xc(V,a,void 0,c)}function wn(V,re){let de=d==null;Jy(V,re,d||l,c,a),de&&(l=[...l],yt({}))}return F={get basename(){return f},get future(){return g},get state(){return M},get routes(){return l},get window(){return t},initialize:ot,subscribe:jt,enableScrollRestoration:Nt,navigate:Lt,fetch:Ot,revalidate:vt,createHref:V=>e.history.createHref(V),encodeLocation:V=>e.history.encodeLocation(V),getFetcher:nt,deleteFetcher:Dt,dispose:mt,getBlocker:It,deleteBlocker:Mt,patchRoutes:wn,_internalFetchControllers:q,_internalActiveDeferreds:Ce,_internalSetRoutes:Nn},F}function hP(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Sf(e,t,n,s,a,c,l,d){let f,p;if(l){f=[];for(let g of t)if(f.push(g),g.route.id===l){p=g;break}}else f=t,p=t[t.length-1];let y=hm(a||".",dm(f,c),tl(e.pathname,n)||e.pathname,d==="path");if(a==null&&(y.search=e.search,y.hash=e.hash),(a==null||a===""||a===".")&&p){let g=pm(y.search);if(p.route.index&&!g)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!p.route.index&&g){let b=new URLSearchParams(y.search),x=b.getAll("index");b.delete("index"),x.filter(C=>C).forEach(C=>b.append("index",C));let S=b.toString();y.search=S?"?"+S:""}}return s&&n!=="/"&&(y.pathname=y.pathname==="/"?n:as([n,y.pathname])),el(y)}function Ky(e,t,n,s){if(!s||!hP(s))return{path:n};if(s.formMethod&&!CP(s.formMethod))return{path:n,error:br(405,{method:s.formMethod})};let a=()=>({path:n,error:br(400,{type:"invalid-body"})}),c=s.formMethod||"get",l=e?c.toUpperCase():c.toLowerCase(),d=ak(n);if(s.body!==void 0){if(s.formEncType==="text/plain"){if(!ei(l))return a();let b=typeof s.body=="string"?s.body:s.body instanceof FormData||s.body instanceof URLSearchParams?Array.from(s.body.entries()).reduce((x,S)=>{let[C,j]=S;return""+x+C+"="+j+`
|
|
51
|
+
`},""):String(s.body);return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:void 0,text:b}}}else if(s.formEncType==="application/json"){if(!ei(l))return a();try{let b=typeof s.body=="string"?JSON.parse(s.body):s.body;return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:b,text:void 0}}}catch{return a()}}}Yt(typeof FormData=="function","FormData is not available in this environment");let f,p;if(s.formData)f=jf(s.formData),p=s.formData;else if(s.body instanceof FormData)f=jf(s.body),p=s.body;else if(s.body instanceof URLSearchParams)f=s.body,p=ev(f);else if(s.body==null)f=new URLSearchParams,p=new FormData;else try{f=new URLSearchParams(s.body),p=ev(f)}catch{return a()}let y={formMethod:l,formAction:d,formEncType:s&&s.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(ei(y.formMethod))return{path:n,submission:y};let g=cs(n);return t&&g.search&&pm(g.search)&&f.append("index",""),g.search="?"+f,{path:el(g),submission:y}}function Qy(e,t,n){n===void 0&&(n=!1);let s=e.findIndex(a=>a.route.id===t);return s>=0?e.slice(0,n?s+1:s):e}function Yy(e,t,n,s,a,c,l,d,f,p,y,g,b,x,S,C){let j=C?Er(C[1])?C[1].error:C[1].data:void 0,R=e.createURL(t.location),L=e.createURL(a),A=n;c&&t.errors?A=Qy(n,Object.keys(t.errors)[0],!0):C&&Er(C[1])&&(A=Qy(n,C[0]));let K=C?C[1].statusCode:void 0,H=l&&K&&K>=400,F=A.filter((_,I)=>{let{route:P}=_;if(P.lazy)return!0;if(P.loader==null)return!1;if(c)return Cf(P,t.loaderData,t.errors);if(fP(t.loaderData,t.matches[I],_)||f.some(X=>X===_.route.id))return!0;let U=t.matches[I],G=_;return Xy(_,yn({currentUrl:R,currentParams:U.params,nextUrl:L,nextParams:G.params},s,{actionResult:j,actionStatus:K,defaultShouldRevalidate:H?!1:d||R.pathname+R.search===L.pathname+L.search||R.search!==L.search||sk(U,G)}))}),M=[];return g.forEach((_,I)=>{if(c||!n.some(Z=>Z.route.id===_.routeId)||y.has(I))return;let P=As(x,_.path,S);if(!P){M.push({key:I,routeId:_.routeId,path:_.path,matches:null,match:null,controller:null});return}let U=t.fetchers.get(I),G=Ma(P,_.path),X=!1;b.has(I)?X=!1:p.has(I)?(p.delete(I),X=!0):U&&U.state!=="idle"&&U.data===void 0?X=d:X=Xy(G,yn({currentUrl:R,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:n[n.length-1].params},s,{actionResult:j,actionStatus:K,defaultShouldRevalidate:H?!1:d})),X&&M.push({key:I,routeId:_.routeId,path:_.path,matches:P,match:G,controller:new AbortController})}),[F,M]}function Cf(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let s=t!=null&&t[e.id]!==void 0,a=n!=null&&n[e.id]!==void 0;return!s&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!s&&!a}function fP(e,t,n){let s=!t||n.route.id!==t.route.id,a=e[n.route.id]===void 0;return s||a}function sk(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Xy(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Jy(e,t,n,s,a){var c;let l;if(e){let p=s[e];Yt(p,"No route found to patch children into: routeId = "+e),p.children||(p.children=[]),l=p.children}else l=n;let d=t.filter(p=>!l.some(y=>ok(p,y))),f=Xc(d,a,[e||"_","patch",String(((c=l)==null?void 0:c.length)||"0")],s);l.push(...f)}function ok(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,s)=>{var a;return(a=t.children)==null?void 0:a.some(c=>ok(n,c))}):!1}async function mP(e,t,n){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let a=n[e.id];Yt(a,"No route found in manifest");let c={};for(let l in s){let f=a[l]!==void 0&&l!=="hasErrorBoundary";Fs(!f,'Route "'+a.id+'" has a static property "'+l+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+l+'" will be ignored.')),!f&&!FN.has(l)&&(c[l]=s[l])}Object.assign(a,c),Object.assign(a,yn({},t(a),{lazy:void 0}))}async function pP(e){let{matches:t}=e,n=t.filter(a=>a.shouldLoad);return(await Promise.all(n.map(a=>a.resolve()))).reduce((a,c,l)=>Object.assign(a,{[n[l].route.id]:c}),{})}async function gP(e,t,n,s,a,c,l,d,f,p){let y=c.map(x=>x.route.lazy?mP(x.route,f,d):void 0),g=c.map((x,S)=>{let C=y[S],j=a.some(L=>L.route.id===x.route.id);return yn({},x,{shouldLoad:j,resolve:async L=>(L&&s.method==="GET"&&(x.route.lazy||x.route.loader)&&(j=!0),j?yP(t,s,x,C,L,p):Promise.resolve({type:ln.data,result:void 0}))})}),b=await e({matches:g,request:s,params:c[0].params,fetcherKey:l,context:p});try{await Promise.all(y)}catch{}return b}async function yP(e,t,n,s,a,c){let l,d,f=p=>{let y,g=new Promise((S,C)=>y=C);d=()=>y(),t.signal.addEventListener("abort",d);let b=S=>typeof p!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):p({request:t,params:n.params,context:c},...S!==void 0?[S]:[]),x=(async()=>{try{return{type:"data",result:await(a?a(C=>b(C)):b())}}catch(S){return{type:"error",result:S}}})();return Promise.race([x,g])};try{let p=n.route[e];if(s)if(p){let y,[g]=await Promise.all([f(p).catch(b=>{y=b}),s]);if(y!==void 0)throw y;l=g}else if(await s,p=n.route[e],p)l=await f(p);else if(e==="action"){let y=new URL(t.url),g=y.pathname+y.search;throw br(405,{method:t.method,pathname:g,routeId:n.route.id})}else return{type:ln.data,result:void 0};else if(p)l=await f(p);else{let y=new URL(t.url),g=y.pathname+y.search;throw br(404,{pathname:g})}Yt(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(p){return{type:ln.error,result:p}}finally{d&&t.signal.removeEventListener("abort",d)}return l}async function vP(e){let{result:t,type:n}=e;if(lk(t)){let g;try{let b=t.headers.get("Content-Type");b&&/\bapplication\/json\b/.test(b)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(b){return{type:ln.error,error:b}}return n===ln.error?{type:ln.error,error:new Jc(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:ln.data,data:g,statusCode:t.status,headers:t.headers}}if(n===ln.error){if(sv(t)){var s,a;if(t.data instanceof Error){var c,l;return{type:ln.error,error:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:ln.error,error:new Jc(((s=t.init)==null?void 0:s.status)||500,void 0,t.data),statusCode:qa(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:ln.error,error:t,statusCode:qa(t)?t.status:void 0}}if(SP(t)){var d,f;return{type:ln.deferred,deferredData:t,statusCode:(d=t.init)==null?void 0:d.status,headers:((f=t.init)==null?void 0:f.headers)&&new Headers(t.init.headers)}}if(sv(t)){var p,y;return{type:ln.data,data:t.data,statusCode:(p=t.init)==null?void 0:p.status,headers:(y=t.init)!=null&&y.headers?new Headers(t.init.headers):void 0}}return{type:ln.data,data:t}}function wP(e,t,n,s,a,c){let l=e.headers.get("Location");if(Yt(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!fm.test(l)){let d=s.slice(0,s.findIndex(f=>f.route.id===n)+1);l=Sf(new URL(t.url),d,a,!0,l,c),e.headers.set("Location",l)}return e}function Zy(e,t,n,s){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(fm.test(e)){let c=e,l=c.startsWith("//")?new URL(t.protocol+c):new URL(c);if(a.includes(l.protocol))throw new Error("Invalid redirect location");let d=tl(l.pathname,n)!=null;if(l.origin===t.origin&&d)return l.pathname+l.search+l.hash}try{let c=s.createURL(e);if(a.includes(c.protocol))throw new Error("Invalid redirect location")}catch{}return e}function mo(e,t,n,s){let a=e.createURL(ak(t)).toString(),c={signal:n};if(s&&ei(s.formMethod)){let{formMethod:l,formEncType:d}=s;c.method=l.toUpperCase(),d==="application/json"?(c.headers=new Headers({"Content-Type":d}),c.body=JSON.stringify(s.json)):d==="text/plain"?c.body=s.text:d==="application/x-www-form-urlencoded"&&s.formData?c.body=jf(s.formData):c.body=s.formData}return new Request(a,c)}function jf(e){let t=new URLSearchParams;for(let[n,s]of e.entries())t.append(n,typeof s=="string"?s:s.name);return t}function ev(e){let t=new FormData;for(let[n,s]of e.entries())t.append(n,s);return t}function bP(e,t,n,s,a){let c={},l=null,d,f=!1,p={},y=n&&Er(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let b=g.route.id,x=t[b];if(Yt(!Ds(x),"Cannot handle redirect results in processLoaderData"),Er(x)){let S=x.error;y!==void 0&&(S=y,y=void 0),l=l||{};{let C=Ls(e,b);l[C.route.id]==null&&(l[C.route.id]=S)}c[b]=void 0,f||(f=!0,d=qa(x.error)?x.error.status:500),x.headers&&(p[b]=x.headers)}else is(x)?(s.set(b,x.deferredData),c[b]=x.deferredData.data,x.statusCode!=null&&x.statusCode!==200&&!f&&(d=x.statusCode),x.headers&&(p[b]=x.headers)):(c[b]=x.data,x.statusCode&&x.statusCode!==200&&!f&&(d=x.statusCode),x.headers&&(p[b]=x.headers))}),y!==void 0&&n&&(l={[n[0]]:y},c[n[0]]=void 0),{loaderData:c,errors:l,statusCode:d||200,loaderHeaders:p}}function tv(e,t,n,s,a,c,l){let{loaderData:d,errors:f}=bP(t,n,s,l);return a.forEach(p=>{let{key:y,match:g,controller:b}=p,x=c[y];if(Yt(x,"Did not find corresponding fetcher result"),!(b&&b.signal.aborted))if(Er(x)){let S=Ls(e.matches,g==null?void 0:g.route.id);f&&f[S.route.id]||(f=yn({},f,{[S.route.id]:x.error})),e.fetchers.delete(y)}else if(Ds(x))Yt(!1,"Unhandled fetcher revalidation redirect");else if(is(x))Yt(!1,"Unhandled fetcher deferred data");else{let S=ns(x.data);e.fetchers.set(y,S)}}),{loaderData:d,errors:f}}function nv(e,t,n,s){let a=yn({},t);for(let c of n){let l=c.route.id;if(t.hasOwnProperty(l)?t[l]!==void 0&&(a[l]=t[l]):e[l]!==void 0&&c.route.loader&&(a[l]=e[l]),s&&s.hasOwnProperty(l))break}return a}function rv(e){return e?Er(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ls(e,t){return(t?e.slice(0,e.findIndex(s=>s.route.id===t)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function iv(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function br(e,t){let{pathname:n,routeId:s,method:a,type:c,message:l}=t===void 0?{}:t,d="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(d="Bad Request",a&&n&&s?f="You made a "+a+' request to "'+n+'" but '+('did not provide a `loader` for route "'+s+'", ')+"so there is no way to handle the request.":c==="defer-action"?f="defer() is not supported in actions":c==="invalid-body"&&(f="Unable to encode submission body")):e===403?(d="Forbidden",f='Route "'+s+'" does not match URL "'+n+'"'):e===404?(d="Not Found",f='No route matches URL "'+n+'"'):e===405&&(d="Method Not Allowed",a&&n&&s?f="You made a "+a.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+s+'", ')+"so there is no way to handle the request.":a&&(f='Invalid request method "'+a.toUpperCase()+'"')),new Jc(e||500,d,new Error(f),!0)}function hc(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[s,a]=t[n];if(Ds(a))return{key:s,result:a}}}function ak(e){let t=typeof e=="string"?cs(e):e;return el(yn({},t,{hash:""}))}function xP(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function kP(e){return lk(e.result)&&aP.has(e.result.status)}function is(e){return e.type===ln.deferred}function Er(e){return e.type===ln.error}function Ds(e){return(e&&e.type)===ln.redirect}function sv(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function SP(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function lk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function CP(e){return oP.has(e.toLowerCase())}function ei(e){return iP.has(e.toLowerCase())}async function jP(e,t,n,s,a){let c=Object.entries(t);for(let l=0;l<c.length;l++){let[d,f]=c[l],p=e.find(b=>(b==null?void 0:b.route.id)===d);if(!p)continue;let y=s.find(b=>b.route.id===p.route.id),g=y!=null&&!sk(y,p)&&(a&&a[p.route.id])!==void 0;is(f)&&g&&await mm(f,n,!1).then(b=>{b&&(t[d]=b)})}}async function NP(e,t,n){for(let s=0;s<n.length;s++){let{key:a,routeId:c,controller:l}=n[s],d=t[a];e.find(p=>(p==null?void 0:p.route.id)===c)&&is(d)&&(Yt(l,"Expected an AbortController for revalidating fetcher deferred result"),await mm(d,l.signal,!0).then(p=>{p&&(t[a]=p)}))}}async function mm(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:ln.data,data:e.deferredData.unwrappedData}}catch(a){return{type:ln.error,error:a}}return{type:ln.data,data:e.deferredData.data}}}function pm(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Ma(e,t){let n=typeof t=="string"?cs(t).search:t.search;if(e[e.length-1].route.index&&pm(n||""))return e[e.length-1];let s=nk(e);return s[s.length-1]}function ov(e){let{formMethod:t,formAction:n,formEncType:s,text:a,formData:c,json:l}=e;if(!(!t||!n||!s)){if(a!=null)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:void 0,text:a};if(c!=null)return{formMethod:t,formAction:n,formEncType:s,formData:c,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:l,text:void 0}}}function mh(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function PP(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function ka(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function TP(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ns(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function EP(e,t){try{let n=e.sessionStorage.getItem(ik);if(n){let s=JSON.parse(n);for(let[a,c]of Object.entries(s||{}))c&&Array.isArray(c)&&t.set(a,new Set(c||[]))}}catch{}}function RP(e,t){if(t.size>0){let n={};for(let[s,a]of t)n[s]=[...a];try{e.sessionStorage.setItem(ik,JSON.stringify(n))}catch(s){Fs(!1,"Failed to save applied view transitions in sessionStorage ("+s+").")}}}/**
|
|
52
|
+
* React Router v6.30.3
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Remix Software Inc.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
58
|
+
*
|
|
59
|
+
* @license MIT
|
|
60
|
+
*/function Zc(){return Zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Zc.apply(this,arguments)}const vu=v.createContext(null),ck=v.createContext(null),nl=v.createContext(null),gm=v.createContext(null),Mi=v.createContext({outlet:null,matches:[],isDataRoute:!1}),uk=v.createContext(null);function rl(){return v.useContext(gm)!=null}function ri(){return rl()||Yt(!1),v.useContext(gm).location}function dk(e){v.useContext(nl).static||v.useLayoutEffect(e)}function qn(){let{isDataRoute:e}=v.useContext(Mi);return e?qP():MP()}function MP(){rl()||Yt(!1);let e=v.useContext(vu),{basename:t,future:n,navigator:s}=v.useContext(nl),{matches:a}=v.useContext(Mi),{pathname:c}=ri(),l=JSON.stringify(dm(a,n.v7_relativeSplatPath)),d=v.useRef(!1);return dk(()=>{d.current=!0}),v.useCallback(function(p,y){if(y===void 0&&(y={}),!d.current)return;if(typeof p=="number"){s.go(p);return}let g=hm(p,JSON.parse(l),c,y.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:as([t,g.pathname])),(y.replace?s.replace:s.push)(g,y.state,y)},[t,s,l,c,e])}const AP=v.createContext(null);function LP(e){let t=v.useContext(Mi).outlet;return t&&v.createElement(AP.Provider,{value:e},t)}function wu(){let{matches:e}=v.useContext(Mi),t=e[e.length-1];return t?t.params:{}}function IP(e,t,n,s){rl()||Yt(!1);let{navigator:a}=v.useContext(nl),{matches:c}=v.useContext(Mi),l=c[c.length-1],d=l?l.params:{};l&&l.pathname;let f=l?l.pathnameBase:"/";l&&l.route;let p=ri(),y;y=p;let g=y.pathname||"/",b=g;if(f!=="/"){let C=f.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=As(e,{pathname:b});return BP(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:as([f,a.encodeLocation?a.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:as([f,a.encodeLocation?a.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),c,n,s)}function DP(){let e=HP(),t=qa(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:a},n):null,null)}const _P=v.createElement(DP,null);class FP extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(Mi.Provider,{value:this.props.routeContext},v.createElement(uk.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function OP(e){let{routeContext:t,match:n,children:s}=e,a=v.useContext(vu);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Mi.Provider,{value:t},s)}function BP(e,t,n,s){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var c;if(!n)return null;if(n.errors)e=n.matches;else if((c=s)!=null&&c.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,d=(a=n)==null?void 0:a.errors;if(d!=null){let y=l.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);y>=0||Yt(!1),l=l.slice(0,Math.min(l.length,y+1))}let f=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(p=y),g.route.id){let{loaderData:b,errors:x}=n,S=g.route.loader&&b[g.route.id]===void 0&&(!x||x[g.route.id]===void 0);if(g.route.lazy||S){f=!0,p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((y,g,b)=>{let x,S=!1,C=null,j=null;n&&(x=d&&g.route.id?d[g.route.id]:void 0,C=g.route.errorElement||_P,f&&(p<0&&b===0?($P("route-fallback"),S=!0,j=null):p===b&&(S=!0,j=g.route.hydrateFallbackElement||null)));let R=t.concat(l.slice(0,b+1)),L=()=>{let A;return x?A=C:S?A=j:g.route.Component?A=v.createElement(g.route.Component,null):g.route.element?A=g.route.element:A=y,v.createElement(OP,{match:g,routeContext:{outlet:y,matches:R,isDataRoute:n!=null},children:A})};return n&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?v.createElement(FP,{location:n.location,revalidation:n.revalidation,component:C,error:x,children:L(),routeContext:{outlet:null,matches:R,isDataRoute:!0}}):L()},null)}var hk=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(hk||{}),fk=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(fk||{});function WP(e){let t=v.useContext(vu);return t||Yt(!1),t}function UP(e){let t=v.useContext(ck);return t||Yt(!1),t}function zP(e){let t=v.useContext(Mi);return t||Yt(!1),t}function mk(e){let t=zP(),n=t.matches[t.matches.length-1];return n.route.id||Yt(!1),n.route.id}function HP(){var e;let t=v.useContext(uk),n=UP(fk.UseRouteError),s=mk();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function qP(){let{router:e}=WP(hk.UseNavigateStable),t=mk(),n=v.useRef(!1);return dk(()=>{n.current=!0}),v.useCallback(function(a,c){c===void 0&&(c={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Zc({fromRouteId:t},c)))},[e,t])}const av={};function $P(e,t,n){av[e]||(av[e]=!0)}function VP(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Lo(e){let{to:t,replace:n,state:s,relative:a}=e;rl()||Yt(!1);let{future:c,static:l}=v.useContext(nl),{matches:d}=v.useContext(Mi),{pathname:f}=ri(),p=qn(),y=hm(t,dm(d,c.v7_relativeSplatPath),f,a==="path"),g=JSON.stringify(y);return v.useEffect(()=>p(JSON.parse(g),{replace:n,state:s,relative:a}),[p,g,a,n,s]),null}function Nf(e){return LP(e.context)}function GP(e){let{basename:t="/",children:n=null,location:s,navigationType:a=Rn.Pop,navigator:c,static:l=!1,future:d}=e;rl()&&Yt(!1);let f=t.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:f,navigator:c,static:l,future:Zc({v7_relativeSplatPath:!1},d)}),[f,d,c,l]);typeof s=="string"&&(s=cs(s));let{pathname:y="/",search:g="",hash:b="",state:x=null,key:S="default"}=s,C=v.useMemo(()=>{let j=tl(y,f);return j==null?null:{location:{pathname:j,search:g,hash:b,state:x,key:S},navigationType:a}},[f,y,g,b,x,S,a]);return C==null?null:v.createElement(nl.Provider,{value:p},v.createElement(gm.Provider,{children:n,value:C}))}new Promise(()=>{});function KP(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
61
|
+
* React Router DOM v6.30.3
|
|
62
|
+
*
|
|
63
|
+
* Copyright (c) Remix Software Inc.
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the MIT license found in the
|
|
66
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
67
|
+
*
|
|
68
|
+
* @license MIT
|
|
69
|
+
*/function eu(){return eu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},eu.apply(this,arguments)}function Pf(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function QP(e,t){let n=Pf(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(c=>{n.append(a,c)})}),n}const YP="6";try{window.__reactRouterVersion=YP}catch{}function XP(e,t){return dP({basename:void 0,future:eu({},void 0,{v7_prependBasename:!0}),history:IN({window:void 0}),hydrationData:JP(),routes:e,mapRouteProperties:KP,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function JP(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=eu({},t,{errors:ZP(t.errors)})),t}function ZP(e){if(!e)return null;let t=Object.entries(e),n={};for(let[s,a]of t)if(a&&a.__type==="RouteErrorResponse")n[s]=new Jc(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let c=window[a.__subType];if(typeof c=="function")try{let l=new c(a.message);l.stack="",n[s]=l}catch{}}if(n[s]==null){let c=new Error(a.message);c.stack="",n[s]=c}}else n[s]=a;return n}const eT=v.createContext({isTransitioning:!1}),tT=v.createContext(new Map),nT="startTransition",lv=Nj[nT],rT="flushSync",cv=LN[rT];function iT(e){lv?lv(e):e()}function Sa(e){cv?cv(e):e()}class sT{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",t(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",n(s))}})}}function oT(e){let{fallbackElement:t,router:n,future:s}=e,[a,c]=v.useState(n.state),[l,d]=v.useState(),[f,p]=v.useState({isTransitioning:!1}),[y,g]=v.useState(),[b,x]=v.useState(),[S,C]=v.useState(),j=v.useRef(new Map),{v7_startTransition:R}=s||{},L=v.useCallback(_=>{R?iT(_):_()},[R]),A=v.useCallback((_,I)=>{let{deletedFetchers:P,flushSync:U,viewTransitionOpts:G}=I;_.fetchers.forEach((Z,$)=>{Z.data!==void 0&&j.current.set($,Z.data)}),P.forEach(Z=>j.current.delete(Z));let X=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!G||X){U?Sa(()=>c(_)):L(()=>c(_));return}if(U){Sa(()=>{b&&(y&&y.resolve(),b.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:G.currentLocation,nextLocation:G.nextLocation})});let Z=n.window.document.startViewTransition(()=>{Sa(()=>c(_))});Z.finished.finally(()=>{Sa(()=>{g(void 0),x(void 0),d(void 0),p({isTransitioning:!1})})}),Sa(()=>x(Z));return}b?(y&&y.resolve(),b.skipTransition(),C({state:_,currentLocation:G.currentLocation,nextLocation:G.nextLocation})):(d(_),p({isTransitioning:!0,flushSync:!1,currentLocation:G.currentLocation,nextLocation:G.nextLocation}))},[n.window,b,y,j,L]);v.useLayoutEffect(()=>n.subscribe(A),[n,A]),v.useEffect(()=>{f.isTransitioning&&!f.flushSync&&g(new sT)},[f]),v.useEffect(()=>{if(y&&l&&n.window){let _=l,I=y.promise,P=n.window.document.startViewTransition(async()=>{L(()=>c(_)),await I});P.finished.finally(()=>{g(void 0),x(void 0),d(void 0),p({isTransitioning:!1})}),x(P)}},[L,l,y,n.window]),v.useEffect(()=>{y&&l&&a.location.key===l.location.key&&y.resolve()},[y,b,a.location,l]),v.useEffect(()=>{!f.isTransitioning&&S&&(d(S.state),p({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),C(void 0))},[f.isTransitioning,S]),v.useEffect(()=>{},[]);let K=v.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:_=>n.navigate(_),push:(_,I,P)=>n.navigate(_,{state:I,preventScrollReset:P==null?void 0:P.preventScrollReset}),replace:(_,I,P)=>n.navigate(_,{replace:!0,state:I,preventScrollReset:P==null?void 0:P.preventScrollReset})}),[n]),H=n.basename||"/",F=v.useMemo(()=>({router:n,navigator:K,static:!1,basename:H}),[n,K,H]),M=v.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return v.useEffect(()=>VP(s,n.future),[s,n.future]),v.createElement(v.Fragment,null,v.createElement(vu.Provider,{value:F},v.createElement(ck.Provider,{value:a},v.createElement(tT.Provider,{value:j.current},v.createElement(eT.Provider,{value:f},v.createElement(GP,{basename:H,location:a.location,navigationType:a.historyAction,navigator:K,future:M},a.initialized||n.future.v7_partialHydration?v.createElement(aT,{routes:n.routes,future:n.future,state:a}):t))))),null)}const aT=v.memo(lT);function lT(e){let{routes:t,future:n,state:s}=e;return IP(t,void 0,s,n)}var uv;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(uv||(uv={}));var dv;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(dv||(dv={}));function cT(e){let t=v.useRef(Pf(e)),n=v.useRef(!1),s=ri(),a=v.useMemo(()=>QP(s.search,n.current?null:t.current),[s.search]),c=qn(),l=v.useCallback((d,f)=>{const p=Pf(typeof d=="function"?d(a):d);n.current=!0,c("?"+p,f)},[c,a]);return[a,l]}const uT="modulepreload",dT=function(e){return"/"+e},hv={},Eo=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let l=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=l(n.map(p=>{if(p=dT(p),p in hv)return;hv[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":uT,y||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((x,S)=>{b.addEventListener("load",x),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},hT="desktop://window-lifecycle",pk=v.createContext(null),fT=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function mT(e){if(typeof document>"u")return;const{documentElement:t,body:n}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),n&&(n.dataset.runtimePlatform=e.platform,n.dataset.osFamily=e.ui.osFamily,n.dataset.windowControls=e.ui.windowControlsStyle,n.dataset.viewportClass=e.viewportClass,n.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Tf(){var e;if(!(typeof document>"u"))for(const t of fT)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function pT(e){if(typeof document>"u")return;if(!e){Tf();return}const t=[document.documentElement,document.body].filter(s=>!!s),n=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const s of t)for(const[a,c]of n)s.style.setProperty(a,c)}function gT(){if(!(typeof window>"u"))return window.innerWidth}function yT({children:e}){const[t,n]=v.useState(()=>gT()),s=v.useMemo(()=>pi({viewportWidth:t}),[t]);return v.useEffect(()=>{if(typeof window>"u")return;function a(){n(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),v.useEffect(()=>{mT(s)},[s]),v.useEffect(()=>()=>{Tf()},[]),v.useEffect(()=>{let a=!1,c=null;return!s.isDesktop||!s.bridge.supported?()=>{a=!0}:(Eo(()=>Promise.resolve().then(()=>D2),void 0).then(async({listen:l})=>{const d=await l(hT,f=>{const p=f.payload,y=p==null?void 0:p.descriptor;y!=null&&y.windowId&&(s.windows.registerDescriptor(y),p.isOpen?s.windows.markWindowOpen(y.windowId):s.windows.markWindowClosed(y.windowId))});if(a){d();return}c=d}).catch(()=>{}),()=>{a=!0,c==null||c()})},[s]),v.useEffect(()=>{let a=!1,c=null;async function l(){var f,p;const d=await s.bridge.getRuntimeInfo();a||pT(d.ok?(p=(f=d.value)==null?void 0:f.windowChrome)==null?void 0:p.macosTitlebar:null)}return!s.isDesktop||s.ui.osFamily!=="macos"||!s.ui.prefersOverlayTitlebar?(Tf(),()=>{a=!0}):(l(),Eo(()=>Promise.resolve().then(()=>U2),void 0).then(async({getCurrentWindow:d})=>{const f=await d().onScaleChanged(()=>{l()});if(a){f();return}c=f}).catch(()=>{}),()=>{a=!0,c==null||c()})},[s]),i.jsx(pk.Provider,{value:s,children:e})}function Mn(){return v.useContext(pk)??pi()}const vT={common:{appName:"CodingNS",loading:"Loading...",retry:"Retry",back:"Back",save:"Save",logout:"Log out",unknown:"Unknown session",close:"Close",cancel:"Cancel",language:"Language"},auth:{loginTitle:"Resume your coding session",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"Server Preset",serverCustomOption:"Use custom server",serverAddress:"Server Address",serverPlaceholder:"For example: http://127.0.0.1:3002",serverHint:"Login, realtime messages, and terminals all connect through this host. Point the client at the Host API endpoint such as http://127.0.0.1:3002; frontend dev ports like 4174 or 5173 are not meant for packaged clients and only work for temporary debugging when proxying and CORS are configured correctly.",serverInvalid:"Invalid server address. Check it and try again.",serverCurrent:"Current Server",bootstrapTitle:"Complete the first-time bootstrap",bootstrapSubtitle:"This Host does not have an admin account yet. Create the minimal login entry first.",username:"Username",password:"Password",rememberPassword:"Remember Password",confirmPassword:"Confirm Password",submitLogin:"Enter Workspace",submitBootstrap:"Create Admin Account",bootstrapSuccess:"Bootstrap completed. You can log in now.",bootstrapMismatch:"The two passwords do not match.",authUnavailable:"Host is unreachable right now. Check the server and try again.",logoutSuccess:"The current login state has been cleared.",demoBanner:"Demo environment — all account data is public and cleared on logout",demoSessionExpired:"Demo session expired. Please log in again.",serverSettings:"Server Settings",serverSettingsTitle:"Server Configuration",saveServerSettings:"Save Settings"},settings:{title:"Settings",appearance:"Appearance",appearanceSectionSummary:"Language, theme, and interface colors",language:"Language",languageDescription:"Choose the display language used by the interface.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",fileManager:"File Manager",showSystemFiles:"Show system files",showSystemFilesDescription:"Display common macOS and Windows system files in the file manager, such as .DS_Store and Thumbs.db. This setting only applies to the current device.",serverConnection:"Server Connection",serverConnectionSectionSummary:"Server address and reconnection behavior",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",runtimePersistentLabel:"Persistent Session",runtimePersistentShortLabel:"persist",runtimeTmuxDescription:"Use a persistent external session, ideal for development terminals that should stay alive.",runtimeWindowsPersistentDescription:"Use a Windows persistent session backed by ConPTY so the shell can survive Host restarts.",runtimeEmbeddedDescription:"Managed directly by the current Host and useful as the lightweight fallback.",runtimeConptyPowerShellLabel:"PowerShell Persistent",runtimeConptyCmdLabel:"CMD Persistent",runtimeConptyGitBashLabel:"Git Bash Persistent",runtimeMissingDialogTitle:"tmux is not installed on this system",runtimeMissingDialogDescription:"The tmux runtime cannot create a persistent terminal right now. Install tmux first, or temporarily switch to embedded-pty to continue.",runtimeMissingInstallDescription:"Installing tmux is recommended if you want terminals to survive Host restarts.",runtimeMissingInstallMacArm:"macOS (Apple Silicon / Homebrew): arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS (Intel Mac / Homebrew): brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian: sudo apt install tmux",runtimeMissingInstallFedora:"Fedora: sudo dnf install tmux",runtimeMissingFallbackDescription:"If you switch to embedded-pty now, the terminal can still start, but it will not stay as an external persistent session.",runtimeMissingKeepAction:"Not now",runtimeMissingFallbackAction:"Switch to embedded-pty",runtimeMissingFallbackPending:"Switching...",shellUnavailable:"Unavailable",workspaceLoadFailed:"The workspace or terminal list is not available right now.",terminalSection:"Terminal Instances",templateSection:"Command Templates",stageEmptyTitle:"No terminal selected yet",stageEmptySubtitle:"Create a terminal first, or run a command template.",emptyTerminals:"There is no terminal instance in the current workspace yet.",emptyTemplates:"There is no command template in the current workspace yet.",createButton:"Create Terminal",creating:"Creating terminal...",creationPendingDescription:"Host is starting the real PTY. This pane will take over as soon as the stream is ready.",defaultTerminalName:"Workspace Terminal",created:"The terminal has been created and connected to Host.",createFailed:"Failed to create terminal.",closeButton:"Close Terminal",closing:"Closing terminal...",closed:"The terminal close request has been submitted.",closeCompleted:"Terminal closed.",closePendingDescription:"The close request has been sent to Host. The page stays responsive and keeps syncing the final result in the background.",closeSyncDelayed:"Host is still finishing the close in the background. The list will keep syncing on the next refresh.",closeFailed:"Failed to close terminal.",inputLabel:"Send command to current terminal",inputPlaceholder:"For example: npm test",sendButton:"Send to Terminal",inputFailed:"Failed to send terminal input.",outputEmpty:"The terminal is connected, but there is no output yet.",outputTruncated:"Some output exceeded the cache window while disconnected. Only the retained part has been restored.",connectedHint:"Current output is coming from the real PTY stream on Host.",moreActions:"Terminal Actions",duplicateAction:"Duplicate Tab",duplicateSuccess:"A new terminal tab has been created with the same setup.",duplicateFailed:"Failed to duplicate the terminal tab.",disconnectAction:"Disconnect",disconnected:"Terminal connection has been disconnected.",reconnectAction:"Reconnect",reconnectRequested:"Reconnect request sent.",deleteAction:"Delete",deleting:"Deleting terminal...",deleted:"Terminal record deleted.",deletePendingDescription:"The delete request has been sent to Host. The page stays responsive and keeps syncing the list in the background.",deleteSyncDelayed:"Host is still finishing the delete in the background. The list will keep syncing on the next refresh.",deleteFailed:"Failed to delete the terminal record.",closePendingBadge:"Closing",deletePendingBadge:"Deleting",pinAction:"Pin",unpinAction:"Unpin",zoomLabel:"Terminal Zoom",zoomInAction:"Zoom in terminal display",zoomOutAction:"Zoom out terminal display",zoomResetAction:"Reset terminal zoom",toolbarToggleAction:"Open terminal toolbar",mobileSwipeHint:"Swipe left or right to switch terminals",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"Open quick terminal list",mobileDrawerTitle:"Quick Terminals",mobileDrawerDescription:"Swipe right to reveal the list, then tap to jump to another terminal.",mobilePinnedSectionTitle:"Pinned Terminals",mobileDrawerEmptyTitle:"No terminals yet",mobileDrawerEmptyDescription:"Create one first and the quick switcher will appear here.",mobileCreateSheetTitle:"Create Terminal",mobileCreateShellLabel:"Terminal Type",mobileCreateShellDescription:"Pick the shell for this terminal instead of squeezing desktop dropdowns onto mobile.",mobileCreateRuntimeLabel:"Session Type",mobileCreateRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",mobileCreateLoadingShells:"Loading available terminal types for this system...",mobileCreateConfirm:"Create this terminal",createDialogTitle:"Create Terminal",createDialogShellDescription:"Choose the shell for this terminal before creation. On Windows we should not silently fall back to CMD anymore.",createDialogRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",createDialogConfirm:"Create Terminal",mobileRuntimePersistentTitle:"Persistent Session",mobileRuntimePersistentDescription:"Best for development terminals that should stay alive and reconnect as a recoverable session.",mobileRuntimeSessionTitle:"runtime (current session)",mobileRuntimeSessionDescription:"Managed directly by the current Host. Lighter, but not an external persistent session.",mobileWorkspaceSwitcherPlaceholder:"Choose Workspace",mobileEmptyTitle:"No terminal content yet",mobileEmptyDescription:"Create a terminal first, or swipe right to open the quick list and switch to an existing one.",layoutLabel:"Layout",layoutSingleAction:"Single pane",layoutVerticalAction:"Split left and right",layoutHorizontalAction:"Split top and bottom",saveLogAction:"Save Log",saveLogSuccess:"The terminal log has been saved.",saveLogFailed:"Failed to save the terminal log.",logEmpty:"There is no terminal log to save yet.",bindToPaneAction:"Bind to current pane",bindToPrimaryPaneAction:"Bind to main pane",bindToSecondaryPaneAction:"Bind to side pane",panePrimary:"Main Pane",paneSecondary:"Side Pane",splitEmptySubtitle:"Pick a tab or create a terminal first, then bind it to this pane.",statusBadge:{creating:"starting",running:"running",closed:"closed",error:"error"},recoveryComplete:"Recovered to the terminal from before refresh. Key cached output has been restored.",recoveryTruncated:"Recovered to the previous terminal, but some disconnected output exceeded the cache window.",recoveryIdleClosed:"The previous terminal was auto-closed by Host after being idle too long. You are seeing the output kept before close.",reconnect:"Reconnect",liveConnected:"Live stream connected",templateName:"Template Name",templateCommand:"Main Command",templateArgs:"Arguments (space separated)",templateCreateButton:"Save Template",templateCreated:"The command template has been saved.",templateCreateFailed:"Failed to save the command template.",templateRunSent:"The command template has been sent to the current terminal.",templateRunCreatedTerminal:"The command template started in a new terminal.",templateRunFailed:"Failed to run the command template.",connection:{connected:"Connected",reconnecting:"Reconnecting",reconnect_failed:"Reconnect failed",closed:"Closed"}},conversation:{titleFallback:"Continue Conversation",historyLoading:"Loading message history from Host...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Message history is not available right now. Try again later.",timelineEmpty:"There are no messages in this session yet. Your first message will go straight into the Host chain.",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",reconnectExplain:"The realtime link is broken. The system is replaying missing messages.",reconnectFailedExplain:"Automatic recovery failed. Retry manually, or reopen the session later.",capabilityDenied:"This action is not supported in the current session.",capabilitySendDisabled:"The current provider does not support sending new messages.",capabilityAttachmentDisabled:"This session does not support attachment input yet.",capabilityInterruptDisabled:"This session does not support interruption.",sidebarTitle:"Current Session Context",sidebarSubtitle:"This sidebar only keeps the minimum capability summary. It does not turn the page into an admin console.",reconnectButton:"Restore Realtime Sync",headerResumedAt:"Last Resumed",headerLastSyncAt:"Last Synced",historyPages:"History Pages",syncStatusIdle:"Sync Idle",syncStatusSyncing:"Syncing",syncStatusError:"Sync Error",capabilityResume:"Resumable",capabilitySend:"Send Enabled",capabilityInterrupt:"Interrupt Enabled",capabilityTools:"Tool Calls",attachmentsLabel:"Attachments",filePanelTitle:"File Manager",filePanelSubtitle:"File capabilities here only serve the current session. This is not a heavy IDE shell.",filePanelNoWorkspace:"There is no selected workspace yet. Browsing or attaching files is unavailable.",filePanelRefresh:"Refresh",filePanelCopyPath:"Copy Path",filePanelCopyAbsolutePath:"Copy Absolute Path",filePanelCopyRelativePath:"Copy Relative Path",filePanelCopyAbsolutePathSuccess:"Absolute path copied.",filePanelCopyRelativePathSuccess:"Relative path copied.",filePanelCopyPathFailed:"Failed to copy the path.",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelFilterChanges:"Changes Only",filePanelShowAll:"Show All",filePanelNoChanges:"No changed files.",filePanelBinaryPreview:"Binary files cannot be previewed.",filePanelDeleteConfirm:"Delete this file? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",preview:"Preview",stageFailed:"Stage operation failed.",diffTitle:"Diff Preview",diffLoadFailed:"Diff content is not available right now.",binaryDiff:"This file is a binary change. The sidebar does not render its content directly.",stagedDiff:"Staged diff",worktreeDiff:"Working tree diff",emptyDiff:"There is no text diff to display right now.",diffTruncated:"The diff is too long and has been truncated for safety.",commitTitle:"Commit Draft",defaultRuleName:"Default Commit Rule",language:"Language",maxLength:"Max Length",bodyRequired:"Body Required",bodyOptional:"Body Optional",issueRequired:"Issue Required",issueOptional:"Issue Optional",commitSubject:"Commit Subject",commitSubjectPlaceholder:"Enter the commit message here",commitBody:"Commit Body",commitBodyPlaceholder:"Explain the change clearly. Do not write empty words.",commitFooter:"Commit Footer",commitFooterPlaceholder:"For example: Refs: #123",generateDraft:"AI Draft",validate:"Validate Draft",commit:"Commit",draftFailed:"Failed to generate the commit draft.",validateFailed:"Commit rule validation failed.",commitFailed:"Commit failed.",commitSuccess:"The commit has been written to the current repository.",validationPassed:"Rule validation passed. You can continue to commit.",validationFailed:"Rule validation failed. Fix the issues below first.",branchTitle:"Branch",branchPlaceholder:"Enter the branch name to switch to or create",switchBranch:"Switch",createBranch:"Create",branchFailed:"Branch operation failed.",historyTitle:"Recent History",historyHint:"Only keep the latest few entries here. This is not a graphical history tree.",noHistory:"There is no commit history to show right now.",remoteTitle:"Remote Sync",remoteReady:"A remote is configured for the current repository.",remoteMissing:"The current repository has no remote configured yet.",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"Push Now",publish:"Publish",remoteFailed:"Remote sync failed.",selectRemoteTitle:"Select Remote to Push",selectRemoteDesc:"Select remote repositories to push to. Multiple selection supported.",noRemotes:"No remote repositories are configured.",pushSelected:"Push ({count})",pushing:"Pushing…",pushAllSuccess:"Successfully pushed to {count} remote(s).",errors:{unauthorized:"The current login is no longer valid. Log in again and retry.",workspaceNotFound:"The workspace bound to the current session does not exist. Check whether it is still available.",invalidWorkspace:"The current workspace config is invalid. The Git sidebar must not operate outside the repo root.",notGitRepository:"The current workspace is not a Git repository. The Git sidebar will not fake a state.",repoNotFound:"No usable Git repository root was found for the current workspace.",pathOutOfWorkspace:"The Git target is outside the current workspace repository boundary. The operation was blocked.",invalidTarget:"The Git target path is invalid. Refresh the sidebar and try again.",notStaged:"The target file is not staged yet. Check the current change state first.",emptyStagedChanges:"The staging area is empty. Stage the changes before committing.",branchConflict:"The current branch has conflicts or is not a fast-forward update. Sync and resolve differences first.",branchNotFound:"The target branch does not exist. Check the branch name first.",remoteNotFound:"The current repository does not have a usable origin remote yet.",remoteAuthFailed:"Remote repository authentication failed. Check the current credentials first.",pushFailed:"Push failed. Check remote state and local commits first.",pullFailed:"Pull failed. Check the remote branch state first.",remoteFailed:"Remote sync failed. Check Git output and network state.",commitValidationFailed:"The commit draft has not passed validation yet. Fix validation issues first.",commandTimeout:"The Git operation timed out. Check repository state and network conditions."}},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"},locale:{zhCN:"Simplified Chinese",enUS:"English"}},wT={common:{appName:"CodingNS",loading:"正在准备会话工作区…",retry:"重新尝试",back:"返回",save:"保存",close:"关闭",cancel:"取消",logout:"退出登录",unknown:"未命名会话"},auth:{loginTitle:"继续你的编码会话",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"服务器列表",serverCustomOption:"使用自定义服务器",serverAddress:"服务器地址",serverPlaceholder:"例如:http://127.0.0.1:3002",serverHint:"登录、实时消息和终端都会连接到这里。客户端应填写 Host API 地址,例如 http://127.0.0.1:3002;4174、5173 这类前端开发端口不是给正式客户端直接连接的,只有代理和跨域都配好时才适合临时调试。",serverInvalid:"服务器地址无效,请检查后再试。",serverCurrent:"当前服务器",bootstrapTitle:"先完成首次初始化",bootstrapSubtitle:"这个 Host 还没有管理员账号,先创建一个最小登录入口。",username:"用户名",password:"密码",rememberPassword:"保存密码",confirmPassword:"确认密码",submitLogin:"进入工作台",submitBootstrap:"创建管理员账号",bootstrapSuccess:"初始化完成,现在可以登录了。",bootstrapMismatch:"两次输入的密码不一致。",authUnavailable:"暂时连不上 Host,请确认服务可访问。",logoutSuccess:"当前登录态已经清空。",demoBanner:"演示环境 — 所有账号数据公开可见,注销后自动清除",demoSessionExpired:"演示会话已过期,请重新登录",serverSettings:"服务器设置",serverSettingsTitle:"服务器配置",saveServerSettings:"保存设置"},settings:{title:"设置",appearance:"外观",appearanceSectionSummary:"语言、主题与界面配色",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",fileManager:"文件管理",showSystemFiles:"显示系统文件",showSystemFilesDescription:"在文件管理里显示 macOS 和 Windows 常见的系统文件,例如 .DS_Store、Thumbs.db。这个开关只影响当前设备。",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",runtimePersistentLabel:"持久会话",runtimePersistentShortLabel:"持久",runtimeTmuxDescription:"持久化外部会话,适合需要后台常驻的开发终端。",runtimeWindowsPersistentDescription:"使用基于 ConPTY 的 Windows 持久化会话,让终端在 Host 重启后仍可继续保留。",runtimeEmbeddedDescription:"由当前 Host 直接托管,适合作为轻量回退方案。",runtimeConptyPowerShellLabel:"PowerShell 持久会话",runtimeConptyCmdLabel:"CMD 持久会话",runtimeConptyGitBashLabel:"Git Bash 持久会话",runtimeMissingDialogTitle:"当前系统没有安装 tmux",runtimeMissingDialogDescription:"tmux runtime 无法继续创建持久化终端。你可以先安装 tmux,或者临时切换到 embedded-pty 继续。",runtimeMissingInstallDescription:"建议优先安装 tmux,这样终端才能在 Host 重启后继续保留。",runtimeMissingInstallMacArm:"macOS(Apple Silicon / Homebrew):arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS(Intel Mac / Homebrew):brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian:sudo apt install tmux",runtimeMissingInstallFedora:"Fedora:sudo dnf install tmux",runtimeMissingFallbackDescription:"如果现在先切到 embedded-pty,本次终端可以继续创建,但它不会作为外部持久会话保留。",runtimeMissingKeepAction:"先不切换",runtimeMissingFallbackAction:"切换到 embedded-pty 并继续",runtimeMissingFallbackPending:"正在切换…",shellUnavailable:"当前不可用",workspaceLoadFailed:"工作区或终端列表暂时没有拉回来。",terminalSection:"终端实例",templateSection:"命令模板",stageEmptyTitle:"还没有选中终端",stageEmptySubtitle:"先创建一个终端,或者运行一个命令模板。",emptyTerminals:"当前工作区还没有终端实例。",emptyTemplates:"当前工作区还没有命令模板。",createButton:"新建终端",creating:"正在创建终端…",creationPendingDescription:"Host 正在启动真实 PTY,连上以后这个窗口会立刻接管显示。",defaultTerminalName:"工作终端",created:"终端已经创建并接入 Host。",createFailed:"终端创建失败。",closeButton:"关闭终端",closing:"正在关闭终端…",closed:"终端关闭请求已经提交。",closeCompleted:"终端已关闭。",closePendingDescription:"关闭请求已经发给 Host,前台不会阻塞,系统会继续同步最终结果。",closeSyncDelayed:"Host 还在后台处理关闭,列表会在后续刷新时继续同步。",closeFailed:"终端关闭失败。",inputLabel:"向当前终端发送命令",inputPlaceholder:"例如:pnpm test",sendButton:"发送到终端",inputFailed:"终端输入发送失败。",outputEmpty:"终端已经连上,但暂时还没有输出。",outputTruncated:"断线期间有一段输出超出缓存窗口,当前只补回了仍保留的部分。",connectedHint:"当前输出来自 Host 真实 PTY 流。",moreActions:"终端操作",duplicateAction:"复制标签",duplicateSuccess:"已按当前终端配置新建一个标签。",duplicateFailed:"复制终端标签失败。",disconnectAction:"断开",disconnected:"终端连接已断开。",reconnectAction:"重连",reconnectRequested:"终端重连请求已发出。",deleteAction:"删除",deleting:"正在删除终端…",deleted:"终端记录已删除。",deletePendingDescription:"删除请求已经发给 Host,前台不会阻塞,系统会在后台继续同步列表。",deleteSyncDelayed:"Host 还在后台处理删除,列表会在后续刷新时继续同步。",deleteFailed:"终端记录删除失败。",closePendingBadge:"关闭中",deletePendingBadge:"删除中",pinAction:"固定",unpinAction:"取消固定",zoomLabel:"终端缩放",zoomInAction:"放大终端显示",zoomOutAction:"缩小终端显示",zoomResetAction:"恢复默认缩放",toolbarToggleAction:"展开终端工具栏",mobileSwipeHint:"左右滑动切换终端",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"打开快捷终端列表",mobileDrawerTitle:"快捷终端",mobileDrawerDescription:"右滑呼出列表,点一下就切到别的终端。",mobilePinnedSectionTitle:"已固定终端",mobileDrawerEmptyTitle:"当前还没有终端",mobileDrawerEmptyDescription:"先新建一个终端,这里才会出现可切换的列表。",mobileCreateSheetTitle:"新建终端",mobileCreateShellLabel:"终端类型",mobileCreateShellDescription:"先选这次要开的 Shell,别把桌面端那套下拉框搬到手机上。",mobileCreateRuntimeLabel:"会话方式",mobileCreateRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",mobileCreateLoadingShells:"正在读取当前系统可用的终端类型…",mobileCreateConfirm:"创建这个终端",createDialogTitle:"新建终端",createDialogShellDescription:"先选这次要开的 Shell,再创建终端。Windows 下不再偷偷按默认值直接起。",createDialogRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",createDialogConfirm:"创建终端",mobileRuntimePersistentTitle:"持久会话",mobileRuntimePersistentDescription:"适合需要一直挂着的开发终端,创建后会作为可恢复会话保留。",mobileRuntimeSessionTitle:"runtime(当前会话)",mobileRuntimeSessionDescription:"直接由当前 Host 托管,创建更轻,但不会保留成外部持久会话。",mobileWorkspaceSwitcherPlaceholder:"选择项目",mobileEmptyTitle:"这里还没有终端内容",mobileEmptyDescription:"先新建一个终端,或者右滑呼出快捷列表,切到当前工作区已有的终端。",layoutLabel:"分栏布局",layoutSingleAction:"单栏显示",layoutVerticalAction:"左右分栏",layoutHorizontalAction:"上下分栏",saveLogAction:"保存日志",saveLogSuccess:"终端日志已保存。",saveLogFailed:"终端日志保存失败。",logEmpty:"当前终端还没有可保存的日志内容。",bindToPaneAction:"绑定到当前分栏",bindToPrimaryPaneAction:"绑定到主分栏",bindToSecondaryPaneAction:"绑定到副分栏",panePrimary:"主分栏",paneSecondary:"副分栏",splitEmptySubtitle:"先点一个标签,或者新建一个终端,把它绑定到当前分栏。",statusBadge:{creating:"启动中",running:"运行中",closed:"已关闭",error:"异常"},recoveryComplete:"已回到刷新前的终端,缓存内的关键输出已经补回。",recoveryTruncated:"已恢复到上一个终端,但断线期间的部分输出已经超出缓存窗口。",recoveryIdleClosed:"上一个终端已因空闲超时被 Host 自动关闭,你现在看到的是关闭前保留的输出。",reconnect:"手动重连",liveConnected:"实时流已接入",templateName:"模板名称",templateCommand:"主命令",templateArgs:"参数(空格分隔)",templateCreateButton:"保存模板",templateCreated:"命令模板已经保存。",templateCreateFailed:"命令模板保存失败。",templateRunSent:"命令模板已经发送到当前终端。",templateRunCreatedTerminal:"命令模板已在新终端中启动。",templateRunFailed:"命令模板执行失败。",connection:{connected:"已连接",reconnecting:"正在重连",reconnect_failed:"重连失败",closed:"已关闭"}},conversation:{titleFallback:"继续对话",historyLoading:"正在从 Host 拉取消息历史…",historyLoadingOlder:"正在加载更早的消息…",historyLoadFailed:"历史消息暂时没有拉回来,可以稍后再试。",timelineEmpty:"这条会话还没有消息。你发出的第一句话会直接进入 Host 链路。",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelFilterChanges:"仅显示变更",filePanelShowAll:"显示全部",filePanelNoChanges:"当前没有变更文件。",filePanelBinaryPreview:"二进制文件不支持预览。",filePanelDeleteConfirm:"确认删除这个文件吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",preview:"预览",stageFailed:"暂存操作失败。",diffTitle:"差异预览",diffLoadFailed:"差异内容暂时没有拉回来。",binaryDiff:"这个文件是二进制改动,侧栏不直接展示内容。",stagedDiff:"暂存区 diff",worktreeDiff:"工作区 diff",emptyDiff:"当前没有可展示的文本差异。",diffTruncated:"差异内容过长,已经做了截断保护。",commitTitle:"提交草稿",defaultRuleName:"默认提交规则",language:"语言",maxLength:"长度",bodyRequired:"正文必填",bodyOptional:"正文可选",issueRequired:"Issue 必填",issueOptional:"Issue 可选",commitSubject:"提交标题",commitSubjectPlaceholder:"在这里输入提交信息",commitBody:"提交正文",commitBodyPlaceholder:"把这次改动说清楚,别写空话。",commitFooter:"提交脚注",commitFooterPlaceholder:"例如:Refs: #123",generateDraft:"AI 起草",validate:"校验草稿",commit:"执行提交",draftFailed:"提交草稿生成失败。",validateFailed:"提交规则校验失败。",commitFailed:"提交失败。",commitSuccess:"提交已经写入当前仓库。",validationPassed:"规则校验通过,可以继续提交。",validationFailed:"规则校验没有通过,先把下面的问题修掉。",branchTitle:"分支",branchPlaceholder:"输入要切换或创建的分支名",switchBranch:"切换",createBranch:"新建",branchFailed:"分支操作失败。",historyTitle:"最近历史",historyHint:"只放最近几条,不做图形历史树。",noHistory:"当前没有可展示的提交历史。",remoteTitle:"远程同步",remoteReady:"当前仓库已配置远程。",remoteMissing:"当前仓库还没有远程。",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"立即推送",publish:"Publish",remoteFailed:"远程同步失败。",selectRemoteTitle:"选择推送仓库",selectRemoteDesc:"勾选要推送到的远程仓库,支持多选。",noRemotes:"当前仓库没有配置任何远程仓库。",pushSelected:"推送 ({count})",pushing:"推送中…",pushAllSuccess:"已成功推送到 {count} 个远程仓库。",errors:{unauthorized:"当前登录态已经失效,请重新登录后再试。",workspaceNotFound:"当前会话绑定的工作区不存在,先确认工作区是否还可用。",invalidWorkspace:"当前工作区配置无效,Git 侧栏不能脱离仓库根目录执行。",notGitRepository:"当前工作区不是 Git 仓库,Git 侧栏不会伪造状态。",repoNotFound:"当前工作区找不到可用的 Git 仓库根目录。",pathOutOfWorkspace:"Git 目标超出了当前工作区仓库边界,操作已被拦截。",invalidTarget:"Git 目标路径无效,请先刷新侧栏后重试。",notStaged:"目标文件还不在暂存区里,先确认当前变更状态。",emptyStagedChanges:"暂存区为空,先把要提交的改动放进暂存区。",branchConflict:"当前分支存在冲突或不是快进更新,先同步并处理差异。",branchNotFound:"目标分支不存在,先确认分支名是否正确。",remoteNotFound:"当前仓库还没有可用的 origin 远程,先配置远程再同步。",remoteAuthFailed:"远程仓库认证失败,请先确认当前仓库凭据可用。",pushFailed:"推送失败,请先检查远程状态和本地提交。",pullFailed:"拉取失败,请先确认远程分支状态。",remoteFailed:"远程同步失败,请检查 Git 输出和网络状态。",commitValidationFailed:"提交草稿还没通过规则校验,先把校验问题修掉。",commandTimeout:"Git 操作超时了,先确认仓库状态和网络环境。"}}},bT=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function ym({variant:e="default",className:t}){const n=Ao(a=>a.profile.language);function s(a){a!==n&&Yc({language:a}).catch(()=>{})}return i.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[i.jsx("span",{className:"language-switcher-label",children:h("common.language")}),i.jsx("div",{className:"language-switcher-options",role:"group","aria-label":h("common.language"),children:bT.map(a=>i.jsx("button",{type:"button",className:`language-switcher-option${n===a.id?" active":""}`,"aria-pressed":n===a.id,onClick:()=>s(a.id),children:h(a.labelKey)},a.id))})]})}const xT={common:{close:"关闭",cancel:"取消",logout:"退出登录",language:"语言"},locale:{zhCN:"简体中文",enUS:"English"},settings:{title:"设置",appearance:"外观",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",connection:"连接与更新",serverAddress:"服务地址",serverDescription:"桌面端和 H5 都通过这个 Host 入口工作。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",notificationSettings:"通知",notificationSettingsDescription:"单独控制会话相关的系统通知提醒。",notifyOnPermissionRequest:"会话等待审批时通知",notifyOnPermissionRequestDescription:"后台会话出现新的权限申请时推送通知。",notifyOnSessionCompleted:"会话完成时通知",notifyOnSessionCompletedDescription:"后台会话变为已完成时推送通知。",notifyOnSessionFailed:"会话异常时通知",notifyOnSessionFailedDescription:"后台会话运行失败时推送通知。",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",runtimePlatform:"当前运行平台",runtimePlatformDescription:"用来确认现在是 Web/H5、Desktop、iOS 还是 Android 运行环境。",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"当前是 Web/H5 运行环境,不支持桌面更新。",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",account:"账号",logout:"退出登录",logoutDescription:"退出当前账号并返回登录页面"},shell:{title:"工作台",subtitle:"管理代码项目里的 AI 会话",mobileWorkspacesEntry:"工作区",mobileTerminalsEntry:"终端",mobileSessionsEntry:"对话",mobileToolsEntry:"工具",mobileSettingsEntry:"设置",mobileNavigationAction:"打开工作台菜单",mobileSearchAction:"打开搜索",mobileAuxiliaryAction:"打开工具面板",mobileRevealNavigationAction:"显示主导航",mobileHideNavigationAction:"收起主导航",mobileConversationPreviewTitle:"快速预览",mobileConversationCurrentWorkspaceSection:"当前工作区",mobileConversationCollapsePreviewAction:"收起预览",mobileConversationRestorePreviewAction:"恢复会话预览",iosMoreAction:"更多操作",androidMoreAction:"更多操作",conversationEntry:"对话",terminalsEntry:"终端",searchEntry:"搜索",searchModalTitle:"搜索",searchModalDescription:"支持搜会话标题,或在当前工作区里搜代码文件。",searchModeLabel:"搜索模式",searchModeSessions:"会话",searchModeCode:"代码",searchKeywordLabel:"关键词",searchWorkspaceLabel:"工作区",searchSessionPlaceholder:"输入会话名称、工作区或 provider",searchCodePlaceholder:"输入文件名或路径片段",searchSessionHint:"输入关键词后,这里会立即列出匹配的会话。",searchCodeHint:"选一个工作区,然后搜文件名或路径。",searchSessionEmpty:"没找到匹配的会话。",searchCodeEmpty:"没找到匹配的文件。",searchCodeFailed:"代码搜索失败,请稍后重试。",searchSubmit:"开始搜索",filesEntry:"文件管理",gitEntry:"GIT管理",terminalManagerEntry:"进程管理",workspaceSectionTitle:"工作区",goBack:"后退",goForward:"前进",workspaceCount:"项目",sessionCount:"会话",manageWorkspaceAction:"管理项目",manageWorkspaceTitle:"管理项目",manageWorkspaceDescription:"默认只列出当前已加载的项目,展开后可以查看路径、Git 摘要、代码类型组成,也可以从当前工作台列表里移除。",manageWorkspaceEmpty:"当前没有可管理的项目。",manageWorkspaceLoading:"正在读取项目详情...",manageWorkspaceLoadFailed:"项目详情加载失败",manageWorkspacePathLabel:"路径",manageWorkspaceGitCommitCount:"Git 提交版本数",manageWorkspaceGitInfoLabel:"Git 仓库信息",manageWorkspaceRepoRoot:"仓库根目录",manageWorkspaceCurrentBranch:"当前分支",manageWorkspaceRemoteLabel:"远程",manageWorkspaceNoRemote:"未配置远程",manageWorkspaceNotGit:"当前项目不是 Git 仓库。",manageWorkspaceCodeCompositionLabel:"代码类型组成",manageWorkspaceCodeCompositionFiles:"文件",manageWorkspaceCodeCompositionOther:"其他",manageWorkspaceNoCodeComposition:"暂时没有识别到可统计的代码文件。",manageWorkspaceCodeTruncated:"文件过多,只统计了前 {count} 个可识别文件。",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",subagentBadge:"子代理",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子代理",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",switchWorkspace:"切换到此项目",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"待看",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerOptionHint:"选择后会立即创建会话",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",attachmentSourceSheetTitle:"添加图片",attachmentSourceSheetDescription:"选择直接拍照,或从相册里挑一张现有图片。",attachmentTakePhoto:"拍照",attachmentTakePhotoHint:"直接打开相机拍一张新图片",attachmentChooseFromLibrary:"从相册选择",attachmentChooseFromLibraryHint:"从手机相册或图片库里挑选",pasteImagesHint:"支持直接粘贴图片",attachmentImageOnly:"目前只支持图片附件",attachmentReadFailed:"图片读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"点击查看大图",attachmentPreviewClose:"关闭图片预览",attachmentPreviewLoading:"图片加载中",attachmentPreviewUnavailable:"图片暂时不可预览",imageAttachmentLabel:"图片附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",applyPatchEditedLabel:"已编辑",applyPatchAddedLabel:"已新增",applyPatchDeletedLabel:"已删除",applyPatchDialogTitle:"Patch 变更预览",applyPatchDialogDescription:"这里按文件显示 apply_patch 将要执行的变更。",applyPatchOpenDiff:"查看 diff",applyPatchAddedStat:"新增",applyPatchRemovedStat:"减少",applyPatchEmpty:"这个 patch 暂时没有可展示的文件变更。",titleFallback:"继续对话",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"工作区",headerWorkspaceUnknown:"未知工作区",headerProvider:"Provider",headerConnection:"连接",headerRuntime:"运行态",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"可发送",queueTitle:"待发队列",queueDescription:"当前运行结束后,会按顺序自动继续处理下面的消息。",queueOrderPrefix:"等待顺序",queueStatusQueued:"等待中",queueStatusFailed:"续跑失败",queueDelete:"删除",queueDeleting:"删除中",permissionRequestSectionTitle:"待处理审批",permissionRequestSectionDescription:"这里把供应商原生的权限申请统一收口,不再让你面对三套不同的确认框。",permissionRequestToastTitle:"需要审批",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"会话已完成",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"会话异常",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"回复权限申请失败。",permissionRequestSubmitting:"提交中...",permissionRequestReasonLabel:"原因",permissionRequestCommandLabel:"命令",permissionRequestToolLabel:"工具",permissionRequestCwdLabel:"工作目录",permissionRequestPathsLabel:"相关路径",permissionRequestPermissionsLabel:"申请权限",permissionRequestReadLabel:"读取",permissionRequestWriteLabel:"写入",permissionRequestNetworkLabel:"网络",permissionRequestQuestionsLabel:"补充问题",permissionRequestDetailLabel:"详情",permissionRequestEmpty:"无",permissionRequestUnknown:"未知",permissionRequestKindCommand:"命令",permissionRequestKindFileChange:"文件改动",permissionRequestKindPermissions:"权限扩展",permissionRequestKindUserInput:"补充输入",permissionRequestKindToolCall:"工具调用",queueImageOnly:"只包含图片附件",sendGuidanceButton:"追加指导",queueGuidanceButton:"加入队列",capabilityDenied:"受限",capabilitySendDisabled:"发送受限",connectionConnected:"实时已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeIdle:"空闲",runtimeStarting:"启动中",runtimeRunning:"运行中",runtimeReconnecting:"恢复中",runtimeStale:"运行待确认",runtimeUnknown:"状态待确认",runtimeCompleted:"已完成",runtimeInterrupted:"已中断",runtimeFailed:"失败",rulesMessageTitle:"规则信息",rulesMessageHint:"这是一段会话启动规则,默认折叠显示,需要时再展开查看。",rulesMessageExpand:"展开规则",rulesMessageCollapse:"收起规则",thinkingLabel:"思考中",filePanelWorkspaceTab:"工作区",filePanelSessionTab:"本次会话",filePanelSessionViewLabel:"本次会话视图",filePanelSessionTreeView:"树状",filePanelSessionListView:"列表",filePanelSessionLoading:"正在整理本次会话修改的文件...",filePanelSessionEmpty:"这条会话还没识别到可暂存的修改文件。",filePanelSessionNoSession:"当前只选中了项目,还没选中会话,无法查看“本次会话”文件。",filePanelSessionStageAll:"全部暂存",filePanelSessionStageSuccess:"已把本次会话的修改加入暂存区。",filePanelSessionLoadFailed:"本次会话修改文件加载失败。",filePanelSessionSummary:"已识别文件",filePanelSessionUnstagedSummary:"未暂存",filePanelSessionDeleted:"已删除"},git:{recentVersionsTitle:"最近版本",stagedChangesTitle:"暂存的更改",expandRecentVersions:"展开最近版本",collapseRecentVersions:"折叠最近版本",stagedLabel:"暂存区",workingTreeLabel:"工作区",changeTreeHint:"按目录层级展示当前变更",discard:"放弃改动",discardFailed:"放弃改动失败",operationMenu:"操作菜单",currentBranch:"当前分支",resizePanels:"调整文件区和最近版本高度",switchBranchTo:"切换到",undoLastCommit:"撤销上次提交",undoLastCommitFailed:"撤销上次提交失败",undoLastCommitSuccess:"已撤销上次提交",historyKindLocal:"本地",historyKindRemote:"远程",historyKindShared:"已同步",pushNow:"推送",commitNow:"提交",refreshNow:"刷新",stageAll:"暂存全部",unstageAll:"取消暂存全部",discardAll:"放弃全部改动",selectedFiles:"已选文件",clearSelection:"清空选中",selectFile:"选中文件",discardConfirm:"确认放弃这些改动吗?{path}",historyItemMenu:"版本操作",copyCommitHash:"复制 Commit Hash",copyCommitHashSuccess:"Commit Hash 已复制。",copyCommitSubject:"复制提交标题",copyCommitSubjectSuccess:"提交标题已复制。"},terminalManager:{workspaceField:"当前工作区",refresh:"刷新列表",loadFailed:"终端管理面板加载失败",shellLoadFailed:"终端 Shell 列表加载失败",emptyWorkspaceBody:"还没有可用工作区。",noCurrentWorkspaceBody:"先选中一条会话,进程管理才能绑定对应的工作区。",emptyTerminalBody:"当前工作区还没有终端实例。",emptyTemplateBody:"还没有快捷启动项,可以先保存一条命令或脚本。",shellField:"新终端 Shell",shellUnavailable:"当前不可用",cwdField:"启动目录",cwdLabel:"目录",cwdPlaceholder:"留空时默认使用工作区根目录",modeField:"启动方式",commandMode:"命令",scriptMode:"脚本",quickLaunchTitle:"快捷启动",quickLaunchDescription:"先保存启动方式,需要时一键拉起到新终端。",desktopPanelDescription:"默认只看启动决策所需的信息,路径和命令行收进详情层。",runningCountLabel:"运行中",portWatchCountLabel:"已监控端口",terminalCountLabel:"终端数",templateSectionTitle:"启动项",templateSectionDescription:"右侧优先显示启动项的端口状态,看清楚是否已被占用。",openCreateModalAction:"添加快捷启动项",createModalTitle:"添加快捷启动项",createModalDescription:"在这里保存命令或脚本,可以附带端口,后面就能一键启动并判断是否在跑。",editAction:"编辑启动项",editModalTitle:"编辑快捷启动项",editModalDescription:"直接修改这条快捷启动的名称、命令、目录和端口配置。",saveTemplateChangesAction:"保存修改",templateUpdating:"保存修改中...",templateUpdateSuccess:"快捷启动项已更新。",templateUpdateFailed:"快捷启动项更新失败",removeAction:"移除启动项",templateRemoving:"移除中...",removeConfirmTitle:"确认移除启动项",removeConfirmAction:"确认移除",removeConfirmTarget:"确认移除“{name}”吗?移除后将不再出现在快捷启动列表中。",removeRunningConfirmTarget:"“{name}”对应的进程还在跑。现在移除的是启动项配置,不会自动结束已经运行的进程。确认继续吗?",templateDeleteSuccess:"快捷启动项已移除。",templateDeleteFailed:"快捷启动项移除失败",terminalSectionTitle:"终端实例",terminalSectionDescription:"这里显示当前工作区由 CodingNS 托管的终端。",closeAction:"关闭终端",closing:"关闭中...",closeSuccess:"终端关闭请求已提交。",closeFailed:"终端关闭失败",createTerminalAction:"新建空终端",creatingTerminal:"创建中...",createTerminalSuccess:"新终端已创建。",createTerminalFailed:"新终端创建失败",defaultTerminalName:"工作终端",templateNameField:"名称",templateNamePlaceholder:"留空时会自动生成",commandField:"启动命令",commandPlaceholder:"例如:npm",scriptPathField:"脚本路径",scriptPathPlaceholder:"例如:scripts/dev.ps1 或 scripts/dev.sh",argsField:"参数",argsPlaceholder:"例如:run dev 或 --watch",portField:"监听端口",portLabel:"端口",portPlaceholder:"例如:3000",proxyField:"反向代理",proxyToggleLabel:"开启反向代理",proxyEnabled:"代理已启用",proxyEnabledDescription:"开启后会生成随机 URL 码,可通过 /proxy/地址访问当前开发服务。",proxyDisabledDescription:"未开启反向代理",proxyPortRequired:"开启反向代理时,必须同时配置端口",openProxyUrlAction:"在浏览器打开代理地址",openProxyUrlFailed:"打开代理地址失败",invalidPort:"端口必须是 1 到 65535 的整数",saveLaunchAction:"保存为快速启动",templateSaving:"保存中...",templateSaveSuccess:"快捷启动项已保存。",templateSaveFailed:"快捷启动项保存失败",runTemplateAction:"启动到新终端",runningTemplate:"启动中...",templateRunSuccess:"快捷启动已发送到新终端。",templateRunFailed:"快捷启动执行失败",showDetailsAction:"显示详细信息",hideDetailsAction:"隐藏详细信息",detailsSectionTitle:"启动项详情",commandPreviewLabel:"启动命令",processIdLabel:"进程 ID",processCommandLabel:"进程命令行",stopProcessAction:"结束进程",stoppingProcess:"结束中...",stopProcessSuccess:"监听进程已结束。",stopProcessFailed:"监听进程结束失败",defaultCommandName:"新启动命令",defaultScriptName:"新启动脚本",lastActiveAt:"最近活跃",updatedAt:"最后更新",processCommandFallback:"这个进程没有暴露命令行",portUnset:"未配置端口",portUnsetDescription:"没有端口时,只能启动,不能自动判断服务是否在跑。",portOccupied:"进程已启动",portAvailable:"端口暂未被占用",portAvailableDescription:"这个启动项对应的端口目前还没有监听进程。",statusRunning:"运行中",statusStopped:"未运行",exitCode:"Exit Code",runningValue:"运行中"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"主题"}},kT={common:{close:"Close",cancel:"Cancel",logout:"Log out",language:"Language"},locale:{zhCN:"Simplified Chinese",enUS:"English"},settings:{title:"Settings",appearance:"Appearance",language:"Language",languageDescription:"Choose the display language used by the interface. The page updates immediately.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",connection:"Connection & Updates",serverAddress:"Server Address",serverDescription:"Desktop and H5 both work through this host entry.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",notificationSettings:"Notifications",notificationSettingsDescription:"Control each session-related system notification independently.",notifyOnPermissionRequest:"Notify on permission requests",notifyOnPermissionRequestDescription:"Notify when a background session needs a new permission approval.",notifyOnSessionCompleted:"Notify when sessions complete",notifyOnSessionCompletedDescription:"Notify when a background session finishes.",notifyOnSessionFailed:"Notify when sessions fail",notifyOnSessionFailedDescription:"Notify when a background session fails.",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",runtimePlatform:"Runtime Platform",runtimePlatformDescription:"Shows whether the app is running in Web/H5, Desktop, iOS, or Android.",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"Desktop updates are not available in the current Web/H5 runtime.",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",account:"Account",logout:"Log out",logoutDescription:"Sign out of the current account and return to the login page."},shell:{title:"Workbench",subtitle:"Manage AI sessions inside code projects",mobileWorkspacesEntry:"Workspaces",mobileTerminalsEntry:"Terminal",mobileSessionsEntry:"Conversation",mobileToolsEntry:"Tools",mobileSettingsEntry:"Settings",mobileNavigationAction:"Open workbench menu",mobileSearchAction:"Open search",mobileAuxiliaryAction:"Open tools panel",mobileRevealNavigationAction:"Show primary navigation",mobileHideNavigationAction:"Hide primary navigation",mobileConversationPreviewTitle:"Quick Preview",mobileConversationCurrentWorkspaceSection:"Current Workspace",mobileConversationCollapsePreviewAction:"Hide Preview",mobileConversationRestorePreviewAction:"Restore Session Preview",iosMoreAction:"More actions",androidMoreAction:"More actions",conversationEntry:"Conversation",terminalsEntry:"Terminal",searchEntry:"Search",searchModalTitle:"Search",searchModalDescription:"Search sessions by title, or search code files inside the selected workspace.",searchModeLabel:"Search mode",searchModeSessions:"Sessions",searchModeCode:"Code",searchKeywordLabel:"Keyword",searchWorkspaceLabel:"Workspace",searchSessionPlaceholder:"Search by session title, workspace, or provider",searchCodePlaceholder:"Search by file name or path fragment",searchSessionHint:"Type a keyword to instantly filter matching sessions.",searchCodeHint:"Pick a workspace, then search by file name or path.",searchSessionEmpty:"No matching sessions found.",searchCodeEmpty:"No matching files found.",searchCodeFailed:"Code search failed. Please try again later.",searchSubmit:"Search",filesEntry:"Files",gitEntry:"Git",terminalManagerEntry:"Process Manager",workspaceSectionTitle:"Workspaces",goBack:"Back",goForward:"Forward",workspaceCount:"Projects",sessionCount:"Sessions",manageWorkspaceAction:"Manage Projects",manageWorkspaceTitle:"Manage Projects",manageWorkspaceDescription:"The list starts with the currently loaded projects. Expand one to inspect its path, Git summary, and code composition, or remove it from the current workbench list.",manageWorkspaceEmpty:"There are no projects to manage right now.",manageWorkspaceLoading:"Loading project details...",manageWorkspaceLoadFailed:"Failed to load project details.",manageWorkspacePathLabel:"Path",manageWorkspaceGitCommitCount:"Git Commit Count",manageWorkspaceGitInfoLabel:"Git Repository Info",manageWorkspaceRepoRoot:"Repository Root",manageWorkspaceCurrentBranch:"Current Branch",manageWorkspaceRemoteLabel:"Remote",manageWorkspaceNoRemote:"No remote configured",manageWorkspaceNotGit:"This project is not a Git repository.",manageWorkspaceCodeCompositionLabel:"Code Composition",manageWorkspaceCodeCompositionFiles:"files",manageWorkspaceCodeCompositionOther:"Other",manageWorkspaceNoCodeComposition:"No recognizable code files were found for composition stats.",manageWorkspaceCodeTruncated:"The project is large, so only the first {count} recognizable files were counted.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",subagentBadge:"Sub-agent",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",switchWorkspace:"Switch to Project",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"Review",workspaceHomeMetricTerminal:"Terminals",workspaceHomeMetricChanges:"Changes",workspaceHomeActiveSessionsSectionTitle:"Active Sessions",workspaceHomeQuickLaunchStatusLabel:"Quick Launch Process",workspaceHomeQuickLaunchRunning:"Running",workspaceHomeQuickLaunchStopped:"Stopped",workspaceHomeWaitingInputLabel:"Waiting Input",workspaceOverviewTitle:"Put project entry points where you can actually see them",workspaceOverviewBody:"Choose a project first, then decide whether to continue or start a new session.",workspaceListBody:"Keep every loaded project here and surface the frequent actions on the page.",workspaceDetailTitle:"Project Details",workspaceDetailSummaryTitle:"Project Overview",workspaceDetailSummaryBody:"See the path, Git summary, and code footprint first, then jump into the right tool.",workspaceDetailMissingTitle:"Project not found",workspaceDetailMissingBody:"This project may have been removed, or the current snapshot has not loaded it yet.",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",providerOptionHint:"A session is created immediately after selection",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",attachmentSourceSheetTitle:"Add Image",attachmentSourceSheetDescription:"Take a new photo now, or choose one from the photo library.",attachmentTakePhoto:"Take Photo",attachmentTakePhotoHint:"Open the camera and capture a new image",attachmentChooseFromLibrary:"Choose from Library",attachmentChooseFromLibraryHint:"Pick an existing image from the system photo library",pasteImagesHint:"Supports pasting images directly",attachmentImageOnly:"Only image attachments are supported right now",attachmentReadFailed:"Failed to read image. Retry.",attachmentPreviewAlt:"Selected image preview",attachmentPreviewOpen:"Click to view full image",attachmentPreviewClose:"Close image preview",attachmentPreviewLoading:"Loading image...",attachmentPreviewUnavailable:"Image preview unavailable",imageAttachmentLabel:"Image Attachment",imagePreviewTitle:"Image Preview",imagePreviewHint:"Click the backdrop or press Esc to close the preview",removeAttachment:"Remove Attachment",modelSelectorLabel:"Model",modelUseCliDefault:"Default",modelUseCodexConfig:"Follow current Codex config",modelUseOpenCodeConfig:"Follow current OpenCode config",reasoningSelectorLabel:"Reasoning Effort",reasoningLow:"Low",reasoningMedium:"Medium",reasoningHigh:"High",reasoningMaximum:"Maximum",slashMenu:"Commands",slashMenuTitle:"Quick Commands",slashCommandPlan:"Ask for an execution plan first",slashCommandReview:"Switch directly to code review mode",slashCommandExplain:"Ask for a clearer explanation",toolInputLabel:"Input",toolResultLabel:"Result",toolResultEmpty:"No output yet",toolPreviewCommand:"Command",toolPreviewTerminal:"Terminal",toolStatusRunning:"Running",toolStatusFailed:"Failed",toolStatusCompleted:"Completed",applyPatchEditedLabel:"Edited",applyPatchAddedLabel:"Added",applyPatchDeletedLabel:"Deleted",applyPatchDialogTitle:"Patch Change Preview",applyPatchDialogDescription:"This shows the file-level changes that apply_patch is about to perform.",applyPatchOpenDiff:"View Diff",applyPatchAddedStat:"Added",applyPatchRemovedStat:"Removed",applyPatchEmpty:"This patch does not contain any file change that can be displayed right now.",titleFallback:"Continue Conversation",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"Workspace",headerWorkspaceUnknown:"Unknown Workspace",headerProvider:"Provider",headerConnection:"Connection",headerRuntime:"Runtime",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"Send Enabled",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"Session completed",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"Session failed",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",capabilityDenied:"Restricted",capabilitySendDisabled:"Sending disabled",connectionConnected:"Realtime connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeIdle:"Idle",runtimeStarting:"Starting",runtimeRunning:"Running",runtimeReconnecting:"Recovering",runtimeStale:"Awaiting confirmation",runtimeUnknown:"Status pending",runtimeCompleted:"Completed",runtimeInterrupted:"Interrupted",runtimeFailed:"Failed",rulesMessageTitle:"Rules",rulesMessageHint:"This is the startup rule block for the session. It is collapsed by default and can be expanded when needed.",rulesMessageExpand:"Expand Rules",rulesMessageCollapse:"Collapse Rules",thinkingLabel:"Thinking",filePanelWorkspaceTab:"Workspace",filePanelSessionTab:"Session",filePanelSessionViewLabel:"Session File View",filePanelSessionTreeView:"Tree",filePanelSessionListView:"List",filePanelSessionLoading:"Collecting files changed in this session...",filePanelSessionEmpty:"No cacheable changed files have been detected in this session yet.",filePanelSessionNoSession:"Only the workspace is selected right now. Pick a session before viewing session-scoped files.",filePanelSessionStageAll:"Stage All",filePanelSessionStageSuccess:"Changes from this session have been added to the staging area.",filePanelSessionLoadFailed:"Failed to load changed files for this session.",filePanelSessionSummary:"Detected Files",filePanelSessionUnstagedSummary:"Unstaged",filePanelSessionDeleted:"Deleted"},git:{recentVersionsTitle:"Recent Versions",stagedChangesTitle:"Staged Changes",expandRecentVersions:"Expand Recent Versions",collapseRecentVersions:"Collapse Recent Versions",stagedLabel:"Staged",workingTreeLabel:"Working Tree",changeTreeHint:"Show current changes by directory hierarchy",discard:"Discard Changes",discardFailed:"Failed to discard changes",operationMenu:"Actions",currentBranch:"Current Branch",resizePanels:"Resize file and recent-version panels",switchBranchTo:"Switch To",undoLastCommit:"Undo Last Commit",undoLastCommitFailed:"Failed to undo last commit",undoLastCommitSuccess:"Last commit undone",historyKindLocal:"Local",historyKindRemote:"Remote",historyKindShared:"Synced",pushNow:"Push",commitNow:"Commit",refreshNow:"Refresh",stageAll:"Stage All",unstageAll:"Unstage All",discardAll:"Discard All Changes",selectedFiles:"Selected Files",clearSelection:"Clear Selection",selectFile:"Select File",discardConfirm:"Discard these changes? {path}",historyItemMenu:"Commit Actions",copyCommitHash:"Copy Commit Hash",copyCommitHashSuccess:"Commit hash copied.",copyCommitSubject:"Copy Commit Title",copyCommitSubjectSuccess:"Commit title copied."},terminalManager:{workspaceField:"Current Workspace",refresh:"Refresh List",loadFailed:"Failed to load the terminal management panel",shellLoadFailed:"Failed to load the terminal shell list",emptyWorkspaceBody:"There is no available workspace yet.",noCurrentWorkspaceBody:"Select a session first so process management can bind to its workspace.",emptyTerminalBody:"There is no terminal instance in the current workspace yet.",emptyTemplateBody:"There is no quick launch item yet. Save a command or script first.",shellField:"Shell for New Terminal",shellUnavailable:"Unavailable",cwdField:"Startup Directory",cwdLabel:"Directory",cwdPlaceholder:"Defaults to the workspace root when left empty",modeField:"Launch Mode",commandMode:"Command",scriptMode:"Script",quickLaunchTitle:"Quick Launch",quickLaunchDescription:"Save a launch preset here so you can start it in a new terminal with one click later.",desktopPanelDescription:"Keep the default view focused on launch decisions, while paths and command lines stay inside the details layer.",runningCountLabel:"Running",portWatchCountLabel:"Watched Ports",terminalCountLabel:"Terminals",templateSectionTitle:"Launch Items",templateSectionDescription:"The right side prioritizes the port status of launch items so you can see whether a service is already in use.",openCreateModalAction:"Add Quick Launch Item",createModalTitle:"Add Quick Launch Item",createModalDescription:"Save a command or script here. You can attach a port and then start it with one click while checking whether it is already running.",editAction:"Edit Launch Item",editModalTitle:"Edit Quick Launch Item",editModalDescription:"Update the name, command, directory, and port for this quick launch item.",saveTemplateChangesAction:"Save Changes",templateUpdating:"Saving changes...",templateUpdateSuccess:"Quick launch item updated.",templateUpdateFailed:"Failed to update quick launch item",removeAction:"Remove Launch Item",templateRemoving:"Removing...",removeConfirmTitle:"Remove Quick Launch Item",removeConfirmAction:"Remove Item",removeConfirmTarget:'Remove "{name}"? It will disappear from the quick launch list after removal.',removeRunningConfirmTarget:'"{name}" is still running. Removing it only deletes the launch item configuration and will not stop the active process. Continue?',templateDeleteSuccess:"Quick launch item removed.",templateDeleteFailed:"Failed to remove quick launch item",terminalSectionTitle:"Terminal Instances",terminalSectionDescription:"This area shows terminals currently managed by CodingNS for the workspace.",closeAction:"Close Terminal",closing:"Closing...",closeSuccess:"Terminal close request submitted.",closeFailed:"Failed to close terminal",createTerminalAction:"New Empty Terminal",creatingTerminal:"Creating...",createTerminalSuccess:"New terminal created.",createTerminalFailed:"Failed to create a new terminal",defaultTerminalName:"Workspace Terminal",templateNameField:"Name",templateNamePlaceholder:"Generated automatically when left empty",commandField:"Launch Command",commandPlaceholder:"For example: npm",scriptPathField:"Script Path",scriptPathPlaceholder:"For example: scripts/dev.ps1 or scripts/dev.sh",argsField:"Arguments",argsPlaceholder:"For example: run dev or --watch",portField:"Listening Port",portLabel:"Port",portPlaceholder:"For example: 3000",proxyField:"Reverse Proxy",proxyToggleLabel:"Enable Reverse Proxy",proxyEnabled:"Proxy Enabled",proxyEnabledDescription:"When enabled, the system generates a random URL code and exposes your dev service under /proxy/.",proxyDisabledDescription:"Reverse proxy is disabled",proxyPortRequired:"A listening port is required when reverse proxy is enabled",openProxyUrlAction:"Open Proxy URL",openProxyUrlFailed:"Failed to open proxy URL",invalidPort:"Port must be an integer between 1 and 65535",saveLaunchAction:"Save as Quick Launch",templateSaving:"Saving...",templateSaveSuccess:"Quick launch item saved.",templateSaveFailed:"Failed to save quick launch item",runTemplateAction:"Run in New Terminal",runningTemplate:"Starting...",templateRunSuccess:"Quick launch item sent to a new terminal.",templateRunFailed:"Failed to run quick launch item",showDetailsAction:"Show details",hideDetailsAction:"Hide details",detailsSectionTitle:"Launch item details",commandPreviewLabel:"Launch Command",processIdLabel:"Process ID",processCommandLabel:"Process Command Line",stopProcessAction:"Stop Process",stoppingProcess:"Stopping...",stopProcessSuccess:"The listening process has been stopped.",stopProcessFailed:"Failed to stop the listening process",defaultCommandName:"New Launch Command",defaultScriptName:"New Launch Script",lastActiveAt:"Last Active",updatedAt:"Updated At",processCommandFallback:"This process did not expose its command line",portUnset:"Port Not Configured",portUnsetDescription:"Without a port, the item can only be started. The system cannot determine automatically whether the service is running.",portOccupied:"Process Started",portAvailable:"Port Available",portAvailableDescription:"There is currently no listening process on the port used by this launch item.",statusRunning:"Running",statusStopped:"Stopped",exitCode:"Exit Code",runningValue:"Running"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"}},gk={"zh-CN":wT,"en-US":vT},yk={"zh-CN":xT,"en-US":kT};function tu(e,t){const n=e.split(".");let s=t;for(const a of n){if(!s||typeof s=="string")return e;const c=s[a];if(c==null)return e;s=c}return typeof s=="string"?s:e}function ST(){return ni.getState().profile.language??"zh-CN"}function h(e,t){const s=ST()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const a of s){const c=tu(e,yk[a]);if(c!==e)return ph(c,t);const l=tu(e,gk[a]);if(l!==e)return ph(l,t)}return ph(e,t)}function ph(e,t){return t?e.replace(/\{([^}]+)\}/g,(n,s)=>{const a=t[s];return a==null?n:String(a)}):e}function CT({children:e,language:t}){return v.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function jT(){const e=Ao(t=>t.profile.language);return t=>{const n=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const s of n){const a=tu(t,yk[s]);if(a!==t)return a;const c=tu(t,gk[s]);if(c!==t)return c}return t}}const vk=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function wk(e){return h(e.labelKey)}function NT(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function PT(){return ni.getState().profile.theme??NT()}function TT(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),Yc({theme:e}).catch(()=>{}))}function bk(){return{theme:Ao(t=>t.profile.theme),setTheme:TT}}function ET(){typeof window>"u"||document.documentElement.setAttribute("data-theme",PT())}function RT({children:e}){const t=Ao(n=>n.profile.theme);return v.useEffect(()=>{ET()},[t]),i.jsx(i.Fragment,{children:e})}const MT={showToast:()=>"",dismissToast:()=>{}},xk=v.createContext(MT);function AT(){return`toast-${Math.random().toString(36).slice(2,10)}`}function LT({toast:e,onDismiss:t}){const{id:n,title:s,description:a,tone:c,durationMs:l,action:d}=e;return v.useEffect(()=>{if(l===null)return;const f=window.setTimeout(()=>{t(n)},l);return()=>{window.clearTimeout(f)}},[l,n,t,s,a,c]),i.jsxs("article",{className:"toast-card","data-tone":c,role:c==="error"?"alert":"status",children:[i.jsxs("div",{className:"toast-body",children:[i.jsx("strong",{className:"toast-title",children:s}),a?i.jsx("p",{className:"toast-description",children:a}):null]}),i.jsxs("div",{className:"toast-actions",children:[d?i.jsx("button",{className:"toast-action",type:"button",onClick:()=>{d.onClick(),t(n)},children:d.label}):null,i.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(n),children:"×"})]})]})}function IT({children:e}){const[t,n]=v.useState([]),s=v.useCallback(l=>{n(d=>d.filter(f=>f.id!==l))},[]),a=v.useCallback(l=>{const d=l.id??AT(),f={id:d,title:l.title,description:l.description,tone:l.tone??"info",durationMs:l.durationMs===void 0?4200:l.durationMs,action:l.action};return n(p=>{const y=p.findIndex(b=>b.id===d);if(y===-1)return[...p,f];const g=[...p];return g[y]=f,g}),d},[]),c=v.useMemo(()=>({showToast:a,dismissToast:s}),[s,a]);return i.jsxs(xk.Provider,{value:c,children:[e,i.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(l=>i.jsx(LT,{toast:l,onDismiss:s},l.id))})]})}function Yn(){return v.useContext(xk)}const Ic="0.1.4",kk=v.createContext(Ic);function DT({children:e}){const t=Mn(),[n,s]=v.useState(Ic);return v.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(c=>{var d,f;if(a)return;const l=c.ok?(f=(d=c.value)==null?void 0:d.version)==null?void 0:f.trim():"";s(l||Ic)}),()=>{a=!0}):(s(Ic),()=>{a=!0})},[t]),i.jsx(kk.Provider,{value:n,children:e})}function Sk(){return v.useContext(kk)}const Ck="codingns.server.base-url.history",jk=6,Nk="__custom__";function Pk(){return typeof window<"u"&&typeof window.localStorage<"u"}function _T(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function Tk(e){if(!e)return null;try{return Ri(e)}catch{return null}}function FT(){if(!Pk())return[];const e=window.localStorage.getItem(Ck);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(n=>typeof n=="string"?Tk(n):null).filter(n=>!!n):[]}catch{return[]}}function OT(e){const t=new Set,n=[];for(const s of e)!s||t.has(s)||(t.add(s),n.push(s));return n}function BT(e){const t=FT();return OT([e,...t,Tk(_T())]).slice(0,jk)}function WT(e){Pk()&&window.localStorage.setItem(Ck,JSON.stringify(e.slice(0,jk)))}class UT{constructor(){Be(this,"state",this.createState(Fn.getState().hostBaseUrl));Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state);Fn.subscribe(()=>{const t=this.createState(Fn.getState().hostBaseUrl);t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((n,s)=>n===this.state.options[s])||(this.state=t,this.emit())})}setBaseUrl(t){const n=Ri(t),s=n!==Fn.getState().hostBaseUrl;return this.state=this.createState(n),this.emit(),Fn.update({hostBaseUrl:n}),s}reset(){this.state=this.createState(Fn.getState().hostBaseUrl),this.emit()}createState(t){const n=BT(t);return WT(n),{baseUrl:t,options:n}}emit(){for(const t of this.listeners)t()}}const nu=new UT;function ru(e){return v.useSyncExternalStore(nu.subscribe,()=>e(nu.getState()))}function zT(e,t){return t.includes(e)?e:Nk}function HT(){return Nk}const Ek={login(e,t,n){return vn.login(e,t,n)},bootstrap(e,t,n){return vn.bootstrap(e,t,n)},refresh(){return vn.refresh()},logout(){vn.clear()}};function qT(){const e=qn(),t=ru(C=>C.baseUrl),[n,s]=v.useState("admin"),[a,c]=v.useState(""),[l,d]=v.useState(""),[f,p]=v.useState(null),[y,g]=v.useState("error"),[b,x]=v.useState(!1);async function S(C){if(C.preventDefault(),a!==l){g("error"),p(h("auth.bootstrapMismatch"));return}x(!0),p(null);try{await Ek.bootstrap(n,a),g("success"),p(h("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(j){g("error"),j instanceof lr?p(j.message):p(h("auth.authUnavailable"))}finally{x(!1)}}return i.jsx("main",{className:"page-center app-shell",children:i.jsxs("section",{className:"auth-card surface-card",children:[i.jsx("h1",{children:h("auth.bootstrapTitle")}),i.jsx("p",{className:"status-text",children:h("auth.bootstrapSubtitle")}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("auth.serverCurrent")}),i.jsx("span",{className:"auth-server-value",children:t})]}),i.jsxs("form",{className:"auth-form",onSubmit:S,children:[i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.username")}),i.jsx("input",{value:n,onChange:C=>s(C.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.password")}),i.jsx("input",{type:"password",value:a,onChange:C=>c(C.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.confirmPassword")}),i.jsx("input",{type:"password",value:l,onChange:C=>d(C.target.value)})]}),f?i.jsx("p",{className:"status-text","data-tone":y,children:f}):null,i.jsx("button",{className:"primary-button",type:"submit",disabled:b,children:h(b?"common.loading":"auth.submitBootstrap")})]})]})})}async function $T(e){try{return{...await uN(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function VT({isOpen:e,onClose:t,onSave:n,theme:s="dark"}){const a=ru(L=>L.baseUrl),c=ru(L=>L.options),l=HT(),[d,f]=v.useState(a),[p,y]=v.useState(null),g=v.useMemo(()=>{try{return Ri(d)}catch{return null}},[d]),b=zT(g??d,c),x="server-settings-preset",S="server-settings-address";if(v.useEffect(()=>{e&&(f(a),y(null))},[e,a]),!e)return null;function C(){if(!g){y(h("auth.serverInvalid"));return}nu.setBaseUrl(g),n==null||n(g),t()}function j(L){L.target===L.currentTarget&&t()}function R(){g&&f(g)}return i.jsx("div",{className:"server-settings-modal-backdrop","data-theme":s,onClick:j,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:i.jsxs("div",{className:"server-settings-modal",children:[i.jsxs("div",{className:"server-settings-modal-header",children:[i.jsx("div",{className:"cyber-header-line"}),i.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[i.jsx("span",{className:"cyber-title-icon",children:"◈"}),h("auth.serverSettingsTitle")]}),i.jsx("div",{className:"cyber-header-line"}),i.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":h("common.close"),children:"×"})]}),i.jsxs("div",{className:"server-settings-modal-content",children:[i.jsxs("label",{className:"field-group cyber-field",htmlFor:x,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverPreset")}),i.jsxs("div",{className:"cyber-select-wrapper",children:[i.jsxs("select",{id:x,"aria-label":h("auth.serverPreset"),className:"cyber-select",value:b,onChange:L=>{const A=L.target.value;A!==l&&(f(A),y(null))},children:[c.map(L=>i.jsx("option",{value:L,children:L},L)),i.jsx("option",{value:l,children:h("auth.serverCustomOption")})]}),i.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),i.jsxs("label",{className:"field-group cyber-field",htmlFor:S,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverAddress")}),i.jsxs("div",{className:"cyber-input-wrapper",children:[i.jsx("input",{id:S,"aria-label":h("auth.serverAddress"),className:"cyber-input",value:d,placeholder:h("auth.serverPlaceholder"),onBlur:R,onChange:L=>{f(L.target.value),y(null)}}),i.jsx("div",{className:"cyber-input-glow"})]})]}),i.jsxs("p",{className:"cyber-hint",children:[i.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),h("auth.serverHint")]}),p?i.jsxs("p",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p]}):null]}),i.jsxs("div",{className:"server-settings-modal-footer",children:[i.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:h("common.cancel")}),i.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:C,children:[i.jsx("span",{className:"cyber-button-glow"}),i.jsx("span",{className:"cyber-button-text",children:h("auth.saveServerSettings")})]})]})]})})}const fv="width=device-width, initial-scale=1.0, viewport-fit=cover",GT="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function KT(){const e=v.useRef(null);return v.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");if(!n)return;let s;const a=()=>{l(),d()};let c=[];const l=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{c=[];const p=Math.min(50,Math.floor(t.width*t.height/25e3));for(let y=0;y<p;y++)c.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},f=()=>{n.clearRect(0,0,t.width,t.height),c.forEach((p,y)=>{p.x+=p.vx,p.y+=p.vy,p.x<0&&(p.x=t.width),p.x>t.width&&(p.x=0),p.y<0&&(p.y=t.height),p.y>t.height&&(p.y=0),n.beginPath(),n.arc(p.x,p.y,p.size,0,Math.PI*2),n.fillStyle=`rgba(10, 132, 255, ${p.opacity})`,n.fill(),c.slice(y+1).forEach(g=>{const b=p.x-g.x,x=p.y-g.y,S=Math.sqrt(b*b+x*x);S<150&&(n.beginPath(),n.moveTo(p.x,p.y),n.lineTo(g.x,g.y),n.strokeStyle=`rgba(10, 132, 255, ${.1*(1-S/150)})`,n.stroke())})}),s=requestAnimationFrame(f)};return l(),d(),f(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(s)}},[]),i.jsx("canvas",{ref:e,className:"particle-canvas"})}function QT({text:e}){return i.jsx("span",{className:"glitch-text","data-text":e,children:e})}function YT({text:e}){const[t,n]=v.useState(""),[s,a]=v.useState(!0);return v.useEffect(()=>{let c=0,l=null;const d=setInterval(()=>{c<=e.length?(n(e.slice(0,c)),c++):(clearInterval(d),l=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(d),l!==null&&window.clearTimeout(l)}},[e]),i.jsxs("span",{className:"typewriter-text",children:[t,s&&i.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function XT(){const e=qn(),t=jT(),[n]=cT(),s=Mn(),a=Sk(),c=am(s.platform),l=v.useMemo(()=>Tj(s),[s]),d=v.useMemo(()=>l?Nx():null,[l]),f=(d==null?void 0:d.serverBaseUrl)??null,[p,y]=v.useState(()=>(d==null?void 0:d.username)??"admin"),[g,b]=v.useState(()=>(d==null?void 0:d.password)??""),[x,S]=v.useState(()=>!!d),C=ru(te=>te.baseUrl),[j,R]=v.useState(C),[L,A]=v.useState(null),[K,H]=v.useState(!1),[F,M]=v.useState(!1),[_,I]=v.useState(null),[P,U]=v.useState(!1),G=Ux(te=>te.session),X=v.useMemo(()=>n.get("returnTo")??"/",[n]),{theme:Z}=bk(),$=v.useRef(!1),se=s.isNativeMobile,Y=v.useMemo(()=>Z==="light"?"light":"dark",[Z]);v.useEffect(()=>{if(typeof document>"u")return;const te=document.querySelector('meta[name="viewport"]');if(!(te instanceof HTMLMetaElement))return;const T=te.getAttribute("content")??fv;return se?te.setAttribute("content",GT):te.setAttribute("content",fv),()=>{te.setAttribute("content",T)}},[se]),v.useEffect(()=>{$.current||($.current=!0,!(!l||!f||f===C)&&(nu.setBaseUrl(f),R(f)))},[C,l,f]),v.useEffect(()=>{if(G){e(X,{replace:!0});return}if(!j)return;let te=!1;return $T(j).then(T=>{te||(T.demoMode&&(U(!0),cN()&&A(t("auth.demoSessionExpired"))),T.reachable&&!T.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{te||A(t("auth.authUnavailable"))}),()=>{te=!0}},[G,e,j,X,t]);async function q(te){te.preventDefault(),H(!0),A(null),R(C),l&&!x&&Rj();try{await Ek.login(p,g,C),await ni.refreshForAuthenticatedUser(),l&&x&&Px({username:p,password:g,serverBaseUrl:C}),e(X,{replace:!0})}catch(T){if(T instanceof lr){if(T.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}A(T.message)}else A(t("auth.authUnavailable"))}finally{H(!1)}}function oe(te){R(te),A(null)}const E="login-username",B="login-password";return i.jsxs("main",{className:"cyber-login-page","data-theme":Y,"data-native-mobile":se?"true":"false",children:[i.jsxs("div",{className:"cyber-bg",children:[i.jsx("div",{className:"cyber-grid"}),i.jsx("div",{className:"cyber-glow cyber-glow-1"}),i.jsx("div",{className:"cyber-glow cyber-glow-2"}),i.jsx(KT,{})]}),i.jsx("div",{className:"scanlines"}),i.jsxs("div",{className:"cyber-login-container",children:[i.jsx("div",{className:"cyber-login-toolbar",children:i.jsx(ym,{variant:"compact"})}),i.jsxs("div",{className:"cyber-login-content",children:[i.jsxs("div",{className:"cyber-brand",children:[i.jsx("div",{className:"cyber-logo",children:i.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),i.jsx("h1",{className:"cyber-brand-title",children:i.jsx(QT,{text:"CodingNS"})}),i.jsx("p",{className:"cyber-brand-subtitle",children:i.jsx(YT,{text:t("auth.loginSubtitle")})})]}),i.jsxs("div",{className:"cyber-card",children:[i.jsx("div",{className:"cyber-corner corner-tl"}),i.jsx("div",{className:"cyber-corner corner-tr"}),i.jsx("div",{className:"cyber-corner corner-bl"}),i.jsx("div",{className:"cyber-corner corner-br"}),i.jsxs("div",{className:"cyber-card-header",children:[i.jsx("div",{className:"cyber-line"}),i.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),i.jsx("div",{className:"cyber-line"})]}),P?i.jsxs("div",{className:"cyber-demo-banner",children:[i.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),i.jsx("span",{children:t("auth.demoBanner")})]}):null,i.jsxs("form",{className:"cyber-form",onSubmit:q,children:[i.jsxs("div",{className:`cyber-field ${_==="username"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:E,children:[i.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),i.jsx("input",{id:E,"aria-label":t("auth.username"),className:"cyber-input",value:p,onChange:te=>y(te.target.value),onFocus:()=>I("username"),onBlur:()=>I(null),autoComplete:"username"})]}),i.jsxs("div",{className:`cyber-field ${_==="password"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:B,children:[i.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),i.jsx("input",{id:B,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:g,onChange:te=>b(te.target.value),onFocus:()=>I("password"),onBlur:()=>I(null),autoComplete:"current-password"})]}),l?i.jsxs("label",{className:"cyber-remember-toggle",children:[i.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:x,onChange:te=>S(te.target.checked)}),i.jsx("span",{children:t("auth.rememberPassword")})]}):null,L?i.jsxs("div",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),i.jsx("span",{children:L})]}):null,i.jsxs("button",{className:`cyber-submit ${K?"loading":""}`,type:"submit",disabled:K,children:[i.jsx("span",{className:"cyber-submit-glow"}),i.jsx("span",{className:"cyber-submit-border"}),i.jsx("span",{className:"cyber-submit-text",children:K?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),c?i.jsxs("div",{className:"cyber-footer",children:[i.jsxs("div",{className:"cyber-divider",children:[i.jsx("span",{className:"cyber-divider-line"}),i.jsx("span",{className:"cyber-divider-text",children:"//"}),i.jsx("span",{className:"cyber-divider-line"})]}),i.jsxs("button",{className:"cyber-server-btn",onClick:()=>M(!0),type:"button",children:[i.jsx("span",{className:"cyber-server-icon",children:"⚙"}),i.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),i.jsx("span",{className:"cyber-server-current",children:C})]})]}):null]})]}),i.jsxs("div",{className:"cyber-version",children:[i.jsxs("span",{className:"cyber-version-text",children:["v",a]}),i.jsx("span",{className:"cyber-version-divider",children:"|"}),i.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),c?i.jsx(VT,{isOpen:F,onClose:()=>M(!1),onSave:oe,theme:Y}):null]})}const Dc="codingns.file-panel.show-system-files",vm="codingns.notification.preferences",po={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function bu(){return typeof window<"u"&&typeof window.localStorage<"u"}function mv(){return bu()?window.localStorage.getItem(Dc)==="1":!1}function gh(e){return typeof e=="boolean"}function pv(){if(!bu())return po;const e=window.localStorage.getItem(vm);if(!e)return po;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:gh(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:po.notifyOnPermissionRequest,notifyOnSessionCompleted:gh(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:po.notifyOnSessionCompleted,notifyOnSessionFailed:gh(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:po.notifyOnSessionFailed}}catch{return po}}function gv(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function JT(e){bu()&&window.localStorage.setItem(vm,JSON.stringify(e))}class ZT{constructor(){Be(this,"state",{showSystemFiles:mv(),notificationPreferences:pv()});Be(this,"listeners",new Set);Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state);Be(this,"handleStorage",t=>{if(t.key!==null&&t.key!==Dc&&t.key!==vm)return;const n=mv(),s=pv(),a=this.state.showSystemFiles===n,c=gv(this.state.notificationPreferences,s);a&&c||(this.state={showSystemFiles:n,notificationPreferences:s},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setShowSystemFiles(t){bu()&&(t?window.localStorage.setItem(Dc,"1"):window.localStorage.removeItem(Dc)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const n={...this.state.notificationPreferences,...t};gv(this.state.notificationPreferences,n)||(JT(n),this.state={...this.state,notificationPreferences:n},this.emit())}emit(){for(const t of this.listeners)t()}}const So=new ZT;function Ti(e){return v.useSyncExternalStore(So.subscribe,()=>e(So.getState()))}function Hr(){return Mn().haptics}function eE(){return Qe.request("/api/workspaces")}async function Rk(){try{return await Qe.request("/api/workbench")}catch(e){if(!(e instanceof lr)||e.status!==404)throw e;const t=await eE();return{items:await Promise.all(t.items.map(async s=>({workspace:s,sessions:(await iE(s.id)).items})))}}}function tE(e){return Qe.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function nE(e){return Qe.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function Mk(e){return Qe.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function Ak(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),Qe.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function rE(e){return Qe.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function iE(e){return Qe.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function sE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}`)}function oE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function aE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function Lk(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function Ik(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function lE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function cE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function Dk(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function uE(){return Qe.request("/api/preferences/quick-phrases")}function dE(e){return Qe.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function hE(e,t){const n=new URLSearchParams;return t!=null&&t.trim()&&n.set("workspaceId",t.trim()),Qe.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}function fE(e,t,n,s="forward"){const a=new URLSearchParams;return a.set("limit",String(n)),a.set("direction",s),Qe.request(`/api/sessions/${encodeURIComponent(e)}/messages?${a.toString()}`)}function mE(e,t){return Qe.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function pE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function gE(e){return Qe.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function yE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function vE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function wE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function bE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function xE(e,t){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function yv(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function kE(e){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function SE(e,t,n){return Qe.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(n)})}function _k({connectionState:e,onReconnect:t}){const{showToast:n,dismissToast:s}=Yn();return v.useEffect(()=>{if(e==="connected"||e==="closed"){s("conversation-connection-state");return}if(e==="reconnect_failed"){n({id:"conversation-connection-state",title:h("conversation.connectionReconnectFailed"),description:h("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:h("conversation.reconnectButton"),onClick:t}});return}n({id:"conversation-connection-state",title:h("conversation.connectionReconnecting"),description:h("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,s,t,n]),null}function yh(e,t){if(!e)return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:h("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")}}}const CE=new Set(["low","medium","high","xhigh"]),jE={"claude-code":{displayNameKey:"conversation.providerClaude",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1}};function Io(e){return e?jE[e]??null:null}function NE(e){return[{id:"provider-default",name:h(e),usesProviderDefault:!0}]}function PE(e){const t=Io(e);return NE((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function TE(e){return!!e}function EE(e){const t=Io(e);return h((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function RE(e){const t=Io(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(t==null?void 0:t.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:!0,supportsPermissionPrompt:!0,supportsCheckpoint:!1,modelOptions:PE(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function ME(e){return(e==null?void 0:e.provider)??"claude-code"}function AE(e){var n;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((n=Io(t))==null?void 0:n.supportsSlashMenuByDefault)??!1}function LE(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(n=>{var s;return((s=n.supportedReasoningEfforts)==null?void 0:s.some(a=>CE.has(a)))??!1}))}function IE(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const n=(e==null?void 0:e.inRunInputMode)??"none";return n==="queued_guidance"||n==="none"||n==="streaming_guidance"&&t===!1}function Fk(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function DE(e){const t=Io(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function _E(e,t){var s;return((s=Io(t??null))==null?void 0:s.foldRulesMessagesByDefault)??!1}function FE(){return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M7 7L17 17M17 7L7 17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})})}function Rr({open:e,title:t,description:n,className:s,onClose:a,children:c}){return v.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&a()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[a,e]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:a}),i.jsxs("section",{className:`workbench-modal-card surface-card${s?` ${s}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:a,children:i.jsx(FE,{})})]}),i.jsx("div",{className:"workbench-modal-body",children:c})]})]}),document.body)}const OE="codingns.conversation.composer-draft:",BE=1,WE=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function wm(){return typeof window<"u"&&typeof window.localStorage<"u"}function UE(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,n="fileName"in e?e.fileName:null,s="mimeType"in e?e.mimeType:null,a="fileSize"in e?e.fileSize:null,c="lastModified"in e?e.lastModified:null,l="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof n!="string"||typeof s!="string"||typeof a!="number"||typeof c!="number"||typeof l!="string")return null;const d=t.trim(),f=n.trim(),p=s.trim(),y=l.trim();return!d||!f||!p||a<0||c<0||!y?null:{id:d,fileName:f,mimeType:p,fileSize:a,lastModified:c,contentBase64:y}}function zE(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,n="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(n))return null;const s=n.map(a=>UE(a)).filter(a=>a!==null);return s.length!==n.length||t.length===0&&s.length===0?null:{content:t,attachments:s}}function Da(e){return`${OE}${e}`}function HE(e){var t,n;return{id:((n=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:n.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function qE(e){if(!wm())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(Da(t));if(!n)return null;try{const s=JSON.parse(n),a=s&&typeof s=="object"&&"draft"in s&&s.draft&&typeof s.draft=="object"?s.draft:s,c=zE(a);return c||(window.localStorage.removeItem(Da(t)),null)}catch{return window.localStorage.removeItem(Da(t)),null}}function $E(e,t){if(!wm())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return Ok(n),!0;try{return window.localStorage.setItem(Da(n),JSON.stringify({schemaVersion:BE,draft:t})),!0}catch{return!1}}function Ok(e){if(!wm())return;const t=e.trim();t&&window.localStorage.removeItem(Da(t))}const VE="provider-default",GE="provider-default",KE="provider-default",vv="workbench:focus-composer",QE="provider-default",wv={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function YE(){return[{id:VE,name:h("conversation.modelUseCliDefault"),provider:"claude-code",usesProviderDefault:!0}]}function XE(){return[{id:GE,name:h("conversation.modelUseCliDefault"),provider:"codex",usesProviderDefault:!0}]}function JE(){return[{id:KE,name:h("conversation.modelUseCliDefault"),provider:"opencode",usesProviderDefault:!0}]}function ZE(e){return e==="claude-code"?YE():e==="opencode"?JE():XE()}function eR(e){return e.usesProviderDefault===!0||e.id===QE}function tR(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function bv(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function nR(e,t,n,s){const a=globalThis.atob(n),c=Uint8Array.from(a,l=>l.charCodeAt(0));return new File([c],e,{type:t,lastModified:s})}function rR(e){const t=nR(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function iR(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function xv(e){return new Promise((t,n)=>{const s=new FileReader;s.onerror=()=>{n(s.error??new Error("FILE_READ_FAILED"))},s.onload=()=>{const a=typeof s.result=="string"?s.result:"",c=a.includes(",")?a.split(",").at(-1)??"":a;t(c)},s.readAsDataURL(e)})}function sR(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function oR(e){const t=[];let n=0;for(const s of e){if(s.type.startsWith("image/")){t.push(s);continue}n+=1}return{accepted:t,rejectedCount:n}}function aR(e,t){const n=new Set(e.map(a=>`${a.file.name}:${a.file.size}:${a.file.lastModified}`)),s=[...e];return t.forEach(a=>{const c=`${a.name}:${a.size}:${a.lastModified}`;n.has(c)||(n.add(c),s.push({id:tR(),file:a,previewUrl:URL.createObjectURL(a)}))}),s}function Bk({capabilities:e,draftStorageId:t,panelRef:n,portalContainer:s=null,hasActiveRun:a=null,canInterrupt:c=null,contextUsage:l=null,hasPendingQueuedMessages:d=!1,isSubmitting:f,isRunning:p=!1,onInterrupt:y,onQueueSend:g,onSend:b}){const x=Mn(),S=v.useId(),C=v.useId(),[j,R]=v.useState(""),[L,A]=v.useState(""),[K,H]=v.useState("medium"),[F,M]=v.useState([]),[_,I]=v.useState(!1),[P,U]=v.useState(WE),[G,X]=v.useState(!1),[Z,$]=v.useState(!1),[se,Y]=v.useState(""),[q,oe]=v.useState(!1),[E,B]=v.useState(!1),[te,T]=v.useState(!1),[we,me]=v.useState(!1),Ce=v.useRef(null),_e=v.useRef(null),Ge=v.useRef(null),ot=v.useRef(!1),mt=v.useRef(new Set),jt=v.useRef(new Map),yt=v.useRef(0),{showToast:St}=Yn(),Lt=Hr(),vt=ME(e),zt=Ao(ae=>dh(vt)?ae.profile.providers[vt]:null),Rt=(zt==null?void 0:zt.defaultModel)??null,ft=(zt==null?void 0:zt.defaultReasoningLevel)??null,tn=v.useMemo(()=>yh(e,"send_message"),[e]),qt=v.useMemo(()=>yh(e,"interrupt"),[e]),Ot=v.useMemo(()=>yh(e,"attachments"),[e]),tt=v.useMemo(()=>{var je;const ae=(je=e==null?void 0:e.modelOptions)==null?void 0:je.map(Xe=>{var rt;return{...Xe,provider:vt,supportedReasoningEfforts:(rt=Xe.supportedReasoningEfforts)==null?void 0:rt.filter(He=>He==="low"||He==="medium"||He==="high"||He==="xhigh")}});return ae!=null&&ae.length?ae:ZE(vt)},[e==null?void 0:e.modelOptions,vt]),$t=v.useMemo(()=>tt.find(ae=>ae.id===L)??null,[tt,L]),gt=LE(e),Vt=AE(e),ue=v.useMemo(()=>[{value:"low",label:h("conversation.reasoningLow")},{value:"medium",label:h("conversation.reasoningMedium")},{value:"high",label:h("conversation.reasoningHigh")},{value:"xhigh",label:h("conversation.reasoningMaximum")}],[]),ve=v.useMemo(()=>{if(!gt)return[];const ae=$t==null?void 0:$t.supportedReasoningEfforts;return!ae||ae.length===0?ue:ue.filter(je=>ae.includes(je.value))},[gt,ue,$t==null?void 0:$t.supportedReasoningEfforts]),Le=v.useMemo(()=>tt.map(ae=>({value:ae.id,label:eR(ae)?h("conversation.modelUseCliDefault"):ae.name})),[tt]),Ke=v.useMemo(()=>ve.map(ae=>({value:ae.value,label:ae.label})),[ve]),nt=v.useMemo(()=>[{command:"/plan",label:h("conversation.slashCommandPlan")},{command:"/review",label:h("conversation.slashCommandReview")},{command:"/explain",label:h("conversation.slashCommandExplain")}],[]),wt=(e==null?void 0:e.inRunInputMode)??"none",Dt=a??null,Pt=p&&wt==="streaming_guidance"&&Dt===!1&&!Fk(e),Ze=p&&wt==="streaming_guidance"&&!Pt,Wt=p&&typeof g=="function"&&IE(e,Dt),ct=p&&!Ze&&!Wt,It=j.trim().length>0||F.length>0,Mt=c??qt.allowed,ee=p&&Mt&&!!y&&!te&&!It&&!we&&!f,Ie=!ee&&!It&&(we||f||p||!p&&d),at=h(we||f||d?"conversation.sendingState":"conversation.runtimeRunning"),Nt=h(p?Wt?"conversation.queueGuidanceButton":Ze?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),Se=v.useCallback(ae=>{A(ae),dh(vt)&&Yc({providers:{[vt]:{defaultModel:ae}}}).catch(()=>{})},[vt]),Ye=v.useCallback(ae=>{H(ae),dh(vt)&&Yc({providers:{[vt]:{defaultReasoningLevel:ae}}}).catch(()=>{})},[vt]),Ut=v.useCallback(ae=>{mt.current.forEach(je=>{URL.revokeObjectURL(je)}),mt.current.clear(),ae.forEach(je=>{mt.current.add(je.previewUrl)}),M(ae)},[]),nn=v.useCallback(ae=>{const{accepted:je,rejectedCount:Xe}=oR(ae);Xe>0&&St({title:h("conversation.attachmentImageOnly"),tone:"error"}),je.length!==0&&M(rt=>{const He=aR(rt,je);return He.forEach(At=>{mt.current.add(At.previewUrl)}),He})},[St]),fn=v.useCallback(ae=>{jt.current.delete(ae),M(je=>{const Xe=je.find(rt=>rt.id===ae);return Xe&&(mt.current.delete(Xe.previewUrl),URL.revokeObjectURL(Xe.previewUrl)),je.filter(rt=>rt.id!==ae)})},[]),Nn=v.useCallback(ae=>{const je=Array.from(ae.target.files??[]);je.length>0&&nn(je),ae.target.value=""},[nn]),wn=v.useCallback(ae=>{if(!Ot.allowed||ct)return;const je=ae==="camera"?Ge.current:_e.current;bv(je),I(!1)},[Ot.allowed,ct]),V=v.useCallback(()=>{if(!(!Ot.allowed||ct)){if(B(!1),x.isNativeMobile){Lt.trigger("selection"),I(!0);return}bv(_e.current)}},[Ot.allowed,Lt,ct,x.isNativeMobile]),re=v.useCallback(()=>{B(ae=>!ae)},[]),de=v.useCallback(ae=>{var je;R(Xe=>Xe.trimStart().startsWith(ae)?Xe:Xe.trim()?`${ae} ${Xe.trim()}`:`${ae} `),B(!1),(je=Ce.current)==null||je.focus()},[]),be=v.useCallback(async ae=>{const je=P;yt.current+=1,U(ae),oe(!0);try{const Xe=await dE(ae.map(rt=>({id:rt.id,text:rt.text})));return U(Xe.items.map(rt=>({id:rt.id,text:rt.text}))),!0}catch(Xe){return U(je),St({title:Xe instanceof Error?Xe.message:h("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{oe(!1)}},[P,St]),Ee=v.useCallback(async()=>{const ae=se.trim();!ae||!await be([...P,HE(ae)])||(Y(""),$(!1))},[be,se,P]),We=v.useCallback(ae=>{be(P.filter(je=>je.id!==ae))},[be,P]),$e=v.useCallback((ae,je)=>{const Xe=P.findIndex(Ct=>Ct.id===ae);if(Xe<0)return;const rt=Xe+je;if(rt<0||rt>=P.length)return;const He=[...P],[At]=He.splice(Xe,1);He.splice(rt,0,At),be(He)},[be,P]),Re=v.useCallback(ae=>{var je;R(ae),X(!1),(je=Ce.current)==null||je.focus()},[]),De=v.useCallback(ae=>{const je=ae?qE(ae):null,Xe=(je==null?void 0:je.attachments.map(rt=>rR(rt)))??[];jt.current=new Map(((je==null?void 0:je.attachments)??[]).map(rt=>[rt.id,rt])),Ut(Xe),R((je==null?void 0:je.content)??""),B(!1)},[Ut]);v.useEffect(()=>{if(!tt.length)return;if(Rt&&tt.some(je=>je.id===Rt)){L!==Rt&&A(Rt);return}if(tt.some(je=>je.id===L))return;const ae=tt[0].id;A(ae)},[tt,vt,L,Rt]),v.useEffect(()=>{if(!DE(vt)||ve.length===0)return;if(ft&&ve.some(Xe=>Xe.value===ft)){K!==ft&&H(ft);return}const ae=e==null?void 0:e.defaultReasoningLevel;if(ae&&ve.some(Xe=>Xe.value===ae)){K!==ae&&H(ae);return}if(ve.some(Xe=>Xe.value===K))return;const je=ve[0].value;H(je)},[ve,e==null?void 0:e.defaultReasoningLevel,vt,K,ft]),v.useEffect(()=>{let ae=!1;const je=yt.current;return uE().then(Xe=>{ae||yt.current!==je||U(Xe.items.map(rt=>({id:rt.id,text:rt.text})))}).catch(()=>{}),()=>{ae=!0}},[]),v.useEffect(()=>{De(t)},[t,De]),v.useEffect(()=>{if(!t)return;const ae=t,je=new Set(F.map(He=>He.id));jt.current.forEach((He,At)=>{je.has(At)||jt.current.delete(At)});let Xe=!1;async function rt(){if(j.length===0&&F.length===0){Ok(ae);return}const He=await Promise.all(F.map(async At=>{const Ct=jt.current.get(At.id);return Ct&&Ct.fileName===At.file.name&&Ct.fileSize===At.file.size&&Ct.lastModified===At.file.lastModified&&Ct.mimeType===(At.file.type||"image/png")?Ct:{id:At.id,fileName:At.file.name,mimeType:At.file.type||"image/png",fileSize:At.file.size,lastModified:At.file.lastModified,contentBase64:await xv(At.file)}}));Xe||(jt.current=new Map(He.map(At=>[At.id,At])),$E(ae,{content:j,attachments:He}))}return rt(),()=>{Xe=!0}},[F,j,t]),v.useEffect(()=>{const ae=Ce.current;ae&&(ae.style.height="0px",ae.style.height=`${Math.min(ae.scrollHeight,120)}px`)},[j]),v.useEffect(()=>{Ot.allowed||(jt.current.clear(),I(!1),Ut([]))},[Ot.allowed,Ut]),v.useEffect(()=>{x.isMobile||I(!1)},[x.isMobile]),v.useEffect(()=>()=>{mt.current.forEach(ae=>{URL.revokeObjectURL(ae)}),mt.current.clear()},[]),v.useEffect(()=>{function ae(){var je;(je=Ce.current)==null||je.focus()}return window.addEventListener(vv,ae),()=>{window.removeEventListener(vv,ae)}},[]);async function Fe(ae){if(ot.current)return;const je=j.trim(),Xe=F;if(je.length===0&&Xe.length===0||!tn.allowed||ct){St({title:ct?h("conversation.runtimeRunning"):tn.reason??h("conversation.capabilityDenied"),tone:"error"});return}ot.current=!0,Lt.trigger(ae==="queue"?"selection":"action"),me(!0),R(""),M([]),I(!1),X(!1),$(!1),B(!1);try{const rt=await Promise.all(Xe.map(async Ct=>({fileName:Ct.file.name,mimeType:Ct.file.type||"image/png",fileSize:Ct.file.size,contentBase64:await xv(Ct.file)}))),He=Xe.map(Ct=>iR(Ct.file,Ct.id));await(ae==="queue"&&g?g:b)(je,{model:$t!=null&&$t.usesProviderDefault?void 0:L||void 0,reasoningLevel:gt&&ve.length>0?K:void 0,attachments:rt,attachmentMeta:He}),sR(Xe),Xe.forEach(Ct=>{mt.current.delete(Ct.previewUrl)})}catch(rt){R(je),M(Xe),St({title:rt instanceof Error&&rt.message==="FILE_READ_FAILED"?h("conversation.attachmentReadFailed"):rt instanceof Error?rt.message:h("conversation.capabilityDenied"),tone:"error"})}finally{me(!1),ot.current=!1}}async function Oe(ae){ae.preventDefault(),await Fe(Wt?"queue":"send")}async function dt(){if(!(!Mt||!y||te))try{T(!0),Lt.trigger("action"),await y()}catch(ae){St({title:ae instanceof Error?ae.message:h("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{T(!1)}}const ut=we||f||ct||!tn.allowed||!It,Gt=we||f||ct||!Ot.allowed,Tt=j.length===0&&!ct,Ue=i.jsxs("section",{ref:n,className:"composer-panel",children:[i.jsxs("form",{className:"composer-form",onSubmit:Oe,children:[i.jsx("input",{id:S,ref:_e,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:wv,onChange:Nn}),i.jsx("input",{id:C,ref:Ge,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:wv,onChange:Nn}),i.jsxs("div",{className:"composer-input-container",children:[F.length>0?i.jsx("div",{className:"composer-attachments",children:F.map(ae=>i.jsxs("div",{className:"composer-attachment-card",children:[i.jsx("img",{src:ae.previewUrl,alt:h("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),i.jsxs("div",{className:"composer-attachment-meta",children:[i.jsx("span",{className:"attachment-name",title:ae.file.name,children:ae.file.name}),i.jsxs("span",{className:"attachment-size",children:[(ae.file.size/1024).toFixed(1)," KB"]})]}),i.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>fn(ae.id),"aria-label":h("conversation.removeAttachment"),children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},ae.id))}):null,i.jsxs("div",{className:"composer-input-wrapper",children:[i.jsx("textarea",{ref:Ce,className:"composer-input",value:j,placeholder:h("conversation.composerPlaceholder"),readOnly:ct,"aria-readonly":ct,onChange:ae=>R(ae.target.value),rows:1,onFocus:()=>B(!1),onPaste:ae=>{if(ct||!Ot.allowed)return;const je=Array.from(ae.clipboardData.items).filter(Xe=>Xe.kind==="file").map(Xe=>Xe.getAsFile()).filter(Xe=>!!Xe);je.length!==0&&(ae.preventDefault(),nn(je))},onKeyDown:ae=>{ae.key==="Escape"&&B(!1),ae.key==="Enter"&&!ae.shiftKey&&(ae.preventDefault(),ut||Oe(ae))}}),Tt?i.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":h("conversation.quickPhraseTrigger"),title:h("conversation.quickPhraseTrigger"),onClick:()=>{X(!0),B(!1)},children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M7 8h10"}),i.jsx("path",{d:"M7 12h8"}),i.jsx("path",{d:"M7 16h5"}),i.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),E?i.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":h("conversation.slashMenuTitle"),children:nt.map(ae=>i.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>de(ae.command),children:[i.jsx("span",{className:"composer-slash-command",children:ae.command}),i.jsx("span",{className:"composer-slash-label",children:ae.label})]},ae.command))}):null,i.jsxs("div",{className:"composer-controls",children:[i.jsxs("div",{className:"composer-controls-left",children:[Ot.allowed?x.isNativeMobile?i.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),disabled:Gt,onClick:V,children:i.jsx(vh,{})}):Gt?i.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),disabled:!0,children:i.jsx(vh,{})}):i.jsx("label",{htmlFor:S,className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),onClick:()=>{B(!1)},children:i.jsx(vh,{})}):null,i.jsx(kv,{ariaLabel:h("conversation.modelSelectorLabel"),value:L,options:Le,onChange:Se}),gt&&ve.length>0?i.jsx(kv,{ariaLabel:h("conversation.reasoningSelectorLabel"),value:K,options:Ke,onChange:ae=>Ye(ae),compact:!0}):null,Vt?i.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:re,title:h("conversation.slashMenu"),children:[i.jsx("span",{className:"slash-icon",children:"/"}),i.jsx("span",{children:h("conversation.slashMenu")})]}):null,i.jsx(dR,{contextUsage:l})]}),Ie?i.jsx("div",{className:"composer-send-group",children:i.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":at,title:at,children:i.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),i.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):i.jsx("div",{className:"composer-send-group",children:ee?i.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{dt()},"aria-label":h("conversation.capabilityInterrupt"),title:h("conversation.capabilityInterrupt"),children:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):i.jsx("button",{className:"composer-send",type:"submit",disabled:ut,"aria-label":Nt,title:Nt,children:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),i.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})]}),i.jsx(Rr,{open:G,title:h("conversation.quickPhraseModalTitle"),description:h("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{X(!1),$(!1)},children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[i.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:i.jsx("span",{children:h("conversation.quickPhraseListLabel")})}),i.jsx("button",{type:"button",className:"primary-button",disabled:q,onClick:()=>$(!0),children:h("conversation.quickPhraseOpenCreateAction")})]}),i.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":h("conversation.quickPhraseListLabel"),children:P.length===0?i.jsx("div",{className:"composer-quick-phrase-empty",children:h("conversation.quickPhraseEmpty")}):P.map((ae,je)=>i.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[i.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Re(ae.text),children:[i.jsx("span",{className:"composer-quick-phrase-order",children:h("conversation.quickPhraseOrderLabel",{index:je+1})}),i.jsx("span",{className:"composer-quick-phrase-text",children:ae.text})]}),i.jsxs("div",{className:"composer-quick-phrase-actions",children:[i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:q||je===0,"aria-label":h("conversation.quickPhraseMoveUp"),title:h("conversation.quickPhraseMoveUp"),onClick:()=>$e(ae.id,-1),children:"↑"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:q||je===P.length-1,"aria-label":h("conversation.quickPhraseMoveDown"),title:h("conversation.quickPhraseMoveDown"),onClick:()=>$e(ae.id,1),children:"↓"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:q,"aria-label":h("conversation.quickPhraseDelete"),title:h("conversation.quickPhraseDelete"),onClick:()=>We(ae.id),children:"×"})]})]},ae.id))})]})}),i.jsx(Rr,{open:Z,title:h("conversation.quickPhraseCreateModalTitle"),description:h("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>$(!1),children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("conversation.quickPhraseCreateLabel")}),i.jsx("textarea",{className:"composer-quick-phrase-textarea",value:se,placeholder:h("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:ae=>Y(ae.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>$(!1),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:q||se.trim().length===0,onClick:()=>{Ee()},children:h("conversation.quickPhraseCreateAction")})]})]})}),i.jsx(lR,{open:_&&x.isNativeMobile,onClose:()=>I(!1),onSelectCamera:()=>wn("camera"),onSelectLibrary:()=>wn("library")})]});return s?Hn.createPortal(Ue,s):Ue}function lR({open:e,onClose:t,onSelectCamera:n,onSelectLibrary:s}){return!e||typeof document>"u"?null:Hn.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay composer-attachment-sheet-overlay",role:"presentation",onClick:t,children:i.jsxs("div",{className:"mobile-workspace-home-sheet composer-attachment-sheet",role:"dialog","aria-modal":"true","aria-label":h("conversation.attachmentSourceSheetTitle"),onClick:a=>a.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card composer-attachment-sheet-card",children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-header",children:[i.jsx("strong",{children:h("conversation.attachmentSourceSheetTitle")}),i.jsx("span",{children:h("conversation.attachmentSourceSheetDescription")})]}),i.jsxs("div",{className:"mobile-workspace-home-group composer-attachment-sheet-actions",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":h("conversation.attachmentTakePhoto"),onClick:n,children:[i.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[i.jsx("strong",{children:h("conversation.attachmentTakePhoto")}),i.jsx("span",{children:h("conversation.attachmentTakePhotoHint")})]}),i.jsx(cR,{})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":h("conversation.attachmentChooseFromLibrary"),onClick:s,children:[i.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[i.jsx("strong",{children:h("conversation.attachmentChooseFromLibrary")}),i.jsx("span",{children:h("conversation.attachmentChooseFromLibraryHint")})]}),i.jsx(uR,{})]})]})]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:h("common.cancel")})]})}),document.body)}function cR(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M4 8h3l1.5-2h7L17 8h3a1 1 0 0 1 1 1v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a1 1 0 0 1 1-1Z"}),i.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function vh(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),i.jsx("path",{d:"M8 12h8M12 8v8"})]})}function uR(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),i.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function kv({ariaLabel:e,value:t,options:n,onChange:s,compact:a=!1}){const[c,l]=v.useState(!1),d=v.useRef(null),f=v.useRef(null),p=v.useRef(null),[y,g]=v.useState(null),b=v.useId(),x=n.find(C=>C.value===t)??n[0]??null,S=v.useCallback(()=>{const C=f.current;if(!C||typeof window>"u")return;const j=C.getBoundingClientRect(),R=window.innerWidth,L=window.innerHeight,A=12,K=10,H=Math.max(160,R-A*2),F=a?140:220,M=Math.min(H,Math.max(j.width,F)),_=Math.min(Math.max(A,j.left),Math.max(A,R-M-A)),I=j.top-A,P=L-j.bottom-A,U=I>=180||I>=P;g({position:"fixed",left:_,width:M,maxWidth:H,top:U?void 0:j.bottom+K,bottom:U?L-j.top+K:void 0})},[a]);return v.useEffect(()=>{if(!c)return;function C(R){var A,K;const L=R.target;!((A=d.current)!=null&&A.contains(L))&&!((K=p.current)!=null&&K.contains(L))&&l(!1)}function j(R){R.key==="Escape"&&l(!1)}return window.addEventListener("pointerdown",C),window.addEventListener("keydown",j),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),S(),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",j),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[c,S]),x?i.jsxs("div",{ref:d,className:`composer-mac-select ${a?"is-compact":""}`,"data-open":c?"true":"false",children:[i.jsxs("button",{ref:f,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"aria-controls":b,onClick:()=>l(C=>!C),children:[i.jsx("span",{className:"composer-mac-select-label",children:x.label}),i.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),c&&y&&typeof document<"u"?Hn.createPortal(i.jsx("div",{ref:p,className:"composer-mac-select-popover",style:y,role:"presentation",children:i.jsx("div",{id:b,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:n.map(C=>{const j=C.value===t;return i.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`composer-mac-select-option ${j?"is-selected":""}`,onClick:()=>{s(C.value),l(!1)},children:[i.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:j?"✓":""}),i.jsx("span",{className:"composer-mac-select-option-label",children:C.label})]},C.value)})})}),document.body):null]}):null}function dR({contextUsage:e}){const[t,n]=v.useState(!1),s=v.useRef(null),a=v.useRef(null),[c,l]=v.useState(null),d=v.useId(),f=e?Math.round(e.usageRatio*100):null,p=e?Math.max(0,Math.min(e.usageRatio,1)):0,y=hR(p),g=e?fR(e.contextWindowSource):null,b=e?`${h("conversation.contextUsageTitle")} ${f}%`:h("conversation.contextUsageUnavailable"),x=v.useCallback(()=>{const S=s.current;if(!S||typeof window>"u")return;const C=S.getBoundingClientRect(),j=window.innerWidth,R=window.innerHeight,L=12,A=10,K=Math.min(240,Math.max(188,j-L*2)),H=Math.min(Math.max(L,C.left+C.width/2-K/2),Math.max(L,j-K-L)),F=C.top-L,M=R-C.bottom-L,_=F>=140||F>=M;l({position:"fixed",left:H,width:K,maxWidth:j-L*2,top:_?void 0:C.bottom+A,bottom:_?R-C.top+A:void 0})},[]);return v.useEffect(()=>{if(!t)return;function S(j){var L,A;const R=j.target;!((L=s.current)!=null&&L.contains(R))&&!((A=a.current)!=null&&A.contains(R))&&n(!1)}function C(j){j.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",S),window.addEventListener("keydown",C),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),x(),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",C),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[t,x]),i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:s,type:"button",className:`composer-context-ring ${y}`,style:{"--context-usage-progress":`${p}`},"aria-label":b,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>n(S=>!S),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:i.jsx("span",{className:"composer-context-ring-value",children:f===null?"--":i.jsxs(i.Fragment,{children:[i.jsx("span",{children:f}),i.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&c&&typeof document<"u"?Hn.createPortal(i.jsx("div",{ref:a,id:d,className:"composer-context-tooltip",style:c,role:"tooltip",children:e?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"composer-context-tooltip-title",children:h("conversation.contextUsageTitle")}),i.jsxs("div",{className:"composer-context-tooltip-line",children:[f,"% · ",wh(e.promptTokens)," /"," ",wh(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageCachedTokens").replace("{count}",wh(e.cachedInputTokens))}):null,g?i.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?i.jsx("div",{className:"composer-context-tooltip-meta",children:h("conversation.contextUsageEstimated")}):null]}):i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageUnavailable")})}),document.body):null]})}function hR(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function fR(e){switch(e){case"provider-log":return h("conversation.contextUsageSourceProviderLog");case"provider-runtime":return h("conversation.contextUsageSourceProviderRuntime");case"provider-config":return h("conversation.contextUsageSourceProviderConfig");case"model-map":return h("conversation.contextUsageSourceModelMap");default:return""}}function wh(e){return new Intl.NumberFormat().format(e)}function mR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const pR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yR={};function Sv(e,t){return(yR.jsx?gR:pR).test(e)}const vR=/[ \t\n\f\r]/g;function wR(e){return typeof e=="object"?e.type==="text"?Cv(e.value):!1:Cv(e)}function Cv(e){return e.replace(vR,"")===""}class il{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}il.prototype.normal={};il.prototype.property={};il.prototype.space=void 0;function Wk(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new il(n,s,t)}function Ef(e){return e.toLowerCase()}class kr{constructor(t,n){this.attribute=n,this.property=t}}kr.prototype.attribute="";kr.prototype.booleanish=!1;kr.prototype.boolean=!1;kr.prototype.commaOrSpaceSeparated=!1;kr.prototype.commaSeparated=!1;kr.prototype.defined=!1;kr.prototype.mustUseProperty=!1;kr.prototype.number=!1;kr.prototype.overloadedBoolean=!1;kr.prototype.property="";kr.prototype.spaceSeparated=!1;kr.prototype.space=void 0;let bR=0;const Bt=Us(),En=Us(),Rf=Us(),Me=Us(),hn=Us(),No=Us(),Tr=Us();function Us(){return 2**++bR}const Mf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Bt,booleanish:En,commaOrSpaceSeparated:Tr,commaSeparated:No,number:Me,overloadedBoolean:Rf,spaceSeparated:hn},Symbol.toStringTag,{value:"Module"})),bh=Object.keys(Mf);class bm extends kr{constructor(t,n,s,a){let c=-1;if(super(t,n),jv(this,"space",a),typeof s=="number")for(;++c<bh.length;){const l=bh[c];jv(this,bh[c],(s&Mf[l])===Mf[l])}}}bm.prototype.defined=!0;function jv(e,t,n){n&&(e[t]=n)}function Do(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const c=new bm(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[Ef(s)]=s,n[Ef(c.attribute)]=s}return new il(t,n,e.space)}const Uk=Do({properties:{ariaActiveDescendant:null,ariaAtomic:En,ariaAutoComplete:null,ariaBusy:En,ariaChecked:En,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:hn,ariaCurrent:null,ariaDescribedBy:hn,ariaDetails:null,ariaDisabled:En,ariaDropEffect:hn,ariaErrorMessage:null,ariaExpanded:En,ariaFlowTo:hn,ariaGrabbed:En,ariaHasPopup:null,ariaHidden:En,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:hn,ariaLevel:Me,ariaLive:null,ariaModal:En,ariaMultiLine:En,ariaMultiSelectable:En,ariaOrientation:null,ariaOwns:hn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:En,ariaReadOnly:En,ariaRelevant:null,ariaRequired:En,ariaRoleDescription:hn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:En,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function zk(e,t){return t in e?e[t]:t}function Hk(e,t){return zk(e,t.toLowerCase())}const xR=Do({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:No,acceptCharset:hn,accessKey:hn,action:null,allow:null,allowFullScreen:Bt,allowPaymentRequest:Bt,allowUserMedia:Bt,alt:null,as:null,async:Bt,autoCapitalize:null,autoComplete:hn,autoFocus:Bt,autoPlay:Bt,blocking:hn,capture:null,charSet:null,checked:Bt,cite:null,className:hn,cols:Me,colSpan:null,content:null,contentEditable:En,controls:Bt,controlsList:hn,coords:Me|No,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Bt,defer:Bt,dir:null,dirName:null,disabled:Bt,download:Rf,draggable:En,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Bt,formTarget:null,headers:hn,height:Me,hidden:Rf,high:Me,href:null,hrefLang:null,htmlFor:hn,httpEquiv:hn,id:null,imageSizes:null,imageSrcSet:null,inert:Bt,inputMode:null,integrity:null,is:null,isMap:Bt,itemId:null,itemProp:hn,itemRef:hn,itemScope:Bt,itemType:hn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Bt,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:Bt,muted:Bt,name:null,nonce:null,noModule:Bt,noValidate:Bt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Bt,optimum:Me,pattern:null,ping:hn,placeholder:null,playsInline:Bt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Bt,referrerPolicy:null,rel:hn,required:Bt,reversed:Bt,rows:Me,rowSpan:Me,sandbox:hn,scope:null,scoped:Bt,seamless:Bt,selected:Bt,shadowRootClonable:Bt,shadowRootDelegatesFocus:Bt,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:En,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:Bt,useMap:null,value:En,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:hn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Bt,declare:Bt,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:Bt,noHref:Bt,noShade:Bt,noWrap:Bt,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:En,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Bt,disableRemotePlayback:Bt,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:Hk}),kR=Do({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Tr,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:hn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:Bt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:No,g2:No,glyphName:No,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Tr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:hn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tr,rev:Tr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tr,requiredFeatures:Tr,requiredFonts:Tr,requiredFormats:Tr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Tr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tr,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:zk}),qk=Do({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$k=Do({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Hk}),Vk=Do({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),SR={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},CR=/[A-Z]/g,Nv=/-[a-z]/g,jR=/^data[-\w.:]+$/i;function NR(e,t){const n=Ef(t);let s=t,a=kr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jR.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Nv,TR);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Nv.test(c)){let l=c.replace(CR,PR);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=bm}return new a(s,t)}function PR(e){return"-"+e.toLowerCase()}function TR(e){return e.charAt(1).toUpperCase()}const ER=Wk([Uk,xR,qk,$k,Vk],"html"),xm=Wk([Uk,kR,qk,$k,Vk],"svg");function RR(e){return e.join(" ").trim()}var go={},xh,Pv;function MR(){if(Pv)return xh;Pv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
70
|
+
`,p="/",y="*",g="",b="comment",x="declaration";function S(j,R){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];R=R||{};var L=1,A=1;function K(Z){var $=Z.match(t);$&&(L+=$.length);var se=Z.lastIndexOf(f);A=~se?Z.length-se:A+Z.length}function H(){var Z={line:L,column:A};return function($){return $.position=new F(Z),I(),$}}function F(Z){this.start=Z,this.end={line:L,column:A},this.source=R.source}F.prototype.content=j;function M(Z){var $=new Error(R.source+":"+L+":"+A+": "+Z);if($.reason=Z,$.filename=R.source,$.line=L,$.column=A,$.source=j,!R.silent)throw $}function _(Z){var $=Z.exec(j);if($){var se=$[0];return K(se),j=j.slice(se.length),$}}function I(){_(n)}function P(Z){var $;for(Z=Z||[];$=U();)$!==!1&&Z.push($);return Z}function U(){var Z=H();if(!(p!=j.charAt(0)||y!=j.charAt(1))){for(var $=2;g!=j.charAt($)&&(y!=j.charAt($)||p!=j.charAt($+1));)++$;if($+=2,g===j.charAt($-1))return M("End of comment missing");var se=j.slice(2,$-2);return A+=2,K(se),j=j.slice($),A+=2,Z({type:b,comment:se})}}function G(){var Z=H(),$=_(s);if($){if(U(),!_(a))return M("property missing ':'");var se=_(c),Y=Z({type:x,property:C($[0].replace(e,g)),value:se?C(se[0].replace(e,g)):g});return _(l),Y}}function X(){var Z=[];P(Z);for(var $;$=G();)$!==!1&&(Z.push($),P(Z));return Z}return I(),X()}function C(j){return j?j.replace(d,g):g}return xh=S,xh}var Tv;function AR(){if(Tv)return go;Tv=1;var e=go&&go.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(go,"__esModule",{value:!0}),go.default=n;const t=e(MR());function n(s,a){let c=null;if(!s||typeof s!="string")return c;const l=(0,t.default)(s),d=typeof a=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:y}=f;d?a(p,y,f):y&&(c=c||{},c[p]=y)}),c}return go}var Ca={},Ev;function LR(){if(Ev)return Ca;Ev=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},l=function(p,y){return y.toUpperCase()},d=function(p,y){return"".concat(y,"-")},f=function(p,y){return y===void 0&&(y={}),c(p)?p:(p=p.toLowerCase(),y.reactCompat?p=p.replace(a,d):p=p.replace(s,d),p.replace(t,l))};return Ca.camelCase=f,Ca}var ja,Rv;function IR(){if(Rv)return ja;Rv=1;var e=ja&&ja.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(AR()),n=LR();function s(a,c){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(d,f){d&&f&&(l[(0,n.camelCase)(d,c)]=f)}),l}return s.default=s,ja=s,ja}var DR=IR();const _R=Ja(DR),Gk=Kk("end"),km=Kk("start");function Kk(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function FR(e){const t=km(e),n=Gk(e);if(t&&n)return{start:t,end:n}}function _a(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Mv(e.position):"start"in e||"end"in e?Mv(e):"line"in e||"column"in e?Af(e):""}function Af(e){return Av(e&&e.line)+":"+Av(e&&e.column)}function Mv(e){return Af(e&&e.start)+"-"+Af(e&&e.end)}function Av(e){return e&&typeof e=="number"?e:1}class rr extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",c={},l=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?a=t:!c.cause&&t&&(l=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof s=="string"){const f=s.indexOf(":");f===-1?c.ruleId=s:(c.source=s.slice(0,f),c.ruleId=s.slice(f+1))}if(!c.place&&c.ancestors&&c.ancestors){const f=c.ancestors[c.ancestors.length-1];f&&(c.place=f.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=_a(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=l&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rr.prototype.file="";rr.prototype.name="";rr.prototype.reason="";rr.prototype.message="";rr.prototype.stack="";rr.prototype.column=void 0;rr.prototype.line=void 0;rr.prototype.ancestors=void 0;rr.prototype.cause=void 0;rr.prototype.fatal=void 0;rr.prototype.place=void 0;rr.prototype.ruleId=void 0;rr.prototype.source=void 0;const Sm={}.hasOwnProperty,OR=new Map,BR=/[A-Z]/g,WR=new Set(["table","tbody","thead","tfoot","tr"]),UR=new Set(["td","th"]),Qk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zR(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=YR(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=QR(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?xm:ER,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Yk(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Yk(e,t,n){if(t.type==="element")return HR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return VR(e,t,n);if(t.type==="mdxjsEsm")return $R(e,t);if(t.type==="root")return GR(e,t,n);if(t.type==="text")return KR(e,t)}function HR(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=xm,e.schema=a),e.ancestors.push(t);const c=Jk(e,t.tagName,!1),l=XR(e,t);let d=jm(e,t);return WR.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!wR(f):!0})),Xk(e,l,c,t),Cm(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function qR(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}$a(e,t.position)}function $R(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$a(e,t.position)}function VR(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=xm,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Jk(e,t.name,!0),l=JR(e,t),d=jm(e,t);return Xk(e,l,c,t),Cm(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function GR(e,t,n){const s={};return Cm(s,jm(e,t)),e.create(t,e.Fragment,s,n)}function KR(e,t){return t.value}function Xk(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Cm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function QR(e,t,n){return s;function s(a,c,l,d){const p=Array.isArray(l.children)?n:t;return d?p(c,l,d):p(c,l)}}function YR(e,t){return n;function n(s,a,c,l){const d=Array.isArray(c.children),f=km(s);return t(a,c,l,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function XR(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Sm.call(t.properties,a)){const c=ZR(e,a,t.properties[a]);if(c){const[l,d]=c;e.tableCellAlignToStyle&&l==="align"&&typeof d=="string"&&UR.has(t.tagName)?s=d:n[l]=d}}if(s){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function JR(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const l=c.expression;l.type;const d=l.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else $a(e,t.position);else{const a=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const d=s.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else $a(e,t.position);else c=s.value===null?!0:s.value;n[a]=c}return n}function jm(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:OR;for(;++s<t.children.length;){const c=t.children[s];let l;if(e.passKeys){const f=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(f){const p=a.get(f)||0;l=f+"-"+p,a.set(f,p+1)}}const d=Yk(e,c,l);d!==void 0&&n.push(d)}return n}function ZR(e,t,n){const s=NR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?mR(n):RR(n)),s.property==="style"){let a=typeof n=="object"?n:eM(e,String(n));return e.stylePropertyNameCase==="css"&&(a=tM(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?SR[s.property]||s.property:s.attribute,n]}}function eM(e,t){try{return _R(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new rr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Qk+"#cannot-parse-style-attribute",a}}function Jk(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,l;for(;++c<a.length;){const d=Sv(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};l=l?{type:"MemberExpression",object:l,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}s=l}else s=Sv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Sm.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);$a(e)}function $a(e,t){const n=new rr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Qk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function tM(e){const t={};let n;for(n in e)Sm.call(e,n)&&(t[nM(n)]=e[n]);return t}function nM(e){let t=e.replace(BR,rM);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rM(e){return"-"+e.toLowerCase()}const kh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},iM={};function Nm(e,t){const n=iM,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Zk(e,s,a)}function Zk(e,t,n){if(sM(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Lv(e.children,t,n)}return Array.isArray(e)?Lv(e,t,n):""}function Lv(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=Zk(e[a],t,n);return s.join("")}function sM(e){return!!(e&&typeof e=="object")}const Iv=document.createElement("i");function Pm(e){const t="&"+e+";";Iv.innerHTML=t;const n=Iv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ar(e,t,n,s){const a=e.length;let c=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)l=Array.from(s),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);c<s.length;)l=s.slice(c,c+1e4),l.unshift(t,0),e.splice(...l),c+=1e4,t+=1e4}function Ur(e,t){return e.length>0?(Ar(e,e.length,0,t),e):t}const Dv={}.hasOwnProperty;function eS(e){const t={};let n=-1;for(;++n<e.length;)oM(t,e[n]);return t}function oM(e,t){let n;for(n in t){const a=(Dv.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let l;if(c)for(l in c){Dv.call(a,l)||(a[l]=[]);const d=c[l];aM(a[l],Array.isArray(d)?d:d?[d]:[])}}}function aM(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ar(e,0,0,s)}function tS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ti(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cr=us(/[A-Za-z]/),tr=us(/[\dA-Za-z]/),lM=us(/[#-'*+\--9=?A-Z^-~]/);function iu(e){return e!==null&&(e<32||e===127)}const Lf=us(/\d/),cM=us(/[\dA-Fa-f]/),uM=us(/[!-/:-@[-`{-~]/);function kt(e){return e!==null&&e<-2}function un(e){return e!==null&&(e<0||e===32)}function Qt(e){return e===-2||e===-1||e===32}const xu=us(new RegExp("\\p{P}|\\p{S}","u")),Os=us(/\s/);function us(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function _o(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let l="";if(c===37&&tr(e.charCodeAt(n+1))&&tr(e.charCodeAt(n+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(l=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(n+1);c<56320&&d>56319&&d<57344?(l=String.fromCharCode(c,d),a=1):l="�"}else l=String.fromCharCode(c);l&&(t.push(e.slice(s,n),encodeURIComponent(l)),s=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function Zt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let c=0;return l;function l(f){return Qt(f)?(e.enter(n),d(f)):t(f)}function d(f){return Qt(f)&&c++<a?(e.consume(f),d):(e.exit(n),t(f))}}const dM={tokenize:hM};function hM(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Zt(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),c(d)}function c(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(d)}function l(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return kt(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),l)}}const fM={tokenize:mM},_v={tokenize:pM};function mM(e){const t=this,n=[];let s=0,a,c,l;return d;function d(A){if(s<n.length){const K=n[s];return t.containerState=K[1],e.attempt(K[0].continuation,f,p)(A)}return p(A)}function f(A){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&L();const K=t.events.length;let H=K,F;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){F=t.events[H][1].end;break}R(s);let M=K;for(;M<t.events.length;)t.events[M][1].end={...F},M++;return Ar(t.events,H+1,0,t.events.slice(K)),t.events.length=M,p(A)}return d(A)}function p(A){if(s===n.length){if(!a)return b(A);if(a.currentConstruct&&a.currentConstruct.concrete)return S(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_v,y,g)(A)}function y(A){return a&&L(),R(s),b(A)}function g(A){return t.parser.lazy[t.now().line]=s!==n.length,l=t.now().offset,S(A)}function b(A){return t.containerState={},e.attempt(_v,x,S)(A)}function x(A){return s++,n.push([t.currentConstruct,t.containerState]),b(A)}function S(A){if(A===null){a&&L(),R(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),C(A)}function C(A){if(A===null){j(e.exit("chunkFlow"),!0),R(0),e.consume(A);return}return kt(A)?(e.consume(A),j(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(A),C)}function j(A,K){const H=t.sliceStream(A);if(K&&H.push(null),A.previous=c,c&&(c.next=A),c=A,a.defineSkip(A.start),a.write(H),t.parser.lazy[A.start.line]){let F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<l&&(!a.events[F][1].end||a.events[F][1].end.offset>l))return;const M=t.events.length;let _=M,I,P;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(I){P=t.events[_][1].end;break}I=!0}for(R(s),F=M;F<t.events.length;)t.events[F][1].end={...P},F++;Ar(t.events,_+1,0,t.events.slice(M)),t.events.length=F}}function R(A){let K=n.length;for(;K-- >A;){const H=n[K];t.containerState=H[1],H[0].exit.call(t,e)}n.length=A}function L(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function pM(e,t,n){return Zt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ro(e){if(e===null||un(e)||Os(e))return 1;if(xu(e))return 2}function ku(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!s.includes(c)&&(t=c(t,n),s.push(c))}return t}const If={name:"attention",resolveAll:gM,tokenize:yM};function gM(e,t){let n=-1,s,a,c,l,d,f,p,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},b={...e[n][1].start};Fv(g,-f),Fv(b,f),l={type:f>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},c={type:f>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...l.start},end:{...d.end}},e[s][1].end={...l.start},e[n][1].start={...d.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Ur(p,[["enter",e[s][1],t],["exit",e[s][1],t]])),p=Ur(p,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",c,t]]),p=Ur(p,ku(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),p=Ur(p,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,p=Ur(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,Ar(e,s-1,n-s+3,p),n=s+p.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function yM(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ro(s);let c;return l;function l(f){return c=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===c)return e.consume(f),d;const p=e.exit("attentionSequence"),y=Ro(f),g=!y||y===2&&a||n.includes(f),b=!a||a===2&&y||n.includes(s);return p._open=!!(c===42?g:g&&(a||!b)),p._close=!!(c===42?b:b&&(y||!g)),t(f)}}function Fv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const vM={name:"autolink",tokenize:wM};function wM(e,t,n){let s=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(x){return cr(x)?(e.consume(x),l):x===64?n(x):p(x)}function l(x){return x===43||x===45||x===46||tr(x)?(s=1,d(x)):p(x)}function d(x){return x===58?(e.consume(x),s=0,f):(x===43||x===45||x===46||tr(x))&&s++<32?(e.consume(x),d):(s=0,p(x))}function f(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||iu(x)?n(x):(e.consume(x),f)}function p(x){return x===64?(e.consume(x),y):lM(x)?(e.consume(x),p):n(x)}function y(x){return tr(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),s=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):b(x)}function b(x){if((x===45||tr(x))&&s++<63){const S=x===45?b:g;return e.consume(x),S}return n(x)}}const sl={partial:!0,tokenize:bM};function bM(e,t,n){return s;function s(c){return Qt(c)?Zt(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||kt(c)?t(c):n(c)}}const nS={continuation:{tokenize:kM},exit:SM,name:"blockQuote",tokenize:xM};function xM(e,t,n){const s=this;return a;function a(l){if(l===62){const d=s.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),c}return n(l)}function c(l){return Qt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function kM(e,t,n){const s=this;return a;function a(l){return Qt(l)?Zt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):c(l)}function c(l){return e.attempt(nS,t,n)(l)}}function SM(e){e.exit("blockQuote")}const rS={name:"characterEscape",tokenize:CM};function CM(e,t,n){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return uM(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const iS={name:"characterReference",tokenize:jM};function jM(e,t,n){const s=this;let a=0,c,l;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),f}function f(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,l=tr,y(g))}function p(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,l=cM,y):(e.enter("characterReferenceValue"),c=7,l=Lf,y(g))}function y(g){if(g===59&&a){const b=e.exit("characterReferenceValue");return l===tr&&!Pm(s.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&a++<c?(e.consume(g),y):n(g)}}const Ov={partial:!0,tokenize:PM},Bv={concrete:!0,name:"codeFenced",tokenize:NM};function NM(e,t,n){const s=this,a={partial:!0,tokenize:H};let c=0,l=0,d;return f;function f(F){return p(F)}function p(F){const M=s.events[s.events.length-1];return c=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,d=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(F)}function y(F){return F===d?(l++,e.consume(F),y):l<3?n(F):(e.exit("codeFencedFenceSequence"),Qt(F)?Zt(e,g,"whitespace")(F):g(F))}function g(F){return F===null||kt(F)?(e.exit("codeFencedFence"),s.interrupt?t(F):e.check(Ov,C,K)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(F))}function b(F){return F===null||kt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(F)):Qt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Zt(e,x,"whitespace")(F)):F===96&&F===d?n(F):(e.consume(F),b)}function x(F){return F===null||kt(F)?g(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(F))}function S(F){return F===null||kt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(F)):F===96&&F===d?n(F):(e.consume(F),S)}function C(F){return e.attempt(a,K,j)(F)}function j(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),R}function R(F){return c>0&&Qt(F)?Zt(e,L,"linePrefix",c+1)(F):L(F)}function L(F){return F===null||kt(F)?e.check(Ov,C,K)(F):(e.enter("codeFlowValue"),A(F))}function A(F){return F===null||kt(F)?(e.exit("codeFlowValue"),L(F)):(e.consume(F),A)}function K(F){return e.exit("codeFenced"),t(F)}function H(F,M,_){let I=0;return P;function P($){return F.enter("lineEnding"),F.consume($),F.exit("lineEnding"),U}function U($){return F.enter("codeFencedFence"),Qt($)?Zt(F,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):G($)}function G($){return $===d?(F.enter("codeFencedFenceSequence"),X($)):_($)}function X($){return $===d?(I++,F.consume($),X):I>=l?(F.exit("codeFencedFenceSequence"),Qt($)?Zt(F,Z,"whitespace")($):Z($)):_($)}function Z($){return $===null||kt($)?(F.exit("codeFencedFence"),M($)):_($)}}}function PM(e,t,n){const s=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}const Sh={name:"codeIndented",tokenize:EM},TM={partial:!0,tokenize:RM};function EM(e,t,n){const s=this;return a;function a(p){return e.enter("codeIndented"),Zt(e,c,"linePrefix",5)(p)}function c(p){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?f(p):kt(p)?e.attempt(TM,l,f)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||kt(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),d)}function f(p){return e.exit("codeIndented"),t(p)}}function RM(e,t,n){const s=this;return a;function a(l){return s.parser.lazy[s.now().line]?n(l):kt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):Zt(e,c,"linePrefix",5)(l)}function c(l){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):kt(l)?a(l):n(l)}}const MM={name:"codeText",previous:LM,resolve:AM,tokenize:IM};function AM(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function LM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function IM(e,t,n){let s=0,a,c;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),s++,d):(e.exit("codeTextSequence"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(c=e.enter("codeTextSequence"),a=0,y(g)):kt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(g))}function p(g){return g===null||g===32||g===96||kt(g)?(e.exit("codeTextData"),f(g)):(e.consume(g),p)}function y(g){return g===96?(e.consume(g),a++,y):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(c.type="codeTextData",p(g))}}class DM{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Na(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Na(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Na(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Na(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Na(this.left,n.reverse())}}}function Na(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function sS(e){const t={};let n=-1,s,a,c,l,d,f,p;const y=new DM(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(s=y.get(n),n&&s[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(f=s[1]._tokenizer.events,c=0,c<f.length&&f[c][1].type==="lineEndingBlank"&&(c+=2),c<f.length&&f[c][1].type==="content"))for(;++c<f.length&&f[c][1].type!=="content";)f[c][1].type==="chunkText"&&(f[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,_M(y,n)),n=t[n],p=!0);else if(s[1]._container){for(c=n,a=void 0;c--;)if(l=y.get(c),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(y.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=c);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(s[1].end={...y.get(a)[1].start},d=y.slice(a,n),d.unshift(s),y.splice(a,n-a+1,d))}}return Ar(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!p}function _M(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const c=[];let l=n._tokenizer;l||(l=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const d=l.events,f=[],p={};let y,g,b=-1,x=n,S=0,C=0;const j=[C];for(;x;){for(;e.get(++a)[1]!==x;);c.push(a),x._tokenizer||(y=s.sliceStream(x),x.next||y.push(null),g&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(y),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++b<d.length;)d[b][0]==="exit"&&d[b-1][0]==="enter"&&d[b][1].type===d[b-1][1].type&&d[b][1].start.line!==d[b][1].end.line&&(C=b+1,j.push(C),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(l.events=[],x?(x._tokenizer=void 0,x.previous=void 0):j.pop(),b=j.length;b--;){const R=d.slice(j[b],j[b+1]),L=c.pop();f.push([L,L+R.length-1]),e.splice(L,2,R)}for(f.reverse(),b=-1;++b<f.length;)p[S+f[b][0]]=S+f[b][1],S+=f[b][1]-f[b][0]-1;return p}const FM={resolve:BM,tokenize:WM},OM={partial:!0,tokenize:UM};function BM(e){return sS(e),e}function WM(e,t){let n;return s;function s(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?c(d):kt(d)?e.check(OM,l,c)(d):(e.consume(d),a)}function c(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function l(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function UM(e,t,n){const s=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Zt(e,c,"linePrefix")}function c(l){if(l===null||kt(l))return n(l);const d=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):e.interrupt(s.parser.constructs.flow,n,t)(l)}}function oS(e,t,n,s,a,c,l,d,f){const p=f||Number.POSITIVE_INFINITY;let y=0;return g;function g(R){return R===60?(e.enter(s),e.enter(a),e.enter(c),e.consume(R),e.exit(c),b):R===null||R===32||R===41||iu(R)?n(R):(e.enter(s),e.enter(l),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(R))}function b(R){return R===62?(e.enter(c),e.consume(R),e.exit(c),e.exit(a),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===62?(e.exit("chunkString"),e.exit(d),b(R)):R===null||R===60||kt(R)?n(R):(e.consume(R),R===92?S:x)}function S(R){return R===60||R===62||R===92?(e.consume(R),x):x(R)}function C(R){return!y&&(R===null||R===41||un(R))?(e.exit("chunkString"),e.exit(d),e.exit(l),e.exit(s),t(R)):y<p&&R===40?(e.consume(R),y++,C):R===41?(e.consume(R),y--,C):R===null||R===32||R===40||iu(R)?n(R):(e.consume(R),R===92?j:C)}function j(R){return R===40||R===41||R===92?(e.consume(R),C):C(R)}}function aS(e,t,n,s,a,c){const l=this;let d=0,f;return p;function p(x){return e.enter(s),e.enter(a),e.consume(x),e.exit(a),e.enter(c),y}function y(x){return d>999||x===null||x===91||x===93&&!f||x===94&&!d&&"_hiddenFootnoteSupport"in l.parser.constructs?n(x):x===93?(e.exit(c),e.enter(a),e.consume(x),e.exit(a),e.exit(s),t):kt(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||kt(x)||d++>999?(e.exit("chunkString"),y(x)):(e.consume(x),f||(f=!Qt(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),d++,g):g(x)}}function lS(e,t,n,s,a,c){let l;return d;function d(b){return b===34||b===39||b===40?(e.enter(s),e.enter(a),e.consume(b),e.exit(a),l=b===40?41:b,f):n(b)}function f(b){return b===l?(e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):(e.enter(c),p(b))}function p(b){return b===l?(e.exit(c),f(l)):b===null?n(b):kt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Zt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===l||b===null||kt(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?g:y)}function g(b){return b===l||b===92?(e.consume(b),y):y(b)}}function Fa(e,t){let n;return s;function s(a){return kt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Qt(a)?Zt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const zM={name:"definition",tokenize:qM},HM={partial:!0,tokenize:$M};function qM(e,t,n){const s=this;let a;return c;function c(x){return e.enter("definition"),l(x)}function l(x){return aS.call(s,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function d(x){return a=ti(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),f):n(x)}function f(x){return un(x)?Fa(e,p)(x):p(x)}function p(x){return oS(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(HM,g,g)(x)}function g(x){return Qt(x)?Zt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||kt(x)?(e.exit("definition"),s.parser.defined.push(a),t(x)):n(x)}}function $M(e,t,n){return s;function s(d){return un(d)?Fa(e,a)(d):n(d)}function a(d){return lS(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Qt(d)?Zt(e,l,"whitespace")(d):l(d)}function l(d){return d===null||kt(d)?t(d):n(d)}}const VM={name:"hardBreakEscape",tokenize:GM};function GM(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return kt(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const KM={name:"headingAtx",resolve:QM,tokenize:YM};function QM(e,t){let n=e.length-2,s=3,a,c;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},c={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Ar(e,s,n-s+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function YM(e,t,n){let s=0;return a;function a(y){return e.enter("atxHeading"),c(y)}function c(y){return e.enter("atxHeadingSequence"),l(y)}function l(y){return y===35&&s++<6?(e.consume(y),l):y===null||un(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),f(y)):y===null||kt(y)?(e.exit("atxHeading"),t(y)):Qt(y)?Zt(e,d,"whitespace")(y):(e.enter("atxHeadingText"),p(y))}function f(y){return y===35?(e.consume(y),f):(e.exit("atxHeadingSequence"),d(y))}function p(y){return y===null||y===35||un(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),p)}}const XM=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Wv=["pre","script","style","textarea"],JM={concrete:!0,name:"htmlFlow",resolveTo:tA,tokenize:nA},ZM={partial:!0,tokenize:iA},eA={partial:!0,tokenize:rA};function tA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function nA(e,t,n){const s=this;let a,c,l,d,f;return p;function p(T){return y(T)}function y(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),c=!0,C):T===63?(e.consume(T),a=3,s.interrupt?t:E):cr(T)?(e.consume(T),l=String.fromCharCode(T),j):n(T)}function b(T){return T===45?(e.consume(T),a=2,x):T===91?(e.consume(T),a=5,d=0,S):cr(T)?(e.consume(T),a=4,s.interrupt?t:E):n(T)}function x(T){return T===45?(e.consume(T),s.interrupt?t:E):n(T)}function S(T){const we="CDATA[";return T===we.charCodeAt(d++)?(e.consume(T),d===we.length?s.interrupt?t:G:S):n(T)}function C(T){return cr(T)?(e.consume(T),l=String.fromCharCode(T),j):n(T)}function j(T){if(T===null||T===47||T===62||un(T)){const we=T===47,me=l.toLowerCase();return!we&&!c&&Wv.includes(me)?(a=1,s.interrupt?t(T):G(T)):XM.includes(l.toLowerCase())?(a=6,we?(e.consume(T),R):s.interrupt?t(T):G(T)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(T):c?L(T):A(T))}return T===45||tr(T)?(e.consume(T),l+=String.fromCharCode(T),j):n(T)}function R(T){return T===62?(e.consume(T),s.interrupt?t:G):n(T)}function L(T){return Qt(T)?(e.consume(T),L):P(T)}function A(T){return T===47?(e.consume(T),P):T===58||T===95||cr(T)?(e.consume(T),K):Qt(T)?(e.consume(T),A):P(T)}function K(T){return T===45||T===46||T===58||T===95||tr(T)?(e.consume(T),K):H(T)}function H(T){return T===61?(e.consume(T),F):Qt(T)?(e.consume(T),H):A(T)}function F(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),f=T,M):Qt(T)?(e.consume(T),F):_(T)}function M(T){return T===f?(e.consume(T),f=null,I):T===null||kt(T)?n(T):(e.consume(T),M)}function _(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||un(T)?H(T):(e.consume(T),_)}function I(T){return T===47||T===62||Qt(T)?A(T):n(T)}function P(T){return T===62?(e.consume(T),U):n(T)}function U(T){return T===null||kt(T)?G(T):Qt(T)?(e.consume(T),U):n(T)}function G(T){return T===45&&a===2?(e.consume(T),se):T===60&&a===1?(e.consume(T),Y):T===62&&a===4?(e.consume(T),B):T===63&&a===3?(e.consume(T),E):T===93&&a===5?(e.consume(T),oe):kt(T)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(ZM,te,X)(T)):T===null||kt(T)?(e.exit("htmlFlowData"),X(T)):(e.consume(T),G)}function X(T){return e.check(eA,Z,te)(T)}function Z(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),$}function $(T){return T===null||kt(T)?X(T):(e.enter("htmlFlowData"),G(T))}function se(T){return T===45?(e.consume(T),E):G(T)}function Y(T){return T===47?(e.consume(T),l="",q):G(T)}function q(T){if(T===62){const we=l.toLowerCase();return Wv.includes(we)?(e.consume(T),B):G(T)}return cr(T)&&l.length<8?(e.consume(T),l+=String.fromCharCode(T),q):G(T)}function oe(T){return T===93?(e.consume(T),E):G(T)}function E(T){return T===62?(e.consume(T),B):T===45&&a===2?(e.consume(T),E):G(T)}function B(T){return T===null||kt(T)?(e.exit("htmlFlowData"),te(T)):(e.consume(T),B)}function te(T){return e.exit("htmlFlow"),t(T)}}function rA(e,t,n){const s=this;return a;function a(l){return kt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c):n(l)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}function iA(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(sl,t,n)}}const sA={name:"htmlText",tokenize:oA};function oA(e,t,n){const s=this;let a,c,l;return d;function d(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),f}function f(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),H):E===63?(e.consume(E),A):cr(E)?(e.consume(E),_):n(E)}function p(E){return E===45?(e.consume(E),y):E===91?(e.consume(E),c=0,S):cr(E)?(e.consume(E),L):n(E)}function y(E){return E===45?(e.consume(E),x):n(E)}function g(E){return E===null?n(E):E===45?(e.consume(E),b):kt(E)?(l=g,Y(E)):(e.consume(E),g)}function b(E){return E===45?(e.consume(E),x):g(E)}function x(E){return E===62?se(E):E===45?b(E):g(E)}function S(E){const B="CDATA[";return E===B.charCodeAt(c++)?(e.consume(E),c===B.length?C:S):n(E)}function C(E){return E===null?n(E):E===93?(e.consume(E),j):kt(E)?(l=C,Y(E)):(e.consume(E),C)}function j(E){return E===93?(e.consume(E),R):C(E)}function R(E){return E===62?se(E):E===93?(e.consume(E),R):C(E)}function L(E){return E===null||E===62?se(E):kt(E)?(l=L,Y(E)):(e.consume(E),L)}function A(E){return E===null?n(E):E===63?(e.consume(E),K):kt(E)?(l=A,Y(E)):(e.consume(E),A)}function K(E){return E===62?se(E):A(E)}function H(E){return cr(E)?(e.consume(E),F):n(E)}function F(E){return E===45||tr(E)?(e.consume(E),F):M(E)}function M(E){return kt(E)?(l=M,Y(E)):Qt(E)?(e.consume(E),M):se(E)}function _(E){return E===45||tr(E)?(e.consume(E),_):E===47||E===62||un(E)?I(E):n(E)}function I(E){return E===47?(e.consume(E),se):E===58||E===95||cr(E)?(e.consume(E),P):kt(E)?(l=I,Y(E)):Qt(E)?(e.consume(E),I):se(E)}function P(E){return E===45||E===46||E===58||E===95||tr(E)?(e.consume(E),P):U(E)}function U(E){return E===61?(e.consume(E),G):kt(E)?(l=U,Y(E)):Qt(E)?(e.consume(E),U):I(E)}function G(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,X):kt(E)?(l=G,Y(E)):Qt(E)?(e.consume(E),G):(e.consume(E),Z)}function X(E){return E===a?(e.consume(E),a=void 0,$):E===null?n(E):kt(E)?(l=X,Y(E)):(e.consume(E),X)}function Z(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||un(E)?I(E):(e.consume(E),Z)}function $(E){return E===47||E===62||un(E)?I(E):n(E)}function se(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function Y(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),q}function q(E){return Qt(E)?Zt(e,oe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):oe(E)}function oe(E){return e.enter("htmlTextData"),l(E)}}const Tm={name:"labelEnd",resolveAll:uA,resolveTo:dA,tokenize:hA},aA={tokenize:fA},lA={tokenize:mA},cA={tokenize:pA};function uA(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Ar(e,0,e.length,n),e}function dA(e,t){let n=e.length,s=0,a,c,l,d;for(;n--;)if(a=e[n][1],c){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(c=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(l=n);const f={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[l][1].end}},y={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[l-2][1].start}};return d=[["enter",f,t],["enter",p,t]],d=Ur(d,e.slice(c+1,c+s+3)),d=Ur(d,[["enter",y,t]]),d=Ur(d,ku(t.parser.constructs.insideSpan.null,e.slice(c+s+4,l-3),t)),d=Ur(d,[["exit",y,t],e[l-2],e[l-1],["exit",p,t]]),d=Ur(d,e.slice(l+1)),d=Ur(d,[["exit",f,t]]),Ar(e,c,e.length,d),e}function hA(e,t,n){const s=this;let a=s.events.length,c,l;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){c=s.events[a][1];break}return d;function d(b){return c?c._inactive?g(b):(l=s.parser.defined.includes(ti(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(aA,y,l?y:g)(b):b===91?e.attempt(lA,y,l?p:g)(b):l?y(b):g(b)}function p(b){return e.attempt(cA,y,g)(b)}function y(b){return t(b)}function g(b){return c._balanced=!0,n(b)}}function fA(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return un(g)?Fa(e,c)(g):c(g)}function c(g){return g===41?y(g):oS(e,l,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return un(g)?Fa(e,f)(g):y(g)}function d(g){return n(g)}function f(g){return g===34||g===39||g===40?lS(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function p(g){return un(g)?Fa(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function mA(e,t,n){const s=this;return a;function a(d){return aS.call(s,e,c,l,"reference","referenceMarker","referenceString")(d)}function c(d){return s.parser.defined.includes(ti(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function l(d){return n(d)}}function pA(e,t,n){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const gA={name:"labelStartImage",resolveAll:Tm.resolveAll,tokenize:yA};function yA(e,t,n){const s=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),l):n(d)}function l(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):t(d)}}const vA={name:"labelStartLink",resolveAll:Tm.resolveAll,tokenize:wA};function wA(e,t,n){const s=this;return a;function a(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),c}function c(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const Ch={name:"lineEnding",tokenize:bA};function bA(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Zt(e,t,"linePrefix")}}const _c={name:"thematicBreak",tokenize:xA};function xA(e,t,n){let s=0,a;return c;function c(p){return e.enter("thematicBreak"),l(p)}function l(p){return a=p,d(p)}function d(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):s>=3&&(p===null||kt(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),s++,f):(e.exit("thematicBreakSequence"),Qt(p)?Zt(e,d,"whitespace")(p):d(p))}}const vr={continuation:{tokenize:jA},exit:PA,name:"list",tokenize:CA},kA={partial:!0,tokenize:TA},SA={partial:!0,tokenize:NA};function CA(e,t,n){const s=this,a=s.events[s.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return d;function d(x){const S=s.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||x===s.containerState.marker:Lf(x)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(_c,n,p)(x):p(x);if(!s.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(x)}return n(x)}function f(x){return Lf(x)&&++l<10?(e.consume(x),f):(!s.interrupt||l<2)&&(s.containerState.marker?x===s.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),p(x)):n(x)}function p(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||x,e.check(sl,s.interrupt?n:y,e.attempt(kA,b,g))}function y(x){return s.containerState.initialBlankLine=!0,c++,b(x)}function g(x){return Qt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):n(x)}function b(x){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function jA(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(sl,a,c);function a(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Zt(e,t,"listItemIndent",s.containerState.size+1)(d)}function c(d){return s.containerState.furtherBlankLines||!Qt(d)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,l(d)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(SA,t,l)(d))}function l(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,Zt(e,e.attempt(vr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function NA(e,t,n){const s=this;return Zt(e,a,"listItemIndent",s.containerState.size+1);function a(c){const l=s.events[s.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===s.containerState.size?t(c):n(c)}}function PA(e){e.exit(this.containerState.type)}function TA(e,t,n){const s=this;return Zt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const l=s.events[s.events.length-1];return!Qt(c)&&l&&l[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Uv={name:"setextUnderline",resolveTo:EA,tokenize:RA};function EA(e,t){let n=e.length,s,a,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const l={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",l,t]),e.splice(c+1,0,["exit",e[s][1],t]),e[s][1].end={...e[c][1].end}):e[s][1]=l,e.push(["exit",l,t]),e}function RA(e,t,n){const s=this;let a;return c;function c(p){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),a=p,l(p)):n(p)}function l(p){return e.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===a?(e.consume(p),d):(e.exit("setextHeadingLineSequence"),Qt(p)?Zt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||kt(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const MA={tokenize:AA};function AA(e){const t=this,n=e.attempt(sl,s,e.attempt(this.parser.constructs.flowInitial,a,Zt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(FM,a)),"linePrefix")));return n;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const LA={resolveAll:uS()},IA=cS("string"),DA=cS("text");function cS(e){return{resolveAll:uS(e==="text"?_A:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],c=n.attempt(a,l,d);return l;function l(y){return p(y)?c(y):d(y)}function d(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),f}function f(y){return p(y)?(n.exit("data"),c(y)):(n.consume(y),f)}function p(y){if(y===null)return!0;const g=a[y];let b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(s,s.previous))return!0}return!1}}}function uS(e){return t;function t(n,s){let a=-1,c;for(;++a<=n.length;)c===void 0?n[a]&&n[a][1].type==="data"&&(c=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==c+2&&(n[c][1].end=n[a-1][1].end,n.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(n,s):n}}function _A(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let c=a.length,l=-1,d=0,f;for(;c--;){const p=a[c];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)d++,l--;if(l)break;l=-1}else if(p===-2)f=!0,d++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const p={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?l:s.start._bufferIndex+l,_index:s.start._index+c,line:s.end.line,column:s.end.column-d,offset:s.end.offset-d},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const FA={42:vr,43:vr,45:vr,48:vr,49:vr,50:vr,51:vr,52:vr,53:vr,54:vr,55:vr,56:vr,57:vr,62:nS},OA={91:zM},BA={[-2]:Sh,[-1]:Sh,32:Sh},WA={35:KM,42:_c,45:[Uv,_c],60:JM,61:Uv,95:_c,96:Bv,126:Bv},UA={38:iS,92:rS},zA={[-5]:Ch,[-4]:Ch,[-3]:Ch,33:gA,38:iS,42:If,60:[vM,sA],91:vA,92:[VM,rS],93:Tm,95:If,96:MM},HA={null:[If,LA]},qA={null:[42,95]},$A={null:[]},VA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qA,contentInitial:OA,disable:$A,document:FA,flow:WA,flowInitial:BA,insideSpan:HA,string:UA,text:zA},Symbol.toStringTag,{value:"Module"}));function GA(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},c=[];let l=[],d=[];const f={attempt:M(H),check:M(F),consume:L,enter:A,exit:K,interrupt:M(F,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=t.tokenize.call(p,f);return t.resolveAll&&c.push(t),p;function g(U){return l=Ur(l,U),j(),l[l.length-1]!==null?[]:(_(t,0),p.events=ku(c,p.events,p),p.events)}function b(U,G){return QA(x(U),G)}function x(U){return KA(l,U)}function S(){const{_bufferIndex:U,_index:G,line:X,column:Z,offset:$}=s;return{_bufferIndex:U,_index:G,line:X,column:Z,offset:$}}function C(U){a[U.line]=U.column,P()}function j(){let U;for(;s._index<l.length;){const G=l[s._index];if(typeof G=="string")for(U=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===U&&s._bufferIndex<G.length;)R(G.charCodeAt(s._bufferIndex));else R(G)}}function R(U){y=y(U)}function L(U){kt(U)?(s.line++,s.column=1,s.offset+=U===-3?2:1,P()):U!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===l[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=U}function A(U,G){const X=G||{};return X.type=U,X.start=S(),p.events.push(["enter",X,p]),d.push(X),X}function K(U){const G=d.pop();return G.end=S(),p.events.push(["exit",G,p]),G}function H(U,G){_(U,G.from)}function F(U,G){G.restore()}function M(U,G){return X;function X(Z,$,se){let Y,q,oe,E;return Array.isArray(Z)?te(Z):"tokenize"in Z?te([Z]):B(Z);function B(Ce){return _e;function _e(Ge){const ot=Ge!==null&&Ce[Ge],mt=Ge!==null&&Ce.null,jt=[...Array.isArray(ot)?ot:ot?[ot]:[],...Array.isArray(mt)?mt:mt?[mt]:[]];return te(jt)(Ge)}}function te(Ce){return Y=Ce,q=0,Ce.length===0?se:T(Ce[q])}function T(Ce){return _e;function _e(Ge){return E=I(),oe=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?me():Ce.tokenize.call(G?Object.assign(Object.create(p),G):p,f,we,me)(Ge)}}function we(Ce){return U(oe,E),$}function me(Ce){return E.restore(),++q<Y.length?T(Y[q]):se}}}function _(U,G){U.resolveAll&&!c.includes(U)&&c.push(U),U.resolve&&Ar(p.events,G,p.events.length-G,U.resolve(p.events.slice(G),p)),U.resolveTo&&(p.events=U.resolveTo(p.events,p))}function I(){const U=S(),G=p.previous,X=p.currentConstruct,Z=p.events.length,$=Array.from(d);return{from:Z,restore:se};function se(){s=U,p.previous=G,p.currentConstruct=X,p.events.length=Z,d=$,P()}}function P(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function KA(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(s,c)];else{if(l=e.slice(n,a),s>-1){const d=l[0];typeof d=="string"?l[0]=d.slice(s):l.shift()}c>0&&l.push(e[a].slice(0,c))}return l}function QA(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const c=e[n];let l;if(typeof c=="string")l=c;else switch(c){case-5:{l="\r";break}case-4:{l=`
|
|
71
|
+
`;break}case-3:{l=`\r
|
|
72
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(c)}a=c===-2,s.push(l)}return s.join("")}function YA(e){const s={constructs:eS([VA,...(e||{}).extensions||[]]),content:a(dM),defined:[],document:a(fM),flow:a(MA),lazy:{},string:a(IA),text:a(DA)};return s;function a(c){return l;function l(d){return GA(s,c,d)}}}function XA(e){for(;!sS(e););return e}const zv=/[\0\t\n\r]/g;function JA(){let e=1,t="",n=!0,s;return a;function a(c,l,d){const f=[];let p,y,g,b,x;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(l||void 0).decode(c)),g=0,t="",n&&(c.charCodeAt(0)===65279&&g++,n=void 0);g<c.length;){if(zv.lastIndex=g,p=zv.exec(c),b=p&&p.index!==void 0?p.index:c.length,x=c.charCodeAt(b),!p){t=c.slice(g);break}if(x===10&&g===b&&s)f.push(-3),s=void 0;else switch(s&&(f.push(-5),s=void 0),g<b&&(f.push(c.slice(g,b)),e+=b-g),x){case 0:{f.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,f.push(-2);e++<y;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:s=!0,e=1}g=b+1}return d&&(s&&f.push(-5),t&&f.push(t),f.push(null)),f}}const ZA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eL(e){return e.replace(ZA,tL)}function tL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return tS(n.slice(c?2:1),c?16:10)}return Pm(n)||e}const dS={}.hasOwnProperty;function nL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rL(n)(XA(YA(n).document().write(JA()(e,t,!0))))}function rL(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(tn),autolinkProtocol:I,autolinkEmail:I,atxHeading:c(vt),blockQuote:c(mt),characterEscape:I,characterReference:I,codeFenced:c(jt),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:c(jt,l),codeText:c(yt,l),codeTextData:I,data:I,codeFlowValue:I,definition:c(St),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:c(Lt),hardBreakEscape:c(zt),hardBreakTrailing:c(zt),htmlFlow:c(Rt,l),htmlFlowData:I,htmlText:c(Rt,l),htmlTextData:I,image:c(ft),label:l,link:c(tn),listItem:c(Ot),listItemValue:b,listOrdered:c(qt,g),listUnordered:c(qt),paragraph:c(tt),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:c(vt),strong:c($t),thematicBreak:c(Vt)},exit:{atxHeading:f(),atxHeadingSequence:H,autolink:f(),autolinkEmail:ot,autolinkProtocol:Ge,blockQuote:f(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:Ce,characterReference:_e,codeFenced:f(j),codeFencedFence:C,codeFencedFenceInfo:x,codeFencedFenceMeta:S,codeFlowValue:P,codeIndented:f(R),codeText:f($),codeTextData:P,data:P,definition:f(),definitionDestinationString:K,definitionLabelString:L,definitionTitleString:A,emphasis:f(),hardBreakEscape:f(G),hardBreakTrailing:f(G),htmlFlow:f(X),htmlFlowData:P,htmlText:f(Z),htmlTextData:P,image:f(Y),label:oe,labelText:q,lineEnding:U,link:f(se),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:we,resourceDestinationString:E,resourceTitleString:B,resource:te,setextHeading:f(_),setextHeadingLineSequence:M,setextHeadingText:F,strong:f(),thematicBreak:f()}};hS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ue){let ve={type:"root",children:[]};const Le={stack:[ve],tokenStack:[],config:t,enter:d,exit:p,buffer:l,resume:y,data:n},Ke=[];let nt=-1;for(;++nt<ue.length;)if(ue[nt][1].type==="listOrdered"||ue[nt][1].type==="listUnordered")if(ue[nt][0]==="enter")Ke.push(nt);else{const wt=Ke.pop();nt=a(ue,wt,nt)}for(nt=-1;++nt<ue.length;){const wt=t[ue[nt][0]];dS.call(wt,ue[nt][1].type)&&wt[ue[nt][1].type].call(Object.assign({sliceSerialize:ue[nt][2].sliceSerialize},Le),ue[nt][1])}if(Le.tokenStack.length>0){const wt=Le.tokenStack[Le.tokenStack.length-1];(wt[1]||Hv).call(Le,void 0,wt[0])}for(ve.position={start:Zi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Zi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<t.transforms.length;)ve=t.transforms[nt](ve)||ve;return ve}function a(ue,ve,Le){let Ke=ve-1,nt=-1,wt=!1,Dt,Pt,Ze,Wt;for(;++Ke<=Le;){const ct=ue[Ke];switch(ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ct[0]==="enter"?nt++:nt--,Wt=void 0;break}case"lineEndingBlank":{ct[0]==="enter"&&(Dt&&!Wt&&!nt&&!Ze&&(Ze=Ke),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!nt&&ct[0]==="enter"&&ct[1].type==="listItemPrefix"||nt===-1&&ct[0]==="exit"&&(ct[1].type==="listUnordered"||ct[1].type==="listOrdered")){if(Dt){let It=Ke;for(Pt=void 0;It--;){const Mt=ue[It];if(Mt[1].type==="lineEnding"||Mt[1].type==="lineEndingBlank"){if(Mt[0]==="exit")continue;Pt&&(ue[Pt][1].type="lineEndingBlank",wt=!0),Mt[1].type="lineEnding",Pt=It}else if(!(Mt[1].type==="linePrefix"||Mt[1].type==="blockQuotePrefix"||Mt[1].type==="blockQuotePrefixWhitespace"||Mt[1].type==="blockQuoteMarker"||Mt[1].type==="listItemIndent"))break}Ze&&(!Pt||Ze<Pt)&&(Dt._spread=!0),Dt.end=Object.assign({},Pt?ue[Pt][1].start:ct[1].end),ue.splice(Pt||Ke,0,["exit",Dt,ct[2]]),Ke++,Le++}if(ct[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},ct[1].start),end:void 0};Dt=It,ue.splice(Ke,0,["enter",It,ct[2]]),Ke++,Le++,Ze=void 0,Wt=!0}}}return ue[ve][1]._spread=wt,Le}function c(ue,ve){return Le;function Le(Ke){d.call(this,ue(Ke),Ke),ve&&ve.call(this,Ke)}}function l(){this.stack.push({type:"fragment",children:[]})}function d(ue,ve,Le){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ve,Le||void 0]),ue.position={start:Zi(ve.start),end:void 0}}function f(ue){return ve;function ve(Le){ue&&ue.call(this,Le),p.call(this,Le)}}function p(ue,ve){const Le=this.stack.pop(),Ke=this.tokenStack.pop();if(Ke)Ke[0].type!==ue.type&&(ve?ve.call(this,ue,Ke[0]):(Ke[1]||Hv).call(this,ue,Ke[0]));else throw new Error("Cannot close `"+ue.type+"` ("+_a({start:ue.start,end:ue.end})+"): it’s not open");Le.position.end=Zi(ue.end)}function y(){return Nm(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ue}function S(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue.replace(/(\r?\n|\r)$/g,"")}function L(ue){const ve=this.resume(),Le=this.stack[this.stack.length-1];Le.label=ve,Le.identifier=ti(this.sliceSerialize(ue)).toLowerCase()}function A(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ue}function K(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ue}function H(ue){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Le=this.sliceSerialize(ue).length;ve.depth=Le}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function M(ue){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ue){const Le=this.stack[this.stack.length-1].children;let Ke=Le[Le.length-1];(!Ke||Ke.type!=="text")&&(Ke=gt(),Ke.position={start:Zi(ue.start),end:void 0},Le.push(Ke)),this.stack.push(Ke)}function P(ue){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ue),ve.position.end=Zi(ue.end)}function U(ue){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=ve.children[ve.children.length-1];Le.position.end=Zi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(I.call(this,ue),P.call(this,ue))}function G(){this.data.atHardBreak=!0}function X(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function Z(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function $(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function se(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ve,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Y(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ve,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function q(ue){const ve=this.sliceSerialize(ue),Le=this.stack[this.stack.length-2];Le.label=eL(ve),Le.identifier=ti(ve).toLowerCase()}function oe(){const ue=this.stack[this.stack.length-1],ve=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ke=ue.children;Le.children=Ke}else Le.alt=ve}function E(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ue}function B(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ue}function te(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function we(ue){const ve=this.resume(),Le=this.stack[this.stack.length-1];Le.label=ve,Le.identifier=ti(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function me(ue){this.data.characterReferenceType=ue.type}function Ce(ue){const ve=this.sliceSerialize(ue),Le=this.data.characterReferenceType;let Ke;Le?(Ke=tS(ve,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ke=Pm(ve);const nt=this.stack[this.stack.length-1];nt.value+=Ke}function _e(ue){const ve=this.stack.pop();ve.position.end=Zi(ue.end)}function Ge(ue){P.call(this,ue);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ue)}function ot(ue){P.call(this,ue);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ue)}function mt(){return{type:"blockquote",children:[]}}function jt(){return{type:"code",lang:null,meta:null,value:""}}function yt(){return{type:"inlineCode",value:""}}function St(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Lt(){return{type:"emphasis",children:[]}}function vt(){return{type:"heading",depth:0,children:[]}}function zt(){return{type:"break"}}function Rt(){return{type:"html",value:""}}function ft(){return{type:"image",title:null,url:"",alt:null}}function tn(){return{type:"link",title:null,url:"",children:[]}}function qt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Ot(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function Vt(){return{type:"thematicBreak"}}}function Zi(e){return{line:e.line,column:e.column,offset:e.offset}}function hS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?hS(e,s):iL(e,s)}}function iL(e,t){let n;for(n in t)if(dS.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Hv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+_a({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_a({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+_a({start:t.start,end:t.end})+") is still open")}function sL(e){const t=this;t.parser=n;function n(s){return nL(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function oL(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
73
|
+
`}]}function lL(e,t){const n=t.value?t.value+`
|
|
74
|
+
`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function cL(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=_o(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let l,d=e.footnoteCounts.get(s);d===void 0?(d=0,e.footnoteOrder.push(s),l=e.footnoteOrder.length):l=c+1,d+=1,e.footnoteCounts.set(s,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function hL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fS(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=s:a.push({type:"text",value:s}),a}function mL(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return fS(e,t);const a={src:_o(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function pL(e,t){const n={src:_o(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function gL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function yL(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return fS(e,t);const a={href:_o(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function vL(e,t){const n={href:_o(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function wL(e,t,n){const s=e.all(t),a=n?bL(n):mS(t),c={},l=[];if(typeof t.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<s.length;){const y=s[d];(a||d!==0||y.type!=="element"||y.tagName!=="p")&&l.push({type:"text",value:`
|
|
75
|
+
`}),y.type==="element"&&y.tagName==="p"&&!a?l.push(...y.children):l.push(y)}const f=s[s.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
76
|
+
`});const p={type:"element",tagName:"li",properties:c,children:l};return e.patch(t,p),e.applyData(t,p)}function bL(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=mS(n[s])}return t}function mS(e){const t=e.spread;return t??e.children.length>1}function xL(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const l=s[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function kL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function CL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jL(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=km(t.children[1]),f=Gk(t.children[t.children.length-1]);d&&f&&(l.position={start:d,end:f}),a.push(l)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function NL(e,t,n){const s=n?n.children:void 0,c=(s?s.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,d=l?l.length:t.children.length;let f=-1;const p=[];for(;++f<d;){const g=t.children[f],b={},x=l?l[f]:void 0;x&&(b.align=x);let S={type:"element",tagName:c,properties:b,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),p.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,y),e.applyData(t,y)}function PL(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const qv=9,$v=32;function TL(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const c=[];for(;s;)c.push(Vv(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return c.push(Vv(t.slice(a),a>0,!1)),c.join("")}function Vv(e,t,n){let s=0,a=e.length;if(t){let c=e.codePointAt(s);for(;c===qv||c===$v;)s++,c=e.codePointAt(s)}if(n){let c=e.codePointAt(a-1);for(;c===qv||c===$v;)a--,c=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function EL(e,t){const n={type:"text",value:TL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function RL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ML={blockquote:oL,break:aL,code:lL,delete:cL,emphasis:uL,footnoteReference:dL,heading:hL,html:fL,imageReference:mL,image:pL,inlineCode:gL,linkReference:yL,link:vL,listItem:wL,list:xL,paragraph:kL,root:SL,strong:CL,table:jL,tableCell:PL,tableRow:NL,text:EL,thematicBreak:RL,toml:fc,yaml:fc,definition:fc,footnoteDefinition:fc};function fc(){}const pS=-1,Su=0,Oa=1,su=2,Em=3,Rm=4,Mm=5,Am=6,gS=7,yS=8,Gv=typeof self=="object"?self:globalThis,AL=(e,t)=>{const n=(a,c)=>(e.set(c,a),a),s=a=>{if(e.has(a))return e.get(a);const[c,l]=t[a];switch(c){case Su:case pS:return n(l,a);case Oa:{const d=n([],a);for(const f of l)d.push(s(f));return d}case su:{const d=n({},a);for(const[f,p]of l)d[s(f)]=s(p);return d}case Em:return n(new Date(l),a);case Rm:{const{source:d,flags:f}=l;return n(new RegExp(d,f),a)}case Mm:{const d=n(new Map,a);for(const[f,p]of l)d.set(s(f),s(p));return d}case Am:{const d=n(new Set,a);for(const f of l)d.add(s(f));return d}case gS:{const{name:d,message:f}=l;return n(new Gv[d](f),a)}case yS:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:d}=new Uint8Array(l);return n(new DataView(d),l)}}return n(new Gv[c](l),a)};return s},Kv=e=>AL(new Map,e)(0),yo="",{toString:LL}={},{keys:IL}=Object,Pa=e=>{const t=typeof e;if(t!=="object"||!e)return[Su,t];const n=LL.call(e).slice(8,-1);switch(n){case"Array":return[Oa,yo];case"Object":return[su,yo];case"Date":return[Em,yo];case"RegExp":return[Rm,yo];case"Map":return[Mm,yo];case"Set":return[Am,yo];case"DataView":return[Oa,n]}return n.includes("Array")?[Oa,n]:n.includes("Error")?[gS,n]:[su,n]},mc=([e,t])=>e===Su&&(t==="function"||t==="symbol"),DL=(e,t,n,s)=>{const a=(l,d)=>{const f=s.push(l)-1;return n.set(d,f),f},c=l=>{if(n.has(l))return n.get(l);let[d,f]=Pa(l);switch(d){case Su:{let y=l;switch(f){case"bigint":d=yS,y=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);y=null;break;case"undefined":return a([pS],l)}return a([d,y],l)}case Oa:{if(f){let b=l;return f==="DataView"?b=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(l)),a([f,[...b]],l)}const y=[],g=a([d,y],l);for(const b of l)y.push(c(b));return g}case su:{if(f)switch(f){case"BigInt":return a([f,l.toString()],l);case"Boolean":case"Number":case"String":return a([f,l.valueOf()],l)}if(t&&"toJSON"in l)return c(l.toJSON());const y=[],g=a([d,y],l);for(const b of IL(l))(e||!mc(Pa(l[b])))&&y.push([c(b),c(l[b])]);return g}case Em:return a([d,l.toISOString()],l);case Rm:{const{source:y,flags:g}=l;return a([d,{source:y,flags:g}],l)}case Mm:{const y=[],g=a([d,y],l);for(const[b,x]of l)(e||!(mc(Pa(b))||mc(Pa(x))))&&y.push([c(b),c(x)]);return g}case Am:{const y=[],g=a([d,y],l);for(const b of l)(e||!mc(Pa(b)))&&y.push(c(b));return g}}const{message:p}=l;return a([d,{name:f,message:p}],l)};return c},Qv=(e,{json:t,lossy:n}={})=>{const s=[];return DL(!(t||n),!!t,new Map,s)(e),s},ou=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Kv(Qv(e,t)):structuredClone(e):(e,t)=>Kv(Qv(e,t));function _L(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function FL(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function OL(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||_L,s=e.options.footnoteBackLabel||FL,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const y=e.all(p),g=String(p.identifier).toUpperCase(),b=_o(g.toLowerCase());let x=0;const S=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++x<=C;){S.length>0&&S.push({type:"text",value:" "});let L=typeof n=="string"?n:n(f,x);typeof L=="string"&&(L={type:"text",value:L}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(f,x),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const j=y[y.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const L=j.children[j.children.length-1];L&&L.type==="text"?L.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...S)}else y.push(...S);const R={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(y,!0)};e.patch(p,R),d.push(R)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...ou(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
77
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
78
|
+
`}]}}const Cu=(function(e){if(e==null)return zL;if(typeof e=="function")return ju(e);if(typeof e=="object")return Array.isArray(e)?BL(e):WL(e);if(typeof e=="string")return UL(e);throw new Error("Expected function, string, or object as test")});function BL(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Cu(e[n]);return ju(s);function s(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function WL(e){const t=e;return ju(n);function n(s){const a=s;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function UL(e){return ju(t);function t(n){return n&&n.type===e}}function ju(e){return t;function t(n,s,a){return!!(HL(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function zL(){return!0}function HL(e){return e!==null&&typeof e=="object"&&"type"in e}const vS=[],qL=!0,Df=!1,$L="skip";function wS(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const c=Cu(a),l=s?-1:1;d(e,void 0,[])();function d(f,p,y){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(x?"<"+x+">":""))+")"})}return b;function b(){let x=vS,S,C,j;if((!t||c(f,p,y[y.length-1]||void 0))&&(x=VL(n(f,y)),x[0]===Df))return x;if("children"in f&&f.children){const R=f;if(R.children&&x[0]!==$L)for(C=(s?R.children.length:-1)+l,j=y.concat(R);C>-1&&C<R.children.length;){const L=R.children[C];if(S=d(L,C,j)(),S[0]===Df)return S;C=typeof S[1]=="number"?S[1]:C+l}}return x}}}function VL(e){return Array.isArray(e)?e:typeof e=="number"?[qL,e]:e==null?vS:[e]}function Lm(e,t,n,s){let a,c,l;typeof t=="function"&&typeof n!="function"?(c=void 0,l=t,a=n):(c=t,l=n,a=s),wS(e,c,d,a);function d(f,p){const y=p[p.length-1],g=y?y.children.indexOf(f):void 0;return l(f,g,y)}}const _f={}.hasOwnProperty,GL={};function KL(e,t){const n=t||GL,s=new Map,a=new Map,c=new Map,l={...ML,...n.handlers},d={all:p,applyData:YL,definitionById:s,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:l,one:f,options:n,patch:QL,wrap:JL};return Lm(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:a,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),d;function f(y,g){const b=y.type,x=d.handlers[b];if(_f.call(d.handlers,b)&&x)return x(d,y,g);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in y){const{children:C,...j}=y,R=ou(j);return R.children=d.all(y),R}return ou(y)}return(d.options.unknownHandler||XL)(d,y,g)}function p(y){const g=[];if("children"in y){const b=y.children;let x=-1;for(;++x<b.length;){const S=d.one(b[x],y);if(S){if(x&&b[x-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Yv(S.value)),!Array.isArray(S)&&S.type==="element")){const C=S.children[0];C&&C.type==="text"&&(C.value=Yv(C.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function QL(e,t){e.position&&(t.position=FR(e))}function YL(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const l="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:l}}n.type==="element"&&c&&Object.assign(n.properties,ou(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function XL(e,t){const n=t.data||{},s="value"in t&&!(_f.call(n,"hProperties")||_f.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function JL(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
79
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
80
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
81
|
+
`}),n}function Yv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Xv(e,t){const n=KL(e,t),s=n.one(e,void 0),a=OL(n),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
|
|
82
|
+
`},a),c}function ZL(e,t){return e&&"run"in e?async function(n,s){const a=Xv(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Xv(n,{file:s,...e||t})}}function Jv(e){if(e)throw e}var jh,Zv;function eI(){if(Zv)return jh;Zv=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var y=e.call(p,"constructor"),g=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!y&&!g)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},l=function(p,y){n&&y.name==="__proto__"?n(p,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):p[y.name]=y.newValue},d=function(p,y){if(y==="__proto__")if(e.call(p,y)){if(s)return s(p,y).value}else return;return p[y]};return jh=function f(){var p,y,g,b,x,S,C=arguments[0],j=1,R=arguments.length,L=!1;for(typeof C=="boolean"&&(L=C,C=arguments[1]||{},j=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});j<R;++j)if(p=arguments[j],p!=null)for(y in p)g=d(C,y),b=d(p,y),C!==b&&(L&&b&&(c(b)||(x=a(b)))?(x?(x=!1,S=g&&a(g)?g:[]):S=g&&c(g)?g:{},l(C,{name:y,newValue:f(L,S,b)})):typeof b<"u"&&l(C,{name:y,newValue:b}));return C},jh}var tI=eI();const Nh=Ja(tI);function Ff(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function nI(){const e=[],t={run:n,use:s};return t;function n(...a){let c=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);d(null,...a);function d(f,...p){const y=e[++c];let g=-1;if(f){l(f);return}for(;++g<a.length;)(p[g]===null||p[g]===void 0)&&(p[g]=a[g]);a=p,y?rI(y,d)(...p):l(null,...p)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function rI(e,t){let n;return s;function s(...l){const d=e.length>l.length;let f;d&&l.push(a);try{f=e.apply(this,l)}catch(p){const y=p;if(d&&n)throw y;return a(y)}d||(f&&f.then&&typeof f.then=="function"?f.then(c,a):f instanceof Error?a(f):c(f))}function a(l,...d){n||(n=!0,t(l,...d))}function c(l){a(null,l)}}const hi={basename:iI,dirname:sI,extname:oI,join:aI,sep:"/"};function iI(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ol(e);let n=0,s=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else s<0&&(c=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let l=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else l<0&&(c=!0,l=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(s=a):(d=-1,s=l));return n===s?s=l:s<0&&(s=e.length),e.slice(n,s)}function sI(e){if(ol(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function oI(e){ol(e);let t=e.length,n=-1,s=0,a=-1,c=0,l;for(;t--;){const d=e.codePointAt(t);if(d===47){if(l){s=t+1;break}continue}n<0&&(l=!0,n=t+1),d===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||n<0||c===0||c===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function aI(...e){let t=-1,n;for(;++t<e.length;)ol(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":lI(n)}function lI(e){ol(e);const t=e.codePointAt(0)===47;let n=cI(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function cI(e,t){let n="",s=0,a=-1,c=0,l=-1,d,f;for(;++l<=e.length;){if(l<e.length)d=e.codePointAt(l);else{if(d===47)break;d=47}if(d===47){if(!(a===l-1||c===1))if(a!==l-1&&c===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",s=0):(n=n.slice(0,f),s=n.length-1-n.lastIndexOf("/")),a=l,c=0;continue}}else if(n.length>0){n="",s=0,a=l,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),s=l-a-1;a=l,c=0}else d===46&&c>-1?c++:c=-1}return n}function ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const uI={cwd:dI};function dI(){return"/"}function Of(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hI(e){if(typeof e=="string")e=new URL(e);else if(!Of(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return fI(e)}function fI(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ph=["history","path","basename","stem","extname","dirname"];class bS{constructor(t){let n;t?Of(t)?n={path:t}:typeof t=="string"||mI(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":uI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ph.length;){const c=Ph[s];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let a;for(a in n)Ph.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?hi.basename(this.path):void 0}set basename(t){Eh(t,"basename"),Th(t,"basename"),this.path=hi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?hi.dirname(this.path):void 0}set dirname(t){ew(this.basename,"dirname"),this.path=hi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?hi.extname(this.path):void 0}set extname(t){if(Th(t,"extname"),ew(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=hi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Of(t)&&(t=hI(t)),Eh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?hi.basename(this.path,this.extname):void 0}set stem(t){Eh(t,"stem"),Th(t,"stem"),this.path=hi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new rr(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Th(e,t){if(e&&e.includes(hi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+hi.sep+"`")}function Eh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ew(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function mI(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pI=(function(e){const s=this.constructor.prototype,a=s[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),gI={}.hasOwnProperty;class Im extends pI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=nI()}copy(){const t=new Im;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Nh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ah("data",this.frozen),this.namespace[t]=n,this):gI.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ah("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=pc(t),s=this.parser||this.Parser;return Rh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Rh("process",this.parser||this.Parser),Mh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,l){const d=pc(t),f=s.parse(d);s.run(f,d,function(y,g,b){if(y||!g||!b)return p(y);const x=g,S=s.stringify(x,b);wI(S)?b.value=S:b.result=S,p(y,b)});function p(y,g){y||!g?l(y):c?c(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Rh("processSync",this.parser||this.Parser),Mh("processSync",this.compiler||this.Compiler),this.process(t,a),nw("processSync","process",n),s;function a(c,l){n=!0,Jv(c),s=l}}run(t,n,s){tw(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?c(void 0,s):new Promise(c);function c(l,d){const f=pc(n);a.run(t,f,p);function p(y,g,b){const x=g||t;y?d(y):l?l(x):s(void 0,x,b)}}}runSync(t,n){let s=!1,a;return this.run(t,n,c),nw("runSync","run",s),a;function c(l,d){Jv(l),a=d,s=!0}}stringify(t,n){this.freeze();const s=pc(n),a=this.compiler||this.Compiler;return Mh("stringify",a),tw(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Ah("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[y,...g]=p;f(y,g)}else l(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function l(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(p.plugins),p.settings&&(a.settings=Nh(!0,a.settings,p.settings))}function d(p){let y=-1;if(p!=null)if(Array.isArray(p))for(;++y<p.length;){const g=p[y];c(g)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,y){let g=-1,b=-1;for(;++g<s.length;)if(s[g][0]===p){b=g;break}if(b===-1)s.push([p,...y]);else if(y.length>0){let[x,...S]=y;const C=s[b][1];Ff(C)&&Ff(x)&&(x=Nh(!0,C,x)),s[b]=[p,x,...S]}}}}const yI=new Im().freeze();function Rh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ah(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tw(e){if(!Ff(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pc(e){return vI(e)?e:new bS(e)}function vI(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function wI(e){return typeof e=="string"||bI(e)}function bI(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rw=[],iw={allowDangerousHtml:!0},kI=/^(https?|ircs?|mailto|xmpp)$/i,SI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Dm(e){const t=CI(e),n=jI(e);return NI(t.runSync(t.parse(n),n),e)}function CI(e){const t=e.rehypePlugins||rw,n=e.remarkPlugins||rw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iw}:iw;return yI().use(sL).use(n).use(ZL,s).use(t)}function jI(e){const t=e.children||"",n=new bS;return typeof t=="string"&&(n.value=t),n}function NI(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,c=t.disallowedElements,l=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||PI;for(const y of SI)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+xI+y.id,void 0);return Lm(e,p),zR(e,{Fragment:i.Fragment,components:a,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function p(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return l?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in kh)if(Object.hasOwn(kh,x)&&Object.hasOwn(y.properties,x)){const S=y.properties[x],C=kh[x];(C===null||C.includes(y.tagName))&&(y.properties[x]=f(String(S||""),x,y))}}if(y.type==="element"){let x=n?!n.includes(y.tagName):c?c.includes(y.tagName):!1;if(!x&&s&&typeof g=="number"&&(x=!s(y,g,b)),x&&b&&typeof g=="number")return d&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function PI(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||kI.test(e.slice(0,t))?e:""}function sw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function TI(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function EI(e,t,n){const a=Cu((n||{}).ignore||[]),c=RI(t);let l=-1;for(;++l<c.length;)wS(e,"text",d);function d(p,y){let g=-1,b;for(;++g<y.length;){const x=y[g],S=b?b.children:void 0;if(a(x,S?S.indexOf(x):void 0,b))return;b=x}if(b)return f(p,y)}function f(p,y){const g=y[y.length-1],b=c[l][0],x=c[l][1];let S=0;const j=g.children.indexOf(p);let R=!1,L=[];b.lastIndex=0;let A=b.exec(p.value);for(;A;){const K=A.index,H={index:A.index,input:A.input,stack:[...y,p]};let F=x(...A,H);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1?b.lastIndex=K+1:(S!==K&&L.push({type:"text",value:p.value.slice(S,K)}),Array.isArray(F)?L.push(...F):F&&L.push(F),S=K+A[0].length,R=!0),!b.global)break;A=b.exec(p.value)}return R?(S<p.value.length&&L.push({type:"text",value:p.value.slice(S)}),g.children.splice(j,1,...L)):L=[p],j+L.length}}function RI(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([MI(a[0]),AI(a[1])])}return t}function MI(e){return typeof e=="string"?new RegExp(TI(e),"g"):e}function AI(e){return typeof e=="function"?e:function(){return e}}const Lh="phrasing",Ih=["autolink","link","image","label"];function LI(){return{transforms:[WI],enter:{literalAutolink:DI,literalAutolinkEmail:Dh,literalAutolinkHttp:Dh,literalAutolinkWww:Dh},exit:{literalAutolink:BI,literalAutolinkEmail:OI,literalAutolinkHttp:_I,literalAutolinkWww:FI}}}function II(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lh,notInConstruct:Ih},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lh,notInConstruct:Ih},{character:":",before:"[ps]",after:"\\/",inConstruct:Lh,notInConstruct:Ih}]}}function DI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Dh(e){this.config.enter.autolinkProtocol.call(this,e)}function _I(e){this.config.exit.autolinkProtocol.call(this,e)}function FI(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function OI(e){this.config.exit.autolinkEmail.call(this,e)}function BI(e){this.exit(e)}function WI(e){EI(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,UI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),zI]],{ignore:["link","linkReference"]})}function UI(e,t,n,s,a){let c="";if(!xS(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!HI(n)))return!1;const l=qI(n+s);if(!l[0])return!1;const d={type:"link",title:null,url:c+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[d,{type:"text",value:l[1]}]:d}function zI(e,t,n,s){return!xS(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function HI(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function qI(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=sw(e,"(");let c=sw(e,")");for(;s!==-1&&a>c;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),c++;return[e,n]}function xS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Os(n)||xu(n))&&(!t||n!==47)}kS.peek=ZI;function $I(){this.buffer()}function VI(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function GI(){this.buffer()}function KI(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function QI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ti(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YI(e){this.exit(e)}function XI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ti(this.sliceSerialize(e)).toLowerCase(),n.label=t}function JI(e){this.exit(e)}function ZI(){return"["}function kS(e,t,n,s){const a=n.createTracker(s);let c=a.move("[^");const l=n.enter("footnoteReference"),d=n.enter("reference");return c+=a.move(n.safe(n.associationId(e),{after:"]",before:c})),d(),l(),c+=a.move("]"),c}function eD(){return{enter:{gfmFootnoteCallString:$I,gfmFootnoteCall:VI,gfmFootnoteDefinitionLabelString:GI,gfmFootnoteDefinition:KI},exit:{gfmFootnoteCallString:QI,gfmFootnoteCall:YI,gfmFootnoteDefinitionLabelString:XI,gfmFootnoteDefinition:JI}}}function tD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,c,l){const d=c.createTracker(l);let f=d.move("[^");const p=c.enter("footnoteDefinition"),y=c.enter("label");return f+=d.move(c.safe(c.associationId(s),{before:f,after:"]"})),y(),f+=d.move("]:"),s.children&&s.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
83
|
+
`:" ")+c.indentLines(c.containerFlow(s,d.current()),t?SS:nD))),p(),f}}function nD(e,t,n){return t===0?e:SS(e,t,n)}function SS(e,t,n){return(n?"":" ")+e}const rD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];CS.peek=lD;function iD(){return{canContainEols:["delete"],enter:{strikethrough:oD},exit:{strikethrough:aD}}}function sD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rD}],handlers:{delete:CS}}}function oD(e){this.enter({type:"delete",children:[]},e)}function aD(e){this.exit(e)}function CS(e,t,n,s){const a=n.createTracker(s),c=n.enter("strikethrough");let l=a.move("~~");return l+=n.containerPhrasing(e,{...a.current(),before:l,after:"~"}),l+=a.move("~~"),c(),l}function lD(){return"~"}function cD(e){return e.length}function uD(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||cD,c=[],l=[],d=[],f=[];let p=0,y=-1;for(;++y<e.length;){const C=[],j=[];let R=-1;for(e[y].length>p&&(p=e[y].length);++R<e[y].length;){const L=dD(e[y][R]);if(n.alignDelimiters!==!1){const A=a(L);j[R]=A,(f[R]===void 0||A>f[R])&&(f[R]=A)}C.push(L)}l[y]=C,d[y]=j}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<p;)c[g]=ow(s[g]);else{const C=ow(s);for(;++g<p;)c[g]=C}g=-1;const b=[],x=[];for(;++g<p;){const C=c[g];let j="",R="";C===99?(j=":",R=":"):C===108?j=":":C===114&&(R=":");let L=n.alignDelimiters===!1?1:Math.max(1,f[g]-j.length-R.length);const A=j+"-".repeat(L)+R;n.alignDelimiters!==!1&&(L=j.length+L+R.length,L>f[g]&&(f[g]=L),x[g]=L),b[g]=A}l.splice(1,0,b),d.splice(1,0,x),y=-1;const S=[];for(;++y<l.length;){const C=l[y],j=d[y];g=-1;const R=[];for(;++g<p;){const L=C[g]||"";let A="",K="";if(n.alignDelimiters!==!1){const H=f[g]-(j[g]||0),F=c[g];F===114?A=" ".repeat(H):F===99?H%2?(A=" ".repeat(H/2+.5),K=" ".repeat(H/2-.5)):(A=" ".repeat(H/2),K=A):K=" ".repeat(H)}n.delimiterStart!==!1&&!g&&R.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&L==="")&&(n.delimiterStart!==!1||g)&&R.push(" "),n.alignDelimiters!==!1&&R.push(A),R.push(L),n.alignDelimiters!==!1&&R.push(K),n.padding!==!1&&R.push(" "),(n.delimiterEnd!==!1||g!==p-1)&&R.push("|")}S.push(n.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return S.join(`
|
|
84
|
+
`)}function dD(e){return e==null?"":String(e)}function ow(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function hD(e,t,n,s){const a=n.enter("blockquote"),c=n.createTracker(s);c.move("> "),c.shift(2);const l=n.indentLines(n.containerFlow(e,c.current()),fD);return a(),l}function fD(e,t,n){return">"+(n?"":" ")+e}function mD(e,t){return aw(e,t.inConstruct,!0)&&!aw(e,t.notInConstruct,!1)}function aw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function lw(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
85
|
+
`&&mD(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
86
|
+
`}function pD(e,t){const n=String(e);let s=n.indexOf(t),a=s,c=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++c>l&&(l=c):c=1,a=s+t.length,s=n.indexOf(t,a);return l}function gD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function yD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function vD(e,t,n,s){const a=yD(n),c=e.value||"",l=a==="`"?"GraveAccent":"Tilde";if(gD(e,n)){const g=n.enter("codeIndented"),b=n.indentLines(c,wD);return g(),b}const d=n.createTracker(s),f=a.repeat(Math.max(pD(c,a)+1,3)),p=n.enter("codeFenced");let y=d.move(f);if(e.lang){const g=n.enter(`codeFencedLang${l}`);y+=d.move(n.safe(e.lang,{before:y,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);y+=d.move(" "),y+=d.move(n.safe(e.meta,{before:y,after:`
|
|
87
|
+
`,encode:["`"],...d.current()})),g()}return y+=d.move(`
|
|
88
|
+
`),c&&(y+=d.move(c+`
|
|
89
|
+
`)),y+=d.move(f),p(),y}function wD(e,t,n){return(n?"":" ")+e}function _m(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function bD(e,t,n,s){const a=_m(n),c=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let d=n.enter("label");const f=n.createTracker(s);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
90
|
+
`,...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),d()),l(),p}function xD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Va(e){return"&#x"+e.toString(16).toUpperCase()+";"}function au(e,t,n){const s=Ro(e),a=Ro(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}jS.peek=kD;function jS(e,t,n,s){const a=xD(n),c=n.enter("emphasis"),l=n.createTracker(s),d=l.move(a);let f=l.move(n.containerPhrasing(e,{after:a,before:d,...l.current()}));const p=f.charCodeAt(0),y=au(s.before.charCodeAt(s.before.length-1),p,a);y.inside&&(f=Va(p)+f.slice(1));const g=f.charCodeAt(f.length-1),b=au(s.after.charCodeAt(0),g,a);b.inside&&(f=f.slice(0,-1)+Va(g));const x=l.move(a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+f+x}function kD(e,t,n){return n.options.emphasis||"*"}function SD(e,t){let n=!1;return Lm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Df}),!!((!e.depth||e.depth<3)&&Nm(e)&&(t.options.setext||n))}function CD(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(s);if(SD(e,n)){const y=n.enter("headingSetext"),g=n.enter("phrasing"),b=n.containerPhrasing(e,{...c.current(),before:`
|
|
91
|
+
`,after:`
|
|
92
|
+
`});return g(),y(),b+`
|
|
93
|
+
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
94
|
+
`))+1))}const l="#".repeat(a),d=n.enter("headingAtx"),f=n.enter("phrasing");c.move(l+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
95
|
+
`,...c.current()});return/^[\t ]/.test(p)&&(p=Va(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),f(),d(),p}NS.peek=jD;function NS(e){return e.value||""}function jD(){return"<"}PS.peek=ND;function PS(e,t,n,s){const a=_m(n),c=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let d=n.enter("label");const f=n.createTracker(s);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),d()),p+=f.move(")"),l(),p}function ND(){return"!"}TS.peek=PD;function TS(e,t,n,s){const a=e.referenceType,c=n.enter("imageReference");let l=n.enter("label");const d=n.createTracker(s);let f=d.move("![");const p=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return l(),n.stack=y,c(),a==="full"||!p||p!==g?f+=d.move(g+"]"):a==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function PD(){return"!"}ES.peek=TD;function ES(e,t,n){let s=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<n.unsafe.length;){const l=n.unsafe[c],d=n.compilePattern(l);let f;if(l.atBreak)for(;f=d.exec(s);){let p=f.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(f.index+1)}}return a+s+a}function TD(){return"`"}function RS(e,t){const n=Nm(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}MS.peek=ED;function MS(e,t,n,s){const a=_m(n),c=a==='"'?"Quote":"Apostrophe",l=n.createTracker(s);let d,f;if(RS(e,n)){const y=n.stack;n.stack=[],d=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),d(),n.stack=y,g}d=n.enter("link"),f=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(e,{before:p,after:"](",...l.current()})),p+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(e.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(f=n.enter("destinationRaw"),p+=l.move(n.safe(e.url,{before:p,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=l.move(" "+a),p+=l.move(n.safe(e.title,{before:p,after:a,...l.current()})),p+=l.move(a),f()),p+=l.move(")"),d(),p}function ED(e,t,n){return RS(e,n)?"<":"["}AS.peek=RD;function AS(e,t,n,s){const a=e.referenceType,c=n.enter("linkReference");let l=n.enter("label");const d=n.createTracker(s);let f=d.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return l(),n.stack=y,c(),a==="full"||!p||p!==g?f+=d.move(g+"]"):a==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function RD(){return"["}function Fm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function MD(e){const t=Fm(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function AD(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function LS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function LD(e,t,n,s){const a=n.enter("list"),c=n.bulletCurrent;let l=e.ordered?AD(n):Fm(n);const d=e.ordered?l==="."?")":".":MD(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&y&&(!y.children||!y.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),LS(n)===l&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=d),n.bulletCurrent=l;const p=n.containerFlow(e,s);return n.bulletLastUsed=l,n.bulletCurrent=c,a(),p}function ID(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function DD(e,t,n,s){const a=ID(n);let c=n.bulletCurrent||Fm(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let l=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const d=n.createTracker(s);d.move(c+" ".repeat(l-c.length)),d.shift(l);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,d.current()),y);return f(),p;function y(g,b,x){return b?(x?"":" ".repeat(l))+g:(x?c:c+" ".repeat(l-c.length))+g}}function _D(e,t,n,s){const a=n.enter("paragraph"),c=n.enter("phrasing"),l=n.containerPhrasing(e,s);return c(),a(),l}const FD=Cu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function OD(e,t,n,s){return(e.children.some(function(l){return FD(l)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function BD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}IS.peek=WD;function IS(e,t,n,s){const a=BD(n),c=n.enter("strong"),l=n.createTracker(s),d=l.move(a+a);let f=l.move(n.containerPhrasing(e,{after:a,before:d,...l.current()}));const p=f.charCodeAt(0),y=au(s.before.charCodeAt(s.before.length-1),p,a);y.inside&&(f=Va(p)+f.slice(1));const g=f.charCodeAt(f.length-1),b=au(s.after.charCodeAt(0),g,a);b.inside&&(f=f.slice(0,-1)+Va(g));const x=l.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+f+x}function WD(e,t,n){return n.options.strong||"*"}function UD(e,t,n,s){return n.safe(e.value,s)}function zD(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function HD(e,t,n){const s=(LS(n)+(n.options.ruleSpaces?" ":"")).repeat(zD(n));return n.options.ruleSpaces?s.slice(0,-1):s}const DS={blockquote:hD,break:lw,code:vD,definition:bD,emphasis:jS,hardBreak:lw,heading:CD,html:NS,image:PS,imageReference:TS,inlineCode:ES,link:MS,linkReference:AS,list:LD,listItem:DD,paragraph:_D,root:OD,strong:IS,text:UD,thematicBreak:HD};function qD(){return{enter:{table:$D,tableData:cw,tableHeader:cw,tableRow:GD},exit:{codeText:KD,table:VD,tableData:_h,tableHeader:_h,tableRow:_h}}}function $D(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function VD(e){this.exit(e),this.data.inTable=void 0}function GD(e){this.enter({type:"tableRow",children:[]},e)}function _h(e){this.exit(e)}function cw(e){this.enter({type:"tableCell",children:[]},e)}function KD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,QD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function QD(e,t){return t==="|"?t:e}function YD(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
96
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:l,tableCell:f,tableRow:d}};function l(x,S,C,j){return p(y(x,C,j),x.align)}function d(x,S,C,j){const R=g(x,C,j),L=p([R]);return L.slice(0,L.indexOf(`
|
|
97
|
+
`))}function f(x,S,C,j){const R=C.enter("tableCell"),L=C.enter("phrasing"),A=C.containerPhrasing(x,{...j,before:c,after:c});return L(),R(),A}function p(x,S){return uD(x,{align:S,alignDelimiters:s,padding:n,stringLength:a})}function y(x,S,C){const j=x.children;let R=-1;const L=[],A=S.enter("table");for(;++R<j.length;)L[R]=g(j[R],S,C);return A(),L}function g(x,S,C){const j=x.children;let R=-1;const L=[],A=S.enter("tableRow");for(;++R<j.length;)L[R]=f(j[R],x,S,C);return A(),L}function b(x,S,C){let j=DS.inlineCode(x,S,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function XD(){return{exit:{taskListCheckValueChecked:uw,taskListCheckValueUnchecked:uw,paragraph:ZD}}}function JD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:e_}}}function uw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ZD(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let c=-1,l;for(;++c<a.length;){const d=a[c];if(d.type==="paragraph"){l=d;break}}l===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function e_(e,t,n,s){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",d=n.createTracker(s);c&&d.move(l);let f=DS.listItem(e,t,n,{...s,...d.current()});return c&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(y){return y+l}}function t_(){return[LI(),eD(),iD(),qD(),XD()]}function n_(e){return{extensions:[II(),tD(e),sD(),YD(e),JD()]}}const r_={tokenize:c_,partial:!0},_S={tokenize:u_,partial:!0},FS={tokenize:d_,partial:!0},OS={tokenize:h_,partial:!0},i_={tokenize:f_,partial:!0},BS={name:"wwwAutolink",tokenize:a_,previous:US},WS={name:"protocolAutolink",tokenize:l_,previous:zS},Ai={name:"emailAutolink",tokenize:o_,previous:HS},gi={};function s_(){return{text:gi}}let Ns=48;for(;Ns<123;)gi[Ns]=Ai,Ns++,Ns===58?Ns=65:Ns===91&&(Ns=97);gi[43]=Ai;gi[45]=Ai;gi[46]=Ai;gi[95]=Ai;gi[72]=[Ai,WS];gi[104]=[Ai,WS];gi[87]=[Ai,BS];gi[119]=[Ai,BS];function o_(e,t,n){const s=this;let a,c;return l;function l(g){return!Bf(g)||!HS.call(s,s.previous)||Om(s.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return Bf(g)?(e.consume(g),d):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(i_,y,p)(g):g===45||g===95||tr(g)?(c=!0,e.consume(g),f):y(g)}function p(g){return e.consume(g),a=!0,f}function y(g){return c&&a&&cr(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function a_(e,t,n){const s=this;return a;function a(l){return l!==87&&l!==119||!US.call(s,s.previous)||Om(s.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(r_,e.attempt(_S,e.attempt(FS,c),n),n)(l))}function c(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function l_(e,t,n){const s=this;let a="",c=!1;return l;function l(g){return(g===72||g===104)&&zS.call(s,s.previous)&&!Om(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),d):n(g)}function d(g){if(cr(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(g),f}return n(g)}function f(g){return g===47?(e.consume(g),c?p:(c=!0,f)):n(g)}function p(g){return g===null||iu(g)||un(g)||Os(g)||xu(g)?n(g):e.attempt(_S,e.attempt(FS,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function c_(e,t,n){let s=0;return a;function a(l){return(l===87||l===119)&&s<3?(s++,e.consume(l),a):l===46&&s===3?(e.consume(l),c):n(l)}function c(l){return l===null?n(l):t(l)}}function u_(e,t,n){let s,a,c;return l;function l(p){return p===46||p===95?e.check(OS,f,d)(p):p===null||un(p)||Os(p)||p!==45&&xu(p)?f(p):(c=!0,e.consume(p),l)}function d(p){return p===95?s=!0:(a=s,s=void 0),e.consume(p),l}function f(p){return a||s||!c?n(p):t(p)}}function d_(e,t){let n=0,s=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&s<n?c(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(OS,t,c)(l):l===null||un(l)||Os(l)?t(l):(e.consume(l),a)}function c(l){return l===41&&s++,e.consume(l),a}}function h_(e,t,n){return s;function s(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),s):d===38?(e.consume(d),c):d===93?(e.consume(d),a):d===60||d===null||un(d)||Os(d)?t(d):n(d)}function a(d){return d===null||d===40||d===91||un(d)||Os(d)?t(d):s(d)}function c(d){return cr(d)?l(d):n(d)}function l(d){return d===59?(e.consume(d),s):cr(d)?(e.consume(d),l):n(d)}}function f_(e,t,n){return s;function s(c){return e.consume(c),a}function a(c){return tr(c)?n(c):t(c)}}function US(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||un(e)}function zS(e){return!cr(e)}function HS(e){return!(e===47||Bf(e))}function Bf(e){return e===43||e===45||e===46||e===95||tr(e)}function Om(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const m_={tokenize:k_,partial:!0};function p_(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:w_,continuation:{tokenize:b_},exit:x_}},text:{91:{name:"gfmFootnoteCall",tokenize:v_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:g_,resolveTo:y_}}}}function g_(e,t,n){const s=this;let a=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let l;for(;a--;){const f=s.events[a][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return d;function d(f){if(!l||!l._balanced)return n(f);const p=ti(s.sliceSerialize({start:l.end,end:s.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function y_(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",l,t],["exit",l,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...d),e}function v_(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,l;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(g){if(c>999||g===93&&!l||g===null||g===91||un(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(ti(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return un(g)||(l=!0),c++,e.consume(g),g===92?y:p}function y(g){return g===91||g===92||g===93?(e.consume(g),c++,p):p(g)}}function w_(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,l=0,d;return f;function f(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(S)}function y(S){if(l>999||S===93&&!d||S===null||S===91||un(S))return n(S);if(S===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=ti(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return un(S)||(d=!0),l++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),l++,y):y(S)}function b(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),a.includes(c)||a.push(c),Zt(e,x,"gfmFootnoteDefinitionWhitespace")):n(S)}function x(S){return t(S)}}function b_(e,t,n){return e.check(sl,t,e.attempt(m_,t,n))}function x_(e){e.exit("gfmFootnoteDefinition")}function k_(e,t,n){const s=this;return Zt(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const l=s.events[s.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(c):n(c)}}function S_(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(l,d){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let p=f;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[f][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[f][1].end)},g={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[f][1].start)},b=[["enter",y,d],["enter",l[p][1],d],["exit",l[p][1],d],["enter",g,d]],x=d.parser.constructs.insideSpan.null;x&&Ar(b,b.length,0,ku(x,l.slice(p+1,f),d)),Ar(b,b.length,0,[["exit",g,d],["enter",l[f][1],d],["exit",l[f][1],d],["exit",y,d]]),Ar(l,p-1,f-p+3,b),f=p+b.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function c(l,d,f){const p=this.previous,y=this.events;let g=0;return b;function b(S){return p===126&&y[y.length-1][1].type!=="characterEscape"?f(S):(l.enter("strikethroughSequenceTemporary"),x(S))}function x(S){const C=Ro(p);if(S===126)return g>1?f(S):(l.consume(S),g++,x);if(g<2&&!n)return f(S);const j=l.exit("strikethroughSequenceTemporary"),R=Ro(S);return j._open=!R||R===2&&!!C,j._close=!C||C===2&&!!R,d(S)}}}class C_{constructor(){this.map=[]}add(t,n,s){j_(this,t,n,s)}consume(t){if(this.map.sort(function(c,l){return c[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const c of a)t.push(c);a=s.pop()}this.map.length=0}}function j_(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function N_(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function P_(){return{flow:{null:{name:"table",tokenize:T_,resolveAll:E_}}}}function T_(e,t,n){const s=this;let a=0,c=0,l;return d;function d(P){let U=s.events.length-1;for(;U>-1;){const Z=s.events[U][1].type;if(Z==="lineEnding"||Z==="linePrefix")U--;else break}const G=U>-1?s.events[U][1].type:null,X=G==="tableHead"||G==="tableRow"?F:f;return X===F&&s.parser.lazy[s.now().line]?n(P):X(P)}function f(P){return e.enter("tableHead"),e.enter("tableRow"),p(P)}function p(P){return P===124||(l=!0,c+=1),y(P)}function y(P){return P===null?n(P):kt(P)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),x):n(P):Qt(P)?Zt(e,y,"whitespace")(P):(c+=1,l&&(l=!1,a+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),l=!0,y):(e.enter("data"),g(P)))}function g(P){return P===null||P===124||un(P)?(e.exit("data"),y(P)):(e.consume(P),P===92?b:g)}function b(P){return P===92||P===124?(e.consume(P),g):g(P)}function x(P){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(P):(e.enter("tableDelimiterRow"),l=!1,Qt(P)?Zt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):S(P))}function S(P){return P===45||P===58?j(P):P===124?(l=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),C):H(P)}function C(P){return Qt(P)?Zt(e,j,"whitespace")(P):j(P)}function j(P){return P===58?(c+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),R):P===45?(c+=1,R(P)):P===null||kt(P)?K(P):H(P)}function R(P){return P===45?(e.enter("tableDelimiterFiller"),L(P)):H(P)}function L(P){return P===45?(e.consume(P),L):P===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(P))}function A(P){return Qt(P)?Zt(e,K,"whitespace")(P):K(P)}function K(P){return P===124?S(P):P===null||kt(P)?!l||a!==c?H(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):H(P)}function H(P){return n(P)}function F(P){return e.enter("tableRow"),M(P)}function M(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),M):P===null||kt(P)?(e.exit("tableRow"),t(P)):Qt(P)?Zt(e,M,"whitespace")(P):(e.enter("data"),_(P))}function _(P){return P===null||P===124||un(P)?(e.exit("data"),M(P)):(e.consume(P),P===92?I:_)}function I(P){return P===92||P===124?(e.consume(P),_):_(P)}}function E_(e,t){let n=-1,s=!0,a=0,c=[0,0,0,0],l=[0,0,0,0],d=!1,f=0,p,y,g;const b=new C_;for(;++n<e.length;){const x=e[n],S=x[1];x[0]==="enter"?S.type==="tableHead"?(d=!1,f!==0&&(dw(b,t,f,p,y),y=void 0,f=0),p={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",p,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,c=[0,0,0,0],l=[0,n+1,0,0],d&&(d=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",y,t]])),a=S.type==="tableDelimiterRow"?2:y?3:1):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,l[2]===0&&(c[1]!==0&&(l[0]=l[1],g=gc(b,t,c,a,void 0,g),c=[0,0,0,0]),l[2]=n)):S.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(l[0]=l[1],g=gc(b,t,c,a,void 0,g)),c=l,l=[c[1],n,0,0])):S.type==="tableHead"?(d=!0,f=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(f=n,c[1]!==0?(l[0]=l[1],g=gc(b,t,c,a,n,g)):l[1]!==0&&(g=gc(b,t,l,a,n,g)),a=0):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&dw(b,t,f,p,y),b.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=N_(t.events,n))}return e}function gc(e,t,n,s,a,c){const l=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},xo(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=xo(t.events,n[1]);if(c={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=xo(t.events,n[2]),y=xo(t.events,n[3]),g={type:d,start:Object.assign({},p),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,t]]),s!==2){const b=t.events[n[2]],x=t.events[n[3]];if(b[1].end=Object.assign({},x[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,C=n[3]-n[2]-1;e.add(S,C,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return a!==void 0&&(c.end=Object.assign({},xo(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function dw(e,t,n,s,a){const c=[],l=xo(t.events,n);a&&(a.end=Object.assign({},l),c.push(["exit",a,t])),s.end=Object.assign({},l),c.push(["exit",s,t]),e.add(n+1,0,c)}function xo(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const R_={name:"tasklistCheck",tokenize:A_};function M_(){return{text:{91:R_}}}function A_(e,t,n){const s=this;return a;function a(f){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),c)}function c(f){return un(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(f)}function d(f){return kt(f)?t(f):Qt(f)?e.check({tokenize:L_},t,n)(f):n(f)}}function L_(e,t,n){return Zt(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function I_(e){return eS([s_(),p_(),S_(e),P_(),M_()])}const D_={};function Bm(e){const t=this,n=e||D_,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),l=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(I_(n)),c.push(t_()),l.push(n_(n))}const hw="*** Begin Patch",fw="*** End Patch";function __(e){const t=e.replace(/\r\n/g,`
|
|
98
|
+
`);if(!t.includes(hw)||!t.includes(fw))return null;const n=t.split(`
|
|
99
|
+
`),s=[];let a=null,c=null;for(const l of n){if(l===hw||l===fw)continue;if(l.startsWith("*** Update File: ")){a=Fh("update",l.slice(17)),s.push(a),c=null;continue}if(l.startsWith("*** Add File: ")){a=Fh("add",l.slice(14)),s.push(a),c={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){a=Fh("delete",l.slice(17)),s.push(a),c=null;continue}if(!a)continue;if(l.startsWith("*** Move to: ")){a.nextPath=l.slice(13),a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("@@")){c=O_(l)??{oldLineNumber:0,newLineNumber:0},a.lines.push({kind:"hunk",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l==="*** End of File"){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(a.action==="add"&&l.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:(c==null?void 0:c.newLineNumber)??a.additions}),c&&(c.newLineNumber+=1);continue}if(!c){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:c.newLineNumber}),c.newLineNumber+=1;continue}if(l.startsWith("-")){a.deletions+=1,a.lines.push({kind:"remove",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:null}),c.oldLineNumber+=1;continue}if(l.startsWith(" ")||l.length===0){a.lines.push({kind:"context",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:c.newLineNumber}),c.oldLineNumber+=1,c.newLineNumber+=1;continue}a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null})}return s.length===0?null:{files:s,totalAdditions:s.reduce((l,d)=>l+d.additions,0),totalDeletions:s.reduce((l,d)=>l+d.deletions,0)}}function F_(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Fh(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function O_(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const B_=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,W_=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,U_=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,z_=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Ga(e){const t=H_(e);return t||qS(e)}function H_(e){const t=e.trim();if(!q_(t))return null;try{const n=JSON.parse(t),s=$_(n);return s.text||s.inlineImages.length>0?s:null}catch{return null}}function q_(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function $_(e){const t=[],n=[];return Fc(e,t,n),{text:VS(t.join(`
|
|
100
|
+
|
|
101
|
+
`)),inlineImages:$S(n)}}function Fc(e,t,n){if(typeof e=="string"){const l=qS(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>Fc(l,t,n));return}if(typeof e!="object")return;const s=e,a=new Set,c=V_(s);c&&(n.push(c),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(l=>{l in s&&a.add(l)}));for(const l of["image_url","url","src","source"]){const d=s[l];typeof d!="string"||!GS(d)||(n.push(_s(d,Wr(s.alt))),a.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in s&&(a.add(l),Fc(s[l],t,n));a.size>0||Object.values(s).forEach(l=>{Fc(l,t,n)})}function qS(e){const t=[];let n=e;return n=n.replace(z_,(s,a,c)=>{const l=X_(a,"name"),d=Y_(c);return d!=null&&d.url&&t.push(_s(d.url,d.altText||l)),""}),n=n.replace(W_,(s,a,c)=>(t.push(_s(c,a)),"")),n=n.replace(U_,(s,a)=>(t.push(_s(a,null)),"")),n=n.replace(B_,(s,a,c)=>(t.push(_s(s,null,`image/${a}`,lu(c))),"")),{text:VS(n),inlineImages:$S(t)}}function _s(e,t,n,s){const a=n??G_(e)??"image/png";return{url:e,mimeType:a,altText:Ka(t),estimatedBytes:s??K_(e)}}function V_(e){const t=Q_(e.source);if(t){const a=Wr(t.type).trim().toLowerCase(),c=pw(t.media_type??t.mime_type??t.mimeType),l=mw(t.data);if(a==="base64"&&c&&l)return _s(`data:${c};base64,${l}`,Ka(Wr(t.alt)||Wr(t.name)||Wr(e.alt)||Wr(e.name)),c,lu(l))}const n=pw(e.media_type??e.mime_type??e.mimeType),s=mw(e.data);return n&&s?_s(`data:${n};base64,${s}`,Ka(Wr(e.alt)||Wr(e.name)),n,lu(s)):null}function $S(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function VS(e){return e.replace(/\r\n/g,`
|
|
102
|
+
`).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
|
|
103
|
+
`).replace(/\n{3,}/g,`
|
|
104
|
+
|
|
105
|
+
`).trim()}function GS(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function G_(e){var n;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())??null}function K_(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?lu(t[1]):null}function lu(e){const t=e.trim(),n=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-n)}function Ka(e){const t=Wr(e).trim();return t.length>0?t:null}function mw(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function pw(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function Wr(e){return typeof e=="string"?e:""}function Q_(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Y_(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),s=Wr(n.image_url??n.imageUrl).trim(),a=Ka(Wr(n.name)||Wr(n.alt));return{url:GS(s)?s:null,altText:a}}catch{const n=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return n?{url:n[1],altText:null}:null}}function X_(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return Ka((s==null?void 0:s[1])??(s==null?void 0:s[2])??(s==null?void 0:s[3])??(s==null?void 0:s[4])??"")}function Zr(){return"/workspaces"}function mi(e){return`/workspaces/${encodeURIComponent(e)}`}function al(e){return`${mi(e)}/sessions`}function Qn(e,t){return`${al(e)}/${encodeURIComponent(t)}`}function Fo(e,t){const n=`${mi(e)}/tools`;if(!t)return n;const s=new URLSearchParams({tab:t});return`${n}?${s.toString()}`}function KS(e){return`${mi(e)}/tools/files`}function QS(e){return`${mi(e)}/tools/git`}function Nu(e){return`${mi(e)}/tools/processes`}function Co(e){return`${mi(e)}/terminals`}function Wm(e){return e.flatMap(t=>t.sessions.map(n=>({session:n,workspace:t.workspace}))).sort((t,n)=>(n.session.lastMessageAt??n.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function J_(e){const t=new Map(e.map(a=>[a.session.sessionId,a])),n=new Map,s=[];for(const a of e){const c=e2(a,t);if(c===a.session.sessionId){s.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...s].sort(gw).map(a=>({entry:a,children:[...n.get(a.session.sessionId)??[]].sort(gw)}))}function YS(e,t){const n=Z_(),s=new URLSearchParams({provider:t});return`${Qn(e,n)}?${s.toString()}`}function Z_(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function gw(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function e2(e,t){var a;let n=e;const s=new Set([e.session.sessionId]);for(;;){const c=((a=n.session.parentSessionId)==null?void 0:a.trim())||null;if(!c)return n.session.sessionId;const l=t.get(c);if(!l)return n.session.sessionId;if(s.has(l.session.sessionId))return e.session.sessionId;s.add(l.session.sessionId),n=l}}const t2="mobile.tools.last-primary-tool";function XS(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(t2)==="git"?"git":"files"}catch{return"files"}}function Um(e){var s;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const a of t){const c=_n(a.pattern,e),l=((s=c==null?void 0:c.params.workspaceId)==null?void 0:s.trim())??null;if(l)return{workspaceId:l,routeKind:a.routeKind,legacy:!1}}const n=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const a of n)if(_n(a.pattern,e))return{workspaceId:null,routeKind:a.routeKind,legacy:!0};return null}function n2(e,t){const n=Um(e);if((n==null?void 0:n.routeKind)==="git")return"git";if((n==null?void 0:n.routeKind)==="files")return"files";const s=new URLSearchParams(t).get("tab");return s==="git"?"git":s==="files"?"files":XS()}function zm(e,t){const n=Um(e);return n!=null&&n.workspaceId?Fo(n.workspaceId,n2(e,t)):n!=null&&n.legacy?XS()==="git"?"/tools?tab=git":"/tools?tab=files":null}function Hm({activeEntry:e,presentation:t,pathname:n,search:s,moreButtonLabel:a}){if(t==="conversation-focus"||e!=="tools")return null;const c=Um(n);return c?c.routeKind==="processes"?{title:h("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:a}:(c.routeKind==="home"||c.routeKind==="files"||c.routeKind==="git",null):null}const JS=v.createContext({composerPortalTarget:null});function qm({composerPortalTarget:e,children:t}){return i.jsx(JS.Provider,{value:{composerPortalTarget:e},children:t})}function ZS(){return v.useContext(JS)}function $m(e,t,n){const[s,a]=v.useState(void 0);return v.useEffect(()=>{const c=e.current,l=t.current;if(!n||!c||!l){a(void 0),c&&c.style.removeProperty("--mobile-conversation-tabbar-height");return}const d=c,f=l;function p(){if(!e.current||!f.isConnected)return;const g=`${Math.round(f.getBoundingClientRect().height)}px`;d.style.setProperty("--mobile-conversation-tabbar-height",g),a(g)}p();const y=typeof ResizeObserver<"u"?new ResizeObserver(p):null;return y==null||y.observe(f),window.addEventListener("resize",p),()=>{y==null||y.disconnect(),window.removeEventListener("resize",p),d.style.removeProperty("--mobile-conversation-tabbar-height")}},[n,e,t]),s}const r2=3e3,yc=10,yw=84,vw=.36;function Vm({enabled:e,rootRef:t,suspended:n=!1,resetKey:s}){const a=v.useRef(null),c=v.useRef(null),l=v.useRef("visible"),d=v.useRef(1),[f,p]=v.useState("visible"),[y,g]=v.useState(1);v.useEffect(()=>{l.current=f},[f]),v.useEffect(()=>{d.current=y},[y]);function b(){Ps(a),a.current=window.setTimeout(()=>{x()},r2)}function x(){p("hidden"),g(0)}function S(){p("visible"),g(1),b()}v.useEffect(()=>{if(Ps(a),!e){Ps(a),p("visible"),g(1);return}if(n){p("hidden"),g(0);return}return S(),()=>{Ps(a)}},[e,s,n]),v.useEffect(()=>()=>{Ps(a)},[]),v.useEffect(()=>{if(!e||n){c.current=null;return}const j=t.current;if(!j)return;function R(_){if(_.touches.length!==1){c.current=null;return}const I=_.touches[0],P=xw(_.target);if(!I||!P){c.current=null;return}c.current={surface:P,startX:I.clientX,startY:I.clientY,pointerType:"touch",initialState:l.current==="visible"?"visible":"hidden",touchId:I.identifier,dragging:!1,latestProgress:d.current},l.current==="visible"&&Ps(a)}function L(_){const I=c.current;if(!I||I.pointerType!=="touch")return;const P=Oh(_.touches,I.touchId);if(!P)return;const U=P.clientX-I.startX,G=P.clientY-I.startY;if(I.surface==="conversation"){if(Math.abs(G)<=yc||Math.abs(G)<=Math.abs(U))return;c.current=null,I.initialState==="visible"&&x();return}const X=I.initialState==="hidden"?-G:G;X<=yc&&!I.dragging||(Sw(_),I.dragging=!0,I.latestProgress=ww(I.initialState,X),p("dragging"),g(I.latestProgress))}function A(_){const I=c.current;if(!(!I||I.pointerType!=="touch"||!Oh(_.changedTouches,I.touchId))){if(c.current=null,!I.dragging){I.initialState==="visible"&&b();return}bw(I.initialState,I.latestProgress,S,p,g)}}function K(_){const I=c.current;if(!(!I||I.pointerType!=="touch"||!Oh(_.changedTouches,I.touchId))){if(c.current=null,!I.dragging){I.initialState==="visible"&&b();return}if(I.initialState==="visible"){S();return}p("hidden"),g(0)}}function H(_){if(_.pointerType!=="touch")return;const I=xw(_.target);if(!I){c.current=null;return}if(c.current={surface:I,startX:_.clientX,startY:_.clientY,pointerType:"pointer",initialState:l.current==="visible"?"visible":"hidden",pointerId:_.pointerId,captureTarget:_.target instanceof Element?_.target:null,dragging:!1,latestProgress:d.current},_.target instanceof Element)try{_.target.setPointerCapture(_.pointerId)}catch{}l.current==="visible"&&Ps(a)}function F(_){const I=c.current;if(!I||I.pointerType!=="pointer")return;const P=_.clientX-I.startX,U=_.clientY-I.startY;if(I.surface==="conversation"){if(Math.abs(U)<=yc||Math.abs(U)<=Math.abs(P))return;c.current=null,I.initialState==="visible"&&x();return}const G=I.initialState==="hidden"?-U:U;G<=yc&&!I.dragging||(Sw(_),I.dragging=!0,I.latestProgress=ww(I.initialState,G),p("dragging"),g(I.latestProgress))}function M(_){const I=c.current;if(!(!I||I.pointerType!=="pointer"||I.pointerId!==_.pointerId)){if(c.current=null,i2(I),!I.dragging){I.initialState==="visible"&&b();return}bw(I.initialState,I.latestProgress,S,p,g)}}return j.addEventListener("touchstart",R,{passive:!0}),j.addEventListener("pointerdown",H,{passive:!0}),window.addEventListener("touchmove",L,{passive:!1}),window.addEventListener("touchend",A),window.addEventListener("touchcancel",K),window.addEventListener("pointermove",F,{passive:!1}),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),()=>{j.removeEventListener("touchstart",R),j.removeEventListener("pointerdown",H),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",A),window.removeEventListener("touchcancel",K),window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)}},[e,t,n]);const C=e&&!n?y:e?0:1;return{state:n&&e?"hidden":f,progress:C,isOpen:C>.01}}function Ps(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function ww(e,t){return kw(e==="hidden"?t/yw:1-t/yw,0,1)}function bw(e,t,n,s,a){if(e==="hidden"){if(t>=vw){n();return}s("hidden"),a(0);return}if(t<=1-vw){s("hidden"),a(0);return}n()}function i2(e){if(!(e.pointerType!=="pointer"||typeof e.pointerId!="number"||!(e.captureTarget instanceof Element)))try{e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}catch{}}function Oh(e,t){if(typeof t!="number")return e[0]??null;for(let n=0;n<e.length;n+=1){const s=e[n];if((s==null?void 0:s.identifier)===t)return s}return null}function xw(e){return e instanceof Element?e.closest(".composer-panel")?"composer":e.closest(".message-list, .message-timeline, .mobile-conversation-main, .conversation-page-shell")?"conversation":null:null}function kw(e,t,n){return Math.min(Math.max(e,t),n)}function Sw(e){e.cancelable&&e.preventDefault()}function ll({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,preferCompactLayout:a=!1}){return a||e==="compact"?"compact":e==="expanded"&&n&&s?"expanded":t==="tools"&&s?"medium-auxiliary":n?"medium-navigation":s?"medium-auxiliary":"compact"}function Pu(e){return!e.isNativeMobile||e.viewportClass==="expanded"||typeof window>"u"?!1:window.innerHeight>window.innerWidth}function eC(e){return e==="medium-navigation"||e==="expanded"}function tC(e){return e==="medium-auxiliary"||e==="expanded"}function Gm({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,preferCompactLayout:a=!1,children:c,navigationPanel:l,auxiliaryPanel:d}){const f=ll({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,preferCompactLayout:a}),p=eC(f)&&l,y=tC(f)&&d;return i.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":f,children:[p?i.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:l}):null,i.jsx("div",{className:"mobile-adaptive-pane-main",children:c}),y?i.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:d}):null]})}function s2({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=Mn(),S=Hr(),C=ri(),j=qn(),R=v.useRef(null),L=v.useRef(null),[A,K]=v.useState(null),H=t==="conversation-focus",F=Pu({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),M=Vm({enabled:H,rootRef:R,resetKey:`${C.pathname}${C.search}`}),_=ll({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:F}),I=Hm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.androidMoreAction")}),P=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(l2,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(c2,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(u2,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(d2,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(h2,{}),onClick:b}],U=H?{"--mobile-conversation-tabbar-progress":M.progress.toFixed(4)}:void 0;$m(R,L,H);function G(){const Z=zm(C.pathname,C.search);if(!Z){f();return}j(Z,{replace:!0})}const X=i.jsx("nav",{ref:L,className:"android-workbench-bottom-nav","aria-label":h("shell.title"),children:P.map(Z=>i.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":Z.key===e,"aria-current":Z.key===e?"page":void 0,onClick:()=>{Z.key!==e&&S.trigger("selection"),Z.onClick()},children:[i.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:Z.icon}),i.jsx("span",{className:"android-workbench-bottom-nav-label",children:Z.label})]},Z.key))});return i.jsx(qm,{composerPortalTarget:H?A:null,children:i.jsxs("div",{ref:R,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":_,"data-tabbar-open":H?M.isOpen:!0,"data-conversation-tabbar-state":H?M.state:"default",style:U,children:[I?i.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[i.jsxs("div",{className:"android-workbench-topbar-leading",children:[I.showBackButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":h("common.back"),onClick:G,children:i.jsx(o2,{})}):null,i.jsx("div",{className:"android-workbench-topbar-copy",children:i.jsx("h1",{children:I.title})})]}),i.jsx("div",{className:"android-workbench-topbar-actions",children:I.showMoreButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":I.moreButtonLabel,onClick:g,children:i.jsx(a2,{})}):null})]}):null,i.jsx("div",{className:"android-workbench-content",children:i.jsx(Gm,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:F,navigationPanel:s,auxiliaryPanel:a,children:n})}),H?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:K,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:X})]}):X]})})}function o2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function a2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function l2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function c2(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function u2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function d2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function h2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}const f2=120,Aa={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Wf(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function m2(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest("[contenteditable='true']"))return!0;if(e instanceof HTMLTextAreaElement)return!e.readOnly&&!e.disabled;if(e instanceof HTMLInputElement){if(e.readOnly||e.disabled)return!1;const t=(e.type||"text").toLowerCase();return!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(t)}return!1}function p2(){var t;if(typeof window>"u")return 0;const e=[window.innerHeight,typeof document<"u"?(t=document.documentElement)==null?void 0:t.clientHeight:0].filter(Wf);return e.length>0?Math.max(...e):0}function Cw(){if(typeof window>"u")return Aa;const e=window.visualViewport,t=p2(),n=(e==null?void 0:e.height)??t,s=Wf(n)?Math.round(n):null,a=Wf(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,c=s===null?0:Math.max(0,Math.round(t-s-a));return{viewportHeight:s,keyboardInset:c,keyboardOpen:m2(typeof document<"u"?document.activeElement:null)&&c>=f2}}function Bh(e,t){if(typeof document>"u")return;[document.documentElement,document.body].filter(s=>s instanceof HTMLElement).forEach(s=>{if(!e){delete s.dataset.mobileKeyboardOpen,delete s.dataset.mobileViewportBound,s.style.removeProperty("--mobile-shell-viewport-height"),s.style.removeProperty("--mobile-shell-keyboard-inset");return}s.dataset.mobileKeyboardOpen=String(t.keyboardOpen),s.dataset.mobileViewportBound="true",t.viewportHeight===null?s.style.removeProperty("--mobile-shell-viewport-height"):s.style.setProperty("--mobile-shell-viewport-height",`${t.viewportHeight}px`),s.style.setProperty("--mobile-shell-keyboard-inset",`${t.keyboardInset}px`)})}function g2(e){const[t,n]=v.useState(()=>e?Cw():Aa),s=v.useRef(null);return v.useEffect(()=>{if(!e){n(Aa),Bh(!1,Aa);return}function a(){n(Cw())}function c(){s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{s.current=null,a()},0)}a();const l=window.visualViewport;return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),l==null||l.addEventListener("resize",a),l==null||l.addEventListener("scroll",a),document.addEventListener("focusin",a),document.addEventListener("focusout",c),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),l==null||l.removeEventListener("resize",a),l==null||l.removeEventListener("scroll",a),document.removeEventListener("focusin",a),document.removeEventListener("focusout",c),Bh(!1,Aa)}},[e]),v.useEffect(()=>{Bh(e,t)},[e,t]),t}function y2({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=Mn(),S=Hr(),C=ri(),j=qn(),R=v.useRef(null),L=v.useRef(null),[A,K]=v.useState(null),H=t==="conversation-focus",F=Pu({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),M=Vm({enabled:H,rootRef:R,resetKey:`${C.pathname}${C.search}`}),_=ll({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:F}),I=Hm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.iosMoreAction")}),P=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(b2,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(x2,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(k2,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(S2,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(C2,{}),onClick:b}],U=H?{"--mobile-conversation-tabbar-progress":M.progress.toFixed(4)}:void 0;$m(R,L,H);function G(){const Z=zm(C.pathname,C.search);if(!Z){f();return}j(Z,{replace:!0})}const X=i.jsx("nav",{ref:L,className:"ios-workbench-tabbar","aria-label":h("shell.title"),children:P.map(Z=>i.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":Z.key===e,"aria-current":Z.key===e?"page":void 0,onClick:()=>{Z.key!==e&&S.trigger("selection"),Z.onClick()},children:[i.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:Z.icon}),i.jsx("span",{className:"ios-workbench-tabbar-label",children:Z.label})]},Z.key))});return i.jsx(qm,{composerPortalTarget:H?A:null,children:i.jsxs("div",{ref:R,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":_,"data-tabbar-open":H?M.isOpen:!0,"data-conversation-tabbar-state":H?M.state:"default",style:U,children:[I?i.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[i.jsx("div",{className:"ios-workbench-nav-leading",children:I.showBackButton?i.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":h("common.back"),onClick:G,children:[i.jsx(v2,{}),i.jsx("span",{children:h("common.back")})]}):null}),i.jsx("div",{className:"ios-workbench-nav-copy",children:i.jsx("h1",{children:I.title})}),i.jsx("div",{className:"ios-workbench-nav-actions",children:I.showMoreButton?i.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":I.moreButtonLabel,onClick:g,children:i.jsx(w2,{})}):null})]}):null,i.jsx("div",{className:"ios-workbench-content",children:i.jsx(Gm,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:F,navigationPanel:s,auxiliaryPanel:a,children:n})}),H?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:K,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:X})]}):X]})})}function v2(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}function w2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function b2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function x2(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function k2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function S2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function C2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function j2(e){const t=Mn();return t.platform==="ios"?i.jsx(y2,{...e}):t.platform==="android"?i.jsx(s2,{...e}):i.jsx(N2,{...e})}function N2({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=Mn(),S=Hr(),C=ri(),j=qn(),R=v.useRef(null),L=v.useRef(null),[A,K]=v.useState(null),H=g2(x.platform==="web"),F=x.platform==="web"&&H.keyboardOpen,M=t==="conversation-focus",_=Pu({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),I=Vm({enabled:M,rootRef:R,suspended:F,resetKey:`${C.pathname}${C.search}`}),P=ll({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:_}),U=Hm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.iosMoreAction")}),G=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(E2,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(R2,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(M2,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(A2,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(L2,{}),onClick:b}],X=M?{"--mobile-conversation-tabbar-progress":I.progress.toFixed(4)}:void 0;$m(R,L,M);function Z(){const se=zm(C.pathname,C.search);if(!se){f();return}j(se,{replace:!0})}const $=i.jsx("nav",{ref:L,className:"mobile-workbench-tabbar","aria-label":h("shell.title"),hidden:F,children:G.map(se=>i.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":se.key===e,"aria-current":se.key===e?"page":void 0,onClick:()=>{se.key!==e&&S.trigger("selection"),se.onClick()},children:[i.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:se.icon}),i.jsx("span",{className:"mobile-workbench-tabbar-label",children:se.label})]},se.key))});return i.jsx(qm,{composerPortalTarget:M?A:null,children:i.jsxs("div",{ref:R,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":x.platform,"data-mobile-keyboard-open":F,"data-pane-layout":P,"data-tabbar-open":F?!1:M?I.isOpen:!0,"data-conversation-tabbar-state":M?I.state:"default",style:X,children:[U?i.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[i.jsxs("div",{className:"mobile-workbench-header-leading",children:[U.showBackButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":h("common.back"),onClick:Z,children:i.jsx(P2,{})}):null,i.jsx("div",{className:"mobile-workbench-header-copy",children:i.jsx("h1",{children:U.title})})]}),i.jsx("div",{className:"mobile-workbench-header-actions",children:U.showMoreButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":U.moreButtonLabel,onClick:g,children:i.jsx(T2,{})}):null})]}):null,i.jsx("div",{className:"mobile-workbench-content",children:i.jsx(Gm,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,preferCompactLayout:_,navigationPanel:s,auxiliaryPanel:a,children:n})}),M?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:K,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:$})]}):$]})})}function P2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function T2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function E2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function R2(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function M2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function A2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function L2(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}class nC{constructor(t){Be(this,"maxAttempts");Be(this,"baseDelayMs");Be(this,"reconnectAttempts",0);Be(this,"reconnectTimer",null);Be(this,"disposed",!1);this.options=t,this.maxAttempts=t.maxAttempts??4,this.baseDelayMs=t.baseDelayMs??300}start(){this.options.onReconnect(!1)}markConnected(){this.reconnectAttempts=0,this.options.onStateChange("connected")}markTransientFailure(){this.disposed||this.reconnectAttempts>0||this.options.onStateChange("reconnecting")}markDisconnected(){if(this.disposed)return;if(!Fn.getState().autoReconnect){this.options.onStateChange("reconnect_failed");return}if(this.reconnectAttempts+=1,this.reconnectAttempts>this.maxAttempts){this.options.onStateChange("reconnect_failed");return}this.options.onStateChange("reconnecting");const t=this.baseDelayMs*this.reconnectAttempts;this.reconnectTimer=window.setTimeout(()=>{this.options.onReconnect(!0)},t)}reconnectNow(){this.reconnectAttempts=0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onReconnect(!0)}close(){this.disposed=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onStateChange("closed")}}class rC{constructor(t){Be(this,"socket",null);Be(this,"disposed",!1);Be(this,"authRecoveryInFlight",!1);Be(this,"pendingRefresh",!1);Be(this,"fileTreeSubscription",null);Be(this,"gitWorkspaceId",null);Be(this,"terminalManagerWorkspaceId",null);Be(this,"workspaceManagementWorkspaceId",null);Be(this,"pendingFileTreeRefresh",null);Be(this,"pendingGitRefreshWorkspaceId",null);Be(this,"pendingTerminalManagerRefreshWorkspaceId",null);Be(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);Be(this,"fileTreeListeners",new Set);Be(this,"gitListeners",new Set);Be(this,"terminalManagerListeners",new Set);Be(this,"workspaceManagementListeners",new Set);Be(this,"connectionManager");this.options=t,this.connectionManager=new nC({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!jw(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,n){this.fileTreeSubscription={workspaceId:t,paths:Nw(n)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,n){const s=Nw(n),a={type:"fileTree.refresh",workspaceId:t,paths:s};this.sendWhenReady(a)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:s}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=vn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Bx("/ws")}?access_token=${encodeURIComponent(n)}`,a=new WebSocket(s);this.socket=a,a.addEventListener("open",()=>{a.send(JSON.stringify({type:"workbench.subscribe"})),this.pendingRefresh&&this.requestRefresh(),this.fileTreeSubscription&&a.send(JSON.stringify({type:"fileTree.subscribe",workspaceId:this.fileTreeSubscription.workspaceId,paths:this.fileTreeSubscription.paths})),this.pendingFileTreeRefresh&&this.requestFileTreeRefresh(this.pendingFileTreeRefresh.workspaceId,this.pendingFileTreeRefresh.paths),this.gitWorkspaceId&&a.send(JSON.stringify({type:"git.subscribe",workspaceId:this.gitWorkspaceId})),this.pendingGitRefreshWorkspaceId&&this.requestGitRefresh(this.pendingGitRefreshWorkspaceId),this.terminalManagerWorkspaceId&&a.send(JSON.stringify({type:"terminalManager.subscribe",workspaceId:this.terminalManagerWorkspaceId})),this.pendingTerminalManagerRefreshWorkspaceId&&this.requestTerminalManagerRefresh(this.pendingTerminalManagerRefreshWorkspaceId),this.workspaceManagementWorkspaceId&&a.send(JSON.stringify({type:"workspaceManagement.subscribe",workspaceId:this.workspaceManagementWorkspaceId})),this.pendingWorkspaceManagementRefreshWorkspaceId&&this.requestWorkspaceManagementRefresh(this.pendingWorkspaceManagementRefreshWorkspaceId)}),a.addEventListener("message",l=>{var f,p,y,g,b,x,S,C;const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.error"){d.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(d.type==="fileTree.snapshot"){(p=(f=this.options).onFileTreeSnapshot)==null||p.call(f,d.snapshot),this.fileTreeListeners.forEach(j=>j(d.snapshot));return}if(d.type==="git.snapshot"){(g=(y=this.options).onGitSnapshot)==null||g.call(y,d.snapshot),this.gitListeners.forEach(j=>j(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(x=(b=this.options).onTerminalManagerSnapshot)==null||x.call(b,d.snapshot),this.terminalManagerListeners.forEach(j=>j(d.snapshot));return}if(d.type==="workspaceManagement.snapshot"){(C=(S=this.options).onWorkspaceManagementSnapshot)==null||C.call(S,d.snapshot),this.workspaceManagementListeners.forEach(j=>j(d.snapshot));return}d.type==="workbench.snapshot"&&I2(d.snapshot)&&this.options.onSnapshot(d.snapshot)}),a.addEventListener("close",()=>{this.disposed||this.socket!==a||this.connectionManager.markDisconnected()}),a.addEventListener("error",()=>{this.disposed||this.socket!==a||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),vn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const n=this.socket;return jw(n)?(n.send(JSON.stringify(t)),!0):!1}}function jw(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function I2(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function Nw(e){const t=new Set;for(const n of e??[""])t.add(n.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Dn(e,t,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function rs(e,t,n,s,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ts,Br,vo,vc,Oc;const xr="__TAURI_TO_IPC_KEY__";function iC(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class sC{constructor(t){Ts.set(this,void 0),Br.set(this,0),vo.set(this,[]),vc.set(this,void 0),rs(this,Ts,t||(()=>{})),this.id=iC(n=>{const s=n.index;if("end"in n){s==Dn(this,Br,"f")?this.cleanupCallback():rs(this,vc,s);return}const a=n.message;if(s==Dn(this,Br,"f")){for(Dn(this,Ts,"f").call(this,a),rs(this,Br,Dn(this,Br,"f")+1);Dn(this,Br,"f")in Dn(this,vo,"f");){const c=Dn(this,vo,"f")[Dn(this,Br,"f")];Dn(this,Ts,"f").call(this,c),delete Dn(this,vo,"f")[Dn(this,Br,"f")],rs(this,Br,Dn(this,Br,"f")+1)}Dn(this,Br,"f")===Dn(this,vc,"f")&&this.cleanupCallback()}else Dn(this,vo,"f")[s]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){rs(this,Ts,t)}get onmessage(){return Dn(this,Ts,"f")}[(Ts=new WeakMap,Br=new WeakMap,vo=new WeakMap,vc=new WeakMap,xr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[xr]()}}async function ye(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class oC{get rid(){return Dn(this,Oc,"f")}constructor(t){Oc.set(this,void 0),rs(this,Oc,t)}async close(){return ye("plugin:resources|close",{rid:this.rid})}}Oc=new WeakMap;class Ba extends oC{constructor(t){super(t)}static async new(t,n,s){return ye("plugin:image|new",{rgba:fi(t),width:n,height:s}).then(a=>new Ba(a))}static async fromBytes(t){return ye("plugin:image|from_bytes",{bytes:fi(t)}).then(n=>new Ba(n))}static async fromPath(t){return ye("plugin:image|from_path",{path:t}).then(n=>new Ba(n))}async rgba(){return ye("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return ye("plugin:image|size",{rid:this.rid})}}function fi(e){return e==null?null:typeof e=="string"?e:e instanceof Ba?e.rid:e}var Bc,Wc;function aC(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(n=>"rid"in n?n:aC(n));else if("action"in e&&e.action){const n=new sC;return n.onmessage=e.action,delete e.action,{...e,handler:n}}return e}async function Oo(e,t){const n=new sC;if(t&&typeof t=="object"&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=fi(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=fi(t.icon)),"items"in t&&t.items)){let s=function(a){var c;return"rid"in a?[a.rid,a.kind]:("item"in a&&typeof a.item=="object"&&(!((c=a.item.About)===null||c===void 0)&&c.icon)&&(a.item.About.icon=fi(a.item.About.icon)),"icon"in a&&a.icon&&(a.icon=fi(a.icon)),"items"in a&&a.items&&(a.items=a.items.map(s)),aC(a))};t.items=t.items.map(s)}return ye("plugin:menu|new",{kind:e,options:t,handler:n})}class Bo extends oC{get id(){return Dn(this,Bc,"f")}get kind(){return Dn(this,Wc,"f")}constructor(t,n,s){super(t),Bc.set(this,void 0),Wc.set(this,void 0),rs(this,Bc,n),rs(this,Wc,s)}}Bc=new WeakMap,Wc=new WeakMap;class Km extends Bo{constructor(t,n){super(t,n,"MenuItem")}static async new(t){return Oo("MenuItem",t).then(([n,s])=>new Km(n,s))}async text(){return ye("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ye("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ye("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ye("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ye("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class Qm extends Bo{constructor(t,n){super(t,n,"Check")}static async new(t){return Oo("Check",t).then(([n,s])=>new Qm(n,s))}async text(){return ye("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ye("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ye("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ye("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ye("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return ye("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return ye("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var Pw;(function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"})(Pw||(Pw={}));class Ym extends Bo{constructor(t,n){super(t,n,"Icon")}static async new(t){return Oo("Icon",t).then(([n,s])=>new Ym(n,s))}async text(){return ye("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ye("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ye("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ye("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ye("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return ye("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:fi(t)})}}class Xm extends Bo{constructor(t,n){super(t,n,"Predefined")}static async new(t){return Oo("Predefined",t).then(([n,s])=>new Xm(n,s))}async text(){return ye("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ye("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}class Jm{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new ls(this.width*t,this.height*t)}[xr](){return{width:this.width,height:this.height}}toJSON(){return this[xr]()}}class ls{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new Jm(this.width/t,this.height/t)}[xr](){return{width:this.width,height:this.height}}toJSON(){return this[xr]()}}class wo{constructor(t){this.size=t}toLogical(t){return this.size instanceof Jm?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof ls?this.size:this.size.toPhysical(t)}[xr](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[xr]()}}class Zm{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new zr(this.x*t,this.y*t)}[xr](){return{x:this.x,y:this.y}}toJSON(){return this[xr]()}}class zr{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new Zm(this.x/t,this.y/t)}[xr](){return{x:this.x,y:this.y}}toJSON(){return this[xr]()}}class ss{constructor(t){this.position=t}toLogical(t){return this.position instanceof Zm?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof zr?this.position:this.position.toPhysical(t)}[xr](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[xr]()}}function Po([e,t,n]){switch(n){case"Submenu":return new ep(e,t);case"Predefined":return new Xm(e,t);case"Check":return new Qm(e,t);case"Icon":return new Ym(e,t);case"MenuItem":default:return new Km(e,t)}}class ep extends Bo{constructor(t,n){super(t,n,"Submenu")}static async new(t){return Oo("Submenu",t).then(([n,s])=>new ep(n,s))}async text(){return ye("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ye("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ye("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ye("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return ye("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ye("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ye("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ye("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ye("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Po)}async items(){return ye("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Po))}async get(t){return ye("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?Po(n):null)}async popup(t,n){var s;return ye("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof ss?t:t?new ss(t):null})}async setAsWindowsMenuForNSApp(){return ye("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return ye("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return ye("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:fi(t)})}}class jo extends Bo{constructor(t,n){super(t,n,"Menu")}static async new(t){return Oo("Menu",t).then(([n,s])=>new jo(n,s))}static async default(){return ye("plugin:menu|create_default").then(([t,n])=>new jo(t,n))}async append(t){return ye("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ye("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ye("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ye("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ye("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Po)}async items(){return ye("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Po))}async get(t){return ye("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?Po(n):null)}async popup(t,n){var s;return ye("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof ss?t:t?new ss(t):null})}async setAsAppMenu(){return ye("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new jo(t[0],t[1]):null)}async setAsWindowMenu(t){var n;return ye("plugin:menu|set_as_window_menu",{rid:this.rid,window:(n=t==null?void 0:t.label)!==null&&n!==void 0?n:null}).then(s=>s?new jo(s[0],s[1]):null)}}var wr;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(wr||(wr={}));async function lC(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await ye("plugin:event|unlisten",{event:e,eventId:t})}async function tp(e,t,n){var s;const a=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(s=n==null?void 0:n.target)!==null&&s!==void 0?s:{kind:"Any"};return ye("plugin:event|listen",{event:e,target:a,handler:iC(t)}).then(c=>async()=>lC(e,c))}async function cC(e,t,n){return tp(e,s=>{lC(e,s.id),t(s)},n)}async function uC(e,t){await ye("plugin:event|emit",{event:e,payload:t})}async function dC(e,t,n){await ye("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}const D2=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return wr},emit:uC,emitTo:dC,listen:tp,once:cC},Symbol.toStringTag,{value:"Module"}));var cu;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(cu||(cu={}));class hC{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var Uf;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(Uf||(Uf={}));function Tu(){return new np(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function Uc(){return ye("plugin:window|get_all_windows").then(e=>e.map(t=>new np(t,{skip:!0})))}const Wh=["tauri://created","tauri://error"];class np{constructor(t,n={}){var s;this.label=t,this.listeners=Object.create(null),n!=null&&n.skip||ye("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(s=n.parent)===null||s===void 0?void 0:s.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async a=>this.emit("tauri://error",a))}static async getByLabel(t){var n;return(n=(await Uc()).find(s=>s.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return Tu()}static async getAll(){return Uc()}static async getFocusedWindow(){for(const t of await Uc())if(await t.isFocused())return t;return null}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:tp(t,n,{target:{kind:"Window",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:cC(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(Wh.includes(t)){for(const s of this.listeners[t]||[])s({event:t,id:-1,payload:n});return}return uC(t,n)}async emitTo(t,n,s){if(Wh.includes(n)){for(const a of this.listeners[n]||[])a({event:n,id:-1,payload:s});return}return dC(t,n,s)}_handleTauriEvent(t,n){return Wh.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return ye("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return ye("plugin:window|inner_position",{label:this.label}).then(t=>new zr(t))}async outerPosition(){return ye("plugin:window|outer_position",{label:this.label}).then(t=>new zr(t))}async innerSize(){return ye("plugin:window|inner_size",{label:this.label}).then(t=>new ls(t))}async outerSize(){return ye("plugin:window|outer_size",{label:this.label}).then(t=>new ls(t))}async isFullscreen(){return ye("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return ye("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return ye("plugin:window|is_maximized",{label:this.label})}async isFocused(){return ye("plugin:window|is_focused",{label:this.label})}async isDecorated(){return ye("plugin:window|is_decorated",{label:this.label})}async isResizable(){return ye("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return ye("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return ye("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return ye("plugin:window|is_closable",{label:this.label})}async isVisible(){return ye("plugin:window|is_visible",{label:this.label})}async title(){return ye("plugin:window|title",{label:this.label})}async theme(){return ye("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return ye("plugin:window|is_always_on_top",{label:this.label})}async center(){return ye("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===cu.Critical?n={type:"Critical"}:n={type:"Informational"}),ye("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return ye("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return ye("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return ye("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return ye("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return ye("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return ye("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return ye("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return ye("plugin:window|maximize",{label:this.label})}async unmaximize(){return ye("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return ye("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return ye("plugin:window|minimize",{label:this.label})}async unminimize(){return ye("plugin:window|unminimize",{label:this.label})}async show(){return ye("plugin:window|show",{label:this.label})}async hide(){return ye("plugin:window|hide",{label:this.label})}async close(){return ye("plugin:window|close",{label:this.label})}async destroy(){return ye("plugin:window|destroy",{label:this.label})}async setDecorations(t){return ye("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return ye("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return ye("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return ye("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return ye("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return ye("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return ye("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return ye("plugin:window|set_size",{label:this.label,value:t instanceof wo?t:new wo(t)})}async setMinSize(t){return ye("plugin:window|set_min_size",{label:this.label,value:t instanceof wo?t:t?new wo(t):null})}async setMaxSize(t){return ye("plugin:window|set_max_size",{label:this.label,value:t instanceof wo?t:t?new wo(t):null})}async setSizeConstraints(t){function n(s){return s?{Logical:s}:null}return ye("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(t==null?void 0:t.minWidth),minHeight:n(t==null?void 0:t.minHeight),maxWidth:n(t==null?void 0:t.maxWidth),maxHeight:n(t==null?void 0:t.maxHeight)}})}async setPosition(t){return ye("plugin:window|set_position",{label:this.label,value:t instanceof ss?t:new ss(t)})}async setFullscreen(t){return ye("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return ye("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return ye("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return ye("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return ye("plugin:window|set_icon",{label:this.label,value:fi(t)})}async setSkipTaskbar(t){return ye("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return ye("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return ye("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return ye("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return ye("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return ye("plugin:window|set_cursor_position",{label:this.label,value:t instanceof ss?t:new ss(t)})}async setIgnoreCursorEvents(t){return ye("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return ye("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return ye("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return ye("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return ye("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return ye("plugin:window|set_overlay_icon",{label:this.label,value:t?fi(t):void 0})}async setProgressBar(t){return ye("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return ye("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return ye("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return ye("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(wr.WINDOW_RESIZED,n=>{n.payload=new ls(n.payload),t(n)})}async onMoved(t){return this.listen(wr.WINDOW_MOVED,n=>{n.payload=new zr(n.payload),t(n)})}async onCloseRequested(t){return this.listen(wr.WINDOW_CLOSE_REQUESTED,async n=>{const s=new hC(n);await t(s),s.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(wr.DRAG_ENTER,l=>{t({...l,payload:{type:"enter",paths:l.payload.paths,position:new zr(l.payload.position)}})}),s=await this.listen(wr.DRAG_OVER,l=>{t({...l,payload:{type:"over",position:new zr(l.payload.position)}})}),a=await this.listen(wr.DRAG_DROP,l=>{t({...l,payload:{type:"drop",paths:l.payload.paths,position:new zr(l.payload.position)}})}),c=await this.listen(wr.DRAG_LEAVE,l=>{t({...l,payload:{type:"leave"}})});return()=>{n(),a(),s(),c()}}async onFocusChanged(t){const n=await this.listen(wr.WINDOW_FOCUS,a=>{t({...a,payload:!0})}),s=await this.listen(wr.WINDOW_BLUR,a=>{t({...a,payload:!1})});return()=>{n(),s()}}async onScaleChanged(t){return this.listen(wr.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(wr.WINDOW_THEME_CHANGED,t)}}var Tw;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(Tw||(Tw={}));var Ew;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(Ew||(Ew={}));var zf;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(zf||(zf={}));var Hf;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(Hf||(Hf={}));function Eu(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new zr(e.position),size:new ls(e.size),workArea:{position:new zr(e.workArea.position),size:new ls(e.workArea.size)}}}async function _2(){return ye("plugin:window|current_monitor").then(Eu)}async function F2(){return ye("plugin:window|primary_monitor").then(Eu)}async function O2(e,t){return ye("plugin:window|monitor_from_point",{x:e,y:t}).then(Eu)}async function B2(){return ye("plugin:window|available_monitors").then(e=>e.map(Eu))}async function W2(){return ye("plugin:window|cursor_position").then(e=>new zr(e))}const U2=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:hC,get Effect(){return zf},get EffectState(){return Hf},LogicalPosition:Zm,LogicalSize:Jm,PhysicalPosition:zr,PhysicalSize:ls,get ProgressBarStatus(){return Uf},get UserAttentionType(){return cu},Window:np,availableMonitors:B2,currentMonitor:_2,cursorPosition:W2,getAllWindows:Uc,getCurrentWindow:Tu,monitorFromPoint:O2,primaryMonitor:F2},Symbol.toStringTag,{value:"Module"}));async function z2(e){if(e.length===0)return;await(await jo.new({items:e.map(n=>({id:n.id,text:n.label,enabled:!n.disabled,accelerator:n.accelerator,action:()=>{n.onSelect()}}))})).popup(void 0,Tu())}const H2=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function rp(e){return e instanceof HTMLElement?!e.closest(H2):!0}async function ip(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await Tu().startDragging()}const uu=.78,q2=1;function $2(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function fC(e,t,n,s){const a=Math.hypot(n-e,s-t),c=Math.min(1,a/120);return uu+(q2-uu)*c}function os(e){return Math.round(Number.isFinite(e)?e:0)}function V2(e){if(!$2())return null;const t=os(e.x),n=os(e.y);let s=!1,a=Promise.resolve();const c=(d,f)=>(a=a.then(async()=>{await window.__TAURI_INTERNALS__.invoke(d,f)}).catch(()=>{}),a),l=async()=>{s||(s=!0,await c("close_detach_preview"))};return c("show_detach_preview",{title:e.title,x:t,y:n,scale:uu}),{updatePosition(d,f){if(s)return;const p=os(d),y=os(f);c("update_detach_preview_position",{x:p,y,scale:fC(t,n,p,y)})},complete(){return l()},cancel(){return l()}}}function G2(e){if(typeof document>"u")return null;const t=os(e.x),n=os(e.y),s=document.createElement("div");s.className="desktop-window-detach-animation",s.setAttribute("aria-hidden","true"),s.dataset.state="preview",s.style.left=`${t}px`,s.style.top=`${n}px`,s.style.setProperty("--detach-preview-scale",uu.toFixed(3));const a=document.createElement("div");a.className="desktop-window-detach-animation-bar";const c=document.createElement("strong");c.className="desktop-window-detach-animation-title",c.textContent=e.title;const l=document.createElement("div");l.className="desktop-window-detach-animation-body",a.append(c),s.append(a,l),document.body.append(s);let d=!1;const f=()=>{d||(d=!0,s.remove())};return{updatePosition(p,y){if(d)return;const g=os(p),b=os(y),x=fC(t,n,g,b);s.style.left=`${g}px`,s.style.top=`${b}px`,s.style.setProperty("--detach-preview-scale",x.toFixed(3))},async complete(){f()},async cancel(){f()}}}function Rw(e){return V2(e)??G2(e)}const K2={files:{kind:"files",label:"文件",defaultFocusOwner:"file-context-panel"},git:{kind:"git",label:"Git",defaultFocusOwner:"git-sidebar"},processes:{kind:"processes",label:"进程管理",defaultFocusOwner:"terminal-manager-panel"}};function Q2(e){return{...e,bounds:{...e.bounds}}}function Y2(e,t,n){t&&(e.windows.registerDescriptor(t),n?e.windows.markWindowOpen(t.windowId):e.windows.markWindowClosed(t.windowId))}function X2(e){return K2[e]}function J2(e,t){return`${e}-${t}`}async function sp(e,t,n){const s=n.workspaceId.trim(),a=X2(t);if(!e.isDesktop||!e.bridge.supported)return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前运行环境不支持桌面外部窗口。"};if(!s)return{ok:!1,errorCode:"WINDOW_WORKSPACE_REQUIRED",detail:`${a.label}外部窗口必须绑定工作区。`};const c=J2(t,s),l=e.windows.getDescriptor(c),d=l?Q2(l):null,f=e.windows.isWindowOpen(c),p=Mj({windowId:c,kind:t,workspaceId:s,sessionId:n.sessionId??(d==null?void 0:d.sessionId)??null,mode:"external",bounds:d==null?void 0:d.bounds,focusOwner:n.focusOwner??a.defaultFocusOwner});e.windows.registerDescriptor(p);const y=await e.bridge.createWindow(p);return y.ok?(e.windows.markWindowOpen(c),{ok:!0,value:p}):(d?Y2(e,d,f):e.windows.removeWindow(c),{ok:!1,errorCode:y.errorCode,detail:y.detail})}function Z2(e,t){return sp(e,"files",t)}function eF(e,t){return sp(e,"git",t)}function tF(e,t){return sp(e,"processes",t)}const La=new Map;function mC(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function Mw(e,t){return!Number.isFinite(e)||Date.now()-e>t}function On(e,t){const n=La.get(e);if(n&&!Mw(n.savedAt,t))return n.value;if(!mC())return null;const s=window.sessionStorage.getItem(e);if(!s)return null;try{const a=JSON.parse(s);return!a||Mw(a.savedAt,t)?(window.sessionStorage.removeItem(e),La.delete(e),null):(La.set(e,a),a.value)}catch{return window.sessionStorage.removeItem(e),La.delete(e),null}}function Mr(e,t){const n={savedAt:Date.now(),value:t};if(La.set(e,n),!!mC())try{window.sessionStorage.setItem(e,JSON.stringify(n))}catch{}}const nF="codingns.debug.perf";function rF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(nF)==="1"}catch{return!1}}function Kt(e,t){if(!rF()||typeof performance>"u")return;const n=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${n}ms`,t);return}console.info(`[perf-ui] ${e} ${n}ms`)}function iF(e,t,n,s){return Qe.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:n,expectedVersion:s??void 0})})}function sF(e){return Qe.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function oF(e){return Qe.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function aF(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Qe.request(`/api/files/download?${n.toString()}`)}function qf(e,t,n=1,s=20){const a=new URLSearchParams({workspaceId:e,keyword:t,page:String(n),pageSize:String(s)});return Qe.request(`/api/files/search?${a.toString()}`)}function Aw(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Qe.request(`/api/files/preview?${n.toString()}`)}function cl(e){var t,n;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((n=e.lastErrorDetail)!=null&&n.trim())}function op(e,t,n){const s=lF(t);return s==="running_inferred"?`${e} is-running-inferred`:`${e} is-${s.replace("_","-")}`}function du(e){return e.runningState==="stale"?h("conversation.runtimeStale"):e.runningState==="unknown"?h("conversation.runtimeUnknown"):null}function pC(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function lF(e){return cl(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?cF(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function cF(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}const Lw=48;function uF(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function ds(e,t){const n=uF(e)||t,s=n.length>Lw?n.slice(0,Lw).trimEnd():n;return{fullTitle:n,displayTitle:s}}const Uh=5,zh=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function gC(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function yC(e,t){const n=e.reduce((d,f)=>d+f.count,0);if(n<=0)return[];const a=e.slice(0,Uh).map((d,f)=>({...d,key:d.type,ratio:d.count/n,color:zh[f]??zh[0]})),c=e.slice(Uh);if(c.length===0)return a;const l=c.reduce((d,f)=>d+f.count,0);return a.push({key:"other",type:t,count:l,ratio:l/n,color:zh[Uh]}),a}function dF(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((s,a)=>{const c=t,l=a===e.length-1?1:Math.min(1,t+s.ratio);return t=l,`${s.color} ${Iw(c)} ${Iw(l)}`}).join(", ")})`}function vC(e){return{"--workbench-manage-chart-background":dF(e)}}function Iw(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const wC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",bC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",xC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",hF=[{provider:"codex"},{provider:"claude-code"},{provider:"opencode"}];function kC({disabled:e=!1,pendingProvider:t=null,onSelect:n}){const s=Hr();return i.jsx("div",{className:"session-provider-grid",children:hF.map(a=>{const c=fF(a.provider),l=t===a.provider;return i.jsxs("button",{type:"button",className:"session-provider-card","data-provider":a.provider,"data-pending":l?"true":"false","aria-label":c,disabled:e,onClick:()=>{s.trigger("action"),n(a.provider)},children:[i.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:i.jsx("img",{src:mF(a.provider),alt:"",loading:"lazy"})}),i.jsxs("span",{className:"session-provider-card-copy",children:[i.jsx("strong",{children:c}),l?i.jsx("span",{className:"session-provider-card-status",children:h("shell.startingSession")}):null]})]},a.provider)})})}function fF(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function mF(e){return e==="codex"?wC:e==="claude-code"?bC:xC}const wc={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function SC({open:e,onClose:t,onCloned:n}){const{showToast:s}=Yn(),[a,c]=v.useState(!1),[l,d]=v.useState(wc),[f,p]=v.useState(!1),[y,g]=v.useState(!1),[b,x]=v.useState(null),[S,C]=v.useState(""),[j,R]=v.useState(""),[L,A]=v.useState(null),[K,H]=v.useState([]),[F,M]=v.useState([]),_=a||y;v.useEffect(()=>{!e&&!a&&(d(wc),p(!1),x(null))},[a,e]);const I=v.useCallback(async se=>{g(!0),x(null);try{const Y=await Ak(se);C(Y.currentPath),R(Y.currentPath),A(Y.parentPath),H(Y.roots),M(Y.items),d(q=>({...q,parentPath:Y.currentPath}))}catch(Y){C(""),A(null),M([]),x(Y instanceof Error?Y.message:h("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function P(){a||(p(!1),x(null),d(wc),t())}function U(){p(!0),I(l.parentPath||void 0)}function G(){a||(p(!1),x(null))}async function X(se){se.preventDefault(),await I(j)}function Z(){d(se=>({...se,parentPath:S})),p(!1),x(null)}async function $(se){se.preventDefault();const Y=l.repositoryUrl.trim(),q=l.parentPath.trim();if(!Y){s({title:h("shell.cloneRepoRequired"),tone:"error"});return}if(!q){s({title:h("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const oe=await nE({repositoryUrl:Y,parentPath:q,directoryName:l.directoryName.trim()||void 0,name:l.name.trim()||void 0,auth:l.authMode==="none"?{mode:"none"}:l.authMode==="basic"?{mode:"basic",username:l.username.trim(),password:l.password}:{mode:"token",username:l.username.trim()||void 0,token:l.token}});await(n==null?void 0:n(oe)),d(wc),p(!1),s({title:h("shell.cloneSuccess"),description:oe.path,tone:"success"}),t()}catch(oe){s({title:oe instanceof Error?oe.message:h("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return i.jsxs(i.Fragment,{children:[i.jsx(Rr,{open:e,title:h("shell.cloneWorkspaceTitle"),description:h("shell.cloneWorkspaceHint"),onClose:P,children:i.jsxs("form",{className:"workbench-clone-form",onSubmit:se=>void $(se),children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneRepositoryLabel")}),i.jsx("input",{type:"text",value:l.repositoryUrl,placeholder:h("shell.cloneRepositoryPlaceholder"),onChange:se=>d(Y=>({...Y,repositoryUrl:se.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneParentPathLabel")}),i.jsxs("div",{className:"workbench-modal-inline-field",children:[i.jsx("input",{type:"text",value:l.parentPath,placeholder:h("shell.cloneParentPathPlaceholder"),onChange:se=>d(Y=>({...Y,parentPath:se.target.value}))}),i.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:U,children:h("shell.clonePickDirectory")})]})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneDirectoryNameLabel")}),i.jsx("input",{type:"text",value:l.directoryName,placeholder:h("shell.cloneDirectoryNamePlaceholder"),onChange:se=>d(Y=>({...Y,directoryName:se.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importNameLabel")}),i.jsx("input",{type:"text",value:l.name,placeholder:h("shell.importNamePlaceholder"),onChange:se=>d(Y=>({...Y,name:se.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneAuthModeLabel")}),i.jsxs("select",{value:l.authMode,onChange:se=>d(Y=>({...Y,authMode:se.target.value})),children:[i.jsx("option",{value:"none",children:h("shell.cloneAuthModeNone")}),i.jsx("option",{value:"basic",children:h("shell.cloneAuthModeBasic")}),i.jsx("option",{value:"token",children:h("shell.cloneAuthModeToken")})]})]}),l.authMode==="basic"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:se=>d(Y=>({...Y,username:se.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.clonePasswordLabel")}),i.jsx("input",{type:"password",value:l.password,placeholder:h("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:se=>d(Y=>({...Y,password:se.target.value}))})]})]}):null,l.authMode==="token"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneTokenUsernamePlaceholder"),onChange:se=>d(Y=>({...Y,username:se.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneTokenLabel")}),i.jsx("input",{type:"password",value:l.token,placeholder:h("shell.cloneTokenPlaceholder"),onChange:se=>d(Y=>({...Y,token:se.target.value}))})]})]}):null,i.jsx("p",{className:"workbench-import-hint",children:h("shell.cloneHint")}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:P,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:h(a?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),i.jsxs(Rr,{open:e&&f,title:h("shell.cloneBrowserTitle"),description:h("shell.cloneBrowserDescription"),onClose:G,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:X,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:j,placeholder:h("shell.importPathPlaceholder"),onChange:se=>R(se.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:_||!L,onClick:()=>{L&&I(L)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:_,children:h("shell.importBrowserOpenPath")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:K.map(se=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:_,onClick:()=>{I(se.path)},children:se.name},se.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:S}),b?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:b}):null,y?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):F.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:F.map(se=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:_,onClick:()=>{I(se.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:se.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:se.path})]},se.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:G,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:_||!S,onClick:Z,children:h("shell.cloneBrowserSubmit")})]})]})]})}function CC({open:e,onClose:t,onImported:n}){const{showToast:s}=Yn(),[a,c]=v.useState(!1),[l,d]=v.useState(!1),[f,p]=v.useState(!1),[y,g]=v.useState(null),[b,x]=v.useState(""),[S,C]=v.useState(""),[j,R]=v.useState(null),[L,A]=v.useState([]),[K,H]=v.useState([]),[F,M]=v.useState(!1),[_,I]=v.useState(""),P=a||l||f,U=v.useCallback(async q=>{c(!0),g(null);try{const oe=await Ak(q);x(oe.currentPath),C(oe.currentPath),R(oe.parentPath),A(oe.roots),H(oe.items)}catch(oe){x(""),R(null),H([]),g(oe instanceof Error?oe.message:h("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);v.useEffect(()=>{if(!e){M(!1),I(""),g(null);return}U(b||void 0)},[U,e]);function G(){P||(M(!1),I(""),t())}async function X(q){q.preventDefault(),await U(S)}function Z(){!b||P||(I(""),M(!0))}function $(){l||(M(!1),I(""))}async function se(q){q==null||q.preventDefault();const oe=_.trim();if(!(!b||!oe||P)){d(!0),g(null);try{const E=await rE({parentPath:b,directoryName:oe});s({title:h("shell.importBrowserCreateDirectorySuccess"),description:E.path,tone:"success"}),M(!1),I(""),await U(E.path)}catch(E){const B=E instanceof Error?E.message:h("shell.importBrowserCreateDirectoryFailed");g(B),s({title:B,tone:"error"})}finally{d(!1)}}}async function Y(){const q=b.trim();if(!(!q||P)){p(!0),g(null);try{const oe=await tE({path:q});s({title:h("shell.importSuccess"),description:oe.path,tone:"success"}),t(),Promise.resolve().then(()=>n==null?void 0:n(oe)).catch(E=>{s({title:E instanceof Error?E.message:h("shell.navigationLoadFailed"),tone:"error"})})}catch(oe){s({title:oe instanceof Error?oe.message:h("shell.importFailed"),tone:"error"})}finally{p(!1)}}}return i.jsxs(i.Fragment,{children:[i.jsxs(Rr,{open:e,title:h("shell.importBrowserTitle"),description:h("shell.importBrowserDescription"),onClose:G,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:X,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:S,placeholder:h("shell.importPathPlaceholder"),onChange:q=>C(q.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:P||!j,onClick:()=>{j&&U(j)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:P,children:h("shell.importBrowserOpenPath")}),i.jsx("button",{type:"button",className:"secondary-button",disabled:P||!b,onClick:Z,children:h("shell.importBrowserCreateDirectory")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:L.map(q=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:P,onClick:()=>{U(q.path)},children:q.name},q.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:b}),y?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:y}):null,a?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):K.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:K.map(q=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:P,onClick:()=>{U(q.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:q.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:q.path})]},q.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:P,onClick:G,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:P||!b,onClick:()=>{Y()},children:h(f?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),i.jsx(Rr,{open:e&&F,title:h("shell.importBrowserCreateDirectoryTitle"),description:h("shell.importBrowserCreateDirectoryDescription"),onClose:$,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:q=>void se(q),children:[i.jsx("div",{className:"workbench-directory-browser-current-path",children:b}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCreateDirectoryLabel")}),i.jsx("input",{type:"text",value:_,placeholder:h("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:q=>I(q.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:l,onClick:$,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:l||!_.trim(),children:h(l?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const Dw="workbench.left.width",_w="workbench.right.width",Fw="workbench.left.collapsed",Ow="workbench.right.collapsed",Hh="workbench.last.session.path",Bw="workbench.workspace.collapsed.ids",qh="workbench.workspace.selected.id",jC="workbench.navigation.snapshot",pF=280,gF=320,bc=208,Ww=520,Uw=560,yF=200,$h=20,xc=40,kc=5,vF=1800*1e3,zw=60*1e3,wF=4e3,Hw=220,qw=18,bF="workbench:focus-composer",xF=new Set(["starting","running","reconnecting","stale","unknown"]);function kF(e){return xF.has(e.runningState??"idle")||e.activityState==="running"}function SF(e){var a,c;const t=((a=e.lastErrorCode)==null?void 0:a.trim())??"",n=((c=e.lastErrorDetail)==null?void 0:c.trim())??"",s=[t,n].filter(l=>l.length>0).join(" · ");return s?s.length<=Hw?s:`${s.slice(0,Hw-3)}...`:null}function $w(e,t){var l,d;const n=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals"];for(const f of n){const p=_n(f,e),y=(l=p==null?void 0:p.params.workspaceId)==null?void 0:l.trim();if(y)return y}const s=Wa(e),a=(s==null?void 0:s.sessionId)??null;return!a||!OC(a)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function CF(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function jF(e){return e==="mobile"?Zr():"/landing"}function Wa(e){var c,l,d;const t=_n("/workspaces/:workspaceId/sessions/:sessionId",e),n=(c=t==null?void 0:t.params.sessionId)==null?void 0:c.trim();if(n)return{sessionId:n,workspaceId:((l=t==null?void 0:t.params.workspaceId)==null?void 0:l.trim())??null};const s=_n("/sessions/:sessionId",e),a=(d=s==null?void 0:s.params.sessionId)==null?void 0:d.trim();return a?{sessionId:a,workspaceId:null}:null}function NF(e){return!!(_n("/sessions",e)||_n("/workspaces/:workspaceId/sessions",e))}function Vw(e){return!!Wa(e)}function PF(e){return!!(_n("/tools",e)||_n("/tools/files",e)||_n("/tools/git",e)||_n("/tools/processes",e)||_n("/workspaces/:workspaceId/tools",e)||_n("/workspaces/:workspaceId/tools/files",e)||_n("/workspaces/:workspaceId/tools/git",e)||_n("/workspaces/:workspaceId/tools/processes",e))}function Gw(e){return!!(_n("/terminals",e)||_n("/workspaces/:workspaceId/terminals",e))}function TF(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const EF=v.lazy(async()=>({default:(await Eo(()=>Promise.resolve().then(()=>SU),void 0)).FileContextPanel})),RF=v.lazy(async()=>({default:(await Eo(()=>Promise.resolve().then(()=>RU),void 0)).GitSidebar})),MF=v.lazy(async()=>({default:(await Eo(()=>Promise.resolve().then(()=>JU),void 0)).TerminalManagerPanel}));function AF(e){return!!(e!=null&&e.session)}function Is(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function Ta(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(AF):[]}const NC=v.createContext(null);function hu(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function $f(e){return e.isSubagent===!0}function Ea(e){return e.isArchived===!0}function Vf(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function LF(e,t){let n=e;const s=new Set([e.sessionId]);for(;;){const a=Vf(n);if(!a)return n.sessionId;const c=t.get(a);if(!c)return n.sessionId;if(s.has(c.sessionId))return e.sessionId;s.add(c.sessionId),n=c}}function PC(e){const t=new Map(e.map(a=>[a.sessionId,a])),n=new Map,s=[];for(const a of e){const c=LF(a,t);if(c===a.sessionId){s.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...s].sort(hu).map(a=>({session:a,children:[...n.get(a.sessionId)??[]].sort(hu)}))}function IF(e){return e.flatMap(t=>[t.session,...Is(t)])}function Vh(e,t,n,s=-1){if(e<=0)return 0;const a=s>=0?Math.max(t,s+1):t;return Math.min(e,Math.max(n??0,a))}function Kw(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(a=>e[a]===t[a])}function DF(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function _F(e){return cl(e)||e.syncStatus==="error"}function FF(e){var s,a;if(!_F(e))return null;const t=((s=e.lastErrorCode)==null?void 0:s.trim())??"",n=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&n&&!n.includes(t)?`${t} · ${n}`:n||t||(e.syncStatus==="error"&&!cl(e)?h("conversation.syncStatusError"):h("conversation.runtimeErrorTitle"))}function OF(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function Ru(e,t="compact"){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?t==="full"?"shell.providerClaudeCode":"conversation.providerClaude":e==="opencode"?"conversation.providerOpenCode":t==="full"?"shell.providerClaudeCode":"conversation.providerClaude")}const BF={position:"relative",zIndex:0},WF={zIndex:1};function TC(e,t,n){const s=[];n&&s.push(t.name);const a=DF(e);return a&&s.push(a),s.join(" · ")||t.name}function Qw(e,t){return op("session-state-indicator",e)}function Yw(e,t){try{const n=window.localStorage.getItem(e),s=n?Number(n):Number.NaN;return Number.isFinite(s)?s:t}catch{return t}}function Xw(e,t){try{const n=window.localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function UF(e){try{const t=window.localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);if(!Array.isArray(n))return[];const s=[];for(const a of n)typeof a=="string"&&!s.includes(a)&&s.push(a);return s}catch{return[]}}function zF(e){var t;try{const n=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return n||null}catch{return null}}function Es(e,t){try{window.localStorage.setItem(e,t)}catch{}}function HF(e){try{window.localStorage.removeItem(e)}catch{}}function Sc(e,t,n){return Math.max(t,Math.min(n,e))}function qF(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function $F(){typeof window>"u"||window.dispatchEvent(new CustomEvent(bF))}function Jw(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(hu)}))}function VF(){return On(jC,vF)}function GF(e,t){let n=!1;const s=e.map(a=>{if(a.workspace.id!==t.workspaceId)return a;const c=a.sessions.findIndex(d=>d.sessionId===t.sessionId),l=c>=0?a.sessions.map((d,f)=>f===c?t:d):[t,...a.sessions];return n=!0,{...a,sessions:[...l].sort(hu)}});return n?s:e}function KF(e,t,n){let s=!1;const a=e.map(c=>{let l=!1;const d=c.sessions.map(f=>f.sessionId!==t?f:(s=!0,l=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>n?f.lastSeenAt:n,activityState:f.activityState==="completed_unread"?"idle":f.activityState}));return l?{...c,sessions:d}:c});return s?a:e}function Zw(e,t,n){let s=!1;const a=e.map(c=>{let l=!1;const d=c.sessions.map(f=>f.sessionId!==t||f.isArchived===n?f:(s=!0,l=!0,{...f,isArchived:n}));return l?{...c,sessions:d}:c});return s?a:e}function eb(e,t,n){let s=!1;const a=e.map(c=>{let l=!1;const d=c.sessions.map(f=>f.sessionId!==t||f.isFavorite===!0===n?f:(s=!0,l=!0,{...f,isFavorite:n}));return l?{...c,sessions:d}:c});return s?a:e}function Gf(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function EC(e,t){const n=e.filter(s=>t.has(s));return n.length===e.length?e:n}function Kf(e){return`workspace-management.summary.${e}`}function RC(e){return`git-sidebar.snapshot.${e}`}function MC(e,t){const n=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!n,repoRoot:n,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function AC(e,t){const n=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n}}}function LC(e,t){var a,c,l;const n=((a=t.status)==null?void 0:a.snapshot.repoRoot)??e.git.repoRoot,s=((c=t.status)==null?void 0:c.snapshot.branch)??((l=t.branches)==null?void 0:l.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n,currentBranch:s,error:null}}}function IC({count:e,className:t="workbench-skeleton-lines"}){return i.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(n,s)=>i.jsx("span",{className:"skeleton-line"},s))})}function QF(){return i.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>i.jsxs("section",{className:"workbench-skeleton-card",children:[i.jsxs("div",{className:"workbench-skeleton-heading",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line tiny"})]}),i.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(n,s)=>i.jsxs("div",{className:"workbench-skeleton-session",children:[i.jsx("span",{className:"workbench-skeleton-dot"}),i.jsx(IC,{count:2,className:"workbench-skeleton-lines compact"})]},s))})]},t))})}function Cc(){return i.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>i.jsxs("article",{className:"workbench-info-skeleton-card",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx(IC,{count:3})]},t))})}function YF({side:e,collapsed:t}){const n=e==="left"?8.5:15.5,s=e==="left"?t?"12 9 15 12 12 15":"15 9 12 12 15 15":t?"12 9 9 12 12 15":"9 9 12 12 9 15";return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:n,y1:"4",x2:n,y2:"20"}),i.jsx("polyline",{points:s})]})}function tb({ariaLabel:e,side:t,collapsed:n,className:s="panel-icon-button",onClick:a}){return i.jsx("button",{className:s,type:"button","aria-label":e,title:e,onClick:a,children:i.jsx(YF,{side:t,collapsed:n})})}function nb({expanded:e}){return i.jsx("svg",{className:e?"workbench-chevron":"workbench-chevron collapsed",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function XF(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function JF(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),i.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),i.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function ZF(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function eO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function tO(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function nO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("path",{d:"M7 9l3 3-3 3"}),i.jsx("path",{d:"M13 15h4"})]})}function DC(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"15 18 9 12 15 6"})})}function ap(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})}function _C(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),i.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function rO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),i.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function iO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function sO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),i.jsx("path",{d:"M14 16l2 2 4-4"})]})}function oO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),i.jsx("path",{d:"M10 12h8"}),i.jsx("path",{d:"M15 8l4 4-4 4"})]})}function aO({selected:e}){return e?i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),i.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function FC({active:e}){return e?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function lO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7h18"}),i.jsx("path",{d:"M5 7l1 12h12l1-12"}),i.jsx("path",{d:"M9 11h6"}),i.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function cO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function uO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M9 13h6"})]})}function dO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]})}function hO(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function fO({open:e,mode:t,keyword:n,codeWorkspaceId:s,codeResults:a,codeLoading:c,codeError:l,workspaceOptions:d,sessionResults:f,onClose:p,onModeChange:y,onKeywordChange:g,onCodeWorkspaceChange:b,onCodeSearch:x,onOpenSession:S}){const C=n.trim().length>0&&s.trim().length>0;return i.jsx(Rr,{open:e,title:h("shell.searchModalTitle"),description:h("shell.searchModalDescription"),onClose:p,children:i.jsxs("div",{className:"workbench-search-modal",children:[i.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":h("shell.searchModeLabel"),children:[i.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>y("sessions"),children:h("shell.searchModeSessions")}),i.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>y("code"),children:h("shell.searchModeCode")})]}),t==="sessions"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),i.jsx("div",{className:"workbench-search-results",children:n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionHint")}):f.length>0?f.map(j=>{const R=ds(j.session.title,h("common.unknown"));return i.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>S(j.session.sessionId),children:[i.jsx("span",{className:"workbench-search-result-title",title:R.fullTitle,children:R.displayTitle}),i.jsxs("span",{className:"workbench-search-result-meta",children:[j.workspace.name," · ",Ru(j.session.provider,"full")]})]},j.session.sessionId)}):i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionEmpty")})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchWorkspaceLabel")}),i.jsx("select",{value:s,onChange:j=>b(j.target.value),children:d.map(j=>i.jsx("option",{value:j.id,children:j.name},j.id))})]}),i.jsxs("form",{className:"workbench-search-code-form",onSubmit:j=>{j.preventDefault(),x()},children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchCodePlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!C||c,children:h(c?"common.loading":"shell.searchSubmit")})]}),i.jsxs("div",{className:"workbench-search-results",children:[l?i.jsx("p",{className:"status-text","data-tone":"error",children:l}):null,!l&&n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeHint")}):null,!l&&n.trim().length>0&&!c&&a.length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeEmpty")}):null,a.map(j=>i.jsxs("div",{className:"workbench-search-result-item static",children:[i.jsx("span",{className:"workbench-search-result-title",children:j.name}),i.jsx("span",{className:"workbench-search-result-meta",children:j.path})]},`${j.path}-${j.kind}`))]})]})]})})}function jc({menuKey:e,session:t,workspace:n,isActive:s,isFavorite:a,menuOpen:c,showWorkspaceName:l,depth:d=0,showActions:f=!0,hasSubagents:p=!1,subagentListExpanded:y=!1,selectionMode:g=!1,selected:b=!1,onToggleSelect:x,onToggleSubagents:S,onOpen:C,onRename:j,onToggleMenu:R,onToggleFavorite:L,onArchive:A,onCloseMenu:K,onContextMenu:H}){var se;const F=((se=t.subagentLabel)==null?void 0:se.trim())||($f(t)?h("shell.subagentBadge"):null),M=ds(t.title,h("common.unknown")),_=FF(t),I=_?OF(_):null,P=du(t),U=P?pC("session-activity-badge",t):null,G=v.useRef(null),[X,Z]=v.useState(null);v.useLayoutEffect(()=>{if(!c){Z(null);return}const Y=()=>{const q=G.current;if(!q)return;const oe=q.getBoundingClientRect();Z({top:`${oe.bottom}px`,left:`${oe.right}px`})};return Y(),window.addEventListener("resize",Y),window.addEventListener("scroll",Y,!0),()=>{window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0)}},[c]);const $=c&&typeof document<"u"&&X?Hn.createPortal(i.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:Y=>Y.stopPropagation(),style:X,children:[i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{j(),K()},children:[i.jsx(cO,{}),i.jsx("span",{children:h("shell.renameAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{L(),K()},children:[i.jsx(FC,{active:a}),i.jsx("span",{children:h(a?"shell.unfavoriteAction":"shell.favoriteAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{A(),K()},children:[i.jsx(lO,{}),i.jsx("span",{children:h("shell.archiveAction")})]})]}),document.body):null;return i.jsxs("article",{className:"workbench-session-card","data-active":s,"data-depth":d,"data-subagent":$f(t),"data-has-subagents":p,"data-selecting":g,"data-selected":b,onContextMenu:Y=>{g||!H||(Y.preventDefault(),H())},children:[i.jsxs("div",{className:"workbench-session-main",children:[g?i.jsx("span",{className:"workbench-session-selection-indicator","data-selected":b,"aria-hidden":"true",children:i.jsx(aO,{selected:b})}):p?i.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:WF,"aria-label":h(y?"shell.subagentCollapse":"shell.subagentExpand"),title:h(y?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":y,onClick:Y=>{Y.stopPropagation(),S==null||S()},children:[i.jsx("span",{className:Qw(t),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:y?i.jsx(dO,{}):i.jsx(ap,{})})]}):i.jsx("span",{className:Qw(t),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("button",{type:"button",className:"workbench-session-link",style:p?BF:void 0,"data-active":s,"aria-pressed":g?b:void 0,onClick:g?x:C,children:i.jsxs("div",{className:"workbench-session-link-copy",children:[i.jsxs("div",{className:"session-title-row",children:[i.jsx("span",{className:"session-title",title:M.fullTitle,children:M.displayTitle}),F?i.jsx("span",{className:"session-subagent-badge",children:F}):null]}),i.jsxs("div",{className:"session-meta-row",children:[i.jsx("span",{className:"session-meta",children:TC(t,n,l)}),P&&U?i.jsx("span",{className:U,children:P}):null,i.jsx("span",{className:`session-provider-badge ${t.provider}`,children:Ru(t.provider)})]}),I?i.jsx("div",{className:"session-error-row",title:_??void 0,children:i.jsx("span",{className:"session-error-text",children:I})}):null]})})]}),f&&!g?i.jsx("div",{className:"workbench-session-actions","data-open":c,children:i.jsx("button",{ref:G,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":h("shell.sessionMoreAction"),title:h("shell.sessionMoreAction"),"aria-expanded":c,onClick:Y=>{Y.stopPropagation(),R()},children:i.jsx(hO,{})})}):null,$]})}function rb({workspaceGroups:e,favoriteSessions:t,favoriteSessionIds:n,activeWorkspaceId:s,isConversationActive:a,isTerminalActive:c,isSearchOpen:l,navigationLoading:d,navigationError:f,activeSessionId:p,onRefreshNavigation:y,onSessionUpdated:g,onNavigateConversation:b,onNavigateTerminals:x,onOpenSearch:S,onOpenSettings:C,onSelectWorkspace:j,onToggleWorkspaceCollapse:R,subscribeGitSnapshot:L,requestGitRefresh:A,subscribeWorkspaceManagementSnapshot:K,requestWorkspaceManagementRefresh:H,onToggleFavoriteSession:F,onArchiveSession:M,onUnarchiveSession:_,workspaceManagementStateById:I,setWorkspaceManagementStateById:P,onClose:U,onToggleCollapse:G}){var ke;const X=qn(),Z=Mn(),{showToast:$}=Yn(),se=v.useCallback(D=>{!Z.isDesktop||Z.ui.osFamily!=="macos"||D.button!==0||rp(D.target)&&ip()},[Z.isDesktop,Z.ui.osFamily]),[Y,q]=v.useState(!1),[oe,E]=v.useState(!1),[B,te]=v.useState(!1),[T,we]=v.useState([]),[me,Ce]=v.useState(null),[_e,Ge]=v.useState(null),[ot,mt]=v.useState(null),[jt,yt]=v.useState(null),[St,Lt]=v.useState(null),[vt,zt]=v.useState(null),[Rt,ft]=v.useState(null),[tn,qt]=v.useState($h),[Ot,tt]=v.useState({}),[$t,gt]=v.useState({}),[Vt,ue]=v.useState([]),[ve,Le]=v.useState(null),[Ke,nt]=v.useState(""),[wt,Dt]=v.useState(null),[Pt,Ze]=v.useState(null),[Wt,ct]=v.useState([]),[It,Mt]=v.useState(!1),Xt=((ke=e.find(D=>D.workspace.id===St))==null?void 0:ke.workspace)??null,ee=e.find(D=>D.workspace.id===vt)??null,Ie=e.find(D=>D.workspace.id===Pt)??null,at=v.useMemo(()=>Ie?IF(Ta(Ie)):[],[Ie]),Nt=v.useMemo(()=>at.map(D=>D.sessionId),[at]),Se=v.useMemo(()=>new Set(Nt),[Nt]),Ye=v.useMemo(()=>new Set(Wt),[Wt]),Ut=Nt.length>0&&Wt.length===Nt.length;v.useEffect(()=>{P(D=>{const he=new Set(e.map(O=>O.workspace.id)),ie={};Object.entries(D).forEach(([O,xe])=>{he.has(O)&&(ie[O]=xe)}),e.forEach(O=>{const xe=On(Kf(O.workspace.id),zw),ge=On(RC(O.workspace.id),zw),ze=ie[O.workspace.id];let ht=AC((ze==null?void 0:ze.detail)??xe??MC(O.workspace),O.workspace);(ge!=null&&ge.status||ge!=null&&ge.branches)&&(ht=LC(ht,{workspaceId:O.workspace.id,status:ge.status??null,branches:ge.branches??null})),ie[O.workspace.id]={detail:ht,loading:!1,error:null}});const it=Object.keys(D),_t=Object.keys(ie);return it.length===_t.length&&_t.every(O=>D[O]===ie[O])?D:ie})},[e]);const nn=v.useCallback(async D=>{await y(),await Z.bridge.showNotification(h("shell.importSuccess"),D.path)},[y,Z.bridge]),fn=v.useCallback(async D=>{await y(),await Z.bridge.showNotification(h("shell.cloneSuccess"),D.path)},[y,Z.bridge]);function Nn(D){if(T.includes(D)){we(ie=>ie.filter(it=>it!==D));return}we(ie=>[...ie,D]),L(D),A(D),K(D),H(D)}async function wn(){if(!(!me||_e)){Ge(me.id);try{await Mk(me.id),we(D=>D.filter(he=>he!==me.id)),P(D=>{const he={...D};return delete he[me.id],he}),Ce(null),await y(),$({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(D){$({title:D instanceof Error?D.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Ge(null)}}}v.useEffect(()=>{if(!Rt)return;function D(he){const ie=he.target;ie instanceof HTMLElement&&(ie.closest(".workbench-session-actions")||ie.closest(".workbench-session-menu"))||ft(null)}return window.addEventListener("pointerdown",D),()=>{window.removeEventListener("pointerdown",D)}},[Rt]),v.useEffect(()=>{if(!Pt){Wt.length>0&&ct([]);return}if(!Ie){Ze(null),ct([]);return}ct(D=>EC(D,Se))},[Ie,Se,Pt,Wt.length]),v.useEffect(()=>{Pt&&Nt.length===0&&(Ze(null),ct([]))},[Nt.length,Pt]),v.useEffect(()=>{const D=new Set(e.map(he=>he.workspace.id));we(he=>he.filter(ie=>D.has(ie))),Ce(he=>he&&D.has(he.id)?he:null)},[e]),v.useEffect(()=>{const D=t.findIndex(he=>he.session.sessionId===p);qt(he=>{const ie=Vh(t.length,$h,he,D);return ie===he?he:ie})},[p,t]),v.useEffect(()=>{tt(D=>{const he={};for(const ie of e){const it=Ta(ie),_t=it.findIndex(O=>O.session.sessionId===p||Is(O).some(xe=>xe.sessionId===p));he[ie.workspace.id]=Vh(it.length,xc,D[ie.workspace.id],_t)}return Kw(D,he)?D:he})},[p,e]),v.useEffect(()=>{gt(D=>{const he={};for(const ie of e)for(const it of Ta(ie)){const _t=Is(it);if(_t.length===0)continue;const O=_t.findIndex(xe=>xe.sessionId===p);he[it.session.sessionId]=Vh(_t.length,kc,D[it.session.sessionId],O)}return Kw(D,he)?D:he})},[p,e]),v.useEffect(()=>{if(!p)return;const D=e.flatMap(he=>Ta(he).filter(ie=>Is(ie).some(it=>it.sessionId===p)).map(ie=>ie.session.sessionId));D.length!==0&&ue(he=>{const ie=new Set(he);let it=!1;for(const _t of D)ie.has(_t)||(ie.add(_t),it=!0);return it?Array.from(ie):he})},[p,e]);function V(){q(!0)}function re(){E(!0)}function de(D){return $t[D]??kc}function be(D){return Vt.includes(D)}function Ee(D){return Ot[D]??xc}function We(){qt(D=>Math.min(t.length,D+$h))}function $e(D,he){tt(ie=>({...ie,[D]:Math.min(he,(ie[D]??xc)+xc)}))}function Re(D){gt(he=>({...he,[D]:(he[D]??kc)+kc}))}function De(D){ue(he=>he.includes(D)?he.filter(ie=>ie!==D):[...he,D])}function Fe(D){for(const he of e){const ie=PC(he.visibleSessions).find(it=>it.session.sessionId===D);if(ie)return Is(ie)}return[]}function Oe(D){ft(null),Ze(D),ct([])}function dt(){Ze(null),ct([])}function ut(D){ct(he=>Gf(he,D))}function Gt(){ct(D=>D.length===Nt.length?[]:Nt)}async function Tt(D,he){mt(D),yt(he);try{Lt(null),X(YS(D,he)),U==null||U()}catch(ie){$({title:ie instanceof Error?ie.message:h("shell.startSessionFailed"),tone:"error"})}finally{mt(null),yt(null)}}async function Ue(D){const he=n.has(D);ft(null);try{await F(D),$({title:h(he?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(ie){$({title:ie instanceof Error?ie.message:h("shell.favoriteToggleFailed"),tone:"error"})}}async function ae(D){ft(null);try{await M(D),$({title:h("shell.archiveAdded"),tone:"success"})}catch(he){$({title:he instanceof Error?he.message:h("shell.navigationLoadFailed"),tone:"error"})}}async function je(){if(!(Wt.length===0||It)){ft(null),Mt(!0);try{const D=[...Wt],he=await Promise.allSettled(D.map(async _t=>({sessionId:_t,session:await Ik(_t,!0)}))),ie=[];let it=0;for(const _t of he){if(_t.status==="fulfilled"){ie.push(_t.value.sessionId),g(_t.value.session);continue}it+=1}ie.length>0&&(await y(),ct(_t=>_t.filter(O=>!ie.includes(O)))),it>0?$({title:ie.length>0?h("shell.batchArchivePartialFailed"):h("shell.batchArchiveFailed"),tone:"error"}):$({title:h("shell.batchArchiveSuccess"),tone:"success"})}catch(D){$({title:D instanceof Error?D.message:h("shell.batchArchiveFailed"),tone:"error"})}finally{Mt(!1)}}}async function Xe(D){ft(null);try{await _(D),$({title:h("shell.archiveRestored"),tone:"success"})}catch(he){$({title:he instanceof Error?he.message:h("shell.navigationLoadFailed"),tone:"error"})}}function rt(D,he){ft(null),Le({session:D,workspace:he}),nt(D.title)}async function He(D){if(D.preventDefault(),!ve)return;const he=Ke.trim();if(he){Dt(ve.session.sessionId);try{const ie=await Lk(ve.session.sessionId,he);g(ie),Le(null),nt(""),$({title:h("shell.renameSuccess"),tone:"success"})}catch(ie){$({title:ie instanceof Error?ie.message:h("shell.renameFailed"),tone:"error"})}finally{Dt(null)}}}async function At(D){if(!Z.isDesktop)return;const he=n.has(D.session.sessionId);await z2([{id:`open-${D.session.sessionId}`,label:h("shell.contextOpenSession"),onSelect:()=>{X(Qn(D.workspace.id,D.session.sessionId)),U==null||U()}},{id:`rename-${D.session.sessionId}`,label:h("shell.renameAction"),onSelect:()=>rt(D.session,D.workspace)},{id:`favorite-${D.session.sessionId}`,label:h(he?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>Ue(D.session.sessionId)},{id:`archive-${D.session.sessionId}`,label:h("shell.archiveAction"),onSelect:()=>{ae(D.session.sessionId)}}])}const Ct=t.slice(0,tn),Q=Ct.length<t.length;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:se,children:i.jsxs("div",{className:"workbench-nav-toolbar",children:[G?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideSessionSidebar"),title:h("shell.hideSessionSidebar"),onClick:G,children:i.jsx(_C,{})}):null,i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>X(-1),children:i.jsx(DC,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>X(1),children:i.jsx(ap,{})})]})}),i.jsxs("div",{className:"workbench-nav-body",children:[i.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":h("shell.centerTabsLabel"),children:[i.jsxs("button",{type:"button",className:a?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":a,onClick:b,children:[i.jsx(tO,{}),h("shell.conversationEntry")]}),i.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:x,children:[i.jsx(nO,{}),h("shell.terminalsEntry")]}),i.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":l,"aria-haspopup":"dialog","aria-expanded":l,onClick:S,children:[i.jsx(eO,{}),i.jsx("span",{children:h("shell.searchEntry")})]})]}),f?i.jsx("div",{className:"workbench-status-row",children:i.jsx("p",{className:"status-text","data-tone":"error",children:f})}):null,t.length>0?i.jsxs("section",{className:"workbench-section-block",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsxs("div",{className:"workbench-section-heading-main",children:[i.jsx(FC,{active:!0}),i.jsx("span",{children:h("shell.favoriteSectionTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:t.length})]}),i.jsxs("div",{className:"workbench-session-list",children:[Ct.map(D=>{const he=Fe(D.session.sessionId),ie=be(D.session.sessionId),it=ie?he.slice(0,de(D.session.sessionId)):[],_t=ie&&it.length<he.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(jc,{menuKey:`favorite:${D.session.sessionId}`,session:D.session,workspace:D.workspace,isActive:D.session.sessionId===p,isFavorite:n.has(D.session.sessionId),menuOpen:Rt===`favorite:${D.session.sessionId}`,showWorkspaceName:!0,hasSubagents:he.length>0,subagentListExpanded:ie,onToggleSubagents:()=>De(D.session.sessionId),onOpen:()=>{X(Qn(D.workspace.id,D.session.sessionId)),U==null||U()},onRename:()=>rt(D.session,D.workspace),onToggleMenu:()=>ft(O=>O===`favorite:${D.session.sessionId}`?null:`favorite:${D.session.sessionId}`),onToggleFavorite:()=>Ue(D.session.sessionId),onArchive:()=>ae(D.session.sessionId),onCloseMenu:()=>ft(null),onContextMenu:Z.isDesktop?()=>{At(D)}:void 0}),he.length>0&&ie?i.jsxs("div",{className:"workbench-subsession-list",children:[it.map(O=>i.jsx(jc,{menuKey:`favorite:${O.sessionId}`,session:O,workspace:D.workspace,isActive:O.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!0,depth:1,showActions:!1,onOpen:()=>{X(Qn(D.workspace.id,O.sessionId)),U==null||U()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:Z.isDesktop?()=>{At({session:O,workspace:D.workspace})}:void 0},O.sessionId)),_t?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Re(D.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},D.session.sessionId)}),Q?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:We,children:h("shell.favoriteExpandMore")}):null]})]}):null,d&&e.length===0?i.jsx(QF,{}):null,!d&&!f&&e.length===0?i.jsx("div",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})}):null,i.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsx("div",{className:"workbench-section-heading-main",children:i.jsx("span",{children:h("shell.workspaceSectionTitle")})}),i.jsxs("div",{className:"workbench-section-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.manageWorkspaceAction"),title:h("shell.manageWorkspaceAction"),onClick:()=>te(!0),children:i.jsx(JF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.importWorkspaceTitle"),title:h("shell.importWorkspaceTitle"),onClick:V,children:i.jsx(XF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.cloneWorkspaceTitle"),title:h("shell.cloneWorkspaceTitle"),onClick:re,children:i.jsx(rO,{})})]})]}),e.map(D=>{const he=Ta(D);return i.jsxs("section",{className:"workbench-workspace-group","data-batch-active":Pt===D.workspace.id,children:[i.jsxs("div",{className:"workbench-workspace-header minimal",children:[i.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":D.isCollapsed?h("shell.workspaceExpand"):h("shell.workspaceCollapse"),onClick:()=>R(D.workspace.id),children:[i.jsx(nb,{expanded:!D.isCollapsed}),i.jsx("strong",{children:D.workspace.name})]}),Pt===D.workspace.id?i.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[i.jsx("span",{className:"workbench-workspace-batch-label",children:h("shell.batchSelectionMode")}),i.jsxs("span",{className:"workbench-workspace-batch-counter",children:[Wt.length,"/",Nt.length]}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:Gt,children:h(Ut?"shell.clearSelectedSessions":"shell.selectAllSessions")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:Wt.length===0||It,onClick:()=>{je()},children:h(It?"shell.batchArchiving":"shell.batchArchiveAction")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:dt,children:h("common.cancel")})]}):i.jsxs("div",{className:"workbench-workspace-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.switchWorkspace"),title:h("shell.switchWorkspace"),"aria-pressed":s===D.workspace.id,onClick:()=>{j(D.workspace.id),U==null||U()},children:i.jsx(oO,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.batchSelectSessions"),title:h("shell.batchSelectSessions"),onClick:()=>Oe(D.workspace.id),children:i.jsx(sO,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":h("shell.createSession"),title:h("shell.createSession"),onClick:()=>Lt(D.workspace.id),children:i.jsx(ZF,{})})]})]}),D.isCollapsed?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-session-list",children:[he.length===0?i.jsx("p",{className:"workbench-session-empty",children:h("shell.emptyWorkspaceSessions")}):he.slice(0,Ee(D.workspace.id)).map(ie=>{const it=Is(ie),_t=be(ie.session.sessionId),O=_t?it.slice(0,de(ie.session.sessionId)):[],xe=_t&&O.length<it.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(jc,{menuKey:`workspace:${D.workspace.id}:${ie.session.sessionId}`,session:ie.session,workspace:D.workspace,isActive:ie.session.sessionId===p,isFavorite:n.has(ie.session.sessionId),menuOpen:Rt===`workspace:${D.workspace.id}:${ie.session.sessionId}`,showWorkspaceName:!1,hasSubagents:it.length>0,subagentListExpanded:_t,selectionMode:Pt===D.workspace.id,selected:Ye.has(ie.session.sessionId),onToggleSelect:()=>ut(ie.session.sessionId),onToggleSubagents:()=>De(ie.session.sessionId),onOpen:()=>{X(Qn(D.workspace.id,ie.session.sessionId)),U==null||U()},onRename:()=>rt(ie.session,D.workspace),onToggleMenu:()=>ft(ge=>ge===`workspace:${D.workspace.id}:${ie.session.sessionId}`?null:`workspace:${D.workspace.id}:${ie.session.sessionId}`),onToggleFavorite:()=>Ue(ie.session.sessionId),onArchive:()=>ae(ie.session.sessionId),onCloseMenu:()=>ft(null),onContextMenu:Z.isDesktop?()=>{At({session:ie.session,workspace:D.workspace})}:void 0}),it.length>0&&_t?i.jsxs("div",{className:"workbench-subsession-list",children:[O.map(ge=>i.jsx(jc,{menuKey:`workspace:${D.workspace.id}:${ge.sessionId}`,session:ge,workspace:D.workspace,isActive:ge.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!1,depth:1,showActions:!1,selectionMode:Pt===D.workspace.id,selected:Ye.has(ge.sessionId),onToggleSelect:()=>ut(ge.sessionId),onOpen:()=>{X(Qn(D.workspace.id,ge.sessionId)),U==null||U()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:Z.isDesktop?()=>{At({session:ge,workspace:D.workspace})}:void 0},ge.sessionId)),xe?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Re(ie.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},ie.session.sessionId)}),he.length>Ee(D.workspace.id)?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>$e(D.workspace.id,he.length),children:h("shell.sessionExpandMore")}):null]}),i.jsxs("button",{type:"button",className:"workbench-archive-folder",onClick:()=>zt(D.workspace.id),children:[i.jsxs("span",{className:"workbench-archive-folder-main",children:[i.jsx(uO,{}),i.jsx("span",{children:h("shell.archiveFolderLabel")})]}),i.jsx("span",{className:"workbench-section-counter",children:D.archivedSessions.length})]})]})]},D.workspace.id)})]})]}),i.jsx("div",{className:"workbench-nav-footer minimal",children:i.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:C,title:h("settings.title"),children:[i.jsx(iO,{}),i.jsx("span",{className:"settings-entry-label",children:h("settings.title")})]})}),i.jsx(Rr,{open:B,title:h("shell.manageWorkspaceTitle"),description:h("shell.manageWorkspaceDescription"),onClose:()=>{_e||te(!1)},children:e.length>0?i.jsx("div",{className:"workbench-manage-list",children:e.map(D=>{var ze;const he=T.includes(D.workspace.id),ie=I[D.workspace.id]??{detail:null,loading:!1,error:null},it=_e===D.workspace.id,_t=(ze=ie.detail)!=null&&ze.git.remotes.length?ie.detail.git.remotes.map(ht=>`${ht.name}: ${ht.url}`).join(" · "):h("shell.manageWorkspaceNoRemote"),O=D.visibleSessions.length+D.archivedSessions.length,xe=ie.detail?yC(ie.detail.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],ge=xe.length>0?vC(xe):void 0;return i.jsxs("article",{className:"workbench-manage-item",children:[i.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":he,onClick:()=>Nn(D.workspace.id),children:[i.jsxs("span",{className:"workbench-manage-item-heading",children:[i.jsx(nb,{expanded:he}),i.jsx("strong",{children:D.workspace.name})]}),i.jsx("span",{className:"workbench-section-counter",children:O})]}),he?i.jsxs("div",{className:"workbench-manage-item-body",children:[i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspacePathLabel")}),i.jsx("p",{className:"workbench-manage-detail-value",children:D.workspace.path})]}),ie.loading&&ie.detail===null?i.jsx("p",{className:"workbench-manage-status status-text",children:h("shell.manageWorkspaceLoading")}):null,ie.error?i.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:ie.error}):null,ie.detail?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-manage-detail-block",children:i.jsxs("div",{className:"workbench-manage-detail-header",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{className:"workbench-manage-detail-accent",children:ie.detail.git.commitCount??"--"})]})}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitInfoLabel")}),ie.detail.git.isRepository?i.jsxs("div",{className:"workbench-manage-kv-list",children:[i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRepoRoot")}),i.jsx("span",{children:ie.detail.git.repoRoot??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("span",{children:ie.detail.git.currentBranch??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRemoteLabel")}),i.jsx("span",{children:_t})]})]}):i.jsx("p",{className:"workbench-section-empty",children:ie.detail.git.error??h("shell.manageWorkspaceNotGit")})]}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceCodeCompositionLabel")}),xe.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:ge,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:ie.detail.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:xe.map(ht=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:ht.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:ht.type})]}),i.jsxs("span",{children:[ht.count," · ",gC(ht)]})]},ht.key))})]}):i.jsx("p",{className:"workbench-section-empty",children:ie.detail.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}),ie.detail.codeComposition.truncated?i.jsx("p",{className:"workbench-manage-hint",children:h("shell.manageWorkspaceCodeTruncated",{count:ie.detail.codeComposition.scannedFileCount})}):null]})]}):null,i.jsx("div",{className:"workbench-modal-actions",children:i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!_e,onClick:()=>Ce(D.workspace),children:h(it?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})})]}):null]},D.workspace.id)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.manageWorkspaceEmpty")})}),i.jsxs(Rr,{open:me!==null,title:h("shell.manageWorkspaceRemoveConfirmTitle"),description:h("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{_e||Ce(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:me?h("shell.manageWorkspaceRemoveConfirmTarget",{name:me.name}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!_e,onClick:()=>Ce(null),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!_e,onClick:()=>{wn()},children:h(_e?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),i.jsx(SC,{open:oe,onClose:()=>E(!1),onCloned:fn}),i.jsx(CC,{open:Y,onClose:()=>q(!1),onImported:nn}),i.jsx(Rr,{open:Xt!==null,title:h("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:Xt?`${h("shell.createSessionTarget")} · ${Xt.name}`:h("shell.createSessionModalDescription"),onClose:()=>Lt(null),children:i.jsx(kC,{disabled:!!ot,pendingProvider:ot===(Xt==null?void 0:Xt.id)?jt??null:null,onSelect:D=>{Xt&&Tt(Xt.id,D)}})}),i.jsx(Rr,{open:ee!==null,title:h("shell.archiveModalTitle"),description:ee?`${ee.workspace.name} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription"),onClose:()=>zt(null),children:ee&&ee.archivedSessions.length>0?i.jsx("div",{className:"workbench-archive-list",children:ee.archivedSessions.map(D=>{const he=ds(D.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:he.fullTitle,children:he.displayTitle}),i.jsxs("p",{children:[TC(D,ee.workspace,!1)," ·"," ",Ru(D.provider)]})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Xe(D.sessionId),children:h("shell.unarchiveAction")})]},D.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})}),i.jsx(Rr,{open:ve!==null,title:h("shell.renameModalTitle"),description:h("shell.renameModalDescription"),onClose:()=>{wt||(Le(null),nt(""))},children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:He,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.renameInputLabel")}),i.jsx("input",{type:"text",value:Ke,placeholder:h("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:D=>nt(D.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!wt,onClick:()=>{Le(null),nt("")},children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!Ke.trim()||wt===(ve==null?void 0:ve.session.sessionId),children:wt===(ve==null?void 0:ve.session.sessionId)?h("shell.renamingSession"):h("common.save")})]})]})})]})}function ib({panelReady:e,activeTab:t,fileRevealRequest:n,onTabChange:s,onToggleCollapse:a,currentSessionId:c,activeWorkspaceId:l,navigationGroups:d}){var M;const f=l??((M=d[0])==null?void 0:M.workspace.id)??null,p=Mn(),{showToast:y}=Yn(),g=v.useRef(null),b=v.useRef(null),x=p.isDesktop&&p.bridge.supported,S=x&&!!l,C=x&&!!f,j=x&&!!f,R=typeof globalThis<"u"&&"PointerEvent"in globalThis,L=v.useCallback(async(_,I,P)=>{if(_==="files"){const G=await Z2(p,{workspaceId:I,sessionId:P,focusOwner:"file-context-panel"});G.ok||y({title:G.detail??h("conversation.filePanelOpenExternalFailed"),tone:"error"});return}if(_==="git"){const G=await eF(p,{workspaceId:I,focusOwner:"git-sidebar"});G.ok||y({title:G.detail??h("git.openExternalFailed"),tone:"error"});return}const U=await tF(p,{workspaceId:I,focusOwner:"terminal-manager-panel"});U.ok||y({title:U.detail??h("terminalManager.openExternalFailed"),tone:"error"})},[p,y]),A=v.useCallback((_,I)=>{if(_.button!==0||!x)return;const P=I==="files"?l:I==="git"||I==="terminals"?f:null;if(!P)return;const U=I==="files"?c:null;g.current={tab:I,startX:_.clientX,startY:_.clientY,workspaceId:P,sessionId:U,detached:!1,preview:null};const G=se=>{var E;const Y=g.current;if(!Y)return;const q=Math.abs(se.clientX-Y.startX),oe=Math.abs(se.clientY-Y.startY);!Y.detached&&Math.max(q,oe)<qw||(Y.detached||(Y.detached=!0,b.current=Y.tab,Y.preview=Rw({title:Y.tab==="files"?h("shell.filesEntry"):Y.tab==="git"?h("shell.gitEntry"):h("shell.terminalManagerEntry"),x:se.clientX,y:se.clientY})),(E=Y.preview)==null||E.updatePosition(se.clientX,se.clientY))},X=se=>{var q;const Y=(q=g.current)==null?void 0:q.preview;se&&(Y==null||Y.cancel()),window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",Z),window.removeEventListener("blur",$),g.current=null},Z=async()=>{var Y;const se=g.current;X(!1),se!=null&&se.detached&&(await((Y=se.preview)==null?void 0:Y.complete()),await L(se.tab,se.workspaceId,se.sessionId))},$=()=>{X(!0)};window.addEventListener("mousemove",G),window.addEventListener("mouseup",Z),window.addEventListener("blur",$)},[l,x,c,f,L]),K=v.useCallback((_,I)=>{if(_.button!==0||!x)return;const P=I==="files"?l:I==="git"||I==="terminals"?f:null;if(!P)return;const U=_.currentTarget,G=_.pointerId;U.setPointerCapture(G);const X=I==="files"?c:null;g.current={tab:I,startX:_.clientX,startY:_.clientY,workspaceId:P,sessionId:X,detached:!1,preview:null};const Z=oe=>{var T;if(oe.pointerId!==G)return;const E=g.current;if(!E)return;const B=Math.abs(oe.clientX-E.startX),te=Math.abs(oe.clientY-E.startY);!E.detached&&Math.max(B,te)<qw||(E.detached||(E.detached=!0,b.current=E.tab,E.preview=Rw({title:E.tab==="files"?h("shell.filesEntry"):E.tab==="git"?h("shell.gitEntry"):h("shell.terminalManagerEntry"),x:oe.clientX,y:oe.clientY})),(T=E.preview)==null||T.updatePosition(oe.clientX,oe.clientY))},$=oe=>{var B;const E=(B=g.current)==null?void 0:B.preview;oe&&(E==null||E.cancel()),U.removeEventListener("pointermove",Z),U.removeEventListener("pointerup",se),U.removeEventListener("pointercancel",Y),U.removeEventListener("lostpointercapture",Y),window.removeEventListener("blur",q),g.current=null,U.hasPointerCapture(G)&&U.releasePointerCapture(G)},se=async oe=>{var B;if(oe.pointerId!==G)return;const E=g.current;$(!1),E!=null&&E.detached&&(await((B=E.preview)==null?void 0:B.complete()),await L(E.tab,E.workspaceId,E.sessionId))},Y=oe=>{oe.pointerId===G&&$(!0)},q=()=>{$(!0)};U.addEventListener("pointermove",Z),U.addEventListener("pointerup",se),U.addEventListener("pointercancel",Y),U.addEventListener("lostpointercapture",Y),window.addEventListener("blur",q)},[l,x,c,f,L]),H=v.useCallback(_=>{if(b.current===_){b.current=null;return}s(_)},[s]),F=v.useCallback(_=>{!p.isDesktop||p.ui.osFamily!=="macos"||_.button!==0||rp(_.target)&&ip()},[p.isDesktop,p.ui.osFamily]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-auxiliary-header","data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:F,children:[a?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideInfoSidebar"),title:h("shell.hideInfoSidebar"),onClick:a,children:i.jsx(_C,{})}):null,i.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":h("shell.infoTabsLabel"),children:[i.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",title:S?"拖拽标签到独立窗口":void 0,onPointerDown:_=>K(_,"files"),onMouseDown:R?void 0:_=>A(_,"files"),onClick:()=>H("files"),children:h("shell.filesEntry")}),i.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",title:C?"拖拽标签到独立窗口":void 0,onPointerDown:_=>K(_,"git"),onMouseDown:R?void 0:_=>A(_,"git"),onClick:()=>H("git"),children:h("shell.gitEntry")}),i.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",title:j?"拖拽标签到独立窗口":void 0,onPointerDown:_=>K(_,"terminals"),onMouseDown:R?void 0:_=>A(_,"terminals"),onClick:()=>H("terminals"),children:h("shell.terminalManagerEntry")})]})]}),i.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:i.jsx(Cc,{}),e&&t==="files"?l?i.jsx(v.Suspense,{fallback:i.jsx(Cc,{}),children:i.jsx(EF,{sessionId:c,workspaceId:l,externalRevealRequest:n})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.filesPanelEmpty")})}):null,e&&t==="git"?f?i.jsx(v.Suspense,{fallback:i.jsx(Cc,{}),children:i.jsx(RF,{workspaceId:f})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?i.jsx(v.Suspense,{fallback:i.jsx(Cc,{}),children:i.jsx(MF,{currentWorkspaceId:l,navigationGroups:d})}):null]})]})}function mO({shellMode:e="desktop"}){var $r,fl,Vo;const t=ri(),n=qn(),s=Mn(),{showToast:a}=Yn(),c=Ti(z=>z.notificationPreferences.notifyOnPermissionRequest),l=Ti(z=>z.notificationPreferences.notifyOnSessionCompleted),d=Ti(z=>z.notificationPreferences.notifyOnSessionFailed),f=v.useRef(VF()),p=v.useRef(0),y=v.useRef((((fl=($r=f.current)==null?void 0:$r.items)==null?void 0:fl.length)??0)>0),g=v.useRef(!1),b=v.useRef(null),x=v.useRef(0),S=v.useRef(null),C=v.useRef(null),j=v.useRef(new Set),R=v.useRef(new Set),L=v.useRef(new Set),A=v.useRef(new Set),K=v.useRef(null),H=v.useRef(null),F=v.useRef(null),M=v.useRef(null),_=v.useRef(null),I=v.useRef(null),P=v.useRef(null),U=v.useRef(null),G=v.useRef(a),X=v.useRef(s.bridge),Z=v.useRef(!1),$=v.useRef(new Map),se=v.useRef(!1),Y=v.useRef(new Map),q=v.useRef([]),[oe,E]=v.useState(()=>Jw(f.current)),[B,te]=v.useState(()=>{var z,le;return(((le=(z=f.current)==null?void 0:z.items)==null?void 0:le.length)??0)===0}),[T,we]=v.useState(null),[me,Ce]=v.useState(()=>Sc(Yw(Dw,pF),bc,Ww)),[_e,Ge]=v.useState(()=>Sc(Yw(_w,gF),bc,Uw)),[ot,mt]=v.useState(()=>Xw(Fw,!1)),[jt,yt]=v.useState(()=>Xw(Ow,!1)),[St,Lt]=v.useState(()=>UF(Bw)),[vt,zt]=v.useState(()=>zF(qh)),[Rt,ft]=v.useState(!1),[tn,qt]=v.useState("files"),[Ot,tt]=v.useState(!1),[$t,gt]=v.useState(!1),[Vt,ue]=v.useState({}),[ve,Le]=v.useState(!1),[Ke,nt]=v.useState("sessions"),[wt,Dt]=v.useState(""),[Pt,Ze]=v.useState(""),[Wt,ct]=v.useState(!1),[It,Mt]=v.useState(null),[Xt,ee]=v.useState([]),[Ie,at]=v.useState(null),[Nt,Se]=v.useState({});v.useEffect(()=>{G.current=a},[a]),v.useEffect(()=>{X.current=s.bridge},[s.bridge]),v.useEffect(()=>{Kt("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),v.useEffect(()=>{var z,le;Kt("workbench.cached_snapshot_loaded",{cached:!!f.current,workspaceCount:((z=f.current)==null?void 0:z.items.length)??0,sessionCount:((le=f.current)==null?void 0:le.items.reduce((qe,pt)=>qe+pt.sessions.length,0))??0})},[]);function Ye(z){var le;!z||!Array.isArray(z.items)||(Kt("workbench.apply_snapshot",{workspaceCount:z.items.length,sessionCount:z.items.reduce((qe,pt)=>qe+pt.sessions.length,0),currentSessionId:((le=Wa(t.pathname))==null?void 0:le.sessionId)??null}),Mr(jC,z),E(Jw(z)),we(null))}const Ut=v.useCallback(async()=>{const z=p.current+1;p.current=z,te(le=>le||!y.current),Kt("workbench.refresh_navigation.start",{requestId:z,hasNavigationData:y.current});try{const le=await Rk();if(z!==p.current){Kt("workbench.refresh_navigation.stale",{requestId:z});return}Ye(le)}catch(le){if(z!==p.current)return;we(le instanceof Error?le.message:h("shell.navigationLoadFailed")),G.current({title:le instanceof Error?le.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{Kt("workbench.refresh_navigation.end",{requestId:z,success:z===p.current}),z===p.current&&te(!1)}},[]),nn=v.useCallback(z=>{E(le=>GF(le,z))},[]),fn=v.useCallback(()=>{var z;(z=C.current)==null||z.requestRefresh()},[]),Nn=v.useCallback((z,le)=>{n(Qn(z,le))},[n]),wn=v.useCallback((z,le)=>{var qe;K.current={workspaceId:z,paths:le},(qe=C.current)==null||qe.subscribeFileTree(z,le)},[]),V=v.useCallback((z,le)=>{var qe;H.current={workspaceId:z,paths:le},(qe=C.current)==null||qe.requestFileTreeRefresh(z,le)},[]),re=v.useCallback(z=>(j.current.add(z),()=>{j.current.delete(z)}),[]),de=v.useCallback(z=>{var le;F.current=z,(le=C.current)==null||le.subscribeGit(z)},[]),be=v.useCallback(z=>{var le;M.current=z,(le=C.current)==null||le.requestGitRefresh(z)},[]),Ee=v.useCallback(z=>(R.current.add(z),()=>{R.current.delete(z)}),[]),We=v.useCallback(z=>{var le;_.current=z,(le=C.current)==null||le.subscribeWorkspaceManagement(z)},[]),$e=v.useCallback(z=>{var le;I.current=z,Se(qe=>{var pt;return{...qe,[z]:{detail:((pt=qe[z])==null?void 0:pt.detail)??null,loading:!0,error:null}}}),(le=C.current)==null||le.requestWorkspaceManagementRefresh(z)},[]),Re=v.useCallback(z=>(L.current.add(z),()=>{L.current.delete(z)}),[]),De=v.useCallback(z=>{var le;P.current=z,(le=C.current)==null||le.subscribeTerminalManager(z)},[]),Fe=v.useCallback(z=>{var le;U.current=z,(le=C.current)==null||le.requestTerminalManagerRefresh(z)},[]),Oe=v.useCallback(z=>(A.current.add(z),()=>{A.current.delete(z)}),[]),dt=v.useCallback((z,le)=>{E(qe=>KF(qe,z,le??new Date().toISOString()))},[]),ut=v.useCallback(async(z,le)=>{E(qe=>Zw(qe,z,le));try{const qe=await Ik(z,le);nn(qe),fn()}catch(qe){throw E(pt=>Zw(pt,z,!le)),qe}},[fn,nn]),Gt=v.useCallback((z,le)=>{Kt("workbench.set_session_workspace",{sessionId:z,workspaceId:le}),ue(qe=>{if(!le){if(!(z in qe))return qe;const pt={...qe};return delete pt[z],pt}return qe[z]===le?qe:{...qe,[z]:le}})},[]);v.useEffect(()=>{y.current=oe.length>0},[oe]),v.useEffect(()=>{Kt("workbench.navigation_state",{navigationLoading:B,workspaceCount:oe.length,sessionCount:oe.reduce((z,le)=>z+le.sessions.length,0)})},[oe,B]),v.useEffect(()=>{S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{var Ft;S.current=null,!(g.current||y.current)&&(Kt("workbench.refresh_navigation.ws_fallback_triggered"),(Ft=C.current)==null||Ft.requestRefresh())},1200);const z=new rC({onConnectionChange:Ft=>{Ft==="reconnect_failed"&&!y.current&&(we(h("shell.navigationLoadFailed")),G.current({id:"workbench-navigation-connection",title:h("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:Ft=>{g.current=!0,Kt("workbench.ws_snapshot_received",{workspaceCount:Ft.items.length,sessionCount:Ft.items.reduce((An,vi)=>An+vi.sessions.length,0)}),S.current!==null&&(window.clearTimeout(S.current),S.current=null),Ye(Ft),te(!1)},onFileTreeSnapshot:Ft=>{j.current.forEach(An=>An(Ft))},onGitSnapshot:Ft=>{Mr(RC(Ft.workspaceId),{status:Ft.status,history:Ft.history,historyTotalCount:Ft.historyTotalCount,historyNextCursor:Ft.historyNextCursor,branches:Ft.branches}),Se(An=>{var qs;const vi=((qs=oe.find(ml=>ml.workspace.id===Ft.workspaceId))==null?void 0:qs.workspace)??null;if(!vi)return An;const sr=An[Ft.workspaceId],oi=LC(AC((sr==null?void 0:sr.detail)??MC(vi),vi),Ft);return Mr(Kf(Ft.workspaceId),oi),{...An,[Ft.workspaceId]:{detail:oi,loading:!1,error:null}}}),R.current.forEach(An=>An(Ft))},onWorkspaceManagementSnapshot:Ft=>{Mr(Kf(Ft.workspaceId),Ft),Se(An=>({...An,[Ft.workspaceId]:{detail:Ft,loading:!1,error:null}})),L.current.forEach(An=>An(Ft))},onTerminalManagerSnapshot:Ft=>{A.current.forEach(An=>An(Ft))},onUnauthorized:()=>{vn.clear(),n("/login",{replace:!0})}});C.current=z;const le=K.current,qe=H.current,pt=F.current,Jt=M.current,$n=_.current,Bn=I.current,Vn=P.current,an=U.current;return le&&z.subscribeFileTree(le.workspaceId,le.paths),pt&&z.subscribeGit(pt),$n&&z.subscribeWorkspaceManagement($n),Vn&&z.subscribeTerminalManager(Vn),qe&&z.requestFileTreeRefresh(qe.workspaceId,qe.paths),Jt&&z.requestGitRefresh(Jt),Bn&&z.requestWorkspaceManagementRefresh(Bn),an&&z.requestTerminalManagerRefresh(an),z.start(),()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null),C.current===z&&(C.current=null),z.close()}},[n]),v.useEffect(()=>{Es(Dw,String(me))},[me]),v.useEffect(()=>{Es(_w,String(_e))},[_e]),v.useEffect(()=>{Es(Fw,String(ot))},[ot]),v.useEffect(()=>{Es(Ow,String(jt))},[jt]),v.useEffect(()=>{Es(Bw,JSON.stringify(St))},[St]),v.useEffect(()=>{if(!vt){HF(qh);return}Es(qh,vt)},[vt]),v.useEffect(()=>{if(Rt||jt)return;const z=window.setTimeout(()=>{ft(!0)},yF);return()=>{window.clearTimeout(z)}},[Rt,jt]);const Tt=Wa(t.pathname),Ue=(Tt==null?void 0:Tt.sessionId)??null,ae=Ue?OC(Ue):!1,je=v.useMemo(()=>Wm(oe),[oe]),Xe=v.useMemo(()=>new Set(St),[St]),rt=v.useMemo(()=>je.filter(z=>z.session.isFavorite===!0).map(z=>z.session.sessionId),[je]),He=v.useMemo(()=>new Set(rt),[rt]);v.useEffect(()=>{const z=new Map;if(je.forEach(({session:le})=>{z.set(le.sessionId,{activityState:le.activityState,completedAt:le.completedAt??null,runningState:le.runningState??null})}),!Z.current){Z.current=!0,$.current=z;return}je.forEach(({session:le})=>{var Bn;if(le.sessionId===Ue)return;const qe=$.current.get(le.sessionId);if(!qe)return;const pt=qe.activityState!=="completed_unread"&&le.activityState==="completed_unread",Jt=((Bn=le.title)==null?void 0:Bn.trim())||h("common.unknown");if(l&&pt){const Vn=h("conversation.backgroundCompletionToastDescription",{title:Jt});G.current({id:`workbench-session-completed-${le.sessionId}-${le.completedAt??"unknown"}`,title:h("conversation.backgroundCompletionToastTitle"),description:Vn,tone:"success",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>Nn(le.workspaceId,le.sessionId)}}),X.current.showNotification(h("conversation.backgroundCompletionToastTitle"),Vn)}const $n=qe.runningState!=="failed"&&(le.runningState??null)==="failed";if(d&&$n){const Vn=SF(le)??h("conversation.runtimeFailed"),an=h("conversation.backgroundFailureToastDescription",{title:Jt,detail:Vn});G.current({id:`workbench-session-failed-${le.sessionId}-${le.updatedAt}`,title:h("conversation.backgroundFailureToastTitle"),description:an,tone:"error",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>Nn(le.workspaceId,le.sessionId)}}),X.current.showNotification(h("conversation.backgroundFailureToastTitle"),an)}}),$.current=z},[Ue,je,l,d,Nn]),v.useEffect(()=>{q.current=je.map(z=>z.session).filter(z=>z.sessionId!==Ue&&kF(z)).map(z=>{var le;return{sessionId:z.sessionId,workspaceId:z.workspaceId,title:((le=z.title)==null?void 0:le.trim())||h("common.unknown")}})},[Ue,je]),v.useEffect(()=>{let z=!1,le=null;const qe=()=>{le=window.setTimeout(()=>{pt().finally(()=>{z||qe()})},wF)},pt=async()=>{var Vn;const Jt=q.current;if(Jt.length===0){se.current||(se.current=!0);return}(Vn=C.current)==null||Vn.requestRefresh();const $n=new Set(Jt.map(an=>an.sessionId)),Bn=await Promise.all(Jt.map(async an=>{try{const Ft=await Dk(an.sessionId);return{session:an,items:Ft.items}}catch{return{session:an,items:null}}}));if(!z){for(const an of Bn){if(!an.items)continue;const Ft=an.items.filter(sr=>sr.status==="pending"),An=new Set(Ft.map(sr=>sr.id)),vi=Y.current.get(an.session.sessionId)??new Set;se.current&&Ft.forEach(sr=>{if(vi.has(sr.id)||!c)return;const oi=h("conversation.backgroundPermissionToastDescription",{title:an.session.title,requestTitle:sr.title});G.current({id:`workbench-permission-request-${sr.id}`,title:h("conversation.permissionRequestToastTitle"),description:oi,tone:"warning",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>Nn(an.session.workspaceId,an.session.sessionId)}}),X.current.showNotification(h("conversation.permissionRequestToastTitle"),oi)}),Y.current.set(an.session.sessionId,An)}for(const[an,Ft]of Y.current.entries())!$n.has(an)&&Ft.size===0&&Y.current.delete(an);se.current=!0}};return pt().finally(()=>{z||qe()}),()=>{z=!0,le!==null&&window.clearTimeout(le)}},[c,Nn]),v.useEffect(()=>{if(B&&oe.length===0)return;const z=new Set(oe.map(le=>le.workspace.id));Lt(le=>EC(le,z)),zt(le=>le&&z.has(le)?le:null)},[oe,B]);const At=je.find(z=>z.session.sessionId===Ue)??null,Ct=(At==null?void 0:At.workspace.id)??(Ue?Vt[Ue]??null:null),Q=$w(t.pathname,t.search),ke=Ct??Q??vt??null,D=ke??((Vo=oe[0])==null?void 0:Vo.workspace.id)??null;v.useEffect(()=>{Ct&&zt(z=>z===Ct?z:Ct)},[Ct]),v.useEffect(()=>{Kt("workbench.current_workspace_resolved",{currentSessionId:Ue,sessionWorkspaceId:Ct,routeWorkspaceId:Q,currentWorkspaceId:D,source:Ct?At?"navigation":"sessionWorkspaceMap":Q?"route":vt?"workspaceSelection":"navigationFallback"})},[At,Ue,D,Q,vt,Ct]),v.useEffect(()=>{Kt("workbench.info_panel_state",{infoPanelReady:Rt,rightCollapsed:jt,currentWorkspaceId:D,sessionWorkspaceId:Ct,currentSessionId:Ue})},[Ue,D,Rt,jt,Ct]);const he=Gw(t.pathname)?"terminals":"conversation",ie=e==="mobile",it=jF(e),_t=v.useMemo(()=>oe.map(z=>({workspace:z.workspace,visibleSessions:z.sessions.filter(le=>!Ea(le)),archivedSessions:z.sessions.filter(le=>Ea(le)&&!Vf(le)),visibleSessionTree:PC(z.sessions.filter(le=>{if(Ea(le))return!1;const qe=Vf(le);if(!qe)return!0;const pt=z.sessions.find(Jt=>Jt.sessionId===qe);return!pt||!Ea(pt)})).filter(le=>!He.has(le.session.sessionId)&&!Is(le).some(qe=>He.has(qe.sessionId))),isCollapsed:Xe.has(z.workspace.id)})),[Xe,He,oe]),O=v.useMemo(()=>je.filter(z=>He.has(z.session.sessionId)&&!Ea(z.session)&&!$f(z.session)),[He,je]),xe=t.pathname.startsWith("/settings")?"settings":Gw(t.pathname)?"terminals":PF(t.pathname)?"tools":NF(t.pathname)||Vw(t.pathname)?"sessions":"workspaces",ge=ie&&xe==="sessions"&&Vw(t.pathname),ze=Pu({isNativeMobile:s.isNativeMobile,viewportClass:s.viewportClass}),ht=ll({viewportClass:s.viewportClass,activeEntry:xe,hasNavigationPanel:ie,hasAuxiliaryPanel:ie,preferCompactLayout:ze}),on=ie&&eC(ht),cn=ie&&tC(ht),ir=v.useMemo(()=>oe.map(z=>z.workspace),[oe]),hs=v.useMemo(()=>{const z=wt.trim().toLowerCase();return z?je.filter(le=>{const qe=(le.session.title||"").toLowerCase(),pt=le.workspace.name.toLowerCase(),Jt=Ru(le.session.provider,"full").toLowerCase();return qe.includes(z)||pt.includes(z)||Jt.includes(z)}):[]},[je,wt]);v.useEffect(()=>{var le;const z=D??((le=oe[0])==null?void 0:le.workspace.id)??"";z&&Ze(qe=>qe&&oe.some(Jt=>Jt.workspace.id===qe)?qe:z)},[D,oe]),v.useEffect(()=>{Ue&&!ae&&Es(Hh,`${t.pathname}${t.search}`)},[Ue,ae,t.pathname,t.search]),v.useEffect(()=>{if(Ue&&ae){b.current=`${t.pathname}${t.search}`;return}Ue&&!ae&&(b.current=null)},[Ue,ae,t.pathname,t.search]),v.useEffect(()=>{ie||(tt(!1),gt(!1))},[ie]),v.useEffect(()=>{!ie||B||!CF(t.pathname)||ke||(tt(!1),gt(!1),n(it,{replace:!0}))},[ke,ie,t.pathname,n,B,it]);function yi(){if(ie){tt(!0);return}mt(!1)}function Li(){if(Sr(),ie){gt(!0);return}yt(!1)}function dl(){if(ie){tt(z=>!z);return}mt(z=>!z)}function Uo(){if(Sr(),ie){gt(z=>!z);return}yt(z=>!z)}function Sr(){ft(!0)}function zs(z){zt(z),Sr(),Ue&&Ct!==z&&n(it)}const Ii=v.useCallback(async z=>{var pt;const le=((pt=je.find(Jt=>Jt.session.sessionId===z))==null?void 0:pt.session)??null,qe=(le==null?void 0:le.isFavorite)!==!0;E(Jt=>eb(Jt,z,qe));try{const Jt=await lE(z,qe);nn(Jt),fn()}catch(Jt){throw E($n=>eb($n,z,!qe)),Jt}},[je,fn,nn]),rn=v.useCallback((z,le)=>{n(YS(z,le))},[n]),zo=v.useCallback(z=>{var pt;const le=((pt=z.workspaceId)==null?void 0:pt.trim())||D,qe=TF(z.filePath);return!le||!qe?!1:(Sr(),qt("files"),ie?(tt(!1),gt(!0)):yt(!1),at({requestId:x.current+1,workspaceId:le,filePath:qe,openViewer:z.openViewer===!0}),x.current+=1,!0)},[D,ie]),Ho=v.useCallback(async(z,le)=>{const qe=await Lk(z,le.trim());return nn(qe),qe},[nn]);function fs(z){Le(!0)}function qo(){Le(!1),nt("sessions"),Dt(""),Mt(null),ee([]),ct(!1)}async function hl(){const z=wt.trim();if(!z||!Pt.trim()){ee([]),Mt(null);return}ct(!0),Mt(null);try{const le=await qf(Pt,z);ee(le.items)}catch(le){ee([]),Mt(le instanceof Error?le.message:h("shell.searchCodeFailed"))}finally{ct(!1)}}function $o(z,le){const qe=z==="left"?me:_e;function pt($n){const Bn=$n.clientX-le;if(z==="left"){Ce(Sc(qe+Bn,bc,Ww));return}Ge(Sc(qe-Bn,bc,Uw))}function Jt(){document.removeEventListener("mousemove",pt),document.removeEventListener("mouseup",Jt)}document.addEventListener("mousemove",pt),document.addEventListener("mouseup",Jt)}function Di(){if(qr())return;if(je.length===0){n(it);return}const z=Qn(je[0].workspace.id,je[0].session.sessionId);n(z)}function Hs(){if(!qr(D)){if(D){n(al(D));return}n(it)}}function qr(z){if(Ue)return z&&Ct&&Ct!==z?!1:(n(`${t.pathname}${t.search}`),!0);if(b.current){if(z){const[qe,pt=""]=b.current.split("?"),Jt=$w(qe??b.current,pt?`?${pt}`:"");if(Jt&&Jt!==z)return!1}return n(b.current),!0}const le=typeof window>"u"?null:window.localStorage.getItem(Hh);if(le){const qe=le.split("?")[0]??le,pt=Wa(qe);if(pt){const Jt=pt.sessionId,$n=je.find(an=>an.session.sessionId===Jt)??null,Bn=pt.workspaceId??($n==null?void 0:$n.workspace.id)??null;if($n!==null&&(!z||Bn===z))return n(le),!0}window.localStorage.removeItem(Hh)}return!1}v.useEffect(()=>{if(typeof window>"u")return;function z(le){if(!(le.metaKey||le.ctrlKey)){le.key==="Escape"&&(tt(!1),gt(!1));return}if(qF(le.target))return;const pt=le.key.toLowerCase();if(!le.shiftKey&&pt==="b"){le.preventDefault(),dl();return}if(le.shiftKey&&pt==="i"){le.preventDefault(),Uo();return}if(!le.shiftKey&&pt===","){le.preventDefault(),n("/settings");return}if(!le.shiftKey&&pt==="1"){le.preventDefault(),Di();return}if(!le.shiftKey&&pt==="2"){le.preventDefault(),n(D?Co(D):Zr());return}if(!le.shiftKey&&pt==="k"){le.preventDefault(),$F();return}le.shiftKey&&pt==="r"&&(le.preventDefault(),Ut())}return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}},[n,Ut,ie,Di]);const ii=v.useMemo(()=>({shellMode:e,navigationGroups:oe,navigationLoading:B,navigationError:T,currentWorkspaceId:D,currentSessionId:Ue,favoriteSessionIds:rt,favoriteSessions:O,refreshNavigation:Ut,requestNavigationRefresh:fn,subscribeFileTree:wn,requestFileTreeRefresh:V,addFileTreeSnapshotListener:re,subscribeGitSnapshot:de,requestGitRefresh:be,addGitSnapshotListener:Ee,subscribeWorkspaceManagementSnapshot:We,requestWorkspaceManagementRefresh:$e,addWorkspaceManagementSnapshotListener:Re,workspaceManagementStateById:Nt,subscribeTerminalManagerSnapshot:De,requestTerminalManagerRefresh:Fe,addTerminalManagerSnapshotListener:Oe,selectWorkspace:zs,toggleFavoriteSession:Ii,archiveSession:z=>ut(z,!0),unarchiveSession:z=>ut(z,!1),renameSession:Ho,startDraftSession:rn,markNavigationSessionSeen:dt,upsertNavigationSession:nn,setSessionWorkspace:Gt,revealWorkspaceFile:zo}),[re,Ee,Re,Oe,ut,Ue,D,rt,O,zs,dt,T,oe,B,V,be,$e,Ut,fn,Fe,Ho,Nt,e,rn,Gt,wn,de,We,De,Ii,nn,zo]),si={"--workbench-left-width":`${me}px`,"--workbench-left-current-width":ot?"0px":`${me}px`,"--workbench-right-width":`${_e}px`,"--workbench-right-current-width":jt?"0px":`${_e}px`},_i=ie?i.jsx(rb,{workspaceGroups:_t,favoriteSessions:O,favoriteSessionIds:He,activeWorkspaceId:D,isConversationActive:he==="conversation",isTerminalActive:he==="terminals",isSearchOpen:ve,navigationLoading:B,navigationError:T,activeSessionId:Ue,onRefreshNavigation:Ut,onSessionUpdated:nn,onNavigateConversation:Di,onNavigateTerminals:()=>{tt(!1),n(D?Co(D):Zr())},onOpenSearch:()=>{tt(!1),fs()},onOpenSettings:()=>{tt(!1),n("/settings")},onSelectWorkspace:zs,onToggleWorkspaceCollapse:z=>Lt(le=>Gf(le,z)),subscribeGitSnapshot:de,requestGitRefresh:be,subscribeWorkspaceManagementSnapshot:We,requestWorkspaceManagementRefresh:$e,onToggleFavoriteSession:Ii,onArchiveSession:z=>ut(z,!0),onUnarchiveSession:z=>ut(z,!1),workspaceManagementStateById:Nt,setWorkspaceManagementStateById:Se,onClose:()=>tt(!1)}):null,Fi=ie?i.jsx(ib,{panelReady:Rt,activeTab:tn,fileRevealRequest:Ie,onTabChange:z=>{Sr(),qt(z)},currentSessionId:ae?null:Ue,activeWorkspaceId:D,navigationGroups:oe}):null;return i.jsxs(NC.Provider,{value:ii,children:[ie?i.jsx(i.Fragment,{children:i.jsx(j2,{activeEntry:xe,presentation:ge?"conversation-focus":"default",navigationPanel:_i,auxiliaryPanel:Fi,onOpenNavigation:()=>{gt(!1),tt(!0)},onOpenSearch:()=>{tt(!1),gt(!1),fs()},onOpenAuxiliary:()=>{Sr(),tt(!1),gt(!0)},onNavigateWorkspaces:()=>{tt(!1),gt(!1),n(Zr())},onNavigateTerminals:()=>{tt(!1),gt(!1),n(D?Co(D):Zr())},onNavigateSessions:()=>{tt(!1),gt(!1),Hs()},onNavigateTools:()=>{tt(!1),gt(!1),n(D?Fo(D):Zr())},onNavigateToolFiles:()=>{tt(!1),gt(!1),n(D?KS(D):Zr())},onNavigateToolGit:()=>{tt(!1),gt(!1),n(D?QS(D):Zr())},onNavigateToolProcesses:()=>{tt(!1),gt(!1),n(D?Nu(D):Zr())},onNavigateSettings:()=>{tt(!1),gt(!1),n("/settings")},children:i.jsx(Nf,{})})}):i.jsx("div",{className:"workbench-shell",style:si,"data-nav-loading":B,"data-left-collapsed":ot,"data-right-collapsed":jt,"data-info-ready":Rt,"data-runtime-platform":s.platform,"data-os-family":s.ui.osFamily,"data-overlay-titlebar":s.ui.prefersOverlayTitlebar,children:i.jsxs("div",{className:"workbench-body-shell",children:[i.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":ot,children:i.jsx(rb,{workspaceGroups:_t,favoriteSessions:O,favoriteSessionIds:He,activeWorkspaceId:D,isConversationActive:he==="conversation",isTerminalActive:he==="terminals",isSearchOpen:ve,navigationLoading:B,navigationError:T,activeSessionId:Ue,onRefreshNavigation:Ut,onSessionUpdated:nn,onNavigateConversation:Di,onNavigateTerminals:()=>n(D?Co(D):Zr()),onOpenSearch:()=>fs(),onOpenSettings:()=>n("/settings"),onSelectWorkspace:zs,onToggleWorkspaceCollapse:z=>Lt(le=>Gf(le,z)),subscribeGitSnapshot:de,requestGitRefresh:be,subscribeWorkspaceManagementSnapshot:We,requestWorkspaceManagementRefresh:$e,onToggleFavoriteSession:Ii,onArchiveSession:z=>ut(z,!0),onUnarchiveSession:z=>ut(z,!1),workspaceManagementStateById:Nt,setWorkspaceManagementStateById:Se,onToggleCollapse:()=>mt(!0)})}),i.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":ot,role:"separator","aria-label":h("shell.leftResizerLabel"),onMouseDown:ot?void 0:z=>$o("left",z.clientX)}),i.jsxs("div",{className:"workbench-main-shell",children:[i.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!ot&&!jt,children:[i.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":ot,children:[i.jsx(tb,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:yi}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>n(-1),children:i.jsx(DC,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>n(1),children:i.jsx(ap,{})})]}),i.jsx("div",{className:"workbench-collapsed-controls right","data-visible":jt,children:i.jsx(tb,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:Li})})]}),i.jsx(Nf,{})]}),i.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":jt,role:"separator","aria-label":h("shell.rightResizerLabel"),onMouseDown:jt?void 0:z=>$o("right",z.clientX)}),i.jsx("aside",{className:"workbench-auxiliary surface-card","data-collapsed":jt,children:i.jsx(ib,{panelReady:Rt,activeTab:tn,fileRevealRequest:Ie,onTabChange:z=>{Sr(),qt(z)},onToggleCollapse:()=>yt(!0),currentSessionId:ae?null:Ue,activeWorkspaceId:D,navigationGroups:oe})})]})}),i.jsx(fO,{open:ve,mode:Ke,keyword:wt,codeWorkspaceId:Pt,codeResults:Xt,codeLoading:Wt,codeError:It,workspaceOptions:ir,sessionResults:hs,onClose:qo,onModeChange:z=>{nt(z),Mt(null),ee([])},onKeywordChange:z=>{Dt(z),Ke==="code"&&!z.trim()&&(ee([]),Mt(null))},onCodeWorkspaceChange:z=>Ze(z),onCodeSearch:()=>{hl()},onOpenSession:z=>{qo();const le=je.find(qe=>qe.session.sessionId===z)??null;n(le?Qn(le.workspace.id,z):Zr())}}),ie?i.jsxs(i.Fragment,{children:[on?null:i.jsx(sb,{isOpen:Ot,side:"left",onClose:()=>tt(!1),children:_i}),cn?null:i.jsx(sb,{isOpen:$t,side:"right",onClose:()=>gt(!1),children:Fi})]}):null]})}function sb({isOpen:e,side:t,onClose:n,children:s,className:a,overlayClassName:c}){if(!e)return null;const l=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:["mobile-nav-overlay","open",c].filter(Boolean).join(" "),onClick:n,role:"button",tabIndex:0,"aria-label":h("common.back"),onKeyDown:d=>{d.key==="Escape"&&n()}}),i.jsx("div",{className:["mobile-nav-drawer",t,"open",a].filter(Boolean).join(" "),children:s})]});return typeof document>"u"?l:Hn.createPortal(l,document.body)}function ur(){return v.useContext(NC)??{navigationGroups:[],navigationLoading:!1,navigationError:null,shellMode:"desktop",currentWorkspaceId:null,currentSessionId:null,favoriteSessionIds:[],favoriteSessions:[],refreshNavigation:async()=>{},requestNavigationRefresh:()=>{},subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{},subscribeWorkspaceManagementSnapshot:()=>{},requestWorkspaceManagementRefresh:()=>{},addWorkspaceManagementSnapshotListener:()=>()=>{},workspaceManagementStateById:{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{},selectWorkspace:()=>{},toggleFavoriteSession:async()=>{},archiveSession:async()=>{},unarchiveSession:async()=>{},renameSession:async()=>{throw new Error("workbench shell unavailable")},startDraftSession:()=>{},setSessionWorkspace:()=>{},upsertNavigationSession:()=>{},markNavigationSessionSeen:()=>{},revealWorkspaceFile:()=>!1}}function OC(e){return e.startsWith("draft-")}const pO=480,BC=v.createContext(!1);function Qf(e){return e.replace(/\\/g,"/")}function fu(e){return/^[a-zA-Z]:\//.test(e)}function gO(e){return e.startsWith("/")||e.startsWith("//")||fu(e)}function yO(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!fu(e)}function ob(e){return e.replace(/\/+$/,"")}function vO(e){const t=e.indexOf("#"),n=t>=0?e.slice(0,t):e,s=n.indexOf("?");return(s>=0?n.slice(0,s):n).replace(/:(\d+)(?::(\d+))?$/,"")}function wO(e){const t=[];for(const n of Qf(e).split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function lp(e){try{return decodeURIComponent(e)}catch{return e}}function bO(e,t){const n=lp(e).trim();if(!n||n.startsWith("#"))return null;let s=n;if(/^file:\/\//i.test(s))try{s=decodeURIComponent(new URL(s).pathname),/^\/[a-zA-Z]:\//.test(s)&&(s=s.slice(1))}catch{return null}else if(yO(s))return null;if(s=Qf(vO(s.trim())),!s)return null;const a=ob(Qf(t.trim()));if(!a)return null;if(gO(s)){const c=ob(s),l=fu(a)?a.toLowerCase():a,d=fu(c)?c.toLowerCase():c;if(d===l)return null;const f=`${l}/`;return d.startsWith(f)?c.slice(a.length+1):null}return wO(s)}function Yf(e){return e.kind==="tool_call"||e.kind==="tool_result"}function WC(e){return e.toolCall?e.toolCall:Yf(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function xO(e){return e==="shell_command"||e==="tool"?h("conversation.roleTool"):e}function UC(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function Rs(e,t){const n=e[t];return typeof n=="string"?n:""}function kO(e){if(e.name==="apply_patch")return __(e.input);if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=UC(e.input);if(!t)return null;const n=Rs(t,"file_path")||Rs(t,"path");if(!n)return null;if(e.name==="Write"){const c=Rs(t,"content"),l=c.length>0?c.split(/\r?\n/):[];return{files:[{path:n,nextPath:null,action:"add",additions:l.length,deletions:0,lines:l.map((d,f)=>({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:f+1}))}],totalAdditions:l.length,totalDeletions:0}}if(e.name==="Edit"){const c=Rs(t,"old_string").split(/\r?\n/),l=Rs(t,"new_string").split(/\r?\n/);return ab(n,[{oldLines:c,newLines:l}])}const a=(Array.isArray(t.edits)?t.edits:[]).map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return null;const l=c;return{oldLines:Rs(l,"old_string").split(/\r?\n/),newLines:Rs(l,"new_string").split(/\r?\n/)}}).filter(c=>!!c);return a.length>0?ab(n,a):null}function ab(e,t){const n=[];let s=0,a=0;return t.forEach((c,l)=>{n.push({kind:"hunk",text:`@@ -1,${c.oldLines.length} +1,${c.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),c.oldLines.forEach((d,f)=>{d.length===0&&c.oldLines.length===1&&c.newLines.length>0||(a+=1,n.push({kind:"remove",text:`-${d}`,oldLineNumber:f+1,newLineNumber:null}))}),c.newLines.forEach((d,f)=>{d.length===0&&c.newLines.length===1&&c.oldLines.length>0||(s+=1,n.push({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:f+1}))}),l<t.length-1&&n.push({kind:"meta",text:"***",oldLineNumber:null,newLineNumber:null})}),{files:[{path:e,nextPath:null,action:"update",additions:s,deletions:a,lines:n}],totalAdditions:s,totalDeletions:a}}function SO(e){const t=UC(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(n)return`${h("conversation.toolPreviewCommand")}:${n}`;if(e.name==="read_thread_terminal")return h("conversation.toolPreviewTerminal");const s=e.input||e.error||e.output||h("conversation.toolResultEmpty");return s.length>60?`${s.slice(0,60)}...`:s}function CO(e){const t=e.map(c=>({message:c,tool:WC(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const n={...t[0].tool};let s=!1,a=!1;for(const{message:c,tool:l}of t)c.kind==="tool_call"&&(s=!0,!n.input&&l.input&&(n.input=l.input)),c.kind==="tool_result"&&(a=!0,n.output=l.output,n.error=l.error,n.status=l.status,!n.input&&l.input&&(n.input=l.input)),!n.name&&l.name&&(n.name=l.name);return{key:t.map(({message:c})=>c.id).join(":"),tool:n,hasRequest:s,hasResult:a}}function jO(e){const t=new Map;for(const n of e){const s=WC(n);if(!s)continue;const a=t.get(s.callId);if(a){a.messages.push(n);continue}t.set(s.callId,{messages:[n],firstSequence:n.sequence})}return Array.from(t.values()).sort((n,s)=>n.firstSequence-s.firstSequence).map(n=>CO(n.messages)).filter(n=>!!n)}function NO(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n];if(!Yf(s)){t.push({type:"message",key:s.id,message:s});continue}const a=[s];let c=n+1;for(;c<e.length;){const d=e[c];if(!Yf(d))break;a.push(d),c+=1}const l=jO(a);if(l.length===0){t.push({type:"message",key:s.id,message:s}),n=c-1;continue}l.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),n=c-1}return t}function PO(e,t){if(!_E(null,e))return!1;const n=t.trim();return/AGENTS\.md instructions for/i.test(n)&&/<INSTRUCTIONS>/i.test(n)&&/<\/INSTRUCTIONS>/i.test(n)}function TO(e){const t=e.split(/\r?\n/).map(n=>n.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):h("conversation.rulesMessageTitle")}function Qa(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>Qa(n)).join(""):e&&typeof e=="object"&&"props"in e?Qa(((t=e.props)==null?void 0:t.children)??""):""}function EO(e){const t=Array.isArray(e)?e[0]:e;if(!v.isValidElement(t))return null;const n=t.props,s=typeof n.className=="string"?n.className:"",a=/language-([^\s]+)/.exec(s);return{content:Qa(n.children).replace(/\n$/,""),codeClassName:s||void 0,language:(a==null?void 0:a[1])??null}}function RO(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function zC(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!RO(e))throw new Error(h("conversation.copyContentFailed"))}}function MO({className:e,children:t,onCopy:n}){const s=v.useContext(BC),a=Qa(t).trim();if(s||!a)return i.jsx("code",{className:e||void 0,children:t});function c(l){l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),n(a))}return i.jsx("code",{className:[e,"markdown-inline-copy"].filter(Boolean).join(" "),role:"button",tabIndex:0,"aria-label":h("conversation.copyAction"),onClick:()=>n(a),onKeyDown:c,children:t})}function AO({href:e,children:t,className:n,onInteract:s}){const a=Qa(t).trim()||(e?lp(e).trim():"");return i.jsx(BC.Provider,{value:!0,children:i.jsx("a",{href:e,className:[n,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:c=>{c.preventDefault(),s(e,a)},children:t})})}function HC({language:e,codeClassName:t,content:n}){const{showToast:s}=Yn(),a=Mn(),c=(e==null?void 0:e.trim().toLowerCase())??null,l=c==="text",d=c||"code";async function f(){try{await zC(n,a),s({title:h("conversation.copyContentSuccess"),tone:"success"})}catch(p){s({title:p instanceof Error?p.message:h("conversation.copyContentFailed"),tone:"error"})}}return i.jsxs("div",{className:`code-block${l?" text-code-block":""}`,children:[i.jsxs("div",{className:"code-header",children:[i.jsx("span",{className:"code-header-label",children:d}),i.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void f(),children:h("conversation.copyAction")})]}),i.jsx("pre",{className:t,children:i.jsx("code",{children:n})})]})}function zc({content:e,className:t}){const{showToast:n}=Yn(),s=Mn(),{navigationGroups:a,currentWorkspaceId:c,revealWorkspaceFile:l}=ur(),d=v.useMemo(()=>{var y;return((y=a.find(g=>g.workspace.id===c))==null?void 0:y.workspace)??null},[c,a]);async function f(y){if(y.trim())try{await zC(y,s),n({title:h("conversation.copyContentSuccess"),tone:"success"})}catch(g){n({title:g instanceof Error?g.message:h("conversation.copyContentFailed"),tone:"error"})}}function p(y,g){const b=y&&(d!=null&&d.path)?bO(y,d.path):null;b&&l({workspaceId:(d==null?void 0:d.id)??c,filePath:b,openViewer:!1})||f(g||(y?lp(y).trim():""))}return i.jsx("div",{className:t,children:i.jsx(Dm,{remarkPlugins:[Bm],components:{p:({node:y,...g})=>i.jsx("p",{...g}),a(y){return i.jsx(AO,{href:typeof y.href=="string"?y.href:void 0,className:typeof y.className=="string"?y.className:void 0,onInteract:p,children:y.children})},pre(y){const g=EO(y.children);return g?i.jsx(HC,{language:g.language,codeClassName:g.codeClassName,content:g.content}):i.jsx("pre",{children:y.children})},code(y){const g=typeof y.className=="string"?y.className:"";return i.jsx(MO,{className:g||void 0,onCopy:b=>{f(b)},children:y.children})}},children:e})})}function lb(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Nc({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){return i.jsx(LO,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:s})}function LO({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){const[a,c]=v.useState({}),[l,d]=v.useState(null),f=v.useMemo(()=>n.map((b,x)=>{const S=lb(b,t==null?void 0:t[x]);if(S)return{id:b.id,fileName:b.fileName,fileSize:b.fileSize,url:S,status:"ready"};const C=a[b.id];return{id:b.id,fileName:b.fileName,fileSize:b.fileSize,url:(C==null?void 0:C.url)??null,status:(C==null?void 0:C.status)??(e?"loading":"error")}}),[t,n,a,e]),p=v.useMemo(()=>s.map((b,x)=>({id:`inline-image-${x}`,fileName:b.altText||`${h("conversation.imageAttachmentLabel")} ${x+1}`,fileSize:b.estimatedBytes,url:b.url,status:"ready"})),[s]),y=v.useMemo(()=>[...p,...f],[f,p]),g=y.find(b=>b.id===l)??null;return v.useEffect(()=>{if(!l)return;function b(x){x.key==="Escape"&&d(null)}return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[l]),v.useEffect(()=>{const b=n.filter((C,j)=>!lb(C,t==null?void 0:t[j]));if(!e||b.length===0){c({});return}let x=!1;const S=[];return c(Object.fromEntries(b.map(C=>[C.id,{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"loading"}]))),Promise.all(b.map(async C=>{try{const j=await mE(e,C.id),R=URL.createObjectURL(j);return S.push(R),{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:R,status:"ready"}}catch{return{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"error"}}})).then(C=>{if(x){S.forEach(j=>URL.revokeObjectURL(j));return}c(Object.fromEntries(C.map(j=>[j.id,j])))}),()=>{x=!0,S.forEach(C=>URL.revokeObjectURL(C))}},[t,n,e]),y.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"message-attachments",children:y.map(b=>{const x=b.status==="loading"?h("conversation.attachmentPreviewLoading"):b.status==="error"?h("conversation.attachmentPreviewUnavailable"):h("conversation.attachmentPreviewOpen");return i.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>b.url&&d(b.id),disabled:!b.url,"aria-label":`${b.fileName} - ${x}`,title:x,children:i.jsx("div",{className:"message-attachment-card",children:b.url?i.jsx("img",{className:"message-attachment-thumbnail",src:b.url,alt:b.fileName||h("conversation.attachmentPreviewAlt"),loading:"lazy"}):i.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:b.status==="loading"?h("conversation.attachmentPreviewLoading"):h("conversation.attachmentPreviewUnavailable")})})},b.id)})}),g!=null&&g.url?i.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null)}),i.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.imagePreviewTitle")}),i.jsx("p",{children:g.fileName})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null),children:"x"})]}),i.jsxs("div",{className:"message-image-modal-body",children:[i.jsx("div",{className:"message-image-modal-stage",children:i.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||h("conversation.attachmentPreviewAlt")})}),i.jsx("p",{className:"message-image-modal-hint",children:h("conversation.imagePreviewHint")})]})]})]}):null]})}function IO(){return i.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:5},(e,t)=>i.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[i.jsx("div",{className:"timeline-skeleton-avatar"}),i.jsxs("div",{className:"timeline-skeleton-bubble",children:[i.jsx("span",{className:"timeline-skeleton-line long"}),i.jsx("span",{className:"timeline-skeleton-line medium"}),i.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function DO({tool:e,preview:t}){const[n,s]=v.useState(null);return v.useEffect(()=>{if(n===null)return;function a(c){c.key==="Escape"&&s(null)}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((a,c)=>i.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>s(c),children:[i.jsx("span",{className:"apply-patch-summary-label",children:cb(a.action)}),i.jsx("span",{className:"apply-patch-summary-file",title:Gh(a),children:F_(a.nextPath??a.path)}),i.jsxs("span",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]},ub(a,c)))}),n!==null&&typeof document<"u"?Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>s(null)}),i.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.applyPatchDialogTitle")}),i.jsx("p",{children:h("conversation.applyPatchDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>s(null),children:"x"})]}),(()=>{const a=t.files[n];return a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"apply-patch-modal-totals",children:[i.jsxs("span",{className:"apply-patch-stat-pill positive",children:[h("conversation.applyPatchAddedStat")," +",a.additions]}),i.jsxs("span",{className:"apply-patch-stat-pill negative",children:[h("conversation.applyPatchRemovedStat")," -",a.deletions]})]}),i.jsxs("div",{className:"apply-patch-modal-body",children:[i.jsxs("section",{className:"apply-patch-file-panel",children:[i.jsxs("div",{className:"apply-patch-file-panel-header",children:[i.jsxs("div",{className:"apply-patch-file-panel-title",children:[i.jsx("span",{className:"apply-patch-summary-label",children:cb(a.action)}),i.jsx("strong",{children:Gh(a)})]}),i.jsxs("div",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]}),i.jsx("div",{className:"apply-patch-diff-view",children:i.jsx("div",{className:"apply-patch-diff-scroll",children:a.lines.map((c,l)=>i.jsxs("div",{className:`apply-patch-diff-line ${FO(c.kind)}`,children:[i.jsx("span",{className:"apply-patch-line-number",children:db(c.oldLineNumber)}),i.jsx("span",{className:"apply-patch-line-number",children:db(c.newLineNumber)}),i.jsx("span",{className:"apply-patch-line-content",children:c.text||" "})]},`${Gh(a)}:${l}`))})})]},ub(a,n)),e.error?i.jsxs("section",{className:"apply-patch-error-panel",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]}):null})()]})]}),document.body):null]})}function _O({group:e}){const[t,n]=v.useState(!1),{tool:s,hasRequest:a,hasResult:c}=e,l=xO(s.name),d=v.useMemo(()=>kO(s),[s.input,s.name]);if(d)return i.jsx(DO,{tool:s,preview:d});const f=SO(s),p=!!(s.input||s.output||s.error);return i.jsxs("div",{className:`tool-call-item ${c?"tool-result":""}`,children:[i.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>p&&n(y=>!y),children:[i.jsxs("div",{className:"tool-call-info",children:[i.jsx("span",{className:"tool-call-name",children:l}),i.jsx("span",{className:"tool-call-input-preview",children:f})]}),i.jsx("div",{className:"tool-call-meta",children:p&&i.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&p&&i.jsxs("div",{className:"tool-call-output",children:[a&&s.input&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolInputLabel")}),i.jsx("pre",{children:s.input})]}),(c||s.error||s.output)&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:s.error?"tool-call-error":void 0,children:s.error||s.output||h("conversation.toolResultEmpty")})]})]})]})}function cb(e){return h(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Gh(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function ub(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function FO(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function db(e){return e===null||e<=0?"":String(e)}function OO({message:e,tone:t,onRetry:n}){const[s,a]=v.useState(!1),c=TO(e.content),l=t==="user-message";return i.jsxs("article",{className:`message-item ${t} rules-message-row`,children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsxs("div",{className:"rules-message-card",children:[i.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":s,onClick:()=>a(d=>!d),children:[i.jsxs("div",{className:"rules-message-heading",children:[i.jsx("span",{className:"rules-message-badge",children:h("conversation.rulesMessageTitle")}),i.jsx("span",{className:"rules-message-summary",children:c})]}),i.jsx("span",{className:"rules-message-action",children:h(s?"conversation.rulesMessageCollapse":"conversation.rulesMessageExpand")})]}),i.jsx("p",{className:"rules-message-hint",children:h("conversation.rulesMessageHint")}),s&&i.jsx("div",{className:"rules-message-body",children:i.jsx(zc,{content:e.content,className:"message-text message-content markdown-content"})})]}),e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),l&&i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})}function BO({message:e,provider:t,onRetry:n}){const s=e.role==="user",a=e.kind==="thinking",c=e.role==="assistant"&&e.kind==="text",l=PO(t,e.content),d=v.useMemo(()=>Ga(e.content),[e.content]),f=d.text,p=d.inlineImages;if(l){const y=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return i.jsx(OO,{message:e,tone:y,onRetry:n})}return s?i.jsxs("article",{className:"message-item user-message",children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Nc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f?i.jsx(zc,{content:f,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}):a?i.jsxs("article",{className:"message-item assistant-message thinking-message-row",children:[i.jsx("div",{className:"message-avatar",children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}),i.jsxs("div",{className:"message-content-wrapper thinking-message-wrapper",children:[i.jsx("div",{className:"thinking-message-label",children:h("conversation.thinkingLabel")}),i.jsx(Nc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f&&i.jsx(zc,{content:f,className:"message-text message-content markdown-content thinking-message-text"})]})]}):c?i.jsxs("article",{className:"message-item assistant-message",children:[i.jsx("div",{className:"message-avatar",children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}),i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Nc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f&&i.jsx(zc,{content:f,className:"message-text message-content markdown-content"})]})]}):i.jsx("article",{className:"message-item system-message",children:i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Nc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f?i.jsx("div",{className:"message-text message-content",children:i.jsx(HC,{language:"text",content:f})}):null]})})}function qC({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:s=!1,hasOlderMessages:a=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:l,provider:d}){const{showToast:f}=Yn(),p=v.useRef(null),y=v.useRef(e),g=v.useRef(t.length),b=v.useRef(Kh(t.at(-1)??null)),x=v.useRef(!0),S=v.useRef(null),C=v.useRef(!1),j=NO(t),R=n==="loading"&&t.length===0;function L(K){return C.current||!a||s||n!=="ready"||K.scrollTop>pO?!1:(C.current=!0,S.current=K.scrollHeight-K.scrollTop,c(),!0)}v.useEffect(()=>{n==="error"&&f({title:h("conversation.historyLoadFailed"),tone:"error"})},[n,f]),v.useEffect(()=>{y.current!==e&&(y.current=e,g.current=0,b.current=null,x.current=!0,S.current=null)},[e]),v.useLayoutEffect(()=>{const K=p.current;if(!K){g.current=t.length,b.current=Kh(t.at(-1)??null);return}const H=g.current,F=b.current,M=Kh(t.at(-1)??null);S.current!==null&&t.length>=H?(K.scrollTop=Math.max(0,K.scrollHeight-S.current),S.current=null):x.current&&(H===0||t.length!==H||M!==F)&&(K.scrollTop=K.scrollHeight),g.current=t.length,b.current=M},[t,e]),v.useEffect(()=>{if(!a){C.current=!1;return}!s&&S.current===null&&(C.current=!1)},[a,s,t.length]);function A(){const K=p.current;if(!K)return;const H=K.scrollHeight-K.clientHeight-K.scrollTop;x.current=H<=80,L(K)}return v.useEffect(()=>{const K=p.current;K&&L(K)},[a,n,s,t.length,c]),i.jsxs("section",{className:"message-timeline",children:[n==="loading"&&i.jsx("div",{className:"timeline-status",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoading")})}),i.jsxs("div",{ref:p,className:"message-list",onScroll:A,children:[R?i.jsx(IO,{}):null,s?i.jsx("div",{className:"timeline-status timeline-status-inline",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoadingOlder")})}):null,j.length===0&&n==="ready"&&i.jsx("div",{className:"timeline-empty",children:i.jsx("p",{className:"status-text",children:h("conversation.timelineEmpty")})}),j.map(K=>K.type==="tool_group"?i.jsx("article",{className:"message-item tool-message-row",children:i.jsx(_O,{group:K.group})},K.key):i.jsx(BO,{message:K.message,provider:d,onRetry:l},K.key))]})]})}function Kh(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function WO({requests:e,replyingRequestId:t,onReply:n}){const[s,a]=v.useState({}),c=v.useMemo(()=>e.filter(l=>l.status==="pending"),[e]);return c.length===0?null:i.jsxs("section",{className:"permission-request-list",children:[i.jsxs("div",{className:"permission-request-list-header",children:[i.jsx("div",{children:i.jsx("strong",{children:h("conversation.permissionRequestSectionTitle")})}),i.jsx("span",{className:"permission-request-count",children:c.length})]}),i.jsx("div",{className:"permission-request-stack",children:c.map(l=>{var b,x;const d=s[l.id]??{},f=l.paths.filter(Boolean),p=l.kind==="command"&&!!((b=l.command)!=null&&b.trim()),y=l.questions.length===0&&f.length===0&&!p&&!!((x=l.summary)!=null&&x.trim()),g=l.kind==="user_input"&&l.questions.some(S=>{var C;return(((C=d[S.id])==null?void 0:C.filter(Boolean).length)??0)===0});return i.jsxs("article",{className:"permission-request-card",children:[i.jsxs("header",{className:"permission-request-card-header",children:[i.jsxs("div",{className:"permission-request-provider",children:[i.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:i.jsx("img",{src:zO(l.provider),alt:"",loading:"lazy"})}),i.jsxs("div",{className:"permission-request-provider-copy",children:[i.jsx("strong",{children:l.title}),i.jsx("span",{children:UO(l.provider)})]})]}),i.jsx("span",{className:"permission-request-kind",children:HO(l.kind)})]}),i.jsxs("div",{className:"permission-request-card-body",children:[f.length>0?i.jsx("div",{className:"permission-request-block",children:i.jsx("ul",{className:"permission-request-target-list",children:f.map(S=>i.jsxs("li",{className:"permission-request-target-item",children:[i.jsx("strong",{children:qO(S)}),i.jsx("span",{children:S})]},`${l.id}:${S}`))})}):null,p?i.jsxs("div",{className:"permission-request-block",children:[i.jsx("div",{className:"permission-request-block-label",children:h("conversation.permissionRequestCommandLabel")}),i.jsx("pre",{children:l.command})]}):null,y?i.jsx("p",{className:"permission-request-summary",children:l.summary}):null,l.questions.length>0?i.jsxs("div",{className:"permission-request-block",children:[i.jsx("div",{className:"permission-request-block-label",children:h("conversation.permissionRequestQuestionsLabel")}),i.jsx("div",{className:"permission-request-question-list",children:l.questions.map(S=>i.jsxs("div",{className:"permission-request-question",children:[i.jsx("div",{className:"permission-request-question-header",children:S.header}),i.jsx("p",{children:S.question}),i.jsx("div",{className:"permission-request-question-options",children:S.options.map(C=>{var R;const j=((R=d[S.id])==null?void 0:R.includes(C.label))??!1;return i.jsxs("label",{className:"permission-request-question-option",children:[i.jsx("input",{type:"radio",name:`${l.id}:${S.id}`,checked:j,onChange:()=>{a(L=>({...L,[l.id]:{...L[l.id]??{},[S.id]:[C.label]}}))}}),i.jsxs("span",{children:[i.jsx("strong",{children:C.label}),C.description?i.jsx("small",{children:C.description}):null]})]},`${S.id}:${C.label}`)})})]},S.id))})]}):null]}),i.jsx("footer",{className:"permission-request-card-footer",children:l.actions.map(S=>i.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${S.tone}`,disabled:t===l.id||S.value==="submit"&&g,onClick:()=>void n(l.id,{action:S.value,answers:l.kind==="user_input"?d:void 0}),children:t===l.id?h("conversation.permissionRequestSubmitting"):S.label},`${l.id}:${S.value}`))})]},l.id)})})]})}function UO(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function zO(e){return e==="codex"?wC:e==="claude-code"?bC:xC}function HO(e){return h(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function qO(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function $O({items:e,deletingQueueItemId:t=null,steeringQueueItemId:n=null,canSteer:s=!1,onDelete:a,onSteer:c}){return e.length===0?null:i.jsxs("section",{className:"queued-message-list","aria-label":h("conversation.queueTitle"),children:[i.jsx("div",{className:"queued-message-list__header",children:i.jsx("h2",{children:`${h("conversation.queueTitle")} · ${e.length}`})}),i.jsx("div",{className:"queued-message-list__items",children:e.map((l,d)=>{const f=l.status==="queued"||l.status==="failed",p=s&&typeof c=="function"&&l.status==="queued";return i.jsxs("article",{className:"queued-message-item",children:[i.jsxs("div",{className:"queued-message-item__main",children:[i.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:d+1}),i.jsx("p",{className:"queued-message-item__content",title:l.content||h("conversation.queueImageOnly"),children:l.content||h("conversation.queueImageOnly")}),i.jsx("span",{className:`queued-message-item__status queued-message-item__status--${l.status}`,children:l.status==="failed"?h("conversation.queueStatusFailed"):h("conversation.queueStatusQueued")}),i.jsxs("div",{className:"queued-message-item__actions",children:[p?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void c(l.id),disabled:n===l.id,"aria-label":h("conversation.queueSteer"),title:h("conversation.queueSteer"),children:n===l.id?h("conversation.queueSteering"):h("conversation.queueSteer")}):null,f?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void a(l.id),disabled:t===l.id,"aria-label":h("conversation.queueDelete"),title:h("conversation.queueDelete"),children:t===l.id?"…":"×"}):null]})]}),l.errorDetail?i.jsx("p",{className:"queued-message-item__error",children:l.errorDetail}):null]},l.id)})})]})}function VO(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function $C({session:e}){const t=Mn(),n=v.useCallback(c=>{!t.isDesktop||t.ui.osFamily!=="macos"||c.button!==0||rp(c.target)&&ip()},[t.isDesktop,t.ui.osFamily]);if(!e)return i.jsx("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsxs("div",{className:"conversation-header-main",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line long"})]})});const s=ds(e.title,h("conversation.titleFallback")),a=VO(s.displayTitle);return i.jsx("header",{className:"conversation-header","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsx("div",{className:"conversation-header-main",children:i.jsx("h1",{className:`conversation-title is-${a}`,title:s.fullTitle,children:s.displayTitle})})})}class GO{constructor(t){Be(this,"socket",null);Be(this,"disposed",!1);Be(this,"authRecoveryInFlight",!1);Be(this,"latestCursor");Be(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new nC({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,n){return!this.socket||this.socket.readyState!==WebSocket.OPEN?!1:(this.socket.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:n})),!0)}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=vn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Bx("/ws")}?access_token=${encodeURIComponent(n)}`,a=new WebSocket(s);this.socket=a,a.addEventListener("open",()=>{a.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),a.addEventListener("message",l=>{const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.options.onSubscribed();return}if(d.type==="session.error"){if(d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.activity"){this.options.onActivity(d);return}if(d.type==="session.history_older"){this.options.onOlderHistory(d);return}if(d.type==="session.runtime_message"){this.options.onRuntimeMessage(d);return}if(d.type==="session.runtime_error"){this.options.onRuntimeError(d);return}if(d.type==="session.interrupted"){this.options.onInterrupted(d);return}if(d.type==="session.permission_request"){this.options.onPermissionRequest(d);return}if(d.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(d);return}this.latestCursor=d.cursor,this.options.onEnvelope(d)}),a.addEventListener("close",()=>{this.disposed||this.socket!==a||this.connectionManager.markDisconnected()}),a.addEventListener("error",()=>{this.disposed||this.socket!==a||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),vn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}}function hb(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],permissionRequests:(e==null?void 0:e.permissionRequests)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:!1,connectionState:"closed",lastCursor:null,pagesLoaded:0,errorCode:null,errorDetail:null}}function VC(e,t,n="sent",s=null){const a=t.kind??(t.role==="tool"?"tool_result":"text"),c=t.toolCall??(a==="tool_call"||a==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:a==="tool_call"?t.content:"",output:a==="tool_result"&&t.content?t.content:null,error:null,status:a==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:a,content:t.content,toolCall:c,attachments:t.attachments??[],attachmentPayloads:null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:n,clientRequestId:s}}function GC(e,t,n,s=[],a=[],c=Number.MAX_SAFE_INTEGER){return{id:`pending-${n}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:s,attachmentPayloads:a,timestamp:new Date().toISOString(),sequence:c,rawRef:`pending://${n}`,deliveryState:"sending",clientRequestId:n}}function Ra(e,t,n){const s=new Map;for(const a of e)s.set(a.id,a);for(const a of n){const c=VC(t,a),l=dB(s,c);if(l&&l!==c.id)continue;const d=uB(s,c);d&&d!==c.id&&s.delete(d);const f=s.get(a.messageId)??null;s.set(a.messageId,f?ZO(f,c):c)}return KC(Array.from(s.values()))}function fb(e,t,n,s){const a=s===null?null:e.find(f=>f.clientRequestId===s)??null,c=e.filter(f=>f.clientRequestId!==s),l=VC(t,n,"sent",s),d=JO(l,a);return KC([...c.filter(f=>f.id!==d.id),d])}function Xf(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function KO(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!tB(s,n)){t.push(n);continue}t[t.length-1]=iB(s,n)}return t}function QO(e){const t=[];let n=null,s=!1;for(const a of e)if(!nB(n,a,s)){if(t.push(a),Ya(a)){n=a,s=!1;continue}n&&Jf(a)&&(s=!0)}return t}function YO(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!QC(s,n)){t.push(n);continue}t[t.length-1]=YC(s,n)}return t}function XO(e){const t=[];for(const n of e){if(t.push(n),t.length<4)continue;const s=t[t.length-4],a=t[t.length-3],c=t[t.length-2],l=t[t.length-1];rB(s,a,c,l)&&t.splice(t.length-3,3,YC(a,l))}return t}function KC(e){const t=[...e].sort((n,s)=>n.sequence!==s.sequence?n.sequence-s.sequence:n.timestamp.localeCompare(s.timestamp));return QO(XO(YO(KO(t))))}function JO(e,t){if(!t||!eB(t,e))return e;const n=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:n.length>0?n:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function ZO(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return Zf(e,t);const n=sB(e.toolCall,t.toolCall),s=aB(e.content,t.content,e.timestamp,t.timestamp),a=lB(e.attachments,t.attachments);return{...Zf(e,t),content:s,toolCall:n,attachments:a,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function eB(e,t){return Mu(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function tB(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const n=Ga(e.content),s=Ga(t.content);return fB(e.timestamp,t.timestamp)&&nr(n.text)===nr(s.text)&&cB(n.inlineImages,s.inlineImages)}function nB(e,t,n){return!e||n||!Ya(e)||!Ya(t)?!1:cp(e.timestamp,t.timestamp,120*1e3)&&nr(e.content)===nr(t.content)}function Ya(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function Jf(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function QC(e,t){return Jf(e)&&Jf(t)&&cp(e.timestamp,t.timestamp,120*1e3)&&nr(e.content)===nr(t.content)}function rB(e,t,n,s){return!e||!t||!n||!s||!Ya(e)||!Ya(n)?!1:QC(t,s)&&cp(e.timestamp,n.timestamp,120*1e3)&&nr(e.content)===nr(n.content)}function YC(e,t){var l,d;const n=((l=e.attachments)==null?void 0:l.length)??0,s=((d=t.attachments)==null?void 0:d.length)??0;if(n!==s)return n>s?e:t;const a=nr(e.content).length,c=nr(t.content).length;return a!==c?a>c?e:t:Zf(e,t)}function iB(e,t){var f,p;const n=((f=e.attachments)==null?void 0:f.length)??0,s=((p=t.attachments)==null?void 0:p.length)??0;if(n!==s)return n>s?e:t;const a=Ga(e.content).inlineImages.length,c=Ga(t.content).inlineImages.length;if(a!==c)return a>c?e:t;const l=e.content!==nr(e.content),d=t.content!==nr(t.content);return l!==d?l?t:e:t}function sB(e,t){return e?t?{...oB(e,t),input:XC(e.input,t.input),output:pb(e.output,t.output),error:pb(e.error,t.error)}:e:t}function oB(e,t){const n=mb(e.status),s=mb(t.status);return s!==n?s>n?t:e:t}function mb(e){return e==="running"?0:1}function aB(e,t,n,s){const a=nr(e),c=nr(t);return a===c?e.length>=t.length?e:t:a.length>c.length&&a.includes(c)?e:c.length>a.length&&c.includes(a)||s.localeCompare(n)>=0?t:e}function lB(e,t){const n=(e==null?void 0:e.length)??0,s=(t==null?void 0:t.length)??0;return s!==n?s>n?t:e:t??e}function XC(e,t){return t.length>e.length?t:e}function pb(e,t){return e===null?t:t===null?e:XC(e,t)}function Zf(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function nr(e){return e.replace(/\r\n/g,`
|
|
106
|
+
`).trimEnd()}function cB(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((n,s)=>{var a;return n.url===((a=t[s])==null?void 0:a.url)})}function uB(e,t){return ZC(t)?JC(e,t,"optimistic"):null}function dB(e,t){return Mu(t)?JC(e,t,"authoritative"):null}function JC(e,t,n){const s=Mo(t.timestamp),a=nr(t.content);let c=null,l=Number.POSITIVE_INFINITY;for(const[d,f]of e.entries()){if(!(n==="optimistic"?Mu(f):ZC(f))||nr(f.content)!==a)continue;const y=Mo(f.timestamp),g=Math.abs(y-s);g>300*1e3||g<l&&(c=d,l=g)}return c}function Mu(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function ZC(e){return e.role==="user"&&e.kind==="text"&&!Mu(e)}function Mo(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function hB(e){return e.reduce((n,s)=>Number.isFinite(s.sequence)&&s.sequence>n?s.sequence:n,0)+1}function fB(e,t){return Math.abs(Mo(e)-Mo(t))<=1e3}function cp(e,t,n){return Math.abs(Mo(e)-Mo(t))<=n}const em=30,e0=40,gb=300*1e3,mB=600,pB=5e3,gB=1e4;function Qh(){const e=ni.getState().profile.defaultPermissionMode;return e==="default"?null:e}class yB{constructor(t,n={}){Be(this,"state");Be(this,"listeners",new Set);Be(this,"realtimeClient",null);Be(this,"historyBootstrapReadyTimer",null);Be(this,"historyBootstrapFallbackTimer",null);Be(this,"historyBootstrapEnvelopeReceived",!1);Be(this,"markSeenTimer",null);Be(this,"markSeenInFlight",!1);Be(this,"lastMarkSeenRequestAt",0);Be(this,"seenWatermark",null);Be(this,"runtimeRefreshTimer",null);Be(this,"runtimeRefreshMode",null);Be(this,"replaceSnapshotSeedOnBackfill",!1);Be(this,"hasAuthoritativeBootstrapMessages");Be(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Be(this,"getState",()=>this.state);var l;this.sessionId=t,this.options=n;const s=On(Zh(t),gb);this.hasAuthoritativeBootstrapMessages=(((l=n.bootstrapMessages)==null?void 0:l.length)??0)>0;const a=Pc(n.initialSession??null,(s==null?void 0:s.session)??null),c=Ra((s==null?void 0:s.messages)??[],this.sessionId,n.bootstrapMessages??[]);this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((s==null?void 0:s.messages.length)??0)>0,this.state=hb({session:a,capabilities:(s==null?void 0:s.capabilities)??null,runtimeHasActiveRun:(s==null?void 0:s.runtimeHasActiveRun)??null,runtimeCanInterrupt:(s==null?void 0:s.runtimeCanInterrupt)??null,contextUsage:(s==null?void 0:s.contextUsage)??null,messages:c,permissionRequests:(s==null?void 0:s.permissionRequests)??[],queuedMessages:(s==null?void 0:s.queuedMessages)??[]}),this.seenWatermark=(a==null?void 0:a.lastSeenAt)??null}async initialize(){this.historyBootstrapEnvelopeReceived=!1,this.clearHistoryBootstrapFallbackTimer();const t=this.options.bootstrapMessages??[],n=Ra(this.state.messages,this.sessionId,t),s=this.hasAuthoritativeBootstrapMessages;this.patch({messages:n,historyState:vB(this.state.session,s?n.length:0),loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:Ms(this.state.session,n.length),pagesLoaded:s?Math.max(this.state.pagesLoaded,1):0,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshPermissionRequests(),this.refreshQueue();try{this.startRealtime(),s?this.scheduleMarkSeen():this.state.historyState==="loading"&&this.scheduleHistoryBootstrapReady()}catch(a){this.handleError(a)}}async reload(){var n,s;this.clearHistoryBootstrapReadyTimer(),this.clearHistoryBootstrapFallbackTimer(),this.historyBootstrapEnvelopeReceived=!1,(n=this.realtimeClient)==null||n.close(),this.realtimeClient=null;const t=On(Zh(this.sessionId),gb);this.state=hb({session:Pc(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:Ra((t==null?void 0:t.messages)??[],this.sessionId,this.options.bootstrapMessages??[]),permissionRequests:(t==null?void 0:t.permissionRequests)??[],queuedMessages:(t==null?void 0:t.queuedMessages)??[]}),this.seenWatermark=((s=this.state.session)==null?void 0:s.lastSeenAt)??null,this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((t==null?void 0:t.messages.length)??0)>0,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const n=Pc(this.state.session,t);n!==this.state.session&&this.patch({session:n,hasOlderMessages:Ms(n,this.state.messages.length)})}async sendMessage(t,n){const s=xb(),a=GC(this.sessionId,t,s,(n==null?void 0:n.attachmentMeta)??[],(n==null?void 0:n.attachments)??[],hB(this.state.messages));this.patch({messages:[...this.state.messages,a],session:di(this.state.session,"running"),runtimeHasActiveRun:kb(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Sb(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,s,n);this.patch({messages:fb(this.state.messages,this.sessionId,c.message,s)})}catch(c){throw this.patch({messages:Xf(this.state.messages,s),session:di(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),c}}async retryMessage(t){const n=this.state.messages.find(s=>s.clientRequestId===t);if(n){this.patch({messages:this.state.messages.map(s=>s.clientRequestId===t?{...s,deliveryState:"sending"}:s),runtimeHasActiveRun:kb(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Sb(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const s=await this.sendMessageWithFallback(n.content,t,{attachments:n.attachmentPayloads??[],attachmentMeta:n.attachments});this.patch({messages:fb(this.state.messages,this.sessionId,s.message,t)})}catch(s){throw this.patch({messages:Xf(this.state.messages,t),session:di(this.state.session,"failed")}),s}}}async enqueueMessage(t,n){const s=xb();try{const a=await wE(this.sessionId,{content:t,clientRequestId:s,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:Qh(),attachments:(n==null?void 0:n.attachments)??[]});this.patch({queuedMessages:kB(this.state.queuedMessages,a)}),await this.refreshQueue()}catch(a){throw a}}async deleteQueuedMessage(t){await bE(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await xE(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await kE(this.sessionId),this.patch({session:di(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}async replyPermissionRequest(t,n){if(!(this.state.permissionRequests.find(c=>c.id===t)??null))return;const a=await SE(this.sessionId,t,n);this.patch({permissionRequests:ef(this.state.permissionRequests,a)})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){var t;if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{if(!((t=this.realtimeClient)==null?void 0:t.requestOlderMessages(this.state.olderCursor,em)))throw new Error("REALTIME_NOT_CONNECTED")}catch(n){const s=n instanceof Error?n.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:s})}}}destroy(){var t;this.clearHistoryBootstrapReadyTimer(),this.clearHistoryBootstrapFallbackTimer(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}startRealtime(){var n;if(!((n=vn.getState().session)==null?void 0:n.accessToken)){vn.clear();return}this.realtimeClient=new GO({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:e0,onSubscribed:()=>{this.patch({connectionState:"connected",historyState:this.state.historyState==="loading"&&up(this.state.session)===0?"ready":this.state.historyState,hasOlderMessages:Ms(this.state.session,this.state.messages.length)}),this.scheduleHistoryBootstrapReady(),this.scheduleHistoryBootstrapFallback()},onConnectionChange:s=>{var c;const a=this.state.connectionState;if(this.patch({connectionState:s,session:s==="reconnecting"&&Pi((c=this.state.session)==null?void 0:c.runningState)?di(this.state.session,"reconnecting"):this.state.session}),s==="connected"){this.clearRuntimeRefreshTimer("poll"),a!=="closed"&&a!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:s=>{var c,l;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer(),this.clearHistoryBootstrapReadyTimer();const a=this.mergeHistoryMessages(s.messages,s.type==="session.backfill");this.patch({messages:a,lastCursor:s.cursor,historyState:"ready",olderCursor:s.olderCursor??this.state.olderCursor,hasOlderMessages:s.type==="session.backfill"?!!s.olderCursor:Ms(this.state.session,a.length),pagesLoaded:s.type==="session.backfill"?Math.max(this.state.pagesLoaded,a.length>0?1:0):this.state.pagesLoaded,session:di(this.state.session,bb(s.type,(c=this.state.session)==null?void 0:c.runningState))}),(l=this.realtimeClient)==null||l.updateCursor(s.cursor),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()},onOlderHistory:s=>{const a=this.mergeHistoryMessages(s.messages,!1);this.patch({messages:a,historyState:"ready",loadingOlderMessages:!1,olderCursor:s.olderCursor,hasOlderMessages:!!s.olderCursor,pagesLoaded:this.state.pagesLoaded+1,errorCode:null,errorDetail:null})},onRuntimeMessage:s=>{this.handleRuntimeMessage(s)},onActivity:s=>{this.handleActivity(s)},onRuntimeStatus:s=>{this.handleRuntimeStatus(s)},onRuntimeError:s=>{this.handleRuntimeError(s)},onInterrupted:s=>{this.handleInterrupted(s)},onPermissionRequest:s=>{this.handlePermissionRequest(s)},onPermissionRequestResolved:s=>{this.handlePermissionRequestResolved(s)},onError:s=>{this.patch({loadingOlderMessages:!1,errorCode:s.error_code,errorDetail:s.detail})},onUnauthorized:()=>{vn.clear()}}),this.realtimeClient.start()}patch(t){let n=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),n={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...n},(Object.prototype.hasOwnProperty.call(n,"session")||Object.prototype.hasOwnProperty.call(n,"capabilities")||Object.prototype.hasOwnProperty.call(n,"contextUsage")||Object.prototype.hasOwnProperty.call(n,"messages")||Object.prototype.hasOwnProperty.call(n,"permissionRequests")||Object.prototype.hasOwnProperty.call(n,"queuedMessages"))&&this.persistSnapshot(),this.emit()}mergeHistoryMessages(t,n){const s=n&&this.replaceSnapshotSeedOnBackfill?this.state.messages.filter(c=>c.deliveryState!=="sent"):this.state.messages,a=Ra(s,this.sessionId,t);return n&&(this.replaceSnapshotSeedOnBackfill=!1),a}handleError(t){this.clearHistoryBootstrapReadyTimer(),this.clearHistoryBootstrapFallbackTimer();const n=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:n})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const n=this.getMarkSeenThrottleDelayMs(),s=Math.max(mB,n);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const a=this.getTargetSeenAt();a!==null&&(Kt("session_seen.start",{sessionId:this.sessionId,targetSeenAt:a,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),aE(this.sessionId).then(()=>{var c,l;this.bumpSeenWatermark(a),this.patch({session:yb(this.state.session,a)}),(l=(c=this.options).onSeen)==null||l.call(c,this.sessionId,a),Kt("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{Kt("session_seen.error",{sessionId:this.sessionId,targetSeenAt:a})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},s)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapReady(){if(this.state.historyState!=="loading"){this.clearHistoryBootstrapReadyTimer();return}this.historyBootstrapReadyTimer===null&&(this.historyBootstrapReadyTimer=window.setTimeout(()=>{this.historyBootstrapReadyTimer=null,this.state.historyState==="loading"&&this.patch({historyState:"ready",hasOlderMessages:Ms(this.state.session,this.state.messages.length),pagesLoaded:this.state.messages.length>0?Math.max(this.state.pagesLoaded,1):0})},500))}clearHistoryBootstrapReadyTimer(){this.historyBootstrapReadyTimer!==null&&(window.clearTimeout(this.historyBootstrapReadyTimer),this.historyBootstrapReadyTimer=null)}scheduleHistoryBootstrapFallback(){this.historyBootstrapEnvelopeReceived||this.historyBootstrapFallbackTimer!==null||(this.historyBootstrapFallbackTimer=window.setTimeout(()=>{this.historyBootstrapFallbackTimer=null,!this.historyBootstrapEnvelopeReceived&&this.resolveHistoryBootstrapFallback()},350))}clearHistoryBootstrapFallbackTimer(){this.historyBootstrapFallbackTimer!==null&&(window.clearTimeout(this.historyBootstrapFallbackTimer),this.historyBootstrapFallbackTimer=null)}async resolveHistoryBootstrapFallback(){try{const t=await fE(this.sessionId,null,em,"backward");if(this.historyBootstrapEnvelopeReceived)return;this.historyBootstrapEnvelopeReceived=!0;const n=this.mergeHistoryMessages(t.messages,!0);this.patch({messages:n,historyState:"ready",olderCursor:t.nextCursor,hasOlderMessages:t.nextCursor!==null?!0:Ms(this.state.session,n.length),lastCursor:t.cursor??this.state.lastCursor,pagesLoaded:n.length>0?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.scheduleMarkSeen()}catch{}}scheduleRuntimeRefresh(t,n){var s,a;if(!Pi((s=this.state.session)==null?void 0:s.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,Kt("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((a=this.state.session)==null?void 0:a.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const c=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(c,n)},t==="poll"?gB:1200))}async refreshRuntimeState(t,n){var s,a,c,l,d;Kt("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((s=this.state.session)==null?void 0:s.runningState)??null});try{const f=await yv(this.sessionId);this.patch({session:vb(this.state.session,f),runtimeHasActiveRun:f.hasActiveRun,runtimeCanInterrupt:f.canInterrupt,contextUsage:f.contextUsage,...Xh(f)}),await this.refreshQueue();const p=t==="poll"&&this.state.connectionState!=="connected"&&Pi((a=this.state.session)==null?void 0:a.runningState);Kt("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,continuePolling:p}),p&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(f){Kt("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((l=this.state.session)==null?void 0:l.runningState)??null,message:f instanceof Error?f.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&Pi((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(sE(this.sessionId).then(n=>{this.patch({session:Pc(n,this.state.session)})}).catch(()=>{})),wb(this.state.capabilities)&&t.push(cE(this.sessionId).then(n=>{this.patch({capabilities:n})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await Dk(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||wb(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){Kt("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const n=await yv(this.sessionId);this.patch({session:vb(this.state.session,n),runtimeHasActiveRun:n.hasActiveRun,runtimeCanInterrupt:n.canInterrupt,contextUsage:n.contextUsage,...Xh(n)}),await this.refreshQueue(),Kt("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:n.contextUsage!==null})}catch(n){Kt("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:n instanceof Error?n.message:"unknown"})}}async refreshQueue(){try{const t=await vE(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,n,s){var a;try{return await yE(this.sessionId,{content:t,clientRequestId:n,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:Qh(),attachments:(s==null?void 0:s.attachments)??[]})}catch(c){if(!(c instanceof lr)||c.status!==404&&c.status!==405||(((a=s==null?void 0:s.attachments)==null?void 0:a.length)??0)>0)throw c;return pE(this.sessionId,{content:t,clientRequestId:n,permissionMode:Qh()})}}handleRuntimeStatus(t){var s;const n=Yh((s=this.state.session)==null?void 0:s.runningState,t.status);this.patch({session:di(this.state.session,n),runtimeHasActiveRun:Pi(n)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:Pi(n)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:n===t.status?t.detail:this.state.errorDetail}),mu(n)&&(this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleActivity(t){if(this.patch({session:wB(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...Xh(t)}),mu(t.runningState)){this.clearRuntimeRefreshTimer(),this.refreshQueue();return}(t.runningState==="stale"||t.runningState==="unknown")&&this.scheduleRuntimeRefresh("tail","activity_watchdog")}handleRuntimeMessage(t){var s;this.clearHistoryBootstrapReadyTimer();const n=Ra(this.state.messages,this.sessionId,[t.message]);this.patch({messages:n,historyState:"ready",hasOlderMessages:Ms(this.state.session,n.length),session:di(this.state.session,bb("session.delta",(s=this.state.session)==null?void 0:s.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var s;const n=Yh((s=this.state.session)==null?void 0:s.runningState,"failed");this.clearRuntimeRefreshTimer(),this.patch({session:di(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="failed"?t.error_code:this.state.errorCode,errorDetail:n==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var s;const n=Yh((s=this.state.session)==null?void 0:s.runningState,"interrupted");this.clearRuntimeRefreshTimer(),this.patch({session:di(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="interrupted"?null:this.state.errorCode,errorDetail:n==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}handlePermissionRequest(t){this.patch({permissionRequests:ef(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:ef(this.state.permissionRequests,t.request)})}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(s=>s.role!=="user");if(!t)return null;const n=this.seenWatermark;return n?t.timestamp>n?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,pB-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:yb(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Mr(Zh(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:xB(this.state.messages),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages})}}function yr(e,t){const[n,s]=v.useState(()=>t(e.getState()));return v.useEffect(()=>(s(t(e.getState())),e.subscribe(()=>{s(t(e.getState()))})),[t,e]),n}function up(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function vB(e,t){return t>0||up(e)===0?"ready":"loading"}function Ms(e,t){const n=up(e);return n!==null?n>t:t>=e0}function di(e,t){return e&&{...e,runningState:t,activityState:n0(e,t,e.completedAt??null,Pi(t))}}function yb(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function vb(e,t){return t0(e,{runningState:t.runningState,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,detail:t.detail,errorCode:t.errorCode,errorDetail:t.errorDetail,hasActiveRun:t.hasActiveRun,updatedAt:t.updatedAt,watchdogTriggeredAt:t.watchdogTriggeredAt})}function wB(e,t){return t0(e,t)}function t0(e,t){if(!e)return e;const n=bB(t.activityResolutionSource),s=mu(t.runningState)?Jh(e.completedAt,t.updatedAt):null,a=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?Jh(e.lastEventAt,t.updatedAt):t.updatedAt;return{...e,runningState:t.runningState,activitySource:n,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,lastEventAt:a,completedAt:s,lastErrorCode:t.runningState==="failed"?t.errorCode??e.lastErrorCode:null,lastErrorDetail:t.runningState==="failed"?t.errorDetail??t.detail??e.lastErrorDetail:null,watchdogTriggeredAt:t.watchdogTriggeredAt,updatedAt:Jh(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:n0(e,t.runningState,s,t.hasActiveRun)}}function n0(e,t,n,s){return s||Pi(t)?"running":n&&(!e.lastSeenAt||n>e.lastSeenAt)?"completed_unread":e.activityState==="running"||e.activityState==="completed_unread"?"idle":e.activityState??"idle"}function Pi(e){return e==="starting"||e==="running"||e==="reconnecting"}function mu(e){return e==="completed"||e==="interrupted"||e==="failed"}function wb(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(n=>n.usesProviderDefault===!0)}function bb(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function Yh(e,t){return mu(e)?e:t}function Xh(e){return e.runningState==="failed"?{errorCode:e.errorCode,errorDetail:e.errorDetail??e.detail}:e.runningState==="interrupted"?{errorCode:null,errorDetail:e.detail}:e.runningState==="completed"?{errorCode:null,errorDetail:e.detail}:{errorCode:null,errorDetail:null}}function bB(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function Jh(e,t){return e?t?e>=t?e:t:e:t??null}function xb(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const n=new Uint8Array(16);globalThis.crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const s=Array.from(n,a=>a.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}return`fallback-${Date.now()}-${Math.random().toString(16).slice(2,10)}`}function kb(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:e.provider==="codex"||e.provider==="claude-code"||e.provider==="opencode":!1}function Sb(e,t){return e?t&&e.provider===t.provider?!(!t.supportsInterrupt||e.provider==="claude-code"&&e.activitySource==="inferred"):e.provider==="codex"||e.provider==="opencode"?!0:e.provider==="claude-code"&&e.activitySource!=="inferred":!1}function Zh(e){return`session-runtime.snapshot.${e}`}function xB(e){return e.filter(t=>t.deliveryState==="sent").slice(-em)}function kB(e,t){const n=e.filter(s=>s.id!==t.id);return n.push(t),n.sort((s,a)=>s.orderIndex-a.orderIndex),n}function ef(e,t){const n=e.filter(s=>s.id!==t.id);return n.push(t),n.sort((s,a)=>s.status!==a.status?s.status==="pending"?-1:1:a.createdAt.localeCompare(s.createdAt)),n}function Pc(e,t){if(!e)return t;if(!t||Cb(e,t))return e;if(Cb(t,e))return t;const n=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),s=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(n)||!Number.isFinite(s)?t:n>=s?e:t}function Cb(e,t){return jb(e)&&!jb(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function jb(e){return e.activityState==="running"||Pi(e.runningState)}function r0({children:e,className:t,frameRef:n,...s}){return i.jsx("div",{ref:n,className:["mobile-top-header-frame",t].filter(Boolean).join(" "),...s,children:e})}function Wo({currentWorkspace:e,workspaces:t,onSelectWorkspace:n,className:s,containerRef:a,heading:c,content:l,sheetContent:d,triggerLabel:f,triggerAriaLabel:p,onTriggerClick:y,trailing:g,gestureHandlers:b}){const[x,S]=v.useState(!1),C=Hr();return e?i.jsxs(i.Fragment,{children:[i.jsx(r0,{className:s,frameRef:a,...b,children:i.jsxs("section",{className:"mobile-workspace-home-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:c??e.name}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":p??h("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(y){y();return}C.trigger("selection"),S(!0)},children:[i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:f??e.name}),i.jsx(jB,{})]}),i.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:g})]}),i.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),l]})}),x&&!y?SB(i.jsxs(CB,{title:h("shell.workspaceHomeSwitcherTitle"),onClose:()=>S(!1),children:[i.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:t.map(j=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{j.id!==e.id&&C.trigger("selection"),n==null||n(j.id),S(!1)},children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:j.name}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:j.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:j.id===e.id?i.jsx(PB,{}):i.jsx(NB,{})})]},j.id))}),d?d(()=>S(!1)):null]})):null]}):null}function SB(e){return typeof document>"u"?null:Hn.createPortal(e,document.body)}function CB({title:e,onClose:t,children:n}){return i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:s=>s.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:e})}),n]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:h("common.cancel")})]})})}function jB(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function NB(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function PB(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function ul({open:e,workspaces:t,initialWorkspaceId:n,onClose:s,onSelect:a}){const[c,l]=v.useState(""),[d,f]=v.useState(!1),p=Hr();if(v.useEffect(()=>{e&&(l(TB(t,n)),f(!1))},[n,e,t]),!e||typeof document>"u")return null;const y=t.find(g=>g.id===c)??t[0]??null;return Hn.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:s,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":h("shell.createSessionModalTitle"),onClick:g=>g.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:h("shell.createSessionModalTitle")})}),i.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[i.jsx("p",{className:"mobile-create-session-description",children:h("shell.createSessionModalDescription")}),i.jsxs("div",{className:"mobile-feature-field",children:[i.jsx("span",{children:h("shell.createSessionWorkspaceLabel")}),i.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${h("shell.createSessionWorkspaceLabel")} ${(y==null?void 0:y.name)??""}`.trim(),"aria-expanded":d?"true":"false",disabled:t.length===0,onClick:()=>{p.trigger("selection"),f(g=>!g)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[i.jsx("strong",{children:(y==null?void 0:y.name)??h("common.unknown")}),i.jsx("span",{children:(y==null?void 0:y.path)??h("common.unknown")})]}),i.jsx(EB,{expanded:d})]}),d?i.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:t.map(g=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row",onClick:()=>{g.id!==c&&p.trigger("selection"),l(g.id),f(!1)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[i.jsx("strong",{children:g.name}),i.jsx("span",{children:g.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:g.id===c?i.jsx(MB,{}):i.jsx(RB,{})})]},g.id))}):null]}),i.jsxs("div",{className:"mobile-create-session-provider-block",children:[i.jsxs("div",{className:"mobile-create-session-provider-header",children:[i.jsx("span",{className:"mobile-create-session-provider-label",children:h("shell.createSessionProviderLabel")}),i.jsx("span",{className:"mobile-create-session-provider-hint",children:h("shell.providerOptionHint")})]}),i.jsx(kC,{disabled:!c,onSelect:g=>{c&&a(c,g)}})]})]})]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:s,children:h("common.cancel")})]})}),document.body)}function TB(e,t){var n;return t&&e.some(s=>s.id===t)?t:((n=e[0])==null?void 0:n.id)??""}function EB({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function RB(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function MB(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const i0="mobile.conversation.preview.mode";function tf(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(i0)==="immersive"?"immersive":"preview"}catch{return"preview"}}function Ei(e){if(!(typeof window>"u"))try{window.localStorage.setItem(i0,e)}catch{}}const AB=15e3,Nb=.6,nf=.6,Pb=8,LB=36,IB=48,DB=96;function _B(){const{sessionId:e="",workspaceId:t}=wu(),n=ri(),s=qn(),a=v.useMemo(()=>new URLSearchParams(n.search),[n.search]),c=(t==null?void 0:t.trim())||null,l=v.useMemo(()=>WB(e,c,a),[c,a,e]),d=v.useMemo(()=>XB(e,n.state),[n.state,e]);return l?i.jsx(BB,{draft:l,navigate:s}):i.jsx(FB,{sessionId:e,bootstrapMessages:d})}function FB({sessionId:e,bootstrapMessages:t}){var Nt;const{shellMode:n,navigationGroups:s,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,markNavigationSessionSeen:d,favoriteSessions:f,archiveSession:p,unarchiveSession:y,startDraftSession:g}=ur(),b=qn(),x=v.useRef(null),S=v.useRef(null),[C,j]=v.useState(!1),[R,L]=v.useState(null),[A,K]=v.useState(!1),[H,F]=v.useState(!1),[M,_]=v.useState(null),[I,P]=v.useState(!1),[U,G]=v.useState(!1),X=v.useMemo(()=>s.flatMap(Se=>Se.sessions).find(Se=>Se.sessionId===e)??null,[s,e]);(!x.current||S.current!==e)&&((Nt=x.current)==null||Nt.destroy(),x.current=new yB(e,{initialSession:X,bootstrapMessages:t,onSeen:(Se,Ye)=>{d(Se,Ye)}}),S.current=e);const Z=x.current,{showToast:$,dismissToast:se}=Yn(),Y=Ti(Se=>Se.notificationPreferences.notifyOnPermissionRequest),q=Mn(),oe=Hr(),E=v.useRef(null),B=v.useRef(null),te=v.useRef(null),T=v.useRef((X==null?void 0:X.runningState)??null),we=v.useRef(new Set),me=yr(Z,Se=>Se.session),Ce=yr(Z,Se=>Se.capabilities),_e=yr(Z,Se=>Se.runtimeHasActiveRun),Ge=yr(Z,Se=>Se.runtimeCanInterrupt),ot=yr(Z,Se=>Se.messages),mt=yr(Z,Se=>Se.permissionRequests),jt=yr(Z,Se=>Se.queuedMessages),yt=yr(Z,Se=>Se.contextUsage),St=yr(Z,Se=>Se.historyState),Lt=yr(Z,Se=>Se.errorCode),vt=yr(Z,Se=>Se.errorDetail),zt=yr(Z,Se=>Se.loadingOlderMessages),Rt=yr(Z,Se=>Se.hasOlderMessages),ft=yr(Z,Se=>Se.connectionState),[tn,qt]=v.useState(null),[Ot,tt]=v.useState(null),$t=QB(me),gt=$t&&Fk(Ce)&&(me==null?void 0:me.provider)===(Ce==null?void 0:Ce.provider),Vt=jt.some(Se=>Se.status==="queued"||Se.status==="dispatching"),ue=n!=="mobile",ve=c0(!ue),Le=(me==null?void 0:me.workspaceId)??(X==null?void 0:X.workspaceId)??null,Ke=v.useMemo(()=>new Set(f.map(Se=>Se.session.sessionId)),[f]),nt=v.useMemo(()=>s.map(Se=>Se.workspace),[s]),wt=v.useMemo(()=>zB(s,Le,e),[Le,s,e]),Dt=v.useMemo(()=>s0(s,(me==null?void 0:me.workspaceId)??(X==null?void 0:X.workspaceId)??null,Ke),[Ke,s,X==null?void 0:X.workspaceId,me==null?void 0:me.workspaceId]),Pt=v.useMemo(()=>o0(f),[f]),Ze=v.useMemo(()=>Le?s.find(Se=>Se.workspace.id===Le)??null:null,[Le,s]);(me==null?void 0:me.provider)??(X==null||X.provider);const Wt=v.useMemo(()=>{var Se;return ds(((Se=me??X)==null?void 0:Se.title)??null,h("conversation.titleFallback"))},[X,me]),ct=v.useMemo(()=>(Ze==null?void 0:Ze.sessions.filter(Se=>Se.isArchived===!0&&Se.isSubagent!==!0))??[],[Ze]),It=v.useRef(null),Mt=v.useRef(null),Xt=v.useRef(null),[ee,Ie]=v.useState(null),{composerPortalTarget:at}=ZS();return v.useEffect(()=>{Z.applyNavigationSession(X)},[X,Z]),v.useEffect(()=>(Z.initialize(),()=>{Z.destroy()}),[Z]),v.useEffect(()=>(l(e,(me==null?void 0:me.workspaceId)??null),()=>{l(e,null)}),[me==null?void 0:me.workspaceId,e,l]),v.useEffect(()=>()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),v.useEffect(()=>{if(!Lt||!vt){te.current!==null&&(window.clearTimeout(te.current),te.current=null),B.current=null,E.current=null,se("conversation-runtime-error");return}const Se=`${Lt}:${vt}`;if(!(E.current===Se||B.current===Se)){if(te.current!==null&&(window.clearTimeout(te.current),te.current=null),OB((me==null?void 0:me.provider)??null,Lt,vt)){B.current=Se,te.current=window.setTimeout(()=>{B.current=null,te.current=null,E.current=Se,$({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:vt,tone:"error",durationMs:null})},AB);return}B.current=null,E.current=Se,$({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:vt,tone:"error",durationMs:null})}},[se,Lt,vt,me==null?void 0:me.provider,$]),v.useEffect(()=>{const Se=T.current,Ye=(me==null?void 0:me.runningState)??null;(Se==="starting"||Se==="running"||Se==="reconnecting")&&Ye==="completed"&&oe.trigger("success"),T.current=Ye},[oe,me==null?void 0:me.runningState]),v.useEffect(()=>{const Se=mt.filter(Ut=>Ut.status==="pending"),Ye=(me==null?void 0:me.workspaceId)??(X==null?void 0:X.workspaceId)??null;for(const Ut of Se)we.current.has(Ut.id)||(we.current.add(Ut.id),Y&&($({id:`permission-request-${Ut.id}`,title:h("conversation.permissionRequestToastTitle"),description:Ut.title,tone:"warning",durationMs:8e3,action:Ye?{label:h("shell.contextOpenSession"),onClick:()=>{b(Qn(Ye,e))}}:void 0}),q.bridge.showNotification(h("conversation.permissionRequestToastTitle"),Ut.title)))},[X==null?void 0:X.workspaceId,b,Y,mt,q.bridge,me==null?void 0:me.workspaceId,e,$]),a0(Mt,ee,!ue,e),l0(Mt,Xt,!ue,e),i.jsxs(i.Fragment,{children:[i.jsxs("main",{ref:Mt,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!ue,"data-preview-mode":ue?void 0:ve.displayMode,"data-preview-dragging":ue?void 0:ve.isDragging,style:ue?void 0:ve.pageStyle,children:[ue?i.jsx($C,{session:me??X}):null,ue?null:i.jsx(Wo,{containerRef:Xt,className:"mobile-conversation-page-header",gestureHandlers:ve.mainGestureHandlers,currentWorkspace:(Ze==null?void 0:Ze.workspace)??nt[0]??null,workspaces:nt,heading:Wt.fullTitle,triggerAriaLabel:ve.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{ve.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:Wt.fullTitle,children:Wt.displayTitle})}),ue?null:i.jsx(u0,{visible:ve.isVisible,widthPx:ve.previewWidthPx,isDragging:ve.isDragging,gestureHandlers:ve.railGestureHandlers,activeSessionId:wt,createSessionActionLabel:h("shell.createSession"),favoriteItems:Pt,items:Dt,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{G(!0)},archiveCurrentActionLabel:h("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:h("shell.archiveFolderAction"),onArchiveActiveSession:()=>{K(!0)},onOpenArchiveFolder:()=>{F(!0)},onActivate:Se=>{Ei("preview"),b(Qn(Se.workspace.id,Se.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...ue?{}:ve.mainGestureHandlers,children:i.jsxs("div",{ref:It,className:"mobile-conversation-main",children:[i.jsx(_k,{connectionState:ft,onReconnect:()=>Z.reconnect()}),i.jsx(WO,{requests:mt,replyingRequestId:R,onReply:async(Se,Ye)=>{L(Se);try{await Z.replyPermissionRequest(Se,Ye)}catch(Ut){$({title:h("conversation.permissionRequestReplyFailed"),description:Ut instanceof Error?Ut.message:void 0,tone:"error"})}finally{L(null)}}}),i.jsx(qC,{sessionId:e,messages:ot,historyState:St,loadingOlderMessages:zt,hasOlderMessages:Rt,provider:(me==null?void 0:me.provider)??null,onLoadOlderMessages:()=>{Z.loadOlderMessages()},onRetryMessage:Se=>{Z.retryMessage(Se)}}),i.jsx($O,{items:jt,deletingQueueItemId:tn,steeringQueueItemId:Ot,canSteer:gt,onDelete:async Se=>{qt(Se);try{await Z.deleteQueuedMessage(Se)}finally{qt(null)}},onSteer:async Se=>{tt(Se);try{await Z.steerQueuedMessage(Se),a()}finally{tt(null)}}}),i.jsx(Bk,{capabilities:Ce,draftStorageId:e,panelRef:ue?void 0:Ie,portalContainer:ue?null:at,hasActiveRun:_e,contextUsage:yt,hasPendingQueuedMessages:Vt,canInterrupt:Ge,isSubmitting:C,isRunning:$t,onInterrupt:async()=>{await Z.interrupt(),a()},onSend:async(Se,Ye)=>{j(!0);try{await Z.sendMessage(Se,{model:Ye==null?void 0:Ye.model,reasoningLevel:Ye==null?void 0:Ye.reasoningLevel,attachments:Ye==null?void 0:Ye.attachments,attachmentMeta:Ye==null?void 0:Ye.attachmentMeta}),a()}finally{j(!1)}},onQueueSend:async(Se,Ye)=>{j(!0);try{await Z.enqueueMessage(Se,{model:Ye==null?void 0:Ye.model,reasoningLevel:Ye==null?void 0:Ye.reasoningLevel,attachments:Ye==null?void 0:Ye.attachments,attachmentMeta:Ye==null?void 0:Ye.attachmentMeta})}finally{j(!1)}}})]})})]}),i.jsx(GB,{open:A,busy:I,onClose:()=>{I||K(!1)},onConfirm:async()=>{if(!I){P(!0);try{if(await p(e),K(!1),$({title:h("shell.archiveAdded"),tone:"success"}),Le){c(Le),Ei("preview"),b(al(Le));return}b("/workspaces")}catch(Se){$({title:Se instanceof Error?Se.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{P(!1)}}}}),i.jsx(KB,{open:H,workspaceName:(Ze==null?void 0:Ze.workspace.name)??null,sessions:ct,restoringSessionId:M,onClose:()=>{M||F(!1)},onRestore:async Se=>{_(Se);try{await y(Se),$({title:h("shell.archiveRestored"),tone:"success"})}catch(Ye){$({title:Ye instanceof Error?Ye.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{_(null)}}}),i.jsx(ul,{open:U,workspaces:nt,initialWorkspaceId:Le,onClose:()=>G(!1),onSelect:(Se,Ye)=>{G(!1),Ei("immersive"),g(Se,Ye)}})]})}function OB(e,t,n){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(n)||/timeout/i.test(n)||/超时/.test(n)}function BB({draft:e,navigate:t}){const{shellMode:n,navigationGroups:s,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,upsertNavigationSession:d,favoriteSessions:f,startDraftSession:p}=ur(),[y,g]=v.useState(!1),[b,x]=v.useState([]),[S,C]=v.useState(!1),j=v.useMemo(()=>RE(e.provider),[e.provider]),[R,L]=v.useState(j),A=n!=="mobile",K=c0(!A),H=v.useMemo(()=>UB(e),[e]),F=v.useMemo(()=>new Set(f.map(Y=>Y.session.sessionId)),[f]),M=v.useMemo(()=>s.map(Y=>Y.workspace),[s]),_=v.useMemo(()=>ds(H.title??null,h("conversation.titleFallback")),[H]),I=v.useMemo(()=>s0(s,e.workspaceId,F),[e.workspaceId,F,s]),P=v.useMemo(()=>o0(f),[f]),U=v.useRef(null),G=v.useRef(null),X=v.useRef(null),[Z,$]=v.useState(null),{composerPortalTarget:se}=ZS();return v.useEffect(()=>(l(e.sessionId,e.workspaceId),()=>{l(e.sessionId,null)}),[e.sessionId,e.workspaceId,l]),v.useEffect(()=>{let Y=!1;return L(j),hE(e.provider,e.workspaceId).then(q=>{Y||L(q)}).catch(()=>{}),()=>{Y=!0}},[e.provider,e.workspaceId,j]),a0(G,Z,!A,e.sessionId),l0(G,X,!A,e.sessionId),i.jsxs(i.Fragment,{children:[i.jsxs("main",{ref:G,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!A,"data-preview-mode":A?void 0:K.displayMode,"data-preview-dragging":A?void 0:K.isDragging,style:A?void 0:K.pageStyle,children:[A?i.jsx($C,{session:H}):null,A?null:i.jsx(Wo,{containerRef:X,className:"mobile-conversation-page-header",gestureHandlers:K.mainGestureHandlers,currentWorkspace:M.find(Y=>Y.id===e.workspaceId)??M[0]??null,workspaces:M,heading:_.fullTitle,triggerAriaLabel:K.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{K.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:_.fullTitle,children:_.displayTitle})}),A?null:i.jsx(u0,{visible:K.isVisible,widthPx:K.previewWidthPx,isDragging:K.isDragging,gestureHandlers:K.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:h("shell.createSession"),favoriteItems:P,items:I,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{C(!0)},onActivate:Y=>{Ei("preview"),t(Qn(Y.workspace.id,Y.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...A?{}:K.mainGestureHandlers,children:i.jsxs("div",{ref:U,className:"mobile-conversation-main",children:[i.jsx(_k,{connectionState:"closed",onReconnect:()=>{}}),i.jsx(qC,{sessionId:e.sessionId,messages:b,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}}),i.jsx(Bk,{capabilities:R,draftStorageId:e.sessionId,panelRef:A?void 0:$,portalContainer:A?null:se,contextUsage:null,isSubmitting:y,isRunning:!1,onSend:async(Y,q)=>{var E,B;const oe=ZB();x(te=>[...te,GC(e.sessionId,Y,oe,(q==null?void 0:q.attachmentMeta)??[],(q==null?void 0:q.attachments)??[])]),g(!0);try{const te=ni.getState().profile.defaultPermissionMode,T=await gE({workspaceId:e.workspaceId,provider:e.provider,content:Y,clientRequestId:oe,model:(q==null?void 0:q.model)??null,reasoningLevel:(q==null?void 0:q.reasoningLevel)??null,permissionMode:te==="default"?null:te,attachments:(q==null?void 0:q.attachments)??[]});T.session&&d(T.session);const we=((B=(E=T.session)==null?void 0:E.workspaceId)==null?void 0:B.trim())||e.workspaceId;l(T.sessionId,we),Ei("preview"),t(Qn(we,T.sessionId),{replace:!0,state:T.message?{bootstrap:{sessionId:T.sessionId,messages:[T.message]}}:null}),a()}catch(te){throw x(T=>Xf(T,oe)),te}finally{g(!1)}}})]})})]}),i.jsx(ul,{open:S,workspaces:M,initialWorkspaceId:e.workspaceId,onClose:()=>C(!1),onSelect:(Y,q)=>{C(!1),Ei("immersive"),p(Y,q)}})]})}function WB(e,t,n,s=null){var l,d;if(!YB(e))return null;const a=t??((l=n.get("workspaceId"))==null?void 0:l.trim())??null,c=((d=n.get("provider"))==null?void 0:d.trim())??s??null;return!a||!TE(c)?null:{sessionId:e,workspaceId:a,provider:c}}function UB(e){const t=new Date().toISOString();return{sessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,providerSessionId:`draft://${e.sessionId}`,rawStoreRef:`draft://${e.sessionId}`,parentSessionId:null,isSubagent:!1,subagentLabel:null,isArchived:!1,title:EE(e.provider),messageCount:0,lastMessageAt:null,createdAt:t,updatedAt:t,syncStatus:"idle",syncCursor:null,lastSyncAt:null,lastErrorCode:null,lastErrorDetail:null,resumedAt:null,runningState:"idle",activitySource:"none",lastEventAt:null,completedAt:null,lastSeenAt:null,activityState:"idle"}}function s0(e,t,n){if(!t)return[];const s=e.find(a=>a.workspace.id===t);return s?Wm([s]).filter(a=>!a.session.isArchived&&a.session.isSubagent!==!0&&!n.has(a.session.sessionId)).map(a=>({entry:a,depth:0})):[]}function o0(e){return e.filter(t=>t.session.isSubagent!==!0).map(t=>({entry:t,depth:0}))}function zB(e,t,n){var d;if(!t)return n;const s=e.find(f=>f.workspace.id===t);if(!s)return n;const a=new Map(s.sessions.map(f=>[f.sessionId,f]));let c=a.get(n);if(!c)return n;const l=new Set([c.sessionId]);for(;;){const f=((d=c.parentSessionId)==null?void 0:d.trim())||null;if(!f)return c.sessionId;const p=a.get(f);if(!p||l.has(p.sessionId))return c.sessionId;l.add(p.sessionId),c=p}}function a0(e,t,n,s){v.useEffect(()=>{const a=e.current;if(!n||!a){a&&a.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){a.style.removeProperty("--mobile-conversation-composer-height");return}const c=a,l=t;function d(){!e.current||!l.isConnected||c.style.setProperty("--mobile-conversation-composer-height",`${l.offsetHeight}px`)}d();const f=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return f==null||f.observe(l),window.addEventListener("resize",d),()=>{f==null||f.disconnect(),window.removeEventListener("resize",d),a.style.removeProperty("--mobile-conversation-composer-height")}},[t,n,s,e])}function l0(e,t,n,s){v.useEffect(()=>{const a=e.current,c=t.current;if(!n||!a){a&&a.style.removeProperty("--mobile-conversation-page-header-height");return}if(!c){a.style.removeProperty("--mobile-conversation-page-header-height");return}const l=a,d=c;function f(){!e.current||!d.isConnected||l.style.setProperty("--mobile-conversation-page-header-height",`${d.offsetHeight}px`)}f();const p=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return p==null||p.observe(d),window.addEventListener("resize",f),()=>{p==null||p.disconnect(),window.removeEventListener("resize",f),a.style.removeProperty("--mobile-conversation-page-header-height")}},[n,t,s,e])}function c0(e){const t=Hr(),[n,s]=v.useState(()=>e?tf():"immersive"),[a,c]=v.useState(()=>Eb()),[l,d]=v.useState(()=>e&&tf()==="preview"?"default":"closed"),f=v.useRef(l),p=v.useRef(null);v.useEffect(()=>{f.current=l},[l]),v.useEffect(()=>{if(!e){p.current=null,f.current="closed",d("closed"),s("immersive");return}const _=tf();s(_),d(_==="preview"?"default":"closed")},[e]),v.useEffect(()=>{e&&Ei(n)},[e,n]),v.useEffect(()=>{if(typeof window>"u")return;function _(){c(Eb())}return _(),window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[]);function y(_){f.current=_,d(_)}function g(_="default"){y(_),s("preview")}function b(){y("closed"),s("immersive")}function x(){y("expanded"),s("preview")}function S(){if(f.current!=="closed"){t.trigger("gesture"),b();return}t.trigger("gesture"),g()}function C(_,I){if(!e||I.touches.length!==1){p.current=null;return}if(HB(I.target)){p.current=null;return}const P=I.touches[0];if(!P){p.current=null;return}if(_==="main"){if(f.current==="closed"&&P.clientX>DB){p.current=null;return}}else if(f.current==="closed"){p.current=null;return}p.current={source:_,intent:_==="rail"?"rail":f.current==="closed"?"open":"close",startX:P.clientX,startY:P.clientY,lastX:P.clientX,lastY:P.clientY,horizontalLocked:!1}}function j(_){const I=p.current,P=_.touches[0];if(!e||!I||!P)return;const U=P.clientX-I.startX,G=P.clientY-I.startY;if(I.lastX=P.clientX,I.lastY=P.clientY,!I.horizontalLocked){if(Math.abs(U)<Pb&&Math.abs(G)<Pb)return;if(Math.abs(U)<=Math.abs(G)){p.current=null;return}if(I.intent==="open"&&U<=0){p.current=null;return}if(I.intent==="close"&&U>=0){p.current=null;return}I.horizontalLocked=!0}}function R(_){var G;const I=p.current;if(p.current=null,!(I!=null&&I.horizontalLocked))return;const P=(G=_==null?void 0:_.changedTouches)==null?void 0:G[0];P&&(I.lastX=P.clientX,I.lastY=P.clientY);const U=I.lastX-I.startX;if(I.intent==="open"){U>=LB&&(t.trigger("gesture"),g("default"));return}if(I.intent==="close"){U<=-34&&(t.trigger("gesture"),b());return}if(U<=-34){t.trigger("gesture"),b();return}U>=IB&&f.current==="default"&&(t.trigger("gesture"),x())}const L=l==="expanded"?nf:l==="default"?Nb:0,A=Math.round(a*L*100)/100,K=L===0?0:L/nf,H={"--mobile-conversation-preview-default-width":`${Math.round(a*Nb*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(a*nf*100)/100}px`,"--mobile-conversation-preview-width":`${A}px`,"--mobile-conversation-preview-progress":K.toFixed(4)};return{closePreview:b,displayMode:l==="closed"?"immersive":"preview",isDragging:!1,isVisible:l!=="closed",mainGestureHandlers:{onTouchStart:_=>C("main",_),onTouchMove:j,onTouchEnd:R,onTouchCancel:R},pageStyle:H,previewWidthPx:A,railGestureHandlers:{onTouchStart:_=>C("rail",_),onTouchMove:j,onTouchEnd:R,onTouchCancel:R},togglePreview:S}}function u0({visible:e,widthPx:t,isDragging:n,gestureHandlers:s,activeSessionId:a,createSessionActionLabel:c,favoriteItems:l,items:d,workspaceSectionLabel:f,onCreateSession:p,archiveCurrentActionLabel:y,archiveFolderActionLabel:g,onArchiveActiveSession:b,onOpenArchiveFolder:x,onActivate:S}){return e?i.jsxs("aside",{className:"mobile-conversation-preview-rail terminal-mobile-list-rail surface-card","data-dragging":n,style:{width:`${t}px`,maxWidth:`${t}px`},...s,children:[c&&p?i.jsx("div",{className:"mobile-conversation-preview-topbar terminal-mobile-list-footer",children:i.jsxs("button",{type:"button",className:"mobile-conversation-preview-create-button workbench-import-toggle terminal-mobile-list-create",onClick:p,children:[i.jsx("span",{className:"workbench-import-toggle-symbol","aria-hidden":"true",children:"+"}),i.jsx("span",{className:"workbench-import-toggle-label",children:c})]})}):null,i.jsxs("div",{className:"mobile-conversation-preview-body terminal-mobile-list-body",children:[l.length>0?i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites terminal-mobile-list-group terminal-mobile-list-group-pinned",children:[i.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[i.jsx("span",{children:h("shell.favoriteSectionTitle")}),i.jsx("span",{className:"workbench-section-counter",children:l.length})]}),i.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static terminal-mobile-session-list",children:l.map(C=>i.jsx(Tb,{entry:C.entry,depth:C.depth,activeSessionId:a,onActivate:S,workspaceName:C.entry.workspace.name},`favorite:${C.entry.workspace.id}:${C.entry.session.sessionId}`))})]}):null,i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace terminal-mobile-list-group terminal-mobile-list-group-workspace",children:[i.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[i.jsx("span",{children:f}),i.jsx("span",{className:"workbench-section-counter",children:d.length})]}),d.length===0?i.jsx("div",{className:"workbench-session-empty",children:h("shell.emptyWorkspaceSessions")}):i.jsx("div",{className:"mobile-conversation-preview-list terminal-mobile-session-list","data-preview-gesture":"ignore",children:d.map(C=>i.jsx(Tb,{entry:C.entry,depth:C.depth,activeSessionId:a,onActivate:S},`${C.entry.workspace.id}:${C.entry.session.sessionId}`))})]})]}),y&&b||g&&x?i.jsxs("div",{className:"mobile-conversation-preview-actions terminal-mobile-list-footer",children:[y&&b?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:()=>{b()},children:y}):null,g&&x?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:x,children:g}):null]}):null]}):null}function Tb({entry:e,depth:t,activeSessionId:n,onActivate:s,workspaceName:a}){const c=e.session.sessionId===n;return i.jsx("article",{className:"mobile-conversation-preview-entry terminal-mobile-session-card","data-active":c,children:i.jsxs("button",{type:"button",className:"mobile-conversation-preview-item terminal-mobile-session-primary","data-active":c,"data-depth":t,onClick:()=>s(e),children:[i.jsx("span",{className:qB(e.session,c),"aria-hidden":"true"}),i.jsxs("div",{className:"mobile-conversation-preview-item-body",children:[i.jsx("span",{className:"mobile-conversation-preview-item-title",children:e.session.title||h("common.unknown")}),i.jsx("span",{className:"mobile-conversation-preview-item-meta",children:d0(e.session,a)})]})]})})}function Eb(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function HB(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function qB(e,t){const n=op("mobile-conversation-preview-indicator",e);return n.endsWith(" is-idle")&&t?"mobile-conversation-preview-indicator is-active":n}function d0(e,t){const n=du(e);return[t??null,$B(e.provider),VB(e.lastMessageAt??e.updatedAt),n].filter(Boolean).join(" · ")}function $B(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function VB(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function GB({open:e,busy:t,onClose:n,onConfirm:s}){return v.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,n,e]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:t,onClick:n}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveConfirmTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveConfirmTitle")}),i.jsx("p",{children:h("shell.archiveConfirmDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{s()},children:h("shell.archiveAction")})]})})]})]}),document.body)}function KB({open:e,workspaceName:t,sessions:n,restoringSessionId:s,onClose:a,onRestore:c}){return v.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&!s&&a()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[a,e,s]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:!!s,onClick:a}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveModalTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveModalTitle")}),i.jsx("p",{children:t?`${t} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:n.length>0?i.jsx("div",{className:"workbench-archive-list",children:n.map(l=>{const d=ds(l.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:d.fullTitle,children:d.displayTitle}),i.jsx("p",{children:d0(l)})]}),i.jsx("button",{type:"button",className:"secondary-button",disabled:s===l.sessionId,onClick:()=>{c(l.sessionId)},children:h("shell.unarchiveAction")})]},l.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})})]})]}),document.body)}function QB(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function YB(e){return e.startsWith("draft-")}function XB(e,t){if(!t||typeof t!="object")return[];const n=t.bootstrap;if(!n||typeof n!="object")return[];const s=n.sessionId,a=n.messages;return s!==e||!Array.isArray(a)?[]:a.filter(JB)}function JB(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.messageId=="string"&&typeof t.provider=="string"&&typeof t.providerSessionId=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.timestamp=="string"&&typeof t.sequence=="number"&&typeof t.rawRef=="string"}function ZB(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function eW(){return v.useEffect(()=>{const e=document.documentElement.style.background,t=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=e,document.body.style.background=t}},[]),i.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:i.jsxs("section",{className:"desktop-detach-preview-card",children:[i.jsx("header",{className:"desktop-detach-preview-bar",children:i.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),i.jsx("div",{className:"desktop-detach-preview-body",children:i.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}function h0(e){return Qe.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function f0(e,t,n){const s=new URLSearchParams({workspaceId:e,path:t,staged:String(n)});return Qe.request(`/api/git/diff?${s.toString()}`)}function m0(e,t){return Qe.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function tW(e,t){return Qe.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function nW(e,t){return Qe.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function rW(e,t){return Qe.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function iW(e,t){return Qe.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function sW(e){return Qe.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function Rb(e,t=5,n=null){const s=new URLSearchParams({workspaceId:e,limit:String(t)});return n&&s.set("cursor",n),Qe.request(`/api/git/history?${s.toString()}`)}function oW(e){return Qe.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function aW(e,t,n){return Qe.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:n})})}function Mb(e,t,n){return Qe.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t,...n?{remote:n}:{}})})}function lW(e){return Qe.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const cW=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),uW=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),dW=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),hW=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),fW=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),mW=new Set(["trace","debug","info","warn","warning","error","fatal"]);function p0({workspaceId:e,filePath:t,open:n,onClose:s,onSaved:a,diffContent:c}){const[l,d]=v.useState(null),[f,p]=v.useState(""),[y,g]=v.useState(!1),[b,x]=v.useState(!1),[S,C]=v.useState("preview"),{showToast:j}=Yn(),R=v.useRef(s),L=v.useRef(j),A=v.useMemo(()=>v0(t),[t]),K=v.useMemo(()=>IW(c),[c]),H=A==="markdown",F=!!(l!=null&&l.supported&&l.kind==="text");if(v.useEffect(()=>{R.current=s},[s]),v.useEffect(()=>{L.current=j},[j]),v.useEffect(()=>{if(!n){d(null),p(""),g(!1),x(!1),C("preview");return}if(!e||!t)return;const G=e,X=t;let Z=!1;async function $(){g(!0);try{const se=await Aw(G,X);Z||(d(se),p(se.content??""),C((MW(X),"preview")))}catch(se){Z||(L.current({title:Ab(se,h("conversation.filePanelOpenFailed")),tone:"error"}),R.current())}finally{Z||g(!1)}}return $(),()=>{Z=!0}},[t,n,e]),v.useEffect(()=>{if(!n)return;function G(X){X.key==="Escape"&&s()}return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[s,n]),!n||!t||typeof document>"u")return null;const M=t,_=e;async function I(){if(!(!_||!(l!=null&&l.version)||!F)){x(!0);try{await iF(_,M,f,l.version);const G=await Aw(_,M);d(G),p(G.content??""),await a(M),j({title:h("conversation.filePanelSaveSuccess"),tone:"success"}),C("preview")}catch(G){j({title:Ab(G,h("conversation.filePanelSaveFailed")),tone:"error"})}finally{x(!1)}}}const P=(l==null?void 0:l.content)??"",U=F&&f!==P;return Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal",role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:h("conversation.fileViewerHint").replace("{language}",tm(A))})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:i.jsx(AW,{})})]}),i.jsxs("div",{className:"file-viewer-toolbar",children:[i.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":h("conversation.fileViewerModeLabel"),children:[i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":S==="preview",role:"tab","aria-selected":S==="preview",onClick:()=>C("preview"),children:h(H?"conversation.fileViewerPreview":"conversation.fileViewerCode")}),i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":S==="edit",role:"tab","aria-selected":S==="edit",onClick:()=>C("edit"),disabled:!F,children:h("conversation.fileViewerEdit")})]}),i.jsxs("div",{className:"file-viewer-actions",children:[i.jsx("span",{className:"file-viewer-language",children:tm(A)}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>void I(),disabled:!U||b,children:h(b?"conversation.filePanelSaving":"conversation.filePanelSave")})]})]}),i.jsx("div",{className:"workbench-modal-body file-viewer-body",children:y?i.jsx("p",{className:"status-text",children:h("common.loading")}):(l==null?void 0:l.supported)===!1?i.jsx("p",{className:"status-text",children:l.reason??h("conversation.filePanelUnsupported")}):S==="edit"?i.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:f,onChange:G=>p(G.target.value),spellCheck:!1}):H?i.jsx(pW,{content:f}):i.jsx(g0,{content:f,language:A,overviewMarkers:K})})]})]}),document.body)}function pW({content:e}){return i.jsx("div",{className:"markdown-content file-viewer-markdown",children:i.jsx(Dm,{remarkPlugins:[Bm],components:{code(t){const n=typeof t.className=="string"?t.className:"",s=/language-([\w-]+)/.exec(n);return s?i.jsx(g0,{content:String(t.children).replace(/\n$/,""),language:hp(s[1]??"plain")}):i.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function g0({content:e,language:t,overviewMarkers:n=[]}){const s=e.split(/\r?\n/),a=v.useRef(null),c=v.useMemo(()=>{const l=new Map;for(const d of n)for(let f=0;f<d.span;f++)l.set(d.line+f,d.kind);return l},[n]);return i.jsxs("div",{className:"file-viewer-code-block",children:[i.jsx("div",{className:"file-viewer-code-header",children:tm(t)}),i.jsxs("div",{className:"file-viewer-scroll-shell",children:[i.jsx("div",{className:"file-viewer-code-body",ref:a,children:s.map((l,d)=>{const f=gW(l,t),p=d+1,y=c.get(p);return i.jsxs("div",{className:`file-viewer-code-line${y?` diff-line-${y}`:""}`,children:[i.jsx("span",{className:"file-viewer-code-gutter",children:p}),i.jsx("code",{className:"file-viewer-code-content",children:f.length?f.map((g,b)=>i.jsx("span",{className:`code-token ${g.kind}`,children:g.text},`${d}-${b}-${g.text}`)):i.jsx("span",{className:"code-token plain",children:" "})})]},`${d}-${l}`)})}),i.jsx(_W,{markers:n,totalLines:s.length,scrollContainerRef:a})]})]})}function gW(e,t){const n=hp(t);return n==="json"?yW(e):n==="yaml"?xW(e):n==="toml"?kW(e):n==="ini"?y0(e):n==="env"?SW(e):n==="properties"?CW(e):n==="conf"?jW(e):n==="editorconfig"?NW(e):n==="dockerfile"?PW(e):n==="gitignore"?TW(e):n==="log"?EW(e):n==="python"?Ua(e,uW,"#"):n==="shell"?Ua(e,dW,"#"):n==="sql"?bW(e):n==="html"||n==="xml"?vW(e):n==="css"?wW(e):n==="markdown"?[{text:e,kind:"plain"}]:Ua(e,cW,"//")}function Ua(e,t,n){const s=[];let a=0;for(;a<e.length;){const c=e.slice(a);if(c.startsWith(n)){s.push({text:c,kind:"comment"});break}const l=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(c);if(l){s.push({text:l[0],kind:"string"}),a+=l[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(c);if(d){s.push({text:d[0],kind:"number"}),a+=d[0].length;continue}const f=/^[A-Za-z_][\w$-]*/.exec(c);if(f){const y=f[0],g=y.toLowerCase();y==="true"||y==="false"||g==="true"||g==="false"?s.push({text:y,kind:"boolean"}):y==="null"||y==="None"||g==="none"?s.push({text:y,kind:"null"}):t.has(y)||t.has(g)?s.push({text:y,kind:"keyword"}):s.push({text:y,kind:"plain"}),a+=y.length;continue}const p=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(c);if(p){s.push({text:p[0],kind:"operator"}),a+=p[0].length;continue}s.push({text:c[0]??"",kind:"plain"}),a+=1}return s}function yW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),a=/^"(?:[^"\\]|\\.)*"/.exec(s);if(a){const f=e.slice(n+a[0].length).trimStart()[0];t.push({text:a[0],kind:f===":"?"attr":"string"}),n+=a[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(s);if(c){t.push({text:c[0],kind:"number"}),n+=c[0].length;continue}const l=/^(?:true|false|null)\b/.exec(s);if(l){const f=l[0]==="null"?"null":"boolean";t.push({text:l[0],kind:f}),n+=l[0].length;continue}const d=/^(?::|,|\{|\}|\[|\])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function vW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("<!--")){t.push({text:s,kind:"comment"});break}const a=/^(<\/?[\w:-]+)/.exec(s);if(a){t.push({text:a[0],kind:"tag"}),n+=a[0].length;continue}const c=/^([\w:-]+)(=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:'[^']*'|"[^"]*")/.exec(s);if(l){t.push({text:l[0],kind:"string"}),n+=l[0].length;continue}const d=/^(?:\/?>)/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function wW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("/*")){t.push({text:s,kind:"comment"});break}const a=/^(?:'[^']*'|"[^"]*")/.exec(s);if(a){t.push({text:a[0],kind:"string"}),n+=a[0].length;continue}const c=/^([A-Za-z-]+)(\s*:)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:@media|@supports|@import|@keyframes)\b/.exec(s);if(d){t.push({text:d[0],kind:"keyword"}),n+=d[0].length;continue}const f=/^(?:[{}:;(),.>])/.exec(s);if(f){t.push({text:f[0],kind:"operator"}),n+=f[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function bW(e){return Ua(e,hW,"--")}function xW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const a=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(s);if(a){t.push({text:a[1]??"",kind:"attr"}),t.push({text:a[2]??"",kind:"operator"}),n+=a[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(s);if(c){t.push({text:c[0],kind:"string"}),n+=c[0].length;continue}const l=/^(?:-?\d+(?:\.\d+)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(s);if(d){const p=d[0].toLowerCase(),y=p==="null"||p==="~"?"null":"boolean";t.push({text:d[0],kind:y}),n+=d[0].length;continue}const f=/^(?:[-?:,[\]{}|>])/.exec(s);if(f){t.push({text:f[0],kind:"operator"}),n+=f[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function kW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const a=/^(\[\[?[^\]]+\]?\])/.exec(s);if(a){t.push({text:a[0],kind:"tag"}),n+=a[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=Au(s,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(l){t.push(...l.tokens),n+=l.length;continue}const d=/^(?:[,[\]{}])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function y0(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),a=s.trimStart();if(a.startsWith(";")||a.startsWith("#")){t.push({text:s,kind:"comment"});break}const c=/^(\[[^\]]+\])/.exec(s);if(c){t.push({text:c[0],kind:"tag"}),n+=c[0].length;continue}const l=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),n+=l[0].length;continue}const d=Au(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(d){t.push(...d.tokens),n+=d.length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function SW(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),s=n?n[0].length:0,a=[];n&&(a.push({text:n[1]??"",kind:"plain"}),a.push({text:n[2]??"",kind:"keyword"}),a.push({text:n[3]??"",kind:"plain"}));const c=e.slice(s),l=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(c);if(!l)return y0(e);a.push({text:l[1]??"",kind:"attr"}),a.push({text:l[2]??"",kind:"operator"});const d=c.slice(l[0].length),f=Au(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return f?(a.push(...f.tokens),a):(a.push({text:d,kind:"plain"}),a)}function CW(e){return dp(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function jW(e){return dp(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function NW(e){return dp(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function PW(e){return Ua(e,fW,"#")}function TW(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,s=e.slice(0,n),a=t.slice(1);return[{text:s,kind:"plain"},{text:"!",kind:"operator"},{text:a,kind:"string"}]}return[{text:e,kind:"string"}]}function EW(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const a=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(s);if(a){t.push({text:a[0],kind:"tag"}),n+=a[0].length;continue}const c=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(s);if(c){t.push({text:s.slice(0,c[0].length),kind:"keyword"}),n+=c[0].length;continue}const l=/^[A-Za-z_][\w-]*/.exec(s);if(l){const f=l[0];mW.has(f.toLowerCase())?t.push({text:f,kind:"keyword"}):t.push({text:f,kind:"plain"}),n+=f.length;continue}const d=/^(?:\d+(?:\.\d+)?)/.exec(s);if(d){t.push({text:d[0],kind:"number"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function dp(e,t){const n=e.trimStart();if(t.commentPrefixes.some(f=>n.startsWith(f)))return[{text:e,kind:"comment"}];if(t.allowSection){const f=/^(\[[^\]]+\])/.exec(e);if(f)return[{text:f[0],kind:"tag"}]}const s=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!s)return[{text:e,kind:"plain"}];const a=(s[2]??"").trim();if(!t.delimiters.includes(a))return[{text:e,kind:"plain"}];const c=[{text:s[1]??"",kind:"attr"},{text:s[2]??"",kind:"operator"}],l=e.slice(s[0].length),d=RW(l);return d.length&&c.push(...d),c}function RW(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),a=Au(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(a){t.push(...a.tokens),n+=a.length;continue}if(s.startsWith("#")||s.startsWith(";")){t.push({text:s,kind:"comment"});break}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function Au(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const s=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(s)return{tokens:[{text:s[0],kind:"number"}],length:s[0].length};const a=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!a)return null;const c=a[0],l=c.toLowerCase();return t.trueValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.falseValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.nullValues.includes(l)?{tokens:[{text:c,kind:"null"}],length:c.length}:{tokens:[{text:c,kind:"plain"}],length:c.length}}function v0(e){var s,a;if(!e)return"plain";const t=((s=e.split(/[\\/]/).pop())==null?void 0:s.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((a=e.split(".").pop())==null?void 0:a.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function hp(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function tm(e){switch(hp(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return h("conversation.fileViewerPlainText")}}function MW(e){return v0(e)==="markdown"}function Ab(e,t){return e instanceof lr?e.message:t}function AW(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function LW(e){const t=[],n=e.replace(/\r\n/g,`
|
|
107
|
+
`).split(`
|
|
108
|
+
`);let s=0,a=0;for(const c of n){if(c.startsWith("diff --git")||c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ ")){t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null});continue}const l=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(c);if(l){s=parseInt(l[1],10),a=parseInt(l[2],10),t.push({kind:"hunk",text:c,oldLineNo:null,newLineNo:null});continue}if(c.startsWith(" ")||c===""){t.push({kind:"context",text:c.slice(1),oldLineNo:s,newLineNo:a}),s++,a++;continue}if(c.startsWith("+")){t.push({kind:"add",text:c.slice(1),oldLineNo:null,newLineNo:a}),a++;continue}if(c.startsWith("-")){t.push({kind:"remove",text:c.slice(1),oldLineNo:s,newLineNo:null}),s++;continue}t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null})}return t}function IW(e){if(!(e!=null&&e.trim()))return[];const t=LW(e),n=[];let s=0,a=[];function c(){if(a.length===0){s=0;return}const l=s>0?"modify":"add";DW(n,a,l),s=0,a=[]}for(const l of t){if(l.kind==="remove"){s+=1;continue}if(l.kind==="add"){l.newLineNo!==null&&a.push(l.newLineNo);continue}c()}return c(),n}function DW(e,t,n){const s=t.filter(l=>l>0);if(s.length===0)return;let a=s[0]??1,c=a;for(let l=1;l<s.length;l+=1){const d=s[l]??c;if(d===c+1){c=d;continue}e.push({line:a,span:c-a+1,kind:n}),a=d,c=d}e.push({line:a,span:c-a+1,kind:n})}function _W({markers:e,totalLines:t,scrollContainerRef:n}){const[s,a]=v.useState({top:0,height:0});if(v.useEffect(()=>{const l=n.current;if(!l){a({top:0,height:0});return}const d=l;function f(){const{clientHeight:p,scrollHeight:y,scrollTop:g}=d;if(y<=0||p<=0||y<=p){a({top:0,height:0});return}const b=p/y,x=Math.min(100,Math.max(12,b*100)),S=y-p,C=Math.max(0,100-x),j=S<=0?0:g/S*C;a({top:j,height:x})}return f(),d.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",f),()=>{d.removeEventListener("scroll",f),window.removeEventListener("resize",f)}},[n]),e.length===0&&s.height===0)return null;const c=Math.max(t,1);return i.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(l=>{const d=(l.line-1)/c*100,f=Math.max(2,l.span/c*100);return i.jsx("div",{className:`file-overview-marker is-${l.kind}`,"data-kind":l.kind,style:{top:`${d}%`,height:`${f}%`}},`${l.kind}-${l.line}-${l.span}`)}),s.height>0?i.jsx("div",{className:"file-overview-viewport",style:{top:`${s.top}%`,height:`${s.height}%`}}):null]})}function Bs(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function Ws(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}const FW=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),OW=["._"];function BW(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function WW(e){const t=e.trim().toLowerCase();return t?FW.has(t)||OW.some(n=>t.startsWith(n)):!1}function fp(e,t,n){return n?[...e]:e.filter(s=>!WW(t(s)))}function Hc(e,t){return fp(e,n=>n.name,t)}function UW(e,t){return t?e:Object.entries(e).reduce((n,[s,a])=>(n[s]=Hc(a,!1),n),{})}async function rf(e,t){const[n,s]=await Promise.all([h0(t),oE(e)]);return zW(n.changes,s.items)}function zW(e,t){const n=new Set(t.map(s=>$c(s.path)));return e.filter(s=>n.has($c(s.path))||s.oldPath!==null&&n.has($c(s.oldPath)))}function HW(e){const t=Lb("","");for(const n of e){const s=$c(n.path),a=s.split("/").filter(Boolean);let c=t;a.forEach((l,d)=>{const f=a.slice(0,d+1).join("/");if(d===a.length-1){c.children.set(`file:${f}`,{kind:"file",name:l,path:s,change:n});return}const p=`directory:${f}`,y=c.children.get(p);if(y&&y.kind==="directory"){c=y;return}const g=Lb(l,f);c.children.set(p,g),c=g})}return x0(b0([...t.children.values()]))}function w0(e,t){const n=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return mp(e)?`${n} ${t}`:n}function mp(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function qc(e){return e.split("/").filter(Boolean).pop()??e}function $c(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function Lb(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function b0(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:b0([...t.children.values()])}:t)}function x0(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=x0(t.children);let s=t.name,a=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,a=d.path,c=d.children}return{kind:"directory",name:s,path:a,children:c}})}const qW=450,$W=60*1e3,Ib=20,Db=16;function VW({sessionId:e,workspaceId:t,showSystemFiles:n,selectedPath:s,refreshVersion:a,onCountChange:c,onSelectFile:l,onOpenFile:d}){const[f,p]=v.useState("tree"),[y,g]=v.useState([]),[b,x]=v.useState(!0),[S,C]=v.useState(!1),[j,R]=v.useState([]),L=v.useRef(null),{showToast:A}=Yn();v.useEffect(()=>{const X=On(Tc(t,e),$W);p("tree"),g(X??[]),x(X===null),C(!1),R([]),L.current=null},[e,t]),v.useEffect(()=>{let X=!1;async function Z(){x(!0);try{const $=await rf(e,t);X||(g($),Mr(Tc(t,e),$))}catch($){X||A({title:sf($,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{X||x(!1)}}return Z(),()=>{X=!0}},[a,e,A,t]);async function K(){x(!0);try{const X=await rf(e,t);g(X),Mr(Tc(t,e),X)}catch(X){A({title:sf(X,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{x(!1)}}async function H(){if(P.length!==0){C(!0);try{await m0(t,P.map(Z=>Z.path));const X=await rf(e,t);g(X),Mr(Tc(t,e),X),A({title:h("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(X){A({title:sf(X,h("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function F(X){R(Z=>Z.includes(X)?Z.filter($=>$!==X):[...Z,X])}function M(X){const Z=Date.now(),$=L.current;return L.current={filePath:X,timestamp:Z},($==null?void 0:$.filePath)===X&&Z-$.timestamp<=qW}async function _(X,Z){if(Z&&M(X)){await d(X),L.current=null;return}Z||(L.current=null),await l(X)}const I=v.useMemo(()=>fp(y,X=>qc(X.path),n),[y,n]),P=I.filter(X=>!X.staged),U=HW(I),G=new Set(j);return v.useEffect(()=>{c==null||c(I.length)},[c,I.length]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"file-panel-session-toolbar",children:[i.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":h("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:f==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":f==="tree",onClick:()=>p("tree"),children:h("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:f==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":f==="list",onClick:()=>p("list"),children:h("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void K(),disabled:b||S,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void H(),disabled:S||P.length===0,children:h("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${h("conversation.filePanelSessionSummary")} ${I.length}`}),i.jsx("span",{children:`${h("conversation.filePanelSessionUnstagedSummary")} ${P.length}`})]}),i.jsx("div",{className:"file-tree",children:b?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionLoading")}):I.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionEmpty")}):f==="tree"?k0({nodes:U,depth:0,collapsedPathSet:G,selectedPath:s,onToggleTreePath:F,onFileClick:_}):GW({items:I,selectedPath:s,onFileClick:_})})]})}function k0({nodes:e,depth:t,collapsedPathSet:n,selectedPath:s,onToggleTreePath:a,onFileClick:c}){return e.map(l=>{if(l.kind==="directory"){const d=!n.has(l.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":d,style:{paddingInlineStart:`${Ib+t*Db}px`},onClick:()=>a(l.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),i.jsx("span",{className:"file-tree-label",children:l.name})]}),d?i.jsx("div",{className:"file-tree-children",children:k0({nodes:l.children,depth:t+1,collapsedPathSet:n,selectedPath:s,onToggleTreePath:a,onFileClick:c})}):null]},`session-directory:${l.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":s===l.change.path,"data-kind":"file",style:{paddingInlineStart:`${Ib+t*Db}px`},onClick:()=>void c(l.change.path,!mp(l.change)),children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(l.name),"aria-hidden":"true",children:Bs(l.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:l.name}),i.jsx("span",{className:"file-tree-path",children:w0(l.change,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":l.change.status,children:l.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:l.change.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-file:${l.path}`)})}function GW({items:e,selectedPath:t,onFileClick:n}){return e.map(s=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===s.path,onClick:()=>void n(s.path,!mp(s)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(qc(s.path)),"aria-hidden":"true",children:Bs(qc(s.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:qc(s.path)}),i.jsx("span",{className:"file-tree-path",children:w0(s,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":s.status,children:s.status}),i.jsx("span",{className:"file-session-badge subtle",children:s.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-list:${s.path}`))}function Tc(e,t){return`file-panel.session-changes.${e}.${t}`}function sf(e,t){return e instanceof lr?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const kn="",KW=450,QW=300*1e3,YW=60*1e3,XW=1600,JW=20,ZW=16;function pp({className:e,sessionId:t,workspaceId:n,hideHeading:s=!1,externalRevealRequest:a=null,externalWindowMode:c=!1,workbenchShellOverrides:l}){var _t;const d=ur(),{navigationGroups:f,subscribeFileTree:p,requestFileTreeRefresh:y,addFileTreeSnapshotListener:g,subscribeGitSnapshot:b,requestGitRefresh:x,addGitSnapshotListener:S}={...d,...l},[C,j]=v.useState({}),[R,L]=v.useState([]),[A,K]=v.useState([]),[H,F]=v.useState(kn),[M,_]=v.useState(null),[I,P]=v.useState(!1),[U,G]=v.useState(!1),[X,Z]=v.useState(!1),[$,se]=v.useState(!1),[Y,q]=v.useState(""),[oe,E]=v.useState(null),[B,te]=v.useState(!1),[T,we]=v.useState(null),[me,Ce]=v.useState("workspace"),[_e,Ge]=v.useState(0),[ot,mt]=v.useState(0),[jt,yt]=v.useState(!1),[St,Lt]=v.useState(!1),[vt,zt]=v.useState([]),[Rt,ft]=v.useState(!1),[tn,qt]=v.useState(null),Ot=v.useRef({}),tt=v.useRef([]),$t=v.useRef(kn),gt=v.useRef(!1),Vt=v.useRef(null),ue=v.useRef(null),ve=v.useRef(null),Le=v.useRef(null),Ke=v.useRef(null),nt=v.useRef(0),wt=v.useRef(new Map),{showToast:Dt}=Yn(),Pt=Mn(),Ze=Ti(O=>O.showSystemFiles),Wt=!!(t!=null&&t.trim()),ct=s&&Pt.isMobile;v.useEffect(()=>{Kt("file_panel.props",{sessionId:t,workspaceId:n,externalWindowMode:c})},[c,t,n]),v.useEffect(()=>{$t.current=H},[H]);function It(O){j(xe=>{const ge=typeof O=="function"?O(xe):O;return Ot.current=ge,ge})}function Mt(O){L(xe=>{const ge=typeof O=="function"?O(xe):O;return tt.current=ge,ge})}v.useEffect(()=>{var ht,on;if(We(),!n){We(),gt.current=!1,Ot.current={},tt.current=[],$t.current=kn,It({}),Mt([]),K([]),F(kn),se(!1),q(""),E(null),te(!1),P(!1),ft(!1),qt(null);return}gt.current=!0;const O=On(Ob(n),QW);Kt("file_panel.workspace_snapshot",{workspaceId:n,cached:!!O,cachedRootItems:((on=(ht=O==null?void 0:O.treeCache)==null?void 0:ht[kn])==null?void 0:on.length)??0,cachedDirectoryCount:Object.keys((O==null?void 0:O.treeCache)??{}).length});const xe=uU((O==null?void 0:O.activeDirectoryPath)??kn,(O==null?void 0:O.treeCache)??{}),ge=Fb((O==null?void 0:O.expandedDirectories)??[],xe),ze=Ec((O==null?void 0:O.treeCache)??{},xe,ge);Ot.current=ze,tt.current=ge,$t.current=xe,It(ze),Mt(ge),K([]),F(xe),P(!1),G(!1),se(!1),q(""),E(null),te(!1),queueMicrotask(()=>{gt.current=!1})},[n]),v.useEffect(()=>{if(!a||a.workspaceId!==n)return;const O=()=>{if(Ke.current===a.requestId)return;Ke.current=a.requestId,Ce("workspace"),(a.openViewer?De(a.filePath):Re(a.filePath)).catch(ge=>{Dt({title:es(ge,h("conversation.filePanelOpenFailed")),tone:"error"})})};if(gt.current){queueMicrotask(O);return}O()},[a,De,Re,Dt,n]),v.useEffect(()=>{if(n)return g(O=>{O.workspaceId===n&&(It(xe=>({...xe,[O.path]:O.items})),O.path===kn&&P(!1),K(xe=>xe.filter(ge=>ge!==O.path)),be(O.path,O.items))})},[g,n]),v.useEffect(()=>()=>{We()},[]),v.useEffect(()=>{n&&p(n,of(tt.current,$t.current))},[H,R,p,n]),v.useEffect(()=>{_(null),we(null),qt(null),Ge(0),yt(!1),Lt(!1),Vt.current=null,nt.current+=1},[t]),v.useEffect(()=>{!Wt&&me==="session"&&Ce("workspace")},[me,Wt]),v.useEffect(()=>{if(!jt&&!St)return;function O(ge){var on,cn;if(!(ge.target instanceof Node))return;const ze=((on=ue.current)==null?void 0:on.contains(ge.target))??!1,ht=((cn=ve.current)==null?void 0:cn.contains(ge.target))??!1;!ze&&!ht&&(yt(!1),Lt(!1))}function xe(ge){ge.key==="Escape"&&(yt(!1),Lt(!1))}return document.addEventListener("pointerdown",O),document.addEventListener("keydown",xe),()=>{document.removeEventListener("pointerdown",O),document.removeEventListener("keydown",xe)}},[jt,St]),v.useEffect(()=>{if(!n)return;const O=Fb(R,H),xe=Ec(C,H,O);Mr(Ob(n),{treeCache:xe,expandedDirectories:O,activeDirectoryPath:H})},[H,R,C,n]),v.useEffect(()=>{if(gt.current)return;const O=Ec(C,H,R);hU(C,O)||It(O)},[H,R,C]),v.useEffect(()=>{let O=!1;const xe=(n==null?void 0:n.trim())??null;async function ge(ht){if(!xe)return;const on=Hc(Ot.current[kn]??[],Ze),cn=(ht==null?void 0:ht.silent)!==!0&&on.length===0;cn&&P(!0),Kt("file_panel.load_root_tree.start",{sessionId:t,workspaceId:xe,silent:(ht==null?void 0:ht.silent)===!0,cachedRootItems:on.length});try{const ir=await re(kn,{force:!0});O||(Kt("file_panel.load_root_tree.end",{sessionId:t,workspaceId:xe,itemCount:ir.length}),It(hs=>({...Ec(hs,$t.current,tt.current),[kn]:ir})))}catch(ir){!O&&!Bb(ir)&&Dt({title:es(ir,h("conversation.filePanelLoadFailed")),tone:"error"})}finally{!O&&cn&&P(!1)}}if(Hc(Ot.current[kn]??[],Ze).length>0){const ht=window.setTimeout(()=>{xe&&(p(xe,of(tt.current,$t.current)),ge({silent:!0}))},1500);return()=>{O=!0,window.clearTimeout(ht)}}return ge(),()=>{O=!0}},[t,Ze,Dt,n]),v.useEffect(()=>{if(!n||!t){mt(0);return}const O=On(fU(n,t),YW);Kt("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:n,cached:O!==null,cachedCount:O}),mt(O??0)},[t,_e,n]),v.useEffect(()=>{if(!n){zt([]);return}const O=n.trim();b(O),x(O)},[n,b,x]),v.useEffect(()=>{if(!n)return;const O=n.trim();return S(xe=>{var ge;xe.workspaceId===O&&zt(((ge=xe.status)==null?void 0:ge.changes)??[])})},[S,n]);const Xt=v.useMemo(()=>fp(vt,O=>BW(O.path),Ze),[vt,Ze]),ee=v.useMemo(()=>{const O=new Map,xe=new Set;for(const ge of Xt){const ze=ge.path.replace(/\\/g,"/"),ht=ge.worktreeStatus??ge.stagedStatus??ge.status;O.set(ze,ht);const on=ze.split("/");for(let cn=1;cn<on.length;cn++)xe.add(on.slice(0,cn).join("/"))}return{statusByPath:O,changedDirs:xe}},[Xt]),Ie=v.useMemo(()=>UW(C,Ze),[Ze,C]),at=v.useMemo(()=>oe===null?null:Hc(oe,Ze),[oe,Ze]),Nt=Ie[kn]??[],Se=$&&at!==null,Ye=((_t=f.find(O=>O.workspace.id===n))==null?void 0:_t.workspace)??null,Ut=nU(M,H),nn=!!(Ye!=null&&Ye.path&&Ut!==null),fn=!!M,Nn=!!((M?Ia(M):H)&&R.length);async function wn(O,xe=!1){if(!n)return[];if(!xe){const ge=Ot.current[O];if(ge)return ge}O===kn?P(!0):K(ge=>Vc(ge,O));try{const ge=await re(O,{force:xe});return It(ze=>({...ze,[O]:ge})),ge}catch(ge){throw Bb(ge)||Dt({title:es(ge,h("conversation.filePanelLoadFailed")),tone:"error"}),ge}finally{O===kn?P(!1):K(ge=>ge.filter(ze=>ze!==O))}}async function V(){if(!n)return;const O=dU(Ot.current,H,tt.current);Kt("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:n,targetDirectories:O});const ge=(await Promise.all(O.map(async ze=>{const ht=await re(ze,{force:!0});return[ze,ht]}))).reduce((ze,[ht,on])=>(ze[ht]=on,ze),{});Kt("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:n,targetDirectories:O,directoryCount:Object.keys(ge).length}),It(ge)}async function re(O,xe){if(!n)return[];if(!(xe!=null&&xe.force)){const ze=Ot.current[O];if(ze)return ze}const ge=of(Vc(tt.current,O),O||$t.current);return p(n,ge),y(n,[O]),de(O)}function de(O,xe=XW){const ge=Ot.current[O];return ge?Promise.resolve(ge):new Promise((ze,ht)=>{const on=window.setTimeout(()=>{Ee(O,on),ht(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${O}`))},xe),cn=wt.current.get(O)??[];wt.current.set(O,[...cn,{resolve:ze,reject:ht,timerId:on}])})}function be(O,xe){const ge=wt.current.get(O)??[];ge.length!==0&&(wt.current.delete(O),ge.forEach(ze=>{window.clearTimeout(ze.timerId),ze.resolve(xe)}))}function Ee(O,xe){const ze=(wt.current.get(O)??[]).filter(ht=>ht.timerId!==xe);if(ze.length===0){wt.current.delete(O);return}wt.current.set(O,ze)}function We(){for(const[O,xe]of wt.current.entries())xe.forEach(ge=>{window.clearTimeout(ge.timerId),ge.reject(new Error(`FILE_TREE_ABORTED:${O}`))});wt.current.clear()}async function $e(O,xe=!1){const ge=Xa(O,xe);if(!ge.length){F(kn);return}Mt(ze=>N0(ze,ge)),F(ge[ge.length-1]??kn);for(const ze of ge)try{await wn(ze)}catch{return}}async function Re(O){_(O),F(Ia(O)),await $e(O)}async function De(O){we(O),qt(null),Vt.current=null,nt.current+=1,Re(O);const xe=nt.current,ge=O.replace(/\\/g,"/"),ze=ee.statusByPath.get(ge);if(n&&ze&&ze!=="?"&&ze!=="D")try{const ht=await f0(n,O,!1);nt.current===xe&&qt(ht.content||null)}catch{nt.current===xe&&qt(null)}}function Fe(O){const xe=Date.now(),ge=Vt.current;return Vt.current={filePath:O,timestamp:xe},(ge==null?void 0:ge.filePath)===O&&xe-ge.timestamp<=KW}function Oe(){Vt.current=null}async function dt(O){if(Fe(O)){await De(O);return}await Re(O)}function ut(){se(!1),q(""),E(null),Oe()}async function Gt(O){if(O.kind==="directory"){ut(),await Tt(O.path);return}if(Fe(O.path)){ut(),await De(O.path);return}await Re(O.path)}async function Tt(O){if(_(null),F(O),!tt.current.includes(O))try{await wn(O),Mt(xe=>Vc(xe,O))}catch{}}async function Ue(O){if(_(null),F(O),tt.current.includes(O)){ae(O);return}await Tt(O)}function ae(O){Mt(xe=>xe.filter(ge=>ge!==O&&!ge.startsWith(`${O}/`))),F(Ia(O)),_(null)}async function je(){if(!n)return;const O=n;try{if(x(O),await V(),M&&await $e(M),Se&&Y.trim()){const xe=await qf(O,Y.trim());E(xe.items)}}catch(xe){Dt({title:es(xe,h("conversation.filePanelLoadFailed")),tone:"error"})}}async function Xe(O){if(O==null||O.preventDefault(),!n||!Y.trim()){E(null);return}te(!0);try{const xe=await qf(n,Y.trim());E(xe.items)}catch(xe){Dt({title:es(xe,h("conversation.filePanelSearchFailed")),tone:"error"})}finally{te(!1)}}function rt(){if($){se(!1),q(""),E(null);return}se(!0)}function He(O){Lt(!1),O()}function At(){var O;(O=Le.current)==null||O.click()}async function Ct(O){var on;const xe=((on=O.target.files)==null?void 0:on[0])??null;if(O.target.value="",!xe||!n)return;const ge=tU(xe.name);if(!ge){Dt({title:h("conversation.filePanelUploadFailed"),tone:"error"});return}const ze=_b(H,M),ht=eU(ze,ge);Z(!0);try{const cn=await sU(xe);await oF({workspaceId:n,path:ht,contentBase64:cn}),await V(),await Re(ht),Dt({title:h("conversation.filePanelUploadSuccess",{name:ge}),tone:"success"})}catch(cn){Dt({title:es(cn,h("conversation.filePanelUploadFailed")),tone:"error"})}finally{Z(!1)}}async function Q(){if(!(!n||!M)){Z(!0);try{const O=await aF(n,M),xe=oU(O.contentBase64);aU(O.fileName,new Blob([xe],{type:"application/octet-stream"})),Dt({title:h("conversation.filePanelDownloadSuccess",{name:O.fileName}),tone:"success"})}catch(O){Dt({title:es(O,h("conversation.filePanelDownloadFailed")),tone:"error"})}finally{Z(!1)}}}function ke(){const O=M?Ia(M):H;!O||!tt.current.includes(O)||ae(O)}async function D(O){if(!n)return;const xe=_b(H,M),ge=xe?`${xe}/`:"",ze=window.prompt(h(O==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),ge);if(!(ze!=null&&ze.trim()))return;const ht=ze.trim();G(!0);try{await sF({workspaceId:n,opType:O,dstPath:ht,content:O==="create_file"?"":void 0}),await V(),O==="create_directory"?(await $e(ht,!0),_(null)):await Re(ht)}catch(on){Dt({title:es(on,h("conversation.filePanelMutateFailed")),tone:"error"})}finally{G(!1)}}async function he(O){const xe=(Ye==null?void 0:Ye.path)??"";if(Ut===null||!xe){yt(!1);return}try{const ge=iU(xe),ze=O==="absolute"?rU(xe,Ut,ge):S0(Ut,ge);await lU(ze,Pt),Dt({title:h(O==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(ge){Dt({title:ge instanceof Error?ge.message:h("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{yt(!1)}}function ie(O,xe){return i.jsx(i.Fragment,{children:O.map(ge=>{const ze=ge.kind==="directory",ht=ze&&R.includes(ge.path),on=ze&&A.includes(ge.path),cn=Ie[ge.path]??[],ir=Rt?af(cn,Ie,ee.statusByPath,ee.changedDirs):cn,hs=M===ge.path||M===null&&ze&&H===ge.path,yi=ee.statusByPath.get(ge.path.replace(/\\/g,"/")),Li=ze&&ee.changedDirs.has(ge.path.replace(/\\/g,"/"));return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":hs,"data-kind":ge.kind,"aria-expanded":ze?ht:void 0,style:{paddingInlineStart:`${JW+xe*ZW}px`},onClick:()=>{if(ze){Oe(),Ue(ge.path);return}dt(ge.path)},children:[i.jsx("span",{className:`file-tree-chevron${ze?"":" is-hidden"}`,"aria-hidden":"true",children:ht?"v":">"}),ze?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(ge.name),"aria-hidden":"true",children:Bs(ge.name)}),i.jsx("span",{className:"file-tree-label","data-status":yi??void 0,"data-has-changes":Li||void 0,children:ge.name}),!ze&&yi?i.jsx("span",{className:"git-status-badge","data-status":yi,"aria-label":yi,children:yi}):null,ze&&Li?i.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,on?i.jsx("span",{className:"file-tree-meta",children:h("common.loading")}):null]}),ze&&ht?i.jsx("div",{className:"file-tree-children",children:on&&!cn.length?i.jsx("p",{className:"file-tree-empty",children:h("common.loading")}):ir.length?ie(ir,xe+1):i.jsx("p",{className:"file-tree-empty",children:h("conversation.filePanelEmptyDirectory")})}):null]},`${ge.kind}-${ge.path}`)})})}function it(O){return i.jsx(i.Fragment,{children:O.map(xe=>{const ge=xe.kind==="directory",ze=M===xe.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":ze,"data-kind":xe.kind,onClick:()=>{Gt(xe)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),ge?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(xe.name),"aria-hidden":"true",children:Bs(xe.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:xe.name}),i.jsx("span",{className:"file-tree-path",children:xe.path})]})]})},`search-${xe.kind}-${xe.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:n?i.jsxs(i.Fragment,{children:[i.jsx(p0,{workspaceId:n,filePath:T,open:T!==null,onClose:()=>{nt.current+=1,we(null),qt(null)},onSaved:async O=>{await V(),await Re(O),Ge(xe=>xe+1)},diffContent:tn}),s?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:h("conversation.filePanelTitle")})}),i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":h("conversation.filePanelTitle"),children:[i.jsx("button",{className:me==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":me==="workspace",onClick:()=>Ce("workspace"),children:h("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:me==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":me==="session",onClick:()=>{Wt&&Ce("session")},disabled:!Wt,children:[h("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${h("conversation.filePanelSessionTab")} ${ot}`,children:ot})]})]}),me==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:Le,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:O=>void Ct(O)}),ct?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":h("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:ve,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":h("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":St,"data-active":St,onClick:()=>{yt(!1),Lt(O=>!O)},children:[i.jsx("span",{children:h("conversation.filePanelActionsMenu")}),i.jsx(xU,{})]}),St?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":h("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Lt(!1),rt()},children:h($?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Lt(!1),ft(O=>!O)},disabled:Xt.length===0,children:h(Rt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(je),disabled:I||U||B,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Lt(!1),ke()},disabled:!Nn,children:h("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Lt(!1),At()},disabled:U||X,children:h("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(Q),disabled:!fn||X,children:h("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(()=>D("create_file")),disabled:U||X,children:h("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(()=>D("create_directory")),disabled:U||X,children:h("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(()=>he("absolute")),disabled:!nn,children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>He(()=>he("relative")),disabled:!nn,children:h("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":h("conversation.filePanelTitle"),children:[i.jsxs("div",{className:"file-toolbar-menu-shell",ref:ue,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCopyPath"),"aria-label":h("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":jt,"data-active":jt,onClick:()=>{Lt(!1),yt(O=>!O)},disabled:!nn,children:i.jsx(gU,{})}),jt?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void he("absolute"),children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void he("relative"),children:h("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCollapseCurrent"),"aria-label":h("conversation.filePanelCollapseCurrent"),onClick:ke,disabled:!Nn,children:i.jsx(mU,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelRefresh"),"aria-label":h("conversation.filePanelRefresh"),onClick:()=>void je(),disabled:I||U||B,children:i.jsx(pU,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),"data-active":$,onClick:rt,disabled:I,children:i.jsx(Wb,{})}),Xt.length>0?i.jsx("button",{className:"file-toolbar-button",type:"button",title:h(Rt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":h(Rt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":Rt,onClick:()=>ft(O=>!O),children:i.jsx(kU,{})}):null,i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelUpload"),"aria-label":h("conversation.filePanelUpload"),onClick:At,disabled:U||X,children:i.jsx(vU,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelDownload"),"aria-label":h("conversation.filePanelDownload"),onClick:()=>void Q(),disabled:!fn||X,children:i.jsx(wU,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewFile"),"aria-label":h("conversation.filePanelNewFile"),onClick:()=>void D("create_file"),disabled:U||X,children:i.jsx(yU,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewDirectory"),"aria-label":h("conversation.filePanelNewDirectory"),onClick:()=>void D("create_directory"),disabled:U||X,children:i.jsx(bU,{})})]}),$?i.jsxs("form",{className:"file-toolbar-search",onSubmit:O=>void Xe(O),children:[i.jsx("input",{value:Y,onChange:O=>q(O.target.value),placeholder:h("conversation.filePanelSearchPlaceholder")}),ct?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":h("conversation.filePanelSearchButton"),disabled:B,children:h("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),disabled:B,children:i.jsx(Wb,{})})]}):null,i.jsx("div",{className:"file-tree","data-search-mode":Se,children:I&&Nt.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("common.loading")}):Se?at!=null&&at.length?it(at):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSearchEmpty")}):Rt?af(Nt,Ie,ee.statusByPath,ee.changedDirs).length?ie(af(Nt,Ie,ee.statusByPath,ee.changedDirs),0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelNoChanges")}):Nt.length?ie(Nt,0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelEmptyDirectory")})})]}):Wt&&t?i.jsx(VW,{sessionId:t,workspaceId:n,showSystemFiles:Ze,selectedPath:M,refreshVersion:_e,onCountChange:mt,onSelectFile:Re,onOpenFile:De}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelNoWorkspace")})})})}function Ia(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):kn}function Xa(e,t=!1){const n=e.split("/").filter(Boolean),s=t?n.length:n.length-1,a=[];for(let c=0;c<s;c+=1)a.push(n.slice(0,c+1).join("/"));return a}function _b(e,t){return e||(t?Ia(t):kn)}function eU(e,t){return e?`${e}/${t}`:t}function tU(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function nU(e,t){return e||t||null}function S0(e,t="posix"){return e?C0(e,t):"."}function rU(e,t,n){const s=C0(e,n),a=S0(t,n).replace(/^\.[/\\]?/,"");if(!a)return s;const c=j0(n),l=a.replace(/^[/\\]+/,"");return l?s.endsWith("/")||s.endsWith("\\")?`${s}${l}`:`${s}${c}${l}`:s}function iU(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function C0(e,t){return e&&(j0(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function j0(e){return e==="windows"?"\\":"/"}async function sU(e){const t=await e.arrayBuffer(),n=new Uint8Array(t),s=32768;let a="";for(let c=0;c<n.length;c+=s){const l=n.subarray(c,c+s);a+=String.fromCharCode(...l)}return btoa(a)}function oU(e){const t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)n[s]=t.charCodeAt(s);return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function aU(e,t){if(typeof document>"u")throw new Error(h("conversation.filePanelDownloadFailed"));const n=window.URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=e,document.body.append(s),s.click(),s.remove(),window.URL.revokeObjectURL(n)}async function lU(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!cU(e))throw new Error(h("conversation.filePanelCopyPathFailed"))}}function cU(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}function uU(e,t){return e&&Xa(e,!0).every(a=>a in t)?e:kn}function Fb(e,t){if(!t)return[];const n=Xa(t,!0);return e.filter(s=>n.includes(s))}function Ec(e,t,n){const s=gp(t,n);return Object.entries(e).reduce((a,[c,l])=>(s.has(c)&&(a[c]=l),a),{})}function dU(e,t,n){const a=[...gp(t,n)].filter(c=>c===kn||c in e);return a.length?a:[kn]}function gp(e,t){const n=new Set([kn]),s=N0(t,Xa(e,!0));for(const a of s){n.add(a);for(const c of Xa(a,!0))n.add(c)}return n}function hU(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(a=>e[a]===t[a])}function Vc(e,t){return e.includes(t)?e:[...e,t]}function N0(e,t){return t.reduce((n,s)=>Vc(n,s),e)}function Ob(e){return`file-panel.workspace-tree.${e}`}function fU(e,t){return`file-panel.session-change-count.${e}.${t}`}function of(e,t){return[...gp(t,e)]}function es(e,t){return e instanceof lr?e.message:t}function Bb(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function mU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function pU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function Wb(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function gU(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function yU(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function vU(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wU(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function bU(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function xU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function kU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function af(e,t,n,s){const a=[];for(const c of e){const l=c.path.replace(/\\/g,"/");c.kind==="file"?n.has(l)&&a.push(c):P0(l,t,n,s)&&a.push(c)}return a}function P0(e,t,n,s,a){const c=a??new Set;if(c.has(e))return!1;c.add(e);const l=t[e];if(!l)return s.has(e);for(const d of l){const f=d.path.replace(/\\/g,"/");if(d.kind==="file"){if(n.has(f))return!0}else if(P0(f,t,n,s,c))return!0}return!1}const SU=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:pp},Symbol.toStringTag,{value:"Module"})),lf=56,Ub=28,cf=72,Rc=8,zb=960,Hb=60*1e3,qb=20,$b=9,Vb=9,uf=68;function yp({className:e,workspaceId:t,panelActive:n=!0,externalWindowMode:s=!1,workbenchShellOverrides:a}){const c=ur(),{subscribeGitSnapshot:l,requestGitRefresh:d,addGitSnapshotListener:f}={...c,...a},[p,y]=v.useState(null),[g,b]=v.useState([]),[x,S]=v.useState(0),[C,j]=v.useState(null),[R,L]=v.useState(!1),[A,K]=v.useState(null),[H,F]=v.useState(null),[M,_]=v.useState(""),[I,P]=v.useState(!1),[U,G]=v.useState(!1),[X,Z]=v.useState([]),[$,se]=v.useState(!0),[Y,q]=v.useState(!1),[oe,E]=v.useState(()=>typeof window<"u"?window.innerWidth<=zb:!1),[B,te]=v.useState([]),[T,we]=v.useState(null),[me,Ce]=v.useState("unstaged"),[_e,Ge]=v.useState(null),[ot,mt]=v.useState(!1),[jt,yt]=v.useState([]),[St,Lt]=v.useState(!1),[vt,zt]=v.useState(new Set),[Rt,ft]=v.useState(new Map),[tn,qt]=v.useState(null),[Ot,tt]=v.useState(lf),[$t,gt]=v.useState(!1),[Vt,ue]=v.useState(null),[ve,Le]=v.useState(null),Ke=v.useRef(null),nt=v.useRef(null),wt=v.useRef(null),Dt=v.useRef(null),Pt=v.useRef(n),{showToast:Ze}=Yn();v.useEffect(()=>{Kt("git_sidebar.props",{workspaceId:t,externalWindowMode:s})},[s,t]),v.useEffect(()=>{Z([]),se(!0),S(0),j(null),L(!1),F(null),_(""),q(!1),te([]),we(null),Ce("unstaged"),Ge(null),qt(null),gt(!1),tt(lf),ue(null),Le(null)},[t]),v.useEffect(()=>{function Q(){E(window.innerWidth<=zb)}return Q(),window.addEventListener("resize",Q),()=>{window.removeEventListener("resize",Q)}},[]),v.useEffect(()=>{if(!$t)return;const Q=document.body.style.cursor,ke=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function D(ie){Ee(ie.clientY)}function he(){gt(!1)}return window.addEventListener("pointermove",D),window.addEventListener("pointerup",he),()=>{document.body.style.cursor=Q,document.body.style.userSelect=ke,window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",he)}},[$t]),v.useEffect(()=>{var D,he;if(!(t!=null&&t.trim())){y(null),b([]),S(0),j(null),K(null),P(!1);return}const Q=t.trim(),ke=On(hf(Q),Hb);if(Kt("git_sidebar.snapshot",{workspaceId:Q,cached:!!ke,cachedHistoryCount:((D=ke==null?void 0:ke.history)==null?void 0:D.length)??0,cachedChangedCount:((he=ke==null?void 0:ke.status)==null?void 0:he.changes.length)??0}),ke){ct(ke),P(!1);return}y(null),b([]),S(0),j(null),K(null),P(!0)},[t]),v.useEffect(()=>{if(t!=null&&t.trim())return f(Q=>{var ke,D,he;Q.workspaceId===t.trim()&&(Kt("git_sidebar.snapshot_received",{workspaceId:Q.workspaceId,changedCount:((ke=Q.status)==null?void 0:ke.changes.length)??0,historyCount:Q.history.length,branchCount:(((D=Q.branches)==null?void 0:D.local.length)??0)+(((he=Q.branches)==null?void 0:he.remote.length)??0)}),ct(Q),P(!1))})},[f,t]),v.useEffect(()=>{if(!(t!=null&&t.trim()))return;const Q=t.trim(),ke=On(hf(Q),Hb)!==null;if(l(Q),ke){d(Q);return}It()},[d,l,t]),v.useEffect(()=>{const Q=Pt.current;Pt.current=n,t!=null&&t.trim()&&!Q&&n&&d(t.trim())},[n,d,t]),v.useEffect(()=>{t&&Mr(hf(t),{status:p,history:g,historyTotalCount:x,historyNextCursor:C,branches:A})},[A,g,C,x,p,t]),v.useEffect(()=>{if(!p||!H)return;p.changes.find(ke=>ke.path===H)||F(null)},[H,p]),v.useEffect(()=>{PU(Dt.current)},[M]),v.useEffect(()=>{oe||(te([]),we(null),Ge(null),qt(null))},[oe]),v.useEffect(()=>{if(!p){te([]);return}const Q=new Set(p.changes.map(ke=>ke.path));te(ke=>ke.filter(D=>Q.has(D)))},[p]);function Wt(){const Q=wt.current;if(!Q)return;Q.querySelectorAll(".git-tree-shell").forEach(D=>{D.scrollTop=0})}function ct(Q){y(Q.status),b(Array.isArray(Q.history)?Q.history:[]),S(typeof Q.historyTotalCount=="number"?Q.historyTotalCount:0),j(typeof Q.historyNextCursor=="string"?Q.historyNextCursor:null),K(Q.branches??null)}function It(Q){t!=null&&t.trim()&&(P(!0),Kt("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),d(t.trim()))}async function Mt(Q){if(!(t!=null&&t.trim()))return;const ke=t.trim();P(!0);try{const[D,he,ie]=await Promise.all([h0(ke),Rb(ke,qb,null),oW(ke)]);ct({status:D,history:he.items,historyTotalCount:he.totalCount,historyNextCursor:he.nextCursor,branches:ie}),d(ke),Q!=null&&Q.resetTreeScroll&&requestAnimationFrame(()=>{Wt()})}catch(D){Ze({title:Jr(D,h("git.panelLoadFailed")),tone:"error"})}finally{P(!1)}}async function Xt(){if(!(!t||!C||R)){L(!0);try{const Q=await Rb(t,qb,C);b(ke=>{const D=new Set(ke.map(ie=>ie.commitHash)),he=Q.items.filter(ie=>!D.has(ie.commitHash));return[...ke,...he]}),S(Q.totalCount),j(Q.nextCursor)}catch(Q){Ze({title:Jr(Q,h("git.panelLoadFailed")),tone:"error"})}finally{L(!1)}}}function ee(Q){if(!$||R||!C)return;const ke=Q.currentTarget;ke.scrollHeight-ke.scrollTop-ke.clientHeight<=40&&Xt()}async function Ie(){if(t){G(!0);try{const Q=await rW(t,"ai");_(Q.validation.normalizedDraft.subject||Q.draft.subject)}catch(Q){Ze({title:Jr(Q,h("git.draftFailed")),tone:"error"})}finally{G(!1)}}}async function at(Q,ke){if(t&&Q.length){G(!0);try{const D=ke?await tW(t,Q):await m0(t,Q);y(D),F(Q[Q.length-1]??null),te(he=>he.filter(ie=>!Q.includes(ie))),we(null),It()}catch(D){P(!1),Ze({title:Jr(D,h("git.stageFailed")),tone:"error"})}finally{G(!1)}}}async function Nt(Q){if(t&&Q.length){G(!0);try{const ke=await nW(t,Q);y(ke),Q.includes(H??"")&&F(null),te(D=>D.filter(he=>!Q.includes(he))),we(null),It()}catch(ke){P(!1),Ze({title:Jr(ke,h("git.discardFailed")),tone:"error"})}finally{G(!1)}}}async function Se(){if(!(!t||!M.trim())){G(!0);try{await iW(t,NU(M)),Ze({title:h("git.commitSuccess"),tone:"success"}),_(""),F(null),It()}catch(Q){Ze({title:Jr(Q,h("git.commitFailed")),tone:"error"})}finally{G(!1)}}}async function Ye(){if(t){Lt(!0);try{const Q=await lW(t);if(Q.length===0){Ze({title:h("git.noRemotes"),tone:"error"});return}if(Q.length===1){Ut([Q[0].name]);return}yt(Q),zt(new Set),ft(new Map),mt(!0)}catch(Q){Ze({title:Jr(Q,h("git.remoteFailed")),tone:"error"})}finally{Lt(!1)}}}async function Ut(Q){if(!t||Q.length===0)return;G(!0),ft(new Map);const ke=await Promise.allSettled(Q.map(async ie=>{const it=await Mb(t,"push",ie);return{name:ie,summary:it.summary}})),D=new Map;let he=!1;for(const ie of ke)if(ie.status==="fulfilled")D.set(ie.value.name,{ok:!0,summary:ie.value.summary});else{he=!0;const it=Q[D.size];D.set(it,{ok:!1,summary:Jr(ie.reason,h("git.remoteFailed"))})}ft(D),It(),G(!1),he||(Ze({title:h("git.pushAllSuccess",{count:String(Q.length)}),tone:"success"}),mt(!1))}async function nn(Q){if(t){if(Q==="push"){q(!1),Ye();return}G(!0);try{const ke=await Mb(t,Q);Ze({title:ke.summary,tone:"success"}),q(!1),It()}catch(ke){Ze({title:Jr(ke,h("git.remoteFailed")),tone:"error"})}finally{G(!1)}}}async function fn(){if(t){G(!0);try{const Q=await sW(t);_(Q.commitSubject??""),Ze({title:Q.summary||h("git.undoLastCommitSuccess"),tone:"success"}),q(!1),It()}catch(Q){Ze({title:Jr(Q,h("git.undoLastCommitFailed")),tone:"error"})}finally{G(!1)}}}async function Nn(Q){if(t){G(!0);try{const ke=await aW(t,Q,!1);K(ke),q(!1),It()}catch(ke){Ze({title:Jr(ke,h("git.branchFailed")),tone:"error"})}finally{G(!1)}}}function wn(Q){Z(ke=>ke.includes(Q)?ke.filter(D=>D!==Q):[...ke,Q])}const V=450;function re(Q){const ke=Date.now(),D=Ke.current;return Ke.current={filePath:Q,timestamp:ke},(D==null?void 0:D.filePath)===Q&&ke-D.timestamp<=V}async function de(Q,ke){if(ke.binary){Ze({title:h("git.binaryDiff"),tone:"info"});return}if(ke.status==="A"||ke.status==="?")Le(null),ue(Q);else if(t)try{const D=await f0(t,Q,ke.staged);Le(D.content),ue(Q)}catch{Le(null),ue(Q)}}function be(Q){F(Q),we(null),te(ke=>ke.includes(Q)?ke.filter(D=>D!==Q):[...ke,Q])}function Ee(Q){const ke=nt.current;if(!ke||!Number.isFinite(Q))return;const D=ke.getBoundingClientRect(),he=D.height-Rc;if(!Number.isFinite(D.top)||!Number.isFinite(D.height)||he<=0)return;const ie=(Q-D.top-Rc/2)/he*100;if(!Number.isFinite(ie))return;const it=Math.max(Ub,Math.min(cf,Math.round(ie)));tt(it)}function We(Q){Q.preventDefault(),Ee(Q.clientY),gt(!0)}const $e=(p==null?void 0:p.changes)??[],Re=$e.filter(Q=>nm(Q,"staged")),De=$e.filter(Q=>nm(Q,"unstaged")),Fe=Xb(Re,"staged"),Oe=Xb(De,"unstaged"),dt=new Set(X),ut=new Set(B),Gt=Jb(B,$e,"staged"),Tt=Jb(B,$e,"unstaged"),Ue=$e.length===0&&((p==null?void 0:p.snapshot.ahead)??0)>0,ae=Re.length>0&&M.trim().length>0,je=(A==null?void 0:A.currentBranch)??(p==null?void 0:p.snapshot.branch)??h("common.unknown"),Xe=Number.isFinite(Ot)?Ot:lf,rt=$?`minmax(120px, ${Xe}fr) ${Rc}px minmax(140px, ${100-Xe}fr)`:`minmax(120px, 1fr) ${Rc}px auto`;v.useEffect(()=>{T==="staged"&&Gt.length===0&&we(null),T==="unstaged"&&Tt.length===0&&we(null)},[T,Gt.length,Tt.length]),v.useEffect(()=>{if(!oe)return;const Q=De.length>0?"unstaged":Re.length>0?"staged":"history";Ce(ke=>ke==="unstaged"&&De.length>0||ke==="staged"&&Re.length>0?ke:Q)},[oe,Re.length,De.length]),v.useEffect(()=>{_e&&(g.some(Q=>Q.commitHash===_e)||Ge(null))},[g,_e]),v.useEffect(()=>{oe&&me!=="history"&&Y&&q(!1)},[oe,Y,me]);async function He(Q,ke){var D;try{if(typeof navigator>"u"||!((D=navigator.clipboard)!=null&&D.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(Q),Ze({title:ke,tone:"success"})}catch{Ze({title:h("common.copyContentFailed"),tone:"error"})}}async function At(Q,ke){typeof window<"u"&&!window.confirm(h("git.discardConfirm",{path:ke}))||await Nt(Q)}function Ct(){return i.jsxs("div",{className:"git-operations-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.currentBranch")}),i.jsx("strong",{className:"git-menu-branch",children:je})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.branchTitle")}),i.jsx("div",{className:"git-menu-branch-list",children:A==null?void 0:A.local.map(Q=>i.jsx("button",{className:"git-menu-item",type:"button",disabled:U||Q.current,onClick:()=>void Nn(Q.name),children:i.jsx("span",{children:Q.current?`${h("git.switchBranch")} ${Q.name}`:`${h("git.switchBranchTo")} ${Q.name}`})},Q.name))})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:U,onClick:()=>void nn("fetch"),children:i.jsx("span",{children:h("git.fetch")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:U,onClick:()=>void nn("pull"),children:i.jsx("span",{children:h("git.pull")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:U,onClick:()=>void nn("push"),children:i.jsx("span",{children:h("git.push")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:U,onClick:()=>void fn(),children:i.jsx("span",{children:h("git.undoLastCommit")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:U||I,onClick:()=>void Mt({resetTreeScroll:!0}),children:i.jsx("span",{children:h("git.refresh")})})]})]})}return i.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[i.jsxs("section",{className:"git-card git-scaffold-section",children:[i.jsxs("div",{className:"git-editor-row",children:[i.jsx("textarea",{ref:Dt,rows:1,value:M,onChange:Q=>_(A0(Q.target.value)),onKeyDown:Q=>{Q.key==="Enter"&&Q.preventDefault()},placeholder:h("git.commitSubjectPlaceholder")}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.generateDraft"),title:h("git.generateDraft"),onClick:()=>void Ie(),disabled:U||I,children:i.jsx(EU,{})})]}),i.jsxs("div",{className:"git-primary-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Mt({resetTreeScroll:!0}),disabled:U||I||!t,children:h("git.refreshNow")}),i.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Ue){Ye();return}Se()},disabled:U||!Ue&&!ae,children:h(Ue?"git.pushNow":"git.commitNow")})]})]}),oe?i.jsxs("div",{className:"git-mobile-sections",children:[i.jsx(df,{title:h("git.stagedChangesTitle"),count:Re.length,expanded:me==="staged",onToggle:()=>Ce("staged"),children:i.jsx(Kb,{title:h("git.stagedChangesTitle"),nodes:Fe,collapsedTreePathSet:dt,onToggleTreePath:wn,onToggleMobileSelection:be,selectedMobilePathSet:ut,selectedTargets:Gt,actioning:U,variant:"staged",swipeRowState:tn,onSwipeRowChange:qt,onStageToggle:at,onDiscardWithConfirm:At,onClearSelectedTargets:()=>te(Q=>Q.filter(ke=>!Gt.includes(ke))),onPreviewFile:de})}),i.jsx(df,{title:h("git.changesTitle"),count:De.length,expanded:me==="unstaged",onToggle:()=>Ce("unstaged"),children:i.jsx(Kb,{title:h("git.changesTitle"),nodes:Oe,collapsedTreePathSet:dt,onToggleTreePath:wn,onToggleMobileSelection:be,selectedMobilePathSet:ut,selectedTargets:Tt,actioning:U,variant:"unstaged",swipeRowState:tn,onSwipeRowChange:qt,onStageToggle:at,onDiscardWithConfirm:At,onClearSelectedTargets:()=>te(Q=>Q.filter(ke=>!Tt.includes(ke))),onPreviewFile:de})}),i.jsxs(df,{title:h("git.recentVersionsTitle"),count:x,expanded:me==="history",onToggle:()=>Ce("history"),trailingContent:i.jsx("span",{className:"badge",children:je}),headerAction:i.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),"aria-expanded":Y,onClick:()=>{Ce("history"),q(Q=>!Q)},disabled:U,children:i.jsx(pu,{})}),children:[Y?i.jsx("div",{className:"git-mobile-operations-shell",children:Ct()}):null,i.jsx(CU,{history:g,historyLoadingMore:R,hasMore:!!C,actioning:U,openCommitHash:_e,onToggleMenu:Q=>Ge(ke=>ke===Q?null:Q),onCopyCommitHash:Q=>void He(Q,h("git.copyCommitHashSuccess")),onCopyCommitSubject:Q=>void He(Q,h("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void fn(),onLoadMore:()=>void Xt()})]})]}):i.jsxs("div",{ref:nt,className:"git-content-split",style:{gridTemplateRows:rt},children:[i.jsx("section",{className:"git-card git-tree-panel",children:i.jsxs("div",{ref:wt,className:"git-tree-panel-body",children:[Re.length>0?i.jsx(Gb,{title:h("git.stagedChangesTitle"),count:Re.length,nodes:Fe,selectedPath:H,collapsedTreePathSet:dt,onToggleTreePath:wn,onSelectFile:F,onPreviewFile:(Q,ke)=>{re(Q)&&de(Q,ke)},onToggleMobileSelection:be,onStageToggle:at,onDiscard:Nt,actioning:U,variant:"staged",isMobileViewport:oe,selectedMobilePathSet:ut,selectedTargets:Gt,mobileActionMenuOpen:T==="staged",onToggleMobileActionMenu:()=>we(Q=>Q==="staged"?null:"staged"),onClearSelectedTargets:()=>te(Q=>Q.filter(ke=>!Gt.includes(ke)))}):null,i.jsx(Gb,{title:h("git.changesTitle"),count:De.length,nodes:Oe,selectedPath:H,collapsedTreePathSet:dt,onToggleTreePath:wn,onSelectFile:F,onPreviewFile:(Q,ke)=>{re(Q)&&de(Q,ke)},onToggleMobileSelection:be,onStageToggle:at,onDiscard:Nt,actioning:U,variant:"unstaged",isMobileViewport:oe,selectedMobilePathSet:ut,selectedTargets:Tt,mobileActionMenuOpen:T==="unstaged",onToggleMobileActionMenu:()=>we(Q=>Q==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>te(Q=>Q.filter(ke=>!Tt.includes(ke)))})]})}),i.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":h("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Ub,"aria-valuemax":cf,"aria-valuenow":$?Xe:cf,"data-dragging":$t,onPointerDown:We,children:i.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),i.jsxs("section",{className:"git-card git-history-section",children:[i.jsxs("div",{className:"git-history-topbar",children:[i.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":$,"aria-label":h($?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>se(Q=>!Q),children:[i.jsxs("span",{className:"git-section-toggle-main",children:[i.jsx(Lu,{expanded:$}),i.jsx("span",{children:h("git.recentVersionsTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:x})]}),i.jsxs("div",{className:"git-history-actions",children:[i.jsx("span",{className:"badge",children:je}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:()=>q(Q=>!Q),disabled:U,children:i.jsx(pu,{})}),Y?Ct():null]})]}),$?i.jsx("div",{className:"git-history-list",onScroll:ee,children:g.length?i.jsxs(i.Fragment,{children:[g.map(Q=>i.jsxs("article",{className:"git-history-entry","data-kind":Q.commitKind,children:[i.jsx("span",{className:"git-history-marker","data-kind":Q.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-history-body",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:Q.subject,children:Q.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":Q.commitKind,children:L0(Q.commitKind)})]}),Q.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:Q.refs.map(ke=>i.jsx("span",{className:"git-history-ref-pill","data-kind":ke.kind,"data-remote-index":String(I0(ke.remoteName)),children:ke.name},`${Q.commitHash}:${ke.kind}:${ke.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:Q.commitHash.slice(0,8)}),i.jsx("span",{children:Q.authorName}),i.jsx("time",{dateTime:Q.authoredAt,children:D0(Q.authoredAt)})]})]})]},Q.commitHash)),R?i.jsxs("p",{className:"git-history-loading",children:[h("git.refreshNow"),"..."]}):null]}):i.jsx("p",{className:"status-text",children:h("git.noHistory")})}):null]})]}),i.jsxs(Rr,{open:ot,title:h("git.selectRemoteTitle"),description:h("git.selectRemoteDesc"),onClose:()=>{U||mt(!1)},children:[i.jsx("div",{className:"git-remote-select-list",children:jt.map(Q=>{const ke=vt.has(Q.name),D=Rt.get(Q.name);return i.jsxs("label",{className:"git-remote-item",children:[i.jsx("input",{type:"checkbox",checked:ke,disabled:U,onChange:()=>{zt(he=>{const ie=new Set(he);return ie.has(Q.name)?ie.delete(Q.name):ie.add(Q.name),ie})}}),i.jsxs("span",{className:"git-remote-item-body",children:[i.jsx("span",{className:"git-remote-name",children:Q.name}),i.jsx("span",{className:"git-remote-url",children:Q.pushUrl}),D&&i.jsx("span",{className:`git-remote-result ${D.ok?"ok":"err"}`,children:D.summary})]})]},Q.name)})}),i.jsxs("div",{className:"git-remote-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:U,onClick:()=>mt(!1),children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:U||vt.size===0,onClick:()=>void Ut(Array.from(vt)),children:U?h("git.pushing"):h("git.pushSelected",{count:String(vt.size)})})]})]}),i.jsx(p0,{workspaceId:t,filePath:Vt,open:Vt!==null,onClose:()=>{ue(null),Le(null)},onSaved:async()=>{await Mt({resetTreeScroll:!0})},diffContent:ve})]})}function Gb({title:e,count:t,nodes:n,selectedPath:s,collapsedTreePathSet:a,onToggleTreePath:c,onSelectFile:l,onPreviewFile:d,onToggleMobileSelection:f,onStageToggle:p,onDiscard:y,actioning:g,variant:b,isMobileViewport:x,selectedMobilePathSet:S,selectedTargets:C,mobileActionMenuOpen:j,onToggleMobileActionMenu:R,onClearSelectedTargets:L}){const A=vp(n),K=h(b==="staged"?"git.unstageAll":"git.stageAll");return i.jsxs("section",{className:"git-tree-group","data-variant":b,children:[i.jsxs("div",{className:"git-section-header git-tree-group-header",children:[i.jsx("h3",{children:e}),i.jsxs("div",{className:"git-tree-group-actions",children:[i.jsx("span",{className:"workbench-section-counter",children:t}),!x&&A.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":K,title:K,onClick:()=>void p(A,b==="staged"),disabled:g,children:i.jsx(rm,{staged:b==="staged"})}),b==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discardAll"),title:h("git.discardAll"),onClick:()=>void y(A),disabled:g,children:i.jsx(im,{})}):null]}):null,x&&C.length>0?i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:R,disabled:g,children:i.jsx(pu,{})}):null]}),x&&j?i.jsxs("div",{className:"git-selection-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.selectedFiles")}),i.jsx("strong",{className:"git-menu-branch",children:C.length})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void p(C,b==="staged"),children:i.jsx("span",{children:h(b==="staged"?"git.unstage":"git.stage")})}),b==="unstaged"?i.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void y(C),children:i.jsx("span",{children:h("git.discard")})}):null,i.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:L,children:i.jsx("span",{children:h("git.clearSelection")})})]})]}):null]}),i.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:n.length?E0({nodes:n,depth:0,collapsedTreePathSet:a,selectedPath:s,onToggleTreePath:c,onSelectFile:l,onPreviewFile:d,onToggleMobileSelection:f,onStageToggle:p,onDiscard:y,actioning:g,variant:b,isMobileViewport:x,selectedMobilePathSet:S}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function df({title:e,count:t,expanded:n,onToggle:s,trailingContent:a,headerAction:c,children:l}){return i.jsxs("section",{className:"git-mobile-section","data-expanded":n,children:[i.jsxs("div",{className:"git-mobile-section-header",children:[i.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":n,onClick:s,children:[i.jsxs("span",{className:"git-mobile-section-toggle-main",children:[i.jsx(Lu,{expanded:n}),i.jsx("h3",{children:e})]}),i.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[a,i.jsx("span",{className:"workbench-section-counter",children:t})]})]}),c?i.jsx("div",{className:"git-mobile-section-header-action",children:c}):null]}),n?i.jsx("div",{className:"git-mobile-section-body",children:l}):null]})}function Kb({title:e,nodes:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:a,selectedMobilePathSet:c,selectedTargets:l,actioning:d,variant:f,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:b,onClearSelectedTargets:x,onPreviewFile:S}){return i.jsxs("div",{className:"git-mobile-record-shell",children:[l.length>0?i.jsxs("div",{className:"git-mobile-selection-toolbar",children:[i.jsxs("span",{className:"git-mobile-selection-count",children:[h("git.selectedFiles")," ",l.length]}),i.jsxs("div",{className:"git-mobile-selection-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(l,f==="staged"),children:h(f==="staged"?"git.unstage":"git.stage")}),f==="unstaged"?i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:d,onClick:()=>void b(l,`${l.length}`),children:h("git.discard")}):null,i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:x,children:h("git.clearSelection")})]})]}):null,i.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?T0({nodes:t,depth:0,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:d,variant:f,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:b,onPreviewFile:S}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function T0({nodes:e,depth:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:f,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g,onPreviewFile:b}){return e.map(x=>{if(x.kind==="directory"){const j=!n.has(x.path),R=vp(x.children),L=`directory:${x.path}`;return i.jsxs("div",{className:"git-mobile-record-branch",children:[i.jsx(Qb,{rowKey:L,openState:(f==null?void 0:f.path)===L?f.direction:null,onOpenStateChange:A=>p(A?{path:L,direction:A}:null),trailingActions:R.length>0?[{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y(R,d==="staged")},...d==="unstaged"?[{label:h("git.discard"),tone:"danger",onPress:()=>void g(R,x.path)}]:[]]:null,children:i.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${$b+t*Vb}px`},onClick:()=>s(x.path),children:[i.jsxs("span",{className:"git-mobile-record-leading",children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:i.jsx(Lu,{expanded:j})}),i.jsx("span",{className:"git-mobile-record-title",children:x.name})]}),i.jsx("span",{className:"git-mobile-record-meta",children:R.length})]})}),j?i.jsx("div",{className:"git-mobile-record-children",role:"group",children:T0({nodes:x.children,depth:t+1,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:f,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g,onPreviewFile:b})}):null]},L)}const S=`file:${x.path}`,C=c.has(x.path);return i.jsx(Qb,{rowKey:S,openState:(f==null?void 0:f.path)===S?f.direction:null,onOpenStateChange:j=>p(j?{path:S,direction:j}:null),trailingActions:[{label:h("git.preview"),tone:"neutral",onPress:()=>b(x.change.path,x.change)},{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y([x.change.path],d==="staged")},...d==="unstaged"?[{label:h("git.discard"),tone:"danger",onPress:()=>void g([x.change.path],x.path)}]:[]],children:i.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${$b+t*Vb}px`},children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${x.name}`,onChange:()=>a(x.change.path)}),i.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>a(x.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(x.name),"aria-hidden":"true",children:Bs(x.name)}),i.jsxs("span",{className:"git-mobile-record-copy",children:[i.jsx("span",{className:"git-mobile-record-title",children:x.name}),i.jsx("span",{className:"git-mobile-record-path",children:x.path})]}),i.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})]})]})},S)})}function Qb({rowKey:e,openState:t,onOpenStateChange:n,trailingActions:s,children:a}){const c=Hr(),l=v.useRef(null),[d,f]=v.useState(0),p=((s==null?void 0:s.length)??0)*uf;v.useEffect(()=>{t||f(0)},[t,e]);const y=d!==0?d:t==="trailing"?-p:0;function g(C){var j,R;C.button===0&&(l.current={pointerId:C.pointerId,startX:C.clientX},(R=(j=C.currentTarget).setPointerCapture)==null||R.call(j,C.pointerId))}function b(C){const j=l.current;if(!j||j.pointerId!==C.pointerId)return;const R=p>0?p+10:0,L=Math.max(-R,Math.min(0,C.clientX-j.startX));f(L)}function x(C){var R,L;const j=l.current;if(!(!j||j.pointerId!==C.pointerId)){if((L=(R=C.currentTarget).releasePointerCapture)==null||L.call(R,C.pointerId),l.current=null,d<=-44&&(s!=null&&s.length)){c.trigger("gesture"),n("trailing"),f(0);return}n(null),f(0)}}function S(C){var R,L;const j=l.current;!j||j.pointerId!==C.pointerId||((L=(R=C.currentTarget).releasePointerCapture)==null||L.call(R,C.pointerId),l.current=null,f(0))}return i.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":d!==0,children:[s==null?void 0:s.map((C,j)=>i.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":C.tone,style:{right:j*uf,width:uf},onClick:()=>{c.trigger(C.tone==="danger"?"warning":"action"),n(null),C.onPress()},children:C.label},`trailing-${j}`)),i.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${y}px)`},onPointerDown:g,onPointerMove:b,onPointerUp:x,onPointerCancel:S,children:a})]})}function CU({history:e,historyLoadingMore:t,hasMore:n,actioning:s,openCommitHash:a,onToggleMenu:c,onCopyCommitHash:l,onCopyCommitSubject:d,onUndoLastCommit:f,onLoadMore:p}){return e.length?i.jsxs("div",{className:"git-mobile-history-list",children:[e.map((y,g)=>{const b=a===y.commitHash,x=g===0&&y.commitKind==="local";return i.jsxs("article",{className:"git-mobile-history-entry","data-kind":y.commitKind,children:[i.jsxs("div",{className:"git-mobile-history-entry-main",children:[i.jsx("span",{className:"git-history-marker","data-kind":y.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-mobile-history-copy",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:y.subject,children:y.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":y.commitKind,children:L0(y.commitKind)})]}),y.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:y.refs.map(S=>i.jsx("span",{className:"git-history-ref-pill","data-kind":S.kind,"data-remote-index":String(I0(S.remoteName)),children:S.name},`${y.commitHash}:${S.kind}:${S.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:y.commitHash.slice(0,8)}),i.jsx("span",{children:y.authorName}),i.jsx("time",{dateTime:y.authoredAt,children:D0(y.authoredAt)})]})]}),i.jsx("button",{type:"button",className:"git-icon-button","aria-label":h("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:i.jsx(pu,{})})]}),b?i.jsxs("div",{className:"git-mobile-history-menu",children:[i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>l(y.commitHash),children:i.jsx("span",{children:h("git.copyCommitHash")})}),i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(y.subject),children:i.jsx("span",{children:h("git.copyCommitSubject")})}),x?i.jsx("button",{type:"button",className:"git-menu-item",disabled:s,onClick:f,children:i.jsx("span",{children:h("git.undoLastCommit")})}):null]}):null]},y.commitHash)}),n?i.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:p,children:t?`${h("git.refreshNow")}...`:h("common.loadMore")}):null]}):i.jsx("p",{className:"git-tree-status",children:h("git.noHistory")})}function E0({nodes:e,depth:t,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:a,onSelectFile:c,onPreviewFile:l,onToggleMobileSelection:d,onStageToggle:f,onDiscard:p,actioning:y,variant:g,isMobileViewport:b,selectedMobilePathSet:x}){return e.map(S=>{if(S.kind==="directory"){const R=!n.has(S.path),L=vp(S.children),A=`${h(g==="staged"?"git.unstage":"git.stage")} ${S.path}`,K=`${h("git.discard")} ${S.path}`;return i.jsxs("div",{className:"git-tree-node",children:[i.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":R,children:[i.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>a(S.path),children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":R,children:i.jsx(Lu,{expanded:R})}),i.jsx("span",{className:"git-tree-label git-tree-label-directory",children:S.name})]}),!b&&L.length>0?i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":A,title:A,onClick:()=>void f(L,g==="staged"),disabled:y,children:i.jsx(rm,{staged:g==="staged"})}),g==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":K,title:K,onClick:()=>void p(L),disabled:y,children:i.jsx(im,{})}):null]}):null]}),R?i.jsx("div",{className:"git-tree-children",role:"group",children:E0({nodes:S.children,depth:t+1,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:a,onSelectFile:c,onPreviewFile:l,onToggleMobileSelection:d,onStageToggle:f,onDiscard:p,actioning:y,variant:g,isMobileViewport:b,selectedMobilePathSet:x})}):null]},`directory:${S.path}`)}const C=x.has(S.path),j=b?C:s===S.path;return b?i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,"data-mobile":"true",children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${S.name}`,onChange:()=>d(S.change.path)}),i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>d(S.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(S.name),"aria-hidden":"true",children:Bs(S.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:S.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":S.status,children:S.status})})]})]},`file:${S.path}`):i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,children:[i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>{c(S.change.path),l&&l(S.change.path,S.change)},children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Ws(S.name),"aria-hidden":"true",children:Bs(S.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:S.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":S.status,children:S.status})})]}),i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":S.variant==="staged"?h("git.unstage"):h("git.stage"),title:S.variant==="staged"?h("git.unstage"):h("git.stage"),onClick:()=>void f([S.change.path],S.variant==="staged"),disabled:y,children:i.jsx(rm,{staged:S.variant==="staged"})}),g==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discard"),title:h("git.discard"),onClick:()=>void p([S.change.path]),disabled:y,children:i.jsx(im,{})}):null]})]},`file:${S.path}`)})}function Yb(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function Xb(e,t){const n=Yb("","");for(const s of e){const a=s.path.replace(/\\/g,"/"),c=a.split("/").filter(Boolean);let l=n;c.forEach((d,f)=>{const p=c.slice(0,f+1).join("/");if(f===c.length-1){l.children.set(`file:${p}`,{kind:"file",name:d,path:a,change:s,status:jU(s,t),variant:t});return}const y=`directory:${p}`,g=l.children.get(y);if(g&&g.kind==="directory"){l=g;return}const b=Yb(d,p);l.children.set(y,b),l=b})}return M0(R0([...n.children.values()]))}function R0(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:R0([...t.children.values()])}:t)}function M0(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=M0(t.children);let s=t.name,a=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,a=d.path,c=d.children}return{kind:"directory",name:s,path:a,children:c}})}function Jb(e,t,n){const s=new Set(e);return t.filter(a=>nm(a,n)&&s.has(a.path)).map(a=>a.path)}function vp(e){const t=[],n=new Set;function s(a){if(a.kind==="file"){n.has(a.path)||(n.add(a.path),t.push(a.path));return}a.children.forEach(s)}return e.forEach(s),t}function nm(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function jU(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function NU(e){return{subject:A0(e).trim(),body:null,footer:null,source:"manual"}}function A0(e){return e.replace(/[\r\n]+/g," ")}function PU(e){if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,34),120);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>120?"auto":"hidden"}function L0(e){switch(e){case"local":return h("git.historyKindLocal");case"remote":return h("git.historyKindRemote");default:return h("git.historyKindShared")}}function I0(e){if(!e)return 0;let t=0;for(const n of e)t=t*33+n.charCodeAt(0)>>>0;return t%6}function Jr(e,t){return e instanceof lr?TU(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function hf(e){return`git-sidebar.snapshot.${e}`}function TU(e){switch(e.errorCode){case"UNAUTHORIZED":return h("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return h("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return h("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return h("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return h("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return h("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return h("git.errors.invalidTarget");case"NOT_STAGED":return h("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return h("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return h("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return h("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return h("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return h("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return h("git.errors.pushFailed");case"GIT_PULL_FAILED":return h("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return h("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return h("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return h("git.discardFailed");case"GIT_UNDO_FAILED":return h("git.undoLastCommitFailed");default:return null}}function Lu({expanded:e}){return i.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function rm({staged:e}){return e?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M5 12h14"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function im(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function EU(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function pu(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function D0(e){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return e}}const RU=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:yp},Symbol.toStringTag,{value:"Module"}));function oz(){return Qe.request("/api/terminals/shells")}function az(e){return Qe.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function MU(e){return Qe.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function lz(e){return Qe.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function cz(e){return Qe.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function uz(e){return Qe.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function dz(e,t={}){const n=new URLSearchParams;typeof t.beforeSeq=="number"&&n.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&n.set("limit",String(t.limit));const s=n.toString();return Qe.request(`/api/terminals/${encodeURIComponent(e)}/history${s?`?${s}`:""}`)}function AU(e){return Qe.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function LU(e,t){return Qe.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function IU(e){return Qe.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function Zb(e,t){return Qe.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function DU(e){return[{value:"",label:h("terminal.runtimeAutoOption"),description:h("terminal.runtimeAutoDescription")},{value:"tmux",label:e==="windows"?h("terminal.runtimePersistentLabel"):"tmux",description:h(e==="windows"?"terminal.runtimeWindowsPersistentDescription":"terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:h("terminal.runtimeEmbeddedDescription")}]}function ex(e,t){return e?e==="conpty-powershell"?h("terminal.runtimeConptyPowerShellLabel"):e==="conpty-cmd"?h("terminal.runtimeConptyCmdLabel"):e==="conpty-git-bash"?h("terminal.runtimeConptyGitBashLabel"):e==="tmux"&&t==="windows"?h("terminal.runtimePersistentLabel"):e:h("terminal.runtimeAutoOption")}function hz(e,t){return e?e==="embedded-pty"?"pty":e==="conpty-powershell"||e==="conpty-cmd"||e==="conpty-git-bash"||e==="tmux"&&t==="windows"?h("terminal.runtimePersistentShortLabel"):e:h("terminal.runtimeAutoShortLabel")}function _U(e){return e instanceof lr?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function FU({open:e,busy:t=!1,onClose:n,onConfirmFallback:s}){return v.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,n,e]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>{t||n()}}),i.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":h("terminal.runtimeMissingDialogTitle"),children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("terminal.runtimeMissingDialogTitle")}),i.jsx("p",{children:h("terminal.runtimeMissingDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>{t||n()},children:"x"})]}),i.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingInstallDescription")}),i.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[i.jsx("li",{children:h("terminal.runtimeMissingInstallMacArm")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallMacIntel")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallDebian")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallFedora")})]})]}),i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge",children:"embedded-pty"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingFallbackDescription")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("terminal.runtimeMissingKeepAction")}),i.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:s,children:h(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const Mc={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},tx=60*1e3;function OU(e){return e?new Date(e).toLocaleString():h("common.unknown")}function BU(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function WU(e){var t,n,s;return((t=e.find(a=>a.id==="cmd"&&a.available))==null?void 0:t.id)??((n=e.find(a=>a.available))==null?void 0:n.id)??((s=e[0])==null?void 0:s.id)??""}function UU(e){const t=e.name.trim();if(t)return t;const n=e.target.trim(),s=e.args.trim();return n?s?`${n} ${s}`:n:e.mode==="script"?h("terminalManager.defaultScriptName"):h("terminalManager.defaultCommandName")}function zU(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function HU(e){return{mode:_0(e),name:e.name,cwd:e.cwd,target:e.command,args:e.args.join(" "),port:e.port===null?"":String(e.port),proxyEnabled:e.proxyEnabled}}function qU(e){return cm(`/proxy/${encodeURIComponent(e)}`)}function _0(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function $U(e){const t=e.trim();if(!t)return null;const n=Number(t);return Number.isInteger(n)?n:Number.NaN}function nx(e,t){return e.get(t)??null}function VU(e,t){return e.port===null?{tone:"untracked",title:h("terminalManager.portUnset"),summary:h("terminalManager.portUnsetDescription"),badgeLabel:h("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:h("terminalManager.portOccupied"),summary:t.processName||h("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:h("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:h("terminalManager.portAvailable"),summary:h("terminalManager.portAvailableDescription"),badgeLabel:h("terminalManager.statusStopped")}}function GU({open:e,title:t,description:n,onClose:s,children:a,className:c}){return v.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[s,e]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",c].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:"x"})]}),i.jsx("div",{className:"workbench-modal-body",children:a})]})]}),document.body)}function KU({open:e,busy:t,title:n,description:s,confirmLabel:a,onClose:c,onConfirm:l,className:d}){return v.useEffect(()=>{if(!e)return;function f(p){p.key==="Escape"&&!t&&c()}return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[t,c,e]),!e||typeof document>"u"?null:Hn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:t,onClick:c}),i.jsxs("section",{className:["workbench-modal-card","surface-card",d].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":n,children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:n}),i.jsx("p",{children:s})]})}),i.jsx("div",{className:"workbench-modal-body",children:i.jsxs("div",{className:"workbench-modal-actions terminal-manager-confirm-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:c,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{l()},children:t?h("terminalManager.templateRemoving"):a})]})})]})]}),document.body)}function rx({label:e,value:t,options:n,open:s,onToggle:a,onChange:c}){const l=n.find(d=>d.value===t)??n[0]??null;return i.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[i.jsx("span",{children:e}),i.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(l==null?void 0:l.label)??""}`.trim(),"aria-expanded":s?"true":"false",onClick:a,children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[i.jsx("strong",{children:(l==null?void 0:l.label)??h("common.unknown")}),l!=null&&l.description?i.jsx("span",{children:l.description}):null]}),i.jsx(QU,{expanded:s})]}),s?i.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:n.map(d=>{const f=d.value===t;return i.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":f,disabled:d.disabled,onClick:()=>{c(d.value)},children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[i.jsx("strong",{children:d.label}),d.description?i.jsx("span",{children:d.description}):null]}),i.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:f?i.jsx(XU,{}):i.jsx(YU,{})})]},d.value||"__empty__")})}):null]})}function QU({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function YU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function XU(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function wp({className:e,currentWorkspaceId:t,navigationGroups:n,externalWindowMode:s=!1,workbenchShellOverrides:a}){var ct,It,Mt,Xt;const c=Mn(),l=ur(),{subscribeTerminalManagerSnapshot:d,requestTerminalManagerRefresh:f,addTerminalManagerSnapshotListener:p}={...l,...a},y=(t==null?void 0:t.trim())||null,[g,b]=v.useState([]),[x,S]=v.useState([]),[C,j]=v.useState([]),[R,L]=v.useState([]),[A,K]=v.useState(""),[H,F]=v.useState(""),[M,_]=v.useState(Mc),[I,P]=v.useState(null),[U,G]=v.useState(null),[X,Z]=v.useState([]),[$,se]=v.useState(!1),[Y,q]=v.useState(!1),[oe,E]=v.useState(null),[B,te]=v.useState(null),[T,we]=v.useState(null),[me,Ce]=v.useState(null),[_e,Ge]=v.useState(null),[ot,mt]=v.useState(!1),[jt,yt]=v.useState(null),{showToast:St}=Yn(),Lt=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,vt=I!==null,zt=I==="edit"?x.find(ee=>ee.id===U)??null:null,Rt=I==="edit";v.useEffect(()=>{Kt("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:n.length,externalWindowMode:s})},[t,s,n.length]);const ft=v.useMemo(()=>R.find(ee=>ee.id===A)??null,[A,R]),tn=v.useMemo(()=>DU(c.ui.osFamily),[c.ui.osFamily]),qt=v.useMemo(()=>new Map(C.map(ee=>[ee.templateId,ee])),[C]),Ot=v.useMemo(()=>C.filter(ee=>ee.occupied).length,[C]),tt=v.useMemo(()=>x.filter(ee=>ee.port!==null).length,[x]),$t=(ft==null?void 0:ft.available)===!1&&R.length>0;v.useEffect(()=>{K(ee=>R.length?ee&&R.some(Ie=>Ie.id===ee)?ee:WU(R):"")},[R]),v.useEffect(()=>{!vt||!y||R.length>0||Vt(y)},[y,R.length,vt]),v.useEffect(()=>{vt||yt(null)},[vt]),v.useEffect(()=>{I==="edit"&&U&&!zt&&(P(null),G(null),_(Mc),F(""),yt(null))},[zt,U,I]),v.useEffect(()=>{!me||T===me.templateId||x.some(ee=>ee.id===me.templateId)||Ce(null)},[me,T,x]),v.useEffect(()=>{if(!y){b([]),S([]),j([]),se(!1);return}const ee=On(ff(y),tx);Kt("terminal_manager.snapshot",{workspaceId:y,cached:!!ee,cachedTemplateCount:(ee==null?void 0:ee.templates.length)??0,cachedStatusCount:(ee==null?void 0:ee.templateStatuses.length)??0}),ee?(b(ee.terminals),S(ee.templates),j(ee.templateStatuses),L(ee.shellOptions??[]),se(!1)):(b([]),S([]),j([]),L([]),se(!0))},[y]),v.useEffect(()=>{if(y)return p(ee=>{ee.workspaceId===y&&(Kt("terminal_manager.snapshot_received",{workspaceId:ee.workspaceId,terminalCount:ee.terminals.length,templateCount:ee.templates.length,statusCount:ee.templateStatuses.length}),gt(ee),se(!1))})},[y,p]),v.useEffect(()=>{if(!y)return;const ee=On(ff(y),tx)!==null;if(d(y),ee){const Ie=window.setTimeout(()=>{Vt(y)},1500);return()=>{window.clearTimeout(Ie)}}Vt(y)},[y,f,d]),v.useEffect(()=>{y&&Mr(ff(y),{terminals:g,templates:x,templateStatuses:C,shellOptions:R})},[y,R,C,x,g]);function gt(ee){b(ee.terminals),S(ee.templates),j(ee.templateStatuses),L(ee.shellOptions??[])}function Vt(ee){Kt("terminal_manager.refresh_requested",{workspaceId:ee}),f(ee)}function ue(){P(null),G(null),_(Mc),F(""),yt(null)}function ve(){G(null),_(Mc),F(""),P("create")}function Le(ee){G(ee.id),_(HU(ee)),F(ee.runtimeType??""),P("edit")}async function Ke(ee){if(y){te(ee);try{await MU(ee),Vt(y),St({title:h("terminalManager.stopProcessSuccess"),tone:"success"})}catch(Ie){St({title:Ie instanceof Error?Ie.message:h("terminalManager.stopProcessFailed"),tone:"error"})}finally{te(null)}}}async function nt(){if(!y||!M.target.trim())return;const ee=$U(M.port);if(Number.isNaN(ee)){St({title:h("terminalManager.invalidPort"),tone:"error"});return}if(M.proxyEnabled&&ee===null){St({title:h("terminalManager.proxyPortRequired"),tone:"error"});return}q(!0);try{const Ie={workspaceId:y,name:UU(M),cwd:M.cwd.trim()||void 0,command:M.target.trim(),args:BU(M.args),port:ee,proxyEnabled:M.proxyEnabled,runtimeType:H||null};if(Rt&&U){const at=await LU(U,Ie);S(Nt=>Nt.map(Se=>Se.id===at.id?at:Se))}else await AU(Ie);ue(),Vt(y),St({title:h(Rt?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(Ie){St({title:Ie instanceof Error?Ie.message:h(Rt?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{q(!1)}}async function wt(ee){const Ie=await c.bridge.openExternal(ee);Ie.ok||St({title:Ie.detail||h("terminalManager.openProxyUrlFailed"),tone:"error"})}async function Dt(ee,Ie){if(y){we(ee.id);try{await IU(ee.id),S(at=>at.filter(Nt=>Nt.id!==ee.id)),j(at=>at.filter(Nt=>Nt.templateId!==ee.id)),Z(at=>at.filter(Nt=>Nt!==ee.id)),Ce(at=>(at==null?void 0:at.templateId)===ee.id?null:at),U===ee.id&&ue(),Vt(y),St({title:h("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(at){St({title:at instanceof Error?at.message:h("terminalManager.templateDeleteFailed"),tone:"error"})}finally{we(null)}}}async function Pt(ee){if(!y)return;const Ie=ft!=null&&ft.available?ft.shell:void 0;E(ee);try{await Zb(ee,{shell:Ie}),Vt(y),St({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(at){if(_U(at)){Ge({templateId:ee,shell:Ie});return}St({title:at instanceof Error?at.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{E(null)}}async function Ze(){if(!(!y||!_e)){mt(!0);try{await Zb(_e.templateId,{shell:_e.shell,runtimeType:"embedded-pty"}),Ge(null),Vt(y),St({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(ee){St({title:ee instanceof Error?ee.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{mt(!1)}}}function Wt(ee){Z(Ie=>Ie.includes(ee)?Ie.filter(at=>at!==ee):[...Ie,ee])}return n.length?y?i.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[i.jsx(FU,{open:_e!==null,busy:ot,onClose:()=>{ot||Ge(null)},onConfirmFallback:()=>{Ze()}}),i.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[i.jsxs("div",{className:"terminal-manager-panel-heading",children:[i.jsx("span",{className:"terminal-manager-panel-eyebrow",children:h("terminalManager.quickLaunchTitle")}),i.jsxs("div",{children:[i.jsx("h2",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.desktopPanelDescription")})]})]}),i.jsxs("div",{className:"terminal-manager-overview",children:[i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.runningCountLabel")}),i.jsx("strong",{children:Ot})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.portWatchCountLabel")}),i.jsx("strong",{children:tt})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.terminalCountLabel")}),i.jsx("strong",{children:g.length})]})]}),i.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[i.jsx("button",{className:"ghost-button",type:"button",disabled:!y||$,onClick:()=>{y&&Vt(y)},children:h("terminalManager.refresh")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!y,onClick:()=>{ve()},children:h("terminalManager.openCreateModalAction")})]})]}),i.jsxs("section",{className:"terminal-manager-section",children:[i.jsxs("div",{className:"terminal-manager-section-header",children:[i.jsxs("div",{children:[i.jsx("h3",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.templateSectionDescription")})]}),i.jsx("span",{className:"workbench-section-counter",children:x.length})]}),$&&!x.length?i.jsx("p",{className:"status-text",children:h("common.loading")}):null,x.length?i.jsx("div",{className:"terminal-manager-list",children:x.map(ee=>{const Ie=nx(qt,ee.id),at=VU(ee,Ie),Nt=X.includes(ee.id),Se=h(Nt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),Ye=ee.proxyEnabled&&ee.proxySlug?qU(ee.proxySlug):null;return i.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":at.tone,"data-expanded":Nt?"true":"false",children:[i.jsxs("div",{className:"terminal-manager-card-header",children:[i.jsxs("div",{className:"terminal-manager-card-title",children:[i.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),i.jsx("strong",{children:ee.name})]}),i.jsxs("div",{className:"terminal-manager-card-tools",children:[i.jsx("span",{className:"badge terminal-runtime-badge",children:ex(ee.runtimeType,c.ui.osFamily)}),i.jsx("span",{className:"badge",children:_0(ee)==="script"?h("terminalManager.scriptMode"):h("terminalManager.commandMode")}),i.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":Se,"aria-expanded":Nt,onClick:()=>{Wt(ee.id)},children:"i"})]})]}),i.jsxs("div",{className:"terminal-manager-status-panel",children:[i.jsxs("div",{className:"terminal-manager-status-copy",children:[i.jsx("p",{className:"terminal-manager-status-title",children:at.title}),i.jsx("p",{className:"status-text",children:at.summary})]}),i.jsxs("div",{className:"terminal-manager-status-badges",children:[i.jsx("span",{className:"terminal-manager-stat-pill",children:ee.port===null?h("terminalManager.portUnset"):`${h("terminalManager.portLabel")} ${ee.port}`}),i.jsx("span",{className:"badge","data-tone":at.badgeTone,children:at.badgeLabel}),ee.proxyEnabled?i.jsx("span",{className:"badge",children:h("terminalManager.proxyEnabled")}):null]})]}),i.jsxs("div",{className:"terminal-manager-actions",children:[Ie!=null&&Ie.occupied?i.jsx("button",{className:"secondary-button",type:"button",disabled:B===ee.id,onClick:()=>{Ke(ee.id)},children:B===ee.id?h("terminalManager.stoppingProcess"):h("terminalManager.stopProcessAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:oe===ee.id||$t,onClick:()=>{Pt(ee.id)},children:oe===ee.id?h("terminalManager.runningTemplate"):h("terminalManager.runTemplateAction")})]}),Nt?i.jsxs("section",{className:"terminal-manager-details","aria-label":h("terminalManager.detailsSectionTitle"),children:[i.jsxs("div",{className:"terminal-manager-detail-grid",children:[i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.commandPreviewLabel")}),i.jsx("strong",{children:zU(ee)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.cwdLabel")}),i.jsx("strong",{children:ee.cwd})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("strong",{children:ex(ee.runtimeType,c.ui.osFamily)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.updatedAt")}),i.jsx("strong",{children:OU(ee.updatedAt)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.portLabel")}),i.jsx("strong",{children:ee.port===null?h("terminalManager.portUnset"):ee.port})]}),i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.proxyField")}),i.jsx("strong",{children:Ye??h("terminalManager.proxyDisabledDescription")})]}),Ie!=null&&Ie.processId?i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.processIdLabel")}),i.jsx("strong",{children:Ie.processId})]}):null,Ie!=null&&Ie.processCommandLine?i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.processCommandLabel")}),i.jsx("strong",{children:Ie.processCommandLine})]}):null]}),i.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[Ye?i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{wt(Ye)},children:h("terminalManager.openProxyUrlAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:Y||T===ee.id,onClick:()=>{Le(ee)},children:h("terminalManager.editAction")}),i.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:T===ee.id,onClick:()=>{Ce({templateId:ee.id,name:ee.name,occupied:!!(Ie!=null&&Ie.occupied)})},children:T===ee.id?h("terminalManager.templateRemoving"):h("terminalManager.removeAction")})]})]}):null]},ee.id)})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyTemplateBody")})})]}),i.jsx(GU,{open:vt,title:h(Rt?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:h(Rt?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:Lt?"terminal-manager-mobile-modal":void 0,onClose:ue,children:i.jsxs("section",{className:"terminal-manager-modal-form",children:[Lt?i.jsxs(i.Fragment,{children:[i.jsx(rx,{label:h("terminalManager.shellField"),value:A,open:jt==="shell",options:R.map(ee=>({value:ee.id,label:ee.label,description:ee.available?null:ee.unavailableReason??h("terminalManager.shellUnavailable"),disabled:!ee.available})),onToggle:()=>{yt(ee=>ee==="shell"?null:"shell")},onChange:ee=>{K(ee),yt(null)}}),(ft==null?void 0:ft.available)===!1&&ft.unavailableReason?i.jsx("p",{className:"status-text",children:ft.unavailableReason}):null,i.jsx(rx,{label:h("terminal.runtimeField"),value:H,open:jt==="runtime",options:tn.map(ee=>({value:ee.value,label:ee.label,description:ee.description})),onToggle:()=>{yt(ee=>ee==="runtime"?null:"runtime")},onChange:ee=>{F(ee),yt(null)}}),i.jsx("p",{className:"status-text",children:((ct=tn.find(ee=>ee.value===H))==null?void 0:ct.description)??((It=tn[0])==null?void 0:It.description)})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.shellField")}),i.jsx("select",{value:A,onChange:ee=>{K(ee.target.value)},children:R.map(ee=>i.jsx("option",{value:ee.id,disabled:!ee.available,children:ee.available?ee.label:`${ee.label} - ${h("terminalManager.shellUnavailable")}`},ee.id))}),(ft==null?void 0:ft.available)===!1&&ft.unavailableReason?i.jsx("p",{className:"status-text",children:ft.unavailableReason}):null]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("select",{value:H,onChange:ee=>{F(ee.target.value)},children:tn.map(ee=>i.jsx("option",{value:ee.value,children:ee.label},ee.value||"auto"))}),i.jsx("p",{className:"status-text",children:((Mt=tn.find(ee=>ee.value===H))==null?void 0:Mt.description)??((Xt=tn[0])==null?void 0:Xt.description)})]})]}),i.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":h("terminalManager.modeField"),children:[i.jsx("button",{type:"button",className:M.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{_(ee=>({...ee,mode:"command"}))},children:h("terminalManager.commandMode")}),i.jsx("button",{type:"button",className:M.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{_(ee=>({...ee,mode:"script"}))},children:h("terminalManager.scriptMode")})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.templateNameField")}),i.jsx("input",{value:M.name,placeholder:h("terminalManager.templateNamePlaceholder"),onChange:ee=>{_(Ie=>({...Ie,name:ee.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.cwdField")}),i.jsx("input",{value:M.cwd,placeholder:h("terminalManager.cwdPlaceholder"),onChange:ee=>{_(Ie=>({...Ie,cwd:ee.target.value}))}})]})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:M.mode==="script"?h("terminalManager.scriptPathField"):h("terminalManager.commandField")}),i.jsx("input",{value:M.target,placeholder:M.mode==="script"?h("terminalManager.scriptPathPlaceholder"):h("terminalManager.commandPlaceholder"),onChange:ee=>{_(Ie=>({...Ie,target:ee.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.argsField")}),i.jsx("input",{value:M.args,placeholder:h("terminalManager.argsPlaceholder"),onChange:ee=>{_(Ie=>({...Ie,args:ee.target.value}))}})]})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.portField")}),i.jsx("input",{value:M.port,placeholder:h("terminalManager.portPlaceholder"),onChange:ee=>{_(Ie=>({...Ie,port:ee.target.value}))}})]}),i.jsxs("div",{className:"field-group terminal-manager-proxy-field",children:[i.jsx("span",{children:h("terminalManager.proxyField")}),i.jsxs("div",{className:"terminal-manager-proxy-control",children:[i.jsx("span",{children:h("terminalManager.proxyToggleLabel")}),i.jsxs("label",{className:"terminal-manager-proxy-switch",children:[i.jsx("input",{type:"checkbox",role:"switch","aria-label":h("terminalManager.proxyField"),checked:M.proxyEnabled,onChange:ee=>{_(Ie=>({...Ie,proxyEnabled:ee.target.checked}))}}),i.jsx("span",{className:"terminal-manager-proxy-track","aria-hidden":"true",children:i.jsx("span",{className:"terminal-manager-proxy-thumb"})})]})]})]})]}),i.jsxs("div",{className:"terminal-manager-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:ue,children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!y||Y||!M.target.trim(),onClick:()=>{nt()},children:h(Y?Rt?"terminalManager.templateUpdating":"terminalManager.templateSaving":Rt?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),i.jsx(KU,{open:me!==null,busy:me!==null&&T===me.templateId,title:h("terminalManager.removeConfirmTitle"),description:me?h(me.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:me.name}):"",confirmLabel:h("terminalManager.removeConfirmAction"),className:Lt?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{T||Ce(null)},onConfirm:()=>{if(!me)return;const ee=x.find(Ie=>Ie.id===me.templateId);if(!ee){Ce(null);return}nx(qt,ee.id),Dt(ee)}})]}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.noCurrentWorkspaceBody")})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyWorkspaceBody")})})}function ff(e){return`terminal-manager.snapshot.${e}`}const JU=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:wp},Symbol.toStringTag,{value:"Module"}));function ix(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort((n,s)=>(s.lastMessageAt??s.updatedAt).localeCompare(n.lastMessageAt??n.updatedAt))}))}function ZU(e){return{navigationGroups:e,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function e4(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function t4(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function n4(e){return e.kind==="files"?h("shell.filesEntry"):e.kind==="git"?h("shell.gitEntry"):e.kind==="processes"?h("shell.terminalManagerEntry"):e.kind}function r4(){const{windowId:e}=wu(),t=qn(),n=Mn(),[s,a]=v.useState(null),[c,l]=v.useState(!0),[d,f]=v.useState(null),[p,y]=v.useState([]),[g,b]=v.useState(null);v.useEffect(()=>{let R=!1;async function L(){if(!e){a(null),l(!1),f(h("desktopWindow.invalidWindowId"));return}l(!0),f(null);const A=await n.bridge.getWindowDescriptor(e),K=A.ok?A.value??null:n.windows.getDescriptor(e);if(!R){if(!K){a(null),l(!1),f(A.detail??h("desktopWindow.loadDescriptorFailed"));return}n.windows.registerDescriptor(K),n.windows.markWindowOpen(K.windowId),a(K),l(!1)}}return L(),()=>{R=!0}},[n,e]),v.useEffect(()=>{if(!(s!=null&&s.workspaceId)){y([]);return}let R=!1;async function L(){try{const A=await Rk();if(R)return;y(ix(A))}catch{if(R)return;y([])}}return L(),()=>{R=!0}},[s==null?void 0:s.workspaceId]),v.useEffect(()=>{if(!s){b(null);return}const R=new rC({onConnectionChange:()=>{},onSnapshot:L=>{y(ix(L))},onUnauthorized:()=>{vn.clear(),t(`/login?returnTo=${encodeURIComponent(`/desktop-window/${s.windowId}`)}`,{replace:!0})}});return b(R),R.start(),()=>{R.close(),b(null)}},[s,t]);const x=v.useMemo(()=>g?{navigationGroups:p,subscribeFileTree:g.subscribeFileTree.bind(g),requestFileTreeRefresh:g.requestFileTreeRefresh.bind(g),addFileTreeSnapshotListener:g.addFileTreeSnapshotListener.bind(g),subscribeGitSnapshot:g.subscribeGit.bind(g),requestGitRefresh:g.requestGitRefresh.bind(g),addGitSnapshotListener:g.addGitSnapshotListener.bind(g)}:ZU(p),[p,g]),S=v.useMemo(()=>g?{subscribeGitSnapshot:g.subscribeGit.bind(g),requestGitRefresh:g.requestGitRefresh.bind(g),addGitSnapshotListener:g.addGitSnapshotListener.bind(g)}:e4(),[g]),C=v.useMemo(()=>g?{subscribeTerminalManagerSnapshot:g.subscribeTerminalManager.bind(g),requestTerminalManagerRefresh:g.requestTerminalManagerRefresh.bind(g),addTerminalManagerSnapshotListener:g.addTerminalManagerSnapshotListener.bind(g)}:t4(),[g]);if(!n.isDesktop)return i.jsx(Lo,{to:"/",replace:!0});if(c)return i.jsx("main",{className:"desktop-window-page",children:i.jsx("p",{className:"status-text",children:h("common.loading")})});if(d)return i.jsx("main",{className:"desktop-window-page",children:i.jsx("p",{className:"status-text",children:d})});if(!s)return i.jsx("main",{className:"desktop-window-page",children:i.jsx("p",{className:"status-text",children:h("desktopWindow.loadDescriptorFailed")})});let j=null;return s.kind==="files"?j=i.jsx(pp,{sessionId:s.sessionId,workspaceId:s.workspaceId,externalWindowMode:!0,workbenchShellOverrides:x}):s.kind==="git"?j=i.jsx(yp,{workspaceId:s.workspaceId,externalWindowMode:!0,workbenchShellOverrides:S}):s.kind==="processes"&&(j=i.jsx(wp,{currentWorkspaceId:s.workspaceId,navigationGroups:p,externalWindowMode:!0,workbenchShellOverrides:C})),j?i.jsx("main",{className:"desktop-window-page",children:i.jsx("div",{className:"desktop-window-body","data-window-kind":s.kind,"aria-label":n4(s),children:j})}):i.jsx("main",{className:"desktop-window-page",children:i.jsx("p",{className:"status-text",children:h("desktopWindow.unsupportedKind",{kind:s.kind})})})}const i4=420;function sx({entry:e,isFavorite:t,isActive:n=!1,depth:s=0,variant:a="default",hasSubsessions:c=!1,showActions:l=!0,onActivate:d,onToggleSubsessions:f,onToggleFavorite:p,onArchive:y,onUnarchive:g,onRename:b}){const[x,S]=v.useState(!1),C=v.useRef(null),j=v.useRef(!1),R=Hr(),{session:L,workspace:A}=e,K=L.title??L.sessionId,H=L.provider==="codex"?h("conversation.providerCodex"):L.provider==="opencode"?h("conversation.providerOpenCode"):h("conversation.providerClaude"),F=[H,o4(L.lastMessageAt??L.updatedAt??null),du(L)].filter(Boolean).join(" · "),M=l4(L),_=M?c4(M):null,I=a==="mobile"?null:du(L),P=I?pC("session-list-activity-badge",L):null;v.useEffect(()=>()=>{U()},[]);function U(){C.current!==null&&(window.clearTimeout(C.current),C.current=null)}function G(q){!c||q.pointerType==="mouse"||(U(),C.current=window.setTimeout(()=>{j.current=!0,R.trigger("gesture"),f==null||f()},i4))}function X(){U()}function Z(){if(j.current){j.current=!1;return}R.trigger("selection"),d(L.sessionId)}const $=async()=>{const q=window.prompt(h("shell.renameModalDescription"),K);q&&(await b(L.sessionId,q.trim()),S(!1))},se=async()=>{if(L.isArchived){await g(L.sessionId),S(!1);return}await y(L.sessionId),S(!1)},Y=()=>{p(L.sessionId),S(!1)};return i.jsxs("article",{className:"session-list-item","data-depth":s,"data-active":n,"data-has-subsessions":c,"data-variant":a,children:[i.jsxs("button",{type:"button",className:"session-list-link",onClick:Z,onPointerDown:G,onPointerUp:X,onPointerCancel:X,onPointerLeave:X,children:[i.jsx("span",{className:s4(L),"aria-hidden":"true"}),i.jsxs("div",{className:"session-list-copy",children:[i.jsx("div",{className:"session-list-title",children:K||h("shell.searchEntry")}),i.jsx("div",{className:"session-list-meta",children:a==="mobile"?i.jsx("span",{children:F}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:A.name}),I&&P?i.jsxs(i.Fragment,{children:[i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{className:P,children:I})]}):null,i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{children:H})]})}),_?i.jsx("div",{className:"session-list-error",title:M??void 0,children:_}):null]})]}),l?i.jsxs("div",{className:"session-list-actions",children:[i.jsx("button",{type:"button",className:"ghost-button","aria-expanded":x,onClick:()=>{R.trigger("selection"),S(q=>!q)},children:h("shell.sessionMoreAction")}),x?i.jsxs("div",{className:"session-action-menu surface-card",role:"menu","aria-label":h("shell.sessionMoreAction"),children:[i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:Y,children:h(t?"shell.unfavoriteAction":"shell.favoriteAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void se(),children:L.isArchived?h("shell.unarchiveAction"):h("shell.archiveAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void $(),children:h("shell.renameAction")})]}):null]}):null]})}function s4(e,t){return op("session-list-indicator",e)}function o4(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function a4(e){return cl(e)||e.syncStatus==="error"}function l4(e){var s,a;if(!a4(e))return null;const t=((s=e.lastErrorCode)==null?void 0:s.trim())??"",n=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&n&&!n.includes(t)?`${t} · ${n}`:n||t||(e.syncStatus==="error"&&!cl(e)?h("conversation.syncStatusError"):h("conversation.runtimeErrorTitle"))}function c4(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function u4(){const e=qn(),{navigationGroups:t,favoriteSessionIds:n,currentWorkspaceId:s,currentSessionId:a,navigationLoading:c,selectWorkspace:l,toggleFavoriteSession:d,archiveSession:f,unarchiveSession:p,renameSession:y,startDraftSession:g}=ur(),b=t.find(I=>I.workspace.id===s)??t[0]??null,x=v.useMemo(()=>new Set(n),[n]),S=v.useMemo(()=>b?Wm([b]).filter(I=>!I.session.isArchived&&!I.session.isSubagent):[],[b]),C=v.useMemo(()=>J_(S),[S]),j=(b==null?void 0:b.workspace.id)??"",R=!!j,[L,A]=v.useState([]),[K,H]=v.useState(!1);v.useEffect(()=>{if(!a)return;const I=C.filter(P=>P.children.some(U=>U.session.sessionId===a)).map(P=>P.entry.session.sessionId);I.length!==0&&A(P=>{const U=new Set(P);let G=!1;for(const X of I)U.has(X)||(U.add(X),G=!0);return G?Array.from(U):P})},[a,C]);function F(I){A(P=>P.includes(I)?P.filter(U=>U!==I):[...P,I])}function M(I,P){Ei("immersive"),e(Qn(I,P))}function _(I,P){H(!1),Ei("immersive"),g(I,P)}return i.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(Wo,{currentWorkspace:(b==null?void 0:b.workspace)??null,workspaces:t.map(I=>I.workspace),onSelectWorkspace:I=>{l(I),e(al(I))},content:i.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!R,onClick:()=>H(!0),children:h("shell.createSession")})}),i.jsx("div",{className:"mobile-page-top-body",children:i.jsxs("section",{className:"session-section session-section-sheet",children:[i.jsxs("header",{className:"session-section-heading",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.mobileConversationCurrentWorkspaceSection")})}),i.jsx("span",{className:"session-section-count",children:C.length})]}),C.length===0?i.jsx("p",{className:"session-section-empty",children:h(c?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):i.jsx("div",{className:"session-current-workspace-list",children:C.map(I=>{const P=I.entry.session.sessionId,U=L.includes(P);return i.jsxs("div",{className:"session-list-tree-node",children:[i.jsx(sx,{entry:I.entry,isFavorite:x.has(P),isActive:a===P,variant:"mobile",hasSubsessions:I.children.length>0,onActivate:G=>M(I.entry.workspace.id,G),onToggleSubsessions:()=>F(P),onToggleFavorite:G=>{d(G)},onArchive:G=>f(G),onUnarchive:G=>p(G),onRename:(G,X)=>y(G,X)}),U&&I.children.length>0?i.jsx("div",{className:"session-list-children",children:I.children.map(G=>i.jsx(sx,{entry:G,isFavorite:x.has(G.session.sessionId),isActive:a===G.session.sessionId,depth:1,variant:"mobile",onActivate:X=>M(G.workspace.id,X),onToggleFavorite:X=>{d(X)},onArchive:X=>f(X),onUnarchive:X=>p(X),onRename:(X,Z)=>y(X,Z)},`${G.workspace.id}:${G.session.sessionId}`))}):null]},`${I.entry.workspace.id}:${P}`)})})]})}),i.jsx(ul,{open:K,workspaces:t.map(I=>I.workspace),initialWorkspaceId:s??j,onClose:()=>H(!1),onSelect:_})]})}function d4(){const{currentWorkspaceId:e}=ur();return e?i.jsx(Lo,{to:Fo(e,"files"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.filesEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function h4(){const{currentWorkspaceId:e}=ur();return e?i.jsx(Lo,{to:Fo(e,"git"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.gitEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function f4(){const{currentWorkspaceId:e,navigationGroups:t}=ur();return e?i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:i.jsx(wp,{className:"mobile-panel-scroll-root mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e,navigationGroups:t})}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.terminalManagerEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}const F0="mobile.tools.last-primary-tool",Gc=["files","git"],m4=56,p4=1.2;function ox(e,t){return e==="git"?"git":e==="files"?"files":t}function g4(e,t,n){if(!t)return e;const s=n.x-t.x,a=n.y-t.y;if(Math.abs(s)<m4||Math.abs(s)<Math.abs(a)*p4)return e;const c=Gc.indexOf(e),l=s<0?Math.min(Gc.length-1,c+1):Math.max(0,c-1);return Gc[l]??e}function y4(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(F0)==="git"?"git":"files"}catch{return"files"}}function v4(){var A,K;const e=ri(),t=qn(),n=Hr(),{navigationGroups:s,currentWorkspaceId:a,currentSessionId:c,selectWorkspace:l}=ur(),d=((A=s.find(H=>H.workspace.id===a))==null?void 0:A.workspace)??((K=s[0])==null?void 0:K.workspace)??null,f=new URLSearchParams(e.search).get("tab"),p=v.useRef(y4()),y=ox(f,p.current),[g,b]=v.useState(()=>{const H=ox(f,p.current);return{files:H==="files",git:H==="git"}}),x=v.useRef(null),S=v.useMemo(()=>[{key:"files",title:h("shell.filesEntry"),render:()=>i.jsx(pp,{sessionId:c,workspaceId:a,hideHeading:!0})},{key:"git",title:h("shell.gitEntry"),render:()=>i.jsx(yp,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:a,panelActive:y==="git"})}],[y,c,a]),C=Gc.indexOf(y);v.useEffect(()=>{b(H=>({...H,[y]:!0}))},[y]),v.useEffect(()=>{if(p.current=y,!(typeof window>"u"))try{window.localStorage.setItem(F0,y)}catch{}},[y]),v.useEffect(()=>{if(f===y)return;const H=new URLSearchParams(e.search);H.set("tab",y),t({pathname:e.pathname,search:`?${H.toString()}`},{replace:!0})},[y,e.pathname,e.search,t,f]);function j(H,F="selection"){if(H===y)return;n.trigger(F);const M=new URLSearchParams(e.search);M.set("tab",H),t({pathname:e.pathname,search:`?${M.toString()}`},{replace:!0})}function R(H){if(H.changedTouches.length!==1){x.current=null;return}const F=H.changedTouches[0];x.current={x:F.clientX,y:F.clientY}}function L(H){const F=x.current;if(x.current=null,H.changedTouches.length!==1)return;const M=H.changedTouches[0],_=g4(y,F,{x:M.clientX,y:M.clientY});_!==y&&j(_)}return i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tools-workspace-page",children:d?i.jsxs(i.Fragment,{children:[i.jsx(Wo,{currentWorkspace:d,workspaces:s.map(H=>H.workspace),onSelectWorkspace:H=>{l(H),t(Fo(H,y))},trailing:i.jsx("button",{type:"button",className:"secondary-button mobile-tools-more-button","aria-label":h("shell.toolsMoreAction"),title:h("shell.toolsMoreAction"),onClick:()=>{n.trigger("action"),t(Nu(d.id))},children:i.jsx(w4,{})}),content:i.jsx("div",{className:"mobile-tools-switcher","aria-label":h("shell.mobileToolsEntry"),children:i.jsx("div",{className:"mobile-tools-segmented-control",role:"tablist","aria-label":h("shell.mobileToolsEntry"),children:S.map(H=>{const F=H.key===y;return i.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":F,"aria-selected":F,"aria-controls":`mobile-tool-panel-${H.key}`,onClick:()=>j(H.key,"selection"),children:H.title},H.key)})})})}),i.jsx("section",{className:"mobile-tools-stage","data-active-tool":y,"data-testid":"mobile-tools-stage",onTouchStart:R,onTouchEnd:L,onTouchCancel:()=>{x.current=null},children:i.jsx("div",{className:"mobile-tools-stage-viewport",children:i.jsx("div",{className:"mobile-tools-stage-track",style:{transform:`translateX(-${C*100}%)`},children:S.map(H=>i.jsx("article",{id:`mobile-tool-panel-${H.key}`,role:"tabpanel","aria-label":H.title,"aria-hidden":H.key!==y,className:"mobile-tools-stage-panel",children:i.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[H.key]?H.render():null})},H.key))})})})]}):i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})})})}function w4(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function b4(e){return e.isArchived!==!0&&e.isSubagent!==!0}function O0(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function x4(e){return e.activityState==="idle"&&O0(e)===!1}function ax(e){return e==="creating"||e==="running"}function gu(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function k4(e,t){return gu(t).localeCompare(gu(e))}function lx(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"shell.providerClaudeCode")}function cx(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}const Ac=60*1e3;function S4(){const e=qn(),{navigationGroups:t,currentWorkspaceId:n,refreshNavigation:s,selectWorkspace:a,startDraftSession:c,subscribeGitSnapshot:l,requestGitRefresh:d,addGitSnapshotListener:f,subscribeTerminalManagerSnapshot:p,requestTerminalManagerRefresh:y,addTerminalManagerSnapshotListener:g}=ur(),[b,x]=v.useState(null),[S,C]=v.useState(!1),[j,R]=v.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),L=t.find(T=>T.workspace.id===n)??t[0]??null,A=(L==null?void 0:L.workspace)??null,K=[...(L==null?void 0:L.sessions)??[]].filter(b4).sort(k4),H=K.filter(O0),F=K.filter(x4),M=K.filter(T=>T.activityState==="completed_unread"),_=K.filter(T=>T.isFavorite===!0),I=H.slice(0,6),P=_.slice(0,6);v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(!T){R({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const we=On(mf(T),Ac);R(me=>{var Ce,_e;return{...me,gitLoading:we===null,branch:((Ce=we==null?void 0:we.status)==null?void 0:Ce.snapshot.branch)??null,changedFileCount:((_e=we==null?void 0:we.status)==null?void 0:_e.changes.length)??null}})},[A==null?void 0:A.id]),v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(T)return f(we=>{we.workspaceId===T&&(Mr(mf(T),we),R(me=>{var Ce,_e,Ge;return{...me,gitLoading:!1,branch:((Ce=we.status)==null?void 0:Ce.snapshot.branch)??((_e=we.branches)==null?void 0:_e.currentBranch)??null,changedFileCount:((Ge=we.status)==null?void 0:Ge.changes.length)??null}}))})},[f,A==null?void 0:A.id]),v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(!T){R(me=>({...me,gitLoading:!1,branch:null,changedFileCount:null}));return}const we=On(pf(T),Ac);R(me=>({...me,terminalLoading:we===null,activeTerminalCount:we?we.terminals.filter(Ce=>ax(Ce.status)).length:null,quickLaunchRunning:we?we.templateStatuses.some(Ce=>Ce.occupied):null}))},[A==null?void 0:A.id]),v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(!T){R(we=>({...we,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return g(we=>{we.workspaceId===T&&(Mr(pf(T),{terminals:we.terminals,templates:we.templates,templateStatuses:we.templateStatuses}),R(me=>({...me,terminalLoading:!1,activeTerminalCount:we.terminals.filter(Ce=>ax(Ce.status)).length,quickLaunchRunning:we.templateStatuses.some(Ce=>Ce.occupied)})))})},[g,A==null?void 0:A.id]),v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(!T)return;const we=On(mf(T),Ac)!==null;l(T),!we&&d(T)},[A==null?void 0:A.id,d,l]),v.useEffect(()=>{const T=(A==null?void 0:A.id)??null;if(!T)return;const we=On(pf(T),Ac)!==null;p(T),!we&&y(T)},[A==null?void 0:A.id,y,p]);async function U(T){await s(),a(T.id),x(null),e(mi(T.id))}async function G(T){await s(),a(T.id),x(null),e(mi(T.id))}function X(){A&&(a(A.id),e(Fo(A.id,"git")))}function Z(){A&&(a(A.id),e(Co(A.id)))}function $(){A&&(a(A.id),e(Nu(A.id)))}function se(){A&&e(al(A.id))}function Y(){A&&C(!0)}function q(T,we){C(!1),c(T,we)}function oe(){A&&(a(A.id),e(mi(A.id)))}function E(T){a(T)}const B=[{label:h("shell.workspaceHomeMetricActive"),value:H.length,onClick:K.length>0?se:void 0},{label:h("shell.workspaceHomeMetricUnread"),value:M.length,onClick:K.length>0?se:void 0},{label:h("shell.workspaceHomeMetricTerminal"),value:j.terminalLoading?"…":j.activeTerminalCount??"—",onClick:A?Z:void 0},{label:h("shell.workspaceHomeMetricChanges"),value:j.gitLoading?"…":j.changedFileCount??"—",onClick:A?X:void 0}],te=[{label:h("shell.workspaceHomeQuickLaunchStatusLabel"),value:j.quickLaunchRunning===null?"…":j.quickLaunchRunning?h("shell.workspaceHomeQuickLaunchRunning"):h("shell.workspaceHomeQuickLaunchStopped"),onClick:A?$:void 0},{label:h("shell.workspaceHomeWaitingInputLabel"),value:F.length,onClick:K.length>0?se:void 0}];return i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[A?i.jsxs(i.Fragment,{children:[i.jsx(Wo,{currentWorkspace:A,workspaces:t.map(T=>T.workspace),onSelectWorkspace:E,sheetContent:T=>i.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{T(),x("import")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{T(),x("clone")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":h("shell.workspaceHomeStatusSectionTitle"),children:i.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:B.map(T=>T.onClick?i.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric",onClick:T.onClick,children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:T.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:T.label})]},T.label):i.jsxs("div",{className:"mobile-workspace-home-toolbar-metric",role:"listitem",children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:T.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:T.label})]},T.label))})})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:oe,children:h("shell.workspaceDetailTitle")}),i.jsx("button",{type:"button",className:"primary-button",onClick:Y,children:h("shell.createSession")})]})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-group",children:te.map(T=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:T.onClick,children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:T.label}),i.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[i.jsx("strong",{children:T.value}),i.jsx(ts,{})]})]},T.label))})}),i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsxs("div",{className:"mobile-workspace-home-section-header",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeActiveSessionsSectionTitle")}),A?i.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:se,children:h("shell.workspaceHomeViewAllAction")}):null]}),i.jsx("div",{className:"mobile-workspace-home-group",children:I.length===0?i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Y,children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:h("shell.createSession")}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:A.name})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]}):I.map(T=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Qn(A.id,T.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:T.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[lx(T.provider)," · ",cx(gu(T))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]},T.sessionId))})]}),P.length>0?i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsx("div",{className:"mobile-workspace-home-section-header",children:i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.favoriteSectionTitle")})}),i.jsx("div",{className:"mobile-workspace-home-group",children:P.map(T=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Qn(A.id,T.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:T.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[lx(T.provider)," · ",cx(gu(T))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]},T.sessionId))})]}):null]})]}):i.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:i.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeSwitcherTitle")}),i.jsxs("div",{className:"mobile-workspace-home-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>x("import"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>x("clone"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(ts,{})})]})]})]})}),i.jsx(CC,{open:b==="import",onClose:()=>x(null),onImported:U}),i.jsx(SC,{open:b==="clone",onClose:()=>x(null),onCloned:G}),i.jsx(ul,{open:S,workspaces:t.map(T=>T.workspace),initialWorkspaceId:(A==null?void 0:A.id)??n??null,onClose:()=>C(!1),onSelect:q})]})}function mf(e){return`git-sidebar.snapshot.${e}`}function pf(e){return`terminal-manager.snapshot.${e}`}function ts(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function ux(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function C4(e){return e.isArchived!==!0&&e.isSubagent!==!0}function j4(e){return e.isArchived===!0&&e.isSubagent!==!0}function dx(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function hx(e,t){return dx(t).localeCompare(dx(e))}const gf=60*1e3,yf=10;function N4(){var se;const{workspaceId:e=""}=wu(),t=qn(),{showToast:n}=Yn(),{navigationGroups:s,currentWorkspaceId:a,favoriteSessionIds:c,workspaceManagementStateById:l,selectWorkspace:d,subscribeGitSnapshot:f,requestGitRefresh:p,subscribeWorkspaceManagementSnapshot:y,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:b,archiveSession:x,unarchiveSession:S,startDraftSession:C}=ur(),[j,R]=v.useState(!1),[L,A]=v.useState(!1),[K,H]=v.useState(yf),F=s.find(Y=>Y.workspace.id===e)??null,M=(F==null?void 0:F.workspace)??null,_=v.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(C4).sort(hx),[F]),I=v.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(j4).sort(hx),[F]);v.useEffect(()=>{e&&d(e)},[d,e]),v.useEffect(()=>{if(!e)return;f(e),y(e);const Y=On(E4(e),gf)!==null,q=On(fx(e),gf)!==null;Y||p(e),q||g(e)},[p,g,f,y,e]),v.useEffect(()=>{H(yf)},[e]);const P=v.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const Y=On(fx(e),gf),q=l[e]??null,oe=(q==null?void 0:q.detail)??(M?R4(M,Y):Y??null);return{loading:(q==null?void 0:q.loading)??!1,error:(q==null?void 0:q.error)??null,hasMeaningfulSummary:M4(oe),summary:oe}},[M,e,l]),U=v.useMemo(()=>P.summary?yC(P.summary.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],[P.summary]),G=v.useMemo(()=>U.length>0?vC(U):void 0,[U]),X=v.useMemo(()=>I.slice(0,K),[I,K]);async function Z(){if(!(!M||!(typeof window>"u"||window.confirm(h("shell.manageWorkspaceRemoveConfirmTarget",{name:M.name}))))){R(!0);try{await Mk(M.id),n({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(q){n({title:q instanceof Error?q.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{R(!1)}}}function $(Y,q){A(!1),C(Y,q)}return M?i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[i.jsx(Wo,{currentWorkspace:M,workspaces:s.map(Y=>Y.workspace),heading:h("shell.workspaceDetailTitle"),triggerLabel:M.name,onSelectWorkspace:Y=>{d(Y),t(mi(Y))},content:i.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[i.jsx("button",{type:"button",className:"primary-button",onClick:()=>A(!0),children:h("shell.createSession")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(KS(M.id))},children:h("shell.filesEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(Co(M.id))},children:h("shell.terminalsEntry")})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.workspaceDetailSummaryTitle")})}),a!==M.id?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(M.id),children:h("shell.switchWorkspace")}):null]}),P.loading&&P.summary===null?i.jsx("p",{children:h("common.loading")}):null,P.error?i.jsx("p",{className:"status-text","data-tone":"error",children:P.error}):null,P.summary?i.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[i.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[i.jsx("span",{children:h("shell.manageWorkspacePathLabel")}),i.jsx("strong",{title:P.summary.path,children:P.summary.path})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("strong",{title:P.summary.git.currentBranch??h("common.unknown"),children:P.summary.git.currentBranch??h("common.unknown")})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{children:P.hasMeaningfulSummary?P.summary.git.commitCount??0:"—"})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCodeCompositionFiles")}),i.jsx("strong",{children:P.hasMeaningfulSummary?P.summary.codeComposition.scannedFileCount:"—"})]})]}):null,i.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(QS(M.id))},children:h("shell.gitEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(Nu(M.id))},children:h("shell.terminalManagerEntry")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>{Z()},children:h(j?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.manageWorkspaceCodeCompositionLabel")})}),P.summary?i.jsx("span",{className:"mobile-feature-counter",children:P.summary.codeComposition.scannedFileCount}):null]}),P.loading&&P.summary===null?i.jsx("p",{children:h("common.loading")}):null,P.summary?U.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:G,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:P.summary.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:U.map(Y=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:Y.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:Y.type})]}),i.jsxs("span",{children:[Y.count," · ",gC(Y)]})]},Y.key))})]}):i.jsx("p",{children:P.summary.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}):null,(se=P.summary)!=null&&se.codeComposition.truncated?i.jsx("p",{className:"mobile-workspace-composition-note",children:h("shell.manageWorkspaceCodeTruncated",{count:P.summary.codeComposition.scannedFileCount})}):null]}),i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.recentSessionsSectionTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:_.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:_.length===0?i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyWorkspaceSessions")})}):_.map(Y=>{const q=ds(Y.title,h("common.unknown")),oe=c.includes(Y.sessionId);return i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Qn(M.id,Y.sessionId)),children:[i.jsx("span",{className:"mobile-session-row-title",title:q.fullTitle,children:q.displayTitle}),i.jsx("span",{className:"mobile-session-row-provider",children:ux(Y.provider)})]}),i.jsxs("div",{className:"mobile-session-row-actions",children:[i.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:Y.messageCount}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h(oe?"shell.unfavoriteAction":"shell.favoriteAction"),title:h(oe?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{b(Y.sessionId)},children:i.jsx(P4,{active:oe})}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h("shell.archiveAction"),title:h("shell.archiveAction"),onClick:()=>{x(Y.sessionId)},children:i.jsx(T4,{})})]})]},Y.sessionId)})})]}),I.length>0?i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.archiveModalTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:I.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:X.map(Y=>i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[i.jsx("span",{className:"mobile-session-row-title",title:Y.title,children:Y.title}),i.jsx("span",{className:"mobile-session-row-provider",children:ux(Y.provider)})]}),i.jsx("div",{className:"mobile-session-row-actions",children:i.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{S(Y.sessionId)},children:h("shell.unarchiveAction")})})]},Y.sessionId))}),X.length<I.length?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{H(Y=>Y+yf)},children:h("shell.archiveExpandMore")}):null]}):null]}),i.jsx(ul,{open:L,workspaces:s.map(Y=>Y.workspace),initialWorkspaceId:a??M.id,onClose:()=>A(!1),onSelect:$})]}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.workspaceDetailMissingTitle")}),i.jsx("p",{children:h("shell.workspaceDetailMissingBody")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:h("shell.mobileWorkspacesEntry")})]})})}function P4({active:e}){return i.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function T4(){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M4 7.5h16"}),i.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),i.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),i.jsx("path",{d:"M10 11.5h4"})]})}function fx(e){return`workspace-management.summary.${e}`}function E4(e){return`git-sidebar.snapshot.${e}`}function R4(e,t){const n=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!n,repoRoot:n,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function M4(e){return e?e.git.isRepository||e.git.repoRoot!==null||e.git.currentBranch!==null||e.git.commitCount!==null||e.git.remotes.length>0||e.codeComposition.scannedFileCount>0||e.codeComposition.items.length>0||e.codeComposition.error!==null:!1}function A4({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function L4(){const e=Mn(),t=A4(e);return i.jsx(mO,{shellMode:t})}const I4=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function D4(){return i.jsx("main",{className:"workbench-page conversation-page-shell",children:i.jsx("section",{className:"workbench-center-placeholder",children:i.jsxs("div",{className:"workbench-empty-guide surface-card",children:[i.jsx("p",{className:"workbench-empty-eyebrow",children:h("workbench.emptyEyebrow")}),i.jsx("div",{className:"workbench-empty-main",children:i.jsxs("div",{className:"workbench-empty-copy",children:[i.jsx("h1",{children:h("workbench.emptyTitle")}),i.jsx("p",{className:"workbench-empty-body",children:h("workbench.emptyBody")})]})}),i.jsx("ol",{className:"workbench-empty-steps",children:I4.map((e,t)=>i.jsxs("li",{className:"workbench-empty-step",children:[i.jsx("span",{className:"workbench-empty-step-index",children:t+1}),i.jsxs("div",{className:"workbench-empty-step-copy",children:[i.jsx("h2",{children:h(e.titleKey)}),i.jsx("p",{children:h(e.bodyKey)})]})]},e.titleKey))}),i.jsx("p",{className:"workbench-empty-tip",children:h("workbench.emptyTip")})]})})})}function _4(){const{shellMode:e}=ur();return e==="mobile"?i.jsx(Lo,{to:"/workspaces",replace:!0}):i.jsx(D4,{})}async function F4(){const e=pi(),t=Fn.getState(),n=await e.bridge.checkForUpdate(t.releaseChannel);if(!n.ok||!n.value)throw new Error(n.detail??"更新检查失败。");return n.value}async function O4(e){return pi().bridge.installUpdate(e)}async function B4(){return pi().bridge.rollbackToPreviousVersion()}function B0(){const e=pi(),t=e.isDesktop,[n,s]=v.useState(!1),[a,c]=v.useState(!1),[l,d]=v.useState(!1),[f,p]=v.useState(null),[y,g]=v.useState(null),[b,x]=v.useState(null),[S,C]=v.useState(!1);async function j(){var F,M;s(!0),p(null);try{const _=await F4();x(_.manifest),g(_.currentVersion),C(_.hasUpdate),p(W4(_.manifest,_.hasUpdate)),_.hasUpdate&&await e.bridge.showNotification(h("settings.releaseUpdateReady"),((F=_.manifest)==null?void 0:F.tagName)??((M=_.manifest)==null?void 0:M.version)??"-")}catch(_){p(_ instanceof Error?_.message:h("settings.releaseCheckFailed"))}finally{s(!1)}}async function R(){if(!(!(b!=null&&b.packageUrl)||!b.signature)){c(!0),p(null);try{const F=await O4(b);if(!F.ok){p(F.detail??h("settings.releaseInstallFailed"));return}p(h("settings.releaseInstallStarted")),await e.bridge.showNotification(h("settings.releaseInstallStarted"),b.version)}catch(F){p(F instanceof Error?F.message:h("settings.releaseInstallFailed"))}finally{c(!1)}}}async function L(){c(!0),p(null);try{const F=await B4();p(F.ok?h("settings.releaseRollbackStarted"):F.detail??h("settings.releaseRollbackFailed")),F.ok&&await e.bridge.showNotification(h("settings.releaseRollbackStarted"),y??h("settings.releaseUnknownVersion"))}catch(F){p(F instanceof Error?F.message:h("settings.releaseRollbackFailed"))}finally{c(!1)}}async function A(){if(b!=null&&b.htmlUrl){d(!0);try{const F=await e.bridge.openExternal(b.htmlUrl);F.ok||p(F.detail??h("settings.releasePageOpenFailed"))}catch(F){p(F instanceof Error?F.message:h("settings.releasePageOpenFailed"))}finally{d(!1)}}}const K=!!(t&&(b!=null&&b.packageUrl)&&b.signature&&S),H=f??(t?null:h("settings.clientUpdateUnsupported"));return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.releaseCurrentVersion"),": ",y??h("settings.releaseUnknownVersion")]}),i.jsxs("span",{children:[h("settings.releaseTargetVersion"),": ",(b==null?void 0:b.version)??"-"]}),i.jsxs("span",{children:[h("settings.releaseTargetTag"),": ",(b==null?void 0:b.tagName)??"-"]}),i.jsxs("span",{children:[h("settings.releasePublishedAt"),": ",U4(b==null?void 0:b.publishedAt)]})]}),b?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.releaseNotes")}),b.title&&b.title!==b.tagName?i.jsx("p",{className:"settings-release-title",children:b.title}):null,b.notes?i.jsx("div",{className:"settings-release-markdown",children:i.jsx(Dm,{remarkPlugins:[Bm],children:b.notes})}):i.jsx("p",{children:h("settings.releaseNotesEmpty")})]}):null,H?i.jsx("p",{className:"settings-release-status",children:H}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||n||a,onClick:j,children:h(n?"common.loading":"settings.releaseCheckNow")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!K||a,onClick:R,children:h(a?"common.loading":"settings.releaseInstallNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(b!=null&&b.htmlUrl)||n||a||l,onClick:A,children:h(l?"common.loading":"settings.releaseOpenPage")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||a,onClick:L,children:h("settings.releaseRollback")})]})]})}function W4(e,t){return t?e!=null&&e.packageUrl?e.signature?h("settings.releaseUpdateReady"):h("settings.releaseSignatureMissing"):h("settings.releaseInstallerMissing"):h("settings.releaseUpToDate")}function U4(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function z4(){const e=Fn.getState();return Qe.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function W0(){const e=pi(),[t,n]=v.useState(!1),[s,a]=v.useState(!1),[c,l]=v.useState(null),[d,f]=v.useState(null);async function p(){n(!0),l(null);try{const g=await z4();f(g),l(H4(g)),g.hasUpdate&&await e.bridge.showNotification(h("settings.serverUpdateReady"),`${h("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){l(g instanceof Error?g.message:h("settings.serverCheckFailed"))}finally{n(!1)}}async function y(){if(d!=null&&d.packagePageUrl){a(!0);try{const g=await e.bridge.openExternal(d.packagePageUrl);g.ok||l(g.detail??h("settings.serverOpenPageFailed"))}catch(g){l(g instanceof Error?g.message:h("settings.serverOpenPageFailed"))}finally{a(!1)}}}return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.serverCurrentVersion"),": ",(d==null?void 0:d.currentVersion)??"-"]}),i.jsxs("span",{children:[h("settings.serverTargetVersion"),": ",(d==null?void 0:d.latestVersion)??h("settings.serverLatestUnknown")]}),i.jsxs("span",{children:[h("settings.serverPackageName"),": ",(d==null?void 0:d.packageName)??"-"]})]}),d?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.serverUpdateCommand")}),i.jsx("p",{className:"settings-release-command",children:d.updateCommand})]}):null,c?i.jsx("p",{className:"settings-release-status",children:c}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:t,onClick:p,children:h(t?"common.loading":"settings.serverCheckNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(d!=null&&d.packagePageUrl)||t||s,onClick:y,children:h(s?"common.loading":"settings.serverOpenPage")})]})]})}function H4(e){return e.latestVersion?e.hasUpdate?h("settings.serverUpdateReady"):h("settings.serverUpToDate"):h("settings.serverLatestUnknown")}function mx({title:e,description:t,actions:n,content:s,className:a}){return i.jsx(r0,{className:a,children:i.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[i.jsx("div",{className:"mobile-page-header-copy",children:i.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),n?i.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:n}):null]}),t?i.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,s?i.jsx("div",{className:"mobile-page-header-content",children:s}):null]})})}function q4(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function px(e){return h(e==="en-US"?"locale.enUS":"locale.zhCN")}function gx(e){return h(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function yx(e){switch(e){case"acceptEdits":return h("settings.permissionModeAcceptEdits");case"bypassPermissions":return h("settings.permissionModeBypassPermissions");default:return h("settings.permissionModeDefault")}}function $4(){const e=qn(),{theme:t,setTheme:n}=bk(),s=rN($=>$),a=kf($=>$.profile.language),c=kf($=>$.profile.defaultPermissionMode),l=Ti($=>$.showSystemFiles),d=Ti($=>$.notificationPreferences.notifyOnPermissionRequest),f=Ti($=>$.notificationPreferences.notifyOnSessionCompleted),p=Ti($=>$.notificationPreferences.notifyOnSessionFailed),y={language:a,defaultPermissionMode:c},g=Mn(),b=am(s.platform),x=b,[S,C]=v.useState(s.hostBaseUrl);v.useEffect(()=>{C(s.hostBaseUrl)},[s.hostBaseUrl]);function j(){vn.clear(),ni.resetToLocalFallback(),e("/login",{replace:!0})}function R($){n($)}function L($){try{return Ri($)}catch{return null}}const A=L(S),K=A!==null&&A!==s.hostBaseUrl;function H($){$.preventDefault(),A&&Fn.update({hostBaseUrl:A})}const F=[{value:"default",label:h("settings.permissionModeDefault")},{value:"acceptEdits",label:h("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:h("settings.permissionModeBypassPermissions")}];function M($){Fn.update({releaseChannel:$==="beta"?"beta":"stable"})}function _($){Fn.update({autoReconnect:$})}function I($){Fn.update({autoCheckUpdate:$})}function P($){const se=$==="acceptEdits"||$==="bypassPermissions"?$:"default";ni.updateProfile({defaultPermissionMode:se}).catch(()=>{})}function U($){So.setShowSystemFiles($)}function G($){So.setNotificationPreferences({notifyOnPermissionRequest:$})}function X($){So.setNotificationPreferences({notifyOnSessionCompleted:$})}function Z($){So.setNotificationPreferences({notifyOnSessionFailed:$})}return{platform:g,theme:t,applyTheme:R,runtimeConfig:s,accountPreferences:y,showSystemFiles:l,notifyOnPermissionRequest:d,notifyOnSessionCompleted:f,notifyOnSessionFailed:p,showServerSettings:x,canConfigureServerAddress:b,hostBaseUrlDraft:S,setHostBaseUrlDraft:C,canSaveHostBaseUrl:K,permissionModeOptions:F,handleHostBaseUrlSubmit:H,handleLogout:j,updateReleaseChannel:M,updateAutoReconnect:_,updateAutoCheckUpdate:I,updateDefaultPermissionMode:P,updateShowSystemFiles:U,updateNotifyOnPermissionRequest:G,updateNotifyOnSessionCompleted:X,updateNotifyOnSessionFailed:Z}}function vx(){const e=$4(),t=Sk();return e.platform.isMobile?i.jsx(G4,{model:e,appVersion:t}):i.jsx(V4,{model:e,appVersion:t})}function V4({model:e,appVersion:t}){const{theme:n,applyTheme:s,runtimeConfig:a,accountPreferences:c,showSystemFiles:l,notifyOnPermissionRequest:d,notifyOnSessionCompleted:f,notifyOnSessionFailed:p,showServerSettings:y,hostBaseUrlDraft:g,setHostBaseUrlDraft:b,canSaveHostBaseUrl:x,permissionModeOptions:S,platform:C,handleHostBaseUrlSubmit:j,handleLogout:R,updateReleaseChannel:L,updateAutoReconnect:A,updateAutoCheckUpdate:K,updateDefaultPermissionMode:H,updateShowSystemFiles:F,updateNotifyOnPermissionRequest:M,updateNotifyOnSessionCompleted:_,updateNotifyOnSessionFailed:I}=e;return i.jsx("div",{className:"settings-page",children:i.jsxs("div",{className:"settings-container",children:[i.jsx("h1",{className:"settings-title",children:h("settings.title")}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.appearance")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.language")}),i.jsx("span",{className:"settings-row-description",children:h("settings.languageDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx(ym,{})})]}),i.jsxs("div",{className:"settings-row settings-row-theme",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.theme")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx("div",{className:"theme-selector",children:vk.map(P=>i.jsxs("button",{type:"button",className:`theme-card ${n===P.id?"active":""}`,"aria-pressed":n===P.id,onClick:()=>s(P.id),children:[i.jsx("span",{className:"theme-preview",style:{background:P.color}}),i.jsx("span",{className:"theme-label",children:wk(P)}),n===P.id?i.jsx("span",{className:"theme-check",children:"✓"}):null]},P.id))})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.showSystemFiles")}),i.jsx("span",{className:"settings-row-description",children:h("settings.showSystemFilesDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox","aria-label":h("settings.showSystemFiles"),checked:l,onChange:P=>F(P.target.checked)}),i.jsx("span",{children:h(l?"settings.enabled":"settings.disabled")})]})})]})]})]}),y?i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.serverConnection")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.serverAddress")}),i.jsx("span",{className:"settings-row-description",children:h("settings.serverDescription")})]}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsxs("form",{className:"settings-inline-form",onSubmit:j,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input",value:g,onChange:P=>b(P.target.value)}),i.jsx("button",{className:"settings-button",disabled:!x,type:"submit",children:h("common.save")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:a.autoReconnect,onChange:P=>A(P.target.checked)}),i.jsx("span",{children:a.autoReconnect?h("settings.enabled"):h("settings.disabled")})]})})]})]})]}):null,i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.securityPrivacy")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select",value:c.defaultPermissionMode,onChange:P=>H(P.target.value),children:S.map(P=>i.jsx("option",{value:P.value,children:P.label},P.value))})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.notifyOnPermissionRequest")}),i.jsx("span",{className:"settings-row-description",children:h("settings.notifyOnPermissionRequestDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox","aria-label":h("settings.notifyOnPermissionRequest"),checked:d,onChange:P=>M(P.target.checked)}),i.jsx("span",{children:h(d?"settings.enabled":"settings.disabled")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.notifyOnSessionCompleted")}),i.jsx("span",{className:"settings-row-description",children:h("settings.notifyOnSessionCompletedDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox","aria-label":h("settings.notifyOnSessionCompleted"),checked:f,onChange:P=>_(P.target.checked)}),i.jsx("span",{children:h(f?"settings.enabled":"settings.disabled")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.notifyOnSessionFailed")}),i.jsx("span",{className:"settings-row-description",children:h("settings.notifyOnSessionFailedDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox","aria-label":h("settings.notifyOnSessionFailed"),checked:p,onChange:P=>I(P.target.checked)}),i.jsx("span",{children:h(p?"settings.enabled":"settings.disabled")})]})})]})]})]}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.softwareUpdate")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select",value:a.releaseChannel,onChange:P=>L(P.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.serverUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx(W0,{})})]}),C.isWeb?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:a.autoCheckUpdate,onChange:P=>K(P.target.checked)}),i.jsx("span",{children:a.autoCheckUpdate?h("settings.enabled"):h("settings.disabled")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.clientUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx(B0,{})})]})]})]})]}),i.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[i.jsxs("span",{className:"settings-version",children:["CodingNS v",t]}),i.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:R,type:"button",children:h("common.logout")})]})]})})}function G4({model:e,appVersion:t}){const n=qn(),{section:s}=wu(),a=q4(s)?s:null,c=e.showServerSettings?[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:px(e.accountPreferences.language),icon:i.jsx(bx,{})},{id:"server-connection",title:h("settings.serverConnection"),description:h("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:i.jsx(J4,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:yx(e.accountPreferences.defaultPermissionMode),icon:i.jsx(kx,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:gx(e.runtimeConfig.releaseChannel),icon:i.jsx(xx,{})}]:[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:px(e.accountPreferences.language),icon:i.jsx(bx,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:yx(e.accountPreferences.defaultPermissionMode),icon:i.jsx(kx,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:gx(e.runtimeConfig.releaseChannel),icon:i.jsx(xx,{})}];return(a?c.find(d=>d.id===a)??null:null)?i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(mx,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[a==="appearance"?i.jsx(K4,{model:e}):null,a==="server-connection"&&e.showServerSettings?i.jsx(Q4,{model:e}):null,a==="security-privacy"?i.jsx(Y4,{model:e}):null,a==="software-update"?i.jsx(X4,{model:e}):null]}),i.jsx(wx,{onLogout:e.handleLogout})]}):i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(mx,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[i.jsx("section",{className:"settings-mobile-group-section",children:i.jsx("div",{className:"settings-mobile-card",children:c.map(d=>i.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>n(`/settings/${d.id}`),children:[i.jsx("span",{className:"settings-mobile-nav-icon",children:d.icon}),i.jsxs("span",{className:"settings-mobile-nav-copy",children:[i.jsx("span",{className:"settings-mobile-nav-title",children:d.title}),i.jsx("span",{className:"settings-mobile-nav-description",children:d.description})]}),i.jsxs("span",{className:"settings-mobile-nav-trailing",children:[d.value?i.jsx("span",{className:"settings-mobile-nav-value",children:d.value}):null,i.jsx(Z4,{})]})]},d.id))})}),i.jsx("div",{className:"settings-footer settings-footer-mobile",children:i.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),i.jsx(wx,{onLogout:e.handleLogout})]})}function K4({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.language")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.languageDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.language")})}),i.jsx(ym,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.theme")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.themeDescription")}),i.jsx("div",{className:"settings-mobile-card",children:vk.map(t=>{const n=e.theme===t.id;return i.jsxs("button",{type:"button",className:`settings-mobile-choice-row${n?" active":""}`,"aria-pressed":n,onClick:()=>e.applyTheme(t.id),children:[i.jsxs("span",{className:"settings-mobile-choice-leading",children:[i.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),i.jsx("span",{className:"settings-mobile-choice-label",children:wk(t)})]}),i.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:n?i.jsx(ez,{}):null})]},t.id)})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.fileManager")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.showSystemFilesDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.showSystemFiles")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.showSystemFilesDescription")})]}),i.jsx(To,{checked:e.showSystemFiles,label:h("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})})]})]})}function Q4({model:e}){return i.jsxs(i.Fragment,{children:[e.canConfigureServerAddress?i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverAddress")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.serverDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),i.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:h("common.save")})]})})]}):null,i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverConnection")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx(To,{checked:e.runtimeConfig.autoReconnect,label:h("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function Y4({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.securityPrivacy")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.securityPrivacySectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.accountPreferences.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>i.jsx("option",{value:t.value,children:t.label},t.value))})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.notificationSettings")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.notificationSettingsDescription")}),i.jsxs("div",{className:"settings-mobile-card",children:[i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.notifyOnPermissionRequest")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.notifyOnPermissionRequestDescription")})]}),i.jsx(To,{checked:e.notifyOnPermissionRequest,label:h("settings.notifyOnPermissionRequest"),onChange:e.updateNotifyOnPermissionRequest})]}),i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.notifyOnSessionCompleted")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.notifyOnSessionCompletedDescription")})]}),i.jsx(To,{checked:e.notifyOnSessionCompleted,label:h("settings.notifyOnSessionCompleted"),onChange:e.updateNotifyOnSessionCompleted})]}),i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.notifyOnSessionFailed")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.notifyOnSessionFailedDescription")})]}),i.jsx(To,{checked:e.notifyOnSessionFailed,label:h("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function X4({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.softwareUpdate")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.softwareUpdateSectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverUpdate")}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx(W0,{})})]}),e.platform.isWeb?null:i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.clientUpdate")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx(To,{checked:e.runtimeConfig.autoCheckUpdate,label:h("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx(B0,{})})]})]})}function wx({onLogout:e}){return i.jsx("div",{className:"settings-mobile-sticky-footer",children:i.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:h("common.logout")})})}function To({checked:e,label:t,onChange:n}){return i.jsxs("label",{className:"settings-mobile-switch","aria-label":t,children:[i.jsx("input",{type:"checkbox",checked:e,onChange:s=>n(s.target.checked)}),i.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:i.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function bx(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.5a6.5 6.5 0 1 0 6.5 6.5c0-.8-.6-1.4-1.4-1.4h-1.6A1.5 1.5 0 0 1 12 7.1V5.5c0-1.1-.9-2-2-2Z"}),i.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function J4(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),i.jsx("path",{d:"M10 9.5V16"}),i.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function xx(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),i.jsx("path",{d:"M7 16h6"}),i.jsx("path",{d:"M10 13.5V16"}),i.jsx("path",{d:"m8 8 2 2 3-3"})]})}function kx(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.2 15 5v4.4c0 3-1.9 5.8-5 7.4-3.1-1.6-5-4.4-5-7.4V5l5-1.8Z"}),i.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function Z4(){return i.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:i.jsx("path",{d:"m4 2 4 4-4 4"})})}function ez(){return i.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function tz(){const e=Ux(n=>n.session),t=ri();if(!e){const n=`${t.pathname}${t.search}`;return i.jsx(Lo,{to:`/login?returnTo=${encodeURIComponent(n)}`,replace:!0})}return i.jsx(Nf,{})}function Sx(){const{shellMode:e}=ur();return i.jsx(Lo,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const nz=[{path:"/bootstrap",element:i.jsx(qT,{})},{path:"/login",element:i.jsx(XT,{})},{path:"/desktop-window-preview",element:i.jsx(eW,{})},{path:"/",element:i.jsx(tz,{}),children:[{path:"desktop-window/:windowId",element:i.jsx(r4,{})},{element:i.jsx(L4,{}),children:[{index:!0,element:i.jsx(Sx,{})},{path:"landing",element:i.jsx(_4,{})},{path:"workspaces",element:i.jsx(S4,{})},{path:"workspaces/:workspaceId",element:i.jsx(N4,{})},{path:"workspaces/:workspaceId/sessions",element:i.jsx(u4,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:i.jsx(_B,{})},{path:"workspaces/:workspaceId/tools",element:i.jsx(v4,{})},{path:"workspaces/:workspaceId/tools/files",element:i.jsx(d4,{})},{path:"workspaces/:workspaceId/tools/git",element:i.jsx(h4,{})},{path:"workspaces/:workspaceId/tools/processes",element:i.jsx(f4,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await Eo(()=>import("./TerminalPage-4ulgBhv9.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"settings",element:i.jsx(vx,{})},{path:"settings/:section",element:i.jsx(vx,{})},{path:"*",element:i.jsx(Sx,{})}]}]}];function rz(){return XP(nz)}function iz(){const e=Ao(n=>n.profile.language),t=v.useMemo(()=>rz(),[]);return i.jsx(yT,{children:i.jsx(DT,{children:i.jsx(CT,{language:e,children:i.jsx(RT,{children:i.jsx(IT,{children:i.jsx(oT,{router:t})})})})})})}MN().finally(()=>{Cj.createRoot(document.getElementById("root")).render(i.jsx(iz,{}))});export{nC as C,Wo as M,FU as T,vn as a,Hr as b,rp as c,qn as d,wu as e,ur as f,Bx as g,Yn as h,az as i,On as j,i as k,DU as l,hz as m,ex as n,cz as o,dz as p,Hn as q,v as r,ip as s,h as t,Mn as u,lz as v,Mr as w,_U as x,uz as y,oz as z};
|