@jingyi0605/codingns 0.1.3 → 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-Nq5sPc5c.js → TerminalPage-4ulgBhv9.js} +19 -19
- package/dist/public/assets/{index-9hnprhO7.css → index-C5lu52cQ.css} +1 -1
- 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/terminal/terminal-service.js +2 -2
- package/dist/server/modules/terminal/terminal-service.js.map +1 -1
- 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 +32 -6
- package/dist/server/server/create-server.js.map +1 -1
- package/package.json +1 -1
- package/dist/public/assets/index-BTpmuKhG.js +0 -108
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-Nq5sPc5c.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Y1=Object.defineProperty;var X1=(e,t,n)=>t in e?Y1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var He=(e,t,n)=>X1(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 Va(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var eh={exports:{}},fa={},th={exports:{}},Ft={};/**
|
|
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 Sy;function J1(){if(Sy)return Ft;Sy=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 k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function j(B,re,T){this.props=B,this.context=re,this.refs=C,this.updater=T||k}j.prototype.isReactComponent={},j.prototype.setState=function(B,re){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,re,"setState")},j.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function A(){}A.prototype=j.prototype;function L(B,re,T){this.props=B,this.context=re,this.refs=C,this.updater=T||k}var M=L.prototype=new A;M.constructor=L,S(M,j.prototype),M.isPureReactComponent=!0;var z=Array.isArray,V=Object.prototype.hasOwnProperty,F={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function _(B,re,T){var ke,ge={},Ee=null,Be=null;if(re!=null)for(ke in re.ref!==void 0&&(Be=re.ref),re.key!==void 0&&(Ee=""+re.key),re)V.call(re,ke)&&!I.hasOwnProperty(ke)&&(ge[ke]=re[ke]);var Ye=arguments.length-2;if(Ye===1)ge.children=T;else if(1<Ye){for(var $e=Array(Ye),rt=0;rt<Ye;rt++)$e[rt]=arguments[rt+2];ge.children=$e}if(B&&B.defaultProps)for(ke in Ye=B.defaultProps,Ye)ge[ke]===void 0&&(ge[ke]=Ye[ke]);return{$$typeof:e,type:B,key:Ee,ref:Be,props:ge,_owner:F.current}}function D(B,re){return{$$typeof:e,type:B.type,key:re,ref:B.ref,props:B.props,_owner:B._owner}}function P(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function J(B){var re={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(T){return re[T]})}var X=/\/+/g;function G(B,re){return typeof B=="object"&&B!==null&&B.key!=null?J(""+B.key):re.toString(36)}function te(B,re,T,ke,ge){var Ee=typeof B;(Ee==="undefined"||Ee==="boolean")&&(B=null);var Be=!1;if(B===null)Be=!0;else switch(Ee){case"string":case"number":Be=!0;break;case"object":switch(B.$$typeof){case e:case t:Be=!0}}if(Be)return Be=B,ge=ge(Be),B=ke===""?"."+G(Be,0):ke,z(ge)?(T="",B!=null&&(T=B.replace(X,"$&/")+"/"),te(ge,re,T,"",function(rt){return rt})):ge!=null&&(P(ge)&&(ge=D(ge,T+(!ge.key||Be&&Be.key===ge.key?"":(""+ge.key).replace(X,"$&/")+"/")+B)),re.push(ge)),1;if(Be=0,ke=ke===""?".":ke+":",z(B))for(var Ye=0;Ye<B.length;Ye++){Ee=B[Ye];var $e=ke+G(Ee,Ye);Be+=te(Ee,re,T,$e,ge)}else if($e=b(B),typeof $e=="function")for(B=$e.call(B),Ye=0;!(Ee=B.next()).done;)Ee=Ee.value,$e=ke+G(Ee,Ye++),Be+=te(Ee,re,T,$e,ge);else if(Ee==="object")throw re=String(B),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.");return Be}function q(B,re,T){if(B==null)return B;var ke=[],ge=0;return te(B,ke,"","",function(Ee){return re.call(T,Ee,ge++)}),ke}function me(B){if(B._status===-1){var re=B._result;re=re(),re.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=re)}if(B._status===1)return B._result.default;throw B._result}var ne={current:null},K={transition:null},ae={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:K,ReactCurrentOwner:F};function E(){throw Error("act(...) is not supported in production builds of React.")}return Ft.Children={map:q,forEach:function(B,re,T){q(B,function(){re.apply(this,arguments)},T)},count:function(B){var re=0;return q(B,function(){re++}),re},toArray:function(B){return q(B,function(re){return re})||[]},only:function(B){if(!P(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},Ft.Component=j,Ft.Fragment=n,Ft.Profiler=a,Ft.PureComponent=L,Ft.StrictMode=s,Ft.Suspense=f,Ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,Ft.act=E,Ft.cloneElement=function(B,re,T){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var ke=S({},B.props),ge=B.key,Ee=B.ref,Be=B._owner;if(re!=null){if(re.ref!==void 0&&(Ee=re.ref,Be=F.current),re.key!==void 0&&(ge=""+re.key),B.type&&B.type.defaultProps)var Ye=B.type.defaultProps;for($e in re)V.call(re,$e)&&!I.hasOwnProperty($e)&&(ke[$e]=re[$e]===void 0&&Ye!==void 0?Ye[$e]:re[$e])}var $e=arguments.length-2;if($e===1)ke.children=T;else if(1<$e){Ye=Array($e);for(var rt=0;rt<$e;rt++)Ye[rt]=arguments[rt+2];ke.children=Ye}return{$$typeof:e,type:B.type,key:ge,ref:Ee,props:ke,_owner:Be}},Ft.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},Ft.createElement=_,Ft.createFactory=function(B){var re=_.bind(null,B);return re.type=B,re},Ft.createRef=function(){return{current:null}},Ft.forwardRef=function(B){return{$$typeof:d,render:B}},Ft.isValidElement=P,Ft.lazy=function(B){return{$$typeof:y,_payload:{_status:-1,_result:B},_init:me}},Ft.memo=function(B,re){return{$$typeof:p,type:B,compare:re===void 0?null:re}},Ft.startTransition=function(B){var re=K.transition;K.transition={};try{B()}finally{K.transition=re}},Ft.unstable_act=E,Ft.useCallback=function(B,re){return ne.current.useCallback(B,re)},Ft.useContext=function(B){return ne.current.useContext(B)},Ft.useDebugValue=function(){},Ft.useDeferredValue=function(B){return ne.current.useDeferredValue(B)},Ft.useEffect=function(B,re){return ne.current.useEffect(B,re)},Ft.useId=function(){return ne.current.useId()},Ft.useImperativeHandle=function(B,re,T){return ne.current.useImperativeHandle(B,re,T)},Ft.useInsertionEffect=function(B,re){return ne.current.useInsertionEffect(B,re)},Ft.useLayoutEffect=function(B,re){return ne.current.useLayoutEffect(B,re)},Ft.useMemo=function(B,re){return ne.current.useMemo(B,re)},Ft.useReducer=function(B,re,T){return ne.current.useReducer(B,re,T)},Ft.useRef=function(B){return ne.current.useRef(B)},Ft.useState=function(B){return ne.current.useState(B)},Ft.useSyncExternalStore=function(B,re,T){return ne.current.useSyncExternalStore(B,re,T)},Ft.useTransition=function(){return ne.current.useTransition()},Ft.version="18.3.1",Ft}var Cy;function Jf(){return Cy||(Cy=1,th.exports=J1()),th.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 jy;function Z1(){if(jy)return fa;jy=1;var e=Jf(),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,k=null;p!==void 0&&(b=""+p),f.key!==void 0&&(b=""+f.key),f.ref!==void 0&&(k=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:k,props:g,_owner:a.current}}return fa.Fragment=n,fa.jsx=l,fa.jsxs=l,fa}var Ny;function ej(){return Ny||(Ny=1,eh.exports=Z1()),eh.exports}var i=ej(),oc={},nh={exports:{}},ur={},rh={exports:{}},ih={};/**
|
|
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 Py;function tj(){return Py||(Py=1,(function(e){function t(K,ae){var E=K.length;K.push(ae);e:for(;0<E;){var B=E-1>>>1,re=K[B];if(0<a(re,ae))K[B]=ae,K[E]=re,E=B;else break e}}function n(K){return K.length===0?null:K[0]}function s(K){if(K.length===0)return null;var ae=K[0],E=K.pop();if(E!==ae){K[0]=E;e:for(var B=0,re=K.length,T=re>>>1;B<T;){var ke=2*(B+1)-1,ge=K[ke],Ee=ke+1,Be=K[Ee];if(0>a(ge,E))Ee<re&&0>a(Be,ge)?(K[B]=Be,K[Ee]=E,B=Ee):(K[B]=ge,K[ke]=E,B=ke);else if(Ee<re&&0>a(Be,E))K[B]=Be,K[Ee]=E,B=Ee;else break e}}return ae}function a(K,ae){var E=K.sortIndex-ae.sortIndex;return E!==0?E:K.id-ae.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,k=!1,S=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,A=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 M(K){for(var ae=n(p);ae!==null;){if(ae.callback===null)s(p);else if(ae.startTime<=K)s(p),ae.sortIndex=ae.expirationTime,t(f,ae);else break;ae=n(p)}}function z(K){if(C=!1,M(K),!S)if(n(f)!==null)S=!0,me(V);else{var ae=n(p);ae!==null&&ne(z,ae.startTime-K)}}function V(K,ae){S=!1,C&&(C=!1,A(_),_=-1),k=!0;var E=b;try{for(M(ae),g=n(f);g!==null&&(!(g.expirationTime>ae)||K&&!J());){var B=g.callback;if(typeof B=="function"){g.callback=null,b=g.priorityLevel;var re=B(g.expirationTime<=ae);ae=e.unstable_now(),typeof re=="function"?g.callback=re:g===n(f)&&s(f),M(ae)}else s(f);g=n(f)}if(g!==null)var T=!0;else{var ke=n(p);ke!==null&&ne(z,ke.startTime-ae),T=!1}return T}finally{g=null,b=E,k=!1}}var F=!1,I=null,_=-1,D=5,P=-1;function J(){return!(e.unstable_now()-P<D)}function X(){if(I!==null){var K=e.unstable_now();P=K;var ae=!0;try{ae=I(!0,K)}finally{ae?G():(F=!1,I=null)}}else F=!1}var G;if(typeof L=="function")G=function(){L(X)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,q=te.port2;te.port1.onmessage=X,G=function(){q.postMessage(null)}}else G=function(){j(X,0)};function me(K){I=K,F||(F=!0,G())}function ne(K,ae){_=j(function(){K(e.unstable_now())},ae)}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(K){K.callback=null},e.unstable_continueExecution=function(){S||k||(S=!0,me(V))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(K){switch(b){case 1:case 2:case 3:var ae=3;break;default:ae=b}var E=b;b=ae;try{return K()}finally{b=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,ae){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var E=b;b=K;try{return ae()}finally{b=E}},e.unstable_scheduleCallback=function(K,ae,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,K){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=E+re,K={id:y++,callback:ae,priorityLevel:K,startTime:E,expirationTime:re,sortIndex:-1},E>B?(K.sortIndex=E,t(p,K),n(f)===null&&K===n(p)&&(C?(A(_),_=-1):C=!0,ne(z,E-B))):(K.sortIndex=re,t(f,K),S||k||(S=!0,me(V))),K},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(K){var ae=b;return function(){var E=b;b=ae;try{return K.apply(this,arguments)}finally{b=E}}}})(ih)),ih}var Ty;function nj(){return Ty||(Ty=1,rh.exports=tj()),rh.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 Ey;function rj(){if(Ey)return ur;Ey=1;var e=Jf(),t=nj();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 k(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"||k(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,x,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=x,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 A=/[\-:]([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(A,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(A,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(A,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 M(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 z=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),F=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),J=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),me=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),K=Symbol.iterator;function ae(r){return r===null||typeof r!="object"?null:(r=K&&r[K]||r["@@iterator"],typeof r=="function"?r:null)}var E=Object.assign,B;function re(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 ke(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(fe){var m=fe}Reflect.construct(r,[],o)}else{try{o.call()}catch(fe){m=fe}r.call(o.prototype)}else{try{throw Error()}catch(fe){m=fe}r()}}catch(fe){if(fe&&m&&typeof fe.stack=="string"){for(var w=fe.stack.split(`
|
|
36
|
-
`),x=m.stack.split(`
|
|
37
|
-
`),N=w.length-1,U=x.length-1;1<=N&&0<=U&&w[N]!==x[U];)U--;for(;1<=N&&0<=U;N--,U--)if(w[N]!==x[U]){if(N!==1||U!==1)do if(N--,U--,0>U||w[N]!==x[U]){var Q=`
|
|
38
|
-
`+w[N].replace(" at new "," at ");return r.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",r.displayName)),Q}while(1<=N&&0<=U);break}}}finally{T=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?re(r):""}function ge(r){switch(r.tag){case 5:return re(r.type);case 16:return re("Lazy");case 13:return re("Suspense");case 19:return re("SuspenseList");case 0:case 2:case 15:return r=ke(r.type,!1),r;case 11:return r=ke(r.type.render,!1),r;case 1:return r=ke(r.type,!0),r;default:return""}}function Ee(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 I:return"Fragment";case F:return"Portal";case D:return"Profiler";case _:return"StrictMode";case G:return"Suspense";case te:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case J:return(r.displayName||"Context")+".Consumer";case P:return(r._context.displayName||"Context")+".Provider";case X:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case q:return o=r.displayName||null,o!==null?o:Ee(r.type)||"Memo";case me:o=r._payload,r=r._init;try{return Ee(r(o))}catch{}}return null}function Be(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 Ee(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 Ye(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function $e(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function rt(r){var o=$e(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,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(N){m=""+N,x.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 ft(r){r._valueTracker||(r._valueTracker=rt(r))}function St(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=$e(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function Dt(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 Mt(r,o){var u=o.checked;return E({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function tt(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=Ye(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 Lt(r,o){o=o.checked,o!=null&&M(r,"checked",o,!1)}function Tt(r,o){Lt(r,o);var u=Ye(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")?Ot(r,o.type,u):o.hasOwnProperty("defaultValue")&&Ot(r,o.type,Ye(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Et(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 Ot(r,o,u){(o!=="number"||Dt(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var zt=Array.isArray;function _t(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=""+Ye(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 Ze(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return E({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Bt(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(zt(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:Ye(u)}}function Ct(r,o){var u=Ye(o.value),m=Ye(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 sn(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 ye(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 Ae,_e=(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(Ae=Ae||document.createElement("div"),Ae.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Ae.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function ut(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Ge={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},Jt=["Webkit","ms","Moz","O"];Object.keys(Ge).forEach(function(r){Jt.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Ge[o]=Ge[r]})});function bt(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Ge.hasOwnProperty(r)&&Ge[r]?(""+o).trim():o+"px"}function mt(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,w=bt(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,w):r[u]=w}}var At=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 lt(r,o){if(o){if(At[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 Y(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 Me=null;function it(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var xt=null,Vt=null,Gt=null;function Qt(r){if(r=Jo(r)){if(typeof xt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=xl(o),xt(r.stateNode,r.type,o))}}function Se(r){Vt?Gt?Gt.push(r):Gt=[r]:Vt=r}function dt(){if(Vt){var r=Vt,o=Gt;if(Gt=Vt=null,Qt(r),o)for(r=0;r<o.length;r++)Qt(o[r])}}function Ht(r,o){return r(o)}function Zt(){}var cn=!1;function bn(r,o,u){if(cn)return r(o,u);cn=!0;try{return Ht(r,o,u)}finally{cn=!1,(Vt!==null||Gt!==null)&&(Zt(),dt())}}function xn(r,o){var u=r.stateNode;if(u===null)return null;var m=xl(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 $=!1;if(d)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){$=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{$=!1}function le(r,o,u,m,w,x,N,U,Q){var fe=Array.prototype.slice.call(arguments,3);try{o.apply(u,fe)}catch(Te){this.onError(Te)}}var be=!1,Ce=null,Fe=!1,Xe=null,Ue={onError:function(r){be=!0,Ce=r}};function We(r,o,u,m,w,x,N,U,Q){be=!1,Ce=null,le.apply(Ue,arguments)}function Oe(r,o,u,m,w,x,N,U,Q){if(We.apply(this,arguments),be){if(be){var fe=Ce;be=!1,Ce=null}else throw Error(n(198));Fe||(Fe=!0,Xe=fe)}}function De(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 at(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 ht(r){if(De(r)!==r)throw Error(n(188))}function en(r){var o=r.alternate;if(!o){if(o=De(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 x=w.alternate;if(x===null){if(m=w.return,m!==null){u=m;continue}break}if(w.child===x.child){for(x=w.child;x;){if(x===u)return ht(w),r;if(x===m)return ht(w),o;x=x.sibling}throw Error(n(188))}if(u.return!==m.return)u=w,m=x;else{for(var N=!1,U=w.child;U;){if(U===u){N=!0,u=w,m=x;break}if(U===m){N=!0,m=w,u=x;break}U=U.sibling}if(!N){for(U=x.child;U;){if(U===u){N=!0,u=x,m=w;break}if(U===m){N=!0,m=x,u=w;break}U=U.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 Rt(r){return r=en(r),r!==null?ze(r):null}function ze(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=ze(r);if(o!==null)return o;r=r.sibling}return null}var se=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Qe=t.unstable_shouldYield,st=t.unstable_requestPaint,O=t.unstable_now,pe=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,kt=t.unstable_UserBlockingPriority,Nt=t.unstable_NormalPriority,W=t.unstable_LowPriority,xe=t.unstable_IdlePriority,R=null,de=null;function he(r){if(de&&typeof de.onCommitFiberRoot=="function")try{de.onCommitFiberRoot(R,r,void 0,(r.current.flags&128)===128)}catch{}}var ve=Math.clz32?Math.clz32:Yt,et=Math.log,pt=Math.LN2;function Yt(r){return r>>>=0,r===0?32:31-(et(r)/pt|0)|0}var an=64,ni=4194304;function gr(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 gi(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,w=r.suspendedLanes,x=r.pingedLanes,N=u&268435455;if(N!==0){var U=N&~w;U!==0?m=gr(U):(x&=N,x!==0&&(m=gr(x)))}else N=u&~w,N!==0?m=gr(N):x!==0&&(m=gr(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&w)===0&&(w=m&-m,x=o&-o,w>=x||w===16&&(x&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-ve(o),w=1<<u,m|=r[u],o&=~w;return m}function Nu(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 Pu(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,w=r.expirationTimes,x=r.pendingLanes;0<x;){var N=31-ve(x),U=1<<N,Q=w[N];Q===-1?((U&u)===0||(U&m)!==0)&&(w[N]=Nu(U,o)):Q<=o&&(r.expiredLanes|=U),x&=~U}}function _o(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function al(){var r=an;return an<<=1,(an&4194240)===0&&(an=64),r}function Ur(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function ri(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-ve(o),r[o]=u}function Bs(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-ve(u),x=1<<w;o[w]=0,m[w]=-1,r[w]=-1,u&=~x}}function Us(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-ve(u),w=1<<m;w&o|r[m]&o&&(r[m]|=o),u&=~w}}var tn=0;function Fo(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Ws,zs,ll,Oo,ls,Bo=!1,cs=[],ii=null,si=null,Wr=null,Li=new Map,Ii=new Map,zr=[],cl="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 H(r,o){switch(r){case"focusin":case"focusout":ii=null;break;case"dragenter":case"dragleave":si=null;break;case"mouseover":case"mouseout":Wr=null;break;case"pointerover":case"pointerout":Li.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ii.delete(o.pointerId)}}function ie(r,o,u,m,w,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[w]},o!==null&&(o=Jo(o),o!==null&&zs(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function qe(r,o,u,m,w){switch(o){case"focusin":return ii=ie(ii,r,o,u,m,w),!0;case"dragenter":return si=ie(si,r,o,u,m,w),!0;case"mouseover":return Wr=ie(Wr,r,o,u,m,w),!0;case"pointerover":var x=w.pointerId;return Li.set(x,ie(Li.get(x)||null,r,o,u,m,w)),!0;case"gotpointercapture":return x=w.pointerId,Ii.set(x,ie(Ii.get(x)||null,r,o,u,m,w)),!0}return!1}function gt(r){var o=ds(r.target);if(o!==null){var u=De(o);if(u!==null){if(o=u.tag,o===13){if(o=at(u),o!==null){r.blockedOn=o,ls(r.priority,function(){ll(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 qt(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Uo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);Me=m,u.target.dispatchEvent(m),Me=null}else return o=Jo(u),o!==null&&zs(o),r.blockedOn=u,!1;o.shift()}return!0}function Dn(r,o,u){qt(r)&&u.delete(o)}function ir(){Bo=!1,ii!==null&&qt(ii)&&(ii=null),si!==null&&qt(si)&&(si=null),Wr!==null&&qt(Wr)&&(Wr=null),Li.forEach(Dn),Ii.forEach(Dn)}function Un(r,o){r.blockedOn===o&&(r.blockedOn=null,Bo||(Bo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ir)))}function rn(r){function o(w){return Un(w,r)}if(0<cs.length){Un(cs[0],r);for(var u=1;u<cs.length;u++){var m=cs[u];m.blockedOn===r&&(m.blockedOn=null)}}for(ii!==null&&Un(ii,r),si!==null&&Un(si,r),Wr!==null&&Un(Wr,r),Li.forEach(o),Ii.forEach(o),u=0;u<zr.length;u++)m=zr[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<zr.length&&(u=zr[0],u.blockedOn===null);)gt(u),u.blockedOn===null&&zr.shift()}var Pt=z.ReactCurrentBatchConfig,kn=!0;function yi(r,o,u,m){var w=tn,x=Pt.transition;Pt.transition=null;try{tn=1,vi(r,o,u,m)}finally{tn=w,Pt.transition=x}}function yr(r,o,u,m){var w=tn,x=Pt.transition;Pt.transition=null;try{tn=4,vi(r,o,u,m)}finally{tn=w,Pt.transition=x}}function vi(r,o,u,m){if(kn){var w=Uo(r,o,u,m);if(w===null)qu(r,o,m,us,u),H(r,m);else if(qe(w,r,o,u,m))m.stopPropagation();else if(H(r,m),o&4&&-1<cl.indexOf(r)){for(;w!==null;){var x=Jo(w);if(x!==null&&Ws(x),x=Uo(r,o,u,m),x===null&&qu(r,o,m,us,u),x===w)break;w=x}w!==null&&m.stopPropagation()}else qu(r,o,m,null,u)}}var us=null;function Uo(r,o,u,m){if(us=null,r=it(m),r=ds(r),r!==null)if(o=De(r),o===null)r=null;else if(u=o.tag,u===13){if(r=at(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 us=r,null}function cp(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(pe()){case Ne:return 1;case kt:return 4;case Nt:case W:return 16;case xe:return 536870912;default:return 16}default:return 16}}var Di=null,Tu=null,ul=null;function up(){if(ul)return ul;var r,o=Tu,u=o.length,m,w="value"in Di?Di.value:Di.textContent,x=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[x-m];m++);return ul=w.slice(r,1<m?1-m:void 0)}function dl(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 hl(){return!0}function dp(){return!1}function vr(r){function o(u,m,w,x,N){this._reactName=u,this._targetInst=w,this.type=m,this.nativeEvent=x,this.target=N,this.currentTarget=null;for(var U in r)r.hasOwnProperty(U)&&(u=r[U],this[U]=u?u(x):x[U]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?hl:dp,this.isPropagationStopped=dp,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=hl)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=hl)},persist:function(){},isPersistent:hl}),o}var Hs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Eu=vr(Hs),Wo=E({},Hs,{view:0,detail:0}),S0=vr(Wo),Ru,Mu,zo,fl=E({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lu,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!==zo&&(zo&&r.type==="mousemove"?(Ru=r.screenX-zo.screenX,Mu=r.screenY-zo.screenY):Mu=Ru=0,zo=r),Ru)},movementY:function(r){return"movementY"in r?r.movementY:Mu}}),hp=vr(fl),C0=E({},fl,{dataTransfer:0}),j0=vr(C0),N0=E({},Wo,{relatedTarget:0}),Au=vr(N0),P0=E({},Hs,{animationName:0,elapsedTime:0,pseudoElement:0}),T0=vr(P0),E0=E({},Hs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),R0=vr(E0),M0=E({},Hs,{data:0}),fp=vr(M0),A0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},L0={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"},I0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D0(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=I0[r])?!!o[r]:!1}function Lu(){return D0}var _0=E({},Wo,{key:function(r){if(r.key){var o=A0[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=dl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?L0[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lu,charCode:function(r){return r.type==="keypress"?dl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?dl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),F0=vr(_0),O0=E({},fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mp=vr(O0),B0=E({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lu}),U0=vr(B0),W0=E({},Hs,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=vr(W0),H0=E({},fl,{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}),q0=vr(H0),$0=[9,13,27,32],Iu=d&&"CompositionEvent"in window,Ho=null;d&&"documentMode"in document&&(Ho=document.documentMode);var V0=d&&"TextEvent"in window&&!Ho,pp=d&&(!Iu||Ho&&8<Ho&&11>=Ho),gp=" ",yp=!1;function vp(r,o){switch(r){case"keyup":return $0.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wp(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var qs=!1;function G0(r,o){switch(r){case"compositionend":return wp(o);case"keypress":return o.which!==32?null:(yp=!0,gp);case"textInput":return r=o.data,r===gp&&yp?null:r;default:return null}}function K0(r,o){if(qs)return r==="compositionend"||!Iu&&vp(r,o)?(r=up(),ul=Tu=Di=null,qs=!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 pp&&o.locale!=="ko"?null:o.data;default:return null}}var Q0={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 bp(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Q0[r.type]:o==="textarea"}function xp(r,o,u,m){Se(m),o=vl(o,"onChange"),0<o.length&&(u=new Eu("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var qo=null,$o=null;function Y0(r){Bp(r,0)}function ml(r){var o=Qs(r);if(St(o))return r}function X0(r,o){if(r==="change")return o}var kp=!1;if(d){var Du;if(d){var _u="oninput"in document;if(!_u){var Sp=document.createElement("div");Sp.setAttribute("oninput","return;"),_u=typeof Sp.oninput=="function"}Du=_u}else Du=!1;kp=Du&&(!document.documentMode||9<document.documentMode)}function Cp(){qo&&(qo.detachEvent("onpropertychange",jp),$o=qo=null)}function jp(r){if(r.propertyName==="value"&&ml($o)){var o=[];xp(o,$o,r,it(r)),bn(Y0,o)}}function J0(r,o,u){r==="focusin"?(Cp(),qo=o,$o=u,qo.attachEvent("onpropertychange",jp)):r==="focusout"&&Cp()}function Z0(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ml($o)}function e1(r,o){if(r==="click")return ml(o)}function t1(r,o){if(r==="input"||r==="change")return ml(o)}function n1(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Hr=typeof Object.is=="function"?Object.is:n1;function Vo(r,o){if(Hr(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)||!Hr(r[w],o[w]))return!1}return!0}function Np(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Pp(r,o){var u=Np(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=Np(u)}}function Tp(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Tp(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Ep(){for(var r=window,o=Dt();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=Dt(r.document)}return o}function Fu(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 r1(r){var o=Ep(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Tp(u.ownerDocument.documentElement,u)){if(m!==null&&Fu(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,x=Math.min(m.start,w);m=m.end===void 0?x:Math.min(m.end,w),!r.extend&&x>m&&(w=m,m=x,x=w),w=Pp(u,x);var N=Pp(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(),x>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 i1=d&&"documentMode"in document&&11>=document.documentMode,$s=null,Ou=null,Go=null,Bu=!1;function Rp(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Bu||$s==null||$s!==Dt(m)||(m=$s,"selectionStart"in m&&Fu(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}),Go&&Vo(Go,m)||(Go=m,m=vl(Ou,"onSelect"),0<m.length&&(o=new Eu("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=$s)))}function pl(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Vs={animationend:pl("Animation","AnimationEnd"),animationiteration:pl("Animation","AnimationIteration"),animationstart:pl("Animation","AnimationStart"),transitionend:pl("Transition","TransitionEnd")},Uu={},Mp={};d&&(Mp=document.createElement("div").style,"AnimationEvent"in window||(delete Vs.animationend.animation,delete Vs.animationiteration.animation,delete Vs.animationstart.animation),"TransitionEvent"in window||delete Vs.transitionend.transition);function gl(r){if(Uu[r])return Uu[r];if(!Vs[r])return r;var o=Vs[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Mp)return Uu[r]=o[u];return r}var Ap=gl("animationend"),Lp=gl("animationiteration"),Ip=gl("animationstart"),Dp=gl("transitionend"),_p=new Map,Fp="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 _i(r,o){_p.set(r,o),c(o,[r])}for(var Wu=0;Wu<Fp.length;Wu++){var zu=Fp[Wu],s1=zu.toLowerCase(),o1=zu[0].toUpperCase()+zu.slice(1);_i(s1,"on"+o1)}_i(Ap,"onAnimationEnd"),_i(Lp,"onAnimationIteration"),_i(Ip,"onAnimationStart"),_i("dblclick","onDoubleClick"),_i("focusin","onFocus"),_i("focusout","onBlur"),_i(Dp,"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 Ko="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(" "),a1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ko));function Op(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Oe(m,o,void 0,r),r.currentTarget=null}function Bp(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 x=void 0;if(o)for(var N=m.length-1;0<=N;N--){var U=m[N],Q=U.instance,fe=U.currentTarget;if(U=U.listener,Q!==x&&w.isPropagationStopped())break e;Op(w,U,fe),x=Q}else for(N=0;N<m.length;N++){if(U=m[N],Q=U.instance,fe=U.currentTarget,U=U.listener,Q!==x&&w.isPropagationStopped())break e;Op(w,U,fe),x=Q}}}if(Fe)throw r=Xe,Fe=!1,Xe=null,r}function hn(r,o){var u=o[Yu];u===void 0&&(u=o[Yu]=new Set);var m=r+"__bubble";u.has(m)||(Up(o,r,2,!1),u.add(m))}function Hu(r,o,u){var m=0;o&&(m|=4),Up(u,r,m,o)}var yl="_reactListening"+Math.random().toString(36).slice(2);function Qo(r){if(!r[yl]){r[yl]=!0,s.forEach(function(u){u!=="selectionchange"&&(a1.has(u)||Hu(u,!1,r),Hu(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[yl]||(o[yl]=!0,Hu("selectionchange",!1,o))}}function Up(r,o,u,m){switch(cp(o)){case 1:var w=yi;break;case 4:w=yr;break;default:w=vi}u=w.bind(null,o,u,r),w=void 0,!$||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 qu(r,o,u,m,w){var x=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 U=m.stateNode.containerInfo;if(U===w||U.nodeType===8&&U.parentNode===w)break;if(N===4)for(N=m.return;N!==null;){var Q=N.tag;if((Q===3||Q===4)&&(Q=N.stateNode.containerInfo,Q===w||Q.nodeType===8&&Q.parentNode===w))return;N=N.return}for(;U!==null;){if(N=ds(U),N===null)return;if(Q=N.tag,Q===5||Q===6){m=x=N;continue e}U=U.parentNode}}m=m.return}bn(function(){var fe=x,Te=it(u),Re=[];e:{var Pe=_p.get(r);if(Pe!==void 0){var Ve=Eu,nt=r;switch(r){case"keypress":if(dl(u)===0)break e;case"keydown":case"keyup":Ve=F0;break;case"focusin":nt="focus",Ve=Au;break;case"focusout":nt="blur",Ve=Au;break;case"beforeblur":case"afterblur":Ve=Au;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=hp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ve=j0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ve=U0;break;case Ap:case Lp:case Ip:Ve=T0;break;case Dp:Ve=z0;break;case"scroll":Ve=S0;break;case"wheel":Ve=q0;break;case"copy":case"cut":case"paste":Ve=R0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ve=mp}var ot=(o&4)!==0,Cn=!ot&&r==="scroll",oe=ot?Pe!==null?Pe+"Capture":null:Pe;ot=[];for(var Z=fe,ce;Z!==null;){ce=Z;var Ie=ce.stateNode;if(ce.tag===5&&Ie!==null&&(ce=Ie,oe!==null&&(Ie=xn(Z,oe),Ie!=null&&ot.push(Yo(Z,Ie,ce)))),Cn)break;Z=Z.return}0<ot.length&&(Pe=new Ve(Pe,nt,null,u,Te),Re.push({event:Pe,listeners:ot}))}}if((o&7)===0){e:{if(Pe=r==="mouseover"||r==="pointerover",Ve=r==="mouseout"||r==="pointerout",Pe&&u!==Me&&(nt=u.relatedTarget||u.fromElement)&&(ds(nt)||nt[wi]))break e;if((Ve||Pe)&&(Pe=Te.window===Te?Te:(Pe=Te.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,Ve?(nt=u.relatedTarget||u.toElement,Ve=fe,nt=nt?ds(nt):null,nt!==null&&(Cn=De(nt),nt!==Cn||nt.tag!==5&&nt.tag!==6)&&(nt=null)):(Ve=null,nt=fe),Ve!==nt)){if(ot=hp,Ie="onMouseLeave",oe="onMouseEnter",Z="mouse",(r==="pointerout"||r==="pointerover")&&(ot=mp,Ie="onPointerLeave",oe="onPointerEnter",Z="pointer"),Cn=Ve==null?Pe:Qs(Ve),ce=nt==null?Pe:Qs(nt),Pe=new ot(Ie,Z+"leave",Ve,u,Te),Pe.target=Cn,Pe.relatedTarget=ce,Ie=null,ds(Te)===fe&&(ot=new ot(oe,Z+"enter",nt,u,Te),ot.target=ce,ot.relatedTarget=Cn,Ie=ot),Cn=Ie,Ve&&nt)t:{for(ot=Ve,oe=nt,Z=0,ce=ot;ce;ce=Gs(ce))Z++;for(ce=0,Ie=oe;Ie;Ie=Gs(Ie))ce++;for(;0<Z-ce;)ot=Gs(ot),Z--;for(;0<ce-Z;)oe=Gs(oe),ce--;for(;Z--;){if(ot===oe||oe!==null&&ot===oe.alternate)break t;ot=Gs(ot),oe=Gs(oe)}ot=null}else ot=null;Ve!==null&&Wp(Re,Pe,Ve,ot,!1),nt!==null&&Cn!==null&&Wp(Re,Cn,nt,ot,!0)}}e:{if(Pe=fe?Qs(fe):window,Ve=Pe.nodeName&&Pe.nodeName.toLowerCase(),Ve==="select"||Ve==="input"&&Pe.type==="file")var ct=X0;else if(bp(Pe))if(kp)ct=t1;else{ct=Z0;var yt=J0}else(Ve=Pe.nodeName)&&Ve.toLowerCase()==="input"&&(Pe.type==="checkbox"||Pe.type==="radio")&&(ct=e1);if(ct&&(ct=ct(r,fe))){xp(Re,ct,u,Te);break e}yt&&yt(r,Pe,fe),r==="focusout"&&(yt=Pe._wrapperState)&&yt.controlled&&Pe.type==="number"&&Ot(Pe,"number",Pe.value)}switch(yt=fe?Qs(fe):window,r){case"focusin":(bp(yt)||yt.contentEditable==="true")&&($s=yt,Ou=fe,Go=null);break;case"focusout":Go=Ou=$s=null;break;case"mousedown":Bu=!0;break;case"contextmenu":case"mouseup":case"dragend":Bu=!1,Rp(Re,u,Te);break;case"selectionchange":if(i1)break;case"keydown":case"keyup":Rp(Re,u,Te)}var vt;if(Iu)e:{switch(r){case"compositionstart":var jt="onCompositionStart";break e;case"compositionend":jt="onCompositionEnd";break e;case"compositionupdate":jt="onCompositionUpdate";break e}jt=void 0}else qs?vp(r,u)&&(jt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(jt="onCompositionStart");jt&&(pp&&u.locale!=="ko"&&(qs||jt!=="onCompositionStart"?jt==="onCompositionEnd"&&qs&&(vt=up()):(Di=Te,Tu="value"in Di?Di.value:Di.textContent,qs=!0)),yt=vl(fe,jt),0<yt.length&&(jt=new fp(jt,r,null,u,Te),Re.push({event:jt,listeners:yt}),vt?jt.data=vt:(vt=wp(u),vt!==null&&(jt.data=vt)))),(vt=V0?G0(r,u):K0(r,u))&&(fe=vl(fe,"onBeforeInput"),0<fe.length&&(Te=new fp("onBeforeInput","beforeinput",null,u,Te),Re.push({event:Te,listeners:fe}),Te.data=vt))}Bp(Re,o)})}function Yo(r,o,u){return{instance:r,listener:o,currentTarget:u}}function vl(r,o){for(var u=o+"Capture",m=[];r!==null;){var w=r,x=w.stateNode;w.tag===5&&x!==null&&(w=x,x=xn(r,u),x!=null&&m.unshift(Yo(r,x,w)),x=xn(r,o),x!=null&&m.push(Yo(r,x,w))),r=r.return}return m}function Gs(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Wp(r,o,u,m,w){for(var x=o._reactName,N=[];u!==null&&u!==m;){var U=u,Q=U.alternate,fe=U.stateNode;if(Q!==null&&Q===m)break;U.tag===5&&fe!==null&&(U=fe,w?(Q=xn(u,x),Q!=null&&N.unshift(Yo(u,Q,U))):w||(Q=xn(u,x),Q!=null&&N.push(Yo(u,Q,U)))),u=u.return}N.length!==0&&r.push({event:o,listeners:N})}var l1=/\r\n?/g,c1=/\u0000|\uFFFD/g;function zp(r){return(typeof r=="string"?r:""+r).replace(l1,`
|
|
39
|
-
`).replace(c1,"")}function wl(r,o,u){if(o=zp(o),zp(r)!==o&&u)throw Error(n(425))}function bl(){}var $u=null,Vu=null;function Gu(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 Ku=typeof setTimeout=="function"?setTimeout:void 0,u1=typeof clearTimeout=="function"?clearTimeout:void 0,Hp=typeof Promise=="function"?Promise:void 0,d1=typeof queueMicrotask=="function"?queueMicrotask:typeof Hp<"u"?function(r){return Hp.resolve(null).then(r).catch(h1)}:Ku;function h1(r){setTimeout(function(){throw r})}function Qu(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),rn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=w}while(u);rn(o)}function Fi(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 qp(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 Ks=Math.random().toString(36).slice(2),oi="__reactFiber$"+Ks,Xo="__reactProps$"+Ks,wi="__reactContainer$"+Ks,Yu="__reactEvents$"+Ks,f1="__reactListeners$"+Ks,m1="__reactHandles$"+Ks;function ds(r){var o=r[oi];if(o)return o;for(var u=r.parentNode;u;){if(o=u[wi]||u[oi]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=qp(r);r!==null;){if(u=r[oi])return u;r=qp(r)}return o}r=u,u=r.parentNode}return null}function Jo(r){return r=r[oi]||r[wi],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Qs(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function xl(r){return r[Xo]||null}var Xu=[],Ys=-1;function Oi(r){return{current:r}}function fn(r){0>Ys||(r.current=Xu[Ys],Xu[Ys]=null,Ys--)}function un(r,o){Ys++,Xu[Ys]=r.current,r.current=o}var Bi={},$n=Oi(Bi),sr=Oi(!1),hs=Bi;function Xs(r,o){var u=r.type.contextTypes;if(!u)return Bi;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var w={},x;for(x in u)w[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function or(r){return r=r.childContextTypes,r!=null}function kl(){fn(sr),fn($n)}function $p(r,o,u){if($n.current!==Bi)throw Error(n(168));un($n,o),un(sr,u)}function Vp(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,Be(r)||"Unknown",w));return E({},u,m)}function Sl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Bi,hs=$n.current,un($n,r),un(sr,sr.current),!0}function Gp(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=Vp(r,o,hs),m.__reactInternalMemoizedMergedChildContext=r,fn(sr),fn($n),un($n,r)):fn(sr),un(sr,u)}var bi=null,Cl=!1,Ju=!1;function Kp(r){bi===null?bi=[r]:bi.push(r)}function p1(r){Cl=!0,Kp(r)}function Ui(){if(!Ju&&bi!==null){Ju=!0;var r=0,o=tn;try{var u=bi;for(tn=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}bi=null,Cl=!1}catch(w){throw bi!==null&&(bi=bi.slice(r+1)),se(Ne,Ui),w}finally{tn=o,Ju=!1}}return null}var Js=[],Zs=0,jl=null,Nl=0,Er=[],Rr=0,fs=null,xi=1,ki="";function ms(r,o){Js[Zs++]=Nl,Js[Zs++]=jl,jl=r,Nl=o}function Qp(r,o,u){Er[Rr++]=xi,Er[Rr++]=ki,Er[Rr++]=fs,fs=r;var m=xi;r=ki;var w=32-ve(m)-1;m&=~(1<<w),u+=1;var x=32-ve(o)+w;if(30<x){var N=w-w%5;x=(m&(1<<N)-1).toString(32),m>>=N,w-=N,xi=1<<32-ve(o)+w|u<<w|m,ki=x+r}else xi=1<<x|u<<w|m,ki=r}function Zu(r){r.return!==null&&(ms(r,1),Qp(r,1,0))}function ed(r){for(;r===jl;)jl=Js[--Zs],Js[Zs]=null,Nl=Js[--Zs],Js[Zs]=null;for(;r===fs;)fs=Er[--Rr],Er[Rr]=null,ki=Er[--Rr],Er[Rr]=null,xi=Er[--Rr],Er[Rr]=null}var wr=null,br=null,mn=!1,qr=null;function Yp(r,o){var u=Ir(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 Xp(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,wr=r,br=Fi(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,wr=r,br=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=fs!==null?{id:xi,overflow:ki}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Ir(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,wr=r,br=null,!0):!1;default:return!1}}function td(r){return(r.mode&1)!==0&&(r.flags&128)===0}function nd(r){if(mn){var o=br;if(o){var u=o;if(!Xp(r,o)){if(td(r))throw Error(n(418));o=Fi(u.nextSibling);var m=wr;o&&Xp(r,o)?Yp(m,u):(r.flags=r.flags&-4097|2,mn=!1,wr=r)}}else{if(td(r))throw Error(n(418));r.flags=r.flags&-4097|2,mn=!1,wr=r}}}function Jp(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;wr=r}function Pl(r){if(r!==wr)return!1;if(!mn)return Jp(r),mn=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Gu(r.type,r.memoizedProps)),o&&(o=br)){if(td(r))throw Zp(),Error(n(418));for(;o;)Yp(r,o),o=Fi(o.nextSibling)}if(Jp(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){br=Fi(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}br=null}}else br=wr?Fi(r.stateNode.nextSibling):null;return!0}function Zp(){for(var r=br;r;)r=Fi(r.nextSibling)}function eo(){br=wr=null,mn=!1}function rd(r){qr===null?qr=[r]:qr.push(r)}var g1=z.ReactCurrentBatchConfig;function Zo(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,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(N){var U=w.refs;N===null?delete U[x]:U[x]=N},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Tl(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function eg(r){var o=r._init;return o(r._payload)}function tg(r){function o(oe,Z){if(r){var ce=oe.deletions;ce===null?(oe.deletions=[Z],oe.flags|=16):ce.push(Z)}}function u(oe,Z){if(!r)return null;for(;Z!==null;)o(oe,Z),Z=Z.sibling;return null}function m(oe,Z){for(oe=new Map;Z!==null;)Z.key!==null?oe.set(Z.key,Z):oe.set(Z.index,Z),Z=Z.sibling;return oe}function w(oe,Z){return oe=Ki(oe,Z),oe.index=0,oe.sibling=null,oe}function x(oe,Z,ce){return oe.index=ce,r?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<Z?(oe.flags|=2,Z):ce):(oe.flags|=2,Z)):(oe.flags|=1048576,Z)}function N(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function U(oe,Z,ce,Ie){return Z===null||Z.tag!==6?(Z=Kd(ce,oe.mode,Ie),Z.return=oe,Z):(Z=w(Z,ce),Z.return=oe,Z)}function Q(oe,Z,ce,Ie){var ct=ce.type;return ct===I?Te(oe,Z,ce.props.children,Ie,ce.key):Z!==null&&(Z.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===me&&eg(ct)===Z.type)?(Ie=w(Z,ce.props),Ie.ref=Zo(oe,Z,ce),Ie.return=oe,Ie):(Ie=Jl(ce.type,ce.key,ce.props,null,oe.mode,Ie),Ie.ref=Zo(oe,Z,ce),Ie.return=oe,Ie)}function fe(oe,Z,ce,Ie){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ce.containerInfo||Z.stateNode.implementation!==ce.implementation?(Z=Qd(ce,oe.mode,Ie),Z.return=oe,Z):(Z=w(Z,ce.children||[]),Z.return=oe,Z)}function Te(oe,Z,ce,Ie,ct){return Z===null||Z.tag!==7?(Z=ks(ce,oe.mode,Ie,ct),Z.return=oe,Z):(Z=w(Z,ce),Z.return=oe,Z)}function Re(oe,Z,ce){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return Z=Kd(""+Z,oe.mode,ce),Z.return=oe,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case V:return ce=Jl(Z.type,Z.key,Z.props,null,oe.mode,ce),ce.ref=Zo(oe,null,Z),ce.return=oe,ce;case F:return Z=Qd(Z,oe.mode,ce),Z.return=oe,Z;case me:var Ie=Z._init;return Re(oe,Ie(Z._payload),ce)}if(zt(Z)||ae(Z))return Z=ks(Z,oe.mode,ce,null),Z.return=oe,Z;Tl(oe,Z)}return null}function Pe(oe,Z,ce,Ie){var ct=Z!==null?Z.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return ct!==null?null:U(oe,Z,""+ce,Ie);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case V:return ce.key===ct?Q(oe,Z,ce,Ie):null;case F:return ce.key===ct?fe(oe,Z,ce,Ie):null;case me:return ct=ce._init,Pe(oe,Z,ct(ce._payload),Ie)}if(zt(ce)||ae(ce))return ct!==null?null:Te(oe,Z,ce,Ie,null);Tl(oe,ce)}return null}function Ve(oe,Z,ce,Ie,ct){if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number")return oe=oe.get(ce)||null,U(Z,oe,""+Ie,ct);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case V:return oe=oe.get(Ie.key===null?ce:Ie.key)||null,Q(Z,oe,Ie,ct);case F:return oe=oe.get(Ie.key===null?ce:Ie.key)||null,fe(Z,oe,Ie,ct);case me:var yt=Ie._init;return Ve(oe,Z,ce,yt(Ie._payload),ct)}if(zt(Ie)||ae(Ie))return oe=oe.get(ce)||null,Te(Z,oe,Ie,ct,null);Tl(Z,Ie)}return null}function nt(oe,Z,ce,Ie){for(var ct=null,yt=null,vt=Z,jt=Z=0,On=null;vt!==null&&jt<ce.length;jt++){vt.index>jt?(On=vt,vt=null):On=vt.sibling;var nn=Pe(oe,vt,ce[jt],Ie);if(nn===null){vt===null&&(vt=On);break}r&&vt&&nn.alternate===null&&o(oe,vt),Z=x(nn,Z,jt),yt===null?ct=nn:yt.sibling=nn,yt=nn,vt=On}if(jt===ce.length)return u(oe,vt),mn&&ms(oe,jt),ct;if(vt===null){for(;jt<ce.length;jt++)vt=Re(oe,ce[jt],Ie),vt!==null&&(Z=x(vt,Z,jt),yt===null?ct=vt:yt.sibling=vt,yt=vt);return mn&&ms(oe,jt),ct}for(vt=m(oe,vt);jt<ce.length;jt++)On=Ve(vt,oe,jt,ce[jt],Ie),On!==null&&(r&&On.alternate!==null&&vt.delete(On.key===null?jt:On.key),Z=x(On,Z,jt),yt===null?ct=On:yt.sibling=On,yt=On);return r&&vt.forEach(function(Qi){return o(oe,Qi)}),mn&&ms(oe,jt),ct}function ot(oe,Z,ce,Ie){var ct=ae(ce);if(typeof ct!="function")throw Error(n(150));if(ce=ct.call(ce),ce==null)throw Error(n(151));for(var yt=ct=null,vt=Z,jt=Z=0,On=null,nn=ce.next();vt!==null&&!nn.done;jt++,nn=ce.next()){vt.index>jt?(On=vt,vt=null):On=vt.sibling;var Qi=Pe(oe,vt,nn.value,Ie);if(Qi===null){vt===null&&(vt=On);break}r&&vt&&Qi.alternate===null&&o(oe,vt),Z=x(Qi,Z,jt),yt===null?ct=Qi:yt.sibling=Qi,yt=Qi,vt=On}if(nn.done)return u(oe,vt),mn&&ms(oe,jt),ct;if(vt===null){for(;!nn.done;jt++,nn=ce.next())nn=Re(oe,nn.value,Ie),nn!==null&&(Z=x(nn,Z,jt),yt===null?ct=nn:yt.sibling=nn,yt=nn);return mn&&ms(oe,jt),ct}for(vt=m(oe,vt);!nn.done;jt++,nn=ce.next())nn=Ve(vt,oe,jt,nn.value,Ie),nn!==null&&(r&&nn.alternate!==null&&vt.delete(nn.key===null?jt:nn.key),Z=x(nn,Z,jt),yt===null?ct=nn:yt.sibling=nn,yt=nn);return r&&vt.forEach(function(Q1){return o(oe,Q1)}),mn&&ms(oe,jt),ct}function Cn(oe,Z,ce,Ie){if(typeof ce=="object"&&ce!==null&&ce.type===I&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case V:e:{for(var ct=ce.key,yt=Z;yt!==null;){if(yt.key===ct){if(ct=ce.type,ct===I){if(yt.tag===7){u(oe,yt.sibling),Z=w(yt,ce.props.children),Z.return=oe,oe=Z;break e}}else if(yt.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===me&&eg(ct)===yt.type){u(oe,yt.sibling),Z=w(yt,ce.props),Z.ref=Zo(oe,yt,ce),Z.return=oe,oe=Z;break e}u(oe,yt);break}else o(oe,yt);yt=yt.sibling}ce.type===I?(Z=ks(ce.props.children,oe.mode,Ie,ce.key),Z.return=oe,oe=Z):(Ie=Jl(ce.type,ce.key,ce.props,null,oe.mode,Ie),Ie.ref=Zo(oe,Z,ce),Ie.return=oe,oe=Ie)}return N(oe);case F:e:{for(yt=ce.key;Z!==null;){if(Z.key===yt)if(Z.tag===4&&Z.stateNode.containerInfo===ce.containerInfo&&Z.stateNode.implementation===ce.implementation){u(oe,Z.sibling),Z=w(Z,ce.children||[]),Z.return=oe,oe=Z;break e}else{u(oe,Z);break}else o(oe,Z);Z=Z.sibling}Z=Qd(ce,oe.mode,Ie),Z.return=oe,oe=Z}return N(oe);case me:return yt=ce._init,Cn(oe,Z,yt(ce._payload),Ie)}if(zt(ce))return nt(oe,Z,ce,Ie);if(ae(ce))return ot(oe,Z,ce,Ie);Tl(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,Z!==null&&Z.tag===6?(u(oe,Z.sibling),Z=w(Z,ce),Z.return=oe,oe=Z):(u(oe,Z),Z=Kd(ce,oe.mode,Ie),Z.return=oe,oe=Z),N(oe)):u(oe,Z)}return Cn}var to=tg(!0),ng=tg(!1),El=Oi(null),Rl=null,no=null,id=null;function sd(){id=no=Rl=null}function od(r){var o=El.current;fn(El),r._currentValue=o}function ad(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 ro(r,o){Rl=r,id=no=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(ar=!0),r.firstContext=null)}function Mr(r){var o=r._currentValue;if(id!==r)if(r={context:r,memoizedValue:o,next:null},no===null){if(Rl===null)throw Error(n(308));no=r,Rl.dependencies={lanes:0,firstContext:r}}else no=no.next=r;return o}var ps=null;function ld(r){ps===null?ps=[r]:ps.push(r)}function rg(r,o,u,m){var w=o.interleaved;return w===null?(u.next=u,ld(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 Wi=!1;function cd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ig(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 zi(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(Xt&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,ld(m)):(o.next=w.next,w.next=o),m.interleaved=o,Si(r,u)}function Ml(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,Us(r,u)}}function sg(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var w=null,x=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};x===null?w=x=N:x=x.next=N,u=u.next}while(u!==null);x===null?w=x=o:x=x.next=o}else w=x=o;u={baseState:m.baseState,firstBaseUpdate:w,lastBaseUpdate:x,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 Al(r,o,u,m){var w=r.updateQueue;Wi=!1;var x=w.firstBaseUpdate,N=w.lastBaseUpdate,U=w.shared.pending;if(U!==null){w.shared.pending=null;var Q=U,fe=Q.next;Q.next=null,N===null?x=fe:N.next=fe,N=Q;var Te=r.alternate;Te!==null&&(Te=Te.updateQueue,U=Te.lastBaseUpdate,U!==N&&(U===null?Te.firstBaseUpdate=fe:U.next=fe,Te.lastBaseUpdate=Q))}if(x!==null){var Re=w.baseState;N=0,Te=fe=Q=null,U=x;do{var Pe=U.lane,Ve=U.eventTime;if((m&Pe)===Pe){Te!==null&&(Te=Te.next={eventTime:Ve,lane:0,tag:U.tag,payload:U.payload,callback:U.callback,next:null});e:{var nt=r,ot=U;switch(Pe=o,Ve=u,ot.tag){case 1:if(nt=ot.payload,typeof nt=="function"){Re=nt.call(Ve,Re,Pe);break e}Re=nt;break e;case 3:nt.flags=nt.flags&-65537|128;case 0:if(nt=ot.payload,Pe=typeof nt=="function"?nt.call(Ve,Re,Pe):nt,Pe==null)break e;Re=E({},Re,Pe);break e;case 2:Wi=!0}}U.callback!==null&&U.lane!==0&&(r.flags|=64,Pe=w.effects,Pe===null?w.effects=[U]:Pe.push(U))}else Ve={eventTime:Ve,lane:Pe,tag:U.tag,payload:U.payload,callback:U.callback,next:null},Te===null?(fe=Te=Ve,Q=Re):Te=Te.next=Ve,N|=Pe;if(U=U.next,U===null){if(U=w.shared.pending,U===null)break;Pe=U,U=Pe.next,Pe.next=null,w.lastBaseUpdate=Pe,w.shared.pending=null}}while(!0);if(Te===null&&(Q=Re),w.baseState=Q,w.firstBaseUpdate=fe,w.lastBaseUpdate=Te,o=w.shared.interleaved,o!==null){w=o;do N|=w.lane,w=w.next;while(w!==o)}else x===null&&(w.shared.lanes=0);vs|=N,r.lanes=N,r.memoizedState=Re}}function og(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 ea={},ai=Oi(ea),ta=Oi(ea),na=Oi(ea);function gs(r){if(r===ea)throw Error(n(174));return r}function ud(r,o){switch(un(na,o),un(ta,r),un(ai,ea),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ye(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ye(o,r)}fn(ai),un(ai,o)}function io(){fn(ai),fn(ta),fn(na)}function ag(r){gs(na.current);var o=gs(ai.current),u=ye(o,r.type);o!==u&&(un(ta,r),un(ai,u))}function dd(r){ta.current===r&&(fn(ai),fn(ta))}var gn=Oi(0);function Ll(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 hd=[];function fd(){for(var r=0;r<hd.length;r++)hd[r]._workInProgressVersionPrimary=null;hd.length=0}var Il=z.ReactCurrentDispatcher,md=z.ReactCurrentBatchConfig,ys=0,yn=null,Tn=null,_n=null,Dl=!1,ra=!1,ia=0,y1=0;function Vn(){throw Error(n(321))}function pd(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Hr(r[u],o[u]))return!1;return!0}function gd(r,o,u,m,w,x){if(ys=x,yn=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Il.current=r===null||r.memoizedState===null?x1:k1,r=u(m,w),ra){x=0;do{if(ra=!1,ia=0,25<=x)throw Error(n(301));x+=1,_n=Tn=null,o.updateQueue=null,Il.current=S1,r=u(m,w)}while(ra)}if(Il.current=Ol,o=Tn!==null&&Tn.next!==null,ys=0,_n=Tn=yn=null,Dl=!1,o)throw Error(n(300));return r}function yd(){var r=ia!==0;return ia=0,r}function li(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?yn.memoizedState=_n=r:_n=_n.next=r,_n}function Ar(){if(Tn===null){var r=yn.alternate;r=r!==null?r.memoizedState:null}else r=Tn.next;var o=_n===null?yn.memoizedState:_n.next;if(o!==null)_n=o,Tn=r;else{if(r===null)throw Error(n(310));Tn=r,r={memoizedState:Tn.memoizedState,baseState:Tn.baseState,baseQueue:Tn.baseQueue,queue:Tn.queue,next:null},_n===null?yn.memoizedState=_n=r:_n=_n.next=r}return _n}function sa(r,o){return typeof o=="function"?o(r):o}function vd(r){var o=Ar(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=Tn,w=m.baseQueue,x=u.pending;if(x!==null){if(w!==null){var N=w.next;w.next=x.next,x.next=N}m.baseQueue=w=x,u.pending=null}if(w!==null){x=w.next,m=m.baseState;var U=N=null,Q=null,fe=x;do{var Te=fe.lane;if((ys&Te)===Te)Q!==null&&(Q=Q.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),m=fe.hasEagerState?fe.eagerState:r(m,fe.action);else{var Re={lane:Te,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};Q===null?(U=Q=Re,N=m):Q=Q.next=Re,yn.lanes|=Te,vs|=Te}fe=fe.next}while(fe!==null&&fe!==x);Q===null?N=m:Q.next=U,Hr(m,o.memoizedState)||(ar=!0),o.memoizedState=m,o.baseState=N,o.baseQueue=Q,u.lastRenderedState=m}if(r=u.interleaved,r!==null){w=r;do x=w.lane,yn.lanes|=x,vs|=x,w=w.next;while(w!==r)}else w===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function wd(r){var o=Ar(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,w=u.pending,x=o.memoizedState;if(w!==null){u.pending=null;var N=w=w.next;do x=r(x,N.action),N=N.next;while(N!==w);Hr(x,o.memoizedState)||(ar=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,m]}function lg(){}function cg(r,o){var u=yn,m=Ar(),w=o(),x=!Hr(m.memoizedState,w);if(x&&(m.memoizedState=w,ar=!0),m=m.queue,bd(hg.bind(null,u,m,r),[r]),m.getSnapshot!==o||x||_n!==null&&_n.memoizedState.tag&1){if(u.flags|=2048,oa(9,dg.bind(null,u,m,w,o),void 0,null),Fn===null)throw Error(n(349));(ys&30)!==0||ug(u,o,w)}return w}function ug(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=yn.updateQueue,o===null?(o={lastEffect:null,stores:null},yn.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function dg(r,o,u,m){o.value=u,o.getSnapshot=m,fg(o)&&mg(r)}function hg(r,o,u){return u(function(){fg(o)&&mg(r)})}function fg(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Hr(r,u)}catch{return!0}}function mg(r){var o=Si(r,1);o!==null&&Kr(o,r,1,-1)}function pg(r){var o=li();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:r},o.queue=r,r=r.dispatch=b1.bind(null,yn,r),[o.memoizedState,r]}function oa(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=yn.updateQueue,o===null?(o={lastEffect:null,stores:null},yn.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 gg(){return Ar().memoizedState}function _l(r,o,u,m){var w=li();yn.flags|=r,w.memoizedState=oa(1|o,u,void 0,m===void 0?null:m)}function Fl(r,o,u,m){var w=Ar();m=m===void 0?null:m;var x=void 0;if(Tn!==null){var N=Tn.memoizedState;if(x=N.destroy,m!==null&&pd(m,N.deps)){w.memoizedState=oa(o,u,x,m);return}}yn.flags|=r,w.memoizedState=oa(1|o,u,x,m)}function yg(r,o){return _l(8390656,8,r,o)}function bd(r,o){return Fl(2048,8,r,o)}function vg(r,o){return Fl(4,2,r,o)}function wg(r,o){return Fl(4,4,r,o)}function bg(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 xg(r,o,u){return u=u!=null?u.concat([r]):null,Fl(4,4,bg.bind(null,o,r),u)}function xd(){}function kg(r,o){var u=Ar();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&pd(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function Sg(r,o){var u=Ar();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&pd(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function Cg(r,o,u){return(ys&21)===0?(r.baseState&&(r.baseState=!1,ar=!0),r.memoizedState=u):(Hr(u,o)||(u=al(),yn.lanes|=u,vs|=u,r.baseState=!0),o)}function v1(r,o){var u=tn;tn=u!==0&&4>u?u:4,r(!0);var m=md.transition;md.transition={};try{r(!1),o()}finally{tn=u,md.transition=m}}function jg(){return Ar().memoizedState}function w1(r,o,u){var m=Vi(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},Ng(r))Pg(o,u);else if(u=rg(r,o,u,m),u!==null){var w=er();Kr(u,r,m,w),Tg(u,o,m)}}function b1(r,o,u){var m=Vi(r),w={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ng(r))Pg(o,w);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var N=o.lastRenderedState,U=x(N,u);if(w.hasEagerState=!0,w.eagerState=U,Hr(U,N)){var Q=o.interleaved;Q===null?(w.next=w,ld(o)):(w.next=Q.next,Q.next=w),o.interleaved=w;return}}catch{}finally{}u=rg(r,o,w,m),u!==null&&(w=er(),Kr(u,r,m,w),Tg(u,o,m))}}function Ng(r){var o=r.alternate;return r===yn||o!==null&&o===yn}function Pg(r,o){ra=Dl=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function Tg(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Us(r,u)}}var Ol={readContext:Mr,useCallback:Vn,useContext:Vn,useEffect:Vn,useImperativeHandle:Vn,useInsertionEffect:Vn,useLayoutEffect:Vn,useMemo:Vn,useReducer:Vn,useRef:Vn,useState:Vn,useDebugValue:Vn,useDeferredValue:Vn,useTransition:Vn,useMutableSource:Vn,useSyncExternalStore:Vn,useId:Vn,unstable_isNewReconciler:!1},x1={readContext:Mr,useCallback:function(r,o){return li().memoizedState=[r,o===void 0?null:o],r},useContext:Mr,useEffect:yg,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,_l(4194308,4,bg.bind(null,o,r),u)},useLayoutEffect:function(r,o){return _l(4194308,4,r,o)},useInsertionEffect:function(r,o){return _l(4,2,r,o)},useMemo:function(r,o){var u=li();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=li();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=w1.bind(null,yn,r),[m.memoizedState,r]},useRef:function(r){var o=li();return r={current:r},o.memoizedState=r},useState:pg,useDebugValue:xd,useDeferredValue:function(r){return li().memoizedState=r},useTransition:function(){var r=pg(!1),o=r[0];return r=v1.bind(null,r[1]),li().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=yn,w=li();if(mn){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Fn===null)throw Error(n(349));(ys&30)!==0||ug(m,o,u)}w.memoizedState=u;var x={value:u,getSnapshot:o};return w.queue=x,yg(hg.bind(null,m,x,r),[r]),m.flags|=2048,oa(9,dg.bind(null,m,x,u,o),void 0,null),u},useId:function(){var r=li(),o=Fn.identifierPrefix;if(mn){var u=ki,m=xi;u=(m&~(1<<32-ve(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=ia++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=y1++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},k1={readContext:Mr,useCallback:kg,useContext:Mr,useEffect:bd,useImperativeHandle:xg,useInsertionEffect:vg,useLayoutEffect:wg,useMemo:Sg,useReducer:vd,useRef:gg,useState:function(){return vd(sa)},useDebugValue:xd,useDeferredValue:function(r){var o=Ar();return Cg(o,Tn.memoizedState,r)},useTransition:function(){var r=vd(sa)[0],o=Ar().memoizedState;return[r,o]},useMutableSource:lg,useSyncExternalStore:cg,useId:jg,unstable_isNewReconciler:!1},S1={readContext:Mr,useCallback:kg,useContext:Mr,useEffect:bd,useImperativeHandle:xg,useInsertionEffect:vg,useLayoutEffect:wg,useMemo:Sg,useReducer:wd,useRef:gg,useState:function(){return wd(sa)},useDebugValue:xd,useDeferredValue:function(r){var o=Ar();return Tn===null?o.memoizedState=r:Cg(o,Tn.memoizedState,r)},useTransition:function(){var r=wd(sa)[0],o=Ar().memoizedState;return[r,o]},useMutableSource:lg,useSyncExternalStore:cg,useId:jg,unstable_isNewReconciler:!1};function $r(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 kd(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 Bl={isMounted:function(r){return(r=r._reactInternals)?De(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=er(),w=Vi(r),x=Ci(m,w);x.payload=o,u!=null&&(x.callback=u),o=zi(r,x,w),o!==null&&(Kr(o,r,w,m),Ml(o,r,w))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=er(),w=Vi(r),x=Ci(m,w);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=zi(r,x,w),o!==null&&(Kr(o,r,w,m),Ml(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=er(),m=Vi(r),w=Ci(u,m);w.tag=2,o!=null&&(w.callback=o),o=zi(r,w,m),o!==null&&(Kr(o,r,m,u),Ml(o,r,m))}};function Eg(r,o,u,m,w,x,N){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,N):o.prototype&&o.prototype.isPureReactComponent?!Vo(u,m)||!Vo(w,x):!0}function Rg(r,o,u){var m=!1,w=Bi,x=o.contextType;return typeof x=="object"&&x!==null?x=Mr(x):(w=or(o)?hs:$n.current,m=o.contextTypes,x=(m=m!=null)?Xs(r,w):Bi),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Bl,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=x),o}function Mg(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&&Bl.enqueueReplaceState(o,o.state,null)}function Sd(r,o,u,m){var w=r.stateNode;w.props=u,w.state=r.memoizedState,w.refs={},cd(r);var x=o.contextType;typeof x=="object"&&x!==null?w.context=Mr(x):(x=or(o)?hs:$n.current,w.context=Xs(r,x)),w.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(kd(r,o,x,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&&Bl.enqueueReplaceState(w,w.state,null),Al(r,u,w,m),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function so(r,o){try{var u="",m=o;do u+=ge(m),m=m.return;while(m);var w=u}catch(x){w=`
|
|
40
|
-
Error generating stack: `+x.message+`
|
|
41
|
-
`+x.stack}return{value:r,source:o,stack:w,digest:null}}function Cd(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function jd(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var C1=typeof WeakMap=="function"?WeakMap:Map;function Ag(r,o,u){u=Ci(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Vl||(Vl=!0,Ud=m),jd(r,o)},u}function Lg(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(){jd(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){jd(r,o),typeof m!="function"&&(qi===null?qi=new Set([this]):qi.add(this));var N=o.stack;this.componentDidCatch(o.value,{componentStack:N!==null?N:""})}),u}function Ig(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new C1;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=O1.bind(null,r,o,u),o.then(r,r))}function Dg(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 _g(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,zi(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var j1=z.ReactCurrentOwner,ar=!1;function Zn(r,o,u,m){o.child=r===null?ng(o,null,u,m):to(o,r.child,u,m)}function Fg(r,o,u,m,w){u=u.render;var x=o.ref;return ro(o,w),m=gd(r,o,u,m,x,w),u=yd(),r!==null&&!ar?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ji(r,o,w)):(mn&&u&&Zu(o),o.flags|=1,Zn(r,o,m,w),o.child)}function Og(r,o,u,m,w){if(r===null){var x=u.type;return typeof x=="function"&&!Gd(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=x,Bg(r,o,x,m,w)):(r=Jl(u.type,null,m,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&w)===0){var N=x.memoizedProps;if(u=u.compare,u=u!==null?u:Vo,u(N,m)&&r.ref===o.ref)return ji(r,o,w)}return o.flags|=1,r=Ki(x,m),r.ref=o.ref,r.return=o,o.child=r}function Bg(r,o,u,m,w){if(r!==null){var x=r.memoizedProps;if(Vo(x,m)&&r.ref===o.ref)if(ar=!1,o.pendingProps=m=x,(r.lanes&w)!==0)(r.flags&131072)!==0&&(ar=!0);else return o.lanes=r.lanes,ji(r,o,w)}return Nd(r,o,u,m,w)}function Ug(r,o,u){var m=o.pendingProps,w=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},un(ao,xr),xr|=u;else{if((u&1073741824)===0)return r=x!==null?x.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,un(ao,xr),xr|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:u,un(ao,xr),xr|=m}else x!==null?(m=x.baseLanes|u,o.memoizedState=null):m=u,un(ao,xr),xr|=m;return Zn(r,o,w,u),o.child}function Wg(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Nd(r,o,u,m,w){var x=or(u)?hs:$n.current;return x=Xs(o,x),ro(o,w),u=gd(r,o,u,m,x,w),m=yd(),r!==null&&!ar?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ji(r,o,w)):(mn&&m&&Zu(o),o.flags|=1,Zn(r,o,u,w),o.child)}function zg(r,o,u,m,w){if(or(u)){var x=!0;Sl(o)}else x=!1;if(ro(o,w),o.stateNode===null)Wl(r,o),Rg(o,u,m),Sd(o,u,m,w),m=!0;else if(r===null){var N=o.stateNode,U=o.memoizedProps;N.props=U;var Q=N.context,fe=u.contextType;typeof fe=="object"&&fe!==null?fe=Mr(fe):(fe=or(u)?hs:$n.current,fe=Xs(o,fe));var Te=u.getDerivedStateFromProps,Re=typeof Te=="function"||typeof N.getSnapshotBeforeUpdate=="function";Re||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(U!==m||Q!==fe)&&Mg(o,N,m,fe),Wi=!1;var Pe=o.memoizedState;N.state=Pe,Al(o,m,N,w),Q=o.memoizedState,U!==m||Pe!==Q||sr.current||Wi?(typeof Te=="function"&&(kd(o,u,Te,m),Q=o.memoizedState),(U=Wi||Eg(o,u,U,m,Pe,Q,fe))?(Re||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=Q),N.props=m,N.state=Q,N.context=fe,m=U):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{N=o.stateNode,ig(r,o),U=o.memoizedProps,fe=o.type===o.elementType?U:$r(o.type,U),N.props=fe,Re=o.pendingProps,Pe=N.context,Q=u.contextType,typeof Q=="object"&&Q!==null?Q=Mr(Q):(Q=or(u)?hs:$n.current,Q=Xs(o,Q));var Ve=u.getDerivedStateFromProps;(Te=typeof Ve=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(U!==Re||Pe!==Q)&&Mg(o,N,m,Q),Wi=!1,Pe=o.memoizedState,N.state=Pe,Al(o,m,N,w);var nt=o.memoizedState;U!==Re||Pe!==nt||sr.current||Wi?(typeof Ve=="function"&&(kd(o,u,Ve,m),nt=o.memoizedState),(fe=Wi||Eg(o,u,fe,m,Pe,nt,Q)||!1)?(Te||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(m,nt,Q),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(m,nt,Q)),typeof N.componentDidUpdate=="function"&&(o.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof N.componentDidUpdate!="function"||U===r.memoizedProps&&Pe===r.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&Pe===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=nt),N.props=m,N.state=nt,N.context=Q,m=fe):(typeof N.componentDidUpdate!="function"||U===r.memoizedProps&&Pe===r.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&Pe===r.memoizedState||(o.flags|=1024),m=!1)}return Pd(r,o,u,m,x,w)}function Pd(r,o,u,m,w,x){Wg(r,o);var N=(o.flags&128)!==0;if(!m&&!N)return w&&Gp(o,u,!1),ji(r,o,x);m=o.stateNode,j1.current=o;var U=N&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&N?(o.child=to(o,r.child,null,x),o.child=to(o,null,U,x)):Zn(r,o,U,x),o.memoizedState=m.state,w&&Gp(o,u,!0),o.child}function Hg(r){var o=r.stateNode;o.pendingContext?$p(r,o.pendingContext,o.pendingContext!==o.context):o.context&&$p(r,o.context,!1),ud(r,o.containerInfo)}function qg(r,o,u,m,w){return eo(),rd(w),o.flags|=256,Zn(r,o,u,m),o.child}var Td={dehydrated:null,treeContext:null,retryLane:0};function Ed(r){return{baseLanes:r,cachePool:null,transitions:null}}function $g(r,o,u){var m=o.pendingProps,w=gn.current,x=!1,N=(o.flags&128)!==0,U;if((U=N)||(U=r!==null&&r.memoizedState===null?!1:(w&2)!==0),U?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),un(gn,w&1),r===null)return nd(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,x?(m=o.mode,x=o.child,N={mode:"hidden",children:N},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=N):x=Zl(N,m,0,null),r=ks(r,m,u,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Ed(u),o.memoizedState=Td,r):Rd(o,N));if(w=r.memoizedState,w!==null&&(U=w.dehydrated,U!==null))return N1(r,o,N,m,U,w,u);if(x){x=m.fallback,N=o.mode,w=r.child,U=w.sibling;var Q={mode:"hidden",children:m.children};return(N&1)===0&&o.child!==w?(m=o.child,m.childLanes=0,m.pendingProps=Q,o.deletions=null):(m=Ki(w,Q),m.subtreeFlags=w.subtreeFlags&14680064),U!==null?x=Ki(U,x):(x=ks(x,N,u,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,N=r.child.memoizedState,N=N===null?Ed(u):{baseLanes:N.baseLanes|u,cachePool:null,transitions:N.transitions},x.memoizedState=N,x.childLanes=r.childLanes&~u,o.memoizedState=Td,m}return x=r.child,r=x.sibling,m=Ki(x,{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 Rd(r,o){return o=Zl({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Ul(r,o,u,m){return m!==null&&rd(m),to(o,r.child,null,u),r=Rd(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function N1(r,o,u,m,w,x,N){if(u)return o.flags&256?(o.flags&=-257,m=Cd(Error(n(422))),Ul(r,o,N,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,w=o.mode,m=Zl({mode:"visible",children:m.children},w,0,null),x=ks(x,w,N,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&to(o,r.child,null,N),o.child.memoizedState=Ed(N),o.memoizedState=Td,x);if((o.mode&1)===0)return Ul(r,o,N,null);if(w.data==="$!"){if(m=w.nextSibling&&w.nextSibling.dataset,m)var U=m.dgst;return m=U,x=Error(n(419)),m=Cd(x,m,void 0),Ul(r,o,N,m)}if(U=(N&r.childLanes)!==0,ar||U){if(m=Fn,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!==x.retryLane&&(x.retryLane=w,Si(r,w),Kr(m,r,w,-1))}return Vd(),m=Cd(Error(n(421))),Ul(r,o,N,m)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=B1.bind(null,r),w._reactRetry=o,null):(r=x.treeContext,br=Fi(w.nextSibling),wr=o,mn=!0,qr=null,r!==null&&(Er[Rr++]=xi,Er[Rr++]=ki,Er[Rr++]=fs,xi=r.id,ki=r.overflow,fs=o),o=Rd(o,m.children),o.flags|=4096,o)}function Vg(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),ad(r.return,o,u)}function Md(r,o,u,m,w){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:w}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=u,x.tailMode=w)}function Gg(r,o,u){var m=o.pendingProps,w=m.revealOrder,x=m.tail;if(Zn(r,o,m.children,u),m=gn.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&&Vg(r,u,o);else if(r.tag===19)Vg(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(un(gn,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&&Ll(r)===null&&(w=u),u=u.sibling;u=w,u===null?(w=o.child,o.child=null):(w=u.sibling,u.sibling=null),Md(o,!1,w,u,x);break;case"backwards":for(u=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Ll(r)===null){o.child=w;break}r=w.sibling,w.sibling=u,u=w,w=r}Md(o,!0,u,null,x);break;case"together":Md(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Wl(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),vs|=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=Ki(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Ki(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function P1(r,o,u){switch(o.tag){case 3:Hg(o),eo();break;case 5:ag(o);break;case 1:or(o.type)&&Sl(o);break;case 4:ud(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,w=o.memoizedProps.value;un(El,m._currentValue),m._currentValue=w;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(un(gn,gn.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?$g(r,o,u):(un(gn,gn.current&1),r=ji(r,o,u),r!==null?r.sibling:null);un(gn,gn.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Gg(r,o,u);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),un(gn,gn.current),m)break;return null;case 22:case 23:return o.lanes=0,Ug(r,o,u)}return ji(r,o,u)}var Kg,Ad,Qg,Yg;Kg=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}},Ad=function(){},Qg=function(r,o,u,m){var w=r.memoizedProps;if(w!==m){r=o.stateNode,gs(ai.current);var x=null;switch(u){case"input":w=Mt(r,w),m=Mt(r,m),x=[];break;case"select":w=E({},w,{value:void 0}),m=E({},m,{value:void 0}),x=[];break;case"textarea":w=Ze(r,w),m=Ze(r,m),x=[];break;default:typeof w.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=bl)}lt(u,m);var N;u=null;for(fe in w)if(!m.hasOwnProperty(fe)&&w.hasOwnProperty(fe)&&w[fe]!=null)if(fe==="style"){var U=w[fe];for(N in U)U.hasOwnProperty(N)&&(u||(u={}),u[N]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(a.hasOwnProperty(fe)?x||(x=[]):(x=x||[]).push(fe,null));for(fe in m){var Q=m[fe];if(U=w!=null?w[fe]:void 0,m.hasOwnProperty(fe)&&Q!==U&&(Q!=null||U!=null))if(fe==="style")if(U){for(N in U)!U.hasOwnProperty(N)||Q&&Q.hasOwnProperty(N)||(u||(u={}),u[N]="");for(N in Q)Q.hasOwnProperty(N)&&U[N]!==Q[N]&&(u||(u={}),u[N]=Q[N])}else u||(x||(x=[]),x.push(fe,u)),u=Q;else fe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,U=U?U.__html:void 0,Q!=null&&U!==Q&&(x=x||[]).push(fe,Q)):fe==="children"?typeof Q!="string"&&typeof Q!="number"||(x=x||[]).push(fe,""+Q):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(a.hasOwnProperty(fe)?(Q!=null&&fe==="onScroll"&&hn("scroll",r),x||U===Q||(x=[])):(x=x||[]).push(fe,Q))}u&&(x=x||[]).push("style",u);var fe=x;(o.updateQueue=fe)&&(o.flags|=4)}},Yg=function(r,o,u,m){u!==m&&(o.flags|=4)};function aa(r,o){if(!mn)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 Gn(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 T1(r,o,u){var m=o.pendingProps;switch(ed(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gn(o),null;case 1:return or(o.type)&&kl(),Gn(o),null;case 3:return m=o.stateNode,io(),fn(sr),fn($n),fd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Pl(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,qr!==null&&(Hd(qr),qr=null))),Ad(r,o),Gn(o),null;case 5:dd(o);var w=gs(na.current);if(u=o.type,r!==null&&o.stateNode!=null)Qg(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 Gn(o),null}if(r=gs(ai.current),Pl(o)){m=o.stateNode,u=o.type;var x=o.memoizedProps;switch(m[oi]=o,m[Xo]=x,r=(o.mode&1)!==0,u){case"dialog":hn("cancel",m),hn("close",m);break;case"iframe":case"object":case"embed":hn("load",m);break;case"video":case"audio":for(w=0;w<Ko.length;w++)hn(Ko[w],m);break;case"source":hn("error",m);break;case"img":case"image":case"link":hn("error",m),hn("load",m);break;case"details":hn("toggle",m);break;case"input":tt(m,x),hn("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},hn("invalid",m);break;case"textarea":Bt(m,x),hn("invalid",m)}lt(u,x),w=null;for(var N in x)if(x.hasOwnProperty(N)){var U=x[N];N==="children"?typeof U=="string"?m.textContent!==U&&(x.suppressHydrationWarning!==!0&&wl(m.textContent,U,r),w=["children",U]):typeof U=="number"&&m.textContent!==""+U&&(x.suppressHydrationWarning!==!0&&wl(m.textContent,U,r),w=["children",""+U]):a.hasOwnProperty(N)&&U!=null&&N==="onScroll"&&hn("scroll",m)}switch(u){case"input":ft(m),Et(m,x,!0);break;case"textarea":ft(m),sn(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=bl)}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[oi]=o,r[Xo]=m,Kg(r,o,!1,!1),o.stateNode=r;e:{switch(N=Y(u,m),u){case"dialog":hn("cancel",r),hn("close",r),w=m;break;case"iframe":case"object":case"embed":hn("load",r),w=m;break;case"video":case"audio":for(w=0;w<Ko.length;w++)hn(Ko[w],r);w=m;break;case"source":hn("error",r),w=m;break;case"img":case"image":case"link":hn("error",r),hn("load",r),w=m;break;case"details":hn("toggle",r),w=m;break;case"input":tt(r,m),w=Mt(r,m),hn("invalid",r);break;case"option":w=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},w=E({},m,{value:void 0}),hn("invalid",r);break;case"textarea":Bt(r,m),w=Ze(r,m),hn("invalid",r);break;default:w=m}lt(u,w),U=w;for(x in U)if(U.hasOwnProperty(x)){var Q=U[x];x==="style"?mt(r,Q):x==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&_e(r,Q)):x==="children"?typeof Q=="string"?(u!=="textarea"||Q!=="")&&ut(r,Q):typeof Q=="number"&&ut(r,""+Q):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(a.hasOwnProperty(x)?Q!=null&&x==="onScroll"&&hn("scroll",r):Q!=null&&M(r,x,Q,N))}switch(u){case"input":ft(r),Et(r,m,!1);break;case"textarea":ft(r),sn(r);break;case"option":m.value!=null&&r.setAttribute("value",""+Ye(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?_t(r,!!m.multiple,x,!1):m.defaultValue!=null&&_t(r,!!m.multiple,m.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=bl)}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 Gn(o),null;case 6:if(r&&o.stateNode!=null)Yg(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=gs(na.current),gs(ai.current),Pl(o)){if(m=o.stateNode,u=o.memoizedProps,m[oi]=o,(x=m.nodeValue!==u)&&(r=wr,r!==null))switch(r.tag){case 3:wl(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&wl(m.nodeValue,u,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[oi]=o,o.stateNode=m}return Gn(o),null;case 13:if(fn(gn),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(mn&&br!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Zp(),eo(),o.flags|=98560,x=!1;else if(x=Pl(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[oi]=o}else eo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Gn(o),x=!1}else qr!==null&&(Hd(qr),qr=null),x=!0;if(!x)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||(gn.current&1)!==0?En===0&&(En=3):Vd())),o.updateQueue!==null&&(o.flags|=4),Gn(o),null);case 4:return io(),Ad(r,o),r===null&&Qo(o.stateNode.containerInfo),Gn(o),null;case 10:return od(o.type._context),Gn(o),null;case 17:return or(o.type)&&kl(),Gn(o),null;case 19:if(fn(gn),x=o.memoizedState,x===null)return Gn(o),null;if(m=(o.flags&128)!==0,N=x.rendering,N===null)if(m)aa(x,!1);else{if(En!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(N=Ll(r),N!==null){for(o.flags|=128,aa(x,!1),m=N.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)x=u,r=m,x.flags&=14680066,N=x.alternate,N===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=N.childLanes,x.lanes=N.lanes,x.child=N.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=N.memoizedProps,x.memoizedState=N.memoizedState,x.updateQueue=N.updateQueue,x.type=N.type,r=N.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return un(gn,gn.current&1|2),o.child}r=r.sibling}x.tail!==null&&O()>lo&&(o.flags|=128,m=!0,aa(x,!1),o.lanes=4194304)}else{if(!m)if(r=Ll(N),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),aa(x,!0),x.tail===null&&x.tailMode==="hidden"&&!N.alternate&&!mn)return Gn(o),null}else 2*O()-x.renderingStartTime>lo&&u!==1073741824&&(o.flags|=128,m=!0,aa(x,!1),o.lanes=4194304);x.isBackwards?(N.sibling=o.child,o.child=N):(u=x.last,u!==null?u.sibling=N:o.child=N,x.last=N)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=O(),o.sibling=null,u=gn.current,un(gn,m?u&1|2:u&1),o):(Gn(o),null);case 22:case 23:return $d(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(xr&1073741824)!==0&&(Gn(o),o.subtreeFlags&6&&(o.flags|=8192)):Gn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function E1(r,o){switch(ed(o),o.tag){case 1:return or(o.type)&&kl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return io(),fn(sr),fn($n),fd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return dd(o),null;case 13:if(fn(gn),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));eo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return fn(gn),null;case 4:return io(),null;case 10:return od(o.type._context),null;case 22:case 23:return $d(),null;case 24:return null;default:return null}}var zl=!1,Kn=!1,R1=typeof WeakSet=="function"?WeakSet:Set,Je=null;function oo(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 Ld(r,o,u){try{u()}catch(m){Sn(r,o,m)}}var Xg=!1;function M1(r,o){if($u=kn,r=Ep(),Fu(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,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var N=0,U=-1,Q=-1,fe=0,Te=0,Re=r,Pe=null;t:for(;;){for(var Ve;Re!==u||w!==0&&Re.nodeType!==3||(U=N+w),Re!==x||m!==0&&Re.nodeType!==3||(Q=N+m),Re.nodeType===3&&(N+=Re.nodeValue.length),(Ve=Re.firstChild)!==null;)Pe=Re,Re=Ve;for(;;){if(Re===r)break t;if(Pe===u&&++fe===w&&(U=N),Pe===x&&++Te===m&&(Q=N),(Ve=Re.nextSibling)!==null)break;Re=Pe,Pe=Re.parentNode}Re=Ve}u=U===-1||Q===-1?null:{start:U,end:Q}}else u=null}u=u||{start:0,end:0}}else u=null;for(Vu={focusedElem:r,selectionRange:u},kn=!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 nt=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(nt!==null){var ot=nt.memoizedProps,Cn=nt.memoizedState,oe=o.stateNode,Z=oe.getSnapshotBeforeUpdate(o.elementType===o.type?ot:$r(o.type,ot),Cn);oe.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var ce=o.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ie){Sn(o,o.return,Ie)}if(r=o.sibling,r!==null){r.return=o.return,Je=r;break}Je=o.return}return nt=Xg,Xg=!1,nt}function la(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 x=w.destroy;w.destroy=void 0,x!==void 0&&Ld(o,u,x)}w=w.next}while(w!==m)}}function Hl(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 Id(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 Jg(r){var o=r.alternate;o!==null&&(r.alternate=null,Jg(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[oi],delete o[Xo],delete o[Yu],delete o[f1],delete o[m1])),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 Zg(r){return r.tag===5||r.tag===3||r.tag===4}function ey(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Zg(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 Dd(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=bl));else if(m!==4&&(r=r.child,r!==null))for(Dd(r,o,u),r=r.sibling;r!==null;)Dd(r,o,u),r=r.sibling}function _d(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(_d(r,o,u),r=r.sibling;r!==null;)_d(r,o,u),r=r.sibling}var Wn=null,Vr=!1;function Hi(r,o,u){for(u=u.child;u!==null;)ty(r,o,u),u=u.sibling}function ty(r,o,u){if(de&&typeof de.onCommitFiberUnmount=="function")try{de.onCommitFiberUnmount(R,u)}catch{}switch(u.tag){case 5:Kn||oo(u,o);case 6:var m=Wn,w=Vr;Wn=null,Hi(r,o,u),Wn=m,Vr=w,Wn!==null&&(Vr?(r=Wn,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Wn.removeChild(u.stateNode));break;case 18:Wn!==null&&(Vr?(r=Wn,u=u.stateNode,r.nodeType===8?Qu(r.parentNode,u):r.nodeType===1&&Qu(r,u),rn(r)):Qu(Wn,u.stateNode));break;case 4:m=Wn,w=Vr,Wn=u.stateNode.containerInfo,Vr=!0,Hi(r,o,u),Wn=m,Vr=w;break;case 0:case 11:case 14:case 15:if(!Kn&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){w=m=m.next;do{var x=w,N=x.destroy;x=x.tag,N!==void 0&&((x&2)!==0||(x&4)!==0)&&Ld(u,o,N),w=w.next}while(w!==m)}Hi(r,o,u);break;case 1:if(!Kn&&(oo(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(U){Sn(u,o,U)}Hi(r,o,u);break;case 21:Hi(r,o,u);break;case 22:u.mode&1?(Kn=(m=Kn)||u.memoizedState!==null,Hi(r,o,u),Kn=m):Hi(r,o,u);break;default:Hi(r,o,u)}}function ny(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new R1),o.forEach(function(m){var w=U1.bind(null,r,m);u.has(m)||(u.add(m),m.then(w,w))})}}function Gr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var w=u[m];try{var x=r,N=o,U=N;e:for(;U!==null;){switch(U.tag){case 5:Wn=U.stateNode,Vr=!1;break e;case 3:Wn=U.stateNode.containerInfo,Vr=!0;break e;case 4:Wn=U.stateNode.containerInfo,Vr=!0;break e}U=U.return}if(Wn===null)throw Error(n(160));ty(x,N,w),Wn=null,Vr=!1;var Q=w.alternate;Q!==null&&(Q.return=null),w.return=null}catch(fe){Sn(w,o,fe)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)ry(o,r),o=o.sibling}function ry(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Gr(o,r),ci(r),m&4){try{la(3,r,r.return),Hl(3,r)}catch(ot){Sn(r,r.return,ot)}try{la(5,r,r.return)}catch(ot){Sn(r,r.return,ot)}}break;case 1:Gr(o,r),ci(r),m&512&&u!==null&&oo(u,u.return);break;case 5:if(Gr(o,r),ci(r),m&512&&u!==null&&oo(u,u.return),r.flags&32){var w=r.stateNode;try{ut(w,"")}catch(ot){Sn(r,r.return,ot)}}if(m&4&&(w=r.stateNode,w!=null)){var x=r.memoizedProps,N=u!==null?u.memoizedProps:x,U=r.type,Q=r.updateQueue;if(r.updateQueue=null,Q!==null)try{U==="input"&&x.type==="radio"&&x.name!=null&&Lt(w,x),Y(U,N);var fe=Y(U,x);for(N=0;N<Q.length;N+=2){var Te=Q[N],Re=Q[N+1];Te==="style"?mt(w,Re):Te==="dangerouslySetInnerHTML"?_e(w,Re):Te==="children"?ut(w,Re):M(w,Te,Re,fe)}switch(U){case"input":Tt(w,x);break;case"textarea":Ct(w,x);break;case"select":var Pe=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!x.multiple;var Ve=x.value;Ve!=null?_t(w,!!x.multiple,Ve,!1):Pe!==!!x.multiple&&(x.defaultValue!=null?_t(w,!!x.multiple,x.defaultValue,!0):_t(w,!!x.multiple,x.multiple?[]:"",!1))}w[Xo]=x}catch(ot){Sn(r,r.return,ot)}}break;case 6:if(Gr(o,r),ci(r),m&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,x=r.memoizedProps;try{w.nodeValue=x}catch(ot){Sn(r,r.return,ot)}}break;case 3:if(Gr(o,r),ci(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{rn(o.containerInfo)}catch(ot){Sn(r,r.return,ot)}break;case 4:Gr(o,r),ci(r);break;case 13:Gr(o,r),ci(r),w=r.child,w.flags&8192&&(x=w.memoizedState!==null,w.stateNode.isHidden=x,!x||w.alternate!==null&&w.alternate.memoizedState!==null||(Bd=O())),m&4&&ny(r);break;case 22:if(Te=u!==null&&u.memoizedState!==null,r.mode&1?(Kn=(fe=Kn)||Te,Gr(o,r),Kn=fe):Gr(o,r),ci(r),m&8192){if(fe=r.memoizedState!==null,(r.stateNode.isHidden=fe)&&!Te&&(r.mode&1)!==0)for(Je=r,Te=r.child;Te!==null;){for(Re=Je=Te;Je!==null;){switch(Pe=Je,Ve=Pe.child,Pe.tag){case 0:case 11:case 14:case 15:la(4,Pe,Pe.return);break;case 1:oo(Pe,Pe.return);var nt=Pe.stateNode;if(typeof nt.componentWillUnmount=="function"){m=Pe,u=Pe.return;try{o=m,nt.props=o.memoizedProps,nt.state=o.memoizedState,nt.componentWillUnmount()}catch(ot){Sn(m,u,ot)}}break;case 5:oo(Pe,Pe.return);break;case 22:if(Pe.memoizedState!==null){oy(Re);continue}}Ve!==null?(Ve.return=Pe,Je=Ve):oy(Re)}Te=Te.sibling}e:for(Te=null,Re=r;;){if(Re.tag===5){if(Te===null){Te=Re;try{w=Re.stateNode,fe?(x=w.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(U=Re.stateNode,Q=Re.memoizedProps.style,N=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,U.style.display=bt("display",N))}catch(ot){Sn(r,r.return,ot)}}}else if(Re.tag===6){if(Te===null)try{Re.stateNode.nodeValue=fe?"":Re.memoizedProps}catch(ot){Sn(r,r.return,ot)}}else if((Re.tag!==22&&Re.tag!==23||Re.memoizedState===null||Re===r)&&Re.child!==null){Re.child.return=Re,Re=Re.child;continue}if(Re===r)break e;for(;Re.sibling===null;){if(Re.return===null||Re.return===r)break e;Te===Re&&(Te=null),Re=Re.return}Te===Re&&(Te=null),Re.sibling.return=Re.return,Re=Re.sibling}}break;case 19:Gr(o,r),ci(r),m&4&&ny(r);break;case 21:break;default:Gr(o,r),ci(r)}}function ci(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(Zg(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&&(ut(w,""),m.flags&=-33);var x=ey(r);_d(r,x,w);break;case 3:case 4:var N=m.stateNode.containerInfo,U=ey(r);Dd(r,U,N);break;default:throw Error(n(161))}}catch(Q){Sn(r,r.return,Q)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function A1(r,o,u){Je=r,iy(r)}function iy(r,o,u){for(var m=(r.mode&1)!==0;Je!==null;){var w=Je,x=w.child;if(w.tag===22&&m){var N=w.memoizedState!==null||zl;if(!N){var U=w.alternate,Q=U!==null&&U.memoizedState!==null||Kn;U=zl;var fe=Kn;if(zl=N,(Kn=Q)&&!fe)for(Je=w;Je!==null;)N=Je,Q=N.child,N.tag===22&&N.memoizedState!==null?ay(w):Q!==null?(Q.return=N,Je=Q):ay(w);for(;x!==null;)Je=x,iy(x),x=x.sibling;Je=w,zl=U,Kn=fe}sy(r)}else(w.subtreeFlags&8772)!==0&&x!==null?(x.return=w,Je=x):sy(r)}}function sy(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:Kn||Hl(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Kn)if(u===null)m.componentDidMount();else{var w=o.elementType===o.type?u.memoizedProps:$r(o.type,u.memoizedProps);m.componentDidUpdate(w,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&og(o,x,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}og(o,N,u)}break;case 5:var U=o.stateNode;if(u===null&&o.flags&4){u=U;var Q=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&u.focus();break;case"img":Q.src&&(u.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var fe=o.alternate;if(fe!==null){var Te=fe.memoizedState;if(Te!==null){var Re=Te.dehydrated;Re!==null&&rn(Re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Kn||o.flags&512&&Id(o)}catch(Pe){Sn(o,o.return,Pe)}}if(o===r){Je=null;break}if(u=o.sibling,u!==null){u.return=o.return,Je=u;break}Je=o.return}}function oy(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 ay(r){for(;Je!==null;){var o=Je;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Hl(4,o)}catch(Q){Sn(o,u,Q)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var w=o.return;try{m.componentDidMount()}catch(Q){Sn(o,w,Q)}}var x=o.return;try{Id(o)}catch(Q){Sn(o,x,Q)}break;case 5:var N=o.return;try{Id(o)}catch(Q){Sn(o,N,Q)}}}catch(Q){Sn(o,o.return,Q)}if(o===r){Je=null;break}var U=o.sibling;if(U!==null){U.return=o.return,Je=U;break}Je=o.return}}var L1=Math.ceil,ql=z.ReactCurrentDispatcher,Fd=z.ReactCurrentOwner,Lr=z.ReactCurrentBatchConfig,Xt=0,Fn=null,jn=null,zn=0,xr=0,ao=Oi(0),En=0,ca=null,vs=0,$l=0,Od=0,ua=null,lr=null,Bd=0,lo=1/0,Ni=null,Vl=!1,Ud=null,qi=null,Gl=!1,$i=null,Kl=0,da=0,Wd=null,Ql=-1,Yl=0;function er(){return(Xt&6)!==0?O():Ql!==-1?Ql:Ql=O()}function Vi(r){return(r.mode&1)===0?1:(Xt&2)!==0&&zn!==0?zn&-zn:g1.transition!==null?(Yl===0&&(Yl=al()),Yl):(r=tn,r!==0||(r=window.event,r=r===void 0?16:cp(r.type)),r)}function Kr(r,o,u,m){if(50<da)throw da=0,Wd=null,Error(n(185));ri(r,u,m),((Xt&2)===0||r!==Fn)&&(r===Fn&&((Xt&2)===0&&($l|=u),En===4&&Gi(r,zn)),cr(r,m),u===1&&Xt===0&&(o.mode&1)===0&&(lo=O()+500,Cl&&Ui()))}function cr(r,o){var u=r.callbackNode;Pu(r,o);var m=gi(r,r===Fn?zn: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?p1(cy.bind(null,r)):Kp(cy.bind(null,r)),d1(function(){(Xt&6)===0&&Ui()}),u=null;else{switch(Fo(m)){case 1:u=Ne;break;case 4:u=kt;break;case 16:u=Nt;break;case 536870912:u=xe;break;default:u=Nt}u=yy(u,ly.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function ly(r,o){if(Ql=-1,Yl=0,(Xt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(co()&&r.callbackNode!==u)return null;var m=gi(r,r===Fn?zn:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Xl(r,m);else{o=m;var w=Xt;Xt|=2;var x=dy();(Fn!==r||zn!==o)&&(Ni=null,lo=O()+500,bs(r,o));do try{_1();break}catch(U){uy(r,U)}while(!0);sd(),ql.current=x,Xt=w,jn!==null?o=0:(Fn=null,zn=0,o=En)}if(o!==0){if(o===2&&(w=_o(r),w!==0&&(m=w,o=zd(r,w))),o===1)throw u=ca,bs(r,0),Gi(r,m),cr(r,O()),u;if(o===6)Gi(r,m);else{if(w=r.current.alternate,(m&30)===0&&!I1(w)&&(o=Xl(r,m),o===2&&(x=_o(r),x!==0&&(m=x,o=zd(r,x))),o===1))throw u=ca,bs(r,0),Gi(r,m),cr(r,O()),u;switch(r.finishedWork=w,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:xs(r,lr,Ni);break;case 3:if(Gi(r,m),(m&130023424)===m&&(o=Bd+500-O(),10<o)){if(gi(r,0)!==0)break;if(w=r.suspendedLanes,(w&m)!==m){er(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=Ku(xs.bind(null,r,lr,Ni),o);break}xs(r,lr,Ni);break;case 4:if(Gi(r,m),(m&4194240)===m)break;for(o=r.eventTimes,w=-1;0<m;){var N=31-ve(m);x=1<<N,N=o[N],N>w&&(w=N),m&=~x}if(m=w,m=O()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*L1(m/1960))-m,10<m){r.timeoutHandle=Ku(xs.bind(null,r,lr,Ni),m);break}xs(r,lr,Ni);break;case 5:xs(r,lr,Ni);break;default:throw Error(n(329))}}}return cr(r,O()),r.callbackNode===u?ly.bind(null,r):null}function zd(r,o){var u=ua;return r.current.memoizedState.isDehydrated&&(bs(r,o).flags|=256),r=Xl(r,o),r!==2&&(o=lr,lr=u,o!==null&&Hd(o)),r}function Hd(r){lr===null?lr=r:lr.push.apply(lr,r)}function I1(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],x=w.getSnapshot;w=w.value;try{if(!Hr(x(),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 Gi(r,o){for(o&=~Od,o&=~$l,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-ve(o),m=1<<u;r[u]=-1,o&=~m}}function cy(r){if((Xt&6)!==0)throw Error(n(327));co();var o=gi(r,0);if((o&1)===0)return cr(r,O()),null;var u=Xl(r,o);if(r.tag!==0&&u===2){var m=_o(r);m!==0&&(o=m,u=zd(r,m))}if(u===1)throw u=ca,bs(r,0),Gi(r,o),cr(r,O()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,xs(r,lr,Ni),cr(r,O()),null}function qd(r,o){var u=Xt;Xt|=1;try{return r(o)}finally{Xt=u,Xt===0&&(lo=O()+500,Cl&&Ui())}}function ws(r){$i!==null&&$i.tag===0&&(Xt&6)===0&&co();var o=Xt;Xt|=1;var u=Lr.transition,m=tn;try{if(Lr.transition=null,tn=1,r)return r()}finally{tn=m,Lr.transition=u,Xt=o,(Xt&6)===0&&Ui()}}function $d(){xr=ao.current,fn(ao)}function bs(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,u1(u)),jn!==null)for(u=jn.return;u!==null;){var m=u;switch(ed(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&kl();break;case 3:io(),fn(sr),fn($n),fd();break;case 5:dd(m);break;case 4:io();break;case 13:fn(gn);break;case 19:fn(gn);break;case 10:od(m.type._context);break;case 22:case 23:$d()}u=u.return}if(Fn=r,jn=r=Ki(r.current,null),zn=xr=o,En=0,ca=null,Od=$l=vs=0,lr=ua=null,ps!==null){for(o=0;o<ps.length;o++)if(u=ps[o],m=u.interleaved,m!==null){u.interleaved=null;var w=m.next,x=u.pending;if(x!==null){var N=x.next;x.next=w,m.next=N}u.pending=m}ps=null}return r}function uy(r,o){do{var u=jn;try{if(sd(),Il.current=Ol,Dl){for(var m=yn.memoizedState;m!==null;){var w=m.queue;w!==null&&(w.pending=null),m=m.next}Dl=!1}if(ys=0,_n=Tn=yn=null,ra=!1,ia=0,Fd.current=null,u===null||u.return===null){En=1,ca=o,jn=null;break}e:{var x=r,N=u.return,U=u,Q=o;if(o=zn,U.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=Q,Te=U,Re=Te.tag;if((Te.mode&1)===0&&(Re===0||Re===11||Re===15)){var Pe=Te.alternate;Pe?(Te.updateQueue=Pe.updateQueue,Te.memoizedState=Pe.memoizedState,Te.lanes=Pe.lanes):(Te.updateQueue=null,Te.memoizedState=null)}var Ve=Dg(N);if(Ve!==null){Ve.flags&=-257,_g(Ve,N,U,x,o),Ve.mode&1&&Ig(x,fe,o),o=Ve,Q=fe;var nt=o.updateQueue;if(nt===null){var ot=new Set;ot.add(Q),o.updateQueue=ot}else nt.add(Q);break e}else{if((o&1)===0){Ig(x,fe,o),Vd();break e}Q=Error(n(426))}}else if(mn&&U.mode&1){var Cn=Dg(N);if(Cn!==null){(Cn.flags&65536)===0&&(Cn.flags|=256),_g(Cn,N,U,x,o),rd(so(Q,U));break e}}x=Q=so(Q,U),En!==4&&(En=2),ua===null?ua=[x]:ua.push(x),x=N;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var oe=Ag(x,Q,o);sg(x,oe);break e;case 1:U=Q;var Z=x.type,ce=x.stateNode;if((x.flags&128)===0&&(typeof Z.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(qi===null||!qi.has(ce)))){x.flags|=65536,o&=-o,x.lanes|=o;var Ie=Lg(x,U,o);sg(x,Ie);break e}}x=x.return}while(x!==null)}fy(u)}catch(ct){o=ct,jn===u&&u!==null&&(jn=u=u.return);continue}break}while(!0)}function dy(){var r=ql.current;return ql.current=Ol,r===null?Ol:r}function Vd(){(En===0||En===3||En===2)&&(En=4),Fn===null||(vs&268435455)===0&&($l&268435455)===0||Gi(Fn,zn)}function Xl(r,o){var u=Xt;Xt|=2;var m=dy();(Fn!==r||zn!==o)&&(Ni=null,bs(r,o));do try{D1();break}catch(w){uy(r,w)}while(!0);if(sd(),Xt=u,ql.current=m,jn!==null)throw Error(n(261));return Fn=null,zn=0,En}function D1(){for(;jn!==null;)hy(jn)}function _1(){for(;jn!==null&&!Qe();)hy(jn)}function hy(r){var o=gy(r.alternate,r,xr);r.memoizedProps=r.pendingProps,o===null?fy(r):jn=o,Fd.current=null}function fy(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=T1(u,o,xr),u!==null){jn=u;return}}else{if(u=E1(u,o),u!==null){u.flags&=32767,jn=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{En=6,jn=null;return}}if(o=o.sibling,o!==null){jn=o;return}jn=o=r}while(o!==null);En===0&&(En=5)}function xs(r,o,u){var m=tn,w=Lr.transition;try{Lr.transition=null,tn=1,F1(r,o,u,m)}finally{Lr.transition=w,tn=m}return null}function F1(r,o,u,m){do co();while($i!==null);if((Xt&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 x=u.lanes|u.childLanes;if(Bs(r,x),r===Fn&&(jn=Fn=null,zn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Gl||(Gl=!0,yy(Nt,function(){return co(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=Lr.transition,Lr.transition=null;var N=tn;tn=1;var U=Xt;Xt|=4,Fd.current=null,M1(r,u),ry(u,r),r1(Vu),kn=!!$u,Vu=$u=null,r.current=u,A1(u),st(),Xt=U,tn=N,Lr.transition=x}else r.current=u;if(Gl&&(Gl=!1,$i=r,Kl=w),x=r.pendingLanes,x===0&&(qi=null),he(u.stateNode),cr(r,O()),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(Vl)throw Vl=!1,r=Ud,Ud=null,r;return(Kl&1)!==0&&r.tag!==0&&co(),x=r.pendingLanes,(x&1)!==0?r===Wd?da++:(da=0,Wd=r):da=0,Ui(),null}function co(){if($i!==null){var r=Fo(Kl),o=Lr.transition,u=tn;try{if(Lr.transition=null,tn=16>r?16:r,$i===null)var m=!1;else{if(r=$i,$i=null,Kl=0,(Xt&6)!==0)throw Error(n(331));var w=Xt;for(Xt|=4,Je=r.current;Je!==null;){var x=Je,N=x.child;if((Je.flags&16)!==0){var U=x.deletions;if(U!==null){for(var Q=0;Q<U.length;Q++){var fe=U[Q];for(Je=fe;Je!==null;){var Te=Je;switch(Te.tag){case 0:case 11:case 15:la(8,Te,x)}var Re=Te.child;if(Re!==null)Re.return=Te,Je=Re;else for(;Je!==null;){Te=Je;var Pe=Te.sibling,Ve=Te.return;if(Jg(Te),Te===fe){Je=null;break}if(Pe!==null){Pe.return=Ve,Je=Pe;break}Je=Ve}}}var nt=x.alternate;if(nt!==null){var ot=nt.child;if(ot!==null){nt.child=null;do{var Cn=ot.sibling;ot.sibling=null,ot=Cn}while(ot!==null)}}Je=x}}if((x.subtreeFlags&2064)!==0&&N!==null)N.return=x,Je=N;else e:for(;Je!==null;){if(x=Je,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:la(9,x,x.return)}var oe=x.sibling;if(oe!==null){oe.return=x.return,Je=oe;break e}Je=x.return}}var Z=r.current;for(Je=Z;Je!==null;){N=Je;var ce=N.child;if((N.subtreeFlags&2064)!==0&&ce!==null)ce.return=N,Je=ce;else e:for(N=Z;Je!==null;){if(U=Je,(U.flags&2048)!==0)try{switch(U.tag){case 0:case 11:case 15:Hl(9,U)}}catch(ct){Sn(U,U.return,ct)}if(U===N){Je=null;break e}var Ie=U.sibling;if(Ie!==null){Ie.return=U.return,Je=Ie;break e}Je=U.return}}if(Xt=w,Ui(),de&&typeof de.onPostCommitFiberRoot=="function")try{de.onPostCommitFiberRoot(R,r)}catch{}m=!0}return m}finally{tn=u,Lr.transition=o}}return!1}function my(r,o,u){o=so(u,o),o=Ag(r,o,1),r=zi(r,o,1),o=er(),r!==null&&(ri(r,1,o),cr(r,o))}function Sn(r,o,u){if(r.tag===3)my(r,r,u);else for(;o!==null;){if(o.tag===3){my(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(qi===null||!qi.has(m))){r=so(u,r),r=Lg(o,r,1),o=zi(o,r,1),r=er(),o!==null&&(ri(o,1,r),cr(o,r));break}}o=o.return}}function O1(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=er(),r.pingedLanes|=r.suspendedLanes&u,Fn===r&&(zn&u)===u&&(En===4||En===3&&(zn&130023424)===zn&&500>O()-Bd?bs(r,0):Od|=u),cr(r,o)}function py(r,o){o===0&&((r.mode&1)===0?o=1:(o=ni,ni<<=1,(ni&130023424)===0&&(ni=4194304)));var u=er();r=Si(r,o),r!==null&&(ri(r,o,u),cr(r,u))}function B1(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),py(r,u)}function U1(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),py(r,u)}var gy;gy=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||sr.current)ar=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return ar=!1,P1(r,o,u);ar=(r.flags&131072)!==0}else ar=!1,mn&&(o.flags&1048576)!==0&&Qp(o,Nl,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Wl(r,o),r=o.pendingProps;var w=Xs(o,$n.current);ro(o,u),w=gd(null,o,m,r,w,u);var x=yd();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,or(m)?(x=!0,Sl(o)):x=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,cd(o),w.updater=Bl,o.stateNode=w,w._reactInternals=o,Sd(o,m,r,u),o=Pd(null,o,m,!0,x,u)):(o.tag=0,mn&&x&&Zu(o),Zn(null,o,w,u),o=o.child),o;case 16:m=o.elementType;e:{switch(Wl(r,o),r=o.pendingProps,w=m._init,m=w(m._payload),o.type=m,w=o.tag=z1(m),r=$r(m,r),w){case 0:o=Nd(null,o,m,r,u);break e;case 1:o=zg(null,o,m,r,u);break e;case 11:o=Fg(null,o,m,r,u);break e;case 14:o=Og(null,o,m,$r(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:$r(m,w),Nd(r,o,m,w,u);case 1:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:$r(m,w),zg(r,o,m,w,u);case 3:e:{if(Hg(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,w=x.element,ig(r,o),Al(o,m,null,u);var N=o.memoizedState;if(m=N.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){w=so(Error(n(423)),o),o=qg(r,o,m,u,w);break e}else if(m!==w){w=so(Error(n(424)),o),o=qg(r,o,m,u,w);break e}else for(br=Fi(o.stateNode.containerInfo.firstChild),wr=o,mn=!0,qr=null,u=ng(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(eo(),m===w){o=ji(r,o,u);break e}Zn(r,o,m,u)}o=o.child}return o;case 5:return ag(o),r===null&&nd(o),m=o.type,w=o.pendingProps,x=r!==null?r.memoizedProps:null,N=w.children,Gu(m,w)?N=null:x!==null&&Gu(m,x)&&(o.flags|=32),Wg(r,o),Zn(r,o,N,u),o.child;case 6:return r===null&&nd(o),null;case 13:return $g(r,o,u);case 4:return ud(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=to(o,null,m,u):Zn(r,o,m,u),o.child;case 11:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:$r(m,w),Fg(r,o,m,w,u);case 7:return Zn(r,o,o.pendingProps,u),o.child;case 8:return Zn(r,o,o.pendingProps.children,u),o.child;case 12:return Zn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,w=o.pendingProps,x=o.memoizedProps,N=w.value,un(El,m._currentValue),m._currentValue=N,x!==null)if(Hr(x.value,N)){if(x.children===w.children&&!sr.current){o=ji(r,o,u);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var U=x.dependencies;if(U!==null){N=x.child;for(var Q=U.firstContext;Q!==null;){if(Q.context===m){if(x.tag===1){Q=Ci(-1,u&-u),Q.tag=2;var fe=x.updateQueue;if(fe!==null){fe=fe.shared;var Te=fe.pending;Te===null?Q.next=Q:(Q.next=Te.next,Te.next=Q),fe.pending=Q}}x.lanes|=u,Q=x.alternate,Q!==null&&(Q.lanes|=u),ad(x.return,u,o),U.lanes|=u;break}Q=Q.next}}else if(x.tag===10)N=x.type===o.type?null:x.child;else if(x.tag===18){if(N=x.return,N===null)throw Error(n(341));N.lanes|=u,U=N.alternate,U!==null&&(U.lanes|=u),ad(N,u,o),N=x.sibling}else N=x.child;if(N!==null)N.return=x;else for(N=x;N!==null;){if(N===o){N=null;break}if(x=N.sibling,x!==null){x.return=N.return,N=x;break}N=N.return}x=N}Zn(r,o,w.children,u),o=o.child}return o;case 9:return w=o.type,m=o.pendingProps.children,ro(o,u),w=Mr(w),m=m(w),o.flags|=1,Zn(r,o,m,u),o.child;case 14:return m=o.type,w=$r(m,o.pendingProps),w=$r(m.type,w),Og(r,o,m,w,u);case 15:return Bg(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:$r(m,w),Wl(r,o),o.tag=1,or(m)?(r=!0,Sl(o)):r=!1,ro(o,u),Rg(o,m,w),Sd(o,m,w,u),Pd(null,o,m,!0,r,u);case 19:return Gg(r,o,u);case 22:return Ug(r,o,u)}throw Error(n(156,o.tag))};function yy(r,o){return se(r,o)}function W1(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 Ir(r,o,u,m){return new W1(r,o,u,m)}function Gd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function z1(r){if(typeof r=="function")return Gd(r)?1:0;if(r!=null){if(r=r.$$typeof,r===X)return 11;if(r===q)return 14}return 2}function Ki(r,o){var u=r.alternate;return u===null?(u=Ir(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 Jl(r,o,u,m,w,x){var N=2;if(m=r,typeof r=="function")Gd(r)&&(N=1);else if(typeof r=="string")N=5;else e:switch(r){case I:return ks(u.children,w,x,o);case _:N=8,w|=8;break;case D:return r=Ir(12,u,o,w|2),r.elementType=D,r.lanes=x,r;case G:return r=Ir(13,u,o,w),r.elementType=G,r.lanes=x,r;case te:return r=Ir(19,u,o,w),r.elementType=te,r.lanes=x,r;case ne:return Zl(u,w,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case P:N=10;break e;case J:N=9;break e;case X:N=11;break e;case q:N=14;break e;case me:N=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Ir(N,u,o,w),o.elementType=r,o.type=m,o.lanes=x,o}function ks(r,o,u,m){return r=Ir(7,r,m,o),r.lanes=u,r}function Zl(r,o,u,m){return r=Ir(22,r,m,o),r.elementType=ne,r.lanes=u,r.stateNode={isHidden:!1},r}function Kd(r,o,u){return r=Ir(6,r,null,o),r.lanes=u,r}function Qd(r,o,u){return o=Ir(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function H1(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=Ur(0),this.expirationTimes=Ur(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ur(0),this.identifierPrefix=m,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Yd(r,o,u,m,w,x,N,U,Q){return r=new H1(r,o,u,U,Q),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Ir(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},cd(x),r}function q1(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 vy(r){if(!r)return Bi;r=r._reactInternals;e:{if(De(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(or(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(or(u))return Vp(r,u,o)}return o}function wy(r,o,u,m,w,x,N,U,Q){return r=Yd(u,m,!0,r,w,x,N,U,Q),r.context=vy(null),u=r.current,m=er(),w=Vi(u),x=Ci(m,w),x.callback=o??null,zi(u,x,w),r.current.lanes=w,ri(r,w,m),cr(r,m),r}function ec(r,o,u,m){var w=o.current,x=er(),N=Vi(w);return u=vy(u),o.context===null?o.context=u:o.pendingContext=u,o=Ci(x,N),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=zi(w,o,N),r!==null&&(Kr(r,w,N,x),Ml(r,w,N)),N}function tc(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 by(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function Xd(r,o){by(r,o),(r=r.alternate)&&by(r,o)}function $1(){return null}var xy=typeof reportError=="function"?reportError:function(r){console.error(r)};function Jd(r){this._internalRoot=r}nc.prototype.render=Jd.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));ec(r,o,null,null)},nc.prototype.unmount=Jd.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;ws(function(){ec(null,r,null,null)}),o[wi]=null}};function nc(r){this._internalRoot=r}nc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Oo();r={blockedOn:null,target:r,priority:o};for(var u=0;u<zr.length&&o!==0&&o<zr[u].priority;u++);zr.splice(u,0,r),u===0&>(r)}};function Zd(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function rc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function ky(){}function V1(r,o,u,m,w){if(w){if(typeof m=="function"){var x=m;m=function(){var fe=tc(N);x.call(fe)}}var N=wy(o,m,r,0,null,!1,!1,"",ky);return r._reactRootContainer=N,r[wi]=N.current,Qo(r.nodeType===8?r.parentNode:r),ws(),N}for(;w=r.lastChild;)r.removeChild(w);if(typeof m=="function"){var U=m;m=function(){var fe=tc(Q);U.call(fe)}}var Q=Yd(r,0,!1,null,null,!1,!1,"",ky);return r._reactRootContainer=Q,r[wi]=Q.current,Qo(r.nodeType===8?r.parentNode:r),ws(function(){ec(o,Q,u,m)}),Q}function ic(r,o,u,m,w){var x=u._reactRootContainer;if(x){var N=x;if(typeof w=="function"){var U=w;w=function(){var Q=tc(N);U.call(Q)}}ec(o,N,r,w)}else N=V1(u,o,r,w,m);return tc(N)}Ws=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=gr(o.pendingLanes);u!==0&&(Us(o,u|1),cr(o,O()),(Xt&6)===0&&(lo=O()+500,Ui()))}break;case 13:ws(function(){var m=Si(r,1);if(m!==null){var w=er();Kr(m,r,1,w)}}),Xd(r,1)}},zs=function(r){if(r.tag===13){var o=Si(r,134217728);if(o!==null){var u=er();Kr(o,r,134217728,u)}Xd(r,134217728)}},ll=function(r){if(r.tag===13){var o=Vi(r),u=Si(r,o);if(u!==null){var m=er();Kr(u,r,o,m)}Xd(r,o)}},Oo=function(){return tn},ls=function(r,o){var u=tn;try{return tn=r,o()}finally{tn=u}},xt=function(r,o,u){switch(o){case"input":if(Tt(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=xl(m);if(!w)throw Error(n(90));St(m),Tt(m,w)}}}break;case"textarea":Ct(r,u);break;case"select":o=u.value,o!=null&&_t(r,!!u.multiple,o,!1)}},Ht=qd,Zt=ws;var G1={usingClientEntryPoint:!1,Events:[Jo,Qs,xl,Se,dt,qd]},ha={findFiberByHostInstance:ds,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},K1={bundleType:ha.bundleType,version:ha.version,rendererPackageName:ha.rendererPackageName,rendererConfig:ha.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:z.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Rt(r),r===null?null:r.stateNode},findFiberByHostInstance:ha.findFiberByHostInstance||$1,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 sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{R=sc.inject(K1),de=sc}catch{}}return ur.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G1,ur.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zd(o))throw Error(n(200));return q1(r,o,null,u)},ur.createRoot=function(r,o){if(!Zd(r))throw Error(n(299));var u=!1,m="",w=xy;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=Yd(r,1,!1,null,null,u,!1,m,w),r[wi]=o.current,Qo(r.nodeType===8?r.parentNode:r),new Jd(o)},ur.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=Rt(o),r=r===null?null:r.stateNode,r},ur.flushSync=function(r){return ws(r)},ur.hydrate=function(r,o,u){if(!rc(o))throw Error(n(200));return ic(null,r,o,!0,u)},ur.hydrateRoot=function(r,o,u){if(!Zd(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,w=!1,x="",N=xy;if(u!=null&&(u.unstable_strictMode===!0&&(w=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(N=u.onRecoverableError)),o=wy(o,null,r,1,u??null,w,!1,x,N),r[wi]=o.current,Qo(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 nc(o)},ur.render=function(r,o,u){if(!rc(o))throw Error(n(200));return ic(null,r,o,!1,u)},ur.unmountComponentAtNode=function(r){if(!rc(r))throw Error(n(40));return r._reactRootContainer?(ws(function(){ic(null,null,r,!1,function(){r._reactRootContainer=null,r[wi]=null})}),!0):!1},ur.unstable_batchedUpdates=qd,ur.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!rc(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return ic(r,o,u,!1,m)},ur.version="18.3.1-next-f1338f8080-20240426",ur}var Ry;function ux(){if(Ry)return nh.exports;Ry=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(),nh.exports=rj(),nh.exports}var My;function ij(){if(My)return oc;My=1;var e=ux();return oc.createRoot=e.createRoot,oc.hydrateRoot=e.hydrateRoot,oc}var sj=ij();const oj=Va(sj);var v=Jf();const aj=Va(v),lj=cx({__proto__:null,default:aj},[v]);function cj(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(!cj(s.protocol))throw new Error("INVALID_SERVER_PROTOCOL");s.hash="",s.search="";const a=s.pathname.replace(/\/+$/,"");return`${s.origin}${a==="/"?"":a}`}const wo="codingns.auth.remembered-login";function Zf(){return typeof window<"u"&&typeof window.localStorage<"u"}function uj(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function dx(){if(!Zf())return null;const e=window.localStorage.getItem(wo);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(wo),null;const n=t.username.trim(),s=t.password,a=Ri(t.serverBaseUrl);return!n||!s?(window.localStorage.removeItem(wo),null):{username:n,password:s,serverBaseUrl:a}}catch{return window.localStorage.removeItem(wo),null}}function hx(e){if(!Zf())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:Ri(e.serverBaseUrl)};window.localStorage.setItem(wo,JSON.stringify(t))}function dj(e){const t=dx();t&&hx({...t,serverBaseUrl:e})}function hj(){Zf()&&window.localStorage.removeItem(wo)}function fx(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function mx(){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 fj(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 mj(e){const t=fj(e);return t<768?"compact":t<1024?"medium":"expanded"}function pj(e){const t=mx();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 Cr(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Qr(e,t){return px(e,t)}async function px(e,t){if(!fx())return Cr("当前运行环境不支持桌面壳能力。");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 gj(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 gx(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function yx(e){if(gx())try{navigator.vibrate(gj(e))}catch{return}}async function vx(e,t){if(typeof window>"u"||typeof Notification>"u")return Cr("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return Cr("系统通知权限未授予。");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 yj{constructor(){He(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(Cr("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,n){return vx(t,n)}writeClipboardText(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(Cr("当前不是桌面端运行环境。"))}}class vj{constructor(){He(this,"supported",gx())}trigger(t){return yx(t)}}class wj{constructor(){He(this,"supported",!0)}openExternal(t){return Qr("open_external",{url:t})}async showNotification(t,n){const s=await vx(t,n);return s.ok?s:Qr("show_notification",{title:t,body:n})}writeClipboardText(t){return Qr("copy_text",{text:t})}setWindowState(t){return Qr("set_window_state",{state:t})}readDesktopConfig(){return Qr("read_desktop_config")}writeDesktopConfig(t){return Qr("write_desktop_config",{patch:t})}getRuntimeInfo(){return Qr("get_runtime_info")}checkForUpdate(t){return Qr("check_for_update",{channel:t})}async installUpdate(t){const n=await Qr("install_update",{manifest:t});return n.ok?n.value??{ok:!0}:{ok:!1,errorCode:n.errorCode,detail:n.detail}}rollbackToPreviousVersion(){return Qr("rollback_to_previous_version")}pickDirectory(){return Qr("pick_directory")}}class bj{constructor(){He(this,"supported",!0)}async trigger(t){(await px("perform_haptic_feedback",{kind:t})).ok||await yx(t)}}function wx(){if(!fx())return"web";const e=mx();return e==="ios"?"ios":e==="android"?"android":"desktop"}function mi(e={}){const t=wx(),n=mj(e.viewportWidth),s=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:s||n!=="expanded",isNativeMobile:s,viewportClass:n,ui:pj(t),bridge:t==="desktop"?new wj:new yj,haptics:s?new bj:new vj}}const hf="codingns.client.runtime-config";function em(e){return e==="desktop"||e==="ios"||e==="android"}function bx(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function xj(){return typeof navigator>"u"?"zh-CN":bx(navigator.language)}function kj(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function xx(){return typeof window<"u"&&typeof window.localStorage<"u"}function Sj(){if(!xx())return null;const e=window.localStorage.getItem(hf);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(hf),null}}function kx(e){xx()&&window.localStorage.setItem(hf,JSON.stringify(e))}function Cj(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function jj(e){if(!e)return null;try{return Ri(e)}catch{return null}}function tm(e){if(e==="web"){const t=jj(Cj());if(t)return t}return Ri("http://127.0.0.1:3002")}function Nj(e){return{platform:e,hostBaseUrl:tm(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:xj(),defaultPermissionMode:"default"}}function ff(e,t){if(!t)return e;const n=t.platform??e.platform;return{...e,...t,hostBaseUrl:em(n)?t.hostBaseUrl?Ri(t.hostBaseUrl):e.hostBaseUrl:tm(n),platform:n,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:bx(t.language??e.language),defaultPermissionMode:kj(t.defaultPermissionMode??e.defaultPermissionMode)}}async function Pj(){const e=mi(),t=Nj(e.platform),n=Sj();let s=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(s=c.value)}const a=ff(ff(t,n),s);return kx(a),a}async function Tj(e,t){const n=ff(e,t);kx(n),dj(n.hostBaseUrl);const s=mi();return s.isDesktop&&await s.bridge.writeDesktopConfig(n),n}function Ej(){const e=wx();return{platform:e,hostBaseUrl:tm(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class Rj{constructor(){He(this,"state",Ej());He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await Pj();return this.hydrate(t),t}async update(t){const n=await Tj(this.state,t);return this.hydrate(n),n}emit(){for(const t of this.listeners)t()}}const An=new Rj;function Mj(e){return v.useSyncExternalStore(An.subscribe,()=>e(An.getState()))}function Aj(e){return e.endsWith("/")?e:`${e}/`}function Lj(e){return e.replace(/^\/+/,"")}function _a(){return An.getState().hostBaseUrl}function nm(e,t=_a()){return new URL(Lj(e),Aj(t)).toString()}function Sx(e,t=_a()){const n=new URL(nm(e,t));return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.toString()}class tr extends Error{constructor(n,s){super(s.detail);He(this,"status");He(this,"errorCode");He(this,"field");this.name="ApiError",this.status=n,this.errorCode=s.error_code,this.field=s.field}}class Ij{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=nm(t,n.baseUrl??_a());if(a&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),!n.skipAuth){const f=(d=wn.getState().session)==null?void 0:d.accessToken;if(!f)throw wn.clear(),new tr(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 tr(0,{detail:`请求 ${c} 失败:${p}`,error_code:"NETWORK_ERROR"})}if(!l.ok){const f=await Dj(l);if(Cx(l.status,f.error_code)&&!n.skipAuth&&!n.retryAfterRefresh){const p=await wn.refresh();if(p.status==="refreshed")return this.performRequest(t,{...n,retryAfterRefresh:!0});throw p.status==="invalid"?new tr(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new tr(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!n.skipAuth&&_j(l.status,f.error_code)&&wn.clear(),new tr(l.status,f)}return l}}const Ke=new Ij;async function Dj(e){const t=await e.text();if(!t)return Ay(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 Ay(e.status,t)}function Ay(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function Cx(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function _j(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:Cx(e,t)}function Fj(e){return Ke.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function Oj(e,t){return Ke.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function Bj(e,t){return Ke.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function Uj(e,t){return Ke.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const ma="codingns.auth.session";class Wj{constructor(){He(this,"state",{status:"anonymous",session:this.readSession()});He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,n,s){const a=await Bj({username:t,password:n},s);return this.setSession(a),a}async bootstrap(t,n,s){await Oj({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 Uj({refreshToken:n});return this.setSession(s),{status:"refreshed",session:s}}catch(s){return Hj(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(ma),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const n={serverBaseUrl:_a(),session:t};window.localStorage.setItem(ma,JSON.stringify(n)),this.emit()}readSession(){const t=window.localStorage.getItem(ma);if(!t)return null;try{const n=JSON.parse(t),s=_a();return zj(n)?(n.serverBaseUrl&&n.serverBaseUrl!==s,n.session):Nx(n)?n:(window.localStorage.removeItem(ma),null)}catch{return window.localStorage.removeItem(ma),null}}emit(){for(const t of this.listeners)t()}}const wn=new Wj;function jx(e){return v.useSyncExternalStore(wn.subscribe,()=>e(wn.getState()))}function zj(e){return typeof e!="object"||e===null?!1:"session"in e&&Nx(e.session)}function Nx(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 Hj(e){return e instanceof tr?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const Px="/api/preferences/profile";async function qj(){return Ke.request(Px)}async function Tx(e){return Ke.request(Px,{method:"PUT",body:JSON.stringify(e)})}const du=["claude-code","codex","opencode"],Ex="codingns.account.preferences.shadow",$j="codingns.client.runtime-config",Vj="codingns-theme",Gj="composer-selected-model:",Kj="composer-reasoning-level:";function Ga(){return typeof window<"u"&&typeof window.localStorage<"u"}function rm(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function Qj(){return typeof navigator>"u"?"zh-CN":rm(navigator.language)??"zh-CN"}function Rx(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function Yj(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mx(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function Ax(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function Lx(){return{"claude-code":{defaultModel:null,defaultReasoningLevel:null},codex:{defaultModel:null,defaultReasoningLevel:null},opencode:{defaultModel:null,defaultReasoningLevel:null}}}function Ix(){return{initialized:!0,profile:{language:Qj(),theme:Yj(),defaultPermissionMode:"default"},providers:Lx(),updatedAt:null,source:"default"}}function Xj(){const e=An.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!Ga())return t;const n=window.localStorage.getItem($j);if(!n)return t;try{const s=JSON.parse(n);return{language:rm(s.language)??t.language,defaultPermissionMode:Mx(s.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function Jj(){return Ga()?Rx(window.localStorage.getItem(Vj)):null}function Zj(){var t;if(!Ga())return;const e={};for(const n of du){const s=((t=window.localStorage.getItem(`${Gj}${n}`))==null?void 0:t.trim())||null,a=Ax(window.localStorage.getItem(`${Kj}${n}`));s===null&&a===null||(e[n]={defaultModel:s,defaultReasoningLevel:a})}return Object.keys(e).length>0?e:void 0}function Dx(){const e=Xj(),t=Jj(),n=Zj(),s={};return e.language&&(s.language=e.language),t&&(s.theme=t),e.defaultPermissionMode&&(s.defaultPermissionMode=e.defaultPermissionMode),n&&(s.providers=n),_x(s)?s:null}function _x(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 Hc(e){var s;const t=Ix(),n=Lx();for(const a of du){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:Ax(c==null?void 0:c.defaultReasoningLevel)??null}}return{language:rm(e==null?void 0:e.language)??t.profile.language,theme:Rx(e==null?void 0:e.theme)??t.profile.theme,defaultPermissionMode:Mx(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:n,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function eN(){var t,n,s;if(!Ga())return null;const e=window.localStorage.getItem(Ex);if(!e)return null;try{const a=JSON.parse(e),c=Hc({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(!Ga())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem(Ex,JSON.stringify(t))}function uo(){const e=Ix(),t=Dx(),n=t?Fx(e,t,"default"):e,s=eN();return s?{initialized:!0,profile:s.profile,providers:s.providers,updatedAt:s.updatedAt,source:"shadow"}:n}function mf(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function Fx(e,t,n){const s={...e.providers};if(t.providers)for(const a of du){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=Hc(await qj());if(e.updatedAt===null){const n=Dx();if(_x(n)){const s=Hc(await Tx(n)),a=mf(s,"remote");return qc(a),a}}const t=mf(e,"remote");return qc(t),t}class nN{constructor(){He(this,"state",uo());He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);An.subscribe(()=>{wn.getState().session||this.state.source==="remote"||this.hydrate(uo())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(uo())}async initialize(){if(!wn.getState().session){const t=uo();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!wn.getState().session){const t=uo();return this.hydrate(t),t}try{const t=await tN();return this.hydrate(t),t}catch{const t=uo();return this.hydrate(t),t}}async updateProfile(t){const n=this.state,s=Fx(n,t,n.source);if(this.hydrate(s),!wn.getState().session)return qc(s),s;try{const a=Hc(await Tx(t)),c=mf(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 ei=new nN;function pf(e){return v.useSyncExternalStore(ei.subscribe,()=>e(ei.getState()))}function sh(e){return du.includes(e)}function rN(){return ei.initialize()}function $c(e){return ei.updateProfile(e)}function To(e){return pf(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function iN(){const e=mi();return await An.initialize(),await rN(),{platform:e.platform}}var Bn=ux();const sN=Va(Bn),oN=cx({__proto__:null,default:sN},[Bn]);/**
|
|
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 pn(){return pn=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},pn.apply(this,arguments)}var Pn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Pn||(Pn={}));const Ly="popstate";function aN(e){e===void 0&&(e={});function t(s,a){let{pathname:c,search:l,hash:d}=s.location;return Fa("",{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:Ka(a)}return cN(t,n,null,e)}function $t(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Is(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lN(){return Math.random().toString(36).substr(2,8)}function Iy(e,t){return{usr:e.state,key:e.key,idx:t}}function Fa(e,t,n,s){return n===void 0&&(n=null),pn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ss(t):t,{state:n,key:t&&t.key||s||lN()})}function Ka(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 ss(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 cN(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:c=!1}=s,l=a.history,d=Pn.Pop,f=null,p=y();p==null&&(p=0,l.replaceState(pn({},l.state,{idx:p}),""));function y(){return(l.state||{idx:null}).idx}function g(){d=Pn.Pop;let j=y(),A=j==null?null:j-p;p=j,f&&f({action:d,location:C.location,delta:A})}function b(j,A){d=Pn.Push;let L=Fa(C.location,j,A);p=y()+1;let M=Iy(L,p),z=C.createHref(L);try{l.pushState(M,"",z)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;a.location.assign(z)}c&&f&&f({action:d,location:C.location,delta:1})}function k(j,A){d=Pn.Replace;let L=Fa(C.location,j,A);p=y();let M=Iy(L,p),z=C.createHref(L);l.replaceState(M,"",z),c&&f&&f({action:d,location:C.location,delta:0})}function S(j){let A=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof j=="string"?j:Ka(j);return L=L.replace(/ $/,"%20"),$t(A,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,A)}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(Ly,g),f=j,()=>{a.removeEventListener(Ly,g),f=null}},createHref(j){return t(a,j)},createURL:S,encodeLocation(j){let A=S(j);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:b,replace:k,go(j){return l.go(j)}};return C}var on;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(on||(on={}));const uN=new Set(["lazy","caseSensitive","path","id","index","children"]);function dN(e){return e.index===!0}function Vc(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($t(a.index!==!0||!a.children,"Cannot specify children on an index route"),$t(!s[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),dN(a)){let f=pn({},a,t(a),{id:d});return s[d]=f,f}else{let f=pn({},a,t(a),{id:d,children:void 0});return s[d]=f,a.children&&(f.children=Vc(a.children,t,l,s)),f}})}function Es(e,t,n){return n===void 0&&(n="/"),Tc(e,t,n,!1)}function Tc(e,t,n,s){let a=typeof t=="string"?ss(t):t,c=Qa(a.pathname||"/",n);if(c==null)return null;let l=Ox(e);fN(l);let d=null;for(let f=0;d==null&&f<l.length;++f){let p=CN(c);d=kN(l[f],p,s)}return d}function hN(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 Ox(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("/")&&($t(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=rs([s,f.relativePath]),y=n.concat(f);c.children&&c.children.length>0&&($t(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),Ox(c.children,t,y,p)),!(c.path==null&&!c.index)&&t.push({path:p,score:bN(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 Bx(c.path))a(c,l,f)}),t}function Bx(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=Bx(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 fN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:xN(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const mN=/^:[\w-]+$/,pN=3,gN=2,yN=1,vN=10,wN=-2,Dy=e=>e==="*";function bN(e,t){let n=e.split("/"),s=n.length;return n.some(Dy)&&(s+=wN),t&&(s+=gN),n.filter(a=>!Dy(a)).reduce((a,c)=>a+(mN.test(c)?pN:c===""?yN:vN),s)}function xN(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 kN(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=Mn({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},y),b=f.route;if(!g&&p&&n&&!s[s.length-1].route.index&&(g=Mn({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},y)),!g)return null;Object.assign(a,g.params),l.push({params:a,pathname:rs([c,g.pathname]),pathnameBase:TN(rs([c,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(c=rs([c,g.pathnameBase]))}return l}function Mn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=SN(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:k}=y;if(b==="*"){let C=d[g]||"";l=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const S=d[g];return k&&!S?p[b]=void 0:p[b]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:l,pattern:e}}function SN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Is(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 CN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Is(!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 Qa(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,NN=e=>jN.test(e);function PN(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?ss(e):e,c;if(n)if(NN(n))c=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Is(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?c=_y(n.substring(1),"/"):c=_y(n,t)}else c=t;return{pathname:c,search:EN(s),hash:RN(a)}}function _y(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 oh(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 Ux(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function im(e,t){let n=Ux(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function sm(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=ss(e):(a=pn({},e),$t(!a.pathname||!a.pathname.includes("?"),oh("?","pathname","search",a)),$t(!a.pathname||!a.pathname.includes("#"),oh("#","pathname","hash",a)),$t(!a.search||!a.search.includes("#"),oh("#","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=PN(a,d),p=l&&l!=="/"&&l.endsWith("/"),y=(c||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||y)&&(f.pathname+="/"),f}const rs=e=>e.join("/").replace(/\/\/+/g,"/"),TN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),EN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,RN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Gc{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 Oa(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Wx=["post","put","patch","delete"],MN=new Set(Wx),AN=["get",...Wx],LN=new Set(AN),IN=new Set([301,302,303,307,308]),DN=new Set([307,308]),ah={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_N={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},pa={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},om=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,FN=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),zx="remix-router-transitions";function ON(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;$t(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 $=e.detectErrorBoundary;a=ee=>({hasErrorBoundary:$(ee)})}else a=FN;let c={},l=Vc(e.routes,a,void 0,c),d,f=e.basename||"/",p=e.dataStrategy||zN,y=e.patchRoutesOnNavigation,g=pn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),b=null,k=new Set,S=null,C=null,j=null,A=e.hydrationData!=null,L=Es(l,e.history.location,f),M=!1,z=null;if(L==null&&!y){let $=fr(404,{pathname:e.history.location.pathname}),{matches:ee,route:le}=Gy(l);L=ee,z={[le.id]:$}}L&&!e.hydrationData&&Zt(L,l,e.history.location.pathname).active&&(L=null);let V;if(L)if(L.some($=>$.route.lazy))V=!1;else if(!L.some($=>$.route.loader))V=!0;else if(g.v7_partialHydration){let $=e.hydrationData?e.hydrationData.loaderData:null,ee=e.hydrationData?e.hydrationData.errors:null;if(ee){let le=L.findIndex(be=>ee[be.route.id]!==void 0);V=L.slice(0,le+1).every(be=>!yf(be.route,$,ee))}else V=L.every(le=>!yf(le.route,$,ee))}else V=e.hydrationData!=null;else if(V=!1,L=[],g.v7_partialHydration){let $=Zt(null,l,e.history.location.pathname);$.active&&$.matches&&(M=!0,L=$.matches)}let F,I={historyAction:e.history.action,location:e.history.location,matches:L,initialized:V,navigation:ah,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||z,fetchers:new Map,blockers:new Map},_=Pn.Pop,D=!1,P,J=!1,X=new Map,G=null,te=!1,q=!1,me=[],ne=new Set,K=new Map,ae=0,E=-1,B=new Map,re=new Set,T=new Map,ke=new Map,ge=new Set,Ee=new Map,Be=new Map,Ye;function $e(){if(b=e.history.listen($=>{let{action:ee,location:le,delta:be}=$;if(Ye){Ye(),Ye=void 0;return}Is(Be.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 Ce=xt({currentLocation:I.location,nextLocation:le,historyAction:ee});if(Ce&&be!=null){let Fe=new Promise(Xe=>{Ye=Xe});e.history.go(be*-1),it(Ce,{state:"blocked",location:le,proceed(){it(Ce,{state:"proceeding",proceed:void 0,reset:void 0,location:le}),Fe.then(()=>e.history.go(be))},reset(){let Xe=new Map(I.blockers);Xe.set(Ce,pa),St({blockers:Xe})}});return}return Lt(ee,le)}),n){nP(t,X);let $=()=>rP(t,X);t.addEventListener("pagehide",$),G=()=>t.removeEventListener("pagehide",$)}return I.initialized||Lt(Pn.Pop,I.location,{initialHydration:!0}),F}function rt(){b&&b(),G&&G(),k.clear(),P&&P.abort(),I.fetchers.forEach(($,ee)=>Ge(ee)),I.blockers.forEach(($,ee)=>Me(ee))}function ft($){return k.add($),()=>k.delete($)}function St($,ee){ee===void 0&&(ee={}),I=pn({},I,$);let le=[],be=[];g.v7_fetcherPersist&&I.fetchers.forEach((Ce,Fe)=>{Ce.state==="idle"&&(ge.has(Fe)?be.push(Fe):le.push(Fe))}),ge.forEach(Ce=>{!I.fetchers.has(Ce)&&!K.has(Ce)&&be.push(Ce)}),[...k].forEach(Ce=>Ce(I,{deletedFetchers:be,viewTransitionOpts:ee.viewTransitionOpts,flushSync:ee.flushSync===!0})),g.v7_fetcherPersist?(le.forEach(Ce=>I.fetchers.delete(Ce)),be.forEach(Ce=>Ge(Ce))):be.forEach(Ce=>ge.delete(Ce))}function Dt($,ee,le){var be,Ce;let{flushSync:Fe}=le===void 0?{}:le,Xe=I.actionData!=null&&I.navigation.formMethod!=null&&Jr(I.navigation.formMethod)&&I.navigation.state==="loading"&&((be=$.state)==null?void 0:be._isRedirect)!==!0,Ue;ee.actionData?Object.keys(ee.actionData).length>0?Ue=ee.actionData:Ue=null:Xe?Ue=I.actionData:Ue=null;let We=ee.loaderData?$y(I.loaderData,ee.loaderData,ee.matches||[],ee.errors):I.loaderData,Oe=I.blockers;Oe.size>0&&(Oe=new Map(Oe),Oe.forEach((ht,en)=>Oe.set(en,pa)));let De=D===!0||I.navigation.formMethod!=null&&Jr(I.navigation.formMethod)&&((Ce=$.state)==null?void 0:Ce._isRedirect)!==!0;d&&(l=d,d=void 0),te||_===Pn.Pop||(_===Pn.Push?e.history.push($,$.state):_===Pn.Replace&&e.history.replace($,$.state));let at;if(_===Pn.Pop){let ht=X.get(I.location.pathname);ht&&ht.has($.pathname)?at={currentLocation:I.location,nextLocation:$}:X.has($.pathname)&&(at={currentLocation:$,nextLocation:I.location})}else if(J){let ht=X.get(I.location.pathname);ht?ht.add($.pathname):(ht=new Set([$.pathname]),X.set(I.location.pathname,ht)),at={currentLocation:I.location,nextLocation:$}}St(pn({},ee,{actionData:Ue,loaderData:We,historyAction:_,location:$,initialized:!0,navigation:ah,revalidation:"idle",restoreScrollPosition:Ht($,ee.matches||I.matches),preventScrollReset:De,blockers:Oe}),{viewTransitionOpts:at,flushSync:Fe===!0}),_=Pn.Pop,D=!1,J=!1,te=!1,q=!1,me=[]}async function Mt($,ee){if(typeof $=="number"){e.history.go($);return}let le=gf(I.location,I.matches,f,g.v7_prependBasename,$,g.v7_relativeSplatPath,ee==null?void 0:ee.fromRouteId,ee==null?void 0:ee.relative),{path:be,submission:Ce,error:Fe}=Fy(g.v7_normalizeFormMethod,!1,le,ee),Xe=I.location,Ue=Fa(I.location,be,ee&&ee.state);Ue=pn({},Ue,e.history.encodeLocation(Ue));let We=ee&&ee.replace!=null?ee.replace:void 0,Oe=Pn.Push;We===!0?Oe=Pn.Replace:We===!1||Ce!=null&&Jr(Ce.formMethod)&&Ce.formAction===I.location.pathname+I.location.search&&(Oe=Pn.Replace);let De=ee&&"preventScrollReset"in ee?ee.preventScrollReset===!0:void 0,at=(ee&&ee.flushSync)===!0,ht=xt({currentLocation:Xe,nextLocation:Ue,historyAction:Oe});if(ht){it(ht,{state:"blocked",location:Ue,proceed(){it(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:Ue}),Mt($,ee)},reset(){let en=new Map(I.blockers);en.set(ht,pa),St({blockers:en})}});return}return await Lt(Oe,Ue,{submission:Ce,pendingError:Fe,preventScrollReset:De,replace:ee&&ee.replace,enableViewTransition:ee&&ee.viewTransition,flushSync:at})}function tt(){if(ye(),St({revalidation:"loading"}),I.navigation.state!=="submitting"){if(I.navigation.state==="idle"){Lt(I.historyAction,I.location,{startUninterruptedRevalidation:!0});return}Lt(_||I.historyAction,I.navigation.location,{overrideNavigation:I.navigation,enableViewTransition:J===!0})}}async function Lt($,ee,le){P&&P.abort(),P=null,_=$,te=(le&&le.startUninterruptedRevalidation)===!0,dt(I.location,I.matches),D=(le&&le.preventScrollReset)===!0,J=(le&&le.enableViewTransition)===!0;let be=d||l,Ce=le&&le.overrideNavigation,Fe=le!=null&&le.initialHydration&&I.matches&&I.matches.length>0&&!M?I.matches:Es(be,ee,f),Xe=(le&&le.flushSync)===!0;if(Fe&&I.initialized&&!q&&KN(I.location,ee)&&!(le&&le.submission&&Jr(le.submission.formMethod))){Dt(ee,{matches:Fe},{flushSync:Xe});return}let Ue=Zt(Fe,be,ee.pathname);if(Ue.active&&Ue.matches&&(Fe=Ue.matches),!Fe){let{error:Rt,notFoundMatches:ze,route:se}=Vt(ee.pathname);Dt(ee,{matches:ze,loaderData:{},errors:{[se.id]:Rt}},{flushSync:Xe});return}P=new AbortController;let We=ho(e.history,ee,P.signal,le&&le.submission),Oe;if(le&&le.pendingError)Oe=[Rs(Fe).route.id,{type:on.error,error:le.pendingError}];else if(le&&le.submission&&Jr(le.submission.formMethod)){let Rt=await Tt(We,ee,le.submission,Fe,Ue.active,{replace:le.replace,flushSync:Xe});if(Rt.shortCircuited)return;if(Rt.pendingActionResult){let[ze,se]=Rt.pendingActionResult;if(jr(se)&&Oa(se.error)&&se.error.status===404){P=null,Dt(ee,{matches:Rt.matches,loaderData:{},errors:{[ze]:se.error}});return}}Fe=Rt.matches||Fe,Oe=Rt.pendingActionResult,Ce=lh(ee,le.submission),Xe=!1,Ue.active=!1,We=ho(e.history,We.url,We.signal)}let{shortCircuited:De,matches:at,loaderData:ht,errors:en}=await Et(We,ee,Fe,Ue.active,Ce,le&&le.submission,le&&le.fetcherSubmission,le&&le.replace,le&&le.initialHydration===!0,Xe,Oe);De||(P=null,Dt(ee,pn({matches:at||Fe},Vy(Oe),{loaderData:ht,errors:en})))}async function Tt($,ee,le,be,Ce,Fe){Fe===void 0&&(Fe={}),ye();let Xe=eP(ee,le);if(St({navigation:Xe},{flushSync:Fe.flushSync===!0}),Ce){let Oe=await cn(be,ee.pathname,$.signal);if(Oe.type==="aborted")return{shortCircuited:!0};if(Oe.type==="error"){let De=Rs(Oe.partialMatches).route.id;return{matches:Oe.partialMatches,pendingActionResult:[De,{type:on.error,error:Oe.error}]}}else if(Oe.matches)be=Oe.matches;else{let{notFoundMatches:De,error:at,route:ht}=Vt(ee.pathname);return{matches:De,pendingActionResult:[ht.id,{type:on.error,error:at}]}}}let Ue,We=ja(be,ee);if(!We.route.action&&!We.route.lazy)Ue={type:on.error,error:fr(405,{method:$.method,pathname:ee.pathname,routeId:We.route.id})};else if(Ue=(await sn("action",I,$,[We],be,null))[We.route.id],$.signal.aborted)return{shortCircuited:!0};if(As(Ue)){let Oe;return Fe&&Fe.replace!=null?Oe=Fe.replace:Oe=zy(Ue.response.headers.get("Location"),new URL($.url),f,e.history)===I.location.pathname+I.location.search,await Ct($,Ue,!0,{submission:le,replace:Oe}),{shortCircuited:!0}}if(ts(Ue))throw fr(400,{type:"defer-action"});if(jr(Ue)){let Oe=Rs(be,We.route.id);return(Fe&&Fe.replace)!==!0&&(_=Pn.Push),{matches:be,pendingActionResult:[Oe.route.id,Ue]}}return{matches:be,pendingActionResult:[We.route.id,Ue]}}async function Et($,ee,le,be,Ce,Fe,Xe,Ue,We,Oe,De){let at=Ce||lh(ee,Fe),ht=Fe||Xe||Qy(at),en=!te&&(!g.v7_partialHydration||!We);if(be){if(en){let R=Ot(De);St(pn({navigation:at},R!==void 0?{actionData:R}:{}),{flushSync:Oe})}let xe=await cn(le,ee.pathname,$.signal);if(xe.type==="aborted")return{shortCircuited:!0};if(xe.type==="error"){let R=Rs(xe.partialMatches).route.id;return{matches:xe.partialMatches,loaderData:{},errors:{[R]:xe.error}}}else if(xe.matches)le=xe.matches;else{let{error:R,notFoundMatches:de,route:he}=Vt(ee.pathname);return{matches:de,loaderData:{},errors:{[he.id]:R}}}}let Rt=d||l,[ze,se]=By(e.history,I,le,ht,ee,g.v7_partialHydration&&We===!0,g.v7_skipActionErrorRevalidation,q,me,ne,ge,T,re,Rt,f,De);if(Gt(xe=>!(le&&le.some(R=>R.route.id===xe))||ze&&ze.some(R=>R.route.id===xe)),E=++ae,ze.length===0&&se.length===0){let xe=At();return Dt(ee,pn({matches:le,loaderData:{},errors:De&&jr(De[1])?{[De[0]]:De[1].error}:null},Vy(De),xe?{fetchers:new Map(I.fetchers)}:{}),{flushSync:Oe}),{shortCircuited:!0}}if(en){let xe={};if(!be){xe.navigation=at;let R=Ot(De);R!==void 0&&(xe.actionData=R)}se.length>0&&(xe.fetchers=zt(se)),St(xe,{flushSync:Oe})}se.forEach(xe=>{bt(xe.key),xe.controller&&K.set(xe.key,xe.controller)});let je=()=>se.forEach(xe=>bt(xe.key));P&&P.signal.addEventListener("abort",je);let{loaderResults:Qe,fetcherResults:st}=await ue(I,le,ze,se,$);if($.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",je),se.forEach(xe=>K.delete(xe.key));let O=ac(Qe);if(O)return await Ct($,O.result,!0,{replace:Ue}),{shortCircuited:!0};if(O=ac(st),O)return re.add(O.key),await Ct($,O.result,!0,{replace:Ue}),{shortCircuited:!0};let{loaderData:pe,errors:Ne}=qy(I,le,Qe,De,se,st,Ee);Ee.forEach((xe,R)=>{xe.subscribe(de=>{(de||xe.done)&&Ee.delete(R)})}),g.v7_partialHydration&&We&&I.errors&&(Ne=pn({},I.errors,Ne));let kt=At(),Nt=lt(E),W=kt||Nt||se.length>0;return pn({matches:le,loaderData:pe,errors:Ne},W?{fetchers:new Map(I.fetchers)}:{})}function Ot($){if($&&!jr($[1]))return{[$[0]]:$[1].data};if(I.actionData)return Object.keys(I.actionData).length===0?null:I.actionData}function zt($){return $.forEach(ee=>{let le=I.fetchers.get(ee.key),be=ga(void 0,le?le.data:void 0);I.fetchers.set(ee.key,be)}),new Map(I.fetchers)}function _t($,ee,le,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.");bt($);let Ce=(be&&be.flushSync)===!0,Fe=d||l,Xe=gf(I.location,I.matches,f,g.v7_prependBasename,le,g.v7_relativeSplatPath,ee,be==null?void 0:be.relative),Ue=Es(Fe,Xe,f),We=Zt(Ue,Fe,Xe);if(We.active&&We.matches&&(Ue=We.matches),!Ue){_e($,ee,fr(404,{pathname:Xe}),{flushSync:Ce});return}let{path:Oe,submission:De,error:at}=Fy(g.v7_normalizeFormMethod,!0,Xe,be);if(at){_e($,ee,at,{flushSync:Ce});return}let ht=ja(Ue,Oe),en=(be&&be.preventScrollReset)===!0;if(De&&Jr(De.formMethod)){Ze($,ee,Oe,ht,Ue,We.active,Ce,en,De);return}T.set($,{routeId:ee,path:Oe}),Bt($,ee,Oe,ht,Ue,We.active,Ce,en,De)}async function Ze($,ee,le,be,Ce,Fe,Xe,Ue,We){ye(),T.delete($);function Oe(ve){if(!ve.route.action&&!ve.route.lazy){let et=fr(405,{method:We.formMethod,pathname:le,routeId:ee});return _e($,ee,et,{flushSync:Xe}),!0}return!1}if(!Fe&&Oe(be))return;let De=I.fetchers.get($);Ae($,tP(We,De),{flushSync:Xe});let at=new AbortController,ht=ho(e.history,le,at.signal,We);if(Fe){let ve=await cn(Ce,new URL(ht.url).pathname,ht.signal,$);if(ve.type==="aborted")return;if(ve.type==="error"){_e($,ee,ve.error,{flushSync:Xe});return}else if(ve.matches){if(Ce=ve.matches,be=ja(Ce,le),Oe(be))return}else{_e($,ee,fr(404,{pathname:le}),{flushSync:Xe});return}}K.set($,at);let en=ae,ze=(await sn("action",I,ht,[be],Ce,$))[be.route.id];if(ht.signal.aborted){K.get($)===at&&K.delete($);return}if(g.v7_fetcherPersist&&ge.has($)){if(As(ze)||jr(ze)){Ae($,Zi(void 0));return}}else{if(As(ze))if(K.delete($),E>en){Ae($,Zi(void 0));return}else return re.add($),Ae($,ga(We)),Ct(ht,ze,!1,{fetcherSubmission:We,preventScrollReset:Ue});if(jr(ze)){_e($,ee,ze.error);return}}if(ts(ze))throw fr(400,{type:"defer-action"});let se=I.navigation.location||I.location,je=ho(e.history,se,at.signal),Qe=d||l,st=I.navigation.state!=="idle"?Es(Qe,I.navigation.location,f):I.matches;$t(st,"Didn't find any matches after fetcher action");let O=++ae;B.set($,O);let pe=ga(We,ze.data);I.fetchers.set($,pe);let[Ne,kt]=By(e.history,I,st,We,se,!1,g.v7_skipActionErrorRevalidation,q,me,ne,ge,T,re,Qe,f,[be.route.id,ze]);kt.filter(ve=>ve.key!==$).forEach(ve=>{let et=ve.key,pt=I.fetchers.get(et),Yt=ga(void 0,pt?pt.data:void 0);I.fetchers.set(et,Yt),bt(et),ve.controller&&K.set(et,ve.controller)}),St({fetchers:new Map(I.fetchers)});let Nt=()=>kt.forEach(ve=>bt(ve.key));at.signal.addEventListener("abort",Nt);let{loaderResults:W,fetcherResults:xe}=await ue(I,st,Ne,kt,je);if(at.signal.aborted)return;at.signal.removeEventListener("abort",Nt),B.delete($),K.delete($),kt.forEach(ve=>K.delete(ve.key));let R=ac(W);if(R)return Ct(je,R.result,!1,{preventScrollReset:Ue});if(R=ac(xe),R)return re.add(R.key),Ct(je,R.result,!1,{preventScrollReset:Ue});let{loaderData:de,errors:he}=qy(I,st,W,void 0,kt,xe,Ee);if(I.fetchers.has($)){let ve=Zi(ze.data);I.fetchers.set($,ve)}lt(O),I.navigation.state==="loading"&&O>E?($t(_,"Expected pending action"),P&&P.abort(),Dt(I.navigation.location,{matches:st,loaderData:de,errors:he,fetchers:new Map(I.fetchers)})):(St({errors:he,loaderData:$y(I.loaderData,de,st,he),fetchers:new Map(I.fetchers)}),q=!1)}async function Bt($,ee,le,be,Ce,Fe,Xe,Ue,We){let Oe=I.fetchers.get($);Ae($,ga(We,Oe?Oe.data:void 0),{flushSync:Xe});let De=new AbortController,at=ho(e.history,le,De.signal);if(Fe){let ze=await cn(Ce,new URL(at.url).pathname,at.signal,$);if(ze.type==="aborted")return;if(ze.type==="error"){_e($,ee,ze.error,{flushSync:Xe});return}else if(ze.matches)Ce=ze.matches,be=ja(Ce,le);else{_e($,ee,fr(404,{pathname:le}),{flushSync:Xe});return}}K.set($,De);let ht=ae,Rt=(await sn("loader",I,at,[be],Ce,$))[be.route.id];if(ts(Rt)&&(Rt=await am(Rt,at.signal,!0)||Rt),K.get($)===De&&K.delete($),!at.signal.aborted){if(ge.has($)){Ae($,Zi(void 0));return}if(As(Rt))if(E>ht){Ae($,Zi(void 0));return}else{re.add($),await Ct(at,Rt,!1,{preventScrollReset:Ue});return}if(jr(Rt)){_e($,ee,Rt.error);return}$t(!ts(Rt),"Unhandled fetcher deferred data"),Ae($,Zi(Rt.data))}}async function Ct($,ee,le,be){let{submission:Ce,fetcherSubmission:Fe,preventScrollReset:Xe,replace:Ue}=be===void 0?{}:be;ee.response.headers.has("X-Remix-Revalidate")&&(q=!0);let We=ee.response.headers.get("Location");$t(We,"Expected a Location header on the redirect Response"),We=zy(We,new URL($.url),f,e.history);let Oe=Fa(I.location,We,{_isRedirect:!0});if(n){let ze=!1;if(ee.response.headers.has("X-Remix-Reload-Document"))ze=!0;else if(om.test(We)){const se=e.history.createURL(We);ze=se.origin!==t.location.origin||Qa(se.pathname,f)==null}if(ze){Ue?t.location.replace(We):t.location.assign(We);return}}P=null;let De=Ue===!0||ee.response.headers.has("X-Remix-Replace")?Pn.Replace:Pn.Push,{formMethod:at,formAction:ht,formEncType:en}=I.navigation;!Ce&&!Fe&&at&&ht&&en&&(Ce=Qy(I.navigation));let Rt=Ce||Fe;if(DN.has(ee.response.status)&&Rt&&Jr(Rt.formMethod))await Lt(De,Oe,{submission:pn({},Rt,{formAction:We}),preventScrollReset:Xe||D,enableViewTransition:le?J:void 0});else{let ze=lh(Oe,Ce);await Lt(De,Oe,{overrideNavigation:ze,fetcherSubmission:Fe,preventScrollReset:Xe||D,enableViewTransition:le?J:void 0})}}async function sn($,ee,le,be,Ce,Fe){let Xe,Ue={};try{Xe=await HN(p,$,ee,le,be,Ce,Fe,c,a)}catch(We){return be.forEach(Oe=>{Ue[Oe.route.id]={type:on.error,error:We}}),Ue}for(let[We,Oe]of Object.entries(Xe))if(QN(Oe)){let De=Oe.result;Ue[We]={type:on.redirect,response:VN(De,le,We,Ce,f,g.v7_relativeSplatPath)}}else Ue[We]=await $N(Oe);return Ue}async function ue($,ee,le,be,Ce){let Fe=$.matches,Xe=sn("loader",$,Ce,le,ee,null),Ue=Promise.all(be.map(async De=>{if(De.matches&&De.match&&De.controller){let ht=(await sn("loader",$,ho(e.history,De.path,De.controller.signal),[De.match],De.matches,De.key))[De.match.route.id];return{[De.key]:ht}}else return Promise.resolve({[De.key]:{type:on.error,error:fr(404,{pathname:De.path})}})})),We=await Xe,Oe=(await Ue).reduce((De,at)=>Object.assign(De,at),{});return await Promise.all([JN(ee,We,Ce.signal,Fe,$.loaderData),ZN(ee,Oe,be)]),{loaderResults:We,fetcherResults:Oe}}function ye(){q=!0,me.push(...Gt()),T.forEach(($,ee)=>{K.has(ee)&&ne.add(ee),bt(ee)})}function Ae($,ee,le){le===void 0&&(le={}),I.fetchers.set($,ee),St({fetchers:new Map(I.fetchers)},{flushSync:(le&&le.flushSync)===!0})}function _e($,ee,le,be){be===void 0&&(be={});let Ce=Rs(I.matches,ee);Ge($),St({errors:{[Ce.route.id]:le},fetchers:new Map(I.fetchers)},{flushSync:(be&&be.flushSync)===!0})}function ut($){return ke.set($,(ke.get($)||0)+1),ge.has($)&&ge.delete($),I.fetchers.get($)||_N}function Ge($){let ee=I.fetchers.get($);K.has($)&&!(ee&&ee.state==="loading"&&B.has($))&&bt($),T.delete($),B.delete($),re.delete($),g.v7_fetcherPersist&&ge.delete($),ne.delete($),I.fetchers.delete($)}function Jt($){let ee=(ke.get($)||0)-1;ee<=0?(ke.delete($),ge.add($),g.v7_fetcherPersist||Ge($)):ke.set($,ee),St({fetchers:new Map(I.fetchers)})}function bt($){let ee=K.get($);ee&&(ee.abort(),K.delete($))}function mt($){for(let ee of $){let le=ut(ee),be=Zi(le.data);I.fetchers.set(ee,be)}}function At(){let $=[],ee=!1;for(let le of re){let be=I.fetchers.get(le);$t(be,"Expected fetcher: "+le),be.state==="loading"&&(re.delete(le),$.push(le),ee=!0)}return mt($),ee}function lt($){let ee=[];for(let[le,be]of B)if(be<$){let Ce=I.fetchers.get(le);$t(Ce,"Expected fetcher: "+le),Ce.state==="loading"&&(bt(le),B.delete(le),ee.push(le))}return mt(ee),ee.length>0}function Y($,ee){let le=I.blockers.get($)||pa;return Be.get($)!==ee&&Be.set($,ee),le}function Me($){I.blockers.delete($),Be.delete($)}function it($,ee){let le=I.blockers.get($)||pa;$t(le.state==="unblocked"&&ee.state==="blocked"||le.state==="blocked"&&ee.state==="blocked"||le.state==="blocked"&&ee.state==="proceeding"||le.state==="blocked"&&ee.state==="unblocked"||le.state==="proceeding"&&ee.state==="unblocked","Invalid blocker state transition: "+le.state+" -> "+ee.state);let be=new Map(I.blockers);be.set($,ee),St({blockers:be})}function xt($){let{currentLocation:ee,nextLocation:le,historyAction:be}=$;if(Be.size===0)return;Be.size>1&&Is(!1,"A router only supports one blocker at a time");let Ce=Array.from(Be.entries()),[Fe,Xe]=Ce[Ce.length-1],Ue=I.blockers.get(Fe);if(!(Ue&&Ue.state==="proceeding")&&Xe({currentLocation:ee,nextLocation:le,historyAction:be}))return Fe}function Vt($){let ee=fr(404,{pathname:$}),le=d||l,{matches:be,route:Ce}=Gy(le);return Gt(),{notFoundMatches:be,route:Ce,error:ee}}function Gt($){let ee=[];return Ee.forEach((le,be)=>{(!$||$(be))&&(le.cancel(),ee.push(be),Ee.delete(be))}),ee}function Qt($,ee,le){if(S=$,j=ee,C=le||null,!A&&I.navigation===ah){A=!0;let be=Ht(I.location,I.matches);be!=null&&St({restoreScrollPosition:be})}return()=>{S=null,j=null,C=null}}function Se($,ee){return C&&C($,ee.map(be=>hN(be,I.loaderData)))||$.key}function dt($,ee){if(S&&j){let le=Se($,ee);S[le]=j()}}function Ht($,ee){if(S){let le=Se($,ee),be=S[le];if(typeof be=="number")return be}return null}function Zt($,ee,le){if(y)if($){if(Object.keys($[0].params).length>0)return{active:!0,matches:Tc(ee,le,f,!0)}}else return{active:!0,matches:Tc(ee,le,f,!0)||[]};return{active:!1,matches:null}}async function cn($,ee,le,be){if(!y)return{type:"success",matches:$};let Ce=$;for(;;){let Fe=d==null,Xe=d||l,Ue=c;try{await y({signal:le,path:ee,matches:Ce,fetcherKey:be,patch:(De,at)=>{le.aborted||Wy(De,at,Xe,Ue,a)}})}catch(De){return{type:"error",error:De,partialMatches:Ce}}finally{Fe&&!le.aborted&&(l=[...l])}if(le.aborted)return{type:"aborted"};let We=Es(Xe,ee,f);if(We)return{type:"success",matches:We};let Oe=Tc(Xe,ee,f,!0);if(!Oe||Ce.length===Oe.length&&Ce.every((De,at)=>De.route.id===Oe[at].route.id))return{type:"success",matches:null};Ce=Oe}}function bn($){c={},d=Vc($,a,void 0,c)}function xn($,ee){let le=d==null;Wy($,ee,d||l,c,a),le&&(l=[...l],St({}))}return F={get basename(){return f},get future(){return g},get state(){return I},get routes(){return l},get window(){return t},initialize:$e,subscribe:ft,enableScrollRestoration:Qt,navigate:Mt,fetch:_t,revalidate:tt,createHref:$=>e.history.createHref($),encodeLocation:$=>e.history.encodeLocation($),getFetcher:ut,deleteFetcher:Jt,dispose:rt,getBlocker:Y,deleteBlocker:Me,patchRoutes:xn,_internalFetchControllers:K,_internalActiveDeferreds:Ee,_internalSetRoutes:bn},F}function BN(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function gf(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=sm(a||".",im(f,c),Qa(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=lm(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),k=b.getAll("index");b.delete("index"),k.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:rs([n,y.pathname])),Ka(y)}function Fy(e,t,n,s){if(!s||!BN(s))return{path:n};if(s.formMethod&&!XN(s.formMethod))return{path:n,error:fr(405,{method:s.formMethod})};let a=()=>({path:n,error:fr(400,{type:"invalid-body"})}),c=s.formMethod||"get",l=e?c.toUpperCase():c.toLowerCase(),d=$x(n);if(s.body!==void 0){if(s.formEncType==="text/plain"){if(!Jr(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((k,S)=>{let[C,j]=S;return""+k+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(!Jr(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()}}}$t(typeof FormData=="function","FormData is not available in this environment");let f,p;if(s.formData)f=vf(s.formData),p=s.formData;else if(s.body instanceof FormData)f=vf(s.body),p=s.body;else if(s.body instanceof URLSearchParams)f=s.body,p=Hy(f);else if(s.body==null)f=new URLSearchParams,p=new FormData;else try{f=new URLSearchParams(s.body),p=Hy(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(Jr(y.formMethod))return{path:n,submission:y};let g=ss(n);return t&&g.search&&lm(g.search)&&f.append("index",""),g.search="?"+f,{path:Ka(g),submission:y}}function Oy(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 By(e,t,n,s,a,c,l,d,f,p,y,g,b,k,S,C){let j=C?jr(C[1])?C[1].error:C[1].data:void 0,A=e.createURL(t.location),L=e.createURL(a),M=n;c&&t.errors?M=Oy(n,Object.keys(t.errors)[0],!0):C&&jr(C[1])&&(M=Oy(n,C[0]));let z=C?C[1].statusCode:void 0,V=l&&z&&z>=400,F=M.filter((_,D)=>{let{route:P}=_;if(P.lazy)return!0;if(P.loader==null)return!1;if(c)return yf(P,t.loaderData,t.errors);if(UN(t.loaderData,t.matches[D],_)||f.some(G=>G===_.route.id))return!0;let J=t.matches[D],X=_;return Uy(_,pn({currentUrl:A,currentParams:J.params,nextUrl:L,nextParams:X.params},s,{actionResult:j,actionStatus:z,defaultShouldRevalidate:V?!1:d||A.pathname+A.search===L.pathname+L.search||A.search!==L.search||Hx(J,X)}))}),I=[];return g.forEach((_,D)=>{if(c||!n.some(te=>te.route.id===_.routeId)||y.has(D))return;let P=Es(k,_.path,S);if(!P){I.push({key:D,routeId:_.routeId,path:_.path,matches:null,match:null,controller:null});return}let J=t.fetchers.get(D),X=ja(P,_.path),G=!1;b.has(D)?G=!1:p.has(D)?(p.delete(D),G=!0):J&&J.state!=="idle"&&J.data===void 0?G=d:G=Uy(X,pn({currentUrl:A,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:n[n.length-1].params},s,{actionResult:j,actionStatus:z,defaultShouldRevalidate:V?!1:d})),G&&I.push({key:D,routeId:_.routeId,path:_.path,matches:P,match:X,controller:new AbortController})}),[F,I]}function yf(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 UN(e,t,n){let s=!t||n.route.id!==t.route.id,a=e[n.route.id]===void 0;return s||a}function Hx(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Uy(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Wy(e,t,n,s,a){var c;let l;if(e){let p=s[e];$t(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=>qx(p,y))),f=Vc(d,a,[e||"_","patch",String(((c=l)==null?void 0:c.length)||"0")],s);l.push(...f)}function qx(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=>qx(n,c))}):!1}async function WN(e,t,n){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let a=n[e.id];$t(a,"No route found in manifest");let c={};for(let l in s){let f=a[l]!==void 0&&l!=="hasErrorBoundary";Is(!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&&!uN.has(l)&&(c[l]=s[l])}Object.assign(a,c),Object.assign(a,pn({},t(a),{lazy:void 0}))}async function zN(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 HN(e,t,n,s,a,c,l,d,f,p){let y=c.map(k=>k.route.lazy?WN(k.route,f,d):void 0),g=c.map((k,S)=>{let C=y[S],j=a.some(L=>L.route.id===k.route.id);return pn({},k,{shouldLoad:j,resolve:async L=>(L&&s.method==="GET"&&(k.route.lazy||k.route.loader)&&(j=!0),j?qN(t,s,k,C,L,p):Promise.resolve({type:on.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 qN(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]:[]),k=(async()=>{try{return{type:"data",result:await(a?a(C=>b(C)):b())}}catch(S){return{type:"error",result:S}}})();return Promise.race([k,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 fr(405,{method:t.method,pathname:g,routeId:n.route.id})}else return{type:on.data,result:void 0};else if(p)l=await f(p);else{let y=new URL(t.url),g=y.pathname+y.search;throw fr(404,{pathname:g})}$t(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:on.error,result:p}}finally{d&&t.signal.removeEventListener("abort",d)}return l}async function $N(e){let{result:t,type:n}=e;if(Vx(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:on.error,error:b}}return n===on.error?{type:on.error,error:new Gc(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:on.data,data:g,statusCode:t.status,headers:t.headers}}if(n===on.error){if(Ky(t)){var s,a;if(t.data instanceof Error){var c,l;return{type:on.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:on.error,error:new Gc(((s=t.init)==null?void 0:s.status)||500,void 0,t.data),statusCode:Oa(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:on.error,error:t,statusCode:Oa(t)?t.status:void 0}}if(YN(t)){var d,f;return{type:on.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(Ky(t)){var p,y;return{type:on.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:on.data,data:t}}function VN(e,t,n,s,a,c){let l=e.headers.get("Location");if($t(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!om.test(l)){let d=s.slice(0,s.findIndex(f=>f.route.id===n)+1);l=gf(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(om.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=Qa(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 ho(e,t,n,s){let a=e.createURL($x(t)).toString(),c={signal:n};if(s&&Jr(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=vf(s.formData):c.body=s.formData}return new Request(a,c)}function vf(e){let t=new URLSearchParams;for(let[n,s]of e.entries())t.append(n,typeof s=="string"?s:s.name);return t}function Hy(e){let t=new FormData;for(let[n,s]of e.entries())t.append(n,s);return t}function GN(e,t,n,s,a){let c={},l=null,d,f=!1,p={},y=n&&jr(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let b=g.route.id,k=t[b];if($t(!As(k),"Cannot handle redirect results in processLoaderData"),jr(k)){let S=k.error;y!==void 0&&(S=y,y=void 0),l=l||{};{let C=Rs(e,b);l[C.route.id]==null&&(l[C.route.id]=S)}c[b]=void 0,f||(f=!0,d=Oa(k.error)?k.error.status:500),k.headers&&(p[b]=k.headers)}else ts(k)?(s.set(b,k.deferredData),c[b]=k.deferredData.data,k.statusCode!=null&&k.statusCode!==200&&!f&&(d=k.statusCode),k.headers&&(p[b]=k.headers)):(c[b]=k.data,k.statusCode&&k.statusCode!==200&&!f&&(d=k.statusCode),k.headers&&(p[b]=k.headers))}),y!==void 0&&n&&(l={[n[0]]:y},c[n[0]]=void 0),{loaderData:c,errors:l,statusCode:d||200,loaderHeaders:p}}function qy(e,t,n,s,a,c,l){let{loaderData:d,errors:f}=GN(t,n,s,l);return a.forEach(p=>{let{key:y,match:g,controller:b}=p,k=c[y];if($t(k,"Did not find corresponding fetcher result"),!(b&&b.signal.aborted))if(jr(k)){let S=Rs(e.matches,g==null?void 0:g.route.id);f&&f[S.route.id]||(f=pn({},f,{[S.route.id]:k.error})),e.fetchers.delete(y)}else if(As(k))$t(!1,"Unhandled fetcher revalidation redirect");else if(ts(k))$t(!1,"Unhandled fetcher deferred data");else{let S=Zi(k.data);e.fetchers.set(y,S)}}),{loaderData:d,errors:f}}function $y(e,t,n,s){let a=pn({},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 Vy(e){return e?jr(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Rs(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 Gy(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 fr(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 Gc(e||500,d,new Error(f),!0)}function ac(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[s,a]=t[n];if(As(a))return{key:s,result:a}}}function $x(e){let t=typeof e=="string"?ss(e):e;return Ka(pn({},t,{hash:""}))}function KN(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function QN(e){return Vx(e.result)&&IN.has(e.result.status)}function ts(e){return e.type===on.deferred}function jr(e){return e.type===on.error}function As(e){return(e&&e.type)===on.redirect}function Ky(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function YN(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 Vx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function XN(e){return LN.has(e.toLowerCase())}function Jr(e){return MN.has(e.toLowerCase())}async function JN(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&&!Hx(y,p)&&(a&&a[p.route.id])!==void 0;ts(f)&&g&&await am(f,n,!1).then(b=>{b&&(t[d]=b)})}}async function ZN(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)&&ts(d)&&($t(l,"Expected an AbortController for revalidating fetcher deferred result"),await am(d,l.signal,!0).then(p=>{p&&(t[a]=p)}))}}async function am(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:on.data,data:e.deferredData.unwrappedData}}catch(a){return{type:on.error,error:a}}return{type:on.data,data:e.deferredData.data}}}function lm(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function ja(e,t){let n=typeof t=="string"?ss(t).search:t.search;if(e[e.length-1].route.index&&lm(n||""))return e[e.length-1];let s=Ux(e);return s[s.length-1]}function Qy(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 lh(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 eP(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 ga(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 Zi(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 nP(e,t){try{let n=e.sessionStorage.getItem(zx);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(zx,JSON.stringify(n))}catch(s){Is(!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 Kc(){return Kc=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},Kc.apply(this,arguments)}const hu=v.createContext(null),Gx=v.createContext(null),Ya=v.createContext(null),cm=v.createContext(null),Mi=v.createContext({outlet:null,matches:[],isDataRoute:!1}),Kx=v.createContext(null);function Xa(){return v.useContext(cm)!=null}function ti(){return Xa()||$t(!1),v.useContext(cm).location}function Qx(e){v.useContext(Ya).static||v.useLayoutEffect(e)}function qn(){let{isDataRoute:e}=v.useContext(Mi);return e?yP():iP()}function iP(){Xa()||$t(!1);let e=v.useContext(hu),{basename:t,future:n,navigator:s}=v.useContext(Ya),{matches:a}=v.useContext(Mi),{pathname:c}=ti(),l=JSON.stringify(im(a,n.v7_relativeSplatPath)),d=v.useRef(!1);return Qx(()=>{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=sm(p,JSON.parse(l),c,y.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:rs([t,g.pathname])),(y.replace?s.replace:s.push)(g,y.state,y)},[t,s,l,c,e])}const sP=v.createContext(null);function oP(e){let t=v.useContext(Mi).outlet;return t&&v.createElement(sP.Provider,{value:e},t)}function um(){let{matches:e}=v.useContext(Mi),t=e[e.length-1];return t?t.params:{}}function aP(e,t,n,s){Xa()||$t(!1);let{navigator:a}=v.useContext(Ya),{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=ti(),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 k=Es(e,{pathname:b});return hP(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:rs([f,a.encodeLocation?a.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:rs([f,a.encodeLocation?a.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),c,n,s)}function lP(){let e=gP(),t=Oa(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 cP=v.createElement(lP,null);class uP 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(Kx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function dP(e){let{routeContext:t,match:n,children:s}=e,a=v.useContext(hu);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 hP(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||$t(!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:k}=n,S=g.route.loader&&b[g.route.id]===void 0&&(!k||k[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 k,S=!1,C=null,j=null;n&&(k=d&&g.route.id?d[g.route.id]:void 0,C=g.route.errorElement||cP,f&&(p<0&&b===0?(vP("route-fallback"),S=!0,j=null):p===b&&(S=!0,j=g.route.hydrateFallbackElement||null)));let A=t.concat(l.slice(0,b+1)),L=()=>{let M;return k?M=C:S?M=j:g.route.Component?M=v.createElement(g.route.Component,null):g.route.element?M=g.route.element:M=y,v.createElement(dP,{match:g,routeContext:{outlet:y,matches:A,isDataRoute:n!=null},children:M})};return n&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?v.createElement(uP,{location:n.location,revalidation:n.revalidation,component:C,error:k,children:L(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):L()},null)}var Yx=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Yx||{}),Xx=(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})(Xx||{});function fP(e){let t=v.useContext(hu);return t||$t(!1),t}function mP(e){let t=v.useContext(Gx);return t||$t(!1),t}function pP(e){let t=v.useContext(Mi);return t||$t(!1),t}function Jx(e){let t=pP(),n=t.matches[t.matches.length-1];return n.route.id||$t(!1),n.route.id}function gP(){var e;let t=v.useContext(Kx),n=mP(Xx.UseRouteError),s=Jx();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function yP(){let{router:e}=fP(Yx.UseNavigateStable),t=Jx(),n=v.useRef(!1);return Qx(()=>{n.current=!0}),v.useCallback(function(a,c){c===void 0&&(c={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Kc({fromRouteId:t},c)))},[e,t])}const Yy={};function vP(e,t,n){Yy[e]||(Yy[e]=!0)}function wP(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 Ja(e){let{to:t,replace:n,state:s,relative:a}=e;Xa()||$t(!1);let{future:c,static:l}=v.useContext(Ya),{matches:d}=v.useContext(Mi),{pathname:f}=ti(),p=qn(),y=sm(t,im(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 wf(e){return oP(e.context)}function bP(e){let{basename:t="/",children:n=null,location:s,navigationType:a=Pn.Pop,navigator:c,static:l=!1,future:d}=e;Xa()&&$t(!1);let f=t.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:f,navigator:c,static:l,future:Kc({v7_relativeSplatPath:!1},d)}),[f,d,c,l]);typeof s=="string"&&(s=ss(s));let{pathname:y="/",search:g="",hash:b="",state:k=null,key:S="default"}=s,C=v.useMemo(()=>{let j=Qa(y,f);return j==null?null:{location:{pathname:j,search:g,hash:b,state:k,key:S},navigationType:a}},[f,y,g,b,k,S,a]);return C==null?null:v.createElement(Ya.Provider,{value:p},v.createElement(cm.Provider,{children:n,value:C}))}new Promise(()=>{});function xP(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 Qc(){return Qc=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},Qc.apply(this,arguments)}function bf(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 kP(e,t){let n=bf(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(c=>{n.append(a,c)})}),n}const SP="6";try{window.__reactRouterVersion=SP}catch{}function CP(e,t){return ON({basename:void 0,future:Qc({},void 0,{v7_prependBasename:!0}),history:aN({window:void 0}),hydrationData:jP(),routes:e,mapRouteProperties:xP,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=Qc({},t,{errors:NP(t.errors)})),t}function NP(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 Gc(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 PP=v.createContext({isTransitioning:!1}),TP=v.createContext(new Map),EP="startTransition",Xy=lj[EP],RP="flushSync",Jy=oN[RP];function MP(e){Xy?Xy(e):e()}function ya(e){Jy?Jy(e):e()}class AP{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 LP(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,k]=v.useState(),[S,C]=v.useState(),j=v.useRef(new Map),{v7_startTransition:A}=s||{},L=v.useCallback(_=>{A?MP(_):_()},[A]),M=v.useCallback((_,D)=>{let{deletedFetchers:P,flushSync:J,viewTransitionOpts:X}=D;_.fetchers.forEach((te,q)=>{te.data!==void 0&&j.current.set(q,te.data)}),P.forEach(te=>j.current.delete(te));let G=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!X||G){J?ya(()=>c(_)):L(()=>c(_));return}if(J){ya(()=>{b&&(y&&y.resolve(),b.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:X.currentLocation,nextLocation:X.nextLocation})});let te=n.window.document.startViewTransition(()=>{ya(()=>c(_))});te.finished.finally(()=>{ya(()=>{g(void 0),k(void 0),d(void 0),p({isTransitioning:!1})})}),ya(()=>k(te));return}b?(y&&y.resolve(),b.skipTransition(),C({state:_,currentLocation:X.currentLocation,nextLocation:X.nextLocation})):(d(_),p({isTransitioning:!0,flushSync:!1,currentLocation:X.currentLocation,nextLocation:X.nextLocation}))},[n.window,b,y,j,L]);v.useLayoutEffect(()=>n.subscribe(M),[n,M]),v.useEffect(()=>{f.isTransitioning&&!f.flushSync&&g(new AP)},[f]),v.useEffect(()=>{if(y&&l&&n.window){let _=l,D=y.promise,P=n.window.document.startViewTransition(async()=>{L(()=>c(_)),await D});P.finished.finally(()=>{g(void 0),k(void 0),d(void 0),p({isTransitioning:!1})}),k(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 z=v.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:_=>n.navigate(_),push:(_,D,P)=>n.navigate(_,{state:D,preventScrollReset:P==null?void 0:P.preventScrollReset}),replace:(_,D,P)=>n.navigate(_,{replace:!0,state:D,preventScrollReset:P==null?void 0:P.preventScrollReset})}),[n]),V=n.basename||"/",F=v.useMemo(()=>({router:n,navigator:z,static:!1,basename:V}),[n,z,V]),I=v.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return v.useEffect(()=>wP(s,n.future),[s,n.future]),v.createElement(v.Fragment,null,v.createElement(hu.Provider,{value:F},v.createElement(Gx.Provider,{value:a},v.createElement(TP.Provider,{value:j.current},v.createElement(PP.Provider,{value:f},v.createElement(bP,{basename:V,location:a.location,navigationType:a.historyAction,navigator:z,future:I},a.initialized||n.future.v7_partialHydration?v.createElement(IP,{routes:n.routes,future:n.future,state:a}):t))))),null)}const IP=v.memo(DP);function DP(e){let{routes:t,future:n,state:s}=e;return aP(t,void 0,s,n)}var Zy;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Zy||(Zy={}));var ev;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ev||(ev={}));function _P(e){let t=v.useRef(bf(e)),n=v.useRef(!1),s=ti(),a=v.useMemo(()=>kP(s.search,n.current?null:t.current),[s.search]),c=qn(),l=v.useCallback((d,f)=>{const p=bf(typeof d=="function"?d(a):d);n.current=!0,c("?"+p,f)},[c,a]);return[a,l]}const FP="modulepreload",OP=function(e){return"/"+e},tv={},Za=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=OP(p),p in tv)return;tv[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":FP,y||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((k,S)=>{b.addEventListener("load",k),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)})},Zx=v.createContext(null),BP=["--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 UP(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 xf(){var e;if(!(typeof document>"u"))for(const t of BP)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function WP(e){if(typeof document>"u")return;if(!e){xf();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 zP(){if(!(typeof window>"u"))return window.innerWidth}function HP({children:e}){const[t,n]=v.useState(()=>zP()),s=v.useMemo(()=>mi({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(()=>{UP(s)},[s]),v.useEffect(()=>()=>{xf()},[]),v.useEffect(()=>{let a=!1,c=null;async function l(){var f,p;const d=await s.bridge.getRuntimeInfo();a||WP(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?(xf(),()=>{a=!0}):(l(),Za(()=>Promise.resolve().then(()=>v_),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(Zx.Provider,{value:s,children:e})}function In(){return v.useContext(Zx)??mi()}const qP={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.",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"}},$P={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:"当前登录态已经清空。",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 操作超时了,先确认仓库状态和网络环境。"}}},VP=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function dm({variant:e="default",className:t}){const n=To(a=>a.profile.language);function s(a){a!==n&&$c({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:VP.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 GP={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:"主题"}},KP={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"}},ek={"zh-CN":$P,"en-US":qP},tk={"zh-CN":GP,"en-US":KP};function Yc(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 QP(){return ei.getState().profile.language??"zh-CN"}function h(e,t){const s=QP()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const a of s){const c=Yc(e,tk[a]);if(c!==e)return ch(c,t);const l=Yc(e,ek[a]);if(l!==e)return ch(l,t)}return ch(e,t)}function ch(e,t){return t?e.replace(/\{([^}]+)\}/g,(n,s)=>{const a=t[s];return a==null?n:String(a)}):e}function YP({children:e,language:t}){return v.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function XP(){const e=To(t=>t.profile.language);return t=>{const n=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const s of n){const a=Yc(t,tk[s]);if(a!==t)return a;const c=Yc(t,ek[s]);if(c!==t)return c}return t}}const nk=[{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 rk(e){return h(e.labelKey)}function JP(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ZP(){return ei.getState().profile.theme??JP()}function eT(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),$c({theme:e}).catch(()=>{}))}function ik(){return{theme:To(t=>t.profile.theme),setTheme:eT}}function tT(){typeof window>"u"||document.documentElement.setAttribute("data-theme",ZP())}function nT({children:e}){const t=To(n=>n.profile.theme);return v.useEffect(()=>{tT()},[t]),i.jsx(i.Fragment,{children:e})}const rT={showToast:()=>"",dismissToast:()=>{}},sk=v.createContext(rT);function iT(){return`toast-${Math.random().toString(36).slice(2,10)}`}function sT({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 oT({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??iT(),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(sk.Provider,{value:c,children:[e,i.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(l=>i.jsx(sT,{toast:l,onDismiss:s},l.id))})]})}function Xn(){return v.useContext(sk)}const Ec="0.1.3",ok=v.createContext(Ec);function aT({children:e}){const t=In(),[n,s]=v.useState(Ec);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||Ec)}),()=>{a=!0}):(s(Ec),()=>{a=!0})},[t]),i.jsx(ok.Provider,{value:n,children:e})}function ak(){return v.useContext(ok)}const lk="codingns.server.base-url.history",ck=6,uk="__custom__";function dk(){return typeof window<"u"&&typeof window.localStorage<"u"}function lT(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function hk(e){if(!e)return null;try{return Ri(e)}catch{return null}}function cT(){if(!dk())return[];const e=window.localStorage.getItem(lk);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(n=>typeof n=="string"?hk(n):null).filter(n=>!!n):[]}catch{return[]}}function uT(e){const t=new Set,n=[];for(const s of e)!s||t.has(s)||(t.add(s),n.push(s));return n}function dT(e){const t=cT();return uT([e,...t,hk(lT())]).slice(0,ck)}function hT(e){dk()&&window.localStorage.setItem(lk,JSON.stringify(e.slice(0,ck)))}class fT{constructor(){He(this,"state",this.createState(An.getState().hostBaseUrl));He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);An.subscribe(()=>{const t=this.createState(An.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!==An.getState().hostBaseUrl;return this.state=this.createState(n),this.emit(),An.update({hostBaseUrl:n}),s}reset(){this.state=this.createState(An.getState().hostBaseUrl),this.emit()}createState(t){const n=dT(t);return hT(n),{baseUrl:t,options:n}}emit(){for(const t of this.listeners)t()}}const Xc=new fT;function Jc(e){return v.useSyncExternalStore(Xc.subscribe,()=>e(Xc.getState()))}function mT(e,t){return t.includes(e)?e:uk}function pT(){return uk}const fk={login(e,t,n){return wn.login(e,t,n)},bootstrap(e,t,n){return wn.bootstrap(e,t,n)},refresh(){return wn.refresh()},logout(){wn.clear()}};function gT(){const e=qn(),t=Jc(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,k]=v.useState(!1);async function S(C){if(C.preventDefault(),a!==l){g("error"),p(h("auth.bootstrapMismatch"));return}k(!0),p(null);try{await fk.bootstrap(n,a),g("success"),p(h("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(j){g("error"),j instanceof tr?p(j.message):p(h("auth.authUnavailable"))}finally{k(!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 yT(e){try{return{...await Fj(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function vT({isOpen:e,onClose:t,onSave:n,theme:s="dark"}){const a=Jc(L=>L.baseUrl),c=Jc(L=>L.options),l=pT(),[d,f]=v.useState(a),[p,y]=v.useState(null),g=v.useMemo(()=>{try{return Ri(d)}catch{return null}},[d]),b=mT(g??d,c),k="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}Xc.setBaseUrl(g),n==null||n(g),t()}function j(L){L.target===L.currentTarget&&t()}function A(){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:k,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverPreset")}),i.jsxs("div",{className:"cyber-select-wrapper",children:[i.jsxs("select",{id:k,"aria-label":h("auth.serverPreset"),className:"cyber-select",value:b,onChange:L=>{const M=L.target.value;M!==l&&(f(M),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:A,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 nv="width=device-width, initial-scale=1.0, viewport-fit=cover",wT="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function bT(){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,k=p.y-g.y,S=Math.sqrt(b*b+k*k);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 xT({text:e}){return i.jsx("span",{className:"glitch-text","data-text":e,children:e})}function kT({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 ST(){const e=qn(),t=XP(),[n]=_P(),s=In(),a=ak(),c=em(s.platform),l=v.useMemo(()=>uj(s),[s]),d=v.useMemo(()=>l?dx():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)??""),[k,S]=v.useState(()=>!!d),C=Jc(E=>E.baseUrl),[j,A]=v.useState(C),[L,M]=v.useState(null),[z,V]=v.useState(!1),[F,I]=v.useState(!1),[_,D]=v.useState(null),P=jx(E=>E.session),J=v.useMemo(()=>n.get("returnTo")??"/",[n]),{theme:X}=ik(),G=v.useRef(!1),te=s.isNativeMobile,q=v.useMemo(()=>X==="light"?"light":"dark",[X]);v.useEffect(()=>{if(typeof document>"u")return;const E=document.querySelector('meta[name="viewport"]');if(!(E instanceof HTMLMetaElement))return;const B=E.getAttribute("content")??nv;return te?E.setAttribute("content",wT):E.setAttribute("content",nv),()=>{E.setAttribute("content",B)}},[te]),v.useEffect(()=>{G.current||(G.current=!0,!(!l||!f||f===C)&&(Xc.setBaseUrl(f),A(f)))},[C,l,f]),v.useEffect(()=>{if(P){e(J,{replace:!0});return}if(!j)return;let E=!1;return yT(j).then(B=>{!E&&B.reachable&&!B.initialized&&e("/bootstrap",{replace:!0})}).catch(()=>{E||M(t("auth.authUnavailable"))}),()=>{E=!0}},[P,e,j,J,t]);async function me(E){E.preventDefault(),V(!0),M(null),A(C),l&&!k&&hj();try{await fk.login(p,g,C),await ei.refreshForAuthenticatedUser(),l&&k&&hx({username:p,password:g,serverBaseUrl:C}),e(J,{replace:!0})}catch(B){if(B instanceof tr){if(B.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}M(B.message)}else M(t("auth.authUnavailable"))}finally{V(!1)}}function ne(E){A(E),M(null)}const K="login-username",ae="login-password";return i.jsxs("main",{className:"cyber-login-page","data-theme":q,"data-native-mobile":te?"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(bT,{})]}),i.jsx("div",{className:"scanlines"}),i.jsxs("div",{className:"cyber-login-container",children:[i.jsx("div",{className:"cyber-login-toolbar",children:i.jsx(dm,{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(xT,{text:"CodingNS"})}),i.jsx("p",{className:"cyber-brand-subtitle",children:i.jsx(kT,{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"})]}),i.jsxs("form",{className:"cyber-form",onSubmit:me,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:K,children:[i.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),i.jsx("input",{id:K,"aria-label":t("auth.username"),className:"cyber-input",value:p,onChange:E=>y(E.target.value),onFocus:()=>D("username"),onBlur:()=>D(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:ae,children:[i.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),i.jsx("input",{id:ae,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:g,onChange:E=>b(E.target.value),onFocus:()=>D("password"),onBlur:()=>D(null),autoComplete:"current-password"})]}),l?i.jsxs("label",{className:"cyber-remember-toggle",children:[i.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:k,onChange:E=>S(E.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 ${z?"loading":""}`,type:"submit",disabled:z,children:[i.jsx("span",{className:"cyber-submit-glow"}),i.jsx("span",{className:"cyber-submit-border"}),i.jsx("span",{className:"cyber-submit-text",children:z?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:()=>I(!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:()=>I(!1),onSave:ne,theme:q}):null]})}const Rc="codingns.file-panel.show-system-files",hm="codingns.notification.preferences",fo={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function fu(){return typeof window<"u"&&typeof window.localStorage<"u"}function rv(){return fu()?window.localStorage.getItem(Rc)==="1":!1}function uh(e){return typeof e=="boolean"}function iv(){if(!fu())return fo;const e=window.localStorage.getItem(hm);if(!e)return fo;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:uh(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:fo.notifyOnPermissionRequest,notifyOnSessionCompleted:uh(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:fo.notifyOnSessionCompleted,notifyOnSessionFailed:uh(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:fo.notifyOnSessionFailed}}catch{return fo}}function sv(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function CT(e){fu()&&window.localStorage.setItem(hm,JSON.stringify(e))}class jT{constructor(){He(this,"state",{showSystemFiles:rv(),notificationPreferences:iv()});He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);He(this,"handleStorage",t=>{if(t.key!==null&&t.key!==Rc&&t.key!==hm)return;const n=rv(),s=iv(),a=this.state.showSystemFiles===n,c=sv(this.state.notificationPreferences,s);a&&c||(this.state={showSystemFiles:n,notificationPreferences:s},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setShowSystemFiles(t){fu()&&(t?window.localStorage.setItem(Rc,"1"):window.localStorage.removeItem(Rc)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const n={...this.state.notificationPreferences,...t};sv(this.state.notificationPreferences,n)||(CT(n),this.state={...this.state,notificationPreferences:n},this.emit())}emit(){for(const t of this.listeners)t()}}const bo=new jT;function Ti(e){return v.useSyncExternalStore(bo.subscribe,()=>e(bo.getState()))}function Br(){return In().haptics}function NT(){return Ke.request("/api/workspaces")}async function PT(){try{return await Ke.request("/api/workbench")}catch(e){if(!(e instanceof tr)||e.status!==404)throw e;const t=await NT();return{items:await Promise.all(t.items.map(async s=>({workspace:s,sessions:(await MT(s.id)).items})))}}}function TT(e){return Ke.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function ET(e){return Ke.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function mk(e){return Ke.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function pk(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),Ke.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function RT(e){return Ke.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function MT(e){return Ke.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function AT(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}`)}function LT(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function IT(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function gk(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function yk(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function DT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function _T(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function vk(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function FT(){return Ke.request("/api/preferences/quick-phrases")}function OT(e){return Ke.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function BT(e,t){const n=new URLSearchParams;return t!=null&&t.trim()&&n.set("workspaceId",t.trim()),Ke.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}function UT(e,t,n,s="forward"){const a=new URLSearchParams;return a.set("limit",String(n)),a.set("direction",s),Ke.request(`/api/sessions/${encodeURIComponent(e)}/messages?${a.toString()}`)}function WT(e,t){return Ke.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function zT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function HT(e){return Ke.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function qT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function $T(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function VT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function GT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function KT(e,t){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function ov(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function QT(e){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function YT(e,t,n){return Ke.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(n)})}function wk({connectionState:e,onReconnect:t}){const{showToast:n,dismissToast:s}=Xn();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 dh(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 XT=new Set(["low","medium","high","xhigh"]),JT={"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 Eo(e){return e?JT[e]??null:null}function ZT(e){return[{id:"provider-default",name:h(e),usesProviderDefault:!0}]}function eE(e){const t=Eo(e);return ZT((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function tE(e){return!!e}function nE(e){const t=Eo(e);return h((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function rE(e){const t=Eo(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:eE(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function iE(e){return(e==null?void 0:e.provider)??"claude-code"}function sE(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=Eo(t))==null?void 0:n.supportsSlashMenuByDefault)??!1}function oE(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=>XT.has(a)))??!1}))}function aE(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 bk(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function lE(e){const t=Eo(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function cE(e,t){var s;return((s=Eo(t??null))==null?void 0:s.foldRulesMessagesByDefault)??!1}function uE(){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 Nr({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:Bn.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(uE,{})})]}),i.jsx("div",{className:"workbench-modal-body",children:c})]})]}),document.body)}const dE="codingns.conversation.composer-draft:",hE=1,fE=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function fm(){return typeof window<"u"&&typeof window.localStorage<"u"}function mE(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 pE(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=>mE(a)).filter(a=>a!==null);return s.length!==n.length||t.length===0&&s.length===0?null:{content:t,attachments:s}}function Ea(e){return`${dE}${e}`}function gE(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 yE(e){if(!fm())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(Ea(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=pE(a);return c||(window.localStorage.removeItem(Ea(t)),null)}catch{return window.localStorage.removeItem(Ea(t)),null}}function vE(e,t){if(!fm())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return xk(n),!0;try{return window.localStorage.setItem(Ea(n),JSON.stringify({schemaVersion:hE,draft:t})),!0}catch{return!1}}function xk(e){if(!fm())return;const t=e.trim();t&&window.localStorage.removeItem(Ea(t))}const wE="provider-default",bE="provider-default",xE="provider-default",av="workbench:focus-composer",kE="provider-default",lv={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function SE(){return[{id:wE,name:h("conversation.modelUseCliDefault"),provider:"claude-code",usesProviderDefault:!0}]}function CE(){return[{id:bE,name:h("conversation.modelUseCliDefault"),provider:"codex",usesProviderDefault:!0}]}function jE(){return[{id:xE,name:h("conversation.modelUseCliDefault"),provider:"opencode",usesProviderDefault:!0}]}function NE(e){return e==="claude-code"?SE():e==="opencode"?jE():CE()}function PE(e){return e.usesProviderDefault===!0||e.id===kE}function TE(){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 EE(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function RE(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 ME(e){const t=RE(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function AE(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function cv(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 LE(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function IE(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 DE(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:TE(),file:a,previewUrl:URL.createObjectURL(a)}))}),s}function kk({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 k=In(),S=v.useId(),C=v.useId(),[j,A]=v.useState(""),[L,M]=v.useState(""),[z,V]=v.useState("medium"),[F,I]=v.useState([]),[_,D]=v.useState(!1),[P,J]=v.useState(fE),[X,G]=v.useState(!1),[te,q]=v.useState(!1),[me,ne]=v.useState(""),[K,ae]=v.useState(!1),[E,B]=v.useState(!1),[re,T]=v.useState(!1),[ke,ge]=v.useState(!1),Ee=v.useRef(null),Be=v.useRef(null),Ye=v.useRef(null),$e=v.useRef(!1),rt=v.useRef(new Set),ft=v.useRef(new Map),St=v.useRef(0),{showToast:Dt}=Xn(),Mt=Br(),tt=iE(e),Lt=To(se=>sh(tt)?se.profile.providers[tt]:null),Tt=(Lt==null?void 0:Lt.defaultModel)??null,Et=(Lt==null?void 0:Lt.defaultReasoningLevel)??null,Ot=v.useMemo(()=>dh(e,"send_message"),[e]),zt=v.useMemo(()=>dh(e,"interrupt"),[e]),_t=v.useMemo(()=>dh(e,"attachments"),[e]),Ze=v.useMemo(()=>{var je;const se=(je=e==null?void 0:e.modelOptions)==null?void 0:je.map(Qe=>{var st;return{...Qe,provider:tt,supportedReasoningEfforts:(st=Qe.supportedReasoningEfforts)==null?void 0:st.filter(O=>O==="low"||O==="medium"||O==="high"||O==="xhigh")}});return se!=null&&se.length?se:NE(tt)},[e==null?void 0:e.modelOptions,tt]),Bt=v.useMemo(()=>Ze.find(se=>se.id===L)??null,[Ze,L]),Ct=oE(e),sn=sE(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")}],[]),ye=v.useMemo(()=>{if(!Ct)return[];const se=Bt==null?void 0:Bt.supportedReasoningEfforts;return!se||se.length===0?ue:ue.filter(je=>se.includes(je.value))},[Ct,ue,Bt==null?void 0:Bt.supportedReasoningEfforts]),Ae=v.useMemo(()=>Ze.map(se=>({value:se.id,label:PE(se)?h("conversation.modelUseCliDefault"):se.name})),[Ze]),_e=v.useMemo(()=>ye.map(se=>({value:se.value,label:se.label})),[ye]),ut=v.useMemo(()=>[{command:"/plan",label:h("conversation.slashCommandPlan")},{command:"/review",label:h("conversation.slashCommandReview")},{command:"/explain",label:h("conversation.slashCommandExplain")}],[]),Ge=(e==null?void 0:e.inRunInputMode)??"none",Jt=a??null,bt=p&&Ge==="streaming_guidance"&&Jt===!1&&!bk(e),mt=p&&Ge==="streaming_guidance"&&!bt,At=p&&typeof g=="function"&&aE(e,Jt),lt=p&&!mt&&!At,Y=j.trim().length>0||F.length>0,Me=c??zt.allowed,xt=p&&Me&&!!y&&!re&&!Y&&!ke&&!f,Vt=!xt&&!Y&&(ke||f||p||!p&&d),Gt=h(ke||f||d?"conversation.sendingState":"conversation.runtimeRunning"),Qt=h(p?At?"conversation.queueGuidanceButton":mt?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),Se=v.useCallback(se=>{M(se),sh(tt)&&$c({providers:{[tt]:{defaultModel:se}}}).catch(()=>{})},[tt]),dt=v.useCallback(se=>{V(se),sh(tt)&&$c({providers:{[tt]:{defaultReasoningLevel:se}}}).catch(()=>{})},[tt]),Ht=v.useCallback(se=>{rt.current.forEach(je=>{URL.revokeObjectURL(je)}),rt.current.clear(),se.forEach(je=>{rt.current.add(je.previewUrl)}),I(se)},[]),Zt=v.useCallback(se=>{const{accepted:je,rejectedCount:Qe}=IE(se);Qe>0&&Dt({title:h("conversation.attachmentImageOnly"),tone:"error"}),je.length!==0&&I(st=>{const O=DE(st,je);return O.forEach(pe=>{rt.current.add(pe.previewUrl)}),O})},[Dt]),cn=v.useCallback(se=>{ft.current.delete(se),I(je=>{const Qe=je.find(st=>st.id===se);return Qe&&(rt.current.delete(Qe.previewUrl),URL.revokeObjectURL(Qe.previewUrl)),je.filter(st=>st.id!==se)})},[]),bn=v.useCallback(se=>{const je=Array.from(se.target.files??[]);je.length>0&&Zt(je),se.target.value=""},[Zt]),xn=v.useCallback(()=>{!_t.allowed||lt||D(!1)},[_t.allowed,lt]),$=v.useCallback(()=>{if(!(!_t.allowed||lt)){if(B(!1),k.isNativeMobile){Mt.trigger("selection"),D(!0);return}EE(Be.current)}},[_t.allowed,Mt,lt,k.isNativeMobile]),ee=v.useCallback(()=>{B(se=>!se)},[]),le=v.useCallback(se=>{var je;A(Qe=>Qe.trimStart().startsWith(se)?Qe:Qe.trim()?`${se} ${Qe.trim()}`:`${se} `),B(!1),(je=Ee.current)==null||je.focus()},[]),be=v.useCallback(async se=>{const je=P;St.current+=1,J(se),ae(!0);try{const Qe=await OT(se.map(st=>({id:st.id,text:st.text})));return J(Qe.items.map(st=>({id:st.id,text:st.text}))),!0}catch(Qe){return J(je),Dt({title:Qe instanceof Error?Qe.message:h("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{ae(!1)}},[P,Dt]),Ce=v.useCallback(async()=>{const se=me.trim();!se||!await be([...P,gE(se)])||(ne(""),q(!1))},[be,me,P]),Fe=v.useCallback(se=>{be(P.filter(je=>je.id!==se))},[be,P]),Xe=v.useCallback((se,je)=>{const Qe=P.findIndex(Ne=>Ne.id===se);if(Qe<0)return;const st=Qe+je;if(st<0||st>=P.length)return;const O=[...P],[pe]=O.splice(Qe,1);O.splice(st,0,pe),be(O)},[be,P]),Ue=v.useCallback(se=>{var je;A(se),G(!1),(je=Ee.current)==null||je.focus()},[]),We=v.useCallback(se=>{const je=se?yE(se):null,Qe=(je==null?void 0:je.attachments.map(st=>ME(st)))??[];ft.current=new Map(((je==null?void 0:je.attachments)??[]).map(st=>[st.id,st])),Ht(Qe),A((je==null?void 0:je.content)??""),B(!1)},[Ht]);v.useEffect(()=>{if(!Ze.length)return;if(Tt&&Ze.some(je=>je.id===Tt)){L!==Tt&&M(Tt);return}if(Ze.some(je=>je.id===L))return;const se=Ze[0].id;M(se)},[Ze,tt,L,Tt]),v.useEffect(()=>{if(!lE(tt)||ye.length===0)return;if(Et&&ye.some(Qe=>Qe.value===Et)){z!==Et&&V(Et);return}const se=e==null?void 0:e.defaultReasoningLevel;if(se&&ye.some(Qe=>Qe.value===se)){z!==se&&V(se);return}if(ye.some(Qe=>Qe.value===z))return;const je=ye[0].value;V(je)},[ye,e==null?void 0:e.defaultReasoningLevel,tt,z,Et]),v.useEffect(()=>{let se=!1;const je=St.current;return FT().then(Qe=>{se||St.current!==je||J(Qe.items.map(st=>({id:st.id,text:st.text})))}).catch(()=>{}),()=>{se=!0}},[]),v.useEffect(()=>{We(t)},[t,We]),v.useEffect(()=>{if(!t)return;const se=t,je=new Set(F.map(O=>O.id));ft.current.forEach((O,pe)=>{je.has(pe)||ft.current.delete(pe)});let Qe=!1;async function st(){if(j.length===0&&F.length===0){xk(se);return}const O=await Promise.all(F.map(async pe=>{const Ne=ft.current.get(pe.id);return Ne&&Ne.fileName===pe.file.name&&Ne.fileSize===pe.file.size&&Ne.lastModified===pe.file.lastModified&&Ne.mimeType===(pe.file.type||"image/png")?Ne:{id:pe.id,fileName:pe.file.name,mimeType:pe.file.type||"image/png",fileSize:pe.file.size,lastModified:pe.file.lastModified,contentBase64:await cv(pe.file)}}));Qe||(ft.current=new Map(O.map(pe=>[pe.id,pe])),vE(se,{content:j,attachments:O}))}return st(),()=>{Qe=!0}},[F,j,t]),v.useEffect(()=>{const se=Ee.current;se&&(se.style.height="0px",se.style.height=`${Math.min(se.scrollHeight,120)}px`)},[j]),v.useEffect(()=>{_t.allowed||(ft.current.clear(),D(!1),Ht([]))},[_t.allowed,Ht]),v.useEffect(()=>{k.isMobile||D(!1)},[k.isMobile]),v.useEffect(()=>()=>{rt.current.forEach(se=>{URL.revokeObjectURL(se)}),rt.current.clear()},[]),v.useEffect(()=>{function se(){var je;(je=Ee.current)==null||je.focus()}return window.addEventListener(av,se),()=>{window.removeEventListener(av,se)}},[]);async function Oe(se){if($e.current)return;const je=j.trim(),Qe=F;if(je.length===0&&Qe.length===0||!Ot.allowed||lt){Dt({title:lt?h("conversation.runtimeRunning"):Ot.reason??h("conversation.capabilityDenied"),tone:"error"});return}$e.current=!0,Mt.trigger(se==="queue"?"selection":"action"),ge(!0),A(""),I([]),D(!1),G(!1),q(!1),B(!1);try{const st=await Promise.all(Qe.map(async Ne=>({fileName:Ne.file.name,mimeType:Ne.file.type||"image/png",fileSize:Ne.file.size,contentBase64:await cv(Ne.file)}))),O=Qe.map(Ne=>AE(Ne.file,Ne.id));await(se==="queue"&&g?g:b)(je,{model:Bt!=null&&Bt.usesProviderDefault?void 0:L||void 0,reasoningLevel:Ct&&ye.length>0?z:void 0,attachments:st,attachmentMeta:O}),LE(Qe),Qe.forEach(Ne=>{rt.current.delete(Ne.previewUrl)})}catch(st){A(je),I(Qe),Dt({title:st instanceof Error&&st.message==="FILE_READ_FAILED"?h("conversation.attachmentReadFailed"):st instanceof Error?st.message:h("conversation.capabilityDenied"),tone:"error"})}finally{ge(!1),$e.current=!1}}async function De(se){se.preventDefault(),await Oe(At?"queue":"send")}async function at(){if(!(!Me||!y||re))try{T(!0),Mt.trigger("action"),await y()}catch(se){Dt({title:se instanceof Error?se.message:h("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{T(!1)}}const ht=ke||f||lt||!Ot.allowed||!Y,en=ke||f||lt||!_t.allowed,Rt=j.length===0&&!lt,ze=i.jsxs("section",{ref:n,className:"composer-panel",children:[i.jsxs("form",{className:"composer-form",onSubmit:De,children:[i.jsx("input",{id:S,ref:Be,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:lv,onChange:bn}),i.jsx("input",{id:C,ref:Ye,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:lv,onChange:bn}),i.jsxs("div",{className:"composer-input-container",children:[F.length>0?i.jsx("div",{className:"composer-attachments",children:F.map(se=>i.jsxs("div",{className:"composer-attachment-card",children:[i.jsx("img",{src:se.previewUrl,alt:h("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),i.jsxs("div",{className:"composer-attachment-meta",children:[i.jsx("span",{className:"attachment-name",title:se.file.name,children:se.file.name}),i.jsxs("span",{className:"attachment-size",children:[(se.file.size/1024).toFixed(1)," KB"]})]}),i.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>cn(se.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"})]})})]},se.id))}):null,i.jsxs("div",{className:"composer-input-wrapper",children:[i.jsx("textarea",{ref:Ee,className:"composer-input",value:j,placeholder:h("conversation.composerPlaceholder"),readOnly:lt,"aria-readonly":lt,onChange:se=>A(se.target.value),rows:1,onFocus:()=>B(!1),onPaste:se=>{if(lt||!_t.allowed)return;const je=Array.from(se.clipboardData.items).filter(Qe=>Qe.kind==="file").map(Qe=>Qe.getAsFile()).filter(Qe=>!!Qe);je.length!==0&&(se.preventDefault(),Zt(je))},onKeyDown:se=>{se.key==="Escape"&&B(!1),se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),ht||De(se))}}),Rt?i.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":h("conversation.quickPhraseTrigger"),title:h("conversation.quickPhraseTrigger"),onClick:()=>{G(!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:ut.map(se=>i.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>le(se.command),children:[i.jsx("span",{className:"composer-slash-command",children:se.command}),i.jsx("span",{className:"composer-slash-label",children:se.label})]},se.command))}):null,i.jsxs("div",{className:"composer-controls",children:[i.jsxs("div",{className:"composer-controls-left",children:[_t.allowed?k.isNativeMobile?i.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),disabled:en,onClick:$,children:i.jsx(hh,{})}):en?i.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),disabled:!0,children:i.jsx(hh,{})}):i.jsx("label",{htmlFor:S,className:"composer-attach-btn","aria-label":h("conversation.attachFiles"),title:h("conversation.attachFiles"),onClick:()=>{B(!1)},children:i.jsx(hh,{})}):null,i.jsx(uv,{ariaLabel:h("conversation.modelSelectorLabel"),value:L,options:Ae,onChange:Se}),Ct&&ye.length>0?i.jsx(uv,{ariaLabel:h("conversation.reasoningSelectorLabel"),value:z,options:_e,onChange:se=>dt(se),compact:!0}):null,sn?i.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:ee,title:h("conversation.slashMenu"),children:[i.jsx("span",{className:"slash-icon",children:"/"}),i.jsx("span",{children:h("conversation.slashMenu")})]}):null,i.jsx(BE,{contextUsage:l})]}),Vt?i.jsx("div",{className:"composer-send-group",children:i.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":Gt,title:Gt,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:xt?i.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{at()},"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:ht,"aria-label":Qt,title:Qt,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(Nr,{open:X,title:h("conversation.quickPhraseModalTitle"),description:h("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{G(!1),q(!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:K,onClick:()=>q(!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((se,je)=>i.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[i.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Ue(se.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:se.text})]}),i.jsxs("div",{className:"composer-quick-phrase-actions",children:[i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:K||je===0,"aria-label":h("conversation.quickPhraseMoveUp"),title:h("conversation.quickPhraseMoveUp"),onClick:()=>Xe(se.id,-1),children:"↑"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:K||je===P.length-1,"aria-label":h("conversation.quickPhraseMoveDown"),title:h("conversation.quickPhraseMoveDown"),onClick:()=>Xe(se.id,1),children:"↓"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:K,"aria-label":h("conversation.quickPhraseDelete"),title:h("conversation.quickPhraseDelete"),onClick:()=>Fe(se.id),children:"×"})]})]},se.id))})]})}),i.jsx(Nr,{open:te,title:h("conversation.quickPhraseCreateModalTitle"),description:h("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>q(!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:me,placeholder:h("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:se=>ne(se.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>q(!1),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:K||me.trim().length===0,onClick:()=>{Ce()},children:h("conversation.quickPhraseCreateAction")})]})]})}),i.jsx(_E,{open:_&&k.isNativeMobile,cameraInputId:C,libraryInputId:S,onClose:()=>D(!1),onSelectCamera:xn,onSelectLibrary:xn})]});return s?Bn.createPortal(ze,s):ze}function _E({open:e,cameraInputId:t,libraryInputId:n,onClose:s,onSelectCamera:a,onSelectLibrary:c}){return!e||typeof document>"u"?null:Bn.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay composer-attachment-sheet-overlay",role:"presentation",onClick:s,children:i.jsxs("div",{className:"mobile-workspace-home-sheet composer-attachment-sheet",role:"dialog","aria-modal":"true","aria-label":h("conversation.attachmentSourceSheetTitle"),onClick:l=>l.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("label",{htmlFor:t,className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":h("conversation.attachmentTakePhoto"),onClick:a,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(FE,{})]}),i.jsxs("label",{htmlFor:n,className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":h("conversation.attachmentChooseFromLibrary"),onClick:c,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(OE,{})]})]})]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:s,children:h("common.cancel")})]})}),document.body)}function FE(){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 hh(){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 OE(){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 uv({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(),k=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(),A=window.innerWidth,L=window.innerHeight,M=12,z=10,V=Math.max(160,A-M*2),F=a?140:220,I=Math.min(V,Math.max(j.width,F)),_=Math.min(Math.max(M,j.left),Math.max(M,A-I-M)),D=j.top-M,P=L-j.bottom-M,J=D>=180||D>=P;g({position:"fixed",left:_,width:I,maxWidth:V,top:J?void 0:j.bottom+z,bottom:J?L-j.top+z:void 0})},[a]);return v.useEffect(()=>{if(!c)return;function C(A){var M,z;const L=A.target;!((M=d.current)!=null&&M.contains(L))&&!((z=p.current)!=null&&z.contains(L))&&l(!1)}function j(A){A.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]),k?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:k.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"?Bn.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 BE({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=UE(p),g=e?WE(e.contextWindowSource):null,b=e?`${h("conversation.contextUsageTitle")} ${f}%`:h("conversation.contextUsageUnavailable"),k=v.useCallback(()=>{const S=s.current;if(!S||typeof window>"u")return;const C=S.getBoundingClientRect(),j=window.innerWidth,A=window.innerHeight,L=12,M=10,z=Math.min(240,Math.max(188,j-L*2)),V=Math.min(Math.max(L,C.left+C.width/2-z/2),Math.max(L,j-z-L)),F=C.top-L,I=A-C.bottom-L,_=F>=140||F>=I;l({position:"fixed",left:V,width:z,maxWidth:j-L*2,top:_?void 0:C.bottom+M,bottom:_?A-C.top+M:void 0})},[]);return v.useEffect(()=>{if(!t)return;function S(j){var L,M;const A=j.target;!((L=s.current)!=null&&L.contains(A))&&!((M=a.current)!=null&&M.contains(A))&&n(!1)}function C(j){j.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",S),window.addEventListener("keydown",C),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),k(),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",C),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[t,k]),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"?Bn.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,"% · ",fh(e.promptTokens)," /"," ",fh(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageCachedTokens").replace("{count}",fh(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 UE(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function WE(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 fh(e){return new Intl.NumberFormat().format(e)}function zE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const HE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$E={};function dv(e,t){return($E.jsx?qE:HE).test(e)}const VE=/[ \t\n\f\r]/g;function GE(e){return typeof e=="object"?e.type==="text"?hv(e.value):!1:hv(e)}function hv(e){return e.replace(VE,"")===""}class el{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}el.prototype.normal={};el.prototype.property={};el.prototype.space=void 0;function Sk(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new el(n,s,t)}function kf(e){return e.toLowerCase()}class pr{constructor(t,n){this.attribute=n,this.property=t}}pr.prototype.attribute="";pr.prototype.booleanish=!1;pr.prototype.boolean=!1;pr.prototype.commaOrSpaceSeparated=!1;pr.prototype.commaSeparated=!1;pr.prototype.defined=!1;pr.prototype.mustUseProperty=!1;pr.prototype.number=!1;pr.prototype.overloadedBoolean=!1;pr.prototype.property="";pr.prototype.spaceSeparated=!1;pr.prototype.space=void 0;let KE=0;const It=Os(),Nn=Os(),Sf=Os(),Le=Os(),dn=Os(),So=Os(),kr=Os();function Os(){return 2**++KE}const Cf=Object.freeze(Object.defineProperty({__proto__:null,boolean:It,booleanish:Nn,commaOrSpaceSeparated:kr,commaSeparated:So,number:Le,overloadedBoolean:Sf,spaceSeparated:dn},Symbol.toStringTag,{value:"Module"})),mh=Object.keys(Cf);class mm extends pr{constructor(t,n,s,a){let c=-1;if(super(t,n),fv(this,"space",a),typeof s=="number")for(;++c<mh.length;){const l=mh[c];fv(this,mh[c],(s&Cf[l])===Cf[l])}}}mm.prototype.defined=!0;function fv(e,t,n){n&&(e[t]=n)}function Ro(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const c=new mm(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[kf(s)]=s,n[kf(c.attribute)]=s}return new el(t,n,e.space)}const Ck=Ro({properties:{ariaActiveDescendant:null,ariaAtomic:Nn,ariaAutoComplete:null,ariaBusy:Nn,ariaChecked:Nn,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:dn,ariaCurrent:null,ariaDescribedBy:dn,ariaDetails:null,ariaDisabled:Nn,ariaDropEffect:dn,ariaErrorMessage:null,ariaExpanded:Nn,ariaFlowTo:dn,ariaGrabbed:Nn,ariaHasPopup:null,ariaHidden:Nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dn,ariaLevel:Le,ariaLive:null,ariaModal:Nn,ariaMultiLine:Nn,ariaMultiSelectable:Nn,ariaOrientation:null,ariaOwns:dn,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:Nn,ariaReadOnly:Nn,ariaRelevant:null,ariaRequired:Nn,ariaRoleDescription:dn,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:Nn,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function jk(e,t){return t in e?e[t]:t}function Nk(e,t){return jk(e,t.toLowerCase())}const QE=Ro({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:So,acceptCharset:dn,accessKey:dn,action:null,allow:null,allowFullScreen:It,allowPaymentRequest:It,allowUserMedia:It,alt:null,as:null,async:It,autoCapitalize:null,autoComplete:dn,autoFocus:It,autoPlay:It,blocking:dn,capture:null,charSet:null,checked:It,cite:null,className:dn,cols:Le,colSpan:null,content:null,contentEditable:Nn,controls:It,controlsList:dn,coords:Le|So,crossOrigin:null,data:null,dateTime:null,decoding:null,default:It,defer:It,dir:null,dirName:null,disabled:It,download:Sf,draggable:Nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:It,formTarget:null,headers:dn,height:Le,hidden:Sf,high:Le,href:null,hrefLang:null,htmlFor:dn,httpEquiv:dn,id:null,imageSizes:null,imageSrcSet:null,inert:It,inputMode:null,integrity:null,is:null,isMap:It,itemId:null,itemProp:dn,itemRef:dn,itemScope:It,itemType:dn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:It,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:It,muted:It,name:null,nonce:null,noModule:It,noValidate:It,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:It,optimum:Le,pattern:null,ping:dn,placeholder:null,playsInline:It,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:It,referrerPolicy:null,rel:dn,required:It,reversed:It,rows:Le,rowSpan:Le,sandbox:dn,scope:null,scoped:It,seamless:It,selected:It,shadowRootClonable:It,shadowRootDelegatesFocus:It,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:Nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:It,useMap:null,value:Nn,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dn,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:It,declare:It,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:It,noHref:It,noShade:It,noWrap:It,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:Nn,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:It,disableRemotePlayback:It,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:Nk}),YE=Ro({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:kr,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:dn,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:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:It,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,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:So,g2:So,glyphName:So,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:kr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,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:Le,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:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kr,rev:kr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kr,requiredFeatures:kr,requiredFonts:kr,requiredFormats:kr,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:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:kr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kr,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:jk}),Pk=Ro({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()}}),Tk=Ro({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nk}),Ek=Ro({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),XE={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"},JE=/[A-Z]/g,mv=/-[a-z]/g,ZE=/^data[-\w.:]+$/i;function eR(e,t){const n=kf(t);let s=t,a=pr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZE.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(mv,nR);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!mv.test(c)){let l=c.replace(JE,tR);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=mm}return new a(s,t)}function tR(e){return"-"+e.toLowerCase()}function nR(e){return e.charAt(1).toUpperCase()}const rR=Sk([Ck,QE,Pk,Tk,Ek],"html"),pm=Sk([Ck,YE,Pk,Tk,Ek],"svg");function iR(e){return e.join(" ").trim()}var mo={},ph,pv;function sR(){if(pv)return ph;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",k="declaration";function S(j,A){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];A=A||{};var L=1,M=1;function z(te){var q=te.match(t);q&&(L+=q.length);var me=te.lastIndexOf(f);M=~me?te.length-me:M+te.length}function V(){var te={line:L,column:M};return function(q){return q.position=new F(te),D(),q}}function F(te){this.start=te,this.end={line:L,column:M},this.source=A.source}F.prototype.content=j;function I(te){var q=new Error(A.source+":"+L+":"+M+": "+te);if(q.reason=te,q.filename=A.source,q.line=L,q.column=M,q.source=j,!A.silent)throw q}function _(te){var q=te.exec(j);if(q){var me=q[0];return z(me),j=j.slice(me.length),q}}function D(){_(n)}function P(te){var q;for(te=te||[];q=J();)q!==!1&&te.push(q);return te}function J(){var te=V();if(!(p!=j.charAt(0)||y!=j.charAt(1))){for(var q=2;g!=j.charAt(q)&&(y!=j.charAt(q)||p!=j.charAt(q+1));)++q;if(q+=2,g===j.charAt(q-1))return I("End of comment missing");var me=j.slice(2,q-2);return M+=2,z(me),j=j.slice(q),M+=2,te({type:b,comment:me})}}function X(){var te=V(),q=_(s);if(q){if(J(),!_(a))return I("property missing ':'");var me=_(c),ne=te({type:k,property:C(q[0].replace(e,g)),value:me?C(me[0].replace(e,g)):g});return _(l),ne}}function G(){var te=[];P(te);for(var q;q=X();)q!==!1&&(te.push(q),P(te));return te}return D(),G()}function C(j){return j?j.replace(d,g):g}return ph=S,ph}var gv;function oR(){if(gv)return mo;gv=1;var e=mo&&mo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(mo,"__esModule",{value:!0}),mo.default=n;const t=e(sR());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 mo}var va={},yv;function aR(){if(yv)return va;yv=1,Object.defineProperty(va,"__esModule",{value:!0}),va.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 va.camelCase=f,va}var wa,vv;function lR(){if(vv)return wa;vv=1;var e=wa&&wa.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(oR()),n=aR();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,wa=s,wa}var cR=lR();const uR=Va(cR),Rk=Mk("end"),gm=Mk("start");function Mk(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 dR(e){const t=gm(e),n=Rk(e);if(t&&n)return{start:t,end:n}}function Ra(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wv(e.position):"start"in e||"end"in e?wv(e):"line"in e||"column"in e?jf(e):""}function jf(e){return bv(e&&e.line)+":"+bv(e&&e.column)}function wv(e){return jf(e&&e.start)+"-"+jf(e&&e.end)}function bv(e){return e&&typeof e=="number"?e:1}class Jn 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=Ra(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}}Jn.prototype.file="";Jn.prototype.name="";Jn.prototype.reason="";Jn.prototype.message="";Jn.prototype.stack="";Jn.prototype.column=void 0;Jn.prototype.line=void 0;Jn.prototype.ancestors=void 0;Jn.prototype.cause=void 0;Jn.prototype.fatal=void 0;Jn.prototype.place=void 0;Jn.prototype.ruleId=void 0;Jn.prototype.source=void 0;const ym={}.hasOwnProperty,hR=new Map,fR=/[A-Z]/g,mR=new Set(["table","tbody","thead","tfoot","tr"]),pR=new Set(["td","th"]),Ak="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gR(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=CR(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=SR(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"?pm:rR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Lk(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Lk(e,t,n){if(t.type==="element")return yR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bR(e,t,n);if(t.type==="mdxjsEsm")return wR(e,t);if(t.type==="root")return xR(e,t,n);if(t.type==="text")return kR(e,t)}function yR(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=pm,e.schema=a),e.ancestors.push(t);const c=Dk(e,t.tagName,!1),l=jR(e,t);let d=wm(e,t);return mR.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!GE(f):!0})),Ik(e,l,c,t),vm(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function vR(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)}Ba(e,t.position)}function wR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ba(e,t.position)}function bR(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=pm,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Dk(e,t.name,!0),l=NR(e,t),d=wm(e,t);return Ik(e,l,c,t),vm(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function xR(e,t,n){const s={};return vm(s,wm(e,t)),e.create(t,e.Fragment,s,n)}function kR(e,t){return t.value}function Ik(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function vm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function SR(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 CR(e,t){return n;function n(s,a,c,l){const d=Array.isArray(c.children),f=gm(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 jR(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&ym.call(t.properties,a)){const c=PR(e,a,t.properties[a]);if(c){const[l,d]=c;e.tableCellAlignToStyle&&l==="align"&&typeof d=="string"&&pR.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 NR(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 Ba(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 Ba(e,t.position);else c=s.value===null?!0:s.value;n[a]=c}return n}function wm(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:hR;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=Lk(e,c,l);d!==void 0&&n.push(d)}return n}function PR(e,t,n){const s=eR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?zE(n):iR(n)),s.property==="style"){let a=typeof n=="object"?n:TR(e,String(n));return e.stylePropertyNameCase==="css"&&(a=ER(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?XE[s.property]||s.property:s.attribute,n]}}function TR(e,t){try{return uR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Jn("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=Ak+"#cannot-parse-style-attribute",a}}function Dk(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=dv(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=dv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return ym.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ba(e)}function Ba(e,t){const n=new Jn("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=Ak+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ER(e){const t={};let n;for(n in e)ym.call(e,n)&&(t[RR(n)]=e[n]);return t}function RR(e){let t=e.replace(fR,MR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function MR(e){return"-"+e.toLowerCase()}const gh={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"]},AR={};function bm(e,t){const n=AR,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _k(e,s,a)}function _k(e,t,n){if(LR(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 xv(e.children,t,n)}return Array.isArray(e)?xv(e,t,n):""}function xv(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=_k(e[a],t,n);return s.join("")}function LR(e){return!!(e&&typeof e=="object")}const kv=document.createElement("i");function xm(e){const t="&"+e+";";kv.innerHTML=t;const n=kv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Tr(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 Fr(e,t){return e.length>0?(Tr(e,e.length,0,t),e):t}const Sv={}.hasOwnProperty;function Fk(e){const t={};let n=-1;for(;++n<e.length;)IR(t,e[n]);return t}function IR(e,t){let n;for(n in t){const a=(Sv.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let l;if(c)for(l in c){Sv.call(a,l)||(a[l]=[]);const d=c[l];DR(a[l],Array.isArray(d)?d:d?[d]:[])}}}function DR(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Tr(e,0,0,s)}function Ok(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 Zr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const nr=os(/[A-Za-z]/),Qn=os(/[\dA-Za-z]/),_R=os(/[#-'*+\--9=?A-Z^-~]/);function Zc(e){return e!==null&&(e<32||e===127)}const Nf=os(/\d/),FR=os(/[\dA-Fa-f]/),OR=os(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function ln(e){return e!==null&&(e<0||e===32)}function Wt(e){return e===-2||e===-1||e===32}const mu=os(new RegExp("\\p{P}|\\p{S}","u")),Ds=os(/\s/);function os(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mo(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let l="";if(c===37&&Qn(e.charCodeAt(n+1))&&Qn(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 Kt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let c=0;return l;function l(f){return Wt(f)?(e.enter(n),d(f)):t(f)}function d(f){return Wt(f)&&c++<a?(e.consume(f),d):(e.exit(n),t(f))}}const BR={tokenize:UR};function UR(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"),Kt(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 wt(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),l)}}const WR={tokenize:zR},Cv={tokenize:HR};function zR(e){const t=this,n=[];let s=0,a,c,l;return d;function d(M){if(s<n.length){const z=n[s];return t.containerState=z[1],e.attempt(z[0].continuation,f,p)(M)}return p(M)}function f(M){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&L();const z=t.events.length;let V=z,F;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){F=t.events[V][1].end;break}A(s);let I=z;for(;I<t.events.length;)t.events[I][1].end={...F},I++;return Tr(t.events,V+1,0,t.events.slice(z)),t.events.length=I,p(M)}return d(M)}function p(M){if(s===n.length){if(!a)return b(M);if(a.currentConstruct&&a.currentConstruct.concrete)return S(M);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Cv,y,g)(M)}function y(M){return a&&L(),A(s),b(M)}function g(M){return t.parser.lazy[t.now().line]=s!==n.length,l=t.now().offset,S(M)}function b(M){return t.containerState={},e.attempt(Cv,k,S)(M)}function k(M){return s++,n.push([t.currentConstruct,t.containerState]),b(M)}function S(M){if(M===null){a&&L(),A(0),e.consume(M);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),C(M)}function C(M){if(M===null){j(e.exit("chunkFlow"),!0),A(0),e.consume(M);return}return wt(M)?(e.consume(M),j(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(M),C)}function j(M,z){const V=t.sliceStream(M);if(z&&V.push(null),M.previous=c,c&&(c.next=M),c=M,a.defineSkip(M.start),a.write(V),t.parser.lazy[M.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 I=t.events.length;let _=I,D,P;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(D){P=t.events[_][1].end;break}D=!0}for(A(s),F=I;F<t.events.length;)t.events[F][1].end={...P},F++;Tr(t.events,_+1,0,t.events.slice(I)),t.events.length=F}}function A(M){let z=n.length;for(;z-- >M;){const V=n[z];t.containerState=V[1],V[0].exit.call(t,e)}n.length=M}function L(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function HR(e,t,n){return Kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function No(e){if(e===null||ln(e)||Ds(e))return 1;if(mu(e))return 2}function pu(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 Pf={name:"attention",resolveAll:qR,tokenize:$R};function qR(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};jv(g,-f),jv(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=Fr(p,[["enter",e[s][1],t],["exit",e[s][1],t]])),p=Fr(p,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",c,t]]),p=Fr(p,pu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),p=Fr(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=Fr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,Tr(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 $R(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=No(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=No(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 jv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const VR={name:"autolink",tokenize:GR};function GR(e,t,n){let s=0;return a;function a(k){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(k){return nr(k)?(e.consume(k),l):k===64?n(k):p(k)}function l(k){return k===43||k===45||k===46||Qn(k)?(s=1,d(k)):p(k)}function d(k){return k===58?(e.consume(k),s=0,f):(k===43||k===45||k===46||Qn(k))&&s++<32?(e.consume(k),d):(s=0,p(k))}function f(k){return k===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.exit("autolink"),t):k===null||k===32||k===60||Zc(k)?n(k):(e.consume(k),f)}function p(k){return k===64?(e.consume(k),y):_R(k)?(e.consume(k),p):n(k)}function y(k){return Qn(k)?g(k):n(k)}function g(k){return k===46?(e.consume(k),s=0,y):k===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.exit("autolink"),t):b(k)}function b(k){if((k===45||Qn(k))&&s++<63){const S=k===45?b:g;return e.consume(k),S}return n(k)}}const tl={partial:!0,tokenize:KR};function KR(e,t,n){return s;function s(c){return Wt(c)?Kt(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||wt(c)?t(c):n(c)}}const Bk={continuation:{tokenize:YR},exit:XR,name:"blockQuote",tokenize:QR};function QR(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 Wt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function YR(e,t,n){const s=this;return a;function a(l){return Wt(l)?Kt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):c(l)}function c(l){return e.attempt(Bk,t,n)(l)}}function XR(e){e.exit("blockQuote")}const Uk={name:"characterEscape",tokenize:JR};function JR(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 OR(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Wk={name:"characterReference",tokenize:ZR};function ZR(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=Qn,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=FR,y):(e.enter("characterReferenceValue"),c=7,l=Nf,y(g))}function y(g){if(g===59&&a){const b=e.exit("characterReferenceValue");return l===Qn&&!xm(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 Nv={partial:!0,tokenize:tM},Pv={concrete:!0,name:"codeFenced",tokenize:eM};function eM(e,t,n){const s=this,a={partial:!0,tokenize:V};let c=0,l=0,d;return f;function f(F){return p(F)}function p(F){const I=s.events[s.events.length-1];return c=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[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"),Wt(F)?Kt(e,g,"whitespace")(F):g(F))}function g(F){return F===null||wt(F)?(e.exit("codeFencedFence"),s.interrupt?t(F):e.check(Nv,C,z)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(F))}function b(F){return F===null||wt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(F)):Wt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Kt(e,k,"whitespace")(F)):F===96&&F===d?n(F):(e.consume(F),b)}function k(F){return F===null||wt(F)?g(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(F))}function S(F){return F===null||wt(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,z,j)(F)}function j(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),A}function A(F){return c>0&&Wt(F)?Kt(e,L,"linePrefix",c+1)(F):L(F)}function L(F){return F===null||wt(F)?e.check(Nv,C,z)(F):(e.enter("codeFlowValue"),M(F))}function M(F){return F===null||wt(F)?(e.exit("codeFlowValue"),L(F)):(e.consume(F),M)}function z(F){return e.exit("codeFenced"),t(F)}function V(F,I,_){let D=0;return P;function P(q){return F.enter("lineEnding"),F.consume(q),F.exit("lineEnding"),J}function J(q){return F.enter("codeFencedFence"),Wt(q)?Kt(F,X,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):X(q)}function X(q){return q===d?(F.enter("codeFencedFenceSequence"),G(q)):_(q)}function G(q){return q===d?(D++,F.consume(q),G):D>=l?(F.exit("codeFencedFenceSequence"),Wt(q)?Kt(F,te,"whitespace")(q):te(q)):_(q)}function te(q){return q===null||wt(q)?(F.exit("codeFencedFence"),I(q)):_(q)}}}function tM(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 yh={name:"codeIndented",tokenize:rM},nM={partial:!0,tokenize:iM};function rM(e,t,n){const s=this;return a;function a(p){return e.enter("codeIndented"),Kt(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):wt(p)?e.attempt(nM,l,f)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||wt(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),d)}function f(p){return e.exit("codeIndented"),t(p)}}function iM(e,t,n){const s=this;return a;function a(l){return s.parser.lazy[s.now().line]?n(l):wt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):Kt(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):wt(l)?a(l):n(l)}}const sM={name:"codeText",previous:aM,resolve:oM,tokenize:lM};function oM(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 aM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lM(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)):wt(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||wt(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 cM{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&&ba(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),ba(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ba(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);ba(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ba(this.left,n.reverse())}}}function ba(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 zk(e){const t={};let n=-1,s,a,c,l,d,f,p;const y=new cM(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,uM(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 Tr(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!p}function uM(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,k=n,S=0,C=0;const j=[C];for(;k;){for(;e.get(++a)[1]!==k;);c.push(a),k._tokenizer||(y=s.sliceStream(k),k.next||y.push(null),g&&l.defineSkip(k.start),k._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(y),k._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=k,k=k.next}for(k=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),k._tokenizer=void 0,k.previous=void 0,k=k.next);for(l.events=[],k?(k._tokenizer=void 0,k.previous=void 0):j.pop(),b=j.length;b--;){const A=d.slice(j[b],j[b+1]),L=c.pop();f.push([L,L+A.length-1]),e.splice(L,2,A)}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 dM={resolve:fM,tokenize:mM},hM={partial:!0,tokenize:pM};function fM(e){return zk(e),e}function mM(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):wt(d)?e.check(hM,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 pM(e,t,n){const s=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Kt(e,c,"linePrefix")}function c(l){if(l===null||wt(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 Hk(e,t,n,s,a,c,l,d,f){const p=f||Number.POSITIVE_INFINITY;let y=0;return g;function g(A){return A===60?(e.enter(s),e.enter(a),e.enter(c),e.consume(A),e.exit(c),b):A===null||A===32||A===41||Zc(A)?n(A):(e.enter(s),e.enter(l),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(A))}function b(A){return A===62?(e.enter(c),e.consume(A),e.exit(c),e.exit(a),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),k(A))}function k(A){return A===62?(e.exit("chunkString"),e.exit(d),b(A)):A===null||A===60||wt(A)?n(A):(e.consume(A),A===92?S:k)}function S(A){return A===60||A===62||A===92?(e.consume(A),k):k(A)}function C(A){return!y&&(A===null||A===41||ln(A))?(e.exit("chunkString"),e.exit(d),e.exit(l),e.exit(s),t(A)):y<p&&A===40?(e.consume(A),y++,C):A===41?(e.consume(A),y--,C):A===null||A===32||A===40||Zc(A)?n(A):(e.consume(A),A===92?j:C)}function j(A){return A===40||A===41||A===92?(e.consume(A),C):C(A)}}function qk(e,t,n,s,a,c){const l=this;let d=0,f;return p;function p(k){return e.enter(s),e.enter(a),e.consume(k),e.exit(a),e.enter(c),y}function y(k){return d>999||k===null||k===91||k===93&&!f||k===94&&!d&&"_hiddenFootnoteSupport"in l.parser.constructs?n(k):k===93?(e.exit(c),e.enter(a),e.consume(k),e.exit(a),e.exit(s),t):wt(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||k===91||k===93||wt(k)||d++>999?(e.exit("chunkString"),y(k)):(e.consume(k),f||(f=!Wt(k)),k===92?b:g)}function b(k){return k===91||k===92||k===93?(e.consume(k),d++,g):g(k)}}function $k(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):wt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Kt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===l||b===null||wt(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 Ma(e,t){let n;return s;function s(a){return wt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Wt(a)?Kt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const gM={name:"definition",tokenize:vM},yM={partial:!0,tokenize:wM};function vM(e,t,n){const s=this;let a;return c;function c(k){return e.enter("definition"),l(k)}function l(k){return qk.call(s,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(k)}function d(k){return a=Zr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),f):n(k)}function f(k){return ln(k)?Ma(e,p)(k):p(k)}function p(k){return Hk(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(k)}function y(k){return e.attempt(yM,g,g)(k)}function g(k){return Wt(k)?Kt(e,b,"whitespace")(k):b(k)}function b(k){return k===null||wt(k)?(e.exit("definition"),s.parser.defined.push(a),t(k)):n(k)}}function wM(e,t,n){return s;function s(d){return ln(d)?Ma(e,a)(d):n(d)}function a(d){return $k(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Wt(d)?Kt(e,l,"whitespace")(d):l(d)}function l(d){return d===null||wt(d)?t(d):n(d)}}const bM={name:"hardBreakEscape",tokenize:xM};function xM(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return wt(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const kM={name:"headingAtx",resolve:SM,tokenize:CM};function SM(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"},Tr(e,s,n-s+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function CM(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||ln(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),f(y)):y===null||wt(y)?(e.exit("atxHeading"),t(y)):Wt(y)?Kt(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||ln(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),p)}}const jM=["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"],Tv=["pre","script","style","textarea"],NM={concrete:!0,name:"htmlFlow",resolveTo:EM,tokenize:RM},PM={partial:!0,tokenize:AM},TM={partial:!0,tokenize:MM};function EM(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 RM(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):nr(T)?(e.consume(T),l=String.fromCharCode(T),j):n(T)}function b(T){return T===45?(e.consume(T),a=2,k):T===91?(e.consume(T),a=5,d=0,S):nr(T)?(e.consume(T),a=4,s.interrupt?t:E):n(T)}function k(T){return T===45?(e.consume(T),s.interrupt?t:E):n(T)}function S(T){const ke="CDATA[";return T===ke.charCodeAt(d++)?(e.consume(T),d===ke.length?s.interrupt?t:X:S):n(T)}function C(T){return nr(T)?(e.consume(T),l=String.fromCharCode(T),j):n(T)}function j(T){if(T===null||T===47||T===62||ln(T)){const ke=T===47,ge=l.toLowerCase();return!ke&&!c&&Tv.includes(ge)?(a=1,s.interrupt?t(T):X(T)):jM.includes(l.toLowerCase())?(a=6,ke?(e.consume(T),A):s.interrupt?t(T):X(T)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(T):c?L(T):M(T))}return T===45||Qn(T)?(e.consume(T),l+=String.fromCharCode(T),j):n(T)}function A(T){return T===62?(e.consume(T),s.interrupt?t:X):n(T)}function L(T){return Wt(T)?(e.consume(T),L):P(T)}function M(T){return T===47?(e.consume(T),P):T===58||T===95||nr(T)?(e.consume(T),z):Wt(T)?(e.consume(T),M):P(T)}function z(T){return T===45||T===46||T===58||T===95||Qn(T)?(e.consume(T),z):V(T)}function V(T){return T===61?(e.consume(T),F):Wt(T)?(e.consume(T),V):M(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,I):Wt(T)?(e.consume(T),F):_(T)}function I(T){return T===f?(e.consume(T),f=null,D):T===null||wt(T)?n(T):(e.consume(T),I)}function _(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||ln(T)?V(T):(e.consume(T),_)}function D(T){return T===47||T===62||Wt(T)?M(T):n(T)}function P(T){return T===62?(e.consume(T),J):n(T)}function J(T){return T===null||wt(T)?X(T):Wt(T)?(e.consume(T),J):n(T)}function X(T){return T===45&&a===2?(e.consume(T),me):T===60&&a===1?(e.consume(T),ne):T===62&&a===4?(e.consume(T),B):T===63&&a===3?(e.consume(T),E):T===93&&a===5?(e.consume(T),ae):wt(T)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(PM,re,G)(T)):T===null||wt(T)?(e.exit("htmlFlowData"),G(T)):(e.consume(T),X)}function G(T){return e.check(TM,te,re)(T)}function te(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),q}function q(T){return T===null||wt(T)?G(T):(e.enter("htmlFlowData"),X(T))}function me(T){return T===45?(e.consume(T),E):X(T)}function ne(T){return T===47?(e.consume(T),l="",K):X(T)}function K(T){if(T===62){const ke=l.toLowerCase();return Tv.includes(ke)?(e.consume(T),B):X(T)}return nr(T)&&l.length<8?(e.consume(T),l+=String.fromCharCode(T),K):X(T)}function ae(T){return T===93?(e.consume(T),E):X(T)}function E(T){return T===62?(e.consume(T),B):T===45&&a===2?(e.consume(T),E):X(T)}function B(T){return T===null||wt(T)?(e.exit("htmlFlowData"),re(T)):(e.consume(T),B)}function re(T){return e.exit("htmlFlow"),t(T)}}function MM(e,t,n){const s=this;return a;function a(l){return wt(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 AM(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(tl,t,n)}}const LM={name:"htmlText",tokenize:IM};function IM(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),V):E===63?(e.consume(E),M):nr(E)?(e.consume(E),_):n(E)}function p(E){return E===45?(e.consume(E),y):E===91?(e.consume(E),c=0,S):nr(E)?(e.consume(E),L):n(E)}function y(E){return E===45?(e.consume(E),k):n(E)}function g(E){return E===null?n(E):E===45?(e.consume(E),b):wt(E)?(l=g,ne(E)):(e.consume(E),g)}function b(E){return E===45?(e.consume(E),k):g(E)}function k(E){return E===62?me(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):wt(E)?(l=C,ne(E)):(e.consume(E),C)}function j(E){return E===93?(e.consume(E),A):C(E)}function A(E){return E===62?me(E):E===93?(e.consume(E),A):C(E)}function L(E){return E===null||E===62?me(E):wt(E)?(l=L,ne(E)):(e.consume(E),L)}function M(E){return E===null?n(E):E===63?(e.consume(E),z):wt(E)?(l=M,ne(E)):(e.consume(E),M)}function z(E){return E===62?me(E):M(E)}function V(E){return nr(E)?(e.consume(E),F):n(E)}function F(E){return E===45||Qn(E)?(e.consume(E),F):I(E)}function I(E){return wt(E)?(l=I,ne(E)):Wt(E)?(e.consume(E),I):me(E)}function _(E){return E===45||Qn(E)?(e.consume(E),_):E===47||E===62||ln(E)?D(E):n(E)}function D(E){return E===47?(e.consume(E),me):E===58||E===95||nr(E)?(e.consume(E),P):wt(E)?(l=D,ne(E)):Wt(E)?(e.consume(E),D):me(E)}function P(E){return E===45||E===46||E===58||E===95||Qn(E)?(e.consume(E),P):J(E)}function J(E){return E===61?(e.consume(E),X):wt(E)?(l=J,ne(E)):Wt(E)?(e.consume(E),J):D(E)}function X(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,G):wt(E)?(l=X,ne(E)):Wt(E)?(e.consume(E),X):(e.consume(E),te)}function G(E){return E===a?(e.consume(E),a=void 0,q):E===null?n(E):wt(E)?(l=G,ne(E)):(e.consume(E),G)}function te(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||ln(E)?D(E):(e.consume(E),te)}function q(E){return E===47||E===62||ln(E)?D(E):n(E)}function me(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function ne(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),K}function K(E){return Wt(E)?Kt(e,ae,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ae(E)}function ae(E){return e.enter("htmlTextData"),l(E)}}const km={name:"labelEnd",resolveAll:OM,resolveTo:BM,tokenize:UM},DM={tokenize:WM},_M={tokenize:zM},FM={tokenize:HM};function OM(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&&Tr(e,0,e.length,n),e}function BM(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=Fr(d,e.slice(c+1,c+s+3)),d=Fr(d,[["enter",y,t]]),d=Fr(d,pu(t.parser.constructs.insideSpan.null,e.slice(c+s+4,l-3),t)),d=Fr(d,[["exit",y,t],e[l-2],e[l-1],["exit",p,t]]),d=Fr(d,e.slice(l+1)),d=Fr(d,[["exit",f,t]]),Tr(e,c,e.length,d),e}function UM(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(Zr(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(DM,y,l?y:g)(b):b===91?e.attempt(_M,y,l?p:g)(b):l?y(b):g(b)}function p(b){return e.attempt(FM,y,g)(b)}function y(b){return t(b)}function g(b){return c._balanced=!0,n(b)}}function WM(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 ln(g)?Ma(e,c)(g):c(g)}function c(g){return g===41?y(g):Hk(e,l,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return ln(g)?Ma(e,f)(g):y(g)}function d(g){return n(g)}function f(g){return g===34||g===39||g===40?$k(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function p(g){return ln(g)?Ma(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 zM(e,t,n){const s=this;return a;function a(d){return qk.call(s,e,c,l,"reference","referenceMarker","referenceString")(d)}function c(d){return s.parser.defined.includes(Zr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function l(d){return n(d)}}function HM(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 qM={name:"labelStartImage",resolveAll:km.resolveAll,tokenize:$M};function $M(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 VM={name:"labelStartLink",resolveAll:km.resolveAll,tokenize:GM};function GM(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 vh={name:"lineEnding",tokenize:KM};function KM(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Kt(e,t,"linePrefix")}}const Mc={name:"thematicBreak",tokenize:QM};function QM(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||wt(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),s++,f):(e.exit("thematicBreakSequence"),Wt(p)?Kt(e,d,"whitespace")(p):d(p))}}const hr={continuation:{tokenize:ZM},exit:tA,name:"list",tokenize:JM},YM={partial:!0,tokenize:nA},XM={partial:!0,tokenize:eA};function JM(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(k){const S=s.containerState.type||(k===42||k===43||k===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||k===s.containerState.marker:Nf(k)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),k===42||k===45?e.check(Mc,n,p)(k):p(k);if(!s.interrupt||k===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(k)}return n(k)}function f(k){return Nf(k)&&++l<10?(e.consume(k),f):(!s.interrupt||l<2)&&(s.containerState.marker?k===s.containerState.marker:k===41||k===46)?(e.exit("listItemValue"),p(k)):n(k)}function p(k){return e.enter("listItemMarker"),e.consume(k),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||k,e.check(tl,s.interrupt?n:y,e.attempt(YM,b,g))}function y(k){return s.containerState.initialBlankLine=!0,c++,b(k)}function g(k){return Wt(k)?(e.enter("listItemPrefixWhitespace"),e.consume(k),e.exit("listItemPrefixWhitespace"),b):n(k)}function b(k){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(k)}}function ZM(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(tl,a,c);function a(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Kt(e,t,"listItemIndent",s.containerState.size+1)(d)}function c(d){return s.containerState.furtherBlankLines||!Wt(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(XM,t,l)(d))}function l(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,Kt(e,e.attempt(hr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function eA(e,t,n){const s=this;return Kt(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 tA(e){e.exit(this.containerState.type)}function nA(e,t,n){const s=this;return Kt(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!Wt(c)&&l&&l[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Ev={name:"setextUnderline",resolveTo:rA,tokenize:iA};function rA(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 iA(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"),Wt(p)?Kt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||wt(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const sA={tokenize:oA};function oA(e){const t=this,n=e.attempt(tl,s,e.attempt(this.parser.constructs.flowInitial,a,Kt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(dM,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 aA={resolveAll:Gk()},lA=Vk("string"),cA=Vk("text");function Vk(e){return{resolveAll:Gk(e==="text"?uA: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 k=g[b];if(!k.previous||k.previous.call(s,s.previous))return!0}return!1}}}function Gk(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 uA(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 dA={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:Bk},hA={91:gM},fA={[-2]:yh,[-1]:yh,32:yh},mA={35:kM,42:Mc,45:[Ev,Mc],60:NM,61:Ev,95:Mc,96:Pv,126:Pv},pA={38:Wk,92:Uk},gA={[-5]:vh,[-4]:vh,[-3]:vh,33:qM,38:Wk,42:Pf,60:[VR,LM],91:VM,92:[bM,Uk],93:km,95:Pf,96:sM},yA={null:[Pf,aA]},vA={null:[42,95]},wA={null:[]},bA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vA,contentInitial:hA,disable:wA,document:dA,flow:mA,flowInitial:fA,insideSpan:yA,string:pA,text:gA},Symbol.toStringTag,{value:"Module"}));function xA(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:I(V),check:I(F),consume:L,enter:M,exit:z,interrupt:I(F,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:k,write:g};let y=t.tokenize.call(p,f);return t.resolveAll&&c.push(t),p;function g(J){return l=Fr(l,J),j(),l[l.length-1]!==null?[]:(_(t,0),p.events=pu(c,p.events,p),p.events)}function b(J,X){return SA(k(J),X)}function k(J){return kA(l,J)}function S(){const{_bufferIndex:J,_index:X,line:G,column:te,offset:q}=s;return{_bufferIndex:J,_index:X,line:G,column:te,offset:q}}function C(J){a[J.line]=J.column,P()}function j(){let J;for(;s._index<l.length;){const X=l[s._index];if(typeof X=="string")for(J=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===J&&s._bufferIndex<X.length;)A(X.charCodeAt(s._bufferIndex));else A(X)}}function A(J){y=y(J)}function L(J){wt(J)?(s.line++,s.column=1,s.offset+=J===-3?2:1,P()):J!==-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=J}function M(J,X){const G=X||{};return G.type=J,G.start=S(),p.events.push(["enter",G,p]),d.push(G),G}function z(J){const X=d.pop();return X.end=S(),p.events.push(["exit",X,p]),X}function V(J,X){_(J,X.from)}function F(J,X){X.restore()}function I(J,X){return G;function G(te,q,me){let ne,K,ae,E;return Array.isArray(te)?re(te):"tokenize"in te?re([te]):B(te);function B(Ee){return Be;function Be(Ye){const $e=Ye!==null&&Ee[Ye],rt=Ye!==null&&Ee.null,ft=[...Array.isArray($e)?$e:$e?[$e]:[],...Array.isArray(rt)?rt:rt?[rt]:[]];return re(ft)(Ye)}}function re(Ee){return ne=Ee,K=0,Ee.length===0?me:T(Ee[K])}function T(Ee){return Be;function Be(Ye){return E=D(),ae=Ee,Ee.partial||(p.currentConstruct=Ee),Ee.name&&p.parser.constructs.disable.null.includes(Ee.name)?ge():Ee.tokenize.call(X?Object.assign(Object.create(p),X):p,f,ke,ge)(Ye)}}function ke(Ee){return J(ae,E),q}function ge(Ee){return E.restore(),++K<ne.length?T(ne[K]):me}}}function _(J,X){J.resolveAll&&!c.includes(J)&&c.push(J),J.resolve&&Tr(p.events,X,p.events.length-X,J.resolve(p.events.slice(X),p)),J.resolveTo&&(p.events=J.resolveTo(p.events,p))}function D(){const J=S(),X=p.previous,G=p.currentConstruct,te=p.events.length,q=Array.from(d);return{from:te,restore:me};function me(){s=J,p.previous=X,p.currentConstruct=G,p.events.length=te,d=q,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 SA(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 CA(e){const s={constructs:Fk([bA,...(e||{}).extensions||[]]),content:a(BR),defined:[],document:a(WR),flow:a(sA),lazy:{},string:a(lA),text:a(cA)};return s;function a(c){return l;function l(d){return xA(s,c,d)}}}function jA(e){for(;!zk(e););return e}const Rv=/[\0\t\n\r]/g;function NA(){let e=1,t="",n=!0,s;return a;function a(c,l,d){const f=[];let p,y,g,b,k;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(Rv.lastIndex=g,p=Rv.exec(c),b=p&&p.index!==void 0?p.index:c.length,k=c.charCodeAt(b),!p){t=c.slice(g);break}if(k===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),k){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 PA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function TA(e){return e.replace(PA,EA)}function EA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return Ok(n.slice(c?2:1),c?16:10)}return xm(n)||e}const Kk={}.hasOwnProperty;function RA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),MA(n)(jA(CA(n).document().write(NA()(e,t,!0))))}function MA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Ot),autolinkProtocol:D,autolinkEmail:D,atxHeading:c(tt),blockQuote:c(rt),characterEscape:D,characterReference:D,codeFenced:c(ft),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:c(ft,l),codeText:c(St,l),codeTextData:D,data:D,codeFlowValue:D,definition:c(Dt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:c(Mt),hardBreakEscape:c(Lt),hardBreakTrailing:c(Lt),htmlFlow:c(Tt,l),htmlFlowData:D,htmlText:c(Tt,l),htmlTextData:D,image:c(Et),label:l,link:c(Ot),listItem:c(_t),listItemValue:b,listOrdered:c(zt,g),listUnordered:c(zt),paragraph:c(Ze),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:c(tt),strong:c(Bt),thematicBreak:c(sn)},exit:{atxHeading:f(),atxHeadingSequence:V,autolink:f(),autolinkEmail:$e,autolinkProtocol:Ye,blockQuote:f(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:Ee,characterReference:Be,codeFenced:f(j),codeFencedFence:C,codeFencedFenceInfo:k,codeFencedFenceMeta:S,codeFlowValue:P,codeIndented:f(A),codeText:f(q),codeTextData:P,data:P,definition:f(),definitionDestinationString:z,definitionLabelString:L,definitionTitleString:M,emphasis:f(),hardBreakEscape:f(X),hardBreakTrailing:f(X),htmlFlow:f(G),htmlFlowData:P,htmlText:f(te),htmlTextData:P,image:f(ne),label:ae,labelText:K,lineEnding:J,link:f(me),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ke,resourceDestinationString:E,resourceTitleString:B,resource:re,setextHeading:f(_),setextHeadingLineSequence:I,setextHeadingText:F,strong:f(),thematicBreak:f()}};Qk(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ue){let ye={type:"root",children:[]};const Ae={stack:[ye],tokenStack:[],config:t,enter:d,exit:p,buffer:l,resume:y,data:n},_e=[];let ut=-1;for(;++ut<ue.length;)if(ue[ut][1].type==="listOrdered"||ue[ut][1].type==="listUnordered")if(ue[ut][0]==="enter")_e.push(ut);else{const Ge=_e.pop();ut=a(ue,Ge,ut)}for(ut=-1;++ut<ue.length;){const Ge=t[ue[ut][0]];Kk.call(Ge,ue[ut][1].type)&&Ge[ue[ut][1].type].call(Object.assign({sliceSerialize:ue[ut][2].sliceSerialize},Ae),ue[ut][1])}if(Ae.tokenStack.length>0){const Ge=Ae.tokenStack[Ae.tokenStack.length-1];(Ge[1]||Mv).call(Ae,void 0,Ge[0])}for(ye.position={start:Yi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Yi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},ut=-1;++ut<t.transforms.length;)ye=t.transforms[ut](ye)||ye;return ye}function a(ue,ye,Ae){let _e=ye-1,ut=-1,Ge=!1,Jt,bt,mt,At;for(;++_e<=Ae;){const lt=ue[_e];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?ut++:ut--,At=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Jt&&!At&&!ut&&!mt&&(mt=_e),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!ut&<[0]==="enter"&<[1].type==="listItemPrefix"||ut===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Jt){let Y=_e;for(bt=void 0;Y--;){const Me=ue[Y];if(Me[1].type==="lineEnding"||Me[1].type==="lineEndingBlank"){if(Me[0]==="exit")continue;bt&&(ue[bt][1].type="lineEndingBlank",Ge=!0),Me[1].type="lineEnding",bt=Y}else if(!(Me[1].type==="linePrefix"||Me[1].type==="blockQuotePrefix"||Me[1].type==="blockQuotePrefixWhitespace"||Me[1].type==="blockQuoteMarker"||Me[1].type==="listItemIndent"))break}mt&&(!bt||mt<bt)&&(Jt._spread=!0),Jt.end=Object.assign({},bt?ue[bt][1].start:lt[1].end),ue.splice(bt||_e,0,["exit",Jt,lt[2]]),_e++,Ae++}if(lt[1].type==="listItemPrefix"){const Y={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Jt=Y,ue.splice(_e,0,["enter",Y,lt[2]]),_e++,Ae++,mt=void 0,At=!0}}}return ue[ye][1]._spread=Ge,Ae}function c(ue,ye){return Ae;function Ae(_e){d.call(this,ue(_e),_e),ye&&ye.call(this,_e)}}function l(){this.stack.push({type:"fragment",children:[]})}function d(ue,ye,Ae){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ye,Ae||void 0]),ue.position={start:Yi(ye.start),end:void 0}}function f(ue){return ye;function ye(Ae){ue&&ue.call(this,Ae),p.call(this,Ae)}}function p(ue,ye){const Ae=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==ue.type&&(ye?ye.call(this,ue,_e[0]):(_e[1]||Mv).call(this,ue,_e[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Ra({start:ue.start,end:ue.end})+"): it’s not open");Ae.position.end=Yi(ue.end)}function y(){return bm(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function k(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ue}function S(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/(\r?\n|\r)$/g,"")}function L(ue){const ye=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ye,Ae.identifier=Zr(this.sliceSerialize(ue)).toLowerCase()}function M(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function z(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function V(ue){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Ae=this.sliceSerialize(ue).length;ye.depth=Ae}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function I(ue){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function D(ue){const Ae=this.stack[this.stack.length-1].children;let _e=Ae[Ae.length-1];(!_e||_e.type!=="text")&&(_e=Ct(),_e.position={start:Yi(ue.start),end:void 0},Ae.push(_e)),this.stack.push(_e)}function P(ue){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ue),ye.position.end=Yi(ue.end)}function J(ue){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=ye.children[ye.children.length-1];Ae.position.end=Yi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(D.call(this,ue),P.call(this,ue))}function X(){this.data.atHardBreak=!0}function G(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function te(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function q(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function me(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ne(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function K(ue){const ye=this.sliceSerialize(ue),Ae=this.stack[this.stack.length-2];Ae.label=TA(ye),Ae.identifier=Zr(ye).toLowerCase()}function ae(){const ue=this.stack[this.stack.length-1],ye=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const _e=ue.children;Ae.children=_e}else Ae.alt=ye}function E(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function B(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function re(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ke(ue){const ye=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ye,Ae.identifier=Zr(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ge(ue){this.data.characterReferenceType=ue.type}function Ee(ue){const ye=this.sliceSerialize(ue),Ae=this.data.characterReferenceType;let _e;Ae?(_e=Ok(ye,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=xm(ye);const ut=this.stack[this.stack.length-1];ut.value+=_e}function Be(ue){const ye=this.stack.pop();ye.position.end=Yi(ue.end)}function Ye(ue){P.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ue)}function $e(ue){P.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ue)}function rt(){return{type:"blockquote",children:[]}}function ft(){return{type:"code",lang:null,meta:null,value:""}}function St(){return{type:"inlineCode",value:""}}function Dt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Mt(){return{type:"emphasis",children:[]}}function tt(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function Tt(){return{type:"html",value:""}}function Et(){return{type:"image",title:null,url:"",alt:null}}function Ot(){return{type:"link",title:null,url:"",children:[]}}function zt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function _t(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function Ze(){return{type:"paragraph",children:[]}}function Bt(){return{type:"strong",children:[]}}function Ct(){return{type:"text",value:""}}function sn(){return{type:"thematicBreak"}}}function Yi(e){return{line:e.line,column:e.column,offset:e.offset}}function Qk(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?Qk(e,s):AA(e,s)}}function AA(e,t){let n;for(n in t)if(Kk.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 Mv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ra({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ra({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ra({start:t.start,end:t.end})+") is still open")}function LA(e){const t=this;t.parser=n;function n(s){return RA(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function IA(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 DA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
73
|
-
`}]}function _A(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 FA(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OA(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BA(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Mo(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 UA(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 WA(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Yk(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 zA(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Yk(e,t);const a={src:Mo(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 HA(e,t){const n={src:Mo(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 qA(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 $A(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Yk(e,t);const a={href:Mo(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 VA(e,t){const n={href:Mo(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 GA(e,t,n){const s=e.all(t),a=n?KA(n):Xk(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 KA(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=Xk(n[s])}return t}function Xk(e){const t=e.spread;return t??e.children.length>1}function QA(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 YA(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XA(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function JA(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZA(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=gm(t.children[1]),f=Rk(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 eL(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={},k=l?l[f]:void 0;k&&(b.align=k);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 tL(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Av=9,Lv=32;function nL(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const c=[];for(;s;)c.push(Iv(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return c.push(Iv(t.slice(a),a>0,!1)),c.join("")}function Iv(e,t,n){let s=0,a=e.length;if(t){let c=e.codePointAt(s);for(;c===Av||c===Lv;)s++,c=e.codePointAt(s)}if(n){let c=e.codePointAt(a-1);for(;c===Av||c===Lv;)a--,c=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function rL(e,t){const n={type:"text",value:nL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function iL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const sL={blockquote:IA,break:DA,code:_A,delete:FA,emphasis:OA,footnoteReference:BA,heading:UA,html:WA,imageReference:zA,image:HA,inlineCode:qA,linkReference:$A,link:VA,listItem:GA,list:QA,paragraph:YA,root:XA,strong:JA,table:ZA,tableCell:tL,tableRow:eL,text:rL,thematicBreak:iL,toml:lc,yaml:lc,definition:lc,footnoteDefinition:lc};function lc(){}const Jk=-1,gu=0,Aa=1,eu=2,Sm=3,Cm=4,jm=5,Nm=6,Zk=7,eS=8,Dv=typeof self=="object"?self:globalThis,oL=(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 gu:case Jk:return n(l,a);case Aa:{const d=n([],a);for(const f of l)d.push(s(f));return d}case eu:{const d=n({},a);for(const[f,p]of l)d[s(f)]=s(p);return d}case Sm:return n(new Date(l),a);case Cm:{const{source:d,flags:f}=l;return n(new RegExp(d,f),a)}case jm:{const d=n(new Map,a);for(const[f,p]of l)d.set(s(f),s(p));return d}case Nm:{const d=n(new Set,a);for(const f of l)d.add(s(f));return d}case Zk:{const{name:d,message:f}=l;return n(new Dv[d](f),a)}case eS: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 Dv[c](l),a)};return s},_v=e=>oL(new Map,e)(0),po="",{toString:aL}={},{keys:lL}=Object,xa=e=>{const t=typeof e;if(t!=="object"||!e)return[gu,t];const n=aL.call(e).slice(8,-1);switch(n){case"Array":return[Aa,po];case"Object":return[eu,po];case"Date":return[Sm,po];case"RegExp":return[Cm,po];case"Map":return[jm,po];case"Set":return[Nm,po];case"DataView":return[Aa,n]}return n.includes("Array")?[Aa,n]:n.includes("Error")?[Zk,n]:[eu,n]},cc=([e,t])=>e===gu&&(t==="function"||t==="symbol"),cL=(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]=xa(l);switch(d){case gu:{let y=l;switch(f){case"bigint":d=eS,y=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);y=null;break;case"undefined":return a([Jk],l)}return a([d,y],l)}case Aa:{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 eu:{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 lL(l))(e||!cc(xa(l[b])))&&y.push([c(b),c(l[b])]);return g}case Sm:return a([d,l.toISOString()],l);case Cm:{const{source:y,flags:g}=l;return a([d,{source:y,flags:g}],l)}case jm:{const y=[],g=a([d,y],l);for(const[b,k]of l)(e||!(cc(xa(b))||cc(xa(k))))&&y.push([c(b),c(k)]);return g}case Nm:{const y=[],g=a([d,y],l);for(const b of l)(e||!cc(xa(b)))&&y.push(c(b));return g}}const{message:p}=l;return a([d,{name:f,message:p}],l)};return c},Fv=(e,{json:t,lossy:n}={})=>{const s=[];return cL(!(t||n),!!t,new Map,s)(e),s},tu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?_v(Fv(e,t)):structuredClone(e):(e,t)=>_v(Fv(e,t));function uL(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 dL(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hL(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||uL,s=e.options.footnoteBackLabel||dL,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=Mo(g.toLowerCase());let k=0;const S=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++k<=C;){S.length>0&&S.push({type:"text",value:" "});let L=typeof n=="string"?n:n(f,k);typeof L=="string"&&(L={type:"text",value:L}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(k>1?"-"+k:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(f,k),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 A={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(y,!0)};e.patch(p,A),d.push(A)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...tu(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 yu=(function(e){if(e==null)return gL;if(typeof e=="function")return vu(e);if(typeof e=="object")return Array.isArray(e)?fL(e):mL(e);if(typeof e=="string")return pL(e);throw new Error("Expected function, string, or object as test")});function fL(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yu(e[n]);return vu(s);function s(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function mL(e){const t=e;return vu(n);function n(s){const a=s;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function pL(e){return vu(t);function t(n){return n&&n.type===e}}function vu(e){return t;function t(n,s,a){return!!(yL(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function gL(){return!0}function yL(e){return e!==null&&typeof e=="object"&&"type"in e}const tS=[],vL=!0,Tf=!1,wL="skip";function nS(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const c=yu(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 k=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(k?"<"+k+">":""))+")"})}return b;function b(){let k=tS,S,C,j;if((!t||c(f,p,y[y.length-1]||void 0))&&(k=bL(n(f,y)),k[0]===Tf))return k;if("children"in f&&f.children){const A=f;if(A.children&&k[0]!==wL)for(C=(s?A.children.length:-1)+l,j=y.concat(A);C>-1&&C<A.children.length;){const L=A.children[C];if(S=d(L,C,j)(),S[0]===Tf)return S;C=typeof S[1]=="number"?S[1]:C+l}}return k}}}function bL(e){return Array.isArray(e)?e:typeof e=="number"?[vL,e]:e==null?tS:[e]}function Pm(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),nS(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 Ef={}.hasOwnProperty,xL={};function kL(e,t){const n=t||xL,s=new Map,a=new Map,c=new Map,l={...sL,...n.handlers},d={all:p,applyData:CL,definitionById:s,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:l,one:f,options:n,patch:SL,wrap:NL};return Pm(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,k=d.handlers[b];if(Ef.call(d.handlers,b)&&k)return k(d,y,g);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in y){const{children:C,...j}=y,A=tu(j);return A.children=d.all(y),A}return tu(y)}return(d.options.unknownHandler||jL)(d,y,g)}function p(y){const g=[];if("children"in y){const b=y.children;let k=-1;for(;++k<b.length;){const S=d.one(b[k],y);if(S){if(k&&b[k-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Ov(S.value)),!Array.isArray(S)&&S.type==="element")){const C=S.children[0];C&&C.type==="text"&&(C.value=Ov(C.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function SL(e,t){e.position&&(t.position=dR(e))}function CL(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,tu(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function jL(e,t){const n=t.data||{},s="value"in t&&!(Ef.call(n,"hProperties")||Ef.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 NL(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 Ov(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Bv(e,t){const n=kL(e,t),s=n.one(e,void 0),a=hL(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 PL(e,t){return e&&"run"in e?async function(n,s){const a=Bv(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Bv(n,{file:s,...e||t})}}function Uv(e){if(e)throw e}var wh,Wv;function TL(){if(Wv)return wh;Wv=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 wh=function f(){var p,y,g,b,k,S,C=arguments[0],j=1,A=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<A;++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)||(k=a(b)))?(k?(k=!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},wh}var EL=TL();const bh=Va(EL);function Rf(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 RL(){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?ML(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 ML(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 di={basename:AL,dirname:LL,extname:IL,join:DL,sep:"/"};function AL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');nl(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 LL(e){if(nl(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 IL(e){nl(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 DL(...e){let t=-1,n;for(;++t<e.length;)nl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":_L(n)}function _L(e){nl(e);const t=e.codePointAt(0)===47;let n=FL(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function FL(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 nl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OL={cwd:BL};function BL(){return"/"}function Mf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function UL(e){if(typeof e=="string")e=new URL(e);else if(!Mf(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 WL(e)}function WL(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 xh=["history","path","basename","stem","extname","dirname"];class rS{constructor(t){let n;t?Mf(t)?n={path:t}:typeof t=="string"||zL(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":OL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<xh.length;){const c=xh[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)xh.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?di.basename(this.path):void 0}set basename(t){Sh(t,"basename"),kh(t,"basename"),this.path=di.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?di.dirname(this.path):void 0}set dirname(t){zv(this.basename,"dirname"),this.path=di.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?di.extname(this.path):void 0}set extname(t){if(kh(t,"extname"),zv(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=di.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Mf(t)&&(t=UL(t)),Sh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?di.basename(this.path,this.extname):void 0}set stem(t){Sh(t,"stem"),kh(t,"stem"),this.path=di.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 Jn(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 kh(e,t){if(e&&e.includes(di.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+di.sep+"`")}function Sh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zv(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function zL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HL=(function(e){const s=this.constructor.prototype,a=s[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),qL={}.hasOwnProperty;class Tm extends HL{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=RL()}copy(){const t=new Tm;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(bh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Nh("data",this.frozen),this.namespace[t]=n,this):qL.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Nh("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=uc(t),s=this.parser||this.Parser;return Ch("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Ch("process",this.parser||this.Parser),jh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,l){const d=uc(t),f=s.parse(d);s.run(f,d,function(y,g,b){if(y||!g||!b)return p(y);const k=g,S=s.stringify(k,b);GL(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(),Ch("processSync",this.parser||this.Parser),jh("processSync",this.compiler||this.Compiler),this.process(t,a),qv("processSync","process",n),s;function a(c,l){n=!0,Uv(c),s=l}}run(t,n,s){Hv(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=uc(n);a.run(t,f,p);function p(y,g,b){const k=g||t;y?d(y):l?l(k):s(void 0,k,b)}}}runSync(t,n){let s=!1,a;return this.run(t,n,c),qv("runSync","run",s),a;function c(l,d){Uv(l),a=d,s=!0}}stringify(t,n){this.freeze();const s=uc(n),a=this.compiler||this.Compiler;return jh("stringify",a),Hv(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Nh("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=bh(!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[k,...S]=y;const C=s[b][1];Rf(C)&&Rf(k)&&(k=bh(!0,C,k)),s[b]=[p,k,...S]}}}}const $L=new Tm().freeze();function Ch(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function jh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Nh(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 Hv(e){if(!Rf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qv(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function uc(e){return VL(e)?e:new rS(e)}function VL(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function GL(e){return typeof e=="string"||KL(e)}function KL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",$v=[],Vv={allowDangerousHtml:!0},YL=/^(https?|ircs?|mailto|xmpp)$/i,XL=[{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 Em(e){const t=JL(e),n=ZL(e);return eI(t.runSync(t.parse(n),n),e)}function JL(e){const t=e.rehypePlugins||$v,n=e.remarkPlugins||$v,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vv}:Vv;return $L().use(LA).use(n).use(PL,s).use(t)}function ZL(e){const t=e.children||"",n=new rS;return typeof t=="string"&&(n.value=t),n}function eI(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,c=t.disallowedElements,l=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||tI;for(const y of XL)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+QL+y.id,void 0);return Pm(e,p),gR(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 k;for(k in gh)if(Object.hasOwn(gh,k)&&Object.hasOwn(y.properties,k)){const S=y.properties[k],C=gh[k];(C===null||C.includes(y.tagName))&&(y.properties[k]=f(String(S||""),k,y))}}if(y.type==="element"){let k=n?!n.includes(y.tagName):c?c.includes(y.tagName):!1;if(!k&&s&&typeof g=="number"&&(k=!s(y,g,b)),k&&b&&typeof g=="number")return d&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function tI(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||YL.test(e.slice(0,t))?e:""}function Gv(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 nI(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rI(e,t,n){const a=yu((n||{}).ignore||[]),c=iI(t);let l=-1;for(;++l<c.length;)nS(e,"text",d);function d(p,y){let g=-1,b;for(;++g<y.length;){const k=y[g],S=b?b.children:void 0;if(a(k,S?S.indexOf(k):void 0,b))return;b=k}if(b)return f(p,y)}function f(p,y){const g=y[y.length-1],b=c[l][0],k=c[l][1];let S=0;const j=g.children.indexOf(p);let A=!1,L=[];b.lastIndex=0;let M=b.exec(p.value);for(;M;){const z=M.index,V={index:M.index,input:M.input,stack:[...y,p]};let F=k(...M,V);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1?b.lastIndex=z+1:(S!==z&&L.push({type:"text",value:p.value.slice(S,z)}),Array.isArray(F)?L.push(...F):F&&L.push(F),S=z+M[0].length,A=!0),!b.global)break;M=b.exec(p.value)}return A?(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 iI(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([sI(a[0]),oI(a[1])])}return t}function sI(e){return typeof e=="string"?new RegExp(nI(e),"g"):e}function oI(e){return typeof e=="function"?e:function(){return e}}const Ph="phrasing",Th=["autolink","link","image","label"];function aI(){return{transforms:[mI],enter:{literalAutolink:cI,literalAutolinkEmail:Eh,literalAutolinkHttp:Eh,literalAutolinkWww:Eh},exit:{literalAutolink:fI,literalAutolinkEmail:hI,literalAutolinkHttp:uI,literalAutolinkWww:dI}}}function lI(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Th},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Th},{character:":",before:"[ps]",after:"\\/",inConstruct:Ph,notInConstruct:Th}]}}function cI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Eh(e){this.config.enter.autolinkProtocol.call(this,e)}function uI(e){this.config.exit.autolinkProtocol.call(this,e)}function dI(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 hI(e){this.config.exit.autolinkEmail.call(this,e)}function fI(e){this.exit(e)}function mI(e){rI(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gI]],{ignore:["link","linkReference"]})}function pI(e,t,n,s,a){let c="";if(!iS(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!yI(n)))return!1;const l=vI(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 gI(e,t,n,s){return!iS(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function yI(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 vI(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=Gv(e,"(");let c=Gv(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 iS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ds(n)||mu(n))&&(!t||n!==47)}sS.peek=PI;function wI(){this.buffer()}function bI(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xI(){this.buffer()}function kI(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function SI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CI(e){this.exit(e)}function jI(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NI(e){this.exit(e)}function PI(){return"["}function sS(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 TI(){return{enter:{gfmFootnoteCallString:wI,gfmFootnoteCall:bI,gfmFootnoteDefinitionLabelString:xI,gfmFootnoteDefinition:kI},exit:{gfmFootnoteCallString:SI,gfmFootnoteCall:CI,gfmFootnoteDefinitionLabelString:jI,gfmFootnoteDefinition:NI}}}function EI(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sS},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?oS:RI))),p(),f}}function RI(e,t,n){return t===0?e:oS(e,t,n)}function oS(e,t,n){return(n?"":" ")+e}const MI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aS.peek=_I;function AI(){return{canContainEols:["delete"],enter:{strikethrough:II},exit:{strikethrough:DI}}}function LI(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:MI}],handlers:{delete:aS}}}function II(e){this.enter({type:"delete",children:[]},e)}function DI(e){this.exit(e)}function aS(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 _I(){return"~"}function FI(e){return e.length}function OI(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||FI,c=[],l=[],d=[],f=[];let p=0,y=-1;for(;++y<e.length;){const C=[],j=[];let A=-1;for(e[y].length>p&&(p=e[y].length);++A<e[y].length;){const L=BI(e[y][A]);if(n.alignDelimiters!==!1){const M=a(L);j[A]=M,(f[A]===void 0||M>f[A])&&(f[A]=M)}C.push(L)}l[y]=C,d[y]=j}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<p;)c[g]=Kv(s[g]);else{const C=Kv(s);for(;++g<p;)c[g]=C}g=-1;const b=[],k=[];for(;++g<p;){const C=c[g];let j="",A="";C===99?(j=":",A=":"):C===108?j=":":C===114&&(A=":");let L=n.alignDelimiters===!1?1:Math.max(1,f[g]-j.length-A.length);const M=j+"-".repeat(L)+A;n.alignDelimiters!==!1&&(L=j.length+L+A.length,L>f[g]&&(f[g]=L),k[g]=L),b[g]=M}l.splice(1,0,b),d.splice(1,0,k),y=-1;const S=[];for(;++y<l.length;){const C=l[y],j=d[y];g=-1;const A=[];for(;++g<p;){const L=C[g]||"";let M="",z="";if(n.alignDelimiters!==!1){const V=f[g]-(j[g]||0),F=c[g];F===114?M=" ".repeat(V):F===99?V%2?(M=" ".repeat(V/2+.5),z=" ".repeat(V/2-.5)):(M=" ".repeat(V/2),z=M):z=" ".repeat(V)}n.delimiterStart!==!1&&!g&&A.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&L==="")&&(n.delimiterStart!==!1||g)&&A.push(" "),n.alignDelimiters!==!1&&A.push(M),A.push(L),n.alignDelimiters!==!1&&A.push(z),n.padding!==!1&&A.push(" "),(n.delimiterEnd!==!1||g!==p-1)&&A.push("|")}S.push(n.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return S.join(`
|
|
84
|
-
`)}function BI(e){return e==null?"":String(e)}function Kv(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 UI(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()),WI);return a(),l}function WI(e,t,n){return">"+(n?"":" ")+e}function zI(e,t){return Qv(e,t.inConstruct,!0)&&!Qv(e,t.notInConstruct,!1)}function Qv(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 Yv(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
85
|
-
`&&zI(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
86
|
-
`}function HI(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 qI(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 $I(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 VI(e,t,n,s){const a=$I(n),c=e.value||"",l=a==="`"?"GraveAccent":"Tilde";if(qI(e,n)){const g=n.enter("codeIndented"),b=n.indentLines(c,GI);return g(),b}const d=n.createTracker(s),f=a.repeat(Math.max(HI(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 GI(e,t,n){return(n?"":" ")+e}function Rm(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 KI(e,t,n,s){const a=Rm(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 QI(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 Ua(e){return"&#x"+e.toString(16).toUpperCase()+";"}function nu(e,t,n){const s=No(e),a=No(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}}lS.peek=YI;function lS(e,t,n,s){const a=QI(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=nu(s.before.charCodeAt(s.before.length-1),p,a);y.inside&&(f=Ua(p)+f.slice(1));const g=f.charCodeAt(f.length-1),b=nu(s.after.charCodeAt(0),g,a);b.inside&&(f=f.slice(0,-1)+Ua(g));const k=l.move(a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+f+k}function YI(e,t,n){return n.options.emphasis||"*"}function XI(e,t){let n=!1;return Pm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Tf}),!!((!e.depth||e.depth<3)&&bm(e)&&(t.options.setext||n))}function JI(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(s);if(XI(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=Ua(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),f(),d(),p}cS.peek=ZI;function cS(e){return e.value||""}function ZI(){return"<"}uS.peek=eD;function uS(e,t,n,s){const a=Rm(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 eD(){return"!"}dS.peek=tD;function dS(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 tD(){return"!"}hS.peek=nD;function hS(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 nD(){return"`"}function fS(e,t){const n=bm(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=rD;function mS(e,t,n,s){const a=Rm(n),c=a==='"'?"Quote":"Apostrophe",l=n.createTracker(s);let d,f;if(fS(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 rD(e,t,n){return fS(e,n)?"<":"["}pS.peek=iD;function pS(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 iD(){return"["}function Mm(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 sD(e){const t=Mm(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 oD(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 gS(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 aD(e,t,n,s){const a=n.enter("list"),c=n.bulletCurrent;let l=e.ordered?oD(n):Mm(n);const d=e.ordered?l==="."?")":".":sD(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),gS(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 lD(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 cD(e,t,n,s){const a=lD(n);let c=n.bulletCurrent||Mm(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,k){return b?(k?"":" ".repeat(l))+g:(k?c:c+" ".repeat(l-c.length))+g}}function uD(e,t,n,s){const a=n.enter("paragraph"),c=n.enter("phrasing"),l=n.containerPhrasing(e,s);return c(),a(),l}const dD=yu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hD(e,t,n,s){return(e.children.some(function(l){return dD(l)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function fD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yS.peek=mD;function yS(e,t,n,s){const a=fD(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=nu(s.before.charCodeAt(s.before.length-1),p,a);y.inside&&(f=Ua(p)+f.slice(1));const g=f.charCodeAt(f.length-1),b=nu(s.after.charCodeAt(0),g,a);b.inside&&(f=f.slice(0,-1)+Ua(g));const k=l.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+f+k}function mD(e,t,n){return n.options.strong||"*"}function pD(e,t,n,s){return n.safe(e.value,s)}function gD(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 yD(e,t,n){const s=(gS(n)+(n.options.ruleSpaces?" ":"")).repeat(gD(n));return n.options.ruleSpaces?s.slice(0,-1):s}const vS={blockquote:UI,break:Yv,code:VI,definition:KI,emphasis:lS,hardBreak:Yv,heading:JI,html:cS,image:uS,imageReference:dS,inlineCode:hS,link:mS,linkReference:pS,list:aD,listItem:cD,paragraph:uD,root:hD,strong:yS,text:pD,thematicBreak:yD};function vD(){return{enter:{table:wD,tableData:Xv,tableHeader:Xv,tableRow:xD},exit:{codeText:kD,table:bD,tableData:Rh,tableHeader:Rh,tableRow:Rh}}}function wD(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 bD(e){this.exit(e),this.data.inTable=void 0}function xD(e){this.enter({type:"tableRow",children:[]},e)}function Rh(e){this.exit(e)}function Xv(e){this.enter({type:"tableCell",children:[]},e)}function kD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SD(e,t){return t==="|"?t:e}function CD(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(k,S,C,j){return p(y(k,C,j),k.align)}function d(k,S,C,j){const A=g(k,C,j),L=p([A]);return L.slice(0,L.indexOf(`
|
|
97
|
-
`))}function f(k,S,C,j){const A=C.enter("tableCell"),L=C.enter("phrasing"),M=C.containerPhrasing(k,{...j,before:c,after:c});return L(),A(),M}function p(k,S){return OI(k,{align:S,alignDelimiters:s,padding:n,stringLength:a})}function y(k,S,C){const j=k.children;let A=-1;const L=[],M=S.enter("table");for(;++A<j.length;)L[A]=g(j[A],S,C);return M(),L}function g(k,S,C){const j=k.children;let A=-1;const L=[],M=S.enter("tableRow");for(;++A<j.length;)L[A]=f(j[A],k,S,C);return M(),L}function b(k,S,C){let j=vS.inlineCode(k,S,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function jD(){return{exit:{taskListCheckValueChecked:Jv,taskListCheckValueUnchecked:Jv,paragraph:PD}}}function ND(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TD}}}function Jv(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function PD(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 TD(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=vS.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 ED(){return[aI(),TI(),AI(),vD(),jD()]}function RD(e){return{extensions:[lI(),EI(e),LI(),CD(e),ND()]}}const MD={tokenize:FD,partial:!0},wS={tokenize:OD,partial:!0},bS={tokenize:BD,partial:!0},xS={tokenize:UD,partial:!0},AD={tokenize:WD,partial:!0},kS={name:"wwwAutolink",tokenize:DD,previous:CS},SS={name:"protocolAutolink",tokenize:_D,previous:jS},Ai={name:"emailAutolink",tokenize:ID,previous:NS},pi={};function LD(){return{text:pi}}let Ss=48;for(;Ss<123;)pi[Ss]=Ai,Ss++,Ss===58?Ss=65:Ss===91&&(Ss=97);pi[43]=Ai;pi[45]=Ai;pi[46]=Ai;pi[95]=Ai;pi[72]=[Ai,SS];pi[104]=[Ai,SS];pi[87]=[Ai,kS];pi[119]=[Ai,kS];function ID(e,t,n){const s=this;let a,c;return l;function l(g){return!Af(g)||!NS.call(s,s.previous)||Am(s.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return Af(g)?(e.consume(g),d):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(AD,y,p)(g):g===45||g===95||Qn(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&&nr(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function DD(e,t,n){const s=this;return a;function a(l){return l!==87&&l!==119||!CS.call(s,s.previous)||Am(s.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(MD,e.attempt(wS,e.attempt(bS,c),n),n)(l))}function c(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function _D(e,t,n){const s=this;let a="",c=!1;return l;function l(g){return(g===72||g===104)&&jS.call(s,s.previous)&&!Am(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),d):n(g)}function d(g){if(nr(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||Zc(g)||ln(g)||Ds(g)||mu(g)?n(g):e.attempt(wS,e.attempt(bS,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function FD(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 OD(e,t,n){let s,a,c;return l;function l(p){return p===46||p===95?e.check(xS,f,d)(p):p===null||ln(p)||Ds(p)||p!==45&&mu(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 BD(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(xS,t,c)(l):l===null||ln(l)||Ds(l)?t(l):(e.consume(l),a)}function c(l){return l===41&&s++,e.consume(l),a}}function UD(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||ln(d)||Ds(d)?t(d):n(d)}function a(d){return d===null||d===40||d===91||ln(d)||Ds(d)?t(d):s(d)}function c(d){return nr(d)?l(d):n(d)}function l(d){return d===59?(e.consume(d),s):nr(d)?(e.consume(d),l):n(d)}}function WD(e,t,n){return s;function s(c){return e.consume(c),a}function a(c){return Qn(c)?n(c):t(c)}}function CS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ln(e)}function jS(e){return!nr(e)}function NS(e){return!(e===47||Af(e))}function Af(e){return e===43||e===45||e===46||e===95||Qn(e)}function Am(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 zD={tokenize:YD,partial:!0};function HD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:GD,continuation:{tokenize:KD},exit:QD}},text:{91:{name:"gfmFootnoteCall",tokenize:VD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qD,resolveTo:$D}}}}function qD(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=Zr(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 $D(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 VD(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||ln(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(Zr(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return ln(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 GD(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||ln(S))return n(S);if(S===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=Zr(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return ln(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),Kt(e,k,"gfmFootnoteDefinitionWhitespace")):n(S)}function k(S){return t(S)}}function KD(e,t,n){return e.check(tl,t,e.attempt(zD,t,n))}function QD(e){e.exit("gfmFootnoteDefinition")}function YD(e,t,n){const s=this;return Kt(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 XD(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]],k=d.parser.constructs.insideSpan.null;k&&Tr(b,b.length,0,pu(k,l.slice(p+1,f),d)),Tr(b,b.length,0,[["exit",g,d],["enter",l[f][1],d],["exit",l[f][1],d],["exit",y,d]]),Tr(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"),k(S))}function k(S){const C=No(p);if(S===126)return g>1?f(S):(l.consume(S),g++,k);if(g<2&&!n)return f(S);const j=l.exit("strikethroughSequenceTemporary"),A=No(S);return j._open=!A||A===2&&!!C,j._close=!C||C===2&&!!A,d(S)}}}class JD{constructor(){this.map=[]}add(t,n,s){ZD(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 ZD(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 e2(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 t2(){return{flow:{null:{name:"table",tokenize:n2,resolveAll:r2}}}}function n2(e,t,n){const s=this;let a=0,c=0,l;return d;function d(P){let J=s.events.length-1;for(;J>-1;){const te=s.events[J][1].type;if(te==="lineEnding"||te==="linePrefix")J--;else break}const X=J>-1?s.events[J][1].type:null,G=X==="tableHead"||X==="tableRow"?F:f;return G===F&&s.parser.lazy[s.now().line]?n(P):G(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):wt(P)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),k):n(P):Wt(P)?Kt(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||ln(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 k(P){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(P):(e.enter("tableDelimiterRow"),l=!1,Wt(P)?Kt(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):V(P)}function C(P){return Wt(P)?Kt(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"),A):P===45?(c+=1,A(P)):P===null||wt(P)?z(P):V(P)}function A(P){return P===45?(e.enter("tableDelimiterFiller"),L(P)):V(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"),M):(e.exit("tableDelimiterFiller"),M(P))}function M(P){return Wt(P)?Kt(e,z,"whitespace")(P):z(P)}function z(P){return P===124?S(P):P===null||wt(P)?!l||a!==c?V(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):V(P)}function V(P){return n(P)}function F(P){return e.enter("tableRow"),I(P)}function I(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),I):P===null||wt(P)?(e.exit("tableRow"),t(P)):Wt(P)?Kt(e,I,"whitespace")(P):(e.enter("data"),_(P))}function _(P){return P===null||P===124||ln(P)?(e.exit("data"),I(P)):(e.consume(P),P===92?D:_)}function D(P){return P===92||P===124?(e.consume(P),_):_(P)}}function r2(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 JD;for(;++n<e.length;){const k=e[n],S=k[1];k[0]==="enter"?S.type==="tableHead"?(d=!1,f!==0&&(Zv(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=dc(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=dc(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=dc(b,t,c,a,n,g)):l[1]!==0&&(g=dc(b,t,l,a,n,g)),a=0):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Zv(b,t,f,p,y),b.consume(t.events),n=-1;++n<t.events.length;){const k=t.events[n];k[0]==="enter"&&k[1].type==="table"&&(k[1]._align=e2(t.events,n))}return e}function dc(e,t,n,s,a,c){const l=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},vo(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=vo(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=vo(t.events,n[2]),y=vo(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]],k=t.events[n[3]];if(b[1].end=Object.assign({},k[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({},vo(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function Zv(e,t,n,s,a){const c=[],l=vo(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 vo(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const i2={name:"tasklistCheck",tokenize:o2};function s2(){return{text:{91:i2}}}function o2(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 ln(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 wt(f)?t(f):Wt(f)?e.check({tokenize:a2},t,n)(f):n(f)}}function a2(e,t,n){return Kt(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function l2(e){return Fk([LD(),HD(),XD(e),t2(),s2()])}const c2={};function Lm(e){const t=this,n=e||c2,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),l=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(l2(n)),c.push(ED()),l.push(RD(n))}const ew="*** Begin Patch",tw="*** End Patch";function u2(e){const t=e.replace(/\r\n/g,`
|
|
98
|
-
`);if(!t.includes(ew)||!t.includes(tw))return null;const n=t.split(`
|
|
99
|
-
`),s=[];let a=null,c=null;for(const l of n){if(l===ew||l===tw)continue;if(l.startsWith("*** Update File: ")){a=Mh("update",l.slice(17)),s.push(a),c=null;continue}if(l.startsWith("*** Add File: ")){a=Mh("add",l.slice(14)),s.push(a),c={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){a=Mh("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=h2(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 d2(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Mh(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function h2(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const f2=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,m2=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,p2=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,g2=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Wa(e){const t=y2(e);return t||PS(e)}function y2(e){const t=e.trim();if(!v2(t))return null;try{const n=JSON.parse(t),s=w2(n);return s.text||s.inlineImages.length>0?s:null}catch{return null}}function v2(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function w2(e){const t=[],n=[];return Ac(e,t,n),{text:ES(t.join(`
|
|
100
|
-
|
|
101
|
-
`)),inlineImages:TS(n)}}function Ac(e,t,n){if(typeof e=="string"){const l=PS(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>Ac(l,t,n));return}if(typeof e!="object")return;const s=e,a=new Set,c=b2(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"||!RS(d)||(n.push(Ls(d,_r(s.alt))),a.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in s&&(a.add(l),Ac(s[l],t,n));a.size>0||Object.values(s).forEach(l=>{Ac(l,t,n)})}function PS(e){const t=[];let n=e;return n=n.replace(g2,(s,a,c)=>{const l=j2(a,"name"),d=C2(c);return d!=null&&d.url&&t.push(Ls(d.url,d.altText||l)),""}),n=n.replace(m2,(s,a,c)=>(t.push(Ls(c,a)),"")),n=n.replace(p2,(s,a)=>(t.push(Ls(a,null)),"")),n=n.replace(f2,(s,a,c)=>(t.push(Ls(s,null,`image/${a}`,ru(c))),"")),{text:ES(n),inlineImages:TS(t)}}function Ls(e,t,n,s){const a=n??x2(e)??"image/png";return{url:e,mimeType:a,altText:za(t),estimatedBytes:s??k2(e)}}function b2(e){const t=S2(e.source);if(t){const a=_r(t.type).trim().toLowerCase(),c=rw(t.media_type??t.mime_type??t.mimeType),l=nw(t.data);if(a==="base64"&&c&&l)return Ls(`data:${c};base64,${l}`,za(_r(t.alt)||_r(t.name)||_r(e.alt)||_r(e.name)),c,ru(l))}const n=rw(e.media_type??e.mime_type??e.mimeType),s=nw(e.data);return n&&s?Ls(`data:${n};base64,${s}`,za(_r(e.alt)||_r(e.name)),n,ru(s)):null}function TS(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function ES(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 RS(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function x2(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 k2(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?ru(t[1]):null}function ru(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 za(e){const t=_r(e).trim();return t.length>0?t:null}function nw(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function rw(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function _r(e){return typeof e=="string"?e:""}function S2(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function C2(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),s=_r(n.image_url??n.imageUrl).trim(),a=za(_r(n.name)||_r(n.alt));return{url:RS(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 j2(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return za((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 Xr(){return"/workspaces"}function fi(e){return`/workspaces/${encodeURIComponent(e)}`}function rl(e){return`${fi(e)}/sessions`}function Hn(e,t){return`${rl(e)}/${encodeURIComponent(t)}`}function Ao(e,t){const n=`${fi(e)}/tools`;if(!t)return n;const s=new URLSearchParams({tab:t});return`${n}?${s.toString()}`}function MS(e){return`${fi(e)}/tools/files`}function AS(e){return`${fi(e)}/tools/git`}function wu(e){return`${fi(e)}/tools/processes`}function xo(e){return`${fi(e)}/terminals`}function Im(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 N2(e){const t=new Map(e.map(a=>[a.session.sessionId,a])),n=new Map,s=[];for(const a of e){const c=T2(a,t);if(c===a.session.sessionId){s.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...s].sort(iw).map(a=>({entry:a,children:[...n.get(a.session.sessionId)??[]].sort(iw)}))}function LS(e,t){const n=P2(),s=new URLSearchParams({provider:t});return`${Hn(e,n)}?${s.toString()}`}function P2(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function iw(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function T2(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 E2="mobile.tools.last-primary-tool";function IS(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(E2)==="git"?"git":"files"}catch{return"files"}}function Dm(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=Mn(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(Mn(a.pattern,e))return{workspaceId:null,routeKind:a.routeKind,legacy:!0};return null}function R2(e,t){const n=Dm(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":IS()}function _m(e,t){const n=Dm(e);return n!=null&&n.workspaceId?Ao(n.workspaceId,R2(e,t)):n!=null&&n.legacy?IS()==="git"?"/tools?tab=git":"/tools?tab=files":null}function Fm({activeEntry:e,presentation:t,pathname:n,search:s,moreButtonLabel:a}){if(t==="conversation-focus"||e!=="tools")return null;const c=Dm(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 DS=v.createContext({composerPortalTarget:null});function Om({composerPortalTarget:e,children:t}){return i.jsx(DS.Provider,{value:{composerPortalTarget:e},children:t})}function _S(){return v.useContext(DS)}function Bm(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 M2=3e3,hc=10,sw=84,ow=.36;function Um({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(){Cs(a),a.current=window.setTimeout(()=>{k()},M2)}function k(){p("hidden"),g(0)}function S(){p("visible"),g(1),b()}v.useEffect(()=>{if(Cs(a),!e){Cs(a),p("visible"),g(1);return}if(n){p("hidden"),g(0);return}return S(),()=>{Cs(a)}},[e,s,n]),v.useEffect(()=>()=>{Cs(a)},[]),v.useEffect(()=>{if(!e||n){c.current=null;return}const j=t.current;if(!j)return;function A(_){if(_.touches.length!==1){c.current=null;return}const D=_.touches[0],P=cw(_.target);if(!D||!P){c.current=null;return}c.current={surface:P,startX:D.clientX,startY:D.clientY,pointerType:"touch",initialState:l.current==="visible"?"visible":"hidden",touchId:D.identifier,dragging:!1,latestProgress:d.current},l.current==="visible"&&Cs(a)}function L(_){const D=c.current;if(!D||D.pointerType!=="touch")return;const P=Ah(_.touches,D.touchId);if(!P)return;const J=P.clientX-D.startX,X=P.clientY-D.startY;if(D.surface==="conversation"){if(Math.abs(X)<=hc||Math.abs(X)<=Math.abs(J))return;c.current=null,D.initialState==="visible"&&k();return}const G=D.initialState==="hidden"?-X:X;G<=hc&&!D.dragging||(dw(_),D.dragging=!0,D.latestProgress=aw(D.initialState,G),p("dragging"),g(D.latestProgress))}function M(_){const D=c.current;if(!(!D||D.pointerType!=="touch"||!Ah(_.changedTouches,D.touchId))){if(c.current=null,!D.dragging){D.initialState==="visible"&&b();return}lw(D.initialState,D.latestProgress,S,p,g)}}function z(_){const D=c.current;if(!(!D||D.pointerType!=="touch"||!Ah(_.changedTouches,D.touchId))){if(c.current=null,!D.dragging){D.initialState==="visible"&&b();return}if(D.initialState==="visible"){S();return}p("hidden"),g(0)}}function V(_){if(_.pointerType!=="touch")return;const D=cw(_.target);if(!D){c.current=null;return}if(c.current={surface:D,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"&&Cs(a)}function F(_){const D=c.current;if(!D||D.pointerType!=="pointer")return;const P=_.clientX-D.startX,J=_.clientY-D.startY;if(D.surface==="conversation"){if(Math.abs(J)<=hc||Math.abs(J)<=Math.abs(P))return;c.current=null,D.initialState==="visible"&&k();return}const X=D.initialState==="hidden"?-J:J;X<=hc&&!D.dragging||(dw(_),D.dragging=!0,D.latestProgress=aw(D.initialState,X),p("dragging"),g(D.latestProgress))}function I(_){const D=c.current;if(!(!D||D.pointerType!=="pointer"||D.pointerId!==_.pointerId)){if(c.current=null,A2(D),!D.dragging){D.initialState==="visible"&&b();return}lw(D.initialState,D.latestProgress,S,p,g)}}return j.addEventListener("touchstart",A,{passive:!0}),j.addEventListener("pointerdown",V,{passive:!0}),window.addEventListener("touchmove",L,{passive:!1}),window.addEventListener("touchend",M),window.addEventListener("touchcancel",z),window.addEventListener("pointermove",F,{passive:!1}),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I),()=>{j.removeEventListener("touchstart",A),j.removeEventListener("pointerdown",V),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",z),window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)}},[e,t,n]);const C=e&&!n?y:e?0:1;return{state:n&&e?"hidden":f,progress:C,isOpen:C>.01}}function Cs(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function aw(e,t){return uw(e==="hidden"?t/sw:1-t/sw,0,1)}function lw(e,t,n,s,a){if(e==="hidden"){if(t>=ow){n();return}s("hidden"),a(0);return}if(t<=1-ow){s("hidden"),a(0);return}n()}function A2(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 Ah(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 cw(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 uw(e,t,n){return Math.min(Math.max(e,t),n)}function dw(e){e.cancelable&&e.preventDefault()}function il({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}){return e==="compact"?"compact":e==="expanded"&&n&&s?"expanded":t==="tools"&&s?"medium-auxiliary":n?"medium-navigation":s?"medium-auxiliary":"compact"}function FS(e){return e==="medium-navigation"||e==="expanded"}function OS(e){return e==="medium-auxiliary"||e==="expanded"}function Wm({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,children:a,navigationPanel:c,auxiliaryPanel:l}){const d=il({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}),f=FS(d)&&c,p=OS(d)&&l;return i.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":d,children:[f?i.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:c}):null,i.jsx("div",{className:"mobile-adaptive-pane-main",children:a}),p?i.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:l}):null]})}function L2({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 k=In(),S=Br(),C=ti(),j=qn(),A=v.useRef(null),L=v.useRef(null),[M,z]=v.useState(null),V=t==="conversation-focus",F=Um({enabled:V,rootRef:A,resetKey:`${C.pathname}${C.search}`}),I=il({viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a}),_=Fm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.androidMoreAction")}),D=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(_2,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(F2,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(O2,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(B2,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(U2,{}),onClick:b}],P=V?{"--mobile-conversation-tabbar-progress":F.progress.toFixed(4)}:void 0;Bm(A,L,V);function J(){const G=_m(C.pathname,C.search);if(!G){f();return}j(G,{replace:!0})}const X=i.jsx("nav",{ref:L,className:"android-workbench-bottom-nav","aria-label":h("shell.title"),children:D.map(G=>i.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":G.key===e,"aria-current":G.key===e?"page":void 0,onClick:()=>{G.key!==e&&S.trigger("selection"),G.onClick()},children:[i.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:G.icon}),i.jsx("span",{className:"android-workbench-bottom-nav-label",children:G.label})]},G.key))});return i.jsx(Om,{composerPortalTarget:V?M:null,children:i.jsxs("div",{ref:A,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":I,"data-tabbar-open":V?F.isOpen:!0,"data-conversation-tabbar-state":V?F.state:"default",style:P,children:[_?i.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[i.jsxs("div",{className:"android-workbench-topbar-leading",children:[_.showBackButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":h("common.back"),onClick:J,children:i.jsx(I2,{})}):null,i.jsx("div",{className:"android-workbench-topbar-copy",children:i.jsx("h1",{children:_.title})})]}),i.jsx("div",{className:"android-workbench-topbar-actions",children:_.showMoreButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":_.moreButtonLabel,onClick:g,children:i.jsx(D2,{})}):null})]}):null,i.jsx("div",{className:"android-workbench-content",children:i.jsx(Wm,{viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,navigationPanel:s,auxiliaryPanel:a,children:n})}),V?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:z,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:X})]}):X]})})}function I2(){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 D2(){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 _2(){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 F2(){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 O2(){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 B2(){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 U2(){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 W2=120,Na={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Lf(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function z2(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 H2(){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(Lf);return e.length>0?Math.max(...e):0}function hw(){if(typeof window>"u")return Na;const e=window.visualViewport,t=H2(),n=(e==null?void 0:e.height)??t,s=Lf(n)?Math.round(n):null,a=Lf(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:z2(typeof document<"u"?document.activeElement:null)&&c>=W2}}function Lh(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 q2(e){const[t,n]=v.useState(()=>e?hw():Na),s=v.useRef(null);return v.useEffect(()=>{if(!e){n(Na),Lh(!1,Na);return}function a(){n(hw())}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),Lh(!1,Na)}},[e]),v.useEffect(()=>{Lh(e,t)},[e,t]),t}function $2({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 k=In(),S=Br(),C=ti(),j=qn(),A=v.useRef(null),L=v.useRef(null),[M,z]=v.useState(null),V=t==="conversation-focus",F=Um({enabled:V,rootRef:A,resetKey:`${C.pathname}${C.search}`}),I=il({viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a}),_=Fm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.iosMoreAction")}),D=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(K2,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(Q2,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(Y2,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(X2,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(J2,{}),onClick:b}],P=V?{"--mobile-conversation-tabbar-progress":F.progress.toFixed(4)}:void 0;Bm(A,L,V);function J(){const G=_m(C.pathname,C.search);if(!G){f();return}j(G,{replace:!0})}const X=i.jsx("nav",{ref:L,className:"ios-workbench-tabbar","aria-label":h("shell.title"),children:D.map(G=>i.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":G.key===e,"aria-current":G.key===e?"page":void 0,onClick:()=>{G.key!==e&&S.trigger("selection"),G.onClick()},children:[i.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:G.icon}),i.jsx("span",{className:"ios-workbench-tabbar-label",children:G.label})]},G.key))});return i.jsx(Om,{composerPortalTarget:V?M:null,children:i.jsxs("div",{ref:A,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":I,"data-tabbar-open":V?F.isOpen:!0,"data-conversation-tabbar-state":V?F.state:"default",style:P,children:[_?i.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[i.jsx("div",{className:"ios-workbench-nav-leading",children:_.showBackButton?i.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":h("common.back"),onClick:J,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:_.title})}),i.jsx("div",{className:"ios-workbench-nav-actions",children:_.showMoreButton?i.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":_.moreButtonLabel,onClick:g,children:i.jsx(G2,{})}):null})]}):null,i.jsx("div",{className:"ios-workbench-content",children:i.jsx(Wm,{viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,navigationPanel:s,auxiliaryPanel:a,children:n})}),V?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:z,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 G2(){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 K2(){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 Q2(){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 Y2(){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 X2(){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 J2(){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 Z2(e){const t=In();return t.platform==="ios"?i.jsx($2,{...e}):t.platform==="android"?i.jsx(L2,{...e}):i.jsx(e_,{...e})}function e_({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 k=In(),S=Br(),C=ti(),j=qn(),A=v.useRef(null),L=v.useRef(null),[M,z]=v.useState(null),V=q2(k.platform==="web"),F=k.platform==="web"&&V.keyboardOpen,I=t==="conversation-focus",_=Um({enabled:I,rootRef:A,suspended:F,resetKey:`${C.pathname}${C.search}`}),D=il({viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a}),P=Fm({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:h("shell.iosMoreAction")}),J=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(r_,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(i_,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(s_,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(o_,{}),onClick:f},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(a_,{}),onClick:b}],X=I?{"--mobile-conversation-tabbar-progress":_.progress.toFixed(4)}:void 0;Bm(A,L,I);function G(){const q=_m(C.pathname,C.search);if(!q){f();return}j(q,{replace:!0})}const te=i.jsx("nav",{ref:L,className:"mobile-workbench-tabbar","aria-label":h("shell.title"),hidden:F,children:J.map(q=>i.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":q.key===e,"aria-current":q.key===e?"page":void 0,onClick:()=>{q.key!==e&&S.trigger("selection"),q.onClick()},children:[i.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:q.icon}),i.jsx("span",{className:"mobile-workbench-tabbar-label",children:q.label})]},q.key))});return i.jsx(Om,{composerPortalTarget:I?M:null,children:i.jsxs("div",{ref:A,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":k.platform,"data-mobile-keyboard-open":F,"data-pane-layout":D,"data-tabbar-open":F?!1:I?_.isOpen:!0,"data-conversation-tabbar-state":I?_.state:"default",style:X,children:[P?i.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[i.jsxs("div",{className:"mobile-workbench-header-leading",children:[P.showBackButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":h("common.back"),onClick:G,children:i.jsx(t_,{})}):null,i.jsx("div",{className:"mobile-workbench-header-copy",children:i.jsx("h1",{children:P.title})})]}),i.jsx("div",{className:"mobile-workbench-header-actions",children:P.showMoreButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":P.moreButtonLabel,onClick:g,children:i.jsx(n_,{})}):null})]}):null,i.jsx("div",{className:"mobile-workbench-content",children:i.jsx(Wm,{viewportClass:k.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!a,navigationPanel:s,auxiliaryPanel:a,children:n})}),I?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:z,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:te})]}):te]})})}function t_(){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 n_(){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 r_(){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 i_(){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 s_(){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 o_(){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 a_(){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 BS{constructor(t){He(this,"maxAttempts");He(this,"baseDelayMs");He(this,"reconnectAttempts",0);He(this,"reconnectTimer",null);He(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(!An.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 l_{constructor(t){He(this,"socket",null);He(this,"disposed",!1);He(this,"authRecoveryInFlight",!1);He(this,"pendingRefresh",!1);He(this,"fileTreeSubscription",null);He(this,"gitWorkspaceId",null);He(this,"terminalManagerWorkspaceId",null);He(this,"workspaceManagementWorkspaceId",null);He(this,"pendingFileTreeRefresh",null);He(this,"pendingGitRefreshWorkspaceId",null);He(this,"pendingTerminalManagerRefreshWorkspaceId",null);He(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);He(this,"fileTreeListeners",new Set);He(this,"gitListeners",new Set);He(this,"terminalManagerListeners",new Set);He(this,"workspaceManagementListeners",new Set);He(this,"connectionManager");this.options=t,this.connectionManager=new BS({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!fw(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,n){this.fileTreeSubscription={workspaceId:t,paths:mw(n)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,n){const s=mw(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=wn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Sx("/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,k,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"){(k=(b=this.options).onTerminalManagerSnapshot)==null||k.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"&&c_(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(),wn.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 fw(n)?(n.send(JSON.stringify(t)),!0):!1}}function fw(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function c_(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function mw(e){const t=new Set;for(const n of e??[""])t.add(n.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Rn(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 es(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 js,Dr,go,fc,Lc;const mr="__TAURI_TO_IPC_KEY__";function US(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class WS{constructor(t){js.set(this,void 0),Dr.set(this,0),go.set(this,[]),fc.set(this,void 0),es(this,js,t||(()=>{})),this.id=US(n=>{const s=n.index;if("end"in n){s==Rn(this,Dr,"f")?this.cleanupCallback():es(this,fc,s);return}const a=n.message;if(s==Rn(this,Dr,"f")){for(Rn(this,js,"f").call(this,a),es(this,Dr,Rn(this,Dr,"f")+1);Rn(this,Dr,"f")in Rn(this,go,"f");){const c=Rn(this,go,"f")[Rn(this,Dr,"f")];Rn(this,js,"f").call(this,c),delete Rn(this,go,"f")[Rn(this,Dr,"f")],es(this,Dr,Rn(this,Dr,"f")+1)}Rn(this,Dr,"f")===Rn(this,fc,"f")&&this.cleanupCallback()}else Rn(this,go,"f")[s]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){es(this,js,t)}get onmessage(){return Rn(this,js,"f")}[(js=new WeakMap,Dr=new WeakMap,go=new WeakMap,fc=new WeakMap,mr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[mr]()}}async function we(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class zS{get rid(){return Rn(this,Lc,"f")}constructor(t){Lc.set(this,void 0),es(this,Lc,t)}async close(){return we("plugin:resources|close",{rid:this.rid})}}Lc=new WeakMap;class La extends zS{constructor(t){super(t)}static async new(t,n,s){return we("plugin:image|new",{rgba:hi(t),width:n,height:s}).then(a=>new La(a))}static async fromBytes(t){return we("plugin:image|from_bytes",{bytes:hi(t)}).then(n=>new La(n))}static async fromPath(t){return we("plugin:image|from_path",{path:t}).then(n=>new La(n))}async rgba(){return we("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return we("plugin:image|size",{rid:this.rid})}}function hi(e){return e==null?null:typeof e=="string"?e:e instanceof La?e.rid:e}var Ic,Dc;function HS(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:HS(n));else if("action"in e&&e.action){const n=new WS;return n.onmessage=e.action,delete e.action,{...e,handler:n}}return e}async function Lo(e,t){const n=new WS;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=hi(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=hi(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=hi(a.item.About.icon)),"icon"in a&&a.icon&&(a.icon=hi(a.icon)),"items"in a&&a.items&&(a.items=a.items.map(s)),HS(a))};t.items=t.items.map(s)}return we("plugin:menu|new",{kind:e,options:t,handler:n})}class Io extends zS{get id(){return Rn(this,Ic,"f")}get kind(){return Rn(this,Dc,"f")}constructor(t,n,s){super(t),Ic.set(this,void 0),Dc.set(this,void 0),es(this,Ic,n),es(this,Dc,s)}}Ic=new WeakMap,Dc=new WeakMap;class zm extends Io{constructor(t,n){super(t,n,"MenuItem")}static async new(t){return Lo("MenuItem",t).then(([n,s])=>new zm(n,s))}async text(){return we("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return we("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return we("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return we("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return we("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class Hm extends Io{constructor(t,n){super(t,n,"Check")}static async new(t){return Lo("Check",t).then(([n,s])=>new Hm(n,s))}async text(){return we("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return we("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return we("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return we("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return we("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return we("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return we("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 qm extends Io{constructor(t,n){super(t,n,"Icon")}static async new(t){return Lo("Icon",t).then(([n,s])=>new qm(n,s))}async text(){return we("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return we("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return we("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return we("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return we("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return we("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:hi(t)})}}class $m extends Io{constructor(t,n){super(t,n,"Predefined")}static async new(t){return Lo("Predefined",t).then(([n,s])=>new $m(n,s))}async text(){return we("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return we("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}class Vm{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 is(this.width*t,this.height*t)}[mr](){return{width:this.width,height:this.height}}toJSON(){return this[mr]()}}class is{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 Vm(this.width/t,this.height/t)}[mr](){return{width:this.width,height:this.height}}toJSON(){return this[mr]()}}class yo{constructor(t){this.size=t}toLogical(t){return this.size instanceof Vm?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof is?this.size:this.size.toPhysical(t)}[mr](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[mr]()}}class Gm{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 Or(this.x*t,this.y*t)}[mr](){return{x:this.x,y:this.y}}toJSON(){return this[mr]()}}class Or{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 Gm(this.x/t,this.y/t)}[mr](){return{x:this.x,y:this.y}}toJSON(){return this[mr]()}}class ns{constructor(t){this.position=t}toLogical(t){return this.position instanceof Gm?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Or?this.position:this.position.toPhysical(t)}[mr](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[mr]()}}function Co([e,t,n]){switch(n){case"Submenu":return new Km(e,t);case"Predefined":return new $m(e,t);case"Check":return new Hm(e,t);case"Icon":return new qm(e,t);case"MenuItem":default:return new zm(e,t)}}class Km extends Io{constructor(t,n){super(t,n,"Submenu")}static async new(t){return Lo("Submenu",t).then(([n,s])=>new Km(n,s))}async text(){return we("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return we("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return we("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return we("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return we("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 we("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 we("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 we("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return we("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Co)}async items(){return we("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Co))}async get(t){return we("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?Co(n):null)}async popup(t,n){var s;return we("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 ns?t:t?new ns(t):null})}async setAsWindowsMenuForNSApp(){return we("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return we("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return we("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:hi(t)})}}class ko extends Io{constructor(t,n){super(t,n,"Menu")}static async new(t){return Lo("Menu",t).then(([n,s])=>new ko(n,s))}static async default(){return we("plugin:menu|create_default").then(([t,n])=>new ko(t,n))}async append(t){return we("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 we("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 we("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 we("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return we("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Co)}async items(){return we("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Co))}async get(t){return we("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?Co(n):null)}async popup(t,n){var s;return we("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 ns?t:t?new ns(t):null})}async setAsAppMenu(){return we("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new ko(t[0],t[1]):null)}async setAsWindowMenu(t){var n;return we("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 ko(s[0],s[1]):null)}}var Sr;(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"})(Sr||(Sr={}));async function qS(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await we("plugin:event|unlisten",{event:e,eventId:t})}async function $S(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 we("plugin:event|listen",{event:e,target:a,handler:US(t)}).then(c=>async()=>qS(e,c))}async function u_(e,t,n){return $S(e,s=>{qS(e,s.id),t(s)},n)}async function d_(e,t){await we("plugin:event|emit",{event:e,payload:t})}async function h_(e,t,n){await we("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}var iu;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(iu||(iu={}));class VS{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var If;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(If||(If={}));function bu(){return new Qm(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function _c(){return we("plugin:window|get_all_windows").then(e=>e.map(t=>new Qm(t,{skip:!0})))}const Ih=["tauri://created","tauri://error"];class Qm{constructor(t,n={}){var s;this.label=t,this.listeners=Object.create(null),n!=null&&n.skip||we("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 _c()).find(s=>s.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return bu()}static async getAll(){return _c()}static async getFocusedWindow(){for(const t of await _c())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)}:$S(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)}:u_(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(Ih.includes(t)){for(const s of this.listeners[t]||[])s({event:t,id:-1,payload:n});return}return d_(t,n)}async emitTo(t,n,s){if(Ih.includes(n)){for(const a of this.listeners[n]||[])a({event:n,id:-1,payload:s});return}return h_(t,n,s)}_handleTauriEvent(t,n){return Ih.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return we("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return we("plugin:window|inner_position",{label:this.label}).then(t=>new Or(t))}async outerPosition(){return we("plugin:window|outer_position",{label:this.label}).then(t=>new Or(t))}async innerSize(){return we("plugin:window|inner_size",{label:this.label}).then(t=>new is(t))}async outerSize(){return we("plugin:window|outer_size",{label:this.label}).then(t=>new is(t))}async isFullscreen(){return we("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return we("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return we("plugin:window|is_maximized",{label:this.label})}async isFocused(){return we("plugin:window|is_focused",{label:this.label})}async isDecorated(){return we("plugin:window|is_decorated",{label:this.label})}async isResizable(){return we("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return we("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return we("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return we("plugin:window|is_closable",{label:this.label})}async isVisible(){return we("plugin:window|is_visible",{label:this.label})}async title(){return we("plugin:window|title",{label:this.label})}async theme(){return we("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return we("plugin:window|is_always_on_top",{label:this.label})}async center(){return we("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===iu.Critical?n={type:"Critical"}:n={type:"Informational"}),we("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return we("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return we("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return we("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return we("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return we("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return we("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return we("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return we("plugin:window|maximize",{label:this.label})}async unmaximize(){return we("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return we("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return we("plugin:window|minimize",{label:this.label})}async unminimize(){return we("plugin:window|unminimize",{label:this.label})}async show(){return we("plugin:window|show",{label:this.label})}async hide(){return we("plugin:window|hide",{label:this.label})}async close(){return we("plugin:window|close",{label:this.label})}async destroy(){return we("plugin:window|destroy",{label:this.label})}async setDecorations(t){return we("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return we("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return we("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return we("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return we("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return we("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return we("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return we("plugin:window|set_size",{label:this.label,value:t instanceof yo?t:new yo(t)})}async setMinSize(t){return we("plugin:window|set_min_size",{label:this.label,value:t instanceof yo?t:t?new yo(t):null})}async setMaxSize(t){return we("plugin:window|set_max_size",{label:this.label,value:t instanceof yo?t:t?new yo(t):null})}async setSizeConstraints(t){function n(s){return s?{Logical:s}:null}return we("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 we("plugin:window|set_position",{label:this.label,value:t instanceof ns?t:new ns(t)})}async setFullscreen(t){return we("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return we("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return we("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return we("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return we("plugin:window|set_icon",{label:this.label,value:hi(t)})}async setSkipTaskbar(t){return we("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return we("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return we("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return we("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return we("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return we("plugin:window|set_cursor_position",{label:this.label,value:t instanceof ns?t:new ns(t)})}async setIgnoreCursorEvents(t){return we("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return we("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return we("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return we("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return we("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return we("plugin:window|set_overlay_icon",{label:this.label,value:t?hi(t):void 0})}async setProgressBar(t){return we("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return we("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return we("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return we("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(Sr.WINDOW_RESIZED,n=>{n.payload=new is(n.payload),t(n)})}async onMoved(t){return this.listen(Sr.WINDOW_MOVED,n=>{n.payload=new Or(n.payload),t(n)})}async onCloseRequested(t){return this.listen(Sr.WINDOW_CLOSE_REQUESTED,async n=>{const s=new VS(n);await t(s),s.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(Sr.DRAG_ENTER,l=>{t({...l,payload:{type:"enter",paths:l.payload.paths,position:new Or(l.payload.position)}})}),s=await this.listen(Sr.DRAG_OVER,l=>{t({...l,payload:{type:"over",position:new Or(l.payload.position)}})}),a=await this.listen(Sr.DRAG_DROP,l=>{t({...l,payload:{type:"drop",paths:l.payload.paths,position:new Or(l.payload.position)}})}),c=await this.listen(Sr.DRAG_LEAVE,l=>{t({...l,payload:{type:"leave"}})});return()=>{n(),a(),s(),c()}}async onFocusChanged(t){const n=await this.listen(Sr.WINDOW_FOCUS,a=>{t({...a,payload:!0})}),s=await this.listen(Sr.WINDOW_BLUR,a=>{t({...a,payload:!1})});return()=>{n(),s()}}async onScaleChanged(t){return this.listen(Sr.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(Sr.WINDOW_THEME_CHANGED,t)}}var gw;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(gw||(gw={}));var yw;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(yw||(yw={}));var Df;(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"})(Df||(Df={}));var _f;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(_f||(_f={}));function xu(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new Or(e.position),size:new is(e.size),workArea:{position:new Or(e.workArea.position),size:new is(e.workArea.size)}}}async function f_(){return we("plugin:window|current_monitor").then(xu)}async function m_(){return we("plugin:window|primary_monitor").then(xu)}async function p_(e,t){return we("plugin:window|monitor_from_point",{x:e,y:t}).then(xu)}async function g_(){return we("plugin:window|available_monitors").then(e=>e.map(xu))}async function y_(){return we("plugin:window|cursor_position").then(e=>new Or(e))}const v_=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:VS,get Effect(){return Df},get EffectState(){return _f},LogicalPosition:Gm,LogicalSize:Vm,PhysicalPosition:Or,PhysicalSize:is,get ProgressBarStatus(){return If},get UserAttentionType(){return iu},Window:Qm,availableMonitors:g_,currentMonitor:f_,cursorPosition:y_,getAllWindows:_c,getCurrentWindow:bu,monitorFromPoint:p_,primaryMonitor:m_},Symbol.toStringTag,{value:"Module"}));async function w_(e){if(e.length===0)return;await(await ko.new({items:e.map(n=>({id:n.id,text:n.label,enabled:!n.disabled,accelerator:n.accelerator,action:()=>{n.onSelect()}}))})).popup(void 0,bu())}const b_=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function Ym(e){return e instanceof HTMLElement?!e.closest(b_):!0}async function Xm(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await bu().startDragging()}const Pa=new Map;function GS(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function vw(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Ln(e,t){const n=Pa.get(e);if(n&&!vw(n.savedAt,t))return n.value;if(!GS())return null;const s=window.sessionStorage.getItem(e);if(!s)return null;try{const a=JSON.parse(s);return!a||vw(a.savedAt,t)?(window.sessionStorage.removeItem(e),Pa.delete(e),null):(Pa.set(e,a),a.value)}catch{return window.sessionStorage.removeItem(e),Pa.delete(e),null}}function Pr(e,t){const n={savedAt:Date.now(),value:t};if(Pa.set(e,n),!!GS())try{window.sessionStorage.setItem(e,JSON.stringify(n))}catch{}}const x_="codingns.debug.perf";function k_(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(x_)==="1"}catch{return!1}}function Ut(e,t){if(!k_()||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 S_(e,t,n,s){return Ke.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:n,expectedVersion:s??void 0})})}function C_(e){return Ke.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function j_(e){return Ke.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function N_(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Ke.request(`/api/files/download?${n.toString()}`)}function Ff(e,t,n=1,s=20){const a=new URLSearchParams({workspaceId:e,keyword:t,page:String(n),pageSize:String(s)});return Ke.request(`/api/files/search?${a.toString()}`)}function ww(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Ke.request(`/api/files/preview?${n.toString()}`)}function sl(e){var t,n;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((n=e.lastErrorDetail)!=null&&n.trim())}function Jm(e,t,n){const s=P_(t);return s==="running_inferred"?`${e} is-running-inferred`:`${e} is-${s.replace("_","-")}`}function su(e){return e.runningState==="stale"?h("conversation.runtimeStale"):e.runningState==="unknown"?h("conversation.runtimeUnknown"):null}function KS(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function P_(e){return sl(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?T_(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function T_(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}const bw=48;function E_(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function as(e,t){const n=E_(e)||t,s=n.length>bw?n.slice(0,bw).trimEnd():n;return{fullTitle:n,displayTitle:s}}const Dh=5,_h=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function QS(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function YS(e,t){const n=e.reduce((d,f)=>d+f.count,0);if(n<=0)return[];const a=e.slice(0,Dh).map((d,f)=>({...d,key:d.type,ratio:d.count/n,color:_h[f]??_h[0]})),c=e.slice(Dh);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:_h[Dh]}),a}function R_(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} ${xw(c)} ${xw(l)}`}).join(", ")})`}function XS(e){return{"--workbench-manage-chart-background":R_(e)}}function xw(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const JS="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=",ZS="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==",eC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",M_=[{provider:"codex"},{provider:"claude-code"},{provider:"opencode"}];function tC({disabled:e=!1,pendingProvider:t=null,onSelect:n}){const s=Br();return i.jsx("div",{className:"session-provider-grid",children:M_.map(a=>{const c=A_(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:L_(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 A_(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function L_(e){return e==="codex"?JS:e==="claude-code"?ZS:eC}const mc={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function nC({open:e,onClose:t,onCloned:n}){const{showToast:s}=Xn(),[a,c]=v.useState(!1),[l,d]=v.useState(mc),[f,p]=v.useState(!1),[y,g]=v.useState(!1),[b,k]=v.useState(null),[S,C]=v.useState(""),[j,A]=v.useState(""),[L,M]=v.useState(null),[z,V]=v.useState([]),[F,I]=v.useState([]),_=a||y;v.useEffect(()=>{!e&&!a&&(d(mc),p(!1),k(null))},[a,e]);const D=v.useCallback(async me=>{g(!0),k(null);try{const ne=await pk(me);C(ne.currentPath),A(ne.currentPath),M(ne.parentPath),V(ne.roots),I(ne.items),d(K=>({...K,parentPath:ne.currentPath}))}catch(ne){C(""),M(null),I([]),k(ne instanceof Error?ne.message:h("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function P(){a||(p(!1),k(null),d(mc),t())}function J(){p(!0),D(l.parentPath||void 0)}function X(){a||(p(!1),k(null))}async function G(me){me.preventDefault(),await D(j)}function te(){d(me=>({...me,parentPath:S})),p(!1),k(null)}async function q(me){me.preventDefault();const ne=l.repositoryUrl.trim(),K=l.parentPath.trim();if(!ne){s({title:h("shell.cloneRepoRequired"),tone:"error"});return}if(!K){s({title:h("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const ae=await ET({repositoryUrl:ne,parentPath:K,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(ae)),d(mc),p(!1),s({title:h("shell.cloneSuccess"),description:ae.path,tone:"success"}),t()}catch(ae){s({title:ae instanceof Error?ae.message:h("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return i.jsxs(i.Fragment,{children:[i.jsx(Nr,{open:e,title:h("shell.cloneWorkspaceTitle"),description:h("shell.cloneWorkspaceHint"),onClose:P,children:i.jsxs("form",{className:"workbench-clone-form",onSubmit:me=>void q(me),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:me=>d(ne=>({...ne,repositoryUrl:me.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:me=>d(ne=>({...ne,parentPath:me.target.value}))}),i.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:J,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:me=>d(ne=>({...ne,directoryName:me.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:me=>d(ne=>({...ne,name:me.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneAuthModeLabel")}),i.jsxs("select",{value:l.authMode,onChange:me=>d(ne=>({...ne,authMode:me.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:me=>d(ne=>({...ne,username:me.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:me=>d(ne=>({...ne,password:me.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:me=>d(ne=>({...ne,username:me.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:me=>d(ne=>({...ne,token:me.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(Nr,{open:e&&f,title:h("shell.cloneBrowserTitle"),description:h("shell.cloneBrowserDescription"),onClose:X,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:G,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:me=>A(me.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:_||!L,onClick:()=>{L&&D(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:z.map(me=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:_,onClick:()=>{D(me.path)},children:me.name},me.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(me=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:_,onClick:()=>{D(me.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:me.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:me.path})]},me.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:X,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:_||!S,onClick:te,children:h("shell.cloneBrowserSubmit")})]})]})]})}function rC({open:e,onClose:t,onImported:n}){const{showToast:s}=Xn(),[a,c]=v.useState(!1),[l,d]=v.useState(!1),[f,p]=v.useState(!1),[y,g]=v.useState(null),[b,k]=v.useState(""),[S,C]=v.useState(""),[j,A]=v.useState(null),[L,M]=v.useState([]),[z,V]=v.useState([]),[F,I]=v.useState(!1),[_,D]=v.useState(""),P=a||l||f,J=v.useCallback(async K=>{c(!0),g(null);try{const ae=await pk(K);k(ae.currentPath),C(ae.currentPath),A(ae.parentPath),M(ae.roots),V(ae.items)}catch(ae){k(""),A(null),V([]),g(ae instanceof Error?ae.message:h("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);v.useEffect(()=>{if(!e){I(!1),D(""),g(null);return}J(b||void 0)},[J,e]);function X(){P||(I(!1),D(""),t())}async function G(K){K.preventDefault(),await J(S)}function te(){!b||P||(D(""),I(!0))}function q(){l||(I(!1),D(""))}async function me(K){K==null||K.preventDefault();const ae=_.trim();if(!(!b||!ae||P)){d(!0),g(null);try{const E=await RT({parentPath:b,directoryName:ae});s({title:h("shell.importBrowserCreateDirectorySuccess"),description:E.path,tone:"success"}),I(!1),D(""),await J(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 ne(){const K=b.trim();if(!(!K||P)){p(!0),g(null);try{const ae=await TT({path:K});s({title:h("shell.importSuccess"),description:ae.path,tone:"success"}),t(),Promise.resolve().then(()=>n==null?void 0:n(ae)).catch(E=>{s({title:E instanceof Error?E.message:h("shell.navigationLoadFailed"),tone:"error"})})}catch(ae){s({title:ae instanceof Error?ae.message:h("shell.importFailed"),tone:"error"})}finally{p(!1)}}}return i.jsxs(i.Fragment,{children:[i.jsxs(Nr,{open:e,title:h("shell.importBrowserTitle"),description:h("shell.importBrowserDescription"),onClose:X,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:G,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:K=>C(K.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:P||!j,onClick:()=>{j&&J(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:te,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(K=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:P,onClick:()=>{J(K.path)},children:K.name},K.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")}):z.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:z.map(K=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:P,onClick:()=>{J(K.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:K.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:K.path})]},K.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:X,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:P||!b,onClick:()=>{ne()},children:h(f?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),i.jsx(Nr,{open:e&&F,title:h("shell.importBrowserCreateDirectoryTitle"),description:h("shell.importBrowserCreateDirectoryDescription"),onClose:q,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:K=>void me(K),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:K=>D(K.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:l,onClick:q,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:l||!_.trim(),children:h(l?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const kw="workbench.left.width",Sw="workbench.right.width",Cw="workbench.left.collapsed",jw="workbench.right.collapsed",Fh="workbench.last.session.path",Nw="workbench.workspace.collapsed.ids",Oh="workbench.workspace.selected.id",iC="workbench.navigation.snapshot",I_=280,D_=320,pc=208,Pw=520,Tw=560,__=200,Bh=20,gc=40,yc=5,F_=1800*1e3,Ew=60*1e3,O_=4e3,Rw=220,B_="workbench:focus-composer",U_=new Set(["starting","running","reconnecting","stale","unknown"]);function W_(e){return U_.has(e.runningState??"idle")||e.activityState==="running"}function z_(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<=Rw?s:`${s.slice(0,Rw-3)}...`:null}function Mw(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=Mn(f,e),y=(l=p==null?void 0:p.params.workspaceId)==null?void 0:l.trim();if(y)return y}const s=Ia(e),a=(s==null?void 0:s.sessionId)??null;return!a||!yC(a)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function H_(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function q_(e){return e==="mobile"?Xr():"/landing"}function Ia(e){var c,l,d;const t=Mn("/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=Mn("/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 $_(e){return!!(Mn("/sessions",e)||Mn("/workspaces/:workspaceId/sessions",e))}function Aw(e){return!!Ia(e)}function V_(e){return!!(Mn("/tools",e)||Mn("/tools/files",e)||Mn("/tools/git",e)||Mn("/tools/processes",e)||Mn("/workspaces/:workspaceId/tools",e)||Mn("/workspaces/:workspaceId/tools/files",e)||Mn("/workspaces/:workspaceId/tools/git",e)||Mn("/workspaces/:workspaceId/tools/processes",e))}function Lw(e){return!!(Mn("/terminals",e)||Mn("/workspaces/:workspaceId/terminals",e))}function G_(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const K_=v.lazy(async()=>({default:(await Za(()=>Promise.resolve().then(()=>w4),void 0)).FileContextPanel})),Q_=v.lazy(async()=>({default:(await Za(()=>Promise.resolve().then(()=>N4),void 0)).GitSidebar})),Y_=v.lazy(async()=>({default:(await Za(()=>Promise.resolve().then(()=>QB),void 0)).TerminalManagerPanel}));function X_(e){return!!(e!=null&&e.session)}function Ms(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function ka(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(X_):[]}const sC=v.createContext(null);function ou(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function Of(e){return e.isSubagent===!0}function Sa(e){return e.isArchived===!0}function Bf(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function J_(e,t){let n=e;const s=new Set([e.sessionId]);for(;;){const a=Bf(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 oC(e){const t=new Map(e.map(a=>[a.sessionId,a])),n=new Map,s=[];for(const a of e){const c=J_(a,t);if(c===a.sessionId){s.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...s].sort(ou).map(a=>({session:a,children:[...n.get(a.sessionId)??[]].sort(ou)}))}function Z_(e){return e.flatMap(t=>[t.session,...Ms(t)])}function Uh(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 Iw(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 eF(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function tF(e){return sl(e)||e.syncStatus==="error"}function nF(e){var s,a;if(!tF(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"&&!sl(e)?h("conversation.syncStatusError"):h("conversation.runtimeErrorTitle"))}function rF(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function ku(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 iF={position:"relative",zIndex:0},sF={zIndex:1};function aC(e,t,n){const s=[];n&&s.push(t.name);const a=eF(e);return a&&s.push(a),s.join(" · ")||t.name}function Dw(e,t){return Jm("session-state-indicator",e)}function _w(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 Fw(e,t){try{const n=window.localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function oF(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 aF(e){var t;try{const n=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return n||null}catch{return null}}function Ns(e,t){try{window.localStorage.setItem(e,t)}catch{}}function lF(e){try{window.localStorage.removeItem(e)}catch{}}function vc(e,t,n){return Math.max(t,Math.min(n,e))}function cF(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function uF(){typeof window>"u"||window.dispatchEvent(new CustomEvent(B_))}function Ow(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(ou)}))}function dF(){return Ln(iC,F_)}function hF(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(ou)}});return n?s:e}function fF(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 Bw(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 Uw(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 Uf(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function lC(e,t){const n=e.filter(s=>t.has(s));return n.length===e.length?e:n}function Wf(e){return`workspace-management.summary.${e}`}function cC(e){return`git-sidebar.snapshot.${e}`}function uC(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 dC(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 hC(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 fC({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 mF(){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(fC,{count:2,className:"workbench-skeleton-lines compact"})]},s))})]},t))})}function wc(){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(fC,{count:3})]},t))})}function pF({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 Ww({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(pF,{side:t,collapsed:n})})}function zw({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 gF(){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 yF(){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 vF(){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 wF(){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 bF(){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 xF(){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 mC(){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 Zm(){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 pC(){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 kF(){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 SF(){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 CF(){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 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:"6",width:"10",height:"12",rx:"2"}),i.jsx("path",{d:"M10 12h8"}),i.jsx("path",{d:"M15 8l4 4-4 4"})]})}function NF({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 gC({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 PF(){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 TF(){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 EF(){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 RF(){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 MF(){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 AF({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:k,onOpenSession:S}){const C=n.trim().length>0&&s.trim().length>0;return i.jsx(Nr,{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 A=as(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:A.fullTitle,children:A.displayTitle}),i.jsxs("span",{className:"workbench-search-result-meta",children:[j.workspace.name," · ",ku(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(),k()},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 bc({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:k,onToggleSubagents:S,onOpen:C,onRename:j,onToggleMenu:A,onToggleFavorite:L,onArchive:M,onCloseMenu:z,onContextMenu:V}){var me;const F=((me=t.subagentLabel)==null?void 0:me.trim())||(Of(t)?h("shell.subagentBadge"):null),I=as(t.title,h("common.unknown")),_=nF(t),D=_?rF(_):null,P=su(t),J=P?KS("session-activity-badge",t):null,X=v.useRef(null),[G,te]=v.useState(null);v.useLayoutEffect(()=>{if(!c){te(null);return}const ne=()=>{const K=X.current;if(!K)return;const ae=K.getBoundingClientRect();te({top:`${ae.bottom}px`,left:`${ae.right}px`})};return ne(),window.addEventListener("resize",ne),window.addEventListener("scroll",ne,!0),()=>{window.removeEventListener("resize",ne),window.removeEventListener("scroll",ne,!0)}},[c]);const q=c&&typeof document<"u"&&G?Bn.createPortal(i.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:ne=>ne.stopPropagation(),style:G,children:[i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{j(),z()},children:[i.jsx(TF,{}),i.jsx("span",{children:h("shell.renameAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{L(),z()},children:[i.jsx(gC,{active:a}),i.jsx("span",{children:h(a?"shell.unfavoriteAction":"shell.favoriteAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{M(),z()},children:[i.jsx(PF,{}),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":Of(t),"data-has-subagents":p,"data-selecting":g,"data-selected":b,onContextMenu:ne=>{g||!V||(ne.preventDefault(),V())},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(NF,{selected:b})}):p?i.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:sF,"aria-label":h(y?"shell.subagentCollapse":"shell.subagentExpand"),title:h(y?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":y,onClick:ne=>{ne.stopPropagation(),S==null||S()},children:[i.jsx("span",{className:Dw(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(RF,{}):i.jsx(Zm,{})})]}):i.jsx("span",{className:Dw(t),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("button",{type:"button",className:"workbench-session-link",style:p?iF:void 0,"data-active":s,"aria-pressed":g?b:void 0,onClick:g?k: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:I.fullTitle,children:I.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:aC(t,n,l)}),P&&J?i.jsx("span",{className:J,children:P}):null,i.jsx("span",{className:`session-provider-badge ${t.provider}`,children:ku(t.provider)})]}),D?i.jsx("div",{className:"session-error-row",title:_??void 0,children:i.jsx("span",{className:"session-error-text",children:D})}):null]})})]}),f&&!g?i.jsx("div",{className:"workbench-session-actions","data-open":c,children:i.jsx("button",{ref:X,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":h("shell.sessionMoreAction"),title:h("shell.sessionMoreAction"),"aria-expanded":c,onClick:ne=>{ne.stopPropagation(),A()},children:i.jsx(MF,{})})}):null,q]})}function Hw({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:k,onOpenSearch:S,onOpenSettings:C,onSelectWorkspace:j,onToggleWorkspaceCollapse:A,subscribeGitSnapshot:L,requestGitRefresh:M,subscribeWorkspaceManagementSnapshot:z,requestWorkspaceManagementRefresh:V,onToggleFavoriteSession:F,onArchiveSession:I,onUnarchiveSession:_,workspaceManagementStateById:D,setWorkspaceManagementStateById:P,onClose:J,onToggleCollapse:X}){var Nt;const G=qn(),te=In(),{showToast:q}=Xn(),me=v.useCallback(W=>{!te.isDesktop||te.ui.osFamily!=="macos"||W.button!==0||Ym(W.target)&&Xm()},[te.isDesktop,te.ui.osFamily]),[ne,K]=v.useState(!1),[ae,E]=v.useState(!1),[B,re]=v.useState(!1),[T,ke]=v.useState([]),[ge,Ee]=v.useState(null),[Be,Ye]=v.useState(null),[$e,rt]=v.useState(null),[ft,St]=v.useState(null),[Dt,Mt]=v.useState(null),[tt,Lt]=v.useState(null),[Tt,Et]=v.useState(null),[Ot,zt]=v.useState(Bh),[_t,Ze]=v.useState({}),[Bt,Ct]=v.useState({}),[sn,ue]=v.useState([]),[ye,Ae]=v.useState(null),[_e,ut]=v.useState(""),[Ge,Jt]=v.useState(null),[bt,mt]=v.useState(null),[At,lt]=v.useState([]),[Y,Me]=v.useState(!1),it=((Nt=e.find(W=>W.workspace.id===Dt))==null?void 0:Nt.workspace)??null,xt=e.find(W=>W.workspace.id===tt)??null,Vt=e.find(W=>W.workspace.id===bt)??null,Gt=v.useMemo(()=>Vt?Z_(ka(Vt)):[],[Vt]),Qt=v.useMemo(()=>Gt.map(W=>W.sessionId),[Gt]),Se=v.useMemo(()=>new Set(Qt),[Qt]),dt=v.useMemo(()=>new Set(At),[At]),Ht=Qt.length>0&&At.length===Qt.length;v.useEffect(()=>{P(W=>{const xe=new Set(e.map(ve=>ve.workspace.id)),R={};Object.entries(W).forEach(([ve,et])=>{xe.has(ve)&&(R[ve]=et)}),e.forEach(ve=>{const et=Ln(Wf(ve.workspace.id),Ew),pt=Ln(cC(ve.workspace.id),Ew),Yt=R[ve.workspace.id];let an=dC((Yt==null?void 0:Yt.detail)??et??uC(ve.workspace),ve.workspace);(pt!=null&&pt.status||pt!=null&&pt.branches)&&(an=hC(an,{workspaceId:ve.workspace.id,status:pt.status??null,branches:pt.branches??null})),R[ve.workspace.id]={detail:an,loading:!1,error:null}});const de=Object.keys(W),he=Object.keys(R);return de.length===he.length&&he.every(ve=>W[ve]===R[ve])?W:R})},[e]);const Zt=v.useCallback(async W=>{await y(),await te.bridge.showNotification(h("shell.importSuccess"),W.path)},[y,te.bridge]),cn=v.useCallback(async W=>{await y(),await te.bridge.showNotification(h("shell.cloneSuccess"),W.path)},[y,te.bridge]);function bn(W){if(T.includes(W)){ke(R=>R.filter(de=>de!==W));return}ke(R=>[...R,W]),L(W),M(W),z(W),V(W)}async function xn(){if(!(!ge||Be)){Ye(ge.id);try{await mk(ge.id),ke(W=>W.filter(xe=>xe!==ge.id)),P(W=>{const xe={...W};return delete xe[ge.id],xe}),Ee(null),await y(),q({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(W){q({title:W instanceof Error?W.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Ye(null)}}}v.useEffect(()=>{if(!Tt)return;function W(xe){const R=xe.target;R instanceof HTMLElement&&(R.closest(".workbench-session-actions")||R.closest(".workbench-session-menu"))||Et(null)}return window.addEventListener("pointerdown",W),()=>{window.removeEventListener("pointerdown",W)}},[Tt]),v.useEffect(()=>{if(!bt){At.length>0&<([]);return}if(!Vt){mt(null),lt([]);return}lt(W=>lC(W,Se))},[Vt,Se,bt,At.length]),v.useEffect(()=>{bt&&Qt.length===0&&(mt(null),lt([]))},[Qt.length,bt]),v.useEffect(()=>{const W=new Set(e.map(xe=>xe.workspace.id));ke(xe=>xe.filter(R=>W.has(R))),Ee(xe=>xe&&W.has(xe.id)?xe:null)},[e]),v.useEffect(()=>{const W=t.findIndex(xe=>xe.session.sessionId===p);zt(xe=>{const R=Uh(t.length,Bh,xe,W);return R===xe?xe:R})},[p,t]),v.useEffect(()=>{Ze(W=>{const xe={};for(const R of e){const de=ka(R),he=de.findIndex(ve=>ve.session.sessionId===p||Ms(ve).some(et=>et.sessionId===p));xe[R.workspace.id]=Uh(de.length,gc,W[R.workspace.id],he)}return Iw(W,xe)?W:xe})},[p,e]),v.useEffect(()=>{Ct(W=>{const xe={};for(const R of e)for(const de of ka(R)){const he=Ms(de);if(he.length===0)continue;const ve=he.findIndex(et=>et.sessionId===p);xe[de.session.sessionId]=Uh(he.length,yc,W[de.session.sessionId],ve)}return Iw(W,xe)?W:xe})},[p,e]),v.useEffect(()=>{if(!p)return;const W=e.flatMap(xe=>ka(xe).filter(R=>Ms(R).some(de=>de.sessionId===p)).map(R=>R.session.sessionId));W.length!==0&&ue(xe=>{const R=new Set(xe);let de=!1;for(const he of W)R.has(he)||(R.add(he),de=!0);return de?Array.from(R):xe})},[p,e]);function $(){K(!0)}function ee(){E(!0)}function le(W){return Bt[W]??yc}function be(W){return sn.includes(W)}function Ce(W){return _t[W]??gc}function Fe(){zt(W=>Math.min(t.length,W+Bh))}function Xe(W,xe){Ze(R=>({...R,[W]:Math.min(xe,(R[W]??gc)+gc)}))}function Ue(W){Ct(xe=>({...xe,[W]:(xe[W]??yc)+yc}))}function We(W){ue(xe=>xe.includes(W)?xe.filter(R=>R!==W):[...xe,W])}function Oe(W){for(const xe of e){const R=oC(xe.visibleSessions).find(de=>de.session.sessionId===W);if(R)return Ms(R)}return[]}function De(W){Et(null),mt(W),lt([])}function at(){mt(null),lt([])}function ht(W){lt(xe=>Uf(xe,W))}function en(){lt(W=>W.length===Qt.length?[]:Qt)}async function Rt(W,xe){rt(W),St(xe);try{Mt(null),G(LS(W,xe)),J==null||J()}catch(R){q({title:R instanceof Error?R.message:h("shell.startSessionFailed"),tone:"error"})}finally{rt(null),St(null)}}async function ze(W){const xe=n.has(W);Et(null);try{await F(W),q({title:h(xe?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(R){q({title:R instanceof Error?R.message:h("shell.favoriteToggleFailed"),tone:"error"})}}async function se(W){Et(null);try{await I(W),q({title:h("shell.archiveAdded"),tone:"success"})}catch(xe){q({title:xe instanceof Error?xe.message:h("shell.navigationLoadFailed"),tone:"error"})}}async function je(){if(!(At.length===0||Y)){Et(null),Me(!0);try{const W=[...At],xe=await Promise.allSettled(W.map(async he=>({sessionId:he,session:await yk(he,!0)}))),R=[];let de=0;for(const he of xe){if(he.status==="fulfilled"){R.push(he.value.sessionId),g(he.value.session);continue}de+=1}R.length>0&&(await y(),lt(he=>he.filter(ve=>!R.includes(ve)))),de>0?q({title:R.length>0?h("shell.batchArchivePartialFailed"):h("shell.batchArchiveFailed"),tone:"error"}):q({title:h("shell.batchArchiveSuccess"),tone:"success"})}catch(W){q({title:W instanceof Error?W.message:h("shell.batchArchiveFailed"),tone:"error"})}finally{Me(!1)}}}async function Qe(W){Et(null);try{await _(W),q({title:h("shell.archiveRestored"),tone:"success"})}catch(xe){q({title:xe instanceof Error?xe.message:h("shell.navigationLoadFailed"),tone:"error"})}}function st(W,xe){Et(null),Ae({session:W,workspace:xe}),ut(W.title)}async function O(W){if(W.preventDefault(),!ye)return;const xe=_e.trim();if(xe){Jt(ye.session.sessionId);try{const R=await gk(ye.session.sessionId,xe);g(R),Ae(null),ut(""),q({title:h("shell.renameSuccess"),tone:"success"})}catch(R){q({title:R instanceof Error?R.message:h("shell.renameFailed"),tone:"error"})}finally{Jt(null)}}}async function pe(W){if(!te.isDesktop)return;const xe=n.has(W.session.sessionId);await w_([{id:`open-${W.session.sessionId}`,label:h("shell.contextOpenSession"),onSelect:()=>{G(Hn(W.workspace.id,W.session.sessionId)),J==null||J()}},{id:`rename-${W.session.sessionId}`,label:h("shell.renameAction"),onSelect:()=>st(W.session,W.workspace)},{id:`favorite-${W.session.sessionId}`,label:h(xe?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>ze(W.session.sessionId)},{id:`archive-${W.session.sessionId}`,label:h("shell.archiveAction"),onSelect:()=>{se(W.session.sessionId)}}])}const Ne=t.slice(0,Ot),kt=Ne.length<t.length;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:me,children:i.jsxs("div",{className:"workbench-nav-toolbar",children:[X?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideSessionSidebar"),title:h("shell.hideSessionSidebar"),onClick:X,children:i.jsx(pC,{})}):null,i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>G(-1),children:i.jsx(mC,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>G(1),children:i.jsx(Zm,{})})]})}),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(bF,{}),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:k,children:[i.jsx(xF,{}),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(wF,{}),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(gC,{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:[Ne.map(W=>{const xe=Oe(W.session.sessionId),R=be(W.session.sessionId),de=R?xe.slice(0,le(W.session.sessionId)):[],he=R&&de.length<xe.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(bc,{menuKey:`favorite:${W.session.sessionId}`,session:W.session,workspace:W.workspace,isActive:W.session.sessionId===p,isFavorite:n.has(W.session.sessionId),menuOpen:Tt===`favorite:${W.session.sessionId}`,showWorkspaceName:!0,hasSubagents:xe.length>0,subagentListExpanded:R,onToggleSubagents:()=>We(W.session.sessionId),onOpen:()=>{G(Hn(W.workspace.id,W.session.sessionId)),J==null||J()},onRename:()=>st(W.session,W.workspace),onToggleMenu:()=>Et(ve=>ve===`favorite:${W.session.sessionId}`?null:`favorite:${W.session.sessionId}`),onToggleFavorite:()=>ze(W.session.sessionId),onArchive:()=>se(W.session.sessionId),onCloseMenu:()=>Et(null),onContextMenu:te.isDesktop?()=>{pe(W)}:void 0}),xe.length>0&&R?i.jsxs("div",{className:"workbench-subsession-list",children:[de.map(ve=>i.jsx(bc,{menuKey:`favorite:${ve.sessionId}`,session:ve,workspace:W.workspace,isActive:ve.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!0,depth:1,showActions:!1,onOpen:()=>{G(Hn(W.workspace.id,ve.sessionId)),J==null||J()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:te.isDesktop?()=>{pe({session:ve,workspace:W.workspace})}:void 0},ve.sessionId)),he?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ue(W.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},W.session.sessionId)}),kt?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:Fe,children:h("shell.favoriteExpandMore")}):null]})]}):null,d&&e.length===0?i.jsx(mF,{}):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:()=>re(!0),children:i.jsx(yF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.importWorkspaceTitle"),title:h("shell.importWorkspaceTitle"),onClick:$,children:i.jsx(gF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.cloneWorkspaceTitle"),title:h("shell.cloneWorkspaceTitle"),onClick:ee,children:i.jsx(kF,{})})]})]}),e.map(W=>{const xe=ka(W);return i.jsxs("section",{className:"workbench-workspace-group","data-batch-active":bt===W.workspace.id,children:[i.jsxs("div",{className:"workbench-workspace-header minimal",children:[i.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":W.isCollapsed?h("shell.workspaceExpand"):h("shell.workspaceCollapse"),onClick:()=>A(W.workspace.id),children:[i.jsx(zw,{expanded:!W.isCollapsed}),i.jsx("strong",{children:W.workspace.name})]}),bt===W.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:[At.length,"/",Qt.length]}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:en,children:h(Ht?"shell.clearSelectedSessions":"shell.selectAllSessions")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:At.length===0||Y,onClick:()=>{je()},children:h(Y?"shell.batchArchiving":"shell.batchArchiveAction")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:at,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===W.workspace.id,onClick:()=>{j(W.workspace.id),J==null||J()},children:i.jsx(jF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.batchSelectSessions"),title:h("shell.batchSelectSessions"),onClick:()=>De(W.workspace.id),children:i.jsx(CF,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":h("shell.createSession"),title:h("shell.createSession"),onClick:()=>Mt(W.workspace.id),children:i.jsx(vF,{})})]})]}),W.isCollapsed?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-session-list",children:[xe.length===0?i.jsx("p",{className:"workbench-session-empty",children:h("shell.emptyWorkspaceSessions")}):xe.slice(0,Ce(W.workspace.id)).map(R=>{const de=Ms(R),he=be(R.session.sessionId),ve=he?de.slice(0,le(R.session.sessionId)):[],et=he&&ve.length<de.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(bc,{menuKey:`workspace:${W.workspace.id}:${R.session.sessionId}`,session:R.session,workspace:W.workspace,isActive:R.session.sessionId===p,isFavorite:n.has(R.session.sessionId),menuOpen:Tt===`workspace:${W.workspace.id}:${R.session.sessionId}`,showWorkspaceName:!1,hasSubagents:de.length>0,subagentListExpanded:he,selectionMode:bt===W.workspace.id,selected:dt.has(R.session.sessionId),onToggleSelect:()=>ht(R.session.sessionId),onToggleSubagents:()=>We(R.session.sessionId),onOpen:()=>{G(Hn(W.workspace.id,R.session.sessionId)),J==null||J()},onRename:()=>st(R.session,W.workspace),onToggleMenu:()=>Et(pt=>pt===`workspace:${W.workspace.id}:${R.session.sessionId}`?null:`workspace:${W.workspace.id}:${R.session.sessionId}`),onToggleFavorite:()=>ze(R.session.sessionId),onArchive:()=>se(R.session.sessionId),onCloseMenu:()=>Et(null),onContextMenu:te.isDesktop?()=>{pe({session:R.session,workspace:W.workspace})}:void 0}),de.length>0&&he?i.jsxs("div",{className:"workbench-subsession-list",children:[ve.map(pt=>i.jsx(bc,{menuKey:`workspace:${W.workspace.id}:${pt.sessionId}`,session:pt,workspace:W.workspace,isActive:pt.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!1,depth:1,showActions:!1,selectionMode:bt===W.workspace.id,selected:dt.has(pt.sessionId),onToggleSelect:()=>ht(pt.sessionId),onOpen:()=>{G(Hn(W.workspace.id,pt.sessionId)),J==null||J()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:te.isDesktop?()=>{pe({session:pt,workspace:W.workspace})}:void 0},pt.sessionId)),et?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ue(R.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},R.session.sessionId)}),xe.length>Ce(W.workspace.id)?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Xe(W.workspace.id,xe.length),children:h("shell.sessionExpandMore")}):null]}),i.jsxs("button",{type:"button",className:"workbench-archive-folder",onClick:()=>Lt(W.workspace.id),children:[i.jsxs("span",{className:"workbench-archive-folder-main",children:[i.jsx(EF,{}),i.jsx("span",{children:h("shell.archiveFolderLabel")})]}),i.jsx("span",{className:"workbench-section-counter",children:W.archivedSessions.length})]})]})]},W.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(SF,{}),i.jsx("span",{className:"settings-entry-label",children:h("settings.title")})]})}),i.jsx(Nr,{open:B,title:h("shell.manageWorkspaceTitle"),description:h("shell.manageWorkspaceDescription"),onClose:()=>{Be||re(!1)},children:e.length>0?i.jsx("div",{className:"workbench-manage-list",children:e.map(W=>{var Yt;const xe=T.includes(W.workspace.id),R=D[W.workspace.id]??{detail:null,loading:!1,error:null},de=Be===W.workspace.id,he=(Yt=R.detail)!=null&&Yt.git.remotes.length?R.detail.git.remotes.map(an=>`${an.name}: ${an.url}`).join(" · "):h("shell.manageWorkspaceNoRemote"),ve=W.visibleSessions.length+W.archivedSessions.length,et=R.detail?YS(R.detail.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],pt=et.length>0?XS(et):void 0;return i.jsxs("article",{className:"workbench-manage-item",children:[i.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":xe,onClick:()=>bn(W.workspace.id),children:[i.jsxs("span",{className:"workbench-manage-item-heading",children:[i.jsx(zw,{expanded:xe}),i.jsx("strong",{children:W.workspace.name})]}),i.jsx("span",{className:"workbench-section-counter",children:ve})]}),xe?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:W.workspace.path})]}),R.loading&&R.detail===null?i.jsx("p",{className:"workbench-manage-status status-text",children:h("shell.manageWorkspaceLoading")}):null,R.error?i.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:R.error}):null,R.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:R.detail.git.commitCount??"--"})]})}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitInfoLabel")}),R.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:R.detail.git.repoRoot??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("span",{children:R.detail.git.currentBranch??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRemoteLabel")}),i.jsx("span",{children:he})]})]}):i.jsx("p",{className:"workbench-section-empty",children:R.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")}),et.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:pt,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:R.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:et.map(an=>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:an.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:an.type})]}),i.jsxs("span",{children:[an.count," · ",QS(an)]})]},an.key))})]}):i.jsx("p",{className:"workbench-section-empty",children:R.detail.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}),R.detail.codeComposition.truncated?i.jsx("p",{className:"workbench-manage-hint",children:h("shell.manageWorkspaceCodeTruncated",{count:R.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:!!Be,onClick:()=>Ee(W.workspace),children:h(de?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})})]}):null]},W.workspace.id)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.manageWorkspaceEmpty")})}),i.jsxs(Nr,{open:ge!==null,title:h("shell.manageWorkspaceRemoveConfirmTitle"),description:h("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{Be||Ee(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:ge?h("shell.manageWorkspaceRemoveConfirmTarget",{name:ge.name}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!Be,onClick:()=>Ee(null),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Be,onClick:()=>{xn()},children:h(Be?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),i.jsx(nC,{open:ae,onClose:()=>E(!1),onCloned:cn}),i.jsx(rC,{open:ne,onClose:()=>K(!1),onImported:Zt}),i.jsx(Nr,{open:it!==null,title:h("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:it?`${h("shell.createSessionTarget")} · ${it.name}`:h("shell.createSessionModalDescription"),onClose:()=>Mt(null),children:i.jsx(tC,{disabled:!!$e,pendingProvider:$e===(it==null?void 0:it.id)?ft??null:null,onSelect:W=>{it&&Rt(it.id,W)}})}),i.jsx(Nr,{open:xt!==null,title:h("shell.archiveModalTitle"),description:xt?`${xt.workspace.name} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription"),onClose:()=>Lt(null),children:xt&&xt.archivedSessions.length>0?i.jsx("div",{className:"workbench-archive-list",children:xt.archivedSessions.map(W=>{const xe=as(W.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:xe.fullTitle,children:xe.displayTitle}),i.jsxs("p",{children:[aC(W,xt.workspace,!1)," ·"," ",ku(W.provider)]})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Qe(W.sessionId),children:h("shell.unarchiveAction")})]},W.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})}),i.jsx(Nr,{open:ye!==null,title:h("shell.renameModalTitle"),description:h("shell.renameModalDescription"),onClose:()=>{Ge||(Ae(null),ut(""))},children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:O,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.renameInputLabel")}),i.jsx("input",{type:"text",value:_e,placeholder:h("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:W=>ut(W.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!Ge,onClick:()=>{Ae(null),ut("")},children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!_e.trim()||Ge===(ye==null?void 0:ye.session.sessionId),children:Ge===(ye==null?void 0:ye.session.sessionId)?h("shell.renamingSession"):h("common.save")})]})]})})]})}function qw({panelReady:e,activeTab:t,fileRevealRequest:n,onTabChange:s,onToggleCollapse:a,currentSessionId:c,activeWorkspaceId:l,navigationGroups:d}){var g;const f=l??((g=d[0])==null?void 0:g.workspace.id)??null,p=In(),y=v.useCallback(b=>{!p.isDesktop||p.ui.osFamily!=="macos"||b.button!==0||Ym(b.target)&&Xm()},[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:y,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(pC,{})}):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",onClick:()=>s("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",onClick:()=>s("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",onClick:()=>s("terminals"),children:h("shell.terminalManagerEntry")})]})]}),i.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:i.jsx(wc,{}),e&&t==="files"?l?i.jsx(v.Suspense,{fallback:i.jsx(wc,{}),children:i.jsx(K_,{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(wc,{}),children:i.jsx(Q_,{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(wc,{}),children:i.jsx(Y_,{currentWorkspaceId:l,navigationGroups:d})}):null]})]})}function LF({shellMode:e="desktop"}){var Ii,zr,cl;const t=ti(),n=qn(),s=In(),{showToast:a}=Xn(),c=Ti(H=>H.notificationPreferences.notifyOnPermissionRequest),l=Ti(H=>H.notificationPreferences.notifyOnSessionCompleted),d=Ti(H=>H.notificationPreferences.notifyOnSessionFailed),f=v.useRef(dF()),p=v.useRef(0),y=v.useRef((((zr=(Ii=f.current)==null?void 0:Ii.items)==null?void 0:zr.length)??0)>0),g=v.useRef(!1),b=v.useRef(null),k=v.useRef(0),S=v.useRef(null),C=v.useRef(null),j=v.useRef(new Set),A=v.useRef(new Set),L=v.useRef(new Set),M=v.useRef(new Set),z=v.useRef(null),V=v.useRef(null),F=v.useRef(null),I=v.useRef(null),_=v.useRef(null),D=v.useRef(null),P=v.useRef(null),J=v.useRef(null),X=v.useRef(a),G=v.useRef(s.bridge),te=v.useRef(!1),q=v.useRef(new Map),me=v.useRef(!1),ne=v.useRef(new Map),K=v.useRef([]),[ae,E]=v.useState(()=>Ow(f.current)),[B,re]=v.useState(()=>{var H,ie;return(((ie=(H=f.current)==null?void 0:H.items)==null?void 0:ie.length)??0)===0}),[T,ke]=v.useState(null),[ge,Ee]=v.useState(()=>vc(_w(kw,I_),pc,Pw)),[Be,Ye]=v.useState(()=>vc(_w(Sw,D_),pc,Tw)),[$e,rt]=v.useState(()=>Fw(Cw,!1)),[ft,St]=v.useState(()=>Fw(jw,!1)),[Dt,Mt]=v.useState(()=>oF(Nw)),[tt,Lt]=v.useState(()=>aF(Oh)),[Tt,Et]=v.useState(!1),[Ot,zt]=v.useState("files"),[_t,Ze]=v.useState(!1),[Bt,Ct]=v.useState(!1),[sn,ue]=v.useState({}),[ye,Ae]=v.useState(!1),[_e,ut]=v.useState("sessions"),[Ge,Jt]=v.useState(""),[bt,mt]=v.useState(""),[At,lt]=v.useState(!1),[Y,Me]=v.useState(null),[it,xt]=v.useState([]),[Vt,Gt]=v.useState(null),[Qt,Se]=v.useState({});v.useEffect(()=>{X.current=a},[a]),v.useEffect(()=>{G.current=s.bridge},[s.bridge]),v.useEffect(()=>{Ut("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),v.useEffect(()=>{var H,ie;Ut("workbench.cached_snapshot_loaded",{cached:!!f.current,workspaceCount:((H=f.current)==null?void 0:H.items.length)??0,sessionCount:((ie=f.current)==null?void 0:ie.items.reduce((qe,gt)=>qe+gt.sessions.length,0))??0})},[]);function dt(H){var ie;!H||!Array.isArray(H.items)||(Ut("workbench.apply_snapshot",{workspaceCount:H.items.length,sessionCount:H.items.reduce((qe,gt)=>qe+gt.sessions.length,0),currentSessionId:((ie=Ia(t.pathname))==null?void 0:ie.sessionId)??null}),Pr(iC,H),E(Ow(H)),ke(null))}const Ht=v.useCallback(async()=>{const H=p.current+1;p.current=H,re(ie=>ie||!y.current),Ut("workbench.refresh_navigation.start",{requestId:H,hasNavigationData:y.current});try{const ie=await PT();if(H!==p.current){Ut("workbench.refresh_navigation.stale",{requestId:H});return}dt(ie)}catch(ie){if(H!==p.current)return;ke(ie instanceof Error?ie.message:h("shell.navigationLoadFailed")),X.current({title:ie instanceof Error?ie.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{Ut("workbench.refresh_navigation.end",{requestId:H,success:H===p.current}),H===p.current&&re(!1)}},[]),Zt=v.useCallback(H=>{E(ie=>hF(ie,H))},[]),cn=v.useCallback(()=>{var H;(H=C.current)==null||H.requestRefresh()},[]),bn=v.useCallback((H,ie)=>{n(Hn(H,ie))},[n]),xn=v.useCallback((H,ie)=>{var qe;z.current={workspaceId:H,paths:ie},(qe=C.current)==null||qe.subscribeFileTree(H,ie)},[]),$=v.useCallback((H,ie)=>{var qe;V.current={workspaceId:H,paths:ie},(qe=C.current)==null||qe.requestFileTreeRefresh(H,ie)},[]),ee=v.useCallback(H=>(j.current.add(H),()=>{j.current.delete(H)}),[]),le=v.useCallback(H=>{var ie;F.current=H,(ie=C.current)==null||ie.subscribeGit(H)},[]),be=v.useCallback(H=>{var ie;I.current=H,(ie=C.current)==null||ie.requestGitRefresh(H)},[]),Ce=v.useCallback(H=>(A.current.add(H),()=>{A.current.delete(H)}),[]),Fe=v.useCallback(H=>{var ie;_.current=H,(ie=C.current)==null||ie.subscribeWorkspaceManagement(H)},[]),Xe=v.useCallback(H=>{var ie;D.current=H,Se(qe=>{var gt;return{...qe,[H]:{detail:((gt=qe[H])==null?void 0:gt.detail)??null,loading:!0,error:null}}}),(ie=C.current)==null||ie.requestWorkspaceManagementRefresh(H)},[]),Ue=v.useCallback(H=>(L.current.add(H),()=>{L.current.delete(H)}),[]),We=v.useCallback(H=>{var ie;P.current=H,(ie=C.current)==null||ie.subscribeTerminalManager(H)},[]),Oe=v.useCallback(H=>{var ie;J.current=H,(ie=C.current)==null||ie.requestTerminalManagerRefresh(H)},[]),De=v.useCallback(H=>(M.current.add(H),()=>{M.current.delete(H)}),[]),at=v.useCallback((H,ie)=>{E(qe=>fF(qe,H,ie??new Date().toISOString()))},[]),ht=v.useCallback(async(H,ie)=>{E(qe=>Bw(qe,H,ie));try{const qe=await yk(H,ie);Zt(qe),cn()}catch(qe){throw E(gt=>Bw(gt,H,!ie)),qe}},[cn,Zt]),en=v.useCallback((H,ie)=>{Ut("workbench.set_session_workspace",{sessionId:H,workspaceId:ie}),ue(qe=>{if(!ie){if(!(H in qe))return qe;const gt={...qe};return delete gt[H],gt}return qe[H]===ie?qe:{...qe,[H]:ie}})},[]);v.useEffect(()=>{y.current=ae.length>0},[ae]),v.useEffect(()=>{Ut("workbench.navigation_state",{navigationLoading:B,workspaceCount:ae.length,sessionCount:ae.reduce((H,ie)=>H+ie.sessions.length,0)})},[ae,B]),v.useEffect(()=>{S.current!==null&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{var Pt;S.current=null,!(g.current||y.current)&&(Ut("workbench.refresh_navigation.ws_fallback_triggered"),(Pt=C.current)==null||Pt.requestRefresh())},1200);const H=new l_({onConnectionChange:Pt=>{Pt==="reconnect_failed"&&!y.current&&(ke(h("shell.navigationLoadFailed")),X.current({id:"workbench-navigation-connection",title:h("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:Pt=>{g.current=!0,Ut("workbench.ws_snapshot_received",{workspaceCount:Pt.items.length,sessionCount:Pt.items.reduce((kn,yi)=>kn+yi.sessions.length,0)}),S.current!==null&&(window.clearTimeout(S.current),S.current=null),dt(Pt),re(!1)},onFileTreeSnapshot:Pt=>{j.current.forEach(kn=>kn(Pt))},onGitSnapshot:Pt=>{Pr(cC(Pt.workspaceId),{status:Pt.status,history:Pt.history,historyTotalCount:Pt.historyTotalCount,historyNextCursor:Pt.historyNextCursor,branches:Pt.branches}),Se(kn=>{var us;const yi=((us=ae.find(Uo=>Uo.workspace.id===Pt.workspaceId))==null?void 0:us.workspace)??null;if(!yi)return kn;const yr=kn[Pt.workspaceId],vi=hC(dC((yr==null?void 0:yr.detail)??uC(yi),yi),Pt);return Pr(Wf(Pt.workspaceId),vi),{...kn,[Pt.workspaceId]:{detail:vi,loading:!1,error:null}}}),A.current.forEach(kn=>kn(Pt))},onWorkspaceManagementSnapshot:Pt=>{Pr(Wf(Pt.workspaceId),Pt),Se(kn=>({...kn,[Pt.workspaceId]:{detail:Pt,loading:!1,error:null}})),L.current.forEach(kn=>kn(Pt))},onTerminalManagerSnapshot:Pt=>{M.current.forEach(kn=>kn(Pt))},onUnauthorized:()=>{wn.clear(),n("/login",{replace:!0})}});C.current=H;const ie=z.current,qe=V.current,gt=F.current,qt=I.current,Dn=_.current,ir=D.current,Un=P.current,rn=J.current;return ie&&H.subscribeFileTree(ie.workspaceId,ie.paths),gt&&H.subscribeGit(gt),Dn&&H.subscribeWorkspaceManagement(Dn),Un&&H.subscribeTerminalManager(Un),qe&&H.requestFileTreeRefresh(qe.workspaceId,qe.paths),qt&&H.requestGitRefresh(qt),ir&&H.requestWorkspaceManagementRefresh(ir),rn&&H.requestTerminalManagerRefresh(rn),H.start(),()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null),C.current===H&&(C.current=null),H.close()}},[n]),v.useEffect(()=>{Ns(kw,String(ge))},[ge]),v.useEffect(()=>{Ns(Sw,String(Be))},[Be]),v.useEffect(()=>{Ns(Cw,String($e))},[$e]),v.useEffect(()=>{Ns(jw,String(ft))},[ft]),v.useEffect(()=>{Ns(Nw,JSON.stringify(Dt))},[Dt]),v.useEffect(()=>{if(!tt){lF(Oh);return}Ns(Oh,tt)},[tt]),v.useEffect(()=>{if(Tt||ft)return;const H=window.setTimeout(()=>{Et(!0)},__);return()=>{window.clearTimeout(H)}},[Tt,ft]);const Rt=Ia(t.pathname),ze=(Rt==null?void 0:Rt.sessionId)??null,se=ze?yC(ze):!1,je=v.useMemo(()=>Im(ae),[ae]),Qe=v.useMemo(()=>new Set(Dt),[Dt]),st=v.useMemo(()=>je.filter(H=>H.session.isFavorite===!0).map(H=>H.session.sessionId),[je]),O=v.useMemo(()=>new Set(st),[st]);v.useEffect(()=>{const H=new Map;if(je.forEach(({session:ie})=>{H.set(ie.sessionId,{activityState:ie.activityState,completedAt:ie.completedAt??null,runningState:ie.runningState??null})}),!te.current){te.current=!0,q.current=H;return}je.forEach(({session:ie})=>{var ir;if(ie.sessionId===ze)return;const qe=q.current.get(ie.sessionId);if(!qe)return;const gt=qe.activityState!=="completed_unread"&&ie.activityState==="completed_unread",qt=((ir=ie.title)==null?void 0:ir.trim())||h("common.unknown");if(l&>){const Un=h("conversation.backgroundCompletionToastDescription",{title:qt});X.current({id:`workbench-session-completed-${ie.sessionId}-${ie.completedAt??"unknown"}`,title:h("conversation.backgroundCompletionToastTitle"),description:Un,tone:"success",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>bn(ie.workspaceId,ie.sessionId)}}),G.current.showNotification(h("conversation.backgroundCompletionToastTitle"),Un)}const Dn=qe.runningState!=="failed"&&(ie.runningState??null)==="failed";if(d&&Dn){const Un=z_(ie)??h("conversation.runtimeFailed"),rn=h("conversation.backgroundFailureToastDescription",{title:qt,detail:Un});X.current({id:`workbench-session-failed-${ie.sessionId}-${ie.updatedAt}`,title:h("conversation.backgroundFailureToastTitle"),description:rn,tone:"error",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>bn(ie.workspaceId,ie.sessionId)}}),G.current.showNotification(h("conversation.backgroundFailureToastTitle"),rn)}}),q.current=H},[ze,je,l,d,bn]),v.useEffect(()=>{K.current=je.map(H=>H.session).filter(H=>H.sessionId!==ze&&W_(H)).map(H=>{var ie;return{sessionId:H.sessionId,workspaceId:H.workspaceId,title:((ie=H.title)==null?void 0:ie.trim())||h("common.unknown")}})},[ze,je]),v.useEffect(()=>{let H=!1,ie=null;const qe=()=>{ie=window.setTimeout(()=>{gt().finally(()=>{H||qe()})},O_)},gt=async()=>{var Un;const qt=K.current;if(qt.length===0){me.current||(me.current=!0);return}(Un=C.current)==null||Un.requestRefresh();const Dn=new Set(qt.map(rn=>rn.sessionId)),ir=await Promise.all(qt.map(async rn=>{try{const Pt=await vk(rn.sessionId);return{session:rn,items:Pt.items}}catch{return{session:rn,items:null}}}));if(!H){for(const rn of ir){if(!rn.items)continue;const Pt=rn.items.filter(yr=>yr.status==="pending"),kn=new Set(Pt.map(yr=>yr.id)),yi=ne.current.get(rn.session.sessionId)??new Set;me.current&&Pt.forEach(yr=>{if(yi.has(yr.id)||!c)return;const vi=h("conversation.backgroundPermissionToastDescription",{title:rn.session.title,requestTitle:yr.title});X.current({id:`workbench-permission-request-${yr.id}`,title:h("conversation.permissionRequestToastTitle"),description:vi,tone:"warning",durationMs:8e3,action:{label:h("shell.contextOpenSession"),onClick:()=>bn(rn.session.workspaceId,rn.session.sessionId)}}),G.current.showNotification(h("conversation.permissionRequestToastTitle"),vi)}),ne.current.set(rn.session.sessionId,kn)}for(const[rn,Pt]of ne.current.entries())!Dn.has(rn)&&Pt.size===0&&ne.current.delete(rn);me.current=!0}};return gt().finally(()=>{H||qe()}),()=>{H=!0,ie!==null&&window.clearTimeout(ie)}},[c,bn]),v.useEffect(()=>{if(B&&ae.length===0)return;const H=new Set(ae.map(ie=>ie.workspace.id));Mt(ie=>lC(ie,H)),Lt(ie=>ie&&H.has(ie)?ie:null)},[ae,B]);const pe=je.find(H=>H.session.sessionId===ze)??null,Ne=(pe==null?void 0:pe.workspace.id)??(ze?sn[ze]??null:null),kt=Mw(t.pathname,t.search),Nt=Ne??kt??tt??null,W=Nt??((cl=ae[0])==null?void 0:cl.workspace.id)??null;v.useEffect(()=>{Ne&&Lt(H=>H===Ne?H:Ne)},[Ne]),v.useEffect(()=>{Ut("workbench.current_workspace_resolved",{currentSessionId:ze,sessionWorkspaceId:Ne,routeWorkspaceId:kt,currentWorkspaceId:W,source:Ne?pe?"navigation":"sessionWorkspaceMap":kt?"route":tt?"workspaceSelection":"navigationFallback"})},[pe,ze,W,kt,tt,Ne]),v.useEffect(()=>{Ut("workbench.info_panel_state",{infoPanelReady:Tt,rightCollapsed:ft,currentWorkspaceId:W,sessionWorkspaceId:Ne,currentSessionId:ze})},[ze,W,Tt,ft,Ne]);const xe=Lw(t.pathname)?"terminals":"conversation",R=e==="mobile",de=q_(e),he=v.useMemo(()=>ae.map(H=>({workspace:H.workspace,visibleSessions:H.sessions.filter(ie=>!Sa(ie)),archivedSessions:H.sessions.filter(ie=>Sa(ie)&&!Bf(ie)),visibleSessionTree:oC(H.sessions.filter(ie=>{if(Sa(ie))return!1;const qe=Bf(ie);if(!qe)return!0;const gt=H.sessions.find(qt=>qt.sessionId===qe);return!gt||!Sa(gt)})).filter(ie=>!O.has(ie.session.sessionId)&&!Ms(ie).some(qe=>O.has(qe.sessionId))),isCollapsed:Qe.has(H.workspace.id)})),[Qe,O,ae]),ve=v.useMemo(()=>je.filter(H=>O.has(H.session.sessionId)&&!Sa(H.session)&&!Of(H.session)),[O,je]),et=t.pathname.startsWith("/settings")?"settings":Lw(t.pathname)?"terminals":V_(t.pathname)?"tools":$_(t.pathname)||Aw(t.pathname)?"sessions":"workspaces",pt=R&&et==="sessions"&&Aw(t.pathname),Yt=il({viewportClass:s.viewportClass,activeEntry:et,hasNavigationPanel:R,hasAuxiliaryPanel:R}),an=R&&FS(Yt),ni=R&&OS(Yt),gr=v.useMemo(()=>ae.map(H=>H.workspace),[ae]),gi=v.useMemo(()=>{const H=Ge.trim().toLowerCase();return H?je.filter(ie=>{const qe=(ie.session.title||"").toLowerCase(),gt=ie.workspace.name.toLowerCase(),qt=ku(ie.session.provider,"full").toLowerCase();return qe.includes(H)||gt.includes(H)||qt.includes(H)}):[]},[je,Ge]);v.useEffect(()=>{var ie;const H=W??((ie=ae[0])==null?void 0:ie.workspace.id)??"";H&&mt(qe=>qe&&ae.some(qt=>qt.workspace.id===qe)?qe:H)},[W,ae]),v.useEffect(()=>{ze&&!se&&Ns(Fh,`${t.pathname}${t.search}`)},[ze,se,t.pathname,t.search]),v.useEffect(()=>{if(ze&&se){b.current=`${t.pathname}${t.search}`;return}ze&&!se&&(b.current=null)},[ze,se,t.pathname,t.search]),v.useEffect(()=>{R||(Ze(!1),Ct(!1))},[R]),v.useEffect(()=>{!R||B||!H_(t.pathname)||Nt||(Ze(!1),Ct(!1),n(de,{replace:!0}))},[Nt,R,t.pathname,n,B,de]);function Nu(){if(R){Ze(!0);return}rt(!1)}function Pu(){if(Ur(),R){Ct(!0);return}St(!1)}function _o(){if(R){Ze(H=>!H);return}rt(H=>!H)}function al(){if(Ur(),R){Ct(H=>!H);return}St(H=>!H)}function Ur(){Et(!0)}function ri(H){Lt(H),Ur(),ze&&Ne!==H&&n(de)}const Bs=v.useCallback(async H=>{var gt;const ie=((gt=je.find(qt=>qt.session.sessionId===H))==null?void 0:gt.session)??null,qe=(ie==null?void 0:ie.isFavorite)!==!0;E(qt=>Uw(qt,H,qe));try{const qt=await DT(H,qe);Zt(qt),cn()}catch(qt){throw E(Dn=>Uw(Dn,H,!qe)),qt}},[je,cn,Zt]),Us=v.useCallback((H,ie)=>{n(LS(H,ie))},[n]),tn=v.useCallback(H=>{var gt;const ie=((gt=H.workspaceId)==null?void 0:gt.trim())||W,qe=G_(H.filePath);return!ie||!qe?!1:(Ur(),zt("files"),R?(Ze(!1),Ct(!0)):St(!1),Gt({requestId:k.current+1,workspaceId:ie,filePath:qe,openViewer:H.openViewer===!0}),k.current+=1,!0)},[W,R]),Fo=v.useCallback(async(H,ie)=>{const qe=await gk(H,ie.trim());return Zt(qe),qe},[Zt]);function Ws(H){Ae(!0)}function zs(){Ae(!1),ut("sessions"),Jt(""),Me(null),xt([]),lt(!1)}async function ll(){const H=Ge.trim();if(!H||!bt.trim()){xt([]),Me(null);return}lt(!0),Me(null);try{const ie=await Ff(bt,H);xt(ie.items)}catch(ie){xt([]),Me(ie instanceof Error?ie.message:h("shell.searchCodeFailed"))}finally{lt(!1)}}function Oo(H,ie){const qe=H==="left"?ge:Be;function gt(Dn){const ir=Dn.clientX-ie;if(H==="left"){Ee(vc(qe+ir,pc,Pw));return}Ye(vc(qe-ir,pc,Tw))}function qt(){document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",qt)}document.addEventListener("mousemove",gt),document.addEventListener("mouseup",qt)}function ls(){if(cs())return;if(je.length===0){n(de);return}const H=Hn(je[0].workspace.id,je[0].session.sessionId);n(H)}function Bo(){if(!cs(W)){if(W){n(rl(W));return}n(de)}}function cs(H){if(ze)return H&&Ne&&Ne!==H?!1:(n(`${t.pathname}${t.search}`),!0);if(b.current){if(H){const[qe,gt=""]=b.current.split("?"),qt=Mw(qe??b.current,gt?`?${gt}`:"");if(qt&&qt!==H)return!1}return n(b.current),!0}const ie=typeof window>"u"?null:window.localStorage.getItem(Fh);if(ie){const qe=ie.split("?")[0]??ie,gt=Ia(qe);if(gt){const qt=gt.sessionId,Dn=je.find(rn=>rn.session.sessionId===qt)??null,ir=gt.workspaceId??(Dn==null?void 0:Dn.workspace.id)??null;if(Dn!==null&&(!H||ir===H))return n(ie),!0}window.localStorage.removeItem(Fh)}return!1}v.useEffect(()=>{if(typeof window>"u")return;function H(ie){if(!(ie.metaKey||ie.ctrlKey)){ie.key==="Escape"&&(Ze(!1),Ct(!1));return}if(cF(ie.target))return;const gt=ie.key.toLowerCase();if(!ie.shiftKey&>==="b"){ie.preventDefault(),_o();return}if(ie.shiftKey&>==="i"){ie.preventDefault(),al();return}if(!ie.shiftKey&>===","){ie.preventDefault(),n("/settings");return}if(!ie.shiftKey&>==="1"){ie.preventDefault(),ls();return}if(!ie.shiftKey&>==="2"){ie.preventDefault(),n(W?xo(W):Xr());return}if(!ie.shiftKey&>==="k"){ie.preventDefault(),uF();return}ie.shiftKey&>==="r"&&(ie.preventDefault(),Ht())}return window.addEventListener("keydown",H),()=>{window.removeEventListener("keydown",H)}},[n,Ht,R,ls]);const ii=v.useMemo(()=>({shellMode:e,navigationGroups:ae,navigationLoading:B,navigationError:T,currentWorkspaceId:W,currentSessionId:ze,favoriteSessionIds:st,favoriteSessions:ve,refreshNavigation:Ht,requestNavigationRefresh:cn,subscribeFileTree:xn,requestFileTreeRefresh:$,addFileTreeSnapshotListener:ee,subscribeGitSnapshot:le,requestGitRefresh:be,addGitSnapshotListener:Ce,subscribeWorkspaceManagementSnapshot:Fe,requestWorkspaceManagementRefresh:Xe,addWorkspaceManagementSnapshotListener:Ue,workspaceManagementStateById:Qt,subscribeTerminalManagerSnapshot:We,requestTerminalManagerRefresh:Oe,addTerminalManagerSnapshotListener:De,selectWorkspace:ri,toggleFavoriteSession:Bs,archiveSession:H=>ht(H,!0),unarchiveSession:H=>ht(H,!1),renameSession:Fo,startDraftSession:Us,markNavigationSessionSeen:at,upsertNavigationSession:Zt,setSessionWorkspace:en,revealWorkspaceFile:tn}),[ee,Ce,Ue,De,ht,ze,W,st,ve,ri,at,T,ae,B,$,be,Xe,Ht,cn,Oe,Fo,Qt,e,Us,en,xn,le,Fe,We,Bs,Zt,tn]),si={"--workbench-left-width":`${ge}px`,"--workbench-left-current-width":$e?"0px":`${ge}px`,"--workbench-right-width":`${Be}px`,"--workbench-right-current-width":ft?"0px":`${Be}px`},Wr=R?i.jsx(Hw,{workspaceGroups:he,favoriteSessions:ve,favoriteSessionIds:O,activeWorkspaceId:W,isConversationActive:xe==="conversation",isTerminalActive:xe==="terminals",isSearchOpen:ye,navigationLoading:B,navigationError:T,activeSessionId:ze,onRefreshNavigation:Ht,onSessionUpdated:Zt,onNavigateConversation:ls,onNavigateTerminals:()=>{Ze(!1),n(W?xo(W):Xr())},onOpenSearch:()=>{Ze(!1),Ws()},onOpenSettings:()=>{Ze(!1),n("/settings")},onSelectWorkspace:ri,onToggleWorkspaceCollapse:H=>Mt(ie=>Uf(ie,H)),subscribeGitSnapshot:le,requestGitRefresh:be,subscribeWorkspaceManagementSnapshot:Fe,requestWorkspaceManagementRefresh:Xe,onToggleFavoriteSession:Bs,onArchiveSession:H=>ht(H,!0),onUnarchiveSession:H=>ht(H,!1),workspaceManagementStateById:Qt,setWorkspaceManagementStateById:Se,onClose:()=>Ze(!1)}):null,Li=R?i.jsx(qw,{panelReady:Tt,activeTab:Ot,fileRevealRequest:Vt,onTabChange:H=>{Ur(),zt(H)},currentSessionId:se?null:ze,activeWorkspaceId:W,navigationGroups:ae}):null;return i.jsxs(sC.Provider,{value:ii,children:[R?i.jsx(i.Fragment,{children:i.jsx(Z2,{activeEntry:et,presentation:pt?"conversation-focus":"default",navigationPanel:Wr,auxiliaryPanel:Li,onOpenNavigation:()=>{Ct(!1),Ze(!0)},onOpenSearch:()=>{Ze(!1),Ct(!1),Ws()},onOpenAuxiliary:()=>{Ur(),Ze(!1),Ct(!0)},onNavigateWorkspaces:()=>{Ze(!1),Ct(!1),n(Xr())},onNavigateTerminals:()=>{Ze(!1),Ct(!1),n(W?xo(W):Xr())},onNavigateSessions:()=>{Ze(!1),Ct(!1),Bo()},onNavigateTools:()=>{Ze(!1),Ct(!1),n(W?Ao(W):Xr())},onNavigateToolFiles:()=>{Ze(!1),Ct(!1),n(W?MS(W):Xr())},onNavigateToolGit:()=>{Ze(!1),Ct(!1),n(W?AS(W):Xr())},onNavigateToolProcesses:()=>{Ze(!1),Ct(!1),n(W?wu(W):Xr())},onNavigateSettings:()=>{Ze(!1),Ct(!1),n("/settings")},children:i.jsx(wf,{})})}):i.jsx("div",{className:"workbench-shell",style:si,"data-nav-loading":B,"data-left-collapsed":$e,"data-right-collapsed":ft,"data-info-ready":Tt,"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":$e,children:i.jsx(Hw,{workspaceGroups:he,favoriteSessions:ve,favoriteSessionIds:O,activeWorkspaceId:W,isConversationActive:xe==="conversation",isTerminalActive:xe==="terminals",isSearchOpen:ye,navigationLoading:B,navigationError:T,activeSessionId:ze,onRefreshNavigation:Ht,onSessionUpdated:Zt,onNavigateConversation:ls,onNavigateTerminals:()=>n(W?xo(W):Xr()),onOpenSearch:()=>Ws(),onOpenSettings:()=>n("/settings"),onSelectWorkspace:ri,onToggleWorkspaceCollapse:H=>Mt(ie=>Uf(ie,H)),subscribeGitSnapshot:le,requestGitRefresh:be,subscribeWorkspaceManagementSnapshot:Fe,requestWorkspaceManagementRefresh:Xe,onToggleFavoriteSession:Bs,onArchiveSession:H=>ht(H,!0),onUnarchiveSession:H=>ht(H,!1),workspaceManagementStateById:Qt,setWorkspaceManagementStateById:Se,onToggleCollapse:()=>rt(!0)})}),i.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":$e,role:"separator","aria-label":h("shell.leftResizerLabel"),onMouseDown:$e?void 0:H=>Oo("left",H.clientX)}),i.jsxs("div",{className:"workbench-main-shell",children:[i.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!$e&&!ft,children:[i.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":$e,children:[i.jsx(Ww,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:Nu}),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(mC,{})}),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(Zm,{})})]}),i.jsx("div",{className:"workbench-collapsed-controls right","data-visible":ft,children:i.jsx(Ww,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:Pu})})]}),i.jsx(wf,{})]}),i.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":ft,role:"separator","aria-label":h("shell.rightResizerLabel"),onMouseDown:ft?void 0:H=>Oo("right",H.clientX)}),i.jsx("aside",{className:"workbench-auxiliary surface-card","data-collapsed":ft,children:i.jsx(qw,{panelReady:Tt,activeTab:Ot,fileRevealRequest:Vt,onTabChange:H=>{Ur(),zt(H)},onToggleCollapse:()=>St(!0),currentSessionId:se?null:ze,activeWorkspaceId:W,navigationGroups:ae})})]})}),i.jsx(AF,{open:ye,mode:_e,keyword:Ge,codeWorkspaceId:bt,codeResults:it,codeLoading:At,codeError:Y,workspaceOptions:gr,sessionResults:gi,onClose:zs,onModeChange:H=>{ut(H),Me(null),xt([])},onKeywordChange:H=>{Jt(H),_e==="code"&&!H.trim()&&(xt([]),Me(null))},onCodeWorkspaceChange:H=>mt(H),onCodeSearch:()=>{ll()},onOpenSession:H=>{zs();const ie=je.find(qe=>qe.session.sessionId===H)??null;n(ie?Hn(ie.workspace.id,H):Xr())}}),R?i.jsxs(i.Fragment,{children:[an?null:i.jsx($w,{isOpen:_t,side:"left",onClose:()=>Ze(!1),children:Wr}),ni?null:i.jsx($w,{isOpen:Bt,side:"right",onClose:()=>Ct(!1),children:Li})]}):null]})}function $w({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:Bn.createPortal(l,document.body)}function rr(){return v.useContext(sC)??{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 yC(e){return e.startsWith("draft-")}const IF=480,vC=v.createContext(!1);function zf(e){return e.replace(/\\/g,"/")}function au(e){return/^[a-zA-Z]:\//.test(e)}function DF(e){return e.startsWith("/")||e.startsWith("//")||au(e)}function _F(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!au(e)}function Vw(e){return e.replace(/\/+$/,"")}function FF(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 OF(e){const t=[];for(const n of zf(e).split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function ep(e){try{return decodeURIComponent(e)}catch{return e}}function BF(e,t){const n=ep(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(_F(s))return null;if(s=zf(FF(s.trim())),!s)return null;const a=Vw(zf(t.trim()));if(!a)return null;if(DF(s)){const c=Vw(s),l=au(a)?a.toLowerCase():a,d=au(c)?c.toLowerCase():c;if(d===l)return null;const f=`${l}/`;return d.startsWith(f)?c.slice(a.length+1):null}return OF(s)}function Hf(e){return e.kind==="tool_call"||e.kind==="tool_result"}function wC(e){return e.toolCall?e.toolCall:Hf(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 UF(e){return e==="shell_command"||e==="tool"?h("conversation.roleTool"):e}function bC(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 Ps(e,t){const n=e[t];return typeof n=="string"?n:""}function WF(e){if(e.name==="apply_patch")return u2(e.input);if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=bC(e.input);if(!t)return null;const n=Ps(t,"file_path")||Ps(t,"path");if(!n)return null;if(e.name==="Write"){const c=Ps(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=Ps(t,"old_string").split(/\r?\n/),l=Ps(t,"new_string").split(/\r?\n/);return Gw(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:Ps(l,"old_string").split(/\r?\n/),newLines:Ps(l,"new_string").split(/\r?\n/)}}).filter(c=>!!c);return a.length>0?Gw(n,a):null}function Gw(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 zF(e){const t=bC(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 HF(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 qF(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=>HF(n.messages)).filter(n=>!!n)}function $F(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n];if(!Hf(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(!Hf(d))break;a.push(d),c+=1}const l=qF(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 VF(e,t){if(!cE(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 GF(e){const t=e.split(/\r?\n/).map(n=>n.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):h("conversation.rulesMessageTitle")}function Ha(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>Ha(n)).join(""):e&&typeof e=="object"&&"props"in e?Ha(((t=e.props)==null?void 0:t.children)??""):""}function KF(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:Ha(n.children).replace(/\n$/,""),codeClassName:s||void 0,language:(a==null?void 0:a[1])??null}}function QF(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 xC(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(!QF(e))throw new Error(h("conversation.copyContentFailed"))}}function YF({className:e,children:t,onCopy:n}){const s=v.useContext(vC),a=Ha(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 XF({href:e,children:t,className:n,onInteract:s}){const a=Ha(t).trim()||(e?ep(e).trim():"");return i.jsx(vC.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 kC({language:e,codeClassName:t,content:n}){const{showToast:s}=Xn(),a=In(),c=(e==null?void 0:e.trim().toLowerCase())??null,l=c==="text",d=c||"code";async function f(){try{await xC(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 Fc({content:e,className:t}){const{showToast:n}=Xn(),s=In(),{navigationGroups:a,currentWorkspaceId:c,revealWorkspaceFile:l}=rr(),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 xC(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)?BF(y,d.path):null;b&&l({workspaceId:(d==null?void 0:d.id)??c,filePath:b,openViewer:!1})||f(g||(y?ep(y).trim():""))}return i.jsx("div",{className:t,children:i.jsx(Em,{remarkPlugins:[Lm],components:{p:({node:y,...g})=>i.jsx("p",{...g}),a(y){return i.jsx(XF,{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=KF(y.children);return g?i.jsx(kC,{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(YF,{className:g||void 0,onCopy:b=>{f(b)},children:y.children})}},children:e})})}function Kw(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function xc({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){return i.jsx(JF,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:s})}function JF({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){const[a,c]=v.useState({}),[l,d]=v.useState(null),f=v.useMemo(()=>n.map((b,k)=>{const S=Kw(b,t==null?void 0:t[k]);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,k)=>({id:`inline-image-${k}`,fileName:b.altText||`${h("conversation.imageAttachmentLabel")} ${k+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(k){k.key==="Escape"&&d(null)}return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[l]),v.useEffect(()=>{const b=n.filter((C,j)=>!Kw(C,t==null?void 0:t[j]));if(!e||b.length===0){c({});return}let k=!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 WT(e,C.id),A=URL.createObjectURL(j);return S.push(A),{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:A,status:"ready"}}catch{return{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"error"}}})).then(C=>{if(k){S.forEach(j=>URL.revokeObjectURL(j));return}c(Object.fromEntries(C.map(j=>[j.id,j])))}),()=>{k=!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 k=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} - ${k}`,title:k,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 ZF(){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 eO({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:Qw(a.action)}),i.jsx("span",{className:"apply-patch-summary-file",title:Wh(a),children:d2(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]})]})]},Yw(a,c)))}),n!==null&&typeof document<"u"?Bn.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:Qw(a.action)}),i.jsx("strong",{children:Wh(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 ${nO(c.kind)}`,children:[i.jsx("span",{className:"apply-patch-line-number",children:Xw(c.oldLineNumber)}),i.jsx("span",{className:"apply-patch-line-number",children:Xw(c.newLineNumber)}),i.jsx("span",{className:"apply-patch-line-content",children:c.text||" "})]},`${Wh(a)}:${l}`))})})]},Yw(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 tO({group:e}){const[t,n]=v.useState(!1),{tool:s,hasRequest:a,hasResult:c}=e,l=UF(s.name),d=v.useMemo(()=>WF(s),[s.input,s.name]);if(d)return i.jsx(eO,{tool:s,preview:d});const f=zF(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 Qw(e){return h(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Wh(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function Yw(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function nO(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function Xw(e){return e===null||e<=0?"":String(e)}function rO({message:e,tone:t,onRetry:n}){const[s,a]=v.useState(!1),c=GF(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(Fc,{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 iO({message:e,provider:t,onRetry:n}){const s=e.role==="user",a=e.kind==="thinking",c=e.role==="assistant"&&e.kind==="text",l=VF(t,e.content),d=v.useMemo(()=>Wa(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(rO,{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(xc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f?i.jsx(Fc,{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(xc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f&&i.jsx(Fc,{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(xc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f&&i.jsx(Fc,{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(xc,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),f?i.jsx("div",{className:"message-text message-content",children:i.jsx(kC,{language:"text",content:f})}):null]})})}function SC({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:s=!1,hasOlderMessages:a=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:l,provider:d}){const{showToast:f}=Xn(),p=v.useRef(null),y=v.useRef(e),g=v.useRef(t.length),b=v.useRef(zh(t.at(-1)??null)),k=v.useRef(!0),S=v.useRef(null),C=v.useRef(!1),j=$F(t),A=n==="loading"&&t.length===0;function L(z){return C.current||!a||s||n!=="ready"||z.scrollTop>IF?!1:(C.current=!0,S.current=z.scrollHeight-z.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,k.current=!0,S.current=null)},[e]),v.useLayoutEffect(()=>{const z=p.current;if(!z){g.current=t.length,b.current=zh(t.at(-1)??null);return}const V=g.current,F=b.current,I=zh(t.at(-1)??null);S.current!==null&&t.length>=V?(z.scrollTop=Math.max(0,z.scrollHeight-S.current),S.current=null):k.current&&(V===0||t.length!==V||I!==F)&&(z.scrollTop=z.scrollHeight),g.current=t.length,b.current=I},[t,e]),v.useEffect(()=>{if(!a){C.current=!1;return}!s&&S.current===null&&(C.current=!1)},[a,s,t.length]);function M(){const z=p.current;if(!z)return;const V=z.scrollHeight-z.clientHeight-z.scrollTop;k.current=V<=80,L(z)}return v.useEffect(()=>{const z=p.current;z&&L(z)},[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:M,children:[A?i.jsx(ZF,{}):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(z=>z.type==="tool_group"?i.jsx("article",{className:"message-item tool-message-row",children:i.jsx(tO,{group:z.group})},z.key):i.jsx(iO,{message:z.message,provider:d,onRetry:l},z.key))]})]})}function zh(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 sO({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,k;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&&!!((k=l.summary)!=null&&k.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:aO(l.provider),alt:"",loading:"lazy"})}),i.jsxs("div",{className:"permission-request-provider-copy",children:[i.jsx("strong",{children:l.title}),i.jsx("span",{children:oO(l.provider)})]})]}),i.jsx("span",{className:"permission-request-kind",children:lO(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:cO(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 A;const j=((A=d[S.id])==null?void 0:A.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 oO(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function aO(e){return e==="codex"?JS:e==="claude-code"?ZS:eC}function lO(e){return h(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function cO(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function uO({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 dO(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function CC({session:e}){const t=In(),n=v.useCallback(c=>{!t.isDesktop||t.ui.osFamily!=="macos"||c.button!==0||Ym(c.target)&&Xm()},[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=as(e.title,h("conversation.titleFallback")),a=dO(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 hO{constructor(t){He(this,"socket",null);He(this,"disposed",!1);He(this,"authRecoveryInFlight",!1);He(this,"latestCursor");He(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new BS({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=wn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Sx("/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(),wn.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 Jw(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 jC(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 NC(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 Ca(e,t,n){const s=new Map;for(const a of e)s.set(a.id,a);for(const a of n){const c=jC(t,a),l=RO(s,c);if(l&&l!==c.id)continue;const d=EO(s,c);d&&d!==c.id&&s.delete(d);const f=s.get(a.messageId)??null;s.set(a.messageId,f?vO(f,c):c)}return PC(Array.from(s.values()))}function Zw(e,t,n,s){const a=s===null?null:e.find(f=>f.clientRequestId===s)??null,c=e.filter(f=>f.clientRequestId!==s),l=jC(t,n,"sent",s),d=yO(l,a);return PC([...c.filter(f=>f.id!==d.id),d])}function qf(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function fO(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!bO(s,n)){t.push(n);continue}t[t.length-1]=SO(s,n)}return t}function mO(e){const t=[];let n=null,s=!1;for(const a of e)if(!xO(n,a,s)){if(t.push(a),qa(a)){n=a,s=!1;continue}n&&$f(a)&&(s=!0)}return t}function pO(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!TC(s,n)){t.push(n);continue}t[t.length-1]=EC(s,n)}return t}function gO(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];kO(s,a,c,l)&&t.splice(t.length-3,3,EC(a,l))}return t}function PC(e){const t=[...e].sort((n,s)=>n.sequence!==s.sequence?n.sequence-s.sequence:n.timestamp.localeCompare(s.timestamp));return mO(gO(pO(fO(t))))}function yO(e,t){if(!t||!wO(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 vO(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return Vf(e,t);const n=CO(e.toolCall,t.toolCall),s=NO(e.content,t.content,e.timestamp,t.timestamp),a=PO(e.attachments,t.attachments);return{...Vf(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 wO(e,t){return Su(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function bO(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=Wa(e.content),s=Wa(t.content);return AO(e.timestamp,t.timestamp)&&Yn(n.text)===Yn(s.text)&&TO(n.inlineImages,s.inlineImages)}function xO(e,t,n){return!e||n||!qa(e)||!qa(t)?!1:tp(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function qa(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function $f(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function TC(e,t){return $f(e)&&$f(t)&&tp(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function kO(e,t,n,s){return!e||!t||!n||!s||!qa(e)||!qa(n)?!1:TC(t,s)&&tp(e.timestamp,n.timestamp,120*1e3)&&Yn(e.content)===Yn(n.content)}function EC(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=Yn(e.content).length,c=Yn(t.content).length;return a!==c?a>c?e:t:Vf(e,t)}function SO(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=Wa(e.content).inlineImages.length,c=Wa(t.content).inlineImages.length;if(a!==c)return a>c?e:t;const l=e.content!==Yn(e.content),d=t.content!==Yn(t.content);return l!==d?l?t:e:t}function CO(e,t){return e?t?{...jO(e,t),input:RC(e.input,t.input),output:tb(e.output,t.output),error:tb(e.error,t.error)}:e:t}function jO(e,t){const n=eb(e.status),s=eb(t.status);return s!==n?s>n?t:e:t}function eb(e){return e==="running"?0:1}function NO(e,t,n,s){const a=Yn(e),c=Yn(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 PO(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 RC(e,t){return t.length>e.length?t:e}function tb(e,t){return e===null?t:t===null?e:RC(e,t)}function Vf(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 Yn(e){return e.replace(/\r\n/g,`
|
|
106
|
-
`).trimEnd()}function TO(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 EO(e,t){return AC(t)?MC(e,t,"optimistic"):null}function RO(e,t){return Su(t)?MC(e,t,"authoritative"):null}function MC(e,t,n){const s=Po(t.timestamp),a=Yn(t.content);let c=null,l=Number.POSITIVE_INFINITY;for(const[d,f]of e.entries()){if(!(n==="optimistic"?Su(f):AC(f))||Yn(f.content)!==a)continue;const y=Po(f.timestamp),g=Math.abs(y-s);g>300*1e3||g<l&&(c=d,l=g)}return c}function Su(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 AC(e){return e.role==="user"&&e.kind==="text"&&!Su(e)}function Po(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function MO(e){return e.reduce((n,s)=>Number.isFinite(s.sequence)&&s.sequence>n?s.sequence:n,0)+1}function AO(e,t){return Math.abs(Po(e)-Po(t))<=1e3}function tp(e,t,n){return Math.abs(Po(e)-Po(t))<=n}const Gf=30,LC=40,nb=300*1e3,LO=600,IO=5e3,DO=1e4;function Hh(){const e=ei.getState().profile.defaultPermissionMode;return e==="default"?null:e}class _O{constructor(t,n={}){He(this,"state");He(this,"listeners",new Set);He(this,"realtimeClient",null);He(this,"historyBootstrapReadyTimer",null);He(this,"historyBootstrapFallbackTimer",null);He(this,"historyBootstrapEnvelopeReceived",!1);He(this,"markSeenTimer",null);He(this,"markSeenInFlight",!1);He(this,"lastMarkSeenRequestAt",0);He(this,"seenWatermark",null);He(this,"runtimeRefreshTimer",null);He(this,"runtimeRefreshMode",null);He(this,"replaceSnapshotSeedOnBackfill",!1);He(this,"hasAuthoritativeBootstrapMessages");He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);var l;this.sessionId=t,this.options=n;const s=Ln(Gh(t),nb);this.hasAuthoritativeBootstrapMessages=(((l=n.bootstrapMessages)==null?void 0:l.length)??0)>0;const a=kc(n.initialSession??null,(s==null?void 0:s.session)??null),c=Ca((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=Jw({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=Ca(this.state.messages,this.sessionId,t),s=this.hasAuthoritativeBootstrapMessages;this.patch({messages:n,historyState:FO(this.state.session,s?n.length:0),loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:Ts(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=Ln(Gh(this.sessionId),nb);this.state=Jw({session:kc(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:Ca((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=kc(this.state.session,t);n!==this.state.session&&this.patch({session:n,hasOlderMessages:Ts(n,this.state.messages.length)})}async sendMessage(t,n){const s=ab(),a=NC(this.sessionId,t,s,(n==null?void 0:n.attachmentMeta)??[],(n==null?void 0:n.attachments)??[],MO(this.state.messages));this.patch({messages:[...this.state.messages,a],session:ui(this.state.session,"running"),runtimeHasActiveRun:lb(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:cb(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,s,n);this.patch({messages:Zw(this.state.messages,this.sessionId,c.message,s)})}catch(c){throw this.patch({messages:qf(this.state.messages,s),session:ui(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:lb(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:cb(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:Zw(this.state.messages,this.sessionId,s.message,t)})}catch(s){throw this.patch({messages:qf(this.state.messages,t),session:ui(this.state.session,"failed")}),s}}}async enqueueMessage(t,n){const s=ab();try{const a=await VT(this.sessionId,{content:t,clientRequestId:s,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:Hh(),attachments:(n==null?void 0:n.attachments)??[]});this.patch({queuedMessages:WO(this.state.queuedMessages,a)}),await this.refreshQueue()}catch(a){throw a}}async deleteQueuedMessage(t){await GT(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await KT(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await QT(this.sessionId),this.patch({session:ui(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 YT(this.sessionId,t,n);this.patch({permissionRequests:Kh(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,Gf)))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=wn.getState().session)==null?void 0:n.accessToken)){wn.clear();return}this.realtimeClient=new hO({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:LC,onSubscribed:()=>{this.patch({connectionState:"connected",historyState:this.state.historyState==="loading"&&np(this.state.session)===0?"ready":this.state.historyState,hasOlderMessages:Ts(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)?ui(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:Ts(this.state.session,a.length),pagesLoaded:s.type==="session.backfill"?Math.max(this.state.pagesLoaded,a.length>0?1:0):this.state.pagesLoaded,session:ui(this.state.session,ob(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:()=>{wn.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=Ca(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(LO,n);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const a=this.getTargetSeenAt();a!==null&&(Ut("session_seen.start",{sessionId:this.sessionId,targetSeenAt:a,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),IT(this.sessionId).then(()=>{var c,l;this.bumpSeenWatermark(a),this.patch({session:rb(this.state.session,a)}),(l=(c=this.options).onSeen)==null||l.call(c,this.sessionId,a),Ut("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{Ut("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:Ts(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 UT(this.sessionId,null,Gf,"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:Ts(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,Ut("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"?DO:1200))}async refreshRuntimeState(t,n){var s,a,c,l,d;Ut("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 ov(this.sessionId);this.patch({session:ib(this.state.session,f),runtimeHasActiveRun:f.hasActiveRun,runtimeCanInterrupt:f.canInterrupt,contextUsage:f.contextUsage,...$h(f)}),await this.refreshQueue();const p=t==="poll"&&this.state.connectionState!=="connected"&&Pi((a=this.state.session)==null?void 0:a.runningState);Ut("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){Ut("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(AT(this.sessionId).then(n=>{this.patch({session:kc(n,this.state.session)})}).catch(()=>{})),sb(this.state.capabilities)&&t.push(_T(this.sessionId).then(n=>{this.patch({capabilities:n})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await vk(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||sb(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){Ut("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const n=await ov(this.sessionId);this.patch({session:ib(this.state.session,n),runtimeHasActiveRun:n.hasActiveRun,runtimeCanInterrupt:n.canInterrupt,contextUsage:n.contextUsage,...$h(n)}),await this.refreshQueue(),Ut("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:n.contextUsage!==null})}catch(n){Ut("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:n instanceof Error?n.message:"unknown"})}}async refreshQueue(){try{const t=await $T(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,n,s){var a;try{return await qT(this.sessionId,{content:t,clientRequestId:n,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:Hh(),attachments:(s==null?void 0:s.attachments)??[]})}catch(c){if(!(c instanceof tr)||c.status!==404&&c.status!==405||(((a=s==null?void 0:s.attachments)==null?void 0:a.length)??0)>0)throw c;return zT(this.sessionId,{content:t,clientRequestId:n,permissionMode:Hh()})}}handleRuntimeStatus(t){var s;const n=qh((s=this.state.session)==null?void 0:s.runningState,t.status);this.patch({session:ui(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}),lu(n)&&(this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleActivity(t){if(this.patch({session:OO(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...$h(t)}),lu(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=Ca(this.state.messages,this.sessionId,[t.message]);this.patch({messages:n,historyState:"ready",hasOlderMessages:Ts(this.state.session,n.length),session:ui(this.state.session,ob("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=qh((s=this.state.session)==null?void 0:s.runningState,"failed");this.clearRuntimeRefreshTimer(),this.patch({session:ui(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=qh((s=this.state.session)==null?void 0:s.runningState,"interrupted");this.clearRuntimeRefreshTimer(),this.patch({session:ui(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:Kh(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Kh(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,IO-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:rb(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Pr(Gh(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:UO(this.state.messages),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages})}}function dr(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 np(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function FO(e,t){return t>0||np(e)===0?"ready":"loading"}function Ts(e,t){const n=np(e);return n!==null?n>t:t>=LC}function ui(e,t){return e&&{...e,runningState:t,activityState:DC(e,t,e.completedAt??null,Pi(t))}}function rb(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function ib(e,t){return IC(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 OO(e,t){return IC(e,t)}function IC(e,t){if(!e)return e;const n=BO(t.activityResolutionSource),s=lu(t.runningState)?Vh(e.completedAt,t.updatedAt):null,a=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?Vh(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:Vh(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:DC(e,t.runningState,s,t.hasActiveRun)}}function DC(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 lu(e){return e==="completed"||e==="interrupted"||e==="failed"}function sb(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(n=>n.usesProviderDefault===!0)}function ob(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function qh(e,t){return lu(e)?e:t}function $h(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 BO(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function Vh(e,t){return e?t?e>=t?e:t:e:t??null}function ab(){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 lb(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:e.provider==="codex"||e.provider==="claude-code"||e.provider==="opencode":!1}function cb(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 Gh(e){return`session-runtime.snapshot.${e}`}function UO(e){return e.filter(t=>t.deliveryState==="sent").slice(-Gf)}function WO(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 Kh(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 kc(e,t){if(!e)return t;if(!t||ub(e,t))return e;if(ub(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 ub(e,t){return db(e)&&!db(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function db(e){return e.activityState==="running"||Pi(e.runningState)}function _C({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 Do({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[k,S]=v.useState(!1),C=Br();return e?i.jsxs(i.Fragment,{children:[i.jsx(_C,{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(qO,{})]}),i.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:g})]}),i.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),l]})}),k&&!y?zO(i.jsxs(HO,{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(VO,{}):i.jsx($O,{})})]},j.id))}),d?d(()=>S(!1)):null]})):null]}):null}function zO(e){return typeof document>"u"?null:Bn.createPortal(e,document.body)}function HO({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 qO(){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 $O(){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 VO(){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 ol({open:e,workspaces:t,initialWorkspaceId:n,onClose:s,onSelect:a}){const[c,l]=v.useState(""),[d,f]=v.useState(!1),p=Br();if(v.useEffect(()=>{e&&(l(GO(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 Bn.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(KO,{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(YO,{}):i.jsx(QO,{})})]},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(tC,{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 GO(e,t){var n;return t&&e.some(s=>s.id===t)?t:((n=e[0])==null?void 0:n.id)??""}function KO({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 QO(){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 YO(){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 FC="mobile.conversation.preview.mode";function Qh(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(FC)==="immersive"?"immersive":"preview"}catch{return"preview"}}function Ei(e){if(!(typeof window>"u"))try{window.localStorage.setItem(FC,e)}catch{}}const XO=15e3,hb=.6,Yh=.6,fb=8,JO=36,ZO=48,eB=96;function tB(){const{sessionId:e="",workspaceId:t}=um(),n=ti(),s=qn(),a=v.useMemo(()=>new URLSearchParams(n.search),[n.search]),c=(t==null?void 0:t.trim())||null,l=v.useMemo(()=>sB(e,c,a),[c,a,e]),d=v.useMemo(()=>gB(e,n.state),[n.state,e]);return l?i.jsx(iB,{draft:l,navigate:s}):i.jsx(nB,{sessionId:e,bootstrapMessages:d})}function nB({sessionId:e,bootstrapMessages:t}){var Qt;const{shellMode:n,navigationGroups:s,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,markNavigationSessionSeen:d,favoriteSessions:f,archiveSession:p,unarchiveSession:y,startDraftSession:g}=rr(),b=qn(),k=v.useRef(null),S=v.useRef(null),[C,j]=v.useState(!1),[A,L]=v.useState(null),[M,z]=v.useState(!1),[V,F]=v.useState(!1),[I,_]=v.useState(null),[D,P]=v.useState(!1),[J,X]=v.useState(!1),G=v.useMemo(()=>s.flatMap(Se=>Se.sessions).find(Se=>Se.sessionId===e)??null,[s,e]);(!k.current||S.current!==e)&&((Qt=k.current)==null||Qt.destroy(),k.current=new _O(e,{initialSession:G,bootstrapMessages:t,onSeen:(Se,dt)=>{d(Se,dt)}}),S.current=e);const te=k.current,{showToast:q,dismissToast:me}=Xn(),ne=Ti(Se=>Se.notificationPreferences.notifyOnPermissionRequest),K=In(),ae=Br(),E=v.useRef(null),B=v.useRef(null),re=v.useRef(null),T=v.useRef((G==null?void 0:G.runningState)??null),ke=v.useRef(new Set),ge=dr(te,Se=>Se.session),Ee=dr(te,Se=>Se.capabilities),Be=dr(te,Se=>Se.runtimeHasActiveRun),Ye=dr(te,Se=>Se.runtimeCanInterrupt),$e=dr(te,Se=>Se.messages),rt=dr(te,Se=>Se.permissionRequests),ft=dr(te,Se=>Se.queuedMessages),St=dr(te,Se=>Se.contextUsage),Dt=dr(te,Se=>Se.historyState),Mt=dr(te,Se=>Se.errorCode),tt=dr(te,Se=>Se.errorDetail),Lt=dr(te,Se=>Se.loadingOlderMessages),Tt=dr(te,Se=>Se.hasOlderMessages),Et=dr(te,Se=>Se.connectionState),[Ot,zt]=v.useState(null),[_t,Ze]=v.useState(null),Bt=mB(ge),Ct=Bt&&bk(Ee)&&(ge==null?void 0:ge.provider)===(Ee==null?void 0:Ee.provider),sn=ft.some(Se=>Se.status==="queued"||Se.status==="dispatching"),ue=n!=="mobile",ye=zC(!ue),Ae=(ge==null?void 0:ge.workspaceId)??(G==null?void 0:G.workspaceId)??null,_e=v.useMemo(()=>new Set(f.map(Se=>Se.session.sessionId)),[f]),ut=v.useMemo(()=>s.map(Se=>Se.workspace),[s]),Ge=v.useMemo(()=>aB(s,Ae,e),[Ae,s,e]),Jt=v.useMemo(()=>OC(s,(ge==null?void 0:ge.workspaceId)??(G==null?void 0:G.workspaceId)??null,_e),[_e,s,G==null?void 0:G.workspaceId,ge==null?void 0:ge.workspaceId]),bt=v.useMemo(()=>BC(f),[f]),mt=v.useMemo(()=>Ae?s.find(Se=>Se.workspace.id===Ae)??null:null,[Ae,s]);(ge==null?void 0:ge.provider)??(G==null||G.provider);const At=v.useMemo(()=>{var Se;return as(((Se=ge??G)==null?void 0:Se.title)??null,h("conversation.titleFallback"))},[G,ge]),lt=v.useMemo(()=>(mt==null?void 0:mt.sessions.filter(Se=>Se.isArchived===!0&&Se.isSubagent!==!0))??[],[mt]),Y=v.useRef(null),Me=v.useRef(null),it=v.useRef(null),[xt,Vt]=v.useState(null),{composerPortalTarget:Gt}=_S();return v.useEffect(()=>{te.applyNavigationSession(G)},[G,te]),v.useEffect(()=>(te.initialize(),()=>{te.destroy()}),[te]),v.useEffect(()=>(l(e,(ge==null?void 0:ge.workspaceId)??null),()=>{l(e,null)}),[ge==null?void 0:ge.workspaceId,e,l]),v.useEffect(()=>()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null)},[]),v.useEffect(()=>{if(!Mt||!tt){re.current!==null&&(window.clearTimeout(re.current),re.current=null),B.current=null,E.current=null,me("conversation-runtime-error");return}const Se=`${Mt}:${tt}`;if(!(E.current===Se||B.current===Se)){if(re.current!==null&&(window.clearTimeout(re.current),re.current=null),rB((ge==null?void 0:ge.provider)??null,Mt,tt)){B.current=Se,re.current=window.setTimeout(()=>{B.current=null,re.current=null,E.current=Se,q({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:tt,tone:"error",durationMs:null})},XO);return}B.current=null,E.current=Se,q({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:tt,tone:"error",durationMs:null})}},[me,Mt,tt,ge==null?void 0:ge.provider,q]),v.useEffect(()=>{const Se=T.current,dt=(ge==null?void 0:ge.runningState)??null;(Se==="starting"||Se==="running"||Se==="reconnecting")&&dt==="completed"&&ae.trigger("success"),T.current=dt},[ae,ge==null?void 0:ge.runningState]),v.useEffect(()=>{const Se=rt.filter(Ht=>Ht.status==="pending"),dt=(ge==null?void 0:ge.workspaceId)??(G==null?void 0:G.workspaceId)??null;for(const Ht of Se)ke.current.has(Ht.id)||(ke.current.add(Ht.id),ne&&(q({id:`permission-request-${Ht.id}`,title:h("conversation.permissionRequestToastTitle"),description:Ht.title,tone:"warning",durationMs:8e3,action:dt?{label:h("shell.contextOpenSession"),onClick:()=>{b(Hn(dt,e))}}:void 0}),K.bridge.showNotification(h("conversation.permissionRequestToastTitle"),Ht.title)))},[G==null?void 0:G.workspaceId,b,ne,rt,K.bridge,ge==null?void 0:ge.workspaceId,e,q]),UC(Me,xt,!ue,e),WC(Me,it,!ue,e),i.jsxs(i.Fragment,{children:[i.jsxs("main",{ref:Me,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!ue,"data-preview-mode":ue?void 0:ye.displayMode,"data-preview-dragging":ue?void 0:ye.isDragging,style:ue?void 0:ye.pageStyle,children:[ue?i.jsx(CC,{session:ge??G}):null,ue?null:i.jsx(Do,{containerRef:it,className:"mobile-conversation-page-header",gestureHandlers:ye.mainGestureHandlers,currentWorkspace:(mt==null?void 0:mt.workspace)??ut[0]??null,workspaces:ut,heading:At.fullTitle,triggerAriaLabel:ye.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{ye.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:At.fullTitle,children:At.displayTitle})}),ue?null:i.jsx(HC,{visible:ye.isVisible,widthPx:ye.previewWidthPx,isDragging:ye.isDragging,gestureHandlers:ye.railGestureHandlers,activeSessionId:Ge,createSessionActionLabel:h("shell.createSession"),favoriteItems:bt,items:Jt,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{X(!0)},archiveCurrentActionLabel:h("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:h("shell.archiveFolderAction"),onArchiveActiveSession:()=>{z(!0)},onOpenArchiveFolder:()=>{F(!0)},onActivate:Se=>{Ei("preview"),b(Hn(Se.workspace.id,Se.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...ue?{}:ye.mainGestureHandlers,children:i.jsxs("div",{ref:Y,className:"mobile-conversation-main",children:[i.jsx(wk,{connectionState:Et,onReconnect:()=>te.reconnect()}),i.jsx(sO,{requests:rt,replyingRequestId:A,onReply:async(Se,dt)=>{L(Se);try{await te.replyPermissionRequest(Se,dt)}catch(Ht){q({title:h("conversation.permissionRequestReplyFailed"),description:Ht instanceof Error?Ht.message:void 0,tone:"error"})}finally{L(null)}}}),i.jsx(SC,{sessionId:e,messages:$e,historyState:Dt,loadingOlderMessages:Lt,hasOlderMessages:Tt,provider:(ge==null?void 0:ge.provider)??null,onLoadOlderMessages:()=>{te.loadOlderMessages()},onRetryMessage:Se=>{te.retryMessage(Se)}}),i.jsx(uO,{items:ft,deletingQueueItemId:Ot,steeringQueueItemId:_t,canSteer:Ct,onDelete:async Se=>{zt(Se);try{await te.deleteQueuedMessage(Se)}finally{zt(null)}},onSteer:async Se=>{Ze(Se);try{await te.steerQueuedMessage(Se),a()}finally{Ze(null)}}}),i.jsx(kk,{capabilities:Ee,draftStorageId:e,panelRef:ue?void 0:Vt,portalContainer:ue?null:Gt,hasActiveRun:Be,contextUsage:St,hasPendingQueuedMessages:sn,canInterrupt:Ye,isSubmitting:C,isRunning:Bt,onInterrupt:async()=>{await te.interrupt(),a()},onSend:async(Se,dt)=>{j(!0);try{await te.sendMessage(Se,{model:dt==null?void 0:dt.model,reasoningLevel:dt==null?void 0:dt.reasoningLevel,attachments:dt==null?void 0:dt.attachments,attachmentMeta:dt==null?void 0:dt.attachmentMeta}),a()}finally{j(!1)}},onQueueSend:async(Se,dt)=>{j(!0);try{await te.enqueueMessage(Se,{model:dt==null?void 0:dt.model,reasoningLevel:dt==null?void 0:dt.reasoningLevel,attachments:dt==null?void 0:dt.attachments,attachmentMeta:dt==null?void 0:dt.attachmentMeta})}finally{j(!1)}}})]})})]}),i.jsx(hB,{open:M,busy:D,onClose:()=>{D||z(!1)},onConfirm:async()=>{if(!D){P(!0);try{if(await p(e),z(!1),q({title:h("shell.archiveAdded"),tone:"success"}),Ae){c(Ae),Ei("preview"),b(rl(Ae));return}b("/workspaces")}catch(Se){q({title:Se instanceof Error?Se.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{P(!1)}}}}),i.jsx(fB,{open:V,workspaceName:(mt==null?void 0:mt.workspace.name)??null,sessions:lt,restoringSessionId:I,onClose:()=>{I||F(!1)},onRestore:async Se=>{_(Se);try{await y(Se),q({title:h("shell.archiveRestored"),tone:"success"})}catch(dt){q({title:dt instanceof Error?dt.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{_(null)}}}),i.jsx(ol,{open:J,workspaces:ut,initialWorkspaceId:Ae,onClose:()=>X(!1),onSelect:(Se,dt)=>{X(!1),Ei("immersive"),g(Se,dt)}})]})}function rB(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 iB({draft:e,navigate:t}){const{shellMode:n,navigationGroups:s,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,upsertNavigationSession:d,favoriteSessions:f,startDraftSession:p}=rr(),[y,g]=v.useState(!1),[b,k]=v.useState([]),[S,C]=v.useState(!1),j=v.useMemo(()=>rE(e.provider),[e.provider]),[A,L]=v.useState(j),M=n!=="mobile",z=zC(!M),V=v.useMemo(()=>oB(e),[e]),F=v.useMemo(()=>new Set(f.map(ne=>ne.session.sessionId)),[f]),I=v.useMemo(()=>s.map(ne=>ne.workspace),[s]),_=v.useMemo(()=>as(V.title??null,h("conversation.titleFallback")),[V]),D=v.useMemo(()=>OC(s,e.workspaceId,F),[e.workspaceId,F,s]),P=v.useMemo(()=>BC(f),[f]),J=v.useRef(null),X=v.useRef(null),G=v.useRef(null),[te,q]=v.useState(null),{composerPortalTarget:me}=_S();return v.useEffect(()=>(l(e.sessionId,e.workspaceId),()=>{l(e.sessionId,null)}),[e.sessionId,e.workspaceId,l]),v.useEffect(()=>{let ne=!1;return L(j),BT(e.provider,e.workspaceId).then(K=>{ne||L(K)}).catch(()=>{}),()=>{ne=!0}},[e.provider,e.workspaceId,j]),UC(X,te,!M,e.sessionId),WC(X,G,!M,e.sessionId),i.jsxs(i.Fragment,{children:[i.jsxs("main",{ref:X,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!M,"data-preview-mode":M?void 0:z.displayMode,"data-preview-dragging":M?void 0:z.isDragging,style:M?void 0:z.pageStyle,children:[M?i.jsx(CC,{session:V}):null,M?null:i.jsx(Do,{containerRef:G,className:"mobile-conversation-page-header",gestureHandlers:z.mainGestureHandlers,currentWorkspace:I.find(ne=>ne.id===e.workspaceId)??I[0]??null,workspaces:I,heading:_.fullTitle,triggerAriaLabel:z.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{z.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:_.fullTitle,children:_.displayTitle})}),M?null:i.jsx(HC,{visible:z.isVisible,widthPx:z.previewWidthPx,isDragging:z.isDragging,gestureHandlers:z.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:h("shell.createSession"),favoriteItems:P,items:D,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{C(!0)},onActivate:ne=>{Ei("preview"),t(Hn(ne.workspace.id,ne.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...M?{}:z.mainGestureHandlers,children:i.jsxs("div",{ref:J,className:"mobile-conversation-main",children:[i.jsx(wk,{connectionState:"closed",onReconnect:()=>{}}),i.jsx(SC,{sessionId:e.sessionId,messages:b,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}}),i.jsx(kk,{capabilities:A,draftStorageId:e.sessionId,panelRef:M?void 0:q,portalContainer:M?null:me,contextUsage:null,isSubmitting:y,isRunning:!1,onSend:async(ne,K)=>{var E,B;const ae=vB();k(re=>[...re,NC(e.sessionId,ne,ae,(K==null?void 0:K.attachmentMeta)??[],(K==null?void 0:K.attachments)??[])]),g(!0);try{const re=ei.getState().profile.defaultPermissionMode,T=await HT({workspaceId:e.workspaceId,provider:e.provider,content:ne,clientRequestId:ae,model:(K==null?void 0:K.model)??null,reasoningLevel:(K==null?void 0:K.reasoningLevel)??null,permissionMode:re==="default"?null:re,attachments:(K==null?void 0:K.attachments)??[]});T.session&&d(T.session);const ke=((B=(E=T.session)==null?void 0:E.workspaceId)==null?void 0:B.trim())||e.workspaceId;l(T.sessionId,ke),Ei("preview"),t(Hn(ke,T.sessionId),{replace:!0,state:T.message?{bootstrap:{sessionId:T.sessionId,messages:[T.message]}}:null}),a()}catch(re){throw k(T=>qf(T,ae)),re}finally{g(!1)}}})]})})]}),i.jsx(ol,{open:S,workspaces:I,initialWorkspaceId:e.workspaceId,onClose:()=>C(!1),onSelect:(ne,K)=>{C(!1),Ei("immersive"),p(ne,K)}})]})}function sB(e,t,n,s=null){var l,d;if(!pB(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 oB(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:nE(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 OC(e,t,n){if(!t)return[];const s=e.find(a=>a.workspace.id===t);return s?Im([s]).filter(a=>!a.session.isArchived&&a.session.isSubagent!==!0&&!n.has(a.session.sessionId)).map(a=>({entry:a,depth:0})):[]}function BC(e){return e.filter(t=>t.session.isSubagent!==!0).map(t=>({entry:t,depth:0}))}function aB(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 UC(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 WC(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 zC(e){const t=Br(),[n,s]=v.useState(()=>e?Qh():"immersive"),[a,c]=v.useState(()=>pb()),[l,d]=v.useState(()=>e&&Qh()==="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 _=Qh();s(_),d(_==="preview"?"default":"closed")},[e]),v.useEffect(()=>{e&&Ei(n)},[e,n]),v.useEffect(()=>{if(typeof window>"u")return;function _(){c(pb())}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 k(){y("expanded"),s("preview")}function S(){if(f.current!=="closed"){t.trigger("gesture"),b();return}t.trigger("gesture"),g()}function C(_,D){if(!e||D.touches.length!==1){p.current=null;return}if(lB(D.target)){p.current=null;return}const P=D.touches[0];if(!P){p.current=null;return}if(_==="main"){if(f.current==="closed"&&P.clientX>eB){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 D=p.current,P=_.touches[0];if(!e||!D||!P)return;const J=P.clientX-D.startX,X=P.clientY-D.startY;if(D.lastX=P.clientX,D.lastY=P.clientY,!D.horizontalLocked){if(Math.abs(J)<fb&&Math.abs(X)<fb)return;if(Math.abs(J)<=Math.abs(X)){p.current=null;return}if(D.intent==="open"&&J<=0){p.current=null;return}if(D.intent==="close"&&J>=0){p.current=null;return}D.horizontalLocked=!0}}function A(_){var X;const D=p.current;if(p.current=null,!(D!=null&&D.horizontalLocked))return;const P=(X=_==null?void 0:_.changedTouches)==null?void 0:X[0];P&&(D.lastX=P.clientX,D.lastY=P.clientY);const J=D.lastX-D.startX;if(D.intent==="open"){J>=JO&&(t.trigger("gesture"),g("default"));return}if(D.intent==="close"){J<=-34&&(t.trigger("gesture"),b());return}if(J<=-34){t.trigger("gesture"),b();return}J>=ZO&&f.current==="default"&&(t.trigger("gesture"),k())}const L=l==="expanded"?Yh:l==="default"?hb:0,M=Math.round(a*L*100)/100,z=L===0?0:L/Yh,V={"--mobile-conversation-preview-default-width":`${Math.round(a*hb*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(a*Yh*100)/100}px`,"--mobile-conversation-preview-width":`${M}px`,"--mobile-conversation-preview-progress":z.toFixed(4)};return{closePreview:b,displayMode:l==="closed"?"immersive":"preview",isDragging:!1,isVisible:l!=="closed",mainGestureHandlers:{onTouchStart:_=>C("main",_),onTouchMove:j,onTouchEnd:A,onTouchCancel:A},pageStyle:V,previewWidthPx:M,railGestureHandlers:{onTouchStart:_=>C("rail",_),onTouchMove:j,onTouchEnd:A,onTouchCancel:A},togglePreview:S}}function HC({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:k,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(mb,{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(mb,{entry:C.entry,depth:C.depth,activeSessionId:a,onActivate:S},`${C.entry.workspace.id}:${C.entry.session.sessionId}`))})]})]}),y&&b||g&&k?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&&k?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:k,children:g}):null]}):null]}):null}function mb({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:cB(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:qC(e.session,a)})]})]})})}function pb(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function lB(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function cB(e,t){const n=Jm("mobile-conversation-preview-indicator",e);return n.endsWith(" is-idle")&&t?"mobile-conversation-preview-indicator is-active":n}function qC(e,t){const n=su(e);return[t??null,uB(e.provider),dB(e.lastMessageAt??e.updatedAt),n].filter(Boolean).join(" · ")}function uB(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function dB(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function hB({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:Bn.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 fB({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:Bn.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=as(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:qC(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 mB(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function pB(e){return e.startsWith("draft-")}function gB(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(yB)}function yB(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 vB(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}const wB=420;function gb({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[k,S]=v.useState(!1),C=v.useRef(null),j=v.useRef(!1),A=Br(),{session:L,workspace:M}=e,z=L.title??L.sessionId,V=L.provider==="codex"?h("conversation.providerCodex"):L.provider==="opencode"?h("conversation.providerOpenCode"):h("conversation.providerClaude"),F=[V,xB(L.lastMessageAt??L.updatedAt??null),su(L)].filter(Boolean).join(" · "),I=SB(L),_=I?CB(I):null,D=a==="mobile"?null:su(L),P=D?KS("session-list-activity-badge",L):null;v.useEffect(()=>()=>{J()},[]);function J(){C.current!==null&&(window.clearTimeout(C.current),C.current=null)}function X(K){!c||K.pointerType==="mouse"||(J(),C.current=window.setTimeout(()=>{j.current=!0,A.trigger("gesture"),f==null||f()},wB))}function G(){J()}function te(){if(j.current){j.current=!1;return}A.trigger("selection"),d(L.sessionId)}const q=async()=>{const K=window.prompt(h("shell.renameModalDescription"),z);K&&(await b(L.sessionId,K.trim()),S(!1))},me=async()=>{if(L.isArchived){await g(L.sessionId),S(!1);return}await y(L.sessionId),S(!1)},ne=()=>{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:te,onPointerDown:X,onPointerUp:G,onPointerCancel:G,onPointerLeave:G,children:[i.jsx("span",{className:bB(L),"aria-hidden":"true"}),i.jsxs("div",{className:"session-list-copy",children:[i.jsx("div",{className:"session-list-title",children:z||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:M.name}),D&&P?i.jsxs(i.Fragment,{children:[i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{className:P,children:D})]}):null,i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{children:V})]})}),_?i.jsx("div",{className:"session-list-error",title:I??void 0,children:_}):null]})]}),l?i.jsxs("div",{className:"session-list-actions",children:[i.jsx("button",{type:"button",className:"ghost-button","aria-expanded":k,onClick:()=>{A.trigger("selection"),S(K=>!K)},children:h("shell.sessionMoreAction")}),k?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:ne,children:h(t?"shell.unfavoriteAction":"shell.favoriteAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void me(),children:L.isArchived?h("shell.unarchiveAction"):h("shell.archiveAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void q(),children:h("shell.renameAction")})]}):null]}):null]})}function bB(e,t){return Jm("session-list-indicator",e)}function xB(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function kB(e){return sl(e)||e.syncStatus==="error"}function SB(e){var s,a;if(!kB(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"&&!sl(e)?h("conversation.syncStatusError"):h("conversation.runtimeErrorTitle"))}function CB(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function jB(){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}=rr(),b=t.find(D=>D.workspace.id===s)??t[0]??null,k=v.useMemo(()=>new Set(n),[n]),S=v.useMemo(()=>b?Im([b]).filter(D=>!D.session.isArchived&&!D.session.isSubagent):[],[b]),C=v.useMemo(()=>N2(S),[S]),j=(b==null?void 0:b.workspace.id)??"",A=!!j,[L,M]=v.useState([]),[z,V]=v.useState(!1);v.useEffect(()=>{if(!a)return;const D=C.filter(P=>P.children.some(J=>J.session.sessionId===a)).map(P=>P.entry.session.sessionId);D.length!==0&&M(P=>{const J=new Set(P);let X=!1;for(const G of D)J.has(G)||(J.add(G),X=!0);return X?Array.from(J):P})},[a,C]);function F(D){M(P=>P.includes(D)?P.filter(J=>J!==D):[...P,D])}function I(D,P){Ei("immersive"),e(Hn(D,P))}function _(D,P){V(!1),Ei("immersive"),g(D,P)}return i.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(Do,{currentWorkspace:(b==null?void 0:b.workspace)??null,workspaces:t.map(D=>D.workspace),onSelectWorkspace:D=>{l(D),e(rl(D))},content:i.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!A,onClick:()=>V(!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(D=>{const P=D.entry.session.sessionId,J=L.includes(P);return i.jsxs("div",{className:"session-list-tree-node",children:[i.jsx(gb,{entry:D.entry,isFavorite:k.has(P),isActive:a===P,variant:"mobile",hasSubsessions:D.children.length>0,onActivate:X=>I(D.entry.workspace.id,X),onToggleSubsessions:()=>F(P),onToggleFavorite:X=>{d(X)},onArchive:X=>f(X),onUnarchive:X=>p(X),onRename:(X,G)=>y(X,G)}),J&&D.children.length>0?i.jsx("div",{className:"session-list-children",children:D.children.map(X=>i.jsx(gb,{entry:X,isFavorite:k.has(X.session.sessionId),isActive:a===X.session.sessionId,depth:1,variant:"mobile",onActivate:G=>I(X.workspace.id,G),onToggleFavorite:G=>{d(G)},onArchive:G=>f(G),onUnarchive:G=>p(G),onRename:(G,te)=>y(G,te)},`${X.workspace.id}:${X.session.sessionId}`))}):null]},`${D.entry.workspace.id}:${P}`)})})]})}),i.jsx(ol,{open:z,workspaces:t.map(D=>D.workspace),initialWorkspaceId:s??j,onClose:()=>V(!1),onSelect:_})]})}function NB(){const{currentWorkspaceId:e}=rr();return e?i.jsx(Ja,{to:Ao(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 PB(){const{currentWorkspaceId:e}=rr();return e?i.jsx(Ja,{to:Ao(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 wW(){return Ke.request("/api/terminals/shells")}function bW(e){return Ke.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function TB(e){return Ke.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function xW(e){return Ke.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function kW(e){return Ke.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function SW(e){return Ke.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function CW(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 Ke.request(`/api/terminals/${encodeURIComponent(e)}/history${s?`?${s}`:""}`)}function EB(e){return Ke.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function RB(e,t){return Ke.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function MB(e){return Ke.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function yb(e,t){return Ke.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function AB(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 vb(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 jW(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 LB(e){return e instanceof tr?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function IB({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:Bn.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 Sc={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},wb=60*1e3;function DB(e){return e?new Date(e).toLocaleString():h("common.unknown")}function _B(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function FB(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 OB(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 BB(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function UB(e){return{mode:$C(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 WB(e){return nm(`/proxy/${encodeURIComponent(e)}`)}function $C(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function zB(e){const t=e.trim();if(!t)return null;const n=Number(t);return Number.isInteger(n)?n:Number.NaN}function bb(e,t){return e.get(t)??null}function HB(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 qB({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:Bn.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 $B({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:Bn.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 xb({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(VB,{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(KB,{}):i.jsx(GB,{})})]},d.value||"__empty__")})}):null]})}function VB({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 GB(){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 KB(){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 VC({className:e,currentWorkspaceId:t,navigationGroups:n}){var bt,mt,At,lt;const s=In(),{subscribeTerminalManagerSnapshot:a,requestTerminalManagerRefresh:c,addTerminalManagerSnapshotListener:l}=rr(),d=(t==null?void 0:t.trim())||null,[f,p]=v.useState([]),[y,g]=v.useState([]),[b,k]=v.useState([]),[S,C]=v.useState([]),[j,A]=v.useState(""),[L,M]=v.useState(""),[z,V]=v.useState(Sc),[F,I]=v.useState(null),[_,D]=v.useState(null),[P,J]=v.useState([]),[X,G]=v.useState(!1),[te,q]=v.useState(!1),[me,ne]=v.useState(null),[K,ae]=v.useState(null),[E,B]=v.useState(null),[re,T]=v.useState(null),[ke,ge]=v.useState(null),[Ee,Be]=v.useState(!1),[Ye,$e]=v.useState(null),{showToast:rt}=Xn(),ft=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,St=F!==null,Dt=F==="edit"?y.find(Y=>Y.id===_)??null:null,Mt=F==="edit";v.useEffect(()=>{Ut("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:n.length})},[t,n.length]);const tt=v.useMemo(()=>S.find(Y=>Y.id===j)??null,[j,S]),Lt=v.useMemo(()=>AB(s.ui.osFamily),[s.ui.osFamily]),Tt=v.useMemo(()=>new Map(b.map(Y=>[Y.templateId,Y])),[b]),Et=v.useMemo(()=>b.filter(Y=>Y.occupied).length,[b]),Ot=v.useMemo(()=>y.filter(Y=>Y.port!==null).length,[y]),zt=(tt==null?void 0:tt.available)===!1&&S.length>0;v.useEffect(()=>{A(Y=>S.length?Y&&S.some(Me=>Me.id===Y)?Y:FB(S):"")},[S]),v.useEffect(()=>{!St||!d||S.length>0||Ze(d)},[d,S.length,St]),v.useEffect(()=>{St||$e(null)},[St]),v.useEffect(()=>{F==="edit"&&_&&!Dt&&(I(null),D(null),V(Sc),M(""),$e(null))},[Dt,_,F]),v.useEffect(()=>{!re||E===re.templateId||y.some(Y=>Y.id===re.templateId)||T(null)},[re,E,y]),v.useEffect(()=>{if(!d){p([]),g([]),k([]),G(!1);return}const Y=Ln(Xh(d),wb);Ut("terminal_manager.snapshot",{workspaceId:d,cached:!!Y,cachedTemplateCount:(Y==null?void 0:Y.templates.length)??0,cachedStatusCount:(Y==null?void 0:Y.templateStatuses.length)??0}),Y?(p(Y.terminals),g(Y.templates),k(Y.templateStatuses),C(Y.shellOptions??[]),G(!1)):(p([]),g([]),k([]),C([]),G(!0))},[d]),v.useEffect(()=>{if(d)return l(Y=>{Y.workspaceId===d&&(Ut("terminal_manager.snapshot_received",{workspaceId:Y.workspaceId,terminalCount:Y.terminals.length,templateCount:Y.templates.length,statusCount:Y.templateStatuses.length}),_t(Y),G(!1))})},[d,l]),v.useEffect(()=>{if(!d)return;const Y=Ln(Xh(d),wb)!==null;if(a(d),Y){const Me=window.setTimeout(()=>{Ze(d)},1500);return()=>{window.clearTimeout(Me)}}Ze(d)},[d,c,a]),v.useEffect(()=>{d&&Pr(Xh(d),{terminals:f,templates:y,templateStatuses:b,shellOptions:S})},[d,S,b,y,f]);function _t(Y){p(Y.terminals),g(Y.templates),k(Y.templateStatuses),C(Y.shellOptions??[])}function Ze(Y){Ut("terminal_manager.refresh_requested",{workspaceId:Y}),c(Y)}function Bt(){I(null),D(null),V(Sc),M(""),$e(null)}function Ct(){D(null),V(Sc),M(""),I("create")}function sn(Y){D(Y.id),V(UB(Y)),M(Y.runtimeType??""),I("edit")}async function ue(Y){if(d){ae(Y);try{await TB(Y),Ze(d),rt({title:h("terminalManager.stopProcessSuccess"),tone:"success"})}catch(Me){rt({title:Me instanceof Error?Me.message:h("terminalManager.stopProcessFailed"),tone:"error"})}finally{ae(null)}}}async function ye(){if(!d||!z.target.trim())return;const Y=zB(z.port);if(Number.isNaN(Y)){rt({title:h("terminalManager.invalidPort"),tone:"error"});return}if(z.proxyEnabled&&Y===null){rt({title:h("terminalManager.proxyPortRequired"),tone:"error"});return}q(!0);try{const Me={workspaceId:d,name:OB(z),cwd:z.cwd.trim()||void 0,command:z.target.trim(),args:_B(z.args),port:Y,proxyEnabled:z.proxyEnabled,runtimeType:L||null};if(Mt&&_){const it=await RB(_,Me);g(xt=>xt.map(Vt=>Vt.id===it.id?it:Vt))}else await EB(Me);Bt(),Ze(d),rt({title:h(Mt?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(Me){rt({title:Me instanceof Error?Me.message:h(Mt?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{q(!1)}}async function Ae(Y){const Me=await s.bridge.openExternal(Y);Me.ok||rt({title:Me.detail||h("terminalManager.openProxyUrlFailed"),tone:"error"})}async function _e(Y,Me){if(d){B(Y.id);try{await MB(Y.id),g(it=>it.filter(xt=>xt.id!==Y.id)),k(it=>it.filter(xt=>xt.templateId!==Y.id)),J(it=>it.filter(xt=>xt!==Y.id)),T(it=>(it==null?void 0:it.templateId)===Y.id?null:it),_===Y.id&&Bt(),Ze(d),rt({title:h("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(it){rt({title:it instanceof Error?it.message:h("terminalManager.templateDeleteFailed"),tone:"error"})}finally{B(null)}}}async function ut(Y){if(!d)return;const Me=tt!=null&&tt.available?tt.shell:void 0;ne(Y);try{await yb(Y,{shell:Me}),Ze(d),rt({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(it){if(LB(it)){ge({templateId:Y,shell:Me});return}rt({title:it instanceof Error?it.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{ne(null)}}async function Ge(){if(!(!d||!ke)){Be(!0);try{await yb(ke.templateId,{shell:ke.shell,runtimeType:"embedded-pty"}),ge(null),Ze(d),rt({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(Y){rt({title:Y instanceof Error?Y.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{Be(!1)}}}function Jt(Y){J(Me=>Me.includes(Y)?Me.filter(it=>it!==Y):[...Me,Y])}return n.length?d?i.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[i.jsx(IB,{open:ke!==null,busy:Ee,onClose:()=>{Ee||ge(null)},onConfirmFallback:()=>{Ge()}}),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:Et})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.portWatchCountLabel")}),i.jsx("strong",{children:Ot})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.terminalCountLabel")}),i.jsx("strong",{children:f.length})]})]}),i.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[i.jsx("button",{className:"ghost-button",type:"button",disabled:!d||X,onClick:()=>{d&&Ze(d)},children:h("terminalManager.refresh")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!d,onClick:()=>{Ct()},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:y.length})]}),X&&!y.length?i.jsx("p",{className:"status-text",children:h("common.loading")}):null,y.length?i.jsx("div",{className:"terminal-manager-list",children:y.map(Y=>{const Me=bb(Tt,Y.id),it=HB(Y,Me),xt=P.includes(Y.id),Vt=h(xt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),Gt=Y.proxyEnabled&&Y.proxySlug?WB(Y.proxySlug):null;return i.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":it.tone,"data-expanded":xt?"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:Y.name})]}),i.jsxs("div",{className:"terminal-manager-card-tools",children:[i.jsx("span",{className:"badge terminal-runtime-badge",children:vb(Y.runtimeType,s.ui.osFamily)}),i.jsx("span",{className:"badge",children:$C(Y)==="script"?h("terminalManager.scriptMode"):h("terminalManager.commandMode")}),i.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":Vt,"aria-expanded":xt,onClick:()=>{Jt(Y.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:it.title}),i.jsx("p",{className:"status-text",children:it.summary})]}),i.jsxs("div",{className:"terminal-manager-status-badges",children:[i.jsx("span",{className:"terminal-manager-stat-pill",children:Y.port===null?h("terminalManager.portUnset"):`${h("terminalManager.portLabel")} ${Y.port}`}),i.jsx("span",{className:"badge","data-tone":it.badgeTone,children:it.badgeLabel}),Y.proxyEnabled?i.jsx("span",{className:"badge",children:h("terminalManager.proxyEnabled")}):null]})]}),i.jsxs("div",{className:"terminal-manager-actions",children:[Me!=null&&Me.occupied?i.jsx("button",{className:"secondary-button",type:"button",disabled:K===Y.id,onClick:()=>{ue(Y.id)},children:K===Y.id?h("terminalManager.stoppingProcess"):h("terminalManager.stopProcessAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:me===Y.id||zt,onClick:()=>{ut(Y.id)},children:me===Y.id?h("terminalManager.runningTemplate"):h("terminalManager.runTemplateAction")})]}),xt?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:BB(Y)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.cwdLabel")}),i.jsx("strong",{children:Y.cwd})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("strong",{children:vb(Y.runtimeType,s.ui.osFamily)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.updatedAt")}),i.jsx("strong",{children:DB(Y.updatedAt)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.portLabel")}),i.jsx("strong",{children:Y.port===null?h("terminalManager.portUnset"):Y.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:Gt??h("terminalManager.proxyDisabledDescription")})]}),Me!=null&&Me.processId?i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.processIdLabel")}),i.jsx("strong",{children:Me.processId})]}):null,Me!=null&&Me.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:Me.processCommandLine})]}):null]}),i.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[Gt?i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{Ae(Gt)},children:h("terminalManager.openProxyUrlAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:te||E===Y.id,onClick:()=>{sn(Y)},children:h("terminalManager.editAction")}),i.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:E===Y.id,onClick:()=>{T({templateId:Y.id,name:Y.name,occupied:!!(Me!=null&&Me.occupied)})},children:E===Y.id?h("terminalManager.templateRemoving"):h("terminalManager.removeAction")})]})]}):null]},Y.id)})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyTemplateBody")})})]}),i.jsx(qB,{open:St,title:h(Mt?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:h(Mt?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:ft?"terminal-manager-mobile-modal":void 0,onClose:Bt,children:i.jsxs("section",{className:"terminal-manager-modal-form",children:[ft?i.jsxs(i.Fragment,{children:[i.jsx(xb,{label:h("terminalManager.shellField"),value:j,open:Ye==="shell",options:S.map(Y=>({value:Y.id,label:Y.label,description:Y.available?null:Y.unavailableReason??h("terminalManager.shellUnavailable"),disabled:!Y.available})),onToggle:()=>{$e(Y=>Y==="shell"?null:"shell")},onChange:Y=>{A(Y),$e(null)}}),(tt==null?void 0:tt.available)===!1&&tt.unavailableReason?i.jsx("p",{className:"status-text",children:tt.unavailableReason}):null,i.jsx(xb,{label:h("terminal.runtimeField"),value:L,open:Ye==="runtime",options:Lt.map(Y=>({value:Y.value,label:Y.label,description:Y.description})),onToggle:()=>{$e(Y=>Y==="runtime"?null:"runtime")},onChange:Y=>{M(Y),$e(null)}}),i.jsx("p",{className:"status-text",children:((bt=Lt.find(Y=>Y.value===L))==null?void 0:bt.description)??((mt=Lt[0])==null?void 0:mt.description)})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.shellField")}),i.jsx("select",{value:j,onChange:Y=>{A(Y.target.value)},children:S.map(Y=>i.jsx("option",{value:Y.id,disabled:!Y.available,children:Y.available?Y.label:`${Y.label} - ${h("terminalManager.shellUnavailable")}`},Y.id))}),(tt==null?void 0:tt.available)===!1&&tt.unavailableReason?i.jsx("p",{className:"status-text",children:tt.unavailableReason}):null]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("select",{value:L,onChange:Y=>{M(Y.target.value)},children:Lt.map(Y=>i.jsx("option",{value:Y.value,children:Y.label},Y.value||"auto"))}),i.jsx("p",{className:"status-text",children:((At=Lt.find(Y=>Y.value===L))==null?void 0:At.description)??((lt=Lt[0])==null?void 0:lt.description)})]})]}),i.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":h("terminalManager.modeField"),children:[i.jsx("button",{type:"button",className:z.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{V(Y=>({...Y,mode:"command"}))},children:h("terminalManager.commandMode")}),i.jsx("button",{type:"button",className:z.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{V(Y=>({...Y,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:z.name,placeholder:h("terminalManager.templateNamePlaceholder"),onChange:Y=>{V(Me=>({...Me,name:Y.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.cwdField")}),i.jsx("input",{value:z.cwd,placeholder:h("terminalManager.cwdPlaceholder"),onChange:Y=>{V(Me=>({...Me,cwd:Y.target.value}))}})]})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:z.mode==="script"?h("terminalManager.scriptPathField"):h("terminalManager.commandField")}),i.jsx("input",{value:z.target,placeholder:z.mode==="script"?h("terminalManager.scriptPathPlaceholder"):h("terminalManager.commandPlaceholder"),onChange:Y=>{V(Me=>({...Me,target:Y.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.argsField")}),i.jsx("input",{value:z.args,placeholder:h("terminalManager.argsPlaceholder"),onChange:Y=>{V(Me=>({...Me,args:Y.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:z.port,placeholder:h("terminalManager.portPlaceholder"),onChange:Y=>{V(Me=>({...Me,port:Y.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:z.proxyEnabled,onChange:Y=>{V(Me=>({...Me,proxyEnabled:Y.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:Bt,children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!d||te||!z.target.trim(),onClick:()=>{ye()},children:h(te?Mt?"terminalManager.templateUpdating":"terminalManager.templateSaving":Mt?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),i.jsx($B,{open:re!==null,busy:re!==null&&E===re.templateId,title:h("terminalManager.removeConfirmTitle"),description:re?h(re.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:re.name}):"",confirmLabel:h("terminalManager.removeConfirmAction"),className:ft?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{E||T(null)},onConfirm:()=>{if(!re)return;const Y=y.find(Me=>Me.id===re.templateId);if(!Y){T(null);return}bb(Tt,Y.id),_e(Y)}})]}):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 Xh(e){return`terminal-manager.snapshot.${e}`}const QB=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:VC},Symbol.toStringTag,{value:"Module"}));function YB(){const{currentWorkspaceId:e,navigationGroups:t}=rr();return e?i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:i.jsx(VC,{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")})]})})}function GC(e){return Ke.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function KC(e,t,n){const s=new URLSearchParams({workspaceId:e,path:t,staged:String(n)});return Ke.request(`/api/git/diff?${s.toString()}`)}function QC(e,t){return Ke.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function XB(e,t){return Ke.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function JB(e,t){return Ke.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function ZB(e,t){return Ke.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function eU(e,t){return Ke.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function tU(e){return Ke.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function kb(e,t=5,n=null){const s=new URLSearchParams({workspaceId:e,limit:String(t)});return n&&s.set("cursor",n),Ke.request(`/api/git/history?${s.toString()}`)}function nU(e){return Ke.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function rU(e,t,n){return Ke.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:n})})}function Sb(e,t,n){return Ke.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t,...n?{remote:n}:{}})})}function iU(e){return Ke.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const sU=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"]),oU=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"]),aU=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),lU=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"]),cU=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),uU=new Set(["trace","debug","info","warn","warning","error","fatal"]);function YC({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,k]=v.useState(!1),[S,C]=v.useState("preview"),{showToast:j}=Xn(),A=v.useRef(s),L=v.useRef(j),M=v.useMemo(()=>ZC(t),[t]),z=v.useMemo(()=>RU(c),[c]),V=M==="markdown",F=!!(l!=null&&l.supported&&l.kind==="text");if(v.useEffect(()=>{A.current=s},[s]),v.useEffect(()=>{L.current=j},[j]),v.useEffect(()=>{if(!n){d(null),p(""),g(!1),k(!1),C("preview");return}if(!e||!t)return;const X=e,G=t;let te=!1;async function q(){g(!0);try{const me=await ww(X,G);te||(d(me),p(me.content??""),C((PU(G),"preview")))}catch(me){te||(L.current({title:Cb(me,h("conversation.filePanelOpenFailed")),tone:"error"}),A.current())}finally{te||g(!1)}}return q(),()=>{te=!0}},[t,n,e]),v.useEffect(()=>{if(!n)return;function X(G){G.key==="Escape"&&s()}return window.addEventListener("keydown",X),()=>{window.removeEventListener("keydown",X)}},[s,n]),!n||!t||typeof document>"u")return null;const I=t,_=e;async function D(){if(!(!_||!(l!=null&&l.version)||!F)){k(!0);try{await S_(_,I,f,l.version);const X=await ww(_,I);d(X),p(X.content??""),await a(I),j({title:h("conversation.filePanelSaveSuccess"),tone:"success"}),C("preview")}catch(X){j({title:Cb(X,h("conversation.filePanelSaveFailed")),tone:"error"})}finally{k(!1)}}}const P=(l==null?void 0:l.content)??"",J=F&&f!==P;return Bn.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}",Kf(M))})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:i.jsx(TU,{})})]}),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(V?"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:Kf(M)}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>void D(),disabled:!J||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:X=>p(X.target.value),spellCheck:!1}):V?i.jsx(dU,{content:f}):i.jsx(XC,{content:f,language:M,overviewMarkers:z})})]})]}),document.body)}function dU({content:e}){return i.jsx("div",{className:"markdown-content file-viewer-markdown",children:i.jsx(Em,{remarkPlugins:[Lm],components:{code(t){const n=typeof t.className=="string"?t.className:"",s=/language-([\w-]+)/.exec(n);return s?i.jsx(XC,{content:String(t.children).replace(/\n$/,""),language:ip(s[1]??"plain")}):i.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function XC({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:Kf(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=hU(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(AU,{markers:n,totalLines:s.length,scrollContainerRef:a})]})]})}function hU(e,t){const n=ip(t);return n==="json"?fU(e):n==="yaml"?yU(e):n==="toml"?vU(e):n==="ini"?JC(e):n==="env"?wU(e):n==="properties"?bU(e):n==="conf"?xU(e):n==="editorconfig"?kU(e):n==="dockerfile"?SU(e):n==="gitignore"?CU(e):n==="log"?jU(e):n==="python"?Da(e,oU,"#"):n==="shell"?Da(e,aU,"#"):n==="sql"?gU(e):n==="html"||n==="xml"?mU(e):n==="css"?pU(e):n==="markdown"?[{text:e,kind:"plain"}]:Da(e,sU,"//")}function Da(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 fU(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 mU(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 pU(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 gU(e){return Da(e,lU,"--")}function yU(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 vU(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=Cu(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 JC(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=Cu(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 wU(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 JC(e);a.push({text:l[1]??"",kind:"attr"}),a.push({text:l[2]??"",kind:"operator"});const d=c.slice(l[0].length),f=Cu(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return f?(a.push(...f.tokens),a):(a.push({text:d,kind:"plain"}),a)}function bU(e){return rp(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function xU(e){return rp(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function kU(e){return rp(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function SU(e){return Da(e,cU,"#")}function CU(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 jU(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];uU.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 rp(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=NU(l);return d.length&&c.push(...d),c}function NU(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),a=Cu(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 Cu(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 ZC(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 ip(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 Kf(e){switch(ip(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 PU(e){return ZC(e)==="markdown"}function Cb(e,t){return e instanceof tr?e.message:t}function TU(){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 EU(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 RU(e){if(!(e!=null&&e.trim()))return[];const t=EU(e),n=[];let s=0,a=[];function c(){if(a.length===0){s=0;return}const l=s>0?"modify":"add";MU(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 MU(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 AU({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,k=Math.min(100,Math.max(12,b*100)),S=y-p,C=Math.max(0,100-k),j=S<=0?0:g/S*C;a({top:j,height:k})}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 _s(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 Fs(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 LU=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),IU=["._"];function DU(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function _U(e){const t=e.trim().toLowerCase();return t?LU.has(t)||IU.some(n=>t.startsWith(n)):!1}function sp(e,t,n){return n?[...e]:e.filter(s=>!_U(t(s)))}function Oc(e,t){return sp(e,n=>n.name,t)}function FU(e,t){return t?e:Object.entries(e).reduce((n,[s,a])=>(n[s]=Oc(a,!1),n),{})}async function Jh(e,t){const[n,s]=await Promise.all([GC(t),LT(e)]);return OU(n.changes,s.items)}function OU(e,t){const n=new Set(t.map(s=>Uc(s.path)));return e.filter(s=>n.has(Uc(s.path))||s.oldPath!==null&&n.has(Uc(s.oldPath)))}function BU(e){const t=jb("","");for(const n of e){const s=Uc(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=jb(l,f);c.children.set(p,g),c=g})}return n0(t0([...t.children.values()]))}function e0(e,t){const n=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return op(e)?`${n} ${t}`:n}function op(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function Bc(e){return e.split("/").filter(Boolean).pop()??e}function Uc(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function jb(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function t0(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:t0([...t.children.values()])}:t)}function n0(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=n0(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 UU=450,WU=60*1e3,Nb=20,Pb=16;function zU({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,k]=v.useState(!0),[S,C]=v.useState(!1),[j,A]=v.useState([]),L=v.useRef(null),{showToast:M}=Xn();v.useEffect(()=>{const G=Ln(Cc(t,e),WU);p("tree"),g(G??[]),k(G===null),C(!1),A([]),L.current=null},[e,t]),v.useEffect(()=>{let G=!1;async function te(){k(!0);try{const q=await Jh(e,t);G||(g(q),Pr(Cc(t,e),q))}catch(q){G||M({title:Zh(q,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{G||k(!1)}}return te(),()=>{G=!0}},[a,e,M,t]);async function z(){k(!0);try{const G=await Jh(e,t);g(G),Pr(Cc(t,e),G)}catch(G){M({title:Zh(G,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{k(!1)}}async function V(){if(P.length!==0){C(!0);try{await QC(t,P.map(te=>te.path));const G=await Jh(e,t);g(G),Pr(Cc(t,e),G),M({title:h("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(G){M({title:Zh(G,h("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function F(G){A(te=>te.includes(G)?te.filter(q=>q!==G):[...te,G])}function I(G){const te=Date.now(),q=L.current;return L.current={filePath:G,timestamp:te},(q==null?void 0:q.filePath)===G&&te-q.timestamp<=UU}async function _(G,te){if(te&&I(G)){await d(G),L.current=null;return}te||(L.current=null),await l(G)}const D=v.useMemo(()=>sp(y,G=>Bc(G.path),n),[y,n]),P=D.filter(G=>!G.staged),J=BU(D),X=new Set(j);return v.useEffect(()=>{c==null||c(D.length)},[c,D.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 z(),disabled:b||S,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void V(),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")} ${D.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")}):D.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionEmpty")}):f==="tree"?r0({nodes:J,depth:0,collapsedPathSet:X,selectedPath:s,onToggleTreePath:F,onFileClick:_}):HU({items:D,selectedPath:s,onFileClick:_})})]})}function r0({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:`${Nb+t*Pb}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:r0({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:`${Nb+t*Pb}px`},onClick:()=>void c(l.change.path,!op(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":Fs(l.name),"aria-hidden":"true",children:_s(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:e0(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 HU({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,!op(s)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Fs(Bc(s.path)),"aria-hidden":"true",children:_s(Bc(s.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:Bc(s.path)}),i.jsx("span",{className:"file-tree-path",children:e0(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 Cc(e,t){return`file-panel.session-changes.${e}.${t}`}function Zh(e,t){return e instanceof tr?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const vn="",qU=450,$U=300*1e3,VU=60*1e3,GU=1600,KU=20,QU=16;function i0({className:e,sessionId:t,workspaceId:n,hideHeading:s=!1,externalRevealRequest:a=null}){var xe;const{navigationGroups:c,subscribeFileTree:l,requestFileTreeRefresh:d,addFileTreeSnapshotListener:f,subscribeGitSnapshot:p,requestGitRefresh:y,addGitSnapshotListener:g}=rr(),[b,k]=v.useState({}),[S,C]=v.useState([]),[j,A]=v.useState([]),[L,M]=v.useState(vn),[z,V]=v.useState(null),[F,I]=v.useState(!1),[_,D]=v.useState(!1),[P,J]=v.useState(!1),[X,G]=v.useState(!1),[te,q]=v.useState(""),[me,ne]=v.useState(null),[K,ae]=v.useState(!1),[E,B]=v.useState(null),[re,T]=v.useState("workspace"),[ke,ge]=v.useState(0),[Ee,Be]=v.useState(0),[Ye,$e]=v.useState(!1),[rt,ft]=v.useState(!1),[St,Dt]=v.useState([]),[Mt,tt]=v.useState(!1),[Lt,Tt]=v.useState(null),Et=v.useRef({}),Ot=v.useRef([]),zt=v.useRef(vn),_t=v.useRef(!1),Ze=v.useRef(null),Bt=v.useRef(null),Ct=v.useRef(null),sn=v.useRef(null),ue=v.useRef(null),ye=v.useRef(0),Ae=v.useRef(new Map),{showToast:_e}=Xn(),ut=In(),Ge=Ti(R=>R.showSystemFiles),Jt=!!(t!=null&&t.trim()),bt=s&&ut.isMobile;v.useEffect(()=>{Ut("file_panel.props",{sessionId:t,workspaceId:n})},[t,n]),v.useEffect(()=>{zt.current=L},[L]);function mt(R){k(de=>{const he=typeof R=="function"?R(de):R;return Et.current=he,he})}function At(R){C(de=>{const he=typeof R=="function"?R(de):R;return Ot.current=he,he})}v.useEffect(()=>{var et,pt;if(le(),!n){le(),_t.current=!1,Et.current={},Ot.current=[],zt.current=vn,mt({}),At([]),A([]),M(vn),G(!1),q(""),ne(null),ae(!1),I(!1),tt(!1),Tt(null);return}_t.current=!0;const R=Ln(Rb(n),$U);Ut("file_panel.workspace_snapshot",{workspaceId:n,cached:!!R,cachedRootItems:((pt=(et=R==null?void 0:R.treeCache)==null?void 0:et[vn])==null?void 0:pt.length)??0,cachedDirectoryCount:Object.keys((R==null?void 0:R.treeCache)??{}).length});const de=o4((R==null?void 0:R.activeDirectoryPath)??vn,(R==null?void 0:R.treeCache)??{}),he=Eb((R==null?void 0:R.expandedDirectories)??[],de),ve=jc((R==null?void 0:R.treeCache)??{},de,he);Et.current=ve,Ot.current=he,zt.current=de,mt(ve),At(he),A([]),M(de),I(!1),D(!1),G(!1),q(""),ne(null),ae(!1),queueMicrotask(()=>{_t.current=!1})},[n]),v.useEffect(()=>{if(!a||a.workspaceId!==n)return;const R=()=>{if(ue.current===a.requestId)return;ue.current=a.requestId,T("workspace"),(a.openViewer?Fe(a.filePath):Ce(a.filePath)).catch(he=>{_e({title:Xi(he,h("conversation.filePanelOpenFailed")),tone:"error"})})};if(_t.current){queueMicrotask(R);return}R()},[a,Fe,Ce,_e,n]),v.useEffect(()=>{if(n)return f(R=>{R.workspaceId===n&&(mt(de=>({...de,[R.path]:R.items})),R.path===vn&&I(!1),A(de=>de.filter(he=>he!==R.path)),$(R.path,R.items))})},[f,n]),v.useEffect(()=>()=>{le()},[]),v.useEffect(()=>{n&&l(n,ef(Ot.current,zt.current))},[L,S,l,n]),v.useEffect(()=>{V(null),B(null),Tt(null),ge(0),$e(!1),ft(!1),Ze.current=null,ye.current+=1},[t]),v.useEffect(()=>{!Jt&&re==="session"&&T("workspace")},[re,Jt]),v.useEffect(()=>{if(!Ye&&!rt)return;function R(he){var pt,Yt;if(!(he.target instanceof Node))return;const ve=((pt=Bt.current)==null?void 0:pt.contains(he.target))??!1,et=((Yt=Ct.current)==null?void 0:Yt.contains(he.target))??!1;!ve&&!et&&($e(!1),ft(!1))}function de(he){he.key==="Escape"&&($e(!1),ft(!1))}return document.addEventListener("pointerdown",R),document.addEventListener("keydown",de),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",de)}},[Ye,rt]),v.useEffect(()=>{if(!n)return;const R=Eb(S,L),de=jc(b,L,R);Pr(Rb(n),{treeCache:de,expandedDirectories:R,activeDirectoryPath:L})},[L,S,b,n]),v.useEffect(()=>{if(_t.current)return;const R=jc(b,L,S);l4(b,R)||mt(R)},[L,S,b]),v.useEffect(()=>{let R=!1;const de=(n==null?void 0:n.trim())??null;async function he(et){if(!de)return;const pt=Oc(Et.current[vn]??[],Ge),Yt=(et==null?void 0:et.silent)!==!0&&pt.length===0;Yt&&I(!0),Ut("file_panel.load_root_tree.start",{sessionId:t,workspaceId:de,silent:(et==null?void 0:et.silent)===!0,cachedRootItems:pt.length});try{const an=await bn(vn,{force:!0});R||(Ut("file_panel.load_root_tree.end",{sessionId:t,workspaceId:de,itemCount:an.length}),mt(ni=>({...jc(ni,zt.current,Ot.current),[vn]:an})))}catch(an){!R&&!Mb(an)&&_e({title:Xi(an,h("conversation.filePanelLoadFailed")),tone:"error"})}finally{!R&&Yt&&I(!1)}}if(Oc(Et.current[vn]??[],Ge).length>0){const et=window.setTimeout(()=>{de&&(l(de,ef(Ot.current,zt.current)),he({silent:!0}))},1500);return()=>{R=!0,window.clearTimeout(et)}}return he(),()=>{R=!0}},[t,Ge,_e,n]),v.useEffect(()=>{if(!n||!t){Be(0);return}const R=Ln(c4(n,t),VU);Ut("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:n,cached:R!==null,cachedCount:R}),Be(R??0)},[t,ke,n]),v.useEffect(()=>{if(!n){Dt([]);return}const R=n.trim();p(R),y(R)},[n,p,y]),v.useEffect(()=>{if(!n)return;const R=n.trim();return g(de=>{var he;de.workspaceId===R&&Dt(((he=de.status)==null?void 0:he.changes)??[])})},[g,n]);const lt=v.useMemo(()=>sp(St,R=>DU(R.path),Ge),[St,Ge]),Y=v.useMemo(()=>{const R=new Map,de=new Set;for(const he of lt){const ve=he.path.replace(/\\/g,"/"),et=he.worktreeStatus??he.stagedStatus??he.status;R.set(ve,et);const pt=ve.split("/");for(let Yt=1;Yt<pt.length;Yt++)de.add(pt.slice(0,Yt).join("/"))}return{statusByPath:R,changedDirs:de}},[lt]),Me=v.useMemo(()=>FU(b,Ge),[Ge,b]),it=v.useMemo(()=>me===null?null:Oc(me,Ge),[me,Ge]),xt=Me[vn]??[],Vt=X&&it!==null,Gt=((xe=c.find(R=>R.workspace.id===n))==null?void 0:xe.workspace)??null,Qt=JU(z,L),Se=!!(Gt!=null&&Gt.path&&Qt!==null),dt=!!z,Ht=!!((z?Ta(z):L)&&S.length);async function Zt(R,de=!1){if(!n)return[];if(!de){const he=Et.current[R];if(he)return he}R===vn?I(!0):A(he=>Wc(he,R));try{const he=await bn(R,{force:de});return mt(ve=>({...ve,[R]:he})),he}catch(he){throw Mb(he)||_e({title:Xi(he,h("conversation.filePanelLoadFailed")),tone:"error"}),he}finally{R===vn?I(!1):A(he=>he.filter(ve=>ve!==R))}}async function cn(){if(!n)return;const R=a4(Et.current,L,Ot.current);Ut("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:n,targetDirectories:R});const he=(await Promise.all(R.map(async ve=>{const et=await bn(ve,{force:!0});return[ve,et]}))).reduce((ve,[et,pt])=>(ve[et]=pt,ve),{});Ut("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:n,targetDirectories:R,directoryCount:Object.keys(he).length}),mt(he)}async function bn(R,de){if(!n)return[];if(!(de!=null&&de.force)){const ve=Et.current[R];if(ve)return ve}const he=ef(Wc(Ot.current,R),R||zt.current);return l(n,he),d(n,[R]),xn(R)}function xn(R,de=GU){const he=Et.current[R];return he?Promise.resolve(he):new Promise((ve,et)=>{const pt=window.setTimeout(()=>{ee(R,pt),et(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${R}`))},de),Yt=Ae.current.get(R)??[];Ae.current.set(R,[...Yt,{resolve:ve,reject:et,timerId:pt}])})}function $(R,de){const he=Ae.current.get(R)??[];he.length!==0&&(Ae.current.delete(R),he.forEach(ve=>{window.clearTimeout(ve.timerId),ve.resolve(de)}))}function ee(R,de){const ve=(Ae.current.get(R)??[]).filter(et=>et.timerId!==de);if(ve.length===0){Ae.current.delete(R);return}Ae.current.set(R,ve)}function le(){for(const[R,de]of Ae.current.entries())de.forEach(he=>{window.clearTimeout(he.timerId),he.reject(new Error(`FILE_TREE_ABORTED:${R}`))});Ae.current.clear()}async function be(R,de=!1){const he=$a(R,de);if(!he.length){M(vn);return}At(ve=>l0(ve,he)),M(he[he.length-1]??vn);for(const ve of he)try{await Zt(ve)}catch{return}}async function Ce(R){V(R),M(Ta(R)),await be(R)}async function Fe(R){B(R),Tt(null),Ze.current=null,ye.current+=1,Ce(R);const de=ye.current,he=R.replace(/\\/g,"/"),ve=Y.statusByPath.get(he);if(n&&ve&&ve!=="?"&&ve!=="D")try{const et=await KC(n,R,!1);ye.current===de&&Tt(et.content||null)}catch{ye.current===de&&Tt(null)}}function Xe(R){const de=Date.now(),he=Ze.current;return Ze.current={filePath:R,timestamp:de},(he==null?void 0:he.filePath)===R&&de-he.timestamp<=qU}function Ue(){Ze.current=null}async function We(R){if(Xe(R)){await Fe(R);return}await Ce(R)}function Oe(){G(!1),q(""),ne(null),Ue()}async function De(R){if(R.kind==="directory"){Oe(),await at(R.path);return}if(Xe(R.path)){Oe(),await Fe(R.path);return}await Ce(R.path)}async function at(R){if(V(null),M(R),!Ot.current.includes(R))try{await Zt(R),At(de=>Wc(de,R))}catch{}}async function ht(R){if(V(null),M(R),Ot.current.includes(R)){en(R);return}await at(R)}function en(R){At(de=>de.filter(he=>he!==R&&!he.startsWith(`${R}/`))),M(Ta(R)),V(null)}async function Rt(){if(!n)return;const R=n;try{if(y(R),await cn(),z&&await be(z),Vt&&te.trim()){const de=await Ff(R,te.trim());ne(de.items)}}catch(de){_e({title:Xi(de,h("conversation.filePanelLoadFailed")),tone:"error"})}}async function ze(R){if(R==null||R.preventDefault(),!n||!te.trim()){ne(null);return}ae(!0);try{const de=await Ff(n,te.trim());ne(de.items)}catch(de){_e({title:Xi(de,h("conversation.filePanelSearchFailed")),tone:"error"})}finally{ae(!1)}}function se(){if(X){G(!1),q(""),ne(null);return}G(!0)}function je(R){ft(!1),R()}function Qe(){var R;(R=sn.current)==null||R.click()}async function st(R){var pt;const de=((pt=R.target.files)==null?void 0:pt[0])??null;if(R.target.value="",!de||!n)return;const he=XU(de.name);if(!he){_e({title:h("conversation.filePanelUploadFailed"),tone:"error"});return}const ve=Tb(L,z),et=YU(ve,he);J(!0);try{const Yt=await t4(de);await j_({workspaceId:n,path:et,contentBase64:Yt}),await cn(),await Ce(et),_e({title:h("conversation.filePanelUploadSuccess",{name:he}),tone:"success"})}catch(Yt){_e({title:Xi(Yt,h("conversation.filePanelUploadFailed")),tone:"error"})}finally{J(!1)}}async function O(){if(!(!n||!z)){J(!0);try{const R=await N_(n,z),de=n4(R.contentBase64);r4(R.fileName,new Blob([de],{type:"application/octet-stream"})),_e({title:h("conversation.filePanelDownloadSuccess",{name:R.fileName}),tone:"success"})}catch(R){_e({title:Xi(R,h("conversation.filePanelDownloadFailed")),tone:"error"})}finally{J(!1)}}}function pe(){const R=z?Ta(z):L;!R||!Ot.current.includes(R)||en(R)}async function Ne(R){if(!n)return;const de=Tb(L,z),he=de?`${de}/`:"",ve=window.prompt(h(R==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),he);if(!(ve!=null&&ve.trim()))return;const et=ve.trim();D(!0);try{await C_({workspaceId:n,opType:R,dstPath:et,content:R==="create_file"?"":void 0}),await cn(),R==="create_directory"?(await be(et,!0),V(null)):await Ce(et)}catch(pt){_e({title:Xi(pt,h("conversation.filePanelMutateFailed")),tone:"error"})}finally{D(!1)}}async function kt(R){const de=(Gt==null?void 0:Gt.path)??"";if(Qt===null||!de){$e(!1);return}try{const he=e4(de),ve=R==="absolute"?ZU(de,Qt,he):s0(Qt,he);await i4(ve,ut),_e({title:h(R==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(he){_e({title:he instanceof Error?he.message:h("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{$e(!1)}}function Nt(R,de){return i.jsx(i.Fragment,{children:R.map(he=>{const ve=he.kind==="directory",et=ve&&S.includes(he.path),pt=ve&&j.includes(he.path),Yt=Me[he.path]??[],an=Mt?tf(Yt,Me,Y.statusByPath,Y.changedDirs):Yt,ni=z===he.path||z===null&&ve&&L===he.path,gr=Y.statusByPath.get(he.path.replace(/\\/g,"/")),gi=ve&&Y.changedDirs.has(he.path.replace(/\\/g,"/"));return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":ni,"data-kind":he.kind,"aria-expanded":ve?et:void 0,style:{paddingInlineStart:`${KU+de*QU}px`},onClick:()=>{if(ve){Ue(),ht(he.path);return}We(he.path)},children:[i.jsx("span",{className:`file-tree-chevron${ve?"":" is-hidden"}`,"aria-hidden":"true",children:et?"v":">"}),ve?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Fs(he.name),"aria-hidden":"true",children:_s(he.name)}),i.jsx("span",{className:"file-tree-label","data-status":gr??void 0,"data-has-changes":gi||void 0,children:he.name}),!ve&&gr?i.jsx("span",{className:"git-status-badge","data-status":gr,"aria-label":gr,children:gr}):null,ve&&gi?i.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,pt?i.jsx("span",{className:"file-tree-meta",children:h("common.loading")}):null]}),ve&&et?i.jsx("div",{className:"file-tree-children",children:pt&&!Yt.length?i.jsx("p",{className:"file-tree-empty",children:h("common.loading")}):an.length?Nt(an,de+1):i.jsx("p",{className:"file-tree-empty",children:h("conversation.filePanelEmptyDirectory")})}):null]},`${he.kind}-${he.path}`)})})}function W(R){return i.jsx(i.Fragment,{children:R.map(de=>{const he=de.kind==="directory",ve=z===de.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":ve,"data-kind":de.kind,onClick:()=>{De(de)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),he?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Fs(de.name),"aria-hidden":"true",children:_s(de.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:de.name}),i.jsx("span",{className:"file-tree-path",children:de.path})]})]})},`search-${de.kind}-${de.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(YC,{workspaceId:n,filePath:E,open:E!==null,onClose:()=>{ye.current+=1,B(null),Tt(null)},onSaved:async R=>{await cn(),await Ce(R),ge(de=>de+1)},diffContent:Lt}),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:re==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":re==="workspace",onClick:()=>T("workspace"),children:h("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:re==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":re==="session",onClick:()=>{Jt&&T("session")},disabled:!Jt,children:[h("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${h("conversation.filePanelSessionTab")} ${Ee}`,children:Ee})]})]}),re==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:sn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:R=>void st(R)}),bt?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:Ct,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":h("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":rt,"data-active":rt,onClick:()=>{$e(!1),ft(R=>!R)},children:[i.jsx("span",{children:h("conversation.filePanelActionsMenu")}),i.jsx(y4,{})]}),rt?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:()=>{ft(!1),se()},children:h(X?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ft(!1),tt(R=>!R)},disabled:lt.length===0,children:h(Mt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(Rt),disabled:F||_||K,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ft(!1),pe()},disabled:!Ht,children:h("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ft(!1),Qe()},disabled:_||P,children:h("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(O),disabled:!dt||P,children:h("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(()=>Ne("create_file")),disabled:_||P,children:h("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(()=>Ne("create_directory")),disabled:_||P,children:h("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(()=>kt("absolute")),disabled:!Se,children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>je(()=>kt("relative")),disabled:!Se,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:Bt,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCopyPath"),"aria-label":h("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":Ye,"data-active":Ye,onClick:()=>{ft(!1),$e(R=>!R)},disabled:!Se,children:i.jsx(h4,{})}),Ye?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void kt("absolute"),children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void kt("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:pe,disabled:!Ht,children:i.jsx(u4,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelRefresh"),"aria-label":h("conversation.filePanelRefresh"),onClick:()=>void Rt(),disabled:F||_||K,children:i.jsx(d4,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),"data-active":X,onClick:se,disabled:F,children:i.jsx(Ab,{})}),lt.length>0?i.jsx("button",{className:"file-toolbar-button",type:"button",title:h(Mt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":h(Mt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":Mt,onClick:()=>tt(R=>!R),children:i.jsx(v4,{})}):null,i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelUpload"),"aria-label":h("conversation.filePanelUpload"),onClick:Qe,disabled:_||P,children:i.jsx(m4,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelDownload"),"aria-label":h("conversation.filePanelDownload"),onClick:()=>void O(),disabled:!dt||P,children:i.jsx(p4,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewFile"),"aria-label":h("conversation.filePanelNewFile"),onClick:()=>void Ne("create_file"),disabled:_||P,children:i.jsx(f4,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewDirectory"),"aria-label":h("conversation.filePanelNewDirectory"),onClick:()=>void Ne("create_directory"),disabled:_||P,children:i.jsx(g4,{})})]}),X?i.jsxs("form",{className:"file-toolbar-search",onSubmit:R=>void ze(R),children:[i.jsx("input",{value:te,onChange:R=>q(R.target.value),placeholder:h("conversation.filePanelSearchPlaceholder")}),bt?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":h("conversation.filePanelSearchButton"),disabled:K,children:h("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),disabled:K,children:i.jsx(Ab,{})})]}):null,i.jsx("div",{className:"file-tree","data-search-mode":Vt,children:F&&xt.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("common.loading")}):Vt?it!=null&&it.length?W(it):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSearchEmpty")}):Mt?tf(xt,Me,Y.statusByPath,Y.changedDirs).length?Nt(tf(xt,Me,Y.statusByPath,Y.changedDirs),0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelNoChanges")}):xt.length?Nt(xt,0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelEmptyDirectory")})})]}):Jt&&t?i.jsx(zU,{sessionId:t,workspaceId:n,showSystemFiles:Ge,selectedPath:z,refreshVersion:ke,onCountChange:Be,onSelectFile:Ce,onOpenFile:Fe}):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 Ta(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):vn}function $a(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 Tb(e,t){return e||(t?Ta(t):vn)}function YU(e,t){return e?`${e}/${t}`:t}function XU(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function JU(e,t){return e||t||null}function s0(e,t="posix"){return e?o0(e,t):"."}function ZU(e,t,n){const s=o0(e,n),a=s0(t,n).replace(/^\.[/\\]?/,"");if(!a)return s;const c=a0(n),l=a.replace(/^[/\\]+/,"");return l?s.endsWith("/")||s.endsWith("\\")?`${s}${l}`:`${s}${c}${l}`:s}function e4(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function o0(e,t){return e&&(a0(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function a0(e){return e==="windows"?"\\":"/"}async function t4(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 n4(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 r4(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 i4(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(!s4(e))throw new Error(h("conversation.filePanelCopyPathFailed"))}}function s4(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 o4(e,t){return e&&$a(e,!0).every(a=>a in t)?e:vn}function Eb(e,t){if(!t)return[];const n=$a(t,!0);return e.filter(s=>n.includes(s))}function jc(e,t,n){const s=ap(t,n);return Object.entries(e).reduce((a,[c,l])=>(s.has(c)&&(a[c]=l),a),{})}function a4(e,t,n){const a=[...ap(t,n)].filter(c=>c===vn||c in e);return a.length?a:[vn]}function ap(e,t){const n=new Set([vn]),s=l0(t,$a(e,!0));for(const a of s){n.add(a);for(const c of $a(a,!0))n.add(c)}return n}function l4(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 Wc(e,t){return e.includes(t)?e:[...e,t]}function l0(e,t){return t.reduce((n,s)=>Wc(n,s),e)}function Rb(e){return`file-panel.workspace-tree.${e}`}function c4(e,t){return`file-panel.session-change-count.${e}.${t}`}function ef(e,t){return[...ap(t,e)]}function Xi(e,t){return e instanceof tr?e.message:t}function Mb(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function u4(){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 d4(){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 Ab(){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 h4(){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 f4(){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 m4(){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 p4(){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 g4(){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 y4(){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 v4(){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 tf(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):c0(l,t,n,s)&&a.push(c)}return a}function c0(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(c0(f,t,n,s,c))return!0}return!1}const w4=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:i0},Symbol.toStringTag,{value:"Module"})),nf=56,Lb=28,rf=72,Nc=8,Ib=960,Db=60*1e3,_b=20,Fb=9,Ob=9,sf=68;function u0({className:e,workspaceId:t,panelActive:n=!0}){const{subscribeGitSnapshot:s,requestGitRefresh:a,addGitSnapshotListener:c}=rr(),[l,d]=v.useState(null),[f,p]=v.useState([]),[y,g]=v.useState(0),[b,k]=v.useState(null),[S,C]=v.useState(!1),[j,A]=v.useState(null),[L,M]=v.useState(null),[z,V]=v.useState(""),[F,I]=v.useState(!1),[_,D]=v.useState(!1),[P,J]=v.useState([]),[X,G]=v.useState(!0),[te,q]=v.useState(!1),[me,ne]=v.useState(()=>typeof window<"u"?window.innerWidth<=Ib:!1),[K,ae]=v.useState([]),[E,B]=v.useState(null),[re,T]=v.useState("unstaged"),[ke,ge]=v.useState(null),[Ee,Be]=v.useState(!1),[Ye,$e]=v.useState([]),[rt,ft]=v.useState(!1),[St,Dt]=v.useState(new Set),[Mt,tt]=v.useState(new Map),[Lt,Tt]=v.useState(null),[Et,Ot]=v.useState(nf),[zt,_t]=v.useState(!1),[Ze,Bt]=v.useState(null),[Ct,sn]=v.useState(null),ue=v.useRef(null),ye=v.useRef(null),Ae=v.useRef(null),_e=v.useRef(null),ut=v.useRef(n),{showToast:Ge}=Xn();v.useEffect(()=>{Ut("git_sidebar.props",{workspaceId:t})},[t]),v.useEffect(()=>{J([]),G(!0),g(0),k(null),C(!1),M(null),V(""),q(!1),ae([]),B(null),T("unstaged"),ge(null),Tt(null),_t(!1),Ot(nf),Bt(null),sn(null)},[t]),v.useEffect(()=>{function O(){ne(window.innerWidth<=Ib)}return O(),window.addEventListener("resize",O),()=>{window.removeEventListener("resize",O)}},[]),v.useEffect(()=>{if(!zt)return;const O=document.body.style.cursor,pe=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function Ne(Nt){ee(Nt.clientY)}function kt(){_t(!1)}return window.addEventListener("pointermove",Ne),window.addEventListener("pointerup",kt),()=>{document.body.style.cursor=O,document.body.style.userSelect=pe,window.removeEventListener("pointermove",Ne),window.removeEventListener("pointerup",kt)}},[zt]),v.useEffect(()=>{var Ne,kt;if(!(t!=null&&t.trim())){d(null),p([]),g(0),k(null),A(null),I(!1);return}const O=t.trim(),pe=Ln(af(O),Db);if(Ut("git_sidebar.snapshot",{workspaceId:O,cached:!!pe,cachedHistoryCount:((Ne=pe==null?void 0:pe.history)==null?void 0:Ne.length)??0,cachedChangedCount:((kt=pe==null?void 0:pe.status)==null?void 0:kt.changes.length)??0}),pe){bt(pe),I(!1);return}d(null),p([]),g(0),k(null),A(null),I(!0)},[t]),v.useEffect(()=>{if(t!=null&&t.trim())return c(O=>{var pe,Ne,kt;O.workspaceId===t.trim()&&(Ut("git_sidebar.snapshot_received",{workspaceId:O.workspaceId,changedCount:((pe=O.status)==null?void 0:pe.changes.length)??0,historyCount:O.history.length,branchCount:(((Ne=O.branches)==null?void 0:Ne.local.length)??0)+(((kt=O.branches)==null?void 0:kt.remote.length)??0)}),bt(O),I(!1))})},[c,t]),v.useEffect(()=>{if(!(t!=null&&t.trim()))return;const O=t.trim(),pe=Ln(af(O),Db)!==null;if(s(O),pe){a(O);return}mt()},[a,s,t]),v.useEffect(()=>{const O=ut.current;ut.current=n,t!=null&&t.trim()&&!O&&n&&a(t.trim())},[n,a,t]),v.useEffect(()=>{t&&Pr(af(t),{status:l,history:f,historyTotalCount:y,historyNextCursor:b,branches:j})},[j,f,b,y,l,t]),v.useEffect(()=>{if(!l||!L)return;l.changes.find(pe=>pe.path===L)||M(null)},[L,l]),v.useEffect(()=>{S4(_e.current)},[z]),v.useEffect(()=>{me||(ae([]),B(null),ge(null),Tt(null))},[me]),v.useEffect(()=>{if(!l){ae([]);return}const O=new Set(l.changes.map(pe=>pe.path));ae(pe=>pe.filter(Ne=>O.has(Ne)))},[l]);function Jt(){const O=Ae.current;if(!O)return;O.querySelectorAll(".git-tree-shell").forEach(Ne=>{Ne.scrollTop=0})}function bt(O){d(O.status),p(Array.isArray(O.history)?O.history:[]),g(typeof O.historyTotalCount=="number"?O.historyTotalCount:0),k(typeof O.historyNextCursor=="string"?O.historyNextCursor:null),A(O.branches??null)}function mt(O){t!=null&&t.trim()&&(I(!0),Ut("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),a(t.trim()))}async function At(O){if(!(t!=null&&t.trim()))return;const pe=t.trim();I(!0);try{const[Ne,kt,Nt]=await Promise.all([GC(pe),kb(pe,_b,null),nU(pe)]);bt({status:Ne,history:kt.items,historyTotalCount:kt.totalCount,historyNextCursor:kt.nextCursor,branches:Nt}),a(pe),O!=null&&O.resetTreeScroll&&requestAnimationFrame(()=>{Jt()})}catch(Ne){Ge({title:Yr(Ne,h("git.panelLoadFailed")),tone:"error"})}finally{I(!1)}}async function lt(){if(!(!t||!b||S)){C(!0);try{const O=await kb(t,_b,b);p(pe=>{const Ne=new Set(pe.map(Nt=>Nt.commitHash)),kt=O.items.filter(Nt=>!Ne.has(Nt.commitHash));return[...pe,...kt]}),g(O.totalCount),k(O.nextCursor)}catch(O){Ge({title:Yr(O,h("git.panelLoadFailed")),tone:"error"})}finally{C(!1)}}}function Y(O){if(!X||S||!b)return;const pe=O.currentTarget;pe.scrollHeight-pe.scrollTop-pe.clientHeight<=40&<()}async function Me(){if(t){D(!0);try{const O=await ZB(t,"ai");V(O.validation.normalizedDraft.subject||O.draft.subject)}catch(O){Ge({title:Yr(O,h("git.draftFailed")),tone:"error"})}finally{D(!1)}}}async function it(O,pe){if(t&&O.length){D(!0);try{const Ne=pe?await XB(t,O):await QC(t,O);d(Ne),M(O[O.length-1]??null),ae(kt=>kt.filter(Nt=>!O.includes(Nt))),B(null),mt()}catch(Ne){I(!1),Ge({title:Yr(Ne,h("git.stageFailed")),tone:"error"})}finally{D(!1)}}}async function xt(O){if(t&&O.length){D(!0);try{const pe=await JB(t,O);d(pe),O.includes(L??"")&&M(null),ae(Ne=>Ne.filter(kt=>!O.includes(kt))),B(null),mt()}catch(pe){I(!1),Ge({title:Yr(pe,h("git.discardFailed")),tone:"error"})}finally{D(!1)}}}async function Vt(){if(!(!t||!z.trim())){D(!0);try{await eU(t,k4(z)),Ge({title:h("git.commitSuccess"),tone:"success"}),V(""),M(null),mt()}catch(O){Ge({title:Yr(O,h("git.commitFailed")),tone:"error"})}finally{D(!1)}}}async function Gt(){if(t){ft(!0);try{const O=await iU(t);if(O.length===0){Ge({title:h("git.noRemotes"),tone:"error"});return}if(O.length===1){Qt([O[0].name]);return}$e(O),Dt(new Set),tt(new Map),Be(!0)}catch(O){Ge({title:Yr(O,h("git.remoteFailed")),tone:"error"})}finally{ft(!1)}}}async function Qt(O){if(!t||O.length===0)return;D(!0),tt(new Map);const pe=await Promise.allSettled(O.map(async Nt=>{const W=await Sb(t,"push",Nt);return{name:Nt,summary:W.summary}})),Ne=new Map;let kt=!1;for(const Nt of pe)if(Nt.status==="fulfilled")Ne.set(Nt.value.name,{ok:!0,summary:Nt.value.summary});else{kt=!0;const W=O[Ne.size];Ne.set(W,{ok:!1,summary:Yr(Nt.reason,h("git.remoteFailed"))})}tt(Ne),mt(),D(!1),kt||(Ge({title:h("git.pushAllSuccess",{count:String(O.length)}),tone:"success"}),Be(!1))}async function Se(O){if(t){if(O==="push"){q(!1),Gt();return}D(!0);try{const pe=await Sb(t,O);Ge({title:pe.summary,tone:"success"}),q(!1),mt()}catch(pe){Ge({title:Yr(pe,h("git.remoteFailed")),tone:"error"})}finally{D(!1)}}}async function dt(){if(t){D(!0);try{const O=await tU(t);V(O.commitSubject??""),Ge({title:O.summary||h("git.undoLastCommitSuccess"),tone:"success"}),q(!1),mt()}catch(O){Ge({title:Yr(O,h("git.undoLastCommitFailed")),tone:"error"})}finally{D(!1)}}}async function Ht(O){if(t){D(!0);try{const pe=await rU(t,O,!1);A(pe),q(!1),mt()}catch(pe){Ge({title:Yr(pe,h("git.branchFailed")),tone:"error"})}finally{D(!1)}}}function Zt(O){J(pe=>pe.includes(O)?pe.filter(Ne=>Ne!==O):[...pe,O])}const cn=450;function bn(O){const pe=Date.now(),Ne=ue.current;return ue.current={filePath:O,timestamp:pe},(Ne==null?void 0:Ne.filePath)===O&&pe-Ne.timestamp<=cn}async function xn(O,pe){if(pe.binary){Ge({title:h("git.binaryDiff"),tone:"info"});return}if(pe.status==="A"||pe.status==="?")sn(null),Bt(O);else if(t)try{const Ne=await KC(t,O,pe.staged);sn(Ne.content),Bt(O)}catch{sn(null),Bt(O)}}function $(O){M(O),B(null),ae(pe=>pe.includes(O)?pe.filter(Ne=>Ne!==O):[...pe,O])}function ee(O){const pe=ye.current;if(!pe||!Number.isFinite(O))return;const Ne=pe.getBoundingClientRect(),kt=Ne.height-Nc;if(!Number.isFinite(Ne.top)||!Number.isFinite(Ne.height)||kt<=0)return;const Nt=(O-Ne.top-Nc/2)/kt*100;if(!Number.isFinite(Nt))return;const W=Math.max(Lb,Math.min(rf,Math.round(Nt)));Ot(W)}function le(O){O.preventDefault(),ee(O.clientY),_t(!0)}const be=(l==null?void 0:l.changes)??[],Ce=be.filter(O=>Qf(O,"staged")),Fe=be.filter(O=>Qf(O,"unstaged")),Xe=Hb(Ce,"staged"),Ue=Hb(Fe,"unstaged"),We=new Set(P),Oe=new Set(K),De=qb(K,be,"staged"),at=qb(K,be,"unstaged"),ht=be.length===0&&((l==null?void 0:l.snapshot.ahead)??0)>0,en=Ce.length>0&&z.trim().length>0,Rt=(j==null?void 0:j.currentBranch)??(l==null?void 0:l.snapshot.branch)??h("common.unknown"),ze=Number.isFinite(Et)?Et:nf,se=X?`minmax(120px, ${ze}fr) ${Nc}px minmax(140px, ${100-ze}fr)`:`minmax(120px, 1fr) ${Nc}px auto`;v.useEffect(()=>{E==="staged"&&De.length===0&&B(null),E==="unstaged"&&at.length===0&&B(null)},[E,De.length,at.length]),v.useEffect(()=>{if(!me)return;const O=Fe.length>0?"unstaged":Ce.length>0?"staged":"history";T(pe=>pe==="unstaged"&&Fe.length>0||pe==="staged"&&Ce.length>0?pe:O)},[me,Ce.length,Fe.length]),v.useEffect(()=>{ke&&(f.some(O=>O.commitHash===ke)||ge(null))},[f,ke]),v.useEffect(()=>{me&&re!=="history"&&te&&q(!1)},[me,te,re]);async function je(O,pe){var Ne;try{if(typeof navigator>"u"||!((Ne=navigator.clipboard)!=null&&Ne.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(O),Ge({title:pe,tone:"success"})}catch{Ge({title:h("common.copyContentFailed"),tone:"error"})}}async function Qe(O,pe){typeof window<"u"&&!window.confirm(h("git.discardConfirm",{path:pe}))||await xt(O)}function st(){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:Rt})]}),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:j==null?void 0:j.local.map(O=>i.jsx("button",{className:"git-menu-item",type:"button",disabled:_||O.current,onClick:()=>void Ht(O.name),children:i.jsx("span",{children:O.current?`${h("git.switchBranch")} ${O.name}`:`${h("git.switchBranchTo")} ${O.name}`})},O.name))})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:_,onClick:()=>void Se("fetch"),children:i.jsx("span",{children:h("git.fetch")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:_,onClick:()=>void Se("pull"),children:i.jsx("span",{children:h("git.pull")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:_,onClick:()=>void Se("push"),children:i.jsx("span",{children:h("git.push")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:_,onClick:()=>void dt(),children:i.jsx("span",{children:h("git.undoLastCommit")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:_||F,onClick:()=>void At({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:_e,rows:1,value:z,onChange:O=>V(p0(O.target.value)),onKeyDown:O=>{O.key==="Enter"&&O.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 Me(),disabled:_||F,children:i.jsx(j4,{})})]}),i.jsxs("div",{className:"git-primary-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void At({resetTreeScroll:!0}),disabled:_||F||!t,children:h("git.refreshNow")}),i.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(ht){Gt();return}Vt()},disabled:_||!ht&&!en,children:h(ht?"git.pushNow":"git.commitNow")})]})]}),me?i.jsxs("div",{className:"git-mobile-sections",children:[i.jsx(of,{title:h("git.stagedChangesTitle"),count:Ce.length,expanded:re==="staged",onToggle:()=>T("staged"),children:i.jsx(Ub,{title:h("git.stagedChangesTitle"),nodes:Xe,collapsedTreePathSet:We,onToggleTreePath:Zt,onToggleMobileSelection:$,selectedMobilePathSet:Oe,selectedTargets:De,actioning:_,variant:"staged",swipeRowState:Lt,onSwipeRowChange:Tt,onStageToggle:it,onDiscardWithConfirm:Qe,onClearSelectedTargets:()=>ae(O=>O.filter(pe=>!De.includes(pe))),onPreviewFile:xn})}),i.jsx(of,{title:h("git.changesTitle"),count:Fe.length,expanded:re==="unstaged",onToggle:()=>T("unstaged"),children:i.jsx(Ub,{title:h("git.changesTitle"),nodes:Ue,collapsedTreePathSet:We,onToggleTreePath:Zt,onToggleMobileSelection:$,selectedMobilePathSet:Oe,selectedTargets:at,actioning:_,variant:"unstaged",swipeRowState:Lt,onSwipeRowChange:Tt,onStageToggle:it,onDiscardWithConfirm:Qe,onClearSelectedTargets:()=>ae(O=>O.filter(pe=>!at.includes(pe))),onPreviewFile:xn})}),i.jsxs(of,{title:h("git.recentVersionsTitle"),count:y,expanded:re==="history",onToggle:()=>T("history"),trailingContent:i.jsx("span",{className:"badge",children:Rt}),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":te,onClick:()=>{T("history"),q(O=>!O)},disabled:_,children:i.jsx(cu,{})}),children:[te?i.jsx("div",{className:"git-mobile-operations-shell",children:st()}):null,i.jsx(b4,{history:f,historyLoadingMore:S,hasMore:!!b,actioning:_,openCommitHash:ke,onToggleMenu:O=>ge(pe=>pe===O?null:O),onCopyCommitHash:O=>void je(O,h("git.copyCommitHashSuccess")),onCopyCommitSubject:O=>void je(O,h("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void dt(),onLoadMore:()=>void lt()})]})]}):i.jsxs("div",{ref:ye,className:"git-content-split",style:{gridTemplateRows:se},children:[i.jsx("section",{className:"git-card git-tree-panel",children:i.jsxs("div",{ref:Ae,className:"git-tree-panel-body",children:[Ce.length>0?i.jsx(Bb,{title:h("git.stagedChangesTitle"),count:Ce.length,nodes:Xe,selectedPath:L,collapsedTreePathSet:We,onToggleTreePath:Zt,onSelectFile:M,onPreviewFile:(O,pe)=>{bn(O)&&xn(O,pe)},onToggleMobileSelection:$,onStageToggle:it,onDiscard:xt,actioning:_,variant:"staged",isMobileViewport:me,selectedMobilePathSet:Oe,selectedTargets:De,mobileActionMenuOpen:E==="staged",onToggleMobileActionMenu:()=>B(O=>O==="staged"?null:"staged"),onClearSelectedTargets:()=>ae(O=>O.filter(pe=>!De.includes(pe)))}):null,i.jsx(Bb,{title:h("git.changesTitle"),count:Fe.length,nodes:Ue,selectedPath:L,collapsedTreePathSet:We,onToggleTreePath:Zt,onSelectFile:M,onPreviewFile:(O,pe)=>{bn(O)&&xn(O,pe)},onToggleMobileSelection:$,onStageToggle:it,onDiscard:xt,actioning:_,variant:"unstaged",isMobileViewport:me,selectedMobilePathSet:Oe,selectedTargets:at,mobileActionMenuOpen:E==="unstaged",onToggleMobileActionMenu:()=>B(O=>O==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>ae(O=>O.filter(pe=>!at.includes(pe)))})]})}),i.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":h("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Lb,"aria-valuemax":rf,"aria-valuenow":X?ze:rf,"data-dragging":zt,onPointerDown:le,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":X,"aria-label":h(X?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>G(O=>!O),children:[i.jsxs("span",{className:"git-section-toggle-main",children:[i.jsx(ju,{expanded:X}),i.jsx("span",{children:h("git.recentVersionsTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:y})]}),i.jsxs("div",{className:"git-history-actions",children:[i.jsx("span",{className:"badge",children:Rt}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:()=>q(O=>!O),disabled:_,children:i.jsx(cu,{})}),te?st():null]})]}),X?i.jsx("div",{className:"git-history-list",onScroll:Y,children:f.length?i.jsxs(i.Fragment,{children:[f.map(O=>i.jsxs("article",{className:"git-history-entry","data-kind":O.commitKind,children:[i.jsx("span",{className:"git-history-marker","data-kind":O.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:O.subject,children:O.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":O.commitKind,children:g0(O.commitKind)})]}),O.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:O.refs.map(pe=>i.jsx("span",{className:"git-history-ref-pill","data-kind":pe.kind,"data-remote-index":String(y0(pe.remoteName)),children:pe.name},`${O.commitHash}:${pe.kind}:${pe.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:O.commitHash.slice(0,8)}),i.jsx("span",{children:O.authorName}),i.jsx("time",{dateTime:O.authoredAt,children:v0(O.authoredAt)})]})]})]},O.commitHash)),S?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(Nr,{open:Ee,title:h("git.selectRemoteTitle"),description:h("git.selectRemoteDesc"),onClose:()=>{_||Be(!1)},children:[i.jsx("div",{className:"git-remote-select-list",children:Ye.map(O=>{const pe=St.has(O.name),Ne=Mt.get(O.name);return i.jsxs("label",{className:"git-remote-item",children:[i.jsx("input",{type:"checkbox",checked:pe,disabled:_,onChange:()=>{Dt(kt=>{const Nt=new Set(kt);return Nt.has(O.name)?Nt.delete(O.name):Nt.add(O.name),Nt})}}),i.jsxs("span",{className:"git-remote-item-body",children:[i.jsx("span",{className:"git-remote-name",children:O.name}),i.jsx("span",{className:"git-remote-url",children:O.pushUrl}),Ne&&i.jsx("span",{className:`git-remote-result ${Ne.ok?"ok":"err"}`,children:Ne.summary})]})]},O.name)})}),i.jsxs("div",{className:"git-remote-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:_,onClick:()=>Be(!1),children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:_||St.size===0,onClick:()=>void Qt(Array.from(St)),children:_?h("git.pushing"):h("git.pushSelected",{count:String(St.size)})})]})]}),i.jsx(YC,{workspaceId:t,filePath:Ze,open:Ze!==null,onClose:()=>{Bt(null),sn(null)},onSaved:async()=>{await At({resetTreeScroll:!0})},diffContent:Ct})]})}function Bb({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:k,selectedMobilePathSet:S,selectedTargets:C,mobileActionMenuOpen:j,onToggleMobileActionMenu:A,onClearSelectedTargets:L}){const M=lp(n),z=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}),!k&&M.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":z,title:z,onClick:()=>void p(M,b==="staged"),disabled:g,children:i.jsx(Yf,{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(M),disabled:g,children:i.jsx(Xf,{})}):null]}):null,k&&C.length>0?i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:A,disabled:g,children:i.jsx(cu,{})}):null]}),k&&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?h0({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:k,selectedMobilePathSet:S}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function of({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(ju,{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 Ub({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:k,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:k,children:h("git.clearSelection")})]})]}):null,i.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?d0({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 d0({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(k=>{if(k.kind==="directory"){const j=!n.has(k.path),A=lp(k.children),L=`directory:${k.path}`;return i.jsxs("div",{className:"git-mobile-record-branch",children:[i.jsx(Wb,{rowKey:L,openState:(f==null?void 0:f.path)===L?f.direction:null,onOpenStateChange:M=>p(M?{path:L,direction:M}:null),trailingActions:A.length>0?[{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y(A,d==="staged")},...d==="unstaged"?[{label:h("git.discard"),tone:"danger",onPress:()=>void g(A,k.path)}]:[]]:null,children:i.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${Fb+t*Ob}px`},onClick:()=>s(k.path),children:[i.jsxs("span",{className:"git-mobile-record-leading",children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:i.jsx(ju,{expanded:j})}),i.jsx("span",{className:"git-mobile-record-title",children:k.name})]}),i.jsx("span",{className:"git-mobile-record-meta",children:A.length})]})}),j?i.jsx("div",{className:"git-mobile-record-children",role:"group",children:d0({nodes:k.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:${k.path}`,C=c.has(k.path);return i.jsx(Wb,{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(k.change.path,k.change)},{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y([k.change.path],d==="staged")},...d==="unstaged"?[{label:h("git.discard"),tone:"danger",onPress:()=>void g([k.change.path],k.path)}]:[]],children:i.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${Fb+t*Ob}px`},children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${k.name}`,onChange:()=>a(k.change.path)}),i.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>a(k.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Fs(k.name),"aria-hidden":"true",children:_s(k.name)}),i.jsxs("span",{className:"git-mobile-record-copy",children:[i.jsx("span",{className:"git-mobile-record-title",children:k.name}),i.jsx("span",{className:"git-mobile-record-path",children:k.path})]}),i.jsx("span",{className:"git-status-badge","data-status":k.status,children:k.status})]})]})},S)})}function Wb({rowKey:e,openState:t,onOpenStateChange:n,trailingActions:s,children:a}){const c=Br(),l=v.useRef(null),[d,f]=v.useState(0),p=((s==null?void 0:s.length)??0)*sf;v.useEffect(()=>{t||f(0)},[t,e]);const y=d!==0?d:t==="trailing"?-p:0;function g(C){var j,A;C.button===0&&(l.current={pointerId:C.pointerId,startX:C.clientX},(A=(j=C.currentTarget).setPointerCapture)==null||A.call(j,C.pointerId))}function b(C){const j=l.current;if(!j||j.pointerId!==C.pointerId)return;const A=p>0?p+10:0,L=Math.max(-A,Math.min(0,C.clientX-j.startX));f(L)}function k(C){var A,L;const j=l.current;if(!(!j||j.pointerId!==C.pointerId)){if((L=(A=C.currentTarget).releasePointerCapture)==null||L.call(A,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 A,L;const j=l.current;!j||j.pointerId!==C.pointerId||((L=(A=C.currentTarget).releasePointerCapture)==null||L.call(A,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*sf,width:sf},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:k,onPointerCancel:S,children:a})]})}function b4({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,k=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:g0(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(y0(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:v0(y.authoredAt)})]})]}),i.jsx("button",{type:"button",className:"git-icon-button","aria-label":h("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:i.jsx(cu,{})})]}),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")})}),k?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 h0({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:k}){return e.map(S=>{if(S.kind==="directory"){const A=!n.has(S.path),L=lp(S.children),M=`${h(g==="staged"?"git.unstage":"git.stage")} ${S.path}`,z=`${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":A,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":A,children:i.jsx(ju,{expanded:A})}),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":M,title:M,onClick:()=>void f(L,g==="staged"),disabled:y,children:i.jsx(Yf,{staged:g==="staged"})}),g==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":z,title:z,onClick:()=>void p(L),disabled:y,children:i.jsx(Xf,{})}):null]}):null]}),A?i.jsx("div",{className:"git-tree-children",role:"group",children:h0({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:k})}):null]},`directory:${S.path}`)}const C=k.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":Fs(S.name),"aria-hidden":"true",children:_s(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":Fs(S.name),"aria-hidden":"true",children:_s(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(Yf,{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(Xf,{})}):null]})]},`file:${S.path}`)})}function zb(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function Hb(e,t){const n=zb("","");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:x4(s,t),variant:t});return}const y=`directory:${p}`,g=l.children.get(y);if(g&&g.kind==="directory"){l=g;return}const b=zb(d,p);l.children.set(y,b),l=b})}return m0(f0([...n.children.values()]))}function f0(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:f0([...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 qb(e,t,n){const s=new Set(e);return t.filter(a=>Qf(a,n)&&s.has(a.path)).map(a=>a.path)}function lp(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 Qf(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function x4(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function k4(e){return{subject:p0(e).trim(),body:null,footer:null,source:"manual"}}function p0(e){return e.replace(/[\r\n]+/g," ")}function S4(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 g0(e){switch(e){case"local":return h("git.historyKindLocal");case"remote":return h("git.historyKindRemote");default:return h("git.historyKindShared")}}function y0(e){if(!e)return 0;let t=0;for(const n of e)t=t*33+n.charCodeAt(0)>>>0;return t%6}function Yr(e,t){return e instanceof tr?C4(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function af(e){return`git-sidebar.snapshot.${e}`}function C4(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 ju({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 Yf({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 Xf(){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 j4(){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 cu(){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 v0(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 N4=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:u0},Symbol.toStringTag,{value:"Module"})),w0="mobile.tools.last-primary-tool",zc=["files","git"],P4=56,T4=1.2;function $b(e,t){return e==="git"?"git":e==="files"?"files":t}function E4(e,t,n){if(!t)return e;const s=n.x-t.x,a=n.y-t.y;if(Math.abs(s)<P4||Math.abs(s)<Math.abs(a)*T4)return e;const c=zc.indexOf(e),l=s<0?Math.min(zc.length-1,c+1):Math.max(0,c-1);return zc[l]??e}function R4(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(w0)==="git"?"git":"files"}catch{return"files"}}function M4(){var M,z;const e=ti(),t=qn(),n=Br(),{navigationGroups:s,currentWorkspaceId:a,currentSessionId:c,selectWorkspace:l}=rr(),d=((M=s.find(V=>V.workspace.id===a))==null?void 0:M.workspace)??((z=s[0])==null?void 0:z.workspace)??null,f=new URLSearchParams(e.search).get("tab"),p=v.useRef(R4()),y=$b(f,p.current),[g,b]=v.useState(()=>{const V=$b(f,p.current);return{files:V==="files",git:V==="git"}}),k=v.useRef(null),S=v.useMemo(()=>[{key:"files",title:h("shell.filesEntry"),render:()=>i.jsx(i0,{sessionId:c,workspaceId:a,hideHeading:!0})},{key:"git",title:h("shell.gitEntry"),render:()=>i.jsx(u0,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:a,panelActive:y==="git"})}],[y,c,a]),C=zc.indexOf(y);v.useEffect(()=>{b(V=>({...V,[y]:!0}))},[y]),v.useEffect(()=>{if(p.current=y,!(typeof window>"u"))try{window.localStorage.setItem(w0,y)}catch{}},[y]),v.useEffect(()=>{if(f===y)return;const V=new URLSearchParams(e.search);V.set("tab",y),t({pathname:e.pathname,search:`?${V.toString()}`},{replace:!0})},[y,e.pathname,e.search,t,f]);function j(V,F="selection"){if(V===y)return;n.trigger(F);const I=new URLSearchParams(e.search);I.set("tab",V),t({pathname:e.pathname,search:`?${I.toString()}`},{replace:!0})}function A(V){if(V.changedTouches.length!==1){k.current=null;return}const F=V.changedTouches[0];k.current={x:F.clientX,y:F.clientY}}function L(V){const F=k.current;if(k.current=null,V.changedTouches.length!==1)return;const I=V.changedTouches[0],_=E4(y,F,{x:I.clientX,y:I.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(Do,{currentWorkspace:d,workspaces:s.map(V=>V.workspace),onSelectWorkspace:V=>{l(V),t(Ao(V,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(wu(d.id))},children:i.jsx(A4,{})}),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(V=>{const F=V.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-${V.key}`,onClick:()=>j(V.key,"selection"),children:V.title},V.key)})})})}),i.jsx("section",{className:"mobile-tools-stage","data-active-tool":y,"data-testid":"mobile-tools-stage",onTouchStart:A,onTouchEnd:L,onTouchCancel:()=>{k.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(V=>i.jsx("article",{id:`mobile-tool-panel-${V.key}`,role:"tabpanel","aria-label":V.title,"aria-hidden":V.key!==y,className:"mobile-tools-stage-panel",children:i.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[V.key]?V.render():null})},V.key))})})})]}):i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})})})}function A4(){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 L4(e){return e.isArchived!==!0&&e.isSubagent!==!0}function b0(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function I4(e){return e.activityState==="idle"&&b0(e)===!1}function Vb(e){return e==="creating"||e==="running"}function uu(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function D4(e,t){return uu(t).localeCompare(uu(e))}function Gb(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"shell.providerClaudeCode")}function Kb(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}const Pc=60*1e3;function _4(){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}=rr(),[b,k]=v.useState(null),[S,C]=v.useState(!1),[j,A]=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,M=(L==null?void 0:L.workspace)??null,z=[...(L==null?void 0:L.sessions)??[]].filter(L4).sort(D4),V=z.filter(b0),F=z.filter(I4),I=z.filter(T=>T.activityState==="completed_unread"),_=z.filter(T=>T.isFavorite===!0),D=V.slice(0,6),P=_.slice(0,6);v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(!T){A({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const ke=Ln(lf(T),Pc);A(ge=>{var Ee,Be;return{...ge,gitLoading:ke===null,branch:((Ee=ke==null?void 0:ke.status)==null?void 0:Ee.snapshot.branch)??null,changedFileCount:((Be=ke==null?void 0:ke.status)==null?void 0:Be.changes.length)??null}})},[M==null?void 0:M.id]),v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(T)return f(ke=>{ke.workspaceId===T&&(Pr(lf(T),ke),A(ge=>{var Ee,Be,Ye;return{...ge,gitLoading:!1,branch:((Ee=ke.status)==null?void 0:Ee.snapshot.branch)??((Be=ke.branches)==null?void 0:Be.currentBranch)??null,changedFileCount:((Ye=ke.status)==null?void 0:Ye.changes.length)??null}}))})},[f,M==null?void 0:M.id]),v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(!T){A(ge=>({...ge,gitLoading:!1,branch:null,changedFileCount:null}));return}const ke=Ln(cf(T),Pc);A(ge=>({...ge,terminalLoading:ke===null,activeTerminalCount:ke?ke.terminals.filter(Ee=>Vb(Ee.status)).length:null,quickLaunchRunning:ke?ke.templateStatuses.some(Ee=>Ee.occupied):null}))},[M==null?void 0:M.id]),v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(!T){A(ke=>({...ke,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return g(ke=>{ke.workspaceId===T&&(Pr(cf(T),{terminals:ke.terminals,templates:ke.templates,templateStatuses:ke.templateStatuses}),A(ge=>({...ge,terminalLoading:!1,activeTerminalCount:ke.terminals.filter(Ee=>Vb(Ee.status)).length,quickLaunchRunning:ke.templateStatuses.some(Ee=>Ee.occupied)})))})},[g,M==null?void 0:M.id]),v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(!T)return;const ke=Ln(lf(T),Pc)!==null;l(T),!ke&&d(T)},[M==null?void 0:M.id,d,l]),v.useEffect(()=>{const T=(M==null?void 0:M.id)??null;if(!T)return;const ke=Ln(cf(T),Pc)!==null;p(T),!ke&&y(T)},[M==null?void 0:M.id,y,p]);async function J(T){await s(),a(T.id),k(null),e(fi(T.id))}async function X(T){await s(),a(T.id),k(null),e(fi(T.id))}function G(){M&&(a(M.id),e(Ao(M.id,"git")))}function te(){M&&(a(M.id),e(xo(M.id)))}function q(){M&&(a(M.id),e(wu(M.id)))}function me(){M&&e(rl(M.id))}function ne(){M&&C(!0)}function K(T,ke){C(!1),c(T,ke)}function ae(){M&&(a(M.id),e(fi(M.id)))}function E(T){a(T)}const B=[{label:h("shell.workspaceHomeMetricActive"),value:V.length,onClick:z.length>0?me:void 0},{label:h("shell.workspaceHomeMetricUnread"),value:I.length,onClick:z.length>0?me:void 0},{label:h("shell.workspaceHomeMetricTerminal"),value:j.terminalLoading?"…":j.activeTerminalCount??"—",onClick:M?te:void 0},{label:h("shell.workspaceHomeMetricChanges"),value:j.gitLoading?"…":j.changedFileCount??"—",onClick:M?G:void 0}],re=[{label:h("shell.workspaceHomeQuickLaunchStatusLabel"),value:j.quickLaunchRunning===null?"…":j.quickLaunchRunning?h("shell.workspaceHomeQuickLaunchRunning"):h("shell.workspaceHomeQuickLaunchStopped"),onClick:M?q:void 0},{label:h("shell.workspaceHomeWaitingInputLabel"),value:F.length,onClick:z.length>0?me:void 0}];return i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[M?i.jsxs(i.Fragment,{children:[i.jsx(Do,{currentWorkspace:M,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(),k("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(Ji,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{T(),k("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(Ji,{})})]})]})}),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:ae,children:h("shell.workspaceDetailTitle")}),i.jsx("button",{type:"button",className:"primary-button",onClick:ne,children:h("shell.createSession")})]})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-group",children:re.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(Ji,{})]})]},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")}),M?i.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:me,children:h("shell.workspaceHomeViewAllAction")}):null]}),i.jsx("div",{className:"mobile-workspace-home-group",children:D.length===0?i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:ne,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:M.name})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Ji,{})})]}):D.map(T=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Hn(M.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:[Gb(T.provider)," · ",Kb(uu(T))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Ji,{})})]},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(Hn(M.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:[Gb(T.provider)," · ",Kb(uu(T))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Ji,{})})]},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:()=>k("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(Ji,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>k("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(Ji,{})})]})]})]})}),i.jsx(rC,{open:b==="import",onClose:()=>k(null),onImported:J}),i.jsx(nC,{open:b==="clone",onClose:()=>k(null),onCloned:X}),i.jsx(ol,{open:S,workspaces:t.map(T=>T.workspace),initialWorkspaceId:(M==null?void 0:M.id)??n??null,onClose:()=>C(!1),onSelect:K})]})}function lf(e){return`git-sidebar.snapshot.${e}`}function cf(e){return`terminal-manager.snapshot.${e}`}function Ji(){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 Qb(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function F4(e){return e.isArchived!==!0&&e.isSubagent!==!0}function O4(e){return e.isArchived===!0&&e.isSubagent!==!0}function Yb(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function Xb(e,t){return Yb(t).localeCompare(Yb(e))}const uf=60*1e3,df=10;function B4(){var me;const{workspaceId:e=""}=um(),t=qn(),{showToast:n}=Xn(),{navigationGroups:s,currentWorkspaceId:a,favoriteSessionIds:c,workspaceManagementStateById:l,selectWorkspace:d,subscribeGitSnapshot:f,requestGitRefresh:p,subscribeWorkspaceManagementSnapshot:y,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:b,archiveSession:k,unarchiveSession:S,startDraftSession:C}=rr(),[j,A]=v.useState(!1),[L,M]=v.useState(!1),[z,V]=v.useState(df),F=s.find(ne=>ne.workspace.id===e)??null,I=(F==null?void 0:F.workspace)??null,_=v.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(F4).sort(Xb),[F]),D=v.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(O4).sort(Xb),[F]);v.useEffect(()=>{e&&d(e)},[d,e]),v.useEffect(()=>{if(!e)return;f(e),y(e);const ne=Ln(z4(e),uf)!==null,K=Ln(Jb(e),uf)!==null;ne||p(e),K||g(e)},[p,g,f,y,e]),v.useEffect(()=>{V(df)},[e]);const P=v.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const ne=Ln(Jb(e),uf),K=l[e]??null,ae=(K==null?void 0:K.detail)??(I?H4(I,ne):ne??null);return{loading:(K==null?void 0:K.loading)??!1,error:(K==null?void 0:K.error)??null,hasMeaningfulSummary:q4(ae),summary:ae}},[I,e,l]),J=v.useMemo(()=>P.summary?YS(P.summary.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],[P.summary]),X=v.useMemo(()=>J.length>0?XS(J):void 0,[J]),G=v.useMemo(()=>D.slice(0,z),[D,z]);async function te(){if(!(!I||!(typeof window>"u"||window.confirm(h("shell.manageWorkspaceRemoveConfirmTarget",{name:I.name}))))){A(!0);try{await mk(I.id),n({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(K){n({title:K instanceof Error?K.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{A(!1)}}}function q(ne,K){M(!1),C(ne,K)}return I?i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[i.jsx(Do,{currentWorkspace:I,workspaces:s.map(ne=>ne.workspace),heading:h("shell.workspaceDetailTitle"),triggerLabel:I.name,onSelectWorkspace:ne=>{d(ne),t(fi(ne))},content:i.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[i.jsx("button",{type:"button",className:"primary-button",onClick:()=>M(!0),children:h("shell.createSession")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(MS(I.id))},children:h("shell.filesEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(xo(I.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!==I.id?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(I.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(I.id),t(AS(I.id))},children:h("shell.gitEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(wu(I.id))},children:h("shell.terminalManagerEntry")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>{te()},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?J.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:X,"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:J.map(ne=>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:ne.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:ne.type})]}),i.jsxs("span",{children:[ne.count," · ",QS(ne)]})]},ne.key))})]}):i.jsx("p",{children:P.summary.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}):null,(me=P.summary)!=null&&me.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(ne=>{const K=as(ne.title,h("common.unknown")),ae=c.includes(ne.sessionId);return i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Hn(I.id,ne.sessionId)),children:[i.jsx("span",{className:"mobile-session-row-title",title:K.fullTitle,children:K.displayTitle}),i.jsx("span",{className:"mobile-session-row-provider",children:Qb(ne.provider)})]}),i.jsxs("div",{className:"mobile-session-row-actions",children:[i.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:ne.messageCount}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h(ae?"shell.unfavoriteAction":"shell.favoriteAction"),title:h(ae?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{b(ne.sessionId)},children:i.jsx(U4,{active:ae})}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h("shell.archiveAction"),title:h("shell.archiveAction"),onClick:()=>{k(ne.sessionId)},children:i.jsx(W4,{})})]})]},ne.sessionId)})})]}),D.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:D.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:G.map(ne=>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:ne.title,children:ne.title}),i.jsx("span",{className:"mobile-session-row-provider",children:Qb(ne.provider)})]}),i.jsx("div",{className:"mobile-session-row-actions",children:i.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{S(ne.sessionId)},children:h("shell.unarchiveAction")})})]},ne.sessionId))}),G.length<D.length?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{V(ne=>ne+df)},children:h("shell.archiveExpandMore")}):null]}):null]}),i.jsx(ol,{open:L,workspaces:s.map(ne=>ne.workspace),initialWorkspaceId:a??I.id,onClose:()=>M(!1),onSelect:q})]}):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 U4({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 W4(){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 Jb(e){return`workspace-management.summary.${e}`}function z4(e){return`git-sidebar.snapshot.${e}`}function H4(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 q4(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 $4({isDesktop:e,isWeb:t,viewportClass:n}){return e||t&&n==="expanded"?"desktop":"mobile"}function V4(){const e=In(),t=$4(e);return i.jsx(LF,{shellMode:t})}const G4=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function K4(){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:G4.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 Q4(){const{shellMode:e}=rr();return e==="mobile"?i.jsx(Ja,{to:"/workspaces",replace:!0}):i.jsx(K4,{})}async function Y4(){const e=mi(),t=An.getState(),n=await e.bridge.checkForUpdate(t.releaseChannel);if(!n.ok||!n.value)throw new Error(n.detail??"更新检查失败。");return n.value}async function X4(e){return mi().bridge.installUpdate(e)}async function J4(){return mi().bridge.rollbackToPreviousVersion()}function x0(){const e=mi(),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,k]=v.useState(null),[S,C]=v.useState(!1);async function j(){var F,I;s(!0),p(null);try{const _=await Y4();k(_.manifest),g(_.currentVersion),C(_.hasUpdate),p(Z4(_.manifest,_.hasUpdate)),_.hasUpdate&&await e.bridge.showNotification(h("settings.releaseUpdateReady"),((F=_.manifest)==null?void 0:F.tagName)??((I=_.manifest)==null?void 0:I.version)??"-")}catch(_){p(_ instanceof Error?_.message:h("settings.releaseCheckFailed"))}finally{s(!1)}}async function A(){if(!(!(b!=null&&b.packageUrl)||!b.signature)){c(!0),p(null);try{const F=await X4(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 J4();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 M(){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 z=!!(t&&(b!=null&&b.packageUrl)&&b.signature&&S),V=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"),": ",eW(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(Em,{remarkPlugins:[Lm],children:b.notes})}):i.jsx("p",{children:h("settings.releaseNotesEmpty")})]}):null,V?i.jsx("p",{className:"settings-release-status",children:V}):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:!z||a,onClick:A,children:h(a?"common.loading":"settings.releaseInstallNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(b!=null&&b.htmlUrl)||n||a||l,onClick:M,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 Z4(e,t){return t?e!=null&&e.packageUrl?e.signature?h("settings.releaseUpdateReady"):h("settings.releaseSignatureMissing"):h("settings.releaseInstallerMissing"):h("settings.releaseUpToDate")}function eW(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function tW(){const e=An.getState();return Ke.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function k0(){const e=mi(),[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 tW();f(g),l(nW(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 nW(e){return e.latestVersion?e.hasUpdate?h("settings.serverUpdateReady"):h("settings.serverUpToDate"):h("settings.serverLatestUnknown")}function Zb({title:e,description:t,actions:n,content:s,className:a}){return i.jsx(_C,{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 rW(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function ex(e){return h(e==="en-US"?"locale.enUS":"locale.zhCN")}function tx(e){return h(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function nx(e){switch(e){case"acceptEdits":return h("settings.permissionModeAcceptEdits");case"bypassPermissions":return h("settings.permissionModeBypassPermissions");default:return h("settings.permissionModeDefault")}}function iW(){const e=qn(),{theme:t,setTheme:n}=ik(),s=Mj(q=>q),a=pf(q=>q.profile.language),c=pf(q=>q.profile.defaultPermissionMode),l=Ti(q=>q.showSystemFiles),d=Ti(q=>q.notificationPreferences.notifyOnPermissionRequest),f=Ti(q=>q.notificationPreferences.notifyOnSessionCompleted),p=Ti(q=>q.notificationPreferences.notifyOnSessionFailed),y={language:a,defaultPermissionMode:c},g=In(),b=em(s.platform),k=b,[S,C]=v.useState(s.hostBaseUrl);v.useEffect(()=>{C(s.hostBaseUrl)},[s.hostBaseUrl]);function j(){wn.clear(),ei.resetToLocalFallback(),e("/login",{replace:!0})}function A(q){n(q)}function L(q){try{return Ri(q)}catch{return null}}const M=L(S),z=M!==null&&M!==s.hostBaseUrl;function V(q){q.preventDefault(),M&&An.update({hostBaseUrl:M})}const F=[{value:"default",label:h("settings.permissionModeDefault")},{value:"acceptEdits",label:h("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:h("settings.permissionModeBypassPermissions")}];function I(q){An.update({releaseChannel:q==="beta"?"beta":"stable"})}function _(q){An.update({autoReconnect:q})}function D(q){An.update({autoCheckUpdate:q})}function P(q){const me=q==="acceptEdits"||q==="bypassPermissions"?q:"default";ei.updateProfile({defaultPermissionMode:me}).catch(()=>{})}function J(q){bo.setShowSystemFiles(q)}function X(q){bo.setNotificationPreferences({notifyOnPermissionRequest:q})}function G(q){bo.setNotificationPreferences({notifyOnSessionCompleted:q})}function te(q){bo.setNotificationPreferences({notifyOnSessionFailed:q})}return{platform:g,theme:t,applyTheme:A,runtimeConfig:s,accountPreferences:y,showSystemFiles:l,notifyOnPermissionRequest:d,notifyOnSessionCompleted:f,notifyOnSessionFailed:p,showServerSettings:k,canConfigureServerAddress:b,hostBaseUrlDraft:S,setHostBaseUrlDraft:C,canSaveHostBaseUrl:z,permissionModeOptions:F,handleHostBaseUrlSubmit:V,handleLogout:j,updateReleaseChannel:I,updateAutoReconnect:_,updateAutoCheckUpdate:D,updateDefaultPermissionMode:P,updateShowSystemFiles:J,updateNotifyOnPermissionRequest:X,updateNotifyOnSessionCompleted:G,updateNotifyOnSessionFailed:te}}function rx(){const e=iW(),t=ak();return e.platform.isMobile?i.jsx(oW,{model:e,appVersion:t}):i.jsx(sW,{model:e,appVersion:t})}function sW({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:k,permissionModeOptions:S,platform:C,handleHostBaseUrlSubmit:j,handleLogout:A,updateReleaseChannel:L,updateAutoReconnect:M,updateAutoCheckUpdate:z,updateDefaultPermissionMode:V,updateShowSystemFiles:F,updateNotifyOnPermissionRequest:I,updateNotifyOnSessionCompleted:_,updateNotifyOnSessionFailed:D}=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(dm,{})})]}),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:nk.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:rk(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:!k,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=>M(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=>V(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=>I(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=>D(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(k0,{})})]}),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=>z(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(x0,{})})]})]})]})]}),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:A,type:"button",children:h("common.logout")})]})]})})}function oW({model:e,appVersion:t}){const n=qn(),{section:s}=um(),a=rW(s)?s:null,c=e.showServerSettings?[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:ex(e.accountPreferences.language),icon:i.jsx(sx,{})},{id:"server-connection",title:h("settings.serverConnection"),description:h("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:i.jsx(dW,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:nx(e.accountPreferences.defaultPermissionMode),icon:i.jsx(ax,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:tx(e.runtimeConfig.releaseChannel),icon:i.jsx(ox,{})}]:[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:ex(e.accountPreferences.language),icon:i.jsx(sx,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:nx(e.accountPreferences.defaultPermissionMode),icon:i.jsx(ax,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:tx(e.runtimeConfig.releaseChannel),icon:i.jsx(ox,{})}];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(Zb,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[a==="appearance"?i.jsx(aW,{model:e}):null,a==="server-connection"&&e.showServerSettings?i.jsx(lW,{model:e}):null,a==="security-privacy"?i.jsx(cW,{model:e}):null,a==="software-update"?i.jsx(uW,{model:e}):null]}),i.jsx(ix,{onLogout:e.handleLogout})]}):i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(Zb,{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(hW,{})]})]},d.id))})}),i.jsx("div",{className:"settings-footer settings-footer-mobile",children:i.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),i.jsx(ix,{onLogout:e.handleLogout})]})}function aW({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(dm,{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:nk.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:rk(t)})]}),i.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:n?i.jsx(fW,{}):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(jo,{checked:e.showSystemFiles,label:h("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})})]})]})}function lW({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(jo,{checked:e.runtimeConfig.autoReconnect,label:h("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function cW({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(jo,{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(jo,{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(jo,{checked:e.notifyOnSessionFailed,label:h("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function uW({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(k0,{})})]}),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(jo,{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(x0,{})})]})]})}function ix({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 jo({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 sx(){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 dW(){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 ox(){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 ax(){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 hW(){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 fW(){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 mW(){const e=jx(n=>n.session),t=ti();if(!e){const n=`${t.pathname}${t.search}`;return i.jsx(Ja,{to:`/login?returnTo=${encodeURIComponent(n)}`,replace:!0})}return i.jsx(wf,{})}function lx(){const{shellMode:e}=rr();return i.jsx(Ja,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const pW=[{path:"/bootstrap",element:i.jsx(gT,{})},{path:"/login",element:i.jsx(ST,{})},{path:"/",element:i.jsx(mW,{}),children:[{element:i.jsx(V4,{}),children:[{index:!0,element:i.jsx(lx,{})},{path:"landing",element:i.jsx(Q4,{})},{path:"workspaces",element:i.jsx(_4,{})},{path:"workspaces/:workspaceId",element:i.jsx(B4,{})},{path:"workspaces/:workspaceId/sessions",element:i.jsx(jB,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:i.jsx(tB,{})},{path:"workspaces/:workspaceId/tools",element:i.jsx(M4,{})},{path:"workspaces/:workspaceId/tools/files",element:i.jsx(NB,{})},{path:"workspaces/:workspaceId/tools/git",element:i.jsx(PB,{})},{path:"workspaces/:workspaceId/tools/processes",element:i.jsx(YB,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await Za(()=>import("./TerminalPage-Nq5sPc5c.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"settings",element:i.jsx(rx,{})},{path:"settings/:section",element:i.jsx(rx,{})},{path:"*",element:i.jsx(lx,{})}]}]}];function gW(){return CP(pW)}function yW(){const e=To(n=>n.profile.language),t=v.useMemo(()=>gW(),[]);return i.jsx(HP,{children:i.jsx(aT,{children:i.jsx(YP,{language:e,children:i.jsx(nT,{children:i.jsx(oT,{children:i.jsx(LP,{router:t})})})})})})}iN().finally(()=>{oj.createRoot(document.getElementById("root")).render(i.jsx(yW,{}))});export{BS as C,Do as M,IB as T,wn as a,Br as b,Ym as c,qn as d,um as e,rr as f,Sx as g,Xn as h,bW as i,Ln as j,i as k,AB as l,jW as m,vb as n,kW as o,CW as p,Bn as q,v as r,Xm as s,h as t,In as u,xW as v,Pr as w,LB as x,SW as y,wW as z};
|