agent-workbench 0.5.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -33
- package/dist/server.js +4443 -664
- package/dist/web/assets/de-CmDQFS83.js +1 -0
- package/dist/web/assets/es-kfFlJ6C6.js +1 -0
- package/dist/web/assets/fr-CgQRflYh.js +1 -0
- package/dist/web/assets/{highlight-BeEbartE.js → highlight-DsNwA50i.js} +1 -1
- package/dist/web/assets/index-mQpsIj-O.js +149 -0
- package/dist/web/assets/index-vJBDG99a.css +32 -0
- package/dist/web/assets/ja-BPlbe60x.js +1 -0
- package/dist/web/assets/ko-DeqZlJbl.js +1 -0
- package/dist/web/assets/pt-BR-Czz2tUjz.js +1 -0
- package/dist/web/assets/ru-Dxhm5BY3.js +1 -0
- package/dist/web/assets/zh-CN-CldKBtQb.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +5 -2
- package/dist/web/assets/de-Dn90shDf.js +0 -1
- package/dist/web/assets/es-ssi17uPF.js +0 -1
- package/dist/web/assets/fr-CqnouzuH.js +0 -1
- package/dist/web/assets/index-D4OE_EfT.css +0 -32
- package/dist/web/assets/index-zFKk_FJ_.js +0 -139
- package/dist/web/assets/ja-1U-Ks_ON.js +0 -1
- package/dist/web/assets/ko-Ce2gOy44.js +0 -1
- package/dist/web/assets/pt-BR-BC8Km40N.js +0 -1
- package/dist/web/assets/ru-DFCLMfWY.js +0 -1
- package/dist/web/assets/zh-CN-VwZ7SeiK.js +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var c_=Object.defineProperty;var u_=(n,t,i)=>t in n?c_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i;var jt=(n,t,i)=>u_(n,typeof t!="symbol"?t+"":t,i);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))a(p);new MutationObserver(p=>{for(const k of p)if(k.type==="childList")for(const C of k.addedNodes)C.tagName==="LINK"&&C.rel==="modulepreload"&&a(C)}).observe(document,{childList:!0,subtree:!0});function i(p){const k={};return p.integrity&&(k.integrity=p.integrity),p.referrerPolicy&&(k.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?k.credentials="include":p.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function a(p){if(p.ep)return;p.ep=!0;const k=i(p);fetch(p.href,k)}})();function h_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Mc={exports:{}},Ji={},Ac={exports:{}},at={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var sf;function d_(){if(sf)return at;sf=1;var n=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),C=Symbol.for("react.context"),r=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),h=Symbol.iterator;function w(H){return H===null||typeof H!="object"?null:(H=h&&H[h]||H["@@iterator"],typeof H=="function"?H:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,g={};function c(H,V,te){this.props=H,this.context=V,this.refs=g,this.updater=te||E}c.prototype.isReactComponent={},c.prototype.setState=function(H,V){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,V,"setState")},c.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function f(){}f.prototype=c.prototype;function m(H,V,te){this.props=H,this.context=V,this.refs=g,this.updater=te||E}var d=m.prototype=new f;d.constructor=m,R(d,c.prototype),d.isPureReactComponent=!0;var L=Array.isArray,I=Object.prototype.hasOwnProperty,x={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function b(H,V,te){var ie,pe={},me=null,X=null;if(V!=null)for(ie in V.ref!==void 0&&(X=V.ref),V.key!==void 0&&(me=""+V.key),V)I.call(V,ie)&&!M.hasOwnProperty(ie)&&(pe[ie]=V[ie]);var K=arguments.length-2;if(K===1)pe.children=te;else if(1<K){for(var J=Array(K),Z=0;Z<K;Z++)J[Z]=arguments[Z+2];pe.children=J}if(H&&H.defaultProps)for(ie in K=H.defaultProps,K)pe[ie]===void 0&&(pe[ie]=K[ie]);return{$$typeof:n,type:H,key:me,ref:X,props:pe,_owner:x.current}}function T(H,V){return{$$typeof:n,type:H.type,key:V,ref:H.ref,props:H.props,_owner:H._owner}}function D(H){return typeof H=="object"&&H!==null&&H.$$typeof===n}function B(H){var V={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(te){return V[te]})}var O=/\/+/g;function F(H,V){return typeof H=="object"&&H!==null&&H.key!=null?B(""+H.key):V.toString(36)}function U(H,V,te,ie,pe){var me=typeof H;(me==="undefined"||me==="boolean")&&(H=null);var X=!1;if(H===null)X=!0;else switch(me){case"string":case"number":X=!0;break;case"object":switch(H.$$typeof){case n:case t:X=!0}}if(X)return X=H,pe=pe(X),H=ie===""?"."+F(X,0):ie,L(pe)?(te="",H!=null&&(te=H.replace(O,"$&/")+"/"),U(pe,V,te,"",function(Z){return Z})):pe!=null&&(D(pe)&&(pe=T(pe,te+(!pe.key||X&&X.key===pe.key?"":(""+pe.key).replace(O,"$&/")+"/")+H)),V.push(pe)),1;if(X=0,ie=ie===""?".":ie+":",L(H))for(var K=0;K<H.length;K++){me=H[K];var J=ie+F(me,K);X+=U(me,V,te,J,pe)}else if(J=w(H),typeof J=="function")for(H=J.call(H),K=0;!(me=H.next()).done;)me=me.value,J=ie+F(me,K++),X+=U(me,V,te,J,pe);else if(me==="object")throw V=String(H),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return X}function q(H,V,te){if(H==null)return H;var ie=[],pe=0;return U(H,ie,"","",function(me){return V.call(te,me,pe++)}),ie}function G(H){if(H._status===-1){var V=H._result;V=V(),V.then(function(te){(H._status===0||H._status===-1)&&(H._status=1,H._result=te)},function(te){(H._status===0||H._status===-1)&&(H._status=2,H._result=te)}),H._status===-1&&(H._status=0,H._result=V)}if(H._status===1)return H._result.default;throw H._result}var Y={current:null},W={transition:null},j={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:W,ReactCurrentOwner:x};function $(){throw Error("act(...) is not supported in production builds of React.")}return at.Children={map:q,forEach:function(H,V,te){q(H,function(){V.apply(this,arguments)},te)},count:function(H){var V=0;return q(H,function(){V++}),V},toArray:function(H){return q(H,function(V){return V})||[]},only:function(H){if(!D(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},at.Component=c,at.Fragment=i,at.Profiler=p,at.PureComponent=m,at.StrictMode=a,at.Suspense=u,at.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,at.act=$,at.cloneElement=function(H,V,te){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var ie=R({},H.props),pe=H.key,me=H.ref,X=H._owner;if(V!=null){if(V.ref!==void 0&&(me=V.ref,X=x.current),V.key!==void 0&&(pe=""+V.key),H.type&&H.type.defaultProps)var K=H.type.defaultProps;for(J in V)I.call(V,J)&&!M.hasOwnProperty(J)&&(ie[J]=V[J]===void 0&&K!==void 0?K[J]:V[J])}var J=arguments.length-2;if(J===1)ie.children=te;else if(1<J){K=Array(J);for(var Z=0;Z<J;Z++)K[Z]=arguments[Z+2];ie.children=K}return{$$typeof:n,type:H.type,key:pe,ref:me,props:ie,_owner:X}},at.createContext=function(H){return H={$$typeof:C,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:k,_context:H},H.Consumer=H},at.createElement=b,at.createFactory=function(H){var V=b.bind(null,H);return V.type=H,V},at.createRef=function(){return{current:null}},at.forwardRef=function(H){return{$$typeof:r,render:H}},at.isValidElement=D,at.lazy=function(H){return{$$typeof:_,_payload:{_status:-1,_result:H},_init:G}},at.memo=function(H,V){return{$$typeof:v,type:H,compare:V===void 0?null:V}},at.startTransition=function(H){var V=W.transition;W.transition={};try{H()}finally{W.transition=V}},at.unstable_act=$,at.useCallback=function(H,V){return Y.current.useCallback(H,V)},at.useContext=function(H){return Y.current.useContext(H)},at.useDebugValue=function(){},at.useDeferredValue=function(H){return Y.current.useDeferredValue(H)},at.useEffect=function(H,V){return Y.current.useEffect(H,V)},at.useId=function(){return Y.current.useId()},at.useImperativeHandle=function(H,V,te){return Y.current.useImperativeHandle(H,V,te)},at.useInsertionEffect=function(H,V){return Y.current.useInsertionEffect(H,V)},at.useLayoutEffect=function(H,V){return Y.current.useLayoutEffect(H,V)},at.useMemo=function(H,V){return Y.current.useMemo(H,V)},at.useReducer=function(H,V,te){return Y.current.useReducer(H,V,te)},at.useRef=function(H){return Y.current.useRef(H)},at.useState=function(H){return Y.current.useState(H)},at.useSyncExternalStore=function(H,V,te){return Y.current.useSyncExternalStore(H,V,te)},at.useTransition=function(){return Y.current.useTransition()},at.version="18.3.1",at}var rf;function ju(){return rf||(rf=1,Ac.exports=d_()),Ac.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var of;function f_(){if(of)return Ji;of=1;var n=ju(),t=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,p=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,k={key:!0,ref:!0,__self:!0,__source:!0};function C(r,u,v){var _,h={},w=null,E=null;v!==void 0&&(w=""+v),u.key!==void 0&&(w=""+u.key),u.ref!==void 0&&(E=u.ref);for(_ in u)a.call(u,_)&&!k.hasOwnProperty(_)&&(h[_]=u[_]);if(r&&r.defaultProps)for(_ in u=r.defaultProps,u)h[_]===void 0&&(h[_]=u[_]);return{$$typeof:t,type:r,key:w,ref:E,props:h,_owner:p.current}}return Ji.Fragment=i,Ji.jsx=C,Ji.jsxs=C,Ji}var lf;function p_(){return lf||(lf=1,Mc.exports=f_()),Mc.exports}var l=p_(),Ml={},Nc={exports:{}},vn={},Dc={exports:{}},Ic={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var af;function m_(){return af||(af=1,(function(n){function t(W,j){var $=W.length;W.push(j);e:for(;0<$;){var H=$-1>>>1,V=W[H];if(0<p(V,j))W[H]=j,W[$]=V,$=H;else break e}}function i(W){return W.length===0?null:W[0]}function a(W){if(W.length===0)return null;var j=W[0],$=W.pop();if($!==j){W[0]=$;e:for(var H=0,V=W.length,te=V>>>1;H<te;){var ie=2*(H+1)-1,pe=W[ie],me=ie+1,X=W[me];if(0>p(pe,$))me<V&&0>p(X,pe)?(W[H]=X,W[me]=$,H=me):(W[H]=pe,W[ie]=$,H=ie);else if(me<V&&0>p(X,$))W[H]=X,W[me]=$,H=me;else break e}}return j}function p(W,j){var $=W.sortIndex-j.sortIndex;return $!==0?$:W.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var k=performance;n.unstable_now=function(){return k.now()}}else{var C=Date,r=C.now();n.unstable_now=function(){return C.now()-r}}var u=[],v=[],_=1,h=null,w=3,E=!1,R=!1,g=!1,c=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(W){for(var j=i(v);j!==null;){if(j.callback===null)a(v);else if(j.startTime<=W)a(v),j.sortIndex=j.expirationTime,t(u,j);else break;j=i(v)}}function L(W){if(g=!1,d(W),!R)if(i(u)!==null)R=!0,G(I);else{var j=i(v);j!==null&&Y(L,j.startTime-W)}}function I(W,j){R=!1,g&&(g=!1,f(b),b=-1),E=!0;var $=w;try{for(d(j),h=i(u);h!==null&&(!(h.expirationTime>j)||W&&!B());){var H=h.callback;if(typeof H=="function"){h.callback=null,w=h.priorityLevel;var V=H(h.expirationTime<=j);j=n.unstable_now(),typeof V=="function"?h.callback=V:h===i(u)&&a(u),d(j)}else a(u);h=i(u)}if(h!==null)var te=!0;else{var ie=i(v);ie!==null&&Y(L,ie.startTime-j),te=!1}return te}finally{h=null,w=$,E=!1}}var x=!1,M=null,b=-1,T=5,D=-1;function B(){return!(n.unstable_now()-D<T)}function O(){if(M!==null){var W=n.unstable_now();D=W;var j=!0;try{j=M(!0,W)}finally{j?F():(x=!1,M=null)}}else x=!1}var F;if(typeof m=="function")F=function(){m(O)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,q=U.port2;U.port1.onmessage=O,F=function(){q.postMessage(null)}}else F=function(){c(O,0)};function G(W){M=W,x||(x=!0,F())}function Y(W,j){b=c(function(){W(n.unstable_now())},j)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(W){W.callback=null},n.unstable_continueExecution=function(){R||E||(R=!0,G(I))},n.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<W?Math.floor(1e3/W):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_getFirstCallbackNode=function(){return i(u)},n.unstable_next=function(W){switch(w){case 1:case 2:case 3:var j=3;break;default:j=w}var $=w;w=j;try{return W()}finally{w=$}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(W,j){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var $=w;w=W;try{return j()}finally{w=$}},n.unstable_scheduleCallback=function(W,j,$){var H=n.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?H+$:H):$=H,W){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=$+V,W={id:_++,callback:j,priorityLevel:W,startTime:$,expirationTime:V,sortIndex:-1},$>H?(W.sortIndex=$,t(v,W),i(u)===null&&W===i(v)&&(g?(f(b),b=-1):g=!0,Y(L,$-H))):(W.sortIndex=V,t(u,W),R||E||(R=!0,G(I))),W},n.unstable_shouldYield=B,n.unstable_wrapCallback=function(W){var j=w;return function(){var $=w;w=j;try{return W.apply(this,arguments)}finally{w=$}}}})(Ic)),Ic}var cf;function g_(){return cf||(cf=1,Dc.exports=m_()),Dc.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var uf;function v_(){if(uf)return vn;uf=1;var n=ju(),t=g_();function i(e){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,p={};function k(e,s){C(e,s),C(e+"Capture",s)}function C(e,s){for(p[e]=s,e=0;e<s.length;e++)a.add(s[e])}var r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,v=/^[: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]*$/,_={},h={};function w(e){return u.call(h,e)?!0:u.call(_,e)?!1:v.test(e)?h[e]=!0:(_[e]=!0,!1)}function E(e,s,o,y){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return y?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,s,o,y){if(s===null||typeof s>"u"||E(e,s,o,y))return!0;if(y)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function g(e,s,o,y,A,P,z){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=y,this.attributeNamespace=A,this.mustUseProperty=o,this.propertyName=e,this.type=s,this.sanitizeURL=P,this.removeEmptyString=z}var c={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){c[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var s=e[0];c[s]=new g(s,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){c[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){c[e]=new g(e,2,!1,e,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(e){c[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){c[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){c[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){c[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){c[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var f=/[\-:]([a-z])/g;function m(e){return e[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(e){var s=e.replace(f,m);c[s]=new g(s,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var s=e.replace(f,m);c[s]=new g(s,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var s=e.replace(f,m);c[s]=new g(s,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){c[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),c.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){c[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function d(e,s,o,y){var A=c.hasOwnProperty(s)?c[s]:null;(A!==null?A.type!==0:y||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(R(s,o,A,y)&&(o=null),y||A===null?w(s)&&(o===null?e.removeAttribute(s):e.setAttribute(s,""+o)):A.mustUseProperty?e[A.propertyName]=o===null?A.type===3?!1:"":o:(s=A.attributeName,y=A.attributeNamespace,o===null?e.removeAttribute(s):(A=A.type,o=A===3||A===4&&o===!0?"":""+o,y?e.setAttributeNS(y,s,o):e.setAttribute(s,o))))}var L=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),x=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),B=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),W=Symbol.iterator;function j(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var $=Object.assign,H;function V(e){if(H===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);H=s&&s[1]||""}return`
|
|
34
|
+
`+H+e}var te=!1;function ie(e,s){if(!e||te)return"";te=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(ce){var y=ce}Reflect.construct(e,[],s)}else{try{s.call()}catch(ce){y=ce}e.call(s.prototype)}else{try{throw Error()}catch(ce){y=ce}e()}}catch(ce){if(ce&&y&&typeof ce.stack=="string"){for(var A=ce.stack.split(`
|
|
35
|
+
`),P=y.stack.split(`
|
|
36
|
+
`),z=A.length-1,Q=P.length-1;1<=z&&0<=Q&&A[z]!==P[Q];)Q--;for(;1<=z&&0<=Q;z--,Q--)if(A[z]!==P[Q]){if(z!==1||Q!==1)do if(z--,Q--,0>Q||A[z]!==P[Q]){var ee=`
|
|
37
|
+
`+A[z].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=z&&0<=Q);break}}}finally{te=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?V(e):""}function pe(e){switch(e.tag){case 5:return V(e.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return e=ie(e.type,!1),e;case 11:return e=ie(e.type.render,!1),e;case 1:return e=ie(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case x:return"Portal";case T:return"Profiler";case b:return"StrictMode";case F:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B:return(e.displayName||"Context")+".Consumer";case D:return(e._context.displayName||"Context")+".Provider";case O:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return s=e.displayName||null,s!==null?s:me(e.type)||"Memo";case G:s=e._payload,e=e._init;try{return me(e(s))}catch{}}return null}function X(e){var s=e.type;switch(e.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=s.render,e=e.displayName||e.name||"",s.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(s);case 8:return s===b?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function K(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function J(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Z(e){var s=J(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s),y=""+e[s];if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var A=o.get,P=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return A.call(this)},set:function(z){y=""+z,P.call(this,z)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return y},setValue:function(z){y=""+z},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function _e(e){e._valueTracker||(e._valueTracker=Z(e))}function ve(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var o=s.getValue(),y="";return e&&(y=J(e)?e.checked?"true":"false":e.value),e=y,e!==o?(s.setValue(e),!0):!1}function ye(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ee(e,s){var o=s.checked;return $({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function fe(e,s){var o=s.defaultValue==null?"":s.defaultValue,y=s.checked!=null?s.checked:s.defaultChecked;o=K(s.value!=null?s.value:o),e._wrapperState={initialChecked:y,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ae(e,s){s=s.checked,s!=null&&d(e,"checked",s,!1)}function ne(e,s){Ae(e,s);var o=K(s.value),y=s.type;if(o!=null)y==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(y==="submit"||y==="reset"){e.removeAttribute("value");return}s.hasOwnProperty("value")?oe(e,s.type,o):s.hasOwnProperty("defaultValue")&&oe(e,s.type,K(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(e.defaultChecked=!!s.defaultChecked)}function Ie(e,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var y=s.type;if(!(y!=="submit"&&y!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+e._wrapperState.initialValue,o||s===e.value||(e.value=s),e.defaultValue=s}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function oe(e,s,o){(s!=="number"||ye(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var ue=Array.isArray;function de(e,s,o,y){if(e=e.options,s){s={};for(var A=0;A<o.length;A++)s["$"+o[A]]=!0;for(o=0;o<e.length;o++)A=s.hasOwnProperty("$"+e[o].value),e[o].selected!==A&&(e[o].selected=A),A&&y&&(e[o].defaultSelected=!0)}else{for(o=""+K(o),s=null,A=0;A<e.length;A++){if(e[A].value===o){e[A].selected=!0,y&&(e[A].defaultSelected=!0);return}s!==null||e[A].disabled||(s=e[A])}s!==null&&(s.selected=!0)}}function Me(e,s){if(s.dangerouslySetInnerHTML!=null)throw Error(i(91));return $({},s,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Re(e,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(i(92));if(ue(o)){if(1<o.length)throw Error(i(93));o=o[0]}s=o}s==null&&(s=""),o=s}e._wrapperState={initialValue:K(o)}}function Ke(e,s){var o=K(s.value),y=K(s.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),s.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),y!=null&&(e.defaultValue=""+y)}function Ue(e){var s=e.textContent;s===e._wrapperState.initialValue&&s!==""&&s!==null&&(e.value=s)}function st(e){switch(e){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 Tt(e,s){return e==null||e==="http://www.w3.org/1999/xhtml"?st(s):e==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var lt,yt=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,y,A){MSApp.execUnsafeLocalFunction(function(){return e(s,o,y,A)})}:e})(function(e,s){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=s;else{for(lt=lt||document.createElement("div"),lt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=lt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;s.firstChild;)e.appendChild(s.firstChild)}});function ct(e,s){if(s){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=s;return}}e.textContent=s}var We={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},Ge=["Webkit","ms","Moz","O"];Object.keys(We).forEach(function(e){Ge.forEach(function(s){s=s+e.charAt(0).toUpperCase()+e.substring(1),We[s]=We[e]})});function bt(e,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||We.hasOwnProperty(e)&&We[e]?(""+s).trim():s+"px"}function it(e,s){e=e.style;for(var o in s)if(s.hasOwnProperty(o)){var y=o.indexOf("--")===0,A=bt(o,s[o],y);o==="float"&&(o="cssFloat"),y?e.setProperty(o,A):e[o]=A}}var Wt=$({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 Pt(e,s){if(s){if(Wt[e]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(i(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(i(61))}if(s.style!=null&&typeof s.style!="object")throw Error(i(62))}}function he(e,s){if(e.indexOf("-")===-1)return typeof s.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Oe=null;function Qe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ot=null,ze=null,xe=null;function He(e){if(e=Oi(e)){if(typeof Ot!="function")throw Error(i(280));var s=e.stateNode;s&&(s=qo(s),Ot(e.stateNode,e.type,s))}}function ut(e){ze?xe?xe.push(e):xe=[e]:ze=e}function be(){if(ze){var e=ze,s=xe;if(xe=ze=null,He(e),s)for(e=0;e<s.length;e++)He(s[e])}}function rt(e,s){return e(s)}function _t(){}var ht=!1;function nt(e,s,o){if(ht)return e(s,o);ht=!0;try{return rt(e,s,o)}finally{ht=!1,(ze!==null||xe!==null)&&(_t(),be())}}function gt(e,s){var o=e.stateNode;if(o===null)return null;var y=qo(o);if(y===null)return null;o=y[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(e=e.type,y=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!y;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var Mt=!1;if(r)try{var Ft={};Object.defineProperty(Ft,"passive",{get:function(){Mt=!0}}),window.addEventListener("test",Ft,Ft),window.removeEventListener("test",Ft,Ft)}catch{Mt=!1}function Ss(e,s,o,y,A,P,z,Q,ee){var ce=Array.prototype.slice.call(arguments,3);try{s.apply(o,ce)}catch(ke){this.onError(ke)}}var Mn=!1,qn=null,cn=!1,Vn=null,_r={onError:function(e){Mn=!0,qn=e}};function ci(e,s,o,y,A,P,z,Q,ee){Mn=!1,qn=null,Ss.apply(_r,arguments)}function wr(e,s,o,y,A,P,z,Q,ee){if(ci.apply(this,arguments),Mn){if(Mn){var ce=qn;Mn=!1,qn=null}else throw Error(i(198));cn||(cn=!0,Vn=ce)}}function An(e){var s=e,o=e;if(e.alternate)for(;s.return;)s=s.return;else{e=s;do s=e,(s.flags&4098)!==0&&(o=s.return),e=s.return;while(e)}return s.tag===3?o:null}function Js(e){if(e.tag===13){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function Cs(e){if(An(e)!==e)throw Error(i(188))}function xs(e){var s=e.alternate;if(!s){if(s=An(e),s===null)throw Error(i(188));return s!==e?null:e}for(var o=e,y=s;;){var A=o.return;if(A===null)break;var P=A.alternate;if(P===null){if(y=A.return,y!==null){o=y;continue}break}if(A.child===P.child){for(P=A.child;P;){if(P===o)return Cs(A),e;if(P===y)return Cs(A),s;P=P.sibling}throw Error(i(188))}if(o.return!==y.return)o=A,y=P;else{for(var z=!1,Q=A.child;Q;){if(Q===o){z=!0,o=A,y=P;break}if(Q===y){z=!0,y=A,o=P;break}Q=Q.sibling}if(!z){for(Q=P.child;Q;){if(Q===o){z=!0,o=P,y=A;break}if(Q===y){z=!0,y=P,o=A;break}Q=Q.sibling}if(!z)throw Error(i(189))}}if(o.alternate!==y)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?e:s}function ks(e){return e=xs(e),e!==null?ge(e):null}function ge(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var s=ge(e);if(s!==null)return s;e=e.sibling}return null}var je=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,St=t.unstable_shouldYield,dt=t.unstable_requestPaint,ft=t.unstable_now,as=t.unstable_getCurrentPriorityLevel,cs=t.unstable_ImmediatePriority,vo=t.unstable_UserBlockingPriority,Es=t.unstable_NormalPriority,ui=t.unstable_LowPriority,_o=t.unstable_IdlePriority,Kn=null,nn=null;function wo(e){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(Kn,e,void 0,(e.current.flags&128)===128)}catch{}}var un=Math.clz32?Math.clz32:di,Zl=Math.log,hi=Math.LN2;function di(e){return e>>>=0,e===0?32:31-(Zl(e)/hi|0)|0}var Nn=64,Gn=4194304;function Yn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function us(e,s){var o=e.pendingLanes;if(o===0)return 0;var y=0,A=e.suspendedLanes,P=e.pingedLanes,z=o&268435455;if(z!==0){var Q=z&~A;Q!==0?y=Yn(Q):(P&=z,P!==0&&(y=Yn(P)))}else z=o&~A,z!==0?y=Yn(z):P!==0&&(y=Yn(P));if(y===0)return 0;if(s!==0&&s!==y&&(s&A)===0&&(A=y&-y,P=s&-s,A>=P||A===16&&(P&4194240)!==0))return s;if((y&4)!==0&&(y|=o&16),s=e.entangledLanes,s!==0)for(e=e.entanglements,s&=y;0<s;)o=31-un(s),A=1<<o,y|=e[o],s&=~A;return y}function Ls(e,s){switch(e){case 1:case 2:case 4:return s+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 s+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 fi(e,s){for(var o=e.suspendedLanes,y=e.pingedLanes,A=e.expirationTimes,P=e.pendingLanes;0<P;){var z=31-un(P),Q=1<<z,ee=A[z];ee===-1?((Q&o)===0||(Q&y)!==0)&&(A[z]=Ls(Q,s)):ee<=s&&(e.expiredLanes|=Q),P&=~Q}}function hn(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function yo(){var e=Nn;return Nn<<=1,(Nn&4194240)===0&&(Nn=64),e}function yr(e){for(var s=[],o=0;31>o;o++)s.push(e);return s}function Sn(e,s,o){e.pendingLanes|=s,s!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,s=31-un(s),e[s]=o}function br(e,s){var o=e.pendingLanes&~s;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=s,e.mutableReadLanes&=s,e.entangledLanes&=s,s=e.entanglements;var y=e.eventTimes;for(e=e.expirationTimes;0<o;){var A=31-un(o),P=1<<A;s[A]=0,y[A]=-1,e[A]=-1,o&=~P}}function pi(e,s){var o=e.entangledLanes|=s;for(e=e.entanglements;o;){var y=31-un(o),A=1<<y;A&s|e[y]&s&&(e[y]|=s),o&=~A}}var Ze=0;function Sr(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var mi,gi,vi,bo,_i,Cr=!1,Ts=[],Xn=null,Dn=null,In=null,Rs=new Map,Ms=new Map,Qn=[],ea="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 wi(e,s){switch(e){case"focusin":case"focusout":Xn=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":In=null;break;case"pointerover":case"pointerout":Rs.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ms.delete(s.pointerId)}}function Jn(e,s,o,y,A,P){return e===null||e.nativeEvent!==P?(e={blockedOn:s,domEventName:o,eventSystemFlags:y,nativeEvent:P,targetContainers:[A]},s!==null&&(s=Oi(s),s!==null&&gi(s)),e):(e.eventSystemFlags|=y,s=e.targetContainers,A!==null&&s.indexOf(A)===-1&&s.push(A),e)}function So(e,s,o,y,A){switch(s){case"focusin":return Xn=Jn(Xn,e,s,o,y,A),!0;case"dragenter":return Dn=Jn(Dn,e,s,o,y,A),!0;case"mouseover":return In=Jn(In,e,s,o,y,A),!0;case"pointerover":var P=A.pointerId;return Rs.set(P,Jn(Rs.get(P)||null,e,s,o,y,A)),!0;case"gotpointercapture":return P=A.pointerId,Ms.set(P,Jn(Ms.get(P)||null,e,s,o,y,A)),!0}return!1}function xr(e){var s=rr(e.target);if(s!==null){var o=An(s);if(o!==null){if(s=o.tag,s===13){if(s=Js(o),s!==null){e.blockedOn=s,_i(e.priority,function(){vi(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function As(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var o=Lr(e.domEventName,e.eventSystemFlags,s[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var y=new o.constructor(o.type,o);Oe=y,o.target.dispatchEvent(y),Oe=null}else return s=Oi(o),s!==null&&gi(s),e.blockedOn=o,!1;s.shift()}return!0}function Co(e,s,o){As(e)&&o.delete(s)}function ta(){Cr=!1,Xn!==null&&As(Xn)&&(Xn=null),Dn!==null&&As(Dn)&&(Dn=null),In!==null&&As(In)&&(In=null),Rs.forEach(Co),Ms.forEach(Co)}function Zs(e,s){e.blockedOn===s&&(e.blockedOn=null,Cr||(Cr=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ta)))}function Ns(e){function s(A){return Zs(A,e)}if(0<Ts.length){Zs(Ts[0],e);for(var o=1;o<Ts.length;o++){var y=Ts[o];y.blockedOn===e&&(y.blockedOn=null)}}for(Xn!==null&&Zs(Xn,e),Dn!==null&&Zs(Dn,e),In!==null&&Zs(In,e),Rs.forEach(s),Ms.forEach(s),o=0;o<Qn.length;o++)y=Qn[o],y.blockedOn===e&&(y.blockedOn=null);for(;0<Qn.length&&(o=Qn[0],o.blockedOn===null);)xr(o),o.blockedOn===null&&Qn.shift()}var sn=L.ReactCurrentBatchConfig,kr=!0;function xo(e,s,o,y){var A=Ze,P=sn.transition;sn.transition=null;try{Ze=1,Er(e,s,o,y)}finally{Ze=A,sn.transition=P}}function na(e,s,o,y){var A=Ze,P=sn.transition;sn.transition=null;try{Ze=4,Er(e,s,o,y)}finally{Ze=A,sn.transition=P}}function Er(e,s,o,y){if(kr){var A=Lr(e,s,o,y);if(A===null)ya(e,s,y,jn,o),wi(e,y);else if(So(A,e,s,o,y))y.stopPropagation();else if(wi(e,y),s&4&&-1<ea.indexOf(e)){for(;A!==null;){var P=Oi(A);if(P!==null&&mi(P),P=Lr(e,s,o,y),P===null&&ya(e,s,y,jn,o),P===A)break;A=P}A!==null&&y.stopPropagation()}else ya(e,s,y,null,o)}}var jn=null;function Lr(e,s,o,y){if(jn=null,e=Qe(y),e=rr(e),e!==null)if(s=An(e),s===null)e=null;else if(o=s.tag,o===13){if(e=Js(s),e!==null)return e;e=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null);return jn=e,null}function yi(e){switch(e){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(as()){case cs:return 1;case vo:return 4;case Es:case ui:return 16;case _o:return 536870912;default:return 16}default:return 16}}var Cn=null,bi=null,hs=null;function Si(){if(hs)return hs;var e,s=bi,o=s.length,y,A="value"in Cn?Cn.value:Cn.textContent,P=A.length;for(e=0;e<o&&s[e]===A[e];e++);var z=o-e;for(y=1;y<=z&&s[o-y]===A[P-y];y++);return hs=A.slice(e,1<y?1-y:void 0)}function Tr(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function Rr(){return!0}function er(){return!1}function rn(e){function s(o,y,A,P,z){this._reactName=o,this._targetInst=A,this.type=y,this.nativeEvent=P,this.target=z,this.currentTarget=null;for(var Q in e)e.hasOwnProperty(Q)&&(o=e[Q],this[Q]=o?o(P):P[Q]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?Rr:er,this.isPropagationStopped=er,this}return $(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Rr)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Rr)},persist:function(){},isPersistent:Rr}),s}var ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mr=rn(ds),tr=$({},ds,{view:0,detail:0}),sa=rn(tr),Ci,xi,nr,Pn=$({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nr&&(nr&&e.type==="mousemove"?(Ci=e.screenX-nr.screenX,xi=e.screenY-nr.screenY):xi=Ci=0,nr=e),Ci)},movementY:function(e){return"movementY"in e?e.movementY:xi}}),ko=rn(Pn),ki=$({},Pn,{dataTransfer:0}),ra=rn(ki),Eo=$({},tr,{relatedTarget:0}),Ei=rn(Eo),ia=$({},ds,{animationName:0,elapsedTime:0,pseudoElement:0}),oa=rn(ia),Lo=$({},ds,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),la=rn(Lo),aa=$({},ds,{data:0}),Ar=rn(aa),To={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Li={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"},Ro={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ca(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=Ro[e])?!!s[e]:!1}function Nr(){return ca}var Mo=$({},tr,{key:function(e){if(e.key){var s=To[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=Tr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Li[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nr,charCode:function(e){return e.type==="keypress"?Tr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ao=rn(Mo),No=$({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ti=rn(No),Do=$({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nr}),ua=rn(Do),Io=$({},ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),sr=rn(Io),jo=$({},Pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Po=rn(jo),Oo=[9,13,27,32],re=r&&"CompositionEvent"in window,Se=null;r&&"documentMode"in document&&(Se=document.documentMode);var ot=r&&"TextEvent"in window&&!Se,On=r&&(!re||Se&&8<Se&&11>=Se),Zn=" ",Qu=!1;function Ju(e,s){switch(e){case"keyup":return Oo.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dr=!1;function ov(e,s){switch(e){case"compositionend":return Zu(s);case"keypress":return s.which!==32?null:(Qu=!0,Zn);case"textInput":return e=s.data,e===Zn&&Qu?null:e;default:return null}}function lv(e,s){if(Dr)return e==="compositionend"||!re&&Ju(e,s)?(e=Si(),hs=bi=Cn=null,Dr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return On&&s.locale!=="ko"?null:s.data;default:return null}}var av={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 eh(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!av[e.type]:s==="textarea"}function th(e,s,o,y){ut(y),s=Uo(s,"onChange"),0<s.length&&(o=new Mr("onChange","change",null,o,y),e.push({event:o,listeners:s}))}var Ri=null,Mi=null;function cv(e){wh(e,0)}function Bo(e){var s=Br(e);if(ve(s))return e}function uv(e,s){if(e==="change")return s}var nh=!1;if(r){var ha;if(r){var da="oninput"in document;if(!da){var sh=document.createElement("div");sh.setAttribute("oninput","return;"),da=typeof sh.oninput=="function"}ha=da}else ha=!1;nh=ha&&(!document.documentMode||9<document.documentMode)}function rh(){Ri&&(Ri.detachEvent("onpropertychange",ih),Mi=Ri=null)}function ih(e){if(e.propertyName==="value"&&Bo(Mi)){var s=[];th(s,Mi,e,Qe(e)),nt(cv,s)}}function hv(e,s,o){e==="focusin"?(rh(),Ri=s,Mi=o,Ri.attachEvent("onpropertychange",ih)):e==="focusout"&&rh()}function dv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Bo(Mi)}function fv(e,s){if(e==="click")return Bo(s)}function pv(e,s){if(e==="input"||e==="change")return Bo(s)}function mv(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var Bn=typeof Object.is=="function"?Object.is:mv;function Ai(e,s){if(Bn(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var o=Object.keys(e),y=Object.keys(s);if(o.length!==y.length)return!1;for(y=0;y<o.length;y++){var A=o[y];if(!u.call(s,A)||!Bn(e[A],s[A]))return!1}return!0}function oh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function lh(e,s){var o=oh(e);e=0;for(var y;o;){if(o.nodeType===3){if(y=e+o.textContent.length,e<=s&&y>=s)return{node:o,offset:s-e};e=y}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=oh(o)}}function ah(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?ah(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function ch(){for(var e=window,s=ye();s instanceof e.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)e=s.contentWindow;else break;s=ye(e.document)}return s}function fa(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}function gv(e){var s=ch(),o=e.focusedElem,y=e.selectionRange;if(s!==o&&o&&o.ownerDocument&&ah(o.ownerDocument.documentElement,o)){if(y!==null&&fa(o)){if(s=y.start,e=y.end,e===void 0&&(e=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(e,o.value.length);else if(e=(s=o.ownerDocument||document)&&s.defaultView||window,e.getSelection){e=e.getSelection();var A=o.textContent.length,P=Math.min(y.start,A);y=y.end===void 0?P:Math.min(y.end,A),!e.extend&&P>y&&(A=y,y=P,P=A),A=lh(o,P);var z=lh(o,y);A&&z&&(e.rangeCount!==1||e.anchorNode!==A.node||e.anchorOffset!==A.offset||e.focusNode!==z.node||e.focusOffset!==z.offset)&&(s=s.createRange(),s.setStart(A.node,A.offset),e.removeAllRanges(),P>y?(e.addRange(s),e.extend(z.node,z.offset)):(s.setEnd(z.node,z.offset),e.addRange(s)))}}for(s=[],e=o;e=e.parentNode;)e.nodeType===1&&s.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)e=s[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var vv=r&&"documentMode"in document&&11>=document.documentMode,Ir=null,pa=null,Ni=null,ma=!1;function uh(e,s,o){var y=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;ma||Ir==null||Ir!==ye(y)||(y=Ir,"selectionStart"in y&&fa(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Ni&&Ai(Ni,y)||(Ni=y,y=Uo(pa,"onSelect"),0<y.length&&(s=new Mr("onSelect","select",null,s,o),e.push({event:s,listeners:y}),s.target=Ir)))}function Fo(e,s){var o={};return o[e.toLowerCase()]=s.toLowerCase(),o["Webkit"+e]="webkit"+s,o["Moz"+e]="moz"+s,o}var jr={animationend:Fo("Animation","AnimationEnd"),animationiteration:Fo("Animation","AnimationIteration"),animationstart:Fo("Animation","AnimationStart"),transitionend:Fo("Transition","TransitionEnd")},ga={},hh={};r&&(hh=document.createElement("div").style,"AnimationEvent"in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),"TransitionEvent"in window||delete jr.transitionend.transition);function Ho(e){if(ga[e])return ga[e];if(!jr[e])return e;var s=jr[e],o;for(o in s)if(s.hasOwnProperty(o)&&o in hh)return ga[e]=s[o];return e}var dh=Ho("animationend"),fh=Ho("animationiteration"),ph=Ho("animationstart"),mh=Ho("transitionend"),gh=new Map,vh="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 Ds(e,s){gh.set(e,s),k(s,[e])}for(var va=0;va<vh.length;va++){var _a=vh[va],_v=_a.toLowerCase(),wv=_a[0].toUpperCase()+_a.slice(1);Ds(_v,"on"+wv)}Ds(dh,"onAnimationEnd"),Ds(fh,"onAnimationIteration"),Ds(ph,"onAnimationStart"),Ds("dblclick","onDoubleClick"),Ds("focusin","onFocus"),Ds("focusout","onBlur"),Ds(mh,"onTransitionEnd"),C("onMouseEnter",["mouseout","mouseover"]),C("onMouseLeave",["mouseout","mouseover"]),C("onPointerEnter",["pointerout","pointerover"]),C("onPointerLeave",["pointerout","pointerover"]),k("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),k("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),k("onBeforeInput",["compositionend","keypress","textInput","paste"]),k("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),k("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),k("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Di="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(" "),yv=new Set("cancel close invalid load scroll toggle".split(" ").concat(Di));function _h(e,s,o){var y=e.type||"unknown-event";e.currentTarget=o,wr(y,s,void 0,e),e.currentTarget=null}function wh(e,s){s=(s&4)!==0;for(var o=0;o<e.length;o++){var y=e[o],A=y.event;y=y.listeners;e:{var P=void 0;if(s)for(var z=y.length-1;0<=z;z--){var Q=y[z],ee=Q.instance,ce=Q.currentTarget;if(Q=Q.listener,ee!==P&&A.isPropagationStopped())break e;_h(A,Q,ce),P=ee}else for(z=0;z<y.length;z++){if(Q=y[z],ee=Q.instance,ce=Q.currentTarget,Q=Q.listener,ee!==P&&A.isPropagationStopped())break e;_h(A,Q,ce),P=ee}}}if(cn)throw e=Vn,cn=!1,Vn=null,e}function kt(e,s){var o=s[Ea];o===void 0&&(o=s[Ea]=new Set);var y=e+"__bubble";o.has(y)||(yh(s,e,2,!1),o.add(y))}function wa(e,s,o){var y=0;s&&(y|=4),yh(o,e,y,s)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Ii(e){if(!e[$o]){e[$o]=!0,a.forEach(function(o){o!=="selectionchange"&&(yv.has(o)||wa(o,!1,e),wa(o,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[$o]||(s[$o]=!0,wa("selectionchange",!1,s))}}function yh(e,s,o,y){switch(yi(s)){case 1:var A=xo;break;case 4:A=na;break;default:A=Er}o=A.bind(null,s,o,e),A=void 0,!Mt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(A=!0),y?A!==void 0?e.addEventListener(s,o,{capture:!0,passive:A}):e.addEventListener(s,o,!0):A!==void 0?e.addEventListener(s,o,{passive:A}):e.addEventListener(s,o,!1)}function ya(e,s,o,y,A){var P=y;if((s&1)===0&&(s&2)===0&&y!==null)e:for(;;){if(y===null)return;var z=y.tag;if(z===3||z===4){var Q=y.stateNode.containerInfo;if(Q===A||Q.nodeType===8&&Q.parentNode===A)break;if(z===4)for(z=y.return;z!==null;){var ee=z.tag;if((ee===3||ee===4)&&(ee=z.stateNode.containerInfo,ee===A||ee.nodeType===8&&ee.parentNode===A))return;z=z.return}for(;Q!==null;){if(z=rr(Q),z===null)return;if(ee=z.tag,ee===5||ee===6){y=P=z;continue e}Q=Q.parentNode}}y=y.return}nt(function(){var ce=P,ke=Qe(o),Le=[];e:{var Ce=gh.get(e);if(Ce!==void 0){var De=Mr,Be=e;switch(e){case"keypress":if(Tr(o)===0)break e;case"keydown":case"keyup":De=Ao;break;case"focusin":Be="focus",De=Ei;break;case"focusout":Be="blur",De=Ei;break;case"beforeblur":case"afterblur":De=Ei;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":De=ko;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":De=ra;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":De=ua;break;case dh:case fh:case ph:De=oa;break;case mh:De=sr;break;case"scroll":De=sa;break;case"wheel":De=Po;break;case"copy":case"cut":case"paste":De=la;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":De=Ti}var $e=(s&4)!==0,Bt=!$e&&e==="scroll",le=$e?Ce!==null?Ce+"Capture":null:Ce;$e=[];for(var se=ce,ae;se!==null;){ae=se;var Te=ae.stateNode;if(ae.tag===5&&Te!==null&&(ae=Te,le!==null&&(Te=gt(se,le),Te!=null&&$e.push(ji(se,Te,ae)))),Bt)break;se=se.return}0<$e.length&&(Ce=new De(Ce,Be,null,o,ke),Le.push({event:Ce,listeners:$e}))}}if((s&7)===0){e:{if(Ce=e==="mouseover"||e==="pointerover",De=e==="mouseout"||e==="pointerout",Ce&&o!==Oe&&(Be=o.relatedTarget||o.fromElement)&&(rr(Be)||Be[fs]))break e;if((De||Ce)&&(Ce=ke.window===ke?ke:(Ce=ke.ownerDocument)?Ce.defaultView||Ce.parentWindow:window,De?(Be=o.relatedTarget||o.toElement,De=ce,Be=Be?rr(Be):null,Be!==null&&(Bt=An(Be),Be!==Bt||Be.tag!==5&&Be.tag!==6)&&(Be=null)):(De=null,Be=ce),De!==Be)){if($e=ko,Te="onMouseLeave",le="onMouseEnter",se="mouse",(e==="pointerout"||e==="pointerover")&&($e=Ti,Te="onPointerLeave",le="onPointerEnter",se="pointer"),Bt=De==null?Ce:Br(De),ae=Be==null?Ce:Br(Be),Ce=new $e(Te,se+"leave",De,o,ke),Ce.target=Bt,Ce.relatedTarget=ae,Te=null,rr(ke)===ce&&($e=new $e(le,se+"enter",Be,o,ke),$e.target=ae,$e.relatedTarget=Bt,Te=$e),Bt=Te,De&&Be)t:{for($e=De,le=Be,se=0,ae=$e;ae;ae=Pr(ae))se++;for(ae=0,Te=le;Te;Te=Pr(Te))ae++;for(;0<se-ae;)$e=Pr($e),se--;for(;0<ae-se;)le=Pr(le),ae--;for(;se--;){if($e===le||le!==null&&$e===le.alternate)break t;$e=Pr($e),le=Pr(le)}$e=null}else $e=null;De!==null&&bh(Le,Ce,De,$e,!1),Be!==null&&Bt!==null&&bh(Le,Bt,Be,$e,!0)}}e:{if(Ce=ce?Br(ce):window,De=Ce.nodeName&&Ce.nodeName.toLowerCase(),De==="select"||De==="input"&&Ce.type==="file")var qe=uv;else if(eh(Ce))if(nh)qe=pv;else{qe=dv;var Ye=hv}else(De=Ce.nodeName)&&De.toLowerCase()==="input"&&(Ce.type==="checkbox"||Ce.type==="radio")&&(qe=fv);if(qe&&(qe=qe(e,ce))){th(Le,qe,o,ke);break e}Ye&&Ye(e,Ce,ce),e==="focusout"&&(Ye=Ce._wrapperState)&&Ye.controlled&&Ce.type==="number"&&oe(Ce,"number",Ce.value)}switch(Ye=ce?Br(ce):window,e){case"focusin":(eh(Ye)||Ye.contentEditable==="true")&&(Ir=Ye,pa=ce,Ni=null);break;case"focusout":Ni=pa=Ir=null;break;case"mousedown":ma=!0;break;case"contextmenu":case"mouseup":case"dragend":ma=!1,uh(Le,o,ke);break;case"selectionchange":if(vv)break;case"keydown":case"keyup":uh(Le,o,ke)}var Xe;if(re)e:{switch(e){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else Dr?Ju(e,o)&&(et="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(et="onCompositionStart");et&&(On&&o.locale!=="ko"&&(Dr||et!=="onCompositionStart"?et==="onCompositionEnd"&&Dr&&(Xe=Si()):(Cn=ke,bi="value"in Cn?Cn.value:Cn.textContent,Dr=!0)),Ye=Uo(ce,et),0<Ye.length&&(et=new Ar(et,e,null,o,ke),Le.push({event:et,listeners:Ye}),Xe?et.data=Xe:(Xe=Zu(o),Xe!==null&&(et.data=Xe)))),(Xe=ot?ov(e,o):lv(e,o))&&(ce=Uo(ce,"onBeforeInput"),0<ce.length&&(ke=new Ar("onBeforeInput","beforeinput",null,o,ke),Le.push({event:ke,listeners:ce}),ke.data=Xe))}wh(Le,s)})}function ji(e,s,o){return{instance:e,listener:s,currentTarget:o}}function Uo(e,s){for(var o=s+"Capture",y=[];e!==null;){var A=e,P=A.stateNode;A.tag===5&&P!==null&&(A=P,P=gt(e,o),P!=null&&y.unshift(ji(e,P,A)),P=gt(e,s),P!=null&&y.push(ji(e,P,A))),e=e.return}return y}function Pr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function bh(e,s,o,y,A){for(var P=s._reactName,z=[];o!==null&&o!==y;){var Q=o,ee=Q.alternate,ce=Q.stateNode;if(ee!==null&&ee===y)break;Q.tag===5&&ce!==null&&(Q=ce,A?(ee=gt(o,P),ee!=null&&z.unshift(ji(o,ee,Q))):A||(ee=gt(o,P),ee!=null&&z.push(ji(o,ee,Q)))),o=o.return}z.length!==0&&e.push({event:s,listeners:z})}var bv=/\r\n?/g,Sv=/\u0000|\uFFFD/g;function Sh(e){return(typeof e=="string"?e:""+e).replace(bv,`
|
|
38
|
+
`).replace(Sv,"")}function Wo(e,s,o){if(s=Sh(s),Sh(e)!==s&&o)throw Error(i(425))}function zo(){}var ba=null,Sa=null;function Ca(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var xa=typeof setTimeout=="function"?setTimeout:void 0,Cv=typeof clearTimeout=="function"?clearTimeout:void 0,Ch=typeof Promise=="function"?Promise:void 0,xv=typeof queueMicrotask=="function"?queueMicrotask:typeof Ch<"u"?function(e){return Ch.resolve(null).then(e).catch(kv)}:xa;function kv(e){setTimeout(function(){throw e})}function ka(e,s){var o=s,y=0;do{var A=o.nextSibling;if(e.removeChild(o),A&&A.nodeType===8)if(o=A.data,o==="/$"){if(y===0){e.removeChild(A),Ns(s);return}y--}else o!=="$"&&o!=="$?"&&o!=="$!"||y++;o=A}while(o);Ns(s)}function Is(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return e}function xh(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return e;s--}else o==="/$"&&s++}e=e.previousSibling}return null}var Or=Math.random().toString(36).slice(2),es="__reactFiber$"+Or,Pi="__reactProps$"+Or,fs="__reactContainer$"+Or,Ea="__reactEvents$"+Or,Ev="__reactListeners$"+Or,Lv="__reactHandles$"+Or;function rr(e){var s=e[es];if(s)return s;for(var o=e.parentNode;o;){if(s=o[fs]||o[es]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(e=xh(e);e!==null;){if(o=e[es])return o;e=xh(e)}return s}e=o,o=e.parentNode}return null}function Oi(e){return e=e[es]||e[fs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Br(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(i(33))}function qo(e){return e[Pi]||null}var La=[],Fr=-1;function js(e){return{current:e}}function Et(e){0>Fr||(e.current=La[Fr],La[Fr]=null,Fr--)}function Ct(e,s){Fr++,La[Fr]=e.current,e.current=s}var Ps={},Xt=js(Ps),dn=js(!1),ir=Ps;function Hr(e,s){var o=e.type.contextTypes;if(!o)return Ps;var y=e.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===s)return y.__reactInternalMemoizedMaskedChildContext;var A={},P;for(P in o)A[P]=s[P];return y&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=A),A}function fn(e){return e=e.childContextTypes,e!=null}function Vo(){Et(dn),Et(Xt)}function kh(e,s,o){if(Xt.current!==Ps)throw Error(i(168));Ct(Xt,s),Ct(dn,o)}function Eh(e,s,o){var y=e.stateNode;if(s=s.childContextTypes,typeof y.getChildContext!="function")return o;y=y.getChildContext();for(var A in y)if(!(A in s))throw Error(i(108,X(e)||"Unknown",A));return $({},o,y)}function Ko(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ps,ir=Xt.current,Ct(Xt,e),Ct(dn,dn.current),!0}function Lh(e,s,o){var y=e.stateNode;if(!y)throw Error(i(169));o?(e=Eh(e,s,ir),y.__reactInternalMemoizedMergedChildContext=e,Et(dn),Et(Xt),Ct(Xt,e)):Et(dn),Ct(dn,o)}var ps=null,Go=!1,Ta=!1;function Th(e){ps===null?ps=[e]:ps.push(e)}function Tv(e){Go=!0,Th(e)}function Os(){if(!Ta&&ps!==null){Ta=!0;var e=0,s=Ze;try{var o=ps;for(Ze=1;e<o.length;e++){var y=o[e];do y=y(!0);while(y!==null)}ps=null,Go=!1}catch(A){throw ps!==null&&(ps=ps.slice(e+1)),je(cs,Os),A}finally{Ze=s,Ta=!1}}return null}var $r=[],Ur=0,Yo=null,Xo=0,xn=[],kn=0,or=null,ms=1,gs="";function lr(e,s){$r[Ur++]=Xo,$r[Ur++]=Yo,Yo=e,Xo=s}function Rh(e,s,o){xn[kn++]=ms,xn[kn++]=gs,xn[kn++]=or,or=e;var y=ms;e=gs;var A=32-un(y)-1;y&=~(1<<A),o+=1;var P=32-un(s)+A;if(30<P){var z=A-A%5;P=(y&(1<<z)-1).toString(32),y>>=z,A-=z,ms=1<<32-un(s)+A|o<<A|y,gs=P+e}else ms=1<<P|o<<A|y,gs=e}function Ra(e){e.return!==null&&(lr(e,1),Rh(e,1,0))}function Ma(e){for(;e===Yo;)Yo=$r[--Ur],$r[Ur]=null,Xo=$r[--Ur],$r[Ur]=null;for(;e===or;)or=xn[--kn],xn[kn]=null,gs=xn[--kn],xn[kn]=null,ms=xn[--kn],xn[kn]=null}var wn=null,yn=null,Rt=!1,Fn=null;function Mh(e,s){var o=Rn(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=e,s=e.deletions,s===null?(e.deletions=[o],e.flags|=16):s.push(o)}function Ah(e,s){switch(e.tag){case 5:var o=e.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(e.stateNode=s,wn=e,yn=Is(s.firstChild),!0):!1;case 6:return s=e.pendingProps===""||s.nodeType!==3?null:s,s!==null?(e.stateNode=s,wn=e,yn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=or!==null?{id:ms,overflow:gs}:null,e.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=Rn(18,null,null,0),o.stateNode=s,o.return=e,e.child=o,wn=e,yn=null,!0):!1;default:return!1}}function Aa(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Na(e){if(Rt){var s=yn;if(s){var o=s;if(!Ah(e,s)){if(Aa(e))throw Error(i(418));s=Is(o.nextSibling);var y=wn;s&&Ah(e,s)?Mh(y,o):(e.flags=e.flags&-4097|2,Rt=!1,wn=e)}}else{if(Aa(e))throw Error(i(418));e.flags=e.flags&-4097|2,Rt=!1,wn=e}}}function Nh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;wn=e}function Qo(e){if(e!==wn)return!1;if(!Rt)return Nh(e),Rt=!0,!1;var s;if((s=e.tag!==3)&&!(s=e.tag!==5)&&(s=e.type,s=s!=="head"&&s!=="body"&&!Ca(e.type,e.memoizedProps)),s&&(s=yn)){if(Aa(e))throw Dh(),Error(i(418));for(;s;)Mh(e,s),s=Is(s.nextSibling)}if(Nh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(s===0){yn=Is(e.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}e=e.nextSibling}yn=null}}else yn=wn?Is(e.stateNode.nextSibling):null;return!0}function Dh(){for(var e=yn;e;)e=Is(e.nextSibling)}function Wr(){yn=wn=null,Rt=!1}function Da(e){Fn===null?Fn=[e]:Fn.push(e)}var Rv=L.ReactCurrentBatchConfig;function Bi(e,s,o){if(e=o.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(i(309));var y=o.stateNode}if(!y)throw Error(i(147,e));var A=y,P=""+e;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===P?s.ref:(s=function(z){var Q=A.refs;z===null?delete Q[P]:Q[P]=z},s._stringRef=P,s)}if(typeof e!="string")throw Error(i(284));if(!o._owner)throw Error(i(290,e))}return e}function Jo(e,s){throw e=Object.prototype.toString.call(s),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e))}function Ih(e){var s=e._init;return s(e._payload)}function jh(e){function s(le,se){if(e){var ae=le.deletions;ae===null?(le.deletions=[se],le.flags|=16):ae.push(se)}}function o(le,se){if(!e)return null;for(;se!==null;)s(le,se),se=se.sibling;return null}function y(le,se){for(le=new Map;se!==null;)se.key!==null?le.set(se.key,se):le.set(se.index,se),se=se.sibling;return le}function A(le,se){return le=qs(le,se),le.index=0,le.sibling=null,le}function P(le,se,ae){return le.index=ae,e?(ae=le.alternate,ae!==null?(ae=ae.index,ae<se?(le.flags|=2,se):ae):(le.flags|=2,se)):(le.flags|=1048576,se)}function z(le){return e&&le.alternate===null&&(le.flags|=2),le}function Q(le,se,ae,Te){return se===null||se.tag!==6?(se=xc(ae,le.mode,Te),se.return=le,se):(se=A(se,ae),se.return=le,se)}function ee(le,se,ae,Te){var qe=ae.type;return qe===M?ke(le,se,ae.props.children,Te,ae.key):se!==null&&(se.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&Ih(qe)===se.type)?(Te=A(se,ae.props),Te.ref=Bi(le,se,ae),Te.return=le,Te):(Te=Sl(ae.type,ae.key,ae.props,null,le.mode,Te),Te.ref=Bi(le,se,ae),Te.return=le,Te)}function ce(le,se,ae,Te){return se===null||se.tag!==4||se.stateNode.containerInfo!==ae.containerInfo||se.stateNode.implementation!==ae.implementation?(se=kc(ae,le.mode,Te),se.return=le,se):(se=A(se,ae.children||[]),se.return=le,se)}function ke(le,se,ae,Te,qe){return se===null||se.tag!==7?(se=mr(ae,le.mode,Te,qe),se.return=le,se):(se=A(se,ae),se.return=le,se)}function Le(le,se,ae){if(typeof se=="string"&&se!==""||typeof se=="number")return se=xc(""+se,le.mode,ae),se.return=le,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case I:return ae=Sl(se.type,se.key,se.props,null,le.mode,ae),ae.ref=Bi(le,null,se),ae.return=le,ae;case x:return se=kc(se,le.mode,ae),se.return=le,se;case G:var Te=se._init;return Le(le,Te(se._payload),ae)}if(ue(se)||j(se))return se=mr(se,le.mode,ae,null),se.return=le,se;Jo(le,se)}return null}function Ce(le,se,ae,Te){var qe=se!==null?se.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return qe!==null?null:Q(le,se,""+ae,Te);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:return ae.key===qe?ee(le,se,ae,Te):null;case x:return ae.key===qe?ce(le,se,ae,Te):null;case G:return qe=ae._init,Ce(le,se,qe(ae._payload),Te)}if(ue(ae)||j(ae))return qe!==null?null:ke(le,se,ae,Te,null);Jo(le,ae)}return null}function De(le,se,ae,Te,qe){if(typeof Te=="string"&&Te!==""||typeof Te=="number")return le=le.get(ae)||null,Q(se,le,""+Te,qe);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case I:return le=le.get(Te.key===null?ae:Te.key)||null,ee(se,le,Te,qe);case x:return le=le.get(Te.key===null?ae:Te.key)||null,ce(se,le,Te,qe);case G:var Ye=Te._init;return De(le,se,ae,Ye(Te._payload),qe)}if(ue(Te)||j(Te))return le=le.get(ae)||null,ke(se,le,Te,qe,null);Jo(se,Te)}return null}function Be(le,se,ae,Te){for(var qe=null,Ye=null,Xe=se,et=se=0,Vt=null;Xe!==null&&et<ae.length;et++){Xe.index>et?(Vt=Xe,Xe=null):Vt=Xe.sibling;var mt=Ce(le,Xe,ae[et],Te);if(mt===null){Xe===null&&(Xe=Vt);break}e&&Xe&&mt.alternate===null&&s(le,Xe),se=P(mt,se,et),Ye===null?qe=mt:Ye.sibling=mt,Ye=mt,Xe=Vt}if(et===ae.length)return o(le,Xe),Rt&&lr(le,et),qe;if(Xe===null){for(;et<ae.length;et++)Xe=Le(le,ae[et],Te),Xe!==null&&(se=P(Xe,se,et),Ye===null?qe=Xe:Ye.sibling=Xe,Ye=Xe);return Rt&&lr(le,et),qe}for(Xe=y(le,Xe);et<ae.length;et++)Vt=De(Xe,le,et,ae[et],Te),Vt!==null&&(e&&Vt.alternate!==null&&Xe.delete(Vt.key===null?et:Vt.key),se=P(Vt,se,et),Ye===null?qe=Vt:Ye.sibling=Vt,Ye=Vt);return e&&Xe.forEach(function(Vs){return s(le,Vs)}),Rt&&lr(le,et),qe}function $e(le,se,ae,Te){var qe=j(ae);if(typeof qe!="function")throw Error(i(150));if(ae=qe.call(ae),ae==null)throw Error(i(151));for(var Ye=qe=null,Xe=se,et=se=0,Vt=null,mt=ae.next();Xe!==null&&!mt.done;et++,mt=ae.next()){Xe.index>et?(Vt=Xe,Xe=null):Vt=Xe.sibling;var Vs=Ce(le,Xe,mt.value,Te);if(Vs===null){Xe===null&&(Xe=Vt);break}e&&Xe&&Vs.alternate===null&&s(le,Xe),se=P(Vs,se,et),Ye===null?qe=Vs:Ye.sibling=Vs,Ye=Vs,Xe=Vt}if(mt.done)return o(le,Xe),Rt&&lr(le,et),qe;if(Xe===null){for(;!mt.done;et++,mt=ae.next())mt=Le(le,mt.value,Te),mt!==null&&(se=P(mt,se,et),Ye===null?qe=mt:Ye.sibling=mt,Ye=mt);return Rt&&lr(le,et),qe}for(Xe=y(le,Xe);!mt.done;et++,mt=ae.next())mt=De(Xe,le,et,mt.value,Te),mt!==null&&(e&&mt.alternate!==null&&Xe.delete(mt.key===null?et:mt.key),se=P(mt,se,et),Ye===null?qe=mt:Ye.sibling=mt,Ye=mt);return e&&Xe.forEach(function(a_){return s(le,a_)}),Rt&&lr(le,et),qe}function Bt(le,se,ae,Te){if(typeof ae=="object"&&ae!==null&&ae.type===M&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:e:{for(var qe=ae.key,Ye=se;Ye!==null;){if(Ye.key===qe){if(qe=ae.type,qe===M){if(Ye.tag===7){o(le,Ye.sibling),se=A(Ye,ae.props.children),se.return=le,le=se;break e}}else if(Ye.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&Ih(qe)===Ye.type){o(le,Ye.sibling),se=A(Ye,ae.props),se.ref=Bi(le,Ye,ae),se.return=le,le=se;break e}o(le,Ye);break}else s(le,Ye);Ye=Ye.sibling}ae.type===M?(se=mr(ae.props.children,le.mode,Te,ae.key),se.return=le,le=se):(Te=Sl(ae.type,ae.key,ae.props,null,le.mode,Te),Te.ref=Bi(le,se,ae),Te.return=le,le=Te)}return z(le);case x:e:{for(Ye=ae.key;se!==null;){if(se.key===Ye)if(se.tag===4&&se.stateNode.containerInfo===ae.containerInfo&&se.stateNode.implementation===ae.implementation){o(le,se.sibling),se=A(se,ae.children||[]),se.return=le,le=se;break e}else{o(le,se);break}else s(le,se);se=se.sibling}se=kc(ae,le.mode,Te),se.return=le,le=se}return z(le);case G:return Ye=ae._init,Bt(le,se,Ye(ae._payload),Te)}if(ue(ae))return Be(le,se,ae,Te);if(j(ae))return $e(le,se,ae,Te);Jo(le,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,se!==null&&se.tag===6?(o(le,se.sibling),se=A(se,ae),se.return=le,le=se):(o(le,se),se=xc(ae,le.mode,Te),se.return=le,le=se),z(le)):o(le,se)}return Bt}var zr=jh(!0),Ph=jh(!1),Zo=js(null),el=null,qr=null,Ia=null;function ja(){Ia=qr=el=null}function Pa(e){var s=Zo.current;Et(Zo),e._currentValue=s}function Oa(e,s,o){for(;e!==null;){var y=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,y!==null&&(y.childLanes|=s)):y!==null&&(y.childLanes&s)!==s&&(y.childLanes|=s),e===o)break;e=e.return}}function Vr(e,s){el=e,Ia=qr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&s)!==0&&(pn=!0),e.firstContext=null)}function En(e){var s=e._currentValue;if(Ia!==e)if(e={context:e,memoizedValue:s,next:null},qr===null){if(el===null)throw Error(i(308));qr=e,el.dependencies={lanes:0,firstContext:e}}else qr=qr.next=e;return s}var ar=null;function Ba(e){ar===null?ar=[e]:ar.push(e)}function Oh(e,s,o,y){var A=s.interleaved;return A===null?(o.next=o,Ba(s)):(o.next=A.next,A.next=o),s.interleaved=o,vs(e,y)}function vs(e,s){e.lanes|=s;var o=e.alternate;for(o!==null&&(o.lanes|=s),o=e,e=e.return;e!==null;)e.childLanes|=s,o=e.alternate,o!==null&&(o.childLanes|=s),o=e,e=e.return;return o.tag===3?o.stateNode:null}var Bs=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bh(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _s(e,s){return{eventTime:e,lane:s,tag:0,payload:null,callback:null,next:null}}function Fs(e,s,o){var y=e.updateQueue;if(y===null)return null;if(y=y.shared,(pt&2)!==0){var A=y.pending;return A===null?s.next=s:(s.next=A.next,A.next=s),y.pending=s,vs(e,o)}return A=y.interleaved,A===null?(s.next=s,Ba(y)):(s.next=A.next,A.next=s),y.interleaved=s,vs(e,o)}function tl(e,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var y=s.lanes;y&=e.pendingLanes,o|=y,s.lanes=o,pi(e,o)}}function Fh(e,s){var o=e.updateQueue,y=e.alternate;if(y!==null&&(y=y.updateQueue,o===y)){var A=null,P=null;if(o=o.firstBaseUpdate,o!==null){do{var z={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};P===null?A=P=z:P=P.next=z,o=o.next}while(o!==null);P===null?A=P=s:P=P.next=s}else A=P=s;o={baseState:y.baseState,firstBaseUpdate:A,lastBaseUpdate:P,shared:y.shared,effects:y.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=s:e.next=s,o.lastBaseUpdate=s}function nl(e,s,o,y){var A=e.updateQueue;Bs=!1;var P=A.firstBaseUpdate,z=A.lastBaseUpdate,Q=A.shared.pending;if(Q!==null){A.shared.pending=null;var ee=Q,ce=ee.next;ee.next=null,z===null?P=ce:z.next=ce,z=ee;var ke=e.alternate;ke!==null&&(ke=ke.updateQueue,Q=ke.lastBaseUpdate,Q!==z&&(Q===null?ke.firstBaseUpdate=ce:Q.next=ce,ke.lastBaseUpdate=ee))}if(P!==null){var Le=A.baseState;z=0,ke=ce=ee=null,Q=P;do{var Ce=Q.lane,De=Q.eventTime;if((y&Ce)===Ce){ke!==null&&(ke=ke.next={eventTime:De,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Be=e,$e=Q;switch(Ce=s,De=o,$e.tag){case 1:if(Be=$e.payload,typeof Be=="function"){Le=Be.call(De,Le,Ce);break e}Le=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=$e.payload,Ce=typeof Be=="function"?Be.call(De,Le,Ce):Be,Ce==null)break e;Le=$({},Le,Ce);break e;case 2:Bs=!0}}Q.callback!==null&&Q.lane!==0&&(e.flags|=64,Ce=A.effects,Ce===null?A.effects=[Q]:Ce.push(Q))}else De={eventTime:De,lane:Ce,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},ke===null?(ce=ke=De,ee=Le):ke=ke.next=De,z|=Ce;if(Q=Q.next,Q===null){if(Q=A.shared.pending,Q===null)break;Ce=Q,Q=Ce.next,Ce.next=null,A.lastBaseUpdate=Ce,A.shared.pending=null}}while(!0);if(ke===null&&(ee=Le),A.baseState=ee,A.firstBaseUpdate=ce,A.lastBaseUpdate=ke,s=A.shared.interleaved,s!==null){A=s;do z|=A.lane,A=A.next;while(A!==s)}else P===null&&(A.shared.lanes=0);hr|=z,e.lanes=z,e.memoizedState=Le}}function Hh(e,s,o){if(e=s.effects,s.effects=null,e!==null)for(s=0;s<e.length;s++){var y=e[s],A=y.callback;if(A!==null){if(y.callback=null,y=o,typeof A!="function")throw Error(i(191,A));A.call(y)}}}var Fi={},ts=js(Fi),Hi=js(Fi),$i=js(Fi);function cr(e){if(e===Fi)throw Error(i(174));return e}function Ha(e,s){switch(Ct($i,s),Ct(Hi,e),Ct(ts,Fi),e=s.nodeType,e){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Tt(null,"");break;default:e=e===8?s.parentNode:s,s=e.namespaceURI||null,e=e.tagName,s=Tt(s,e)}Et(ts),Ct(ts,s)}function Kr(){Et(ts),Et(Hi),Et($i)}function $h(e){cr($i.current);var s=cr(ts.current),o=Tt(s,e.type);s!==o&&(Ct(Hi,e),Ct(ts,o))}function $a(e){Hi.current===e&&(Et(ts),Et(Hi))}var At=js(0);function sl(e){for(var s=e;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ua=[];function Wa(){for(var e=0;e<Ua.length;e++)Ua[e]._workInProgressVersionPrimary=null;Ua.length=0}var rl=L.ReactCurrentDispatcher,za=L.ReactCurrentBatchConfig,ur=0,Nt=null,$t=null,zt=null,il=!1,Ui=!1,Wi=0,Mv=0;function Qt(){throw Error(i(321))}function qa(e,s){if(s===null)return!1;for(var o=0;o<s.length&&o<e.length;o++)if(!Bn(e[o],s[o]))return!1;return!0}function Va(e,s,o,y,A,P){if(ur=P,Nt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,rl.current=e===null||e.memoizedState===null?Iv:jv,e=o(y,A),Ui){P=0;do{if(Ui=!1,Wi=0,25<=P)throw Error(i(301));P+=1,zt=$t=null,s.updateQueue=null,rl.current=Pv,e=o(y,A)}while(Ui)}if(rl.current=al,s=$t!==null&&$t.next!==null,ur=0,zt=$t=Nt=null,il=!1,s)throw Error(i(300));return e}function Ka(){var e=Wi!==0;return Wi=0,e}function ns(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Nt.memoizedState=zt=e:zt=zt.next=e,zt}function Ln(){if($t===null){var e=Nt.alternate;e=e!==null?e.memoizedState:null}else e=$t.next;var s=zt===null?Nt.memoizedState:zt.next;if(s!==null)zt=s,$t=e;else{if(e===null)throw Error(i(310));$t=e,e={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},zt===null?Nt.memoizedState=zt=e:zt=zt.next=e}return zt}function zi(e,s){return typeof s=="function"?s(e):s}function Ga(e){var s=Ln(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var y=$t,A=y.baseQueue,P=o.pending;if(P!==null){if(A!==null){var z=A.next;A.next=P.next,P.next=z}y.baseQueue=A=P,o.pending=null}if(A!==null){P=A.next,y=y.baseState;var Q=z=null,ee=null,ce=P;do{var ke=ce.lane;if((ur&ke)===ke)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),y=ce.hasEagerState?ce.eagerState:e(y,ce.action);else{var Le={lane:ke,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(Q=ee=Le,z=y):ee=ee.next=Le,Nt.lanes|=ke,hr|=ke}ce=ce.next}while(ce!==null&&ce!==P);ee===null?z=y:ee.next=Q,Bn(y,s.memoizedState)||(pn=!0),s.memoizedState=y,s.baseState=z,s.baseQueue=ee,o.lastRenderedState=y}if(e=o.interleaved,e!==null){A=e;do P=A.lane,Nt.lanes|=P,hr|=P,A=A.next;while(A!==e)}else A===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Ya(e){var s=Ln(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var y=o.dispatch,A=o.pending,P=s.memoizedState;if(A!==null){o.pending=null;var z=A=A.next;do P=e(P,z.action),z=z.next;while(z!==A);Bn(P,s.memoizedState)||(pn=!0),s.memoizedState=P,s.baseQueue===null&&(s.baseState=P),o.lastRenderedState=P}return[P,y]}function Uh(){}function Wh(e,s){var o=Nt,y=Ln(),A=s(),P=!Bn(y.memoizedState,A);if(P&&(y.memoizedState=A,pn=!0),y=y.queue,Xa(Vh.bind(null,o,y,e),[e]),y.getSnapshot!==s||P||zt!==null&&zt.memoizedState.tag&1){if(o.flags|=2048,qi(9,qh.bind(null,o,y,A,s),void 0,null),qt===null)throw Error(i(349));(ur&30)!==0||zh(o,s,A)}return A}function zh(e,s,o){e.flags|=16384,e={getSnapshot:s,value:o},s=Nt.updateQueue,s===null?(s={lastEffect:null,stores:null},Nt.updateQueue=s,s.stores=[e]):(o=s.stores,o===null?s.stores=[e]:o.push(e))}function qh(e,s,o,y){s.value=o,s.getSnapshot=y,Kh(s)&&Gh(e)}function Vh(e,s,o){return o(function(){Kh(s)&&Gh(e)})}function Kh(e){var s=e.getSnapshot;e=e.value;try{var o=s();return!Bn(e,o)}catch{return!0}}function Gh(e){var s=vs(e,1);s!==null&&Wn(s,e,1,-1)}function Yh(e){var s=ns();return typeof e=="function"&&(e=e()),s.memoizedState=s.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:e},s.queue=e,e=e.dispatch=Dv.bind(null,Nt,e),[s.memoizedState,e]}function qi(e,s,o,y){return e={tag:e,create:s,destroy:o,deps:y,next:null},s=Nt.updateQueue,s===null?(s={lastEffect:null,stores:null},Nt.updateQueue=s,s.lastEffect=e.next=e):(o=s.lastEffect,o===null?s.lastEffect=e.next=e:(y=o.next,o.next=e,e.next=y,s.lastEffect=e)),e}function Xh(){return Ln().memoizedState}function ol(e,s,o,y){var A=ns();Nt.flags|=e,A.memoizedState=qi(1|s,o,void 0,y===void 0?null:y)}function ll(e,s,o,y){var A=Ln();y=y===void 0?null:y;var P=void 0;if($t!==null){var z=$t.memoizedState;if(P=z.destroy,y!==null&&qa(y,z.deps)){A.memoizedState=qi(s,o,P,y);return}}Nt.flags|=e,A.memoizedState=qi(1|s,o,P,y)}function Qh(e,s){return ol(8390656,8,e,s)}function Xa(e,s){return ll(2048,8,e,s)}function Jh(e,s){return ll(4,2,e,s)}function Zh(e,s){return ll(4,4,e,s)}function ed(e,s){if(typeof s=="function")return e=e(),s(e),function(){s(null)};if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function td(e,s,o){return o=o!=null?o.concat([e]):null,ll(4,4,ed.bind(null,s,e),o)}function Qa(){}function nd(e,s){var o=Ln();s=s===void 0?null:s;var y=o.memoizedState;return y!==null&&s!==null&&qa(s,y[1])?y[0]:(o.memoizedState=[e,s],e)}function sd(e,s){var o=Ln();s=s===void 0?null:s;var y=o.memoizedState;return y!==null&&s!==null&&qa(s,y[1])?y[0]:(e=e(),o.memoizedState=[e,s],e)}function rd(e,s,o){return(ur&21)===0?(e.baseState&&(e.baseState=!1,pn=!0),e.memoizedState=o):(Bn(o,s)||(o=yo(),Nt.lanes|=o,hr|=o,e.baseState=!0),s)}function Av(e,s){var o=Ze;Ze=o!==0&&4>o?o:4,e(!0);var y=za.transition;za.transition={};try{e(!1),s()}finally{Ze=o,za.transition=y}}function id(){return Ln().memoizedState}function Nv(e,s,o){var y=Ws(e);if(o={lane:y,action:o,hasEagerState:!1,eagerState:null,next:null},od(e))ld(s,o);else if(o=Oh(e,s,o,y),o!==null){var A=ln();Wn(o,e,y,A),ad(o,s,y)}}function Dv(e,s,o){var y=Ws(e),A={lane:y,action:o,hasEagerState:!1,eagerState:null,next:null};if(od(e))ld(s,A);else{var P=e.alternate;if(e.lanes===0&&(P===null||P.lanes===0)&&(P=s.lastRenderedReducer,P!==null))try{var z=s.lastRenderedState,Q=P(z,o);if(A.hasEagerState=!0,A.eagerState=Q,Bn(Q,z)){var ee=s.interleaved;ee===null?(A.next=A,Ba(s)):(A.next=ee.next,ee.next=A),s.interleaved=A;return}}catch{}finally{}o=Oh(e,s,A,y),o!==null&&(A=ln(),Wn(o,e,y,A),ad(o,s,y))}}function od(e){var s=e.alternate;return e===Nt||s!==null&&s===Nt}function ld(e,s){Ui=il=!0;var o=e.pending;o===null?s.next=s:(s.next=o.next,o.next=s),e.pending=s}function ad(e,s,o){if((o&4194240)!==0){var y=s.lanes;y&=e.pendingLanes,o|=y,s.lanes=o,pi(e,o)}}var al={readContext:En,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},Iv={readContext:En,useCallback:function(e,s){return ns().memoizedState=[e,s===void 0?null:s],e},useContext:En,useEffect:Qh,useImperativeHandle:function(e,s,o){return o=o!=null?o.concat([e]):null,ol(4194308,4,ed.bind(null,s,e),o)},useLayoutEffect:function(e,s){return ol(4194308,4,e,s)},useInsertionEffect:function(e,s){return ol(4,2,e,s)},useMemo:function(e,s){var o=ns();return s=s===void 0?null:s,e=e(),o.memoizedState=[e,s],e},useReducer:function(e,s,o){var y=ns();return s=o!==void 0?o(s):s,y.memoizedState=y.baseState=s,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},y.queue=e,e=e.dispatch=Nv.bind(null,Nt,e),[y.memoizedState,e]},useRef:function(e){var s=ns();return e={current:e},s.memoizedState=e},useState:Yh,useDebugValue:Qa,useDeferredValue:function(e){return ns().memoizedState=e},useTransition:function(){var e=Yh(!1),s=e[0];return e=Av.bind(null,e[1]),ns().memoizedState=e,[s,e]},useMutableSource:function(){},useSyncExternalStore:function(e,s,o){var y=Nt,A=ns();if(Rt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),qt===null)throw Error(i(349));(ur&30)!==0||zh(y,s,o)}A.memoizedState=o;var P={value:o,getSnapshot:s};return A.queue=P,Qh(Vh.bind(null,y,P,e),[e]),y.flags|=2048,qi(9,qh.bind(null,y,P,o,s),void 0,null),o},useId:function(){var e=ns(),s=qt.identifierPrefix;if(Rt){var o=gs,y=ms;o=(y&~(1<<32-un(y)-1)).toString(32)+o,s=":"+s+"R"+o,o=Wi++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=Mv++,s=":"+s+"r"+o.toString(32)+":";return e.memoizedState=s},unstable_isNewReconciler:!1},jv={readContext:En,useCallback:nd,useContext:En,useEffect:Xa,useImperativeHandle:td,useInsertionEffect:Jh,useLayoutEffect:Zh,useMemo:sd,useReducer:Ga,useRef:Xh,useState:function(){return Ga(zi)},useDebugValue:Qa,useDeferredValue:function(e){var s=Ln();return rd(s,$t.memoizedState,e)},useTransition:function(){var e=Ga(zi)[0],s=Ln().memoizedState;return[e,s]},useMutableSource:Uh,useSyncExternalStore:Wh,useId:id,unstable_isNewReconciler:!1},Pv={readContext:En,useCallback:nd,useContext:En,useEffect:Xa,useImperativeHandle:td,useInsertionEffect:Jh,useLayoutEffect:Zh,useMemo:sd,useReducer:Ya,useRef:Xh,useState:function(){return Ya(zi)},useDebugValue:Qa,useDeferredValue:function(e){var s=Ln();return $t===null?s.memoizedState=e:rd(s,$t.memoizedState,e)},useTransition:function(){var e=Ya(zi)[0],s=Ln().memoizedState;return[e,s]},useMutableSource:Uh,useSyncExternalStore:Wh,useId:id,unstable_isNewReconciler:!1};function Hn(e,s){if(e&&e.defaultProps){s=$({},s),e=e.defaultProps;for(var o in e)s[o]===void 0&&(s[o]=e[o]);return s}return s}function Ja(e,s,o,y){s=e.memoizedState,o=o(y,s),o=o==null?s:$({},s,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var cl={isMounted:function(e){return(e=e._reactInternals)?An(e)===e:!1},enqueueSetState:function(e,s,o){e=e._reactInternals;var y=ln(),A=Ws(e),P=_s(y,A);P.payload=s,o!=null&&(P.callback=o),s=Fs(e,P,A),s!==null&&(Wn(s,e,A,y),tl(s,e,A))},enqueueReplaceState:function(e,s,o){e=e._reactInternals;var y=ln(),A=Ws(e),P=_s(y,A);P.tag=1,P.payload=s,o!=null&&(P.callback=o),s=Fs(e,P,A),s!==null&&(Wn(s,e,A,y),tl(s,e,A))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var o=ln(),y=Ws(e),A=_s(o,y);A.tag=2,s!=null&&(A.callback=s),s=Fs(e,A,y),s!==null&&(Wn(s,e,y,o),tl(s,e,y))}};function cd(e,s,o,y,A,P,z){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(y,P,z):s.prototype&&s.prototype.isPureReactComponent?!Ai(o,y)||!Ai(A,P):!0}function ud(e,s,o){var y=!1,A=Ps,P=s.contextType;return typeof P=="object"&&P!==null?P=En(P):(A=fn(s)?ir:Xt.current,y=s.contextTypes,P=(y=y!=null)?Hr(e,A):Ps),s=new s(o,P),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=cl,e.stateNode=s,s._reactInternals=e,y&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=A,e.__reactInternalMemoizedMaskedChildContext=P),s}function hd(e,s,o,y){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,y),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,y),s.state!==e&&cl.enqueueReplaceState(s,s.state,null)}function Za(e,s,o,y){var A=e.stateNode;A.props=o,A.state=e.memoizedState,A.refs={},Fa(e);var P=s.contextType;typeof P=="object"&&P!==null?A.context=En(P):(P=fn(s)?ir:Xt.current,A.context=Hr(e,P)),A.state=e.memoizedState,P=s.getDerivedStateFromProps,typeof P=="function"&&(Ja(e,s,P,o),A.state=e.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(s=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),s!==A.state&&cl.enqueueReplaceState(A,A.state,null),nl(e,o,A,y),A.state=e.memoizedState),typeof A.componentDidMount=="function"&&(e.flags|=4194308)}function Gr(e,s){try{var o="",y=s;do o+=pe(y),y=y.return;while(y);var A=o}catch(P){A=`
|
|
39
|
+
Error generating stack: `+P.message+`
|
|
40
|
+
`+P.stack}return{value:e,source:s,stack:A,digest:null}}function ec(e,s,o){return{value:e,source:null,stack:o??null,digest:s??null}}function tc(e,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var Ov=typeof WeakMap=="function"?WeakMap:Map;function dd(e,s,o){o=_s(-1,o),o.tag=3,o.payload={element:null};var y=s.value;return o.callback=function(){gl||(gl=!0,gc=y),tc(e,s)},o}function fd(e,s,o){o=_s(-1,o),o.tag=3;var y=e.type.getDerivedStateFromError;if(typeof y=="function"){var A=s.value;o.payload=function(){return y(A)},o.callback=function(){tc(e,s)}}var P=e.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){tc(e,s),typeof y!="function"&&($s===null?$s=new Set([this]):$s.add(this));var z=s.stack;this.componentDidCatch(s.value,{componentStack:z!==null?z:""})}),o}function pd(e,s,o){var y=e.pingCache;if(y===null){y=e.pingCache=new Ov;var A=new Set;y.set(s,A)}else A=y.get(s),A===void 0&&(A=new Set,y.set(s,A));A.has(o)||(A.add(o),e=Qv.bind(null,e,s,o),s.then(e,e))}function md(e){do{var s;if((s=e.tag===13)&&(s=e.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return e;e=e.return}while(e!==null);return null}function gd(e,s,o,y,A){return(e.mode&1)===0?(e===s?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=_s(-1,1),s.tag=2,Fs(o,s,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=A,e)}var Bv=L.ReactCurrentOwner,pn=!1;function on(e,s,o,y){s.child=e===null?Ph(s,null,o,y):zr(s,e.child,o,y)}function vd(e,s,o,y,A){o=o.render;var P=s.ref;return Vr(s,A),y=Va(e,s,o,y,P,A),o=Ka(),e!==null&&!pn?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~A,ws(e,s,A)):(Rt&&o&&Ra(s),s.flags|=1,on(e,s,y,A),s.child)}function _d(e,s,o,y,A){if(e===null){var P=o.type;return typeof P=="function"&&!Cc(P)&&P.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=P,wd(e,s,P,y,A)):(e=Sl(o.type,null,y,s,s.mode,A),e.ref=s.ref,e.return=s,s.child=e)}if(P=e.child,(e.lanes&A)===0){var z=P.memoizedProps;if(o=o.compare,o=o!==null?o:Ai,o(z,y)&&e.ref===s.ref)return ws(e,s,A)}return s.flags|=1,e=qs(P,y),e.ref=s.ref,e.return=s,s.child=e}function wd(e,s,o,y,A){if(e!==null){var P=e.memoizedProps;if(Ai(P,y)&&e.ref===s.ref)if(pn=!1,s.pendingProps=y=P,(e.lanes&A)!==0)(e.flags&131072)!==0&&(pn=!0);else return s.lanes=e.lanes,ws(e,s,A)}return nc(e,s,o,y,A)}function yd(e,s,o){var y=s.pendingProps,A=y.children,P=e!==null?e.memoizedState:null;if(y.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ct(Xr,bn),bn|=o;else{if((o&1073741824)===0)return e=P!==null?P.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:e,cachePool:null,transitions:null},s.updateQueue=null,Ct(Xr,bn),bn|=e,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=P!==null?P.baseLanes:o,Ct(Xr,bn),bn|=y}else P!==null?(y=P.baseLanes|o,s.memoizedState=null):y=o,Ct(Xr,bn),bn|=y;return on(e,s,A,o),s.child}function bd(e,s){var o=s.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function nc(e,s,o,y,A){var P=fn(o)?ir:Xt.current;return P=Hr(s,P),Vr(s,A),o=Va(e,s,o,y,P,A),y=Ka(),e!==null&&!pn?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~A,ws(e,s,A)):(Rt&&y&&Ra(s),s.flags|=1,on(e,s,o,A),s.child)}function Sd(e,s,o,y,A){if(fn(o)){var P=!0;Ko(s)}else P=!1;if(Vr(s,A),s.stateNode===null)hl(e,s),ud(s,o,y),Za(s,o,y,A),y=!0;else if(e===null){var z=s.stateNode,Q=s.memoizedProps;z.props=Q;var ee=z.context,ce=o.contextType;typeof ce=="object"&&ce!==null?ce=En(ce):(ce=fn(o)?ir:Xt.current,ce=Hr(s,ce));var ke=o.getDerivedStateFromProps,Le=typeof ke=="function"||typeof z.getSnapshotBeforeUpdate=="function";Le||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==y||ee!==ce)&&hd(s,z,y,ce),Bs=!1;var Ce=s.memoizedState;z.state=Ce,nl(s,y,z,A),ee=s.memoizedState,Q!==y||Ce!==ee||dn.current||Bs?(typeof ke=="function"&&(Ja(s,o,ke,y),ee=s.memoizedState),(Q=Bs||cd(s,o,Q,y,Ce,ee,ce))?(Le||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(s.flags|=4194308)):(typeof z.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=y,s.memoizedState=ee),z.props=y,z.state=ee,z.context=ce,y=Q):(typeof z.componentDidMount=="function"&&(s.flags|=4194308),y=!1)}else{z=s.stateNode,Bh(e,s),Q=s.memoizedProps,ce=s.type===s.elementType?Q:Hn(s.type,Q),z.props=ce,Le=s.pendingProps,Ce=z.context,ee=o.contextType,typeof ee=="object"&&ee!==null?ee=En(ee):(ee=fn(o)?ir:Xt.current,ee=Hr(s,ee));var De=o.getDerivedStateFromProps;(ke=typeof De=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==Le||Ce!==ee)&&hd(s,z,y,ee),Bs=!1,Ce=s.memoizedState,z.state=Ce,nl(s,y,z,A);var Be=s.memoizedState;Q!==Le||Ce!==Be||dn.current||Bs?(typeof De=="function"&&(Ja(s,o,De,y),Be=s.memoizedState),(ce=Bs||cd(s,o,ce,y,Ce,Be,ee)||!1)?(ke||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(y,Be,ee),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(y,Be,ee)),typeof z.componentDidUpdate=="function"&&(s.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&Ce===e.memoizedState||(s.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&Ce===e.memoizedState||(s.flags|=1024),s.memoizedProps=y,s.memoizedState=Be),z.props=y,z.state=Be,z.context=ee,y=ce):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&Ce===e.memoizedState||(s.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&Ce===e.memoizedState||(s.flags|=1024),y=!1)}return sc(e,s,o,y,P,A)}function sc(e,s,o,y,A,P){bd(e,s);var z=(s.flags&128)!==0;if(!y&&!z)return A&&Lh(s,o,!1),ws(e,s,P);y=s.stateNode,Bv.current=s;var Q=z&&typeof o.getDerivedStateFromError!="function"?null:y.render();return s.flags|=1,e!==null&&z?(s.child=zr(s,e.child,null,P),s.child=zr(s,null,Q,P)):on(e,s,Q,P),s.memoizedState=y.state,A&&Lh(s,o,!0),s.child}function Cd(e){var s=e.stateNode;s.pendingContext?kh(e,s.pendingContext,s.pendingContext!==s.context):s.context&&kh(e,s.context,!1),Ha(e,s.containerInfo)}function xd(e,s,o,y,A){return Wr(),Da(A),s.flags|=256,on(e,s,o,y),s.child}var rc={dehydrated:null,treeContext:null,retryLane:0};function ic(e){return{baseLanes:e,cachePool:null,transitions:null}}function kd(e,s,o){var y=s.pendingProps,A=At.current,P=!1,z=(s.flags&128)!==0,Q;if((Q=z)||(Q=e!==null&&e.memoizedState===null?!1:(A&2)!==0),Q?(P=!0,s.flags&=-129):(e===null||e.memoizedState!==null)&&(A|=1),Ct(At,A&1),e===null)return Na(s),e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((s.mode&1)===0?s.lanes=1:e.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(z=y.children,e=y.fallback,P?(y=s.mode,P=s.child,z={mode:"hidden",children:z},(y&1)===0&&P!==null?(P.childLanes=0,P.pendingProps=z):P=Cl(z,y,0,null),e=mr(e,y,o,null),P.return=s,e.return=s,P.sibling=e,s.child=P,s.child.memoizedState=ic(o),s.memoizedState=rc,e):oc(s,z));if(A=e.memoizedState,A!==null&&(Q=A.dehydrated,Q!==null))return Fv(e,s,z,y,Q,A,o);if(P){P=y.fallback,z=s.mode,A=e.child,Q=A.sibling;var ee={mode:"hidden",children:y.children};return(z&1)===0&&s.child!==A?(y=s.child,y.childLanes=0,y.pendingProps=ee,s.deletions=null):(y=qs(A,ee),y.subtreeFlags=A.subtreeFlags&14680064),Q!==null?P=qs(Q,P):(P=mr(P,z,o,null),P.flags|=2),P.return=s,y.return=s,y.sibling=P,s.child=y,y=P,P=s.child,z=e.child.memoizedState,z=z===null?ic(o):{baseLanes:z.baseLanes|o,cachePool:null,transitions:z.transitions},P.memoizedState=z,P.childLanes=e.childLanes&~o,s.memoizedState=rc,y}return P=e.child,e=P.sibling,y=qs(P,{mode:"visible",children:y.children}),(s.mode&1)===0&&(y.lanes=o),y.return=s,y.sibling=null,e!==null&&(o=s.deletions,o===null?(s.deletions=[e],s.flags|=16):o.push(e)),s.child=y,s.memoizedState=null,y}function oc(e,s){return s=Cl({mode:"visible",children:s},e.mode,0,null),s.return=e,e.child=s}function ul(e,s,o,y){return y!==null&&Da(y),zr(s,e.child,null,o),e=oc(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function Fv(e,s,o,y,A,P,z){if(o)return s.flags&256?(s.flags&=-257,y=ec(Error(i(422))),ul(e,s,z,y)):s.memoizedState!==null?(s.child=e.child,s.flags|=128,null):(P=y.fallback,A=s.mode,y=Cl({mode:"visible",children:y.children},A,0,null),P=mr(P,A,z,null),P.flags|=2,y.return=s,P.return=s,y.sibling=P,s.child=y,(s.mode&1)!==0&&zr(s,e.child,null,z),s.child.memoizedState=ic(z),s.memoizedState=rc,P);if((s.mode&1)===0)return ul(e,s,z,null);if(A.data==="$!"){if(y=A.nextSibling&&A.nextSibling.dataset,y)var Q=y.dgst;return y=Q,P=Error(i(419)),y=ec(P,y,void 0),ul(e,s,z,y)}if(Q=(z&e.childLanes)!==0,pn||Q){if(y=qt,y!==null){switch(z&-z){case 4:A=2;break;case 16:A=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:A=32;break;case 536870912:A=268435456;break;default:A=0}A=(A&(y.suspendedLanes|z))!==0?0:A,A!==0&&A!==P.retryLane&&(P.retryLane=A,vs(e,A),Wn(y,e,A,-1))}return Sc(),y=ec(Error(i(421))),ul(e,s,z,y)}return A.data==="$?"?(s.flags|=128,s.child=e.child,s=Jv.bind(null,e),A._reactRetry=s,null):(e=P.treeContext,yn=Is(A.nextSibling),wn=s,Rt=!0,Fn=null,e!==null&&(xn[kn++]=ms,xn[kn++]=gs,xn[kn++]=or,ms=e.id,gs=e.overflow,or=s),s=oc(s,y.children),s.flags|=4096,s)}function Ed(e,s,o){e.lanes|=s;var y=e.alternate;y!==null&&(y.lanes|=s),Oa(e.return,s,o)}function lc(e,s,o,y,A){var P=e.memoizedState;P===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:y,tail:o,tailMode:A}:(P.isBackwards=s,P.rendering=null,P.renderingStartTime=0,P.last=y,P.tail=o,P.tailMode=A)}function Ld(e,s,o){var y=s.pendingProps,A=y.revealOrder,P=y.tail;if(on(e,s,y.children,o),y=At.current,(y&2)!==0)y=y&1|2,s.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ed(e,o,s);else if(e.tag===19)Ed(e,o,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}y&=1}if(Ct(At,y),(s.mode&1)===0)s.memoizedState=null;else switch(A){case"forwards":for(o=s.child,A=null;o!==null;)e=o.alternate,e!==null&&sl(e)===null&&(A=o),o=o.sibling;o=A,o===null?(A=s.child,s.child=null):(A=o.sibling,o.sibling=null),lc(s,!1,A,o,P);break;case"backwards":for(o=null,A=s.child,s.child=null;A!==null;){if(e=A.alternate,e!==null&&sl(e)===null){s.child=A;break}e=A.sibling,A.sibling=o,o=A,A=e}lc(s,!0,o,null,P);break;case"together":lc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function hl(e,s){(s.mode&1)===0&&e!==null&&(e.alternate=null,s.alternate=null,s.flags|=2)}function ws(e,s,o){if(e!==null&&(s.dependencies=e.dependencies),hr|=s.lanes,(o&s.childLanes)===0)return null;if(e!==null&&s.child!==e.child)throw Error(i(153));if(s.child!==null){for(e=s.child,o=qs(e,e.pendingProps),s.child=o,o.return=s;e.sibling!==null;)e=e.sibling,o=o.sibling=qs(e,e.pendingProps),o.return=s;o.sibling=null}return s.child}function Hv(e,s,o){switch(s.tag){case 3:Cd(s),Wr();break;case 5:$h(s);break;case 1:fn(s.type)&&Ko(s);break;case 4:Ha(s,s.stateNode.containerInfo);break;case 10:var y=s.type._context,A=s.memoizedProps.value;Ct(Zo,y._currentValue),y._currentValue=A;break;case 13:if(y=s.memoizedState,y!==null)return y.dehydrated!==null?(Ct(At,At.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?kd(e,s,o):(Ct(At,At.current&1),e=ws(e,s,o),e!==null?e.sibling:null);Ct(At,At.current&1);break;case 19:if(y=(o&s.childLanes)!==0,(e.flags&128)!==0){if(y)return Ld(e,s,o);s.flags|=128}if(A=s.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Ct(At,At.current),y)break;return null;case 22:case 23:return s.lanes=0,yd(e,s,o)}return ws(e,s,o)}var Td,ac,Rd,Md;Td=function(e,s){for(var o=s.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},ac=function(){},Rd=function(e,s,o,y){var A=e.memoizedProps;if(A!==y){e=s.stateNode,cr(ts.current);var P=null;switch(o){case"input":A=Ee(e,A),y=Ee(e,y),P=[];break;case"select":A=$({},A,{value:void 0}),y=$({},y,{value:void 0}),P=[];break;case"textarea":A=Me(e,A),y=Me(e,y),P=[];break;default:typeof A.onClick!="function"&&typeof y.onClick=="function"&&(e.onclick=zo)}Pt(o,y);var z;o=null;for(ce in A)if(!y.hasOwnProperty(ce)&&A.hasOwnProperty(ce)&&A[ce]!=null)if(ce==="style"){var Q=A[ce];for(z in Q)Q.hasOwnProperty(z)&&(o||(o={}),o[z]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(p.hasOwnProperty(ce)?P||(P=[]):(P=P||[]).push(ce,null));for(ce in y){var ee=y[ce];if(Q=A!=null?A[ce]:void 0,y.hasOwnProperty(ce)&&ee!==Q&&(ee!=null||Q!=null))if(ce==="style")if(Q){for(z in Q)!Q.hasOwnProperty(z)||ee&&ee.hasOwnProperty(z)||(o||(o={}),o[z]="");for(z in ee)ee.hasOwnProperty(z)&&Q[z]!==ee[z]&&(o||(o={}),o[z]=ee[z])}else o||(P||(P=[]),P.push(ce,o)),o=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,Q=Q?Q.__html:void 0,ee!=null&&Q!==ee&&(P=P||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(P=P||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(p.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&kt("scroll",e),P||Q===ee||(P=[])):(P=P||[]).push(ce,ee))}o&&(P=P||[]).push("style",o);var ce=P;(s.updateQueue=ce)&&(s.flags|=4)}},Md=function(e,s,o,y){o!==y&&(s.flags|=4)};function Vi(e,s){if(!Rt)switch(e.tailMode){case"hidden":s=e.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var y=null;o!==null;)o.alternate!==null&&(y=o),o=o.sibling;y===null?s||e.tail===null?e.tail=null:e.tail.sibling=null:y.sibling=null}}function Jt(e){var s=e.alternate!==null&&e.alternate.child===e.child,o=0,y=0;if(s)for(var A=e.child;A!==null;)o|=A.lanes|A.childLanes,y|=A.subtreeFlags&14680064,y|=A.flags&14680064,A.return=e,A=A.sibling;else for(A=e.child;A!==null;)o|=A.lanes|A.childLanes,y|=A.subtreeFlags,y|=A.flags,A.return=e,A=A.sibling;return e.subtreeFlags|=y,e.childLanes=o,s}function $v(e,s,o){var y=s.pendingProps;switch(Ma(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(s),null;case 1:return fn(s.type)&&Vo(),Jt(s),null;case 3:return y=s.stateNode,Kr(),Et(dn),Et(Xt),Wa(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(e===null||e.child===null)&&(Qo(s)?s.flags|=4:e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Fn!==null&&(wc(Fn),Fn=null))),ac(e,s),Jt(s),null;case 5:$a(s);var A=cr($i.current);if(o=s.type,e!==null&&s.stateNode!=null)Rd(e,s,o,y,A),e.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!y){if(s.stateNode===null)throw Error(i(166));return Jt(s),null}if(e=cr(ts.current),Qo(s)){y=s.stateNode,o=s.type;var P=s.memoizedProps;switch(y[es]=s,y[Pi]=P,e=(s.mode&1)!==0,o){case"dialog":kt("cancel",y),kt("close",y);break;case"iframe":case"object":case"embed":kt("load",y);break;case"video":case"audio":for(A=0;A<Di.length;A++)kt(Di[A],y);break;case"source":kt("error",y);break;case"img":case"image":case"link":kt("error",y),kt("load",y);break;case"details":kt("toggle",y);break;case"input":fe(y,P),kt("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!P.multiple},kt("invalid",y);break;case"textarea":Re(y,P),kt("invalid",y)}Pt(o,P),A=null;for(var z in P)if(P.hasOwnProperty(z)){var Q=P[z];z==="children"?typeof Q=="string"?y.textContent!==Q&&(P.suppressHydrationWarning!==!0&&Wo(y.textContent,Q,e),A=["children",Q]):typeof Q=="number"&&y.textContent!==""+Q&&(P.suppressHydrationWarning!==!0&&Wo(y.textContent,Q,e),A=["children",""+Q]):p.hasOwnProperty(z)&&Q!=null&&z==="onScroll"&&kt("scroll",y)}switch(o){case"input":_e(y),Ie(y,P,!0);break;case"textarea":_e(y),Ue(y);break;case"select":case"option":break;default:typeof P.onClick=="function"&&(y.onclick=zo)}y=A,s.updateQueue=y,y!==null&&(s.flags|=4)}else{z=A.nodeType===9?A:A.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=st(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=z.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof y.is=="string"?e=z.createElement(o,{is:y.is}):(e=z.createElement(o),o==="select"&&(z=e,y.multiple?z.multiple=!0:y.size&&(z.size=y.size))):e=z.createElementNS(e,o),e[es]=s,e[Pi]=y,Td(e,s,!1,!1),s.stateNode=e;e:{switch(z=he(o,y),o){case"dialog":kt("cancel",e),kt("close",e),A=y;break;case"iframe":case"object":case"embed":kt("load",e),A=y;break;case"video":case"audio":for(A=0;A<Di.length;A++)kt(Di[A],e);A=y;break;case"source":kt("error",e),A=y;break;case"img":case"image":case"link":kt("error",e),kt("load",e),A=y;break;case"details":kt("toggle",e),A=y;break;case"input":fe(e,y),A=Ee(e,y),kt("invalid",e);break;case"option":A=y;break;case"select":e._wrapperState={wasMultiple:!!y.multiple},A=$({},y,{value:void 0}),kt("invalid",e);break;case"textarea":Re(e,y),A=Me(e,y),kt("invalid",e);break;default:A=y}Pt(o,A),Q=A;for(P in Q)if(Q.hasOwnProperty(P)){var ee=Q[P];P==="style"?it(e,ee):P==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&yt(e,ee)):P==="children"?typeof ee=="string"?(o!=="textarea"||ee!=="")&&ct(e,ee):typeof ee=="number"&&ct(e,""+ee):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(p.hasOwnProperty(P)?ee!=null&&P==="onScroll"&&kt("scroll",e):ee!=null&&d(e,P,ee,z))}switch(o){case"input":_e(e),Ie(e,y,!1);break;case"textarea":_e(e),Ue(e);break;case"option":y.value!=null&&e.setAttribute("value",""+K(y.value));break;case"select":e.multiple=!!y.multiple,P=y.value,P!=null?de(e,!!y.multiple,P,!1):y.defaultValue!=null&&de(e,!!y.multiple,y.defaultValue,!0);break;default:typeof A.onClick=="function"&&(e.onclick=zo)}switch(o){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}}y&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Jt(s),null;case 6:if(e&&s.stateNode!=null)Md(e,s,e.memoizedProps,y);else{if(typeof y!="string"&&s.stateNode===null)throw Error(i(166));if(o=cr($i.current),cr(ts.current),Qo(s)){if(y=s.stateNode,o=s.memoizedProps,y[es]=s,(P=y.nodeValue!==o)&&(e=wn,e!==null))switch(e.tag){case 3:Wo(y.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Wo(y.nodeValue,o,(e.mode&1)!==0)}P&&(s.flags|=4)}else y=(o.nodeType===9?o:o.ownerDocument).createTextNode(y),y[es]=s,s.stateNode=y}return Jt(s),null;case 13:if(Et(At),y=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Rt&&yn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Dh(),Wr(),s.flags|=98560,P=!1;else if(P=Qo(s),y!==null&&y.dehydrated!==null){if(e===null){if(!P)throw Error(i(318));if(P=s.memoizedState,P=P!==null?P.dehydrated:null,!P)throw Error(i(317));P[es]=s}else Wr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Jt(s),P=!1}else Fn!==null&&(wc(Fn),Fn=null),P=!0;if(!P)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(y=y!==null,y!==(e!==null&&e.memoizedState!==null)&&y&&(s.child.flags|=8192,(s.mode&1)!==0&&(e===null||(At.current&1)!==0?Ut===0&&(Ut=3):Sc())),s.updateQueue!==null&&(s.flags|=4),Jt(s),null);case 4:return Kr(),ac(e,s),e===null&&Ii(s.stateNode.containerInfo),Jt(s),null;case 10:return Pa(s.type._context),Jt(s),null;case 17:return fn(s.type)&&Vo(),Jt(s),null;case 19:if(Et(At),P=s.memoizedState,P===null)return Jt(s),null;if(y=(s.flags&128)!==0,z=P.rendering,z===null)if(y)Vi(P,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(z=sl(e),z!==null){for(s.flags|=128,Vi(P,!1),y=z.updateQueue,y!==null&&(s.updateQueue=y,s.flags|=4),s.subtreeFlags=0,y=o,o=s.child;o!==null;)P=o,e=y,P.flags&=14680066,z=P.alternate,z===null?(P.childLanes=0,P.lanes=e,P.child=null,P.subtreeFlags=0,P.memoizedProps=null,P.memoizedState=null,P.updateQueue=null,P.dependencies=null,P.stateNode=null):(P.childLanes=z.childLanes,P.lanes=z.lanes,P.child=z.child,P.subtreeFlags=0,P.deletions=null,P.memoizedProps=z.memoizedProps,P.memoizedState=z.memoizedState,P.updateQueue=z.updateQueue,P.type=z.type,e=z.dependencies,P.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return Ct(At,At.current&1|2),s.child}e=e.sibling}P.tail!==null&&ft()>Qr&&(s.flags|=128,y=!0,Vi(P,!1),s.lanes=4194304)}else{if(!y)if(e=sl(z),e!==null){if(s.flags|=128,y=!0,o=e.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),Vi(P,!0),P.tail===null&&P.tailMode==="hidden"&&!z.alternate&&!Rt)return Jt(s),null}else 2*ft()-P.renderingStartTime>Qr&&o!==1073741824&&(s.flags|=128,y=!0,Vi(P,!1),s.lanes=4194304);P.isBackwards?(z.sibling=s.child,s.child=z):(o=P.last,o!==null?o.sibling=z:s.child=z,P.last=z)}return P.tail!==null?(s=P.tail,P.rendering=s,P.tail=s.sibling,P.renderingStartTime=ft(),s.sibling=null,o=At.current,Ct(At,y?o&1|2:o&1),s):(Jt(s),null);case 22:case 23:return bc(),y=s.memoizedState!==null,e!==null&&e.memoizedState!==null!==y&&(s.flags|=8192),y&&(s.mode&1)!==0?(bn&1073741824)!==0&&(Jt(s),s.subtreeFlags&6&&(s.flags|=8192)):Jt(s),null;case 24:return null;case 25:return null}throw Error(i(156,s.tag))}function Uv(e,s){switch(Ma(s),s.tag){case 1:return fn(s.type)&&Vo(),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return Kr(),Et(dn),Et(Xt),Wa(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 5:return $a(s),null;case 13:if(Et(At),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Wr()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return Et(At),null;case 4:return Kr(),null;case 10:return Pa(s.type._context),null;case 22:case 23:return bc(),null;case 24:return null;default:return null}}var dl=!1,Zt=!1,Wv=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Yr(e,s){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(y){It(e,s,y)}else o.current=null}function cc(e,s,o){try{o()}catch(y){It(e,s,y)}}var Ad=!1;function zv(e,s){if(ba=kr,e=ch(),fa(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var y=o.getSelection&&o.getSelection();if(y&&y.rangeCount!==0){o=y.anchorNode;var A=y.anchorOffset,P=y.focusNode;y=y.focusOffset;try{o.nodeType,P.nodeType}catch{o=null;break e}var z=0,Q=-1,ee=-1,ce=0,ke=0,Le=e,Ce=null;t:for(;;){for(var De;Le!==o||A!==0&&Le.nodeType!==3||(Q=z+A),Le!==P||y!==0&&Le.nodeType!==3||(ee=z+y),Le.nodeType===3&&(z+=Le.nodeValue.length),(De=Le.firstChild)!==null;)Ce=Le,Le=De;for(;;){if(Le===e)break t;if(Ce===o&&++ce===A&&(Q=z),Ce===P&&++ke===y&&(ee=z),(De=Le.nextSibling)!==null)break;Le=Ce,Ce=Le.parentNode}Le=De}o=Q===-1||ee===-1?null:{start:Q,end:ee}}else o=null}o=o||{start:0,end:0}}else o=null;for(Sa={focusedElem:e,selectionRange:o},kr=!1,Pe=s;Pe!==null;)if(s=Pe,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,Pe=e;else for(;Pe!==null;){s=Pe;try{var Be=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Be!==null){var $e=Be.memoizedProps,Bt=Be.memoizedState,le=s.stateNode,se=le.getSnapshotBeforeUpdate(s.elementType===s.type?$e:Hn(s.type,$e),Bt);le.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ae=s.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Te){It(s,s.return,Te)}if(e=s.sibling,e!==null){e.return=s.return,Pe=e;break}Pe=s.return}return Be=Ad,Ad=!1,Be}function Ki(e,s,o){var y=s.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var A=y=y.next;do{if((A.tag&e)===e){var P=A.destroy;A.destroy=void 0,P!==void 0&&cc(s,o,P)}A=A.next}while(A!==y)}}function fl(e,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&e)===e){var y=o.create;o.destroy=y()}o=o.next}while(o!==s)}}function uc(e){var s=e.ref;if(s!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof s=="function"?s(e):s.current=e}}function Nd(e){var s=e.alternate;s!==null&&(e.alternate=null,Nd(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&(delete s[es],delete s[Pi],delete s[Ea],delete s[Ev],delete s[Lv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Dd(e){return e.tag===5||e.tag===3||e.tag===4}function Id(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hc(e,s,o){var y=e.tag;if(y===5||y===6)e=e.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(e,s):o.insertBefore(e,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(e,o)):(s=o,s.appendChild(e)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=zo));else if(y!==4&&(e=e.child,e!==null))for(hc(e,s,o),e=e.sibling;e!==null;)hc(e,s,o),e=e.sibling}function dc(e,s,o){var y=e.tag;if(y===5||y===6)e=e.stateNode,s?o.insertBefore(e,s):o.appendChild(e);else if(y!==4&&(e=e.child,e!==null))for(dc(e,s,o),e=e.sibling;e!==null;)dc(e,s,o),e=e.sibling}var Kt=null,$n=!1;function Hs(e,s,o){for(o=o.child;o!==null;)jd(e,s,o),o=o.sibling}function jd(e,s,o){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Kn,o)}catch{}switch(o.tag){case 5:Zt||Yr(o,s);case 6:var y=Kt,A=$n;Kt=null,Hs(e,s,o),Kt=y,$n=A,Kt!==null&&($n?(e=Kt,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):Kt.removeChild(o.stateNode));break;case 18:Kt!==null&&($n?(e=Kt,o=o.stateNode,e.nodeType===8?ka(e.parentNode,o):e.nodeType===1&&ka(e,o),Ns(e)):ka(Kt,o.stateNode));break;case 4:y=Kt,A=$n,Kt=o.stateNode.containerInfo,$n=!0,Hs(e,s,o),Kt=y,$n=A;break;case 0:case 11:case 14:case 15:if(!Zt&&(y=o.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){A=y=y.next;do{var P=A,z=P.destroy;P=P.tag,z!==void 0&&((P&2)!==0||(P&4)!==0)&&cc(o,s,z),A=A.next}while(A!==y)}Hs(e,s,o);break;case 1:if(!Zt&&(Yr(o,s),y=o.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=o.memoizedProps,y.state=o.memoizedState,y.componentWillUnmount()}catch(Q){It(o,s,Q)}Hs(e,s,o);break;case 21:Hs(e,s,o);break;case 22:o.mode&1?(Zt=(y=Zt)||o.memoizedState!==null,Hs(e,s,o),Zt=y):Hs(e,s,o);break;default:Hs(e,s,o)}}function Pd(e){var s=e.updateQueue;if(s!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new Wv),s.forEach(function(y){var A=Zv.bind(null,e,y);o.has(y)||(o.add(y),y.then(A,A))})}}function Un(e,s){var o=s.deletions;if(o!==null)for(var y=0;y<o.length;y++){var A=o[y];try{var P=e,z=s,Q=z;e:for(;Q!==null;){switch(Q.tag){case 5:Kt=Q.stateNode,$n=!1;break e;case 3:Kt=Q.stateNode.containerInfo,$n=!0;break e;case 4:Kt=Q.stateNode.containerInfo,$n=!0;break e}Q=Q.return}if(Kt===null)throw Error(i(160));jd(P,z,A),Kt=null,$n=!1;var ee=A.alternate;ee!==null&&(ee.return=null),A.return=null}catch(ce){It(A,s,ce)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Od(s,e),s=s.sibling}function Od(e,s){var o=e.alternate,y=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Un(s,e),ss(e),y&4){try{Ki(3,e,e.return),fl(3,e)}catch($e){It(e,e.return,$e)}try{Ki(5,e,e.return)}catch($e){It(e,e.return,$e)}}break;case 1:Un(s,e),ss(e),y&512&&o!==null&&Yr(o,o.return);break;case 5:if(Un(s,e),ss(e),y&512&&o!==null&&Yr(o,o.return),e.flags&32){var A=e.stateNode;try{ct(A,"")}catch($e){It(e,e.return,$e)}}if(y&4&&(A=e.stateNode,A!=null)){var P=e.memoizedProps,z=o!==null?o.memoizedProps:P,Q=e.type,ee=e.updateQueue;if(e.updateQueue=null,ee!==null)try{Q==="input"&&P.type==="radio"&&P.name!=null&&Ae(A,P),he(Q,z);var ce=he(Q,P);for(z=0;z<ee.length;z+=2){var ke=ee[z],Le=ee[z+1];ke==="style"?it(A,Le):ke==="dangerouslySetInnerHTML"?yt(A,Le):ke==="children"?ct(A,Le):d(A,ke,Le,ce)}switch(Q){case"input":ne(A,P);break;case"textarea":Ke(A,P);break;case"select":var Ce=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!P.multiple;var De=P.value;De!=null?de(A,!!P.multiple,De,!1):Ce!==!!P.multiple&&(P.defaultValue!=null?de(A,!!P.multiple,P.defaultValue,!0):de(A,!!P.multiple,P.multiple?[]:"",!1))}A[Pi]=P}catch($e){It(e,e.return,$e)}}break;case 6:if(Un(s,e),ss(e),y&4){if(e.stateNode===null)throw Error(i(162));A=e.stateNode,P=e.memoizedProps;try{A.nodeValue=P}catch($e){It(e,e.return,$e)}}break;case 3:if(Un(s,e),ss(e),y&4&&o!==null&&o.memoizedState.isDehydrated)try{Ns(s.containerInfo)}catch($e){It(e,e.return,$e)}break;case 4:Un(s,e),ss(e);break;case 13:Un(s,e),ss(e),A=e.child,A.flags&8192&&(P=A.memoizedState!==null,A.stateNode.isHidden=P,!P||A.alternate!==null&&A.alternate.memoizedState!==null||(mc=ft())),y&4&&Pd(e);break;case 22:if(ke=o!==null&&o.memoizedState!==null,e.mode&1?(Zt=(ce=Zt)||ke,Un(s,e),Zt=ce):Un(s,e),ss(e),y&8192){if(ce=e.memoizedState!==null,(e.stateNode.isHidden=ce)&&!ke&&(e.mode&1)!==0)for(Pe=e,ke=e.child;ke!==null;){for(Le=Pe=ke;Pe!==null;){switch(Ce=Pe,De=Ce.child,Ce.tag){case 0:case 11:case 14:case 15:Ki(4,Ce,Ce.return);break;case 1:Yr(Ce,Ce.return);var Be=Ce.stateNode;if(typeof Be.componentWillUnmount=="function"){y=Ce,o=Ce.return;try{s=y,Be.props=s.memoizedProps,Be.state=s.memoizedState,Be.componentWillUnmount()}catch($e){It(y,o,$e)}}break;case 5:Yr(Ce,Ce.return);break;case 22:if(Ce.memoizedState!==null){Hd(Le);continue}}De!==null?(De.return=Ce,Pe=De):Hd(Le)}ke=ke.sibling}e:for(ke=null,Le=e;;){if(Le.tag===5){if(ke===null){ke=Le;try{A=Le.stateNode,ce?(P=A.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none"):(Q=Le.stateNode,ee=Le.memoizedProps.style,z=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,Q.style.display=bt("display",z))}catch($e){It(e,e.return,$e)}}}else if(Le.tag===6){if(ke===null)try{Le.stateNode.nodeValue=ce?"":Le.memoizedProps}catch($e){It(e,e.return,$e)}}else if((Le.tag!==22&&Le.tag!==23||Le.memoizedState===null||Le===e)&&Le.child!==null){Le.child.return=Le,Le=Le.child;continue}if(Le===e)break e;for(;Le.sibling===null;){if(Le.return===null||Le.return===e)break e;ke===Le&&(ke=null),Le=Le.return}ke===Le&&(ke=null),Le.sibling.return=Le.return,Le=Le.sibling}}break;case 19:Un(s,e),ss(e),y&4&&Pd(e);break;case 21:break;default:Un(s,e),ss(e)}}function ss(e){var s=e.flags;if(s&2){try{e:{for(var o=e.return;o!==null;){if(Dd(o)){var y=o;break e}o=o.return}throw Error(i(160))}switch(y.tag){case 5:var A=y.stateNode;y.flags&32&&(ct(A,""),y.flags&=-33);var P=Id(e);dc(e,P,A);break;case 3:case 4:var z=y.stateNode.containerInfo,Q=Id(e);hc(e,Q,z);break;default:throw Error(i(161))}}catch(ee){It(e,e.return,ee)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function qv(e,s,o){Pe=e,Bd(e)}function Bd(e,s,o){for(var y=(e.mode&1)!==0;Pe!==null;){var A=Pe,P=A.child;if(A.tag===22&&y){var z=A.memoizedState!==null||dl;if(!z){var Q=A.alternate,ee=Q!==null&&Q.memoizedState!==null||Zt;Q=dl;var ce=Zt;if(dl=z,(Zt=ee)&&!ce)for(Pe=A;Pe!==null;)z=Pe,ee=z.child,z.tag===22&&z.memoizedState!==null?$d(A):ee!==null?(ee.return=z,Pe=ee):$d(A);for(;P!==null;)Pe=P,Bd(P),P=P.sibling;Pe=A,dl=Q,Zt=ce}Fd(e)}else(A.subtreeFlags&8772)!==0&&P!==null?(P.return=A,Pe=P):Fd(e)}}function Fd(e){for(;Pe!==null;){var s=Pe;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Zt||fl(5,s);break;case 1:var y=s.stateNode;if(s.flags&4&&!Zt)if(o===null)y.componentDidMount();else{var A=s.elementType===s.type?o.memoizedProps:Hn(s.type,o.memoizedProps);y.componentDidUpdate(A,o.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var P=s.updateQueue;P!==null&&Hh(s,P,y);break;case 3:var z=s.updateQueue;if(z!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}Hh(s,z,o)}break;case 5:var Q=s.stateNode;if(o===null&&s.flags&4){o=Q;var ee=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&o.focus();break;case"img":ee.src&&(o.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ce=s.alternate;if(ce!==null){var ke=ce.memoizedState;if(ke!==null){var Le=ke.dehydrated;Le!==null&&Ns(Le)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}Zt||s.flags&512&&uc(s)}catch(Ce){It(s,s.return,Ce)}}if(s===e){Pe=null;break}if(o=s.sibling,o!==null){o.return=s.return,Pe=o;break}Pe=s.return}}function Hd(e){for(;Pe!==null;){var s=Pe;if(s===e){Pe=null;break}var o=s.sibling;if(o!==null){o.return=s.return,Pe=o;break}Pe=s.return}}function $d(e){for(;Pe!==null;){var s=Pe;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{fl(4,s)}catch(ee){It(s,o,ee)}break;case 1:var y=s.stateNode;if(typeof y.componentDidMount=="function"){var A=s.return;try{y.componentDidMount()}catch(ee){It(s,A,ee)}}var P=s.return;try{uc(s)}catch(ee){It(s,P,ee)}break;case 5:var z=s.return;try{uc(s)}catch(ee){It(s,z,ee)}}}catch(ee){It(s,s.return,ee)}if(s===e){Pe=null;break}var Q=s.sibling;if(Q!==null){Q.return=s.return,Pe=Q;break}Pe=s.return}}var Vv=Math.ceil,pl=L.ReactCurrentDispatcher,fc=L.ReactCurrentOwner,Tn=L.ReactCurrentBatchConfig,pt=0,qt=null,Ht=null,Gt=0,bn=0,Xr=js(0),Ut=0,Gi=null,hr=0,ml=0,pc=0,Yi=null,mn=null,mc=0,Qr=1/0,ys=null,gl=!1,gc=null,$s=null,vl=!1,Us=null,_l=0,Xi=0,vc=null,wl=-1,yl=0;function ln(){return(pt&6)!==0?ft():wl!==-1?wl:wl=ft()}function Ws(e){return(e.mode&1)===0?1:(pt&2)!==0&&Gt!==0?Gt&-Gt:Rv.transition!==null?(yl===0&&(yl=yo()),yl):(e=Ze,e!==0||(e=window.event,e=e===void 0?16:yi(e.type)),e)}function Wn(e,s,o,y){if(50<Xi)throw Xi=0,vc=null,Error(i(185));Sn(e,o,y),((pt&2)===0||e!==qt)&&(e===qt&&((pt&2)===0&&(ml|=o),Ut===4&&zs(e,Gt)),gn(e,y),o===1&&pt===0&&(s.mode&1)===0&&(Qr=ft()+500,Go&&Os()))}function gn(e,s){var o=e.callbackNode;fi(e,s);var y=us(e,e===qt?Gt:0);if(y===0)o!==null&&Je(o),e.callbackNode=null,e.callbackPriority=0;else if(s=y&-y,e.callbackPriority!==s){if(o!=null&&Je(o),s===1)e.tag===0?Tv(Wd.bind(null,e)):Th(Wd.bind(null,e)),xv(function(){(pt&6)===0&&Os()}),o=null;else{switch(Sr(y)){case 1:o=cs;break;case 4:o=vo;break;case 16:o=Es;break;case 536870912:o=_o;break;default:o=Es}o=Qd(o,Ud.bind(null,e))}e.callbackPriority=s,e.callbackNode=o}}function Ud(e,s){if(wl=-1,yl=0,(pt&6)!==0)throw Error(i(327));var o=e.callbackNode;if(Jr()&&e.callbackNode!==o)return null;var y=us(e,e===qt?Gt:0);if(y===0)return null;if((y&30)!==0||(y&e.expiredLanes)!==0||s)s=bl(e,y);else{s=y;var A=pt;pt|=2;var P=qd();(qt!==e||Gt!==s)&&(ys=null,Qr=ft()+500,fr(e,s));do try{Yv();break}catch(Q){zd(e,Q)}while(!0);ja(),pl.current=P,pt=A,Ht!==null?s=0:(qt=null,Gt=0,s=Ut)}if(s!==0){if(s===2&&(A=hn(e),A!==0&&(y=A,s=_c(e,A))),s===1)throw o=Gi,fr(e,0),zs(e,y),gn(e,ft()),o;if(s===6)zs(e,y);else{if(A=e.current.alternate,(y&30)===0&&!Kv(A)&&(s=bl(e,y),s===2&&(P=hn(e),P!==0&&(y=P,s=_c(e,P))),s===1))throw o=Gi,fr(e,0),zs(e,y),gn(e,ft()),o;switch(e.finishedWork=A,e.finishedLanes=y,s){case 0:case 1:throw Error(i(345));case 2:pr(e,mn,ys);break;case 3:if(zs(e,y),(y&130023424)===y&&(s=mc+500-ft(),10<s)){if(us(e,0)!==0)break;if(A=e.suspendedLanes,(A&y)!==y){ln(),e.pingedLanes|=e.suspendedLanes&A;break}e.timeoutHandle=xa(pr.bind(null,e,mn,ys),s);break}pr(e,mn,ys);break;case 4:if(zs(e,y),(y&4194240)===y)break;for(s=e.eventTimes,A=-1;0<y;){var z=31-un(y);P=1<<z,z=s[z],z>A&&(A=z),y&=~P}if(y=A,y=ft()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*Vv(y/1960))-y,10<y){e.timeoutHandle=xa(pr.bind(null,e,mn,ys),y);break}pr(e,mn,ys);break;case 5:pr(e,mn,ys);break;default:throw Error(i(329))}}}return gn(e,ft()),e.callbackNode===o?Ud.bind(null,e):null}function _c(e,s){var o=Yi;return e.current.memoizedState.isDehydrated&&(fr(e,s).flags|=256),e=bl(e,s),e!==2&&(s=mn,mn=o,s!==null&&wc(s)),e}function wc(e){mn===null?mn=e:mn.push.apply(mn,e)}function Kv(e){for(var s=e;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var y=0;y<o.length;y++){var A=o[y],P=A.getSnapshot;A=A.value;try{if(!Bn(P(),A))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function zs(e,s){for(s&=~pc,s&=~ml,e.suspendedLanes|=s,e.pingedLanes&=~s,e=e.expirationTimes;0<s;){var o=31-un(s),y=1<<o;e[o]=-1,s&=~y}}function Wd(e){if((pt&6)!==0)throw Error(i(327));Jr();var s=us(e,0);if((s&1)===0)return gn(e,ft()),null;var o=bl(e,s);if(e.tag!==0&&o===2){var y=hn(e);y!==0&&(s=y,o=_c(e,y))}if(o===1)throw o=Gi,fr(e,0),zs(e,s),gn(e,ft()),o;if(o===6)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=s,pr(e,mn,ys),gn(e,ft()),null}function yc(e,s){var o=pt;pt|=1;try{return e(s)}finally{pt=o,pt===0&&(Qr=ft()+500,Go&&Os())}}function dr(e){Us!==null&&Us.tag===0&&(pt&6)===0&&Jr();var s=pt;pt|=1;var o=Tn.transition,y=Ze;try{if(Tn.transition=null,Ze=1,e)return e()}finally{Ze=y,Tn.transition=o,pt=s,(pt&6)===0&&Os()}}function bc(){bn=Xr.current,Et(Xr)}function fr(e,s){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,Cv(o)),Ht!==null)for(o=Ht.return;o!==null;){var y=o;switch(Ma(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&Vo();break;case 3:Kr(),Et(dn),Et(Xt),Wa();break;case 5:$a(y);break;case 4:Kr();break;case 13:Et(At);break;case 19:Et(At);break;case 10:Pa(y.type._context);break;case 22:case 23:bc()}o=o.return}if(qt=e,Ht=e=qs(e.current,null),Gt=bn=s,Ut=0,Gi=null,pc=ml=hr=0,mn=Yi=null,ar!==null){for(s=0;s<ar.length;s++)if(o=ar[s],y=o.interleaved,y!==null){o.interleaved=null;var A=y.next,P=o.pending;if(P!==null){var z=P.next;P.next=A,y.next=z}o.pending=y}ar=null}return e}function zd(e,s){do{var o=Ht;try{if(ja(),rl.current=al,il){for(var y=Nt.memoizedState;y!==null;){var A=y.queue;A!==null&&(A.pending=null),y=y.next}il=!1}if(ur=0,zt=$t=Nt=null,Ui=!1,Wi=0,fc.current=null,o===null||o.return===null){Ut=1,Gi=s,Ht=null;break}e:{var P=e,z=o.return,Q=o,ee=s;if(s=Gt,Q.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,ke=Q,Le=ke.tag;if((ke.mode&1)===0&&(Le===0||Le===11||Le===15)){var Ce=ke.alternate;Ce?(ke.updateQueue=Ce.updateQueue,ke.memoizedState=Ce.memoizedState,ke.lanes=Ce.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var De=md(z);if(De!==null){De.flags&=-257,gd(De,z,Q,P,s),De.mode&1&&pd(P,ce,s),s=De,ee=ce;var Be=s.updateQueue;if(Be===null){var $e=new Set;$e.add(ee),s.updateQueue=$e}else Be.add(ee);break e}else{if((s&1)===0){pd(P,ce,s),Sc();break e}ee=Error(i(426))}}else if(Rt&&Q.mode&1){var Bt=md(z);if(Bt!==null){(Bt.flags&65536)===0&&(Bt.flags|=256),gd(Bt,z,Q,P,s),Da(Gr(ee,Q));break e}}P=ee=Gr(ee,Q),Ut!==4&&(Ut=2),Yi===null?Yi=[P]:Yi.push(P),P=z;do{switch(P.tag){case 3:P.flags|=65536,s&=-s,P.lanes|=s;var le=dd(P,ee,s);Fh(P,le);break e;case 1:Q=ee;var se=P.type,ae=P.stateNode;if((P.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&($s===null||!$s.has(ae)))){P.flags|=65536,s&=-s,P.lanes|=s;var Te=fd(P,Q,s);Fh(P,Te);break e}}P=P.return}while(P!==null)}Kd(o)}catch(qe){s=qe,Ht===o&&o!==null&&(Ht=o=o.return);continue}break}while(!0)}function qd(){var e=pl.current;return pl.current=al,e===null?al:e}function Sc(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),qt===null||(hr&268435455)===0&&(ml&268435455)===0||zs(qt,Gt)}function bl(e,s){var o=pt;pt|=2;var y=qd();(qt!==e||Gt!==s)&&(ys=null,fr(e,s));do try{Gv();break}catch(A){zd(e,A)}while(!0);if(ja(),pt=o,pl.current=y,Ht!==null)throw Error(i(261));return qt=null,Gt=0,Ut}function Gv(){for(;Ht!==null;)Vd(Ht)}function Yv(){for(;Ht!==null&&!St();)Vd(Ht)}function Vd(e){var s=Xd(e.alternate,e,bn);e.memoizedProps=e.pendingProps,s===null?Kd(e):Ht=s,fc.current=null}function Kd(e){var s=e;do{var o=s.alternate;if(e=s.return,(s.flags&32768)===0){if(o=$v(o,s,bn),o!==null){Ht=o;return}}else{if(o=Uv(o,s),o!==null){o.flags&=32767,Ht=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ut=6,Ht=null;return}}if(s=s.sibling,s!==null){Ht=s;return}Ht=s=e}while(s!==null);Ut===0&&(Ut=5)}function pr(e,s,o){var y=Ze,A=Tn.transition;try{Tn.transition=null,Ze=1,Xv(e,s,o,y)}finally{Tn.transition=A,Ze=y}return null}function Xv(e,s,o,y){do Jr();while(Us!==null);if((pt&6)!==0)throw Error(i(327));o=e.finishedWork;var A=e.finishedLanes;if(o===null)return null;if(e.finishedWork=null,e.finishedLanes=0,o===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0;var P=o.lanes|o.childLanes;if(br(e,P),e===qt&&(Ht=qt=null,Gt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||vl||(vl=!0,Qd(Es,function(){return Jr(),null})),P=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||P){P=Tn.transition,Tn.transition=null;var z=Ze;Ze=1;var Q=pt;pt|=4,fc.current=null,zv(e,o),Od(o,e),gv(Sa),kr=!!ba,Sa=ba=null,e.current=o,qv(o),dt(),pt=Q,Ze=z,Tn.transition=P}else e.current=o;if(vl&&(vl=!1,Us=e,_l=A),P=e.pendingLanes,P===0&&($s=null),wo(o.stateNode),gn(e,ft()),s!==null)for(y=e.onRecoverableError,o=0;o<s.length;o++)A=s[o],y(A.value,{componentStack:A.stack,digest:A.digest});if(gl)throw gl=!1,e=gc,gc=null,e;return(_l&1)!==0&&e.tag!==0&&Jr(),P=e.pendingLanes,(P&1)!==0?e===vc?Xi++:(Xi=0,vc=e):Xi=0,Os(),null}function Jr(){if(Us!==null){var e=Sr(_l),s=Tn.transition,o=Ze;try{if(Tn.transition=null,Ze=16>e?16:e,Us===null)var y=!1;else{if(e=Us,Us=null,_l=0,(pt&6)!==0)throw Error(i(331));var A=pt;for(pt|=4,Pe=e.current;Pe!==null;){var P=Pe,z=P.child;if((Pe.flags&16)!==0){var Q=P.deletions;if(Q!==null){for(var ee=0;ee<Q.length;ee++){var ce=Q[ee];for(Pe=ce;Pe!==null;){var ke=Pe;switch(ke.tag){case 0:case 11:case 15:Ki(8,ke,P)}var Le=ke.child;if(Le!==null)Le.return=ke,Pe=Le;else for(;Pe!==null;){ke=Pe;var Ce=ke.sibling,De=ke.return;if(Nd(ke),ke===ce){Pe=null;break}if(Ce!==null){Ce.return=De,Pe=Ce;break}Pe=De}}}var Be=P.alternate;if(Be!==null){var $e=Be.child;if($e!==null){Be.child=null;do{var Bt=$e.sibling;$e.sibling=null,$e=Bt}while($e!==null)}}Pe=P}}if((P.subtreeFlags&2064)!==0&&z!==null)z.return=P,Pe=z;else e:for(;Pe!==null;){if(P=Pe,(P.flags&2048)!==0)switch(P.tag){case 0:case 11:case 15:Ki(9,P,P.return)}var le=P.sibling;if(le!==null){le.return=P.return,Pe=le;break e}Pe=P.return}}var se=e.current;for(Pe=se;Pe!==null;){z=Pe;var ae=z.child;if((z.subtreeFlags&2064)!==0&&ae!==null)ae.return=z,Pe=ae;else e:for(z=se;Pe!==null;){if(Q=Pe,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:fl(9,Q)}}catch(qe){It(Q,Q.return,qe)}if(Q===z){Pe=null;break e}var Te=Q.sibling;if(Te!==null){Te.return=Q.return,Pe=Te;break e}Pe=Q.return}}if(pt=A,Os(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Kn,e)}catch{}y=!0}return y}finally{Ze=o,Tn.transition=s}}return!1}function Gd(e,s,o){s=Gr(o,s),s=dd(e,s,1),e=Fs(e,s,1),s=ln(),e!==null&&(Sn(e,1,s),gn(e,s))}function It(e,s,o){if(e.tag===3)Gd(e,e,o);else for(;s!==null;){if(s.tag===3){Gd(s,e,o);break}else if(s.tag===1){var y=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&($s===null||!$s.has(y))){e=Gr(o,e),e=fd(s,e,1),s=Fs(s,e,1),e=ln(),s!==null&&(Sn(s,1,e),gn(s,e));break}}s=s.return}}function Qv(e,s,o){var y=e.pingCache;y!==null&&y.delete(s),s=ln(),e.pingedLanes|=e.suspendedLanes&o,qt===e&&(Gt&o)===o&&(Ut===4||Ut===3&&(Gt&130023424)===Gt&&500>ft()-mc?fr(e,0):pc|=o),gn(e,s)}function Yd(e,s){s===0&&((e.mode&1)===0?s=1:(s=Gn,Gn<<=1,(Gn&130023424)===0&&(Gn=4194304)));var o=ln();e=vs(e,s),e!==null&&(Sn(e,s,o),gn(e,o))}function Jv(e){var s=e.memoizedState,o=0;s!==null&&(o=s.retryLane),Yd(e,o)}function Zv(e,s){var o=0;switch(e.tag){case 13:var y=e.stateNode,A=e.memoizedState;A!==null&&(o=A.retryLane);break;case 19:y=e.stateNode;break;default:throw Error(i(314))}y!==null&&y.delete(s),Yd(e,o)}var Xd;Xd=function(e,s,o){if(e!==null)if(e.memoizedProps!==s.pendingProps||dn.current)pn=!0;else{if((e.lanes&o)===0&&(s.flags&128)===0)return pn=!1,Hv(e,s,o);pn=(e.flags&131072)!==0}else pn=!1,Rt&&(s.flags&1048576)!==0&&Rh(s,Xo,s.index);switch(s.lanes=0,s.tag){case 2:var y=s.type;hl(e,s),e=s.pendingProps;var A=Hr(s,Xt.current);Vr(s,o),A=Va(null,s,y,e,A,o);var P=Ka();return s.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,fn(y)?(P=!0,Ko(s)):P=!1,s.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,Fa(s),A.updater=cl,s.stateNode=A,A._reactInternals=s,Za(s,y,e,o),s=sc(null,s,y,!0,P,o)):(s.tag=0,Rt&&P&&Ra(s),on(null,s,A,o),s=s.child),s;case 16:y=s.elementType;e:{switch(hl(e,s),e=s.pendingProps,A=y._init,y=A(y._payload),s.type=y,A=s.tag=t_(y),e=Hn(y,e),A){case 0:s=nc(null,s,y,e,o);break e;case 1:s=Sd(null,s,y,e,o);break e;case 11:s=vd(null,s,y,e,o);break e;case 14:s=_d(null,s,y,Hn(y.type,e),o);break e}throw Error(i(306,y,""))}return s;case 0:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Hn(y,A),nc(e,s,y,A,o);case 1:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Hn(y,A),Sd(e,s,y,A,o);case 3:e:{if(Cd(s),e===null)throw Error(i(387));y=s.pendingProps,P=s.memoizedState,A=P.element,Bh(e,s),nl(s,y,null,o);var z=s.memoizedState;if(y=z.element,P.isDehydrated)if(P={element:y,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},s.updateQueue.baseState=P,s.memoizedState=P,s.flags&256){A=Gr(Error(i(423)),s),s=xd(e,s,y,o,A);break e}else if(y!==A){A=Gr(Error(i(424)),s),s=xd(e,s,y,o,A);break e}else for(yn=Is(s.stateNode.containerInfo.firstChild),wn=s,Rt=!0,Fn=null,o=Ph(s,null,y,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Wr(),y===A){s=ws(e,s,o);break e}on(e,s,y,o)}s=s.child}return s;case 5:return $h(s),e===null&&Na(s),y=s.type,A=s.pendingProps,P=e!==null?e.memoizedProps:null,z=A.children,Ca(y,A)?z=null:P!==null&&Ca(y,P)&&(s.flags|=32),bd(e,s),on(e,s,z,o),s.child;case 6:return e===null&&Na(s),null;case 13:return kd(e,s,o);case 4:return Ha(s,s.stateNode.containerInfo),y=s.pendingProps,e===null?s.child=zr(s,null,y,o):on(e,s,y,o),s.child;case 11:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Hn(y,A),vd(e,s,y,A,o);case 7:return on(e,s,s.pendingProps,o),s.child;case 8:return on(e,s,s.pendingProps.children,o),s.child;case 12:return on(e,s,s.pendingProps.children,o),s.child;case 10:e:{if(y=s.type._context,A=s.pendingProps,P=s.memoizedProps,z=A.value,Ct(Zo,y._currentValue),y._currentValue=z,P!==null)if(Bn(P.value,z)){if(P.children===A.children&&!dn.current){s=ws(e,s,o);break e}}else for(P=s.child,P!==null&&(P.return=s);P!==null;){var Q=P.dependencies;if(Q!==null){z=P.child;for(var ee=Q.firstContext;ee!==null;){if(ee.context===y){if(P.tag===1){ee=_s(-1,o&-o),ee.tag=2;var ce=P.updateQueue;if(ce!==null){ce=ce.shared;var ke=ce.pending;ke===null?ee.next=ee:(ee.next=ke.next,ke.next=ee),ce.pending=ee}}P.lanes|=o,ee=P.alternate,ee!==null&&(ee.lanes|=o),Oa(P.return,o,s),Q.lanes|=o;break}ee=ee.next}}else if(P.tag===10)z=P.type===s.type?null:P.child;else if(P.tag===18){if(z=P.return,z===null)throw Error(i(341));z.lanes|=o,Q=z.alternate,Q!==null&&(Q.lanes|=o),Oa(z,o,s),z=P.sibling}else z=P.child;if(z!==null)z.return=P;else for(z=P;z!==null;){if(z===s){z=null;break}if(P=z.sibling,P!==null){P.return=z.return,z=P;break}z=z.return}P=z}on(e,s,A.children,o),s=s.child}return s;case 9:return A=s.type,y=s.pendingProps.children,Vr(s,o),A=En(A),y=y(A),s.flags|=1,on(e,s,y,o),s.child;case 14:return y=s.type,A=Hn(y,s.pendingProps),A=Hn(y.type,A),_d(e,s,y,A,o);case 15:return wd(e,s,s.type,s.pendingProps,o);case 17:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Hn(y,A),hl(e,s),s.tag=1,fn(y)?(e=!0,Ko(s)):e=!1,Vr(s,o),ud(s,y,A),Za(s,y,A,o),sc(null,s,y,!0,e,o);case 19:return Ld(e,s,o);case 22:return yd(e,s,o)}throw Error(i(156,s.tag))};function Qd(e,s){return je(e,s)}function e_(e,s,o,y){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,s,o,y){return new e_(e,s,o,y)}function Cc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function t_(e){if(typeof e=="function")return Cc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===O)return 11;if(e===q)return 14}return 2}function qs(e,s){var o=e.alternate;return o===null?(o=Rn(e.tag,s,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=s,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,s=e.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function Sl(e,s,o,y,A,P){var z=2;if(y=e,typeof e=="function")Cc(e)&&(z=1);else if(typeof e=="string")z=5;else e:switch(e){case M:return mr(o.children,A,P,s);case b:z=8,A|=8;break;case T:return e=Rn(12,o,s,A|2),e.elementType=T,e.lanes=P,e;case F:return e=Rn(13,o,s,A),e.elementType=F,e.lanes=P,e;case U:return e=Rn(19,o,s,A),e.elementType=U,e.lanes=P,e;case Y:return Cl(o,A,P,s);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:z=10;break e;case B:z=9;break e;case O:z=11;break e;case q:z=14;break e;case G:z=16,y=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return s=Rn(z,o,s,A),s.elementType=e,s.type=y,s.lanes=P,s}function mr(e,s,o,y){return e=Rn(7,e,y,s),e.lanes=o,e}function Cl(e,s,o,y){return e=Rn(22,e,y,s),e.elementType=Y,e.lanes=o,e.stateNode={isHidden:!1},e}function xc(e,s,o){return e=Rn(6,e,null,s),e.lanes=o,e}function kc(e,s,o){return s=Rn(4,e.children!==null?e.children:[],e.key,s),s.lanes=o,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}function n_(e,s,o,y,A){this.tag=s,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yr(0),this.expirationTimes=yr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yr(0),this.identifierPrefix=y,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function Ec(e,s,o,y,A,P,z,Q,ee){return e=new n_(e,s,o,Q,ee),s===1?(s=1,P===!0&&(s|=8)):s=0,P=Rn(3,null,null,s),e.current=P,P.stateNode=e,P.memoizedState={element:y,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fa(P),e}function s_(e,s,o){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:y==null?null:""+y,children:e,containerInfo:s,implementation:o}}function Jd(e){if(!e)return Ps;e=e._reactInternals;e:{if(An(e)!==e||e.tag!==1)throw Error(i(170));var s=e;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(fn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(i(171))}if(e.tag===1){var o=e.type;if(fn(o))return Eh(e,o,s)}return s}function Zd(e,s,o,y,A,P,z,Q,ee){return e=Ec(o,y,!0,e,A,P,z,Q,ee),e.context=Jd(null),o=e.current,y=ln(),A=Ws(o),P=_s(y,A),P.callback=s??null,Fs(o,P,A),e.current.lanes=A,Sn(e,A,y),gn(e,y),e}function xl(e,s,o,y){var A=s.current,P=ln(),z=Ws(A);return o=Jd(o),s.context===null?s.context=o:s.pendingContext=o,s=_s(P,z),s.payload={element:e},y=y===void 0?null:y,y!==null&&(s.callback=y),e=Fs(A,s,z),e!==null&&(Wn(e,A,z,P),tl(e,A,z)),z}function kl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ef(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<s?o:s}}function Lc(e,s){ef(e,s),(e=e.alternate)&&ef(e,s)}function r_(){return null}var tf=typeof reportError=="function"?reportError:function(e){console.error(e)};function Tc(e){this._internalRoot=e}El.prototype.render=Tc.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(i(409));xl(e,s,null,null)},El.prototype.unmount=Tc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;dr(function(){xl(null,e,null,null)}),s[fs]=null}};function El(e){this._internalRoot=e}El.prototype.unstable_scheduleHydration=function(e){if(e){var s=bo();e={blockedOn:null,target:e,priority:s};for(var o=0;o<Qn.length&&s!==0&&s<Qn[o].priority;o++);Qn.splice(o,0,e),o===0&&xr(e)}};function Rc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ll(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function nf(){}function i_(e,s,o,y,A){if(A){if(typeof y=="function"){var P=y;y=function(){var ce=kl(z);P.call(ce)}}var z=Zd(s,y,e,0,null,!1,!1,"",nf);return e._reactRootContainer=z,e[fs]=z.current,Ii(e.nodeType===8?e.parentNode:e),dr(),z}for(;A=e.lastChild;)e.removeChild(A);if(typeof y=="function"){var Q=y;y=function(){var ce=kl(ee);Q.call(ce)}}var ee=Ec(e,0,!1,null,null,!1,!1,"",nf);return e._reactRootContainer=ee,e[fs]=ee.current,Ii(e.nodeType===8?e.parentNode:e),dr(function(){xl(s,ee,o,y)}),ee}function Tl(e,s,o,y,A){var P=o._reactRootContainer;if(P){var z=P;if(typeof A=="function"){var Q=A;A=function(){var ee=kl(z);Q.call(ee)}}xl(s,z,e,A)}else z=i_(o,s,e,A,y);return kl(z)}mi=function(e){switch(e.tag){case 3:var s=e.stateNode;if(s.current.memoizedState.isDehydrated){var o=Yn(s.pendingLanes);o!==0&&(pi(s,o|1),gn(s,ft()),(pt&6)===0&&(Qr=ft()+500,Os()))}break;case 13:dr(function(){var y=vs(e,1);if(y!==null){var A=ln();Wn(y,e,1,A)}}),Lc(e,1)}},gi=function(e){if(e.tag===13){var s=vs(e,134217728);if(s!==null){var o=ln();Wn(s,e,134217728,o)}Lc(e,134217728)}},vi=function(e){if(e.tag===13){var s=Ws(e),o=vs(e,s);if(o!==null){var y=ln();Wn(o,e,s,y)}Lc(e,s)}},bo=function(){return Ze},_i=function(e,s){var o=Ze;try{return Ze=e,s()}finally{Ze=o}},Ot=function(e,s,o){switch(s){case"input":if(ne(e,o),s=o.name,o.type==="radio"&&s!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var y=o[s];if(y!==e&&y.form===e.form){var A=qo(y);if(!A)throw Error(i(90));ve(y),ne(y,A)}}}break;case"textarea":Ke(e,o);break;case"select":s=o.value,s!=null&&de(e,!!o.multiple,s,!1)}},rt=yc,_t=dr;var o_={usingClientEntryPoint:!1,Events:[Oi,Br,qo,ut,be,yc]},Qi={findFiberByHostInstance:rr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},l_={bundleType:Qi.bundleType,version:Qi.version,rendererPackageName:Qi.rendererPackageName,rendererConfig:Qi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:L.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ks(e),e===null?null:e.stateNode},findFiberByHostInstance:Qi.findFiberByHostInstance||r_,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 Rl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rl.isDisabled&&Rl.supportsFiber)try{Kn=Rl.inject(l_),nn=Rl}catch{}}return vn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=o_,vn.createPortal=function(e,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Rc(s))throw Error(i(200));return s_(e,s,null,o)},vn.createRoot=function(e,s){if(!Rc(e))throw Error(i(299));var o=!1,y="",A=tf;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(y=s.identifierPrefix),s.onRecoverableError!==void 0&&(A=s.onRecoverableError)),s=Ec(e,1,!1,null,null,o,!1,y,A),e[fs]=s.current,Ii(e.nodeType===8?e.parentNode:e),new Tc(s)},vn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=ks(s),e=e===null?null:e.stateNode,e},vn.flushSync=function(e){return dr(e)},vn.hydrate=function(e,s,o){if(!Ll(s))throw Error(i(200));return Tl(null,e,s,!0,o)},vn.hydrateRoot=function(e,s,o){if(!Rc(e))throw Error(i(405));var y=o!=null&&o.hydratedSources||null,A=!1,P="",z=tf;if(o!=null&&(o.unstable_strictMode===!0&&(A=!0),o.identifierPrefix!==void 0&&(P=o.identifierPrefix),o.onRecoverableError!==void 0&&(z=o.onRecoverableError)),s=Zd(s,null,e,1,o??null,A,!1,P,z),e[fs]=s.current,Ii(e),y)for(e=0;e<y.length;e++)o=y[e],A=o._getVersion,A=A(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,A]:s.mutableSourceEagerHydrationData.push(o,A);return new El(s)},vn.render=function(e,s,o){if(!Ll(s))throw Error(i(200));return Tl(null,e,s,!1,o)},vn.unmountComponentAtNode=function(e){if(!Ll(e))throw Error(i(40));return e._reactRootContainer?(dr(function(){Tl(null,null,e,!1,function(){e._reactRootContainer=null,e[fs]=null})}),!0):!1},vn.unstable_batchedUpdates=yc,vn.unstable_renderSubtreeIntoContainer=function(e,s,o,y){if(!Ll(o))throw Error(i(200));if(e==null||e._reactInternals===void 0)throw Error(i(38));return Tl(e,s,o,!1,y)},vn.version="18.3.1-next-f1338f8080-20240426",vn}var hf;function fm(){if(hf)return Nc.exports;hf=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Nc.exports=v_(),Nc.exports}var df;function __(){if(df)return Ml;df=1;var n=fm();return Ml.createRoot=n.createRoot,Ml.hydrateRoot=n.hydrateRoot,Ml}var w_=__(),N=ju();const y_=h_(N);function Fe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function Ne(n){return typeof n=="string"?n:null}function we(n){return typeof n=="string"&&n.length>0?n:null}function vt(n){return typeof n=="boolean"?n:null}function Ve(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function so(n){if(!Array.isArray(n))return null;const t=[];for(const i of n){if(typeof i!="string")return null;t.push(i)}return t}function Lt(n,t){if(!Array.isArray(n))return null;const i=[];for(const a of n){const p=t(a);if(p===null)return null;i.push(p)}return i}function an(n,t){if(!Array.isArray(n))return null;const i=[];for(const a of n){const p=t(a);p!==null&&i.push(p)}return i}function tt(n,t){return typeof n=="string"&&t.includes(n)?n:null}function b_(n){try{return JSON.parse(n)}catch{return}}const S_=["auto","default","acceptEdits","plan"];function ni(n){return typeof n=="string"&&S_.includes(n)}const C_={agentUnknown:[],answerInterrupted:[],answerInvalid:[],answerNoFreeText:[],answerNotPending:[],answerSendFailed:[],answersUnsupported:[],archiveOpenTab:[],attachmentEmpty:["name"],attachmentExecutable:["name"],attachmentSaveFailed:[],attachmentTooLarge:["max","name","size"],badMessage:[],cliFolderClosed:[],cliMissing:["command","url"],cliNotFound:[],cliNotInstalled:["label"],cliOpenFailed:[],continueFailed:[],continueHistoryMissing:[],continueNoFolder:[],continueNotInHistory:[],continueReadFailed:[],continueSameCli:[],continueTabFailed:[],continueTranscriptFailed:[],conversationNotFollowed:[],cwdMissing:["cwd"],cwdNotDir:["cwd"],diffBinaryUntracked:[],diffNewEmpty:[],diffNoStaged:[],diffNoUnstaged:[],diffReadFailed:[],dirReadFailed:[],dirSearchFailed:[],fileReadFailed:[],fileSaveBlocked:[],fileSaveFailed:[],fileSaveTooLarge:["max"],filesPerMessage:["max"],forceSendFailed:[],forceSendNoCli:[],forceSendNothing:[],forceSendUnsupported:[],forceSendWaiting:[],gitCommandFailed:["command"],gitMissing:[],gitNotFound:[],gitNotRepo:[],gitRunFailed:[],gitStatusUnknown:[],gitUnexpected:["command"],handoffEmpty:[],handoffNoTranscript:[],imageEmpty:[],imageTooLarge:["max","size"],imageTypeUnsupported:["type"],imageUnknownFormat:[],imagesPerMessage:["max"],imagesUnsupported:[],memoryAppeared:["file"],memoryBrokenBlock:["file"],memoryChooseFile:[],memoryGitFailed:["detail"],memoryHardLinks:["file"],memoryLinkOutside:["path"],memoryNotAFile:["label"],memoryNotInstalled:[],memoryNotUtf8:["file"],memoryNoteClaude:[],memoryNoteGone:[],memoryNoteHardLink:["path"],memoryNoteHardLinkCmd:["path"],memoryNoteName:[],memoryNoteOpenCode:[],memorySameFile:["file","other"],memoryViaEncoding:["file"],memoryViaFallback:[],memoryViaFile:["file"],memoryViaNoBlock:["file"],memoryViaNoBlockEither:[],memoryViaNoFolder:[],memoryViaNoIndex:[],memoryViaOutside:["file"],modePendingConfirmation:[],modeUnreachable:["key"],modesUnsupported:[],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],operationFailed:["detail"],pasteImageFailed:[],pathMissing:[],pathNotRelative:[],pathNullByte:[],pathOpenFailed:[],pathOutside:[],pendingSubmitAnswer:["label"],pendingSubmitPermission:["label"],pickerCliFolder:[],pickerClosed:[],pickerCreateFailed:[],pickerFolderExists:[],pickerListFailed:[],pickerNameChars:[],pickerNameInvalid:[],pickerNoProjectsHere:[],pickerNotListed:[],pickerRootMissing:[],pickerTooMany:[],planReadFailed:[],raw:["text"],relaunchCloseFailed:[],remoteDeviceGone:[],remoteFailed:[],remoteHostOnly:[],remoteNotActive:[],remoteOpensOnHost:[],remotePortInvalid:["max","min"],remoteTooManyDevices:["max"],rewindBusy:[],rewindFailed:[],rewindNoCli:[],rewindUnknownMessage:[],rewindUnsupported:[],searchFailed:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],shellNotFound:[],submitInterrupted:[],submitStoppedTool:["label"],submitStoppedToolNoLabel:[],submitStoppedWaiting:["label"],submitStoppedWaitingNoLabel:[],tabClosedWhileOpening:[],tabDirGone:[],tabOpenFailed:[],terminalAsleep:[],terminalGone:[],terminalOpenFailed:[],tooManyTabs:["max"],vaultBusyMeasuring:[],vaultBusyMoving:[],vaultBusyWriting:[],vaultCannotWrite:[],vaultCurrentInsideTarget:[],vaultDiskFull:["detail"],vaultFailed:[],vaultIndexNotReady:[],vaultMeasureFirst:[],vaultMemoryFailed:["cwd","detail"],vaultMoveFailed:["detail"],vaultMoving:[],vaultNoCopyYet:[],vaultNotLoaded:[],vaultProjectGone:[],vaultReasonNewerFormat:[],vaultReasonOriginMissing:[],vaultReasonUnsafeId:[],vaultSessionFailed:["agent","detail","session"],vaultSessionMissing:[],vaultTargetCliFolder:[],vaultTargetInsideCurrent:[],vaultTargetNotAbsolute:[],waitingSubmit:["label"]};function x_(n){return Object.prototype.hasOwnProperty.call(C_,n)}function ls(n,t=0){const i=Fe(n);if(i===null)return null;const a=Ne(i.key);if(a===null||a.length===0)return null;const p=i.params;if(p===void 0)return{key:a};const k=Fe(p);if(k===null)return null;const C={};for(const[r,u]of Object.entries(k)){if(typeof u=="string"||typeof u=="number"&&Number.isFinite(u)){C[r]=u;continue}const v=t===0?ls(u,t+1):null;if(v===null)return null;C[r]=v}return{key:a,params:C}}function k_(n){if(!Array.isArray(n))return null;const t=[];for(const i of n){const a=ls(i);if(a===null)return null;t.push(a)}return t}const si=["claude-code","codex","opencode","antigravity","pi"],E_=["gemini-cli","antigravity-ide"],Yl=[...si,...E_],L_={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function li(n){return si.includes(n)}const T_=["at-quoted","bare-path-paste","quoted-path-line"],R_=["at"],M_=["usage-with-variants","token-count","usage-with-catalog","status-line"],A_=["child-session-marker"],N_=["active","missing","other-command","disabled","unreadable"];function pm(n,t=null){return!n.statusSource||t==="unknown"}const mm={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1,forceSend:!1};function Pu(n){return n.filter(t=>t.available).length>1}function D_(n){const t=Fe(n);if(t===null)return null;const i=t.modes;if(!Array.isArray(i)||i.length===0)return null;const a=[];for(const C of i){if(!ni(C))return null;a.push(C)}const p=t.launchMode;if(!ni(p)||!a.includes(p))return null;const k=we(t.keyLabel);return k===null?null:{modes:a,launchMode:p,keyLabel:k,approvesPendingOnCycle:t.approvesPendingOnCycle===!0}}function I_(n){const t=Fe(n);if(t===null)return null;const i=tt(t.state,N_),a=we(t.settingsPath),p=we(t.scriptPath),k=t.fragment,C=k===null?null:we(k);return i===null||a===null||p===null||k!==null&&C===null?null:{state:i,settingsPath:a,scriptPath:p,fragment:C}}function j_(n){const t=Fe(n);if(t===null)return null;const i=we(t.value),a=Ne(t.label),p=Ne(t.family),k=vt(t.long),C=t.window,r=C===null?null:Ve(C);return i===null||a===null||p===null||k===null||C!==null&&r===null?null:{value:i,label:a,family:p,long:k,window:r}}function P_(n){const t=Fe(n);if(t===null)return null;const i=we(t.value),a=Ne(t.label);return i===null||a===null?null:{value:i,label:a}}function ff(n,t){const i=Lt(n,t);return i===null||i.length===0?null:i}function O_(n){const t=Fe(n);return t===null?{...mm}:{sessionIdAtLaunch:t.sessionIdAtLaunch===!0,resume:t.resume===!0,statusSource:t.statusSource===!0,readySignal:t.readySignal===!0,permissionCycle:D_(t.permissionCycle),models:ff(t.models,j_),efforts:ff(t.efforts,P_),questionCards:t.questionCards===!0,imagesByPath:tt(t.imagesByPath,T_),fileMentions:tt(t.fileMentions,R_),rewind:t.rewind===!0,contextWindowSource:tt(t.contextWindowSource,M_),plans:t.plans===!0,waitingBlocksSubmit:t.waitingBlocksSubmit===!0,forceSend:t.forceSend===!0}}function pf(n){const t=Fe(n);if(t===null)return null;const i=tt(t.id,si),a=Ne(t.label),p=Ne(t.command),k=Ne(t.installUrl);return i===null||a===null||p===null||k===null?null:{id:i,label:a,command:p,available:t.available===!0,version:Ne(t.version),installUrl:k,missingMessage:ls(t.missingMessage),capabilities:O_(t.capabilities),environmentNotice:tt(t.environmentNotice,A_),statusLine:I_(t.statusLine)}}const B_=["custom","ai","first-message","none"],F_=["native","vault"],H_=["idle","scanning","ready"],$_=["agent","shell"],U_=["busy","idle","waiting","offline","unknown"],W_=["server-closed"];function z_(n){const t=Fe(n);if(t===null)return null;const i=we(t.sessionId),a=Ne(t.title),p=tt(t.titleSource,B_),k=Ve(t.updatedAt),C=Ve(t.sizeBytes);if(i===null||a===null||p===null||k===null||C===null)return null;const r=t.agent===void 0?"claude-code":tt(t.agent,Yl);if(r===null)return null;const u=Ne(t.cwd)??"";return{agent:r,sessionId:i,cwd:u,title:a,titleSource:p,updatedAt:k,sizeBytes:C,archived:t.archived===!0,storage:tt(t.storage,F_)??"native",partial:t.partial===!0}}function q_(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.cwd),a=vt(t.cwdExists),p=an(t.sessions,z_),k=Ve(t.lastActivityAt);if(i===null||a===null||p===null||k===null)return null;const C=we(t.key);if(C!==null)return{key:C,fallbackName:Ne(t.fallbackName)??"",cwd:i,cwdExists:a,sessions:p,lastActivityAt:k};const r=we(t.slug);return r===null?null:{key:r,fallbackName:i.length===0?r:"",cwd:i,cwdExists:a,sessions:p,lastActivityAt:k}}function V_(n){const t=Fe(n);if(t===null)return null;const i=tt(t.state,H_),a=Ve(t.scannedFiles),p=Ve(t.totalFiles);return i===null||a===null||p===null?null:{state:i,scannedFiles:a,totalFiles:p}}function mf(n){const t=Fe(n);if(t===null)return null;const i=we(t.terminalId),a=tt(t.kind,$_)??"agent";let p=null;if(a==="agent"&&(p=t.agent===void 0?"claude-code":tt(t.agent,si),p===null))return null;const k=Ne(t.cwd),C=Ne(t.sessionId),r=Ne(t.label),u=vt(t.resumed),v=Ve(t.createdAt),_=vt(t.alive);if(i===null||k===null||C===null||r===null||u===null||v===null||_===null)return null;const h=t.exitCode;return{terminalId:i,kind:a,agent:p,cwd:k,sessionId:C,label:r,resumed:u,createdAt:v,alive:_,exitCode:typeof h=="number"?h:null,sleeping:t.sleeping===!0,launchedAt:Ve(t.launchedAt)}}const gm=["user","assistant"],vm=["content","attachment","pasted"],K_=["compacted","interrupted","error"],G_=["cli-plans","project","scratch"],Y_=120,X_=20,Q_=20,gf=4e3,jc={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},vf=["waiting","live","unavailable","no-transcript"];function J_(n){const t=Fe(n);if(t===null)return null;const i=Ve(t.inputTokens),a=Ve(t.outputTokens),p=Ve(t.cacheCreationInputTokens),k=Ve(t.cacheReadInputTokens);return i===null||a===null||p===null||k===null?null:{inputTokens:i,outputTokens:a,cacheCreationInputTokens:p,cacheReadInputTokens:k}}function Z_(n){const t=Fe(n);if(t===null)return null;const i=we(t.label);return i===null?null:{label:i,description:Ne(t.description)??""}}function e0(n){const t=Fe(n);if(t===null)return null;const i=we(t.question),a=Lt(t.options,Z_);return i===null||a===null||a.length===0?null:{question:i,header:Ne(t.header)??"",multiSelect:t.multiSelect===!0,options:a}}function _m(n){const t=Fe(n);if(t===null)return null;switch(t.kind){case"text":{const i=Ne(t.text),a=vt(t.truncated);return i===null||a===null?null:{kind:"text",text:i,truncated:a}}case"tool-call":{const i=Ne(t.toolUseId),a=Ne(t.name),p=Ne(t.input),k=vt(t.truncated);return i===null||a===null||p===null||k===null?null:{kind:"tool-call",toolUseId:i,name:a,input:p,truncated:k}}case"tool-result":{const i=Ne(t.toolUseId),a=Ne(t.text),p=vt(t.isError),k=vt(t.truncated),C=Ve(t.imageCount);return i===null||a===null||p===null||k===null||C===null?null:{kind:"tool-result",toolUseId:i,text:a,isError:p,truncated:k,imageCount:C}}case"thinking":return{kind:"thinking"};case"question":{const i=we(t.toolUseId),a=Lt(t.questions,e0);return i===null||a===null||a.length===0?null:{kind:"question",toolUseId:i,questions:a}}case"image":{const i=Ve(t.index),a=Ne(t.mediaType);if(i===null||a===null)return null;const p=tt(t.source,vm)??"content";return{kind:"image",index:i,mediaType:a,source:p}}case"notice":{const i=tt(t.notice,K_);return i===null?null:{kind:"notice",notice:i,detail:Ne(t.detail)??""}}default:return null}}function Pc(n){const t=Fe(n);if(t===null)return null;const i=we(t.eventId),a=tt(t.role,gm),p=Ve(t.at),k=Lt(t.parts,_m);return i===null||a===null||p===null||k===null?null:{eventId:i,role:a,at:p,parts:k,model:Ne(t.model),usage:J_(t.usage),effort:Ne(t.effort),durationMs:Ve(t.durationMs),queued:t.queued===!0}}function t0(n){const t=Fe(n);if(t===null)return null;const i=we(t.toolUseId),a=Ne(t.description),p=Ve(t.startedAt);return i===null||a===null||p===null?null:{toolUseId:i,description:a.slice(0,Y_),background:t.background===!0,startedAt:p}}function n0(n){const t=Fe(n);if(t===null)return null;const i=we(t.id),a=Ne(t.text),p=Ve(t.images),k=Ve(t.at);if(i===null||a===null||p===null||k===null)return null;const C={id:i,text:a.slice(0,gf),truncated:t.truncated===!0||a.length>gf,images:Math.max(0,Math.floor(p)),at:k},r=we(t.eventId);return r!==null&&(C.eventId=r),t.forced===!0&&(C.forced=!0),C}function _f(n){const t=Fe(n);if(t===null)return null;const i=Ve(t.lastRequestTokens),a=Ve(t.lastOutputTokens),p=Ve(t.totalInputTokens),k=Ve(t.totalOutputTokens),C=Ve(t.totalCacheReadTokens),r=Ve(t.assistantMessages);if(i===null||a===null||p===null||k===null||C===null||r===null)return null;const u=Ne(t.lastEffort);return{lastRequestTokens:i,lastOutputTokens:a,lastModel:Ne(t.lastModel),contextWindow:Ve(t.contextWindow),contextWindowEstimated:t.contextWindowEstimated===!0,totalInputTokens:p,totalOutputTokens:k,totalCacheReadTokens:C,assistantMessages:r,...u!==null?{lastEffort:u}:{}}}function s0(n){const t=Fe(n);if(t===null)return null;const i=we(t.fileName),a=we(t.title),p=Ve(t.modifiedAt),k=Ve(t.sizeBytes);if(i===null||a===null||p===null||k===null)return null;const C=t.origin,r=G_.find(v=>v===C)??"cli-plans",u=Ne(t.path)??"";return{fileName:i,title:a,origin:r,path:u,absolutePath:Ne(t.absolutePath)??"",exists:t.exists===!0,modifiedAt:p,sizeBytes:k}}function r0(n){const t=Fe(n);if(t===null)return null;const i=we(t.fileName),a=Ne(t.text);return i===null||a===null?null:{fileName:i,text:a,truncated:t.truncated===!0}}const wm=[{value:"default",label:"Por defecto",family:"",long:!1,window:null},{value:"opus",label:"Opus",family:"opus",long:!1,window:2e5},{value:"opus[1m]",label:"Opus",family:"opus",long:!0,window:1e6},{value:"sonnet",label:"Sonnet",family:"sonnet",long:!1,window:2e5},{value:"sonnet[1m]",label:"Sonnet",family:"sonnet",long:!0,window:1e6},{value:"haiku",label:"Haiku",family:"haiku",long:!1,window:2e5},{value:"fable",label:"Fable",family:"fable",long:!1,window:2e5},{value:"fable[1m]",label:"Fable",family:"fable",long:!0,window:1e6}];function i0(n){if(n.window===null)return n.label;const t=n.window>=1e6?`${Math.round(n.window/1e6)}M`:`${Math.round(n.window/1e3)}k`;return`${n.label} · ${t}`}function o0(n,t=wm){const i=l0(n,t);if(i===null||n===null)return null;const a=n.includes("[1m]");return t.find(p=>p.family===i&&p.long===a)??null}function l0(n,t=wm){var a;return n===null||n.length===0?null:((a=t.filter(p=>p.family.length>0).sort((p,k)=>k.family.length-p.family.length).find(p=>n.includes(p.family)))==null?void 0:a.family)??null}function a0(n){return`/model ${n}`}const Ou="/effort";function c0(n,t=Ou){return`${t} ${n}`}const u0=["staged","unstaged","untracked","conflict"],h0=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],d0=["ready","not-a-repo","git-missing","error"],Oc={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},f0=["meta","hunk","context","added","removed"];function p0(n){const t=Fe(n);if(t===null)return null;const i=we(t.path),a=tt(t.kind,h0),p=tt(t.stage,u0);return i===null||a===null||p===null?null:{path:i,kind:a,stage:p,oldPath:Ne(t.oldPath)}}function m0(n){const t=Fe(n);if(t===null)return null;const i=we(t.path);return i===null?null:{path:i,branch:Ne(t.branch),isCurrent:t.isCurrent===!0}}function g0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.state,d0),a=Ne(t.repoRoot),p=Ve(t.ahead),k=Ve(t.behind),C=Lt(t.changes,p0),r=Lt(t.worktrees,m0),u=Ve(t.updatedAt);return i===null||a===null||p===null||k===null||C===null||r===null||u===null?null:{state:i,message:ls(t.message),repoRoot:a,branch:Ne(t.branch),head:Ne(t.head),upstream:Ne(t.upstream),ahead:p,behind:k,changes:C,worktrees:r,truncated:t.truncated===!0,updatedAt:u}}function v0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.kind,f0),a=Ne(t.text);return i===null||a===null?null:{kind:i,text:a,oldLine:Ve(t.oldLine),newLine:Ve(t.newLine)}}function _0(n){const t=Fe(n);if(t===null)return null;const i=we(t.path),a=vt(t.staged),p=Lt(t.lines,v0);return i===null||a===null||p===null?null:{path:i,staged:a,lines:p,truncated:t.truncated===!0,binary:t.binary===!0,message:ls(t.message)}}const w0=["dir","file"],y0=["ignored","always"];function b0(n){return typeof n=="string"&&/^[0-9a-f]{64}$/.test(n)}function ym(n){const t=Fe(n);if(t===null)return null;const i=we(t.name),a=we(t.path),p=tt(t.kind,w0),k=Ve(t.sizeBytes),C=Ve(t.modifiedAt);if(i===null||a===null||p===null||k===null||C===null)return null;const r=tt(t.hidden,y0),u={name:i,path:a,kind:p,sizeBytes:k,modifiedAt:C};return r===null?u:{...u,hidden:r}}function S0(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.query),a=Lt(t.entries,ym);return i===null||a===null?null:{query:i,entries:a,truncated:t.truncated===!0}}function C0(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.path),a=Lt(t.entries,ym),p=Ve(t.hiddenCount);return i===null||a===null||p===null?null:{path:i,entries:a,truncated:t.truncated===!0,hiddenCount:p}}function wf(n){const t=Fe(n);if(t===null)return null;const i=we(t.path),a=Ne(t.text),p=Ve(t.sizeBytes),k=vt(t.binary);if(i===null||a===null||p===null||k===null)return null;const C={path:i,language:Ne(t.language),text:a,sizeBytes:p,truncated:t.truncated===!0,binary:k},r=t.hash;return t.editable===!0&&b0(r)?{...C,editable:!0,hash:r}:C}function x0(n){const t=Fe(n);if(t===null)return null;const i=we(t.pickerId),a=we(t.path),p=Lt(t.entries,C=>we(C)),k=Lt(t.roots,C=>we(C));return i===null||a===null||p===null||k===null?null:{pickerId:i,path:a,entries:p,roots:k,canGoUp:t.canGoUp===!0,truncated:t.truncated===!0}}const bm=1e6,k0=100,E0=999999;function Sm(n){return n.pasted.reduce((t,i)=>t+i.text.length,n.text.length)}function Fl(n){return n.text.trim().length===0&&n.pasted.every(t=>t.text.trim().length===0)}function Cm(n,t){return n.text!==t.text||n.pasted.length!==t.pasted.length?!1:n.pasted.every((i,a)=>{const p=t.pasted[a];return p!==void 0&&p.number===i.number&&p.text===i.text})}function L0(n){const t=Fe(n);if(t===null)return null;const i=t.number,a=Ne(t.text);return typeof i!="number"||!Number.isInteger(i)||i<1||i>E0||a===null?null:{number:i,text:a}}function T0(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.text),a=Lt(t.pasted,L0);return i===null||a===null||a.length>k0||new Set(a.map(p=>p.number)).size!==a.length?null:{text:i,pasted:a}}const Hl="MEMORY.md",Bu=["AGENTS.md","CLAUDE.md"],xm=["claude-code","codex","antigravity","opencode","pi"],R0=["outside","encoding"],M0=["create","append-block","replace-block","append-lines","copy"];function A0(n){return{instructionFiles:[...Bu],gitMode:n!==null&&n.git.kind==="error"?"version":"ignore",importNative:n!==null&&n.native.pending>0,copyFromMainWorktree:n!==null&&n.git.kind==="repo"&&n.git.worktree!==null&&n.git.worktree.mainHasMemory}}function N0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.name,Bu),a=vt(t.exists),p=vt(t.hasBlock),k=vt(t.blockCurrent),C=vt(t.brokenBlock),r=t.problem,u=r===null?null:tt(r,R0);return i===null||a===null||p===null||k===null||C===null||r!==null&&u===null?null:{name:i,exists:a,hasBlock:p,blockCurrent:k,brokenBlock:C,problem:u}}function D0(n){const t=Fe(n);if(t===null)return null;switch(t.kind){case"not-repo":return{kind:"not-repo"};case"error":{const i=ls(t.message);return i===null?null:{kind:"error",message:i}}case"repo":{const i=vt(t.ignored);if(i===null)return null;if(t.worktree===null)return{kind:"repo",ignored:i,worktree:null};const a=Fe(t.worktree);if(a===null)return null;const p=we(a.mainPath),k=vt(a.mainHasMemory);return p===null||k===null?null:{kind:"repo",ignored:i,worktree:{mainPath:p,mainHasMemory:k}}}default:return null}}function I0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.agent,xm),a=we(t.label),p=vt(t.reaches),k=ls(t.via);return i===null||a===null||p===null||k===null?null:{agent:i,label:a,reaches:p,via:k}}function j0(n){const t=Fe(n);if(t===null)return null;const i=we(t.name),a=Ne(t.title),p=Ne(t.description),k=Ve(t.sizeBytes),C=Ve(t.modifiedAt);return i===null||a===null||p===null||k===null||C===null?null:{name:i,title:a,description:p,sizeBytes:k,modifiedAt:C}}const P0=["line","command","json"];function O0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.agent,xm),a=we(t.label),p=we(t.target),k=tt(t.kind,P0),C=we(t.text),r=ls(t.note);return i===null||a===null||p===null||k===null||C===null||r===null?null:{agent:i,label:a,target:p,kind:k,text:C,note:r}}function B0(n){const t=Fe(n);if(t===null)return null;const i=we(t.cwd),a=vt(t.folderExists),p=vt(t.indexExists),k=vt(t.installed),C=Lt(t.notes,j0),r=Lt(t.files,N0),u=D0(t.git),v=Lt(t.reach,I0),_=Fe(t.native),h=_===null?null:Ve(_.available),w=_===null?null:Ve(_.pending),E=Lt(t.globalFragments,O0);return i===null||a===null||p===null||k===null||C===null||r===null||u===null||v===null||h===null||w===null||E===null?null:{cwd:i,folderExists:a,indexExists:p,installed:k,notes:C,files:r,git:u,reach:v,native:{available:h,pending:w},globalFragments:E}}function yf(n){const t=Fe(n);if(t===null)return null;const i=we(t.file),a=tt(t.action,M0),p=Ne(t.preview),k=Ne(t.copiedFrom);return i===null||a===null||p===null?null:{file:i,action:a,preview:p,copiedFrom:k}}function F0(n){const t=Fe(n);if(t===null)return null;const i=we(t.name),a=Ne(t.text),p=vt(t.truncated);return i===null||a===null||p===null?null:{name:i,text:a,truncated:p}}const bf=20;function H0(n,t="Nota"){const i=n.text.split(`
|
|
41
|
+
`).map(a=>a.trim()).find(a=>a.length>0);return i===void 0?n.images.length>0?"Imagen":t:i.length>40?`${i.slice(0,40)}…`:i}function $0(n){const t=Fe(n);if(t===null)return null;const i=we(t.imageId),a=we(t.mediaType),p=Ve(t.bytes);return i===null||a===null||p===null?null:{imageId:i,mediaType:a,bytes:p}}function U0(n){const t=Fe(n);if(t===null)return null;const i=we(t.noteId),a=Ne(t.text),p=Lt(t.images,$0),k=Ve(t.createdAt),C=Ve(t.updatedAt);return i===null||a===null||p===null?null:{noteId:i,text:a,images:p,createdAt:k??0,updatedAt:C??0}}const km=3,W0=3e4,z0=["results","time"];function ri(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function ro(n,t){if(n==null)return null;const i=t(n);return i===null?void 0:i}function Em(n){const t=Fe(n);if(t===null)return null;const i=tt(t.agent,Yl),a=we(t.sessionId),p=ro(t.cwd,Ne),k=Ne(t.title),C=ro(t.eventId,we),r=ro(t.role,w=>tt(w,gm)),u=ro(t.at,Ve),v=Ne(t.snippet),_=ri(t.matchStart),h=ri(t.matchLength);return i===null||a===null||p===void 0||k===null||C===void 0||r===void 0||u===void 0||v===null||_===null||h===null||_+h>v.length?null:{agent:i,sessionId:a,cwd:p,title:k,eventId:C,role:r,at:u,snippet:v,matchStart:_,matchLength:h}}function q0(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.query),a=an(t.hits,Em),p=ri(t.sessionsScanned),k=ri(t.sessionsTotal),C=ro(t.truncated,r=>tt(r,z0));return i===null||a===null||p===null||k===null||p>k||C===void 0?null:{query:i,hits:a,sessionsScanned:p,sessionsTotal:k,truncated:C}}function V0(n){const t=Fe(n);if(t===null)return null;const i=Ne(t.query),a=an(t.hits,Em),p=ri(t.sessionsScanned),k=ri(t.sessionsTotal);return i===null||a===null||p===null||k===null||p>k?null:{query:i,hits:a,sessionsScanned:p,sessionsTotal:k}}const K0=["off","idle","measuring","writing","moving"];function tn(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Zi(n,t){if(n==null)return null;const i=t(n);return i===null?void 0:i}function G0(n){const t=Fe(n);if(t===null)return null;const i=tt(t.agent,Yl),a=tn(t.sessions),p=tn(t.eventBytes),k=tn(t.images),C=tn(t.imageBytes),r=tn(t.skippedArchived),u=tn(t.skippedEmpty),v=tn(t.unsupported),_=tn(t.failed),h=k_(t.failureReasons);return i===null||a===null||p===null||k===null||C===null||r===null||u===null||v===null||_===null||h===null?null:{agent:i,sessions:a,eventBytes:p,images:k,imageBytes:C,skippedArchived:r,skippedEmpty:u,unsupported:v,failed:_,failureReasons:h}}function Y0(n){const t=Fe(n);if(t===null)return null;const i=Ve(t.measuredAt),a=Ve(t.durationMs),p=an(t.byAgent,G0),k=tn(t.memoryProjects),C=tn(t.memoryBytes);return i===null||a===null||p===null||k===null||C===null?null:{measuredAt:i,durationMs:a,byAgent:p,memoryProjects:k,memoryBytes:C}}function X0(n){const t=Fe(n);if(t===null)return null;const i=tn(t.done),a=tn(t.total);return i===null||a===null?null:{done:i,total:a}}function Q0(n){const t=Fe(n);if(t===null)return null;const i=vt(t.enabled),a=Ne(t.dir),p=vt(t.isDefaultDir),k=tt(t.state,K0),C=tn(t.sessions),r=tn(t.passSessions),u=tn(t.bytes),v=tn(t.pending),_=Zi(t.progress,X0),h=Zi(t.lastPassAt,Ve),w=Zi(t.measurement,Y0),E=Zi(t.previousDir,Ne),R=Zi(t.lastError,ls);return i===null||a===null||p===null||k===null||C===null||r===null||u===null||v===null||_===void 0||h===void 0||w===void 0||E===void 0||R===void 0?null:{enabled:i,dir:a,isDefaultDir:p,state:k,progress:_,sessions:C,passSessions:r,bytes:u,lastPassAt:h,pending:v,measurement:w,previousDir:E,lastError:R}}const Lm=1024,Tm=65535,J0="pair",Z0=4001;function ew(n){return typeof n=="number"&&Number.isInteger(n)&&n>=Lm&&n<=Tm}const tw=["off","active","restart-needed","port-busy"];function nw(n){const t=Fe(n);if(t===null)return null;const i=we(t.id),a=Ne(t.label),p=Ve(t.createdAt),k=vt(t.connected);if(i===null||a===null||p===null||k===null)return null;const C=t.lastSeenAt,r=C==null?null:Ve(C);return C!=null&&r===null?null:{id:i,label:a,createdAt:p,lastSeenAt:r,connected:k}}function sw(n){const t=Fe(n);if(t===null)return null;const i=vt(t.enabled),a=Ve(t.port),p=tt(t.state,tw),k=Ve(t.listeningPort),C=Ne(t.sshUser),r=so(t.hostNames),u=vt(t.pairingActive),v=Lt(t.devices,nw);return i===null||a===null||p===null||k===null||C===null||r===null||u===null||v===null?null:{enabled:i,port:a,state:p,listeningPort:k,sshUser:C,hostNames:r,pairingActive:u,devices:v}}function rw(n){const t=Fe(n);if(t===null)return null;const i=we(t.code),a=Ve(t.expiresAt);return i===null||a===null?null:{code:i,expiresAt:a}}const iw=["powershell-admin","powershell","terminal"];function ow(n){const t=Fe(n);if(t===null)return null;const i=we(t.payload),a=we(t.authorizeCommand),p=tt(t.shell,iw),k=we(t.code),C=Ve(t.expiresAt);return i===null||a===null||p===null||k===null||C===null?null:{payload:i,authorizeCommand:a,shell:p,code:k,expiresAt:C}}const lw=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function Rm(n){return tt(n,lw)}function aw(n){const t=Fe(n);if(t===null)return null;const i=Rm(t.id),a=we(t.label);return i===null||i==="auto"||a===null?null:{id:i,label:a}}function Sf(n){return Array.isArray(n)?[...new Set(n.filter(t=>typeof t=="string"&&li(t)))]:null}function cw(n){const t=Fe(n);if(t===null)return null;const i=Rm(t.consoleShell),a=an(t.consoleShells,aw),p=t.shellName,k=p===null?null:we(p),C=Sf(t.disabledAgents),r=Sf(t.disabledAtStart);return i===null||a===null||C===null||r===null||p!==null&&k===null?null:{consoleShell:i,consoleShells:a,shellName:k,disabledAgents:C,disabledAtStart:r}}const ei=8,uw="/ws",fu="token",$l=12*1024*1024,Bc=8,Cf=10*1024*1024,Fc=4,xf=100,hw=512,dw=["saved","changed"],fw=["sending","prefilled"],pw=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound"],mw=["cli-not-found","shell-not-found","spawn-failed","bad-message","unknown-terminal","terminal-asleep","invalid-cwd","too-many-terminals","invalid-path","read-failed","submit-failed","answer-failed","mode-failed","archive-failed","notes-failed","picker-failed","memory-failed","vault-failed","continue-failed","search-failed","remote-failed","settings-failed","rewind-failed","force-send-failed","write-failed","remote-refused","agent-unsupported","internal"];function gw(n){const t={model:null,effort:null,contextWindow:null};if(typeof n!="object"||n===null)return t;const i=n;return{model:we(i.model),effort:we(i.effort),contextWindow:Ve(i.contextWindow)}}function vw(n){const t=Fe(n);if(t===null)return null;const i=we(t.terminalId),a=T0(t.draft);return i===null||a===null?null:{terminalId:i,draft:a}}function kf(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Al(n,t){const i=we(t.requestId);return i!==null&&(n.requestId=i),n}function Ef(n){var t;return((t=an(n,t0))==null?void 0:t.slice(0,X_))??null}function Hc(n){var t;return((t=an(n,n0))==null?void 0:t.slice(0,Q_))??null}function _w(n){const t=Fe(b_(n));if(t===null)return null;switch(t.type){case"hello":{const i=Ve(t.protocolVersion),a=Ne(t.platform),p=Ne(t.defaultCwd);return i===null||a===null||p===null?null:{type:"hello",protocolVersion:i,agents:an(t.agents,pf)??[],defaultAgent:tt(t.defaultAgent,si),platform:a,defaultCwd:p,shellName:we(t.shellName),remoteClient:t.remoteClient===!0,fileCheck:t.fileCheck===!0,fileWrite:t.fileWrite===!0}}case"agents":{const i=an(t.agents,pf);return i===null?null:{type:"agents",agents:i,defaultAgent:tt(t.defaultAgent,si)}}case"terminal.list":{const i=an(t.terminals,mf),a=so(t.order);return i===null||a===null?null:{type:"terminal.list",terminals:i,order:a}}case"terminal.opened":{const i=we(t.requestId),a=mf(t.terminal);return i===null||a===null?null:{type:"terminal.opened",requestId:i,terminal:a}}case"terminal.output":{const i=we(t.terminalId),a=Ne(t.data);return i===null||a===null?null:{type:"terminal.output",terminalId:i,data:a}}case"terminal.replay":{const i=we(t.terminalId),a=Ne(t.data);return i===null||a===null?null:{type:"terminal.replay",terminalId:i,data:a,truncated:t.truncated===!0}}case"terminal.exit":{const i=we(t.terminalId),a=Ve(t.exitCode);if(i===null||a===null)return null;const p=t.signal;return{type:"terminal.exit",terminalId:i,exitCode:a,signal:typeof p=="number"?p:null}}case"terminal.closed":{const i=we(t.terminalId);return i===null?null:{type:"terminal.closed",terminalId:i}}case"terminal.activity":{const i=we(t.terminalId),a=tt(t.activity,U_);if(i===null||a===null)return null;const p=a==="offline"?tt(t.offlineReason,W_):null;return p===null?{type:"terminal.activity",terminalId:i,activity:a}:{type:"terminal.activity",terminalId:i,activity:a,offlineReason:p}}case"index.status":{const i=V_(t.status);return i===null?null:{type:"index.status",status:i}}case"index.projects":{const i=an(t.projects,q_);return i===null?null:{type:"index.projects",projects:i,replace:t.replace===!0}}case"conversation.reset":{const i=we(t.terminalId),a=Ne(t.sessionId),p=tt(t.state,vf),k=an(t.events,Pc),C=_f(t.usage);return i===null||a===null||p===null||k===null||C===null?null:{type:"conversation.reset",terminalId:i,sessionId:a,state:p,events:k,hasMore:t.hasMore===!0,usage:C,permissionMode:ni(t.permissionMode)?t.permissionMode:null,defaults:gw(t.defaults),waitingFor:we(t.waitingFor),openToolCall:t.openToolCall===!0,subagents:Ef(t.subagents)??[],queue:Hc(t.queue)??[]}}case"conversation.subagents":{const i=we(t.terminalId),a=Ef(t.subagents);return i===null||a===null?null:{type:"conversation.subagents",terminalId:i,subagents:a}}case"conversation.queue":{const i=we(t.terminalId),a=Hc(t.queue);return i===null||a===null?null:{type:"conversation.queue",terminalId:i,queue:a}}case"agent.forceSent":{const i=we(t.terminalId),a=we(t.requestId),p=vt(t.sent);return i===null||a===null||p===null?null:{type:"agent.forceSent",terminalId:i,requestId:a,sent:p}}case"agent.submitted":{const i=we(t.terminalId),a=we(t.requestId),p=vt(t.delivered);return i===null||a===null||p===null?null:{type:"agent.submitted",terminalId:i,requestId:a,delivered:p}}case"agent.rewound":{const i=we(t.terminalId),a=we(t.requestId),p=vt(t.codeRestored);return i===null||a===null||p===null?null:{type:"agent.rewound",terminalId:i,requestId:a,codeRestored:p}}case"conversation.append":{const i=we(t.terminalId),a=an(t.events,Pc),p=_f(t.usage);if(i===null||a===null||p===null)return null;const k={type:"conversation.append",terminalId:i,events:a,usage:p,permissionMode:ni(t.permissionMode)?t.permissionMode:null},C=Hc(t.queue);return C!==null&&(k.queue=C),k}case"conversation.mode":{const i=we(t.terminalId),a=t.mode;return i===null||!ni(a)?null:{type:"conversation.mode",terminalId:i,mode:a}}case"conversation.waiting":{const i=we(t.terminalId);return i===null?null:{type:"conversation.waiting",terminalId:i,waitingFor:we(t.waitingFor)}}case"conversation.toolCall":{const i=we(t.terminalId),a=vt(t.open);return i===null||a===null?null:{type:"conversation.toolCall",terminalId:i,open:a}}case"conversation.page":{const i=we(t.terminalId),a=an(t.events,Pc);return i===null||a===null?null:{type:"conversation.page",terminalId:i,events:a,hasMore:t.hasMore===!0}}case"conversation.turns":{const i=we(t.terminalId),a=Lt(t.turns,p=>{const k=Fe(p);if(k===null)return null;const C=we(k.eventId),r=Ve(k.durationMs);return C===null||r===null?null:{eventId:C,durationMs:r}});return i===null||a===null?null:{type:"conversation.turns",terminalId:i,turns:a}}case"conversation.parts":{const i=we(t.terminalId),a=Lt(t.updates,p=>{const k=Fe(p);if(k===null)return null;const C=we(k.eventId),r=Lt(k.parts,_m);return C===null||r===null?null:{eventId:C,parts:r}});return i===null||a===null?null:{type:"conversation.parts",terminalId:i,updates:a}}case"conversation.imageData":{const i=we(t.terminalId),a=we(t.eventId),p=Ve(t.index),k=Ne(t.mediaType);if(i===null||a===null||p===null||k===null)return null;const C=t.data;return{type:"conversation.imageData",terminalId:i,eventId:a,index:p,source:tt(t.source,vm)??"content",mediaType:k,data:typeof C=="string"?C:null}}case"conversation.state":{const i=we(t.terminalId),a=tt(t.state,vf);return i===null||a===null?null:{type:"conversation.state",terminalId:i,state:a}}case"git.status":{const i=we(t.terminalId),a=g0(t.status);return i===null||a===null?null:{type:"git.status",terminalId:i,status:a}}case"git.diff":{const i=we(t.terminalId),a=_0(t.diff);return i===null||a===null?null:{type:"git.diff",terminalId:i,diff:a}}case"files.listing":{const i=we(t.terminalId),a=C0(t.listing);return i===null||a===null?null:{type:"files.listing",terminalId:i,listing:a}}case"picker.listing":{const i=x0(t.listing);return i===null?null:{type:"picker.listing",listing:i}}case"files.preview":{const i=we(t.terminalId),a=wf(t.preview);return i===null||a===null?null:{type:"files.preview",terminalId:i,preview:a}}case"files.checked":{const i=we(t.terminalId),a=we(t.requestId),p=so(t.existing);return i===null||a===null||p===null?null:{type:"files.checked",terminalId:i,requestId:a,existing:p}}case"files.saved":{const i=we(t.terminalId),a=we(t.requestId),p=we(t.path),k=tt(t.outcome,dw),C=t.preview===null?null:wf(t.preview);return i===null||a===null||p===null||k===null||C===null&&(k==="saved"||t.preview!==null)?null:{type:"files.saved",terminalId:i,requestId:a,path:p,outcome:k,preview:C}}case"conversation.plans":{const i=we(t.terminalId),a=Lt(t.plans,s0);return i===null||a===null?null:{type:"conversation.plans",terminalId:i,plans:a}}case"plans.content":{const i=we(t.terminalId),a=r0(t.plan);return i===null||a===null?null:{type:"plans.content",terminalId:i,plan:a}}case"files.results":{const i=we(t.terminalId),a=S0(t.result);return i===null||a===null?null:{type:"files.results",terminalId:i,result:a}}case"notes.list":{const i=Lt(t.notes,U0);return i===null?null:{type:"notes.list",notes:i}}case"notes.imageData":{const i=we(t.imageId),a=Ne(t.mediaType);if(i===null||a===null)return null;const p=t.data;return{type:"notes.imageData",imageId:i,mediaType:a,data:typeof p=="string"?p:null}}case"memory.status":{const i=we(t.terminalId),a=B0(t.status);return i===null||a===null?null:{type:"memory.status",terminalId:i,status:a}}case"memory.planned":{const i=we(t.terminalId),a=Lt(t.changes,yf);return i===null||a===null?null:Al({type:"memory.planned",terminalId:i,changes:a},t)}case"memory.installed":{const i=we(t.terminalId),a=Lt(t.applied,yf);return i===null||a===null?null:Al({type:"memory.installed",terminalId:i,applied:a},t)}case"memory.imported":{const i=we(t.terminalId),a=so(t.copied),p=so(t.skipped);return i===null||a===null||p===null?null:Al({type:"memory.imported",terminalId:i,copied:a,skipped:p},t)}case"memory.content":{const i=we(t.terminalId),a=F0(t.note);return i===null||a===null?null:Al({type:"memory.content",terminalId:i,note:a},t)}case"vault.status":{const i=Q0(t.status);return i===null?null:{type:"vault.status",status:i}}case"vault.exported":{const i=we(t.projectKey),a=Ve(t.sessions);return i===null||a===null?null:{type:"vault.exported",projectKey:i,sessions:a}}case"session.continued":{const i=we(t.requestId),a=we(t.terminalId),p=Fe(t.source),k=tt(p==null?void 0:p.agent,Yl),C=we(p==null?void 0:p.sessionId),r=Ne(p==null?void 0:p.title),u=kf(t.includedTurns),v=kf(t.totalTurns),_=tt(t.delivery,fw);return i===null||a===null||k===null||C===null||r===null||u===null||v===null||u>v||_===null?null:{type:"session.continued",requestId:i,terminalId:a,source:{agent:k,sessionId:C,title:r},includedTurns:u,totalTurns:v,totalTurnsIsMinimum:t.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const i=we(t.terminalId),a=we(t.text),p=tt(t.reason,pw);return i===null||a===null||p===null?null:{type:"composer.prefill",terminalId:i,text:a,reason:p}}case"composer.drafts":{const i=an(t.drafts,vw);return i===null?null:{type:"composer.drafts",drafts:i}}case"search.progress":{const i=we(t.searchId),a=V0(t.progress);return i===null||a===null?null:{type:"search.progress",searchId:i,progress:a}}case"remote.status":{const i=sw(t.status);return i===null?null:{type:"remote.status",status:i}}case"settings.status":{const i=cw(t.settings);return i===null?null:{type:"settings.status",settings:i}}case"remote.pairing.code":{const i=rw(t.pairing);return i===null?null:{type:"remote.pairing.code",pairing:i}}case"remote.phone.pairing":{const i=ow(t.pairing);return i===null?null:{type:"remote.phone.pairing",pairing:i}}case"search.results":{const i=we(t.searchId),a=q0(t.result);return i===null||a===null?null:{type:"search.results",searchId:i,result:a}}case"error":{const i=ls(t.text);if(i===null)return null;const p={type:"error",code:tt(t.code,mw)??"internal",text:i},k=Ne(t.detail);k!==null&&(p.detail=k);const C=we(t.requestId);return C!==null&&(p.requestId=C),p}default:return null}}function Lf(n){return JSON.stringify(n)}const ww=/^[A-Za-z]:\\$/;function ii(n,t){return n.length===0?"":t==="win32"?yw(n):bw(n)}function yw(n){let t=n.replace(/\//g,"\\");for(t.startsWith("\\\\?\\UNC\\")?t=`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")&&(t=t.slice(4)),t=t.startsWith("\\\\")?`\\\\${t.slice(2).replace(/\\+/g,"\\")}`:t.replace(/\\+/g,"\\");t.endsWith("\\")&&!ww.test(t);)t=t.slice(0,-1);return t.toLowerCase()}function Mm(n,t,i){return n.length===0||i==="win32"&&n!==t&&n.toLowerCase()===t.toLowerCase()?t:n}function bw(n){let t=n.replace(/\/+/g,"/");for(;t.length>1&&t.endsWith("/");)t=t.slice(0,-1);return t}function Sw(n,t,i,a){const p=ii(i.cwd,a);let k=-1;for(const[C,r]of n.entries()){const u=t(r);u===void 0||u.kind!=="agent"||ii(u.cwd,a)===p&&(k=C)}return k===-1?n.length:k+1}function Am(n){return`[Pasted text #${n}]`}function Cw(n){return`[Start of pasted text #${n}]`}function xw(n){return`[End of pasted text #${n}]`}function kw(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function Ew(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function Lw(){return/\[Pasted text #(\d{1,6})\]/g}const Nm="https://buymeacoffee.com/cvelasquez",Tw="modulepreload",Rw=function(n){return"/"+n},Tf={},rs=function(t,i,a){let p=Promise.resolve();if(i&&i.length>0){let C=function(v){return Promise.all(v.map(_=>Promise.resolve(_).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),u=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));p=C(i.map(v=>{if(v=Rw(v),v in Tf)return;Tf[v]=!0;const _=v.endsWith(".css"),h=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${h}`))return;const w=document.createElement("link");if(w.rel=_?"stylesheet":Tw,_||(w.as="script"),w.crossOrigin="",w.href=v,u&&w.setAttribute("nonce",u),document.head.appendChild(w),_)return new Promise((E,R)=>{w.addEventListener("load",E),w.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${v}`)))})}))}function k(C){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=C,window.dispatchEvent(r),!r.defaultPrevented)throw C}return p.then(C=>{for(const r of C||[])r.status==="rejected"&&k(r.reason);return t().catch(k)})},Mw={"agent.composer.imagesRefused":"This CLI doesn't take images from the message box.","agent.continue.discovering":"The session isn't in the history yet: it shows up with the first message.","agent.continue.noConversation":"This tab doesn't have a conversation to continue yet.","agent.continue.noMessages":"This conversation doesn't have any messages to continue yet.","agent.continue.title":"Continue this conversation with another CLI","agent.dot.idle":"Ready, nothing in progress","agent.dot.noStatus":"This CLI doesn't publish its status","agent.dot.open":"CLI open","agent.dot.statusLineOnly":"This CLI only publishes its status with the status line configured","agent.dot.statusLinePending":"The status line hasn't published this conversation's status yet","agent.handoff.notice":"Continued from {{label}}: the agent starts from a transcript of {{turns}}, not from the context it had. Tool results are trimmed and images don't carry over.","agent.handoff.prefill.noDelivery":"The message is in the message box: check it and send it with Enter.","agent.handoff.prefill.notReady":"The CLI wasn't ready in time: the message is in the message box for you to send.","agent.handoff.prefill.sendFailed":"It couldn't be sent automatically: the message is in the message box for you to send.","agent.handoff.sending":"Sending the continuation…","agent.handoff.tabLabel":"Continued: {{title}}","agent.handoff.tabLabelNoTitle":"Continued","agent.handoff.turns.all_one":"the {{count}} turn","agent.handoff.turns.all_other":"the {{count}} turns","agent.handoff.turns.lastManyOfMore_one":"the last {{included}} of more than {{count}} turn","agent.handoff.turns.lastManyOfMore_other":"the last {{included}} of more than {{count}} turns","agent.handoff.turns.lastMany_one":"the last {{included}} of {{count}} turn","agent.handoff.turns.lastMany_other":"the last {{included}} of {{count}} turns","agent.handoff.turns.lastOne":"the last turn of {{total}}","agent.handoff.turns.lastOneOfMore":"the last turn of more than {{total}}","agent.handoff.turns.single":"the only turn","agent.meter.idle.noFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and the project's instructions file already take up context, and the real number shows up with the first response.","agent.meter.idle.statusLine":"The status line hasn't published tokens for this conversation yet. It doesn't start at zero: the number shows up when the CLI runs it, with the first message or when the session resumes.","agent.meter.idle.withFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and {{file}} already take up context, and the real number shows up with the first response.","agent.meter.origin.catalog":"limit from the CLI's model catalog","agent.meter.origin.estimated":"limit inferred from the measured tokens","agent.meter.setup.disabled":"This CLI only publishes its tokens through its status line, and the app's status line is disabled. Configure explains how.","agent.meter.setup.missing":"This CLI only publishes its tokens through its status line, and it isn't configured yet. Configure explains how.","agent.meter.setup.otherCommand":"This CLI only publishes its tokens through its status line, and you have another status line configured. Configure explains how.","agent.meter.setup.unreadable":"This CLI only publishes its tokens through its status line, and its settings.json couldn't be read. Configure explains how.","agent.mode.blocked":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","agent.mode.title":"{{mode}} mode: {{hint}}. Changing it sends {{key}} to the CLI tab","agent.mode.titleBlind":"{{title}}. Without status line data the app can't tell whether a confirmation is pending; changing the mode at that moment approves it","agent.note.empty":"The note is empty","agent.note.needsTab":"Open a tab first: the conversation opens in its project","agent.note.noReadySignal":"This tab's CLI doesn't say when it's ready, so the note can't be sent","agent.note.send":"Send the note to the agent in a new conversation in {{cwd}}","agent.openBlocked":"Opening a tab in this project…","agent.openTool.noLabel":"The CLI has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.openTool.withLabel":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.queueReturned.noLabel":"The CLI didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.queueReturned.withLabel":"{{label}} didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.serverClosed.noLabel":"The CLI server closed and this tab lost its connection.","agent.serverClosed.relaunch":"Relaunch","agent.serverClosed.relaunching":"Relaunching…","agent.serverClosed.withLabel":"The {{label}} server closed and this tab lost its connection.","agent.session.cliMissing":"{{label}} isn't installed.","agent.shortcuts.antigravity.answerPermission":"Answer a permission request: 1 allows it, 4 rejects it","agent.shortcuts.antigravity.cycleMode":"Change the mode: accept-edits, plan and default (with focus on the terminal)","agent.shortcuts.antigravity.help":"Show the CLI's shortcuts","agent.shortcuts.antigravity.interrupt":"Interrupt the current turn, or cancel a permission request","agent.shortcuts.claudeCode.cancel":"Cancel","agent.shortcuts.claudeCode.cycleMode":"Change the permission mode (with focus on the terminal)","agent.shortcuts.claudeCode.fullOutput":"Show the full output","agent.shortcuts.claudeCode.pasteImage":"Paste an image from the clipboard","agent.shortcuts.claudeCode.pasteText":"Paste text from the clipboard","agent.shortcuts.claudeCode.rewind":"Open the rewind menu","agent.shortcuts.claudeCode.searchHistory":"Search the command history","agent.shortcuts.codex.cycleMode":"Switch between the default mode and Plan (with focus on the terminal)","agent.shortcuts.codex.editPrevious":"Edit a previous message","agent.shortcuts.codex.effort":"Lower / raise the effort","agent.shortcuts.codex.externalEditor":"Edit the message in the external editor","agent.shortcuts.codex.interruptOrExit":"Interrupt, or exit if there's no turn","agent.shortcuts.codex.interruptTurn":"Interrupt the current turn","agent.shortcuts.codex.mention":"Mention a file, a skill or a plugin","agent.shortcuts.codex.note":"Alt + ← / → switch agents inside Codex, but here the app uses them to switch tabs.","agent.shortcuts.codex.queue":"Queue the message while the agent works","agent.shortcuts.codex.searchHistory":"Search the message history","agent.shortcuts.codex.transcript":"Show the transcript","agent.shortcuts.commands":"Commands","agent.shortcuts.composer.newline":"New line without sending","agent.shortcuts.composer.pasteText":"Paste text","agent.shortcuts.composer.pasteWithImages":"Paste text or an image (it stays as a thumbnail)","agent.shortcuts.composer.send":"Send the message","agent.shortcuts.interruptCli":"Interrupt whatever the CLI is doing","agent.shortcuts.leaderThen":"Ctrl + X, then {{key}}","agent.shortcuts.opencode.clearInput":"Clear the input; twice, exit","agent.shortcuts.opencode.commandList":"Command list, with the model variants","agent.shortcuts.opencode.cycleAgent":"Switch agent, build or plan (with focus on the terminal)","agent.shortcuts.opencode.interrupt":"Interrupt (the first press only warns)","agent.shortcuts.opencode.model":"Choose a model","agent.shortcuts.opencode.newSession":"New session: the tab stays tied to the session it was opened with","agent.shortcuts.opencode.newline":"New line","agent.shortcuts.opencode.note":"Ctrl + T switches the model variant inside OpenCode, but the browser keeps it for itself: it's under Ctrl + P.","agent.shortcuts.opencode.paste":"Paste","agent.shortcuts.pi.bash":"Run a shell command","agent.shortcuts.pi.clearOrExit":"Clear the editor; twice, exit","agent.shortcuts.pi.cycleThinking":"Change the thinking level (with focus on the terminal)","agent.shortcuts.pi.model":"Choose a model","agent.shortcuts.pi.newline":"New line","agent.shortcuts.pi.nextModel":"Switch to the next model","agent.shortcuts.pi.toolOutput":"Collapse or expand tool output","agent.shortcuts.pi.tree":"With the editor empty: open the session tree","agent.statusLine.noFragment":"The app's folder has characters the console interprets (such as & % ! or quotes), and with them there's no line the CLI can run: on Windows it runs it with cmd /c and no quote gets through. Moving the configuration folder to a path without those characters fixes it.","agent.statusLine.state.active":"Configured","agent.statusLine.state.disabled":"Disabled (enabled: false)","agent.statusLine.state.missing":"Not configured","agent.statusLine.state.otherCommand":"You have another status line: pasting this one replaces it","agent.statusLine.state.unreadable":"Couldn't read settings.json","agent.stoppedEarly":"You stopped it before the agent started: the message is back in the message box so you can fix it.","agent.thread.discovering":"The session shows up in the history with the first message.","agent.thread.noTranscript":"This conversation comes from a CLI version that didn't leave a readable transcript. It can be resumed from the sidebar, but there's nothing to show here.","agent.waiting.answer":"The CLI is waiting for an answer from you.","agent.waiting.permission":"The CLI is waiting for you to authorize a tool.","agent.waiting.question":"The agent asked you a question: answer it in the thread.","agentMenu.chooseTitle":"Choose which CLI to open with","agentMenu.openWith":"Open with","agentMenu.titleWithAgent":"{{title}} — with {{label}}","app.banner.revoked":"This device's access was revoked, or remote access was turned off. To come back, pair it again from the computer running Agent Workbench.","app.divider.consoleHeight":"Drag to change the console's height","app.divider.width":"Drag to change the width","app.empty.hint":"Pick a project on the left, or open a session from the history to resume it.","app.empty.newSession":"New session in {{cwd}}","app.empty.noTabs":"No open tabs.","app.empty.opening":"Opening…","app.header.cliVersion":"CLI {{version}}","app.header.remoteAccess":"Remote access","app.header.remoteBadge":"Remote","app.header.remoteBadgeTitle":"This window is connected from a paired device. Managing remote access, and anything that opens a file with the apps of the computer running Agent Workbench, is only available on that computer.","app.header.shortcuts":"Show keyboard shortcuts","app.markerNotice":"This server was started from inside a CLI session. The <code>{{variable}}</code> variable was removed from the tabs' environment: it turns off history saving, and without that there would be no conversation or context meter. The rest of the environment is left untouched.","app.panel.name":"Panel","app.panel.show":"Show the right panel (Alt+P)","app.picker.project.confirm":"Open here","app.picker.project.confirmTitle":"Open an agent tab in {{path}}","app.picker.project.title":"New project","app.picker.vault.confirm":"Use this folder","app.picker.vault.confirmTitle":"Move the backup to {{path}}. The current folder stays untouched","app.picker.vault.title":"Backup folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab, and the CLI saves it as the default for the next tabs","controls.effort.low":"Low","controls.effort.max":"Max","controls.effort.medium":"Medium","controls.effort.minimal":"Minimal","controls.effort.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","controls.effort.off":"Off","controls.effort.placeholder":"effort — no data","controls.effort.provisional":"Effort from your configuration: {{effort}}. No response has confirmed it yet","controls.effort.xhigh":"Very high","controls.model.default":"Default","controls.model.inUse":"Model in use: {{model}}. Changing it sends /model to the CLI tab","controls.model.inUseSaved":"Model in use: {{model}}. Changing it sends /model to the CLI tab, and the CLI saves it as the default for the next tabs","controls.model.noData":"Model: there hasn't been any response in this session yet","controls.model.placeholder":"model — no data","controls.model.provisional":"Model from your configuration: {{model}}. No response has confirmed it yet","conversation.answerUnconfirmed":"The CLI didn't confirm this answer. Try again, or answer in the CLI tab.","diff.binary":"Binary file: there's no diff to show.","diff.noChanges":"No changes.","diff.truncated":"The diff was cut off because of its size. The full file is easier to read outside this panel.","docs.backToList":"Show the list","docs.edit.adopt":"Move my changes to the new version","docs.edit.button":"Edit","docs.edit.cancel":"Cancel","docs.edit.closeConfirm":"This file has unsaved changes. Discard them and close it?","docs.edit.conflict":"The file changed on disk while you were editing it. Your changes weren't saved.","docs.edit.discard":"Discard","docs.edit.discardAndClose":"Discard and close","docs.edit.discardConfirm":"Discard your changes?","docs.edit.discardMine":"Discard my changes","docs.edit.editing":"Editing {{name}}","docs.edit.gone":"The file is no longer on disk, or its new version can't be edited here. Your changes weren't saved: copy them if you need them.","docs.edit.keepEditing":"Keep editing","docs.edit.lost":"The connection dropped while saving. Save again to be sure.","docs.edit.noChanges":"No changes","docs.edit.pending":"Your changes, not saved yet. Move them into the file and save.","docs.edit.pendingDone":"Done","docs.edit.save":"Save","docs.edit.saveTitle":"Save (Ctrl+S)","docs.edit.saved":"Saved","docs.edit.saving":"Saving…","docs.edit.title":"Edit this file here","docs.edit.tooLarge":"It's too big to edit here","docs.edit.unsafe":"It isn't plain UTF-8 text: saving it from here could damage it","docs.edit.unsaved":"Unsaved changes","docs.failed":"Couldn't read the document. Use ⟳ to try again.","docs.mode.formatted":"Formatted","docs.mode.label":"How to show this Markdown","docs.mode.source":"Source","docs.reload":"Read the document again","docs.reloadFailed":"Couldn't read it again: this is the last version that arrived.","docs.search.placeholder":"Search this document","docs.tab.close":"Close this document","files.allHidden":"everything in it is hidden","files.empty":"empty","files.hidden.hide":"Hide again what .gitignore and the built-in list exclude","files.hidden.show":"Also show what .gitignore and the built-in list exclude","files.hiddenCount_one":"{{count}} hidden","files.hiddenCount_other":"{{count}} hidden","files.hiddenTitle":"Hidden: .git, node_modules, dist, bin, obj and whatever .gitignore says","files.insertFolderPath":"Put this folder's path in your message","files.insertPath":"Put the path of {{name}} in your message","files.loading":"loading…","files.menu.copyAbsolute":"Copy absolute path","files.menu.copyRelative":"Copy relative path","files.menu.insertMention":"Insert as @path","files.menu.openWithSystem":"Open with the default app","files.moreEntries":"there are more entries than shown","files.pathInserted":"Added to your message","files.preview.binary":"Binary file: no preview.","files.preview.insertPath":"Put the path in your message","files.preview.truncated":"The file was cut off because of its size. Open it with the default app to see all of it.","files.readDirFailed":"Couldn't read the directory.","files.readingDir":"Reading the directory…","files.readingFile":"Reading the file…","files.refresh":"Reload the tree","files.reveal":"Open {{name}} in the system's file explorer","files.revealFolder":"Open this folder in the system's file explorer","files.row.alwaysHidden":"always hidden: .git, node_modules, dist, bin, obj","files.row.ignored":"hidden by .gitignore","files.search.clear":"Clear (Esc)","files.search.more":"there are more results than shown","files.search.moreTitle":"Narrow the search to see them all","files.search.none":"No file with that name.","files.search.placeholder":"Search files by name…","files.search.prompt":"Type to search.","files.search.searching":"Searching…","format.bytes.b":"{{value}} B","format.bytes.gb":"{{value}} GB","format.bytes.kb":"{{value}} KB","format.bytes.mb":"{{value}} MB","format.duration.minutes":"{{value}} min","format.duration.minutesSeconds":"{{minutes}} min {{seconds}} s","format.duration.ms":"{{value}} ms","format.duration.seconds":"{{value}} s","format.duration.underSecond":"less than 1 s","git.aheadBehindTitle":"Commits ahead of and behind the upstream branch","git.backToChanges":"Changes","git.clean":"The working tree is clean.","git.detached":"Detached HEAD","git.detachedAt":"Detached HEAD @ {{head}}","git.group.conflict":"Conflicted","git.group.conflictHint":"They need to be resolved before going on","git.group.staged":"Staged","git.group.stagedHint":"Already added with git add","git.group.unstaged":"Unstaged","git.group.unstagedHint":"Modified in the working tree","git.group.untracked":"Untracked","git.group.untrackedHint":"New files git doesn't know about","git.kind.added":"added","git.kind.conflict":"conflicted","git.kind.copied":"copied","git.kind.deleted":"deleted","git.kind.modified":"modified","git.kind.renamed":"renamed","git.kind.typeChanged":"type changed","git.kind.untracked":"untracked","git.newFolderTitle":"{{path}} — new folder; its contents show up in Files","git.readingDiff":"Reading the diff…","git.refresh":"Refresh the status now","git.stagedTag":"staged","git.truncated":"There are more changes than shown. It usually means a rule is missing from <code>.gitignore</code>.","git.unknownState":"The repository's status isn't known yet.","git.upstreamTitle":"Upstream branch: {{upstream}}","git.worktrees.detached":"detached","git.worktrees.heading":"Other worktrees","git.worktrees.headingTitle":"Other working trees of this repository","header.locale.auto":"Automatic (browser: {{name}})","header.locale.title":"Language: {{name}}","header.locale.titleAuto":"Language: {{name}} (automatic, from the browser)","memory.action.appendBlock":"the block will be added at the end","memory.action.appendLines":"lines will be added at the end","memory.action.copy":"will be copied","memory.action.create":"will be created","memory.action.replaceBlock":"the block will be replaced","memory.back":"← Memory","memory.error.connectionLost":"The connection dropped before the response. Once it reconnects, the status shows what got written.","memory.form.copyFromMain":"Copy the notes from the main worktree","memory.form.existingNotes":"Existing notes","memory.form.files":"Instruction files","memory.form.importNative_one":"Import {{count}} note from Claude Code's memory","memory.form.importNative_other":"Import {{count}} notes from Claude Code's memory","memory.form.noFiles":"Choose at least one instruction file","memory.form.planning":"Calculating…","memory.form.preview":"Preview changes","memory.git.alreadyIgnored":"This repo already ignores <code>.agents/memory/</code>. To track it, that rule has to be removed from <code>.gitignore</code> by hand.","memory.git.blocked":"With git returning an error, it can only be installed without touching .gitignore","memory.git.dontTouch":"Don't touch <code>.gitignore</code>","memory.git.errorHint":"git returned an error","memory.git.errorWarning":"git returned an error, so there's no telling whether the memory is ignored. It can be installed without touching <code>.gitignore</code>.","memory.git.ignore":"Ignore the memory","memory.git.ignoreHint":"recommended","memory.git.version":"Track it","memory.git.versionHint":"for private repos","memory.global.copy":"Copy the snippet","memory.global.intro":"What applies to all your projects goes in <code>~/.agents/global.md</code>. The app doesn't write it: each CLI reads it once you add its snippet.","memory.global.title":"Global memory","memory.index":"Index","memory.intro.what":"Shared memory keeps what the agents learn about this project —decisions, constraints, pitfalls they already ran into— for the next session.","memory.intro.where":"It lives in <code>.agents/memory/</code>: one note per file and an index, <code>MEMORY.md</code>. The four CLIs read it through a marked block in their instructions file. Nothing is written until you confirm the changes.","memory.list.empty":"No notes yet. The agents save them here when they learn something that's useful in another session.","memory.list.notes":"Notes","memory.loading":"Reading the memory…","memory.native.import_one":"Import {{count}} note","memory.native.import_other":"Import {{count}} notes","memory.native.importing":"Importing…","memory.native.pending_one":"Claude Code's own memory has {{count}} note that isn't here.","memory.native.pending_other":"Claude Code's own memory has {{count}} notes that aren't here.","memory.note.loading":"Reading the note…","memory.note.truncated":"The note was cut off because of its size.","memory.plan.back":"Back","memory.plan.changes":"Changes","memory.plan.copiedFrom":"Copy of {{path}}","memory.plan.install":"Install","memory.plan.nothing":"There's nothing to change: the bridge is already up to date.","memory.plan.update":"Update","memory.plan.writing":"Writing…","memory.problem.brokenBlock":"Its block markers are malformed","memory.problem.brokenBlockWarning":"<code>{{file}}</code> has malformed memory block markers: one without its pair, or the block repeated. The app won't touch it until you fix it by hand.","memory.problem.encoding":"It isn't in UTF-8","memory.problem.encodingWarning":"<code>{{file}}</code> isn't in UTF-8 (it looks like UTF-16, which is what <code>></code> writes in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it until then.","memory.problem.outside":"It's a link that points outside the project","memory.problem.outsideWarning":"<code>{{file}}</code> is a link that points outside the project: the app doesn't read or write it.","memory.reach.adjust":"Adjust","memory.reach.adjustTitle":"Choose the bridge's instruction files again","memory.reach.doesNotReach":": doesn't reach the memory, {{via}}","memory.reach.reaches":": reaches the memory through {{via}}","memory.reach.title":"{{label}}: {{via}}","memory.result.imported_one":"Imported {{count}} note.","memory.result.imported_other":"Imported {{count}} notes.","memory.result.installed_one":"Done: {{count}} file changed.","memory.result.installed_other":"Done: {{count}} files changed.","memory.result.nothingChanged":"There was nothing to change: the bridge was already up to date.","memory.result.nothingImported":"There were no new notes to import.","memory.result.skipped_one":"Not overwritten because it already existed with different content: {{files}}.","memory.result.skipped_other":"Not overwritten because they already existed with different content: {{files}}.","memory.result.withSkipped":"{{result}} {{skipped}}","memory.update.button":"Update the bridge","memory.update.missing":"The block is missing from {{files}}.","memory.update.outdatedAndMissing_one":"{{outdated}} has an outdated block; the block is missing from {{missing}}.","memory.update.outdatedAndMissing_other":"{{outdated}} have an outdated block; the block is missing from {{missing}}.","memory.update.outdated_one":"{{files}} has an outdated block.","memory.update.outdated_other":"{{files}} have an outdated block.","meter.configure":"Configure","meter.label":"Context","meter.lastResponseTitle":"The model's last response","meter.modelWithOrigin":"{{model}} — {{origin}}","meter.noTokens":"this CLI doesn't publish tokens","meter.noTokensTitle":"This CLI doesn't publish how many tokens each response uses, so there's nothing to measure.","meter.output":"output {{tokens}}","meter.responses_one":"{{count}} response","meter.responses_other":"{{count}} responses","meter.sessionTitle":"Total for the whole session","meter.sessionTotals_one":"session {{output}} out · {{cache}} cache · {{count}} response","meter.sessionTotals_other":"session {{output}} out · {{cache}} cache · {{count}} responses","meter.unknownModel":"unrecognized model: showing the tokens, not the window size","meter.unknownModelShort":"unrecognized model: no window size","meter.unmeasured":"not measured","meter.windowPercent":"{{percent}}% of the window","mode.acceptEdits.hint":"Accepts file edits without asking","mode.acceptEdits.label":"Accept edits","mode.auto.hint":"The CLI decides on its own which tools to use, without asking","mode.auto.label":"Auto","mode.default.hint":"Asks before each tool that isn't allowed","mode.default.label":"Manual","mode.plan.hint":"Researches and proposes a plan, without touching anything until you approve it","mode.plan.label":"Plan","narrow.keys.ctrlO":"Ctrl+O (in Claude Code, expands what is shown cut short)","narrow.keys.ctrlX":"Ctrl+X","narrow.keys.down":"Down arrow","narrow.keys.esc":"Escape","narrow.keys.interrupt":"Ctrl+C: interrupt","narrow.keys.label":"Terminal keys","narrow.keys.left":"Left arrow","narrow.keys.right":"Right arrow","narrow.keys.shiftTab":"Shift+Tab (in Claude Code, cycles the permission mode)","narrow.keys.tab":"Tab","narrow.keys.up":"Up arrow","narrow.menu.chimePage":"This page","narrow.menu.chimeSystem":"System","narrow.menu.cli":"CLI","narrow.menu.connection":"Connection","narrow.menu.folder":"Folder","narrow.menu.language":"Language","narrow.menu.notifications":"System notifications","narrow.menu.phoneAppDisconnect":"Disconnect","narrow.menu.phoneAppSettings":"Settings","narrow.menu.shortcuts":"Keyboard shortcuts","narrow.menu.sound":"Notification sound","narrow.menu.theme":"Theme","narrow.more":"More","narrow.projects":"Projects","narrow.tabs.close":"Close tab","narrow.tabs.new":"New tab","narrow.tabs.none":"No tabs open.","narrow.tabs.open":"Tabs","narrow.tabs.rename":"Rename","narrow.view.chat":"Chat","notes.attach":"Attach an image from a file","notes.closeConfirm":"Closing this note deletes it, along with its images.","notes.closeNote":"Close the note. It's deleted, along with its images","notes.collapse":"Collapse. Notes aren't lost: the × on each tab is what closes them","notes.empty":"No notes. The <b>+</b> opens one; they're for jotting down an idea without leaving what you're doing.","notes.expand":"Expand the notes","notes.imageAlt":"note image","notes.imageFallbackName":"the image","notes.imageOnly":"Image","notes.imageTooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"notes.imageUnavailable":"the image isn't available","notes.lightboxClose":"Click to close","notes.name":"Notes","notes.new":"New note","notes.placeholder":"Jot down an idea. Images can be pasted or dragged here.","notes.readFailed":"Couldn't read the image.","notes.removeImage":"Remove the image","notes.resize":"Drag to change the height","notes.thumbMissing":"missing","notes.tooManyImages_one":"Up to {{count}} image per note.","notes.tooManyImages_other":"Up to {{count}} images per note.","notes.untitled":"Note","notify.attention":"“{{tab}}” is waiting for you","notify.done":"“{{tab}}” finished","panel.cliUnseen":"The CLI wrote something","panel.hide":"Hide the panel (Alt+P)","panel.restoreWidth":"Restore the column's width","panel.tab.cli":"CLI","panel.tab.files":"Files","panel.tab.git":"Changes","panel.tab.memory":"Memory","panel.tab.plans":"Plans","panel.widen":"Widen the column — the CLI's interface needs room to draw diffs and tables","picker.create":"Create","picker.createHere":"Create a folder here","picker.empty":"There are no subfolders here.","picker.goTo":"Go to {{root}}","picker.loading":"Reading the disk...","picker.newFolderName":"Folder name","picker.truncated":"There are more subfolders than fit in the list. Open one to narrow it down.","picker.up":"parent folder","plans.empty":"This conversation hasn't written any documents yet. Plans from plan mode show up here, along with the <code>.md</code> files the agent saves in the project or in its temporary folder.","plans.loading":"Reading the plan…","plans.missing":"missing","plans.missingTitle":"The file is no longer on disk","plans.truncated":"The plan was cut off because of its size.","remote.address":"This computer's address","remote.copied":"Copied","remote.copy":"Copy","remote.device.connected":"Connected now","remote.device.lastSeen":"Last seen: {{when}}","remote.device.never":"Never connected","remote.device.paired":"Paired: {{when}}","remote.device.rename":"Rename","remote.device.revoke":"Revoke","remote.device.revokeConfirm":"Click again to revoke","remote.devices":"Paired devices","remote.devices.empty":"None yet.","remote.intro":"Use Agent Workbench from another computer on your network, or from your phone. Nothing is opened to the network: the connection goes through an SSH tunnel.","remote.onlyOnHost":"Only on the computer running Agent Workbench: it opens with that computer's apps.","remote.pair.after":"After that, the other computer just opens {{url}}.","remote.pair.cancel":"Cancel","remote.pair.expires":"It works once and expires in {{time}}.","remote.pair.needsActive":"You can pair once remote access is on and running.","remote.pair.open":"With the tunnel running, open this address in the other computer's browser:","remote.pair.start":"Pair a device","remote.phone.authorize.admin":"1. Authorize the phone's key: on this computer, paste this into PowerShell as administrator.","remote.phone.authorize.powershell":"1. Authorize the phone's key: on this computer, paste this into PowerShell.","remote.phone.authorize.terminal":"1. Authorize the phone's key: on this computer, paste this into a terminal.","remote.phone.authorizeOnce":"The key only opens the tunnel to Agent Workbench: no terminal and no commands. If you already pasted it, you don't need to do it again.","remote.phone.hint":"Using the Android app? It only needs step 1: it opens the tunnel and pairs itself.","remote.phone.qrLabel":"Code to scan with the phone","remote.phone.scan":"2. In the app, tap “Scan code” and point the camera here:","remote.phone.secret":"Don't share this code or a photo of it: it carries the phone's key.","remote.phone.start":"Pair a phone","remote.phone.title":"A phone","remote.port":"Port","remote.portInvalid":"A number between {{min}} and {{max}}.","remote.portSave":"Save","remote.restartHint":"Turning it on, or changing the port, takes effect when you restart Agent Workbench. Restarting closes the open CLIs: the tabs come back asleep.","remote.ssh.linux":"In a terminal (Ubuntu or Debian; on other distributions, install their OpenSSH server):","remote.ssh.macos":"System Settings → General → Sharing → turn on “Remote Login”.","remote.ssh.windows":"Open PowerShell as administrator and paste this. The first line downloads and installs the server: it takes a few minutes and shows “Running” meanwhile. Wait until the prompt comes back before moving on.","remote.state.active":"On, port {{port}}","remote.state.off":"Off","remote.state.portBusy":"Port {{port}} is busy, so remote access isn't working in this run. Close the other program (it may be another Agent Workbench) and restart, or choose another port.","remote.state.restartNeeded":"On, but it takes effect when you restart Agent Workbench","remote.step.host":"1. On this computer, once: turn on SSH","remote.step.hostHint":"It's a system setting that needs administrator rights, so the app doesn't do it for you. This computer's system is open:","remote.step.pair":"3. Pair it, once per device","remote.step.tunnel":"2. On the other computer, each time you use it","remote.step.tunnelHint":"Paste this command into its terminal and leave it open. It asks for the password of your user on this computer.","remote.title":"Remote access","remote.trouble":"Not connecting?","remote.trouble.network":"On Windows, check that this computer's Wi‑Fi network is set to Private.","remote.turnOff":"Turn off","remote.turnOffHint":"Turning it off takes effect right away: paired devices are disconnected, and stay paired.","remote.turnOn":"Turn on remote access","remote.userHint":"If SSH rejects “{{user}}”: with a Microsoft or work account, try the name of your user folder (C:\\Users\\<name>) and the account password, not the PIN.","remote.vpnHint":"A work VPN that blocks the local network cuts the connection while it's on. The app can't do anything about that.","rewind.filesHint":"Changes made by hand or with console commands are not undone.","rewind.filesSection":"Files the agent changed since then","rewind.intro":"This message and everything after it are undone. The message comes back to the message box so you can edit it.","rewind.running":"Going back…","rewind.title":"Go back to before this message","rewind.undo":"Undo","rewind.undoAll":"Undo conversation and code","rewind.undoConversation":"Conversation only","search.found":"{{hits}} in {{sessions}}","search.hits_one":"{{count}} match","search.hits_other":"{{count}} matches","search.mode.conversations":"In conversations","search.mode.conversationsTitle":"Searches the text of the conversations saved in the backup, ignoring case and accents","search.mode.titles":"In titles","search.off":"The backup is off: the search covers what it saved while it was on.","search.placeholder.conversations":"Search the conversations (Enter)","search.placeholder.titles":"Filter projects and sessions","search.role.assistant":"Response","search.role.title":"Title","search.role.user":"Request","search.sessions_one":"{{count}} session","search.sessions_other":"{{count}} sessions","search.status.done":"{{found}}.","search.status.none":"No results","search.status.noneIn":"No results in {{sessions}}.","search.status.progressFound_one":"Searching… {{scanned}} of {{count}} session, {{found}} so far.","search.status.progressFound_other":"Searching… {{scanned}} of {{count}} sessions, {{found}} so far.","search.status.progress_one":"Searching… {{scanned}} of {{count}} session.","search.status.progress_other":"Searching… {{scanned}} of {{count}} sessions.","search.status.searching":"Searching…","search.status.truncatedResults":"{{found}}: these are the first ones, refine the search to see the rest.","search.status.truncatedTime":"{{found}}: the search stopped after {{seconds}} s and {{left}} were left unchecked.","search.tooShort":"Type at least {{min}} characters and press Enter.","searchHook.connectionLost":"The connection to the server was lost: search again.","server.agentUnknown":"This server doesn't know how to launch that CLI.","server.answerInterrupted":"The answer wasn't fully sent: the interruption cut it off.","server.answerInvalid":"The answer doesn't match the question.","server.answerNoFreeText":"This question doesn't accept a written answer: choose one of the options.","server.answerNotPending":"That question is no longer waiting for an answer.","server.answerSendFailed":"The answer couldn't be sent: answer it in the CLI tab.","server.answersUnsupported":"This CLI doesn't take answers from the conversation. Answer it in the CLI tab.","server.archiveOpenTab":"Sessions with an open tab aren't archived. Close it first.","server.attachmentEmpty":'"{{name}}" arrived empty.',"server.attachmentExecutable":`Executables aren't attached: "{{name}}".`,"server.attachmentSaveFailed":"The attached file couldn't be saved.","server.attachmentTooLarge":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"server.badMessage":"Message not recognized by the protocol.","server.cliFolderClosed":"That's inside a CLI's own folder: the app doesn't open it.","server.cliMissing":`The "{{command}}" command wasn't found in the PATH. Agent Workbench uses the CLI you already have installed: it doesn't include or download it. Install it from {{url}} and start again.`,"server.cliNotFound":"The CLI isn't installed or wasn't found in the PATH.","server.cliNotInstalled":"{{label}} isn't installed or wasn't found in the PATH.","server.cliOpenFailed":"The tab's CLI couldn't be opened.","server.continueFailed":"The continuation couldn't be prepared.","server.continueHistoryMissing":"That conversation's history wasn't found.","server.continueNoFolder":"That conversation doesn't say which folder it ran in.","server.continueNotInHistory":"That conversation isn't in the history: if it just started, try again in a few seconds.","server.continueReadFailed":"That conversation couldn't be read.","server.continueSameCli":"That conversation already belongs to that CLI: to continue it, open it from the sidebar.","server.continueTabFailed":"The continuation's tab couldn't be opened.","server.continueTranscriptFailed":"The continuation's transcript couldn't be saved.","server.conversationNotFollowed":"That conversation is no longer being followed.","server.cwdMissing":"The directory doesn't exist: {{cwd}}","server.cwdNotDir":"It isn't a directory: {{cwd}}","server.diffBinaryUntracked":"Untracked binary file.","server.diffNewEmpty":"New, empty file.","server.diffNoStaged":"There are no staged changes for this file.","server.diffNoUnstaged":"There are no unstaged changes for this file.","server.diffReadFailed":"The diff couldn't be read.","server.dirReadFailed":"The directory couldn't be read.","server.dirSearchFailed":"The directory couldn't be searched.","server.fileReadFailed":"The file couldn't be read.","server.fileSaveBlocked":"The file couldn't be saved: it's read-only, or another program has it open.","server.fileSaveFailed":"The file couldn't be saved.","server.fileSaveTooLarge":"It's too big to save from here: the limit is {{max}}.","server.filesPerMessage":"You can attach up to {{max}} files per message.","server.forceSendFailed":"Couldn't force the send: the message is still queued.","server.forceSendNoCli":"This tab's CLI isn't open.","server.forceSendNothing":"Nothing is queued: the message already reached the agent.","server.forceSendUnsupported":"This tab's CLI can't force a send from the app.","server.forceSendWaiting":"The CLI is waiting for your answer: answer it before forcing the send.","server.gitCommandFailed":"git {{command}} failed.","server.gitMissing":"git wasn't found in the PATH. The Changes panel needs git installed; the rest of the app works the same.","server.gitNotFound":"git wasn't found in the PATH.","server.gitNotRepo":"This folder isn't inside a git repository.","server.gitRunFailed":"git couldn't be run to read the repository's status.","server.gitStatusUnknown":"The repository's status isn't known yet.","server.gitUnexpected":"Unexpected answer from git {{command}}.","server.handoffEmpty":"That conversation has no messages to continue.","server.handoffNoTranscript":"That conversation has no messages to continue: that CLI didn't leave a readable transcript.","server.imageEmpty":"The image arrived empty.","server.imageTooLarge":"The image is {{size}} MB; the maximum is {{max}} MB.","server.imageTypeUnsupported":"Image type not supported: {{type}}","server.imageUnknownFormat":"The content isn't an image in a known format.","server.imagesPerMessage":"You can attach up to {{max}} images per message.","server.imagesUnsupported":"This CLI doesn't take images from the message box.","server.memoryAppeared":"{{file}} appeared during the installation. Review the changes again.","server.memoryBrokenBlock":"{{file}} has malformed memory block markers (one without its pair, or the block repeated). Fix it by hand: the app won't touch that file in the meantime.","server.memoryChooseFile":"Choose at least one instructions file.","server.memoryGitFailed":"git couldn't be queried ({{detail}}). Without that, there's no telling whether .gitignore needs changes.","server.memoryHardLinks":"{{file}} has hard links: the app doesn't modify it, because writing it would break the link. Add the block by hand.","server.memoryLinkOutside":"{{path}} points outside the project (a link or a junction): the app doesn't write there.","server.memoryNotAFile":"{{label}} exists but isn't a file.","server.memoryNotInstalled":"Install the bridge first: the .agents/memory folder is missing.","server.memoryNotUtf8":"{{file}} isn't UTF-8 (it looks like UTF-16, which is what `>` leaves in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it in the meantime.","server.memoryNoteClaude":"Add this line at the end. Claude Code imports the file at startup.","server.memoryNoteGone":"That note no longer exists.","server.memoryNoteHardLink":"Hard link. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteHardLinkCmd":"Hard link, in cmd. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteName":"That name isn't a memory note.","server.memoryNoteOpenCode":"Inside the root object. Absolute path: OpenCode doesn't expand `~` in this key (unverified).","server.memorySameFile":"{{other}} and {{file}} are the same file (a link). Choose just one.","server.memoryViaEncoding":"{{file}} isn't UTF-8","server.memoryViaFallback":"CLAUDE.md (fallback)","server.memoryViaFile":"{{file}}","server.memoryViaNoBlock":"the block is missing in {{file}}","server.memoryViaNoBlockEither":"the block is missing in AGENTS.md or CLAUDE.md","server.memoryViaNoFolder":"the .agents/memory folder is missing","server.memoryViaNoIndex":".agents/memory/MEMORY.md is missing","server.memoryViaOutside":"{{file}} points outside the project","server.modePendingConfirmation":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","server.modeUnreachable":"That mode can't be reached from the current one. Change it with {{key}} in the CLI tab.","server.modesUnsupported":"This CLI has no permission modes to change from here.","server.noteCliNotStarted":"That tab's CLI didn't manage to start; the note wasn't sent.","server.noteEmpty":"The note is empty.","server.noteExists":"That note already exists.","server.noteGone":"The note no longer exists.","server.noteIdInvalid":"The note's id isn't valid.","server.noteImageFailed":"An image from the note couldn't be attached.","server.noteImagesMax":"Up to {{max}} images per note.","server.noteImagesUnsupported":"This CLI doesn't take images; the note wasn't sent.","server.noteInterrupted":"The note wasn't fully sent: the interruption cut it off.","server.noteNoAgent":"That tab has no agent to send the note to.","server.noteNoReadySignal":"This CLI doesn't say when it's ready; the note wasn't sent.","server.noteSaveFailed":"The note couldn't be saved.","server.noteTooLong":"A note holds up to {{max}} characters.","server.notesMax":"Up to {{max}} open notes. Close one first.","server.openToolSubmit":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","server.operationFailed":"The operation couldn't be completed: {{detail}}","server.pasteImageFailed":"The pasted image couldn't be saved.","server.pathMissing":"The path doesn't exist.","server.pathNotRelative":"Only paths relative to the tab's directory are accepted.","server.pathNullByte":"The path contains a null byte.","server.pathOpenFailed":"The path couldn't be opened.","server.pathOutside":"The path goes outside the tab's directory.","server.pendingSubmitAnswer":"{{label}} is waiting for an answer: the message's Enter would answer it. Answer it in the CLI tab.","server.pendingSubmitPermission":"{{label}} is waiting for you to authorize a tool: the message's Enter would approve it. Answer it in the CLI tab.","server.pickerCliFolder":"That folder belongs to the CLI and can't be opened from here.","server.pickerClosed":"That folder picker is no longer open.","server.pickerCreateFailed":"The folder couldn't be created there.","server.pickerFolderExists":"There's already a folder with that name.","server.pickerListFailed":"That folder couldn't be listed.","server.pickerNameChars":"The name has characters that can't be used.","server.pickerNameInvalid":"The folder name isn't valid.","server.pickerNoProjectsHere":"Projects aren't created there: it's the CLI's folder.","server.pickerNotListed":"That folder isn't in the current listing.","server.pickerRootMissing":"That root doesn't exist.","server.pickerTooMany":"Too many folder pickers are open.","server.planReadFailed":"The plan couldn't be read.","server.raw":"{{text}}","server.relaunchCloseFailed":"The tab's CLI couldn't be closed to relaunch it.","server.remoteDeviceGone":"That device is no longer paired.","server.remoteFailed":"The remote access change couldn't be made.","server.remoteHostOnly":"Remote access is managed only from the computer running Agent Workbench.","server.remoteNotActive":"Remote access isn't on and running yet. Turn it on and restart Agent Workbench.","server.remoteOpensOnHost":"That opens a window on the computer running Agent Workbench, so it isn't available from a remote device.","server.remotePortInvalid":"The port has to be a number between {{min}} and {{max}}.","server.remoteTooManyDevices":"There are already {{max}} paired devices. Revoke one first.","server.rewindBusy":"The CLI is working: stop it before going back.","server.rewindFailed":"Couldn't go back from here, and nothing was undone. Do it in the CLI tab with Esc Esc.","server.rewindNoCli":"This tab's CLI isn't open: open it to go back.","server.rewindUnknownMessage":"That message is no longer in the conversation.","server.rewindUnsupported":"This tab's CLI can't go back from the app.","server.searchFailed":"The backup couldn't be searched.","server.settingsFailed":"Couldn't save the settings.","server.settingsHostOnly":"These settings can only be changed on the computer running Agent Workbench.","server.settingsShellMissing":"That console isn't installed anymore.","server.shellNotFound":"No system console was found to open.","server.submitInterrupted":"The message wasn't fully sent: the interruption cut it off.","server.submitStoppedTool":"The message wasn't fully sent: {{label}} opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedToolNoLabel":"The message wasn't fully sent: the CLI opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedWaiting":"The message wasn't fully sent: {{label}} started waiting for an answer while it was being typed. Answer it before sending another message.","server.submitStoppedWaitingNoLabel":"The message wasn't fully sent: the CLI started waiting for an answer while it was being typed. Answer it before sending another message.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The backup is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The backup is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The backup is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current backup can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The backup operation couldn't be completed.","server.vaultIndexNotReady":"The history is still being read. Measure when it's done.","server.vaultMeasureFirst":"First measure how much it would take.","server.vaultMemoryFailed":"memory of {{cwd}}: {{detail}}","server.vaultMoveFailed":"The backup couldn't be moved: {{detail}}","server.vaultMoving":"The backup is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no backup yet.","server.vaultNotLoaded":"The backup isn't loaded.","server.vaultProjectGone":"That project is no longer in the sidebar.","server.vaultReasonNewerFormat":"the existing copy is in a newer format","server.vaultReasonOriginMissing":"the source wasn't found","server.vaultReasonUnsafeId":"a session id that can't be copied","server.vaultSessionFailed":"{{agent}}/{{session}}: {{detail}}","server.vaultSessionMissing":"That session isn't in the backup.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the backup isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current backup.","server.vaultTargetNotAbsolute":"The backup folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","session.untitled":"Untitled session","settings.cli.disabled":"Off","settings.cli.hint":"An unchecked CLI doesn't show in the menu or the sidebar, and its history isn't read.","settings.cli.install":"How to install it","settings.cli.notInstalled":"Not installed","settings.cli.restart":"Changes to the CLIs apply when you restart the app.","settings.console.auto":"Automatic","settings.console.autoWith":"Automatic ({{shell}})","settings.console.hint":"For consoles you open from now on; the open ones keep theirs.","settings.hiddenHint":"Hidden: {{name}}. You can show it again from ⚙ Settings.","settings.hide.console":"Hide the console (it comes back from ⚙ Settings)","settings.hide.notes":"Hide the notes (they come back from ⚙ Settings)","settings.hostOnly":"The console and the CLIs can only be changed on the computer running Agent Workbench.","settings.language":"Language","settings.more.open":"{{name}}…","settings.oldServer":"The server is from an older version: restart it to choose the console and the CLIs.","settings.open":"Settings","settings.panels.cliAlways":"The CLI tab is always shown: the agent's permissions and questions appear there.","settings.panels.consoleConfirmYes":"Hide and close","settings.panels.consoleConfirm_one":"Hiding the console closes {{count}} open terminal.","settings.panels.consoleConfirm_other":"Hiding the console closes {{count}} open terminals.","settings.section.appearance":"Appearance","settings.section.clis":"CLIs","settings.section.console":"Console","settings.section.more":"More","settings.section.panels":"Panels","settings.terminalTheme":"Terminal theme","settings.terminalTheme.dark":"Always dark","settings.terminalTheme.follow":"Follow the app's theme","settings.terminalTheme.hint":"CLIs pick their colors for a dark terminal: on a light one, some text is hard to read.","settings.title":"Settings","shortcuts.altNumber":"<strong>Alt + number</strong> isn't used either, on purpose: on Windows, Alt with the numeric keypad is how you type characters that aren't on the keyboard (<kbd>Alt + 164</kbd> = ñ). Intercepting it breaks typing accented characters. To switch tabs there are <kbd>Alt + ←</kbd> and <kbd>Alt + →</kbd>.","shortcuts.app.closeTab":"Close the active tab","shortcuts.app.newTab":"New tab in the current tab's directory","shortcuts.app.previousTab":"Go back to the previous tab (outside the terminal: inside, it goes to the CLI)","shortcuts.app.switchTab":"Previous / next tab (also Alt + PgUp / PgDn)","shortcuts.app.togglePanel":"Show or hide the right panel","shortcuts.ariaLabel":"Keyboard shortcuts","shortcuts.browserReserved":"<strong>Ctrl+T</strong>, <strong>Ctrl+W</strong> and <strong>Ctrl+Tab</strong> can't be used: the browser keeps them for its own tabs and the event never reaches the page.","shortcuts.cliHint":"The CLI handles these. The app doesn't intercept them: they reach it as they are. In the terminal, a new line is still <kbd>Ctrl + J</kbd> and images are pasted with <kbd>Alt + V</kbd>; the message box is the one with the keys above.","shortcuts.section.app":"Application","shortcuts.section.cli":"CLI, inside the terminal","shortcuts.section.composer":"In the message box","shortcuts.title":"Shortcuts","sidebar.action.archive":"Archive","sidebar.action.restore":"Restore","sidebar.action.undo":"Undo","sidebar.archived.hide_one":"Hide {{count}} archived","sidebar.archived.hide_other":"Hide {{count}} archived","sidebar.archived.show_one":"Show {{count}} archived","sidebar.archived.show_other":"Show {{count}} archived","sidebar.archived.toggleTitle":"Archived sessions stay on disk; this only shows or hides them","sidebar.empty.noMatch":"Nothing matches the filter.","sidebar.empty.noProjects":"No projects found in the history.","sidebar.hide":"Hide the projects","sidebar.history.button":"Archive history…","sidebar.history.buttonTitle":"Hide a CLI's sessions from before today in one go. Nothing is deleted","sidebar.history.confirm_one":"{{count}} {{label}} session will be hidden; nothing is deleted","sidebar.history.confirm_other":"{{count}} {{label}} sessions will be hidden; nothing is deleted","sidebar.history.count_one":"{{count}} session from before today","sidebar.history.count_other":"{{count}} sessions from before today","sidebar.history.heading":"Archive everything before today","sidebar.history.region":"Archive history","sidebar.indexing":"Indexing {{scanned}} / {{total}}","sidebar.newProject":"New project: choose or create a folder","sidebar.project.archive":"Archive project","sidebar.project.archiveTitle":"Archive the project: hides its conversations from the sidebar. Nothing is deleted","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.reindex":"Reindex the history","sidebar.searchMode.label":"Where to search","sidebar.searchMode.titlesTitle":"Filters the list by project name and session title","sidebar.selection.count_one":"{{count}} selected","sidebar.selection.count_other":"{{count}} selected","sidebar.session.archive":"Archive — hides it from the list, nothing is deleted","sidebar.session.blocked":"It has an open tab. Close it first.","sidebar.session.restore":"Restore to the list","sidebar.undo.dismissTitle":"Dismiss the notice; the sessions stay archived","sidebar.undo.text_one":"Archived {{count}} session from {{what}}","sidebar.undo.text_other":"Archived {{count}} sessions from {{what}}","sidebar.vaultLine.lastError":"Last error: {{error}}","sidebar.vaultLine.title":"See the backup's status and folder","sound.notify.blocked":"The browser is blocking this page's notifications. Allow them in the site's settings and click again.","sound.notify.off":"System notifications off — click to turn them on","sound.notify.on":"System notifications on — click to turn them off. They only show when this window isn't in view.","sound.off":"Notification sound muted — click to turn it on","sound.on":"Notification sound on — click to mute","sound.volume":"Notification sound volume","statusLine.benefit":"With the status line configured, this CLI's tabs show their status, the “waiting” bar when it asks for permission to use a tool, and the context meter with the exact window. Without it there's no way to know: the CLI doesn't leave it in any other file.","statusLine.check":"Check","statusLine.checkHint":"The app also notices on its own within a couple of seconds.","statusLine.checking":"Checking…","statusLine.copied":"Copied","statusLine.copy":"Copy","statusLine.copyTitle":"Copy the line to the clipboard","statusLine.lineSection":"The line","statusLine.mergeHint":"Merge it with what the file below already has, without replacing it: if it already has braces, add only the <kbd>statusLine</kbd> key.","statusLine.runsEverywhere":"With the line in place, every CLI session runs it, including the ones you open outside the app, and it needs <kbd>node</kbd> in the PATH.","statusLine.scriptHint":"It only saves the status, model and tokens of each conversation, in the app's folder. It doesn't save your email, your quota or the cost, which the CLI also passes to it, and it doesn't print anything: the CLI's own line stays as it is.","statusLine.scriptSection":"What the script does","statusLine.title":"{{agent}} status line","statusLine.whereHint":"The app doesn't touch that file: you edit it.","statusLine.whereSection":"Where","summary.alsoWorksWith":"Also works with: {{names}}","summary.newerServer":"The server is from a newer version than this page (protocol {{server}}, this page uses {{page}}). Reload the page with F5.","summary.outdatedServer":"The running server is from an older version than this page (protocol {{server}}, this page uses {{page}}). Restart it and reload the page.","support.dismiss":"Not now","support.link":"Support","support.notice":"If Agent Workbench is useful to you, consider supporting it.","tabs.aria.opening":"opening","tabs.aria.working":"working","tabs.close":"Close (Alt+W)","tabs.dot.busy":"The agent is working","tabs.dot.exited":"This tab's CLI has closed","tabs.dot.sleeping":"Sleeping: readable, no CLI open","tabs.dot.waiting":"The CLI is waiting for an answer from you","tabs.new":"New tab (Alt+T)","tabs.state.alive":"active","tabs.state.exited":"exited (code {{code}})","tabs.state.opening":"opening…","tabs.state.sleeping":"sleeping","terminal.exited":"the process exited (code {{code}})","terminal.replayTruncated":"earlier output trimmed","theme.dark":"Dark theme","theme.light":"Light theme","theme.system":"System theme","theme.title":"{{theme}} — click to change","thread.continueWith":"↪ Continue with…","thread.copyMessage":"Copy this message's text","thread.empty.noMessages":"The session doesn't have any messages yet.","thread.empty.unavailable":"This tab doesn't have a known directory, so there's no session file to follow.","thread.empty.waiting":"Waiting for the first message. The session file is created when the conversation starts.","thread.fold.less":"show less","thread.fold.more_one":"show {{count}} line","thread.fold.more_other":"show all {{count}} lines","thread.goToCli":"Go to the CLI tab","thread.image.alt":"message image","thread.image.gone":"the image is no longer in the file","thread.image.loading":"loading image…","thread.image.openTitle":"Click to see it full size","thread.jumpToEnd":"Jump to the end","thread.jumpToEndNew_one":"Jump to the end: {{count}} new message","thread.jumpToEndNew_other":"Jump to the end: {{count}} new messages","thread.jumpToOwn":"Jump to your previous message","thread.loadEarlier":"Load earlier messages","thread.loadingMore":"Loading...","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.openInFiles":"Open {{path}} in the Files tab","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.multi":"multiple","thread.question.pickEach":"Pick an option in each question · you can also answer in the CLI tab","thread.question.pickOne":"Pick an option · you can also answer in the CLI tab","thread.question.placeholder":"Write your answer","thread.question.send":"Send","thread.question.sendAnswers":"Send answers","thread.question.useText":"Use this text","thread.question.writeOther":"Write another answer…","thread.question.writeOtherHint":"To suggest an alternative, or give more context","thread.queue.forceBlocked":"The CLI is waiting for your answer: answer it first","thread.queue.forceSend":"Force send now","thread.queue.forceSendTitle":"The agent stops what it's doing and reads your message now. Use it when it's heading the wrong way","thread.queue.forced":"sent to the agent","thread.queue.forcedTitle":"You forced the send: the CLI is handing it to the agent, and it shows up in the conversation once the CLI records it","thread.queue.forcing":"Sending…","thread.queue.images_one":"+{{count}} image","thread.queue.images_other":"+{{count}} images","thread.queue.label":"queued","thread.queue.labelTitle":"You sent it while the agent was working: the CLI hands it over when the agent can read it","thread.rewind":"Go back to before this message","thread.rewindBusy":"Stop the agent first to go back to before this message","thread.search.next":"Next","thread.search.none":"no results","thread.search.placeholder":"Search the conversation","thread.search.previous":"Previous","thread.status.awaitingReply":"Delivered to the CLI · no reply yet · {{elapsed}}","thread.status.delivered":"Delivered to the CLI","thread.status.sending":"Sending to the CLI…","thread.status.subagent":"{{name}} ({{elapsed}})","thread.status.subagentUnnamed":"unnamed","thread.status.subagentsMore_one":"{{count}} more","thread.status.subagentsMore_other":"{{count}} more","thread.status.subagents_one":"{{count}} subagent still working: {{list}}","thread.status.subagents_other":"{{count}} subagents still working: {{list}}","thread.status.working":"The agent is working…","thread.status.workingDelivered":"The agent is working · message delivered","thread.status.workingFor":"The agent is working · {{elapsed}}","thread.status.workingForDelivered":"The agent is working · {{elapsed}} · message delivered","thread.tool.error":"error","thread.tool.imagesNotSent_one":"({{count}} image: not sent to the panel)","thread.tool.imagesNotSent_other":"({{count}} images: not sent to the panel)","thread.tool.images_one":"{{count}} image","thread.tool.images_other":"{{count}} images","thread.tool.input":"input","thread.tool.noOutput":"(no output)","thread.tool.orphanResult":"orphan result","thread.tool.result":"result","thread.truncated":"… (truncated)","thread.turn.effort":"effort {{effort}}","thread.turn.queued":"sent while it was working","thread.turn.queuedTitle":"You wrote it while the agent was working: it went into the turn already in progress","thread.turn.you":"You","thread.wake.exited":"This tab's CLI closed.","thread.wake.exitedWithCode":"This tab's CLI closed (exit code {{code}}).","thread.wake.open":"Open CLI","thread.wake.opening":"Opening…","thread.wake.sleeping":"You're reading this conversation without the CLI open. Open it to write to the agent.","threadFont.size.l":"large","threadFont.size.m":"normal","threadFont.size.s":"small","threadFont.title":"Font size: {{current}} (click: {{next}})","time.daysAgo":"{{count}} d ago","time.hoursAgo":"{{count}} h ago","time.justNow":"just now","time.minutesAgo":"{{count}} min ago","tools.run.agent_one":"{{count}} subagent","tools.run.agent_other":"{{count}} subagents","tools.run.callsTo_one":"{{count}} call to {{name}}","tools.run.callsTo_other":"{{count}} calls to {{name}}","tools.run.edit_one":"{{count}} edit","tools.run.edit_other":"{{count}} edits","tools.run.find_one":"{{count}} project search","tools.run.find_other":"{{count}} project searches","tools.run.read_one":"{{count}} file read","tools.run.read_other":"{{count}} files read","tools.run.shell_one":"{{count}} console command","tools.run.shell_other":"{{count}} console commands","tools.run.todo_one":"{{count}} to-do list","tools.run.todo_other":"{{count}} to-do lists","tools.run.web_one":"{{count}} search","tools.run.web_other":"{{count}} searches","vault.archived":"Archived sessions aren't copied, and archiving one that was already copied doesn't delete its copy. The app never deletes anything from this folder.","vault.busy":"A backup operation is in progress. Wait for it to finish.","vault.button.off":"Backup: off. Set it up","vault.button.on":"Backup: on. See the status and the folder","vault.dialog.activate":"Turn on","vault.dialog.activateExistingHint":"The folder already has a backup. Once on, it completes it and keeps it up to date.","vault.dialog.activateExistingTitle":"The folder already has a backup: turning it on completes it","vault.dialog.activateMeasuredHint":"Copies everything measured and, after that, every session that changes and stays quiet for a minute.","vault.dialog.activateMeasuredTitle":"Copies what was measured now and, after that, every session that changes","vault.dialog.changeDir":"Change folder…","vault.dialog.changeDirTitle":"Choose another folder. What was copied gets copied there; this one stays untouched","vault.dialog.defaultDir":"It's the default one, in the app's folder.","vault.dialog.folderSection":"Folder","vault.dialog.inFolder":"In the folder","vault.dialog.lastError":"Last error","vault.dialog.lastPass":"last pass {{when}}","vault.dialog.measure":"Measure","vault.dialog.measureAgain":"Measure again","vault.dialog.measureTitle":"Reads the whole history without writing anything, not even the folder","vault.dialog.needsMeasure":"First measure how much it would take: then “{{activate}}” shows up.","vault.dialog.openFolder":"Open folder","vault.dialog.openFolderTitle":"Open the folder in the system's file explorer","vault.dialog.pendingCalm_one":"{{count}} waiting for its quiet minute","vault.dialog.pendingCalm_other":"{{count}} waiting for their quiet minute","vault.dialog.sizeSection":"How much it would take","vault.dialog.table.archived":"Archived","vault.dialog.table.archivedTitle":"Archived sessions aren't copied","vault.dialog.table.images":"Images","vault.dialog.table.memory_one":"Memory of {{count}} project","vault.dialog.table.memory_other":"Memory of {{count}} projects","vault.dialog.table.sessions":"Sessions","vault.dialog.table.size":"Size","vault.dialog.table.total":"Total","vault.dialog.turnOff":"Turn off","vault.dialog.turnOffHint":"Turning it off doesn't delete anything: what was copied stays in the folder.","vault.dialog.waiting":"Waiting for the server's status…","vault.export.done":"Exported: the folder was opened","vault.export.exporting":"Exporting to Markdown…","vault.export.idle":"Export this project's sessions to Markdown","vault.indexNotReady":"The history is still being read. Measure when it's done.","vault.line.copying":"copying","vault.line.copyingProgress":"copying {{done}} / {{total}}","vault.line.measuring":"measuring","vault.line.moving":"moving to another folder","vault.line.neverCopied":"not copied yet","vault.line.pending_one":"{{count}} waiting","vault.line.pending_other":"{{count}} waiting","vault.mark.copy":"backup","vault.mark.copyTitle":"The CLI's history no longer has this session. The backup opens, in Markdown.","vault.mark.partial":"partial","vault.mark.partialTitle":"Only the summary and the documents were recovered: the conversation's content is encrypted.","vault.measure.summary":"Measured {{when}}, in {{duration}}","vault.measure.summaryNoWhen":"Measured in {{duration}}","vault.name":"Backup","vault.note.empty_one":"{{count}} empty","vault.note.empty_other":"{{count}} empty","vault.note.failedWithReasons_one":"{{count}} failed ({{reasons}})","vault.note.failedWithReasons_other":"{{count}} failed ({{reasons}})","vault.note.failed_one":"{{count}} failed","vault.note.failed_other":"{{count}} failed","vault.note.notCopied":"Not copied: {{parts}}","vault.note.unsupported_one":"{{count}} without a full read","vault.note.unsupported_other":"{{count}} without a full read","vault.previousDir":"The previous folder was left untouched: {{dir}}","vault.privacy":"It keeps the same as each CLI's history —messages, tool inputs and results, images— in a folder of yours. If you put it in a synced folder or in a repository, all that travels with it.","vault.sessions_one":"{{count}} session","vault.sessions_other":"{{count}} sessions","vault.state.measuring":"Measuring…","vault.state.measuringProgress":"Measuring… {{done}} / {{total}}","vault.state.moving":"Moving to another folder…","vault.state.off":"Off","vault.state.on":"On","vault.state.writing":"Copying…","vault.state.writingProgress":"Copying… {{done}} / {{total}}","workspace.connectFailed":"Couldn't connect to the local server. Open the URL it printed at startup again."},Fu=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],Dm="en",$c={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},Aw={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Hu={en:"en-US",es:"es-419",de:"de-DE",fr:"fr-FR","pt-BR":"pt-BR",ru:"ru-RU",ja:"ja-JP",ko:"ko-KR","zh-CN":"zh-CN"},Nw={es:()=>rs(()=>import("./es-kfFlJ6C6.js"),[]),de:()=>rs(()=>import("./de-CmDQFS83.js"),[]),fr:()=>rs(()=>import("./fr-CgQRflYh.js"),[]),"pt-BR":()=>rs(()=>import("./pt-BR-Czz2tUjz.js"),[]),ru:()=>rs(()=>import("./ru-Dxhm5BY3.js"),[]),ja:()=>rs(()=>import("./ja-BPlbe60x.js"),[]),ko:()=>rs(()=>import("./ko-DeqZlJbl.js"),[]),"zh-CN":()=>rs(()=>import("./zh-CN-CldKBtQb.js"),[])},Im=Mw,pu=new Map([["en",Im]]),Rf=new Map,mu=new Set;let lo=Dm,gu=Hu[Dm],Mf=0;function jm(n){return Fu.includes(n)}function vu(){return lo}function Xl(){return gu}function Dw(n){return Hu[n]}function Pm(n){return mu.add(n),()=>mu.delete(n)}async function Om(n,t=Hu[n]){const i=++Mf;if(!pu.has(n)&&n!=="en"){const a=await Nw[n]();pu.set(n,a.default)}if(i===Mf&&!(lo===n&&gu===t)){lo=n,gu=t;for(const a of mu)a()}}function Iw(n,t){let i=Rf.get(n);return i===void 0&&(i=new Intl.PluralRules(n),Rf.set(n,i)),i.select(t)}function Af(n,t,i,a){if(a!==void 0){const p=n[`${i}_${Iw(t,a)}`]??n[`${i}_other`];if(p!==void 0)return p}return n[i]}function jw(n,t,i,a){const p=a==null?void 0:a.count,k=typeof p=="number"?p:void 0;return(n===void 0?void 0:Af(n,t,i,k))??Af(Im,"en",i,k)??i}function Pl(n,t){return t===void 0?n:n.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(i,a)=>{const p=t[a];return p===void 0?i:String(p)})}function Bm(n,t){return jw(pu.get(lo),lo,n,t)}function S(n,t){return Pl(Bm(n,t),t)}function Pw(){return[{keys:"Esc",description:S("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:S("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:S("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:S("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:S("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:S("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:S("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:S("agent.shortcuts.codex.searchHistory")},{keys:"@",description:S("agent.shortcuts.codex.mention")},{keys:"/",description:S("agent.shortcuts.commands")},{keys:"Ctrl + G",description:S("agent.shortcuts.codex.externalEditor")}]}function Ow(){return[{keys:"Esc Esc",description:S("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:S("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:S("agent.shortcuts.opencode.commandList")},{keys:S("agent.shortcuts.leaderThen",{key:"M"}),description:S("agent.shortcuts.opencode.model")},{keys:S("agent.shortcuts.leaderThen",{key:"N"}),description:S("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:S("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:S("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:S("agent.shortcuts.opencode.paste")}]}function Bw(){return[{keys:"Esc",description:S("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:S("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:S("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:S("agent.shortcuts.commands")},{keys:"?",description:S("agent.shortcuts.antigravity.help")}]}function Fw(){return[{keys:"Esc",description:S("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:S("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:S("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:S("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:S("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:S("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:S("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:S("agent.shortcuts.pi.newline")},{keys:"!",description:S("agent.shortcuts.pi.bash")},{keys:"/",description:S("agent.shortcuts.commands")}]}function Hw(){return[{keys:"Esc",description:S("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:S("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:S("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:S("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:S("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:S("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:S("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:S("agent.shortcuts.claudeCode.pasteText")}]}const gr={"claude-code":{shortLabel:"CC",get shortcuts(){return Hw()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1},codex:{shortLabel:"CX",get shortcuts(){return Pw()},get shortcutsNote(){return S("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},opencode:{shortLabel:"OC",get shortcuts(){return Ow()},get shortcutsNote(){return S("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},antigravity:{shortLabel:"AG",get shortcuts(){return Bw()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0},pi:{shortLabel:"PI",get shortcuts(){return Fw()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking"}};function $w(n){return(n===null?void 0:gr[n].effortCommand)??Ou}const Uw={"gemini-cli":"GC","antigravity-ide":"AI"};function Ww(n){return li(n)?gr[n].shortLabel:Uw[n]}function po(n,t){var i;return li(n)?((i=t.find(a=>a.id===n))==null?void 0:i.label)??n:L_[n]}const Fm="Sesion sin titulo";function is(n,t){return t==="none"||n===Fm?S("session.untitled"):n}function zw(n,t){const i=new Map;for(const p of t)p.titleSource==="none"||p.title===Fm||i.set(`${p.agent}\0${p.sessionId}`,p.title);const a=new Map;for(const p of n){if(p.agent===null||p.sessionId.length===0)continue;const k=i.get(`${p.agent}\0${p.sessionId}`);k!==void 0&&a.set(p.terminalId,k)}return a}function _u(n){return n.storage==="native"&&li(n.agent)}function qw(n){return n!==null&&gr[n].savesModelChoice}function Vw(n,t,i){if(t!=null)return t;for(let a=n.length-1;a>=0;a-=1){const p=n[a];if(!(p===void 0||p.effort===null))return i===null||p.at>=i?p.effort:null}return null}function Kw(n){return n===null?null:gr[n].instructionsFile}function Gw(n){return{modeCycle:n.permissionCycle,models:n.models,efforts:n.efforts,imagesAllowed:n.imagesByPath!==null,rewind:n.rewind,questionsAnswerable:n.questionCards,fileMentions:n.fileMentions!==null,plansAvailable:n.plans,contextWindowSource:n.contextWindowSource,noteSendable:n.readySignal,forceSend:n.forceSend}}function Yw(n,t){const i=o0(t,n);return i===null?null:n.find(a=>a.value===i.value)??null}function Xw(n,t){return n??t.launchMode}const Qw={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Jw={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function Hm(n){return S(Qw[n])}function Zw(n){return S(Jw[n])}function ey(n,t){return S("agent.mode.title",{mode:Hm(n),hint:Zw(n),key:t.keyLabel})}function $m(n,t){return n.approvesPendingOnCycle&&t!==null}function ty(n,t,i,a){if($m(t,a))return S("agent.mode.blocked");const p=ey(n,t);return!t.approvesPendingOnCycle||i?p:S("agent.mode.titleBlind",{title:p})}const ny={active:"agent.statusLine.state.active",missing:"agent.statusLine.state.missing","other-command":"agent.statusLine.state.otherCommand",disabled:"agent.statusLine.state.disabled",unreadable:"agent.statusLine.state.unreadable"};function sy(n){return S(ny[n])}function ry(){return S("agent.statusLine.noFragment")}function iy(n,t,i=new Set){return n.filter(a=>(t||a.id!=="plans")&&(a.id==="cli"||!i.has(a.id)))}function oy(n,t,i=new Set){return n==="plans"&&!t||n!=="cli"&&i.has(n)?"cli":n}function ly(n,t,i){const a=p=>p===null?void 0:t.find(k=>k.id===p);return a(n)??a(i)??t[0]??null}function ay(n){return[{keys:"Enter",description:S("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:S("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:S(n?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:S("agent.shortcuts.interruptCli")}]}function cy(){return S("agent.composer.imagesRefused")}function uy(n,t,i){return i??(n==="token-count"||n==="status-line"?t.contextWindow:null)}function hy(n,t){return n==="status-line"?t.lastRequestTokens>0:t.assistantMessages>0}function dy(n,t){return n===null&&t!==null&&t.state!=="active"}function fy(n){return S(n==="other-command"?"agent.meter.setup.otherCommand":n==="disabled"?"agent.meter.setup.disabled":n==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function py(n,t){return t.contextWindowEstimated?S("agent.meter.origin.estimated"):n==="usage-with-catalog"&&t.contextWindow!==null?S("agent.meter.origin.catalog"):null}function my(n,t=null){return t==="status-line"?S("agent.meter.idle.statusLine"):n===null?S("agent.meter.idle.noFile"):S("agent.meter.idle.withFile",{file:n})}function gy(n,t=null){return n==="idle"?S("agent.dot.idle"):n==="unknown"?t===null?S("agent.dot.noStatus"):t.state==="active"?S("agent.dot.statusLinePending"):S("agent.dot.statusLineOnly"):S("agent.dot.open")}function Nf(n,t){return n.length===0?!0:n.some(i=>i.id===t&&i.available&&i.capabilities.resume)}function vy(n,t,i){return n?i?S("agent.note.empty"):S("agent.note.send",{cwd:t??""}):S(t===null?"agent.note.needsTab":"agent.note.noReadySignal")}function Um(n,t,i){const a=ii(t,i);let p=null;for(const k of n)k.kind!=="agent"||k.agent===null||ii(k.cwd,i)===a&&(p=k.agent);return p}function Wm(n,t){var a;const i=t.filter(p=>p.available);for(const p of n)if(p!==null&&i.some(k=>k.id===p))return p;return((a=i[0])==null?void 0:a.id)??null}function _y(n){let t=null;for(const i of n){const a=i.agent;li(a)&&(t===null||i.updatedAt>t.updatedAt)&&(t={agent:a,updatedAt:i.updatedAt})}return(t==null?void 0:t.agent)??null}function wy(n,t,i,a,p){return Wm([Um(n,t,i),p],a)}function yy(n,t,i,a,p){return Wm([Um(n,t.cwd,i),_y(t.sessions),p],a)}function zm(n){return n.filter(t=>t.available)}function by(n,t){const i=n.findIndex(a=>a.id===t);return i===-1?0:i}function Sy(n,t,i){return i<=0?0:((n+t)%i+i)%i}function Cy(n,t,i,a=4){const p=n.bottom+2,k=n.top-2-t.height,C=p+t.height+a<=i.height||k<a?Math.max(a,Math.min(p,i.height-t.height-a)):k;return{left:Math.max(a,Math.min(n.left,i.width-t.width-a)),top:C}}function xy(n,t,i){const a=n;return a===null||typeof a!="object"||typeof a.contains!="function"?!0:i!==null&&i.contains(n)?!1:a.contains(t)}function qm(n,t,i=!1){return t===null||i||!Pu(n)?[]:zm(n).filter(a=>a.id!==t)}function ky(){return S("agent.continue.title")}function Ey(n,t,i){return t?S("agent.continue.discovering"):n.length===0?S("agent.continue.noConversation"):i?null:S("agent.continue.noMessages")}function Ly(n,t,i,a){const p=t>=i&&!a?i===1?S("agent.handoff.turns.single"):S("agent.handoff.turns.all",{count:i}):t===1?a?S("agent.handoff.turns.lastOneOfMore",{total:i}):S("agent.handoff.turns.lastOne",{total:i}):a?S("agent.handoff.turns.lastManyOfMore",{count:i,included:t}):S("agent.handoff.turns.lastMany",{count:i,included:t});return S("agent.handoff.notice",{label:n,turns:p})}const Df=40;function If(n){const t=n.replace(/\s+/g," ").trim(),i=[...t],a=i.length>Df?`${i.slice(0,Df).join("").trimEnd()}…`:t;return a.length>0?S("agent.handoff.tabLabel",{title:a}):S("agent.handoff.tabLabelNoTitle")}function Ty(){return S("agent.handoff.sending")}function Ry(n){return n===null?S("agent.queueReturned.noLabel"):S("agent.queueReturned.withLabel",{label:n})}function My(){return S("agent.stoppedEarly")}function Ay(n){switch(n){case"no-delivery":return S("agent.handoff.prefill.noDelivery");case"not-ready":return S("agent.handoff.prefill.notReady");case"send-failed":return S("agent.handoff.prefill.sendFailed")}}function jf(n,t){return n.trim().length===0?t:`${t}
|
|
42
|
+
|
|
43
|
+
${n}`}function Ny(n,t){return n&&t!==null}function Dy(n,t,i){if(!li(n))return{badge:!0,unavailableTitle:null};const a=t.find(C=>C.id===n),p=t.some(C=>C.available),k=a!==void 0&&!a.available&&p;return{badge:i||k,unavailableTitle:k?S("agent.session.cliMissing",{label:a.label}):null}}function Iy(n,t,i){return n!==null&&t===""&&!i.sessionIdAtLaunch}function jy(){return S("agent.thread.noTranscript")}function Py(){return S("agent.thread.discovering")}function Oy(n,t,i,a,p=null){return!a||!pm(n,p)||!t?null:i===null?S("agent.openTool.noLabel"):S("agent.openTool.withLabel",{label:i})}function Vm(n,t=!1){return S(n==="permission prompt"?"agent.waiting.permission":n==="question"&&t?"agent.waiting.question":"agent.waiting.answer")}function By(n){return n.relaunching?"relaunching":n.offlineReason==="server-closed"&&n.alive?"offer":null}function Fy(n){return n===null?S("agent.serverClosed.noLabel"):S("agent.serverClosed.withLabel",{label:n})}function Hy(){return S("agent.serverClosed.relaunch")}function $y(){return S("agent.serverClosed.relaunching")}function Uy(n,t){const i=new Map,a=[];for(const[p,k]of n){const C=t.find(r=>r.terminalId===p);C===void 0||C.alive&&k==="exited"?a.push(p):i.set(p,C.alive?k:"exited")}return{phases:i,finished:a}}function Wy(n,t,i){var a;return!i||t===null||((a=n.permissionCycle)==null?void 0:a.approvesPendingOnCycle)!==!0&&!n.waitingBlocksSubmit?null:Vm(t,n.questionCards)}const zy=2e4;function qy(n){if(n.label.length>0)return n.label;const t=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return t[t.length-1]??n.cwd}function Vy(n,t,i){const a=n.map(k=>({terminalId:k.terminalId,kind:k.kind,cwd:k.cwd})),p=[];for(const k of t){const C=Sw(a.map(r=>r.terminalId),r=>a.find(u=>u.terminalId===r),{cwd:k.cwd},i);p.push({pending:k,index:C,label:qy(k)}),a.splice(C,0,{terminalId:`pending:${k.requestId}`,kind:"agent",cwd:k.cwd})}return p}function Pf(n,t,i){const a=ii(t,i);return n.some(p=>ii(p.cwd,i)===a)}function Km(){return S("agent.openBlocked")}const Ky={off:"controls.effort.off",minimal:"controls.effort.minimal",low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function Gy(n){const t=Ky[n.value];return t===void 0?n.label:S(t)}function Yy(n){return n.value==="default"?S("controls.model.default"):i0(n)}function Xy({models:n,efforts:t,model:i,effort:a,modelProvisional:p=!1,effortProvisional:k=!1,savesChoice:C=!1,effortCommandName:r=Ou,disabled:u,onCommand:v}){const _=n===null?null:Yw(n,i),h=_===null&&i!==null;return l.jsxs(l.Fragment,{children:[n!==null&&l.jsxs("select",{className:"agent-select",value:(_==null?void 0:_.value)??"",disabled:u,onChange:w=>{w.target.value.length>0&&v(a0(w.target.value))},title:i===null?S("controls.model.noData"):p?S("controls.model.provisional",{model:i}):C?S("controls.model.inUseSaved",{model:i}):S("controls.model.inUse",{model:i}),children:[_===null&&l.jsx("option",{value:"",children:h?i??"":S("controls.model.placeholder")}),n.map(w=>l.jsx("option",{value:w.value,children:Yy(w)},w.value))]}),t!==null&&l.jsxs("select",{className:"agent-select",value:a??"",disabled:u,onChange:w=>{w.target.value.length>0&&v(c0(w.target.value,r))},title:a===null?S("controls.effort.noData"):k?S("controls.effort.provisional",{effort:a}):C?S("controls.effort.inUseSaved",{effort:a,command:r}):S("controls.effort.inUse",{effort:a,command:r}),children:[a===null&&l.jsx("option",{value:"",children:S("controls.effort.placeholder")}),t.map(w=>l.jsx("option",{value:w.value,children:Gy(w)},w.value))]})]})}function Qy({mode:n,cycle:t,disabled:i,waitingFor:a=null,statusKnown:p=!0,onChange:k}){const C=Xw(n,t);return l.jsx("select",{className:"agent-select agent-select-mode",value:C,disabled:i||$m(t,a),onChange:r=>{ni(r.target.value)&&k(r.target.value)},title:ty(C,t,p,a),children:t.modes.map(r=>l.jsx("option",{value:r,children:Hm(r)},r))})}function Ul(n){const t=n.replace(/(\r?\n)+$/,"");return t.length===0?0:t.split(`
|
|
44
|
+
`).length}function Jy(n,t){return t===0?S("composer.chip.pastedTextEmpty",{number:n}):S("composer.chip.pastedText",{number:n,count:t})}function Zy(n){return n.length===0?1:Math.max(...n)+1}function e1(n){const t=new Set;for(const i of n.matchAll(Lw()))t.add(Number(i[1]));return[...t].sort((i,a)=>i-a)}const t1=/[^\s([{"'¿¡«]/u,n1=/[\p{L}\p{N}]/u;function s1(n,t,i,a){const{start:p,end:k,before:C,after:r}=Gm(n,t,i),u=`${C!==""&&t1.test(C)?" ":""}${Am(a)}${r!==""&&n1.test(r)?" ":""}`;return Ym(n,p,k,u)}const r1=/[^\s([{¿¡«]/u,i1=/[\p{L}\p{N}"'«]/u;function Of(n,t,i,a){const{start:p,end:k,before:C,after:r}=Gm(n,t,i),u=C!==""&&r1.test(C),v=r===""||i1.test(r),_=`${u?" ":""}${a}${v?" ":""}`;return Ym(n,p,k,_)}function Gm(n,t,i){const a=Math.max(0,Math.min(t,n.length)),p=Math.max(a,Math.min(i,n.length));return{start:a,end:p,before:a>0?n.charAt(a-1):"",after:p<n.length?n.charAt(p):""}}function Ym(n,t,i,a){return{text:`${n.slice(0,t)}${a}${n.slice(i)}`,inserted:a,caret:t+a.length}}function Xm(n,t){const i=new RegExp(`( ?)${a1(Am(t))}( ?)`,"g");return n.replace(i,(a,p,k)=>p!==""&&k!==""?" ":"")}function o1(n,t){let i=t;const a=[];for(const p of n){const k=p.text.replace(/\r\n?/g,`
|
|
45
|
+
`).replace(/\n+$/,"");if(k.trim().length===0){i=Xm(i,p.number);continue}a.push(`${Cw(p.number)}
|
|
46
|
+
${k}
|
|
47
|
+
${xw(p.number)}`)}return i.trim().length>0&&a.push(i),a.join(`
|
|
48
|
+
|
|
49
|
+
`)}function l1(n,t=!1){const i=n.replace(/\r\n?/g,`
|
|
50
|
+
`),a=[],p=u=>{const v=u.replace(/^\n+|\n+$/g,"");v.trim().length>0&&a.push({kind:"text",text:v})};let k=0;for(const u of i.matchAll(kw())){const v=u[1]??"",_=(u.index??0)+v.length;p(i.slice(k,_)),a.push({kind:"pasted",number:Number(u[2]),text:u[3]??"",complete:!0}),k=(u.index??0)+u[0].length}const C=i.slice(k),r=t?Ew().exec(C):null;if(r!==null){const u=r.index+(r[1]??"").length;p(C.slice(0,u)),a.push({kind:"pasted",number:Number(r[2]),text:C.slice(r.index+r[0].length),complete:!1})}else p(C);return a.some(u=>u.kind==="pasted")?a:[{kind:"text",text:n}]}function a1(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const c1=800;function Ol(n){return{text:n.text,pasted:n.items.flatMap(t=>t.kind==="text"?[{number:t.number,text:t.text}]:[])}}function u1(n,t){return{text:n.text,items:n.pasted.map(i=>({id:t(),kind:"text",number:i.number,text:i.text,lines:Ul(i.text)}))}}function h1(n,t){if(t===void 0)return{start:n,end:n,direction:"forward",scrollTop:"end"};const i=k=>Math.min(Math.max(0,k),n),a=i(t.selectionStart),p=Math.max(a,i(t.selectionEnd));return{start:a,end:p,direction:t.backward?"backward":"forward",scrollTop:Math.max(0,t.scrollTop)}}function d1(n){return Sm(Ol(n))>bm}function Zr(n,t){return n===void 0||Fl(n)?Fl(t):Cm(n,t)}const Bf={text:"",pasted:[]};function f1(n,t,i){const a=u1(n,i),p=((t==null?void 0:t.items)??[]).filter(k=>k.kind!=="text");return{text:a.text,items:[...a.items,...p]}}class p1{constructor(t){jt(this,"local",new Map);jt(this,"views",new Map);jt(this,"saved",new Map);jt(this,"heard",new Map);jt(this,"unconfirmed",new Map);jt(this,"submitting",new Map);jt(this,"pending",new Map);jt(this,"listeners",new Set);jt(this,"serverKeeps",!1);this.deps=t}get(t){return this.local.get(t)}put(t,i){this.local.set(t,i),this.schedule(t,Ol(i))}rememberView(t,i){this.views.set(t,i)}viewOf(t){return this.views.get(t)}submitted(t,i){this.cancel(t),this.local.delete(t),this.views.delete(t),this.saved.delete(t),this.unconfirmed.delete(t),this.submitting.set(t,i?"sent":"queued")}restore(t){const i=!this.serverKeeps;this.serverKeeps=!0;const a=[];for(const{terminalId:p,draft:k}of t)this.receive(p,k,i)&&a.push(p);for(const p of a)for(const k of this.listeners)k(p);for(const[p,k]of[...this.pending])k.handle===null&&this.sendNow(p)}reconnected(){this.serverKeeps=!1;for(const[t,i]of[...this.submitting])i==="sent"?this.submitting.delete(t):this.submitting.set(t,"sent")}retain(t){const i=new Set(t);for(const a of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.heard.keys(),...this.unconfirmed.keys(),...this.submitting.keys(),...this.pending.keys()]))i.has(a)||(this.cancel(a),this.local.delete(a),this.views.delete(a),this.saved.delete(a),this.heard.delete(a),this.unconfirmed.delete(a),this.submitting.delete(a))}flushAll(){for(const t of[...this.pending.keys()])this.sendNow(t)}onRestored(t){return this.listeners.add(t),()=>this.listeners.delete(t)}receive(t,i,a){const p=this.heard.get(t);if(this.heard.set(t,i),this.submitting.has(t)){if(!Fl(i))return!1;this.submitting.delete(t)}const k=this.unconfirmed.get(t);if(k!==void 0)if(Zr(k,i))this.unconfirmed.delete(t);else if(a)if(Zr(p,i)){this.unconfirmed.delete(t),this.setSaved(t,i);const v=this.local.get(t);return v!==void 0&&this.schedule(t,Ol(v)),!1}else this.unconfirmed.delete(t);else return!1;const C=this.local.get(t),r=C===void 0?Bf:Ol(C),u=Zr(this.saved.get(t),r);return this.setSaved(t,i),this.pending.has(t)||!u||Zr(i,r)?!1:(this.local.set(t,f1(i,C,this.deps.newId)),this.views.delete(t),!0)}setSaved(t,i){Fl(i)?this.saved.delete(t):this.saved.set(t,i)}schedule(t,i){const a=this.pending.get(t);if(a!==void 0&&Cm(a.draft,i)||(this.cancel(t),Zr(this.saved.get(t),i)))return;const p=this.deps.setTimer(()=>this.sendNow(t),this.deps.delayMs??c1);this.pending.set(t,{handle:p,draft:i})}cancel(t){const i=this.pending.get(t);i!==void 0&&(i.handle!==null&&this.deps.clearTimer(i.handle),this.pending.delete(t))}sendNow(t){const i=this.pending.get(t);if(i===void 0)return;if(i.handle!==null&&this.deps.clearTimer(i.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(t,{handle:null,draft:i.draft});return}this.pending.delete(t);const a=Sm(i.draft)>bm?Bf:i.draft;Zr(this.saved.get(t),a)||(this.deps.send(t,a),this.unconfirmed.set(t,a),this.setSaved(t,a))}}const wu=1024,yu=wu*1024,Ff=yu*1024;function ti(n,t=0){return new Intl.NumberFormat(Xl(),{minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:!1}).format(n)}function _n(n){return!Number.isFinite(n)||n<wu?S("format.bytes.b",{value:ti(Math.max(0,Math.round(n)||0))}):n<yu?S("format.bytes.kb",{value:ti(Math.round(n/wu))}):n<Ff?S("format.bytes.mb",{value:ti(n/yu,1)}):S("format.bytes.gb",{value:ti(n/Ff,2)})}function Qm(n){const t=Math.floor(n/60),i=n%60;return i===0?S("format.duration.minutes",{value:t}):S("format.duration.minutesSeconds",{minutes:t,seconds:i})}function m1(n){if(n<1e3)return S("format.duration.ms",{value:n});const t=Math.round(n/1e3);return t<60?S("format.duration.seconds",{value:t}):Qm(t)}function ao(n){if(!Number.isFinite(n)||n<1e3)return S("format.duration.underSecond");const t=Math.round(n/1e3);return t<60?S("format.duration.seconds",{value:t}):Qm(t)}function os(n,t=Date.now()){if(n<=0)return"";const i=Math.floor((t-n)/6e4);if(i<1)return S("time.justNow");if(i<60)return S("time.minutesAgo",{count:i});const a=Math.floor(i/60);if(a<24)return S("time.hoursAgo",{count:a});const p=Math.floor(a/24);return p<30?S("time.daysAgo",{count:p}):g1(n)}function g1(n){return new Date(n).toLocaleDateString(Xl())}function $u(n){return new Date(n).toLocaleTimeString(Xl(),{hour:"2-digit",minute:"2-digit"})}function Uu(n){return new Intl.ListFormat(Xl(),{type:"conjunction"}).format(n)}var Jm=fm();function Zm({src:n,caption:t,onClose:i}){return N.useEffect(()=>{const a=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),i())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[i]),Jm.createPortal(l.jsxs("div",{className:"viewer",onClick:i,role:"presentation",children:[l.jsx("div",{className:"viewer-frame",onClick:a=>a.stopPropagation(),children:l.jsx("img",{className:"viewer-image",src:n,alt:t})}),l.jsxs("div",{className:"viewer-bar",children:[l.jsx("span",{className:"viewer-caption",children:t}),l.jsx("button",{className:"viewer-close",onClick:i,title:S("common.closeEsc"),children:"×"})]})]}),document.body)}const v1=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,_1=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,w1=/^([ \t]*)([-*•])([ \t]+)/;function Hf(n){const t=v1.exec(n);if(t!==null){const[p,k="",C="",r=".",u=" "]=t;return{kind:"number",indent:k,value:Number(C),upper:!1,sep:r,space:u,length:p.length}}const i=_1.exec(n);if(i!==null){const[p,k="",C="a",r=" "]=i;return{kind:"letter",indent:k,value:C.toLowerCase().charCodeAt(0)-97,upper:C!==C.toLowerCase(),sep:")",space:r,length:p.length}}const a=w1.exec(n);if(a!==null){const[p,k="",C="-",r=" "]=a;return{kind:"bullet",indent:k,value:0,upper:!1,sep:C,space:r,length:p.length}}return null}function $f(n,t){if(n.kind==="bullet")return`${n.indent}${n.sep}${n.space}`;if(n.kind==="number")return`${n.indent}${t}${n.sep}${n.space}`;if(t>25)return null;const i=String.fromCharCode(97+t);return`${n.indent}${n.upper?i.toUpperCase():i}${n.sep}${n.space}`}function y1(n,t){return n.kind===t.kind&&n.indent===t.indent&&n.sep===t.sep&&n.upper===t.upper}function b1(n,t,i){if(t!==i)return null;const a=n.lastIndexOf(`
|
|
51
|
+
`,t-1)+1,p=n.indexOf(`
|
|
52
|
+
`,t),k=p===-1?n.length:p,C=n.slice(a,k),r=Hf(C);if(r===null||t-a<r.length)return null;if(C.slice(r.length).trim().length===0)return{from:a,to:k,text:"",caret:a};const u=$f(r,r.value+1);if(u===null)return null;let v="",_=k;if(r.kind!=="bullet"){let h=r.value+1;for(;_<n.length;){const w=_+1,E=n.indexOf(`
|
|
53
|
+
`,w),R=E===-1?n.length:E,g=n.slice(w,R),c=Hf(g);if(c===null||!y1(r,c)||c.value!==h)break;const f=$f(c,c.value+1);if(f===null)break;v+=`
|
|
54
|
+
${f}${g.slice(c.length)}`,h+=1,_=R}}return{from:t,to:_,text:`
|
|
55
|
+
${u}${n.slice(t,k)}${v}`,caret:t+1+u.length}}const S1=768,C1=`(max-width: ${S1}px)`,x1="(hover: none)",Uf="agent-workbench.narrow-view",eg="tab",tg=["chat","cli","git","files","plans","memory","notes","console"];function k1(n){return typeof n=="string"&&tg.includes(n)}function E1(n){return k1(n)?n:null}function L1(n){const t=n.hidden??new Set,i=a=>a==="chat"||a==="cli"||!t.has(a);return n.hasTab?tg.filter(a=>(a!=="plans"||n.plansAvailable)&&i(a)):["chat","notes"].filter(i)}function T1(n,t){return t.includes(n)?n:"chat"}function Wf(n){switch(n){case"cli":case"git":case"files":case"plans":case"memory":return n;default:return null}}const R1={chat:"narrow.view.chat",cli:"panel.tab.cli",git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",notes:"notes.name",console:"console.name"};function M1(n){return R1[n]}const A1=/^[A-Za-z0-9_-]{1,80}$/;function N1(n){const t=new URLSearchParams(n).get(eg);return t!==null&&A1.test(t)?t:null}function D1(n,t){const i=new URLSearchParams(n);for(const p of t)i.delete(p);const a=i.toString();return a.length>0?`?${a}`:""}const I1=[{id:"esc",label:"Esc",data:"\x1B",titleKey:"narrow.keys.esc"},{id:"tab",label:"Tab",data:" ",titleKey:"narrow.keys.tab"},{id:"shift-tab",label:"⇧Tab",data:"\x1B[Z",titleKey:"narrow.keys.shiftTab"},{id:"up",label:"↑",data:"\x1B[A",titleKey:"narrow.keys.up"},{id:"down",label:"↓",data:"\x1B[B",titleKey:"narrow.keys.down"},{id:"left",label:"←",data:"\x1B[D",titleKey:"narrow.keys.left"},{id:"right",label:"→",data:"\x1B[C",titleKey:"narrow.keys.right"},{id:"interrupt",label:"^C",data:"",titleKey:"narrow.keys.interrupt"},{id:"ctrl-o",label:"^O",data:"",titleKey:"narrow.keys.ctrlO"},{id:"ctrl-x",label:"^X",data:"",titleKey:"narrow.keys.ctrlX"}];function j1(n,t){return n.shiftKey||n.altKey?!1:!t||n.ctrlKey||n.metaKey}const P1="AgentWorkbenchAndroid/",O1="agentworkbench://settings",B1="agentworkbench://disconnect",zf="agentWorkbenchBack";function ng(n){return n.includes(P1)}function F1(n){return n.dialogOpen?"close-dialog":n.sheetOpen?"close-sheet":n.drawerOpen?"close-drawer":n.view!=="chat"?"show-chat":null}const H1=6e4,$1=10*6e4,U1=15e3,W1=4e3,z1=3,sg={runStartedAt:null,busySeenAt:null};function q1(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function V1(n,t){var a;let i=0;if(n!==null){const p=t.findIndex(k=>k.eventId===n);if(p===-1)return!0;i=p+1}for(let p=i;p<t.length;p+=1)if(((a=t[p])==null?void 0:a.role)==="assistant")return!0;return!1}function K1(n,t,i,a){const p=t==="busy"||n==="busy"?a:i.busySeenAt;let k=null;return t==="busy"?n==="idle"?k=a:(n==="busy"||n==="waiting")&&(k=i.runStartedAt):t==="waiting"&&(k=i.runStartedAt),{runStartedAt:k,busySeenAt:p}}function G1(n,t,i,a){const p=new Map;for(const[k,C]of t){const r=n.get(k),u=i.get(k);p.set(k,u!==void 0&&r===C?u:K1(r,C,u??sg,a))}return p}function Y1(n,t){const i=new Map;for(const[a,p]of n)p.phase!=="sending"?i.set(a,p):p.queued&&i.set(a,{...p,queued:!1,sentAt:t});return i}function X1(n,t,i){const a=n.get(t.terminalId);if(a===void 0||a.requestId!==t.requestId)return n;const p=new Map(n);return t.delivered?p.set(t.terminalId,{...a,phase:"delivered",queued:!1,deliveredAt:i}):p.delete(t.terminalId),p}function Q1(n){if(!n.live||n.waitingFor!==null)return null;const{receipt:t,activity:i,now:a}=n,p=n.clock??sg;if((t==null?void 0:t.phase)==="sending"&&(t.queued||a-t.sentAt<H1))return{kind:"sending"};const k=(t==null?void 0:t.phase)==="delivered"?t.deliveredAt:null;return i==="busy"?{kind:"working",since:p.runStartedAt,justDelivered:k!==null&&a-k<W1}:t===null||k===null||V1(t.afterEventId,n.events)?null:i==="unknown"?a-k<$1?{kind:"awaiting-reply",since:k}:null:i!=="idle"&&i!==null||p.busySeenAt!==null&&p.busySeenAt>=t.sentAt?null:a-k<U1?{kind:"delivered"}:null}function J1(n,t){switch(n.kind){case"sending":return S("thread.status.sending");case"delivered":return S("thread.status.delivered");case"working":{const i=n.since===null?0:t-n.since;if(i<1e3)return n.justDelivered?S("thread.status.workingDelivered"):S("thread.status.working");const a={elapsed:ao(i)};return n.justDelivered?S("thread.status.workingForDelivered",a):S("thread.status.workingFor",a)}case"awaiting-reply":{const i=t-n.since;return i<1e3?S("thread.status.delivered"):S("thread.status.awaitingReply",{elapsed:ao(i)})}}}function Z1(n,t){const i=n.slice(0,z1).map(p=>S("thread.status.subagent",{name:p.description.length>0?p.description:S("thread.status.subagentUnnamed"),elapsed:ao(Math.max(0,t-p.startedAt))})),a=n.length-i.length;return a>0&&i.push(S("thread.status.subagentsMore",{count:a})),S("thread.status.subagents",{count:n.length,list:Uu(i)})}const eb=5,tb=1200;function Uc(){return crypto.randomUUID()}function nb(n=!0){const[t,i]=N.useState([]),[a,p]=N.useState(null),k=N.useCallback(R=>{if(t.filter(c=>c.kind==="image").length>=Bc){p(S("composer.problem.tooManyImages",{count:Bc}));return}if(R.size>$l){const c=Math.round(R.size/1024/1024),f=$l/1024/1024;p(R.name.length>0?S("composer.problem.tooBig",{name:R.name,size:c,max:f}):S("composer.problem.imageTooBig",{size:c,max:f}));return}const g=new FileReader;g.onload=()=>{const c=g.result;if(typeof c!="string")return;const f=c.indexOf(",");f!==-1&&i(m=>m.filter(d=>d.kind==="image").length>=Bc?m:[...m,{id:Uc(),kind:"image",mediaType:R.type,base64:c.slice(f+1),dataUrl:c,bytes:R.size,name:R.name.length>0?R.name:S("composer.pastedImage")}])},g.onerror=()=>p(S("composer.problem.imageUnreadable")),g.readAsDataURL(R)},[t]),C=N.useCallback(R=>{if(t.filter(c=>c.kind==="file").length>=Fc){p(S("composer.problem.tooManyFiles",{count:Fc}));return}if(R.size===0){p(S("composer.problem.empty",{name:R.name}));return}if(R.size>Cf){p(S("composer.problem.tooBig",{name:R.name,size:Math.round(R.size/1024/1024),max:Cf/1024/1024}));return}const g=new FileReader;g.onload=()=>{const c=g.result;if(typeof c!="string")return;const f=c.indexOf(",");f!==-1&&i(m=>m.filter(d=>d.kind==="file").length>=Fc?m:[...m,{id:Uc(),kind:"file",name:R.name.length>0?R.name:"archivo",base64:c.slice(f+1),bytes:R.size}])},g.onerror=()=>p(S("composer.problem.unreadable",{name:R.name})),g.readAsDataURL(R)},[t]),r=N.useCallback(R=>{const g=Array.from(R),c=g.filter(m=>m.type.startsWith("image/")),f=g.filter(m=>!m.type.startsWith("image/"));if(c.length>0&&!n)p(cy());else for(const m of c)k(m);for(const m of f)C(m)},[k,C,n]),u=N.useCallback((R,g=[])=>{if(R.files.length>0)return r(R.files),{consumed:!0,pastedNumber:null};const c=R.getData("text/plain");if(c.length===0)return{consumed:!1,pastedNumber:null};if(c.split(`
|
|
56
|
+
`).length<eb&&c.length<tb)return{consumed:!1,pastedNumber:null};const f=Zy([...t.flatMap(m=>m.kind==="text"?[m.number]:[]),...g]);return i(m=>[...m,{id:Uc(),kind:"text",number:f,text:c,lines:Ul(c)}]),{consumed:!0,pastedNumber:f}},[r,t]),v=N.useCallback(R=>{i(g=>g.filter(c=>c.id!==R))},[]),_=N.useCallback((R,g)=>{i(c=>c.map(f=>f.id===R&&f.kind==="text"?{...f,text:g,lines:Ul(g)}:f))},[]),h=N.useCallback(R=>{i(R),p(null)},[]),w=N.useCallback(()=>h([]),[h]),E=N.useCallback(()=>p(null),[]);return{items:t,problem:a,acceptPaste:u,acceptFiles:r,remove:v,updateText:_,replace:h,clear:w,dismissProblem:E}}function Bl({min:n,max:t,value:i,measure:a,onChange:p,onCommit:k,onStart:C}){const r=N.useRef(!1),u=N.useRef(i),v=N.useCallback(w=>{r.current=!0,u.current=i,C==null||C(w),w.currentTarget.setPointerCapture(w.pointerId),w.preventDefault()},[C,i]),_=N.useCallback(w=>{if(!r.current)return;const E=Math.min(t,Math.max(n,a(w)));u.current=E,p(E)},[t,n,a,p]),h=N.useCallback(w=>{r.current&&(r.current=!1,w.currentTarget.releasePointerCapture(w.pointerId),k(u.current))},[k]);return{onPointerDown:v,onPointerMove:_,onPointerUp:h,onPointerCancel:h}}function rg(n){const[t,i]=N.useState(()=>typeof window<"u"&&window.matchMedia(n).matches);return N.useEffect(()=>{const a=window.matchMedia(n),p=()=>i(a.matches);return p(),a.addEventListener("change",p),()=>a.removeEventListener("change",p)},[n]),t}function sb(){return rg(C1)}function rb(){return rg(x1)}const ig="agent_workbench_prefs",bu="agent-workbench.",og=/^[a-z0-9][a-z0-9.-]{0,59}$/,lg=200,ib=400*24*60*60,ob=3500;function lb(n){const t=new Map;for(const i of n.split(";")){const a=i.indexOf("=");if(a===-1||i.slice(0,a).trim()!==ig)continue;let p;try{p=JSON.parse(decodeURIComponent(i.slice(a+1).trim()))}catch{return t}if(p===null||typeof p!="object"||Array.isArray(p))return t;for(const[k,C]of Object.entries(p))!og.test(k)||typeof C!="string"||C.length>lg||t.set(`${bu}${k}`,C);return t}return t}function ab(n){const t={};for(const[a,p]of n){if(!a.startsWith(bu))continue;const k=a.slice(bu.length);!og.test(k)||p.length>lg||(t[k]=p)}const i=encodeURIComponent(JSON.stringify(t));return i.length>ob?null:i}function cb(n){return`${ig}=${n}; Path=/; Max-Age=${ib}; SameSite=Strict`}function ag(){try{return lb(document.cookie)}catch{return new Map}}function cg(n,t){const i=ag();if(i.get(n)===t)return;i.set(n,t);const a=ab(i);if(a!==null)try{document.cookie=cb(a)}catch{}}function xt(n,t,i){const a=ag().get(n);if(a!==void 0){const p=i(a);if(p!==null)return p}try{const p=window.localStorage.getItem(n);if(p===null)return t;const k=i(p);return k===null?t:(a===void 0&&cg(n,p),k)}catch{return t}}function wt(n,t){cg(n,t);try{window.localStorage.setItem(n,t)}catch{}}function ub(n,t,i){const a=Number.parseInt(n,10);return Number.isFinite(a)&&a>=t&&a<=i?a:null}const qf=90,hb=260,Vf=720,Kf="agent-workbench.composer-height";function Gf(n){return{selectionStart:n.selectionStart,selectionEnd:n.selectionEnd,backward:n.selectionDirection==="backward",scrollTop:n.scrollTop}}function db({connection:n,drafts:t,terminalId:i,alive:a,sleeping:p=!1,projectColor:k,activity:C,controls:r,leading:u,imagesAllowed:v=!0,blockedReason:_=null,prefills:h,onPrefillApplied:w,notice:E=null,onDismissNotice:R,onSubmitted:g,fontSize:c,insertRef:f}){const[m,d]=N.useState(""),[L,I]=N.useState(!1),x=nb(v),M=N.useRef(null),b=rb(),[T,D]=N.useState(()=>xt(Kf,hb,oe=>ub(oe,qf,Vf))),[B,O]=N.useState(!1),F=N.useCallback(()=>{const oe=M.current;if(oe===null)return;oe.style.height="auto";const ue=oe.offsetHeight-oe.clientHeight,de=oe.scrollHeight+ue,Me=B?T:Math.min(de,T);oe.style.height=`${Me}px`,oe.style.overflowY=de>Me?"auto":"hidden"},[T,B]);N.useEffect(F,[m,F,c]);const U=N.useRef(0),q=N.useRef(0),G=Bl({min:qf,max:Vf,value:T,measure:N.useCallback(oe=>U.current-oe.clientY-q.current,[]),onChange:D,onCommit:N.useCallback(oe=>{O(!1),wt(Kf,String(oe))},[]),onStart:N.useCallback(oe=>{const ue=M.current,de=ue==null?void 0:ue.getBoundingClientRect();U.current=(de==null?void 0:de.bottom)??oe.clientY,q.current=((de==null?void 0:de.bottom)??oe.clientY)-oe.clientY-((de==null?void 0:de.height)??0),O(!0)},[])}),Y=N.useRef(null),[W,j]=N.useState(0),$=N.useCallback(()=>j(oe=>oe+1),[]),H=N.useRef(m);H.current=m;const V=N.useRef(x.items);V.current=x.items;const{replace:te}=x;N.useEffect(()=>{const oe=Y.current;oe!==null&&t.put(oe,{text:m,items:x.items})},[m,x.items,t]),N.useEffect(()=>{var de;const oe=Y.current;if(oe===i)return;if(Y.current=i,oe!==null){t.put(oe,{text:H.current,items:V.current});const Me=M.current;Me!==null&&t.rememberView(oe,Gf(Me))}const ue=i===null?void 0:t.get(i);d((ue==null?void 0:ue.text)??""),te((ue==null?void 0:ue.items)??[]),$(),i!==null&&((de=M.current)==null||de.focus())},[i,te,t,$]),N.useEffect(()=>()=>{const oe=Y.current;oe!==null&&t.put(oe,{text:H.current,items:V.current})},[t]),N.useLayoutEffect(()=>()=>{const oe=Y.current,ue=M.current;oe!==null&&ue!==null&&t.rememberView(oe,Gf(ue))},[t]),N.useEffect(()=>{if(W===0)return;const oe=Y.current,ue=M.current;if(oe===null||ue===null)return;const de=h1(ue.value.length,t.viewOf(oe));ue.setSelectionRange(de.start,de.end,de.direction),ue.scrollTop=de.scrollTop==="end"?ue.scrollHeight:de.scrollTop},[W,t]),N.useEffect(()=>t.onRestored(oe=>{if(oe!==Y.current)return;const ue=t.get(oe);ue!==void 0&&(d(ue.text),te(ue.items),$())}),[t,te,$]);const ie=N.useRef(new Set);N.useEffect(()=>{if(!(h===void 0||h.length===0)){for(const oe of h)if(!ie.current.has(oe.id)){if(ie.current.add(oe.id),oe.terminalId===Y.current)d(ue=>jf(ue,oe.text));else{const ue=t.get(oe.terminalId);t.put(oe.terminalId,{text:jf((ue==null?void 0:ue.text)??"",oe.text),items:(ue==null?void 0:ue.items)??[]})}w==null||w(oe.id)}}},[h,w,t]);const pe=N.useCallback(()=>{if(i===null||_!==null)return;const oe=x.items.filter(Ue=>Ue.kind==="text").map(Ue=>({number:Ue.number,text:Ue.text})),ue=x.items.filter(Ue=>Ue.kind==="image").map(Ue=>({mediaType:Ue.mediaType,data:Ue.base64})),de=x.items.filter(Ue=>Ue.kind==="file").map(Ue=>({name:Ue.name,data:Ue.base64})),Me=o1(oe,m);if(Me.length===0&&ue.length===0&&de.length===0)return;const Re=q1(),Ke=n.send({type:"agent.submit",terminalId:i,text:Me,images:ue,...de.length>0?{files:de}:{},requestId:Re});t.submitted(i,Ke),d(""),x.clear(),g==null||g(i,Re,!Ke)},[n,t,i,m,x,_,g]),me=N.useCallback(()=>{i!==null&&n.send({type:"agent.interrupt",terminalId:i})},[n,i]),X=N.useCallback((oe,ue)=>{oe.setSelectionRange(ue.from,ue.to);let de=!1;try{de=ue.text.length>0?document.execCommand("insertText",!1,ue.text):document.execCommand("delete")}catch{de=!1}de||(oe.setRangeText(ue.text,ue.from,ue.to,"end"),d(oe.value)),oe.setSelectionRange(ue.caret,ue.caret)},[]),K=N.useCallback(oe=>{if(oe.key==="Enter"&&j1(oe,b)){oe.preventDefault(),pe();return}if(oe.key==="Enter"&&!oe.nativeEvent.isComposing){const ue=oe.currentTarget,de=b1(ue.value,ue.selectionStart,ue.selectionEnd);if(de!==null){oe.preventDefault(),X(ue,de);return}}oe.key==="Escape"&&(oe.preventDefault(),me())},[pe,me,b,X]),J=N.useCallback((oe,ue)=>{const{inserted:de}=s1(oe.value,oe.selectionStart,oe.selectionEnd,ue);let Me=!1;try{Me=document.execCommand("insertText",!1,de)}catch{Me=!1}Me||(oe.setRangeText(de,oe.selectionStart,oe.selectionEnd,"end"),d(oe.value))},[]),Z=N.useCallback((oe,ue)=>{const de=M.current;if(de===null||de.disabled){d(Ke=>Of(Ke,Ke.length,Ke.length,oe).text);return}const{inserted:Me}=Of(de.value,de.selectionStart,de.selectionEnd,oe);let Re=!1;if(ue){de.focus();try{Re=document.execCommand("insertText",!1,Me)}catch{Re=!1}}Re||(de.setRangeText(Me,de.selectionStart,de.selectionEnd,"end"),d(de.value))},[]);N.useEffect(()=>{if(f!==void 0)return f.current=Z,()=>{f.current===Z&&(f.current=null)}},[f,Z]);const _e=N.useCallback(oe=>{if(oe.clipboardData===null)return;const ue=x.acceptPaste(oe.clipboardData,e1(oe.currentTarget.value));ue.consumed&&(oe.preventDefault(),ue.pastedNumber!==null&&J(oe.currentTarget,ue.pastedNumber))},[x,J]),ve=N.useCallback(oe=>{x.remove(oe.id),oe.kind==="text"&&d(ue=>Xm(ue,oe.number))},[x]),ye=N.useRef(null),Ee=i===null||!a,fe=m.trim().length>0||x.items.some(oe=>oe.kind!=="text"||oe.text.trim().length>0),Ae=a&&C!=="idle",ne=fe||!Ae,Ie=d1({text:m,items:x.items});return l.jsxs("div",{className:`composer${L?" composer-dragging":""}`,style:k===void 0?void 0:{"--composer-accent":k},onDragOver:oe=>{Array.from(oe.dataTransfer.types).includes("Files")&&(oe.preventDefault(),I(!0))},onDragLeave:()=>I(!1),onDrop:oe=>{oe.preventDefault(),I(!1),x.acceptFiles(oe.dataTransfer.files)},children:[l.jsx("div",{className:"hdivider composer-divider",...G,title:S("composer.resizeTitle")}),E!==null&&l.jsxs("div",{className:"handoff-notice",role:"status",children:[l.jsxs("span",{className:"handoff-notice-text",children:[E.text,E.status!==null&&l.jsx("span",{className:"handoff-notice-status",children:E.status})]}),R!==void 0&&l.jsx("button",{className:"icon-button",onClick:R,title:S("common.dismissNotice"),children:"×"})]}),x.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:x.problem}),l.jsx("button",{className:"icon-button",onClick:x.dismissProblem,title:S("common.close"),children:"×"})]}),Ie&&l.jsx("div",{className:"composer-problem",role:"status",children:l.jsx("span",{children:S("composer.problem.draftTooLong")})}),x.items.length>0&&l.jsx("div",{className:"composer-chips",children:x.items.map(oe=>l.jsx(fb,{item:oe,onRemove:()=>ve(oe),onEdit:ue=>x.updateText(oe.id,ue),onDoneEditing:()=>{var ue;return(ue=M.current)==null?void 0:ue.focus()}},oe.id))}),l.jsxs("div",{className:`composer-field${Ae&&ne?" composer-field-two":""}`,children:[l.jsx("textarea",{ref:M,className:"composer-input",value:m,rows:1,placeholder:S(Ee?p?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Ee,onChange:oe=>d(oe.target.value),onKeyDown:K,onPaste:_e,spellCheck:!1}),l.jsxs("div",{className:"composer-field-actions",children:[Ae&&l.jsx("button",{className:"composer-icon composer-stop",onClick:me,disabled:Ee,title:S("composer.stopTitle"),"aria-label":S("composer.stop"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),ne&&l.jsx("button",{className:"composer-icon composer-send",onClick:pe,disabled:Ee||!fe||_!==null,title:_??S("composer.sendTitle"),"aria-label":S("composer.send"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("input",{ref:ye,type:"file",multiple:!0,hidden:!0,onChange:oe=>{oe.target.files!==null&&x.acceptFiles(oe.target.files),oe.target.value=""}}),l.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var oe;return(oe=ye.current)==null?void 0:oe.click()},disabled:Ee,title:S("composer.attachTitle"),"aria-label":S("composer.attach"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M21.4 11.1 12.3 20.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u,l.jsx("span",{className:"composer-spacer"}),r]})]})}function fb({item:n,onRemove:t,onEdit:i,onDoneEditing:a}){const[p,k]=N.useState(!1);if(n.kind==="image"){const C=`${n.name} · ${_n(n.bytes)}`;return l.jsxs("figure",{className:"chip chip-image",title:C,children:[l.jsx("img",{src:n.dataUrl,alt:n.name,onClick:()=>k(!0)}),l.jsx("button",{className:"chip-remove",onClick:t,title:S("composer.chip.remove"),children:"×"}),p&&l.jsx(Zm,{src:n.dataUrl,caption:C,onClose:()=>k(!1)})]})}return n.kind==="file"?l.jsxs("div",{className:"chip chip-text chip-file",title:`${n.name} · ${_n(n.bytes)}`,children:[l.jsxs("span",{className:"chip-toggle chip-file-label",children:[l.jsx("span",{className:"chip-icon",children:"▤"}),l.jsx("span",{className:"chip-file-name",children:n.name}),l.jsx("span",{className:"chip-file-size",children:_n(n.bytes)})]}),l.jsx("button",{className:"chip-remove",onClick:t,title:S("composer.chip.remove"),children:"×"})]}):l.jsxs("div",{className:`chip chip-text${p?" chip-open":""}`,children:[l.jsxs("button",{className:"chip-toggle",onClick:()=>k(C=>!C),title:S("composer.chip.editHint"),"aria-expanded":p,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),Jy(n.number,n.lines),l.jsx("span",{className:"chip-chevron",children:p?"▾":"▸"})]}),l.jsx("button",{className:"chip-remove",onClick:t,title:S("composer.chip.remove"),children:"×"}),p&&l.jsx("textarea",{className:"chip-editor",value:n.text,onChange:C=>i(C.target.value),onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),k(!1),a())},"aria-label":S("composer.chip.editorLabel",{number:n.number}),spellCheck:!1,autoFocus:!0})]})}var Wc={exports:{}},Yf;function pb(){return Yf||(Yf=1,(function(n,t){(function(i,a){n.exports=a()})(self,(()=>(()=>{var i={};return(()=>{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.FitAddon=class{activate(p){this._terminal=p}dispose(){}fit(){const p=this.proposeDimensions();if(!p||!this._terminal||isNaN(p.cols)||isNaN(p.rows))return;const k=this._terminal._core;this._terminal.rows===p.rows&&this._terminal.cols===p.cols||(k._renderService.clear(),this._terminal.resize(p.cols,p.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const p=this._terminal._core,k=p._renderService.dimensions;if(k.css.cell.width===0||k.css.cell.height===0)return;const C=this._terminal.options.scrollback===0?0:p.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(r.getPropertyValue("height")),v=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),h=u-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),w=v-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-C;return{cols:Math.max(2,Math.floor(w/k.css.cell.width)),rows:Math.max(1,Math.floor(h/k.css.cell.height))}}}})(),i})()))})(Wc)),Wc.exports}var mb=pb(),zc={exports:{}},Xf;function gb(){return Xf||(Xf=1,(function(n,t){(function(i,a){n.exports=a()})(self,(()=>(()=>{var i={6:(C,r)=>{function u(_){try{const h=new URL(_),w=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return _.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(r,"__esModule",{value:!0}),r.LinkComputer=r.WebLinkProvider=void 0,r.WebLinkProvider=class{constructor(_,h,w,E={}){this._terminal=_,this._regex=h,this._handler=w,this._options=E}provideLinks(_,h){const w=v.computeLink(_,this._regex,this._terminal,this._handler);h(this._addCallbacks(w))}_addCallbacks(_){return _.map((h=>(h.leave=this._options.leave,h.hover=(w,E)=>{if(this._options.hover){const{range:R}=h;this._options.hover(w,E,R)}},h)))}};class v{static computeLink(h,w,E,R){const g=new RegExp(w.source,(w.flags||"")+"g"),[c,f]=v._getWindowedLineStrings(h-1,E),m=c.join("");let d;const L=[];for(;d=g.exec(m);){const I=d[0];if(!u(I))continue;const[x,M]=v._mapStrIdx(E,f,0,d.index),[b,T]=v._mapStrIdx(E,x,M,I.length);if(x===-1||M===-1||b===-1||T===-1)continue;const D={start:{x:M+1,y:x+1},end:{x:T,y:b+1}};L.push({range:D,text:I,activate:R})}return L}static _getWindowedLineStrings(h,w){let E,R=h,g=h,c=0,f="";const m=[];if(E=w.buffer.active.getLine(h)){const d=E.translateToString(!0);if(E.isWrapped&&d[0]!==" "){for(c=0;(E=w.buffer.active.getLine(--R))&&c<2048&&(f=E.translateToString(!0),c+=f.length,m.push(f),E.isWrapped&&f.indexOf(" ")===-1););m.reverse()}for(m.push(d),c=0;(E=w.buffer.active.getLine(++g))&&E.isWrapped&&c<2048&&(f=E.translateToString(!0),c+=f.length,m.push(f),f.indexOf(" ")===-1););}return[m,R]}static _mapStrIdx(h,w,E,R){const g=h.buffer.active,c=g.getNullCell();let f=E;for(;R;){const m=g.getLine(w);if(!m)return[-1,-1];for(let d=f;d<m.length;++d){m.getCell(d,c);const L=c.getChars();if(c.getWidth()&&(R-=L.length||1,d===m.length-1&&L==="")){const I=g.getLine(w+1);I&&I.isWrapped&&(I.getCell(0,c),c.getWidth()===2&&(R+=1))}if(R<0)return[w,d]}w++,f=0}return[w,f]}}r.LinkComputer=v}},a={};function p(C){var r=a[C];if(r!==void 0)return r.exports;var u=a[C]={exports:{}};return i[C](u,u.exports,p),u.exports}var k={};return(()=>{var C=k;Object.defineProperty(C,"__esModule",{value:!0}),C.WebLinksAddon=void 0;const r=p(6),u=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function v(_,h){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}C.WebLinksAddon=class{constructor(_=v,h={}){this._handler=_,this._options=h}activate(_){this._terminal=_;const h=this._options,w=h.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new r.WebLinkProvider(this._terminal,w,this._handler,h))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),k})()))})(zc)),zc.exports}var vb=gb(),qc={exports:{}},Qf;function _b(){return Qf||(Qf=1,(function(n,t){(function(i,a){n.exports=a()})(self,(()=>(()=>{var i={965:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GlyphRenderer=void 0;const v=u(374),_=u(509),h=u(855),w=u(859),E=u(381),R=11,g=R*Float32Array.BYTES_PER_ELEMENT;let c,f=0,m=0,d=0;class L extends w.Disposable{constructor(x,M,b,T){super(),this._terminal=x,this._gl=M,this._dimensions=b,this._optionsService=T,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const D=this._gl;_.TextureAtlas.maxAtlasPages===void 0&&(_.TextureAtlas.maxAtlasPages=Math.min(32,(0,v.throwIfFalsy)(D.getParameter(D.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,v.throwIfFalsy)(D.getParameter(D.MAX_TEXTURE_SIZE))),this._program=(0,v.throwIfFalsy)((0,E.createProgram)(D,`#version 300 es
|
|
57
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
58
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
59
|
+
layout (location = 2) in vec2 a_offset;
|
|
60
|
+
layout (location = 3) in vec2 a_size;
|
|
61
|
+
layout (location = 4) in float a_texpage;
|
|
62
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
63
|
+
layout (location = 6) in vec2 a_texsize;
|
|
64
|
+
|
|
65
|
+
uniform mat4 u_projection;
|
|
66
|
+
uniform vec2 u_resolution;
|
|
67
|
+
|
|
68
|
+
out vec2 v_texcoord;
|
|
69
|
+
flat out int v_texpage;
|
|
70
|
+
|
|
71
|
+
void main() {
|
|
72
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
73
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
74
|
+
v_texpage = int(a_texpage);
|
|
75
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
76
|
+
}`,(function(G){let Y="";for(let W=1;W<G;W++)Y+=` else if (v_texpage == ${W}) { outColor = texture(u_texture[${W}], v_texcoord); }`;return`#version 300 es
|
|
77
|
+
precision lowp float;
|
|
78
|
+
|
|
79
|
+
in vec2 v_texcoord;
|
|
80
|
+
flat in int v_texpage;
|
|
81
|
+
|
|
82
|
+
uniform sampler2D u_texture[${G}];
|
|
83
|
+
|
|
84
|
+
out vec4 outColor;
|
|
85
|
+
|
|
86
|
+
void main() {
|
|
87
|
+
if (v_texpage == 0) {
|
|
88
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
89
|
+
} ${Y}
|
|
90
|
+
}`})(_.TextureAtlas.maxAtlasPages))),this.register((0,w.toDisposable)((()=>D.deleteProgram(this._program)))),this._projectionLocation=(0,v.throwIfFalsy)(D.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,v.throwIfFalsy)(D.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,v.throwIfFalsy)(D.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=D.createVertexArray(),D.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),O=D.createBuffer();this.register((0,w.toDisposable)((()=>D.deleteBuffer(O)))),D.bindBuffer(D.ARRAY_BUFFER,O),D.bufferData(D.ARRAY_BUFFER,B,D.STATIC_DRAW),D.enableVertexAttribArray(0),D.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),U=D.createBuffer();this.register((0,w.toDisposable)((()=>D.deleteBuffer(U)))),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,U),D.bufferData(D.ELEMENT_ARRAY_BUFFER,F,D.STATIC_DRAW),this._attributesBuffer=(0,v.throwIfFalsy)(D.createBuffer()),this.register((0,w.toDisposable)((()=>D.deleteBuffer(this._attributesBuffer)))),D.bindBuffer(D.ARRAY_BUFFER,this._attributesBuffer),D.enableVertexAttribArray(2),D.vertexAttribPointer(2,2,D.FLOAT,!1,g,0),D.vertexAttribDivisor(2,1),D.enableVertexAttribArray(3),D.vertexAttribPointer(3,2,D.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(3,1),D.enableVertexAttribArray(4),D.vertexAttribPointer(4,1,D.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(4,1),D.enableVertexAttribArray(5),D.vertexAttribPointer(5,2,D.FLOAT,!1,g,5*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(5,1),D.enableVertexAttribArray(6),D.vertexAttribPointer(6,2,D.FLOAT,!1,g,7*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(6,1),D.enableVertexAttribArray(1),D.vertexAttribPointer(1,2,D.FLOAT,!1,g,9*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(1,1),D.useProgram(this._program);const q=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let G=0;G<_.TextureAtlas.maxAtlasPages;G++)q[G]=G;D.uniform1iv(this._textureLocation,q),D.uniformMatrix4fv(this._projectionLocation,!1,E.PROJECTION_MATRIX),this._atlasTextures=[];for(let G=0;G<_.TextureAtlas.maxAtlasPages;G++){const Y=new E.GLTexture((0,v.throwIfFalsy)(D.createTexture()));this.register((0,w.toDisposable)((()=>D.deleteTexture(Y.texture)))),D.activeTexture(D.TEXTURE0+G),D.bindTexture(D.TEXTURE_2D,Y.texture),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texImage2D(D.TEXTURE_2D,0,D.RGBA,1,1,0,D.RGBA,D.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[G]=Y}D.enable(D.BLEND),D.blendFunc(D.SRC_ALPHA,D.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(x,M,b,T,D,B,O,F,U){this._updateCell(this._vertices.attributes,x,M,b,T,D,B,O,F,U)}_updateCell(x,M,b,T,D,B,O,F,U,q){f=(b*this._terminal.cols+M)*R,T!==h.NULL_CELL_CODE&&T!==void 0?this._atlas&&(c=F&&F.length>1?this._atlas.getRasterizedGlyphCombinedChar(F,D,B,O,!1):this._atlas.getRasterizedGlyph(T,D,B,O,!1),m=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),D!==q&&c.offset.x>m?(d=c.offset.x-m,x[f]=-(c.offset.x-d)+this._dimensions.device.char.left,x[f+1]=-c.offset.y+this._dimensions.device.char.top,x[f+2]=(c.size.x-d)/this._dimensions.device.canvas.width,x[f+3]=c.size.y/this._dimensions.device.canvas.height,x[f+4]=c.texturePage,x[f+5]=c.texturePositionClipSpace.x+d/this._atlas.pages[c.texturePage].canvas.width,x[f+6]=c.texturePositionClipSpace.y,x[f+7]=c.sizeClipSpace.x-d/this._atlas.pages[c.texturePage].canvas.width,x[f+8]=c.sizeClipSpace.y):(x[f]=-c.offset.x+this._dimensions.device.char.left,x[f+1]=-c.offset.y+this._dimensions.device.char.top,x[f+2]=c.size.x/this._dimensions.device.canvas.width,x[f+3]=c.size.y/this._dimensions.device.canvas.height,x[f+4]=c.texturePage,x[f+5]=c.texturePositionClipSpace.x,x[f+6]=c.texturePositionClipSpace.y,x[f+7]=c.sizeClipSpace.x,x[f+8]=c.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,v.allowRescaling)(T,U,c.size.x,this._dimensions.device.cell.width)&&(x[f+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):x.fill(0,f,f+R-1-2)}clear(){const x=this._terminal,M=x.cols*x.rows*R;this._vertices.count!==M?this._vertices.attributes=new Float32Array(M):this._vertices.attributes.fill(0);let b=0;for(;b<this._vertices.attributesBuffers.length;b++)this._vertices.count!==M?this._vertices.attributesBuffers[b]=new Float32Array(M):this._vertices.attributesBuffers[b].fill(0);this._vertices.count=M,b=0;for(let T=0;T<x.rows;T++)for(let D=0;D<x.cols;D++)this._vertices.attributes[b+9]=D/x.cols,this._vertices.attributes[b+10]=T/x.rows,b+=R}handleResize(){const x=this._gl;x.useProgram(this._program),x.viewport(0,0,x.canvas.width,x.canvas.height),x.uniform2f(this._resolutionLocation,x.canvas.width,x.canvas.height),this.clear()}render(x){if(!this._atlas)return;const M=this._gl;M.useProgram(this._program),M.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const b=this._vertices.attributesBuffers[this._activeBuffer];let T=0;for(let D=0;D<x.lineLengths.length;D++){const B=D*this._terminal.cols*R,O=this._vertices.attributes.subarray(B,B+x.lineLengths[D]*R);b.set(O,T),T+=O.length}M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.bufferData(M.ARRAY_BUFFER,b.subarray(0,T),M.STREAM_DRAW);for(let D=0;D<this._atlas.pages.length;D++)this._atlas.pages[D].version!==this._atlasTextures[D].version&&this._bindAtlasPageTexture(M,this._atlas,D);M.drawElementsInstanced(M.TRIANGLE_STRIP,4,M.UNSIGNED_BYTE,0,T/R)}setAtlas(x){this._atlas=x;for(const M of this._atlasTextures)M.version=-1}_bindAtlasPageTexture(x,M,b){x.activeTexture(x.TEXTURE0+b),x.bindTexture(x.TEXTURE_2D,this._atlasTextures[b].texture),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,M.pages[b].canvas),x.generateMipmap(x.TEXTURE_2D),this._atlasTextures[b].version=M.pages[b].version}setDimensions(x){this._dimensions=x}}r.GlyphRenderer=L},742:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RectangleRenderer=void 0;const v=u(374),_=u(859),h=u(310),w=u(381),E=8*Float32Array.BYTES_PER_ELEMENT;class R{constructor(){this.attributes=new Float32Array(160),this.count=0}}let g=0,c=0,f=0,m=0,d=0,L=0,I=0;class x extends _.Disposable{constructor(b,T,D,B){super(),this._terminal=b,this._gl=T,this._dimensions=D,this._themeService=B,this._vertices=new R,this._verticesCursor=new R;const O=this._gl;this._program=(0,v.throwIfFalsy)((0,w.createProgram)(O,`#version 300 es
|
|
91
|
+
layout (location = 0) in vec2 a_position;
|
|
92
|
+
layout (location = 1) in vec2 a_size;
|
|
93
|
+
layout (location = 2) in vec4 a_color;
|
|
94
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
95
|
+
|
|
96
|
+
uniform mat4 u_projection;
|
|
97
|
+
|
|
98
|
+
out vec4 v_color;
|
|
99
|
+
|
|
100
|
+
void main() {
|
|
101
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
102
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
103
|
+
v_color = a_color;
|
|
104
|
+
}`,`#version 300 es
|
|
105
|
+
precision lowp float;
|
|
106
|
+
|
|
107
|
+
in vec4 v_color;
|
|
108
|
+
|
|
109
|
+
out vec4 outColor;
|
|
110
|
+
|
|
111
|
+
void main() {
|
|
112
|
+
outColor = v_color;
|
|
113
|
+
}`)),this.register((0,_.toDisposable)((()=>O.deleteProgram(this._program)))),this._projectionLocation=(0,v.throwIfFalsy)(O.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=O.createVertexArray(),O.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),U=O.createBuffer();this.register((0,_.toDisposable)((()=>O.deleteBuffer(U)))),O.bindBuffer(O.ARRAY_BUFFER,U),O.bufferData(O.ARRAY_BUFFER,F,O.STATIC_DRAW),O.enableVertexAttribArray(3),O.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const q=new Uint8Array([0,1,2,3]),G=O.createBuffer();this.register((0,_.toDisposable)((()=>O.deleteBuffer(G)))),O.bindBuffer(O.ELEMENT_ARRAY_BUFFER,G),O.bufferData(O.ELEMENT_ARRAY_BUFFER,q,O.STATIC_DRAW),this._attributesBuffer=(0,v.throwIfFalsy)(O.createBuffer()),this.register((0,_.toDisposable)((()=>O.deleteBuffer(this._attributesBuffer)))),O.bindBuffer(O.ARRAY_BUFFER,this._attributesBuffer),O.enableVertexAttribArray(0),O.vertexAttribPointer(0,2,O.FLOAT,!1,E,0),O.vertexAttribDivisor(0,1),O.enableVertexAttribArray(1),O.vertexAttribPointer(1,2,O.FLOAT,!1,E,2*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(1,1),O.enableVertexAttribArray(2),O.vertexAttribPointer(2,4,O.FLOAT,!1,E,4*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(2,1),this._updateCachedColors(B.colors),this.register(this._themeService.onChangeColors((Y=>{this._updateCachedColors(Y),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(b){const T=this._gl;T.useProgram(this._program),T.bindVertexArray(this._vertexArrayObject),T.uniformMatrix4fv(this._projectionLocation,!1,w.PROJECTION_MATRIX),T.bindBuffer(T.ARRAY_BUFFER,this._attributesBuffer),T.bufferData(T.ARRAY_BUFFER,b.attributes,T.DYNAMIC_DRAW),T.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,T.UNSIGNED_BYTE,0,b.count)}handleResize(){this._updateViewportRectangle()}setDimensions(b){this._dimensions=b}_updateCachedColors(b){this._bgFloat=this._colorToFloat32Array(b.background),this._cursorFloat=this._colorToFloat32Array(b.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(b){const T=this._terminal,D=this._vertices;let B,O,F,U,q,G,Y,W,j,$,H,V=1;for(B=0;B<T.rows;B++){for(F=-1,U=0,q=0,G=!1,O=0;O<T.cols;O++)Y=(B*T.cols+O)*h.RENDER_MODEL_INDICIES_PER_CELL,W=b.cells[Y+h.RENDER_MODEL_BG_OFFSET],j=b.cells[Y+h.RENDER_MODEL_FG_OFFSET],$=!!(67108864&j),(W!==U||j!==q&&(G||$))&&((U!==0||G&&q!==0)&&(H=8*V++,this._updateRectangle(D,H,q,U,F,O,B)),F=O,U=W,q=j,G=$);(U!==0||G&&q!==0)&&(H=8*V++,this._updateRectangle(D,H,q,U,F,T.cols,B))}D.count=V}updateCursor(b){const T=this._verticesCursor,D=b.cursor;if(!D||D.style==="block")return void(T.count=0);let B,O=0;D.style!=="bar"&&D.style!=="outline"||(B=8*O++,this._addRectangleFloat(T.attributes,B,D.x*this._dimensions.device.cell.width,D.y*this._dimensions.device.cell.height,D.style==="bar"?D.dpr*D.cursorWidth:D.dpr,this._dimensions.device.cell.height,this._cursorFloat)),D.style!=="underline"&&D.style!=="outline"||(B=8*O++,this._addRectangleFloat(T.attributes,B,D.x*this._dimensions.device.cell.width,(D.y+1)*this._dimensions.device.cell.height-D.dpr,D.width*this._dimensions.device.cell.width,D.dpr,this._cursorFloat)),D.style==="outline"&&(B=8*O++,this._addRectangleFloat(T.attributes,B,D.x*this._dimensions.device.cell.width,D.y*this._dimensions.device.cell.height,D.width*this._dimensions.device.cell.width,D.dpr,this._cursorFloat),B=8*O++,this._addRectangleFloat(T.attributes,B,(D.x+D.width)*this._dimensions.device.cell.width-D.dpr,D.y*this._dimensions.device.cell.height,D.dpr,this._dimensions.device.cell.height,this._cursorFloat)),T.count=O}_updateRectangle(b,T,D,B,O,F,U){if(67108864&D)switch(50331648&D){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&D].rgba;break;case 50331648:g=(16777215&D)<<8;break;default:g=this._themeService.colors.foreground.rgba}else switch(50331648&B){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&B].rgba;break;case 50331648:g=(16777215&B)<<8;break;default:g=this._themeService.colors.background.rgba}b.attributes.length<T+4&&(b.attributes=(0,w.expandFloat32Array)(b.attributes,this._terminal.rows*this._terminal.cols*8)),c=O*this._dimensions.device.cell.width,f=U*this._dimensions.device.cell.height,m=(g>>24&255)/255,d=(g>>16&255)/255,L=(g>>8&255)/255,I=1,this._addRectangle(b.attributes,T,c,f,(F-O)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,m,d,L,I)}_addRectangle(b,T,D,B,O,F,U,q,G,Y){b[T]=D/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=O/this._dimensions.device.canvas.width,b[T+3]=F/this._dimensions.device.canvas.height,b[T+4]=U,b[T+5]=q,b[T+6]=G,b[T+7]=Y}_addRectangleFloat(b,T,D,B,O,F,U){b[T]=D/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=O/this._dimensions.device.canvas.width,b[T+3]=F/this._dimensions.device.canvas.height,b[T+4]=U[0],b[T+5]=U[1],b[T+6]=U[2],b[T+7]=U[3]}_colorToFloat32Array(b){return new Float32Array([(b.rgba>>24&255)/255,(b.rgba>>16&255)/255,(b.rgba>>8&255)/255,(255&b.rgba)/255])}}r.RectangleRenderer=x},310:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderModel=r.COMBINED_CHAR_BIT_MASK=r.RENDER_MODEL_EXT_OFFSET=r.RENDER_MODEL_FG_OFFSET=r.RENDER_MODEL_BG_OFFSET=r.RENDER_MODEL_INDICIES_PER_CELL=void 0;const v=u(296);r.RENDER_MODEL_INDICIES_PER_CELL=4,r.RENDER_MODEL_BG_OFFSET=1,r.RENDER_MODEL_FG_OFFSET=2,r.RENDER_MODEL_EXT_OFFSET=3,r.COMBINED_CHAR_BIT_MASK=2147483648,r.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,v.createSelectionRenderModel)()}resize(_,h){const w=_*h*r.RENDER_MODEL_INDICIES_PER_CELL;w!==this.cells.length&&(this.cells=new Uint32Array(w),this.lineLengths=new Uint32Array(h))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JoinedCellData=r.WebglRenderer=void 0;const v=u(820),_=u(274),h=u(627),w=u(457),E=u(56),R=u(374),g=u(345),c=u(859),f=u(147),m=u(782),d=u(855),L=u(965),I=u(742),x=u(310),M=u(733);class b extends c.Disposable{constructor(O,F,U,q,G,Y,W,j,$){super(),this._terminal=O,this._characterJoinerService=F,this._charSizeService=U,this._coreBrowserService=q,this._coreService=G,this._decorationService=Y,this._optionsService=W,this._themeService=j,this._cursorBlinkStateManager=new c.MutableDisposable,this._charAtlasDisposable=this.register(new c.MutableDisposable),this._observerDisposable=this.register(new c.MutableDisposable),this._model=new x.RenderModel,this._workCell=new m.CellData,this._workCell2=new m.CellData,this._rectangleRenderer=this.register(new c.MutableDisposable),this._glyphRenderer=this.register(new c.MutableDisposable),this._onChangeTextureAtlas=this.register(new g.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new g.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new g.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new g.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new _.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new M.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,W,this._themeService)],this.dimensions=(0,R.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(W.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const H={antialias:!1,depth:!1,preserveDrawingBuffer:$};if(this._gl=this._canvas.getContext("webgl2",H),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,v.addDisposableDomListener)(this._canvas,"webglcontextlost",(V=>{console.log("webglcontextlost event received"),V.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(V)}),3e3)}))),this.register((0,v.addDisposableDomListener)(this._canvas,"webglcontextrestored",(V=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,h.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,E.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((V,te)=>this._setCanvasDevicePixelDimensions(V,te))),this.register(this._coreBrowserService.onWindowChange((V=>{this._observerDisposable.value=(0,E.observeDevicePixelDimensions)(this._canvas,V,((te,ie)=>this._setCanvasDevicePixelDimensions(te,ie)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,c.toDisposable)((()=>{var V;for(const te of this._renderLayers)te.dispose();(V=this._canvas.parentElement)==null||V.removeChild(this._canvas),(0,h.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var O;return(O=this._charAtlas)==null?void 0:O.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(O,F){var U,q,G,Y;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const W of this._renderLayers)W.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(U=this._rectangleRenderer.value)==null||U.setDimensions(this.dimensions),(q=this._rectangleRenderer.value)==null||q.handleResize(),(G=this._glyphRenderer.value)==null||G.setDimensions(this.dimensions),(Y=this._glyphRenderer.value)==null||Y.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var O;for(const F of this._renderLayers)F.handleBlur(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.pause(),this._requestRedrawViewport()}handleFocus(){var O;for(const F of this._renderLayers)F.handleFocus(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.resume(),this._requestRedrawViewport()}handleSelectionChanged(O,F,U){for(const q of this._renderLayers)q.handleSelectionChanged(this._terminal,O,F,U);this._model.selection.update(this._core,O,F,U),this._requestRedrawViewport()}handleCursorMove(){var O;for(const F of this._renderLayers)F.handleCursorMove(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new I.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new L.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var F;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const O=(0,h.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==O&&(this._onChangeTextureAtlas.fire(O.pages[0].canvas),this._charAtlasDisposable.value=(0,c.getDisposeArrayDisposable)([(0,g.forwardEvent)(O.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,g.forwardEvent)(O.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=O,this._charAtlas.warmUp(),(F=this._glyphRenderer.value)==null||F.setAtlas(this._charAtlas)}_clearModel(O){var F;this._model.clear(),O&&((F=this._glyphRenderer.value)==null||F.clear())}clearTextureAtlas(){var O;(O=this._charAtlas)==null||O.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var O;this._clearModel(!0);for(const F of this._renderLayers)F.reset(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(O){return-1}deregisterCharacterJoiner(O){return!1}renderRows(O,F){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const U of this._renderLayers)U.handleGridChanged(this._terminal,O,F);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(O,F),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new w.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(O,F){const U=this._core;let q,G,Y,W,j,$,H,V,te,ie,pe,me,X,K,J=this._workCell;O=D(O,U.rows-1,0),F=D(F,U.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,_e=Z-U.buffer.ydisp,ve=Math.min(this._terminal.buffer.active.cursorX,U.cols-1);let ye=-1;const Ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let fe=!1;for(G=O;G<=F;G++)for(Y=G+U.buffer.ydisp,W=U.buffer.lines.get(Y),this._model.lineLengths[G]=0,j=this._characterJoinerService.getJoinedCharacters(Y),X=0;X<U.cols;X++)if(q=this._cellColorResolver.result.bg,W.loadCell(X,J),X===0&&(q=this._cellColorResolver.result.bg),$=!1,H=X,j.length>0&&X===j[0][0]&&($=!0,V=j.shift(),J=new T(J,W.translateToString(!0,V[0],V[1]),V[1]-V[0]),H=V[1]-1),te=J.getChars(),ie=J.getCode(),me=(G*U.cols+X)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(J,X,Y,this.dimensions.device.cell.width),Ee&&Y===Z&&(X===ve&&(this._model.cursor={x:ve,y:_e,width:J.getWidth(),style:this._coreBrowserService.isFocused?U.options.cursorStyle||"block":U.options.cursorInactiveStyle,cursorWidth:U.options.cursorWidth,dpr:this._devicePixelRatio},ye=ve+J.getWidth()-1),X>=ve&&X<=ye&&(this._coreBrowserService.isFocused&&(U.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&U.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),ie!==d.NULL_CELL_CODE&&(this._model.lineLengths[G]=X+1),(this._model.cells[me]!==ie||this._model.cells[me+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[me+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[me+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(fe=!0,te.length>1&&(ie|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[me]=ie,this._model.cells[me+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[me+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[me+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,pe=J.getWidth(),this._glyphRenderer.value.updateCell(X,G,ie,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,te,pe,q),$))for(J=this._workCell,X++;X<H;X++)K=(G*U.cols+X)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(X,G,d.NULL_CELL_CODE,0,0,0,d.NULL_CELL_CHAR,0,0),this._model.cells[K]=d.NULL_CELL_CODE,this._model.cells[K+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[K+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[K+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;fe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(O,F){this._canvas.width===O&&this._canvas.height===F||(this._canvas.width=O,this._canvas.height=F,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const O=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:O,end:O})}}r.WebglRenderer=b;class T extends f.AttributeData{constructor(O,F,U){super(),this.content=0,this.combinedData="",this.fg=O.fg,this.bg=O.bg,this.combinedData=F,this._width=U}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(O){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function D(B,O,F=0){return Math.max(Math.min(B,O),F)}r.JoinedCellData=T},381:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GLTexture=r.expandFloat32Array=r.createShader=r.createProgram=r.PROJECTION_MATRIX=void 0;const v=u(374);function _(h,w,E){const R=(0,v.throwIfFalsy)(h.createShader(w));if(h.shaderSource(R,E),h.compileShader(R),h.getShaderParameter(R,h.COMPILE_STATUS))return R;console.error(h.getShaderInfoLog(R)),h.deleteShader(R)}r.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),r.createProgram=function(h,w,E){const R=(0,v.throwIfFalsy)(h.createProgram());if(h.attachShader(R,(0,v.throwIfFalsy)(_(h,h.VERTEX_SHADER,w))),h.attachShader(R,(0,v.throwIfFalsy)(_(h,h.FRAGMENT_SHADER,E))),h.linkProgram(R),h.getProgramParameter(R,h.LINK_STATUS))return R;console.error(h.getProgramInfoLog(R)),h.deleteProgram(R)},r.createShader=_,r.expandFloat32Array=function(h,w){const E=Math.min(2*h.length,w),R=new Float32Array(E);for(let g=0;g<h.length;g++)R[g]=h[g];return R},r.GLTexture=class{constructor(h){this.texture=h,this.version=-1}}},592:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseRenderLayer=void 0;const v=u(627),_=u(237),h=u(374),w=u(859);class E extends w.Disposable{constructor(g,c,f,m,d,L,I,x){super(),this._container=c,this._alpha=d,this._coreBrowserService=L,this._optionsService=I,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${f}-layer`),this._canvas.style.zIndex=m.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((M=>{this._refreshCharAtlas(g,M),this.reset(g)}))),this.register((0,w.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,h.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(g){}handleFocus(g){}handleCursorMove(g){}handleGridChanged(g,c,f){}handleSelectionChanged(g,c,f,m=!1){}_setTransparency(g,c){if(c===this._alpha)return;const f=this._canvas;this._alpha=c,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,f),this._refreshCharAtlas(g,this._themeService.colors),this.handleGridChanged(g,0,g.rows-1)}_refreshCharAtlas(g,c){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,v.acquireTextureAtlas)(g,this._optionsService.rawOptions,c,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(g,c){this._deviceCellWidth=c.device.cell.width,this._deviceCellHeight=c.device.cell.height,this._deviceCharWidth=c.device.char.width,this._deviceCharHeight=c.device.char.height,this._deviceCharLeft=c.device.char.left,this._deviceCharTop=c.device.char.top,this._canvas.width=c.device.canvas.width,this._canvas.height=c.device.canvas.height,this._canvas.style.width=`${c.css.canvas.width}px`,this._canvas.style.height=`${c.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(g,this._themeService.colors)}_fillBottomLineAtCells(g,c,f=1){this._ctx.fillRect(g*this._deviceCellWidth,(c+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,f*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(g,c,f,m){this._alpha?this._ctx.clearRect(g*this._deviceCellWidth,c*this._deviceCellHeight,f*this._deviceCellWidth,m*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(g*this._deviceCellWidth,c*this._deviceCellHeight,f*this._deviceCellWidth,m*this._deviceCellHeight))}_fillCharTrueColor(g,c,f,m){this._ctx.font=this._getFont(g,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(f,m,c.getWidth()),this._ctx.fillText(c.getChars(),f*this._deviceCellWidth+this._deviceCharLeft,m*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(g,c,f){this._ctx.beginPath(),this._ctx.rect(g*this._deviceCellWidth,c*this._deviceCellHeight,f*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(g,c,f){return`${f?"italic":""} ${c?g.options.fontWeightBold:g.options.fontWeight} ${g.options.fontSize*this._coreBrowserService.dpr}px ${g.options.fontFamily}`}}r.BaseRenderLayer=E},733:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkRenderLayer=void 0;const v=u(197),_=u(237),h=u(592);class w extends h.BaseRenderLayer{constructor(R,g,c,f,m,d,L){super(c,R,"link",g,!0,m,d,L),this.register(f.onShowLinkUnderline((I=>this._handleShowLinkUnderline(I)))),this.register(f.onHideLinkUnderline((I=>this._handleHideLinkUnderline(I))))}resize(R,g){super.resize(R,g),this._state=void 0}reset(R){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const R=this._state.y2-this._state.y1-1;R>0&&this._clearCells(0,this._state.y1+1,this._state.cols,R),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(R){if(R.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:R.fg!==void 0&&(0,v.is256Color)(R.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[R.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,R.y1===R.y2)this._fillBottomLineAtCells(R.x1,R.y1,R.x2-R.x1);else{this._fillBottomLineAtCells(R.x1,R.y1,R.cols-R.x1);for(let g=R.y1+1;g<R.y2;g++)this._fillBottomLineAtCells(0,g,R.cols);this._fillBottomLineAtCells(0,R.y2,R.x2)}this._state=R}_handleHideLinkUnderline(R){this._clearCurrentLink()}}r.LinkRenderLayer=w},820:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(u,v,_,h){u.addEventListener(v,_,h);let w=!1;return{dispose:()=>{w||(w=!0,u.removeEventListener(v,_,h))}}}},274:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellColorResolver=void 0;const v=u(855),_=u(160),h=u(374);let w,E=0,R=0,g=!1,c=!1,f=!1,m=0;r.CellColorResolver=class{constructor(d,L,I,x,M,b){this._terminal=d,this._optionService=L,this._selectionRenderModel=I,this._decorationService=x,this._coreBrowserService=M,this._themeService=b,this.result={fg:0,bg:0,ext:0}}resolve(d,L,I,x){if(this.result.bg=d.bg,this.result.fg=d.fg,this.result.ext=268435456&d.bg?d.extended.ext:0,R=0,E=0,c=!1,g=!1,f=!1,w=this._themeService.colors,m=0,d.getCode()!==v.NULL_CELL_CODE&&d.extended.underlineStyle===4){const M=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));m=L*x%(2*Math.round(M))}if(this._decorationService.forEachDecorationAtCell(L,I,"bottom",(M=>{M.backgroundColorRGB&&(R=M.backgroundColorRGB.rgba>>8&16777215,c=!0),M.foregroundColorRGB&&(E=M.foregroundColorRGB.rgba>>8&16777215,g=!0)})),f=this._selectionRenderModel.isCellSelected(this._terminal,L,I),f){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:R=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:R=(16777215&this.result.fg)<<8|255;break;default:R=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:R=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:R=(16777215&this.result.bg)<<8|255}R=_.rgba.blend(R,4294967040&(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else R=(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(c=!0,w.selectionForeground&&(E=w.selectionForeground.rgba>>8&16777215,g=!0),(0,h.treatGlyphAsBackgroundColor)(d.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)E=(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:E=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:E=(16777215&this.result.fg)<<8|255;break;default:E=this._themeService.colors.foreground.rgba}E=_.rgba.blend(E,4294967040&(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}g=!0}}this._decorationService.forEachDecorationAtCell(L,I,"top",(M=>{M.backgroundColorRGB&&(R=M.backgroundColorRGB.rgba>>8&16777215,c=!0),M.foregroundColorRGB&&(E=M.foregroundColorRGB.rgba>>8&16777215,g=!0)})),c&&(R=f?-16777216&d.bg&-134217729|R|50331648:-16777216&d.bg|R|50331648),g&&(E=-16777216&d.fg&-67108865|E|50331648),67108864&this.result.fg&&(c&&!g&&(E=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&w.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,g=!0),!c&&g&&(R=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&w.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,c=!0)),w=void 0,this.result.bg=c?R:this.result.bg,this.result.fg=g?E:this.result.fg,this.result.ext&=536870911,this.result.ext|=m<<29&3758096384}}},627:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeTerminalFromCache=r.acquireTextureAtlas=void 0;const v=u(509),_=u(197),h=[];r.acquireTextureAtlas=function(w,E,R,g,c,f,m,d){const L=(0,_.generateConfig)(g,c,f,m,E,R,d);for(let M=0;M<h.length;M++){const b=h[M],T=b.ownedBy.indexOf(w);if(T>=0){if((0,_.configEquals)(b.config,L))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),h.splice(M,1)):b.ownedBy.splice(T,1);break}}for(let M=0;M<h.length;M++){const b=h[M];if((0,_.configEquals)(b.config,L))return b.ownedBy.push(w),b.atlas}const I=w._core,x={atlas:new v.TextureAtlas(document,L,I.unicodeService),config:L,ownedBy:[w]};return h.push(x),x.atlas},r.removeTerminalFromCache=function(w){for(let E=0;E<h.length;E++){const R=h[E].ownedBy.indexOf(w);if(R!==-1){h[E].ownedBy.length===1?(h[E].atlas.dispose(),h.splice(E,1)):h[E].ownedBy.splice(R,1);break}}}},197:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.is256Color=r.configEquals=r.generateConfig=void 0;const v=u(160);r.generateConfig=function(_,h,w,E,R,g,c){const f={foreground:g.foreground,background:g.background,cursor:v.NULL_COLOR,cursorAccent:v.NULL_COLOR,selectionForeground:v.NULL_COLOR,selectionBackgroundTransparent:v.NULL_COLOR,selectionBackgroundOpaque:v.NULL_COLOR,selectionInactiveBackgroundTransparent:v.NULL_COLOR,selectionInactiveBackgroundOpaque:v.NULL_COLOR,ansi:g.ansi.slice(),contrastCache:g.contrastCache,halfContrastCache:g.halfContrastCache};return{customGlyphs:R.customGlyphs,devicePixelRatio:c,letterSpacing:R.letterSpacing,lineHeight:R.lineHeight,deviceCellWidth:_,deviceCellHeight:h,deviceCharWidth:w,deviceCharHeight:E,fontFamily:R.fontFamily,fontSize:R.fontSize,fontWeight:R.fontWeight,fontWeightBold:R.fontWeightBold,allowTransparency:R.allowTransparency,drawBoldTextInBrightColors:R.drawBoldTextInBrightColors,minimumContrastRatio:R.minimumContrastRatio,colors:f}},r.configEquals=function(_,h){for(let w=0;w<_.colors.ansi.length;w++)if(_.colors.ansi[w].rgba!==h.colors.ansi[w].rgba)return!1;return _.devicePixelRatio===h.devicePixelRatio&&_.customGlyphs===h.customGlyphs&&_.lineHeight===h.lineHeight&&_.letterSpacing===h.letterSpacing&&_.fontFamily===h.fontFamily&&_.fontSize===h.fontSize&&_.fontWeight===h.fontWeight&&_.fontWeightBold===h.fontWeightBold&&_.allowTransparency===h.allowTransparency&&_.deviceCharWidth===h.deviceCharWidth&&_.deviceCharHeight===h.deviceCharHeight&&_.drawBoldTextInBrightColors===h.drawBoldTextInBrightColors&&_.minimumContrastRatio===h.minimumContrastRatio&&_.colors.foreground.rgba===h.colors.foreground.rgba&&_.colors.background.rgba===h.colors.background.rgba},r.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const v=u(399);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=v.isFirefox||v.isLegacyEdge?"bottom":"ideographic"},457:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CursorBlinkStateManager=void 0,r.CursorBlinkStateManager=class{constructor(u,v){this._renderCallback=u,this._coreBrowserService=v,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(u=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const v=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,v>0)return void this._restartInterval(v)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const v=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(v)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),u)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryDrawCustomChar=r.powerlineDefinitions=r.boxDrawingDefinitions=r.blockElementDefinitions=void 0;const v=u(374);r.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const _={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};r.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(g,c)=>`M0,${.5-c} L1,${.5-c} M0,${.5+c} L1,${.5+c}`},"║":{1:(g,c)=>`M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╒":{1:(g,c)=>`M.5,1 L.5,${.5-c} L1,${.5-c} M.5,${.5+c} L1,${.5+c}`},"╓":{1:(g,c)=>`M${.5-g},1 L${.5-g},.5 L1,.5 M${.5+g},.5 L${.5+g},1`},"╔":{1:(g,c)=>`M1,${.5-c} L${.5-g},${.5-c} L${.5-g},1 M1,${.5+c} L${.5+g},${.5+c} L${.5+g},1`},"╕":{1:(g,c)=>`M0,${.5-c} L.5,${.5-c} L.5,1 M0,${.5+c} L.5,${.5+c}`},"╖":{1:(g,c)=>`M${.5+g},1 L${.5+g},.5 L0,.5 M${.5-g},.5 L${.5-g},1`},"╗":{1:(g,c)=>`M0,${.5+c} L${.5-g},${.5+c} L${.5-g},1 M0,${.5-c} L${.5+g},${.5-c} L${.5+g},1`},"╘":{1:(g,c)=>`M.5,0 L.5,${.5+c} L1,${.5+c} M.5,${.5-c} L1,${.5-c}`},"╙":{1:(g,c)=>`M1,.5 L${.5-g},.5 L${.5-g},0 M${.5+g},.5 L${.5+g},0`},"╚":{1:(g,c)=>`M1,${.5-c} L${.5+g},${.5-c} L${.5+g},0 M1,${.5+c} L${.5-g},${.5+c} L${.5-g},0`},"╛":{1:(g,c)=>`M0,${.5+c} L.5,${.5+c} L.5,0 M0,${.5-c} L.5,${.5-c}`},"╜":{1:(g,c)=>`M0,.5 L${.5+g},.5 L${.5+g},0 M${.5-g},.5 L${.5-g},0`},"╝":{1:(g,c)=>`M0,${.5-c} L${.5-g},${.5-c} L${.5-g},0 M0,${.5+c} L${.5+g},${.5+c} L${.5+g},0`},"╞":{1:(g,c)=>`M.5,0 L.5,1 M.5,${.5-c} L1,${.5-c} M.5,${.5+c} L1,${.5+c}`},"╟":{1:(g,c)=>`M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1 M${.5+g},.5 L1,.5`},"╠":{1:(g,c)=>`M${.5-g},0 L${.5-g},1 M1,${.5+c} L${.5+g},${.5+c} L${.5+g},1 M1,${.5-c} L${.5+g},${.5-c} L${.5+g},0`},"╡":{1:(g,c)=>`M.5,0 L.5,1 M0,${.5-c} L.5,${.5-c} M0,${.5+c} L.5,${.5+c}`},"╢":{1:(g,c)=>`M0,.5 L${.5-g},.5 M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╣":{1:(g,c)=>`M${.5+g},0 L${.5+g},1 M0,${.5+c} L${.5-g},${.5+c} L${.5-g},1 M0,${.5-c} L${.5-g},${.5-c} L${.5-g},0`},"╤":{1:(g,c)=>`M0,${.5-c} L1,${.5-c} M0,${.5+c} L1,${.5+c} M.5,${.5+c} L.5,1`},"╥":{1:(g,c)=>`M0,.5 L1,.5 M${.5-g},.5 L${.5-g},1 M${.5+g},.5 L${.5+g},1`},"╦":{1:(g,c)=>`M0,${.5-c} L1,${.5-c} M0,${.5+c} L${.5-g},${.5+c} L${.5-g},1 M1,${.5+c} L${.5+g},${.5+c} L${.5+g},1`},"╧":{1:(g,c)=>`M.5,0 L.5,${.5-c} M0,${.5-c} L1,${.5-c} M0,${.5+c} L1,${.5+c}`},"╨":{1:(g,c)=>`M0,.5 L1,.5 M${.5-g},.5 L${.5-g},0 M${.5+g},.5 L${.5+g},0`},"╩":{1:(g,c)=>`M0,${.5+c} L1,${.5+c} M0,${.5-c} L${.5-g},${.5-c} L${.5-g},0 M1,${.5-c} L${.5+g},${.5-c} L${.5+g},0`},"╪":{1:(g,c)=>`M.5,0 L.5,1 M0,${.5-c} L1,${.5-c} M0,${.5+c} L1,${.5+c}`},"╫":{1:(g,c)=>`M0,.5 L1,.5 M${.5-g},0 L${.5-g},1 M${.5+g},0 L${.5+g},1`},"╬":{1:(g,c)=>`M0,${.5+c} L${.5-g},${.5+c} L${.5-g},1 M1,${.5+c} L${.5+g},${.5+c} L${.5+g},1 M0,${.5-c} L${.5-g},${.5-c} L${.5-g},0 M1,${.5-c} L${.5+g},${.5-c} L${.5+g},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(g,c)=>`M.5,1 L.5,${.5+c/.15*.5} C.5,${.5+c/.15*.5},.5,.5,1,.5`},"╮":{1:(g,c)=>`M.5,1 L.5,${.5+c/.15*.5} C.5,${.5+c/.15*.5},.5,.5,0,.5`},"╯":{1:(g,c)=>`M.5,0 L.5,${.5-c/.15*.5} C.5,${.5-c/.15*.5},.5,.5,0,.5`},"╰":{1:(g,c)=>`M.5,0 L.5,${.5-c/.15*.5} C.5,${.5-c/.15*.5},.5,.5,1,.5`}},r.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},r.powerlineDefinitions[""]=r.powerlineDefinitions[""],r.powerlineDefinitions[""]=r.powerlineDefinitions[""],r.tryDrawCustomChar=function(g,c,f,m,d,L,I,x){const M=r.blockElementDefinitions[c];if(M)return(function(B,O,F,U,q,G){for(let Y=0;Y<O.length;Y++){const W=O[Y],j=q/8,$=G/8;B.fillRect(F+W.x*j,U+W.y*$,W.w*j,W.h*$)}})(g,M,f,m,d,L),!0;const b=_[c];if(b)return(function(B,O,F,U,q,G){let Y=h.get(O);Y||(Y=new Map,h.set(O,Y));const W=B.fillStyle;if(typeof W!="string")throw new Error(`Unexpected fillStyle type "${W}"`);let j=Y.get(W);if(!j){const $=O[0].length,H=O.length,V=B.canvas.ownerDocument.createElement("canvas");V.width=$,V.height=H;const te=(0,v.throwIfFalsy)(V.getContext("2d")),ie=new ImageData($,H);let pe,me,X,K;if(W.startsWith("#"))pe=parseInt(W.slice(1,3),16),me=parseInt(W.slice(3,5),16),X=parseInt(W.slice(5,7),16),K=W.length>7&&parseInt(W.slice(7,9),16)||1;else{if(!W.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${W}" when drawing pattern glyph`);[pe,me,X,K]=W.substring(5,W.length-1).split(",").map((J=>parseFloat(J)))}for(let J=0;J<H;J++)for(let Z=0;Z<$;Z++)ie.data[4*(J*$+Z)]=pe,ie.data[4*(J*$+Z)+1]=me,ie.data[4*(J*$+Z)+2]=X,ie.data[4*(J*$+Z)+3]=O[J][Z]*(255*K);te.putImageData(ie,0,0),j=(0,v.throwIfFalsy)(B.createPattern(V,null)),Y.set(W,j)}B.fillStyle=j,B.fillRect(F,U,q,G)})(g,b,f,m,d,L),!0;const T=r.boxDrawingDefinitions[c];if(T)return(function(B,O,F,U,q,G,Y){B.strokeStyle=B.fillStyle;for(const[W,j]of Object.entries(O)){let $;B.beginPath(),B.lineWidth=Y*Number.parseInt(W),$=typeof j=="function"?j(.15,.15/G*q):j;for(const H of $.split(" ")){const V=H[0],te=E[V];if(!te){console.error(`Could not find drawing instructions for "${V}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&te(B,R(ie,q,G,F,U,!0,Y))}B.stroke(),B.closePath()}})(g,T,f,m,d,L,x),!0;const D=r.powerlineDefinitions[c];return!!D&&((function(B,O,F,U,q,G,Y,W){const j=new Path2D;j.rect(F,U,q,G),B.clip(j),B.beginPath();const $=Y/12;B.lineWidth=W*$;for(const H of O.d.split(" ")){const V=H[0],te=E[V];if(!te){console.error(`Could not find drawing instructions for "${V}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&te(B,R(ie,q,G,F,U,!1,W,(O.leftPadding??0)*($/2),(O.rightPadding??0)*($/2)))}O.type===1?(B.strokeStyle=B.fillStyle,B.stroke()):B.fill(),B.closePath()})(g,D,f,m,d,L,I,x),!0)};const h=new Map;function w(g,c,f=0){return Math.max(Math.min(g,c),f)}const E={C:(g,c)=>g.bezierCurveTo(c[0],c[1],c[2],c[3],c[4],c[5]),L:(g,c)=>g.lineTo(c[0],c[1]),M:(g,c)=>g.moveTo(c[0],c[1])};function R(g,c,f,m,d,L,I,x=0,M=0){const b=g.map((T=>parseFloat(T)||parseInt(T)));if(b.length<2)throw new Error("Too few arguments for instruction");for(let T=0;T<b.length;T+=2)b[T]*=c-x*I-M*I,L&&b[T]!==0&&(b[T]=w(Math.round(b[T]+.5)-.5,c,0)),b[T]+=m+x*I;for(let T=1;T<b.length;T+=2)b[T]*=f,L&&b[T]!==0&&(b[T]=w(Math.round(b[T]+.5)-.5,f,0)),b[T]+=d;return b}},56:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.observeDevicePixelDimensions=void 0;const v=u(859);r.observeDevicePixelDimensions=function(_,h,w){let E=new h.ResizeObserver((R=>{const g=R.find((m=>m.target===_));if(!g)return;if(!("devicePixelContentBoxSize"in g))return E==null||E.disconnect(),void(E=void 0);const c=g.devicePixelContentBoxSize[0].inlineSize,f=g.devicePixelContentBoxSize[0].blockSize;c>0&&f>0&&w(c,f)}));try{E.observe(_,{box:["device-pixel-content-box"]})}catch{E.disconnect(),E=void 0}return(0,v.toDisposable)((()=>E==null?void 0:E.disconnect()))}},374:(C,r)=>{function u(_){return 57508<=_&&_<=57558}function v(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},r.isPowerlineGlyph=u,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=v,r.allowRescaling=function(_,h,w,E){return h===1&&w>Math.ceil(1.5*E)&&_!==void 0&&_>255&&!v(_)&&!u(_)&&!(function(R){return 57344<=R&&R<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return u(_)||(function(h){return 9472<=h&&h<=9631})(_)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(_,h,w=0){return(_-(2*Math.round(h)-w))%(2*Math.round(h))}},296:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(_,h,w,E=!1){if(this.selectionStart=h,this.selectionEnd=w,!h||!w||h[0]===w[0]&&h[1]===w[1])return void this.clear();const R=_.buffers.active.ydisp,g=h[1]-R,c=w[1]-R,f=Math.max(g,0),m=Math.min(c,_.rows-1);f>=_.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=g,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=m,this.startCol=h[0],this.endCol=w[0])}isCellSelected(_,h,w){return!!this.hasSelection&&(w-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&w>=this.viewportCappedStartRow&&h<this.endCol&&w<=this.viewportCappedEndRow:h<this.startCol&&w>=this.viewportCappedStartRow&&h>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol)}}r.createSelectionRenderModel=function(){return new u}},509:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TextureAtlas=void 0;const v=u(237),_=u(860),h=u(374),w=u(160),E=u(345),R=u(485),g=u(385),c=u(147),f=u(855),m={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let d;class L{get pages(){return this._pages}constructor(T,D,B){this._document=T,this._config=D,this._unicodeService=B,this._didWarmUp=!1,this._cacheMap=new R.FourKeyMap,this._cacheMapCombined=new R.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new c.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new E.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new E.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=M(T,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,h.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const T of this.pages)T.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const T=new g.IdleTaskQueue;for(let D=33;D<126;D++)T.enqueue((()=>{if(!this._cacheMap.get(D,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT)){const B=this._drawToCache(D,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT);this._cacheMap.set(D,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT,B)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const T of this._pages)T.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(L.maxAtlasPages&&this._pages.length>=Math.max(4,L.maxAtlasPages)){const D=this._pages.filter((Y=>2*Y.canvas.width<=(L.maxTextureSize||4096))).sort(((Y,W)=>W.canvas.width!==Y.canvas.width?W.canvas.width-Y.canvas.width:W.percentageUsed-Y.percentageUsed));let B=-1,O=0;for(let Y=0;Y<D.length;Y++)if(D[Y].canvas.width!==O)B=Y,O=D[Y].canvas.width;else if(Y-B==3)break;const F=D.slice(B,B+4),U=F.map((Y=>Y.glyphs[0].texturePage)).sort(((Y,W)=>Y>W?1:-1)),q=this.pages.length-F.length,G=this._mergePages(F,q);G.version++;for(let Y=U.length-1;Y>=0;Y--)this._deletePage(U[Y]);this.pages.push(G),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(G.canvas)}const T=new I(this._document,this._textureSize);return this._pages.push(T),this._activePages.push(T),this._onAddTextureAtlasCanvas.fire(T.canvas),T}_mergePages(T,D){const B=2*T[0].canvas.width,O=new I(this._document,B,T);for(const[F,U]of T.entries()){const q=F*U.canvas.width%B,G=Math.floor(F/2)*U.canvas.height;O.ctx.drawImage(U.canvas,q,G);for(const W of U.glyphs)W.texturePage=D,W.sizeClipSpace.x=W.size.x/B,W.sizeClipSpace.y=W.size.y/B,W.texturePosition.x+=q,W.texturePosition.y+=G,W.texturePositionClipSpace.x=W.texturePosition.x/B,W.texturePositionClipSpace.y=W.texturePosition.y/B;this._onRemoveTextureAtlasCanvas.fire(U.canvas);const Y=this._activePages.indexOf(U);Y!==-1&&this._activePages.splice(Y,1)}return O}_deletePage(T){this._pages.splice(T,1);for(let D=T;D<this._pages.length;D++){const B=this._pages[D];for(const O of B.glyphs)O.texturePage--;B.version++}}getRasterizedGlyphCombinedChar(T,D,B,O,F){return this._getFromCacheMap(this._cacheMapCombined,T,D,B,O,F)}getRasterizedGlyph(T,D,B,O,F){return this._getFromCacheMap(this._cacheMap,T,D,B,O,F)}_getFromCacheMap(T,D,B,O,F,U=!1){return d=T.get(D,B,O,F),d||(d=this._drawToCache(D,B,O,F,U),T.set(D,B,O,F,d)),d}_getColorFromAnsiIndex(T){if(T>=this._config.colors.ansi.length)throw new Error("No color found for idx "+T);return this._config.colors.ansi[T]}_getBackgroundColor(T,D,B,O){if(this._config.allowTransparency)return w.NULL_COLOR;let F;switch(T){case 16777216:case 33554432:F=this._getColorFromAnsiIndex(D);break;case 50331648:const U=c.AttributeData.toColorRGB(D);F=w.channels.toColor(U[0],U[1],U[2]);break;default:F=B?w.color.opaque(this._config.colors.foreground):this._config.colors.background}return F}_getForegroundColor(T,D,B,O,F,U,q,G,Y,W){const j=this._getMinimumContrastColor(T,D,B,O,F,U,q,Y,G,W);if(j)return j;let $;switch(F){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&Y&&U<8&&(U+=8),$=this._getColorFromAnsiIndex(U);break;case 50331648:const H=c.AttributeData.toColorRGB(U);$=w.channels.toColor(H[0],H[1],H[2]);break;default:$=q?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&($=w.color.opaque($)),G&&($=w.color.multiplyOpacity($,v.DIM_OPACITY)),$}_resolveBackgroundRgba(T,D,B){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(D).rgba;case 50331648:return D<<8;default:return B?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,D,B,O){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&O&&D<8&&(D+=8),this._getColorFromAnsiIndex(D).rgba;case 50331648:return D<<8;default:return B?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,D,B,O,F,U,q,G,Y,W){if(this._config.minimumContrastRatio===1||W)return;const j=this._getContrastCache(Y),$=j.getColor(T,O);if($!==void 0)return $||void 0;const H=this._resolveBackgroundRgba(D,B,q),V=this._resolveForegroundRgba(F,U,q,G),te=w.rgba.ensureContrastRatio(H,V,this._config.minimumContrastRatio/(Y?2:1));if(!te)return void j.setColor(T,O,null);const ie=w.channels.toColor(te>>24&255,te>>16&255,te>>8&255);return j.setColor(T,O,ie),ie}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,D,B,O,F=!1){const U=typeof T=="number"?String.fromCharCode(T):T,q=Math.min(this._config.deviceCellWidth*Math.max(U.length,2)+4,this._textureSize);this._tmpCanvas.width<q&&(this._tmpCanvas.width=q);const G=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<G&&(this._tmpCanvas.height=G),this._tmpCtx.save(),this._workAttributeData.fg=B,this._workAttributeData.bg=D,this._workAttributeData.extended.ext=O,this._workAttributeData.isInvisible())return m;const Y=!!this._workAttributeData.isBold(),W=!!this._workAttributeData.isInverse(),j=!!this._workAttributeData.isDim(),$=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),V=!!this._workAttributeData.isStrikethrough(),te=!!this._workAttributeData.isOverline();let ie=this._workAttributeData.getFgColor(),pe=this._workAttributeData.getFgColorMode(),me=this._workAttributeData.getBgColor(),X=this._workAttributeData.getBgColorMode();if(W){const Re=ie;ie=me,me=Re;const Ke=pe;pe=X,X=Ke}const K=this._getBackgroundColor(X,me,W,j);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=K.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const J=Y?this._config.fontWeightBold:this._config.fontWeight,Z=$?"italic":"";this._tmpCtx.font=`${Z} ${J} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=v.TEXT_BASELINE;const _e=U.length===1&&(0,h.isPowerlineGlyph)(U.charCodeAt(0)),ve=U.length===1&&(0,h.isRestrictedPowerlineGlyph)(U.charCodeAt(0)),ye=this._getForegroundColor(D,X,me,B,pe,ie,W,j,Y,(0,h.treatGlyphAsBackgroundColor)(U.charCodeAt(0)));this._tmpCtx.fillStyle=ye.css;const Ee=ve?0:4;let fe=!1;this._config.customGlyphs!==!1&&(fe=(0,_.tryDrawCustomChar)(this._tmpCtx,U,Ee,Ee,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ae,ne=!_e;if(Ae=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),H){this._tmpCtx.save();const Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ke=Re%2==1?.5:0;if(this._tmpCtx.lineWidth=Re,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ne=!1,this._tmpCtx.strokeStyle=`rgb(${c.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ne=!1;let ct=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ct<8&&(ct+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ct).css}this._tmpCtx.beginPath();const Ue=Ee,st=Math.ceil(Ee+this._config.deviceCharHeight)-Ke-(F?2*Re:0),Tt=st+Re,lt=st+2*Re;let yt=this._workAttributeData.getUnderlineVariantOffset();for(let ct=0;ct<Ae;ct++){this._tmpCtx.save();const We=Ue+ct*this._config.deviceCellWidth,Ge=Ue+(ct+1)*this._config.deviceCellWidth,bt=We+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(We,st),this._tmpCtx.lineTo(Ge,st),this._tmpCtx.moveTo(We,lt),this._tmpCtx.lineTo(Ge,lt);break;case 3:const it=Re<=1?lt:Math.ceil(Ee+this._config.deviceCharHeight-Re/2)-Ke,Wt=Re<=1?st:Math.ceil(Ee+this._config.deviceCharHeight+Re/2)-Ke,Pt=new Path2D;Pt.rect(We,st,this._config.deviceCellWidth,lt-st),this._tmpCtx.clip(Pt),this._tmpCtx.moveTo(We-this._config.deviceCellWidth/2,Tt),this._tmpCtx.bezierCurveTo(We-this._config.deviceCellWidth/2,Wt,We,Wt,We,Tt),this._tmpCtx.bezierCurveTo(We,it,bt,it,bt,Tt),this._tmpCtx.bezierCurveTo(bt,Wt,Ge,Wt,Ge,Tt),this._tmpCtx.bezierCurveTo(Ge,it,Ge+this._config.deviceCellWidth/2,it,Ge+this._config.deviceCellWidth/2,Tt);break;case 4:const he=yt===0?0:yt>=Re?2*Re-yt:Re-yt;yt>=Re||he===0?(this._tmpCtx.setLineDash([Math.round(Re),Math.round(Re)]),this._tmpCtx.moveTo(We+he,st),this._tmpCtx.lineTo(Ge,st)):(this._tmpCtx.setLineDash([Math.round(Re),Math.round(Re)]),this._tmpCtx.moveTo(We,st),this._tmpCtx.lineTo(We+he,st),this._tmpCtx.moveTo(We+he+Re,st),this._tmpCtx.lineTo(Ge,st)),yt=(0,h.computeNextVariantOffset)(Ge-We,Re,yt);break;case 5:const Oe=.6,Qe=.3,Ot=Ge-We,ze=Math.floor(Oe*Ot),xe=Math.floor(Qe*Ot),He=Ot-ze-xe;this._tmpCtx.setLineDash([ze,xe,He]),this._tmpCtx.moveTo(We,st),this._tmpCtx.lineTo(Ge,st);break;default:this._tmpCtx.moveTo(We,st),this._tmpCtx.lineTo(Ge,st)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!fe&&this._config.fontSize>=12&&!this._config.allowTransparency&&U!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ct=this._tmpCtx.measureText(U);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ct&&ct.actualBoundingBoxDescent>0){this._tmpCtx.save();const We=new Path2D;We.rect(Ue,st-Math.ceil(Re/2),this._config.deviceCellWidth*Ae,lt-st+Math.ceil(Re/2)),this._tmpCtx.clip(We),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=K.css,this._tmpCtx.strokeText(U,Ee,Ee+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(te){const Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ke=Re%2==1?.5:0;this._tmpCtx.lineWidth=Re,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ee,Ee+Ke),this._tmpCtx.lineTo(Ee+this._config.deviceCharWidth*Ae,Ee+Ke),this._tmpCtx.stroke()}if(fe||this._tmpCtx.fillText(U,Ee,Ee+this._config.deviceCharHeight),U==="_"&&!this._config.allowTransparency){let Re=x(this._tmpCtx.getImageData(Ee,Ee,this._config.deviceCellWidth,this._config.deviceCellHeight),K,ye,ne);if(Re)for(let Ke=1;Ke<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=K.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(U,Ee,Ee+this._config.deviceCharHeight-Ke),Re=x(this._tmpCtx.getImageData(Ee,Ee,this._config.deviceCellWidth,this._config.deviceCellHeight),K,ye,ne),Re);Ke++);}if(V){const Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ke=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Re,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ee,Ee+Math.floor(this._config.deviceCharHeight/2)-Ke),this._tmpCtx.lineTo(Ee+this._config.deviceCharWidth*Ae,Ee+Math.floor(this._config.deviceCharHeight/2)-Ke),this._tmpCtx.stroke()}this._tmpCtx.restore();const Ie=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let oe;if(oe=this._config.allowTransparency?(function(Re){for(let Ke=0;Ke<Re.data.length;Ke+=4)if(Re.data[Ke+3]>0)return!1;return!0})(Ie):x(Ie,K,ye,ne),oe)return m;const ue=this._findGlyphBoundingBox(Ie,this._workBoundingBox,q,ve,fe,Ee);let de,Me;for(;;){if(this._activePages.length===0){const Re=this._createNewPage();de=Re,Me=Re.currentRow,Me.height=ue.size.y;break}de=this._activePages[this._activePages.length-1],Me=de.currentRow;for(const Re of this._activePages)ue.size.y<=Re.currentRow.height&&(de=Re,Me=Re.currentRow);for(let Re=this._activePages.length-1;Re>=0;Re--)for(const Ke of this._activePages[Re].fixedRows)Ke.height<=Me.height&&ue.size.y<=Ke.height&&(de=this._activePages[Re],Me=Ke);if(Me.y+ue.size.y>=de.canvas.height||Me.height>ue.size.y+2){let Re=!1;if(de.currentRow.y+de.currentRow.height+ue.size.y>=de.canvas.height){let Ke;for(const Ue of this._activePages)if(Ue.currentRow.y+Ue.currentRow.height+ue.size.y<Ue.canvas.height){Ke=Ue;break}if(Ke)de=Ke;else if(L.maxAtlasPages&&this._pages.length>=L.maxAtlasPages&&Me.y+ue.size.y<=de.canvas.height&&Me.height>=ue.size.y&&Me.x+ue.size.x<=de.canvas.width)Re=!0;else{const Ue=this._createNewPage();de=Ue,Me=Ue.currentRow,Me.height=ue.size.y,Re=!0}}Re||(de.currentRow.height>0&&de.fixedRows.push(de.currentRow),Me={x:0,y:de.currentRow.y+de.currentRow.height,height:ue.size.y},de.fixedRows.push(Me),de.currentRow={x:0,y:Me.y+Me.height,height:0})}if(Me.x+ue.size.x<=de.canvas.width)break;Me===de.currentRow?(Me.x=0,Me.y+=Me.height,Me.height=0):de.fixedRows.splice(de.fixedRows.indexOf(Me),1)}return ue.texturePage=this._pages.indexOf(de),ue.texturePosition.x=Me.x,ue.texturePosition.y=Me.y,ue.texturePositionClipSpace.x=Me.x/de.canvas.width,ue.texturePositionClipSpace.y=Me.y/de.canvas.height,ue.sizeClipSpace.x/=de.canvas.width,ue.sizeClipSpace.y/=de.canvas.height,Me.height=Math.max(Me.height,ue.size.y),Me.x+=ue.size.x,de.ctx.putImageData(Ie,ue.texturePosition.x-this._workBoundingBox.left,ue.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ue.size.x,ue.size.y),de.addGlyph(ue),de.version++,ue}_findGlyphBoundingBox(T,D,B,O,F,U){D.top=0;const q=O?this._config.deviceCellHeight:this._tmpCanvas.height,G=O?this._config.deviceCellWidth:B;let Y=!1;for(let W=0;W<q;W++){for(let j=0;j<G;j++){const $=W*this._tmpCanvas.width*4+4*j+3;if(T.data[$]!==0){D.top=W,Y=!0;break}}if(Y)break}D.left=0,Y=!1;for(let W=0;W<U+G;W++){for(let j=0;j<q;j++){const $=j*this._tmpCanvas.width*4+4*W+3;if(T.data[$]!==0){D.left=W,Y=!0;break}}if(Y)break}D.right=G,Y=!1;for(let W=U+G-1;W>=U;W--){for(let j=0;j<q;j++){const $=j*this._tmpCanvas.width*4+4*W+3;if(T.data[$]!==0){D.right=W,Y=!0;break}}if(Y)break}D.bottom=q,Y=!1;for(let W=q-1;W>=0;W--){for(let j=0;j<G;j++){const $=W*this._tmpCanvas.width*4+4*j+3;if(T.data[$]!==0){D.bottom=W,Y=!0;break}}if(Y)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:D.right-D.left+1,y:D.bottom-D.top+1},sizeClipSpace:{x:D.right-D.left+1,y:D.bottom-D.top+1},offset:{x:-D.left+U+(O||F?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-D.top+U+(O||F?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}r.TextureAtlas=L;class I{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(T){this._glyphs.push(T),this._usedPixels+=T.size.x*T.size.y}constructor(T,D,B){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],B)for(const O of B)this._glyphs.push(...O.glyphs),this._usedPixels+=O._usedPixels;this.canvas=M(T,D,D),this.ctx=(0,h.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(b,T,D,B){const O=T.rgba>>>24,F=T.rgba>>>16&255,U=T.rgba>>>8&255,q=D.rgba>>>24,G=D.rgba>>>16&255,Y=D.rgba>>>8&255,W=Math.floor((Math.abs(O-q)+Math.abs(F-G)+Math.abs(U-Y))/12);let j=!0;for(let $=0;$<b.data.length;$+=4)b.data[$]===O&&b.data[$+1]===F&&b.data[$+2]===U||B&&Math.abs(b.data[$]-O)+Math.abs(b.data[$+1]-F)+Math.abs(b.data[$+2]-U)<W?b.data[$+3]=0:j=!1;return j}function M(b,T,D){const B=b.createElement("canvas");return B.width=T,B.height=D,B}},160:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let u=0,v=0,_=0,h=0;var w,E,R,g,c;function f(d){const L=d.toString(16);return L.length<2?"0"+L:L}function m(d,L){return d<L?(L+.05)/(d+.05):(d+.05)/(L+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(L,I,x,M){return M!==void 0?`#${f(L)}${f(I)}${f(x)}${f(M)}`:`#${f(L)}${f(I)}${f(x)}`},d.toRgba=function(L,I,x,M=255){return(L<<24|I<<16|x<<8|M)>>>0},d.toColor=function(L,I,x,M){return{css:d.toCss(L,I,x,M),rgba:d.toRgba(L,I,x,M)}}})(w||(r.channels=w={})),(function(d){function L(I,x){return h=Math.round(255*x),[u,v,_]=c.toChannels(I.rgba),{css:w.toCss(u,v,_,h),rgba:w.toRgba(u,v,_,h)}}d.blend=function(I,x){if(h=(255&x.rgba)/255,h===1)return{css:x.css,rgba:x.rgba};const M=x.rgba>>24&255,b=x.rgba>>16&255,T=x.rgba>>8&255,D=I.rgba>>24&255,B=I.rgba>>16&255,O=I.rgba>>8&255;return u=D+Math.round((M-D)*h),v=B+Math.round((b-B)*h),_=O+Math.round((T-O)*h),{css:w.toCss(u,v,_),rgba:w.toRgba(u,v,_)}},d.isOpaque=function(I){return(255&I.rgba)==255},d.ensureContrastRatio=function(I,x,M){const b=c.ensureContrastRatio(I.rgba,x.rgba,M);if(b)return w.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(I){const x=(255|I.rgba)>>>0;return[u,v,_]=c.toChannels(x),{css:w.toCss(u,v,_),rgba:x}},d.opacity=L,d.multiplyOpacity=function(I,x){return h=255&I.rgba,L(I,h*x/255)},d.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(E||(r.color=E={})),(function(d){let L,I;try{const x=document.createElement("canvas");x.width=1,x.height=1;const M=x.getContext("2d",{willReadFrequently:!0});M&&(L=M,L.globalCompositeOperation="copy",I=L.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return u=parseInt(x.slice(1,2).repeat(2),16),v=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),w.toColor(u,v,_);case 5:return u=parseInt(x.slice(1,2).repeat(2),16),v=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),h=parseInt(x.slice(4,5).repeat(2),16),w.toColor(u,v,_,h);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const M=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return u=parseInt(M[1]),v=parseInt(M[2]),_=parseInt(M[3]),h=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),w.toColor(u,v,_,h);if(!L||!I)throw new Error("css.toColor: Unsupported css format");if(L.fillStyle=I,L.fillStyle=x,typeof L.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(L.fillRect(0,0,1,1),[u,v,_,h]=L.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(u,v,_,h),css:x}}})(R||(r.css=R={})),(function(d){function L(I,x,M){const b=I/255,T=x/255,D=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}d.relativeLuminance=function(I){return L(I>>16&255,I>>8&255,255&I)},d.relativeLuminance2=L})(g||(r.rgb=g={})),(function(d){function L(x,M,b){const T=x>>24&255,D=x>>16&255,B=x>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));for(;q<b&&(O>0||F>0||U>0);)O-=Math.max(0,Math.ceil(.1*O)),F-=Math.max(0,Math.ceil(.1*F)),U-=Math.max(0,Math.ceil(.1*U)),q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));return(O<<24|F<<16|U<<8|255)>>>0}function I(x,M,b){const T=x>>24&255,D=x>>16&255,B=x>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));for(;q<b&&(O<255||F<255||U<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=Math.min(255,U+Math.ceil(.1*(255-U))),q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));return(O<<24|F<<16|U<<8|255)>>>0}d.blend=function(x,M){if(h=(255&M)/255,h===1)return M;const b=M>>24&255,T=M>>16&255,D=M>>8&255,B=x>>24&255,O=x>>16&255,F=x>>8&255;return u=B+Math.round((b-B)*h),v=O+Math.round((T-O)*h),_=F+Math.round((D-F)*h),w.toRgba(u,v,_)},d.ensureContrastRatio=function(x,M,b){const T=g.relativeLuminance(x>>8),D=g.relativeLuminance(M>>8);if(m(T,D)<b){if(D<T){const F=L(x,M,b),U=m(T,g.relativeLuminance(F>>8));if(U<b){const q=I(x,M,b);return U>m(T,g.relativeLuminance(q>>8))?F:q}return F}const B=I(x,M,b),O=m(T,g.relativeLuminance(B>>8));if(O<b){const F=L(x,M,b);return O>m(T,g.relativeLuminance(F>>8))?B:F}return B}},d.reduceLuminance=L,d.increaseLuminance=I,d.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(c||(r.rgba=c={})),r.toPaddedHex=f,r.contrastRatio=m},345:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let v=0;v<this._listeners.length;v++)if(this._listeners[v]===u)return void this._listeners.splice(v,1)}}})),this._event}fire(u,v){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,u,v)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(u,v){return u((_=>v.fire(_)))},r.runAndSubscribe=function(u,v){return v(void 0),u((_=>v(_)))}},859:(C,r)=>{function u(v){for(const _ of v)_.dispose();v.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const v of this._disposables)v.dispose();this._disposables.length=0}register(v){return this._disposables.push(v),v}unregister(v){const _=this._disposables.indexOf(v);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(v){var _;this._isDisposed||v===this._value||((_=this._value)==null||_.dispose(),this._value=v)}clear(){this.value=void 0}dispose(){var v;this._isDisposed=!0,(v=this._value)==null||v.dispose(),this._value=void 0}},r.toDisposable=function(v){return{dispose:v}},r.disposeArray=u,r.getDisposeArrayDisposable=function(v){return{dispose:()=>u(v)}}},485:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(_,h,w){this._data[_]||(this._data[_]={}),this._data[_][h]=w}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=u,r.FourKeyMap=class{constructor(){this._data=new u}set(v,_,h,w,E){this._data.get(v,_)||this._data.set(v,_,new u),this._data.get(v,_).set(h,w,E)}get(v,_,h,w){var E;return(E=this._data.get(v,_))==null?void 0:E.get(h,w)}clear(){this._data.clear()}}},399:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const u=r.isNode?"node":navigator.userAgent,v=r.isNode?"node":navigator.platform;r.isFirefox=u.includes("Firefox"),r.isLegacyEdge=u.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(u),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=u.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(v),r.isIpad=v==="iPad",r.isIphone=v==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(v),r.isLinux=v.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(u)},385:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const v=u(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let R=0,g=0,c=E.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(R=Date.now(),this._tasks[this._i]()||this._i++,R=Math.max(1,Date.now()-R),g=Math.max(R,g),f=E.timeRemaining(),1.5*g>f)return c-R<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-R))}ms`),void this._start();c=f}this.clear()}}class h extends _{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const R=Date.now()+E;return{timeRemaining:()=>Math.max(0,R-Date.now())}}}r.PriorityTaskQueue=h,r.IdleTaskQueue=!v.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(w){return requestIdleCallback(w)}_cancelCallback(w){cancelIdleCallback(w)}}:h,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(w){this._queue.clear(),this._queue.enqueue(w)}flush(){this._queue.flush()}}},147:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new v}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new u;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=u;class v{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,w=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=w}clone(){return new v(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=v},782:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const v=u(133),_=u(855),h=u(147);class w extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(R){const g=new w;return g.setFromCharData(R),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,v.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(R){this.fg=R[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(R[_.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(R[_.CHAR_DATA_CHAR_INDEX].length===2){const c=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){const f=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(c-55296)+f-56320+65536|R[_.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|R[_.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=R[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|R[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=w},855:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},133:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},r.utf32ToString=function(u,v=0,_=u.length){let h="";for(let w=v;w<_;++w){let E=u[w];E>65535?(E-=65536,h+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):h+=String.fromCharCode(E)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,v){const _=u.length;if(!_)return 0;let h=0,w=0;if(this._interim){const E=u.charCodeAt(w++);56320<=E&&E<=57343?v[h++]=1024*(this._interim-55296)+E-56320+65536:(v[h++]=this._interim,v[h++]=E),this._interim=0}for(let E=w;E<_;++E){const R=u.charCodeAt(E);if(55296<=R&&R<=56319){if(++E>=_)return this._interim=R,h;const g=u.charCodeAt(E);56320<=g&&g<=57343?v[h++]=1024*(R-55296)+g-56320+65536:(v[h++]=R,v[h++]=g)}else R!==65279&&(v[h++]=R)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,v){const _=u.length;if(!_)return 0;let h,w,E,R,g=0,c=0,f=0;if(this.interim[0]){let L=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let x,M=0;for(;(x=63&this.interim[++M])&&M<4;)I<<=6,I|=x;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;f<T;){if(f>=_)return 0;if(x=u[f++],(192&x)!=128){f--,L=!0;break}this.interim[M++]=x,I<<=6,I|=63&x}L||(b===2?I<128?f--:v[g++]=I:b===3?I<2048||I>=55296&&I<=57343||I===65279||(v[g++]=I):I<65536||I>1114111||(v[g++]=I)),this.interim.fill(0)}const m=_-4;let d=f;for(;d<_;){for(;!(!(d<m)||128&(h=u[d])||128&(w=u[d+1])||128&(E=u[d+2])||128&(R=u[d+3]));)v[g++]=h,v[g++]=w,v[g++]=E,v[g++]=R,d+=4;if(h=u[d++],h<128)v[g++]=h;else if((224&h)==192){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(c=(31&h)<<6|63&w,c<128){d--;continue}v[g++]=c}else if((240&h)==224){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,g;if(E=u[d++],(192&E)!=128){d--;continue}if(c=(15&h)<<12|(63&w)<<6|63&E,c<2048||c>=55296&&c<=57343||c===65279)continue;v[g++]=c}else if((248&h)==240){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,g;if(E=u[d++],(192&E)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,this.interim[2]=E,g;if(R=u[d++],(192&R)!=128){d--;continue}if(c=(7&h)<<18|(63&w)<<12|(63&E)<<6|63&R,c<65536||c>1114111)continue;v[g++]=c}}return g}}},776:function(C,r,u){var v=this&&this.__decorate||function(c,f,m,d){var L,I=arguments.length,x=I<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(c,f,m,d);else for(var M=c.length-1;M>=0;M--)(L=c[M])&&(x=(I<3?L(x):I>3?L(f,m,x):L(f,m))||x);return I>3&&x&&Object.defineProperty(f,m,x),x},_=this&&this.__param||function(c,f){return function(m,d){f(m,d,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const h=u(859),w=u(97),E={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF};let R,g=r.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),R=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let f=0;f<c.length;f++)typeof c[f]=="function"&&(c[f]=c[f]())}_log(c,f,m){this._evalLazyOptionalParams(m),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...m)}trace(c,...f){var m;this._logLevel<=w.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,c,f)}debug(c,...f){var m;this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,c,f)}info(c,...f){var m;this._logLevel<=w.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,c,f)}warn(c,...f){var m;this._logLevel<=w.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,c,f)}error(c,...f){var m;this._logLevel<=w.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,c,f)}};r.LogService=g=v([_(0,w.IOptionsService)],g),r.setTraceLogger=function(c){R=c},r.traceCall=function(c,f,m){if(typeof m.value!="function")throw new Error("not supported");const d=m.value;m.value=function(...L){if(R.logLevel!==w.LogLevelEnum.TRACE)return d.apply(this,L);R.trace(`GlyphRenderer#${d.name}(${L.map((x=>JSON.stringify(x))).join(", ")})`);const I=d.apply(this,L);return R.trace(`GlyphRenderer#${d.name} return`,I),I}}},726:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const u="di$target",v="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[v]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const h=function(w,E,R){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,c,f){c[u]===c?c[v].push({id:g,index:f}):(c[v]=[{id:g,index:f}],c[u]=c)})(h,w,R)};return h.toString=()=>_,r.serviceRegistry.set(_,h),h}},97:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const v=u(726);var _;r.IBufferService=(0,v.createDecorator)("BufferService"),r.ICoreMouseService=(0,v.createDecorator)("CoreMouseService"),r.ICoreService=(0,v.createDecorator)("CoreService"),r.ICharsetService=(0,v.createDecorator)("CharsetService"),r.IInstantiationService=(0,v.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,v.createDecorator)("LogService"),r.IOptionsService=(0,v.createDecorator)("OptionsService"),r.IOscLinkService=(0,v.createDecorator)("OscLinkService"),r.IUnicodeService=(0,v.createDecorator)("UnicodeService"),r.IDecorationService=(0,v.createDecorator)("DecorationService")}},a={};function p(C){var r=a[C];if(r!==void 0)return r.exports;var u=a[C]={exports:{}};return i[C].call(u.exports,u,u.exports,p),u.exports}var k={};return(()=>{var C=k;Object.defineProperty(C,"__esModule",{value:!0}),C.WebglAddon=void 0;const r=p(345),u=p(859),v=p(399),_=p(666),h=p(776);class w extends u.Disposable{constructor(R){if(v.isSafari&&(0,v.getSafariVersion)()<16){const g={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",g))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=R,this._onChangeTextureAtlas=this.register(new r.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new r.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new r.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new r.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(R){const g=R._core;if(!R.element)return void this.register(g.onWillOpen((()=>this.activate(R))));this._terminal=R;const c=g.coreService,f=g.optionsService,m=g,d=m._renderService,L=m._characterJoinerService,I=m._charSizeService,x=m._coreBrowserService,M=m._decorationService,b=m._logService,T=m._themeService;(0,h.setTraceLogger)(b),this._renderer=this.register(new _.WebglRenderer(R,L,I,x,c,M,f,T,this._preserveDrawingBuffer)),this.register((0,r.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,r.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,r.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,r.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),d.setRenderer(this._renderer),this.register((0,u.toDisposable)((()=>{const D=this._terminal._core._renderService;D.setRenderer(this._terminal._core._createRenderer()),D.handleResize(R.cols,R.rows)})))}get textureAtlas(){var R;return(R=this._renderer)==null?void 0:R.textureAtlas}clearTextureAtlas(){var R;(R=this._renderer)==null||R.clearTextureAtlas()}}C.WebglAddon=w})(),k})()))})(qc)),qc.exports}var wb=_b(),Vc={exports:{}},Jf;function yb(){return Jf||(Jf=1,(function(n,t){(function(i,a){n.exports=a()})(globalThis,(()=>(()=>{var i={4567:function(C,r,u){var v=this&&this.__decorate||function(m,d,L,I){var x,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,L,I);else for(var T=m.length-1;T>=0;T--)(x=m[T])&&(b=(M<3?x(b):M>3?x(d,L,b):x(d,L))||b);return M>3&&b&&Object.defineProperty(d,L,b),b},_=this&&this.__param||function(m,d){return function(L,I){d(L,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const h=u(9042),w=u(9924),E=u(844),R=u(4725),g=u(2585),c=u(3656);let f=r.AccessibilityManager=class extends E.Disposable{constructor(m,d,L,I){super(),this._terminal=m,this._coreBrowserService=L,this._renderService=I,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new w.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
114
|
+
`)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,E.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(m){for(let d=0;d<m;d++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
|
|
115
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,d){this._liveRegionDebouncer.refresh(m,d,this._terminal.rows)}_renderRows(m,d){const L=this._terminal.buffer,I=L.lines.length.toString();for(let x=m;x<=d;x++){const M=L.lines.get(L.ydisp+x),b=[],T=(M==null?void 0:M.translateToString(!0,void 0,void 0,b))||"",D=(L.ydisp+x+1).toString(),B=this._rowElements[x];B&&(T.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=T,this._rowColumns.set(B,b)),B.setAttribute("aria-posinset",D),B.setAttribute("aria-setsize",I))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,d){const L=m.target,I=this._rowElements[d===0?1:this._rowElements.length-2];if(L.getAttribute("aria-posinset")===(d===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==I)return;let x,M;if(d===0?(x=L,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(x=this._rowElements.shift(),M=L,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),M.removeEventListener("focus",this._bottomBoundaryFocusListener),d===0){const b=this._createAccessibilityTreeNode();this._rowElements.unshift(b),this._rowContainer.insertAdjacentElement("afterbegin",b)}else{const b=this._createAccessibilityTreeNode();this._rowElements.push(b),this._rowContainer.appendChild(b)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(d===0?-1:1),this._rowElements[d===0?1:this._rowElements.length-2].focus(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let d={node:m.anchorNode,offset:m.anchorOffset},L={node:m.focusNode,offset:m.focusOffset};if((d.node.compareDocumentPosition(L.node)&Node.DOCUMENT_POSITION_PRECEDING||d.node===L.node&&d.offset>L.offset)&&([d,L]=[L,d]),d.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(d={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(d.node))return;const I=this._rowElements.slice(-1)[0];if(L.node.compareDocumentPosition(I)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(L={node:I,offset:((T=I.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(L.node))return;const x=({node:D,offset:B})=>{const O=D instanceof Text?D.parentNode:D;let F=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(O);if(!U)return console.warn("columns is null. Race condition?"),null;let q=B<U.length?U[B]:U.slice(-1)[0]+1;return q>=this._terminal.cols&&(++F,q=0),{row:F,column:q}},M=x(d),b=x(L);if(M&&b){if(M.row>b.row||M.row===b.row&&M.column>=b.column)throw new Error("invalid range");this._terminal.select(M.column,M.row,(b.row-M.row)*this._terminal.cols-M.column+b.column)}}_handleResize(m){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let d=this._rowContainer.children.length;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);for(;this._rowElements.length>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=f=v([_(1,g.IInstantiationService),_(2,R.ICoreBrowserService),_(3,R.IRenderService)],f)},3614:(C,r)=>{function u(w){return w.replace(/\r?\n/g,"\r")}function v(w,E){return E?"\x1B[200~"+w+"\x1B[201~":w}function _(w,E,R,g){w=v(w=u(w),R.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),R.triggerDataEvent(w,!0),E.value=""}function h(w,E,R){const g=R.getBoundingClientRect(),c=w.clientX-g.left-10,f=w.clientY-g.top-10;E.style.width="20px",E.style.height="20px",E.style.left=`${c}px`,E.style.top=`${f}px`,E.style.zIndex="1000",E.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=u,r.bracketTextForPaste=v,r.copyHandler=function(w,E){w.clipboardData&&w.clipboardData.setData("text/plain",E.selectionText),w.preventDefault()},r.handlePasteEvent=function(w,E,R,g){w.stopPropagation(),w.clipboardData&&_(w.clipboardData.getData("text/plain"),E,R,g)},r.paste=_,r.moveTextAreaUnderMouseCursor=h,r.rightClickHandler=function(w,E,R,g,c){h(w,E,R),c&&g.rightClickSelect(w),E.value=g.selectionText,E.select()}},7239:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const v=u(1505);r.ColorContrastCache=class{constructor(){this._color=new v.TwoKeyMap,this._css=new v.TwoKeyMap}setCss(_,h,w){this._css.set(_,h,w)}getCss(_,h){return this._css.get(_,h)}setColor(_,h,w){this._color.set(_,h,w)}getColor(_,h){return this._color.get(_,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(u,v,_,h){u.addEventListener(v,_,h);let w=!1;return{dispose:()=>{w||(w=!0,u.removeEventListener(v,_,h))}}}},3551:function(C,r,u){var v=this&&this.__decorate||function(f,m,d,L){var I,x=arguments.length,M=x<3?m:L===null?L=Object.getOwnPropertyDescriptor(m,d):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,m,d,L);else for(var b=f.length-1;b>=0;b--)(I=f[b])&&(M=(x<3?I(M):x>3?I(m,d,M):I(m,d))||M);return x>3&&M&&Object.defineProperty(m,d,M),M},_=this&&this.__param||function(f,m){return function(d,L){m(d,L,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const h=u(3656),w=u(8460),E=u(844),R=u(2585),g=u(4725);let c=r.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(f,m,d,L,I){super(),this._element=f,this._mouseService=m,this._renderService=d,this._bufferService=L,this._linkProviderService=I,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new w.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new w.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,E.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,E.toDisposable)((()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const m=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const d=f.composedPath();for(let L=0;L<d.length;L++){const I=d[L];if(I.classList.contains("xterm"))break;if(I.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,m){var L,I;this._activeProviderReplies&&m||((L=this._activeProviderReplies)==null||L.forEach((x=>{x==null||x.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let d=!1;for(const[x,M]of this._linkProviderService.linkProviders.entries())m?(I=this._activeProviderReplies)!=null&&I.get(x)&&(d=this._checkLinkProviderResult(x,f,d)):M.provideLinks(f.y,(b=>{var D,B;if(this._isMouseOut)return;const T=b==null?void 0:b.map((O=>({link:O})));(D=this._activeProviderReplies)==null||D.set(x,T),d=this._checkLinkProviderResult(x,f,d),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,m){const d=new Set;for(let L=0;L<m.size;L++){const I=m.get(L);if(I)for(let x=0;x<I.length;x++){const M=I[x],b=M.link.range.start.y<f?0:M.link.range.start.x,T=M.link.range.end.y>f?this._bufferService.cols:M.link.range.end.x;for(let D=b;D<=T;D++){if(d.has(D)){I.splice(x--,1);break}d.add(D)}}}}_checkLinkProviderResult(f,m,d){var x;if(!this._activeProviderReplies)return d;const L=this._activeProviderReplies.get(f);let I=!1;for(let M=0;M<f;M++)this._activeProviderReplies.has(M)&&!this._activeProviderReplies.get(M)||(I=!0);if(!I&&L){const M=L.find((b=>this._linkAtPosition(b.link,m)));M&&(d=!0,this._handleNewLink(M))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!d)for(let M=0;M<this._activeProviderReplies.size;M++){const b=(x=this._activeProviderReplies.get(M))==null?void 0:x.find((T=>this._linkAtPosition(T.link,m)));if(b){d=!0,this._handleNewLink(b);break}}return d}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const m=this._positionFromMouseEvent(f,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,m){this._currentLink&&this._lastMouseEvent&&(!f||!m||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,E.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(f.link,m)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var d,L;return(L=(d=this._currentLink)==null?void 0:d.state)==null?void 0:L.decorations.pointerCursor},set:d=>{var L;(L=this._currentLink)!=null&&L.state&&this._currentLink.state.decorations.pointerCursor!==d&&(this._currentLink.state.decorations.pointerCursor=d,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",d))}},underline:{get:()=>{var d,L;return(L=(d=this._currentLink)==null?void 0:d.state)==null?void 0:L.decorations.underline},set:d=>{var L,I,x;(L=this._currentLink)!=null&&L.state&&((x=(I=this._currentLink)==null?void 0:I.state)==null?void 0:x.decorations.underline)!==d&&(this._currentLink.state.decorations.underline=d,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,d))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((d=>{if(!this._currentLink)return;const L=d.start===0?0:d.start+1+this._bufferService.buffer.ydisp,I=this._bufferService.buffer.ydisp+1+d.end;if(this._currentLink.link.range.start.y>=L&&this._currentLink.link.range.end.y<=I&&(this._clearCurrentLink(L,I),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(f,m,d){var L;(L=this._currentLink)!=null&&L.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(d,m.text)}_fireUnderlineEvent(f,m){const d=f.range,L=this._bufferService.buffer.ydisp,I=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-L-1,d.end.x,d.end.y-L-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(I)}_linkLeave(f,m,d){var L;(L=this._currentLink)!=null&&L.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(d,m.text)}_linkAtPosition(f,m){const d=f.range.start.y*this._bufferService.cols+f.range.start.x,L=f.range.end.y*this._bufferService.cols+f.range.end.x,I=m.y*this._bufferService.cols+m.x;return d<=I&&I<=L}_positionFromMouseEvent(f,m,d){const L=d.getCoords(f,m,this._bufferService.cols,this._bufferService.rows);if(L)return{x:L[0],y:L[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,m,d,L,I){return{x1:f,y1:m,x2:d,y2:L,cols:this._bufferService.cols,fg:I}}};r.Linkifier=c=v([_(1,g.IMouseService),_(2,g.IRenderService),_(3,R.IBufferService),_(4,g.ILinkProviderService)],c)},9042:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(C,r,u){var v=this&&this.__decorate||function(g,c,f,m){var d,L=arguments.length,I=L<3?c:m===null?m=Object.getOwnPropertyDescriptor(c,f):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(g,c,f,m);else for(var x=g.length-1;x>=0;x--)(d=g[x])&&(I=(L<3?d(I):L>3?d(c,f,I):d(c,f))||I);return L>3&&I&&Object.defineProperty(c,f,I),I},_=this&&this.__param||function(g,c){return function(f,m){c(f,m,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const h=u(511),w=u(2585);let E=r.OscLinkProvider=class{constructor(g,c,f){this._bufferService=g,this._optionsService=c,this._oscLinkService=f}provideLinks(g,c){var T;const f=this._bufferService.buffer.lines.get(g-1);if(!f)return void c(void 0);const m=[],d=this._optionsService.rawOptions.linkHandler,L=new h.CellData,I=f.getTrimmedLength();let x=-1,M=-1,b=!1;for(let D=0;D<I;D++)if(M!==-1||f.hasContent(D)){if(f.loadCell(D,L),L.hasExtendedAttrs()&&L.extended.urlId){if(M===-1){M=D,x=L.extended.urlId;continue}b=L.extended.urlId!==x}else M!==-1&&(b=!0);if(b||M!==-1&&D===I-1){const B=(T=this._oscLinkService.getLinkData(x))==null?void 0:T.uri;if(B){const O={start:{x:M+1,y:g},end:{x:D+(b||D!==I-1?0:1),y:g}};let F=!1;if(!(d!=null&&d.allowNonHttpProtocols))try{const U=new URL(B);["http:","https:"].includes(U.protocol)||(F=!0)}catch{F=!0}F||m.push({text:B,range:O,activate:(U,q)=>d?d.activate(U,q,O):R(0,q),hover:(U,q)=>{var G;return(G=d==null?void 0:d.hover)==null?void 0:G.call(d,U,q,O)},leave:(U,q)=>{var G;return(G=d==null?void 0:d.leave)==null?void 0:G.call(d,U,q,O)}})}b=!1,L.hasExtendedAttrs()&&L.extended.urlId?(M=D,x=L.extended.urlId):(M=-1,x=-1)}}c(m)}};function R(g,c){if(confirm(`Do you want to navigate to ${c}?
|
|
116
|
+
|
|
117
|
+
WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=E=v([_(0,w.IBufferService),_(1,w.IOptionsService),_(2,w.IOscLinkService)],E)},6193:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(u,v){this._renderCallback=u,this._coreBrowserService=v,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,v,_){this._rowCount=_,u=u!==void 0?u:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const u=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,v),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const v=u(3614),_=u(3656),h=u(3551),w=u(9042),E=u(3730),R=u(1680),g=u(3107),c=u(5744),f=u(2950),m=u(1296),d=u(428),L=u(4269),I=u(5114),x=u(8934),M=u(3230),b=u(9312),T=u(4725),D=u(6731),B=u(8055),O=u(8969),F=u(8460),U=u(844),q=u(6114),G=u(8437),Y=u(2584),W=u(7399),j=u(5941),$=u(9074),H=u(2585),V=u(5435),te=u(4567),ie=u(779);class pe extends O.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(X={}){super(X),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(E.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((K,J)=>this.refresh(K,J)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((K=>this._reportWindowsOptions(K)))),this.register(this._inputHandler.onColor((K=>this._handleColorEvent(K)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((K=>this._afterResize(K.cols,K.rows)))),this.register((0,U.toDisposable)((()=>{var K,J;this._customKeyEventHandler=void 0,(J=(K=this.element)==null?void 0:K.parentNode)==null||J.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const K of X){let J,Z="";switch(K.index){case 256:J="foreground",Z="10";break;case 257:J="background",Z="11";break;case 258:J="cursor",Z="12";break;default:J="ansi",Z="4;"+K.index}switch(K.type){case 0:const _e=B.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[K.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${Z};${(0,j.toRgbString)(_e)}${Y.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors((ve=>ve.ansi[K.index]=B.channels.toColor(...K.color)));else{const ve=J;this._themeService.modifyColors((ye=>ye[ve]=B.channels.toColor(...K.color)))}break;case 2:this._themeService.restoreColor(K.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,K=this.buffer.lines.get(X);if(!K)return;const J=Math.min(this.buffer.x,this.cols-1),Z=this._renderService.dimensions.css.cell.height,_e=K.getWidth(J),ve=this._renderService.dimensions.css.cell.width*_e,ye=this.buffer.y*this._renderService.dimensions.css.cell.height,Ee=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ee+"px",this.textarea.style.top=ye+"px",this.textarea.style.width=ve+"px",this.textarea.style.height=Z+"px",this.textarea.style.lineHeight=Z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(K=>{this.hasSelection()&&(0,v.copyHandler)(K,this._selectionService)})));const X=K=>(0,v.handlePasteEvent)(K,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,_.addDisposableDomListener)(this.element,"paste",X)),q.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(K=>{K.button===2&&(0,v.rightClickHandler)(K,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(K=>{(0,v.rightClickHandler)(K,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(K=>{K.button===1&&(0,v.moveTextAreaUnderMouseCursor)(K,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var J;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((J=this.element)==null?void 0:J.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const K=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),K.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",(Z=>this.updateCursorStyle(Z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),K.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",w.promptLabel),q.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(I.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(T.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(Z=>this._handleTextAreaFocus(Z)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(d.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(T.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(L.CharacterJoinerService),this._instantiationService.setService(T.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(M.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(T.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Z=>this._onRender.fire(Z)))),this.onResize((Z=>this._renderService.resize(Z.cols,Z.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(K);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(R.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(b.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(T.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Z=>this._renderService.handleSelectionChanged(Z.start,Z.end,Z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Z=>{this.textarea.value=Z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(Z=>this._selectionService.handleMouseDown(Z)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Z=>this._handleScreenReaderModeOptionChange(Z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Z=>{!this._overviewRulerRenderer&&Z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,K=this.element;function J(ve){const ye=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!ye)return!1;let Ee,fe;switch(ve.overrideType||ve.type){case"mousemove":fe=32,ve.buttons===void 0?(Ee=3,ve.button!==void 0&&(Ee=ve.button<3?ve.button:3)):Ee=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":fe=0,Ee=ve.button<3?ve.button:3;break;case"mousedown":fe=1,Ee=ve.button<3?ve.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ve)===!1||X.viewport.getLinesScrolled(ve)===0)return!1;fe=ve.deltaY<0?0:1,Ee=4;break;default:return!1}return!(fe===void 0||Ee===void 0||Ee>4)&&X.coreMouseService.triggerMouseEvent({col:ye.col,row:ye.row,x:ye.x,y:ye.y,button:Ee,action:fe,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},_e={mouseup:ve=>(J(ve),ve.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(ve)),wheel:ve=>(J(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&J(ve)},mousemove:ve=>{ve.buttons||J(ve)}};this.register(this.coreMouseService.onProtocolChange((ve=>{ve?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ve)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ve?Z.mousemove||(K.addEventListener("mousemove",_e.mousemove),Z.mousemove=_e.mousemove):(K.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&ve?Z.wheel||(K.addEventListener("wheel",_e.wheel,{passive:!1}),Z.wheel=_e.wheel):(K.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&ve?Z.mouseup||(Z.mouseup=_e.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&ve?Z.mousedrag||(Z.mousedrag=_e.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(K,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return J(ve),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(ve)}))),this.register((0,_.addDisposableDomListener)(K,"wheel",(ve=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const ye=this.viewport.getLinesScrolled(ve);if(ye===0)return;const Ee=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let fe="";for(let Ae=0;Ae<Math.abs(ye);Ae++)fe+=Ee;return this.coreService.triggerDataEvent(fe,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(K,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(K,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,K){var J;(J=this._renderService)==null||J.refreshRows(X,K)}updateCursorStyle(X){var K;(K=this._selectionService)!=null&&K.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,K,J=0){var Z;J===1?(super.scrollLines(X,K,J),this.refresh(0,this.rows-1)):(Z=this.viewport)==null||Z.scrollLines(X)}paste(X){(0,v.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const K=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),K}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,K,J){this._selectionService.setSelection(X,K,J)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,K){var J;(J=this._selectionService)==null||J.selectLines(X,K)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const K=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!K&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;K||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const J=(0,W.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),J.type===3||J.type===2){const Z=this.rows-1;return this.scrollLines(J.type===2?-Z:Z),this.cancel(X,!0)}return J.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(J.cancel&&this.cancel(X,!0),!J.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(J.key!==Y.C0.ETX&&J.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:J.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(J.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,K){const J=X.isMac&&!this.options.macOptionIsMeta&&K.altKey&&!K.ctrlKey&&!K.metaKey||X.isWindows&&K.altKey&&K.ctrlKey&&!K.metaKey||X.isWindows&&K.getModifierState("AltGraph");return K.type==="keypress"?J:J&&(!K.keyCode||K.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(K){return K.keyCode===16||K.keyCode===17||K.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let K;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)K=X.charCode;else if(X.which===null||X.which===void 0)K=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;K=X.which}return!(!K||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(K=String.fromCharCode(K),this._onKey.fire({key:K,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(K,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const K=X.data;return this.coreService.triggerDataEvent(K,!0),this.cancel(X),!0}return!1}resize(X,K){X!==this.cols||K!==this.rows?super.resize(X,K):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,K){var J,Z;(J=this._charSizeService)==null||J.measure(),(Z=this.viewport)==null||Z.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let K=1;K<this.rows;K++)this.buffer.lines.push(this.buffer.getBlankLine(G.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var K,J;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(K=this._selectionService)==null||K.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const K=this._renderService.dimensions.css.canvas.width.toFixed(0),J=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${J};${K}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),_e=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${_e};${Z}t`)}}cancel(X,K){if(this.options.cancelEvents||K)return X.preventDefault(),X.stopPropagation(),!1}}r.Terminal=pe},9924:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(u,v=1e3){this._renderCallback=u,this._debounceThresholdMS=v,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,v,_){this._rowCount=_,u=u!==void 0?u:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const w=h-this._lastRefreshMs,E=this._debounceThresholdMS-w;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),E)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,v)}}},1680:function(C,r,u){var v=this&&this.__decorate||function(f,m,d,L){var I,x=arguments.length,M=x<3?m:L===null?L=Object.getOwnPropertyDescriptor(m,d):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,m,d,L);else for(var b=f.length-1;b>=0;b--)(I=f[b])&&(M=(x<3?I(M):x>3?I(m,d,M):I(m,d))||M);return x>3&&M&&Object.defineProperty(m,d,M),M},_=this&&this.__param||function(f,m){return function(d,L){m(d,L,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const h=u(3656),w=u(4725),E=u(8460),R=u(844),g=u(2585);let c=r.Viewport=class extends R.Disposable{constructor(f,m,d,L,I,x,M,b){super(),this._viewportElement=f,this._scrollArea=m,this._bufferService=d,this._optionsService=L,this._charSizeService=I,this._renderService=x,this._coreBrowserService=M,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((T=>this._activeBuffer=T.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((T=>this._renderDimensions=T))),this._handleThemeChange(b.colors),this.register(b.onChangeColors((T=>this._handleThemeChange(T)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(f){if(f)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(f,m){const d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&d<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const m=this._getPixelsScrolled(f);return m!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(f,m))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let m=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(f,m){var b;let d,L="";const I=[],x=m??this._bufferService.buffer.lines.length,M=this._bufferService.buffer.lines;for(let T=f;T<x;T++){const D=M.get(T);if(!D)continue;const B=(b=M.get(T+1))==null?void 0:b.isWrapped;if(L+=D.translateToString(!B),!B||T===M.length-1){const O=document.createElement("div");O.textContent=L,I.push(O),L.length>0&&(d=O),L=""}}return{bufferElements:I,cursorElement:d}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let m=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(f,m){const d=this._optionsService.rawOptions.fastScrollModifier;return d==="alt"&&m.altKey||d==="ctrl"&&m.ctrlKey||d==="shift"&&m.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const m=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(f,m))}};r.Viewport=c=v([_(2,g.IBufferService),_(3,g.IOptionsService),_(4,w.ICharSizeService),_(5,w.IRenderService),_(6,w.ICoreBrowserService),_(7,w.IThemeService)],c)},3107:function(C,r,u){var v=this&&this.__decorate||function(g,c,f,m){var d,L=arguments.length,I=L<3?c:m===null?m=Object.getOwnPropertyDescriptor(c,f):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(g,c,f,m);else for(var x=g.length-1;x>=0;x--)(d=g[x])&&(I=(L<3?d(I):L>3?d(c,f,I):d(c,f))||I);return L>3&&I&&Object.defineProperty(c,f,I),I},_=this&&this.__param||function(g,c){return function(f,m){c(f,m,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const h=u(4725),w=u(844),E=u(2585);let R=r.BufferDecorationRenderer=class extends w.Disposable{constructor(g,c,f,m,d){super(),this._screenElement=g,this._bufferService=c,this._coreBrowserService=f,this._decorationService=m,this._renderService=d,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((L=>this._removeDecoration(L)))),this.register((0,w.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const g of this._decorationService.decorations)this._renderDecoration(g);this._dimensionsChanged=!1}_renderDecoration(g){this._refreshStyle(g),this._dimensionsChanged&&this._refreshXPosition(g)}_createElement(g){var m;const c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",((m=g==null?void 0:g.options)==null?void 0:m.layer)==="top"),c.style.width=`${Math.round((g.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(g.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(g.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=g.options.x??0;return f&&f>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(g,c),c}_refreshStyle(g){const c=g.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)g.element&&(g.element.style.display="none",g.onRenderEmitter.fire(g.element));else{let f=this._decorationElements.get(g);f||(f=this._createElement(g),g.element=f,this._decorationElements.set(g,f),this._container.appendChild(f),g.onDispose((()=>{this._decorationElements.delete(g),f.remove()}))),f.style.top=c*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",g.onRenderEmitter.fire(f)}}_refreshXPosition(g,c=g.element){if(!c)return;const f=g.options.x??0;(g.options.anchor||"left")==="right"?c.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(g){var c;(c=this._decorationElements.get(g))==null||c.remove(),this._decorationElements.delete(g),g.dispose()}};r.BufferDecorationRenderer=R=v([_(1,E.IBufferService),_(2,h.ICoreBrowserService),_(3,E.IDecorationService),_(4,h.IRenderService)],R)},5871:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(u){if(u.options.overviewRulerOptions){for(const v of this._zones)if(v.color===u.options.overviewRulerOptions.color&&v.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(v,u.marker.line))return;if(this._lineAdjacentToZone(v,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(v,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,v){return v>=u.startBufferLine&&v<=u.endBufferLine}_lineAdjacentToZone(u,v,_){return v>=u.startBufferLine-this._linePadding[_||"full"]&&v<=u.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(u,v){u.startBufferLine=Math.min(u.startBufferLine,v),u.endBufferLine=Math.max(u.endBufferLine,v)}}},5744:function(C,r,u){var v=this&&this.__decorate||function(d,L,I,x){var M,b=arguments.length,T=b<3?L:x===null?x=Object.getOwnPropertyDescriptor(L,I):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,L,I,x);else for(var D=d.length-1;D>=0;D--)(M=d[D])&&(T=(b<3?M(T):b>3?M(L,I,T):M(L,I))||T);return b>3&&T&&Object.defineProperty(L,I,T),T},_=this&&this.__param||function(d,L){return function(I,x){L(I,x,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const h=u(5871),w=u(4725),E=u(844),R=u(2585),g={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let m=r.OverviewRulerRenderer=class extends E.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(d,L,I,x,M,b,T){var B;super(),this._viewportElement=d,this._screenElement=L,this._bufferService=I,this._decorationService=x,this._renderService=M,this._optionsService=b,this._coreBrowserService=T,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,E.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const d=Math.floor(this._canvas.width/3),L=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=d,c.center=L,c.right=d,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=c.left,f.right=c.left+c.center}_refreshDrawHeightConstants(){g.full=Math.round(2*this._coreBrowserService.dpr);const d=this._canvas.height/this._bufferService.buffer.lines.length,L=Math.round(Math.max(Math.min(d,12),6)*this._coreBrowserService.dpr);g.left=L,g.center=L,g.right=L}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*g.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const L of this._decorationService.decorations)this._colorZoneStore.addDecoration(L);this._ctx.lineWidth=1;const d=this._colorZoneStore.zones;for(const L of d)L.position!=="full"&&this._renderColorZone(L);for(const L of d)L.position==="full"&&this._renderColorZone(L);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(d){this._ctx.fillStyle=d.color,this._ctx.fillRect(f[d.position||"full"],Math.round((this._canvas.height-1)*(d.startBufferLine/this._bufferService.buffers.active.lines.length)-g[d.position||"full"]/2),c[d.position||"full"],Math.round((this._canvas.height-1)*((d.endBufferLine-d.startBufferLine)/this._bufferService.buffers.active.lines.length)+g[d.position||"full"]))}_queueRefresh(d,L){this._shouldUpdateDimensions=d||this._shouldUpdateDimensions,this._shouldUpdateAnchor=L||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=m=v([_(2,R.IBufferService),_(3,R.IDecorationService),_(4,w.IRenderService),_(5,R.IOptionsService),_(6,w.ICoreBrowserService)],m)},2950:function(C,r,u){var v=this&&this.__decorate||function(g,c,f,m){var d,L=arguments.length,I=L<3?c:m===null?m=Object.getOwnPropertyDescriptor(c,f):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(g,c,f,m);else for(var x=g.length-1;x>=0;x--)(d=g[x])&&(I=(L<3?d(I):L>3?d(c,f,I):d(c,f))||I);return L>3&&I&&Object.defineProperty(c,f,I),I},_=this&&this.__param||function(g,c){return function(f,m){c(f,m,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const h=u(4725),w=u(2585),E=u(2584);let R=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,c,f,m,d,L){this._textarea=g,this._compositionView=c,this._bufferService=f,this._optionsService=m,this._coreService=d,this._renderService=L,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}}),0)}else{this._isSendingComposition=!1;const c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const c=this._textarea.value,f=c.replace(g,"");this._dataAlreadySent=f,c.length>g.length?this._coreService.triggerDataEvent(f,!0):c.length<g.length?this._coreService.triggerDataEvent(`${E.C0.DEL}`,!0):c.length===g.length&&c!==g&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,m=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,d=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=d+"px",this._compositionView.style.top=m+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const L=this._compositionView.getBoundingClientRect();this._textarea.style.left=d+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(L.width,1)+"px",this._textarea.style.height=Math.max(L.height,1)+"px",this._textarea.style.lineHeight=L.height+"px"}g||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=R=v([_(2,w.IBufferService),_(3,w.IOptionsService),_(4,w.ICoreService),_(5,h.IRenderService)],R)},9806:(C,r)=>{function u(v,_,h){const w=h.getBoundingClientRect(),E=v.getComputedStyle(h),R=parseInt(E.getPropertyValue("padding-left")),g=parseInt(E.getPropertyValue("padding-top"));return[_.clientX-w.left-R,_.clientY-w.top-g]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=u,r.getCoords=function(v,_,h,w,E,R,g,c,f){if(!R)return;const m=u(v,_,h);return m?(m[0]=Math.ceil((m[0]+(f?g/2:0))/g),m[1]=Math.ceil(m[1]/c),m[0]=Math.min(Math.max(m[0],1),w+(f?1:0)),m[1]=Math.min(Math.max(m[1],1),E),m):void 0}},9504:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const v=u(2584);function _(c,f,m,d){const L=c-h(c,m),I=f-h(f,m),x=Math.abs(L-I)-(function(M,b,T){let D=0;const B=M-h(M,T),O=b-h(b,T);for(let F=0;F<Math.abs(B-O);F++){const U=w(M,b)==="A"?-1:1,q=T.buffer.lines.get(B+U*F);q!=null&&q.isWrapped&&D++}return D})(c,f,m);return g(x,R(w(c,f),d))}function h(c,f){let m=0,d=f.buffer.lines.get(c),L=d==null?void 0:d.isWrapped;for(;L&&c>=0&&c<f.rows;)m++,d=f.buffer.lines.get(--c),L=d==null?void 0:d.isWrapped;return m}function w(c,f){return c>f?"A":"B"}function E(c,f,m,d,L,I){let x=c,M=f,b="";for(;x!==m||M!==d;)x+=L?1:-1,L&&x>I.cols-1?(b+=I.buffer.translateBufferLineToString(M,!1,c,x),x=0,c=0,M++):!L&&x<0&&(b+=I.buffer.translateBufferLineToString(M,!1,0,c+1),x=I.cols-1,c=x,M--);return b+I.buffer.translateBufferLineToString(M,!1,c,x)}function R(c,f){const m=f?"O":"[";return v.C0.ESC+m+c}function g(c,f){c=Math.floor(c);let m="";for(let d=0;d<c;d++)m+=f;return m}r.moveToCellSequence=function(c,f,m,d){const L=m.buffer.x,I=m.buffer.y;if(!m.buffer.hasScrollback)return(function(b,T,D,B,O,F){return _(T,B,O,F).length===0?"":g(E(b,T,b,T-h(T,O),!1,O).length,R("D",F))})(L,I,0,f,m,d)+_(I,f,m,d)+(function(b,T,D,B,O,F){let U;U=_(T,B,O,F).length>0?B-h(B,O):T;const q=B,G=(function(Y,W,j,$,H,V){let te;return te=_(j,$,H,V).length>0?$-h($,H):W,Y<j&&te<=$||Y>=j&&te<$?"C":"D"})(b,T,D,B,O,F);return g(E(b,U,D,q,G==="C",O).length,R(G,F))})(L,I,c,f,m,d);let x;if(I===f)return x=L>c?"D":"C",g(Math.abs(L-c),R(x,d));x=I>f?"D":"C";const M=Math.abs(I-f);return g((function(b,T){return T.cols-b})(I>f?c:L,m)+(M-1)*m.cols+1+((I>f?L:c)-1),R(x,d))}},1296:function(C,r,u){var v=this&&this.__decorate||function(F,U,q,G){var Y,W=arguments.length,j=W<3?U:G===null?G=Object.getOwnPropertyDescriptor(U,q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(F,U,q,G);else for(var $=F.length-1;$>=0;$--)(Y=F[$])&&(j=(W<3?Y(j):W>3?Y(U,q,j):Y(U,q))||j);return W>3&&j&&Object.defineProperty(U,q,j),j},_=this&&this.__param||function(F,U){return function(q,G){U(q,G,F)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const h=u(3787),w=u(2550),E=u(2223),R=u(6171),g=u(6052),c=u(4725),f=u(8055),m=u(8460),d=u(844),L=u(2585),I="xterm-dom-renderer-owner-",x="xterm-rows",M="xterm-fg-",b="xterm-bg-",T="xterm-focus",D="xterm-selection";let B=1,O=r.DomRenderer=class extends d.Disposable{constructor(F,U,q,G,Y,W,j,$,H,V,te,ie,pe){super(),this._terminal=F,this._document=U,this._element=q,this._screenElement=G,this._viewportElement=Y,this._helperContainer=W,this._linkifier2=j,this._charSizeService=H,this._optionsService=V,this._bufferService=te,this._coreBrowserService=ie,this._themeService=pe,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,g.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(D),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,R.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((me=>this._injectCss(me)))),this._injectCss(this._themeService.colors),this._rowFactory=$.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(I+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((me=>this._handleLinkHover(me)))),this.register(this._linkifier2.onHideLinkUnderline((me=>this._handleLinkLeave(me)))),this.register((0,d.toDisposable)((()=>{this._element.classList.remove(I+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new w.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const U=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=U,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${x} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${x} .xterm-dim { color: ${f.color.multiplyOpacity(F.foreground,.5).css};}`,U+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;U+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${G} { 50% { box-shadow: none; }}`,U+=`@keyframes ${Y} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,U+=`${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${x}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[W,j]of F.ansi.entries())U+=`${this._terminalSelector} .${M}${W} { color: ${j.css}; }${this._terminalSelector} .${M}${W}.xterm-dim { color: ${f.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${b}${W} { background-color: ${j.css}; }`;U+=`${this._terminalSelector} .${M}${E.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(F.background).css}; }${this._terminalSelector} .${M}${E.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${b}${E.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,U){for(let q=this._rowElements.length;q<=U;q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,U){this._refreshRowElements(F,U),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(T),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(T),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,U,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,U,q),this.renderRows(0,this._bufferService.rows-1),!F||!U)return;this._selectionRenderModel.update(this._terminal,F,U,q);const G=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||j<0)return;const $=this._document.createDocumentFragment();if(q){const H=F[0]>U[0];$.appendChild(this._createSelectionElement(W,H?U[0]:F[0],H?F[0]:U[0],j-W+1))}else{const H=G===W?F[0]:0,V=W===Y?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(W,H,V));const te=j-W-1;if($.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,te)),W!==j){const ie=Y===j?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(j,0,ie))}}this._selectionContainer.appendChild($)}_createSelectionElement(F,U,q,G=1){const Y=this._document.createElement("div"),W=U*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(q-U);return W+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-W),Y.style.height=G*this.dimensions.css.cell.height+"px",Y.style.top=F*this.dimensions.css.cell.height+"px",Y.style.left=`${W}px`,Y.style.width=`${j}px`,Y}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const F of this._rowElements)F.replaceChildren()}renderRows(F,U){const q=this._bufferService.buffer,G=q.ybase+q.y,Y=Math.min(q.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=F;H<=U;H++){const V=H+q.ydisp,te=this._rowElements[H],ie=q.lines.get(V);if(!te||!ie)break;te.replaceChildren(...this._rowFactory.createRow(ie,V,V===G,j,$,Y,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${I}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,U,q,G,Y,W){q<0&&(F=0),G<0&&(U=0);const j=this._bufferService.rows-1;q=Math.max(Math.min(q,j),0),G=Math.max(Math.min(G,j),0),Y=Math.min(Y,this._bufferService.cols);const $=this._bufferService.buffer,H=$.ybase+$.y,V=Math.min($.x,Y-1),te=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,pe=this._optionsService.rawOptions.cursorInactiveStyle;for(let me=q;me<=G;++me){const X=me+$.ydisp,K=this._rowElements[me],J=$.lines.get(X);if(!K||!J)break;K.replaceChildren(...this._rowFactory.createRow(J,X,X===H,ie,pe,V,te,this.dimensions.css.cell.width,this._widthCache,W?me===q?F:0:-1,W?(me===G?U:Y)-1:-1))}}};r.DomRenderer=O=v([_(7,L.IInstantiationService),_(8,c.ICharSizeService),_(9,L.IOptionsService),_(10,L.IBufferService),_(11,c.ICoreBrowserService),_(12,c.IThemeService)],O)},3787:function(C,r,u){var v=this&&this.__decorate||function(x,M,b,T){var D,B=arguments.length,O=B<3?M:T===null?T=Object.getOwnPropertyDescriptor(M,b):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(x,M,b,T);else for(var F=x.length-1;F>=0;F--)(D=x[F])&&(O=(B<3?D(O):B>3?D(M,b,O):D(M,b))||O);return B>3&&O&&Object.defineProperty(M,b,O),O},_=this&&this.__param||function(x,M){return function(b,T){M(b,T,x)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const h=u(2223),w=u(643),E=u(511),R=u(2585),g=u(8055),c=u(4725),f=u(4269),m=u(6171),d=u(3734);let L=r.DomRendererRowFactory=class{constructor(x,M,b,T,D,B,O){this._document=x,this._characterJoinerService=M,this._optionsService=b,this._coreBrowserService=T,this._coreService=D,this._decorationService=B,this._themeService=O,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,M,b){this._selectionStart=x,this._selectionEnd=M,this._columnSelectMode=b}createRow(x,M,b,T,D,B,O,F,U,q,G){const Y=[],W=this._characterJoinerService.getJoinedCharacters(M),j=this._themeService.colors;let $,H=x.getNoBgTrimmedLength();b&&H<B+1&&(H=B+1);let V=0,te="",ie=0,pe=0,me=0,X=!1,K=0,J=!1,Z=0;const _e=[],ve=q!==-1&&G!==-1;for(let ye=0;ye<H;ye++){x.loadCell(ye,this._workCell);let Ee=this._workCell.getWidth();if(Ee===0)continue;let fe=!1,Ae=ye,ne=this._workCell;if(W.length>0&&ye===W[0][0]){fe=!0;const Ge=W.shift();ne=new f.JoinedCellData(this._workCell,x.translateToString(!0,Ge[0],Ge[1]),Ge[1]-Ge[0]),Ae=Ge[1]-1,Ee=ne.getWidth()}const Ie=this._isCellInSelection(ye,M),oe=b&&ye===B,ue=ve&&ye>=q&&ye<=G;let de=!1;this._decorationService.forEachDecorationAtCell(ye,M,void 0,(Ge=>{de=!0}));let Me=ne.getChars()||w.WHITESPACE_CELL_CHAR;if(Me===" "&&(ne.isUnderline()||ne.isOverline())&&(Me=" "),Z=Ee*F-U.get(Me,ne.isBold(),ne.isItalic()),$){if(V&&(Ie&&J||!Ie&&!J&&ne.bg===ie)&&(Ie&&J&&j.selectionForeground||ne.fg===pe)&&ne.extended.ext===me&&ue===X&&Z===K&&!oe&&!fe&&!de){ne.isInvisible()?te+=w.WHITESPACE_CELL_CHAR:te+=Me,V++;continue}V&&($.textContent=te),$=this._document.createElement("span"),V=0,te=""}else $=this._document.createElement("span");if(ie=ne.bg,pe=ne.fg,me=ne.extended.ext,X=ue,K=Z,J=Ie,fe&&B>=ye&&B<=Ae&&(B=ye),!this._coreService.isCursorHidden&&oe&&this._coreService.isCursorInitialized){if(_e.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&_e.push("xterm-cursor-blink"),_e.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":_e.push("xterm-cursor-outline");break;case"block":_e.push("xterm-cursor-block");break;case"bar":_e.push("xterm-cursor-bar");break;case"underline":_e.push("xterm-cursor-underline")}}if(ne.isBold()&&_e.push("xterm-bold"),ne.isItalic()&&_e.push("xterm-italic"),ne.isDim()&&_e.push("xterm-dim"),te=ne.isInvisible()?w.WHITESPACE_CELL_CHAR:ne.getChars()||w.WHITESPACE_CELL_CHAR,ne.isUnderline()&&(_e.push(`xterm-underline-${ne.extended.underlineStyle}`),te===" "&&(te=" "),!ne.isUnderlineColorDefault()))if(ne.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${d.AttributeData.toColorRGB(ne.getUnderlineColor()).join(",")})`;else{let Ge=ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ne.isBold()&&Ge<8&&(Ge+=8),$.style.textDecorationColor=j.ansi[Ge].css}ne.isOverline()&&(_e.push("xterm-overline"),te===" "&&(te=" ")),ne.isStrikethrough()&&_e.push("xterm-strikethrough"),ue&&($.style.textDecoration="underline");let Re=ne.getFgColor(),Ke=ne.getFgColorMode(),Ue=ne.getBgColor(),st=ne.getBgColorMode();const Tt=!!ne.isInverse();if(Tt){const Ge=Re;Re=Ue,Ue=Ge;const bt=Ke;Ke=st,st=bt}let lt,yt,ct,We=!1;switch(this._decorationService.forEachDecorationAtCell(ye,M,void 0,(Ge=>{Ge.options.layer!=="top"&&We||(Ge.backgroundColorRGB&&(st=50331648,Ue=Ge.backgroundColorRGB.rgba>>8&16777215,lt=Ge.backgroundColorRGB),Ge.foregroundColorRGB&&(Ke=50331648,Re=Ge.foregroundColorRGB.rgba>>8&16777215,yt=Ge.foregroundColorRGB),We=Ge.options.layer==="top")})),!We&&Ie&&(lt=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,Ue=lt.rgba>>8&16777215,st=50331648,We=!0,j.selectionForeground&&(Ke=50331648,Re=j.selectionForeground.rgba>>8&16777215,yt=j.selectionForeground)),We&&_e.push("xterm-decoration-top"),st){case 16777216:case 33554432:ct=j.ansi[Ue],_e.push(`xterm-bg-${Ue}`);break;case 50331648:ct=g.channels.toColor(Ue>>16,Ue>>8&255,255&Ue),this._addStyle($,`background-color:#${I((Ue>>>0).toString(16),"0",6)}`);break;default:Tt?(ct=j.foreground,_e.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):ct=j.background}switch(lt||ne.isDim()&&(lt=g.color.multiplyOpacity(ct,.5)),Ke){case 16777216:case 33554432:ne.isBold()&&Re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Re+=8),this._applyMinimumContrast($,ct,j.ansi[Re],ne,lt,void 0)||_e.push(`xterm-fg-${Re}`);break;case 50331648:const Ge=g.channels.toColor(Re>>16&255,Re>>8&255,255&Re);this._applyMinimumContrast($,ct,Ge,ne,lt,yt)||this._addStyle($,`color:#${I(Re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,ct,j.foreground,ne,lt,yt)||Tt&&_e.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}_e.length&&($.className=_e.join(" "),_e.length=0),oe||fe||de?$.textContent=te:V++,Z!==this.defaultSpacing&&($.style.letterSpacing=`${Z}px`),Y.push($),ye=Ae}return $&&V&&($.textContent=te),Y}_applyMinimumContrast(x,M,b,T,D,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const O=this._getContrastCache(T);let F;if(D||B||(F=O.getColor(M.rgba,b.rgba)),F===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);F=g.color.ensureContrastRatio(D||M,B||b,U),O.setColor((D||M).rgba,(B||b).rgba,F??null)}return!!F&&(this._addStyle(x,`color:${F.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,M){x.setAttribute("style",`${x.getAttribute("style")||""}${M};`)}_isCellInSelection(x,M){const b=this._selectionStart,T=this._selectionEnd;return!(!b||!T)&&(this._columnSelectMode?b[0]<=T[0]?x>=b[0]&&M>=b[1]&&x<T[0]&&M<=T[1]:x<b[0]&&M>=b[1]&&x>=T[0]&&M<=T[1]:M>b[1]&&M<T[1]||b[1]===T[1]&&M===b[1]&&x>=b[0]&&x<T[0]||b[1]<T[1]&&M===T[1]&&x<T[0]||b[1]<T[1]&&M===b[1]&&x>=b[0])}};function I(x,M,b){for(;x.length<b;)x=M+x;return x}r.DomRendererRowFactory=L=v([_(1,c.ICharacterJoinerService),_(2,R.IOptionsService),_(3,c.ICoreBrowserService),_(4,R.ICoreService),_(5,R.IDecorationService),_(6,c.IThemeService)],L)},2550:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(u,v){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const _=u.createElement("span");_.classList.add("xterm-char-measure-element");const h=u.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const w=u.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontStyle="italic";const E=u.createElement("span");E.classList.add("xterm-char-measure-element"),E.style.fontWeight="bold",E.style.fontStyle="italic",this._measureElements=[_,h,w,E],this._container.appendChild(_),this._container.appendChild(h),this._container.appendChild(w),this._container.appendChild(E),v.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,v,_,h){u===this._font&&v===this._fontSize&&_===this._weight&&h===this._weightBold||(this._font=u,this._fontSize=v,this._weight=_,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(u,v,_){let h=0;if(!v&&!_&&u.length===1&&(h=u.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const R=this._measure(u,0);return R>0&&(this._flat[h]=R),R}let w=u;v&&(w+="B"),_&&(w+="I");let E=this._holey.get(w);if(E===void 0){let R=0;v&&(R|=1),_&&(R|=2),E=this._measure(u,R),E>0&&this._holey.set(w,E)}return E}_measure(u,v){const _=this._measureElements[v];return _.textContent=u.repeat(32),_.offsetWidth/32}}},2223:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const v=u(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=v.isFirefox||v.isLegacyEdge?"bottom":"ideographic"},6171:(C,r)=>{function u(_){return 57508<=_&&_<=57558}function v(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},r.isPowerlineGlyph=u,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=v,r.allowRescaling=function(_,h,w,E){return h===1&&w>Math.ceil(1.5*E)&&_!==void 0&&_>255&&!v(_)&&!u(_)&&!(function(R){return 57344<=R&&R<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return u(_)||(function(h){return 9472<=h&&h<=9631})(_)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(_,h,w=0){return(_-(2*Math.round(h)-w))%(2*Math.round(h))}},6052:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(_,h,w,E=!1){if(this.selectionStart=h,this.selectionEnd=w,!h||!w||h[0]===w[0]&&h[1]===w[1])return void this.clear();const R=_.buffers.active.ydisp,g=h[1]-R,c=w[1]-R,f=Math.max(g,0),m=Math.min(c,_.rows-1);f>=_.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=g,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=m,this.startCol=h[0],this.endCol=w[0])}isCellSelected(_,h,w){return!!this.hasSelection&&(w-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&w>=this.viewportCappedStartRow&&h<this.endCol&&w<=this.viewportCappedEndRow:h<this.startCol&&w>=this.viewportCappedStartRow&&h>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol)}}r.createSelectionRenderModel=function(){return new u}},456:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(u){this._bufferService=u,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,v=this.selectionEnd;return!(!u||!v)&&(u[1]>v[1]||u[1]===v[1]&&u[0]>v[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,r,u){var v=this&&this.__decorate||function(m,d,L,I){var x,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,L,I);else for(var T=m.length-1;T>=0;T--)(x=m[T])&&(b=(M<3?x(b):M>3?x(d,L,b):x(d,L))||b);return M>3&&b&&Object.defineProperty(d,L,b),b},_=this&&this.__param||function(m,d){return function(L,I){d(L,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const h=u(2585),w=u(8460),E=u(844);let R=r.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,d,L){super(),this._optionsService=L,this.width=0,this.height=0,this._onCharSizeChange=this.register(new w.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new c(m,d,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};r.CharSizeService=R=v([_(2,h.IOptionsService)],R);class g extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(d,L){d!==void 0&&d>0&&L!==void 0&&L>0&&(this._result.width=d,this._result.height=L)}}class c extends g{constructor(d,L,I){super(),this._document=d,this._parentElement=L,this._optionsService=I,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class f extends g{constructor(d){super(),this._optionsService=d,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const L=this._ctx.measureText("W");if(!("width"in L&&"fontBoundingBoxAscent"in L&&"fontBoundingBoxDescent"in L))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const d=this._ctx.measureText("W");return this._validateAndSet(d.width,d.fontBoundingBoxAscent+d.fontBoundingBoxDescent),this._result}}},4269:function(C,r,u){var v=this&&this.__decorate||function(f,m,d,L){var I,x=arguments.length,M=x<3?m:L===null?L=Object.getOwnPropertyDescriptor(m,d):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,m,d,L);else for(var b=f.length-1;b>=0;b--)(I=f[b])&&(M=(x<3?I(M):x>3?I(m,d,M):I(m,d))||M);return x>3&&M&&Object.defineProperty(m,d,M),M},_=this&&this.__param||function(f,m){return function(d,L){m(d,L,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const h=u(3734),w=u(643),E=u(511),R=u(2585);class g extends h.AttributeData{constructor(m,d,L){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=d,this._width=L}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=g;let c=r.CharacterJoinerService=class ug{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(m){const d={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(d),d.id}deregister(m){for(let d=0;d<this._characterJoiners.length;d++)if(this._characterJoiners[d].id===m)return this._characterJoiners.splice(d,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const d=this._bufferService.buffer.lines.get(m);if(!d||d.length===0)return[];const L=[],I=d.translateToString(!0);let x=0,M=0,b=0,T=d.getFg(0),D=d.getBg(0);for(let B=0;B<d.getTrimmedLength();B++)if(d.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==D){if(B-x>1){const O=this._getJoinedRanges(I,b,M,d,x);for(let F=0;F<O.length;F++)L.push(O[F])}x=B,b=M,T=this._workCell.fg,D=this._workCell.bg}M+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const B=this._getJoinedRanges(I,b,M,d,x);for(let O=0;O<B.length;O++)L.push(B[O])}return L}_getJoinedRanges(m,d,L,I,x){const M=m.substring(d,L);let b=[];try{b=this._characterJoiners[0].handler(M)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const D=this._characterJoiners[T].handler(M);for(let B=0;B<D.length;B++)ug._mergeRanges(b,D[B])}catch(D){console.error(D)}return this._stringRangesToCellRanges(b,I,x),b}_stringRangesToCellRanges(m,d,L){let I=0,x=!1,M=0,b=m[I];if(b){for(let T=L;T<this._bufferService.cols;T++){const D=d.getWidth(T),B=d.getString(T).length||w.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!x&&b[0]<=M&&(b[0]=T,x=!0),b[1]<=M){if(b[1]=T,b=m[++I],!b)break;b[0]<=M?(b[0]=T,x=!0):x=!1}M+=B}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(m,d){let L=!1;for(let I=0;I<m.length;I++){const x=m[I];if(L){if(d[1]<=x[0])return m[I-1][1]=d[1],m;if(d[1]<=x[1])return m[I-1][1]=Math.max(d[1],x[1]),m.splice(I,1),m;m.splice(I,1),I--}else{if(d[1]<=x[0])return m.splice(I,0,d),m;if(d[1]<=x[1])return x[0]=Math.min(d[0],x[0]),m;d[0]<x[1]&&(x[0]=Math.min(d[0],x[0]),L=!0)}}return L?m[m.length-1][1]=d[1]:m.push(d),m}};r.CharacterJoinerService=c=v([_(0,R.IBufferService)],c)},5114:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const v=u(844),_=u(8460),h=u(3656);class w extends v.Disposable{constructor(g,c,f){super(),this._textarea=g,this._window=c,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new E(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((m=>this._screenDprMonitor.setWindow(m)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(g){this._window!==g&&(this._window=g,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}r.CoreBrowserService=w;class E extends v.Disposable{constructor(g){super(),this._parentWindow=g,this._windowResizeListener=this.register(new v.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,v.toDisposable)((()=>this.clearListener())))}setWindow(g){this._parentWindow=g,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var g;this._outerListener&&((g=this._resolutionMediaMatchList)==null||g.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const v=u(844);class _ extends v.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,v.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(w){return this.linkProviders.push(w),{dispose:()=>{const E=this.linkProviders.indexOf(w);E!==-1&&this.linkProviders.splice(E,1)}}}}r.LinkProviderService=_},8934:function(C,r,u){var v=this&&this.__decorate||function(R,g,c,f){var m,d=arguments.length,L=d<3?g:f===null?f=Object.getOwnPropertyDescriptor(g,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(R,g,c,f);else for(var I=R.length-1;I>=0;I--)(m=R[I])&&(L=(d<3?m(L):d>3?m(g,c,L):m(g,c))||L);return d>3&&L&&Object.defineProperty(g,c,L),L},_=this&&this.__param||function(R,g){return function(c,f){g(c,f,R)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const h=u(4725),w=u(9806);let E=r.MouseService=class{constructor(R,g){this._renderService=R,this._charSizeService=g}getCoords(R,g,c,f,m){return(0,w.getCoords)(window,R,g,c,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(R,g){const c=(0,w.getCoordsRelativeToElement)(window,R,g);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};r.MouseService=E=v([_(0,h.IRenderService),_(1,h.ICharSizeService)],E)},3230:function(C,r,u){var v=this&&this.__decorate||function(m,d,L,I){var x,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,L,I);else for(var T=m.length-1;T>=0;T--)(x=m[T])&&(b=(M<3?x(b):M>3?x(d,L,b):x(d,L))||b);return M>3&&b&&Object.defineProperty(d,L,b),b},_=this&&this.__param||function(m,d){return function(L,I){d(L,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const h=u(6193),w=u(4725),E=u(8460),R=u(844),g=u(7226),c=u(2585);let f=r.RenderService=class extends R.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,d,L,I,x,M,b,T){super(),this._rowCount=m,this._charSizeService=I,this._renderer=this.register(new R.MutableDisposable),this._pausedResizeTask=new g.DebouncedIdleTask,this._observerDisposable=this.register(new R.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new E.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new E.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new E.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((D,B)=>this._renderRows(D,B)),b),this.register(this._renderDebouncer),this.register(b.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(M.onResize((()=>this._fullRefresh()))),this.register(M.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(L.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(x.onDecorationRegistered((()=>this._fullRefresh()))),this.register(x.onDecorationRemoved((()=>this._fullRefresh()))),this.register(L.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(M.cols,M.rows),this._fullRefresh()}))),this.register(L.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(M.buffer.y,M.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(b.window,d),this.register(b.onWindowChange((D=>this._registerIntersectionObserver(D,d))))}_registerIntersectionObserver(m,d){if("IntersectionObserver"in m){const L=new m.IntersectionObserver((I=>this._handleIntersectionChange(I[I.length-1])),{threshold:0});L.observe(d),this._observerDisposable.value=(0,R.toDisposable)((()=>L.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(m,d,L=!1){this._isPaused?this._needsFullRefresh=!0:(L||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,d,this._rowCount))}_renderRows(m,d){this._renderer.value&&(m=Math.min(m,this._rowCount-1),d=Math.min(d,this._rowCount-1),this._renderer.value.renderRows(m,d),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:m,end:d}),this._onRender.fire({start:m,end:d}),this._isNextRenderRedrawOnly=!0)}resize(m,d){this._rowCount=d,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((d=>this.refreshRows(d.start,d.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,d;this._renderer.value&&((d=(m=this._renderer.value).clearTextureAtlas)==null||d.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,d){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var L;return(L=this._renderer.value)==null?void 0:L.handleResize(m,d)})):this._renderer.value.handleResize(m,d),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,d,L){var I;this._selectionState.start=m,this._selectionState.end=d,this._selectionState.columnSelectMode=L,(I=this._renderer.value)==null||I.handleSelectionChanged(m,d,L)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};r.RenderService=f=v([_(2,c.IOptionsService),_(3,w.ICharSizeService),_(4,c.IDecorationService),_(5,c.IBufferService),_(6,w.ICoreBrowserService),_(7,w.IThemeService)],f)},9312:function(C,r,u){var v=this&&this.__decorate||function(b,T,D,B){var O,F=arguments.length,U=F<3?T:B===null?B=Object.getOwnPropertyDescriptor(T,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(b,T,D,B);else for(var q=b.length-1;q>=0;q--)(O=b[q])&&(U=(F<3?O(U):F>3?O(T,D,U):O(T,D))||U);return F>3&&U&&Object.defineProperty(T,D,U),U},_=this&&this.__param||function(b,T){return function(D,B){T(D,B,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const h=u(9806),w=u(9504),E=u(456),R=u(4725),g=u(8460),c=u(844),f=u(6114),m=u(4841),d=u(511),L=u(2585),I=" ",x=new RegExp(I,"g");let M=r.SelectionService=class extends c.Disposable{constructor(b,T,D,B,O,F,U,q,G){super(),this._element=b,this._screenElement=T,this._linkifier=D,this._bufferService=B,this._coreService=O,this._mouseService=F,this._optionsService=U,this._renderService=q,this._coreBrowserService=G,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new d.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new E.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!b||!T||b[0]===T[0]&&b[1]===T[1])}get selectionText(){const b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!b||!T)return"";const D=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(b[0]===T[0])return"";const O=b[0]<T[0]?b[0]:T[0],F=b[0]<T[0]?T[0]:b[0];for(let U=b[1];U<=T[1];U++){const q=D.translateBufferLineToString(U,!0,O,F);B.push(q)}}else{const O=b[1]===T[1]?T[0]:void 0;B.push(D.translateBufferLineToString(b[1],!0,b[0],O));for(let F=b[1]+1;F<=T[1]-1;F++){const U=D.lines.get(F),q=D.translateBufferLineToString(F,!0);U!=null&&U.isWrapped?B[B.length-1]+=q:B.push(q)}if(b[1]!==T[1]){const F=D.lines.get(T[1]),U=D.translateBufferLineToString(T[1],!0,0,T[0]);F&&F.isWrapped?B[B.length-1]+=U:B.push(U)}}return B.map((O=>O.replace(x," "))).join(f.isWindows?`\r
|
|
118
|
+
`:`
|
|
119
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&b&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(b){const T=this._getMouseBufferCoords(b),D=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(D&&B&&T)&&this._areCoordsInSelection(T,D,B)}isCellInSelection(b,T){const D=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!D||!B)&&this._areCoordsInSelection([b,T],D,B)}_areCoordsInSelection(b,T,D){return b[1]>T[1]&&b[1]<D[1]||T[1]===D[1]&&b[1]===T[1]&&b[0]>=T[0]&&b[0]<D[0]||T[1]<D[1]&&b[1]===D[1]&&b[0]<D[0]||T[1]<D[1]&&b[1]===T[1]&&b[0]>=T[0]}_selectWordAtCursor(b,T){var O,F;const D=(F=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:F.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(b);return!!B&&(this._selectWordAt(B,T),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,T){this._model.clearSelection(),b=Math.max(b,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){const T=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T}_getMouseEventScrollAmount(b){let T=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=D?0:(T>D&&(T-=D),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(b){return f.isMac?b.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:b.shiftKey}handleMouseDown(b){if(this._mouseDownTimeStamp=b.timeStamp,(b.button!==2||!this.hasSelection)&&b.button===0){if(!this._enabled){if(!this.shouldForceSelection(b))return;b.stopPropagation()}b.preventDefault(),this._dragScrollAmount=0,this._enabled&&b.shiftKey?this._handleIncrementalClick(b):b.detail===1?this._handleSingleClick(b):b.detail===2?this._handleDoubleClick(b):b.detail===3&&this._handleTripleClick(b),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(b){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(b))}_handleSingleClick(b){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(b)?3:0,this._model.selectionStart=this._getMouseBufferCoords(b),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){const T=this._getMouseBufferCoords(b);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))}shouldColumnSelect(b){return b.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.stopImmediatePropagation(),!this._model.selectionStart)return;const T=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(b),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(b),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const B=D.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const b=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(b.ydisp+this._bufferService.rows,b.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=b.ydisp),this.refresh()}}_handleMouseUp(b){const T=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const B=(0,w.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const b=this._model.finalSelectionStart,T=this._model.finalSelectionEnd,D=!(!b||!T||b[0]===T[0]&&b[1]===T[1]);D?b&&T&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&T[0]===this._oldSelectionEnd[0]&&T[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,T,D)):this._oldHasSelection&&this._fireOnSelectionChange(b,T,D)}_fireOnSelectionChange(b,T,D){this._oldSelectionStart=b,this._oldSelectionEnd=T,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(b,T){let D=T;for(let B=0;T>=B;B++){const O=b.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:O>1&&T!==B&&(D+=O-1)}return D}setSelection(b,T,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,T],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,T,D=!0,B=!0){if(b[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,F=O.lines.get(b[1]);if(!F)return;const U=O.translateBufferLineToString(b[1],!1);let q=this._convertViewportColToCharacterIndex(F,b[0]),G=q;const Y=b[0]-q;let W=0,j=0,$=0,H=0;if(U.charAt(q)===" "){for(;q>0&&U.charAt(q-1)===" ";)q--;for(;G<U.length&&U.charAt(G+1)===" ";)G++}else{let ie=b[0],pe=b[0];F.getWidth(ie)===0&&(W++,ie--),F.getWidth(pe)===2&&(j++,pe++);const me=F.getString(pe).length;for(me>1&&(H+=me-1,G+=me-1);ie>0&&q>0&&!this._isCharWordSeparator(F.loadCell(ie-1,this._workCell));){F.loadCell(ie-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,ie--):X>1&&($+=X-1,q-=X-1),q--,ie--}for(;pe<F.length&&G+1<U.length&&!this._isCharWordSeparator(F.loadCell(pe+1,this._workCell));){F.loadCell(pe+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,pe++):X>1&&(H+=X-1,G+=X-1),G++,pe++}}G++;let V=q+Y-W+$,te=Math.min(this._bufferService.cols,G-q+W+j-$-H);if(T||U.slice(q,G).trim()!==""){if(D&&V===0&&F.getCodePoint(0)!==32){const ie=O.lines.get(b[1]-1);if(ie&&F.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const pe=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(pe){const me=this._bufferService.cols-pe.start;V-=me,te+=me}}}if(B&&V+te===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const ie=O.lines.get(b[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const pe=this._getWordAt([0,b[1]+1],!1,!1,!0);pe&&(te+=pe.length)}}return{start:V,length:te}}}_selectWordAt(b,T){const D=this._getWordAt(b,T);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[D.start,b[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(b){const T=this._getWordAt(b,!0);if(T){let D=b[1];for(;T.start<0;)T.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,D]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const T=this._bufferService.buffer.getWrappedRangeForLine(b),D={start:{x:0,y:T.first},end:{x:this._bufferService.cols-1,y:T.last}};this._model.selectionStart=[0,T.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,m.getRangeLength)(D,this._bufferService.cols)}};r.SelectionService=M=v([_(3,L.IBufferService),_(4,L.ICoreService),_(5,R.IMouseService),_(6,L.IOptionsService),_(7,R.IRenderService),_(8,R.ICoreBrowserService)],M)},4725:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const v=u(8343);r.ICharSizeService=(0,v.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,v.createDecorator)("CoreBrowserService"),r.IMouseService=(0,v.createDecorator)("MouseService"),r.IRenderService=(0,v.createDecorator)("RenderService"),r.ISelectionService=(0,v.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,v.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,v.createDecorator)("ThemeService"),r.ILinkProviderService=(0,v.createDecorator)("LinkProviderService")},6731:function(C,r,u){var v=this&&this.__decorate||function(M,b,T,D){var B,O=arguments.length,F=O<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(M,b,T,D);else for(var U=M.length-1;U>=0;U--)(B=M[U])&&(F=(O<3?B(F):O>3?B(b,T,F):B(b,T))||F);return O>3&&F&&Object.defineProperty(b,T,F),F},_=this&&this.__param||function(M,b){return function(T,D){b(T,D,M)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const h=u(7239),w=u(8055),E=u(8460),R=u(844),g=u(2585),c=w.css.toColor("#ffffff"),f=w.css.toColor("#000000"),m=w.css.toColor("#ffffff"),d=w.css.toColor("#000000"),L={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const M=[w.css.toColor("#2e3436"),w.css.toColor("#cc0000"),w.css.toColor("#4e9a06"),w.css.toColor("#c4a000"),w.css.toColor("#3465a4"),w.css.toColor("#75507b"),w.css.toColor("#06989a"),w.css.toColor("#d3d7cf"),w.css.toColor("#555753"),w.css.toColor("#ef2929"),w.css.toColor("#8ae234"),w.css.toColor("#fce94f"),w.css.toColor("#729fcf"),w.css.toColor("#ad7fa8"),w.css.toColor("#34e2e2"),w.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let T=0;T<216;T++){const D=b[T/36%6|0],B=b[T/6%6|0],O=b[T%6];M.push({css:w.channels.toCss(D,B,O),rgba:w.channels.toRgba(D,B,O)})}for(let T=0;T<24;T++){const D=8+10*T;M.push({css:w.channels.toCss(D,D,D),rgba:w.channels.toRgba(D,D,D)})}return M})());let I=r.ThemeService=class extends R.Disposable{get colors(){return this._colors}constructor(M){super(),this._optionsService=M,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new E.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:f,cursor:m,cursorAccent:d,selectionForeground:void 0,selectionBackgroundTransparent:L,selectionBackgroundOpaque:w.color.blend(f,L),selectionInactiveBackgroundTransparent:L,selectionInactiveBackgroundOpaque:w.color.blend(f,L),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(M={}){const b=this._colors;if(b.foreground=x(M.foreground,c),b.background=x(M.background,f),b.cursor=x(M.cursor,m),b.cursorAccent=x(M.cursorAccent,d),b.selectionBackgroundTransparent=x(M.selectionBackground,L),b.selectionBackgroundOpaque=w.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=x(M.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=w.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=M.selectionForeground?x(M.selectionForeground,w.NULL_COLOR):void 0,b.selectionForeground===w.NULL_COLOR&&(b.selectionForeground=void 0),w.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=w.color.opacity(b.selectionBackgroundTransparent,.3)),w.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=w.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=r.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=x(M.black,r.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=x(M.red,r.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=x(M.green,r.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=x(M.yellow,r.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=x(M.blue,r.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=x(M.magenta,r.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=x(M.cyan,r.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=x(M.white,r.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=x(M.brightBlack,r.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=x(M.brightRed,r.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=x(M.brightGreen,r.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=x(M.brightYellow,r.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=x(M.brightBlue,r.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=x(M.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=x(M.brightCyan,r.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=x(M.brightWhite,r.DEFAULT_ANSI_COLORS[15]),M.extendedAnsi){const T=Math.min(b.ansi.length-16,M.extendedAnsi.length);for(let D=0;D<T;D++)b.ansi[D+16]=x(M.extendedAnsi[D],r.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(M){this._restoreColor(M),this._onChangeColors.fire(this.colors)}_restoreColor(M){if(M!==void 0)switch(M){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[M]=this._restoreColors.ansi[M]}else for(let b=0;b<this._restoreColors.ansi.length;++b)this._colors.ansi[b]=this._restoreColors.ansi[b]}modifyColors(M){M(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function x(M,b){if(M!==void 0)try{return w.css.toColor(M)}catch{}return b}r.ThemeService=I=v([_(0,g.IOptionsService)],I)},6349:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const v=u(8460),_=u(844);class h extends _.Disposable{constructor(E){super(),this._maxLength=E,this.onDeleteEmitter=this.register(new v.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new v.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new v.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(E){if(this._maxLength===E)return;const R=new Array(E);for(let g=0;g<Math.min(E,this.length);g++)R[g]=this._array[this._getCyclicIndex(g)];this._array=R,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let R=this._length;R<E;R++)this._array[R]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,R){this._array[this._getCyclicIndex(E)]=R}push(E){this._array[this._getCyclicIndex(this._length)]=E,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(E,R,...g){if(R){for(let c=E;c<this._length-R;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+R)];this._length-=R,this.onDeleteEmitter.fire({index:E,amount:R})}for(let c=this._length-1;c>=E;c--)this._array[this._getCyclicIndex(c+g.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<g.length;c++)this._array[this._getCyclicIndex(E+c)]=g[c];if(g.length&&this.onInsertEmitter.fire({index:E,amount:g.length}),this._length+g.length>this._maxLength){const c=this._length+g.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=g.length}trimStart(E){E>this._length&&(E=this._length),this._startIndex+=E,this._length-=E,this.onTrimEmitter.fire(E)}shiftElements(E,R,g){if(!(R<=0)){if(E<0||E>=this._length)throw new Error("start argument out of range");if(E+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let f=R-1;f>=0;f--)this.set(E+f+g,this.get(E+f));const c=E+R+g-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<R;c++)this.set(E+c+g,this.get(E+c))}}_getCyclicIndex(E){return(this._startIndex+E)%this._maxLength}}r.CircularList=h},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function u(v,_=5){if(typeof v!="object")return v;const h=Array.isArray(v)?[]:{};for(const w in v)h[w]=_<=1?v[w]:v[w]&&u(v[w],_-1);return h}},8055:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let u=0,v=0,_=0,h=0;var w,E,R,g,c;function f(d){const L=d.toString(16);return L.length<2?"0"+L:L}function m(d,L){return d<L?(L+.05)/(d+.05):(d+.05)/(L+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(L,I,x,M){return M!==void 0?`#${f(L)}${f(I)}${f(x)}${f(M)}`:`#${f(L)}${f(I)}${f(x)}`},d.toRgba=function(L,I,x,M=255){return(L<<24|I<<16|x<<8|M)>>>0},d.toColor=function(L,I,x,M){return{css:d.toCss(L,I,x,M),rgba:d.toRgba(L,I,x,M)}}})(w||(r.channels=w={})),(function(d){function L(I,x){return h=Math.round(255*x),[u,v,_]=c.toChannels(I.rgba),{css:w.toCss(u,v,_,h),rgba:w.toRgba(u,v,_,h)}}d.blend=function(I,x){if(h=(255&x.rgba)/255,h===1)return{css:x.css,rgba:x.rgba};const M=x.rgba>>24&255,b=x.rgba>>16&255,T=x.rgba>>8&255,D=I.rgba>>24&255,B=I.rgba>>16&255,O=I.rgba>>8&255;return u=D+Math.round((M-D)*h),v=B+Math.round((b-B)*h),_=O+Math.round((T-O)*h),{css:w.toCss(u,v,_),rgba:w.toRgba(u,v,_)}},d.isOpaque=function(I){return(255&I.rgba)==255},d.ensureContrastRatio=function(I,x,M){const b=c.ensureContrastRatio(I.rgba,x.rgba,M);if(b)return w.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(I){const x=(255|I.rgba)>>>0;return[u,v,_]=c.toChannels(x),{css:w.toCss(u,v,_),rgba:x}},d.opacity=L,d.multiplyOpacity=function(I,x){return h=255&I.rgba,L(I,h*x/255)},d.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(E||(r.color=E={})),(function(d){let L,I;try{const x=document.createElement("canvas");x.width=1,x.height=1;const M=x.getContext("2d",{willReadFrequently:!0});M&&(L=M,L.globalCompositeOperation="copy",I=L.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return u=parseInt(x.slice(1,2).repeat(2),16),v=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),w.toColor(u,v,_);case 5:return u=parseInt(x.slice(1,2).repeat(2),16),v=parseInt(x.slice(2,3).repeat(2),16),_=parseInt(x.slice(3,4).repeat(2),16),h=parseInt(x.slice(4,5).repeat(2),16),w.toColor(u,v,_,h);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const M=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return u=parseInt(M[1]),v=parseInt(M[2]),_=parseInt(M[3]),h=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),w.toColor(u,v,_,h);if(!L||!I)throw new Error("css.toColor: Unsupported css format");if(L.fillStyle=I,L.fillStyle=x,typeof L.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(L.fillRect(0,0,1,1),[u,v,_,h]=L.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(u,v,_,h),css:x}}})(R||(r.css=R={})),(function(d){function L(I,x,M){const b=I/255,T=x/255,D=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}d.relativeLuminance=function(I){return L(I>>16&255,I>>8&255,255&I)},d.relativeLuminance2=L})(g||(r.rgb=g={})),(function(d){function L(x,M,b){const T=x>>24&255,D=x>>16&255,B=x>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));for(;q<b&&(O>0||F>0||U>0);)O-=Math.max(0,Math.ceil(.1*O)),F-=Math.max(0,Math.ceil(.1*F)),U-=Math.max(0,Math.ceil(.1*U)),q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));return(O<<24|F<<16|U<<8|255)>>>0}function I(x,M,b){const T=x>>24&255,D=x>>16&255,B=x>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));for(;q<b&&(O<255||F<255||U<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=Math.min(255,U+Math.ceil(.1*(255-U))),q=m(g.relativeLuminance2(O,F,U),g.relativeLuminance2(T,D,B));return(O<<24|F<<16|U<<8|255)>>>0}d.blend=function(x,M){if(h=(255&M)/255,h===1)return M;const b=M>>24&255,T=M>>16&255,D=M>>8&255,B=x>>24&255,O=x>>16&255,F=x>>8&255;return u=B+Math.round((b-B)*h),v=O+Math.round((T-O)*h),_=F+Math.round((D-F)*h),w.toRgba(u,v,_)},d.ensureContrastRatio=function(x,M,b){const T=g.relativeLuminance(x>>8),D=g.relativeLuminance(M>>8);if(m(T,D)<b){if(D<T){const F=L(x,M,b),U=m(T,g.relativeLuminance(F>>8));if(U<b){const q=I(x,M,b);return U>m(T,g.relativeLuminance(q>>8))?F:q}return F}const B=I(x,M,b),O=m(T,g.relativeLuminance(B>>8));if(O<b){const F=L(x,M,b);return O>m(T,g.relativeLuminance(F>>8))?B:F}return B}},d.reduceLuminance=L,d.increaseLuminance=I,d.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(c||(r.rgba=c={})),r.toPaddedHex=f,r.contrastRatio=m},8969:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const v=u(844),_=u(2585),h=u(4348),w=u(7866),E=u(744),R=u(7302),g=u(6975),c=u(8460),f=u(1753),m=u(1480),d=u(7994),L=u(9282),I=u(5435),x=u(5981),M=u(2660);let b=!1;class T extends v.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((B=>{var O;(O=this._onScrollApi)==null||O.fire(B.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new v.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new R.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(E.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(w.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(M.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new I.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new x.WriteBuffer(((O,F)=>this._inputHandler.parse(O,F)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=_.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,E.MINIMUM_COLS),O=Math.max(O,E.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,F){this._bufferService.scrollLines(B,O,F)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(L.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,L.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,v.toDisposable)((()=>{for(const O of B)O.dispose()}))}}}r.CoreTerminal=T},8460:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let v=0;v<this._listeners.length;v++)if(this._listeners[v]===u)return void this._listeners.splice(v,1)}}})),this._event}fire(u,v){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,u,v)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(u,v){return u((_=>v.fire(_)))},r.runAndSubscribe=function(u,v){return v(void 0),u((_=>v(_)))}},5435:function(C,r,u){var v=this&&this.__decorate||function(W,j,$,H){var V,te=arguments.length,ie=te<3?j:H===null?H=Object.getOwnPropertyDescriptor(j,$):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(W,j,$,H);else for(var pe=W.length-1;pe>=0;pe--)(V=W[pe])&&(ie=(te<3?V(ie):te>3?V(j,$,ie):V(j,$))||ie);return te>3&&ie&&Object.defineProperty(j,$,ie),ie},_=this&&this.__param||function(W,j){return function($,H){j($,H,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const h=u(2584),w=u(7116),E=u(2015),R=u(844),g=u(482),c=u(8437),f=u(8460),m=u(643),d=u(511),L=u(3734),I=u(2585),x=u(1480),M=u(6242),b=u(6351),T=u(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O(W,j){if(W>24)return j.setWinLines||!1;switch(W){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var F;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(r.WindowsOptionsReportType=F={}));let U=0;class q extends R.Disposable{getAttrData(){return this._curAttrData}constructor(j,$,H,V,te,ie,pe,me,X=new E.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=$,this._coreService=H,this._logService=V,this._optionsService=te,this._oscLinkService=ie,this._coreMouseService=pe,this._unicodeService=me,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new d.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((K=>this._activeBuffer=K.activeBuffer))),this._parser.setCsiHandlerFallback(((K,J)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(K),params:J.toArray()})})),this._parser.setEscHandlerFallback((K=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(K)})})),this._parser.setExecuteHandlerFallback((K=>{this._logService.debug("Unknown EXECUTE code: ",{code:K})})),this._parser.setOscHandlerFallback(((K,J,Z)=>{this._logService.debug("Unknown OSC code: ",{identifier:K,action:J,data:Z})})),this._parser.setDcsHandlerFallback(((K,J,Z)=>{J==="HOOK"&&(Z=Z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(K),action:J,payload:Z})})),this._parser.setPrintHandler(((K,J,Z)=>this.print(K,J,Z))),this._parser.registerCsiHandler({final:"@"},(K=>this.insertChars(K))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(K=>this.scrollLeft(K))),this._parser.registerCsiHandler({final:"A"},(K=>this.cursorUp(K))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(K=>this.scrollRight(K))),this._parser.registerCsiHandler({final:"B"},(K=>this.cursorDown(K))),this._parser.registerCsiHandler({final:"C"},(K=>this.cursorForward(K))),this._parser.registerCsiHandler({final:"D"},(K=>this.cursorBackward(K))),this._parser.registerCsiHandler({final:"E"},(K=>this.cursorNextLine(K))),this._parser.registerCsiHandler({final:"F"},(K=>this.cursorPrecedingLine(K))),this._parser.registerCsiHandler({final:"G"},(K=>this.cursorCharAbsolute(K))),this._parser.registerCsiHandler({final:"H"},(K=>this.cursorPosition(K))),this._parser.registerCsiHandler({final:"I"},(K=>this.cursorForwardTab(K))),this._parser.registerCsiHandler({final:"J"},(K=>this.eraseInDisplay(K,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(K=>this.eraseInDisplay(K,!0))),this._parser.registerCsiHandler({final:"K"},(K=>this.eraseInLine(K,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(K=>this.eraseInLine(K,!0))),this._parser.registerCsiHandler({final:"L"},(K=>this.insertLines(K))),this._parser.registerCsiHandler({final:"M"},(K=>this.deleteLines(K))),this._parser.registerCsiHandler({final:"P"},(K=>this.deleteChars(K))),this._parser.registerCsiHandler({final:"S"},(K=>this.scrollUp(K))),this._parser.registerCsiHandler({final:"T"},(K=>this.scrollDown(K))),this._parser.registerCsiHandler({final:"X"},(K=>this.eraseChars(K))),this._parser.registerCsiHandler({final:"Z"},(K=>this.cursorBackwardTab(K))),this._parser.registerCsiHandler({final:"`"},(K=>this.charPosAbsolute(K))),this._parser.registerCsiHandler({final:"a"},(K=>this.hPositionRelative(K))),this._parser.registerCsiHandler({final:"b"},(K=>this.repeatPrecedingCharacter(K))),this._parser.registerCsiHandler({final:"c"},(K=>this.sendDeviceAttributesPrimary(K))),this._parser.registerCsiHandler({prefix:">",final:"c"},(K=>this.sendDeviceAttributesSecondary(K))),this._parser.registerCsiHandler({final:"d"},(K=>this.linePosAbsolute(K))),this._parser.registerCsiHandler({final:"e"},(K=>this.vPositionRelative(K))),this._parser.registerCsiHandler({final:"f"},(K=>this.hVPosition(K))),this._parser.registerCsiHandler({final:"g"},(K=>this.tabClear(K))),this._parser.registerCsiHandler({final:"h"},(K=>this.setMode(K))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(K=>this.setModePrivate(K))),this._parser.registerCsiHandler({final:"l"},(K=>this.resetMode(K))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(K=>this.resetModePrivate(K))),this._parser.registerCsiHandler({final:"m"},(K=>this.charAttributes(K))),this._parser.registerCsiHandler({final:"n"},(K=>this.deviceStatus(K))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(K=>this.deviceStatusPrivate(K))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(K=>this.softReset(K))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(K=>this.setCursorStyle(K))),this._parser.registerCsiHandler({final:"r"},(K=>this.setScrollRegion(K))),this._parser.registerCsiHandler({final:"s"},(K=>this.saveCursor(K))),this._parser.registerCsiHandler({final:"t"},(K=>this.windowOptions(K))),this._parser.registerCsiHandler({final:"u"},(K=>this.restoreCursor(K))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(K=>this.insertColumns(K))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(K=>this.deleteColumns(K))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(K=>this.selectProtected(K))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(K=>this.requestMode(K,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(K=>this.requestMode(K,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new M.OscHandler((K=>(this.setTitle(K),this.setIconName(K),!0)))),this._parser.registerOscHandler(1,new M.OscHandler((K=>this.setIconName(K)))),this._parser.registerOscHandler(2,new M.OscHandler((K=>this.setTitle(K)))),this._parser.registerOscHandler(4,new M.OscHandler((K=>this.setOrReportIndexedColor(K)))),this._parser.registerOscHandler(8,new M.OscHandler((K=>this.setHyperlink(K)))),this._parser.registerOscHandler(10,new M.OscHandler((K=>this.setOrReportFgColor(K)))),this._parser.registerOscHandler(11,new M.OscHandler((K=>this.setOrReportBgColor(K)))),this._parser.registerOscHandler(12,new M.OscHandler((K=>this.setOrReportCursorColor(K)))),this._parser.registerOscHandler(104,new M.OscHandler((K=>this.restoreIndexedColor(K)))),this._parser.registerOscHandler(110,new M.OscHandler((K=>this.restoreFgColor(K)))),this._parser.registerOscHandler(111,new M.OscHandler((K=>this.restoreBgColor(K)))),this._parser.registerOscHandler(112,new M.OscHandler((K=>this.restoreCursorColor(K)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const K in w.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:K},(()=>this.selectCharset("("+K))),this._parser.registerEscHandler({intermediates:")",final:K},(()=>this.selectCharset(")"+K))),this._parser.registerEscHandler({intermediates:"*",final:K},(()=>this.selectCharset("*"+K))),this._parser.registerEscHandler({intermediates:"+",final:K},(()=>this.selectCharset("+"+K))),this._parser.registerEscHandler({intermediates:"-",final:K},(()=>this.selectCharset("-"+K))),this._parser.registerEscHandler({intermediates:".",final:K},(()=>this.selectCharset("."+K))),this._parser.registerEscHandler({intermediates:"/",final:K},(()=>this.selectCharset("/"+K)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((K=>(this._logService.error("Parsing error: ",K),K))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler(((K,J)=>this.requestStatusString(K,J))))}_preserveStack(j,$,H,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=H,this._parseStack.position=V}_logSlowResolvingAsync(j){this._logService.logLevel<=I.LogLevelEnum.WARN&&Promise.race([j,new Promise((($,H)=>setTimeout((()=>H("#SLOW_TIMEOUT")),5e3)))]).catch(($=>{if($!=="#SLOW_TIMEOUT")throw $;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(j,$){let H,V=this._activeBuffer.x,te=this._activeBuffer.y,ie=0;const pe=this._parseStack.paused;if(pe){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(H),H;V=this._parseStack.cursorStartX,te=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>B&&(ie=this._parseStack.position+B)}if(this._logService.logLevel<=I.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof j=="string"?` "${j}"`:` "${Array.prototype.map.call(j,(K=>String.fromCharCode(K))).join("")}"`),typeof j=="string"?j.split("").map((K=>K.charCodeAt(0))):j),this._parseBuffer.length<j.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(j.length,B))),pe||this._dirtyRowTracker.clearRange(),j.length>B)for(let K=ie;K<j.length;K+=B){const J=K+B<j.length?K+B:j.length,Z=typeof j=="string"?this._stringDecoder.decode(j.substring(K,J),this._parseBuffer):this._utf8Decoder.decode(j.subarray(K,J),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(V,te,Z,K),this._logSlowResolvingAsync(H),H}else if(!pe){const K=typeof j=="string"?this._stringDecoder.decode(j,this._parseBuffer):this._utf8Decoder.decode(j,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,K))return this._preserveStack(V,te,K,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===V&&this._activeBuffer.y===te||this._onCursorMove.fire();const me=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(me,this._bufferService.rows-1))}print(j,$,H){let V,te;const ie=this._charsetService.charset,pe=this._optionsService.rawOptions.screenReaderMode,me=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,K=this._coreService.modes.insertMode,J=this._curAttrData;let Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&H-$>0&&Z.getWidth(this._activeBuffer.x-1)===2&&Z.setCellFromCodepoint(this._activeBuffer.x-1,0,1,J);let _e=this._parser.precedingJoinState;for(let ve=$;ve<H;++ve){if(V=j[ve],V<127&&ie){const Ae=ie[String.fromCharCode(V)];Ae&&(V=Ae.charCodeAt(0))}const ye=this._unicodeService.charProperties(V,_e);te=x.UnicodeService.extractWidth(ye);const Ee=x.UnicodeService.extractShouldJoin(ye),fe=Ee?x.UnicodeService.extractWidth(_e):0;if(_e=ye,pe&&this._onA11yChar.fire((0,g.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+te-fe>me){if(X){const Ae=Z;let ne=this._activeBuffer.x-fe;for(this._activeBuffer.x=fe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),fe>0&&Z instanceof c.BufferLine&&Z.copyCellsFrom(Ae,ne,0,fe,!1);ne<me;)Ae.setCellFromCodepoint(ne++,0,1,J)}else if(this._activeBuffer.x=me-1,te===2)continue}if(Ee&&this._activeBuffer.x){const Ae=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-Ae,V,te);for(let ne=te-fe;--ne>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}else if(K&&(Z.insertCells(this._activeBuffer.x,te-fe,this._activeBuffer.getNullCell(J)),Z.getWidth(me-1)===2&&Z.setCellFromCodepoint(me-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,J)),Z.setCellFromCodepoint(this._activeBuffer.x++,V,te,J),te>0)for(;--te;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}this._parser.precedingJoinState=_e,this._activeBuffer.x<me&&H-$>0&&Z.getWidth(this._activeBuffer.x)===0&&!Z.hasContent(this._activeBuffer.x)&&Z.setCellFromCodepoint(this._activeBuffer.x,0,1,J),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,$){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,$):this._parser.registerCsiHandler(j,(H=>!O(H.params[0],this._optionsService.rawOptions.windowOptions)||$(H)))}registerDcsHandler(j,$){return this._parser.registerDcsHandler(j,new b.DcsHandler($))}registerEscHandler(j,$){return this._parser.registerEscHandler(j,$)}registerOscHandler(j,$){return this._parser.registerOscHandler(j,new M.OscHandler($))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var j;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&j.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);$.hasWidth(this._activeBuffer.x)&&!$.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const j=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-j),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(j=this._bufferService.cols-1){this._activeBuffer.x=Math.min(j,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(j,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=j,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+$)}cursorUp(j){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,j.params[0]||1)):this._moveCursor(0,j.params[0]||1),!0}cursorForward(j){return this._moveCursor(j.params[0]||1,0),!0}cursorBackward(j){return this._moveCursor(-(j.params[0]||1),0),!0}cursorNextLine(j){return this.cursorDown(j),this._activeBuffer.x=0,!0}cursorPrecedingLine(j){return this.cursorUp(j),this._activeBuffer.x=0,!0}cursorCharAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(j){return this._setCursor(j.length>=2?(j.params[1]||1)-1:0,(j.params[0]||1)-1),!0}charPosAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(j){return this._moveCursor(j.params[0]||1,0),!0}linePosAbsolute(j){return this._setCursor(this._activeBuffer.x,(j.params[0]||1)-1),!0}vPositionRelative(j){return this._moveCursor(0,j.params[0]||1),!0}hVPosition(j){return this.cursorPosition(j),!0}tabClear(j){const $=j.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=j.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=j.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const $=j.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,$,H,V=!1,te=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);ie.replaceCells($,H,this._activeBuffer.getNullCell(this._eraseAttrData()),te),V&&(ie.isWrapped=!1)}_resetBufferLine(j,$=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),H.isWrapped=!1)}eraseInDisplay(j,$=!1){let H;switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);H<this._bufferService.rows;H++)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(H);break;case 1:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H,0,this._activeBuffer.x+1,!0,$),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(H+1).isWrapped=!1);H--;)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(0);break;case 2:for(H=this._bufferService.rows,this._dirtyRowTracker.markDirty(H-1);H--;)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(j,$=!1){switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,$);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,$)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(j){this._restrictCursor();let $=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,te=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;$--;)this._activeBuffer.lines.splice(te-1,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(j){this._restrictCursor();let $=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;$--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let $=j.params[0]||1;for(;$--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(j){let $=j.params[0]||1;for(;$--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);V.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);V.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);V.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);V.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(j.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(j){const $=this._parser.precedingJoinState;if(!$)return!0;const H=j.params[0]||1,V=x.UnicodeService.extractWidth($),te=this._activeBuffer.x-V,ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(te),pe=new Uint32Array(ie.length*H);let me=0;for(let K=0;K<ie.length;){const J=ie.codePointAt(K)||0;pe[me++]=J,K+=J>65535?2:1}let X=me;for(let K=1;K<H;++K)pe.copyWithin(X,0,me),X+=me;return this.print(pe,0,X),!0}sendDeviceAttributesPrimary(j){return j.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(j){return j.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(j.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(j){return(this._optionsService.rawOptions.termName+"").indexOf(j)===0}setMode(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,w.DEFAULT_CHARSET),this._charsetService.setgCharset(1,w.DEFAULT_CHARSET),this._charsetService.setgCharset(2,w.DEFAULT_CHARSET),this._charsetService.setgCharset(3,w.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),j.params[$]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(j,$){const H=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:te}=this._coreMouseService,ie=this._coreService,{buffers:pe,cols:me}=this._bufferService,{active:X,alt:K}=pe,J=this._optionsService.rawOptions,Z=Ee=>Ee?1:2,_e=j.params[0];return ve=_e,ye=$?_e===2?4:_e===4?Z(ie.modes.insertMode):_e===12?3:_e===20?Z(J.convertEol):0:_e===1?Z(H.applicationCursorKeys):_e===3?J.windowOptions.setWinLines?me===80?2:me===132?1:0:0:_e===6?Z(H.origin):_e===7?Z(H.wraparound):_e===8?3:_e===9?Z(V==="X10"):_e===12?Z(J.cursorBlink):_e===25?Z(!ie.isCursorHidden):_e===45?Z(H.reverseWraparound):_e===66?Z(H.applicationKeypad):_e===67?4:_e===1e3?Z(V==="VT200"):_e===1002?Z(V==="DRAG"):_e===1003?Z(V==="ANY"):_e===1004?Z(H.sendFocus):_e===1005?4:_e===1006?Z(te==="SGR"):_e===1015?4:_e===1016?Z(te==="SGR_PIXELS"):_e===1048?1:_e===47||_e===1047||_e===1049?Z(X===K):_e===2004?Z(H.bracketedPasteMode):0,ie.triggerDataEvent(`${h.C0.ESC}[${$?"":"?"}${ve};${ye}$y`),!0;var ve,ye}_updateAttrColor(j,$,H,V,te){return $===2?(j|=50331648,j&=-16777216,j|=L.AttributeData.fromColorRGB([H,V,te])):$===5&&(j&=-50331904,j|=33554432|255&H),j}_extractColor(j,$,H){const V=[0,0,-1,0,0,0];let te=0,ie=0;do{if(V[ie+te]=j.params[$+ie],j.hasSubParams($+ie)){const pe=j.getSubParams($+ie);let me=0;do V[1]===5&&(te=1),V[ie+me+1+te]=pe[me];while(++me<pe.length&&me+ie+1+te<V.length);break}if(V[1]===5&&ie+te>=2||V[1]===2&&ie+te>=5)break;V[1]&&(te=1)}while(++ie+$<j.length&&ie+te<V.length);for(let pe=2;pe<V.length;++pe)V[pe]===-1&&(V[pe]=0);switch(V[0]){case 38:H.fg=this._updateAttrColor(H.fg,V[1],V[3],V[4],V[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,V[1],V[3],V[4],V[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,V[1],V[3],V[4],V[5])}return ie}_processUnderline(j,$){$.extended=$.extended.clone(),(!~j||j>5)&&(j=1),$.extended.underlineStyle=j,$.fg|=268435456,j===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(j){j.fg=c.DEFAULT_ATTR_DATA.fg,j.bg=c.DEFAULT_ATTR_DATA.bg,j.extended=j.extended.clone(),j.extended.underlineStyle=0,j.extended.underlineColor&=-67108864,j.updateExtended()}charAttributes(j){if(j.length===1&&j.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=j.length;let H;const V=this._curAttrData;for(let te=0;te<$;te++)H=j.params[te],H>=30&&H<=37?(V.fg&=-50331904,V.fg|=16777216|H-30):H>=40&&H<=47?(V.bg&=-50331904,V.bg|=16777216|H-40):H>=90&&H<=97?(V.fg&=-50331904,V.fg|=16777224|H-90):H>=100&&H<=107?(V.bg&=-50331904,V.bg|=16777224|H-100):H===0?this._processSGR0(V):H===1?V.fg|=134217728:H===3?V.bg|=67108864:H===4?(V.fg|=268435456,this._processUnderline(j.hasSubParams(te)?j.getSubParams(te)[0]:1,V)):H===5?V.fg|=536870912:H===7?V.fg|=67108864:H===8?V.fg|=1073741824:H===9?V.fg|=2147483648:H===2?V.bg|=134217728:H===21?this._processUnderline(2,V):H===22?(V.fg&=-134217729,V.bg&=-134217729):H===23?V.bg&=-67108865:H===24?(V.fg&=-268435457,this._processUnderline(0,V)):H===25?V.fg&=-536870913:H===27?V.fg&=-67108865:H===28?V.fg&=-1073741825:H===29?V.fg&=2147483647:H===39?(V.fg&=-67108864,V.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):H===49?(V.bg&=-67108864,V.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?te+=this._extractColor(j,te,V):H===53?V.bg|=1073741824:H===55?V.bg&=-1073741825:H===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):H===100?(V.fg&=-67108864,V.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(j){switch(j.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${$};${H}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${$};${H}R`)}return!0}softReset(j){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(j){const $=j.params[0]||1;switch($){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const H=$%2==1;return this._optionsService.options.cursorBlink=H,!0}setScrollRegion(j){const $=j.params[0]||1;let H;return(j.length<2||(H=j.params[1])>this._bufferService.rows||H===0)&&(H=this._bufferService.rows),H>$&&(this._activeBuffer.scrollTop=$-1,this._activeBuffer.scrollBottom=H-1,this._setCursor(0,0)),!0}windowOptions(j){if(!O(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:$!==0&&$!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),$!==0&&$!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:$!==0&&$!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),$!==0&&$!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(j){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(j){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(j){return this._windowTitle=j,this._onTitleChange.fire(j),!0}setIconName(j){return this._iconName=j,!0}setOrReportIndexedColor(j){const $=[],H=j.split(";");for(;H.length>1;){const V=H.shift(),te=H.shift();if(/^\d+$/.exec(V)){const ie=parseInt(V);if(Y(ie))if(te==="?")$.push({type:0,index:ie});else{const pe=(0,T.parseColor)(te);pe&&$.push({type:1,index:ie,color:pe})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(j){const $=j.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(j,$){this._getCurrentLinkId()&&this._finishHyperlink();const H=j.split(":");let V;const te=H.findIndex((ie=>ie.startsWith("id=")));return te!==-1&&(V=H[te].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(j,$){const H=j.split(";");for(let V=0;V<H.length&&!($>=this._specialColors.length);++V,++$)if(H[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const te=(0,T.parseColor)(H[V]);te&&this._onColor.fire([{type:1,index:this._specialColors[$],color:te}])}return!0}setOrReportFgColor(j){return this._setOrReportSpecialColor(j,0)}setOrReportBgColor(j){return this._setOrReportSpecialColor(j,1)}setOrReportCursorColor(j){return this._setOrReportSpecialColor(j,2)}restoreIndexedColor(j){if(!j)return this._onColor.fire([{type:2}]),!0;const $=[],H=j.split(";");for(let V=0;V<H.length;++V)if(/^\d+$/.exec(H[V])){const te=parseInt(H[V]);Y(te)&&$.push({type:2,index:te})}return $.length&&this._onColor.fire($),!0}restoreFgColor(j){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(j){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(j){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,w.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(D[j[0]],w.CHARSETS[j[1]]||w.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const j=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,j,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(j){return this._charsetService.setgLevel(j),!0}screenAlignmentPattern(){const j=new d.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const H=this._activeBuffer.ybase+this._activeBuffer.y+$,V=this._activeBuffer.lines.get(H);V&&(V.fill(j),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,$){const H=this._bufferService.buffer,V=this._optionsService.rawOptions;return(te=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${te}${h.C0.ESC}\\`),!0))(j==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:j==='"p'?'P1$r61;1"p':j==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:j==="m"?"P1$r0m":j===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,$){this._dirtyRowTracker.markRangeDirty(j,$)}}r.InputHandler=q;let G=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,j){W>j&&(U=W,W=j,j=U),W<this.start&&(this.start=W),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(W){return 0<=W&&W<256}G=v([_(0,I.IBufferService)],G)},844:(C,r)=>{function u(v){for(const _ of v)_.dispose();v.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const v of this._disposables)v.dispose();this._disposables.length=0}register(v){return this._disposables.push(v),v}unregister(v){const _=this._disposables.indexOf(v);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(v){var _;this._isDisposed||v===this._value||((_=this._value)==null||_.dispose(),this._value=v)}clear(){this.value=void 0}dispose(){var v;this._isDisposed=!0,(v=this._value)==null||v.dispose(),this._value=void 0}},r.toDisposable=function(v){return{dispose:v}},r.disposeArray=u,r.getDisposeArrayDisposable=function(v){return{dispose:()=>u(v)}}},1505:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(_,h,w){this._data[_]||(this._data[_]={}),this._data[_][h]=w}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=u,r.FourKeyMap=class{constructor(){this._data=new u}set(v,_,h,w,E){this._data.get(v,_)||this._data.set(v,_,new u),this._data.get(v,_).set(h,w,E)}get(v,_,h,w){var E;return(E=this._data.get(v,_))==null?void 0:E.get(h,w)}clear(){this._data.clear()}}},6114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const u=r.isNode?"node":navigator.userAgent,v=r.isNode?"node":navigator.platform;r.isFirefox=u.includes("Firefox"),r.isLegacyEdge=u.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(u),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=u.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(v),r.isIpad=v==="iPad",r.isIphone=v==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(v),r.isLinux=v.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(u)},6106:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let u=0;r.SortedList=class{constructor(v){this._getKey=v,this._array=[]}clear(){this._array.length=0}insert(v){this._array.length!==0?(u=this._search(this._getKey(v)),this._array.splice(u,0,v)):this._array.push(v)}delete(v){if(this._array.length===0)return!1;const _=this._getKey(v);if(_===void 0||(u=this._search(_),u===-1)||this._getKey(this._array[u])!==_)return!1;do if(this._array[u]===v)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===_);return!1}*getKeyIterator(v){if(this._array.length!==0&&(u=this._search(v),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===v))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===v)}forEachByKey(v,_){if(this._array.length!==0&&(u=this._search(v),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===v))do _(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===v)}values(){return[...this._array].values()}_search(v){let _=0,h=this._array.length-1;for(;h>=_;){let w=_+h>>1;const E=this._getKey(this._array[w]);if(E>v)h=w-1;else{if(!(E<v)){for(;w>0&&this._getKey(this._array[w-1])===v;)w--;return w}_=w+1}}return _}}},7226:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const v=u(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let R=0,g=0,c=E.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(R=Date.now(),this._tasks[this._i]()||this._i++,R=Math.max(1,Date.now()-R),g=Math.max(R,g),f=E.timeRemaining(),1.5*g>f)return c-R<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-R))}ms`),void this._start();c=f}this.clear()}}class h extends _{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const R=Date.now()+E;return{timeRemaining:()=>Math.max(0,R-Date.now())}}}r.PriorityTaskQueue=h,r.IdleTaskQueue=!v.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(w){return requestIdleCallback(w)}_cancelCallback(w){cancelIdleCallback(w)}}:h,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(w){this._queue.clear(),this._queue.enqueue(w)}flush(){this._queue.flush()}}},9282:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const v=u(643);r.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),w=h==null?void 0:h.get(_.cols-1),E=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);E&&w&&(E.isWrapped=w[v.CHAR_DATA_CODE_INDEX]!==v.NULL_CELL_CODE&&w[v.CHAR_DATA_CODE_INDEX]!==v.WHITESPACE_CELL_CODE)}},3734:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new v}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new u;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=u;class v{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,w=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=w}clone(){return new v(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=v},9092:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const v=u(6349),_=u(7226),h=u(3734),w=u(8437),E=u(4634),R=u(511),g=u(643),c=u(4863),f=u(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(m,d,L){this._hasScrollback=m,this._optionsService=d,this._bufferService=L,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=w.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=R.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=R.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,d){return new w.BufferLine(this._bufferService.cols,this.getNullCell(m),d)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const d=m+this._optionsService.rawOptions.scrollback;return d>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:d}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=w.DEFAULT_ATTR_DATA);let d=this._rows;for(;d--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,d){const L=this.getNullCell(w.DEFAULT_ATTR_DATA);let I=0;const x=this._getCorrectBufferLength(d);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<m)for(let b=0;b<this.lines.length;b++)I+=+this.lines.get(b).resize(m,L);let M=0;if(this._rows<d)for(let b=this._rows;b<d;b++)this.lines.length<d+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new w.BufferLine(m,L)):this.ybase>0&&this.lines.length<=this.ybase+this.y+M+1?(this.ybase--,M++,this.ydisp>0&&this.ydisp--):this.lines.push(new w.BufferLine(m,L)));else for(let b=this._rows;b>d;b--)this.lines.length>d+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const b=this.lines.length-x;b>0&&(this.lines.trimStart(b),this.ybase=Math.max(this.ybase-b,0),this.ydisp=Math.max(this.ydisp-b,0),this.savedY=Math.max(this.savedY-b,0)),this.lines.maxLength=x}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,d-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=d-1,this._isReflowEnabled&&(this._reflow(m,d),this._cols>m))for(let M=0;M<this.lines.length;M++)I+=+this.lines.get(M).resize(m,L);this._cols=m,this._rows=d,this._memoryCleanupQueue.clear(),I>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let d=0;for(;this._memoryCleanupPosition<this.lines.length;)if(d+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),d>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,d){this._cols!==m&&(m>this._cols?this._reflowLarger(m,d):this._reflowSmaller(m,d))}_reflowLarger(m,d){const L=(0,E.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(w.DEFAULT_ATTR_DATA));if(L.length>0){const I=(0,E.reflowLargerCreateNewLayout)(this.lines,L);(0,E.reflowLargerApplyNewLayout)(this.lines,I.layout),this._reflowLargerAdjustViewport(m,d,I.countRemoved)}}_reflowLargerAdjustViewport(m,d,L){const I=this.getNullCell(w.DEFAULT_ATTR_DATA);let x=L;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<d&&this.lines.push(new w.BufferLine(m,I))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-L,0)}_reflowSmaller(m,d){const L=this.getNullCell(w.DEFAULT_ATTR_DATA),I=[];let x=0;for(let M=this.lines.length-1;M>=0;M--){let b=this.lines.get(M);if(!b||!b.isWrapped&&b.getTrimmedLength()<=m)continue;const T=[b];for(;b.isWrapped&&M>0;)b=this.lines.get(--M),T.unshift(b);const D=this.ybase+this.y;if(D>=M&&D<M+T.length)continue;const B=T[T.length-1].getTrimmedLength(),O=(0,E.reflowSmallerGetNewLineLengths)(T,this._cols,m),F=O.length-T.length;let U;U=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const q=[];for(let H=0;H<F;H++){const V=this.getBlankLine(w.DEFAULT_ATTR_DATA,!0);q.push(V)}q.length>0&&(I.push({start:M+T.length+x,newLines:q}),x+=q.length),T.push(...q);let G=O.length-1,Y=O[G];Y===0&&(G--,Y=O[G]);let W=T.length-F-1,j=B;for(;W>=0;){const H=Math.min(j,Y);if(T[G]===void 0)break;if(T[G].copyCellsFrom(T[W],j-H,Y-H,H,!0),Y-=H,Y===0&&(G--,Y=O[G]),j-=H,j===0){W--;const V=Math.max(W,0);j=(0,E.getWrappedLineTrimmedLength)(T,V,this._cols)}}for(let H=0;H<T.length;H++)O[H]<m&&T[H].setCell(O[H],L);let $=F-U;for(;$-- >0;)this.ybase===0?this.y<d-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-d&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+d-1)}if(I.length>0){const M=[],b=[];for(let G=0;G<this.lines.length;G++)b.push(this.lines.get(G));const T=this.lines.length;let D=T-1,B=0,O=I[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let F=0;for(let G=Math.min(this.lines.maxLength-1,T+x-1);G>=0;G--)if(O&&O.start>D+F){for(let Y=O.newLines.length-1;Y>=0;Y--)this.lines.set(G--,O.newLines[Y]);G++,M.push({index:D+1,amount:O.newLines.length}),F+=O.newLines.length,O=I[++B]}else this.lines.set(G,b[D--]);let U=0;for(let G=M.length-1;G>=0;G--)M[G].index+=U,this.lines.onInsertEmitter.fire(M[G]),U+=M[G].amount;const q=Math.max(0,T+x-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(m,d,L=0,I){const x=this.lines.get(m);return x?x.translateToString(d,L,I):""}getWrappedRangeForLine(m){let d=m,L=m;for(;d>0&&this.lines.get(d).isWrapped;)d--;for(;L+1<this.lines.length&&this.lines.get(L+1).isWrapped;)L++;return{first:d,last:L}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].line===m&&(this.markers[d].dispose(),this.markers.splice(d--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const d=new c.Marker(m);return this.markers.push(d),d.register(this.lines.onTrim((L=>{d.line-=L,d.line<0&&d.dispose()}))),d.register(this.lines.onInsert((L=>{d.line>=L.index&&(d.line+=L.amount)}))),d.register(this.lines.onDelete((L=>{d.line>=L.index&&d.line<L.index+L.amount&&d.dispose(),d.line>L.index&&(d.line-=L.amount)}))),d.register(d.onDispose((()=>this._removeMarker(d)))),d}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const v=u(3734),_=u(511),h=u(643),w=u(482);r.DEFAULT_ATTR_DATA=Object.freeze(new v.AttributeData);let E=0;class R{constructor(c,f,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);const d=f||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let L=0;L<c;++L)this.setCell(L,d);this.length=c}get(c){const f=this._data[3*c+0],m=2097151&f;return[this._data[3*c+1],2097152&f?this._combined[c]:m?(0,w.stringFromCodePoint)(m):"",f>>22,2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):m]}set(c,f){this._data[3*c+1]=f[h.CHAR_DATA_ATTR_INDEX],f[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=f[1],this._data[3*c+0]=2097152|c|f[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=f[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){const f=this._data[3*c+0];return 2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&f}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){const f=this._data[3*c+0];return 2097152&f?this._combined[c]:2097151&f?(0,w.stringFromCodePoint)(2097151&f):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,f){return E=3*c,f.content=this._data[E+0],f.fg=this._data[E+1],f.bg=this._data[E+2],2097152&f.content&&(f.combinedData=this._combined[c]),268435456&f.bg&&(f.extended=this._extendedAttrs[c]),f}setCell(c,f){2097152&f.content&&(this._combined[c]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=f.content,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}setCellFromCodepoint(c,f,m,d){268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=f|m<<22,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}addCodepointToCell(c,f,m){let d=this._data[3*c+0];2097152&d?this._combined[c]+=(0,w.stringFromCodePoint)(f):2097151&d?(this._combined[c]=(0,w.stringFromCodePoint)(2097151&d)+(0,w.stringFromCodePoint)(f),d&=-2097152,d|=2097152):d=f|4194304,m&&(d&=-12582913,d|=m<<22),this._data[3*c+0]=d}insertCells(c,f,m){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,m),f<this.length-c){const d=new _.CellData;for(let L=this.length-c-f-1;L>=0;--L)this.setCell(c+f+L,this.loadCell(c+L,d));for(let L=0;L<f;++L)this.setCell(c+L,m)}else for(let d=c;d<this.length;++d)this.setCell(d,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(c,f,m){if(c%=this.length,f<this.length-c){const d=new _.CellData;for(let L=0;L<this.length-c-f;++L)this.setCell(c+L,this.loadCell(c+f+L,d));for(let L=this.length-f;L<this.length;++L)this.setCell(L,m)}else for(let d=c;d<this.length;++d)this.setCell(d,m);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,m),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,m)}replaceCells(c,f,m,d=!1){if(d)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,m),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,m);c<f&&c<this.length;)this.isProtected(c)||this.setCell(c,m),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,m),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,m);c<f&&c<this.length;)this.setCell(c++,m)}resize(c,f){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const d=new Uint32Array(m);d.set(this._data),this._data=d}for(let d=this.length;d<c;++d)this.setCell(d,f)}else{this._data=this._data.subarray(0,m);const d=Object.keys(this._combined);for(let I=0;I<d.length;I++){const x=parseInt(d[I],10);x>=c&&delete this._combined[x]}const L=Object.keys(this._extendedAttrs);for(let I=0;I<L.length;I++){const x=parseInt(L[I],10);x>=c&&delete this._extendedAttrs[x]}}return this.length=c,4*m*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,f=!1){if(f)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,c);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(const f in c._combined)this._combined[f]=c._combined[f];this._extendedAttrs={};for(const f in c._extendedAttrs)this._extendedAttrs[f]=c._extendedAttrs[f];this.isWrapped=c.isWrapped}clone(){const c=new R(0);c._data=new Uint32Array(this._data),c.length=this.length;for(const f in this._combined)c._combined[f]=this._combined[f];for(const f in this._extendedAttrs)c._extendedAttrs[f]=this._extendedAttrs[f];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,f,m,d,L){const I=c._data;if(L)for(let M=d-1;M>=0;M--){for(let b=0;b<3;b++)this._data[3*(m+M)+b]=I[3*(f+M)+b];268435456&I[3*(f+M)+2]&&(this._extendedAttrs[m+M]=c._extendedAttrs[f+M])}else for(let M=0;M<d;M++){for(let b=0;b<3;b++)this._data[3*(m+M)+b]=I[3*(f+M)+b];268435456&I[3*(f+M)+2]&&(this._extendedAttrs[m+M]=c._extendedAttrs[f+M])}const x=Object.keys(c._combined);for(let M=0;M<x.length;M++){const b=parseInt(x[M],10);b>=f&&(this._combined[b-f+m]=c._combined[b])}}translateToString(c,f,m,d){f=f??0,m=m??this.length,c&&(m=Math.min(m,this.getTrimmedLength())),d&&(d.length=0);let L="";for(;f<m;){const I=this._data[3*f+0],x=2097151&I,M=2097152&I?this._combined[f]:x?(0,w.stringFromCodePoint)(x):h.WHITESPACE_CELL_CHAR;if(L+=M,d)for(let b=0;b<M.length;++b)d.push(f);f+=I>>22||1}return d&&d.push(f),L}}r.BufferLine=R},4841:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(u,v){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return v*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(C,r)=>{function u(v,_,h){if(_===v.length-1)return v[_].getTrimmedLength();const w=!v[_].hasContent(h-1)&&v[_].getWidth(h-1)===1,E=v[_+1].getWidth(0)===2;return w&&E?h-1:h}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(v,_,h,w,E){const R=[];for(let g=0;g<v.length-1;g++){let c=g,f=v.get(++c);if(!f.isWrapped)continue;const m=[v.get(g)];for(;c<v.length&&f.isWrapped;)m.push(f),f=v.get(++c);if(w>=g&&w<c){g+=m.length-1;continue}let d=0,L=u(m,d,_),I=1,x=0;for(;I<m.length;){const b=u(m,I,_),T=b-x,D=h-L,B=Math.min(T,D);m[d].copyCellsFrom(m[I],x,L,B,!1),L+=B,L===h&&(d++,L=0),x+=B,x===b&&(I++,x=0),L===0&&d!==0&&m[d-1].getWidth(h-1)===2&&(m[d].copyCellsFrom(m[d-1],h-1,L++,1,!1),m[d-1].setCell(h-1,E))}m[d].replaceCells(L,h,E);let M=0;for(let b=m.length-1;b>0&&(b>d||m[b].getTrimmedLength()===0);b--)M++;M>0&&(R.push(g+m.length-M),R.push(M)),g+=m.length-1}return R},r.reflowLargerCreateNewLayout=function(v,_){const h=[];let w=0,E=_[w],R=0;for(let g=0;g<v.length;g++)if(E===g){const c=_[++w];v.onDeleteEmitter.fire({index:g-R,amount:c}),g+=c-1,R+=c,E=_[++w]}else h.push(g);return{layout:h,countRemoved:R}},r.reflowLargerApplyNewLayout=function(v,_){const h=[];for(let w=0;w<_.length;w++)h.push(v.get(_[w]));for(let w=0;w<h.length;w++)v.set(w,h[w]);v.length=_.length},r.reflowSmallerGetNewLineLengths=function(v,_,h){const w=[],E=v.map(((f,m)=>u(v,m,_))).reduce(((f,m)=>f+m));let R=0,g=0,c=0;for(;c<E;){if(E-c<h){w.push(E-c);break}R+=h;const f=u(v,g,_);R>f&&(R-=f,g++);const m=v[g].getWidth(R-1)===2;m&&R--;const d=m?h-1:h;w.push(d),c+=d}return w},r.getWrappedLineTrimmedLength=u},5295:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const v=u(8460),_=u(844),h=u(9092);class w extends _.Disposable{constructor(R,g){super(),this._optionsService=R,this._bufferService=g,this._onBufferActivate=this.register(new v.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(R){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(R),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(R,g){this._normal.resize(R,g),this._alt.resize(R,g),this.setupTabStops(R)}setupTabStops(R){this._normal.setupTabStops(R),this._alt.setupTabStops(R)}}r.BufferSet=w},511:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const v=u(482),_=u(643),h=u(3734);class w extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(R){const g=new w;return g.setFromCharData(R),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,v.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(R){this.fg=R[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(R[_.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(R[_.CHAR_DATA_CHAR_INDEX].length===2){const c=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){const f=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(c-55296)+f-56320+65536|R[_.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=R[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|R[_.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=R[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|R[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=w},643:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const v=u(8460),_=u(844);class h{get id(){return this._id}constructor(E){this.line=E,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(E){return this._disposables.push(E),E}}r.Marker=h,h._nextId=1},7116:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(C,r)=>{var u,v,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
|
|
120
|
+
`,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(u||(r.C0=u={})),(function(h){h.PAD="",h.HOP="",h.BPH="",h.NBH="",h.IND="",h.NEL="
",h.SSA="",h.ESA="",h.HTS="",h.HTJ="",h.VTS="",h.PLD="",h.PLU="",h.RI="",h.SS2="",h.SS3="",h.DCS="",h.PU1="",h.PU2="",h.STS="",h.CCH="",h.MW="",h.SPA="",h.EPA="",h.SOS="",h.SGCI="",h.SCI="",h.CSI="",h.ST="",h.OSC="",h.PM="",h.APC=""})(v||(r.C1=v={})),(function(h){h.ST=`${u.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const v=u(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(h,w,E,R){const g={type:0,cancel:!1,key:void 0},c=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?g.key=w?v.C0.ESC+"OA":v.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?g.key=w?v.C0.ESC+"OD":v.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?g.key=w?v.C0.ESC+"OC":v.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(g.key=w?v.C0.ESC+"OB":v.C0.ESC+"[B");break;case 8:g.key=h.ctrlKey?"\b":v.C0.DEL,h.altKey&&(g.key=v.C0.ESC+g.key);break;case 9:if(h.shiftKey){g.key=v.C0.ESC+"[Z";break}g.key=v.C0.HT,g.cancel=!0;break;case 13:g.key=h.altKey?v.C0.ESC+v.C0.CR:v.C0.CR,g.cancel=!0;break;case 27:g.key=v.C0.ESC,h.altKey&&(g.key=v.C0.ESC+v.C0.ESC),g.cancel=!0;break;case 37:if(h.metaKey)break;c?(g.key=v.C0.ESC+"[1;"+(c+1)+"D",g.key===v.C0.ESC+"[1;3D"&&(g.key=v.C0.ESC+(E?"b":"[1;5D"))):g.key=w?v.C0.ESC+"OD":v.C0.ESC+"[D";break;case 39:if(h.metaKey)break;c?(g.key=v.C0.ESC+"[1;"+(c+1)+"C",g.key===v.C0.ESC+"[1;3C"&&(g.key=v.C0.ESC+(E?"f":"[1;5C"))):g.key=w?v.C0.ESC+"OC":v.C0.ESC+"[C";break;case 38:if(h.metaKey)break;c?(g.key=v.C0.ESC+"[1;"+(c+1)+"A",E||g.key!==v.C0.ESC+"[1;3A"||(g.key=v.C0.ESC+"[1;5A")):g.key=w?v.C0.ESC+"OA":v.C0.ESC+"[A";break;case 40:if(h.metaKey)break;c?(g.key=v.C0.ESC+"[1;"+(c+1)+"B",E||g.key!==v.C0.ESC+"[1;3B"||(g.key=v.C0.ESC+"[1;5B")):g.key=w?v.C0.ESC+"OB":v.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(g.key=v.C0.ESC+"[2~");break;case 46:g.key=c?v.C0.ESC+"[3;"+(c+1)+"~":v.C0.ESC+"[3~";break;case 36:g.key=c?v.C0.ESC+"[1;"+(c+1)+"H":w?v.C0.ESC+"OH":v.C0.ESC+"[H";break;case 35:g.key=c?v.C0.ESC+"[1;"+(c+1)+"F":w?v.C0.ESC+"OF":v.C0.ESC+"[F";break;case 33:h.shiftKey?g.type=2:h.ctrlKey?g.key=v.C0.ESC+"[5;"+(c+1)+"~":g.key=v.C0.ESC+"[5~";break;case 34:h.shiftKey?g.type=3:h.ctrlKey?g.key=v.C0.ESC+"[6;"+(c+1)+"~":g.key=v.C0.ESC+"[6~";break;case 112:g.key=c?v.C0.ESC+"[1;"+(c+1)+"P":v.C0.ESC+"OP";break;case 113:g.key=c?v.C0.ESC+"[1;"+(c+1)+"Q":v.C0.ESC+"OQ";break;case 114:g.key=c?v.C0.ESC+"[1;"+(c+1)+"R":v.C0.ESC+"OR";break;case 115:g.key=c?v.C0.ESC+"[1;"+(c+1)+"S":v.C0.ESC+"OS";break;case 116:g.key=c?v.C0.ESC+"[15;"+(c+1)+"~":v.C0.ESC+"[15~";break;case 117:g.key=c?v.C0.ESC+"[17;"+(c+1)+"~":v.C0.ESC+"[17~";break;case 118:g.key=c?v.C0.ESC+"[18;"+(c+1)+"~":v.C0.ESC+"[18~";break;case 119:g.key=c?v.C0.ESC+"[19;"+(c+1)+"~":v.C0.ESC+"[19~";break;case 120:g.key=c?v.C0.ESC+"[20;"+(c+1)+"~":v.C0.ESC+"[20~";break;case 121:g.key=c?v.C0.ESC+"[21;"+(c+1)+"~":v.C0.ESC+"[21~";break;case 122:g.key=c?v.C0.ESC+"[23;"+(c+1)+"~":v.C0.ESC+"[23~";break;case 123:g.key=c?v.C0.ESC+"[24;"+(c+1)+"~":v.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(E&&!R||!h.altKey||h.metaKey)!E||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?g.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(g.key=v.C0.US),h.key==="@"&&(g.key=v.C0.NUL)):h.keyCode===65&&(g.type=1);else{const f=_[h.keyCode],m=f==null?void 0:f[h.shiftKey?1:0];if(m)g.key=v.C0.ESC+m;else if(h.keyCode>=65&&h.keyCode<=90){const d=h.ctrlKey?h.keyCode-64:h.keyCode+32;let L=String.fromCharCode(d);h.shiftKey&&(L=L.toUpperCase()),g.key=v.C0.ESC+L}else if(h.keyCode===32)g.key=v.C0.ESC+(h.ctrlKey?v.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let d=h.code.slice(3,4);h.shiftKey||(d=d.toLowerCase()),g.key=v.C0.ESC+d,g.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?g.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?g.key=v.C0.NUL:h.keyCode>=51&&h.keyCode<=55?g.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?g.key=v.C0.DEL:h.keyCode===219?g.key=v.C0.ESC:h.keyCode===220?g.key=v.C0.FS:h.keyCode===221&&(g.key=v.C0.GS)}return g}},482:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},r.utf32ToString=function(u,v=0,_=u.length){let h="";for(let w=v;w<_;++w){let E=u[w];E>65535?(E-=65536,h+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):h+=String.fromCharCode(E)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,v){const _=u.length;if(!_)return 0;let h=0,w=0;if(this._interim){const E=u.charCodeAt(w++);56320<=E&&E<=57343?v[h++]=1024*(this._interim-55296)+E-56320+65536:(v[h++]=this._interim,v[h++]=E),this._interim=0}for(let E=w;E<_;++E){const R=u.charCodeAt(E);if(55296<=R&&R<=56319){if(++E>=_)return this._interim=R,h;const g=u.charCodeAt(E);56320<=g&&g<=57343?v[h++]=1024*(R-55296)+g-56320+65536:(v[h++]=R,v[h++]=g)}else R!==65279&&(v[h++]=R)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,v){const _=u.length;if(!_)return 0;let h,w,E,R,g=0,c=0,f=0;if(this.interim[0]){let L=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let x,M=0;for(;(x=63&this.interim[++M])&&M<4;)I<<=6,I|=x;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;f<T;){if(f>=_)return 0;if(x=u[f++],(192&x)!=128){f--,L=!0;break}this.interim[M++]=x,I<<=6,I|=63&x}L||(b===2?I<128?f--:v[g++]=I:b===3?I<2048||I>=55296&&I<=57343||I===65279||(v[g++]=I):I<65536||I>1114111||(v[g++]=I)),this.interim.fill(0)}const m=_-4;let d=f;for(;d<_;){for(;!(!(d<m)||128&(h=u[d])||128&(w=u[d+1])||128&(E=u[d+2])||128&(R=u[d+3]));)v[g++]=h,v[g++]=w,v[g++]=E,v[g++]=R,d+=4;if(h=u[d++],h<128)v[g++]=h;else if((224&h)==192){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(c=(31&h)<<6|63&w,c<128){d--;continue}v[g++]=c}else if((240&h)==224){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,g;if(E=u[d++],(192&E)!=128){d--;continue}if(c=(15&h)<<12|(63&w)<<6|63&E,c<2048||c>=55296&&c<=57343||c===65279)continue;v[g++]=c}else if((248&h)==240){if(d>=_)return this.interim[0]=h,g;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,g;if(E=u[d++],(192&E)!=128){d--;continue}if(d>=_)return this.interim[0]=h,this.interim[1]=w,this.interim[2]=E,g;if(R=u[d++],(192&R)!=128){d--;continue}if(c=(7&h)<<18|(63&w)<<12|(63&E)<<6|63&R,c<65536||c>1114111)continue;v[g++]=c}}return g}}},225:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const v=u(1480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let w;r.UnicodeV6=class{constructor(){if(this.version="6",!w){w=new Uint8Array(65536),w.fill(1),w[0]=0,w.fill(0,1,32),w.fill(0,127,160),w.fill(2,4352,4448),w[9001]=2,w[9002]=2,w.fill(2,11904,42192),w[12351]=1,w.fill(2,44032,55204),w.fill(2,63744,64256),w.fill(2,65040,65050),w.fill(2,65072,65136),w.fill(2,65280,65377),w.fill(2,65504,65511);for(let E=0;E<_.length;++E)w.fill(0,_[E][0],_[E][1]+1)}}wcwidth(E){return E<32?0:E<127?1:E<65536?w[E]:(function(R,g){let c,f=0,m=g.length-1;if(R<g[0][0]||R>g[m][1])return!1;for(;m>=f;)if(c=f+m>>1,R>g[c][1])f=c+1;else{if(!(R<g[c][0]))return!0;m=c-1}return!1})(E,h)?0:E>=131072&&E<=196605||E>=196608&&E<=262141?2:1}charProperties(E,R){let g=this.wcwidth(E),c=g===0&&R!==0;if(c){const f=v.UnicodeService.extractWidth(R);f===0?c=!1:f>g&&(g=f)}return v.UnicodeService.createPropertyValue(0,g,c)}}},5981:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const v=u(8460),_=u(844);class h extends _.Disposable{constructor(E){super(),this._action=E,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(E,R){if(R!==void 0&&this._syncCalls>R)return void(this._syncCalls=0);if(this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);const c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(E,R){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(R),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(R)}_innerWrite(E=0,R=!0){const g=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const c=this._writeBuffer[this._bufferOffset],f=this._action(c,R);if(f){const d=L=>Date.now()-g>=12?setTimeout((()=>this._innerWrite(0,L))):this._innerWrite(g,L);return void f.catch((L=>(queueMicrotask((()=>{throw L})),Promise.resolve(!1)))).then(d)}const m=this._callbacks[this._bufferOffset];if(m&&m(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-g>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=h},5941:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,v=/^[\da-f]+$/;function _(h,w){const E=h.toString(16),R=E.length<2?"0"+E:E;switch(w){case 4:return E[0];case 8:return R;case 12:return(R+R).slice(0,3);default:return R+R}}r.parseColor=function(h){if(!h)return;let w=h.toLowerCase();if(w.indexOf("rgb:")===0){w=w.slice(4);const E=u.exec(w);if(E){const R=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/R*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/R*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/R*255)]}}else if(w.indexOf("#")===0&&(w=w.slice(1),v.exec(w)&&[3,6,9,12].includes(w.length))){const E=w.length/3,R=[0,0,0];for(let g=0;g<3;++g){const c=parseInt(w.slice(E*g,E*g+E),16);R[g]=E===1?c<<4:E===2?c:E===3?c>>4:c>>8}return R}},r.toRgbString=function(h,w=16){const[E,R,g]=h;return`rgb:${_(E,w)}/${_(R,w)}/${_(g,w)}`}},5770:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const v=u(482),_=u(8742),h=u(5770),w=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=w}registerHandler(R,g){this._handlers[R]===void 0&&(this._handlers[R]=[]);const c=this._handlers[R];return c.push(g),{dispose:()=>{const f=c.indexOf(g);f!==-1&&c.splice(f,1)}}}clearHandler(R){this._handlers[R]&&delete this._handlers[R]}setHandlerFallback(R){this._handlerFb=R}reset(){if(this._active.length)for(let R=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;R>=0;--R)this._active[R].unhook(!1);this._stack.paused=!1,this._active=w,this._ident=0}hook(R,g){if(this.reset(),this._ident=R,this._active=this._handlers[R]||w,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(R,g,c){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(R,g,c);else this._handlerFb(this._ident,"PUT",(0,v.utf32ToString)(R,g,c))}unhook(R,g=!0){if(this._active.length){let c=!1,f=this._active.length-1,m=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,c=g,m=this._stack.fallThrough,this._stack.paused=!1),!m&&c===!1){for(;f>=0&&(c=this._active[f].unhook(R),c!==!0);f--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,c;f--}for(;f>=0;f--)if(c=this._active[f].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",R);this._active=w,this._ident=0}};const E=new _.Params;E.addParam(0),r.DcsHandler=class{constructor(R){this._handler=R,this._data="",this._params=E,this._hitLimit=!1}hook(R){this._params=R.length>1||R.params[0]?R.clone():E,this._data="",this._hitLimit=!1}put(R,g,c){this._hitLimit||(this._data+=(0,v.utf32ToString)(R,g,c),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(R){let g=!1;if(this._hitLimit)g=!1;else if(R&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then((c=>(this._params=E,this._data="",this._hitLimit=!1,c)));return this._params=E,this._data="",this._hitLimit=!1,g}}},2015:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const v=u(844),_=u(8742),h=u(6242),w=u(6351);class E{constructor(f){this.table=new Uint8Array(f)}setDefault(f,m){this.table.fill(f<<4|m)}add(f,m,d,L){this.table[m<<8|f]=d<<4|L}addMany(f,m,d,L){for(let I=0;I<f.length;I++)this.table[m<<8|f[I]]=d<<4|L}}r.TransitionTable=E;const R=160;r.VT500_TRANSITION_TABLE=(function(){const c=new E(4095),f=Array.apply(null,Array(256)).map(((M,b)=>b)),m=(M,b)=>f.slice(M,b),d=m(32,127),L=m(0,24);L.push(25),L.push.apply(L,m(28,32));const I=m(0,14);let x;for(x in c.setDefault(1,0),c.addMany(d,0,2,0),I)c.addMany([24,26,153,154],x,3,0),c.addMany(m(128,144),x,3,0),c.addMany(m(144,152),x,3,0),c.add(156,x,0,0),c.add(27,x,11,1),c.add(157,x,4,8),c.addMany([152,158,159],x,0,7),c.add(155,x,11,3),c.add(144,x,11,9);return c.addMany(L,0,3,0),c.addMany(L,1,3,1),c.add(127,1,0,1),c.addMany(L,8,0,8),c.addMany(L,3,3,3),c.add(127,3,0,3),c.addMany(L,4,3,4),c.add(127,4,0,4),c.addMany(L,6,3,6),c.addMany(L,5,3,5),c.add(127,5,0,5),c.addMany(L,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(d,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(m(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(d,7,0,7),c.addMany(L,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(m(64,127),3,7,0),c.addMany(m(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(m(48,60),4,8,4),c.addMany(m(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(m(32,64),6,0,6),c.add(127,6,0,6),c.addMany(m(64,127),6,0,0),c.addMany(m(32,48),3,9,5),c.addMany(m(32,48),5,9,5),c.addMany(m(48,64),5,0,6),c.addMany(m(64,127),5,7,0),c.addMany(m(32,48),4,9,5),c.addMany(m(32,48),1,9,2),c.addMany(m(32,48),2,9,2),c.addMany(m(48,127),2,10,0),c.addMany(m(48,80),1,10,0),c.addMany(m(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(m(96,127),1,10,0),c.add(80,1,11,9),c.addMany(L,9,0,9),c.add(127,9,0,9),c.addMany(m(28,32),9,0,9),c.addMany(m(32,48),9,9,12),c.addMany(m(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(L,11,0,11),c.addMany(m(32,128),11,0,11),c.addMany(m(28,32),11,0,11),c.addMany(L,10,0,10),c.add(127,10,0,10),c.addMany(m(28,32),10,0,10),c.addMany(m(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(m(32,48),10,9,12),c.addMany(L,12,0,12),c.add(127,12,0,12),c.addMany(m(28,32),12,0,12),c.addMany(m(32,48),12,9,12),c.addMany(m(48,64),12,0,11),c.addMany(m(64,127),12,12,13),c.addMany(m(64,127),10,12,13),c.addMany(m(64,127),9,12,13),c.addMany(L,13,13,13),c.addMany(d,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(R,0,2,0),c.add(R,8,5,8),c.add(R,6,0,6),c.add(R,11,0,11),c.add(R,13,13,13),c})();class g extends v.Disposable{constructor(f=r.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(m,d,L)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,d)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,v.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new w.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,m=[64,126]){let d=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(d=f.prefix.charCodeAt(0),d&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let I=0;I<f.intermediates.length;++I){const x=f.intermediates.charCodeAt(I);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=x}}if(f.final.length!==1)throw new Error("final must be a single byte");const L=f.final.charCodeAt(0);if(m[0]>L||L>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return d<<=8,d|=L,d}identToString(f){const m=[];for(;f;)m.push(String.fromCharCode(255&f)),f>>=8;return m.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,m){const d=this._identifier(f,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);const L=this._escHandlers[d];return L.push(m),{dispose:()=>{const I=L.indexOf(m);I!==-1&&L.splice(I,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,m){this._executeHandlers[f.charCodeAt(0)]=m}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,m){const d=this._identifier(f);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);const L=this._csiHandlers[d];return L.push(m),{dispose:()=>{const I=L.indexOf(m);I!==-1&&L.splice(I,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,m){return this._dcsParser.registerHandler(this._identifier(f),m)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,m){return this._oscParser.registerHandler(f,m)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(f,m,d,L,I){this._parseStack.state=f,this._parseStack.handlers=m,this._parseStack.handlerPos=d,this._parseStack.transition=L,this._parseStack.chunkPos=I}parse(f,m,d){let L,I=0,x=0,M=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,M=this._parseStack.chunkPos+1;else{if(d===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const b=this._parseStack.handlers;let T=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(d===!1&&T>-1){for(;T>=0&&(L=b[T](this._params),L!==!0);T--)if(L instanceof Promise)return this._parseStack.handlerPos=T,L}this._parseStack.handlers=[];break;case 4:if(d===!1&&T>-1){for(;T>=0&&(L=b[T](),L!==!0);T--)if(L instanceof Promise)return this._parseStack.handlerPos=T,L}this._parseStack.handlers=[];break;case 6:if(I=f[this._parseStack.chunkPos],L=this._dcsParser.unhook(I!==24&&I!==26,d),L)return L;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(I=f[this._parseStack.chunkPos],L=this._oscParser.end(I!==24&&I!==26,d),L)return L;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,M=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let b=M;b<m;++b){switch(I=f[b],x=this._transitions.table[this.currentState<<8|(I<160?I:R)],x>>4){case 2:for(let F=b+1;;++F){if(F>=m||(I=f[F])<32||I>126&&I<R){this._printHandler(f,b,F),b=F-1;break}if(++F>=m||(I=f[F])<32||I>126&&I<R){this._printHandler(f,b,F),b=F-1;break}if(++F>=m||(I=f[F])<32||I>126&&I<R){this._printHandler(f,b,F),b=F-1;break}if(++F>=m||(I=f[F])<32||I>126&&I<R){this._printHandler(f,b,F),b=F-1;break}}break;case 3:this._executeHandlers[I]?this._executeHandlers[I]():this._executeHandlerFb(I),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:b,code:I,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|I];let D=T?T.length-1:-1;for(;D>=0&&(L=T[D](this._params),L!==!0);D--)if(L instanceof Promise)return this._preserveStack(3,T,D,x,b),L;D<0&&this._csiHandlerFb(this._collect<<8|I,this._params),this.precedingJoinState=0;break;case 8:do switch(I){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(I-48)}while(++b<m&&(I=f[b])>47&&I<60);b--;break;case 9:this._collect<<=8,this._collect|=I;break;case 10:const B=this._escHandlers[this._collect<<8|I];let O=B?B.length-1:-1;for(;O>=0&&(L=B[O](),L!==!0);O--)if(L instanceof Promise)return this._preserveStack(4,B,O,x,b),L;O<0&&this._escHandlerFb(this._collect<<8|I),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|I,this._params);break;case 13:for(let F=b+1;;++F)if(F>=m||(I=f[F])===24||I===26||I===27||I>127&&I<R){this._dcsParser.put(f,b,F),b=F-1;break}break;case 14:if(L=this._dcsParser.unhook(I!==24&&I!==26),L)return this._preserveStack(6,[],0,x,b),L;I===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let F=b+1;;F++)if(F>=m||(I=f[F])<32||I>127&&I<R){this._oscParser.put(f,b,F),b=F-1;break}break;case 6:if(L=this._oscParser.end(I!==24&&I!==26),L)return this._preserveStack(5,[],0,x,b),L;I===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}r.EscapeSequenceParser=g},6242:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const v=u(5770),_=u(482),h=[];r.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(w,E){this._handlers[w]===void 0&&(this._handlers[w]=[]);const R=this._handlers[w];return R.push(E),{dispose:()=>{const g=R.indexOf(E);g!==-1&&R.splice(g,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].start();else this._handlerFb(this._id,"START")}_put(w,E,R){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(w,E,R);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(w,E,R))}start(){this.reset(),this._state=1}put(w,E,R){if(this._state!==3){if(this._state===1)for(;E<R;){const g=w[E++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&R-E>0&&this._put(w,E,R)}}end(w,E=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let R=!1,g=this._active.length-1,c=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,R=E,c=this._stack.fallThrough,this._stack.paused=!1),!c&&R===!1){for(;g>=0&&(R=this._active[g].end(w),R!==!0);g--)if(R instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,R;g--}for(;g>=0;g--)if(R=this._active[g].end(!1),R instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,R}else this._handlerFb(this._id,"END",w);this._active=h,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(w){this._handler=w,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(w,E,R){this._hitLimit||(this._data+=(0,_.utf32ToString)(w,E,R),this._data.length>v.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(w){let E=!1;if(this._hitLimit)E=!1;else if(w&&(E=this._handler(this._data),E instanceof Promise))return E.then((R=>(this._data="",this._hitLimit=!1,R)));return this._data="",this._hitLimit=!1,E}}},8742:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const u=2147483647;class v{static fromArray(h){const w=new v;if(!h.length)return w;for(let E=Array.isArray(h[0])?1:0;E<h.length;++E){const R=h[E];if(Array.isArray(R))for(let g=0;g<R.length;++g)w.addSubParam(R[g]);else w.addParam(R)}return w}constructor(h=32,w=32){if(this.maxLength=h,this.maxSubParamsLength=w,w>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(w),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new v(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let w=0;w<this.length;++w){h.push(this.params[w]);const E=this._subParamsIdx[w]>>8,R=255&this._subParamsIdx[w];R-E>0&&h.push(Array.prototype.slice.call(this._subParams,E,R))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>u?u:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>u?u:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const w=this._subParamsIdx[h]>>8,E=255&this._subParamsIdx[h];return E-w>0?this._subParams.subarray(w,E):null}getSubParamsAll(){const h={};for(let w=0;w<this.length;++w){const E=this._subParamsIdx[w]>>8,R=255&this._subParamsIdx[w];R-E>0&&(h[w]=this._subParams.slice(E,R))}return h}addDigit(h){let w;if(this._rejectDigits||!(w=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const E=this._digitIsSub?this._subParams:this.params,R=E[w-1];E[w-1]=~R?Math.min(10*R+h,u):h}}r.Params=v},5741:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,v){const _={instance:v,dispose:v.dispose,isDisposed:!1};this._addons.push(_),v.dispose=()=>this._wrappedAddonDispose(_),v.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let v=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===u){v=_;break}if(v===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(v,1)}}},8771:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const v=u(3785),_=u(511);r.BufferApiView=class{constructor(h,w){this._buffer=h,this.type=w}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const w=this._buffer.lines.get(h);if(w)return new v.BufferLineApiView(w)}getNullCell(){return new _.CellData}}},3785:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const v=u(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new v.CellData)}translateToString(_,h,w){return this._line.translateToString(_,h,w)}}},8285:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const v=u(8771),_=u(8460),h=u(844);class w extends h.Disposable{constructor(R){super(),this._core=R,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new v.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new v.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=w},7975:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,v){return this._core.registerCsiHandler(u,(_=>v(_.toArray())))}addCsiHandler(u,v){return this.registerCsiHandler(u,v)}registerDcsHandler(u,v){return this._core.registerDcsHandler(u,((_,h)=>v(_,h.toArray())))}addDcsHandler(u,v){return this.registerDcsHandler(u,v)}registerEscHandler(u,v){return this._core.registerEscHandler(u,v)}addEscHandler(u,v){return this.registerEscHandler(u,v)}registerOscHandler(u,v){return this._core.registerOscHandler(u,v)}addOscHandler(u,v){return this.registerOscHandler(u,v)}}},7090:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(C,r,u){var v=this&&this.__decorate||function(c,f,m,d){var L,I=arguments.length,x=I<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(c,f,m,d);else for(var M=c.length-1;M>=0;M--)(L=c[M])&&(x=(I<3?L(x):I>3?L(f,m,x):L(f,m))||x);return I>3&&x&&Object.defineProperty(f,m,x),x},_=this&&this.__param||function(c,f){return function(m,d){f(m,d,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const h=u(8460),w=u(844),E=u(5295),R=u(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let g=r.BufferService=class extends w.Disposable{get buffer(){return this.buffers.active}constructor(c){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(c.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new E.BufferSet(c,this))}resize(c,f){this.cols=c,this.rows=f,this.buffers.resize(c,f),this._onResize.fire({cols:c,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,f=!1){const m=this.buffer;let d;d=this._cachedBlankLine,d&&d.length===this.cols&&d.getFg(0)===c.fg&&d.getBg(0)===c.bg||(d=m.getBlankLine(c,f),this._cachedBlankLine=d),d.isWrapped=f;const L=m.ybase+m.scrollTop,I=m.ybase+m.scrollBottom;if(m.scrollTop===0){const x=m.lines.isFull;I===m.lines.length-1?x?m.lines.recycle().copyFrom(d):m.lines.push(d.clone()):m.lines.splice(I+1,0,d.clone()),x?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const x=I-L+1;m.lines.shiftElements(L+1,x-1,-1),m.lines.set(I,d.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(c,f,m){const d=this.buffer;if(c<0){if(d.ydisp===0)return;this.isUserScrolling=!0}else c+d.ydisp>=d.ybase&&(this.isUserScrolling=!1);const L=d.ydisp;d.ydisp=Math.max(Math.min(d.ydisp+c,d.ybase),0),L!==d.ydisp&&(f||this._onScroll.fire(d.ydisp))}};r.BufferService=g=v([_(0,R.IOptionsService)],g)},7994:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,v){this._charsets[u]=v,this.glevel===u&&(this.charset=v)}}},1753:function(C,r,u){var v=this&&this.__decorate||function(d,L,I,x){var M,b=arguments.length,T=b<3?L:x===null?x=Object.getOwnPropertyDescriptor(L,I):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,L,I,x);else for(var D=d.length-1;D>=0;D--)(M=d[D])&&(T=(b<3?M(T):b>3?M(L,I,T):M(L,I))||T);return b>3&&T&&Object.defineProperty(L,I,T),T},_=this&&this.__param||function(d,L){return function(I,x){L(I,x,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const h=u(2585),w=u(8460),E=u(844),R={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:d=>d.button!==4&&d.action===1&&(d.ctrl=!1,d.alt=!1,d.shift=!1,!0)},VT200:{events:19,restrict:d=>d.action!==32},DRAG:{events:23,restrict:d=>d.action!==32||d.button!==3},ANY:{events:31,restrict:d=>!0}};function g(d,L){let I=(d.ctrl?16:0)|(d.shift?4:0)|(d.alt?8:0);return d.button===4?(I|=64,I|=d.action):(I|=3&d.button,4&d.button&&(I|=64),8&d.button&&(I|=128),d.action===32?I|=32:d.action!==0||L||(I|=3)),I}const c=String.fromCharCode,f={DEFAULT:d=>{const L=[g(d,!1)+32,d.col+32,d.row+32];return L[0]>255||L[1]>255||L[2]>255?"":`\x1B[M${c(L[0])}${c(L[1])}${c(L[2])}`},SGR:d=>{const L=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${g(d,!0)};${d.col};${d.row}${L}`},SGR_PIXELS:d=>{const L=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${g(d,!0)};${d.x};${d.y}${L}`}};let m=r.CoreMouseService=class extends E.Disposable{constructor(d,L){super(),this._bufferService=d,this._coreService=L,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new w.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const I of Object.keys(R))this.addProtocol(I,R[I]);for(const I of Object.keys(f))this.addEncoding(I,f[I]);this.reset()}addProtocol(d,L){this._protocols[d]=L}addEncoding(d,L){this._encodings[d]=L}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(d){if(!this._protocols[d])throw new Error(`unknown protocol "${d}"`);this._activeProtocol=d,this._onProtocolChange.fire(this._protocols[d].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(d){if(!this._encodings[d])throw new Error(`unknown encoding "${d}"`);this._activeEncoding=d}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(d){if(d.col<0||d.col>=this._bufferService.cols||d.row<0||d.row>=this._bufferService.rows||d.button===4&&d.action===32||d.button===3&&d.action!==32||d.button!==4&&(d.action===2||d.action===3)||(d.col++,d.row++,d.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,d,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(d))return!1;const L=this._encodings[this._activeEncoding](d);return L&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(L):this._coreService.triggerDataEvent(L,!0)),this._lastEvent=d,!0}explainEvents(d){return{down:!!(1&d),up:!!(2&d),drag:!!(4&d),move:!!(8&d),wheel:!!(16&d)}}_equalEvents(d,L,I){if(I){if(d.x!==L.x||d.y!==L.y)return!1}else if(d.col!==L.col||d.row!==L.row)return!1;return d.button===L.button&&d.action===L.action&&d.ctrl===L.ctrl&&d.alt===L.alt&&d.shift===L.shift}};r.CoreMouseService=m=v([_(0,h.IBufferService),_(1,h.ICoreService)],m)},6975:function(C,r,u){var v=this&&this.__decorate||function(m,d,L,I){var x,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,L,I);else for(var T=m.length-1;T>=0;T--)(x=m[T])&&(b=(M<3?x(b):M>3?x(d,L,b):x(d,L))||b);return M>3&&b&&Object.defineProperty(d,L,b),b},_=this&&this.__param||function(m,d){return function(L,I){d(L,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const h=u(1439),w=u(8460),E=u(844),R=u(2585),g=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=r.CoreService=class extends E.Disposable{constructor(m,d,L){super(),this._bufferService=m,this._logService=d,this._optionsService=L,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new w.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new w.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new w.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new w.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(g),this.decPrivateModes=(0,h.clone)(c)}reset(){this.modes=(0,h.clone)(g),this.decPrivateModes=(0,h.clone)(c)}triggerDataEvent(m,d=!1){if(this._optionsService.rawOptions.disableStdin)return;const L=this._bufferService.buffer;d&&this._optionsService.rawOptions.scrollOnUserInput&&L.ybase!==L.ydisp&&this._onRequestScrollToBottom.fire(),d&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((I=>I.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((d=>d.charCodeAt(0))))),this._onBinary.fire(m))}};r.CoreService=f=v([_(0,R.IBufferService),_(1,R.ILogService),_(2,R.IOptionsService)],f)},9074:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const v=u(8055),_=u(8460),h=u(844),w=u(6106);let E=0,R=0;class g extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new w.SortedList((m=>m==null?void 0:m.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(m){if(m.marker.isDisposed)return;const d=new c(m);if(d){const L=d.marker.onDispose((()=>d.dispose()));d.onDispose((()=>{d&&(this._decorations.delete(d)&&this._onDecorationRemoved.fire(d),L.dispose())})),this._decorations.insert(d),this._onDecorationRegistered.fire(d)}return d}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,d,L){let I=0,x=0;for(const M of this._decorations.getKeyIterator(d))I=M.options.x??0,x=I+(M.options.width??1),m>=I&&m<x&&(!L||(M.options.layer??"bottom")===L)&&(yield M)}forEachDecorationAtCell(m,d,L,I){this._decorations.forEachByKey(d,(x=>{E=x.options.x??0,R=E+(x.options.width??1),m>=E&&m<R&&(!L||(x.options.layer??"bottom")===L)&&I(x)}))}}r.DecorationService=g;class c extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=v.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=v.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=m.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const v=u(2585),_=u(8343);class h{constructor(...E){this._entries=new Map;for(const[R,g]of E)this.set(R,g)}set(E,R){const g=this._entries.get(E);return this._entries.set(E,R),g}forEach(E){for(const[R,g]of this._entries.entries())E(R,g)}has(E){return this._entries.has(E)}get(E){return this._entries.get(E)}}r.ServiceCollection=h,r.InstantiationService=class{constructor(){this._services=new h,this._services.set(v.IInstantiationService,this)}setService(w,E){this._services.set(w,E)}getService(w){return this._services.get(w)}createInstance(w,...E){const R=(0,_.getServiceDependencies)(w).sort(((f,m)=>f.index-m.index)),g=[];for(const f of R){const m=this._services.get(f.id);if(!m)throw new Error(`[createInstance] ${w.name} depends on UNKNOWN service ${f.id}.`);g.push(m)}const c=R.length>0?R[0].index:E.length;if(E.length!==c)throw new Error(`[createInstance] First service dependency of ${w.name} at position ${c+1} conflicts with ${E.length} static arguments`);return new w(...E,...g)}}},7866:function(C,r,u){var v=this&&this.__decorate||function(c,f,m,d){var L,I=arguments.length,x=I<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(c,f,m,d);else for(var M=c.length-1;M>=0;M--)(L=c[M])&&(x=(I<3?L(x):I>3?L(f,m,x):L(f,m))||x);return I>3&&x&&Object.defineProperty(f,m,x),x},_=this&&this.__param||function(c,f){return function(m,d){f(m,d,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const h=u(844),w=u(2585),E={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF};let R,g=r.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),R=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let f=0;f<c.length;f++)typeof c[f]=="function"&&(c[f]=c[f]())}_log(c,f,m){this._evalLazyOptionalParams(m),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...m)}trace(c,...f){var m;this._logLevel<=w.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,c,f)}debug(c,...f){var m;this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,c,f)}info(c,...f){var m;this._logLevel<=w.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,c,f)}warn(c,...f){var m;this._logLevel<=w.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,c,f)}error(c,...f){var m;this._logLevel<=w.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,c,f)}};r.LogService=g=v([_(0,w.IOptionsService)],g),r.setTraceLogger=function(c){R=c},r.traceCall=function(c,f,m){if(typeof m.value!="function")throw new Error("not supported");const d=m.value;m.value=function(...L){if(R.logLevel!==w.LogLevelEnum.TRACE)return d.apply(this,L);R.trace(`GlyphRenderer#${d.name}(${L.map((x=>JSON.stringify(x))).join(", ")})`);const I=d.apply(this,L);return R.trace(`GlyphRenderer#${d.name} return`,I),I}}},7302:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const v=u(8460),_=u(844),h=u(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const w=["normal","bold","100","200","300","400","500","600","700","800","900"];class E extends _.Disposable{constructor(g){super(),this._onOptionChange=this.register(new v.EventEmitter),this.onOptionChange=this._onOptionChange.event;const c={...r.DEFAULT_OPTIONS};for(const f in g)if(f in c)try{const m=g[f];c[f]=this._sanitizeAndValidateOption(f,m)}catch(m){console.error(m)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(g,c){return this.onOptionChange((f=>{f===g&&c(this.rawOptions[g])}))}onMultipleOptionChange(g,c){return this.onOptionChange((f=>{g.indexOf(f)!==-1&&c()}))}_setupOptions(){const g=f=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},c=(f,m)=>{if(!(f in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);m=this._sanitizeAndValidateOption(f,m),this.rawOptions[f]!==m&&(this.rawOptions[f]=m,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const m={get:g.bind(this,f),set:c.bind(this,f)};Object.defineProperty(this.options,f,m)}}_sanitizeAndValidateOption(g,c){switch(g){case"cursorStyle":if(c||(c=r.DEFAULT_OPTIONS[g]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${g}`);break;case"wordSeparator":c||(c=r.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=w.includes(c)?c:r.DEFAULT_OPTIONS[g];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${g} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${g} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${g} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}r.OptionsService=E},2660:function(C,r,u){var v=this&&this.__decorate||function(E,R,g,c){var f,m=arguments.length,d=m<3?R:c===null?c=Object.getOwnPropertyDescriptor(R,g):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(E,R,g,c);else for(var L=E.length-1;L>=0;L--)(f=E[L])&&(d=(m<3?f(d):m>3?f(R,g,d):f(R,g))||d);return m>3&&d&&Object.defineProperty(R,g,d),d},_=this&&this.__param||function(E,R){return function(g,c){R(g,c,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const h=u(2585);let w=r.OscLinkService=class{constructor(E){this._bufferService=E,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(E){const R=this._bufferService.buffer;if(E.id===void 0){const L=R.addMarker(R.ybase+R.y),I={data:E,id:this._nextId++,lines:[L]};return L.onDispose((()=>this._removeMarkerFromLink(I,L))),this._dataByLinkId.set(I.id,I),I.id}const g=E,c=this._getEntryIdKey(g),f=this._entriesWithId.get(c);if(f)return this.addLineToLink(f.id,R.ybase+R.y),f.id;const m=R.addMarker(R.ybase+R.y),d={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(d,m))),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(E,R){const g=this._dataByLinkId.get(E);if(g&&g.lines.every((c=>c.line!==R))){const c=this._bufferService.buffer.addMarker(R);g.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(g,c)))}}getLinkData(E){var R;return(R=this._dataByLinkId.get(E))==null?void 0:R.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,R){const g=E.lines.indexOf(R);g!==-1&&(E.lines.splice(g,1),E.lines.length===0&&(E.data.id!==void 0&&this._entriesWithId.delete(E.key),this._dataByLinkId.delete(E.id)))}};r.OscLinkService=w=v([_(0,h.IBufferService)],w)},8343:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const u="di$target",v="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[v]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const h=function(w,E,R){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,c,f){c[u]===c?c[v].push({id:g,index:f}):(c[v]=[{id:g,index:f}],c[u]=c)})(h,w,R)};return h.toString=()=>_,r.serviceRegistry.set(_,h),h}},2585:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const v=u(8343);var _;r.IBufferService=(0,v.createDecorator)("BufferService"),r.ICoreMouseService=(0,v.createDecorator)("CoreMouseService"),r.ICoreService=(0,v.createDecorator)("CoreService"),r.ICharsetService=(0,v.createDecorator)("CharsetService"),r.IInstantiationService=(0,v.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,v.createDecorator)("LogService"),r.IOptionsService=(0,v.createDecorator)("OptionsService"),r.IOscLinkService=(0,v.createDecorator)("OscLinkService"),r.IUnicodeService=(0,v.createDecorator)("UnicodeService"),r.IDecorationService=(0,v.createDecorator)("DecorationService")},1480:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const v=u(8460),_=u(225);class h{static extractShouldJoin(E){return(1&E)!=0}static extractWidth(E){return E>>1&3}static extractCharKind(E){return E>>3}static createPropertyValue(E,R,g=!1){return(16777215&E)<<3|(3&R)<<1|(g?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new v.EventEmitter,this.onChange=this._onChange.event;const E=new _.UnicodeV6;this.register(E),this._active=E.version,this._activeProvider=E}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(E){if(!this._providers[E])throw new Error(`unknown Unicode version "${E}"`);this._active=E,this._activeProvider=this._providers[E],this._onChange.fire(E)}register(E){this._providers[E.version]=E}wcwidth(E){return this._activeProvider.wcwidth(E)}getStringCellWidth(E){let R=0,g=0;const c=E.length;for(let f=0;f<c;++f){let m=E.charCodeAt(f);if(55296<=m&&m<=56319){if(++f>=c)return R+this.wcwidth(m);const I=E.charCodeAt(f);56320<=I&&I<=57343?m=1024*(m-55296)+I-56320+65536:R+=this.wcwidth(I)}const d=this.charProperties(m,g);let L=h.extractWidth(d);h.extractShouldJoin(d)&&(L-=h.extractWidth(g)),R+=L,g=d}return R}charProperties(E,R){return this._activeProvider.charProperties(E,R)}}r.UnicodeService=h}},a={};function p(C){var r=a[C];if(r!==void 0)return r.exports;var u=a[C]={exports:{}};return i[C].call(u.exports,u,u.exports,p),u.exports}var k={};return(()=>{var C=k;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=p(9042),u=p(3236),v=p(844),_=p(5741),h=p(8285),w=p(7975),E=p(7090),R=["cols","rows"];class g extends v.Disposable{constructor(f){super(),this._core=this.register(new u.Terminal(f)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const m=L=>this._core.options[L],d=(L,I)=>{this._checkReadonlyOptions(L),this._core.options[L]=I};for(const L in this._core.options){const I={get:m.bind(this,L),set:d.bind(this,L)};Object.defineProperty(this._publicOptions,L,I)}}_checkReadonlyOptions(f){if(R.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new w.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new E.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const m in f)this._publicOptions[m]=f[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,m=!0){this._core.input(f,m)}resize(f,m){this._verifyIntegers(f,m),this._core.resize(f,m)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,m,d){this._verifyIntegers(f,m,d),this._core.select(f,m,d)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,m){this._verifyIntegers(f,m),this._core.selectLines(f,m)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,m){this._core.write(f,m)}writeln(f,m){this._core.write(f),this._core.write(`\r
|
|
121
|
+
`,m)}paste(f){this._core.paste(f)}refresh(f,m){this._verifyIntegers(f,m),this._core.refresh(f,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return r}_verifyIntegers(...f){for(const m of f)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const m of f)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}C.Terminal=g})(),k})()))})(Vc)),Vc.exports}var bb=yb();function Sb(n){return n.toLowerCase().startsWith("win")}function Cb(n){return n.keyCode===86&&n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey}const xb=8,kb=100,Eb=80,Zf=6,ep=.02,Lb=.95,Tb=50;function Rb(n,t){return Math.hypot(n,t)>xb}function Mb(n,t){const i=n[n.length-1];if(i===void 0||t-i.t>Eb)return 0;const a=n.filter(C=>i.t-C.t<=kb),p=a[0];if(p===void 0||a.length<2||i.t===p.t)return 0;const k=(p.y-i.y)/(i.t-p.t);return Math.max(-Zf,Math.min(Zf,k))}function Ab(n,t){if(Math.abs(n)<ep)return{delta:0,velocity:0};const i=Math.max(0,Math.min(Tb,t)),a=n*Lb**(i/16);return{delta:n*i,velocity:Math.abs(a)<ep?0:a}}function Nb(n){const t=Math.trunc(n);return{pixels:t,rest:n-t}}const Db=60;function Ib(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const tp={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},np={dark:1,light:4.5};function hg({terminalId:n,connection:t,active:i,theme:a,autoFocus:p=!0,pasteOnCtrlV:k=!1}){const C=N.useRef(null),r=N.useRef(null),u=N.useRef(null),v=N.useRef(a);return v.current=a,N.useEffect(()=>{const _=C.current;if(_===null)return;const h=new bb.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:tp[v.current],minimumContrastRatio:np[v.current]});r.current=h;const w=new mb.FitAddon;u.current=w,h.loadAddon(w),h.loadAddon(new vb.WebLinksAddon),h.open(_);let E=!1;const R=()=>{if(!(E||Ib()!=="webgl")){E=!0;try{const J=new wb.WebglAddon;J.onContextLoss(()=>J.dispose()),h.loadAddon(J)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let g={cols:0,rows:0},c;const f=()=>_.clientWidth>0&&_.clientHeight>0,m=J=>{const{cols:Z,rows:_e}=h;Z<=0||_e<=0||!J&&Z===g.cols&&_e===g.rows||(g={cols:Z,rows:_e},t.send({type:"resize",terminalId:n,cols:Z,rows:_e}))};let d={atBottom:!0,line:0},L=!1;const I=()=>{if(L||!f())return;const J=h.buffer.active;d={atBottom:J.viewportY>=J.baseY,line:J.viewportY}},x=()=>{const J=h.buffer.active;if(J.baseY===0)return;const Z=d.atBottom?J.baseY:Math.min(d.line,J.baseY);h.scrollToLine(Z>0?Z-1:Z+1),h.scrollToLine(Z)},M=h.onRender(I),b=h.onScroll(I);let T=f();const D=()=>{if(f()){try{w.fit()}catch{return}L&&(x(),L=!1),h.cols>0&&h.rows>0&&R(),m(!1)}},B=()=>{window.clearTimeout(c),c=window.setTimeout(D,Db)},O=new ResizeObserver(()=>{const J=f();L=!0,J&&!T&&x(),T=J,B()});O.observe(_),window.addEventListener("resize",B);let F=null,U=0,q=0;const G=(J,Z,_e)=>{const ve=h.element;if(ve===void 0)return;const ye=Nb(q+J);q=ye.rest,ye.pixels!==0&&ve.dispatchEvent(new WheelEvent("wheel",{deltaY:ye.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:_e,bubbles:!0,cancelable:!0}))},Y=()=>{window.cancelAnimationFrame(U),U=0},W=(J,Z,_e)=>{let ve=J,ye=performance.now();const Ee=fe=>{if(!f()){U=0;return}const Ae=Ab(ve,fe-ye);ye=fe,G(Ae.delta,Z,_e),ve=Ae.velocity,U=ve===0?0:window.requestAnimationFrame(Ee)};U=window.requestAnimationFrame(Ee)},j=(J,Z)=>{for(let _e=0;_e<J.length;_e++){const ve=J.item(_e);if(ve!==null&&ve.identifier===Z)return ve}return null},$=J=>{Y(),q=0;const Z=J.touches.length===1?J.touches.item(0):null;F=Z===null?null:{id:Z.identifier,startX:Z.clientX,startY:Z.clientY,lastX:Z.clientX,lastY:Z.clientY,moving:!1,samples:[{t:J.timeStamp,y:Z.clientY}]}},H=J=>{if(J.stopPropagation(),F===null)return;const Z=j(J.touches,F.id);if(Z===null)return;if(!F.moving){if(!Rb(Z.clientX-F.startX,Z.clientY-F.startY))return;F.moving=!0}J.cancelable&&J.preventDefault();const _e=F.lastY-Z.clientY;F.lastX=Z.clientX,F.lastY=Z.clientY,F.samples.push({t:J.timeStamp,y:Z.clientY}),F.samples.length>32&&F.samples.shift(),G(_e,Z.clientX,Z.clientY)},V=J=>{if(F===null||j(J.changedTouches,F.id)===null)return;const Z=F;if(F=null,!Z.moving)return;const _e=Mb(Z.samples,J.timeStamp);_e!==0&&W(_e,Z.lastX,Z.lastY)},te=()=>{F=null};_.addEventListener("touchstart",$,{capture:!0,passive:!0}),_.addEventListener("touchmove",H,{capture:!0,passive:!1}),_.addEventListener("touchend",V,{capture:!0,passive:!0}),_.addEventListener("touchcancel",te,{capture:!0,passive:!0});const ie=()=>{if(!(document.visibilityState!=="visible"||!f())){try{w.fit()}catch{return}m(!0)}};window.addEventListener("focus",ie),document.addEventListener("visibilitychange",ie),k&&h.attachCustomKeyEventHandler(J=>!Cb(J));const pe=h.onData(J=>{t.send({type:"input",terminalId:n,data:J})}),me=t.onMessage(J=>{switch(J.type){case"terminal.output":J.terminalId===n&&h.write(J.data);break;case"terminal.replay":if(J.terminalId!==n)break;h.reset(),J.truncated&&h.write(`\x1B[90m-- ${S("terminal.replayTruncated")} --\x1B[0m\r
|
|
122
|
+
`),h.write(J.data);break;case"terminal.exit":if(J.terminalId!==n)break;h.write(`\r
|
|
123
|
+
\x1B[90m-- ${S("terminal.exited",{code:J.exitCode})} --\x1B[0m\r
|
|
124
|
+
`);break}}),X=()=>{if(f())try{w.fit()}catch{}const J=h.cols>0?h.cols:80,Z=h.rows>0?h.rows:24;g={cols:J,rows:Z},t.send({type:"terminal.attach",terminalId:n,cols:J,rows:Z})};X();const K=t.onReopen(X);return()=>{window.clearTimeout(c),window.removeEventListener("resize",B),window.removeEventListener("focus",ie),document.removeEventListener("visibilitychange",ie),O.disconnect(),Y(),_.removeEventListener("touchstart",$,{capture:!0}),_.removeEventListener("touchmove",H,{capture:!0}),_.removeEventListener("touchend",V,{capture:!0}),_.removeEventListener("touchcancel",te,{capture:!0}),M.dispose(),b.dispose(),pe.dispose(),me(),K(),t.send({type:"terminal.detach",terminalId:n}),h.dispose(),r.current=null,u.current=null}},[n,t,k]),N.useEffect(()=>{const _=r.current;_!==null&&(_.options.theme=tp[a],_.options.minimumContrastRatio=np[a])},[a]),N.useEffect(()=>{if(!i)return;const _=r.current,h=u.current;if(_===null||h===null)return;const w=window.setTimeout(()=>{const E=C.current;if(!(E===null||E.clientWidth===0||E.clientHeight===0)){try{h.fit()}catch{return}p&&_.focus(),_.cols>0&&_.rows>0&&t.send({type:"resize",terminalId:n,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(w)},[i,p,n,t]),l.jsx("div",{className:`terminal-surface${i?"":" terminal-surface-hidden"}`,ref:C})}function jb(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8s-2.4 4.5-6.5 4.5S1.5 8 1.5 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Wl({title:n,onHide:t,confirmText:i}){const[a,p]=N.useState(!1);return l.jsxs("span",{className:"section-hide",children:[l.jsx("button",{className:"icon-button",onClick:k=>{k.stopPropagation(),i===null?t():p(!0)},title:n,"aria-label":n,children:l.jsx(jb,{})}),a&&i!==null&&l.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[l.jsx("span",{children:i}),l.jsx("button",{className:"link-button",onClick:()=>{p(!1),t()},children:S("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>p(!1),children:S("common.cancel")})]})]})}const Pb=typeof navigator<"u"&&Sb(navigator.platform);function Ob({connection:n,shells:t,activeShellId:i,cwd:a,shellName:p,theme:k,onSelect:C,onOpen:r,onCloseShell:u,onCollapse:v,onHide:_,hideCount:h=0}){const w=p??S("console.name"),E=t.find(R=>R.terminalId===i)??t[0]??null;return l.jsxs("section",{className:"console-pane",children:[l.jsxs("header",{className:"console-header",children:[l.jsxs("div",{className:"strip-tabs",children:[t.map((R,g)=>l.jsxs("div",{className:`strip-tab${R.terminalId===(E==null?void 0:E.terminalId)?" is-active":""}${R.alive?"":" is-dead"}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>C(R.terminalId),title:R.alive?S("console.tab.title",{shell:R.label.length>0?R.label:w,number:g+1,cwd:a}):S("console.tab.exited",{code:R.exitCode??"?"}),children:S("console.tab.label",{number:g+1})}),l.jsx("button",{className:"strip-tab-close",onClick:()=>u(R.terminalId),title:S("console.tab.close"),children:"×"})]},R.terminalId)),p!==null&&l.jsx("button",{className:"strip-tab-new",onClick:r,title:S("console.openAnother",{shell:w,cwd:a}),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button",onClick:v,title:S("console.collapse"),children:"▾"}),_!==void 0&&l.jsx(Wl,{title:S("settings.hide.console"),onHide:_,confirmText:h===0?null:S("settings.panels.consoleConfirm",{count:h})})]}),l.jsx("div",{className:"console-body",children:t.length===0?l.jsx("div",{className:"console-empty",children:p===null?l.jsx("p",{className:"panel-note",children:S("console.noShell")}):l.jsx("button",{className:"link-button",onClick:r,children:S("console.openIn",{shell:w,cwd:a})})}):l.jsx("div",{className:"terminal-stack",children:t.map(R=>l.jsx(hg,{terminalId:R.terminalId,connection:n,active:R.terminalId===(E==null?void 0:E.terminalId),theme:k,pasteOnCtrlV:Pb},R.terminalId))})})]})}function Bb(n,t){if(!t.consoleShown)return{requested:n.size===0?n:new Set,open:null};const{cwd:i}=t;if(i===null)return{requested:n,open:null};if(t.shellCwds.includes(i)){if(!n.has(i))return{requested:n,open:null};const a=new Set(n);return a.delete(i),{requested:a,open:null}}return n.has(i)?{requested:n,open:null}:{requested:new Set(n).add(i),open:i}}function sp(n,t){return n.has(t)?n:new Set(n).add(t)}const Fb=.75,Hb=.9;function zn(n){if(n<1e3)return String(n);if(n<1e6){const t=n/1e3;return`${t<100?ti(t,1):Math.round(t)}k`}return`${ti(n/1e6,2)}M`}function $b({usage:n,source:t,instructionsFile:i,fallbackWindow:a=null,compact:p=!1,statusLineState:k=null,onConfigure:C}){const{lastRequestTokens:r,contextWindow:u}=n;if(C!==void 0&&k!==null&&dy(t,{state:k}))return l.jsxs("div",{className:`meter meter-idle${p?" meter-compact":""}`,title:fy(k),children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${p?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:S("meter.unmeasured")}),l.jsx("button",{className:"link-button",onClick:C,children:S("meter.configure")})]});if(t===null)return l.jsxs("div",{className:`meter meter-idle${p?" meter-compact":""}`,title:S("meter.noTokensTitle"),children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${p?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:S("meter.noTokens")})]});if(!hy(t,n)){const E=my(i,t),R=uy(t,n,a);return l.jsxs("div",{className:`meter meter-idle${p?" meter-compact":""}`,title:E,children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${p?" meter-bar-inline":""}`}),l.jsxs("span",{className:"meter-value",children:[S("meter.unmeasured"),R!==null&&l.jsxs("span",{className:"meter-dim",children:[" / ",zn(R)]})]})]})}const v=u!==null&&u>0?Math.min(r/u,1):null,_=v===null?"unknown":v>=Hb?"danger":v>=Fb?"warn":"ok",h=u===null?"":` / ${zn(u)}${n.contextWindowEstimated?"+":""}`,w=py(t,n);if(p){const E=[n.lastModel===null?null:n.lastModel,w,v===null?S("meter.unknownModelShort"):S("meter.windowPercent",{percent:Math.round(v*100)}),S("meter.output",{tokens:zn(n.lastOutputTokens)}),t==="status-line"?S("meter.responses",{count:n.assistantMessages}):S("meter.sessionTotals",{output:zn(n.totalOutputTokens),cache:zn(n.totalCacheReadTokens),count:n.assistantMessages})].filter(R=>R!==null).join(" · ");return l.jsxs("div",{className:"meter meter-compact",title:E,children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),v!==null&&l.jsx("span",{className:"meter-bar meter-bar-inline",children:l.jsx("span",{className:`meter-fill meter-fill-${_}`,style:{width:`${v*100}%`}})}),l.jsxs("span",{className:"meter-value",children:[zn(r),h.length>0&&l.jsx("span",{className:"meter-dim",children:h})]})]})}return l.jsxs("div",{className:"meter",children:[l.jsxs("div",{className:"meter-row",children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsxs("span",{className:"meter-value",children:[zn(r),u!==null&&l.jsxs("span",{className:"meter-dim",title:n.lastModel===null?void 0:w!==null?S("meter.modelWithOrigin",{model:n.lastModel,origin:w}):n.lastModel,children:[" ","/ ",zn(u),n.contextWindowEstimated&&"+"]})]})]}),v!==null?l.jsx("div",{className:"meter-bar",title:S("meter.windowPercent",{percent:Math.round(v*100)}),children:l.jsx("div",{className:`meter-fill meter-fill-${_}`,style:{width:`${v*100}%`}})}):l.jsx("div",{className:"meter-note",title:n.lastModel??void 0,children:S("meter.unknownModel")}),l.jsxs("div",{className:"meter-row meter-row-dim",children:[l.jsx("span",{title:S("meter.lastResponseTitle"),children:S("meter.output",{tokens:zn(n.lastOutputTokens)})}),l.jsx("span",{title:S("meter.sessionTitle"),children:S("meter.sessionTotals",{output:zn(n.totalOutputTokens),cache:zn(n.totalCacheReadTokens),count:n.assistantMessages})})]})]})}const Kc=["s","m","l"],dg="m",Ub="agent-workbench.thread-font",Wb="agent-workbench.notes-font",zb="s",qb={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function rp(n){return S(qb[n])}function fg(n){const t=Kc.indexOf(n);return Kc[(t+1)%Kc.length]??dg}function Vb(n){return n==="s"||n==="m"||n==="l"?n:null}function zl(n){return S("threadFont.title",{current:rp(n),next:rp(fg(n))})}const Kb=300,Gb=200,Yb=2,Xb=Kb+Gb,pg=Yb*Xb,Qb=200;function mg(n){return Math.max(Qb,n)}function Jb(n){return n.hasMore&&!n.loading&&n.searching!==!0&&n.scrollTop<n.previousScrollTop&&n.scrollTop<=mg(n.clientHeight)}function Zb(n,t,i){return n<0&&t<=mg(i)}function eS(n,t){return Math.max(0,t-n)}function tS(n,t){return n===null||t.length===0||t[0]===n?!1:t.includes(n)}const nS=52,sS=10;function rS(n){return n.filter(t=>t.role==="user"&&t.parts.some(i=>i.kind==="text"||i.kind==="image")).map(t=>t.eventId)}function iS(n,t){for(let i=n-1;i>=0;i-=1){const a=t(i);if(a!==null&&a<-8)return i}return null}function oS(n){return n.awayFromEnd&&(n.ownAbove||n.hasMore)}function ip(n,t){return Math.max(0,n+t-nS)}function lS(n){return n.found?"jump":n.loading?"wait":!n.hasMore||n.pagesRequested>=sS?"give-up":"load"}const aS=1;function cS(n,t){for(const i of n){const a=t(i);if(!(a===null||a.bottom<=aS))return{eventId:i,offset:a.top,lastId:n[n.length-1]??null}}return null}function uS(n,t,i,a){const p=t.indexOf(n.eventId);if(p===-1)return null;for(let k=p;k<t.length;k+=1){const C=t[k],r=C===void 0?null:i(C);if(r!==null)return Math.max(0,a+r.top-(k===p?n.offset:0))}return null}function hS(n,t){if(t===null)return 0;const i=n.lastIndexOf(t);return i===-1?0:n.length-1-i}const op=2,dS=4;function fS(n,t,i,a=dS){const p=t.right-t.left,k=t.bottom-t.top;if(p<=0||k<=0)return 0;const C=n.right-op,r=C-p,u=n.top+op,v=u+k;return C<=i.left-a||r>=i.right+a||v<=i.top-a||u>=i.bottom+a?0:Math.ceil(C-(i.left-a))}function gg({agents:n,preselected:t,anchor:i,label:a=S("agentMenu.openWith"),onPick:p,onClose:k}){const C=N.useMemo(()=>zm(n),[n]),[r,u]=N.useState(()=>by(C,t)),[v,_]=N.useState(null),h=N.useRef(null),w=N.useRef([]);return N.useLayoutEffect(()=>{const E=h.current;if(E===null)return;const R=i.getBoundingClientRect(),g=E.getBoundingClientRect();_(Cy({left:R.left,top:R.top,bottom:R.bottom},{width:g.width,height:g.height},{width:window.innerWidth,height:window.innerHeight}))},[i]),N.useEffect(()=>{var E;(E=w.current[r])==null||E.focus()},[r,v]),N.useEffect(()=>{const E=c=>{if(!(c.altKey||c.ctrlKey||c.metaKey)){if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),k(),i.focus();return}if(c.key==="ArrowDown"||c.key==="ArrowUp"){c.preventDefault(),c.stopPropagation(),u(f=>Sy(f,c.key==="ArrowDown"?1:-1,C.length));return}if(c.key==="Enter"){c.preventDefault(),c.stopPropagation();const f=C[r];f!==void 0&&p(f.id);return}c.key==="Tab"&&k()}},R=c=>{var m;const f=c.target;f instanceof Node&&((m=h.current)!=null&&m.contains(f)||i.contains(f))||k()},g=c=>{xy(c.target,i,h.current)&&k()};return window.addEventListener("keydown",E,!0),document.addEventListener("pointerdown",R,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("keydown",E,!0),document.removeEventListener("pointerdown",R,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",k)}},[r,i,C,k,p]),Jm.createPortal(l.jsx("div",{ref:h,className:"agent-menu",role:"menu","aria-label":a,style:v===null?{left:0,top:0,visibility:"hidden"}:{left:`${v.left}px`,top:`${v.top}px`},children:C.map((E,R)=>l.jsxs("button",{ref:g=>{w.current[R]=g},className:`agent-menu-item${R===r?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:R===r?0:-1,onMouseEnter:()=>u(R),onClick:()=>p(E.id),children:[l.jsx("span",{className:"agent-menu-label",children:E.label}),E.version!==null&&l.jsx("span",{className:"agent-menu-version",children:E.version})]},E.id))}),document.body)}function vg({targets:n,className:t,text:i,blockedReason:a=null,onPick:p}){const[k,C]=N.useState(!1),r=N.useRef(null),u=N.useCallback(()=>C(!1),[]),v=N.useCallback(_=>{C(!1),p(_)},[p]);return n.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:r,className:t,onClick:()=>C(_=>!_),disabled:a!==null,"aria-haspopup":"menu","aria-expanded":k,title:a??ky(),children:i}),k&&r.current!==null&&l.jsx(gg,{agents:n,preselected:null,anchor:r.current,label:S("continue.menuLabel"),onPick:v,onClose:u})]})}function _g(n){switch(n.notice){case"compacted":return n.detail==="auto"?S("thread.notice.compactedAuto"):S("thread.notice.compacted");case"interrupted":return S("thread.notice.interrupted");case"error":return n.detail.length>0?S("thread.notice.error",{detail:n.detail}):S("thread.notice.errorNoDetail")}}const wg="agent-workbench.locale",yg="auto";function pS(n){return n==="auto"||jm(n)?n:null}function bg(n){const t=n.trim().replace(/_/g,"-").toLowerCase();if(t.length===0)return null;const i=Fu.find(k=>k.toLowerCase()===t);if(i!==void 0)return i;const[a="",...p]=t.split("-");return a==="zh"?p.includes("hant")||p.some(C=>C==="tw"||C==="hk"||C==="mo")?null:Gc("zh-CN"):Gc(a==="pt"?"pt-BR":a)}function Gc(n){return jm(n)?n:null}function Sg(n,t){if(n!=="auto")return n;for(const i of t){const a=bg(i);if(a!==null)return a}return"en"}function Cg(n,t){for(const i of t)if(bg(i)===n)try{if(Intl.DateTimeFormat.supportedLocalesOf([i]).length>0)return i}catch{}return Dw(n)}let ql=yg;const Su=new Set;function Wu(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function mS(){return Sg("auto",Wu())}async function xg(n){const t=Wu(),i=Sg(n,t);await Om(i,Cg(i,t))}async function gS(){ql=xt(wg,yg,pS);try{await xg(ql)}catch{await Om("en",Cg("en",Wu()))}document.documentElement.lang=vu(),Pm(()=>{document.documentElement.lang=vu()})}async function vS(n){await xg(n),ql=n,wt(wg,n);for(const t of Su)t()}function _S(n){return Su.add(n),()=>Su.delete(n)}function wS(){return ql}function mo(){return N.useSyncExternalStore(Pm,vu)}function yS(){return N.useSyncExternalStore(_S,wS)}const kg=String.raw`https?:\/\/[^\s<>"'\`]+`,bS=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${kg})`].join("|")),SS=/^(https?:|mailto:)/i,CS=new RegExp(kg);function xS(n){const t=CS.exec(n);if(t===null||t.index===void 0)return null;const i=Eg(t[0]);return{index:t.index,length:i.length,href:i}}function Nl(n,t){let i=0;for(const a of n)a===t&&(i+=1);return i}function Eg(n){let t=n;for(;;){const i=t.slice(-1);if(i.length===0)return t;if(".,;:!?".includes(i)){t=t.slice(0,-1);continue}if(i===")"&&Nl(t,"(")<Nl(t,")")){t=t.slice(0,-1);continue}if(i==="]"&&Nl(t,"[")<Nl(t,"]")){t=t.slice(0,-1);continue}return t}}function kS(n){const t=bS.exec(n);if(t===null||t.index===void 0)return null;const i=t[0],a=t.index,p=(C,r=i.length)=>({index:a,length:r,token:C});if(i.startsWith("`"))return p({kind:"code",text:i.slice(1,-1)});if(i.startsWith("**")||i.startsWith("__"))return p({kind:"strong",text:i.slice(2,-2)});if(i.startsWith("~~"))return p({kind:"del",text:i.slice(2,-2)});if(i.startsWith("*"))return p({kind:"em",text:i.slice(1,-1)});if(i.startsWith("[")){const C=i.indexOf("]("),r=i.slice(1,C),u=i.slice(C+2,-1);return SS.test(u)?p({kind:"link",label:r,href:u}):p({kind:"plain",text:i})}const k=Eg(i);return p({kind:"link",label:k,href:k},k.length)}function eo(n,t,i){if(t.length===0)return[n];const a=n.toLowerCase(),p=t.toLowerCase(),k=[];let C=0,r=a.indexOf(p),u=0;for(;r!==-1;)r>C&&k.push(n.slice(C,r)),k.push(l.jsx("mark",{children:n.slice(r,r+t.length)},`${i}-m${u++}`)),C=r+t.length,r=a.indexOf(p,C);return C<n.length&&k.push(n.slice(C)),k}const ES=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function LS(n,t){const i=ES.exec(n);if(i===null)return null;const a=i[2]??"",p=t(a);return p===null?null:{label:i[1]??"",href:a,open:p}}function bs(n,t,i,a){const p=[];let k=n,C=0;for(;k.length>0;){const r=kS(k);if(r===null){p.push(...eo(k,t,`${i}-${C++}`));break}r.index>0&&p.push(...eo(k.slice(0,r.index),t,`${i}-${C++}`));const u=`${i}-i${C++}`,{token:v}=r;switch(v.kind){case"code":{const _=a.code===void 0?null:a.code(v.text);p.push(_===null?l.jsx("code",{children:v.text},u):l.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:S("thread.openInFiles",{path:v.text}),onClick:_,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),_())},children:v.text},u));break}case"strong":p.push(l.jsx("strong",{children:bs(v.text,t,u,a)},u));break;case"del":p.push(l.jsx("del",{children:bs(v.text,t,u,a)},u));break;case"em":p.push(l.jsx("em",{children:bs(v.text,t,u,a)},u));break;case"link":p.push(l.jsx("a",{href:v.href,target:"_blank",rel:"noreferrer noopener",children:eo(v.label,t,u)},u));break;default:{const _=a.local===void 0?null:LS(v.text,a.local);if(_!==null){p.push(l.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:eo(_.label,t,u)},u));break}p.push(l.jsx("span",{children:eo(v.text,t,u)},u));break}}k=k.slice(r.index+r.length)}return p}function TS({code:n,language:t}){const[i,a]=N.useState(null),[p,k]=N.useState(!1),C=N.useRef(null);N.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]);const r=()=>{navigator.clipboard.writeText(n).then(()=>{k(!0),C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>k(!1),1200)}).catch(()=>k(!1))};return N.useEffect(()=>{let u=!0;return rs(async()=>{const{highlightCode:v}=await import("./highlight-DsNwA50i.js");return{highlightCode:v}},[]).then(({highlightCode:v})=>{u&&a(v(n,t))}).catch(()=>{u&&a(null)}),()=>{u=!1}},[n,t]),l.jsxs("div",{className:"md-code-wrap",children:[l.jsx("pre",{className:"md-code hljs",children:i===null?l.jsx("code",{children:n}):l.jsx("code",{dangerouslySetInnerHTML:{__html:i}})}),l.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[t!==null&&l.jsx("span",{className:"md-code-lang",children:t}),l.jsx("button",{className:"md-code-copy",onClick:r,title:S(p?"common.copied":"common.copyCode"),"aria-label":S("common.copyCode"),children:p?"✓":"⧉"})]})]})}const lp=/^(#{1,6})\s+(.*)$/,Yc=/^\s{0,3}[-*+]\s+(.*)$/,to=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Dl=/^>\s?(.*)$/,Xc=/^\s*```(\S*)\s*$/,ap=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Qc=/^\s*\|.*\|\s*$/,RS=/^\s*\|[\s:|-]+\|\s*$/;function cp(n){return n.trim().replace(/^\||\|$/g,"").split("|").map(t=>t.trim())}function zu({text:n,needle:t="",localLink:i,codeLink:a}){var u,v;const p={local:i,code:a},k=n.split(`
|
|
125
|
+
`),C=[];let r=0;for(;r<k.length;){const _=k[r]??"",h=`b${r}`,w=Xc.exec(_);if(w!==null){const g=(w[1]??"").length>0?w[1]:null,c=[];for(r+=1;r<k.length&&!Xc.test(k[r]??"");)c.push(k[r]??""),r+=1;r+=1,C.push({key:h,node:l.jsx(TS,{code:c.join(`
|
|
126
|
+
`),language:g},h)});continue}if(_.trim().length===0){r+=1;continue}if(ap.test(_)){C.push({key:h,node:l.jsx("hr",{className:"md-rule"},h)}),r+=1;continue}const E=lp.exec(_);if(E!==null){const g=Math.min((E[1]??"#").length,6);C.push({key:h,node:l.jsx("p",{className:`md-heading md-h${g}`,children:bs(E[2]??"",t,h,p)},h)}),r+=1;continue}if(Qc.test(_)&&RS.test(k[r+1]??"")){const g=cp(_);r+=2;const c=[];for(;r<k.length&&Qc.test(k[r]??"");)c.push(cp(k[r]??"")),r+=1;C.push({key:h,node:l.jsx("div",{className:"md-table-wrap",children:l.jsxs("table",{className:"md-table",children:[l.jsx("thead",{children:l.jsx("tr",{children:g.map((f,m)=>l.jsx("th",{children:bs(f,t,`${h}-h${m}`,p)},m))})}),l.jsx("tbody",{children:c.map((f,m)=>l.jsx("tr",{children:f.map((d,L)=>l.jsx("td",{children:bs(d,t,`${h}-${m}-${L}`,p)},L))},m))})]})},h)});continue}if(Dl.test(_)){const g=[];for(;r<k.length&&Dl.test(k[r]??"");)g.push(((u=Dl.exec(k[r]??""))==null?void 0:u[1])??""),r+=1;C.push({key:h,node:l.jsx("blockquote",{className:"md-quote",children:bs(g.join(`
|
|
127
|
+
`),t,h,p)},h)});continue}if(Yc.test(_)||to.test(_)){const g=to.test(_),c=g?Number(((v=to.exec(_))==null?void 0:v[1])??"1"):1,f=[];for(;r<k.length;){const d=k[r]??"",L=Yc.exec(d),I=to.exec(d);if(g&&I!==null)f.push(I[2]??"");else if(!g&&L!==null)f.push(L[1]??"");else if(f.length>0&&/^\s{2,}\S/.test(d)&&L===null&&I===null)f[f.length-1]=`${f[f.length-1]??""} ${d.trim()}`;else break;r+=1}const m=f.map((d,L)=>l.jsx("li",{children:bs(d,t,`${h}-l${L}`,p)},L));C.push({key:h,node:g?l.jsx("ol",{className:"md-list",start:c===1?void 0:c,children:m},h):l.jsx("ul",{className:"md-list",children:m},h)});continue}const R=[];for(;r<k.length;){const g=k[r]??"";if(g.trim().length===0||Xc.test(g)||lp.test(g)||Yc.test(g)||to.test(g)||Dl.test(g)||ap.test(g)||Qc.test(g))break;R.push(g),r+=1}C.push({key:h,node:l.jsx("p",{className:"md-paragraph",children:bs(R.join(`
|
|
128
|
+
`),t,h,p)},h)})}return l.jsx("div",{className:"md",children:C.map(_=>_.node)})}const Lg=[{key:"shell",names:["Bash","PowerShell","BashOutput","KillShell","shell_command","bash"],run:"tools.run.shell"},{key:"read",names:["Read","NotebookRead","read"],run:"tools.run.read"},{key:"find",names:["Glob","Grep","LS","grep","glob","list"],run:"tools.run.find"},{key:"edit",names:["Edit","Write","NotebookEdit","MultiEdit","apply_patch","edit","write"],run:"tools.run.edit"},{key:"web",names:["WebSearch","WebFetch","ToolSearch","webfetch","websearch","codesearch"],run:"tools.run.web"},{key:"agent",names:["Task","Agent","task"],run:"tools.run.agent"},{key:"todo",names:["TodoWrite","update_plan","todowrite","todoread"],run:"tools.run.todo"}];function Jc(n){const t=Lg.find(i=>i.names.includes(n));return t===void 0?{key:`name:${n}`,known:!1}:{key:t.key,known:!0}}function MS(n,t,i){const a=Lg.find(p=>p.key===n);return a===void 0?S("tools.run.callsTo",{count:t,name:i}):S(a.run,{count:t})}function Dt(n){if(!x_(n.key))return n.key;let t;if(n.params!==void 0){const i={};for(const[a,p]of Object.entries(n.params))i[a]=typeof p=="object"?Dt(p):p;t=i}return S(`server.${n.key}`,t)}const Zc={model:null,effort:null,contextWindow:null},AS=200,NS=2e4,DS={},IS={},up=[],hp=[],jS=15e3;function Cu(n,t,i){return`${n}:${i}:${t}`}function PS(n,t){const[i,a]=N.useState([]),[p,k]=N.useState(jc),[C,r]=N.useState(Zc),[u,v]=N.useState("waiting"),[_,h]=N.useState(!1),[w,E]=N.useState(!1),[R,g]=N.useState({}),[c,f]=N.useState(null),[m,d]=N.useState(null),[L,I]=N.useState(!1),[x,M]=N.useState(up),[b,T]=N.useState(hp),[D,B]=N.useState(!1),O=N.useRef(null),F=N.useRef(null),U=N.useCallback(()=>{O.current=null,F.current!==null&&window.clearTimeout(F.current),F.current=null,B(!1)},[]),[q,G]=N.useState({}),[Y,W]=N.useState({}),j=(t===null?void 0:q[t])??DS,$=(t===null?void 0:Y[t])??IS,H=N.useRef(new Set),V=N.useRef(new Map),te=N.useRef(new Set),ie=N.useCallback((ye,Ee,fe)=>{W(Ae=>({...Ae,[ye]:{...Ae[ye]??{},[Ee]:fe}}))},[]),pe=N.useCallback(ye=>{W(Ee=>{let fe=!1;const Ae={};for(const[ne,Ie]of Object.entries(Ee))if(ye in Ie){const oe={...Ie};delete oe[ye],Ae[ne]=oe,fe=!0}else Ae[ne]=Ie;return fe?Ae:Ee})},[]),me=N.useCallback((ye,Ee)=>{W(fe=>{const Ae=fe[ye];if(Ae===void 0||!(Ee in Ae))return fe;const ne={...Ae};return delete ne[Ee],{...fe,[ye]:ne}})},[]);N.useEffect(()=>{for(const ye of i)for(const Ee of ye.parts){if(Ee.kind!=="tool-result")continue;te.current.add(Ee.toolUseId);const fe=V.current.get(Ee.toolUseId);fe!==void 0&&(window.clearTimeout(fe),V.current.delete(Ee.toolUseId)),pe(Ee.toolUseId)}},[i,pe]),N.useEffect(()=>{const ye=V.current;return()=>{for(const Ee of ye.values())window.clearTimeout(Ee);ye.clear()}},[]);const X=N.useRef(null);N.useEffect(()=>{if(t===null){a([]),k(jc),r(Zc),v("waiting"),h(!1),X.current=null;return}a([]),k(jc),r(Zc),v("waiting"),h(!1),E(!1),g({}),f(null),d(null),I(!1),M(up),T(hp),U(),H.current.clear(),X.current=null;const ye=n.onMessage(fe=>{var Ae;switch(fe.type){case"conversation.reset":if(fe.terminalId!==t)break;a(fe.events),k(fe.usage),r(fe.defaults),f(fe.permissionMode),d(fe.waitingFor),I(fe.openToolCall),M(fe.subagents),T(fe.queue),v(fe.state),h(fe.hasMore),E(!1),X.current=((Ae=fe.events[0])==null?void 0:Ae.eventId)??null;break;case"conversation.append":{if(fe.terminalId!==t)break;a(ne=>{var ue;const Ie=new Set(ne.map(de=>de.eventId)),oe=fe.events.filter(de=>!Ie.has(de.eventId));return oe.length===0?ne:(X.current===null&&(X.current=((ue=oe[0])==null?void 0:ue.eventId)??null),[...ne,...oe])}),k(fe.usage),fe.permissionMode!==null&&f(fe.permissionMode),fe.queue!==void 0&&T(fe.queue),v("live");break}case"conversation.page":{if(fe.terminalId!==t)break;a(ne=>{var ue;const Ie=new Set(ne.map(de=>de.eventId)),oe=fe.events.filter(de=>!Ie.has(de.eventId));return oe.length===0?ne:(X.current=((ue=oe[0])==null?void 0:ue.eventId)??X.current,[...oe,...ne])}),h(fe.hasMore),E(!1);break}case"conversation.turns":{if(fe.terminalId!==t)break;const ne=new Map(fe.turns.map(Ie=>[Ie.eventId,Ie.durationMs]));a(Ie=>Ie.map(oe=>{const ue=ne.get(oe.eventId);return ue===void 0?oe:{...oe,durationMs:ue}}));break}case"conversation.parts":{if(fe.terminalId!==t)break;const ne=new Map(fe.updates.map(Ie=>[Ie.eventId,Ie.parts]));a(Ie=>Ie.map(oe=>{const ue=ne.get(oe.eventId);return ue===void 0?oe:{...oe,parts:ue}}));break}case"conversation.imageData":{if(fe.terminalId!==t)break;const ne=Cu(fe.eventId,fe.index,fe.source);g(Ie=>({...Ie,[ne]:fe.data===null?null:`data:${fe.mediaType};base64,${fe.data}`}));break}case"conversation.state":if(fe.terminalId!==t)break;v(fe.state);break;case"conversation.mode":if(fe.terminalId!==t)break;f(fe.mode);break;case"conversation.waiting":if(fe.terminalId!==t)break;d(fe.waitingFor);break;case"conversation.toolCall":if(fe.terminalId!==t)break;I(fe.open);break;case"conversation.subagents":if(fe.terminalId!==t)break;M(fe.subagents);break;case"conversation.queue":if(fe.terminalId!==t)break;T(fe.queue);break;case"agent.forceSent":fe.requestId===O.current&&!fe.sent&&U();break;case"error":{if(fe.requestId!==void 0&&fe.requestId===O.current){U();break}if(fe.code!=="answer-failed"||t===null)break;for(const[ne,Ie]of V.current)window.clearTimeout(Ie),V.current.delete(ne),G(oe=>{const ue=oe[t];if(ue===void 0||!(ne in ue))return oe;const de={...ue};return delete de[ne],{...oe,[t]:de}}),ie(t,ne,Dt(fe.text));break}}});n.send({type:"conversation.subscribe",terminalId:t});const Ee=n.onReopen(()=>{n.send({type:"conversation.subscribe",terminalId:t})});return()=>{ye(),Ee(),n.send({type:"conversation.unsubscribe",terminalId:t})}},[n,t,ie,U]),N.useEffect(()=>{D&&b.every(ye=>ye.forced===!0)&&U()},[D,b,U]),N.useEffect(()=>()=>{F.current!==null&&window.clearTimeout(F.current)},[]);const K=N.useCallback(()=>{if(t===null||O.current!==null)return;const ye=crypto.randomUUID();O.current=ye,B(!0),F.current!==null&&window.clearTimeout(F.current),F.current=window.setTimeout(U,jS),n.send({type:"agent.forceSend",terminalId:t,requestId:ye})},[n,t,U]),J=N.useCallback(()=>{const ye=X.current;t===null||ye===null||w||(E(!0),n.send({type:"conversation.loadMore",terminalId:t,beforeEventId:ye,limit:AS}))},[n,t,w]),Z=N.useCallback((ye,Ee,fe)=>{if(t===null)return;const Ae=Cu(ye,Ee,fe);H.current.has(Ae)||(H.current.add(Ae),n.send({type:"conversation.image",terminalId:t,eventId:ye,index:Ee,source:fe}))},[n,t]),_e=N.useCallback((ye,Ee)=>{if(t===null)return;G(Ae=>{const ne=Ae[t]??{};return ye in ne?Ae:{...Ae,[t]:{...ne,[ye]:Ee}}}),me(t,ye),n.send({type:"agent.answer",terminalId:t,toolUseId:ye,selections:Ee});const fe=window.setTimeout(()=>{te.current.has(ye)||(G(Ae=>{const ne=Ae[t];if(ne===void 0||!(ye in ne))return Ae;const Ie={...ne};return delete Ie[ye],{...Ae,[t]:Ie}}),ie(t,ye,S("conversation.answerUnconfirmed")))},NS);V.current.set(ye,fe)},[n,t,ie,me]),ve=N.useCallback(ye=>{t!==null&&n.send({type:"agent.mode",terminalId:t,mode:ye})},[n,t]);return{events:i,usage:p,defaults:C,state:u,permissionMode:c,waitingFor:m,openToolCall:L,subagents:x,queue:b,forceSend:K,forcing:D,hasMore:_,loadingMore:w,loadMore:J,images:R,requestImage:Z,answer:_e,answered:j,answerFailed:$,setPermissionMode:ve}}function OS(n){return n.role!=="user"||n.parts.some(t=>t.kind==="tool-result"||t.kind==="notice")?!1:n.parts.some(t=>t.kind==="text"||t.kind==="image")}const BS=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function FS(n){try{const i=JSON.parse(n),a=i.file_path??i.notebook_path;if(typeof a=="string"&&a.length>0)return a}catch{}const t=/"(?:file_path|notebook_path)"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(n);if(t===null||t[1]===void 0)return null;try{return JSON.parse(`"${t[1]}"`)}catch{return null}}function HS(n,t){const i=k=>k.replace(/\\/g,"/").replace(/\/+$/,""),a=i(n),p=i(t);return a.length>0&&p.toLowerCase().startsWith(`${a.toLowerCase()}/`)?t.slice(a.length+1):t}function $S(n,t,i){const a=n.findIndex(k=>k.eventId===t);if(a===-1)return[];const p=[];for(const k of n.slice(a))for(const C of k.parts){if(C.kind!=="tool-call"||!BS.has(C.name))continue;const r=FS(C.input);if(r===null)continue;const u=HS(i,r);p.includes(u)||p.push(u)}return p}function US(n,t=6,i=400){if(n===void 0)return"";const a=n.parts.flatMap(C=>C.kind==="text"?[C.text]:[]).join(`
|
|
129
|
+
`).trim();let k=a.split(`
|
|
130
|
+
`).slice(0,t).join(`
|
|
131
|
+
`);return k.length>i&&(k=k.slice(0,i)),k.length<a.length?`${k.trimEnd()}…`:k}const Tg=80;function eu(n){return n.scrollHeight-n.scrollTop-n.clientHeight>Tg}const dp=5;function Il(n){return!Array.isArray(n)}function fp(n){const t=[];for(const i of n.parts){if(i.kind!=="tool-call")return null;t.push(i.name)}return t.length>0?t:null}function WS(n){const t=[];let i=0;for(;i<n.length;){const a=n[i];if(a===void 0)break;const p=fp(a),k=p===null?null:Jc(p[0]??"");if(!(p!==null&&k!==null&&p.every(_=>Jc(_).key===k.key))||p===null||k===null){t.push({kind:"card",card:a}),i+=1;continue}const r=[a];let u=p.length,v=i+1;for(;v<n.length;){const _=n[v];if(_===void 0)break;const h=fp(_);if(h===null||!h.every(w=>Jc(w).key===k.key))break;r.push(_),u+=h.length,v+=1}if(u<2){t.push({kind:"card",card:a}),i+=1;continue}t.push({kind:"tools",id:`tools-${a.event.eventId}`,summary:MS(k.key,u,p[0]??""),at:a.event.at,cards:r}),i=v}return t}function zS(n){switch(n.kind){case"text":return n.text;case"tool-call":return`${n.name} ${n.input}`;case"tool-result":return n.text;case"question":return n.questions.map(t=>`${t.question} ${t.options.map(i=>i.label).join(" ")}`).join(`
|
|
132
|
+
`);case"notice":return _g(n);case"thinking":case"image":return""}}function pp(n,t){const i=[];for(const a of n.parts)if(i.push(zS(a)),a.kind==="tool-call"){const p=t.get(a.toolUseId);p!==void 0&&i.push(p.text)}return i.join(`
|
|
133
|
+
`)}function Qs(n,t){if(t.length===0)return l.jsx(l.Fragment,{children:n});const i=n.toLowerCase(),a=t.toLowerCase(),p=[];let k=0,C=i.indexOf(a),r=0;for(;C!==-1;)C>k&&p.push(l.jsx("span",{children:n.slice(k,C)},r++)),p.push(l.jsx("mark",{children:n.slice(C,C+t.length)},r++)),k=C+t.length,C=i.indexOf(a,k);return k<n.length&&p.push(l.jsx("span",{children:n.slice(k)},r++)),l.jsx(l.Fragment,{children:p})}function Rg(n,t){const i=[];let a=n,p=0;for(;a.length>0;){const k=xS(a);if(k===null){i.push(l.jsx("span",{children:Qs(a,t)},p++));break}k.index>0&&i.push(l.jsx("span",{children:Qs(a.slice(0,k.index),t)},p++)),i.push(l.jsx("a",{href:k.href,target:"_blank",rel:"noreferrer noopener",children:Qs(k.href,t)},p++)),a=a.slice(k.index+k.length)}return l.jsx(l.Fragment,{children:i})}const Mg=N.createContext(null);function qS({view:n,terminalId:t,onRewind:i,rewindBlocked:a=!1,questionsAnswerable:p,contextWindowSource:k,instructionsFile:C,onGoToCli:r,cliPresence:u,exitCode:v,onWakeCli:_,waking:h,discovering:w=!1,toolCallNotice:E=null,serverClosed:R=null,statusLineState:g=null,onConfigureStatusLine:c,threadFont:f,continueTargets:m=[],continueBlockedReason:d=null,onContinue:L,searchRequest:I=null,onSearchRequestApplied:x,activity:M=null,receipt:b=null,clock:T=null,fileLinks:D=null,forceSendAvailable:B=!1}){const{events:O,usage:F,defaults:U,state:q,waitingFor:G,subagents:Y,queue:W,forceSend:j,forcing:$,hasMore:H,loadingMore:V,loadMore:te,images:ie,requestImage:pe,answer:me,answered:X,answerFailed:K}=n,J=mo(),[Z,_e]=N.useState(""),[ve,ye]=N.useState(0),[Ee,fe]=N.useState(null);N.useEffect(()=>{I!==null&&(_e(I.query),x==null||x(I.seq))},[I,x]);const Ae=N.useRef(null),ne=N.useRef(new Map),Ie=N.useRef(!0),[oe,ue]=N.useState(!1),[de,Me]=N.useState(0),Re=N.useRef(t),Ke=N.useRef(new Map),Ue=N.useRef(null),[st,Tt]=N.useState(!1),lt=N.useRef(null),[yt,ct]=N.useState(!1),[We,Ge]=N.useState(!1),bt=N.useRef(null),it=N.useMemo(()=>new Set(W.flatMap(ge=>ge.eventId===void 0?[]:[ge.eventId])),[W]),Wt=N.useMemo(()=>it.size===0?O:O.filter(ge=>!it.has(ge.eventId)),[O,it]),Pt=N.useMemo(()=>rS(Wt),[Wt]),{cards:he,results:Oe}=N.useMemo(()=>{const ge=new Map,je=new Set;for(const St of Wt)for(const dt of St.parts)dt.kind==="tool-result"?ge.set(dt.toolUseId,dt):(dt.kind==="tool-call"||dt.kind==="question")&&je.add(dt.toolUseId);const Je=[];for(const St of Wt){const dt=St.parts.filter(ft=>ft.kind!=="thinking"&&!(ft.kind==="tool-result"&&je.has(ft.toolUseId)));dt.length!==0&&Je.push({event:St,parts:dt})}return{cards:Je,results:ge}},[Wt]),Qe=N.useRef([]);Qe.current=N.useMemo(()=>he.map(ge=>ge.event.eventId),[he]);const Ot=N.useCallback(ge=>{const je=ge.getBoundingClientRect().top;return Je=>{const St=ne.current.get(Je);if(St===void 0)return null;const dt=St.getBoundingClientRect();return dt.height<=0?null:{top:dt.top-je,bottom:dt.bottom-je}}},[]),ze=N.useMemo(()=>WS(he),[he,J]),xe=Z.trim(),He=N.useMemo(()=>{if(xe.length===0)return[];const ge=xe.toLowerCase();return he.filter(je=>pp(je,Oe).toLowerCase().includes(ge)).map(je=>je.event.eventId)},[he,Oe,xe,J]);N.useEffect(()=>{ye(0)},[xe]);const ut=N.useMemo(()=>new Set(He),[He]),be=He[ve]??null;N.useEffect(()=>{var ge;be!==null&&((ge=ne.current.get(be))==null||ge.scrollIntoView({block:"center"}))},[be]),N.useLayoutEffect(()=>{const ge=Re.current;Re.current=t;const je=Ae.current;if(ge!==null&&ge!==t&&Ue.current===null){const Je=je===null||Ie.current?null:cS(Qe.current,Ot(je));Je===null?Ke.current.delete(ge):Ke.current.set(ge,Je)}Ue.current=t===null?null:Ke.current.get(t)??null,Ie.current=!0,ue(!1),Me(0),bt.current=null,Ge(!1),ct(!1),Tt(!1)},[t,Ot]),N.useEffect(()=>()=>{lt.current!==null&&window.clearTimeout(lt.current)},[]);const rt=N.useCallback(()=>{const ge=Ae.current;if(ge===null)return;const je=eu(ge);ue(je),je||Me(0)},[]),_t=N.useCallback(ge=>{const je=ge.getBoundingClientRect().top,Je=dt=>{const ft=Pt[dt],as=ft===void 0?void 0:ne.current.get(ft);return as===void 0?null:as.getBoundingClientRect().top-je},St=iS(Pt.length,Je);return St===null?null:Je(St)},[Pt]),ht=N.useCallback(()=>{const ge=Ae.current;ge!==null&&ct(oS({awayFromEnd:eu(ge),ownAbove:_t(ge)!==null,hasMore:H}))},[_t,H]),nt=N.useRef(null),gt=N.useRef(0),Mt=N.useRef(0);N.useLayoutEffect(()=>{const ge=nt.current,je=O.map(St=>St.eventId);nt.current=je[0]??null;const Je=Ae.current;Je===null||!tS(ge,je)||(Je.scrollTop=eS(gt.current,Je.scrollHeight))},[O]),N.useLayoutEffect(()=>{const ge=Ae.current,je=Ue.current;if(ge!==null&&je!==null&&he.length>0){Ue.current=null;const Je=Qe.current,St=xe.length>0?null:uS(je,Je,Ot(ge),ge.scrollTop);St!==null&&(ge.scrollTop=St,Ie.current=!eu(ge),Ie.current||(Me(hS(Je,je.lastId)),Tt(!0),lt.current!==null&&window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>{lt.current=null,Tt(!1)},pg)))}ge!==null&&Ie.current&&xe.length===0&&(ge.scrollTop=ge.scrollHeight),rt()},[he.length,W.length,xe,rt,Ot]),N.useLayoutEffect(()=>{const ge=bt.current,je=Ae.current;if(ge===null||je===null)return;const Je=_t(je),St=lS({found:Je!==null,hasMore:H,loading:V,pagesRequested:ge.pages});if(St!=="wait"){if(St==="load"){ge.pages+=1,te();return}bt.current=null,Ge(!1),Je!==null&&(Ie.current=!1,je.scrollTop=ip(je.scrollTop,Je))}},[he,H,V,We,_t,te]),N.useLayoutEffect(()=>{ht()},[he,ht]);const Ft=N.useRef(null),Ss=N.useRef(null),Mn=N.useRef(new Map),qn=N.useCallback(()=>{const ge=new Map;for(const je of[Ft.current,Ss.current]){if(je===null)continue;const Je=je.getBoundingClientRect();for(const St of[Je.top+1,(Je.top+Je.bottom)/2,Je.bottom-1]){const dt=document.elementsFromPoint(Je.left+1,St).map(cs=>cs.closest(".turn")).find(cs=>cs!==null),ft=(dt==null?void 0:dt.querySelector(":scope > .turn-actions"))??null;if(dt==null||ft===null)continue;const as=fS(dt.getBoundingClientRect(),ft.getBoundingClientRect(),Je);as>0&&ge.set(dt,Math.max(ge.get(dt)??0,as))}}for(const je of Mn.current.keys())ge.has(je)||je.style.removeProperty("--turn-actions-shift");for(const[je,Je]of ge)Mn.current.get(je)!==Je&&je.style.setProperty("--turn-actions-shift",`${Je}px`);Mn.current=ge},[]);N.useLayoutEffect(()=>{const ge=Ae.current;ge!==null&&(gt.current=ge.scrollHeight-ge.scrollTop,Mt.current=ge.scrollTop,qn())});const cn=N.useRef(null),Vn=N.useCallback(()=>{var je;const ge=((je=O[0])==null?void 0:je.eventId)??null;ge===null||cn.current===ge||(cn.current=ge,te())},[O,te]),_r=N.useRef(null);N.useEffect(()=>{var St;const ge=((St=he[he.length-1])==null?void 0:St.event.eventId)??null,je=_r.current;if(_r.current=ge,je===null||ge===je||Ie.current&&xe.length===0)return;const Je=he.findIndex(dt=>dt.event.eventId===je);Je!==-1&&Me(dt=>dt+(he.length-1-Je))},[he,xe]);const ci=N.useCallback(()=>{const ge=Ae.current;if(ge===null)return;const je=ge.scrollHeight-ge.scrollTop-ge.clientHeight;Ie.current=je<=Tg,rt(),ht(),qn();const Je=Jb({scrollTop:ge.scrollTop,previousScrollTop:Mt.current,clientHeight:ge.clientHeight,hasMore:H,loading:V,searching:xe.length>0});Mt.current=ge.scrollTop,gt.current=ge.scrollHeight-ge.scrollTop,Je&&Vn()},[rt,ht,qn,H,V,Vn,xe]),wr=N.useCallback(ge=>{const je=Ae.current;je===null||!H||V||xe.length>0||Zb(ge.deltaY,je.scrollTop,je.clientHeight)&&Vn()},[H,V,Vn,xe]),An=N.useCallback(()=>{const ge=Ae.current;ge!==null&&(ge.scrollTop=ge.scrollHeight,Ie.current=!0,ue(!1),Me(0),bt.current=null,Ge(!1),ct(!1))},[]),Js=N.useCallback(()=>{const ge=Ae.current;if(ge===null)return;const je=_t(ge);if(je!==null){Ie.current=!1,ge.scrollTop=ip(ge.scrollTop,je);return}bt.current===null&&(bt.current={pages:0},Ge(!0))},[_t]),Cs=N.useCallback((ge,je)=>{je===null?ne.current.delete(ge):ne.current.set(ge,je)},[]),xs=N.useCallback(ge=>{const je=pp(ge,Oe);navigator.clipboard.writeText(je).then(()=>{fe(ge.event.eventId),window.setTimeout(()=>fe(null),1200)}).catch(()=>fe(null))},[Oe,J]),ks=ge=>{He.length!==0&&ye(je=>(je+ge+He.length)%He.length)};return l.jsx(Mg.Provider,{value:D,children:l.jsxs("div",{className:"conversation-pane",children:[l.jsxs("div",{className:"conversation-search",children:[l.jsx("input",{className:"conversation-search-input",type:"search",placeholder:S("thread.search.placeholder"),value:Z,onChange:ge=>_e(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"&&ks(ge.shiftKey?-1:1),ge.stopPropagation()},spellCheck:!1}),xe.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:He.length===0?S("thread.search.none"):`${ve+1}/${He.length}`}),l.jsx("button",{className:"icon-button",onClick:()=>ks(-1),disabled:He.length===0,title:S("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>ks(1),disabled:He.length===0,title:S("thread.search.next"),children:"↓"})]}),l.jsx("span",{className:"conversation-spacer"}),L!==void 0&&l.jsx(vg,{targets:m,className:"icon-button conversation-continue",text:S("thread.continueWith"),blockedReason:d,onPick:L}),f!==void 0&&l.jsx("button",{className:"icon-button thread-font-button",onClick:f.cycle,title:zl(f.size),"aria-label":zl(f.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),l.jsx($b,{usage:F,source:k,instructionsFile:C,fallbackWindow:U.contextWindow,compact:!0,statusLineState:g,onConfigure:c})]}),l.jsxs("div",{className:"conversation-scroll-frame",children:[l.jsxs("div",{className:"conversation-scroll",ref:Ae,onScroll:ci,onWheel:wr,children:[H&&l.jsxs("button",{className:`conversation-more${V?" conversation-more-loading":""}`,onClick:te,disabled:V,"aria-busy":V,children:[V&&l.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),S(V?"thread.loadingMore":"thread.loadEarlier")]}),he.length===0&&l.jsxs("p",{className:"conversation-empty",children:[q==="unavailable"?S("thread.empty.unavailable"):q==="no-transcript"?jy():S(q==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),q==="waiting"&&w&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),Py()]})]}),ze.map(ge=>{if(ge.kind==="card")return l.jsx(mp,{card:ge.card,results:Oe,needle:xe,isMatch:ge.card.event.eventId===be,copied:Ee===ge.card.event.eventId,images:ie,onRequestImage:pe,onCopy:()=>xs(ge.card),onRewind:i,rewindBlocked:a,register:Cs,answered:X,answerFailed:K,answerable:p,onAnswer:me},ge.card.event.eventId);const je=ge.cards.some(Je=>ut.has(Je.event.eventId));return l.jsx(eC,{summary:ge.summary,at:ge.at,open:je,children:ge.cards.map(Je=>l.jsx(mp,{card:Je,results:Oe,needle:xe,isMatch:Je.event.eventId===be,copied:Ee===Je.event.eventId,images:ie,onRequestImage:pe,onCopy:()=>xs(Je),onRewind:i,rewindBlocked:a,register:Cs,answered:X,answerFailed:K,answerable:p,onAnswer:me},Je.event.eventId))},ge.id)}),u==="live"&&W.length>0&&l.jsx(ZS,{queue:W,canForce:B&&W.some(ge=>ge.forced!==!0),forceBlocked:G!==null,forcing:$,onForce:j})]}),oe&&(yt||We)&&l.jsx("button",{ref:Ft,className:`conversation-jump conversation-jump-own${We?" is-seeking":""}`,onClick:Js,disabled:We,"aria-busy":We,title:S("thread.jumpToOwn"),"aria-label":S("thread.jumpToOwn"),children:l.jsx("span",{"aria-hidden":"true",children:"↑"})}),oe&&l.jsxs("button",{ref:Ss,className:`conversation-jump${de>0?" has-unseen":""}${st?" is-hinting":""}`,onClick:An,title:de>0?S("thread.jumpToEndNew",{count:de}):S("thread.jumpToEnd"),"aria-label":de>0?S("thread.jumpToEndNew",{count:de}):S("thread.jumpToEnd"),children:[l.jsx("span",{"aria-hidden":"true",children:"↓"}),de>0&&l.jsx("span",{className:"conversation-jump-count",children:de>99?"99+":de}),st&&l.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:de>0?S("thread.jumpToEndNew",{count:de}):S("thread.jumpToEnd")})]})]}),l.jsx(KS,{live:u==="live"&&R===null,activity:M,waitingFor:G,receipt:b,events:O,clock:T,subagents:Y}),R!==null&&(R.state==="relaunching"||u==="live")?l.jsx(XS,{text:R.text,relaunching:R.state==="relaunching",onRelaunch:_}):u==="live"?G===null&&E!==null?l.jsx(JS,{notice:E,onGoToCli:r}):l.jsx(QS,{waitingFor:G,questionsAnswerable:p,onGoToCli:r}):l.jsx(YS,{presence:u,exitCode:v,waking:h,onWake:_})]})})}const VS=1e3;function KS({live:n,activity:t,waitingFor:i,receipt:a,events:p,clock:k,subagents:C}){const[,r]=N.useState(0),u=Date.now(),v=Q1({live:n,activity:t,waitingFor:i,receipt:a,events:p,clock:k,now:u}),_=n?C:[],h=v!==null||_.length>0;return N.useEffect(()=>{if(!h)return;const w=window.setInterval(()=>r(E=>E+1),VS);return()=>window.clearInterval(w)},[h]),h?l.jsxs("div",{className:"thread-status",children:[v!==null&&l.jsxs("div",{className:`thread-status-row thread-status-${v.kind}`,children:[l.jsx(GS,{kind:v.kind}),l.jsx("span",{className:"thread-status-text",children:J1(v,u)})]}),_.length>0&&l.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[l.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}),l.jsx("span",{className:"thread-status-text",children:Z1(_,u)})]})]}):null}function GS({kind:n}){return n==="working"?l.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):n==="sending"?l.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):l.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function YS({presence:n,exitCode:t,waking:i,onWake:a}){const p=n==="sleeping"?S("thread.wake.sleeping"):t===null?S("thread.wake.exited"):S("thread.wake.exitedWithCode",{code:t});return l.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[l.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),l.jsx("span",{children:p}),l.jsx("button",{className:"primary-button primary-button-small",onClick:a,disabled:i,children:S(i?"thread.wake.opening":"thread.wake.open")})]})}function XS({text:n,relaunching:t,onRelaunch:i}){return l.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[l.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),l.jsx("span",{children:n}),l.jsx("button",{className:"primary-button primary-button-small",onClick:i,disabled:t,children:t?$y():Hy()})]})}function QS({waitingFor:n,questionsAnswerable:t,onGoToCli:i}){if(n===null)return null;const a=Vm(n,t);return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:a}),l.jsx("button",{className:"link-button",onClick:i,children:S("thread.goToCli")})]})}function JS({notice:n,onGoToCli:t}){return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:n}),l.jsx("button",{className:"link-button",onClick:t,children:S("thread.goToCli")})]})}function mp({card:n,results:t,needle:i,isMatch:a,copied:p,images:k,onRequestImage:C,onCopy:r,onRewind:u,rewindBlocked:v=!1,register:_,answered:h,answerFailed:w,answerable:E,onAnswer:R}){const{event:g}=n,c=g.role==="user",f=m=>{const d=h[m.toolUseId];return d!==void 0?d:t.has(m.toolUseId)?[]:null};return l.jsxs("article",{ref:m=>_(g.eventId,m),className:`turn turn-${g.role}${a?" turn-match":""}`,children:[l.jsxs("div",{className:"turn-actions",children:[l.jsx("button",{className:"icon-button",onClick:r,title:S("thread.copyMessage"),children:p?"✓":"⧉"}),c&&u!==void 0&&OS(g)&&l.jsx("button",{className:"icon-button",onClick:()=>u(g.eventId),disabled:v,title:S(v?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),n.parts.map((m,d)=>l.jsx(nC,{part:m,eventId:g.eventId,mine:c,result:m.kind==="tool-call"?t.get(m.toolUseId)??null:null,needle:i,images:k,onRequestImage:C,answeredAt:m.kind==="question"?f(m):null,failure:m.kind==="question"?w[m.toolUseId]??null:null,answerable:E,onAnswer:R},d)),l.jsx(tC,{event:g,mine:c})]})}function ZS({queue:n,canForce:t,forceBlocked:i,forcing:a,onForce:p}){return l.jsxs("div",{className:"queued-prompts",children:[n.map(k=>l.jsxs("article",{className:`turn turn-user turn-pending${k.forced===!0?" turn-pending-forced":""}`,children:[k.text.length>0&&l.jsx(Ag,{text:k.text,truncated:k.truncated,needle:""}),k.images>0&&l.jsx("div",{className:"turn-pending-images",children:S("thread.queue.images",{count:k.images})}),l.jsxs("div",{className:"turn-meta",children:[l.jsx("span",{className:"turn-who",children:S("thread.turn.you")}),k.at>0&&l.jsx("span",{children:$u(k.at)}),l.jsx("span",{className:"turn-pending-state",title:k.forced===!0?S("thread.queue.forcedTitle"):S("thread.queue.labelTitle"),children:k.forced===!0?S("thread.queue.forced"):S("thread.queue.label")})]})]},k.id)),t&&l.jsx("div",{className:"queued-prompts-actions",children:l.jsx("button",{className:"queued-force",onClick:p,disabled:a||i,"aria-busy":a,title:S(i?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:S(a?"thread.queue.forcing":"thread.queue.forceSend")})})]})}function eC({summary:n,at:t,open:i,children:a}){const p=t>0?$u(t):"";return l.jsxs("details",{className:"tool-group",open:i,children:[l.jsxs("summary",{className:"tool-group-summary",children:[l.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),l.jsx("span",{className:"tool-group-count",children:n}),p.length>0&&l.jsx("span",{className:"tool-group-time",children:p})]}),l.jsx("div",{className:"tool-group-body",children:a})]})}function tC({event:n,mine:t}){const i=n.at>0?$u(n.at):"",a=[];return n.durationMs!==null&&a.push(m1(n.durationMs)),n.effort!==null&&a.push(S("thread.turn.effort",{effort:n.effort})),l.jsxs("div",{className:"turn-meta",children:[t&&l.jsx("span",{className:"turn-who",children:S("thread.turn.you")}),i.length>0&&l.jsx("span",{children:i}),n.queued&&l.jsx("span",{className:"turn-queued",title:S("thread.turn.queuedTitle"),children:S("thread.turn.queued")}),a.map(p=>l.jsx("span",{className:"turn-meta-bit",children:p},p))]})}function nC({part:n,eventId:t,mine:i,result:a,needle:p,images:k,onRequestImage:C,answeredAt:r,failure:u,answerable:v,onAnswer:_}){const h=N.useContext(Mg);switch(n.kind){case"text":return i?l.jsx(Ag,{text:n.text,truncated:n.truncated,needle:p}):l.jsxs("div",{className:"part-text",children:[l.jsx(zu,{text:n.text,needle:p,codeLink:h==null?void 0:h.code,localLink:h==null?void 0:h.link}),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]});case"image":return l.jsx(iC,{eventId:t,index:n.index,source:n.source,src:k[Cu(t,n.index,n.source)],onRequest:C});case"thinking":return null;case"notice":return l.jsx("div",{className:`turn-notice turn-notice-${n.notice}`,children:Qs(_g(n),p)});case"question":return l.jsx(sC,{part:n,answeredAt:r,failure:u,answerable:v,onAnswer:_,needle:p});case"tool-call":{const w=p.length>0&&`${n.name} ${n.input} ${(a==null?void 0:a.text)??""}`.toLowerCase().includes(p.toLowerCase());return l.jsxs("details",{className:"tool",open:w,children:[l.jsxs("summary",{className:"tool-summary",children:[l.jsx("span",{className:"tool-name",children:n.name}),a!==null&&a.isError&&l.jsx("span",{className:"tool-error",children:S("thread.tool.error")}),a!==null&&a.imageCount>0&&l.jsx("span",{className:"tool-images",children:S("thread.tool.images",{count:a.imageCount})})]}),l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.input")}),l.jsxs("pre",{className:"tool-pre",children:[Qs(n.input,p),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]})]}),a!==null&&l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.result")}),l.jsxs("pre",{className:`tool-pre${a.isError?" tool-pre-error":""}`,children:[a.text.length>0?Qs(a.text,p):a.imageCount>0?S("thread.tool.imagesNotSent",{count:a.imageCount}):S("thread.tool.noOutput"),a.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]})]})]})}case"tool-result":return l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.orphanResult")}),l.jsx("pre",{className:`tool-pre${n.isError?" tool-pre-error":""}`,children:Qs(n.text,p)})]})}}function sC({part:n,answeredAt:t,failure:i,answerable:a,onAnswer:p,needle:k}){var I;const[C,r]=N.useState(()=>n.questions.map(()=>[])),[u,v]=N.useState(null),[_,h]=N.useState(""),w=t!==null,E=w||!a,R=t??C,g=n.questions.length===1&&((I=n.questions[0])==null?void 0:I.multiSelect)===!1,c=R.every(x=>Il(x)?x.text.trim().length>0:x.length>0),f=x=>x===void 0||Il(x)?[]:x,m=(x,M)=>{if(E)return;const b=n.questions[x];if(b!==void 0){if(g){p(n.toolUseId,[[M]]);return}v(T=>T===x?null:T),r(T=>T.map((D,B)=>{if(B!==x)return D;const O=f(D);return b.multiSelect?O.includes(M)?O.filter(F=>F!==M):[...O,M]:[M]}))}},d=x=>{const M=_.trim();if(M.length===0||E)return;const b={kind:"free",text:M};if(g){p(n.toolUseId,[b]);return}r(T=>T.map((D,B)=>B===x?b:D)),v(null),h("")},L=x=>{if(E)return;const M=R[x];h(M!==void 0&&Il(M)?M.text:""),v(x)};return l.jsxs("div",{className:`question${w?" question-done":""}`,children:[n.questions.map((x,M)=>{const b=R[M],T=b!==void 0&&Il(b)?b.text:null;return l.jsxs("div",{className:"question-item",children:[l.jsxs("div",{className:"question-head",children:[x.header.length>0&&l.jsx("span",{className:"question-header",children:x.header}),l.jsx("span",{className:"question-text",children:Qs(x.question,k)}),x.multiSelect&&l.jsx("span",{className:"question-hint",children:S("thread.question.multi")})]}),l.jsxs("div",{className:"question-options",children:[x.options.map((D,B)=>{const O=f(b).includes(B);return l.jsxs("button",{type:"button",className:`question-option${O?" question-option-picked":""}`,disabled:E,onClick:()=>m(M,B),children:[l.jsx("span",{className:"question-option-label",children:D.label}),D.description.length>0&&l.jsx("span",{className:"question-option-desc",children:D.description})]},B)}),u===M&&!E?l.jsxs("div",{className:"question-write",children:[l.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:S("thread.question.placeholder"),onChange:D=>h(D.target.value),onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),d(M)),D.key==="Escape"&&v(null),D.stopPropagation()}}),l.jsxs("div",{className:"question-write-actions",children:[l.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>d(M),children:S(g?"thread.question.send":"thread.question.useText")}),l.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>v(null),children:S("common.cancel")})]})]}):l.jsxs("button",{type:"button",className:`question-option question-option-write${T!==null?" question-option-picked":""}`,disabled:E,onClick:()=>L(M),children:[l.jsx("span",{className:"question-option-label",children:T!==null?T:S("thread.question.writeOther")}),T===null&&l.jsx("span",{className:"question-option-desc",children:S("thread.question.writeOtherHint")})]})]})]},M)}),l.jsxs("div",{className:"question-foot",children:[i!==null&&l.jsx("span",{className:"question-failed",children:i}),w?l.jsx("span",{className:"question-sent",children:S("thread.question.answered")}):a?l.jsxs(l.Fragment,{children:[!g&&l.jsx("button",{type:"button",className:"question-send",disabled:!c,onClick:()=>p(n.toolUseId,C),children:S("thread.question.sendAnswers")}),l.jsx("span",{className:"question-note",children:S(g?"thread.question.pickOne":"thread.question.pickEach")})]}):l.jsx("span",{className:"question-note",children:S("thread.question.answerInCli")})]})]})}function Ag({text:n,truncated:t,needle:i}){const a=l1(n,t),p=a.length===1?a[0]:void 0;if(p!==void 0&&p.kind==="text")return l.jsx(gp,{text:n,truncated:t,needle:i});const k=a.length-1;return l.jsx("div",{className:"part-own",children:a.map((C,r)=>C.kind==="text"?l.jsx(gp,{text:C.text,truncated:t&&r===k,needle:i},r):l.jsx(rC,{number:C.number,text:C.text,complete:C.complete,needle:i},r))})}function rC({number:n,text:t,complete:i,needle:a}){const[p,k]=N.useState(!1),C=a.length>0&&t.toLowerCase().includes(a.toLowerCase()),r=p||C;return l.jsxs("div",{className:`thread-pasted${r?" thread-pasted-open":""}`,children:[l.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>k(u=>!u),"aria-expanded":r,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),S("thread.pasted",{number:n,count:Ul(t)}),!i&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]}),l.jsx("span",{className:"chip-chevron",children:r?"▾":"▸"})]}),r&&l.jsx("div",{className:"thread-pasted-text part-mine",children:Rg(t,a)})]})}function gp({text:n,truncated:t,needle:i}){const[a,p]=N.useState(!1),k=n.split(`
|
|
134
|
+
`),C=i.length>0&&n.toLowerCase().includes(i.toLowerCase()),r=k.length>=dp&&!C,u=r&&!a?k.slice(0,dp-1).join(`
|
|
135
|
+
`):n;return l.jsxs("div",{className:"part-text part-mine",children:[Rg(u,i),t&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]}),r&&l.jsx("button",{className:"fold-toggle",onClick:()=>p(v=>!v),children:a?S("thread.fold.less"):S("thread.fold.more",{count:k.length})})]})}function iC({eventId:n,index:t,source:i,src:a,onRequest:p}){const[k,C]=N.useState(!1);return N.useEffect(()=>{a===void 0&&p(n,t,i)},[a,n,t,i,p]),a===void 0?l.jsx("div",{className:"conversation-image-placeholder",children:S("thread.image.loading")}):a===null?l.jsx("div",{className:"conversation-image-placeholder",children:S("thread.image.gone")}):l.jsxs(l.Fragment,{children:[l.jsx("img",{className:"conversation-image",src:a,alt:S("thread.image.alt"),onClick:()=>C(!0),title:S("thread.image.openTitle")}),k&&l.jsx(Zm,{src:a,caption:S("thread.image.alt"),onClose:()=>C(!1)})]})}function vp({connection:n,title:t,confirmLabel:i,confirmTitle:a,onChoose:p,onClose:k}){const[C,r]=N.useState(null),[u,v]=N.useState(null),[_,h]=N.useState(!1),[w,E]=N.useState(""),R=N.useRef(null),g=N.useRef(null);N.useEffect(()=>{const d=n.onMessage(L=>{if(L.type==="picker.listing"){R.current=L.listing.pickerId,r(L.listing),v(null),h(!1),E("");return}L.type==="error"&&L.code==="picker-failed"&&v(Dt(L.text))});return n.send({type:"picker.open"}),()=>{d();const L=R.current;L!==null&&n.send({type:"picker.close",pickerId:L})}},[n]),N.useEffect(()=>{const d=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),k())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[k]),N.useEffect(()=>{var d;_&&((d=g.current)==null||d.focus())},[_]);const c=N.useCallback(d=>{const L=R.current;L!==null&&n.send({type:"picker.enter",pickerId:L,name:d})},[n]),f=N.useCallback(d=>{const L=R.current;L!==null&&n.send({type:"picker.root",pickerId:L,rootIndex:d})},[n]),m=N.useCallback(()=>{const d=R.current,L=w.trim();d===null||L.length===0||n.send({type:"picker.create",pickerId:d,name:L})},[n,w]);return l.jsx("div",{className:"modal-backdrop",onClick:k,children:l.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":t,onClick:d=>d.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:t}),l.jsx("button",{className:"icon-button",onClick:k,title:S("common.close"),children:"×"})]}),C===null?l.jsx("p",{className:"panel-note",children:S("picker.loading")}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"picker-roots",children:C.roots.map((d,L)=>l.jsx("button",{className:"picker-root",onClick:()=>f(L),title:S("picker.goTo",{root:d}),children:d},d))}),l.jsx("p",{className:"picker-path",title:C.path,children:C.path}),l.jsxs("div",{className:"picker-list",children:[C.canGoUp&&l.jsxs("button",{className:"picker-entry picker-up",onClick:()=>c(".."),children:["‹ ",S("picker.up")]}),C.entries.length===0&&!C.canGoUp&&l.jsx("p",{className:"panel-note",children:S("picker.empty")}),C.entries.map(d=>l.jsx("button",{className:"picker-entry",onClick:()=>c(d),children:d},d)),C.truncated&&l.jsx("p",{className:"panel-note",children:S("picker.truncated")})]}),u!==null&&l.jsx("p",{className:"picker-problem",children:u}),l.jsxs("footer",{className:"picker-footer",children:[_?l.jsxs("div",{className:"picker-create",children:[l.jsx("input",{ref:g,className:"picker-create-input",value:w,placeholder:S("picker.newFolderName"),onChange:d=>E(d.target.value),onKeyDown:d=>{d.key==="Enter"&&m(),d.key==="Escape"&&(d.stopPropagation(),h(!1)),d.stopPropagation()},spellCheck:!1}),l.jsx("button",{className:"primary-button primary-button-small",onClick:m,children:S("picker.create")}),l.jsx("button",{className:"link-button",onClick:()=>h(!1),children:S("common.cancel")})]}):l.jsx("button",{className:"primary-button primary-button-small",onClick:()=>h(!0),children:S("picker.createHere")}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"picker-open",onClick:()=>p(C.pickerId,C.path),title:a(C.path),children:i})]})]})]})})}function oC(n,t){return Pu(n)&&t!==null&&t.sessions>0}function lC(){return S("search.mode.titles")}function aC(){return S("search.mode.conversations")}function cC(){return S("search.mode.conversationsTitle")}function uC(n){return S(n==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function hC(){return S("search.tooShort",{min:km})}function dC(n){return[...n.trim()].length<km}function fC(){return S("search.off")}function pC(n){const t=new Map;for(const i of n){const a=`${i.agent}:${i.sessionId}`;let p=t.get(a);p===void 0&&(p={key:a,agent:i.agent,sessionId:i.sessionId,title:i.title,titleHit:null,hits:[],lastAt:null},t.set(a,p)),i.eventId===null?p.titleHit=i:p.hits.push(i),i.at!==null&&(p.lastAt=Math.max(p.lastAt??0,i.at))}return[...t.values()]}const mC=40;function Ng(n,t=mC){const i=n.matchStart+n.matchLength;let a=n.snippet.slice(0,n.matchStart);if(a.length>t){let p=a.length-t;const k=a.charCodeAt(p);k>=56320&&k<=57343&&(p+=1),a=`…${a.slice(p)}`}return{before:a,match:n.snippet.slice(n.matchStart,i),after:n.snippet.slice(i)}}function gC(n){return n.role==="user"?S("search.role.user"):n.role==="assistant"?S("search.role.assistant"):S("search.role.title")}function Dg(n){return Ng(n).match.trim()}function vC(n){const t=n.hits[0]??n.titleHit;return t===null?"":Dg(t)}const xu=n=>S("search.sessions",{count:n});function _C(n,t){return{query:t.query,hits:n===null?[...t.hits]:[...n.hits,...t.hits],sessionsScanned:t.sessionsScanned,sessionsTotal:t.sessionsTotal,truncated:null}}function wC(n){const{result:t}=n;if(n.searching&&n.error===null){if(t===null)return S("search.status.searching");const a={count:t.sessionsTotal,scanned:t.sessionsScanned};return t.hits.length===0?S("search.status.progress",a):S("search.status.progressFound",{...a,found:_p(t)})}if(n.error!==null)return n.error;if(t===null)return null;const i=t.hits.length===0?S("search.status.none"):_p(t);if(t.truncated===null&&t.hits.length===0&&t.sessionsScanned>0)return S("search.status.noneIn",{sessions:xu(t.sessionsScanned)});if(t.truncated==="results")return S("search.status.truncatedResults",{found:i});if(t.truncated==="time"){const a=Math.max(0,t.sessionsTotal-t.sessionsScanned);return S("search.status.truncatedTime",{found:i,seconds:Math.round(W0/1e3),left:xu(a)})}return S("search.status.done",{found:i})}function _p(n){const t=new Set(n.hits.map(i=>`${i.agent}:${i.sessionId}`)).size;return S("search.found",{hits:S("search.hits",{count:n.hits.length}),sessions:xu(t)})}function yC(n,t){const i=t.terminals.find(a=>a.kind==="agent"&&a.agent===n.agent&&a.sessionId===n.sessionId);if(i!==void 0)return{kind:"activate",terminalId:i.terminalId};for(const a of t.projects){const p=a.sessions.find(k=>k.agent===n.agent&&k.sessionId===n.sessionId);if(p!==void 0)return _u(p)&&a.cwdExists&&t.canResume(p.agent)?{kind:"resume",cwd:Mm(p.cwd,a.cwd,t.platform),session:p}:{kind:"copy"}}return{kind:"copy"}}const bC=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function Yt(n,t,i){const a=Bm(n,t),p=[];let k=0;for(const C of a.matchAll(bC)){const r=C.index??0;r>k&&p.push(Pl(a.slice(k,r),t));const u=C[1];if(u===void 0)p.push(N.createElement("br",{key:p.length}));else{const v=Pl(C[2]??"",t);p.push(N.createElement(u,{key:p.length},v))}k=r+C[0].length}return k<a.length&&p.push(Pl(a.slice(k),t)),p.length===1?p[0]:p}const wp="0.7.0",yp="agent-workbench.support-notice",SC=3e4;function CC(n){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(n)?n:null}function xC(n,t){return n!==t}function kC(){return[{keys:"Alt + T",description:S("shortcuts.app.newTab")},{keys:"Alt + W",description:S("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:S("shortcuts.app.switchTab")},{keys:"Alt + P",description:S("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:S("shortcuts.app.previousTab")}]}function EC({agent:n,onClose:t}){return N.useEffect(()=>{const i=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[t]),l.jsx("div",{className:"modal-backdrop",onClick:t,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":S("shortcuts.ariaLabel"),onClick:i=>i.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S("shortcuts.title")}),l.jsx("button",{className:"icon-button",onClick:t,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.app")}),l.jsx(tu,{shortcuts:kC()}),l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.composer")}),l.jsx(tu,{shortcuts:ay(n!==null&&n.capabilities.imagesByPath!==null)}),n!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.cli")}),l.jsx("p",{className:"modal-hint",children:Yt("shortcuts.cliHint")}),l.jsx(tu,{shortcuts:gr[n.id].shortcuts}),gr[n.id].shortcutsNote!==null&&l.jsx("p",{className:"modal-hint",children:gr[n.id].shortcutsNote})]}),l.jsx("p",{className:"modal-hint",children:Yt("shortcuts.browserReserved")}),l.jsx("p",{className:"modal-hint",children:Yt("shortcuts.altNumber")}),l.jsxs("p",{className:"modal-hint support-hint",children:[l.jsx("span",{"aria-hidden":"true",children:"☕"})," ",S("support.notice")," ",l.jsx("a",{href:Nm,target:"_blank",rel:"noreferrer noopener",children:S("support.link")})]})]})]})})}function tu({shortcuts:n}){return l.jsx("dl",{className:"shortcut-list",children:n.map(t=>l.jsxs("div",{className:"shortcut-row",children:[l.jsx("dt",{children:l.jsx("kbd",{children:t.keys})}),l.jsx("dd",{children:t.description})]},t.keys))})}const LC=1e3,TC=5e3;function RC({info:n,agentLabel:t,onRefresh:i,onClose:a}){const[p,k]=N.useState(!1),[C,r]=N.useState(!1),u=N.useRef(null),v=N.useRef(null);N.useEffect(()=>{const R=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a())};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[a]),N.useEffect(()=>{r(!1)},[n]),N.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current),v.current!==null&&window.clearTimeout(v.current)},[]);const _=R=>{navigator.clipboard.writeText(R).then(()=>{k(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>k(!1),LC)}).catch(()=>k(!1))},h=()=>{r(!0),i(),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>r(!1),TC)},w=n.state==="active",E=S("statusLine.title",{agent:t});return l.jsx("div",{className:"modal-backdrop",onClick:a,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":E,onClick:R=>R.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:E}),l.jsx("button",{className:"icon-button",onClick:a,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${w?" status-line-state-active":""}`,children:sy(n.state)}),l.jsx("p",{className:"modal-hint",children:S("statusLine.benefit")}),l.jsx("h3",{className:"modal-section",children:S("statusLine.lineSection")}),n.fragment===null?l.jsx("p",{className:"modal-hint",children:ry()}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Yt("statusLine.mergeHint")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:n.fragment}),l.jsx("button",{className:"link-button",onClick:()=>_(n.fragment??""),title:S("statusLine.copyTitle"),children:p?l.jsxs(l.Fragment,{children:["✓ ",S("statusLine.copied")]}):S("statusLine.copy")})]})]}),l.jsx("h3",{className:"modal-section",children:S("statusLine.whereSection")}),l.jsx("p",{className:"status-line-path",children:n.settingsPath}),l.jsx("p",{className:"modal-hint",children:S("statusLine.whereHint")}),l.jsx("h3",{className:"modal-section",children:S("statusLine.scriptSection")}),l.jsx("p",{className:"modal-hint",children:S("statusLine.scriptHint")}),l.jsx("p",{className:"status-line-path",children:n.scriptPath}),l.jsx("p",{className:"modal-hint",children:Yt("statusLine.runsEverywhere")}),l.jsxs("div",{className:"status-line-actions",children:[l.jsx("button",{className:"primary-button",onClick:h,disabled:C,children:S(C?"statusLine.checking":"statusLine.check")}),l.jsx("span",{className:"modal-hint",children:S("statusLine.checkHint")})]})]})]})})}function MC(){const[n,t]=N.useState(()=>xC(xt(yp,null,CC),wp));return N.useEffect(()=>{if(!n)return;wt(yp,wp);const i=window.setTimeout(()=>t(!1),SC);return()=>window.clearTimeout(i)},[n]),n?l.jsxs("div",{className:"banner banner-support",role:"status",children:[l.jsx("span",{children:S("support.notice")}),l.jsx("a",{className:"banner-support-link",href:Nm,target:"_blank",rel:"noreferrer noopener",onClick:()=>t(!1),children:S("support.link")}),l.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>t(!1),children:S("support.dismiss")})]}):null}function ku({agent:n,agents:t}){return l.jsx("span",{className:"agent-badge",title:po(n,t),children:Ww(n)})}const AC=500,bp=10;function NC(n){const t=N.useRef(null),i=N.useRef(null),a=N.useRef(!1),p=N.useRef(n);p.current=n;const k=N.useCallback(()=>{t.current!==null&&window.clearTimeout(t.current),t.current=null,i.current=null},[]),C=N.useCallback(_=>{_.pointerType==="mouse"||_.button!==0||(k(),a.current=!1,i.current={x:_.clientX,y:_.clientY},t.current=window.setTimeout(()=>{t.current=null,a.current=!0,p.current()},AC))},[k]),r=N.useCallback(_=>{const h=i.current;h!==null&&(Math.abs(_.clientX-h.x)>bp||Math.abs(_.clientY-h.y)>bp)&&k()},[k]),u=N.useCallback(_=>{(a.current||t.current!==null)&&_.preventDefault()},[]),v=N.useCallback(_=>{a.current&&(a.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:C,onPointerMove:r,onPointerUp:k,onPointerCancel:k,onContextMenu:u,onClickCapture:v}}function DC({onLongPress:n,...t}){const i=NC(n);return l.jsx("button",{...t,...i})}function qu({className:n,text:t,title:i,disabled:a,offerAgentChoice:p,agents:k,agent:C,onOpen:r}){var R;const[u,v]=N.useState(!1),_=N.useRef(null),h=N.useCallback(()=>v(!1),[]),w=N.useCallback(g=>{v(!1),r(g)},[r]);if(!p)return l.jsx("button",{className:n,onClick:()=>r(),disabled:a,title:i,children:t});const E=((R=k.find(g=>g.id===C))==null?void 0:R.label)??null;return l.jsxs("span",{className:"split-button",children:[l.jsx("button",{className:`${n} split-button-main`,onClick:()=>r(C??void 0),disabled:a,title:E===null?i:S("agentMenu.titleWithAgent",{title:i,label:E}),children:t}),l.jsx("button",{ref:_,className:`${n} split-button-arrow`,onClick:()=>v(g=>!g),disabled:a,"aria-haspopup":"menu","aria-expanded":u,title:S("agentMenu.chooseTitle"),children:"▾"}),u&&_.current!==null&&l.jsx(gg,{agents:k,preselected:C,anchor:_.current,onPick:w,onClose:h})]})}function IC(n){const t=new Date(n);return t.setHours(0,0,0,0),t.getTime()}function Ig(n,t,i,a){const p=new Set;for(const k of n)for(const C of k.sessions)C.agent===t&&(C.archived||C.updatedAt<i&&(a.has(C.sessionId)||p.add(C.sessionId)));return[...p]}function jC(n,t,i,a){const p=[];for(const r of n)for(const u of r.sessions)p.includes(u.agent)||p.push(u.agent);const k=a,C=r=>{const u=k.indexOf(r);return u===-1?a.length:u};return p.sort((r,u)=>C(r)-C(u)).map(r=>({agent:r,count:Ig(n,r,t,i).length})).filter(r=>r.count>0)}function jg(n,t){const i=new Set;let a=0;for(const p of n.sessions)if(!p.archived){if(t.has(p.sessionId)){a+=1;continue}i.add(p.sessionId)}return{sessionIds:[...i],blocked:a}}function PC(n){const{sessionIds:t,blocked:i}=n;if(t.length===0)return S("archive.allBlocked",{count:i});const a=S("archive.confirm",{count:t.length});return i===0?a:S("archive.withBlocked",{confirm:a,blocked:S("archive.blockedStays",{count:i})})}const Sp=12;function OC(n){let t=2166136261;for(let i=0;i<n.length;i+=1)t^=n.charCodeAt(i),t=Math.imul(t,16777619);return t>>>0}function vr(n){const t=n.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${OC(t)%Sp*(360/Sp)} var(--project-color-s) var(--project-color-l))`}function oi(){return S("vault.name")}function BC(){return S("vault.privacy")}function FC(){return S("vault.archived")}function HC(){return S("vault.mark.copy")}function Cp(){return S("vault.mark.copyTitle")}function $C(){return S("vault.mark.partial")}function UC(){return S("vault.mark.partialTitle")}function Pg(n){return S("vault.sessions",{count:n})}function Vu(n){return n==="measuring"||n==="writing"||n==="moving"}function WC(n){const t=n.progress;switch(n.state){case"measuring":return t===null?S("vault.state.measuring"):S("vault.state.measuringProgress",{done:t.done,total:t.total});case"writing":return t===null?S("vault.state.writing"):S("vault.state.writingProgress",{done:t.done,total:t.total});case"moving":return S("vault.state.moving");default:return n.enabled?S("vault.state.on"):S("vault.state.off")}}function zC(n){if(n===null||!n.enabled)return null;const t=[oi(),Pg(n.sessions)];return n.state==="writing"?t.push(n.progress===null?S("vault.line.copying"):S("vault.line.copyingProgress",{done:n.progress.done,total:n.progress.total})):n.state==="moving"?t.push(S("vault.line.moving")):n.state==="measuring"?t.push(S("vault.line.measuring")):t.push(n.lastPassAt===null?S("vault.line.neverCopied"):os(n.lastPassAt)),n.pending>0&&t.push(S("vault.line.pending",{count:n.pending})),t.join(" · ")}function qC(n){return n===null?oi():n.enabled?S("vault.button.on"):S("vault.button.off")}function VC(n){return n.enabled?"enabled":Vu(n.state)?"busy":n.measurement!==null?"measured":n.passSessions>0?"existing":"needs-measure"}function KC(n,t){return Vu(n.state)?S("vault.busy"):t?null:S("vault.indexNotReady")}function GC(n){return Vu(n.state)?S("vault.busy"):null}function YC(n){return S("vault.previousDir",{dir:n})}function XC(n){const t=[];return n.skippedEmpty>0&&t.push(S("vault.note.empty",{count:n.skippedEmpty})),n.unsupported>0&&t.push(S("vault.note.unsupported",{count:n.unsupported})),n.failed>0&&t.push(n.failureReasons.length>0?S("vault.note.failedWithReasons",{count:n.failed,reasons:n.failureReasons.map(Dt).join("; ")}):S("vault.note.failed",{count:n.failed})),t.length===0?null:S("vault.note.notCopied",{parts:t.join(" · ")})}function QC(n,t){const i=n.byAgent.map(k=>({agent:k.agent,label:po(k.agent,t),sessions:k.sessions,bytes:k.eventBytes+k.imageBytes,images:k.images,imageBytes:k.imageBytes,skippedArchived:k.skippedArchived,note:XC(k)})),a=i.reduce((k,C)=>({sessions:k.sessions+C.sessions,bytes:k.bytes+C.bytes,images:k.images+C.images,skippedArchived:k.skippedArchived+C.skippedArchived}),{sessions:0,bytes:n.memoryBytes,images:0,skippedArchived:0}),p=os(n.measuredAt);return{rows:i,memoryProjects:n.memoryProjects,memoryBytes:n.memoryBytes,total:a,summary:p.length>0?S("vault.measure.summary",{when:p,duration:ao(n.durationMs)}):S("vault.measure.summaryNoWhen",{duration:ao(n.durationMs)})}}function JC(n){const t=n.storage==="vault";return{copy:t,partial:t&&n.partial}}function ZC(n){switch(n){case"exporting":return S("vault.export.exporting");case"done":return S("vault.export.done");default:return S("vault.export.idle")}}const ex=1e3;function xp({hit:n}){const{before:t,match:i,after:a}=Ng(n);return l.jsxs(l.Fragment,{children:[t,l.jsx("mark",{children:i}),a]})}function tx({project:n,openSessionIds:t,onConfirm:i,onCancel:a}){const p=jg(n,t);return l.jsxs("div",{className:"project-archive-confirm",role:"group",children:[l.jsx("span",{className:"archive-history-text",children:PC(p)}),p.sessionIds.length>0&&l.jsx("button",{className:"link-button",onClick:i,children:S("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:a,children:p.sessionIds.length>0?S("common.cancel"):S("common.close")})]})}function nu(n){if(n.cwd.length===0)return n.fallbackName;const t=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return t[t.length-1]??n.cwd}function kp({out:n}){return l.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),l.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),n?l.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):l.jsx("path",{d:"M10 12.5h4"})]})}function nx(){return l.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 6.5V4.5a1.5 1.5 0 0 1 1.5-1.5h9A1.5 1.5 0 0 1 20 4.5v11a1.5 1.5 0 0 1-1.5 1.5H17"}),l.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),l.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function sx({done:n}){return l.jsx("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n?l.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M14 3H7a1.5 1.5 0 0 0-1.5 1.5v15A1.5 1.5 0 0 0 7 21h10a1.5 1.5 0 0 0 1.5-1.5V7.5z"}),l.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function rx({candidates:n,agents:t,onArchiveAgent:i,onClose:a,anchorRef:p}){const[k,C]=N.useState(null),r=N.useRef(null);return N.useEffect(()=>{const u=h=>{var w,E;return h instanceof Node&&(((w=r.current)==null?void 0:w.contains(h))===!0||((E=p.current)==null?void 0:E.contains(h))===!0)},v=h=>{h.key!=="Escape"||!u(document.activeElement)||(h.preventDefault(),h.stopPropagation(),a())},_=h=>{u(h.target)||a()};return window.addEventListener("keydown",v,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",v,!0),document.removeEventListener("pointerdown",_,!0)}},[p,a]),l.jsxs("div",{ref:r,className:"archive-history",role:"region","aria-label":S("sidebar.history.region"),children:[l.jsxs("div",{className:"archive-history-header",children:[l.jsx("span",{children:S("sidebar.history.heading")}),l.jsx("button",{className:"icon-button",onClick:a,title:S("common.closeEsc"),children:"×"})]}),n.map(({agent:u,count:v})=>{const _=po(u,t);return k===u?l.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[l.jsx("span",{className:"archive-history-text",children:S("sidebar.history.confirm",{count:v,label:_})}),l.jsx("button",{className:"link-button",onClick:()=>i(u),children:S("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:()=>C(null),children:S("common.cancel")})]},u):l.jsxs("div",{className:"archive-history-row",children:[l.jsxs("span",{className:"archive-history-text",children:[l.jsx("span",{className:"archive-history-agent",children:_}),l.jsx("span",{className:"archive-history-count",children:S("sidebar.history.count",{count:v})})]}),l.jsx("button",{className:"link-button",onClick:()=>C(u),children:S("sidebar.action.archive")})]},u)})]})}function ix({projects:n,indexStatus:t,disabled:i,openSessionIds:a,openBlocked:p,onOpenProject:k,agents:C,offerAgentChoice:r,agentForProject:u,onOpenSession:v,canResume:_,platform:h,onRefresh:w,onArchive:E,onHide:R,width:g,onNewProject:c,vault:f,onOpenVault:m,onOpenVaultSession:d,onExportProject:L,exporting:I,lastExported:x,onContinueSession:M,globalSearch:b,onOpenSearchHit:T}){const[D,B]=N.useState(new Set),[O,F]=N.useState(null);N.useEffect(()=>{const he=x===null?0:x.at+ex-Date.now();if(x===null||he<=0)return;F(x.projectKey);const Oe=window.setTimeout(()=>F(null),he);return()=>window.clearTimeout(Oe)},[x]);const U=he=>I.has(he)?"exporting":O===he?"done":"idle",q=zC(f),[G,Y]=N.useState(""),[W,j]=N.useState(!1),[$,H]=N.useState(new Set),[V,te]=N.useState("titles"),ie=b===null?"titles":V,[pe,me]=N.useState(!1),X=b!==null&&ie==="conversations"&&G.trim().length>0&&(pe||b.submitted!==null),K=(b==null?void 0:b.result)??null,J=N.useMemo(()=>X&&K!==null?pC(K.hits):[],[X,K]),Z=he=>{te(he),me(!1),b==null||b.clear()},_e=()=>{if(b!==null){if(dC(G)){me(!0),b.clear();return}me(!1),b.search(G.trim(),W)}},ve=(b==null?void 0:b.submitted)??null,ye=b==null?void 0:b.search;N.useEffect(()=>{ie!=="conversations"||ve===null||ye===void 0||ve.includeArchived!==W&&ye(ve.query,W)},[ie,ve,ye,W]);const Ee=N.useMemo(()=>n.reduce((he,Oe)=>he+Oe.sessions.filter(Qe=>Qe.archived).length,0),[n]),fe=N.useMemo(()=>{const he=ie==="titles"?G.trim().toLowerCase():"";return n.map(Oe=>{const Qe=W?Oe.sessions:Oe.sessions.filter(xe=>!xe.archived);if(Qe.length===0)return null;if(he.length===0)return{...Oe,sessions:Qe};if(nu(Oe).toLowerCase().includes(he)||Oe.cwd.toLowerCase().includes(he))return{...Oe,sessions:Qe};const ze=Qe.filter(xe=>is(xe.title,xe.titleSource).toLowerCase().includes(he));return ze.length>0?{...Oe,sessions:ze}:null}).filter(Oe=>Oe!==null)},[n,G,W,ie]),Ae=ie==="titles"&&G.trim().length>0,ne=he=>he.archived||!a.has(he.sessionId),[Ie,oe]=N.useState(!1),ue=N.useRef(null),de=IC(Date.now()),Me=N.useMemo(()=>C.map(he=>he.id),[C]),Re=N.useMemo(()=>jC(n,de,a,Me),[n,de,a,Me]),[Ke,Ue]=N.useState(null);N.useEffect(()=>{Re.length===0&&oe(!1)},[Re.length]);const st=N.useCallback(()=>oe(!1),[]),Tt=he=>{const Oe=Ig(n,he,de,a);Oe.length>0&&(E(Oe,!0),Ue({what:po(he,C),sessionIds:Oe})),oe(!1)},[lt,yt]=N.useState(null),ct=he=>{const Oe=jg(he,a);Oe.sessionIds.length>0&&(E(Oe.sessionIds,!0),Ue({what:nu(he),sessionIds:Oe.sessionIds})),yt(null)},We=()=>{Ke!==null&&E(Ke.sessionIds,!1),Ue(null)},Ge=he=>{H(Oe=>{const Qe=new Set(Oe);return Qe.has(he)?Qe.delete(he):Qe.add(he),Qe})},bt=N.useMemo(()=>{const he=[];for(const Oe of fe)for(const Qe of Oe.sessions)$.has(Qe.sessionId)&&he.push(Qe);return he},[fe,$]),it=he=>{const Oe=bt.filter(Qe=>he?ne(Qe):!0).map(Qe=>Qe.sessionId);Oe.length>0&&E(Oe,he),H(new Set)},Wt=he=>{B(Oe=>{const Qe=new Set(Oe);return Qe.has(he)?Qe.delete(he):Qe.add(he),Qe})},Pt=t.state==="scanning";return l.jsxs("aside",{className:"sidebar",style:{width:`${g}px`},children:[l.jsxs("div",{className:"sidebar-header",children:[l.jsx("input",{className:"sidebar-filter",type:"search",placeholder:uC(ie),value:G,onChange:he=>{Y(he.target.value),ie==="conversations"&&(me(!1),he.target.value.trim().length===0&&(b==null||b.clear()))},onKeyDown:he=>{ie!=="conversations"||he.key!=="Enter"||(he.preventDefault(),_e())},spellCheck:!1}),l.jsx("button",{className:"icon-button",onClick:c,title:S("sidebar.newProject"),disabled:i,children:"+"}),l.jsx("button",{className:"icon-button",onClick:w,title:S("sidebar.reindex"),disabled:Pt,children:"⟳"}),l.jsx("button",{className:`icon-button${(f==null?void 0:f.enabled)===!0?" icon-button-on":""}`,onClick:m,title:qC(f),"aria-label":oi(),children:l.jsx(nx,{})}),l.jsx("button",{className:"icon-button",onClick:R,title:S("sidebar.hide"),children:"«"})]}),b!==null&&l.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":S("sidebar.searchMode.label"),children:[l.jsx("button",{className:`sidebar-search-mode-option${ie==="titles"?" is-on":""}`,"aria-pressed":ie==="titles",onClick:()=>Z("titles"),title:S("sidebar.searchMode.titlesTitle"),children:lC()}),l.jsx("button",{className:`sidebar-search-mode-option${ie==="conversations"?" is-on":""}`,"aria-pressed":ie==="conversations",onClick:()=>Z("conversations"),title:cC(),children:aC()})]}),Pt&&l.jsx("div",{className:"sidebar-progress",children:S("sidebar.indexing",{scanned:t.scannedFiles,total:t.totalFiles})}),(Ee>0||Re.length>0)&&l.jsxs("div",{className:"sidebar-archive-bar",children:[Ee>0&&l.jsx("button",{className:`sidebar-archived-toggle${W?" is-on":""}`,onClick:()=>j(he=>!he),title:S("sidebar.archived.toggleTitle"),children:W?S("sidebar.archived.hide",{count:Ee}):S("sidebar.archived.show",{count:Ee})}),Re.length>0&&l.jsx("button",{ref:ue,className:`link-button sidebar-archive-history${Ie?" is-on":""}`,onClick:()=>oe(he=>!he),"aria-expanded":Ie,title:S("sidebar.history.buttonTitle"),children:S("sidebar.history.button")})]}),Ie&&Re.length>0&&l.jsx(rx,{candidates:Re,agents:C,onArchiveAgent:Tt,onClose:st,anchorRef:ue}),Ke!==null&&!Ie&&l.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[l.jsx("span",{className:"archive-history-text",children:S("sidebar.undo.text",{count:Ke.sessionIds.length,what:Ke.what})}),l.jsx("button",{className:"link-button",onClick:We,children:S("sidebar.action.undo")}),l.jsx("button",{className:"icon-button",onClick:()=>Ue(null),title:S("sidebar.undo.dismissTitle"),children:"×"})]}),q!==null&&l.jsx("button",{className:`sidebar-vault-line${(f==null?void 0:f.lastError)!=null?" is-problem":""}`,onClick:m,title:(f==null?void 0:f.lastError)!=null?S("sidebar.vaultLine.lastError",{error:Dt(f.lastError)}):S("sidebar.vaultLine.title"),children:q}),l.jsxs("div",{className:"sidebar-scroll",children:[X&&b!==null&&l.jsxs("div",{className:"search-results",children:[!b.vaultEnabled&&l.jsx("p",{className:"search-note",children:fC()}),l.jsx("p",{className:`search-status${b.error!==null?" is-problem":""}`,role:"status",children:pe?hC():wC(b)}),!pe&&J.map(he=>{const Oe=he.hits[0]??he.titleHit;return Oe===null?null:l.jsxs("div",{className:"search-group",children:[l.jsxs("button",{className:"search-group-title",onClick:()=>T(Oe,vC(he)),title:is(he.title),children:[l.jsx(ku,{agent:he.agent,agents:C}),he.titleHit!==null?l.jsx(xp,{hit:he.titleHit}):is(he.title)]}),he.hits.map(Qe=>l.jsxs("button",{className:"search-hit",onClick:()=>T(Qe,Dg(Qe)),children:[l.jsx("span",{className:"search-hit-snippet",children:l.jsx(xp,{hit:Qe})}),l.jsxs("span",{className:"search-hit-meta",children:[gC(Qe),Qe.at!==null?` · ${os(Qe.at)}`:""]})]},Qe.eventId??"titulo"))]},he.key)})]}),!X&&fe.length===0&&!Pt&&l.jsx("p",{className:"sidebar-empty",children:n.length===0?S("sidebar.empty.noProjects"):S("sidebar.empty.noMatch")}),!X&&fe.map(he=>{const Oe=D.has(he.key)||Ae,Qe=!i&&he.cwdExists,Ot=p(he.cwd);return l.jsxs("div",{className:"project",children:[l.jsxs("div",{className:"project-row",children:[l.jsxs("button",{className:"project-toggle",onClick:()=>Wt(he.key),title:he.cwd.length>0?he.cwd:he.fallbackName,children:[l.jsx("span",{className:`chevron${Oe?" chevron-open":""}`,children:"›"}),l.jsx("span",{className:"project-swatch",style:{background:vr(he.cwd)},"aria-hidden":"true"}),l.jsx("span",{className:"project-name",children:nu(he)}),l.jsx("span",{className:"project-count",children:he.sessions.length})]}),l.jsxs("span",{className:"project-actions",children:[L!==null&&l.jsx("button",{className:`icon-button project-action${U(he.key)!=="idle"?" project-action-busy":""}`,onClick:()=>L(he.key),disabled:U(he.key)==="exporting",title:ZC(U(he.key)),"aria-label":S("sidebar.project.export"),children:l.jsx(sx,{done:U(he.key)==="done"})}),l.jsx("button",{className:`icon-button project-action${lt===he.key?" project-action-busy":""}`,onClick:()=>yt(ze=>ze===he.key?null:he.key),title:S("sidebar.project.archiveTitle"),"aria-label":S("sidebar.project.archive"),"aria-expanded":lt===he.key,children:l.jsx(kp,{out:!1})})]}),l.jsx(qu,{className:"icon-button",text:"+",title:Ot?Km():he.cwdExists?S("sidebar.project.newSession"):S("sidebar.project.folderGone"),disabled:!Qe||Ot,offerAgentChoice:r,agents:C,agent:r?u(he):null,onOpen:ze=>k(he.cwd,ze)})]}),!he.cwdExists&&l.jsx("div",{className:"project-missing",title:he.cwd,children:S("sidebar.project.missing")}),lt===he.key&&l.jsx(tx,{project:he,openSessionIds:a,onConfirm:()=>ct(he),onCancel:()=>yt(null)}),Oe&&l.jsx("ul",{className:"session-list",children:he.sessions.map(ze=>{const xe=$.has(ze.sessionId),He=!ne(ze),ut=Dy(ze.agent,C,r),be=JC(ze),rt=_u(ze)&&_(ze.agent),_t=be.copy?d!==null:Qe&&rt;return l.jsxs("li",{className:`session-row${ze.archived?" session-archived":""}${xe?" session-selected":""}`,children:[l.jsxs(DC,{className:"session-item",onLongPress:()=>Ge(ze.sessionId),onClick:ht=>{if(ht.ctrlKey||ht.metaKey){Ge(ze.sessionId);return}if(be.copy){d==null||d(ze);return}_u(ze)&&(ze.archived&&E([ze.sessionId],!1),v(Mm(ze.cwd,he.cwd,h),ze))},disabled:!_t,title:be.copy?`${is(ze.title,ze.titleSource)}
|
|
136
|
+
${d===null?S("remote.onlyOnHost"):Cp()}`:ut.unavailableTitle??is(ze.title,ze.titleSource),children:[l.jsxs("span",{className:"session-title",children:[ut.badge&&l.jsx(ku,{agent:ze.agent,agents:C}),be.copy&&l.jsx("span",{className:"session-vault-mark",title:Cp(),children:HC()}),be.partial&&l.jsx("span",{className:"session-partial-mark",title:UC(),children:$C()}),is(ze.title,ze.titleSource)]}),l.jsx("span",{className:"session-meta",children:os(ze.updatedAt)})]}),l.jsx(vg,{targets:qm(C,ze.agent,ze.partial),className:"icon-button session-continue",text:"↪",onPick:ht=>M(ze,ht)}),l.jsx("button",{className:"icon-button session-action",onClick:()=>E([ze.sessionId],!ze.archived),disabled:He,title:ze.archived?S("sidebar.session.restore"):S(He?"sidebar.session.blocked":"sidebar.session.archive"),children:l.jsx(kp,{out:ze.archived})})]},`${ze.agent}:${ze.sessionId}`)})})]},he.key)})]}),bt.length>0&&l.jsxs("div",{className:"sidebar-selection",children:[l.jsx("span",{children:S("sidebar.selection.count",{count:bt.length})}),bt.some(he=>!he.archived)&&l.jsx("button",{className:"link-button",onClick:()=>it(!0),children:S("sidebar.action.archive")}),bt.some(he=>he.archived)&&l.jsx("button",{className:"link-button",onClick:()=>it(!1),children:S("sidebar.action.restore")}),l.jsx("button",{className:"link-button",onClick:()=>H(new Set),children:S("common.cancel")})]})]})}function Eu({x:n,y:t,items:i,onClose:a,anchor:p=null}){const k=N.useRef(null),[C,r]=N.useState({left:n,top:t});return N.useLayoutEffect(()=>{const u=k.current;if(u===null)return;const{width:v,height:_}=u.getBoundingClientRect();r({left:Math.max(4,Math.min(n,window.innerWidth-v-4)),top:Math.max(4,Math.min(t,window.innerHeight-_-4))})},[n,t]),N.useEffect(()=>{const u=_=>{_.key==="Escape"&&(_.stopPropagation(),a())},v=_=>{var w;const h=_.target;h instanceof Node&&((w=k.current)!=null&&w.contains(h)||p!=null&&p.contains(h))||a()};return window.addEventListener("keydown",u,!0),window.addEventListener("pointerdown",v,!0),window.addEventListener("scroll",a,!0),window.addEventListener("resize",a),()=>{window.removeEventListener("keydown",u,!0),window.removeEventListener("pointerdown",v,!0),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a)}},[p,a]),l.jsx("div",{ref:k,className:"context-menu",style:{left:`${C.left}px`,top:`${C.top}px`},onPointerDown:u=>u.stopPropagation(),children:i.map(u=>l.jsxs("button",{className:"context-menu-item",lang:u.lang,role:u.checked===void 0?void 0:"menuitemradio","aria-checked":u.checked,onClick:()=>{u.onSelect(),a()},children:[u.checked!==void 0&&l.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:u.checked?"✓":""}),u.label]},u.label))})}function Og({listLabel:n,docs:t,active:i,tooltipOf:a,labelOf:p=u=>u.title,onShowList:k,onSelect:C,onClose:r}){return l.jsxs("div",{className:"panel-subhead doc-strip",children:[l.jsx("button",{className:`doc-strip-list${i===null?" is-active":""}`,onClick:k,title:S("docs.backToList"),children:i===null?n:`← ${n}`}),l.jsx("div",{className:"strip-tabs doc-tabs",children:t.map(u=>l.jsxs("div",{className:`strip-tab${u.key===i?" is-active":""}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>C(u.key),title:a(u),children:p(u)}),l.jsx("button",{className:"strip-tab-close",onClick:()=>r(u.key),title:S("docs.tab.close"),children:"×"})]},u.key))})]})}const ox={added:"+",removed:"-",context:" ",hunk:"",meta:""};function lx({diff:n}){return n.binary?l.jsx("p",{className:"panel-note",children:S("diff.binary")}):n.lines.length===0?l.jsx("p",{className:"panel-note",children:n.message===null?S("diff.noChanges"):Dt(n.message)}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx(Bg,{lines:n.lines}),n.truncated&&l.jsx("p",{className:"panel-note",children:S("diff.truncated")})]})}function Bg({lines:n}){return l.jsx("div",{className:"diff",children:n.map((t,i)=>l.jsxs("div",{className:`diff-line diff-line-${t.kind}`,children:[l.jsx("span",{className:"diff-num","aria-hidden":"true",children:t.oldLine??""}),l.jsx("span",{className:"diff-num","aria-hidden":"true",children:t.newLine??""}),l.jsx("span",{className:"diff-marker","aria-hidden":"true",children:ox[t.kind]}),l.jsx("span",{className:"diff-text",children:t.text})]},i))})}function Ep(n){let t="";for(let i=0;i<n.length;i++){const a=n[i]??"",p=a.toLowerCase();t+=p.length===a.length?p:a}return t}function ax(n,t){if(t.length===0)return[];const i=Ep(n),a=Ep(t),p=[];let k=i.indexOf(a);for(;k!==-1;)p.push(k),k=i.indexOf(a,k+a.length);return p}function Lp(n,t,i){for(let k=0;k<n.length;k++){const C=n[k]??0;if(i==="start"?t<C:t<=C){const r=k===0?0:n[k-1]??0;return{node:k,offset:t-r}}}const a=Math.max(0,n.length-1),p=a===0?0:n[a-1]??0;return{node:a,offset:(n[a]??0)-p}}function cx(n,t,i){return t===0?0:(n+i+t)%t}function ux(n){return/\.(md|markdown)$/i.test(n)}function hx(n,t){var k;const i=((k=t.split("#")[0])==null?void 0:k.split("?")[0])??"";if(i.length===0)return null;let a;try{a=decodeURIComponent(i)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(a)||a.startsWith("/")||a.startsWith("\\"))return null;const p=n.split("/").slice(0,-1);for(const C of a.replace(/\\/g,"/").split("/")){if(C.includes(":"))return null;if(!(C===""||C===".")){if(C===".."){if(p.length===0)return null;p.pop();continue}p.push(C)}}return p.length===0?null:p.join("/")}function dx({text:n,language:t}){const[i,a]=N.useState(null);N.useEffect(()=>{if(t===null){a(null);return}let k=!1;return rs(async()=>{const{highlightCode:C}=await import("./highlight-DsNwA50i.js");return{highlightCode:C}},[]).then(({highlightCode:C})=>{k||a(C(n,t))}).catch(()=>{k||a(null)}),()=>{k=!0,a(null)}},[n,t]);const p=N.useMemo(()=>n.split(`
|
|
137
|
+
`).length,[n]);return l.jsxs("div",{className:"preview",children:[l.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:p},(k,C)=>l.jsx("span",{children:C+1},C))}),i!==null?l.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:"preview-code",children:n})]})}function Tp({onInsert:n,onOpenWithSystem:t}){const[i,a]=N.useState(!1),p=N.useRef(null);N.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]);const k=()=>{n==null||n(),a(!0),p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>a(!1),1200)};return l.jsxs("div",{className:"preview-actions",children:[n!==void 0&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:k,children:S(i?"files.pathInserted":"files.preview.insertPath")}),t!==null&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:t,children:S("files.menu.openWithSystem")})]})}const Lu="doc-search",Tu="doc-search-current";function Ru(){const n=CSS.highlights,t=window.Highlight;return n===void 0||typeof t!="function"?null:n}function Rp(n){const t=window.Highlight;return new t(...n)}function Mp(){const n=Ru();n==null||n.delete(Lu),n==null||n.delete(Tu)}function fx(n,t){if(t===null)return;const i=n.getBoundingClientRect(),a=t.getBoundingClientRect();(i.top<a.top+16||i.bottom>a.bottom-16)&&(t.scrollTop+=i.top-a.top-a.height/3),(i.left<a.left||i.right>a.right)&&(t.scrollLeft+=i.left-a.left-48)}function px(n,t,i,a){const[p,k]=N.useState(0),[C,r]=N.useState(0),[u,v]=N.useState(0),_=N.useRef([]);N.useEffect(()=>{const w=n.current;if(w===null||i.length===0)return;let E=0;const R=new MutationObserver(()=>{E===0&&(E=window.requestAnimationFrame(()=>{E=0,v(g=>g+1)}))});return R.observe(w,{childList:!0,subtree:!0,characterData:!0}),()=>{R.disconnect(),E!==0&&window.cancelAnimationFrame(E)}},[n,i,a]),N.useEffect(()=>{const w=n.current;if(_.current=[],w===null||i.length===0){Mp(),k(0),r(0);return}const E=[],R=[];let g="";const c=document.createTreeWalker(w,NodeFilter.SHOW_TEXT,{acceptNode:m=>{var d;return(d=m.parentElement)!=null&&d.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let m=c.nextNode();m!==null;m=c.nextNode()){const d=m;E.push(d),g+=d.data,R.push(g.length)}_.current=ax(g,i).map(m=>{const d=Lp(R,m,"start"),L=Lp(R,m+i.length,"end"),I=document.createRange();return I.setStart(E[d.node],d.offset),I.setEnd(E[L.node],L.offset),I}),k(_.current.length),r(m=>m<_.current.length?m:0);const f=Ru();return f!==null&&_.current.length>0?f.set(Lu,Rp(_.current)):f==null||f.delete(Lu),Mp},[n,i,u,a]),N.useEffect(()=>{r(0)},[i]),N.useEffect(()=>{const w=_.current[C],E=Ru();if(w===void 0){E==null||E.delete(Tu);return}E==null||E.set(Tu,Rp([w])),fx(w,t.current)},[C,p,u,a,i,t]);const h=N.useCallback(w=>r(E=>cx(E,p,w)),[p]);return{count:p,index:C,step:h}}function Fg({doc:n,content:t,readingText:i,truncatedText:a,onReload:p,onModeChange:k,onOpenWithSystem:C,onInsert:r,onOpenLink:u,initialScroll:v,onScrollChange:_,editor:h=null,insertButton:w}){const[E,R]=N.useState(""),g=N.useRef(null),c=N.useRef(null),f=(t==null?void 0:t.loaded)??null,m=f===null?"":f.kind==="file"?f.preview.text:f.plan.text,d=f!==null&&f.kind==="file"&&f.preview.binary,L=f!==null&&(f.kind==="file"?f.preview.truncated:f.plan.truncated),I=f!==null&&(f.kind==="plan"||f.preview.language==="markdown"||ux(f.preview.path)),x=I&&(n.mode??"formatted")==="formatted",M=f!==null&&f.kind==="file"?f.preview.language:"markdown",b=E.trim(),T=px(c,g,b,`${x?"f":"s"}:${m.length}:${m.slice(0,64)}`),D=N.useRef(!1);N.useLayoutEffect(()=>{D.current||f===null||(D.current=!0,v!==void 0&&g.current!==null&&(g.current.scrollTop=v))},[f,v]);const B=u===void 0||f===null||f.kind!=="file"?void 0:G=>{const Y=hx(n.key,G);return Y===null?null:()=>u(Y)},O=f!==null&&!d,F=(h==null?void 0:h.edit)??null;if(h!==null&&F!==null)return l.jsx(mx,{title:n.title,editor:h,insertButton:w});const U=f!==null&&f.kind==="file"&&f.preview.editable===!0,q=S(U?"docs.edit.title":L?"docs.edit.tooLarge":"docs.edit.unsafe");return l.jsxs("div",{className:"panel-body doc-viewer",children:[l.jsxs("div",{className:"doc-toolbar",children:[l.jsx("input",{className:"conversation-search-input",type:"search",placeholder:S("docs.search.placeholder"),value:E,disabled:!O,onChange:G=>R(G.target.value),onKeyDown:G=>{G.key==="Enter"&&T.step(G.shiftKey?-1:1),G.key==="Escape"&&R(""),G.stopPropagation()},spellCheck:!1}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:T.count===0?S("thread.search.none"):`${T.index+1}/${T.count}`}),l.jsx("button",{className:"icon-button",onClick:()=>T.step(-1),disabled:T.count===0,title:S("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>T.step(1),disabled:T.count===0,title:S("thread.search.next"),children:"↓"})]}),I&&l.jsxs("div",{className:"doc-mode",role:"group","aria-label":S("docs.mode.label"),children:[l.jsx("button",{className:x?"is-active":"","aria-pressed":x,onClick:()=>k("formatted"),children:S("docs.mode.formatted")}),l.jsx("button",{className:x?"":"is-active","aria-pressed":!x,onClick:()=>k("source"),children:S("docs.mode.source")})]}),h!==null&&f!==null&&f.kind==="file"&&!d&&l.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:h.begin,disabled:!U,title:q,children:h.justSaved?S("docs.edit.saved"):S("docs.edit.button")}),w,l.jsx("button",{className:"icon-button",onClick:p,disabled:(t==null?void 0:t.loading)===!0,title:S("docs.reload"),children:"⟳"})]}),(t==null?void 0:t.failed)===!0&&f!==null&&l.jsx("p",{className:"panel-note doc-note",children:S("docs.reloadFailed")}),f===null?l.jsx("p",{className:"panel-note",children:(t==null?void 0:t.failed)===!0?S("docs.failed"):i}):d?l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:S("files.preview.binary")}),l.jsx(Tp,{onInsert:r,onOpenWithSystem:C})]}):l.jsxs("div",{className:"panel-scroll",ref:g,onScroll:G=>_(G.currentTarget.scrollTop),children:[l.jsx("div",{ref:c,className:x?"plan-body":"doc-source",children:x?l.jsx(zu,{text:m,localLink:B}):l.jsx(dx,{text:m,language:M})}),L&&l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:a}),f.kind==="file"&&l.jsx(Tp,{onInsert:r,onOpenWithSystem:C})]})]})]})}function mx({title:n,editor:t,insertButton:i}){const[a,p]=N.useState(!1),k=t.edit;if(k===null)return l.jsx(l.Fragment,{});const C=k.text!==k.opened,r=k.conflict,u=C&&!k.saving&&r===null,v=k.saving?S("docs.edit.saving"):S(C?"docs.edit.unsaved":"docs.edit.noChanges"),_=()=>{t.unsaved?p(!0):t.discard()};return l.jsxs("div",{className:"panel-body doc-viewer",children:[l.jsxs("div",{className:"doc-toolbar",children:[l.jsxs("span",{className:"doc-edit-status",title:n,children:[S("docs.edit.editing",{name:n}),l.jsxs("span",{className:"doc-edit-state",children:[" · ",v]})]}),l.jsx("button",{className:"link-button",onClick:_,disabled:k.saving,children:S("docs.edit.cancel")}),l.jsx("button",{className:"primary-button primary-button-small",onClick:t.save,disabled:!u,title:S("docs.edit.saveTitle"),children:S("docs.edit.save")}),i,l.jsx("button",{className:"icon-button",disabled:!0,title:S("docs.reload"),children:"⟳"})]}),k.closing&&l.jsxs("div",{className:"note-closing doc-edit-bar",children:[l.jsx("span",{children:S("docs.edit.closeConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:t.confirmClose,children:S("docs.edit.discardAndClose")}),l.jsx("button",{className:"link-button",onClick:t.keepEditing,children:S("docs.edit.keepEditing")})]}),a&&!k.closing&&l.jsxs("div",{className:"note-closing doc-edit-bar",children:[l.jsx("span",{children:S("docs.edit.discardConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:t.discard,children:S("docs.edit.discard")}),l.jsx("button",{className:"link-button",onClick:()=>p(!1),children:S("docs.edit.keepEditing")})]}),r!==null&&l.jsxs("div",{className:"note-closing doc-edit-bar",children:[l.jsx("span",{children:r.next===null?S("docs.edit.gone"):S("docs.edit.conflict")}),r.next!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:t.adopt,children:S("docs.edit.adopt")}),l.jsx("button",{className:"link-button link-danger",onClick:t.discard,children:S("docs.edit.discardMine")})]}),k.failure!==null&&l.jsx("div",{className:"composer-problem doc-edit-bar",children:l.jsx("span",{children:k.failure.kind==="lost"?S("docs.edit.lost"):Dt(k.failure.text)})}),k.pending!==null&&l.jsxs("div",{className:"doc-changes",children:[l.jsxs("div",{className:"doc-changes-head",children:[l.jsx("span",{children:S("docs.edit.pending")}),l.jsx("button",{className:"link-button",onClick:t.dismissPending,children:S("docs.edit.pendingDone")})]}),l.jsx("div",{className:"doc-changes-body",children:l.jsx(Bg,{lines:k.pending})})]}),l.jsx("textarea",{className:"doc-editor",value:k.text,readOnly:r!==null||k.saving,spellCheck:!1,autoFocus:!0,"aria-label":S("docs.edit.editing",{name:n}),onChange:h=>t.change(h.target.value),onKeyDown:h=>{(h.ctrlKey||h.metaKey)&&!h.altKey&&h.key.toLowerCase()==="s"&&(h.preventDefault(),u&&t.save()),h.stopPropagation()}})]})}function Ku(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M1.5 3.5h4l1.2 1.6h7.8v7.4a1 1 0 0 1-1 1h-12a1 1 0 0 1-1-1V3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function gx(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M10.5 13.2v.3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h.3",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function vx({open:n}){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M1.4 8S3.8 3.9 8 3.9 14.6 8 14.6 8 12.2 12.1 8 12.1 1.4 8 1.4 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!n&&l.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function _x(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M8 1.5v6.2M5.4 5.3L8 7.9l2.6-2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wx(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hg({className:n,title:t,doneTitle:i,icon:a,onAction:p}){const[k,C]=N.useState(!1),r=N.useRef(null);N.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const u=v=>{v.stopPropagation(),p(),C(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>C(!1),1200)};return l.jsx("button",{className:k?`${n} tree-action-done`:n,onClick:u,title:k?i:t,children:k?l.jsx(wx,{}):a})}function yx({className:n,title:t,onCopy:i}){return l.jsx(Hg,{className:n,title:t,doneTitle:S("common.copied"),icon:l.jsx(gx,{}),onAction:i})}function co({className:n,title:t,onInsert:i}){return l.jsx(Hg,{className:n,title:t,doneTitle:S("files.pathInserted"),icon:l.jsx(_x,{}),onAction:i})}function bx({view:n,cwd:t,platform:i,onInsert:a,onInsertPath:p,onReveal:k,docs:C}){const{listings:r,loading:u,refresh:v,query:_,setQuery:h,showHidden:w,toggleHidden:E}=n,R=mo(),[g,c]=N.useState(null),f=i==="win32"?"\\":"/",m=N.useCallback(q=>{const G=q.split("/").join(f);return t.length===0?G:t.endsWith(f)?`${t}${G}`:`${t}${f}${G}`},[t,f]),d=N.useCallback(q=>{navigator.clipboard.writeText(q).catch(()=>{})},[]),L=N.useCallback(q=>p(`"${m(q)}"`),[m,p]),I=N.useCallback((q,G)=>{q.preventDefault(),q.stopPropagation(),c({x:q.clientX,y:q.clientY,items:[{label:S("files.menu.copyAbsolute"),onSelect:()=>d(m(G))},{label:S("files.menu.copyRelative"),onSelect:()=>d(G)},...a===void 0?[]:[{label:S("files.menu.insertMention"),onSelect:()=>a(`@${G}`)}],...k===null?[]:[{label:S("files.menu.openWithSystem"),onSelect:()=>k(G)}]]})},[m,d,a,k,R]),x=C.active===null?null:C.docs.find(q=>q.key===C.active)??null,M=x===null?void 0:C.content(x.key),b=x!==null&&M===void 0;N.useEffect(()=>{b&&x!==null&&C.reload(x.key)},[b,x==null?void 0:x.key]);const T=N.useCallback(q=>C.open({key:q,title:q.split("/").pop()??q}),[C]),D=N.useMemo(()=>({...n,openFile:T}),[n,T]),B=q=>{var Y;const G=(Y=C.content(q.key))==null?void 0:Y.loaded;return(G==null?void 0:G.kind)==="file"?`${q.key} · ${_n(G.preview.sizeBytes)}`:q.key},O=C.docs.length>0?l.jsx(Og,{listLabel:S("panel.tab.files"),docs:C.docs,active:C.active,tooltipOf:B,labelOf:q=>C.unsaved(q.key)?`${q.title} •`:q.title,onShowList:C.showList,onSelect:C.select,onClose:C.requestClose}):null;if(x!==null)return l.jsxs("div",{className:"panel-body",children:[O,l.jsx(Fg,{doc:x,content:M,readingText:S("files.readingFile"),truncatedText:S("files.preview.truncated"),onReload:()=>C.reload(x.key),onModeChange:q=>C.setMode(x.key,q),onOpenWithSystem:k===null?null:()=>k(x.key),onInsert:()=>L(x.key),onOpenLink:T,initialScroll:C.scrollOf(x.key),onScrollChange:q=>C.rememberScroll(x.key,q),editor:C.editorFor(x.key),insertButton:l.jsx(co,{className:"icon-button",title:S("files.insertPath",{name:x.title}),onInsert:()=>L(x.key)})},x.key),g!==null&&l.jsx(Eu,{x:g.x,y:g.y,items:g.items,onClose:()=>c(null)})]});const F=r.get(""),U=_.trim();return l.jsxs("div",{className:"panel-body",children:[O,l.jsxs("div",{className:"panel-subhead",children:[l.jsx("span",{className:"panel-subhead-title",title:t,children:t.split(/[\\/]/).filter(q=>q.length>0).pop()??t}),l.jsx(co,{className:"icon-button",title:S("files.insertFolderPath"),onInsert:()=>L("")}),l.jsx("button",{className:w?"icon-button icon-button-on":"icon-button",onClick:E,title:S(w?"files.hidden.hide":"files.hidden.show"),children:l.jsx(vx,{open:w})}),k!==null&&l.jsx("button",{className:"icon-button",onClick:()=>k(""),title:S("files.revealFolder"),children:l.jsx(Ku,{})}),l.jsx("button",{className:"icon-button",onClick:v,title:S("files.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"tree-search",children:[l.jsx("input",{className:"tree-search-input",value:_,placeholder:S("files.search.placeholder"),onChange:q=>h(q.target.value),onKeyDown:q=>{q.key==="Escape"&&_.length>0&&(q.stopPropagation(),h(""))}}),_.length>0&&l.jsx("button",{className:"tree-search-clear",onClick:()=>h(""),title:S("files.search.clear"),children:"×"})]}),l.jsx("div",{className:"panel-scroll",children:U.length>0?l.jsx(Sx,{view:D,onContextMenu:I,onReveal:k,onInsertPath:L}):F===void 0?l.jsx("p",{className:"panel-note",children:u.has("")?S("files.readingDir"):S("files.readDirFailed")}):l.jsx($g,{path:"",depth:0,view:D,onContextMenu:I,onReveal:k,onInsertPath:L})}),g!==null&&l.jsx(Eu,{x:g.x,y:g.y,items:g.items,onClose:()=>c(null)})]})}function Sx({view:n,onContextMenu:t,onReveal:i,onInsertPath:a}){const{results:p,searching:k,openFile:C,toggleDirectory:r}=n;return p===null?l.jsx("p",{className:"panel-note",children:S(k?"files.search.searching":"files.search.prompt")}):p.entries.length===0?l.jsx("p",{className:"panel-note",children:S("files.search.none")}):l.jsxs("ul",{className:"tree tree-results",children:[p.entries.map(u=>l.jsx("li",{children:l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${u.kind}${u.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>u.kind==="dir"?r(u.path):C(u.path),onContextMenu:v=>t(v,u.path,u.kind),title:u.path,children:[l.jsx("span",{className:"tree-chevron",children:u.kind==="dir"?"›":""}),l.jsxs("span",{className:"tree-result",children:[l.jsx("span",{className:"tree-name",children:u.name}),l.jsx("span",{className:"tree-result-path",children:u.path})]}),u.kind==="file"&&l.jsx("span",{className:"tree-size",children:_n(u.sizeBytes)})]}),l.jsx(co,{className:"tree-action",title:S("files.insertPath",{name:u.name}),onInsert:()=>a(u.path)}),u.kind==="dir"&&i!==null&&l.jsx("button",{className:"tree-action",onClick:()=>i(u.path),title:S("files.reveal",{name:u.name}),children:l.jsx(Ku,{})})]})},u.path)),p.truncated&&l.jsx("li",{className:"tree-hidden",title:S("files.search.moreTitle"),children:S("files.search.more")})]})}function $g({path:n,depth:t,view:i,onContextMenu:a,onReveal:p,onInsertPath:k}){const{listings:C,loading:r}=i,u=C.get(n);return u===void 0?r.has(n)?l.jsx("div",{className:"tree-loading",children:S("files.loading")}):null:l.jsxs("ul",{className:"tree",children:[u.entries.map(v=>l.jsx(Cx,{entry:v,depth:t,view:i,onContextMenu:a,onReveal:p,onInsertPath:k},v.path)),u.entries.length===0&&l.jsx("li",{className:"tree-empty",style:{paddingLeft:`${t*12+8}px`},children:u.hiddenCount>0?S("files.allHidden"):S("files.empty")}),(u.truncated||u.hiddenCount>0)&&u.entries.length>0&&l.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${t*12+8}px`},title:S("files.hiddenTitle"),children:u.truncated?S("files.moreEntries"):S("files.hiddenCount",{count:u.hiddenCount})})]})}function Cx({entry:n,depth:t,view:i,onContextMenu:a,onReveal:p,onInsertPath:k}){const{expanded:C,toggleDirectory:r,openFile:u}=i,v=n.kind==="dir"&&C.has(n.path);return l.jsxs("li",{children:[l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${n.kind}${n.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${t*12+6}px`},onClick:()=>n.kind==="dir"?r(n.path):u(n.path),onContextMenu:_=>a(_,n.path,n.kind),title:n.hidden===void 0?n.path:`${n.path}
|
|
138
|
+
${n.hidden==="ignored"?S("files.row.ignored"):S("files.row.alwaysHidden")}`,children:[l.jsx("span",{className:`tree-chevron${v?" tree-chevron-open":""}`,children:n.kind==="dir"?"›":""}),l.jsx("span",{className:"tree-name",children:n.name}),n.kind==="file"&&l.jsx("span",{className:"tree-size",children:_n(n.sizeBytes)})]}),l.jsx(co,{className:"tree-action",title:S("files.insertPath",{name:n.name}),onInsert:()=>k(n.path)}),n.kind==="dir"&&p!==null&&l.jsx("button",{className:"tree-action",onClick:()=>p(n.path),title:S("files.reveal",{name:n.name}),children:l.jsx(Ku,{})})]}),v&&l.jsx($g,{path:n.path,depth:t+1,view:i,onContextMenu:a,onReveal:p,onInsertPath:k})]})}const xx={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},kx={added:"git.kind.added",modified:"git.kind.modified",deleted:"git.kind.deleted",renamed:"git.kind.renamed",copied:"git.kind.copied","type-changed":"git.kind.typeChanged",untracked:"git.kind.untracked",conflict:"git.kind.conflict"},Ex=[{stage:"conflict",title:"git.group.conflict",hint:"git.group.conflictHint"},{stage:"staged",title:"git.group.staged",hint:"git.group.stagedHint"},{stage:"unstaged",title:"git.group.unstaged",hint:"git.group.unstagedHint"},{stage:"untracked",title:"git.group.untracked",hint:"git.group.untrackedHint"}];function Ap(n){const t=n.endsWith("/"),i=t?n.slice(0,-1):n,a=i.lastIndexOf("/"),p=a===-1?i:i.slice(a+1);return{dir:a===-1?"":i.slice(0,a+1),name:t?`${p}/`:p,isDirectory:t}}function Lx({status:n}){return l.jsxs("div",{className:"git-headline",children:[l.jsx("span",{className:"git-branch",title:n.repoRoot,children:n.branch??(n.head!==null?S("git.detachedAt",{head:n.head}):S("git.detached"))}),n.upstream!==null&&l.jsx("span",{className:"git-upstream",title:S("git.upstreamTitle",{upstream:n.upstream}),children:n.upstream}),(n.ahead>0||n.behind>0)&&l.jsxs("span",{className:"git-ab",title:S("git.aheadBehindTitle"),children:[n.ahead>0&&l.jsxs("span",{className:"git-ahead",children:["↑",n.ahead]}),n.behind>0&&l.jsxs("span",{className:"git-behind",children:["↓",n.behind]})]})]})}function Tx({view:n}){const{status:t,diff:i,loadingDiff:a,openDiff:p,closeDiff:k,refresh:C}=n;if(i!==null||a)return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsxs("button",{className:"link-button",onClick:k,children:["← ",S("git.backToChanges")]}),i!==null&&l.jsxs("span",{className:"panel-subhead-title",title:i.path,children:[Ap(i.path).name,i.staged&&l.jsxs("span",{className:"panel-tagline",children:[" ",S("git.stagedTag")]})]})]}),a?l.jsx("p",{className:"panel-note",children:S("git.readingDiff")}):i!==null&&l.jsx(lx,{diff:i})]});if(t.state!=="ready")return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:t.message===null?S("git.unknownState"):Dt(t.message)})});const r=t.worktrees.filter(u=>!u.isCurrent);return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx(Lx,{status:t}),l.jsx("button",{className:"icon-button",onClick:C,title:S("git.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"panel-scroll",children:[t.changes.length===0&&l.jsx("p",{className:"panel-note",children:S("git.clean")}),Ex.map(u=>{const v=t.changes.filter(_=>_.stage===u.stage);return v.length===0?null:l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:S(u.hint),children:[S(u.title),l.jsx("span",{className:"git-group-count",children:v.length})]}),l.jsx("ul",{className:"git-list",children:v.map(_=>{const{dir:h,name:w,isDirectory:E}=Ap(_.path),R=_.oldPath!==null?`${_.oldPath} → ${_.path}`:E?S("git.newFolderTitle",{path:_.path}):_.path,g=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`git-badge git-badge-${_.kind}`,title:S(kx[_.kind]),children:xx[_.kind]}),l.jsxs("span",{className:"git-path",children:[l.jsx("span",{className:"git-path-name",children:w}),h.length>0&&l.jsx("span",{className:"git-path-dir",children:h})]})]});return l.jsx("li",{children:E?l.jsx("div",{className:"git-item git-item-static",title:R,children:g}):l.jsx("button",{className:"git-item",onClick:()=>p(_.path,_.stage==="staged"),title:R,children:g})},`${u.stage}:${_.path}`)})})]},u.stage)}),t.truncated&&l.jsx("p",{className:"panel-note",children:Yt("git.truncated")}),r.length>0&&l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:S("git.worktrees.headingTitle"),children:[S("git.worktrees.heading"),l.jsx("span",{className:"git-group-count",children:r.length})]}),l.jsx("ul",{className:"git-list",children:r.map(u=>l.jsx("li",{children:l.jsxs("div",{className:"git-worktree",title:u.path,children:[l.jsx("span",{className:"git-worktree-branch",children:u.branch??S("git.worktrees.detached")}),l.jsx("span",{className:"git-worktree-path",children:u.path})]})},u.path))})]})]})]})}const Rx={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},Mx={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function Ql(n){return n.brokenBlock||n.problem!==null}function Ax(n){return n.problem==="outside"?S("memory.problem.outside"):n.problem==="encoding"?S("memory.problem.encoding"):n.brokenBlock?S("memory.problem.brokenBlock"):null}function Nx(n){const t=n.files.filter(i=>!Ql(i));return n.installed?{instructionFiles:t.filter(i=>i.hasBlock||i.exists).map(i=>i.name),gitMode:n.git.kind==="error"||n.git.kind==="repo"&&!n.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...A0(n),instructionFiles:t.map(i=>i.name)}}function Dx(n){const t=n.files.filter(p=>p.hasBlock&&!p.blockCurrent),i=n.files.filter(p=>p.exists&&!p.hasBlock&&!Ql(p)),a=p=>Uu(p.map(k=>k.name));return t.length===0?i.length===0?null:S("memory.update.missing",{files:a(i)}):i.length===0?S("memory.update.outdated",{count:t.length,files:a(t)}):S("memory.update.outdatedAndMissing",{count:t.length,outdated:a(t),missing:a(i)})}function Ix(n){const t=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
|
|
139
|
+
`),i=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(t);return i===null?t:t.slice(i[0].length)}function jx(n){return n.split(/`([^`]+)`/).map((t,i)=>i%2===1?l.jsx("code",{children:t},i):t)}function Px({view:n}){var c;const{status:t,open:i,loading:a,error:p,closeNote:k,openNote:C}=n,[r,u]=N.useState(null),[v,_]=N.useState(!1),h=(t==null?void 0:t.cwd)??null;N.useEffect(()=>{u(null),_(!1)},[h]),N.useEffect(()=>{n.lastResult!==null&&(u(null),_(!1))},[n.lastResult]);const w=N.useCallback(f=>{if(t===null)return null;let m=f.replace(/^\.\//,"");try{m=decodeURIComponent(m)}catch{return null}return m===Hl||t.notes.some(L=>L.name===m)?()=>C(m):null},[t,C]);if(t===null)return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:p??S("memory.loading")})});if(i!==null||a!==null){const f=(i==null?void 0:i.name)??a??"",m=f===Hl?S("memory.index"):((c=t.notes.find(d=>d.name===f))==null?void 0:c.title)??f;return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("button",{className:"link-button",onClick:k,children:S("memory.back")}),l.jsx("span",{className:"panel-subhead-title",title:f,children:m})]}),i===null?l.jsx("p",{className:"panel-note",children:S("memory.note.loading")}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"plan-body",children:l.jsx(zu,{text:Ix(i.text),localLink:w})}),i.truncated&&l.jsx("p",{className:"panel-note",children:S("memory.note.truncated")})]})]})}const E=r??Nx(t),R=t.installed?Dx(t):null,g=!t.installed||v||n.planned!==null;return l.jsxs("div",{className:"panel-body",children:[l.jsx(Ox,{reach:t.reach,onAdjust:t.installed&&!g&&R===null&&t.reach.some(f=>!f.reaches)?()=>_(!0):null}),l.jsxs("div",{className:"panel-scroll",children:[(p??n.lastResult)!==null&&l.jsxs("div",{className:`memory-message${p!==null?" memory-message-error":""}`,children:[l.jsx("span",{children:p??n.lastResult}),l.jsx("button",{className:"link-button",onClick:n.dismissMessage,title:S("common.dismissNotice"),children:"×"})]}),t.git.kind==="error"&&l.jsxs("div",{className:"memory-warning",children:[l.jsx("p",{className:"memory-warning-line",children:Yt("memory.git.errorWarning")}),l.jsx("pre",{className:"memory-git-message",children:Dt(t.git.message)})]}),t.files.filter(Ql).map(f=>l.jsx("p",{className:"memory-warning",children:f.problem==="outside"?Yt("memory.problem.outsideWarning",{file:f.name}):f.problem==="encoding"?Yt("memory.problem.encodingWarning",{file:f.name}):Yt("memory.problem.brokenBlockWarning",{file:f.name})},f.name)),!t.installed&&l.jsxs("div",{className:"memory-intro",children:[l.jsx("p",{children:S("memory.intro.what")}),l.jsx("p",{children:Yt("memory.intro.where")})]}),t.installed&&R!==null&&!g&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:R}),l.jsx("button",{className:"primary-button primary-button-small",onClick:()=>_(!0),children:S("memory.update.button")})]}),g&&(n.planned===null?l.jsx(Bx,{status:t,options:E,busy:n.busy,onChange:u,onPlan:()=>{u(E),n.requestPlan(E)},onCancel:t.installed?()=>{_(!1),u(null)}:null}):l.jsx(Fx,{changes:n.planned,busy:n.busy,confirmLabel:t.installed?S("memory.plan.update"):S("memory.plan.install"),onConfirm:n.install,onCancel:n.cancelPlan})),t.installed&&t.native.pending>0&&!g&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:S("memory.native.pending",{count:t.native.pending})}),l.jsx("button",{className:"primary-button primary-button-small",disabled:n.busy!==null,onClick:n.importNative,children:n.busy==="import"?S("memory.native.importing"):S("memory.native.import",{count:t.native.pending})})]}),t.installed&&l.jsx(Hx,{notes:t.notes,indexExists:t.indexExists,onOpen:C}),t.globalFragments.length>0&&l.jsx($x,{fragments:t.globalFragments})]})]})}function Ox({reach:n,onAdjust:t}){return l.jsxs("div",{className:"memory-reach",children:[n.map(i=>l.jsxs("span",{className:`memory-reach-item${i.reaches?" memory-reach-on":""}`,title:S("memory.reach.title",{label:i.label,via:Dt(i.via)}),children:[l.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:i.reaches?"✓":"—"}),i.label,l.jsx("span",{className:"visually-hidden",children:i.reaches?S("memory.reach.reaches",{via:Dt(i.via)}):S("memory.reach.doesNotReach",{via:Dt(i.via)})})]},i.agent)),t!==null&&l.jsx("button",{className:"link-button memory-reach-adjust",onClick:t,title:S("memory.reach.adjustTitle"),children:S("memory.reach.adjust")})]})}function Bx({status:n,options:t,busy:i,onChange:a,onPlan:p,onCancel:k}){const{git:C}=n,r=C.kind==="repo"?C.worktree:null,u=C.kind==="error"&&t.gitMode==="ignore",v=(_,h)=>{const w=new Set(t.instructionFiles);h?w.add(_):w.delete(_),a({...t,instructionFiles:Bu.filter(E=>w.has(E))})};return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:S("memory.form.files")}),n.files.map(_=>l.jsxs("label",{className:"memory-option",title:Ax(_)??void 0,children:[l.jsx("input",{type:"checkbox",checked:t.instructionFiles.includes(_.name),disabled:Ql(_),onChange:h=>v(_.name,h.target.checked)}),l.jsx("code",{children:_.name}),l.jsx("span",{className:"memory-option-hint",children:Uu(Mx[_.name])})]},_.name)),C.kind==="repo"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:"Git"}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:t.gitMode==="ignore",onChange:()=>a({...t,gitMode:"ignore"})}),S("memory.git.ignore"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.ignoreHint")})]}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:t.gitMode==="version",onChange:()=>a({...t,gitMode:"version"})}),S("memory.git.version"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.versionHint")})]}),C.ignored&&t.gitMode==="version"&&l.jsx("p",{className:"memory-warning",children:Yt("memory.git.alreadyIgnored")})]}),C.kind==="error"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:"Git"}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:t.gitMode==="version",onChange:()=>a({...t,gitMode:"version"})}),Yt("memory.git.dontTouch"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.errorHint")})]})]}),(n.native.pending>0||(r==null?void 0:r.mainHasMemory)===!0)&&l.jsx("p",{className:"memory-section-label",children:S("memory.form.existingNotes")}),n.native.pending>0&&l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"checkbox",checked:t.importNative,onChange:_=>a({...t,importNative:_.target.checked})}),S("memory.form.importNative",{count:n.native.pending})]}),(r==null?void 0:r.mainHasMemory)===!0&&l.jsxs("label",{className:"memory-option",title:r.mainPath,children:[l.jsx("input",{type:"checkbox",checked:t.copyFromMainWorktree,onChange:_=>a({...t,copyFromMainWorktree:_.target.checked})}),S("memory.form.copyFromMain")]}),l.jsxs("div",{className:"memory-actions",children:[l.jsx("button",{className:"primary-button primary-button-small",disabled:i!==null||t.instructionFiles.length===0||u,onClick:p,title:t.instructionFiles.length===0?S("memory.form.noFiles"):u?S("memory.git.blocked"):void 0,children:S(i==="plan"?"memory.form.planning":"memory.form.preview")}),k!==null&&l.jsx("button",{className:"link-button",onClick:k,disabled:i!==null,children:S("common.cancel")})]})]})}function Fx({changes:n,busy:t,confirmLabel:i,onConfirm:a,onCancel:p}){const k=t==="install";return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:S("memory.plan.changes")}),n.length===0?l.jsx("p",{className:"memory-empty",children:S("memory.plan.nothing")}):l.jsx("ul",{className:"memory-change-list",children:n.map((C,r)=>l.jsxs("li",{className:"memory-change",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("code",{className:"memory-change-file",children:C.file}),l.jsx("span",{className:"memory-option-hint",children:S(Rx[C.action])})]}),C.copiedFrom!==null&&l.jsx("p",{className:"memory-option-hint",children:S("memory.plan.copiedFrom",{path:C.copiedFrom})}),C.preview.length>0&&l.jsx("pre",{className:"memory-preview",children:C.preview})]},`${C.file}-${r}`))}),l.jsxs("div",{className:"memory-actions",children:[n.length>0&&l.jsx("button",{className:"primary-button primary-button-small",disabled:t!==null,onClick:a,children:k?S("memory.plan.writing"):i}),l.jsx("button",{className:"link-button",onClick:p,disabled:k,children:n.length===0?S("memory.plan.back"):S("common.cancel")})]})]})}function Hx({notes:n,indexExists:t,onOpen:i}){return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:S("memory.list.notes")}),l.jsxs("ul",{className:"plan-list",children:[t&&l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(Hl),children:[l.jsx("span",{className:"plan-name",children:S("memory.index")}),l.jsx("span",{className:"plan-meta",children:Hl})]})}),n.map(a=>l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(a.name),title:a.name,children:[l.jsx("span",{className:"plan-name",children:a.title}),a.description.length>0&&l.jsx("span",{className:"memory-note-description",children:a.description}),l.jsxs("span",{className:"plan-meta",children:[os(a.modifiedAt)," · ",_n(a.sizeBytes)]})]})},a.name))]}),n.length===0&&l.jsx("p",{className:"memory-empty",children:S("memory.list.empty")})]})}function $x({fragments:n}){const t=N.useCallback(i=>{navigator.clipboard.writeText(i).catch(()=>{})},[]);return l.jsxs("details",{className:"memory-global",children:[l.jsx("summary",{className:"memory-global-summary",children:S("memory.global.title")}),l.jsx("p",{className:"memory-empty",children:Yt("memory.global.intro")}),n.map(i=>l.jsxs("div",{className:"memory-fragment",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("span",{className:"memory-fragment-label",children:i.label}),l.jsx("code",{className:"memory-fragment-target",title:i.target,children:i.target})]}),l.jsxs("div",{className:"memory-fragment-body",children:[l.jsx("pre",{className:"memory-preview",children:i.text}),l.jsx(yx,{className:"icon-button",title:S("memory.global.copy"),onCopy:()=>t(i.text)})]}),l.jsx("p",{className:"memory-fragment-note",children:jx(Dt(i.note))})]},i.agent))]})}function Ux(n){for(const t of n.split(`
|
|
140
|
+
`,40)){const i=/^#{1,3}\s+(.+)$/.exec(t.trim());if(i!==null)return(i[1]??"").trim()}return null}function Wx({view:n,docs:t,onInsertPath:i}){const{plans:a}=n,p=t.active===null?null:t.docs.find(v=>v.key===t.active)??null,k=p===null?void 0:t.content(p.key),C=p!==null&&k===void 0&&n.listFor!==null&&n.listFor===t.terminalId;N.useEffect(()=>{C&&p!==null&&t.reload(p.key)},[C,p==null?void 0:p.key]);const r=v=>{var h;const _=(h=t.content(v.key))==null?void 0:h.loaded;return(_==null?void 0:_.kind)==="plan"?Ux(_.plan.text)??v.title:v.title},u=v=>{var h;const _=((h=a.find(w=>w.fileName===v.key))==null?void 0:h.path)??"";return _.length>0?_:r(v)};return l.jsxs("div",{className:"panel-body",children:[t.docs.length>0&&l.jsx(Og,{listLabel:S("panel.tab.plans"),docs:t.docs,active:t.active,tooltipOf:u,labelOf:r,onShowList:t.showList,onSelect:t.select,onClose:t.close}),p!==null?l.jsx(Fg,{doc:p,content:k,readingText:S("plans.loading"),truncatedText:S("plans.truncated"),onReload:()=>t.reload(p.key),onModeChange:v=>t.setMode(p.key,v),onOpenWithSystem:null,initialScroll:t.scrollOf(p.key),onScrollChange:v=>t.rememberScroll(p.key,v)},p.key):l.jsx("div",{className:"panel-scroll",children:a.length===0?l.jsx("p",{className:"panel-note",children:Yt("plans.empty")}):l.jsx("ul",{className:"plan-list",children:[...a].reverse().map(v=>l.jsx(zx,{plan:v,onOpen:()=>t.open({key:v.fileName,title:v.title}),onInsertPath:i},v.fileName))})})]})}function zx({plan:n,onOpen:t,onInsertPath:i}){const a=n.path.length>0?n.path:null;return n.exists?l.jsxs("li",{className:"plan-item",children:[l.jsxs("button",{className:"plan-row",onClick:t,title:a??void 0,children:[l.jsx("span",{className:"plan-name",children:n.title}),a!==null&&l.jsx("span",{className:"plan-path",children:a}),l.jsxs("span",{className:"plan-meta",children:[os(n.modifiedAt)," · ",_n(n.sizeBytes)]})]}),n.absolutePath.length>0&&l.jsx(co,{className:"tree-action plan-action",title:S("files.insertPath",{name:n.absolutePath.split(/[\\/]/).pop()??n.title}),onInsert:()=>i(`"${n.absolutePath}"`)})]}):l.jsxs("li",{className:"plan-row plan-row-missing",title:a??S("plans.missingTitle"),children:[l.jsx("span",{className:"plan-name",children:n.title}),a!==null&&l.jsx("span",{className:"plan-path",children:a}),l.jsx("span",{className:"plan-meta",children:S("plans.missing")})]})}const qx=[{id:"cli",labelKey:"panel.tab.cli"},{id:"git",labelKey:"panel.tab.git"},{id:"files",labelKey:"panel.tab.files"},{id:"plans",labelKey:"panel.tab.plans"},{id:"memory",labelKey:"panel.tab.memory"}];function Ug(n){return n.state!=="ready"?0:new Set(n.changes.map(t=>t.path)).size}function Vx({tab:n,plansAvailable:t,hiddenTabs:i,hidden:a,onTabChange:p,title:k,cwd:C,platform:r,cli:u,cliUnseen:v,expanded:_,onToggleExpanded:h,git:w,files:E,plans:R,documents:g,memory:c,onInsert:f,onInsertPath:m,onReveal:d,onHide:L}){var M;const I=Ug(w.status),x=((M=c.status)==null?void 0:M.installed)===!0?c.status.notes.length:0;return l.jsxs("section",{className:`side-panel${a?" side-panel-hidden":""}`,"aria-hidden":a,children:[l.jsxs("header",{className:"side-panel-header",children:[l.jsx("button",{className:"icon-button",onClick:L,title:S("panel.hide"),children:"»"}),C.length>0&&l.jsx("span",{className:"project-swatch",style:{background:vr(C)}}),l.jsx("span",{className:"side-panel-title",title:C,children:k}),l.jsx("button",{className:"icon-button",onClick:h,title:S(_?"panel.restoreWidth":"panel.widen"),children:_?"⇥":"⇤"})]}),l.jsx("nav",{className:"side-panel-tabs",children:iy(qx,t,i).map(b=>l.jsxs("button",{className:`side-panel-tab${b.id===n?" side-panel-tab-active":""}`,onClick:()=>p(b.id),title:S(b.labelKey),children:[l.jsx("span",{className:"side-panel-tab-label",children:S(b.labelKey)}),b.id==="git"&&I>0&&l.jsx("span",{className:"side-panel-badge",children:I}),b.id==="plans"&&R.plans.length>0&&l.jsx("span",{className:"side-panel-badge",children:R.plans.length}),b.id==="memory"&&x>0&&l.jsx("span",{className:"side-panel-badge",children:x}),b.id==="cli"&&v&&n!=="cli"&&l.jsx("span",{className:"side-panel-dot",title:S("panel.cliUnseen")})]},b.id))}),l.jsxs("div",{className:"side-panel-body",children:[l.jsx("div",{className:`cli-slot${n==="cli"?"":" cli-slot-hidden"}`,children:u}),n==="git"&&l.jsx(Tx,{view:w}),n==="plans"&&l.jsx(Wx,{view:R,docs:g.plans,onInsertPath:m}),n==="memory"&&l.jsx(Px,{view:c}),n==="files"&&l.jsx(bx,{view:E,cwd:C,platform:r,onInsert:f,onInsertPath:m,onReveal:d,docs:g.files})]})]})}function Kx(n,t,i){return`${t===void 0||t.length===0?n:`${n} — ${t}`}
|
|
141
|
+
${i}`}function Gx({placement:n}){return l.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${n.pending.cwd}
|
|
142
|
+
${S("tabs.state.opening")}`,style:{"--tab-project-color":vr(n.pending.cwd)},children:[l.jsx("span",{className:"tab-opening","aria-label":S("tabs.aria.opening"),children:l.jsx("i",{})}),l.jsx("span",{className:"tab-label",children:n.label})]})}function Gu({terminal:n,activity:t,statusLine:i}){if(!n.alive){const a=n.sleeping;return l.jsx("span",{className:`tab-dot${a?" tab-dot-sleeping":" tab-dot-dead"}`,title:S(a?"tabs.dot.sleeping":"tabs.dot.exited")})}return t==="waiting"?l.jsx("span",{className:"tab-bang",title:S("tabs.dot.waiting"),children:"!"}):t==="busy"?l.jsxs("span",{className:"tab-working",title:S("tabs.dot.busy"),"aria-label":S("tabs.aria.working"),children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):l.jsx("span",{className:"tab-dot",title:gy(t,i)})}function uo(n){if(n.label.length>0)return n.label;const t=n.cwd.split(/[\\/]/).filter(a=>a.length>0),i=t[t.length-1]??n.cwd;return n.resumed?`${i} ↩`:i}function Yx(n){return n.alive?S("tabs.state.alive"):n.sleeping?S("tabs.state.sleeping"):S("tabs.state.exited",{code:n.exitCode??"?"})}function Xx({terminals:n,activeTerminalId:t,activity:i,attention:a,canOpen:p,onSelect:k,onClose:C,onRename:r,onReorder:u,onNew:v,agents:_,offerAgentChoice:h,newTabAgent:w,pendingOpens:E,platform:R,newTabBlockedTitle:g,sessionTitles:c}){const[f,m]=N.useState(null),[d,L]=N.useState(""),[I,x]=N.useState(null),M=N.useRef(null);N.useEffect(()=>{var U;f!==null&&((U=M.current)==null||U.select())},[f]);const b=U=>{m(U.terminalId),L(U.label.length>0?U.label:uo(U))},T=()=>{f!==null&&r(f,d.trim()),m(null)},D=U=>{if(I===null||I===U)return;const q=n.map(W=>W.terminalId),G=q.indexOf(I),Y=q.indexOf(U);G===-1||Y===-1||(q.splice(Y,0,...q.splice(G,1)),u(q),x(null))},B=Vy(n,E,R),O=new Map;for(const U of B){const q=O.get(U.index);q===void 0?O.set(U.index,[U]):q.push(U)}const F=U=>(O.get(U)??[]).map(q=>l.jsx(Gx,{placement:q},`pending:${q.pending.requestId}`));return l.jsxs("div",{className:"tab-bar",children:[n.map((U,q)=>{var W;const G=U.terminalId===t,Y=U.terminalId===f;return l.jsxs(y_.Fragment,{children:[F(q),l.jsx("div",{className:`tab${G?" tab-active":""}${U.alive||U.sleeping?"":" tab-dead"}${(a==null?void 0:a.has(U.terminalId))===!0?" tab-attention":""}`,draggable:!Y,onDragStart:()=>x(U.terminalId),onDragOver:j=>j.preventDefault(),onDrop:()=>D(U.terminalId),onDragEnd:()=>x(null),onClick:()=>k(U.terminalId),onDoubleClick:()=>b(U),title:Kx(U.cwd,c.get(U.terminalId),Yx(U)),style:{"--tab-project-color":vr(U.cwd)},children:Y?l.jsx("input",{ref:M,className:"tab-input",value:d,onChange:j=>L(j.target.value),onBlur:T,onKeyDown:j=>{j.key==="Enter"&&T(),j.key==="Escape"&&m(null),j.stopPropagation()},onClick:j=>j.stopPropagation()}):l.jsxs(l.Fragment,{children:[l.jsx(Gu,{terminal:U,activity:i.get(U.terminalId),statusLine:((W=_.find(j=>j.id===U.agent))==null?void 0:W.statusLine)??null}),l.jsxs("span",{className:"tab-label",children:[U.agent!==null&&Ny(h,U.agent)&&l.jsx(ku,{agent:U.agent,agents:_}),uo(U)]}),l.jsx("button",{className:"tab-close",onClick:j=>{j.stopPropagation(),C(U.terminalId)},title:S("tabs.close"),children:"×"})]})})]},U.terminalId)}),F(n.length),l.jsx(qu,{className:"tab-new",text:"+",title:g??S("tabs.new"),disabled:!p||g!==null,offerAgentChoice:h,agents:_,agent:w,onOpen:v})]})}function Qx(n,t,i){const[a,p]=N.useState(!1);return N.useEffect(()=>{if(p(!1),!(t===null||i))return n.onMessage(k=>{k.type==="terminal.output"&&k.terminalId===t&&p(!0)})},[n,t,i]),a&&!i}const Jx=200,Np="agent-workbench.files.hidden";function Zx(n,t){const[i,a]=N.useState(new Map),[p,k]=N.useState(new Set),[C,r]=N.useState(new Set),[u,v]=N.useState(""),[_,h]=N.useState(null),[w,E]=N.useState(!1),[R,g]=N.useState(()=>xt(Np,!1,x=>x==="true"?!0:x==="false"?!1:null)),c=N.useRef(new Set),f=N.useRef(R);f.current=R;const m=N.useCallback(x=>{t===null||c.current.has(x)||(c.current.add(x),r(M=>new Set(M).add(x)),n.send({type:"files.list",terminalId:t,path:x,includeHidden:f.current}))},[n,t]);N.useEffect(()=>{if(a(new Map),k(new Set),r(new Set),v(""),h(null),E(!1),c.current=new Set,t===null)return;const x=n.onMessage(b=>{switch(b.type){case"files.listing":{if(b.terminalId!==t)break;const{listing:T}=b;c.current.delete(T.path),a(D=>new Map(D).set(T.path,T)),r(D=>{const B=new Set(D);return B.delete(T.path),B});break}case"files.results":if(b.terminalId!==t)break;h(b.result),E(!1);break;case"error":c.current=new Set,r(new Set),E(!1);break}});n.send({type:"files.list",terminalId:t,path:"",includeHidden:f.current}),c.current.add(""),r(new Set([""]));const M=n.onReopen(()=>{c.current=new Set,n.send({type:"files.list",terminalId:t,path:"",includeHidden:f.current})});return()=>{x(),M()}},[n,t]),N.useEffect(()=>{const x=u.trim();if(t===null||x.length===0){h(null),E(!1);return}E(!0);const M=window.setTimeout(()=>{n.send({type:"files.search",terminalId:t,query:x,includeHidden:f.current})},Jx);return()=>window.clearTimeout(M)},[n,t,u,R]);const d=N.useCallback(x=>{k(M=>{const b=new Set(M);return b.has(x)?b.delete(x):(b.add(x),m(x)),b})},[m]),L=N.useCallback(()=>{if(t===null)return;c.current=new Set;const x=["",...p];for(const M of x)c.current.add(M),n.send({type:"files.list",terminalId:t,path:M,includeHidden:f.current});r(new Set(x))},[n,t,p]),I=N.useCallback(()=>{g(x=>{const M=!x;if(f.current=M,wt(Np,String(M)),t!==null){c.current=new Set;const b=["",...p];for(const T of b)c.current.add(T),n.send({type:"files.list",terminalId:t,path:T,includeHidden:M});r(new Set(b))}return M})},[n,t,p]);return{listings:i,expanded:p,loading:C,query:u,setQuery:v,results:_,searching:w,showHidden:R,toggleHidden:I,toggleDirectory:d,refresh:L}}function ek(n){const[t,i]=N.useState(!1),[a,p]=N.useState(null),[k,C]=N.useState(null),[r,u]=N.useState(null),v=N.useRef(null);N.useEffect(()=>{const w=n.onMessage(R=>{switch(R.type){case"search.progress":if(v.current===null||R.searchId!==v.current)break;p(g=>_C(g,R.progress));break;case"search.results":if(v.current===null||R.searchId!==v.current)break;v.current=null,p(R.result),C(null),i(!1);break;case"error":if(R.code!=="search-failed"||v.current===null||R.requestId!==v.current)break;v.current=null,R.detail!==void 0&&console.error("[servidor]",R.detail),p(null),C(Dt(R.text)),i(!1);break}}),E=n.onReopen(()=>{v.current!==null&&(v.current=null,i(!1),C(S("searchHook.connectionLost")))});return()=>{w(),E()}},[n]);const _=N.useCallback((w,E)=>{const R=crypto.randomUUID();v.current=R,u({query:w,includeArchived:E}),i(!0),C(null),p(null),n.send({type:"search.global",searchId:R,query:w,includeArchived:E})},[n]),h=N.useCallback(()=>{const w=v.current;v.current=null,w!==null&&n.send({type:"search.cancel",searchId:w}),u(null),i(!1),p(null),C(null)},[n]);return{searching:t,result:a,error:k,submitted:r,search:_,clear:h}}function tk(n,t){const[i,a]=N.useState([]),[p,k]=N.useState(null);return N.useEffect(()=>{if(a([]),k(null),t!==null)return n.onMessage(C=>{switch(C.type){case"conversation.plans":if(C.terminalId!==t)break;a(C.plans),k(t);break}})},[n,t]),{plans:i,listFor:p}}const Wg=8,zg=1024,nk=300,sk=["file","plan"],Vl={docs:[],active:null,recent:[]},ho={};function Kl(n,t){return[...n.filter(i=>i!==t),t]}function rk(n,t,i=new Set){const a=n.docs.find(C=>C.key===t.key);if(a!==void 0)return{docs:a.title===t.title?n.docs:n.docs.map(r=>r.key===t.key?{...r,title:t.title}:r),active:t.key,recent:Kl(n.recent,t.key)};let p=[...n.docs,{key:t.key,title:t.title}],k=Kl(n.recent,t.key);for(;p.length>Wg;){const C=k.find(r=>r!==t.key&&!i.has(r));if(C===void 0)break;p=p.filter(r=>r.key!==C),k=k.filter(r=>r!==C)}return{docs:p,active:t.key,recent:k}}function Dp(n,t){return n.docs.some(i=>i.key===t)?{...n,active:t,recent:Kl(n.recent,t)}:n}function ik(n){return n.active===null?n:{...n,active:null}}function ok(n,t){const i=n.docs.findIndex(C=>C.key===t);if(i===-1)return n;const a=n.docs.filter(C=>C.key!==t),p=n.recent.filter(C=>C!==t);if(n.active!==t)return{docs:a,active:n.active,recent:p};const k=a[i]??a[i-1]??null;return{docs:a,active:k===null?null:k.key,recent:k===null?p:Kl(p,k.key)}}function lk(n,t,i){return{...n,docs:n.docs.map(a=>a.key===t?{...a,mode:i}:a)}}function su(n,t,i){var a;return((a=n[t])==null?void 0:a[i])??Vl}function ak(n,t,i,a){const p=n[t]??{file:Vl,plan:Vl};return{...n,[t]:{...p,[i]:a}}}function ck(n,t){if(t.length===0)return n;const i=new Set(t),a=Object.keys(n).filter(k=>!i.has(k));if(a.length===0)return n;const p={...n};for(const k of a)delete p[k];return p}function Ys(n,t,i){return`${n}\0${t}\0${i}`}function uk(n){const t=new Set;for(const[i,a]of Object.entries(n))for(const p of sk)for(const k of a[p].docs)t.add(Ys(i,p,k.key));return t}function hk(n){return JSON.stringify(n)}function Gl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function dk(n){const t=Gl(n);if(t===null)return null;const{key:i,title:a,mode:p}=t;if(typeof i!="string"||i.length===0||i.length>zg||typeof a!="string"||a.length>nk)return null;const k={key:i,title:a};return p==="formatted"||p==="source"?{...k,mode:p}:k}function Ip(n){const t=Gl(n);if(t===null||!Array.isArray(t.docs))return Vl;const i=[];for(const r of t.docs){const u=dk(r);if(u!==null&&!i.some(v=>v.key===u.key)&&i.push(u),i.length===Wg)break}const a=i.map(r=>r.key),p=typeof t.active=="string"&&a.includes(t.active)?t.active:null,k=Array.isArray(t.recent)?t.recent.filter(r=>typeof r=="string"&&a.includes(r)):[],C=[...a.filter(r=>!k.includes(r)),...new Set(k)];return{docs:i,active:p,recent:C}}function fk(n){let t;try{t=JSON.parse(n)}catch{return ho}const i=Gl(t);if(i===null)return ho;const a={};for(const[p,k]of Object.entries(i)){const C=Gl(k);if(C===null||p.length===0||p.length>zg)continue;const r=Ip(C.file),u=Ip(C.plan);r.docs.length===0&&u.docs.length===0||(a[p]={file:r,plan:u})}return a}const jp=1,pk=25e4,qg={kind:"hunk",text:"…",oldLine:null,newLine:null};function Mu(n){return n.replace(/\r\n?/g,`
|
|
143
|
+
`)}function Pp(n){const t=Mu(n).split(`
|
|
144
|
+
`);return t.length>0&&t[t.length-1]===""&&t.pop(),t}function mk(n,t){const i=Pp(n),a=Pp(t);let p=0;for(;p<i.length&&p<a.length&&i[p]===a[p];)p+=1;let k=i.length,C=a.length;for(;k>p&&C>p&&i[k-1]===a[C-1];)k-=1,C-=1;if(p===k&&p===C)return[];const r=[];for(let u=0;u<p;u+=1)r.push(Au(i,u,u));gk(i,a,p,k,p,C,r);for(let u=k,v=C;u<i.length;u+=1,v+=1)r.push(Au(i,u,v));return vk(r)}function Au(n,t,i){return{kind:"context",text:n[t]??"",oldLine:t+1,newLine:i+1}}function ru(n,t){return{kind:"removed",text:n[t]??"",oldLine:t+1,newLine:null}}function iu(n,t){return{kind:"added",text:n[t]??"",oldLine:null,newLine:t+1}}function gk(n,t,i,a,p,k,C){const r=a-i,u=k-p;if(r===0||u===0||r*u>pk){for(let R=i;R<a;R+=1)C.push(ru(n,R));for(let R=p;R<k;R+=1)C.push(iu(t,R));return}const v=u+1,_=new Uint32Array((r+1)*v),h=(R,g)=>_[R*v+g]??0;for(let R=r-1;R>=0;R-=1)for(let g=u-1;g>=0;g-=1)_[R*v+g]=n[i+R]===t[p+g]?h(R+1,g+1)+1:Math.max(h(R+1,g),h(R,g+1));let w=0,E=0;for(;w<r&&E<u;)n[i+w]===t[p+E]?(C.push(Au(n,i+w,p+E)),w+=1,E+=1):h(w+1,E)>=h(w,E+1)?(C.push(ru(n,i+w)),w+=1):(C.push(iu(t,p+E)),E+=1);for(;w<r;w+=1)C.push(ru(n,i+w));for(;E<u;E+=1)C.push(iu(t,p+E))}function vk(n){const t=n.map(p=>p.kind!=="context"),i=[];let a=-1;return n.forEach((p,k)=>{let C=!1;for(let r=-jp;r<=jp&&!C;r+=1)C=t[k+r]===!0;C&&(a!==-1&&k>a+1&&i.push(qg),i.push(p),a=k)}),i}const Vg="agent-workbench.docTabs",_k=1600;function wk(){try{const n=window.sessionStorage.getItem(Vg);return n===null?ho:fk(n)}catch{return ho}}function ou(n){return n!==void 0&&(n.text!==n.opened||n.conflict!==null||n.pending!==null)}function yk(n,t,i,a){const[p,k]=N.useState(wk),[C,r]=N.useState(new Map),[u,v]=N.useState(new Map),[_,h]=N.useState(new Set),w=N.useRef(C);w.current=C;const E=N.useRef(u);E.current=u;const R=N.useRef(new Map),g=N.useRef(new Map),c=N.useRef(new Map);N.useEffect(()=>{k(x=>ck(x,t.map(M=>M.terminalId)))},[t]),N.useEffect(()=>{const x=uk(p);for(const M of[...R.current.keys()])x.has(M)||R.current.delete(M);r(M=>{const b=[...M.keys()].filter(D=>!x.has(D));if(b.length===0)return M;const T=new Map(M);for(const D of b)T.delete(D);return T}),v(M=>{const b=[...M.keys()].filter(D=>!x.has(D));if(b.length===0)return M;const T=new Map(M);for(const D of b)T.delete(D);return T})},[p]),N.useEffect(()=>{try{window.sessionStorage.setItem(Vg,hk(p))}catch{}},[p]);const f=N.useMemo(()=>[...u.values()].some(ou),[u]);N.useEffect(()=>{if(!f)return;const x=M=>{M.preventDefault(),M.returnValue=""};return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[f]),N.useEffect(()=>{const x=c.current;return()=>{for(const M of x.values())window.clearTimeout(M)}},[]);const m=N.useCallback((x,M,b)=>{const T=Ys(x,M,b);r(D=>{var B;return new Map(D).set(T,{loaded:((B=D.get(T))==null?void 0:B.loaded)??null,loading:!0,failed:!1})}),M==="file"?n.send({type:"files.read",terminalId:x,path:b}):n.send({type:"plans.read",terminalId:x,fileName:b})},[n]),d=N.useCallback((x,M)=>{v(b=>{const T=b.get(x);if(T===void 0)return b;const D=new Map(b),B=M(T);return B===null?D.delete(x):D.set(x,B),D})},[]),L=N.useCallback(x=>{h(b=>new Set(b).add(x));const M=c.current.get(x);M!==void 0&&window.clearTimeout(M),c.current.set(x,window.setTimeout(()=>{c.current.delete(x),h(b=>{if(!b.has(x))return b;const T=new Set(b);return T.delete(x),T})},_k))},[]);N.useEffect(()=>{const x=(T,D)=>r(B=>B.has(T)?new Map(B).set(T,{loaded:D,loading:!1,failed:!1}):B),M=n.onMessage(T=>{switch(T.type){case"files.preview":x(Ys(T.terminalId,"file",T.preview.path),{kind:"file",preview:T.preview});break;case"plans.content":x(Ys(T.terminalId,"plan",T.plan.fileName),{kind:"plan",plan:T.plan});break;case"files.saved":{const D=g.current.get(T.requestId);if(D===void 0)break;g.current.delete(T.requestId);const{id:B}=D,{preview:O}=T;if(O!==null&&x(B,{kind:"file",preview:O}),T.outcome==="saved")d(B,()=>null),L(B);else{const F=O!==null&&O.editable===!0?O:null;d(B,U=>({...U,saving:!1,conflict:{next:F}}))}break}case"error":{const D=T.requestId===void 0?void 0:g.current.get(T.requestId);if(D!==void 0&&T.requestId!==void 0){g.current.delete(T.requestId),d(D.id,B=>({...B,saving:!1,failure:{kind:"server",text:T.text}}));break}r(B=>{if(![...B.values()].some(F=>F.loading))return B;const O=new Map;for(const[F,U]of B)O.set(F,U.loading?{...U,loading:!1,failed:!0}:U);return O});break}}}),b=n.onReopen(()=>{for(const[T,D]of w.current){if(!D.loading)continue;const[B,O,F]=T.split("\0");B===void 0||F===void 0||(O==="file"&&n.send({type:"files.read",terminalId:B,path:F}),O==="plan"&&n.send({type:"plans.read",terminalId:B,fileName:F}))}for(const[T,D]of g.current){if(!D.sent){D.sent=!0;continue}g.current.delete(T),d(D.id,B=>({...B,saving:!1,failure:{kind:"lost"}}))}});return()=>{M(),b()}},[n,d,L]);const I=N.useCallback(x=>{const M=i,b=M===null?su(ho,"",x):su(p,M,x),T=q=>M===null?null:Ys(M,x,q),D=q=>{M!==null&&k(G=>ak(G,M,x,q(su(G,M,x))))},B=q=>{const G=T(q);return G!==null&&ou(u.get(G))},O=()=>new Set(b.docs.filter(q=>B(q.key)).map(q=>q.key)),F=q=>D(G=>ok(G,q)),U=q=>{const G=T(q);if(x!=="file"||!a||M===null||G===null)return null;const Y=u.get(G)??null;return{edit:Y,unsaved:ou(Y??void 0),justSaved:_.has(G),begin:()=>{var H;const W=(H=C.get(G))==null?void 0:H.loaded;if((W==null?void 0:W.kind)!=="file"||W.preview.editable!==!0||W.preview.hash===void 0)return;const{hash:j}=W.preview,$=Mu(W.preview.text);v(V=>V.has(G)?V:new Map(V).set(G,{opened:$,baseHash:j,text:$,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:W=>d(G,j=>j.conflict!==null?j:{...j,text:W,failure:null}),save:()=>{const W=E.current.get(G);if(W===void 0||W.saving||W.conflict!==null||W.text===W.opened)return;const j=crypto.randomUUID(),$=n.send({type:"files.write",terminalId:M,requestId:j,path:q,text:W.text,baseHash:W.baseHash});g.current.set(j,{id:G,sent:$}),d(G,H=>({...H,saving:!0,failure:null}))},discard:()=>{const W=E.current.get(G);d(G,()=>null),W!==void 0&&W.conflict!==null&&W.conflict.next===null&&m(M,x,q)},adopt:()=>d(G,W=>{var te;const j=((te=W.conflict)==null?void 0:te.next)??null;if(j===null||j.hash===void 0)return W;const $=mk(W.opened,W.text),H=$.length===0?W.pending:W.pending===null?$:[...W.pending,qg,...$],V=Mu(j.text);return{...W,opened:V,baseHash:j.hash,text:V,failure:null,conflict:null,pending:H,closing:!1}}),dismissPending:()=>d(G,W=>({...W,pending:null})),confirmClose:()=>{d(G,()=>null),F(q)},keepEditing:()=>d(G,W=>({...W,closing:!1}))}};return{terminalId:M,docs:b.docs,active:b.active,open:q=>{if(M===null)return;const G=O();D(Y=>rk(Y,q,G)),m(M,x,q.key)},select:q=>D(G=>Dp(G,q)),showList:()=>D(ik),close:F,requestClose:q=>{const G=T(q);if(G===null||!B(q)){F(q);return}D(Y=>Dp(Y,q)),d(G,Y=>({...Y,closing:!0}))},setMode:(q,G)=>D(Y=>lk(Y,q,G)),content:q=>M===null?void 0:C.get(Ys(M,x,q)),reload:q=>{M!==null&&m(M,x,q)},rememberScroll:(q,G)=>{M!==null&&R.current.set(Ys(M,x,q),G)},scrollOf:q=>M===null?void 0:R.current.get(Ys(M,x,q)),editorFor:U,unsaved:B}},[i,p,C,u,_,a,n,m,d]);return N.useMemo(()=>({files:I("file"),plans:I("plan")}),[I])}const bk=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,Sk=/[\n\r\t*?<>|"`]/,Ck=/\.[A-Za-z0-9_-]{1,12}$/,Kg=n=>n.replace(/\\/g,"/"),xk=n=>n.replace(/\/+$/,"");function Op(n,t){const i=xk(Kg(t.cwd));return i.length===0?null:(t.platform==="win32"?n.toLowerCase().startsWith(`${i.toLowerCase()}/`):n.startsWith(`${i}/`))?n.slice(i.length+1):null}function Yu(n,t){let i=n.trim();const a=/^(["'])(.*)\1$/.exec(i);if(a!==null&&(i=(a[2]??"").trim()),i.startsWith("@")&&(i=i.slice(1)),i.length===0||i.length>hw||Sk.test(i)||i.includes("://")||i.startsWith("~")||i.startsWith("-")||(i=Kg(i.replace(bk,"")).replace(/[.,;:]+$/,""),i.length===0))return null;const p=t.platform==="win32";if(/^[A-Za-z]:\//.test(i)||i.startsWith("//")){const r=p?Op(i,t):null;if(r===null)return null;i=r}else if(i.startsWith("/")){const r=p?null:Op(i,t);if(r===null)return null;i=r}const k=[];for(const r of i.split("/"))if(!(r===""||r===".")){if(r===".."){if(k.length===0)return null;k.pop();continue}if(r.includes(":")||r!==r.trim())return null;k.push(r)}const C=k[k.length-1];return C===void 0||k.length===1&&!Ck.test(C)?null:k.join("/")}function Gg(n,t){var p;const i=((p=n.split("#")[0])==null?void 0:p.split("?")[0])??"";if(i.length===0)return null;let a;try{a=decodeURIComponent(i)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(a)?null:Yu(a,t)}const kk=/`([^`\n]+)`/g,Ek=/\]\(([^)\s]+)\)/g;function Lk(n,t){const i=new Set;for(const a of n.matchAll(kk)){const p=Yu(a[1]??"",t);p!==null&&i.add(p)}for(const a of n.matchAll(Ek)){const p=Gg(a[1]??"",t);p!==null&&i.add(p)}return[...i]}function Tk(n,t,i){return n.filter(a=>t.get(a)!==!0&&!i.has(a))}function Rk(n,t,i){const a=new Set(i),p=new Map(n);for(const k of t)p.set(k,a.has(k));return p}const Mk=1e3;function Ak(n){const{connection:t,enabled:i,terminalId:a,cwd:p,platform:k,events:C,liveTerminalIds:r,onOpen:u}=n,v=N.useRef(new Map),_=N.useRef(new Map),h=N.useRef(0),[w,E]=N.useState(0),[R,g]=N.useState(0),c=N.useMemo(()=>({cwd:p,platform:k}),[p,k]);return N.useEffect(()=>{const f=t.onMessage(d=>{if(d.type!=="files.checked")return;const L=_.current.get(d.requestId);if(L===void 0)return;_.current.delete(d.requestId);const I=v.current.get(L.terminalId);if(I!==void 0){for(const x of L.paths)I.pending.delete(x);I.known=Rk(I.known,L.paths,d.existing),E(x=>x+1)}}),m=t.onReopen(()=>{_.current.clear();for(const d of v.current.values())d.pending.clear(),d.scanned=new WeakSet;g(d=>d+1)});return()=>{f(),m()}},[t]),N.useEffect(()=>{const f=new Set(r);for(const m of[...v.current.keys()])f.has(m)||v.current.delete(m)},[r]),N.useEffect(()=>{if(!i||a===null||p.length===0)return;let f=v.current.get(a);f===void 0&&(f={known:new Map,pending:new Set,scanned:new WeakSet},v.current.set(a,f));const m=new Set;for(const L of C)if(!f.scanned.has(L)&&(f.scanned.add(L),L.role==="assistant")){for(const I of L.parts)if(I.kind==="text")for(const x of Lk(I.text,c))m.add(x)}const d=Tk([...m],f.known,f.pending).slice(0,Mk);for(let L=0;L<d.length;L+=xf){const I=d.slice(L,L+xf);h.current+=1;const x=`files-${h.current}`;_.current.set(x,{terminalId:a,paths:I});for(const M of I)f.pending.add(M);t.send({type:"files.check",terminalId:a,requestId:x,paths:I})}},[t,i,a,p,c,C,R]),N.useMemo(()=>{var d;if(!i||a===null)return null;const f=(d=v.current.get(a))==null?void 0:d.known,m=L=>L!==null&&(f==null?void 0:f.get(L))===!0?()=>u(L):null;return{code:L=>m(Yu(L,c)),link:L=>m(Gg(L,c))}},[i,a,c,u,w])}function Nk(n,t){const[i,a]=N.useState(Oc),[p,k]=N.useState(null),[C,r]=N.useState(!1);N.useEffect(()=>{if(t===null){a(Oc),k(null);return}a(Oc),k(null),r(!1);const h=n.onMessage(E=>{switch(E.type){case"git.status":E.terminalId===t&&a(E.status);break;case"git.diff":if(E.terminalId!==t)break;k(E.diff),r(!1);break;case"error":r(!1);break}});n.send({type:"git.subscribe",terminalId:t});const w=n.onReopen(()=>{n.send({type:"git.subscribe",terminalId:t})});return()=>{h(),w(),n.send({type:"git.unsubscribe",terminalId:t})}},[n,t]);const u=N.useCallback((h,w)=>{t!==null&&(r(!0),k(null),n.send({type:"git.diff",terminalId:t,path:h,staged:w}))},[n,t]),v=N.useCallback(()=>{k(null),r(!1)},[]),_=N.useCallback(()=>{t!==null&&n.send({type:"git.refresh",terminalId:t})},[n,t]);return{status:i,diff:p,loadingDiff:C,openDiff:u,closeDiff:v,refresh:_}}const Nu=new Set;function Dk(n){return n!==void 0&&Nu.has(n)}function Ik(n){return n.length===0?S("memory.result.nothingChanged"):S("memory.result.installed",{count:n.length})}function jk(n,t){const i=n.length===0?S("memory.result.nothingImported"):S("memory.result.imported",{count:n.length});return t.length===0?i:S("memory.result.withSkipped",{result:i,skipped:S("memory.result.skipped",{count:t.length,files:t.join(", ")})})}function Pk(n,t){const[i,a]=N.useState(null),[p,k]=N.useState(null),[C,r]=N.useState(null),[u,v]=N.useState(null),[_,h]=N.useState(null),[w,E]=N.useState(null),[R,g]=N.useState(null),c=N.useRef(new Map),f=N.useRef(new Set),m=N.useRef(null),d=N.useRef(!1),L=N.useCallback(U=>{const q=`memory-${crypto.randomUUID()}`;return c.current.set(q,U),f.current.add(q),Nu.add(q),q},[]),I=N.useCallback(U=>{for(const[q,G]of c.current)G===U&&c.current.delete(q)},[]);N.useEffect(()=>{a(null),k(null),r(null),v(null),h(null),E(null),g(null),c.current.clear();for(const j of f.current)Nu.delete(j);if(f.current.clear(),m.current=null,d.current=!1,t===null)return;const U=(j,$)=>j===void 0||c.current.get(j)!==$?!1:(c.current.delete(j),!0),q=n.onMessage(j=>{switch(j.type){case"memory.status":if(j.terminalId!==t)break;a(j.status),d.current&&(d.current=!1,g(null));break;case"memory.planned":if(j.terminalId!==t||!U(j.requestId,"plan"))break;v(j.changes),h(null);break;case"memory.installed":if(j.terminalId!==t||!U(j.requestId,"install"))break;m.current=null,v(null),h(null),E(Ik(j.applied));break;case"memory.imported":if(j.terminalId!==t||!U(j.requestId,"import"))break;h(null),E(jk(j.copied,j.skipped));break;case"memory.content":if(j.terminalId!==t||!U(j.requestId,"read"))break;k(j.note),r(null);break;case"error":{const $=j.requestId,H=$===void 0?void 0:c.current.get($);if($===void 0||H===void 0)break;c.current.delete($),H==="read"?r(null):H!=="subscribe"&&h(null),g(Dt(j.text)),d.current=H==="subscribe";break}}}),G=n.onStatus(j=>{if(j!=="reconnecting"&&j!=="failed")return;const $=new Set(c.current.values());c.current.clear(),h(null),r(null),($.has("install")||$.has("import"))&&(m.current=null,v(null),g(S("memory.error.connectionLost")))}),Y=()=>{n.send({type:"memory.subscribe",terminalId:t,requestId:L("subscribe")})};Y();const W=n.onReopen(Y);return()=>{q(),G(),W(),n.send({type:"memory.unsubscribe",terminalId:t})}},[n,t,L]);const x=N.useCallback(()=>{d.current=!1,g(null),E(null)},[]),M=N.useCallback(U=>{t!==null&&(I("read"),x(),r(U),k(null),n.send({type:"memory.read",terminalId:t,name:U,requestId:L("read")}))},[n,t,x,I,L]),b=N.useCallback(()=>{I("read"),k(null),r(null)},[I]),T=N.useCallback(U=>{t!==null&&(x(),m.current=U,v(null),h("plan"),n.send({type:"memory.plan",terminalId:t,options:U,requestId:L("plan")}))},[n,t,x,L]),D=N.useCallback(()=>{const U=m.current;t===null||U===null||(x(),h("install"),n.send({type:"memory.install",terminalId:t,options:U,requestId:L("install")}))},[n,t,x,L]),B=N.useCallback(()=>{t!==null&&(x(),h("import"),n.send({type:"memory.import",terminalId:t,requestId:L("import")}))},[n,t,x,L]),O=N.useCallback(()=>{I("plan"),m.current=null,v(null)},[I]),F=N.useCallback(()=>{d.current=!1,g(null),E(null)},[]);return{status:i,open:p,loading:C,planned:u,busy:_,lastResult:w,error:R,openNote:M,closeNote:b,requestPlan:T,install:D,importNative:B,cancelPlan:O,dismissMessage:F}}function Ok(n){const[t,i]=N.useState([]),[a,p]=N.useState({}),[k,C]=N.useState(null),r=N.useRef(new Set);N.useEffect(()=>{const c=n.onMessage(m=>{switch(m.type){case"notes.list":i(m.notes);break;case"notes.imageData":r.current.add(m.imageId),p(d=>({...d,[m.imageId]:m.data===null?null:`data:${m.mediaType};base64,${m.data}`}));break;case"error":m.code==="notes-failed"&&C(Dt(m.text));break}}),f=n.onReopen(()=>{r.current.clear()});return()=>{c(),f()}},[n]);const u=N.useCallback(c=>{r.current.has(c)||(r.current.add(c),n.send({type:"notes.image",imageId:c}))},[n]),v=N.useCallback(()=>{const c=crypto.randomUUID(),f=Date.now();return i(m=>[...m,{noteId:c,text:"",images:[],createdAt:f,updatedAt:f}]),n.send({type:"notes.create",noteId:c}),c},[n]),_=N.useCallback((c,f)=>{i(m=>m.map(d=>d.noteId===c?{...d,text:f,updatedAt:Date.now()}:d)),n.send({type:"notes.update",noteId:c,text:f})},[n]),h=N.useCallback(c=>{i(f=>f.filter(m=>m.noteId!==c)),n.send({type:"notes.delete",noteId:c})},[n]),w=N.useCallback((c,f)=>{const m=t.find(L=>L.noteId===c);if(m!==void 0&&m.images.length>=bf){C(S("notes.tooManyImages",{count:bf}));return}if(f.size>$l){C(S("notes.imageTooBig",{name:f.name||S("notes.imageFallbackName"),size:Math.round(f.size/1024/1024),max:$l/1024/1024}));return}const d=new FileReader;d.onload=()=>{const L=d.result;if(typeof L!="string")return;const I=L.indexOf(",");I!==-1&&n.send({type:"notes.addImage",noteId:c,image:{mediaType:f.type,data:L.slice(I+1)}})},d.onerror=()=>C(S("notes.readFailed")),d.readAsDataURL(f)},[n,t]),E=N.useCallback((c,f)=>{i(m=>m.map(d=>d.noteId===c?{...d,images:d.images.filter(L=>L.imageId!==f)}:d)),n.send({type:"notes.removeImage",noteId:c,imageId:f})},[n]),R=N.useCallback((c,f)=>{n.send({type:"notes.send",noteId:c,terminalId:f})},[n]),g=N.useCallback(()=>C(null),[]);return{notes:t,images:a,problem:k,requestImage:u,create:v,updateText:_,remove:h,addImage:w,removeImage:E,sendToAgent:R,dismissProblem:g}}const Yg="agent-workbench.theme",lu=["system","light","dark"],Bk={system:"theme.system",light:"theme.light",dark:"theme.dark"};function Bp(n){return S("theme.title",{theme:S(Bk[n])})}const Fp={system:"◐",light:"☀",dark:"☾"};function Fk(){return xt(Yg,"system",n=>n==="light"||n==="dark"||n==="system"?n:null)}function Hk(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function $k(){const[n,t]=N.useState(Fk),[i,a]=N.useState(Hk);N.useEffect(()=>{const C=window.matchMedia("(prefers-color-scheme: dark)"),r=u=>a(u.matches);return C.addEventListener("change",r),()=>C.removeEventListener("change",r)},[]);const p=n==="system"?i?"dark":"light":n;N.useEffect(()=>{document.documentElement.dataset.theme=p,document.documentElement.style.colorScheme=p},[p]);const k=N.useCallback(()=>{t(C=>{const r=lu[(lu.indexOf(C)+1)%lu.length]??"system";return wt(Yg,r),r})},[]);return{preference:n,resolved:p,cycle:k}}const Hp="agent-workbench.terminalTheme";function Uk(n){return n==="dark"||n==="follow"?n:null}function Wk(n,t){return n==="follow"?t:"dark"}function zk(n){const[t,i]=N.useState(()=>xt(Hp,"dark",Uk)),a=Wk(t,n);N.useEffect(()=>{document.documentElement.dataset.terminalTheme=a},[a]);const p=N.useCallback(k=>{wt(Hp,k),i(k)},[]);return{preference:t,resolved:a,setPreference:p}}const qk=1500;function Vk(n,t){return n===void 0||n===t?null:t==="waiting"?"attention":t==="idle"&&n==="busy"?"done":null}function Kk(n,t){const i={now:[],later:[],cancel:[]};for(const[a,p]of t){const k=n.get(a);if(k===p)continue;i.cancel.push(a);const C=Vk(k,p);C==="attention"?i.now.push(a):C==="done"&&i.later.push(a)}for(const a of n.keys())t.has(a)||i.cancel.push(a);return i}const $p="agent-workbench.phone-chime";function Gk(n){return n==="system"||n==="page"?n:null}function Yk(n){return`agentworkbench://chime?source=${n}`}function Xk(n,t,i,a){return n?t==="page"?Jl:null:i?go(a):null}const Up="agent-workbench.sound";function Qk(n){return n==="on"?!0:n==="off"?!1:null}function Jk(n){return S(n?"sound.on":"sound.off")}function Zk(n,t){return n&&t>0}const eE={done:[{frequency:880,at:0,duration:.18},{frequency:659.25,at:.14,duration:.28}],attention:[{frequency:659.25,at:0,duration:.18},{frequency:987.77,at:.14,duration:.28}]},Xg=.02,Jl=.8,Qg=.2,Wp="agent-workbench.sound-volume";function go(n){return Math.min(Jl,Math.max(Xg,n))}function tE(n){if(n.trim().length===0)return null;const t=Number(n);return Number.isFinite(t)?go(t):null}function nE(n){return Math.round(go(n)/Jl*100)}class sE{constructor(){jt(this,"context",null);jt(this,"volume",Qg)}unlock(){typeof window>"u"||typeof window.AudioContext!="function"||(this.context??(this.context=new window.AudioContext),this.context.state==="suspended"&&this.context.resume().catch(()=>{}))}get ready(){var t;return((t=this.context)==null?void 0:t.state)==="running"}play(t){const i=this.context;if(i===null||i.state!=="running")return;const a=i.currentTime+.01;for(const p of eE[t]){const k=i.createOscillator(),C=i.createGain();k.type="sine",k.frequency.value=p.frequency;const r=a+p.at;C.gain.setValueAtTime(1e-4,r),C.gain.exponentialRampToValueAtTime(go(this.volume),r+.012),C.gain.exponentialRampToValueAtTime(1e-4,r+p.duration),k.connect(C),C.connect(i.destination),k.start(r),k.stop(r+p.duration+.02)}}}const au="agent-workbench.notify";function rE(n){return n==="on"?!0:n==="off"?!1:null}function iE(n,t,i){return n&&t==="granted"&&!i}function oE(n,t){return S(t==="denied"?"sound.notify.blocked":n?"sound.notify.on":"sound.notify.off")}function lE(n,t){return n==="attention"?S("notify.attention",{tab:t}):S("notify.done",{tab:t})}function aE(n){return n===void 0?"":n.label.length>0?n.label:n.cwd.split(/[\\/]/).filter(t=>t.length>0).pop()??n.cwd}function oo(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function cE(){if(oo()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return oo()}}function uE(){return document.visibilityState==="visible"&&document.hasFocus()}function hE(n){try{const t=new Notification("Agent Workbench",{body:lE(n.chime,n.tabName),tag:`agent-workbench:${n.terminalId}`});t.onclick=()=>{window.focus(),n.onClick(),t.close()}}catch{}}function dE(n,t){const[i,a]=N.useState(()=>xt(Up,!0,Qk)),p=N.useRef(i);p.current=i;const[k,C]=N.useState(()=>xt(Wp,Qg,tE)),r=N.useRef(k);r.current=k;const[u]=N.useState(()=>typeof navigator<"u"&&ng(navigator.userAgent)),[v,_]=N.useState(()=>xt($p,"system",Gk)),h=N.useRef(v);h.current=v;const[w,E]=N.useState(()=>oo()),[R,g]=N.useState(()=>xt(au,!1,rE)),c=N.useRef(R);c.current=R;const f=N.useRef(t);f.current=t;const m=N.useCallback((W,j)=>{iE(c.current,oo(),uE())&&hE({chime:W,terminalId:j,tabName:f.current.nameOf(j),onClick:()=>f.current.activate(j)})},[]),d=N.useRef(null),L=N.useRef(new Map),I=N.useRef(new Map),[x,M]=N.useState(()=>new Set),b=N.useRef(new Map),T=N.useCallback(W=>{const j=b.current,$=j.get(W);$!==void 0&&window.clearTimeout($),M(H=>H.has(W)?H:new Set(H).add(W)),j.set(W,window.setTimeout(()=>{j.delete(W),M(H=>{if(!H.has(W))return H;const V=new Set(H);return V.delete(W),V})},pg))},[]),D=N.useCallback(W=>{const j=d.current,$=Xk(u,h.current,p.current,r.current);j===null||$===null||(j.volume=$,j.play(W))},[u]);N.useEffect(()=>{const W=new sE;W.volume=r.current,d.current=W;const j=()=>{W.unlock(),W.ready&&(window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",j))};return window.addEventListener("pointerdown",j),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",j),d.current=null}},[]),N.useEffect(()=>{const W=Kk(L.current,n);L.current=new Map(n);const j=I.current;for(const $ of W.cancel){const H=j.get($);H!==void 0&&(window.clearTimeout(H),j.delete($))}W.now.length>0&&D("attention");for(const $ of W.now)m("attention",$),T($);for(const $ of W.later)j.set($,window.setTimeout(()=>{j.delete($),D("done"),m("done",$),T($)},qk))},[n,m,D,T]),N.useEffect(()=>{const W=I.current,j=b.current;return()=>{for(const $ of W.values())window.clearTimeout($);W.clear();for(const $ of j.values())window.clearTimeout($);j.clear()}},[]);const B=N.useCallback(()=>{var W,j;a($=>{const H=!$;return wt(Up,H?"on":"off"),H}),p.current||((W=d.current)==null||W.unlock(),(j=d.current)==null||j.play("done"))},[]),O=N.useCallback(W=>{const j=go(W);C(j),wt(Wp,String(j)),d.current!==null&&(d.current.volume=j)},[]),F=N.useCallback(()=>{var W,j;p.current&&((W=d.current)==null||W.unlock(),(j=d.current)==null||j.play("done"))},[]),U=N.useCallback(()=>{if(c.current&&oo()==="granted"){g(!1),wt(au,"off");return}cE().then(W=>{E(W),W==="granted"&&(g(!0),wt(au,"on"))})},[]),q={supported:w!=="unsupported",enabled:R&&w==="granted",permission:w,toggle:U},G=N.useCallback(W=>{var j;_(W),h.current=W,wt($p,W),window.location.href=Yk(W),W==="page"&&((j=d.current)==null||j.unlock(),D("done"))},[D]);return{enabled:i,toggle:B,volume:k,setVolume:O,previewVolume:F,notify:q,phoneChime:u?{source:v,setSource:G}:null,attention:x}}function Jg(n,t,i){const[a,p]=N.useState(()=>xt(n,t,Vb));N.useLayoutEffect(()=>{document.documentElement.dataset[i]=a},[i,a]);const k=N.useCallback(()=>{p(C=>{const r=fg(C);return wt(n,r),r})},[n]);return{size:a,cycle:k}}function fE(){return Jg(Ub,dg,"threadFont")}function pE(){return Jg(Wb,zb,"notesFont")}function mE(n,t){const[i,a]=N.useState(()=>new Map),[p,k]=N.useState(()=>new Map),C=N.useCallback((u,v,_,h)=>{a(w=>new Map(w).set(u,{requestId:v,terminalId:u,afterEventId:_,phase:"sending",queued:h,sentAt:Date.now(),deliveredAt:null}))},[]);N.useEffect(()=>{const u=n.onMessage(_=>{_.type==="agent.submitted"&&a(h=>X1(h,_,Date.now()))}),v=n.onReopen(()=>a(_=>Y1(_,Date.now())));return()=>{u(),v()}},[n]);const r=N.useRef(new Map);return N.useLayoutEffect(()=>{const u=r.current;if(u===t)return;r.current=t;const v=Date.now();k(_=>G1(u,t,_,v))},[t]),{track:C,receipts:i,clocks:p}}const gE=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function Zg({sound:n}){return l.jsxs("span",{className:"sound-control",children:[l.jsx("button",{className:`icon-button${Zk(n.enabled,n.volume)?" icon-button-on":""}`,onClick:n.toggle,title:Jk(n.enabled),"aria-pressed":n.enabled,children:"♪"}),n.enabled&&l.jsx("div",{className:"sound-volume",children:l.jsxs("div",{className:"sound-volume-box",children:[l.jsx("input",{className:"sound-volume-slider",type:"range",min:Xg,max:Jl,step:.01,value:n.volume,onChange:t=>n.setVolume(Number(t.target.value)),onPointerUp:n.previewVolume,onKeyUp:t=>{gE.has(t.key)&&n.previewVolume()},title:S("sound.volume"),"aria-label":S("sound.volume")}),l.jsxs("span",{className:"sound-volume-value",children:[nE(n.volume),"%"]})]})})]})}function ev({notify:n}){return n.supported?l.jsx("button",{className:`icon-button${n.enabled?" icon-button-on":""}`,onClick:n.toggle,title:oE(n.enabled,n.permission),"aria-pressed":n.enabled,children:l.jsx(vE,{})}):null}function vE(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M4 11V7a4 4 0 0 1 8 0v4l1.2 1.5H2.8L4 11zM6.6 14a1.5 1.5 0 0 0 2.8 0",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function _E(n){const[t,i]=N.useState(null),[a,p]=N.useState(null),[k,C]=N.useState(null),[r,u]=N.useState(!1),[v,_]=N.useState(null);N.useEffect(()=>{const L=n.onMessage(x=>{switch(x.type){case"remote.status":i(x.status),x.status.pairingActive||(p(null),C(null));break;case"remote.pairing.code":p(x.pairing),C(null);break;case"remote.phone.pairing":C(x.pairing),p(null);break;case"error":if(x.code!=="remote-failed")break;_(Dt(x.text)),x.detail!==void 0&&console.error("[servidor]",x.detail);break}}),I=n.onReopen(()=>{p(null),C(null),u(!1)});return()=>{L(),I()}},[n]);const h=N.useCallback(L=>{_(null),n.send({type:"remote.configure",enabled:L})},[n]),w=N.useCallback(L=>{_(null),n.send({type:"remote.configure",port:L})},[n]),E=N.useCallback(()=>{_(null),n.send({type:"remote.pairing.start"})},[n]),R=N.useCallback(()=>{p(null),n.send({type:"remote.pairing.cancel"})},[n]),g=N.useCallback(()=>{_(null),u(!0),n.send({type:"remote.phone.start"})},[n]),c=N.useCallback(()=>{C(null),u(!1),n.send({type:"remote.phone.cancel"})},[n]),f=N.useCallback((L,I)=>{_(null),n.send({type:"remote.device.rename",deviceId:L,label:I})},[n]),m=N.useCallback(L=>{_(null),n.send({type:"remote.device.revoke",deviceId:L})},[n]),d=N.useCallback(()=>_(null),[]);return{status:t,pairing:a,phonePairing:k,phoneStarted:r,problem:v,setEnabled:h,setPort:w,startPairing:E,cancelPairing:R,startPhonePairing:g,cancelPhonePairing:c,renameDevice:f,revokeDevice:m,dismissProblem:d}}const wE="USER";function yE(n,t){const i=n.sshUser.length>0?n.sshUser:wE,a=/\s/.test(i)?`"${i}@${t}"`:`${i}@${t}`;return`ssh -N -L ${n.port}:127.0.0.1:${n.port} ${a}`}function tv(n){return`http://localhost:${n}`}function bE(n,t){return`${tv(n)}/?${J0}=${t}`}function zp(n){return n[0]??"localhost"}function Du(n,t){switch(n){case"off":return S("remote.state.off");case"active":return S("remote.state.active",{port:t});case"restart-needed":return S("remote.state.restartNeeded");case"port-busy":return S("remote.state.portBusy",{port:t})}}function SE(n){const t=n.trim();if(!/^\d{1,5}$/.test(t))return null;const i=Number(t);return ew(i)?i:null}function CE(){return S("remote.portInvalid",{min:Lm,max:Tm})}function qp(n,t){return Math.max(0,Math.ceil((n-t)/1e3))}function Vp(n){return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function xE(n,t=Date.now()){return n.connected?S("remote.device.connected"):n.lastSeenAt===null?S("remote.device.never"):S("remote.device.lastSeen",{when:os(n.lastSeenAt,t)})}function kE(n,t=Date.now()){return S("remote.device.paired",{when:os(n.createdAt,t)})}function EE(n){switch(n){case"powershell-admin":return S("remote.phone.authorize.admin");case"powershell":return S("remote.phone.authorize.powershell");case"terminal":return S("remote.phone.authorize.terminal")}}function LE(){return[{platform:"win32",label:"Windows",hint:S("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
|
|
145
|
+
`)},{platform:"darwin",label:"macOS",hint:S("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:S("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
|
|
146
|
+
`)}]}function TE(n){return n==="win32"||n==="darwin"?n:"linux"}function jl(n){return n!==null&&n.state==="active"}function Kp(n){return n!==null&&n.state==="active"&&n.devices.length>0}const ai=function(n,t){let p=n;const k=io[t];let C=null,r=0,u=null;const v=[],_={},h=function(M,b){r=p*4+17,C=(function(T){const D=new Array(T);for(let B=0;B<T;B+=1){D[B]=new Array(T);for(let O=0;O<T;O+=1)D[B][O]=null}return D})(r),w(0,0),w(r-7,0),w(0,r-7),g(),R(),f(M,b),p>=7&&c(M),u==null&&(u=L(p,k,v)),m(u,b)},w=function(M,b){for(let T=-1;T<=7;T+=1)if(!(M+T<=-1||r<=M+T))for(let D=-1;D<=7;D+=1)b+D<=-1||r<=b+D||(0<=T&&T<=6&&(D==0||D==6)||0<=D&&D<=6&&(T==0||T==6)||2<=T&&T<=4&&2<=D&&D<=4?C[M+T][b+D]=!0:C[M+T][b+D]=!1)},E=function(){let M=0,b=0;for(let T=0;T<8;T+=1){h(!0,T);const D=Gs.getLostPoint(_);(T==0||M>D)&&(M=D,b=T)}return b},R=function(){for(let M=8;M<r-8;M+=1)C[M][6]==null&&(C[M][6]=M%2==0);for(let M=8;M<r-8;M+=1)C[6][M]==null&&(C[6][M]=M%2==0)},g=function(){const M=Gs.getPatternPosition(p);for(let b=0;b<M.length;b+=1)for(let T=0;T<M.length;T+=1){const D=M[b],B=M[T];if(C[D][B]==null)for(let O=-2;O<=2;O+=1)for(let F=-2;F<=2;F+=1)O==-2||O==2||F==-2||F==2||O==0&&F==0?C[D+O][B+F]=!0:C[D+O][B+F]=!1}},c=function(M){const b=Gs.getBCHTypeNumber(p);for(let T=0;T<18;T+=1){const D=!M&&(b>>T&1)==1;C[Math.floor(T/3)][T%3+r-8-3]=D}for(let T=0;T<18;T+=1){const D=!M&&(b>>T&1)==1;C[T%3+r-8-3][Math.floor(T/3)]=D}},f=function(M,b){const T=k<<3|b,D=Gs.getBCHTypeInfo(T);for(let B=0;B<15;B+=1){const O=!M&&(D>>B&1)==1;B<6?C[B][8]=O:B<8?C[B+1][8]=O:C[r-15+B][8]=O}for(let B=0;B<15;B+=1){const O=!M&&(D>>B&1)==1;B<8?C[8][r-B-1]=O:B<9?C[8][15-B-1+1]=O:C[8][15-B-1]=O}C[r-8][8]=!M},m=function(M,b){let T=-1,D=r-1,B=7,O=0;const F=Gs.getMaskFunction(b);for(let U=r-1;U>0;U-=2)for(U==6&&(U-=1);;){for(let q=0;q<2;q+=1)if(C[D][U-q]==null){let G=!1;O<M.length&&(G=(M[O]>>>B&1)==1),F(D,U-q)&&(G=!G),C[D][U-q]=G,B-=1,B==-1&&(O+=1,B=7)}if(D+=T,D<0||r<=D){D-=T,T=-T;break}}},d=function(M,b){let T=0,D=0,B=0;const O=new Array(b.length),F=new Array(b.length);for(let Y=0;Y<b.length;Y+=1){const W=b[Y].dataCount,j=b[Y].totalCount-W;D=Math.max(D,W),B=Math.max(B,j),O[Y]=new Array(W);for(let te=0;te<O[Y].length;te+=1)O[Y][te]=255&M.getBuffer()[te+T];T+=W;const $=Gs.getErrorCorrectPolynomial(j),V=fo(O[Y],$.getLength()-1).mod($);F[Y]=new Array($.getLength()-1);for(let te=0;te<F[Y].length;te+=1){const ie=te+V.getLength()-F[Y].length;F[Y][te]=ie>=0?V.getAt(ie):0}}let U=0;for(let Y=0;Y<b.length;Y+=1)U+=b[Y].totalCount;const q=new Array(U);let G=0;for(let Y=0;Y<D;Y+=1)for(let W=0;W<b.length;W+=1)Y<O[W].length&&(q[G]=O[W][Y],G+=1);for(let Y=0;Y<B;Y+=1)for(let W=0;W<b.length;W+=1)Y<F[W].length&&(q[G]=F[W][Y],G+=1);return q},L=function(M,b,T){const D=Gp.getRSBlocks(M,b),B=Yp();for(let F=0;F<T.length;F+=1){const U=T[F];B.put(U.getMode(),4),B.put(U.getLength(),Gs.getLengthInBits(U.getMode(),M)),U.write(B)}let O=0;for(let F=0;F<D.length;F+=1)O+=D[F].dataCount;if(B.getLengthInBits()>O*8)throw"code length overflow. ("+B.getLengthInBits()+">"+O*8+")";for(B.getLengthInBits()+4<=O*8&&B.put(0,4);B.getLengthInBits()%8!=0;)B.putBit(!1);for(;!(B.getLengthInBits()>=O*8||(B.put(236,8),B.getLengthInBits()>=O*8));)B.put(17,8);return d(B,D)};_.addData=function(M,b){b=b||"Byte";let T=null;switch(b){case"Numeric":T=RE(M);break;case"Alphanumeric":T=ME(M);break;case"Byte":T=AE(M);break;case"Kanji":T=NE(M);break;default:throw"mode:"+b}v.push(T),u=null},_.isDark=function(M,b){if(M<0||r<=M||b<0||r<=b)throw M+","+b;return C[M][b]},_.getModuleCount=function(){return r},_.make=function(){if(p<1){let M=1;for(;M<40;M++){const b=Gp.getRSBlocks(M,k),T=Yp();for(let B=0;B<v.length;B++){const O=v[B];T.put(O.getMode(),4),T.put(O.getLength(),Gs.getLengthInBits(O.getMode(),M)),O.write(T)}let D=0;for(let B=0;B<b.length;B++)D+=b[B].dataCount;if(T.getLengthInBits()<=D*8)break}p=M}h(!1,E())},_.createTableTag=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;let T="";T+='<table style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: "+b+"px;",T+='">',T+="<tbody>";for(let D=0;D<_.getModuleCount();D+=1){T+="<tr>";for(let B=0;B<_.getModuleCount();B+=1)T+='<td style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: 0px;",T+=" width: "+M+"px;",T+=" height: "+M+"px;",T+=" background-color: ",T+=_.isDark(D,B)?"#000000":"#ffffff",T+=";",T+='"/>';T+="</tr>"}return T+="</tbody>",T+="</table>",T},_.createSvgTag=function(M,b,T,D){let B={};typeof arguments[0]=="object"&&(B=arguments[0],M=B.cellSize,b=B.margin,T=B.alt,D=B.title),M=M||2,b=typeof b>"u"?M*4:b,T=typeof T=="string"?{text:T}:T||{},T.text=T.text||null,T.id=T.text?T.id||"qrcode-description":null,D=typeof D=="string"?{text:D}:D||{},D.text=D.text||null,D.id=D.text?D.id||"qrcode-title":null;const O=_.getModuleCount()*M+b*2;let F,U,q,G,Y="",W;for(W="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",Y+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',Y+=B.scalable?"":' width="'+O+'px" height="'+O+'px"',Y+=' viewBox="0 0 '+O+" "+O+'" ',Y+=' preserveAspectRatio="xMinYMin meet"',Y+=D.text||T.text?' role="img" aria-labelledby="'+I([D.id,T.id].join(" ").trim())+'"':"",Y+=">",Y+=D.text?'<title id="'+I(D.id)+'">'+I(D.text)+"</title>":"",Y+=T.text?'<description id="'+I(T.id)+'">'+I(T.text)+"</description>":"",Y+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',Y+='<path d="',q=0;q<_.getModuleCount();q+=1)for(G=q*M+b,F=0;F<_.getModuleCount();F+=1)_.isDark(q,F)&&(U=F*M+b,Y+="M"+U+","+G+W);return Y+='" stroke="transparent" fill="black"/>',Y+="</svg>",Y},_.createDataURL=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;const T=_.getModuleCount()*M+b*2,D=b,B=T-b;return PE(T,T,function(O,F){if(D<=O&&O<B&&D<=F&&F<B){const U=Math.floor((O-D)/M),q=Math.floor((F-D)/M);return _.isDark(q,U)?0:1}else return 1})},_.createImgTag=function(M,b,T){M=M||2,b=typeof b>"u"?M*4:b;const D=_.getModuleCount()*M+b*2;let B="";return B+="<img",B+=' src="',B+=_.createDataURL(M,b),B+='"',B+=' width="',B+=D,B+='"',B+=' height="',B+=D,B+='"',T&&(B+=' alt="',B+=I(T),B+='"'),B+="/>",B};const I=function(M){let b="";for(let T=0;T<M.length;T+=1){const D=M.charAt(T);switch(D){case"<":b+="<";break;case">":b+=">";break;case"&":b+="&";break;case'"':b+=""";break;default:b+=D;break}}return b},x=function(M){M=typeof M>"u"?2:M;const T=_.getModuleCount()*1+M*2,D=M,B=T-M;let O,F,U,q,G;const Y={"██":"█","█ ":"▀"," █":"▄"," ":" "},W={"██":"▀","█ ":"▀"," █":" "," ":" "};let j="";for(O=0;O<T;O+=2){for(U=Math.floor((O-D)/1),q=Math.floor((O+1-D)/1),F=0;F<T;F+=1)G="█",D<=F&&F<B&&D<=O&&O<B&&_.isDark(U,Math.floor((F-D)/1))&&(G=" "),D<=F&&F<B&&D<=O+1&&O+1<B&&_.isDark(q,Math.floor((F-D)/1))?G+=" ":G+="█",j+=M<1&&O+1>=B?W[G]:Y[G];j+=`
|
|
147
|
+
`}return T%2&&M>0?j.substring(0,j.length-T-1)+Array(T+1).join("▀"):j.substring(0,j.length-1)};return _.createASCII=function(M,b){if(M=M||1,M<2)return x(b);M-=1,b=typeof b>"u"?M*2:b;const T=_.getModuleCount()*M+b*2,D=b,B=T-b;let O,F,U,q;const G=Array(M+1).join("██"),Y=Array(M+1).join(" ");let W="",j="";for(O=0;O<T;O+=1){for(U=Math.floor((O-D)/M),j="",F=0;F<T;F+=1)q=1,D<=F&&F<B&&D<=O&&O<B&&_.isDark(U,Math.floor((F-D)/M))&&(q=0),j+=q?G:Y;for(U=0;U<M;U+=1)W+=j+`
|
|
148
|
+
`}return W.substring(0,W.length-1)},_.renderTo2dContext=function(M,b){b=b||2;const T=_.getModuleCount();for(let D=0;D<T;D++)for(let B=0;B<T;B++)M.fillStyle=_.isDark(D,B)?"black":"white",M.fillRect(B*b,D*b,b,b)},_};ai.stringToBytes=function(n){const t=[];for(let i=0;i<n.length;i+=1){const a=n.charCodeAt(i);t.push(a&255)}return t};ai.createStringToBytes=function(n,t){const i=(function(){const p=IE(n),k=function(){const u=p.read();if(u==-1)throw"eof";return u};let C=0;const r={};for(;;){const u=p.read();if(u==-1)break;const v=k(),_=k(),h=k(),w=String.fromCharCode(u<<8|v),E=_<<8|h;r[w]=E,C+=1}if(C!=t)throw C+" != "+t;return r})(),a=63;return function(p){const k=[];for(let C=0;C<p.length;C+=1){const r=p.charCodeAt(C);if(r<128)k.push(r);else{const u=i[p.charAt(C)];typeof u=="number"?(u&255)==u?k.push(u):(k.push(u>>>8),k.push(u&255)):k.push(a)}}return k}};const en={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},io={L:1,M:0,Q:3,H:2},Ks={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Gs=(function(){const n=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,i=7973,a=21522,p={},k=function(C){let r=0;for(;C!=0;)r+=1,C>>>=1;return r};return p.getBCHTypeInfo=function(C){let r=C<<10;for(;k(r)-k(t)>=0;)r^=t<<k(r)-k(t);return(C<<10|r)^a},p.getBCHTypeNumber=function(C){let r=C<<12;for(;k(r)-k(i)>=0;)r^=i<<k(r)-k(i);return C<<12|r},p.getPatternPosition=function(C){return n[C-1]},p.getMaskFunction=function(C){switch(C){case Ks.PATTERN000:return function(r,u){return(r+u)%2==0};case Ks.PATTERN001:return function(r,u){return r%2==0};case Ks.PATTERN010:return function(r,u){return u%3==0};case Ks.PATTERN011:return function(r,u){return(r+u)%3==0};case Ks.PATTERN100:return function(r,u){return(Math.floor(r/2)+Math.floor(u/3))%2==0};case Ks.PATTERN101:return function(r,u){return r*u%2+r*u%3==0};case Ks.PATTERN110:return function(r,u){return(r*u%2+r*u%3)%2==0};case Ks.PATTERN111:return function(r,u){return(r*u%3+(r+u)%2)%2==0};default:throw"bad maskPattern:"+C}},p.getErrorCorrectPolynomial=function(C){let r=fo([1],0);for(let u=0;u<C;u+=1)r=r.multiply(fo([1,Xs.gexp(u)],0));return r},p.getLengthInBits=function(C,r){if(1<=r&&r<10)switch(C){case en.MODE_NUMBER:return 10;case en.MODE_ALPHA_NUM:return 9;case en.MODE_8BIT_BYTE:return 8;case en.MODE_KANJI:return 8;default:throw"mode:"+C}else if(r<27)switch(C){case en.MODE_NUMBER:return 12;case en.MODE_ALPHA_NUM:return 11;case en.MODE_8BIT_BYTE:return 16;case en.MODE_KANJI:return 10;default:throw"mode:"+C}else if(r<41)switch(C){case en.MODE_NUMBER:return 14;case en.MODE_ALPHA_NUM:return 13;case en.MODE_8BIT_BYTE:return 16;case en.MODE_KANJI:return 12;default:throw"mode:"+C}else throw"type:"+r},p.getLostPoint=function(C){const r=C.getModuleCount();let u=0;for(let h=0;h<r;h+=1)for(let w=0;w<r;w+=1){let E=0;const R=C.isDark(h,w);for(let g=-1;g<=1;g+=1)if(!(h+g<0||r<=h+g))for(let c=-1;c<=1;c+=1)w+c<0||r<=w+c||g==0&&c==0||R==C.isDark(h+g,w+c)&&(E+=1);E>5&&(u+=3+E-5)}for(let h=0;h<r-1;h+=1)for(let w=0;w<r-1;w+=1){let E=0;C.isDark(h,w)&&(E+=1),C.isDark(h+1,w)&&(E+=1),C.isDark(h,w+1)&&(E+=1),C.isDark(h+1,w+1)&&(E+=1),(E==0||E==4)&&(u+=3)}for(let h=0;h<r;h+=1)for(let w=0;w<r-6;w+=1)C.isDark(h,w)&&!C.isDark(h,w+1)&&C.isDark(h,w+2)&&C.isDark(h,w+3)&&C.isDark(h,w+4)&&!C.isDark(h,w+5)&&C.isDark(h,w+6)&&(u+=40);for(let h=0;h<r;h+=1)for(let w=0;w<r-6;w+=1)C.isDark(w,h)&&!C.isDark(w+1,h)&&C.isDark(w+2,h)&&C.isDark(w+3,h)&&C.isDark(w+4,h)&&!C.isDark(w+5,h)&&C.isDark(w+6,h)&&(u+=40);let v=0;for(let h=0;h<r;h+=1)for(let w=0;w<r;w+=1)C.isDark(w,h)&&(v+=1);const _=Math.abs(100*v/r/r-50)/5;return u+=_*10,u},p})(),Xs=(function(){const n=new Array(256),t=new Array(256);for(let a=0;a<8;a+=1)n[a]=1<<a;for(let a=8;a<256;a+=1)n[a]=n[a-4]^n[a-5]^n[a-6]^n[a-8];for(let a=0;a<255;a+=1)t[n[a]]=a;const i={};return i.glog=function(a){if(a<1)throw"glog("+a+")";return t[a]},i.gexp=function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return n[a]},i})(),fo=function(n,t){if(typeof n.length>"u")throw n.length+"/"+t;const i=(function(){let p=0;for(;p<n.length&&n[p]==0;)p+=1;const k=new Array(n.length-p+t);for(let C=0;C<n.length-p;C+=1)k[C]=n[C+p];return k})(),a={};return a.getAt=function(p){return i[p]},a.getLength=function(){return i.length},a.multiply=function(p){const k=new Array(a.getLength()+p.getLength()-1);for(let C=0;C<a.getLength();C+=1)for(let r=0;r<p.getLength();r+=1)k[C+r]^=Xs.gexp(Xs.glog(a.getAt(C))+Xs.glog(p.getAt(r)));return fo(k,0)},a.mod=function(p){if(a.getLength()-p.getLength()<0)return a;const k=Xs.glog(a.getAt(0))-Xs.glog(p.getAt(0)),C=new Array(a.getLength());for(let r=0;r<a.getLength();r+=1)C[r]=a.getAt(r);for(let r=0;r<p.getLength();r+=1)C[r]^=Xs.gexp(Xs.glog(p.getAt(r))+k);return fo(C,0).mod(p)},a},Gp=(function(){const n=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(p,k){const C={};return C.totalCount=p,C.dataCount=k,C},i={},a=function(p,k){switch(k){case io.L:return n[(p-1)*4+0];case io.M:return n[(p-1)*4+1];case io.Q:return n[(p-1)*4+2];case io.H:return n[(p-1)*4+3];default:return}};return i.getRSBlocks=function(p,k){const C=a(p,k);if(typeof C>"u")throw"bad rs block @ typeNumber:"+p+"/errorCorrectionLevel:"+k;const r=C.length/3,u=[];for(let v=0;v<r;v+=1){const _=C[v*3+0],h=C[v*3+1],w=C[v*3+2];for(let E=0;E<_;E+=1)u.push(t(h,w))}return u},i})(),Yp=function(){const n=[];let t=0;const i={};return i.getBuffer=function(){return n},i.getAt=function(a){const p=Math.floor(a/8);return(n[p]>>>7-a%8&1)==1},i.put=function(a,p){for(let k=0;k<p;k+=1)i.putBit((a>>>p-k-1&1)==1)},i.getLengthInBits=function(){return t},i.putBit=function(a){const p=Math.floor(t/8);n.length<=p&&n.push(0),a&&(n[p]|=128>>>t%8),t+=1},i},RE=function(n){const t=en.MODE_NUMBER,i=n,a={};a.getMode=function(){return t},a.getLength=function(C){return i.length},a.write=function(C){const r=i;let u=0;for(;u+2<r.length;)C.put(p(r.substring(u,u+3)),10),u+=3;u<r.length&&(r.length-u==1?C.put(p(r.substring(u,u+1)),4):r.length-u==2&&C.put(p(r.substring(u,u+2)),7))};const p=function(C){let r=0;for(let u=0;u<C.length;u+=1)r=r*10+k(C.charAt(u));return r},k=function(C){if("0"<=C&&C<="9")return C.charCodeAt(0)-48;throw"illegal char :"+C};return a},ME=function(n){const t=en.MODE_ALPHA_NUM,i=n,a={};a.getMode=function(){return t},a.getLength=function(k){return i.length},a.write=function(k){const C=i;let r=0;for(;r+1<C.length;)k.put(p(C.charAt(r))*45+p(C.charAt(r+1)),11),r+=2;r<C.length&&k.put(p(C.charAt(r)),6)};const p=function(k){if("0"<=k&&k<="9")return k.charCodeAt(0)-48;if("A"<=k&&k<="Z")return k.charCodeAt(0)-65+10;switch(k){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+k}};return a},AE=function(n){const t=en.MODE_8BIT_BYTE,i=ai.stringToBytes(n),a={};return a.getMode=function(){return t},a.getLength=function(p){return i.length},a.write=function(p){for(let k=0;k<i.length;k+=1)p.put(i[k],8)},a},NE=function(n){const t=en.MODE_KANJI,i=ai.stringToBytes;(function(k,C){const r=i(k);if(r.length!=2||(r[0]<<8|r[1])!=C)throw"sjis not supported."})("友",38726);const a=i(n),p={};return p.getMode=function(){return t},p.getLength=function(k){return~~(a.length/2)},p.write=function(k){const C=a;let r=0;for(;r+1<C.length;){let u=(255&C[r])<<8|255&C[r+1];if(33088<=u&&u<=40956)u-=33088;else if(57408<=u&&u<=60351)u-=49472;else throw"illegal char at "+(r+1)+"/"+u;u=(u>>>8&255)*192+(u&255),k.put(u,13),r+=2}if(r<C.length)throw"illegal char at "+(r+1)},p},nv=function(){const n=[],t={};return t.writeByte=function(i){n.push(i&255)},t.writeShort=function(i){t.writeByte(i),t.writeByte(i>>>8)},t.writeBytes=function(i,a,p){a=a||0,p=p||i.length;for(let k=0;k<p;k+=1)t.writeByte(i[k+a])},t.writeString=function(i){for(let a=0;a<i.length;a+=1)t.writeByte(i.charCodeAt(a))},t.toByteArray=function(){return n},t.toString=function(){let i="";i+="[";for(let a=0;a<n.length;a+=1)a>0&&(i+=","),i+=n[a];return i+="]",i},t},DE=function(){let n=0,t=0,i=0,a="";const p={},k=function(r){a+=String.fromCharCode(C(r&63))},C=function(r){if(r<0)throw"n:"+r;if(r<26)return 65+r;if(r<52)return 97+(r-26);if(r<62)return 48+(r-52);if(r==62)return 43;if(r==63)return 47;throw"n:"+r};return p.writeByte=function(r){for(n=n<<8|r&255,t+=8,i+=1;t>=6;)k(n>>>t-6),t-=6},p.flush=function(){if(t>0&&(k(n<<6-t),n=0,t=0),i%3!=0){const r=3-i%3;for(let u=0;u<r;u+=1)a+="="}},p.toString=function(){return a},p},IE=function(n){const t=n;let i=0,a=0,p=0;const k={};k.read=function(){for(;p<8;){if(i>=t.length){if(p==0)return-1;throw"unexpected end of file./"+p}const u=t.charAt(i);if(i+=1,u=="=")return p=0,-1;if(u.match(/^\s$/))continue;a=a<<6|C(u.charCodeAt(0)),p+=6}const r=a>>>p-8&255;return p-=8,r};const C=function(r){if(65<=r&&r<=90)return r-65;if(97<=r&&r<=122)return r-97+26;if(48<=r&&r<=57)return r-48+52;if(r==43)return 62;if(r==47)return 63;throw"c:"+r};return k},jE=function(n,t){const i=n,a=t,p=new Array(n*t),k={};k.setPixel=function(v,_,h){p[_*i+v]=h},k.write=function(v){v.writeString("GIF87a"),v.writeShort(i),v.writeShort(a),v.writeByte(128),v.writeByte(0),v.writeByte(0),v.writeByte(0),v.writeByte(0),v.writeByte(0),v.writeByte(255),v.writeByte(255),v.writeByte(255),v.writeString(","),v.writeShort(0),v.writeShort(0),v.writeShort(i),v.writeShort(a),v.writeByte(0);const _=2,h=r(_);v.writeByte(_);let w=0;for(;h.length-w>255;)v.writeByte(255),v.writeBytes(h,w,255),w+=255;v.writeByte(h.length-w),v.writeBytes(h,w,h.length-w),v.writeByte(0),v.writeString(";")};const C=function(v){const _=v;let h=0,w=0;const E={};return E.write=function(R,g){if(R>>>g)throw"length over";for(;h+g>=8;)_.writeByte(255&(R<<h|w)),g-=8-h,R>>>=8-h,w=0,h=0;w=R<<h|w,h=h+g},E.flush=function(){h>0&&_.writeByte(w)},E},r=function(v){const _=1<<v,h=(1<<v)+1;let w=v+1;const E=u();for(let m=0;m<_;m+=1)E.add(String.fromCharCode(m));E.add(String.fromCharCode(_)),E.add(String.fromCharCode(h));const R=nv(),g=C(R);g.write(_,w);let c=0,f=String.fromCharCode(p[c]);for(c+=1;c<p.length;){const m=String.fromCharCode(p[c]);c+=1,E.contains(f+m)?f=f+m:(g.write(E.indexOf(f),w),E.size()<4095&&(E.size()==1<<w&&(w+=1),E.add(f+m)),f=m)}return g.write(E.indexOf(f),w),g.write(h,w),g.flush(),R.toByteArray()},u=function(){const v={};let _=0;const h={};return h.add=function(w){if(h.contains(w))throw"dup key:"+w;v[w]=_,_+=1},h.size=function(){return _},h.indexOf=function(w){return v[w]},h.contains=function(w){return typeof v[w]<"u"},h};return k},PE=function(n,t,i){const a=jE(n,t);for(let r=0;r<t;r+=1)for(let u=0;u<n;u+=1)a.setPixel(u,r,i(u,r));const p=nv();a.write(p);const k=DE(),C=p.toByteArray();for(let r=0;r<C.length;r+=1)k.writeByte(C[r]);return k.flush(),"data:image/gif;base64,"+k};ai.stringToBytes;const no=4;function OE(n){const t=ai(0,"M");t.addData(n,"Byte"),t.make();const i=t.getModuleCount();let a="";for(let p=0;p<i;p++){let k=0;for(;k<i;){if(!t.isDark(p,k)){k++;continue}const C=k;for(;k<i&&t.isDark(p,k);)k++;a+=`M${C} ${p}h${k-C}v1h-${k-C}z`}}return{size:i,path:a}}const BE=1e3,FE=4e3;function HE({status:n,pairing:t,phonePairing:i,phoneStarted:a,problem:p,platform:k,onSetEnabled:C,onSetPort:r,onStartPairing:u,onCancelPairing:v,onStartPhonePairing:_,onCancelPhonePairing:h,onRenameDevice:w,onRevokeDevice:E,onDismissProblem:R,onClose:g}){const[c,f]=N.useState(()=>zp(n.hostNames)),[m,d]=N.useState(String(n.port)),[L,I]=N.useState(null),x=N.useRef(null),[M,b]=N.useState(()=>Date.now()),T=()=>{t!==null&&v(),a&&h(),g()},D=N.useRef(T);D.current=T,N.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),D.current())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[]),N.useEffect(()=>{if(t===null&&i===null)return;b(Date.now());const j=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(j)},[t,i]),N.useEffect(()=>()=>{x.current!==null&&window.clearTimeout(x.current)},[]);const B=N.useRef(null),O=i!==null;N.useEffect(()=>{var $;if(!O)return;const j=window.matchMedia("(prefers-reduced-motion: reduce)").matches;($=B.current)==null||$.scrollIntoView({block:"center",behavior:j?"auto":"smooth"})},[O]),N.useEffect(()=>{d(String(n.port))},[n.port]),N.useEffect(()=>{n.hostNames.includes(c)||f(zp(n.hostNames))},[n.hostNames,c]);const F=(j,$)=>{navigator.clipboard.writeText($).then(()=>{I(j),x.current!==null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>I(null),BE)}).catch(()=>I(null))},U=SE(m),q=U!==null&&U!==n.port,G=yE(n,c),Y=S("remote.title"),W=t===null?null:bE(n.port,t.code);return l.jsx("div",{className:"modal-backdrop",onClick:T,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":Y,onClick:j=>j.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:Y}),l.jsx("button",{className:"icon-button",onClick:T,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${n.state==="active"?" status-line-state-active":""}`,children:Du(n.state,n.port)}),l.jsx("p",{className:"modal-hint",children:S("remote.intro")}),l.jsx("div",{className:"vault-actions",children:n.enabled?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>C(!1),children:S("remote.turnOff")}),l.jsx("span",{className:"modal-hint",children:S("remote.turnOffHint")})]}):l.jsx("button",{className:"primary-button",onClick:()=>C(!0),children:S("remote.turnOn")})}),l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:S("remote.port")}),l.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:m,onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&q&&U!==null&&r(U)}}),l.jsx("button",{className:"link-button",onClick:()=>U!==null&&r(U),disabled:!q,children:S("remote.portSave")}),U===null&&l.jsx("span",{className:"modal-hint remote-port-invalid",children:CE()})]}),l.jsx("p",{className:"modal-hint",children:S("remote.restartHint")}),p!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:p}),l.jsx("button",{className:"icon-button",onClick:R,title:S("common.close"),children:"×"})]}),l.jsx("h3",{className:"modal-section",children:S("remote.step.host")}),l.jsx("p",{className:"modal-hint",children:S("remote.step.hostHint")}),LE().map(j=>l.jsxs("details",{className:"remote-os",open:j.platform===TE(k),children:[l.jsx("summary",{className:"remote-os-summary",children:j.label}),l.jsx("p",{className:"modal-hint",children:j.hint}),j.command!==null&&l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:j.command}),l.jsx("button",{className:"link-button",onClick:()=>F("ssh",j.command??""),children:L==="ssh"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]})]},j.platform)),l.jsx("h3",{className:"modal-section",children:S("remote.step.tunnel")}),l.jsx("p",{className:"modal-hint",children:S("remote.step.tunnelHint")}),n.hostNames.length>1&&l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:S("remote.address")}),l.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:c,onChange:j=>f(j.target.value),children:n.hostNames.map(j=>l.jsx("option",{value:j,children:j},j))})]}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:G}),l.jsx("button",{className:"link-button",onClick:()=>F("command",G),children:L==="command"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsxs("details",{className:"remote-os",children:[l.jsx("summary",{className:"remote-os-summary",children:S("remote.trouble")}),l.jsxs("ul",{className:"remote-trouble",children:[l.jsx("li",{className:"modal-hint",children:S("remote.trouble.network")}),l.jsx("li",{className:"modal-hint",children:S("remote.vpnHint")}),n.sshUser.length>0&&l.jsx("li",{className:"modal-hint",children:S("remote.userHint",{user:n.sshUser})})]})]}),l.jsx("h3",{className:"modal-section",children:S("remote.step.pair")}),t===null||W===null?l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:u,disabled:!jl(n),children:S("remote.pair.start")}),!jl(n)&&l.jsx("span",{className:"modal-hint",children:S("remote.pair.needsActive")})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:S("remote.pair.open")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:W}),l.jsx("button",{className:"link-button",onClick:()=>F("pairing",W),children:L==="pairing"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsxs("p",{className:"modal-hint",children:[S("remote.pair.expires",{time:Vp(qp(t.expiresAt,M))})," ",S("remote.pair.after",{url:tv(n.port)})]}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:v,children:S("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:S("remote.phone.title")}),i===null?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:S("remote.phone.hint")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:_,disabled:!jl(n),children:S("remote.phone.start")}),!jl(n)&&l.jsx("span",{className:"modal-hint",children:S("remote.pair.needsActive")})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:EE(i.shell)}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre remote-phone-command",children:i.authorizeCommand}),l.jsx("button",{className:"link-button",onClick:()=>F("phone",i.authorizeCommand),children:L==="phone"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.authorizeOnce")}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.scan")}),l.jsx("div",{ref:B,children:l.jsx($E,{payload:i.payload})}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.secret")}),l.jsx("p",{className:"modal-hint",children:S("remote.pair.expires",{time:Vp(qp(i.expiresAt,M))})}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:h,children:S("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:S("remote.devices")}),n.devices.length===0?l.jsx("p",{className:"modal-hint",children:S("remote.devices.empty")}):l.jsx("ul",{className:"remote-devices",children:n.devices.map(j=>l.jsx(UE,{device:j,onRename:$=>w(j.id,$),onRevoke:()=>E(j.id)},j.id))})]})]})})}function $E({payload:n}){const t=OE(n),i=t.size+no*2;return l.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-no} ${-no} ${i} ${i}`,role:"img","aria-label":S("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[l.jsx("rect",{x:-no,y:-no,width:i,height:i,fill:"#fff"}),l.jsx("path",{d:t.path,fill:"#000"})]})}function UE({device:n,onRename:t,onRevoke:i}){const[a,p]=N.useState(!1),[k,C]=N.useState(n.label),[r,u]=N.useState(!1),v=N.useRef(null);N.useEffect(()=>()=>{v.current!==null&&window.clearTimeout(v.current)},[]);const _=()=>{p(!1);const w=k.trim();w.length>0&&w!==n.label&&t(w)},h=()=>{if(r){i();return}u(!0),v.current=window.setTimeout(()=>u(!1),FE)};return l.jsxs("li",{className:"remote-device",children:[l.jsxs("div",{className:"remote-device-main",children:[a?l.jsx("input",{className:"remote-device-input",value:k,autoFocus:!0,onChange:w=>C(w.target.value),onBlur:_,onKeyDown:w=>{w.key==="Enter"&&_()}}):l.jsx("button",{className:"remote-device-label",onClick:()=>{C(n.label),p(!0)},title:S("remote.device.rename"),children:n.label}),l.jsx("span",{className:`remote-device-seen${n.connected?" remote-device-connected":""}`,children:xE(n)}),l.jsx("span",{className:"remote-device-paired",children:kE(n)})]}),l.jsx("button",{className:`link-button${r?" remote-device-confirm":""}`,onClick:h,children:S(r?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const cu="agent-workbench.notes-open",Xp="agent-workbench.notes-active",Qp="agent-workbench.notes-height",uu=160,WE=300;function zE(n){return n.text.trim().length===0?n.images.length>0?S("notes.imageOnly"):S("notes.untitled"):H0(n)}function qE({notes:n,onSendNote:t,sendTargetCwd:i,fill:a,onHide:p}){const[k,C]=N.useState(()=>xt(cu,!1,q=>q==="true")),r=k||a,[u,v]=N.useState(()=>xt(Qp,WE,q=>{const G=Number.parseInt(q,10);return Number.isFinite(G)?Math.max(G,uu):null})),[_,h]=N.useState(()=>xt(Xp,null,q=>q)),[w,E]=N.useState(null),[R,g]=N.useState(null),[c,f]=N.useState(0),m=pE(),d=N.useMemo(()=>n.notes.length===0?null:n.notes.find(q=>q.noteId===_)??n.notes[n.notes.length-1]??null,[n.notes,_]),L=N.useCallback(q=>{h(q),wt(Xp,q),E(null)},[]),I=N.useCallback(()=>{C(q=>{const G=!q;return wt(cu,String(G)),G})},[]),x=N.useCallback(()=>{const q=n.create();L(q),r||(C(!0),wt(cu,"true")),f(G=>G+1)},[n,r,L]),M=N.useCallback(q=>{if(q.text.trim().length===0&&q.images.length===0){n.remove(q.noteId);return}L(q.noteId),E(q.noteId)},[n,L]),b=N.useCallback(()=>{w!==null&&n.remove(w),E(null)},[w,n]),T=N.useRef(null),D=N.useCallback(q=>{const G=q.currentTarget.parentElement,Y=G===null?u:Math.round(G.getBoundingClientRect().height);T.current={startY:q.clientY,startHeight:Y},q.currentTarget.setPointerCapture(q.pointerId),q.preventDefault()},[u]),B=N.useCallback(q=>{const G=T.current;if(G===null)return;const Y=Math.max(uu,Math.floor(window.innerHeight*.8));v(Math.min(Y,Math.max(uu,G.startHeight+G.startY-q.clientY)))},[]),O=N.useCallback(q=>{T.current!==null&&(T.current=null,q.currentTarget.releasePointerCapture(q.pointerId),wt(Qp,String(u)))},[u]);N.useEffect(()=>{if(R===null)return;const q=G=>{G.key==="Escape"&&(G.stopPropagation(),g(null))};return window.addEventListener("keydown",q,!0),()=>window.removeEventListener("keydown",q,!0)},[R]);const F=R===null?void 0:n.images[R],U=n.notes.length;return l.jsxs("section",{className:`notes${r?" notes-open":""}${a?" notes-fill":""}`,style:r&&!a?{height:`${u}px`}:void 0,children:[r&&!a&&l.jsx("div",{className:"notes-resize",onPointerDown:D,onPointerMove:B,onPointerUp:O,onPointerCancel:O,title:S("notes.resize")}),r?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"notes-header",children:[l.jsxs("div",{className:"strip-tabs",role:"tablist",children:[n.notes.map(q=>{const G=q.noteId===(d==null?void 0:d.noteId),Y=zE(q);return l.jsxs("div",{className:`strip-tab${G?" is-active":""}`,role:"tab","aria-selected":G,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>L(q.noteId),title:Y,children:Y}),l.jsx("button",{className:"strip-tab-close",onClick:()=>M(q),title:S("notes.closeNote"),children:"×"})]},q.noteId)}),l.jsx("button",{className:"strip-tab-new",onClick:x,title:S("notes.new"),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button thread-font-button",onClick:m.cycle,title:zl(m.size),"aria-label":zl(m.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),!a&&l.jsx("button",{className:"icon-button",onClick:I,title:S("notes.collapse"),children:"▾"}),p!==void 0&&l.jsx(Wl,{title:S("settings.hide.notes"),onHide:p,confirmText:null})]}),l.jsx("div",{className:"notes-body",children:U===0||d===null?l.jsx("p",{className:"notes-empty",children:Yt("notes.empty")}):l.jsx(GE,{note:d,notes:n,closing:w===d.noteId,focusRequest:c,onConfirmClose:b,onCancelClose:()=>E(null),onOpenImage:g,onSend:t===null?null:()=>t(d.noteId),sendTargetCwd:i},d.noteId)})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:I,title:S("notes.expand"),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:S("notes.name")}),U>0&&l.jsx("span",{className:"strip-collapsed-count",children:U})]}),p!==void 0&&l.jsx(Wl,{title:S("settings.hide.notes"),onHide:p,confirmText:null})]}),R!==null&&l.jsx("div",{className:"notes-lightbox",onClick:()=>g(null),title:S("notes.lightboxClose"),children:typeof F=="string"?l.jsx("img",{src:F,alt:S("notes.imageAlt")}):l.jsx("span",{className:"notes-lightbox-missing",children:S("notes.imageUnavailable")})})]})}function VE(){return l.jsx("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M20 11.5 11.7 19.8a5 5 0 0 1-7.1-7.1l8.6-8.6a3.4 3.4 0 0 1 4.8 4.8l-8.5 8.5a1.8 1.8 0 0 1-2.5-2.5l7.9-7.9"})})}function KE(){return l.jsxs("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M21.5 2.5 11 13"}),l.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function GE({note:n,notes:t,closing:i,focusRequest:a,onConfirmClose:p,onCancelClose:k,onOpenImage:C,onSend:r,sendTargetCwd:u}){const v=N.useRef(null),[_,h]=N.useState(!1),w=n.text.trim().length===0&&n.images.length===0;N.useEffect(()=>{var g;a>0&&((g=v.current)==null||g.focus())},[a]);const E=N.useCallback(g=>{const c=Array.from(g).filter(f=>f.type.startsWith("image/"));for(const f of c)t.addImage(n.noteId,f);return c.length>0},[t,n.noteId]),R=N.useCallback(g=>{g.clipboardData!==null&&E(g.clipboardData.files)&&g.preventDefault()},[E]);return l.jsxs("div",{className:`note-editor${_?" note-editor-dragging":""}`,onDragOver:g=>{Array.from(g.dataTransfer.types).includes("Files")&&(g.preventDefault(),h(!0))},onDragLeave:()=>h(!1),onDrop:g=>{g.preventDefault(),h(!1),E(g.dataTransfer.files)},children:[i&&l.jsxs("div",{className:"note-closing",children:[l.jsx("span",{children:S("notes.closeConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:p,children:S("common.close")}),l.jsx("button",{className:"link-button",onClick:k,children:S("common.cancel")})]}),t.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:t.problem}),l.jsx("button",{className:"icon-button",onClick:t.dismissProblem,title:S("common.close"),children:"×"})]}),l.jsx("textarea",{ref:v,className:"note-input",value:n.text,placeholder:S("notes.placeholder"),onChange:g=>t.updateText(n.noteId,g.target.value),onPaste:R,spellCheck:!1}),n.images.length>0&&l.jsx("div",{className:"note-images",children:n.images.map(g=>l.jsx(YE,{image:g,src:t.images[g.imageId],onRequest:t.requestImage,onOpen:()=>C(g.imageId),onRemove:()=>t.removeImage(n.noteId,g.imageId)},g.imageId))}),l.jsxs("div",{className:"note-footer",children:[l.jsx("span",{className:"note-meta",children:os(n.updatedAt)}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"icon-button",onClick:()=>r==null?void 0:r(),disabled:r===null||w,title:vy(r!==null,u,w),children:l.jsx(KE,{})}),l.jsxs("label",{className:"icon-button note-attach",title:S("notes.attach"),children:[l.jsx(VE,{}),l.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:g=>{g.target.files!==null&&E(g.target.files),g.target.value=""}})]})]})]})}function YE({image:n,src:t,onRequest:i,onOpen:a,onRemove:p}){return N.useEffect(()=>{t===void 0&&i(n.imageId)},[t,n.imageId,i]),l.jsxs("figure",{className:"chip chip-image note-thumb",title:_n(n.bytes),children:[typeof t=="string"?l.jsx("img",{src:t,alt:S("notes.imageAlt"),onClick:a}):l.jsx("span",{className:"note-thumb-placeholder",children:t===null?S("notes.thumbMissing"):"…"}),l.jsx("button",{className:"chip-remove",onClick:p,title:S("notes.removeImage"),children:"×"})]})}function sv(){const n=mo(),t=yS(),[i,a]=N.useState(null),p=N.useCallback(()=>a(null),[]),k=N.useRef(null),C=v=>{vS(v).catch(()=>{})},r=[{label:S("header.locale.auto",{name:$c[mS()]}),checked:t==="auto",onSelect:()=>C("auto")},...Fu.map(v=>({label:$c[v],lang:v,checked:t===v,onSelect:()=>C(v)}))],u=$c[n];return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:k,className:"icon-button locale-button",onClick:v=>{const _=v.currentTarget.getBoundingClientRect();a(h=>h===null?{x:_.left,y:_.bottom+4}:null)},title:t==="auto"?S("header.locale.titleAuto",{name:u}):S("header.locale.title",{name:u}),"aria-haspopup":"menu","aria-expanded":i!==null,children:Aw[n]}),i!==null&&l.jsx(Eu,{x:i.x,y:i.y,items:r,onClose:p,anchor:k.current})]})}function XE({onKey:n}){return l.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":S("narrow.keys.label"),children:I1.map(t=>l.jsx("button",{className:"narrow-key",onPointerDown:i=>i.preventDefault(),onClick:()=>n(t.data),title:S(t.titleKey),children:t.label},t.id))})}function QE({banners:n,status:t,statusLabel:i,terminals:a,activeTerminalId:p,activity:k,agents:C,offerAgentChoice:r,newTabAgent:u,canOpen:v,newTabBlockedTitle:_,onSelectTab:h,onCloseTab:w,onRenameTab:E,onNewTab:R,drawer:g,drawerOpen:c,onDrawerChange:f,menu:m,view:d,views:L,onViewChange:I,badges:x,chat:M,panel:b,notes:T,console:D,onTerminalKey:B}){const[O,F]=N.useState(null),U=a.find(j=>j.terminalId===p)??null,q=j=>{var $;return(($=C.find(H=>H.id===j.agent))==null?void 0:$.statusLine)??null};N.useEffect(()=>{if(!c&&O===null)return;const j=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),O!==null?F(null):f(!1))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[c,O,f]);const G=N.useRef({sheet:O,drawerOpen:c,view:d,onDrawerChange:f,onViewChange:I});G.current={sheet:O,drawerOpen:c,view:d,onDrawerChange:f,onViewChange:I},N.useEffect(()=>{const j=window;return j[zf]=()=>{const $=G.current;switch(F1({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:$.sheet!==null,drawerOpen:$.drawerOpen,view:$.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return F(null),!0;case"close-drawer":return $.onDrawerChange(!1),!0;case"show-chat":return $.onViewChange("chat"),!0;case null:return!1}},()=>{delete j[zf]}},[]);const Y=N.useRef(null);N.useEffect(()=>{var j;(j=Y.current)==null||j.scrollIntoView({block:"nearest",inline:"nearest"})},[d]);const W=j=>{const $=j==="git"?x.changes:j==="plans"?x.plans:j==="memory"?x.memory:0;return $>0?l.jsx("span",{className:"side-panel-badge",children:$}):j==="cli"&&x.cliUnseen&&d!=="cli"?l.jsx("span",{className:"narrow-view-dot",title:S("panel.cliUnseen")}):null};return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"app-header narrow-header",children:[l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>f(!0),title:S("narrow.projects"),"aria-label":S("narrow.projects"),children:"☰"}),l.jsxs("button",{className:"narrow-current",onClick:()=>F("tabs"),title:S("narrow.tabs.open"),children:[U===null?l.jsx("span",{className:"app-name",children:"Agent Workbench"}):l.jsxs(l.Fragment,{children:[l.jsx(Gu,{terminal:U,activity:k.get(U.terminalId),statusLine:q(U)}),l.jsx("span",{className:"project-swatch",style:{background:vr(U.cwd)}}),l.jsx("span",{className:"narrow-current-label",children:uo(U)})]}),l.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),t!=="open"&&l.jsx("span",{className:`status status-${t}`,children:i}),l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>F("menu"),title:S("narrow.more"),"aria-label":S("narrow.more"),children:"⋮"})]}),n,l.jsxs("div",{className:"narrow-body",children:[l.jsx("nav",{className:"narrow-views",role:"tablist",children:L.map(j=>l.jsxs("button",{ref:j===d?Y:null,role:"tab","aria-selected":j===d,className:`narrow-view-tab${j===d?" narrow-view-active":""}`,onClick:()=>I(j),children:[l.jsx("span",{children:S(M1(j))}),W(j)]},j))}),l.jsxs("div",{className:"narrow-stack",children:[l.jsx("main",{className:`workspace narrow-pane${d==="chat"?"":" narrow-pane-veiled"}`,children:M}),b,l.jsx("div",{className:`narrow-pane${d==="notes"?"":" narrow-pane-hidden"}`,children:T}),l.jsx("div",{className:`narrow-pane${d==="console"?"":" narrow-pane-hidden"}`,children:D})]}),B!==null&&l.jsx(XE,{onKey:B})]}),c&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>f(!1),children:l.jsx("div",{className:"narrow-drawer",onClick:j=>j.stopPropagation(),children:g})}),O==="tabs"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>F(null),children:l.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":S("narrow.tabs.open"),onClick:j=>j.stopPropagation(),children:[l.jsx(JE,{terminals:a,activeTerminalId:p,activity:k,statusLineOf:q,onSelect:j=>{h(j),F(null)},onClose:w,onRename:E}),l.jsx(qu,{className:"narrow-sheet-new",text:S("narrow.tabs.new"),title:_??S("narrow.tabs.new"),disabled:!v||_!==null,offerAgentChoice:r,agents:C,agent:u,onOpen:j=>{R(j),F(null)}})]})}),O==="menu"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>F(null),children:l.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":S("narrow.more"),onClick:j=>j.stopPropagation(),children:l.jsx(e5,{menu:m,status:t,statusLabel:i,onClose:()=>F(null)})})})]})}function JE({terminals:n,activeTerminalId:t,activity:i,statusLineOf:a,onSelect:p,onClose:k,onRename:C}){const[r,u]=N.useState(null),[v,_]=N.useState(""),h=N.useRef(null);N.useEffect(()=>{var E;r!==null&&((E=h.current)==null||E.select())},[r]);const w=()=>{r!==null&&C(r,v.trim()),u(null)};return n.length===0?l.jsx("p",{className:"narrow-sheet-empty",children:S("narrow.tabs.none")}):l.jsx("ul",{className:"narrow-tabs",children:n.map(E=>{const R=r===E.terminalId;return l.jsxs("li",{className:`narrow-tab-row${E.terminalId===t?" narrow-tab-active":""}`,style:{"--tab-project-color":vr(E.cwd)},children:[R?l.jsx("input",{ref:h,className:"narrow-tab-input",value:v,onChange:g=>_(g.target.value),onBlur:w,onKeyDown:g=>{g.key==="Enter"&&w(),g.key==="Escape"&&(g.stopPropagation(),u(null))}}):l.jsxs("button",{className:"narrow-tab-select",onClick:()=>p(E.terminalId),children:[l.jsx(Gu,{terminal:E,activity:i.get(E.terminalId),statusLine:a(E)}),l.jsx("span",{className:"narrow-tab-label",children:uo(E)})]}),l.jsx("button",{className:"icon-button",onClick:()=>{u(E.terminalId),_(E.label.length>0?E.label:uo(E))},title:S("narrow.tabs.rename"),children:"✎"}),l.jsx("button",{className:"icon-button",onClick:()=>k(E.terminalId),title:S("narrow.tabs.close"),children:"×"})]},E.terminalId)})})}function ZE({choice:n}){const t=[{source:"system",label:S("narrow.menu.chimeSystem")},{source:"page",label:S("narrow.menu.chimePage")}];return l.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":S("narrow.menu.sound"),children:t.map(({source:i,label:a})=>l.jsx("button",{className:`narrow-chime-option${n.source===i?" is-on":""}`,"aria-pressed":n.source===i,onClick:()=>n.setSource(i),children:a},i))})}function e5({menu:n,status:t,statusLabel:i,onClose:a}){return l.jsxs("div",{className:"narrow-menu",children:[l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.connection")}),l.jsx("span",{className:`status status-${t}`,children:i}),ng(navigator.userAgent)&&l.jsxs(l.Fragment,{children:[l.jsx("a",{className:"link-button",href:B1,onClick:a,children:S("narrow.menu.phoneAppDisconnect")}),l.jsx("a",{className:"link-button",href:O1,onClick:a,children:S("narrow.menu.phoneAppSettings")})]})]}),n.cwd!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.folder")}),l.jsx("span",{className:"narrow-menu-value",title:n.cwd,children:n.cwd})]}),n.cliVersion!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.cli")}),l.jsx("span",{className:"narrow-menu-value",title:n.cliVersion,children:n.cliVersion})]}),n.remoteClient&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("app.header.remoteBadge")}),l.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:S("app.header.remoteBadgeTitle")})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.theme")}),l.jsx("button",{className:"icon-button",onClick:n.onCycleTheme,title:n.themeTitle,children:n.themeIcon})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.language")}),l.jsx(sv,{})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.sound")}),n.sound.phoneChime===null?l.jsx(Zg,{sound:n.sound}):l.jsx(ZE,{choice:n.sound.phoneChime})]}),n.sound.notify.supported&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.notifications")}),l.jsx(ev,{notify:n.sound.notify})]}),n.remote!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("app.header.remoteAccess")}),l.jsx("button",{className:`icon-button${n.remote.active?" icon-button-on":""}`,onClick:()=>{var p;a(),(p=n.remote)==null||p.onOpen()},title:n.remote.title,children:"⇄"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.shortcuts")}),l.jsx("button",{className:"icon-button",onClick:()=>{a(),n.onShortcuts()},title:S("app.header.shortcuts"),children:"?"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("settings.title")}),l.jsx("button",{className:"icon-button",onClick:()=>{a(),n.onSettings()},title:S("settings.open"),"aria-label":S("settings.open"),children:"⚙"})]})]})}function t5(){const n=window.location.search,t=new URLSearchParams(n).get(fu),i=t!==null&&t.length>0?t:null,a=N1(n);return i===null&&a===null?{token:i,tab:a}:(window.history.replaceState(null,"",`${window.location.pathname}${D1(n,[fu,eg])}`),{token:i,tab:a})}const rv=t5(),Jp=rv.token,n5=rv.tab,hu=new Set;function s5(n){const[t,i]=N.useState(null),[a,p]=N.useState(null),[k,C]=N.useState(hu),[r,u]=N.useState(null);N.useEffect(()=>{const c=n.onMessage(m=>{switch(m.type){case"vault.status":i(m.status);break;case"vault.exported":C(d=>{if(!d.has(m.projectKey))return d;const L=new Set(d);return L.delete(m.projectKey),L}),u({projectKey:m.projectKey,sessions:m.sessions,at:Date.now()});break;case"error":if(m.code!=="vault-failed")break;p(Dt(m.text)),m.detail!==void 0&&console.error("[servidor]",m.detail),C(hu);break}}),f=n.onReopen(()=>C(hu));return()=>{c(),f()}},[n]);const v=N.useCallback(()=>{p(null),n.send({type:"vault.measure"})},[n]),_=N.useCallback(c=>{p(null),n.send({type:"vault.enable",enabled:c})},[n]),h=N.useCallback(c=>{p(null),n.send({type:"vault.setDir",pickerId:c})},[n]),w=N.useCallback(c=>{p(null),C(f=>new Set(f).add(c)),n.send({type:"vault.exportProject",projectKey:c})},[n]),E=N.useCallback((c,f)=>{p(null),n.send({type:"vault.openSession",agent:c,sessionId:f})},[n]),R=N.useCallback(()=>{p(null),n.send({type:"vault.reveal"})},[n]),g=N.useCallback(()=>p(null),[]);return{status:t,problem:a,exporting:k,lastExported:r,measure:v,setEnabled:_,chooseDir:h,exportProject:w,openSession:E,reveal:R,dismissProblem:g}}function r5(n){return S("summary.outdatedServer",{server:n,page:ei})}function i5(n){const[t,...i]=n;if(t===void 0||t.missingMessage===null)return null;const a=Dt(t.missingMessage);return i.length===0?a:`${a}
|
|
149
|
+
${S("summary.alsoWorksWith",{names:i.map(p=>p.label).join(", ")})}`}function o5(n){const t=n.version??"?";return t.toLowerCase().includes(n.label.toLowerCase())?t:`${n.label} ${t}`}function l5(n,t,i=ei){var C,r;if(t&&i<ei)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:r5(i),environmentNotice:null};if(t&&i>ei)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:S("summary.newerServer",{server:i,page:ei}),environmentNotice:null};const a=n.filter(u=>u.available);let p=null;a.length===1?p=((C=a[0])==null?void 0:C.version)??null:a.length>1&&(p=a.map(o5).join(" · "));const k=t&&a.length===0;return{cliAvailable:!t||a.length>0,cliVersion:p,cliMissingMessage:k?i5(n):null,environmentNotice:((r=n.find(u=>u.environmentNotice!==null))==null?void 0:r.environmentNotice)??null}}const a5=500,c5=8e3;class u5{constructor(){jt(this,"socket",null);jt(this,"status","connecting");jt(this,"attempt",0);jt(this,"closedByUs",!1);jt(this,"hasConnectedOnce",!1);jt(this,"reconnectTimer");jt(this,"messageHandlers",new Set);jt(this,"statusHandlers",new Set);jt(this,"reopenHandlers",new Set);jt(this,"outbox",[])}getStatus(){return this.status}onMessage(t){return this.messageHandlers.add(t),()=>this.messageHandlers.delete(t)}onStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}onReopen(t){return this.reopenHandlers.add(t),()=>this.reopenHandlers.delete(t)}connect(){if(this.socket!==null)return;const t=new URL(uw,window.location.href);t.protocol=window.location.protocol==="https:"?"wss:":"ws:",Jp!==null&&t.searchParams.set(fu,Jp);const i=new WebSocket(t);this.socket=i,i.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const a=this.outbox.shift();a!==void 0&&i.send(Lf(a))}if(this.hasConnectedOnce)for(const a of this.reopenHandlers)a();this.hasConnectedOnce=!0},i.onmessage=a=>{const p=_w(a.data);if(p===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const k of this.messageHandlers)k(p)},i.onclose=a=>{if(this.socket=null,!this.closedByUs){if(a.code===Z0){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},i.onerror=()=>{}}send(t){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(Lf(t)),!0):(t.type!=="input"&&t.type!=="resize"&&this.outbox.push(t),!1)}close(){var t;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(t=this.socket)==null||t.close(),this.socket=null}setStatus(t){if(this.status!==t){this.status=t;for(const i of this.statusHandlers)i(t)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const t=Math.min(a5*2**(this.attempt-1),c5);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),t)}}const Iu="agent-workbench.activeTab";function h5(){try{return window.sessionStorage.getItem(Iu)}catch{return null}}const d5={state:"idle",scannedFiles:0,totalFiles:0};function f5(n,t,i){const a=new Map(i?[]:n.map(p=>[p.key,p]));for(const p of t)a.set(p.key,p);return[...a.values()].sort((p,k)=>k.lastActivityAt-p.lastActivityAt)}function p5(){const n=N.useMemo(()=>new u5,[]),t=N.useMemo(()=>new p1({send:(xe,He)=>n.send({type:"composer.draft",terminalId:xe,draft:He}),connected:()=>n.getStatus()==="open",setTimer:(xe,He)=>window.setTimeout(xe,He),clearTimer:xe=>window.clearTimeout(xe),newId:()=>crypto.randomUUID()}),[n]),[i,a]=N.useState("connecting"),[p,k]=N.useState([]),[C,r]=N.useState(null),[u,v]=N.useState(!1),[_,h]=N.useState(ei),[w,E]=N.useState(""),[R,g]=N.useState(""),[c,f]=N.useState(null),[m,d]=N.useState(!1),[L,I]=N.useState(!1),[x,M]=N.useState(!1),[b,T]=N.useState([]),[D,B]=N.useState([]),[O,F]=N.useState(d5),[U,q]=N.useState(h5);N.useEffect(()=>{try{U===null?window.sessionStorage.removeItem(Iu):window.sessionStorage.setItem(Iu,U)}catch{}},[U]);const[G,Y]=N.useState(new Set),[W,j]=N.useState(new Map),[$,H]=N.useState(new Map),V=N.useRef(new Map),te=N.useRef(new Map),[ie,pe]=N.useState(new Set),[me,X]=N.useState(null),[K,J]=N.useState([]),[Z,_e]=N.useState(new Map),[ve,ye]=N.useState([]),Ee=N.useRef(1),[fe,Ae]=N.useState(new Map),ne=N.useRef(new Set),Ie=N.useRef(new Map),oe=N.useRef(new Map),ue=N.useCallback(xe=>{const He=oe.current.get(xe);He!==void 0&&(clearTimeout(He),oe.current.delete(xe)),J(ut=>ut.some(be=>be.requestId===xe)?ut.filter(be=>be.requestId!==xe):ut)},[]),de=N.useCallback(()=>{for(const xe of oe.current.values())clearTimeout(xe);oe.current.clear(),J(xe=>xe.length===0?xe:[])},[]);N.useEffect(()=>{const xe=n.onStatus(be=>{a(be),be==="failed"&&X({message:S("workspace.connectFailed"),at:Date.now()})}),He=n.onMessage(be=>{switch(be.type){case"agents":k(be.agents),r(be.defaultAgent);break;case"hello":k(be.agents),r(be.defaultAgent),v(!0),h(be.protocolVersion),E(be.platform),g(be.defaultCwd),f(be.shellName),d(be.remoteClient),I(be.fileCheck),M(be.fileWrite);break;case"terminal.list":{T(be.terminals),t.retain(be.terminals.map(nt=>nt.terminalId));const rt=Uy(te.current,be.terminals),_t=rt.finished.length>0||[...rt.phases].some(([nt,gt])=>te.current.get(nt)!==gt);te.current=rt.phases,_t&&pe(new Set(rt.phases.keys())),Y(nt=>{if(nt.size===0)return nt;const gt=new Set(nt);for(const Mt of nt){if(rt.phases.has(Mt))continue;const Ft=be.terminals.find(Ss=>Ss.terminalId===Mt);(Ft===void 0||Ft.alive)&>.delete(Mt)}return gt.size===nt.size?nt:gt}),H(nt=>{if(nt.size===0)return nt;const gt=new Map([...nt].filter(([Mt])=>be.terminals.some(Ft=>Ft.terminalId===Mt)));return gt.size===nt.size?nt:(V.current=gt,gt)});const ht=be.terminals.filter(nt=>nt.kind==="agent");q(nt=>{var gt;return nt!==null&&ht.some(Mt=>Mt.terminalId===nt)?nt:((gt=ht[0])==null?void 0:gt.terminalId)??null}),_e(nt=>{if(nt.size===0)return nt;const gt=new Map(nt);for(const Mt of nt.keys())be.terminals.some(Ft=>Ft.terminalId===Mt)||gt.delete(Mt);return gt.size===nt.size?nt:gt}),Ae(nt=>{if(nt.size===0)return nt;const gt=new Map([...nt].filter(([Mt])=>be.terminals.some(Ft=>Ft.terminalId===Mt)));return gt.size===nt.size?nt:gt});break}case"session.continued":_e(rt=>new Map(rt).set(be.terminalId,{sourceAgent:be.source.agent,includedTurns:be.includedTurns,totalTurns:be.totalTurns,totalTurnsIsMinimum:be.totalTurnsIsMinimum,delivery:be.delivery,prefillReason:null}));break;case"composer.prefill":{const rt=Ee.current;Ee.current+=1,ye(ht=>[...ht,{id:rt,terminalId:be.terminalId,text:be.text}]);const{reason:_t}=be;if(_t==="returned-by-cli"||_t==="stopped-early"){Ae(ht=>ht.get(be.terminalId)===_t?ht:new Map(ht).set(be.terminalId,_t));break}if(_t==="rewound")break;_e(ht=>{const nt=ht.get(be.terminalId);return nt===void 0?ht:new Map(ht).set(be.terminalId,{...nt,delivery:"prefilled",prefillReason:_t})});break}case"composer.drafts":t.restore(be.drafts);break;case"terminal.opened":{ue(be.requestId),ne.current.delete(be.requestId)&&be.terminal.kind==="agent"&&q(be.terminal.terminalId);const rt=Ie.current.get(be.requestId);rt!==void 0&&(Ie.current.delete(be.requestId),rt(be.terminal));break}case"terminal.activity":j(rt=>rt.get(be.terminalId)===be.activity?rt:new Map(rt).set(be.terminalId,be.activity)),H(rt=>{const _t=be.offlineReason??null;if((rt.get(be.terminalId)??null)===_t)return rt;const ht=new Map(rt);return _t===null?ht.delete(be.terminalId):ht.set(be.terminalId,_t),V.current=ht,ht});break;case"index.status":F(be.status);break;case"index.projects":B(rt=>f5(rt,be.projects,be.replace));break;case"error":if(Dk(be.requestId)){be.detail!==void 0&&console.error("[servidor]",be.detail);break}if(be.code==="vault-failed"||be.code==="search-failed"||be.code==="remote-failed"||be.code==="settings-failed"||be.code==="rewind-failed")break;X({message:Dt(be.text),at:Date.now()}),Y(rt=>rt.size===0?rt:new Set),te.current.size>0&&(te.current=new Map,pe(new Set)),be.detail!==void 0&&console.error("[servidor]",be.detail),be.requestId!==void 0&&(ne.current.delete(be.requestId),Ie.current.delete(be.requestId),ue(be.requestId));break}}),ut=n.onReopen(()=>{de(),Y(be=>be.size===0?be:new Set),te.current.size>0&&(te.current=new Map,pe(new Set))});return n.connect(),()=>{xe(),He(),ut(),n.close()}},[n,t,ue,de]),N.useEffect(()=>{const xe=n.onReopen(()=>t.reconnected()),He=()=>t.flushAll(),ut=()=>{document.visibilityState==="hidden"&&t.flushAll()};return window.addEventListener("pagehide",He),document.addEventListener("visibilitychange",ut),()=>{xe(),window.removeEventListener("pagehide",He),document.removeEventListener("visibilitychange",ut)}},[n,t]),N.useEffect(()=>de,[de]);const Me=N.useCallback(xe=>{const He=crypto.randomUUID();ne.current.add(He),xe.onOpened!==void 0&&Ie.current.set(He,xe.onOpened),J(be=>[...be,{requestId:He,cwd:xe.cwd,agent:xe.agent??null,label:xe.label??"",at:Date.now()}]);const ut=setTimeout(()=>ue(He),zy);oe.current.set(He,ut),n.send({type:"terminal.open",requestId:He,cwd:xe.cwd,...xe.resumeSessionId!==void 0?{resumeSessionId:xe.resumeSessionId}:{},...xe.label!==void 0?{label:xe.label}:{},...xe.agent!==void 0?{agent:xe.agent}:{}})},[n,ue]),Re=N.useCallback(xe=>{n.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:xe,kind:"shell"})},[n]),Ke=N.useCallback(xe=>n.send({type:"terminal.close",terminalId:xe}),[n]),Ue=N.useCallback(xe=>{Y(He=>new Set(He).add(xe)),V.current.get(xe)==="server-closed"&&(te.current=new Map(te.current).set(xe,"waiting-exit"),pe(new Set(te.current.keys()))),n.send({type:"terminal.wake",terminalId:xe})},[n]),st=N.useCallback((xe,He)=>n.send({type:"terminal.rename",terminalId:xe,label:He}),[n]),Tt=N.useCallback(xe=>n.send({type:"tabs.reorder",terminalIds:xe}),[n]),lt=N.useCallback((xe,He)=>n.send({type:"session.archive",sessionIds:xe,archived:He}),[n]),yt=N.useCallback((xe,He,ut)=>{const be=crypto.randomUUID();ne.current.add(be),n.send({type:"session.continue",requestId:be,agent:xe.agent,sessionId:xe.sessionId,target:He,label:ut})},[n]),ct=N.useCallback(xe=>{_e(He=>{if(!He.has(xe))return He;const ut=new Map(He);return ut.delete(xe),ut})},[]),We=N.useCallback(xe=>{Ae(He=>{if(!He.has(xe))return He;const ut=new Map(He);return ut.delete(xe),ut})},[]),Ge=N.useCallback(xe=>{ye(He=>He.some(ut=>ut.id===xe)?He.filter(ut=>ut.id!==xe):He)},[]),bt=N.useCallback(()=>n.send({type:"index.refresh"}),[n]),it=N.useCallback(()=>n.send({type:"agents.refresh"}),[n]),Wt=N.useCallback(()=>X(null),[]),Pt=N.useMemo(()=>b.filter(xe=>xe.kind==="agent"),[b]),he=N.useMemo(()=>b.filter(xe=>xe.kind==="shell"),[b]),Oe=mo(),Qe=N.useMemo(()=>l5(p,u,_),[p,u,_,Oe]),Ot=N.useCallback(xe=>{var He;return(xe===null||(He=p.find(ut=>ut.id===xe))==null?void 0:He.capabilities)??mm},[p]),ze=N.useMemo(()=>Pu(p),[p]);return{connection:n,status:i,agents:p,defaultAgent:C,capabilitiesFor:Ot,offerAgentChoice:ze,cliAvailable:Qe.cliAvailable,cliVersion:Qe.cliVersion,cliMissingMessage:Qe.cliMissingMessage,platform:w,defaultCwd:R,environmentNotice:Qe.environmentNotice,shellName:c,remoteClient:m,fileCheck:L,fileWrite:x,terminals:Pt,shells:he,pendingOpens:K,activeTerminalId:U,projects:D,indexStatus:O,error:me,dismissError:Wt,setActiveTerminal:q,openTerminal:Me,openShell:Re,closeTerminal:Ke,wakeTerminal:Ue,waking:G,activity:W,offlineReasons:$,relaunching:ie,renameTerminal:st,reorderTabs:Tt,refreshIndex:bt,refreshAgents:it,archiveSessions:lt,continueSession:yt,handoffs:Z,dismissHandoff:ct,returnedMessages:fe,dismissReturned:We,prefills:ve,prefillApplied:Ge,drafts:t}}const Xu=["git","files","plans","memory","console","notes"],Zp="agent-workbench.hiddenPanels";function m5(n){return Xu.includes(n)}const g5=new Set(["memory"]),v5="none";function _5(n){return new Set(n.split(",").map(t=>t.trim()).filter(m5))}function w5(n){const t=Xu.filter(i=>n.has(i));return t.length===0?v5:t.join(",")}function y5(n,t,i){const a=new Set(n);return i?a.delete(t):a.add(t),a}function b5(){const[n,t]=N.useState(()=>xt(Zp,g5,_5)),i=N.useCallback((p,k)=>{t(C=>{const r=y5(C,p,k);return wt(Zp,w5(r)),r})},[]),a=N.useCallback(p=>!n.has(p),[n]);return{hidden:n,isVisible:a,setVisible:i}}const S5={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},C5={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function x5(n,t,i){const a=n.filter(p=>p!==t);return i?[...a,t]:a}function k5(n,t){return n.length===t.length&&n.every(i=>t.includes(i))}function E5({onClose:n,terminalTheme:t,panels:i,consoleCount:a,onHideConsole:p,appSettings:k,agents:C,remoteClient:r,onOpenVault:u,onOpenRemote:v}){const[_,h]=N.useState(!1),w=k.status,E=w!==null&&!r,[R,g]=N.useState(null),[c,f]=N.useState(null);N.useEffect(()=>{g(null),f(null)},[w,k.problem]);const m=R??(w==null?void 0:w.consoleShell)??"auto",d=c??(w==null?void 0:w.disabledAgents)??[];N.useEffect(()=>{const b=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),n())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[n]);const L=(b,T)=>{if(b==="console"&&!T&&a>0){h(!0);return}i.setVisible(b,T)},I=(w==null?void 0:w.consoleShells.find(b=>b.id!=="git-bash"&&b.id!=="zsh"))??null,x=w!==null&&!k5(w.disabledAgents,w.disabledAtStart),M=w===null?[]:[{id:"auto",label:I===null?S("settings.console.auto"):S("settings.console.autoWith",{shell:I.label})},...w.consoleShells];return l.jsx("div",{className:"modal-backdrop",onClick:n,children:l.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":S("settings.title"),onClick:b=>b.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S("settings.title")}),l.jsx("button",{className:"icon-button",onClick:n,title:S("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body settings-body",children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.appearance")}),l.jsxs("div",{className:"settings-row",children:[l.jsx("span",{className:"settings-label",children:S("settings.language")}),l.jsx(sv,{})]}),l.jsxs("div",{className:"settings-row settings-row-top",children:[l.jsx("span",{className:"settings-label",children:S("settings.terminalTheme")}),l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":S("settings.terminalTheme"),children:[["dark","follow"].map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"terminal-theme",checked:t.preference===b,onChange:()=>t.setPreference(b)}),S(C5[b])]},b)),l.jsx("p",{className:"modal-hint",children:S("settings.terminalTheme.hint")})]})]}),l.jsx("h3",{className:"modal-section",children:S("settings.section.panels")}),l.jsx("div",{className:"settings-panels",children:Xu.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:i.isVisible(b),onChange:T=>L(b,T.target.checked)}),S(S5[b])]},b))}),_&&l.jsxs("div",{className:"settings-confirm",role:"alert",children:[l.jsx("span",{children:S("settings.panels.consoleConfirm",{count:a})}),l.jsx("button",{className:"link-button",onClick:()=>{h(!1),p()},children:S("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>h(!1),children:S("common.cancel")})]}),l.jsx("p",{className:"modal-hint",children:S("settings.panels.cliAlways")}),w===null?l.jsx("p",{className:"modal-hint",children:S("settings.oldServer")}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.console")}),w.consoleShells.length===0?l.jsx("p",{className:"modal-hint",children:S("console.noShell")}):l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":S("settings.section.console"),children:[M.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"console-shell",checked:m===b.id,disabled:!E,onChange:()=>{g(b.id),k.setConsoleShell(b.id)}}),b.label]},b.id)),l.jsx("p",{className:"modal-hint",children:S("settings.console.hint")})]}),l.jsx("h3",{className:"modal-section",children:S("settings.section.clis")}),l.jsx("ul",{className:"settings-clis",children:C.map(b=>{const T=d.includes(b.id),D=w.disabledAtStart.includes(b.id),B=b.available||D;return l.jsxs("li",{className:"settings-cli",children:[B?l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:!T,disabled:!E,onChange:O=>{const F=x5(d,b.id,!O.target.checked);f(F),k.setDisabledAgents(F)}}),l.jsx("span",{className:"settings-cli-name",children:b.label})]}):l.jsx("span",{className:"settings-cli-name settings-cli-missing",children:b.label}),l.jsx("span",{className:"settings-cli-detail",children:b.available?b.version??"":S(D?"settings.cli.disabled":"settings.cli.notInstalled")}),!B&&l.jsx("a",{className:"link-button",href:b.installUrl,target:"_blank",rel:"noreferrer noopener",children:S("settings.cli.install")})]},b.id)})}),l.jsx("p",{className:"modal-hint",children:S("settings.cli.hint")}),x&&l.jsx("p",{className:"settings-restart",children:S("settings.cli.restart")}),r&&l.jsx("p",{className:"modal-hint",children:S("settings.hostOnly")}),k.problem!==null&&l.jsxs("p",{className:"settings-problem",role:"alert",children:[k.problem,l.jsx("button",{className:"link-button",onClick:k.dismissProblem,children:S("common.close")})]})]}),(u!==null||v!==null)&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.more")}),l.jsxs("div",{className:"settings-row settings-more",children:[u!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:u,children:S("settings.more.open",{name:oi()})}),v!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:v,children:S("settings.more.open",{name:S("app.header.remoteAccess")})})]})]})]})]})})}function L5(n){const[t,i]=N.useState(null),[a,p]=N.useState(null);N.useEffect(()=>n.onMessage(u=>{switch(u.type){case"settings.status":i(u.settings),p(null);break;case"error":if(u.code!=="settings-failed")break;p(Dt(u.text)),u.detail!==void 0&&console.error("[servidor]",u.detail);break}}),[n]);const k=N.useCallback(u=>n.send({type:"settings.update",consoleShell:u}),[n]),C=N.useCallback(u=>n.send({type:"settings.update",disabledAgents:u}),[n]),r=N.useCallback(()=>p(null),[]);return{status:t,problem:a,setConsoleShell:k,setDisabledAgents:C,dismissProblem:r}}function T5({status:n,agents:t,indexReady:i,problem:a,covered:p,onMeasure:k,onSetEnabled:C,onChangeDir:r,onReveal:u,onDismissProblem:v,onClose:_}){return N.useEffect(()=>{if(p)return;const h=w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),_())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[p,_]),l.jsx("div",{className:"modal-backdrop",onClick:_,children:l.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":oi(),onClick:h=>h.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:oi()}),n!==null&&l.jsx("span",{className:`vault-state${n.enabled?" vault-state-on":""}`,children:WC(n)}),l.jsx("button",{className:"icon-button",onClick:_,title:S("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:"vault-lead",children:BC()}),l.jsx("p",{className:"modal-hint",children:FC()}),n===null?l.jsx("p",{className:"modal-hint",children:S("vault.dialog.waiting")}):l.jsx(R5,{status:n,agents:t,indexReady:i,onMeasure:k,onSetEnabled:C,onChangeDir:r,onReveal:u}),a!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:a}),l.jsx("button",{className:"icon-button",onClick:v,title:S("common.dismissNotice"),children:"×"})]})]})]})})}function R5({status:n,agents:t,indexReady:i,onMeasure:a,onSetEnabled:p,onChangeDir:k,onReveal:C}){const r=KC(n,i),u=GC(n),v=VC(n),_=n.measurement===null?null:QC(n.measurement,t),h=n.progress;return l.jsxs(l.Fragment,{children:[n.enabled&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("vault.dialog.inFolder")}),l.jsxs("p",{className:"vault-summary",children:[Pg(n.sessions)," · ",_n(n.bytes),n.lastPassAt!==null&&l.jsxs(l.Fragment,{children:[" · ",S("vault.dialog.lastPass",{when:os(n.lastPassAt)})]}),n.pending>0&&l.jsxs(l.Fragment,{children:[" · ",S("vault.dialog.pendingCalm",{count:n.pending})]})]})]}),h!==null&&h.total>0&&l.jsx("progress",{className:"vault-progress",value:h.done,max:h.total}),l.jsx("h3",{className:"modal-section",children:S("vault.dialog.sizeSection")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button vault-measure",onClick:a,disabled:r!==null,title:r??S("vault.dialog.measureTitle"),children:n.state==="measuring"?S("vault.state.measuring"):S(_===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),_!==null&&l.jsx("span",{className:"modal-hint",children:_.summary})]}),_!==null&&l.jsx("div",{className:"vault-table-wrap",children:l.jsxs("table",{className:"vault-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"CLI"}),l.jsx("th",{children:S("vault.dialog.table.sessions")}),l.jsx("th",{children:S("vault.dialog.table.size")}),l.jsx("th",{children:S("vault.dialog.table.images")}),l.jsx("th",{title:S("vault.dialog.table.archivedTitle"),children:S("vault.dialog.table.archived")})]})}),l.jsxs("tbody",{children:[_.rows.map(w=>l.jsxs("tr",{children:[l.jsxs("td",{children:[w.label,w.note!==null&&l.jsx("span",{className:"vault-table-note",children:w.note})]}),l.jsx("td",{children:w.sessions}),l.jsx("td",{children:_n(w.bytes)}),l.jsx("td",{title:w.images>0?_n(w.imageBytes):void 0,children:w.images}),l.jsx("td",{children:w.skippedArchived})]},w.agent)),l.jsxs("tr",{children:[l.jsx("td",{children:S("vault.dialog.table.memory",{count:_.memoryProjects})}),l.jsx("td",{}),l.jsx("td",{children:_n(_.memoryBytes)}),l.jsx("td",{}),l.jsx("td",{})]})]}),l.jsx("tfoot",{children:l.jsxs("tr",{children:[l.jsx("td",{children:S("vault.dialog.table.total")}),l.jsx("td",{children:_.total.sessions}),l.jsx("td",{children:_n(_.total.bytes)}),l.jsx("td",{children:_.total.images}),l.jsx("td",{children:_.total.skippedArchived})]})})]})}),l.jsxs("div",{className:"vault-actions vault-switch",children:[v==="enabled"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>p(!1),children:S("vault.dialog.turnOff")}),l.jsx("span",{className:"modal-hint",children:S("vault.dialog.turnOffHint")})]}),(v==="measured"||v==="existing")&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"primary-button",onClick:()=>p(!0),title:S(v==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:S("vault.dialog.activate")}),l.jsx("span",{className:"modal-hint",children:S(v==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),v==="needs-measure"&&l.jsx("span",{className:"modal-hint",children:S("vault.dialog.needsMeasure",{activate:S("vault.dialog.activate")})})]}),l.jsx("h3",{className:"modal-section",children:S("vault.dialog.folderSection")}),l.jsx("p",{className:"vault-dir",title:n.dir,children:n.dir}),n.isDefaultDir&&l.jsx("p",{className:"modal-hint",children:S("vault.dialog.defaultDir")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button",onClick:k,disabled:u!==null,title:u??S("vault.dialog.changeDirTitle"),children:S("vault.dialog.changeDir")}),C!==null&&l.jsx("button",{className:"link-button",onClick:C,title:S("vault.dialog.openFolderTitle"),children:S("vault.dialog.openFolder")})]}),n.previousDir!==null&&l.jsx("p",{className:"modal-hint",children:YC(n.previousDir)}),n.lastError!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("vault.dialog.lastError")}),l.jsx("p",{className:"vault-error",children:Dt(n.lastError)})]})]})}function M5({preview:n,files:t,running:i,error:a,onConfirm:p,onClose:k}){N.useEffect(()=>{const r=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),k())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[k]);const C=S("rewind.title");return l.jsx("div",{className:"modal-backdrop",onClick:k,children:l.jsxs("div",{className:"modal rewind-dialog",role:"dialog","aria-label":C,onClick:r=>r.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:C}),l.jsx("button",{className:"icon-button",onClick:k,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[n.length>0&&l.jsx("blockquote",{className:"rewind-quote",children:n}),l.jsx("p",{className:"modal-hint",children:S("rewind.intro")}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("rewind.filesSection")}),l.jsx("ul",{className:"rewind-files",children:t.map(r=>l.jsx("li",{children:r},r))}),l.jsx("p",{className:"modal-hint",children:S("rewind.filesHint")})]}),a!==null&&l.jsx("p",{className:"rewind-error",children:a}),l.jsxs("div",{className:"rewind-actions",children:[t.length>0?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"primary-button",disabled:i,onClick:()=>p("conversation-and-code"),children:S("rewind.undoAll")}),l.jsx("button",{className:"primary-button",disabled:i,onClick:()=>p("conversation"),children:S("rewind.undoConversation")})]}):l.jsx("button",{className:"primary-button",disabled:i,onClick:()=>p("conversation"),children:S("rewind.undo")}),l.jsx("button",{className:"link-button",onClick:k,children:S("common.cancel")}),i&&l.jsx("span",{className:"modal-hint",children:S("rewind.running")})]})]})]})})}function A5(n){const[t,i]=N.useState(null),a=N.useRef(null),p=N.useRef(null),k=N.useCallback(v=>{a.current=v,i(v)},[]);N.useEffect(()=>n.onMessage(v=>{const _=p.current;if(_!==null){if(v.type==="agent.rewound"&&v.requestId===_){p.current=null,k(null);return}if(v.type==="error"&&v.requestId===_){p.current=null;const h=a.current;h!==null&&k({...h,phase:"failed",error:Dt(v.text)})}}}),[n,k]);const C=N.useCallback((v,_)=>{p.current=null,k({terminalId:v,eventId:_,phase:"confirm",error:null})},[k]),r=N.useCallback(v=>{const _=a.current;if(_===null||_.phase==="running")return;const h=crypto.randomUUID();p.current=h,n.send({type:"agent.rewind",terminalId:_.terminalId,eventId:_.eventId,restore:v,requestId:h}),k({..._,phase:"running",error:null})},[n,k]),u=N.useCallback(()=>{p.current=null,k(null)},[k]);return{state:t,open:C,confirm:r,close:u}}const em={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},tm=320,N5=1400,D5=640,nm=200,sm=560,I5=270,j5=120,P5=720,O5=260,rm="agent-workbench.panel-width",im="agent-workbench.panel-visible",om="agent-workbench.panel-tab",du="agent-workbench.panel-expanded",lm="agent-workbench.sidebar-visible",am="agent-workbench.sidebar-width",cm="agent-workbench.console-visible",um="agent-workbench.console-height",hm="agent-workbench.marker-notice-dismissed",dm="agent-workbench.hidden-hint-shown";function B5(){var Po,Oo;const n=mo(),t=p5(),{connection:i,status:a,agents:p,defaultAgent:k,capabilitiesFor:C,offerAgentChoice:r,cliAvailable:u,cliVersion:v,cliMissingMessage:_,platform:h,defaultCwd:w,environmentNotice:E,shellName:R,terminals:g,archiveSessions:c,shells:f,pendingOpens:m,activeTerminalId:d,projects:L,indexStatus:I,error:x,dismissError:M,setActiveTerminal:b,openTerminal:T,openShell:D,closeTerminal:B,wakeTerminal:O,waking:F,activity:U,offlineReasons:q,relaunching:G,renameTerminal:Y,reorderTabs:W,refreshIndex:j,refreshAgents:$,continueSession:H,handoffs:V,dismissHandoff:te,returnedMessages:ie,dismissReturned:pe,prefills:me,prefillApplied:X,drafts:K,remoteClient:J,fileCheck:Z,fileWrite:_e}=t,ve=$k(),ye=zk(ve.resolved),Ee=N.useMemo(()=>({nameOf:re=>aE(g.find(Se=>Se.terminalId===re)),activate:b}),[g,b]),fe=dE(U,Ee),Ae=fE(),ne=g.find(re=>re.terminalId===d)??null,Ie=N.useCallback(re=>{re!==d&&M(),b(re)},[d,M,b]),oe=(ne==null?void 0:ne.agent)??null,ue=C(oe),de=N.useMemo(()=>Gw(ue),[ue]),Me=p.find(re=>re.id===oe)??null,Re=N.useMemo(()=>{if(ne===null||oe===null)return null;for(const re of L){const Se=re.sessions.find(ot=>ot.agent===oe&&ot.sessionId===ne.sessionId);if(Se!==void 0)return is(Se.title,Se.titleSource)}return null},[ne,oe,L,n]),Ke=N.useMemo(()=>zw(g,L.flatMap(re=>re.sessions)),[g,L]),Ue=(Me==null?void 0:Me.statusLine)??null,st=(ne==null?void 0:ne.cwd)??w,Tt=N.useMemo(()=>r?wy(g,st,h,p,k):null,[r,g,st,h,p,k]),lt=N.useMemo(()=>Pf(m,st,h),[m,st,h]),yt=lt?Km():null,ct=Ok(i),We=s5(i),[Ge,bt]=N.useState(!1),it=_E(i),[Wt,Pt]=N.useState(!1),he=sb(),Oe=b5(),[Qe,Ot]=N.useState(!1),ze=N.useCallback(()=>Ot(!1),[]),[xe,He]=N.useState(()=>xt(Uf,"chat",E1)),ut=N.useMemo(()=>L1({hasTab:ne!==null,plansAvailable:de.plansAvailable,hidden:Oe.hidden}),[ne,de.plansAvailable,Oe.hidden]),be=T1(xe,ut),rt=N.useCallback(re=>{He(re),wt(Uf,re)},[]),_t=N.useRef(n5);N.useEffect(()=>{if(_t.current!==null)return i.onMessage(re=>{if(re.type!=="terminal.list"||_t.current===null)return;const Se=_t.current;_t.current=null,re.terminals.some(ot=>ot.terminalId===Se&&ot.kind==="agent")&&b(Se)})},[i,b]);const ht=ek(i),nt=oC(p,We.status),[gt,Mt]=N.useState(null),Ft=N.useRef(0),Ss=N.useCallback(re=>{Mt(Se=>Se!==null&&Se.seq===re?null:Se)},[]),Mn=(re,Se)=>{const ot=yC(re,{projects:L,terminals:g,platform:h,canResume:Zn=>Nf(p,Zn)}),On=()=>{Se.length!==0&&(Ft.current+=1,Mt({query:Se,seq:Ft.current}))};switch(ot.kind){case"activate":Ie(ot.terminalId),On();break;case"resume":ot.session.archived&&c([ot.session.sessionId],!1),T({cwd:ot.cwd,resumeSessionId:ot.session.sessionId,agent:ot.session.agent,label:is(ot.session.title,ot.session.titleSource)}),On();break;case"copy":We.openSession(re.agent,re.sessionId);break}},qn=N.useMemo(()=>new Set(g.map(re=>re.sessionId).filter(re=>re.length>0)),[g]),[cn,Vn]=N.useState(()=>xt(im,!0,re=>re==="true")),[_r,ci]=N.useState(()=>xt(om,"cli",re=>re==="git"||re==="files"||re==="cli"||re==="plans"||re==="memory"?re:re==="conversation"?"cli":null)),[wr,An]=N.useState(()=>xt(rm,D5,re=>{const Se=Number.parseInt(re,10);return Number.isFinite(Se)?Math.max(Se,tm):null})),[Js,Cs]=N.useState(()=>xt(du,!1,re=>re==="true")),[xs,ks]=N.useState(()=>xt(lm,!0,re=>re==="true")),[ge,je]=N.useState(()=>xt(am,I5,re=>{const Se=Number.parseInt(re,10);return Number.isFinite(Se)?Math.min(sm,Math.max(nm,Se)):null})),[Je,St]=N.useState(()=>xt(cm,!1,re=>re==="true")),[dt,ft]=N.useState(()=>xt(um,O5,re=>{const Se=Number.parseInt(re,10);return Number.isFinite(Se)?Se:null})),[as,cs]=N.useState(()=>xt(hm,!0,re=>re!=="true")),[vo,Es]=N.useState(!1),ui=L5(i),[_o,Kn]=N.useState(!1),nn=ui.status!==null?ui.status.shellName:R,[wo,un]=N.useState(null),[Zl,hi]=N.useState(!1);N.useEffect(()=>{Ue===null&&hi(!1)},[Ue]);const[di,Nn]=N.useState(null),Gn=cn&&ne!==null,Yn=oy(_r,de.plansAvailable,Oe.hidden),us=Je&&Oe.isVisible("console"),Ls=ne!==null?cn||us:cn,fi=Js&&ne!==null,hn=N.useMemo(()=>ne===null?[]:f.filter(re=>re.cwd===ne.cwd),[f,ne]),[yo,yr]=N.useState(null),Sn=hn.find(re=>re.terminalId===yo)??hn[0]??null,br=be==="cli"?d:be==="console"?(Sn==null?void 0:Sn.terminalId)??null:null,pi=N.useCallback(re=>{br!==null&&i.send({type:"input",terminalId:br,data:re})},[i,br]),Ze=PS(i,d),Sr=mE(i,U),mi=he?ne!==null:Gn,gi=he?be==="files":Gn&&Yn==="files",vi=Nk(i,mi?d:null),bo=Zx(i,gi?d:null),_i=tk(i,d),Cr=yk(i,g,d,_e),Ts=Pk(i,mi?d:null),Xn=he?be==="cli":Gn&&Yn==="cli",Dn=Ze.usage.lastModel,In=Vw(Ze.events,Ze.usage.lastEffort,(ne==null?void 0:ne.launchedAt)??null),Rs=Dn??Ze.defaults.model,Ms=In??Ze.defaults.effort,Qn=Dn===null&&Rs!==null,ea=In===null&&Ms!==null,wi=Qx(i,d,Xn),Jn=d===null?null:U.get(d)??null,So=Oy(ue,Ze.openToolCall,(Me==null?void 0:Me.label)??null,(ne==null?void 0:ne.alive)??!1,Jn),xr=By({offlineReason:d===null?null:q.get(d)??null,alive:(ne==null?void 0:ne.alive)??!1,relaunching:d!==null&&G.has(d)}),As=xr===null?null:Fy((Me==null?void 0:Me.label)??null),Co=As??So??Wy(ue,Ze.waitingFor,(ne==null?void 0:ne.alive)??!1),ta=!pm(ue,Jn),Zs=N.useMemo(()=>qm(p,oe),[p,oe]),Ns=ne!==null&&Iy(oe,ne.sessionId,ue),sn=d===null?null:V.get(d)??null,kr=sn===null?null:{text:Ly(po(sn.sourceAgent,p),sn.includedTurns,sn.totalTurns,sn.totalTurnsIsMinimum),status:sn.prefillReason!==null?Ay(sn.prefillReason):sn.delivery==="sending"&&Ze.events.length===0?Ty():null},xo=d===null?void 0:ie.get(d),na=kr??(xo===void 0?null:{text:xo==="stopped-early"?My():Ry((Me==null?void 0:Me.label)??null),status:null}),Er=N.useCallback(re=>{te(re),pe(re)},[te,pe]),jn=N.useCallback(()=>{Vn(re=>{const Se=!re;return wt(im,String(Se)),Se})},[]),Lr=N.useCallback(()=>{ks(re=>{const Se=!re;return wt(lm,String(Se)),Se})},[]),yi=N.useCallback(()=>{St(re=>{const Se=!re;return wt(cm,String(Se)),Se})},[]),Cn=N.useCallback(re=>{ci(re),wt(om,re)},[]),bi=N.useCallback(()=>{Cs(re=>{const Se=!re;return wt(du,String(Se)),Se})},[]),hs=A5(i),{open:Si}=hs,Tr=N.useCallback(re=>{d!==null&&Si(d,re)},[Si,d]),Rr=N.useCallback(re=>{d!==null&&i.send({type:"input",terminalId:d,data:`${re} `})},[i,d]),er=N.useRef(null),rn=N.useCallback(re=>{var Se;return(Se=er.current)==null?void 0:Se.call(er,re,!he)},[he]),ds=re=>{if(Cr.files.open({key:re,title:re.split("/").pop()??re}),he){rt("files");return}Gn||jn(),Cn("files")},Mr=N.useRef(ds);Mr.current=ds;const tr=N.useCallback(re=>Mr.current(re),[]),sa=N.useMemo(()=>g.map(re=>re.terminalId),[g]),Ci=Ak({connection:i,enabled:Z&&Oe.isVisible("files"),terminalId:d,cwd:(ne==null?void 0:ne.cwd)??"",platform:h,events:Ze.events,liveTerminalIds:sa,onOpen:tr}),xi=N.useCallback(re=>{d!==null&&i.send({type:"agent.submit",terminalId:d,text:re,images:[],keepDraft:!0})},[i,d]),nr=N.useCallback(re=>{d!==null&&i.send({type:"files.reveal",terminalId:d,path:re})},[i,d]),Pn=N.useRef(new Set);N.useEffect(()=>{const re=Bb(Pn.current,{consoleShown:us,cwd:(ne==null?void 0:ne.cwd)??null,shellCwds:f.map(Se=>Se.cwd)});Pn.current=re.requested,re.open!==null&&D(re.open)},[us,ne,f,D]);const ko=N.useCallback(re=>{const Se=hn.find(ot=>ot.terminalId===re);Se!==void 0&&(Pn.current=sp(Pn.current,Se.cwd)),B(re)},[hn,B]),ki=N.useCallback(re=>{if(re==="console")for(const Se of f)B(Se.terminalId);Oe.setVisible(re,!1),!xt(dm,!1,Se=>Se==="true")&&(wt(dm,"true"),un(re))},[f,B,Oe]),ra=N.useCallback(()=>{for(const re of f)B(re.terminalId);Oe.setVisible("console",!1)},[f,B,Oe]),Eo=N.useRef(new Set);N.useEffect(()=>{const re=hn.filter(ot=>!Eo.current.has(ot.terminalId));for(const ot of hn)Eo.current.add(ot.terminalId);const Se=re[re.length-1];Se!==void 0&&yr(Se.terminalId)},[hn]);const Ei=N.useCallback(()=>{ne!==null&&(Pn.current=sp(Pn.current,ne.cwd),D(ne.cwd))},[ne,D]),ia=Bl({min:tm,max:N5,value:wr,measure:N.useCallback(re=>window.innerWidth-re.clientX,[]),onChange:An,onCommit:N.useCallback(re=>wt(rm,String(re)),[]),onStart:N.useCallback(()=>{Cs(!1),wt(du,"false")},[])}),oa=Bl({min:nm,max:sm,value:ge,measure:N.useCallback(re=>re.clientX,[]),onChange:je,onCommit:N.useCallback(re=>wt(am,String(re)),[])}),Lo=N.useRef(0),la=Bl({min:j5,max:P5,value:dt,measure:N.useCallback(re=>Math.round(Lo.current-re.clientY),[]),onChange:ft,onCommit:N.useCallback(re=>wt(um,String(re)),[]),onStart:N.useCallback(re=>{const Se=re.currentTarget.nextElementSibling;Lo.current=Se===null?window.innerHeight:re.clientY+Se.getBoundingClientRect().height},[])}),aa=N.useCallback(()=>{cs(!1),wt(hm,"true")},[]),Ar=N.useCallback(re=>{if(g.length===0)return;const ot=(g.findIndex(Zn=>Zn.terminalId===d)+re+g.length)%g.length,On=g[ot];On!==void 0&&Ie(On.terminalId)},[g,d,Ie]),To=N.useRef(null),Li=N.useRef(null);N.useEffect(()=>{d!==Li.current&&(To.current=Li.current,Li.current=d)},[d]);const Ro=N.useCallback(()=>{const re=To.current;re===null||re===d||g.some(Se=>Se.terminalId===re)&&Ie(re)},[d,g,Ie]);N.useEffect(()=>{const re=Se=>{if(Se.key!=="Tab"||!Se.shiftKey||Se.altKey||Se.ctrlKey||Se.metaKey)return;const ot=document.activeElement;ot instanceof Element&&ot.closest(".xterm")!==null||(Se.preventDefault(),Se.stopPropagation(),Ro())};return window.addEventListener("keydown",re,!0),()=>window.removeEventListener("keydown",re,!0)},[Ro]),N.useEffect(()=>{const re=Se=>{if(!Se.altKey||Se.ctrlKey||Se.metaKey)return;const ot=Se.key.toLowerCase();if(ot==="t"){u&&w.length>0&&!lt&&(Se.preventDefault(),Se.stopPropagation(),T({cwd:(ne==null?void 0:ne.cwd)??w}));return}if(ot==="w"){d!==null&&(Se.preventDefault(),Se.stopPropagation(),B(d));return}if(ot==="p"){Se.preventDefault(),Se.stopPropagation(),jn();return}if(ot==="arrowright"||ot==="pagedown"){Se.preventDefault(),Se.stopPropagation(),Ar(1);return}(ot==="arrowleft"||ot==="pageup")&&(Se.preventDefault(),Se.stopPropagation(),Ar(-1))};return window.addEventListener("keydown",re,!0),()=>window.removeEventListener("keydown",re,!0)},[ne,d,u,B,Ar,w,lt,T,jn]);const ca=ne===null?S("app.panel.name"):ne.label.length>0?ne.label:ne.cwd.split(/[\\/]/).filter(re=>re.length>0).pop()??ne.cwd,Nr=l.jsx(ix,{projects:L,indexStatus:I,disabled:!u,onOpenProject:(re,Se)=>{ze(),T({cwd:re,...Se!==void 0?{agent:Se}:{}})},agents:p,offerAgentChoice:r,agentForProject:re=>yy(g,re,h,p,k),onOpenSession:(re,Se)=>{ze(),T({cwd:re,resumeSessionId:Se.sessionId,agent:Se.agent,label:is(Se.title,Se.titleSource)})},canResume:re=>Nf(p,re),platform:h,onRefresh:j,openSessionIds:qn,openBlocked:re=>Pf(m,re,h),onArchive:c,onHide:he?ze:Lr,width:ge,onNewProject:()=>{ze(),Nn("project")},vault:We.status,onOpenVault:()=>{ze(),bt(!0)},onOpenVaultSession:J?null:re=>We.openSession(re.agent,re.sessionId),onExportProject:J?null:We.exportProject,exporting:We.exporting,lastExported:We.lastExported,onContinueSession:(re,Se)=>{ze(),H({agent:re.agent,sessionId:re.sessionId},Se,If(is(re.title,re.titleSource)))},globalSearch:nt?{...ht,vaultEnabled:((Po=We.status)==null?void 0:Po.enabled)===!0}:null,onOpenSearchHit:(re,Se)=>{ze(),Mn(re,Se)}}),Mo=l.jsx("div",{className:"chat-stack",children:g.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx("p",{children:S("app.empty.noTabs")}),l.jsx("p",{className:"empty-hint",children:S("app.empty.hint")}),u&&w.length>0&&l.jsx("button",{className:"primary-button",onClick:()=>T({cwd:w}),disabled:lt,title:yt??void 0,children:lt?S("app.empty.opening"):S("app.empty.newSession",{cwd:w})})]}):l.jsx(qS,{view:Ze,terminalId:d,threadFont:Ae,fileLinks:Ci,onRewind:de.rewind&&(ne==null?void 0:ne.alive)===!0?Tr:void 0,rewindBlocked:Jn!=="idle",forceSendAvailable:de.forceSend&&(ne==null?void 0:ne.alive)===!0,questionsAnswerable:de.questionsAnswerable,contextWindowSource:de.contextWindowSource,instructionsFile:Kw(oe),onGoToCli:()=>{if(he){rt("cli");return}Gn||jn(),Cn("cli")},cliPresence:ne===null||ne.alive?"live":ne.sleeping?"sleeping":"exited",exitCode:(ne==null?void 0:ne.exitCode)??null,waking:d!==null&&F.has(d),onWakeCli:()=>{d!==null&&O(d)},discovering:Ns,continueTargets:Zs,continueBlockedReason:Ey((ne==null?void 0:ne.sessionId)??"",Ns,Ze.events.length>0),onContinue:ne===null||oe===null?void 0:re=>H({agent:oe,sessionId:ne.sessionId},re,If(Re??ne.label)),searchRequest:gt,onSearchRequestApplied:Ss,toolCallNotice:So,serverClosed:xr===null||As===null?null:{state:xr,text:As},statusLineState:(Ue==null?void 0:Ue.state)??null,onConfigureStatusLine:Ue===null?void 0:()=>hi(!0),activity:Jn,receipt:d===null?null:Sr.receipts.get(d)??null,clock:d===null?null:Sr.clocks.get(d)??null})}),Ao=l.jsx(l.Fragment,{children:ne!==null&&l.jsx(db,{connection:i,drafts:K,terminalId:d,alive:ne.alive,sleeping:ne.sleeping,projectColor:vr(ne.cwd),activity:U.get(ne.terminalId),imagesAllowed:de.imagesAllowed,blockedReason:Co,prefills:me,onPrefillApplied:X,notice:na,onDismissNotice:d===null?void 0:()=>Er(d),onSubmitted:(re,Se,ot)=>{Er(re);const{events:On}=Ze,Zn=re===d?On[On.length-1]:void 0;Sr.track(re,Se,(Zn==null?void 0:Zn.eventId)??null,ot)},fontSize:Ae.size,insertRef:er,leading:de.modeCycle===null?void 0:l.jsx(Qy,{mode:Ze.permissionMode,cycle:de.modeCycle,disabled:!ne.alive,waitingFor:Ze.waitingFor,statusKnown:ta,onChange:Ze.setPermissionMode}),controls:de.models===null&&de.efforts===null?void 0:l.jsx(Xy,{models:de.models,efforts:de.efforts,model:Rs,effort:Ms,modelProvisional:Qn,effortProvisional:ea,savesChoice:qw(oe),effortCommandName:$w(oe),disabled:!ne.alive,onCommand:xi})})}),No=ne===null?null:l.jsx(Vx,{tab:he?Wf(be)??Yn:Yn,plansAvailable:de.plansAvailable,hiddenTabs:Oe.hidden,hidden:he?Wf(be)===null:!cn,onTabChange:he?rt:Cn,title:ca,cwd:ne.cwd,platform:h,cli:l.jsx("div",{className:"terminal-stack",children:g.map(re=>l.jsx(hg,{terminalId:re.terminalId,connection:i,active:re.terminalId===d,theme:ye.resolved,autoFocus:!1},re.terminalId))}),cliUnseen:wi,expanded:Js,onToggleExpanded:bi,git:vi,files:bo,plans:_i,documents:Cr,memory:Ts,onInsert:de.fileMentions&&ne.alive?Rr:void 0,onInsertPath:rn,onReveal:J?null:nr,onHide:jn}),Ti=ne===null?null:l.jsx(Ob,{connection:i,shells:hn,activeShellId:(Sn==null?void 0:Sn.terminalId)??null,cwd:ne.cwd,shellName:nn,theme:ye.resolved,onSelect:yr,onOpen:Ei,onCloseShell:ko,onCollapse:he?()=>rt("chat"):yi,onHide:he?void 0:()=>ki("console"),hideCount:f.length}),Do=Oe.isVisible("notes")?l.jsx(qE,{notes:ct,fill:he||ne===null,onHide:he?void 0:()=>ki("notes"),onSendNote:ne===null||!de.noteSendable?null:re=>{const Se=ne.cwd;T({cwd:Se,...ne.agent!==null?{agent:ne.agent}:{},onOpened:ot=>{i.send({type:"notes.send",noteId:re,terminalId:ot.terminalId}),he&&rt("chat")}})},sendTargetCwd:(ne==null?void 0:ne.cwd)??null}):null,ua=ne===null||!Oe.isVisible("console")?null:l.jsx(l.Fragment,{children:us?l.jsxs(l.Fragment,{children:[cn&&l.jsx("div",{className:"hdivider",...la,title:S("app.divider.consoleHeight")}),l.jsx("div",{className:"console-slot",style:cn?{height:`${dt}px`}:{flex:"1 1 auto"},children:Ti})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:yi,title:nn===null?S("console.openAnyIn",{cwd:ne.cwd}):S("console.openIn",{shell:nn,cwd:ne.cwd}),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:nn??S("console.name")}),hn.length>0&&l.jsx("span",{className:"strip-collapsed-count",children:hn.length})]}),l.jsx(Wl,{title:S("settings.hide.console"),onHide:()=>ki("console"),confirmText:f.length===0?null:S("settings.panels.consoleConfirm",{count:f.length})})]})}),Io=l.jsxs(l.Fragment,{children:[a==="revoked"&&l.jsx("div",{className:"banner banner-error",children:S("app.banner.revoked")}),wo!==null&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:S("settings.hiddenHint",{name:S(wo==="console"?"console.name":"notes.name")})}),l.jsx("button",{className:"banner-close",onClick:()=>un(null),title:S("common.gotIt"),children:"×"})]}),!u&&_!==null&&l.jsx("div",{className:"banner banner-error banner-lines",children:_}),E==="child-session-marker"&&as&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:Yt("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),l.jsx("button",{className:"banner-close",onClick:aa,title:S("common.gotIt"),children:"×"})]}),x!==null&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:x.message}),l.jsx("button",{className:"banner-close",onClick:M,title:S("common.close"),children:"×"})]}),We.problem!==null&&!Ge&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:We.problem}),l.jsx("button",{className:"banner-close",onClick:We.dismissProblem,title:S("common.close"),children:"×"})]}),l.jsx(MC,{})]}),sr=hs.state,jo=l.jsxs(l.Fragment,{children:[sr!==null&&l.jsx(M5,{preview:US(Ze.events.find(re=>re.eventId===sr.eventId)),files:$S(Ze.events,sr.eventId,(ne==null?void 0:ne.cwd)??""),running:sr.phase==="running",error:sr.error,onConfirm:hs.confirm,onClose:hs.close}),Zl&&Ue!==null&&Me!==null&&l.jsx(RC,{info:Ue,agentLabel:Me.label,onRefresh:$,onClose:()=>hi(!1)}),_o&&l.jsx(E5,{onClose:()=>Kn(!1),terminalTheme:ye,panels:Oe,consoleCount:he?0:f.length,onHideConsole:ra,appSettings:ui,agents:p,remoteClient:J,onOpenVault:()=>{Kn(!1),bt(!0)},onOpenRemote:it.status!==null&&!J?()=>{Kn(!1),Pt(!0)}:null}),vo&&l.jsx(EC,{agent:ly(oe,p,k),onClose:()=>Es(!1)}),di==="project"&&l.jsx(vp,{connection:i,title:S("app.picker.project.title"),confirmLabel:S("app.picker.project.confirm"),confirmTitle:re=>S("app.picker.project.confirmTitle",{path:re}),onChoose:(re,Se)=>{Nn(null),T({cwd:Se})},onClose:()=>Nn(null)}),Ge&&l.jsx(T5,{status:We.status,agents:p,indexReady:I.state==="ready",problem:We.problem,covered:di==="vault",onMeasure:We.measure,onSetEnabled:We.setEnabled,onChangeDir:()=>Nn("vault"),onReveal:J?null:We.reveal,onDismissProblem:We.dismissProblem,onClose:()=>bt(!1)}),Wt&&it.status!==null&&!J&&l.jsx(HE,{status:it.status,pairing:it.pairing,phonePairing:it.phonePairing,phoneStarted:it.phoneStarted,problem:it.problem,platform:h,onSetEnabled:it.setEnabled,onSetPort:it.setPort,onStartPairing:it.startPairing,onCancelPairing:it.cancelPairing,onStartPhonePairing:it.startPhonePairing,onCancelPhonePairing:it.cancelPhonePairing,onRenameDevice:it.renameDevice,onRevokeDevice:it.revokeDevice,onDismissProblem:it.dismissProblem,onClose:()=>Pt(!1)}),di==="vault"&&l.jsx(vp,{connection:i,title:S("app.picker.vault.title"),confirmLabel:S("app.picker.vault.confirm"),confirmTitle:re=>S("app.picker.vault.confirmTitle",{path:re}),onChoose:re=>{We.chooseDir(re),Nn(null)},onClose:()=>Nn(null)})]});return he?l.jsxs("div",{className:"app app-narrow",children:[l.jsx(QE,{banners:Io,status:a,statusLabel:S(em[a]),terminals:g,activeTerminalId:d,activity:U,agents:p,offerAgentChoice:r,newTabAgent:Tt,canOpen:u&&w.length>0,newTabBlockedTitle:yt,onSelectTab:Ie,onCloseTab:B,onRenameTab:Y,onNewTab:re=>T({cwd:st,...re!==void 0?{agent:re}:{}}),drawer:Nr,drawerOpen:Qe,onDrawerChange:Ot,menu:{cwd:(ne==null?void 0:ne.cwd)??null,cliVersion:v,themeIcon:Fp[ve.preference],themeTitle:Bp(ve.preference),onCycleTheme:ve.cycle,sound:fe,remote:it.status!==null&&!J?{title:`${S("app.header.remoteAccess")} — ${Du(it.status.state,it.status.port)}`,active:Kp(it.status),onOpen:()=>Pt(!0)}:null,remoteClient:J,onShortcuts:()=>Es(!0),onSettings:()=>Kn(!0)},view:be,views:ut,onViewChange:rt,badges:{changes:Ug(vi.status),plans:_i.plans.length,memory:((Oo=Ts.status)==null?void 0:Oo.installed)===!0?Ts.status.notes.length:0,cliUnseen:wi},chat:l.jsxs(l.Fragment,{children:[Mo,Ao]}),panel:No,notes:Do,console:Ti,onTerminalKey:br===null?null:pi}),jo]}):l.jsxs("div",{className:"app",children:[l.jsxs("header",{className:"app-header",children:[l.jsx("span",{className:"app-name",children:"Agent Workbench"}),l.jsx("span",{className:`status status-${a}`,children:S(em[a])}),ne!==null&&l.jsx("span",{className:"meta",title:ne.cwd,children:ne.cwd}),l.jsx("span",{className:"header-spacer"}),v!==null&&l.jsx("span",{className:"meta meta-dim",children:S("app.header.cliVersion",{version:v})}),l.jsx("button",{className:"icon-button",onClick:ve.cycle,title:Bp(ve.preference),children:Fp[ve.preference]}),l.jsx(Zg,{sound:fe}),l.jsx(ev,{notify:fe.notify}),it.status!==null&&!J&&l.jsx("button",{className:`icon-button${Kp(it.status)?" icon-button-on":""}`,onClick:()=>Pt(!0),title:`${S("app.header.remoteAccess")} — ${Du(it.status.state,it.status.port)}`,children:"⇄"}),J&&l.jsx("span",{className:"remote-badge",title:S("app.header.remoteBadgeTitle"),children:S("app.header.remoteBadge")}),l.jsx("button",{className:"icon-button",onClick:()=>Kn(!0),title:S("settings.open"),"aria-label":S("settings.open"),children:"⚙"}),l.jsx("button",{className:"icon-button",onClick:()=>Es(!0),title:S("app.header.shortcuts"),children:"?"})]}),Io,l.jsxs("div",{className:"app-body",children:[!xs&&l.jsxs("button",{className:"panel-peek panel-peek-left",onClick:Lr,title:S("app.sidebar.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"»"}),l.jsx("span",{className:"panel-peek-label",children:S("app.sidebar.name")})]}),xs&&Nr,xs&&l.jsx("div",{className:"divider",...oa,title:S("app.divider.width")}),l.jsxs("main",{className:`workspace${fi&&Ls?" workspace-narrow":""}`,children:[l.jsx(Xx,{terminals:g,activeTerminalId:d,activity:U,attention:fe.attention,canOpen:u&&w.length>0,onSelect:Ie,onClose:B,onRename:Y,onReorder:W,onNew:re=>T({cwd:st,...re!==void 0?{agent:re}:{}}),agents:p,offerAgentChoice:r,newTabAgent:Tt,pendingOpens:m,platform:h,newTabBlockedTitle:yt,sessionTitles:Ke}),Mo,Ao]}),l.jsxs(l.Fragment,{children:[!Ls&&l.jsxs("button",{className:"panel-peek",onClick:jn,title:S("app.panel.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"«"}),l.jsx("span",{className:"panel-peek-label",children:S("app.panel.name")})]}),Ls&&l.jsx("div",{className:"divider",...ia,title:S("app.divider.width")}),l.jsxs("div",{className:`panel-slot${Ls?"":" panel-slot-collapsed"}${Ls&&fi?" panel-slot-expanded":""}`,style:Ls&&!fi?{width:`${wr}px`}:void 0,children:[ne!==null&&l.jsxs(l.Fragment,{children:[No,ua]}),Do]})]})]}),jo]})}const iv=document.getElementById("root");if(iv===null)throw new Error("Falta el contenedor #root.");const F5=w_.createRoot(iv);gS().then(()=>F5.render(l.jsx(B5,{})));export{h_ as g};
|