agent-workbench 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- var P_=Object.defineProperty;var O_=(n,s,i)=>s in n?P_(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i;var Tt=(n,s,i)=>O_(n,typeof s!="symbol"?s+"":s,i);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const v of document.querySelectorAll('link[rel="modulepreload"]'))h(v);new MutationObserver(v=>{for(const R of v)if(R.type==="childList")for(const x of R.addedNodes)x.tagName==="LINK"&&x.rel==="modulepreload"&&h(x)}).observe(document,{childList:!0,subtree:!0});function i(v){const R={};return v.integrity&&(R.integrity=v.integrity),v.referrerPolicy&&(R.referrerPolicy=v.referrerPolicy),v.crossOrigin==="use-credentials"?R.credentials="include":v.crossOrigin==="anonymous"?R.credentials="omit":R.credentials="same-origin",R}function h(v){if(v.ep)return;v.ep=!0;const R=i(v);fetch(v.href,R)}})();function B_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _c={exports:{}},Bi={},vc={exports:{}},it={};/**
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 Bd;function F_(){if(Bd)return it;Bd=1;var n=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),x=Symbol.for("react.context"),r=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),u=Symbol.iterator;function y(H){return H===null||typeof H!="object"?null:(H=u&&H[u]||H["@@iterator"],typeof H=="function"?H:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,f={};function l(H,q,te){this.props=H,this.context=q,this.refs=f,this.updater=te||S}l.prototype.isReactComponent={},l.prototype.setState=function(H,q){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,q,"setState")},l.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function m(){}m.prototype=l.prototype;function p(H,q,te){this.props=H,this.context=q,this.refs=f,this.updater=te||S}var d=p.prototype=new m;d.constructor=p,L(d,l.prototype),d.isPureReactComponent=!0;var k=Array.isArray,D=Object.prototype.hasOwnProperty,E={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function b(H,q,te){var se,le={},ue=null,K=null;if(q!=null)for(se in q.ref!==void 0&&(K=q.ref),q.key!==void 0&&(ue=""+q.key),q)D.call(q,se)&&!M.hasOwnProperty(se)&&(le[se]=q[se]);var W=arguments.length-2;if(W===1)le.children=te;else if(1<W){for(var J=Array(W),Z=0;Z<W;Z++)J[Z]=arguments[Z+2];le.children=J}if(H&&H.defaultProps)for(se in W=H.defaultProps,W)le[se]===void 0&&(le[se]=W[se]);return{$$typeof:n,type:H,key:ue,ref:K,props:le,_owner:E.current}}function T(H,q){return{$$typeof:n,type:H.type,key:q,ref:H.ref,props:H.props,_owner:H._owner}}function N(H){return typeof H=="object"&&H!==null&&H.$$typeof===n}function B(H){var q={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(te){return q[te]})}var F=/\/+/g;function O(H,q){return typeof H=="object"&&H!==null&&H.key!=null?B(""+H.key):q.toString(36)}function U(H,q,te,se,le){var ue=typeof H;(ue==="undefined"||ue==="boolean")&&(H=null);var K=!1;if(H===null)K=!0;else switch(ue){case"string":case"number":K=!0;break;case"object":switch(H.$$typeof){case n:case s:K=!0}}if(K)return K=H,le=le(K),H=se===""?"."+O(K,0):se,k(le)?(te="",H!=null&&(te=H.replace(F,"$&/")+"/"),U(le,q,te,"",function(Z){return Z})):le!=null&&(N(le)&&(le=T(le,te+(!le.key||K&&K.key===le.key?"":(""+le.key).replace(F,"$&/")+"/")+H)),q.push(le)),1;if(K=0,se=se===""?".":se+":",k(H))for(var W=0;W<H.length;W++){ue=H[W];var J=se+O(ue,W);K+=U(ue,q,te,J,le)}else if(J=y(H),typeof J=="function")for(H=J.call(H),W=0;!(ue=H.next()).done;)ue=ue.value,J=se+O(ue,W++),K+=U(ue,q,te,J,le);else if(ue==="object")throw q=String(H),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return K}function V(H,q,te){if(H==null)return H;var se=[],le=0;return U(H,se,"","",function(ue){return q.call(te,ue,le++)}),se}function Y(H){if(H._status===-1){var q=H._result;q=q(),q.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=q)}if(H._status===1)return H._result.default;throw H._result}var X={current:null},G={transition:null},P={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:G,ReactCurrentOwner:E};function $(){throw Error("act(...) is not supported in production builds of React.")}return it.Children={map:V,forEach:function(H,q,te){V(H,function(){q.apply(this,arguments)},te)},count:function(H){var q=0;return V(H,function(){q++}),q},toArray:function(H){return V(H,function(q){return q})||[]},only:function(H){if(!N(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},it.Component=l,it.Fragment=i,it.Profiler=v,it.PureComponent=p,it.StrictMode=h,it.Suspense=c,it.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,it.act=$,it.cloneElement=function(H,q,te){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var se=L({},H.props),le=H.key,ue=H.ref,K=H._owner;if(q!=null){if(q.ref!==void 0&&(ue=q.ref,K=E.current),q.key!==void 0&&(le=""+q.key),H.type&&H.type.defaultProps)var W=H.type.defaultProps;for(J in q)D.call(q,J)&&!M.hasOwnProperty(J)&&(se[J]=q[J]===void 0&&W!==void 0?W[J]:q[J])}var J=arguments.length-2;if(J===1)se.children=te;else if(1<J){W=Array(J);for(var Z=0;Z<J;Z++)W[Z]=arguments[Z+2];se.children=W}return{$$typeof:n,type:H.type,key:le,ref:ue,props:se,_owner:K}},it.createContext=function(H){return H={$$typeof:x,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:R,_context:H},H.Consumer=H},it.createElement=b,it.createFactory=function(H){var q=b.bind(null,H);return q.type=H,q},it.createRef=function(){return{current:null}},it.forwardRef=function(H){return{$$typeof:r,render:H}},it.isValidElement=N,it.lazy=function(H){return{$$typeof:_,_payload:{_status:-1,_result:H},_init:Y}},it.memo=function(H,q){return{$$typeof:g,type:H,compare:q===void 0?null:q}},it.startTransition=function(H){var q=G.transition;G.transition={};try{H()}finally{G.transition=q}},it.unstable_act=$,it.useCallback=function(H,q){return X.current.useCallback(H,q)},it.useContext=function(H){return X.current.useContext(H)},it.useDebugValue=function(){},it.useDeferredValue=function(H){return X.current.useDeferredValue(H)},it.useEffect=function(H,q){return X.current.useEffect(H,q)},it.useId=function(){return X.current.useId()},it.useImperativeHandle=function(H,q,te){return X.current.useImperativeHandle(H,q,te)},it.useInsertionEffect=function(H,q){return X.current.useInsertionEffect(H,q)},it.useLayoutEffect=function(H,q){return X.current.useLayoutEffect(H,q)},it.useMemo=function(H,q){return X.current.useMemo(H,q)},it.useReducer=function(H,q,te){return X.current.useReducer(H,q,te)},it.useRef=function(H){return X.current.useRef(H)},it.useState=function(H){return X.current.useState(H)},it.useSyncExternalStore=function(H,q,te){return X.current.useSyncExternalStore(H,q,te)},it.useTransition=function(){return X.current.useTransition()},it.version="18.3.1",it}var Fd;function mu(){return Fd||(Fd=1,vc.exports=F_()),vc.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 Hd;function H_(){if(Hd)return Bi;Hd=1;var n=mu(),s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,v=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,R={key:!0,ref:!0,__self:!0,__source:!0};function x(r,c,g){var _,u={},y=null,S=null;g!==void 0&&(y=""+g),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(S=c.ref);for(_ in c)h.call(c,_)&&!R.hasOwnProperty(_)&&(u[_]=c[_]);if(r&&r.defaultProps)for(_ in c=r.defaultProps,c)u[_]===void 0&&(u[_]=c[_]);return{$$typeof:s,type:r,key:y,ref:S,props:u,_owner:v.current}}return Bi.Fragment=i,Bi.jsx=x,Bi.jsxs=x,Bi}var $d;function $_(){return $d||($d=1,_c.exports=H_()),_c.exports}var a=$_(),_a={},yc={exports:{}},cn={},wc={exports:{}},bc={};/**
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 Ud;function U_(){return Ud||(Ud=1,(function(n){function s(G,P){var $=G.length;G.push(P);e:for(;0<$;){var H=$-1>>>1,q=G[H];if(0<v(q,P))G[H]=P,G[$]=q,$=H;else break e}}function i(G){return G.length===0?null:G[0]}function h(G){if(G.length===0)return null;var P=G[0],$=G.pop();if($!==P){G[0]=$;e:for(var H=0,q=G.length,te=q>>>1;H<te;){var se=2*(H+1)-1,le=G[se],ue=se+1,K=G[ue];if(0>v(le,$))ue<q&&0>v(K,le)?(G[H]=K,G[ue]=$,H=ue):(G[H]=le,G[se]=$,H=se);else if(ue<q&&0>v(K,$))G[H]=K,G[ue]=$,H=ue;else break e}}return P}function v(G,P){var $=G.sortIndex-P.sortIndex;return $!==0?$:G.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var R=performance;n.unstable_now=function(){return R.now()}}else{var x=Date,r=x.now();n.unstable_now=function(){return x.now()-r}}var c=[],g=[],_=1,u=null,y=3,S=!1,L=!1,f=!1,l=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=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(G){for(var P=i(g);P!==null;){if(P.callback===null)h(g);else if(P.startTime<=G)h(g),P.sortIndex=P.expirationTime,s(c,P);else break;P=i(g)}}function k(G){if(f=!1,d(G),!L)if(i(c)!==null)L=!0,Y(D);else{var P=i(g);P!==null&&X(k,P.startTime-G)}}function D(G,P){L=!1,f&&(f=!1,m(b),b=-1),S=!0;var $=y;try{for(d(P),u=i(c);u!==null&&(!(u.expirationTime>P)||G&&!B());){var H=u.callback;if(typeof H=="function"){u.callback=null,y=u.priorityLevel;var q=H(u.expirationTime<=P);P=n.unstable_now(),typeof q=="function"?u.callback=q:u===i(c)&&h(c),d(P)}else h(c);u=i(c)}if(u!==null)var te=!0;else{var se=i(g);se!==null&&X(k,se.startTime-P),te=!1}return te}finally{u=null,y=$,S=!1}}var E=!1,M=null,b=-1,T=5,N=-1;function B(){return!(n.unstable_now()-N<T)}function F(){if(M!==null){var G=n.unstable_now();N=G;var P=!0;try{P=M(!0,G)}finally{P?O():(E=!1,M=null)}}else E=!1}var O;if(typeof p=="function")O=function(){p(F)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,V=U.port2;U.port1.onmessage=F,O=function(){V.postMessage(null)}}else O=function(){l(F,0)};function Y(G){M=G,E||(E=!0,O())}function X(G,P){b=l(function(){G(n.unstable_now())},P)}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(G){G.callback=null},n.unstable_continueExecution=function(){L||S||(L=!0,Y(D))},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_getFirstCallbackNode=function(){return i(c)},n.unstable_next=function(G){switch(y){case 1:case 2:case 3:var P=3;break;default:P=y}var $=y;y=P;try{return G()}finally{y=$}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(G,P){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var $=y;y=G;try{return P()}finally{y=$}},n.unstable_scheduleCallback=function(G,P,$){var H=n.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?H+$:H):$=H,G){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=$+q,G={id:_++,callback:P,priorityLevel:G,startTime:$,expirationTime:q,sortIndex:-1},$>H?(G.sortIndex=$,s(g,G),i(c)===null&&G===i(g)&&(f?(m(b),b=-1):f=!0,X(k,$-H))):(G.sortIndex=q,s(c,G),L||S||(L=!0,Y(D))),G},n.unstable_shouldYield=B,n.unstable_wrapCallback=function(G){var P=y;return function(){var $=y;y=P;try{return G.apply(this,arguments)}finally{y=$}}}})(bc)),bc}var Wd;function W_(){return Wd||(Wd=1,wc.exports=U_()),wc.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 zd;function z_(){if(zd)return cn;zd=1;var n=mu(),s=W_();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h=new Set,v={};function R(e,t){x(e,t),x(e+"Capture",t)}function x(e,t){for(v[e]=t,e=0;e<t.length;e++)h.add(t[e])}var r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,g=/^[: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]*$/,_={},u={};function y(e){return c.call(u,e)?!0:c.call(_,e)?!1:g.test(e)?u[e]=!0:(_[e]=!0,!1)}function S(e,t,o,w){if(o!==null&&o.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return w?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,t,o,w){if(t===null||typeof t>"u"||S(e,t,o,w))return!0;if(w)return!1;if(o!==null)switch(o.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function f(e,t,o,w,A,j,z){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=w,this.attributeNamespace=A,this.mustUseProperty=o,this.propertyName=e,this.type=t,this.sanitizeURL=j,this.removeEmptyString=z}var l={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){l[e]=new f(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];l[t]=new f(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){l[e]=new f(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){l[e]=new f(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){l[e]=new f(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){l[e]=new f(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){l[e]=new f(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){l[e]=new f(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){l[e]=new f(e,5,!1,e.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function p(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 t=e.replace(m,p);l[t]=new f(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(m,p);l[t]=new f(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(m,p);l[t]=new f(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){l[e]=new f(e,1,!1,e.toLowerCase(),null,!1,!1)}),l.xlinkHref=new f("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){l[e]=new f(e,1,!1,e.toLowerCase(),null,!0,!0)});function d(e,t,o,w){var A=l.hasOwnProperty(t)?l[t]:null;(A!==null?A.type!==0:w||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(L(t,o,A,w)&&(o=null),w||A===null?y(t)&&(o===null?e.removeAttribute(t):e.setAttribute(t,""+o)):A.mustUseProperty?e[A.propertyName]=o===null?A.type===3?!1:"":o:(t=A.attributeName,w=A.attributeNamespace,o===null?e.removeAttribute(t):(A=A.type,o=A===3||A===4&&o===!0?"":""+o,w?e.setAttributeNS(w,t,o):e.setAttribute(t,o))))}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),E=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),B=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),G=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var $=Object.assign,H;function q(e){if(H===void 0)try{throw Error()}catch(o){var t=o.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||""}return`
34
- `+H+e}var te=!1;function se(e,t){if(!e||te)return"";te=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(ce){var w=ce}Reflect.construct(e,[],t)}else{try{t.call()}catch(ce){w=ce}e.call(t.prototype)}else{try{throw Error()}catch(ce){w=ce}e()}}catch(ce){if(ce&&w&&typeof ce.stack=="string"){for(var A=ce.stack.split(`
35
- `),j=w.stack.split(`
36
- `),z=A.length-1,Q=j.length-1;1<=z&&0<=Q&&A[z]!==j[Q];)Q--;for(;1<=z&&0<=Q;z--,Q--)if(A[z]!==j[Q]){if(z!==1||Q!==1)do if(z--,Q--,0>Q||A[z]!==j[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:"")?q(e):""}function le(e){switch(e.tag){case 5:return q(e.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return""}}function ue(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 E:return"Portal";case T:return"Profiler";case b:return"StrictMode";case O:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B:return(e.displayName||"Context")+".Consumer";case N:return(e._context.displayName||"Context")+".Provider";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case Y:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}function K(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(t);case 8:return t===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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function W(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function J(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Z(e){var t=J(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),w=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var A=o.get,j=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return A.call(this)},set:function(z){w=""+z,j.call(this,z)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return w},setValue:function(z){w=""+z},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function de(e){e._valueTracker||(e._valueTracker=Z(e))}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),w="";return e&&(w=J(e)?e.checked?"true":"false":e.value),e=w,e!==o?(t.setValue(e),!0):!1}function re(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 ke(e,t){var o=t.checked;return $({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Me(e,t){var o=t.defaultValue==null?"":t.defaultValue,w=t.checked!=null?t.checked:t.defaultChecked;o=W(t.value!=null?t.value:o),e._wrapperState={initialChecked:w,initialValue:o,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function et(e,t){t=t.checked,t!=null&&d(e,"checked",t,!1)}function Le(e,t){et(e,t);var o=W(t.value),w=t.type;if(o!=null)w==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(w==="submit"||w==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Te(e,t.type,o):t.hasOwnProperty("defaultValue")&&Te(e,t.type,W(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fe(e,t,o){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var w=t.type;if(!(w!=="submit"&&w!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,o||t===e.value||(e.value=t),e.defaultValue=t}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function Te(e,t,o){(t!=="number"||re(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Ce=Array.isArray;function Ee(e,t,o,w){if(e=e.options,t){t={};for(var A=0;A<o.length;A++)t["$"+o[A]]=!0;for(o=0;o<e.length;o++)A=t.hasOwnProperty("$"+e[o].value),e[o].selected!==A&&(e[o].selected=A),A&&w&&(e[o].defaultSelected=!0)}else{for(o=""+W(o),t=null,A=0;A<e.length;A++){if(e[A].value===o){e[A].selected=!0,w&&(e[A].defaultSelected=!0);return}t!==null||e[A].disabled||(t=e[A])}t!==null&&(t.selected=!0)}}function Be(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(i(91));return $({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ve(e,t){var o=t.value;if(o==null){if(o=t.children,t=t.defaultValue,o!=null){if(t!=null)throw Error(i(92));if(Ce(o)){if(1<o.length)throw Error(i(93));o=o[0]}t=o}t==null&&(t=""),o=t}e._wrapperState={initialValue:W(o)}}function Ae(e,t){var o=W(t.value),w=W(t.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),t.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),w!=null&&(e.defaultValue=""+w)}function st(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Xe(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 Qe(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Xe(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var dt,ht=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,o,w,A){MSApp.execUnsafeLocalFunction(function(){return e(t,o,w,A)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(dt=dt||document.createElement("div"),dt.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=dt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $e(e,t){if(t){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=t;return}}e.textContent=t}var tt={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},We=["Webkit","ms","Moz","O"];Object.keys(tt).forEach(function(e){We.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),tt[t]=tt[e]})});function ot(e,t,o){return t==null||typeof t=="boolean"||t===""?"":o||typeof t!="number"||t===0||tt.hasOwnProperty(e)&&tt[e]?(""+t).trim():t+"px"}function ft(e,t){e=e.style;for(var o in t)if(t.hasOwnProperty(o)){var w=o.indexOf("--")===0,A=ot(o,t[o],w);o==="float"&&(o="cssFloat"),w?e.setProperty(o,A):e[o]=A}}var Re=$({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 Ve(e,t){if(t){if(Re[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function he(e,t){if(e.indexOf("-")===-1)return typeof t.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 me=null;function Ne(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mt=null,De=null,qe=null;function lt(e){if(e=Ci(e)){if(typeof mt!="function")throw Error(i(280));var t=e.stateNode;t&&(t=No(t),mt(e.stateNode,e.type,t))}}function Rt(e){De?qe?qe.push(e):qe=[e]:De=e}function Mt(){if(De){var e=De,t=qe;if(qe=De=null,lt(e),t)for(e=0;e<t.length;e++)lt(t[e])}}function Se(e,t){return e(t)}function Ke(){}var rt=!1;function Dt(e,t,o){if(rt)return e(t,o);rt=!0;try{return Se(e,t,o)}finally{rt=!1,(De!==null||qe!==null)&&(Ke(),Mt())}}function xt(e,t){var o=e.stateNode;if(o===null)return null;var w=No(o);if(w===null)return null;o=w[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(e=e.type,w=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!w;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(i(231,t,typeof o));return o}var mn=!1;if(r)try{var Jt={};Object.defineProperty(Jt,"passive",{get:function(){mn=!0}}),window.addEventListener("test",Jt,Jt),window.removeEventListener("test",Jt,Jt)}catch{mn=!1}function $a(e,t,o,w,A,j,z,Q,ee){var ce=Array.prototype.slice.call(arguments,3);try{t.apply(o,ce)}catch(_e){this.onError(_e)}}var js=!1,ir=null,Ps=!1,Jr=null,Zi={onError:function(e){js=!0,ir=e}};function eo(e,t,o,w,A,j,z,Q,ee){js=!1,ir=null,$a.apply(Zi,arguments)}function Zr(e,t,o,w,A,j,z,Q,ee){if(eo.apply(this,arguments),js){if(js){var ce=ir;js=!1,ir=null}else throw Error(i(198));Ps||(Ps=!0,Jr=ce)}}function Kn(e){var t=e,o=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(o=t.return),e=t.return;while(e)}return t.tag===3?o:null}function ei(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function to(e){if(Kn(e)!==e)throw Error(i(188))}function Ua(e){var t=e.alternate;if(!t){if(t=Kn(e),t===null)throw Error(i(188));return t!==e?null:e}for(var o=e,w=t;;){var A=o.return;if(A===null)break;var j=A.alternate;if(j===null){if(w=A.return,w!==null){o=w;continue}break}if(A.child===j.child){for(j=A.child;j;){if(j===o)return to(A),e;if(j===w)return to(A),t;j=j.sibling}throw Error(i(188))}if(o.return!==w.return)o=A,w=j;else{for(var z=!1,Q=A.child;Q;){if(Q===o){z=!0,o=A,w=j;break}if(Q===w){z=!0,w=A,o=j;break}Q=Q.sibling}if(!z){for(Q=j.child;Q;){if(Q===o){z=!0,o=j,w=A;break}if(Q===w){z=!0,w=j,o=A;break}Q=Q.sibling}if(!z)throw Error(i(189))}}if(o.alternate!==w)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?e:t}function no(e){return e=Ua(e),e!==null?ti(e):null}function ti(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ti(e);if(t!==null)return t;e=e.sibling}return null}var so=s.unstable_scheduleCallback,ro=s.unstable_cancelCallback,Wa=s.unstable_shouldYield,za=s.unstable_requestPaint,yt=s.unstable_now,ni=s.unstable_getCurrentPriorityLevel,si=s.unstable_ImmediatePriority,cs=s.unstable_UserBlockingPriority,Gn=s.unstable_NormalPriority,io=s.unstable_LowPriority,ri=s.unstable_IdlePriority,or=null,nn=null;function ii(e){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(or,e,void 0,(e.current.flags&128)===128)}catch{}}var Ot=Math.clz32?Math.clz32:cr,ar=Math.log,lr=Math.LN2;function cr(e){return e>>>=0,e===0?32:31-(ar(e)/lr|0)|0}var Sn=64,us=4194304;function Vt(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 ur(e,t){var o=e.pendingLanes;if(o===0)return 0;var w=0,A=e.suspendedLanes,j=e.pingedLanes,z=o&268435455;if(z!==0){var Q=z&~A;Q!==0?w=Vt(Q):(j&=z,j!==0&&(w=Vt(j)))}else z=o&~A,z!==0?w=Vt(z):j!==0&&(w=Vt(j));if(w===0)return 0;if(t!==0&&t!==w&&(t&A)===0&&(A=w&-w,j=t&-t,A>=j||A===16&&(j&4194240)!==0))return t;if((w&4)!==0&&(w|=o&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=w;0<t;)o=31-Ot(t),A=1<<o,w|=e[o],t&=~A;return w}function oo(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 hs(e,t){for(var o=e.suspendedLanes,w=e.pingedLanes,A=e.expirationTimes,j=e.pendingLanes;0<j;){var z=31-Ot(j),Q=1<<z,ee=A[z];ee===-1?((Q&o)===0||(Q&w)!==0)&&(A[z]=oo(Q,t)):ee<=t&&(e.expiredLanes|=Q),j&=~Q}}function ds(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ao(){var e=Sn;return Sn<<=1,(Sn&4194240)===0&&(Sn=64),e}function Bt(e){for(var t=[],o=0;31>o;o++)t.push(e);return t}function Yn(e,t,o){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ot(t),e[t]=o}function lo(e,t){var o=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var w=e.eventTimes;for(e=e.expirationTimes;0<o;){var A=31-Ot(o),j=1<<A;t[A]=0,w[A]=-1,e[A]=-1,o&=~j}}function oi(e,t){var o=e.entangledLanes|=t;for(e=e.entanglements;o;){var w=31-Ot(o),A=1<<w;A&t|e[w]&t&&(e[w]|=t),o&=~A}}var ct=0;function co(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var ai,li,hr,uo,ci,dr=!1,Os=[],Cn=null,In=null,jn=null,fs=new Map,Xn=new Map,xn=[],ui="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 fr(e,t){switch(e){case"focusin":case"focusout":Cn=null;break;case"dragenter":case"dragleave":In=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":fs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xn.delete(t.pointerId)}}function Bs(e,t,o,w,A,j){return e===null||e.nativeEvent!==j?(e={blockedOn:t,domEventName:o,eventSystemFlags:w,nativeEvent:j,targetContainers:[A]},t!==null&&(t=Ci(t),t!==null&&li(t)),e):(e.eventSystemFlags|=w,t=e.targetContainers,A!==null&&t.indexOf(A)===-1&&t.push(A),e)}function Va(e,t,o,w,A){switch(t){case"focusin":return Cn=Bs(Cn,e,t,o,w,A),!0;case"dragenter":return In=Bs(In,e,t,o,w,A),!0;case"mouseover":return jn=Bs(jn,e,t,o,w,A),!0;case"pointerover":var j=A.pointerId;return fs.set(j,Bs(fs.get(j)||null,e,t,o,w,A)),!0;case"gotpointercapture":return j=A.pointerId,Xn.set(j,Bs(Xn.get(j)||null,e,t,o,w,A)),!0}return!1}function ho(e){var t=Vs(e.target);if(t!==null){var o=Kn(t);if(o!==null){if(t=o.tag,t===13){if(t=ei(o),t!==null){e.blockedOn=t,ci(e.priority,function(){hr(o)});return}}else if(t===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var o=di(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var w=new o.constructor(o.type,o);me=w,o.target.dispatchEvent(w),me=null}else return t=Ci(o),t!==null&&li(t),e.blockedOn=o,!1;t.shift()}return!0}function kn(e,t,o){Fs(e)&&o.delete(t)}function qa(){dr=!1,Cn!==null&&Fs(Cn)&&(Cn=null),In!==null&&Fs(In)&&(In=null),jn!==null&&Fs(jn)&&(jn=null),fs.forEach(kn),Xn.forEach(kn)}function En(e,t){e.blockedOn===t&&(e.blockedOn=null,dr||(dr=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,qa)))}function ps(e){function t(A){return En(A,e)}if(0<Os.length){En(Os[0],e);for(var o=1;o<Os.length;o++){var w=Os[o];w.blockedOn===e&&(w.blockedOn=null)}}for(Cn!==null&&En(Cn,e),In!==null&&En(In,e),jn!==null&&En(jn,e),fs.forEach(t),Xn.forEach(t),o=0;o<xn.length;o++)w=xn[o],w.blockedOn===e&&(w.blockedOn=null);for(;0<xn.length&&(o=xn[0],o.blockedOn===null);)ho(o),o.blockedOn===null&&xn.shift()}var Qn=k.ReactCurrentBatchConfig,Hs=!0;function Ka(e,t,o,w){var A=ct,j=Qn.transition;Qn.transition=null;try{ct=1,hi(e,t,o,w)}finally{ct=A,Qn.transition=j}}function Ga(e,t,o,w){var A=ct,j=Qn.transition;Qn.transition=null;try{ct=4,hi(e,t,o,w)}finally{ct=A,Qn.transition=j}}function hi(e,t,o,w){if(Hs){var A=di(e,t,o,w);if(A===null)al(e,t,w,Jn,o),fr(e,w);else if(Va(A,e,t,o,w))w.stopPropagation();else if(fr(e,w),t&4&&-1<ui.indexOf(e)){for(;A!==null;){var j=Ci(A);if(j!==null&&ai(j),j=di(e,t,o,w),j===null&&al(e,t,w,Jn,o),j===A)break;A=j}A!==null&&w.stopPropagation()}else al(e,t,w,null,o)}}var Jn=null;function di(e,t,o,w){if(Jn=null,e=Ne(w),e=Vs(e),e!==null)if(t=Kn(e),t===null)e=null;else if(o=t.tag,o===13){if(e=ei(t),e!==null)return e;e=null}else if(o===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Jn=e,null}function fo(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(ni()){case si:return 1;case cs:return 4;case Gn:case io:return 16;case ri:return 536870912;default:return 16}default:return 16}}var Pn=null,On=null,pr=null;function mr(){if(pr)return pr;var e,t=On,o=t.length,w,A="value"in Pn?Pn.value:Pn.textContent,j=A.length;for(e=0;e<o&&t[e]===A[e];e++);var z=o-e;for(w=1;w<=z&&t[o-w]===A[j-w];w++);return pr=A.slice(e,1<w?1-w:void 0)}function gr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $s(){return!0}function po(){return!1}function Zt(e){function t(o,w,A,j,z){this._reactName=o,this._targetInst=A,this.type=w,this.nativeEvent=j,this.target=z,this.currentTarget=null;for(var Q in e)e.hasOwnProperty(Q)&&(o=e[Q],this[Q]=o?o(j):j[Q]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?$s:po,this.isPropagationStopped=po,this}return $(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=$s)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=$s)},persist:function(){},isPersistent:$s}),t}var ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_r=Zt(ms),Us=$({},ms,{view:0,detail:0}),Ya=Zt(Us),Ws,vr,Zn,zs=$({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nt,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!==Zn&&(Zn&&e.type==="mousemove"?(Ws=e.screenX-Zn.screenX,vr=e.screenY-Zn.screenY):vr=Ws=0,Zn=e),Ws)},movementY:function(e){return"movementY"in e?e.movementY:vr}}),mo=Zt(zs),go=$({},zs,{dataTransfer:0}),_o=Zt(go),vo=$({},Us,{relatedTarget:0}),yr=Zt(vo),yo=$({},ms,{animationName:0,elapsedTime:0,pseudoElement:0}),wo=Zt(yo),Xa=$({},ms,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bo=Zt(Xa),So=$({},ms,{data:0}),fi=Zt(So),Co={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xo={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"},ie={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ye(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ie[e])?!!t[e]:!1}function nt(){return ye}var Bn=$({},Us,{key:function(e){if(e.key){var t=Co[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?xo[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nt,charCode:function(e){return e.type==="keypress"?gr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),es=Zt(Bn),xg=$({},zs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ru=Zt(xg),kg=$({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nt}),Eg=Zt(kg),Lg=$({},ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),Tg=Zt(Lg),Rg=$({},zs,{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}),Mg=Zt(Rg),Ag=[9,13,27,32],Qa=r&&"CompositionEvent"in window,pi=null;r&&"documentMode"in document&&(pi=document.documentMode);var Ng=r&&"TextEvent"in window&&!pi,Mu=r&&(!Qa||pi&&8<pi&&11>=pi),Au=" ",Nu=!1;function Du(e,t){switch(e){case"keyup":return Ag.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wr=!1;function Dg(e,t){switch(e){case"compositionend":return Iu(t);case"keypress":return t.which!==32?null:(Nu=!0,Au);case"textInput":return e=t.data,e===Au&&Nu?null:e;default:return null}}function Ig(e,t){if(wr)return e==="compositionend"||!Qa&&Du(e,t)?(e=mr(),pr=On=Pn=null,wr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Mu&&t.locale!=="ko"?null:t.data;default:return null}}var jg={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 ju(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jg[e.type]:t==="textarea"}function Pu(e,t,o,w){Rt(w),t=Ro(t,"onChange"),0<t.length&&(o=new _r("onChange","change",null,o,w),e.push({event:o,listeners:t}))}var mi=null,gi=null;function Pg(e){eh(e,0)}function ko(e){var t=kr(e);if(pe(t))return e}function Og(e,t){if(e==="change")return t}var Ou=!1;if(r){var Ja;if(r){var Za="oninput"in document;if(!Za){var Bu=document.createElement("div");Bu.setAttribute("oninput","return;"),Za=typeof Bu.oninput=="function"}Ja=Za}else Ja=!1;Ou=Ja&&(!document.documentMode||9<document.documentMode)}function Fu(){mi&&(mi.detachEvent("onpropertychange",Hu),gi=mi=null)}function Hu(e){if(e.propertyName==="value"&&ko(gi)){var t=[];Pu(t,gi,e,Ne(e)),Dt(Pg,t)}}function Bg(e,t,o){e==="focusin"?(Fu(),mi=t,gi=o,mi.attachEvent("onpropertychange",Hu)):e==="focusout"&&Fu()}function Fg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ko(gi)}function Hg(e,t){if(e==="click")return ko(t)}function $g(e,t){if(e==="input"||e==="change")return ko(t)}function Ug(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ln=typeof Object.is=="function"?Object.is:Ug;function _i(e,t){if(Ln(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var o=Object.keys(e),w=Object.keys(t);if(o.length!==w.length)return!1;for(w=0;w<o.length;w++){var A=o[w];if(!c.call(t,A)||!Ln(e[A],t[A]))return!1}return!0}function $u(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Uu(e,t){var o=$u(e);e=0;for(var w;o;){if(o.nodeType===3){if(w=e+o.textContent.length,e<=t&&w>=t)return{node:o,offset:t-e};e=w}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=$u(o)}}function Wu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zu(){for(var e=window,t=re();t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}if(o)e=t.contentWindow;else break;t=re(e.document)}return t}function el(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Wg(e){var t=zu(),o=e.focusedElem,w=e.selectionRange;if(t!==o&&o&&o.ownerDocument&&Wu(o.ownerDocument.documentElement,o)){if(w!==null&&el(o)){if(t=w.start,e=w.end,e===void 0&&(e=t),"selectionStart"in o)o.selectionStart=t,o.selectionEnd=Math.min(e,o.value.length);else if(e=(t=o.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var A=o.textContent.length,j=Math.min(w.start,A);w=w.end===void 0?j:Math.min(w.end,A),!e.extend&&j>w&&(A=w,w=j,j=A),A=Uu(o,j);var z=Uu(o,w);A&&z&&(e.rangeCount!==1||e.anchorNode!==A.node||e.anchorOffset!==A.offset||e.focusNode!==z.node||e.focusOffset!==z.offset)&&(t=t.createRange(),t.setStart(A.node,A.offset),e.removeAllRanges(),j>w?(e.addRange(t),e.extend(z.node,z.offset)):(t.setEnd(z.node,z.offset),e.addRange(t)))}}for(t=[],e=o;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<t.length;o++)e=t[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var zg=r&&"documentMode"in document&&11>=document.documentMode,br=null,tl=null,vi=null,nl=!1;function Vu(e,t,o){var w=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;nl||br==null||br!==re(w)||(w=br,"selectionStart"in w&&el(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),vi&&_i(vi,w)||(vi=w,w=Ro(tl,"onSelect"),0<w.length&&(t=new _r("onSelect","select",null,t,o),e.push({event:t,listeners:w}),t.target=br)))}function Eo(e,t){var o={};return o[e.toLowerCase()]=t.toLowerCase(),o["Webkit"+e]="webkit"+t,o["Moz"+e]="moz"+t,o}var Sr={animationend:Eo("Animation","AnimationEnd"),animationiteration:Eo("Animation","AnimationIteration"),animationstart:Eo("Animation","AnimationStart"),transitionend:Eo("Transition","TransitionEnd")},sl={},qu={};r&&(qu=document.createElement("div").style,"AnimationEvent"in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),"TransitionEvent"in window||delete Sr.transitionend.transition);function Lo(e){if(sl[e])return sl[e];if(!Sr[e])return e;var t=Sr[e],o;for(o in t)if(t.hasOwnProperty(o)&&o in qu)return sl[e]=t[o];return e}var Ku=Lo("animationend"),Gu=Lo("animationiteration"),Yu=Lo("animationstart"),Xu=Lo("transitionend"),Qu=new Map,Ju="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 gs(e,t){Qu.set(e,t),R(t,[e])}for(var rl=0;rl<Ju.length;rl++){var il=Ju[rl],Vg=il.toLowerCase(),qg=il[0].toUpperCase()+il.slice(1);gs(Vg,"on"+qg)}gs(Ku,"onAnimationEnd"),gs(Gu,"onAnimationIteration"),gs(Yu,"onAnimationStart"),gs("dblclick","onDoubleClick"),gs("focusin","onFocus"),gs("focusout","onBlur"),gs(Xu,"onTransitionEnd"),x("onMouseEnter",["mouseout","mouseover"]),x("onMouseLeave",["mouseout","mouseover"]),x("onPointerEnter",["pointerout","pointerover"]),x("onPointerLeave",["pointerout","pointerover"]),R("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),R("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),R("onBeforeInput",["compositionend","keypress","textInput","paste"]),R("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),R("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),R("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yi="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(" "),Kg=new Set("cancel close invalid load scroll toggle".split(" ").concat(yi));function Zu(e,t,o){var w=e.type||"unknown-event";e.currentTarget=o,Zr(w,t,void 0,e),e.currentTarget=null}function eh(e,t){t=(t&4)!==0;for(var o=0;o<e.length;o++){var w=e[o],A=w.event;w=w.listeners;e:{var j=void 0;if(t)for(var z=w.length-1;0<=z;z--){var Q=w[z],ee=Q.instance,ce=Q.currentTarget;if(Q=Q.listener,ee!==j&&A.isPropagationStopped())break e;Zu(A,Q,ce),j=ee}else for(z=0;z<w.length;z++){if(Q=w[z],ee=Q.instance,ce=Q.currentTarget,Q=Q.listener,ee!==j&&A.isPropagationStopped())break e;Zu(A,Q,ce),j=ee}}}if(Ps)throw e=Jr,Ps=!1,Jr=null,e}function wt(e,t){var o=t[fl];o===void 0&&(o=t[fl]=new Set);var w=e+"__bubble";o.has(w)||(th(t,e,2,!1),o.add(w))}function ol(e,t,o){var w=0;t&&(w|=4),th(o,e,w,t)}var To="_reactListening"+Math.random().toString(36).slice(2);function wi(e){if(!e[To]){e[To]=!0,h.forEach(function(o){o!=="selectionchange"&&(Kg.has(o)||ol(o,!1,e),ol(o,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[To]||(t[To]=!0,ol("selectionchange",!1,t))}}function th(e,t,o,w){switch(fo(t)){case 1:var A=Ka;break;case 4:A=Ga;break;default:A=hi}o=A.bind(null,t,o,e),A=void 0,!mn||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(A=!0),w?A!==void 0?e.addEventListener(t,o,{capture:!0,passive:A}):e.addEventListener(t,o,!0):A!==void 0?e.addEventListener(t,o,{passive:A}):e.addEventListener(t,o,!1)}function al(e,t,o,w,A){var j=w;if((t&1)===0&&(t&2)===0&&w!==null)e:for(;;){if(w===null)return;var z=w.tag;if(z===3||z===4){var Q=w.stateNode.containerInfo;if(Q===A||Q.nodeType===8&&Q.parentNode===A)break;if(z===4)for(z=w.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=Vs(Q),z===null)return;if(ee=z.tag,ee===5||ee===6){w=j=z;continue e}Q=Q.parentNode}}w=w.return}Dt(function(){var ce=j,_e=Ne(o),be=[];e:{var ge=Qu.get(e);if(ge!==void 0){var Ie=_r,Oe=e;switch(e){case"keypress":if(gr(o)===0)break e;case"keydown":case"keyup":Ie=es;break;case"focusin":Oe="focus",Ie=yr;break;case"focusout":Oe="blur",Ie=yr;break;case"beforeblur":case"afterblur":Ie=yr;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":Ie=mo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ie=_o;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ie=Eg;break;case Ku:case Gu:case Yu:Ie=wo;break;case Xu:Ie=Tg;break;case"scroll":Ie=Ya;break;case"wheel":Ie=Mg;break;case"copy":case"cut":case"paste":Ie=bo;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ie=Ru}var He=(t&4)!==0,At=!He&&e==="scroll",oe=He?ge!==null?ge+"Capture":null:ge;He=[];for(var ne=ce,ae;ne!==null;){ae=ne;var xe=ae.stateNode;if(ae.tag===5&&xe!==null&&(ae=xe,oe!==null&&(xe=xt(ne,oe),xe!=null&&He.push(bi(ne,xe,ae)))),At)break;ne=ne.return}0<He.length&&(ge=new Ie(ge,Oe,null,o,_e),be.push({event:ge,listeners:He}))}}if((t&7)===0){e:{if(ge=e==="mouseover"||e==="pointerover",Ie=e==="mouseout"||e==="pointerout",ge&&o!==me&&(Oe=o.relatedTarget||o.fromElement)&&(Vs(Oe)||Oe[ts]))break e;if((Ie||ge)&&(ge=_e.window===_e?_e:(ge=_e.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ie?(Oe=o.relatedTarget||o.toElement,Ie=ce,Oe=Oe?Vs(Oe):null,Oe!==null&&(At=Kn(Oe),Oe!==At||Oe.tag!==5&&Oe.tag!==6)&&(Oe=null)):(Ie=null,Oe=ce),Ie!==Oe)){if(He=mo,xe="onMouseLeave",oe="onMouseEnter",ne="mouse",(e==="pointerout"||e==="pointerover")&&(He=Ru,xe="onPointerLeave",oe="onPointerEnter",ne="pointer"),At=Ie==null?ge:kr(Ie),ae=Oe==null?ge:kr(Oe),ge=new He(xe,ne+"leave",Ie,o,_e),ge.target=At,ge.relatedTarget=ae,xe=null,Vs(_e)===ce&&(He=new He(oe,ne+"enter",Oe,o,_e),He.target=ae,He.relatedTarget=At,xe=He),At=xe,Ie&&Oe)t:{for(He=Ie,oe=Oe,ne=0,ae=He;ae;ae=Cr(ae))ne++;for(ae=0,xe=oe;xe;xe=Cr(xe))ae++;for(;0<ne-ae;)He=Cr(He),ne--;for(;0<ae-ne;)oe=Cr(oe),ae--;for(;ne--;){if(He===oe||oe!==null&&He===oe.alternate)break t;He=Cr(He),oe=Cr(oe)}He=null}else He=null;Ie!==null&&nh(be,ge,Ie,He,!1),Oe!==null&&At!==null&&nh(be,At,Oe,He,!0)}}e:{if(ge=ce?kr(ce):window,Ie=ge.nodeName&&ge.nodeName.toLowerCase(),Ie==="select"||Ie==="input"&&ge.type==="file")var Ue=Og;else if(ju(ge))if(Ou)Ue=$g;else{Ue=Fg;var Ge=Bg}else(Ie=ge.nodeName)&&Ie.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ue=Hg);if(Ue&&(Ue=Ue(e,ce))){Pu(be,Ue,o,_e);break e}Ge&&Ge(e,ge,ce),e==="focusout"&&(Ge=ge._wrapperState)&&Ge.controlled&&ge.type==="number"&&Te(ge,"number",ge.value)}switch(Ge=ce?kr(ce):window,e){case"focusin":(ju(Ge)||Ge.contentEditable==="true")&&(br=Ge,tl=ce,vi=null);break;case"focusout":vi=tl=br=null;break;case"mousedown":nl=!0;break;case"contextmenu":case"mouseup":case"dragend":nl=!1,Vu(be,o,_e);break;case"selectionchange":if(zg)break;case"keydown":case"keyup":Vu(be,o,_e)}var Ye;if(Qa)e:{switch(e){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else wr?Du(e,o)&&(Je="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(Je="onCompositionStart");Je&&(Mu&&o.locale!=="ko"&&(wr||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&wr&&(Ye=mr()):(Pn=_e,On="value"in Pn?Pn.value:Pn.textContent,wr=!0)),Ge=Ro(ce,Je),0<Ge.length&&(Je=new fi(Je,e,null,o,_e),be.push({event:Je,listeners:Ge}),Ye?Je.data=Ye:(Ye=Iu(o),Ye!==null&&(Je.data=Ye)))),(Ye=Ng?Dg(e,o):Ig(e,o))&&(ce=Ro(ce,"onBeforeInput"),0<ce.length&&(_e=new fi("onBeforeInput","beforeinput",null,o,_e),be.push({event:_e,listeners:ce}),_e.data=Ye))}eh(be,t)})}function bi(e,t,o){return{instance:e,listener:t,currentTarget:o}}function Ro(e,t){for(var o=t+"Capture",w=[];e!==null;){var A=e,j=A.stateNode;A.tag===5&&j!==null&&(A=j,j=xt(e,o),j!=null&&w.unshift(bi(e,j,A)),j=xt(e,t),j!=null&&w.push(bi(e,j,A))),e=e.return}return w}function Cr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function nh(e,t,o,w,A){for(var j=t._reactName,z=[];o!==null&&o!==w;){var Q=o,ee=Q.alternate,ce=Q.stateNode;if(ee!==null&&ee===w)break;Q.tag===5&&ce!==null&&(Q=ce,A?(ee=xt(o,j),ee!=null&&z.unshift(bi(o,ee,Q))):A||(ee=xt(o,j),ee!=null&&z.push(bi(o,ee,Q)))),o=o.return}z.length!==0&&e.push({event:t,listeners:z})}var Gg=/\r\n?/g,Yg=/\u0000|\uFFFD/g;function sh(e){return(typeof e=="string"?e:""+e).replace(Gg,`
38
- `).replace(Yg,"")}function Mo(e,t,o){if(t=sh(t),sh(e)!==t&&o)throw Error(i(425))}function Ao(){}var ll=null,cl=null;function ul(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hl=typeof setTimeout=="function"?setTimeout:void 0,Xg=typeof clearTimeout=="function"?clearTimeout:void 0,rh=typeof Promise=="function"?Promise:void 0,Qg=typeof queueMicrotask=="function"?queueMicrotask:typeof rh<"u"?function(e){return rh.resolve(null).then(e).catch(Jg)}:hl;function Jg(e){setTimeout(function(){throw e})}function dl(e,t){var o=t,w=0;do{var A=o.nextSibling;if(e.removeChild(o),A&&A.nodeType===8)if(o=A.data,o==="/$"){if(w===0){e.removeChild(A),ps(t);return}w--}else o!=="$"&&o!=="$?"&&o!=="$!"||w++;o=A}while(o);ps(t)}function _s(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ih(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(t===0)return e;t--}else o==="/$"&&t++}e=e.previousSibling}return null}var xr=Math.random().toString(36).slice(2),Fn="__reactFiber$"+xr,Si="__reactProps$"+xr,ts="__reactContainer$"+xr,fl="__reactEvents$"+xr,Zg="__reactListeners$"+xr,e_="__reactHandles$"+xr;function Vs(e){var t=e[Fn];if(t)return t;for(var o=e.parentNode;o;){if(t=o[ts]||o[Fn]){if(o=t.alternate,t.child!==null||o!==null&&o.child!==null)for(e=ih(e);e!==null;){if(o=e[Fn])return o;e=ih(e)}return t}e=o,o=e.parentNode}return null}function Ci(e){return e=e[Fn]||e[ts],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function kr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(i(33))}function No(e){return e[Si]||null}var pl=[],Er=-1;function vs(e){return{current:e}}function bt(e){0>Er||(e.current=pl[Er],pl[Er]=null,Er--)}function _t(e,t){Er++,pl[Er]=e.current,e.current=t}var ys={},qt=vs(ys),sn=vs(!1),qs=ys;function Lr(e,t){var o=e.type.contextTypes;if(!o)return ys;var w=e.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===t)return w.__reactInternalMemoizedMaskedChildContext;var A={},j;for(j in o)A[j]=t[j];return w&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=A),A}function rn(e){return e=e.childContextTypes,e!=null}function Do(){bt(sn),bt(qt)}function oh(e,t,o){if(qt.current!==ys)throw Error(i(168));_t(qt,t),_t(sn,o)}function ah(e,t,o){var w=e.stateNode;if(t=t.childContextTypes,typeof w.getChildContext!="function")return o;w=w.getChildContext();for(var A in w)if(!(A in t))throw Error(i(108,K(e)||"Unknown",A));return $({},o,w)}function Io(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ys,qs=qt.current,_t(qt,e),_t(sn,sn.current),!0}function lh(e,t,o){var w=e.stateNode;if(!w)throw Error(i(169));o?(e=ah(e,t,qs),w.__reactInternalMemoizedMergedChildContext=e,bt(sn),bt(qt),_t(qt,e)):bt(sn),_t(sn,o)}var ns=null,jo=!1,ml=!1;function ch(e){ns===null?ns=[e]:ns.push(e)}function t_(e){jo=!0,ch(e)}function ws(){if(!ml&&ns!==null){ml=!0;var e=0,t=ct;try{var o=ns;for(ct=1;e<o.length;e++){var w=o[e];do w=w(!0);while(w!==null)}ns=null,jo=!1}catch(A){throw ns!==null&&(ns=ns.slice(e+1)),so(si,ws),A}finally{ct=t,ml=!1}}return null}var Tr=[],Rr=0,Po=null,Oo=0,gn=[],_n=0,Ks=null,ss=1,rs="";function Gs(e,t){Tr[Rr++]=Oo,Tr[Rr++]=Po,Po=e,Oo=t}function uh(e,t,o){gn[_n++]=ss,gn[_n++]=rs,gn[_n++]=Ks,Ks=e;var w=ss;e=rs;var A=32-Ot(w)-1;w&=~(1<<A),o+=1;var j=32-Ot(t)+A;if(30<j){var z=A-A%5;j=(w&(1<<z)-1).toString(32),w>>=z,A-=z,ss=1<<32-Ot(t)+A|o<<A|w,rs=j+e}else ss=1<<j|o<<A|w,rs=e}function gl(e){e.return!==null&&(Gs(e,1),uh(e,1,0))}function _l(e){for(;e===Po;)Po=Tr[--Rr],Tr[Rr]=null,Oo=Tr[--Rr],Tr[Rr]=null;for(;e===Ks;)Ks=gn[--_n],gn[_n]=null,rs=gn[--_n],gn[_n]=null,ss=gn[--_n],gn[_n]=null}var dn=null,fn=null,Ct=!1,Tn=null;function hh(e,t){var o=bn(5,null,null,0);o.elementType="DELETED",o.stateNode=t,o.return=e,t=e.deletions,t===null?(e.deletions=[o],e.flags|=16):t.push(o)}function dh(e,t){switch(e.tag){case 5:var o=e.type;return t=t.nodeType!==1||o.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,dn=e,fn=_s(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,dn=e,fn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(o=Ks!==null?{id:ss,overflow:rs}:null,e.memoizedState={dehydrated:t,treeContext:o,retryLane:1073741824},o=bn(18,null,null,0),o.stateNode=t,o.return=e,e.child=o,dn=e,fn=null,!0):!1;default:return!1}}function vl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yl(e){if(Ct){var t=fn;if(t){var o=t;if(!dh(e,t)){if(vl(e))throw Error(i(418));t=_s(o.nextSibling);var w=dn;t&&dh(e,t)?hh(w,o):(e.flags=e.flags&-4097|2,Ct=!1,dn=e)}}else{if(vl(e))throw Error(i(418));e.flags=e.flags&-4097|2,Ct=!1,dn=e}}}function fh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;dn=e}function Bo(e){if(e!==dn)return!1;if(!Ct)return fh(e),Ct=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ul(e.type,e.memoizedProps)),t&&(t=fn)){if(vl(e))throw ph(),Error(i(418));for(;t;)hh(e,t),t=_s(t.nextSibling)}if(fh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(t===0){fn=_s(e.nextSibling);break e}t--}else o!=="$"&&o!=="$!"&&o!=="$?"||t++}e=e.nextSibling}fn=null}}else fn=dn?_s(e.stateNode.nextSibling):null;return!0}function ph(){for(var e=fn;e;)e=_s(e.nextSibling)}function Mr(){fn=dn=null,Ct=!1}function wl(e){Tn===null?Tn=[e]:Tn.push(e)}var n_=k.ReactCurrentBatchConfig;function xi(e,t,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 w=o.stateNode}if(!w)throw Error(i(147,e));var A=w,j=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===j?t.ref:(t=function(z){var Q=A.refs;z===null?delete Q[j]:Q[j]=z},t._stringRef=j,t)}if(typeof e!="string")throw Error(i(284));if(!o._owner)throw Error(i(290,e))}return e}function Fo(e,t){throw e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function mh(e){var t=e._init;return t(e._payload)}function gh(e){function t(oe,ne){if(e){var ae=oe.deletions;ae===null?(oe.deletions=[ne],oe.flags|=16):ae.push(ne)}}function o(oe,ne){if(!e)return null;for(;ne!==null;)t(oe,ne),ne=ne.sibling;return null}function w(oe,ne){for(oe=new Map;ne!==null;)ne.key!==null?oe.set(ne.key,ne):oe.set(ne.index,ne),ne=ne.sibling;return oe}function A(oe,ne){return oe=Ts(oe,ne),oe.index=0,oe.sibling=null,oe}function j(oe,ne,ae){return oe.index=ae,e?(ae=oe.alternate,ae!==null?(ae=ae.index,ae<ne?(oe.flags|=2,ne):ae):(oe.flags|=2,ne)):(oe.flags|=1048576,ne)}function z(oe){return e&&oe.alternate===null&&(oe.flags|=2),oe}function Q(oe,ne,ae,xe){return ne===null||ne.tag!==6?(ne=hc(ae,oe.mode,xe),ne.return=oe,ne):(ne=A(ne,ae),ne.return=oe,ne)}function ee(oe,ne,ae,xe){var Ue=ae.type;return Ue===M?_e(oe,ne,ae.props.children,xe,ae.key):ne!==null&&(ne.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===Y&&mh(Ue)===ne.type)?(xe=A(ne,ae.props),xe.ref=xi(oe,ne,ae),xe.return=oe,xe):(xe=ca(ae.type,ae.key,ae.props,null,oe.mode,xe),xe.ref=xi(oe,ne,ae),xe.return=oe,xe)}function ce(oe,ne,ae,xe){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ae.containerInfo||ne.stateNode.implementation!==ae.implementation?(ne=dc(ae,oe.mode,xe),ne.return=oe,ne):(ne=A(ne,ae.children||[]),ne.return=oe,ne)}function _e(oe,ne,ae,xe,Ue){return ne===null||ne.tag!==7?(ne=nr(ae,oe.mode,xe,Ue),ne.return=oe,ne):(ne=A(ne,ae),ne.return=oe,ne)}function be(oe,ne,ae){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=hc(""+ne,oe.mode,ae),ne.return=oe,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case D:return ae=ca(ne.type,ne.key,ne.props,null,oe.mode,ae),ae.ref=xi(oe,null,ne),ae.return=oe,ae;case E:return ne=dc(ne,oe.mode,ae),ne.return=oe,ne;case Y:var xe=ne._init;return be(oe,xe(ne._payload),ae)}if(Ce(ne)||P(ne))return ne=nr(ne,oe.mode,ae,null),ne.return=oe,ne;Fo(oe,ne)}return null}function ge(oe,ne,ae,xe){var Ue=ne!==null?ne.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Ue!==null?null:Q(oe,ne,""+ae,xe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case D:return ae.key===Ue?ee(oe,ne,ae,xe):null;case E:return ae.key===Ue?ce(oe,ne,ae,xe):null;case Y:return Ue=ae._init,ge(oe,ne,Ue(ae._payload),xe)}if(Ce(ae)||P(ae))return Ue!==null?null:_e(oe,ne,ae,xe,null);Fo(oe,ae)}return null}function Ie(oe,ne,ae,xe,Ue){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return oe=oe.get(ae)||null,Q(ne,oe,""+xe,Ue);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case D:return oe=oe.get(xe.key===null?ae:xe.key)||null,ee(ne,oe,xe,Ue);case E:return oe=oe.get(xe.key===null?ae:xe.key)||null,ce(ne,oe,xe,Ue);case Y:var Ge=xe._init;return Ie(oe,ne,ae,Ge(xe._payload),Ue)}if(Ce(xe)||P(xe))return oe=oe.get(ae)||null,_e(ne,oe,xe,Ue,null);Fo(ne,xe)}return null}function Oe(oe,ne,ae,xe){for(var Ue=null,Ge=null,Ye=ne,Je=ne=0,$t=null;Ye!==null&&Je<ae.length;Je++){Ye.index>Je?($t=Ye,Ye=null):$t=Ye.sibling;var ut=ge(oe,Ye,ae[Je],xe);if(ut===null){Ye===null&&(Ye=$t);break}e&&Ye&&ut.alternate===null&&t(oe,Ye),ne=j(ut,ne,Je),Ge===null?Ue=ut:Ge.sibling=ut,Ge=ut,Ye=$t}if(Je===ae.length)return o(oe,Ye),Ct&&Gs(oe,Je),Ue;if(Ye===null){for(;Je<ae.length;Je++)Ye=be(oe,ae[Je],xe),Ye!==null&&(ne=j(Ye,ne,Je),Ge===null?Ue=Ye:Ge.sibling=Ye,Ge=Ye);return Ct&&Gs(oe,Je),Ue}for(Ye=w(oe,Ye);Je<ae.length;Je++)$t=Ie(Ye,oe,Je,ae[Je],xe),$t!==null&&(e&&$t.alternate!==null&&Ye.delete($t.key===null?Je:$t.key),ne=j($t,ne,Je),Ge===null?Ue=$t:Ge.sibling=$t,Ge=$t);return e&&Ye.forEach(function(Rs){return t(oe,Rs)}),Ct&&Gs(oe,Je),Ue}function He(oe,ne,ae,xe){var Ue=P(ae);if(typeof Ue!="function")throw Error(i(150));if(ae=Ue.call(ae),ae==null)throw Error(i(151));for(var Ge=Ue=null,Ye=ne,Je=ne=0,$t=null,ut=ae.next();Ye!==null&&!ut.done;Je++,ut=ae.next()){Ye.index>Je?($t=Ye,Ye=null):$t=Ye.sibling;var Rs=ge(oe,Ye,ut.value,xe);if(Rs===null){Ye===null&&(Ye=$t);break}e&&Ye&&Rs.alternate===null&&t(oe,Ye),ne=j(Rs,ne,Je),Ge===null?Ue=Rs:Ge.sibling=Rs,Ge=Rs,Ye=$t}if(ut.done)return o(oe,Ye),Ct&&Gs(oe,Je),Ue;if(Ye===null){for(;!ut.done;Je++,ut=ae.next())ut=be(oe,ut.value,xe),ut!==null&&(ne=j(ut,ne,Je),Ge===null?Ue=ut:Ge.sibling=ut,Ge=ut);return Ct&&Gs(oe,Je),Ue}for(Ye=w(oe,Ye);!ut.done;Je++,ut=ae.next())ut=Ie(Ye,oe,Je,ut.value,xe),ut!==null&&(e&&ut.alternate!==null&&Ye.delete(ut.key===null?Je:ut.key),ne=j(ut,ne,Je),Ge===null?Ue=ut:Ge.sibling=ut,Ge=ut);return e&&Ye.forEach(function(j_){return t(oe,j_)}),Ct&&Gs(oe,Je),Ue}function At(oe,ne,ae,xe){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 D:e:{for(var Ue=ae.key,Ge=ne;Ge!==null;){if(Ge.key===Ue){if(Ue=ae.type,Ue===M){if(Ge.tag===7){o(oe,Ge.sibling),ne=A(Ge,ae.props.children),ne.return=oe,oe=ne;break e}}else if(Ge.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===Y&&mh(Ue)===Ge.type){o(oe,Ge.sibling),ne=A(Ge,ae.props),ne.ref=xi(oe,Ge,ae),ne.return=oe,oe=ne;break e}o(oe,Ge);break}else t(oe,Ge);Ge=Ge.sibling}ae.type===M?(ne=nr(ae.props.children,oe.mode,xe,ae.key),ne.return=oe,oe=ne):(xe=ca(ae.type,ae.key,ae.props,null,oe.mode,xe),xe.ref=xi(oe,ne,ae),xe.return=oe,oe=xe)}return z(oe);case E:e:{for(Ge=ae.key;ne!==null;){if(ne.key===Ge)if(ne.tag===4&&ne.stateNode.containerInfo===ae.containerInfo&&ne.stateNode.implementation===ae.implementation){o(oe,ne.sibling),ne=A(ne,ae.children||[]),ne.return=oe,oe=ne;break e}else{o(oe,ne);break}else t(oe,ne);ne=ne.sibling}ne=dc(ae,oe.mode,xe),ne.return=oe,oe=ne}return z(oe);case Y:return Ge=ae._init,At(oe,ne,Ge(ae._payload),xe)}if(Ce(ae))return Oe(oe,ne,ae,xe);if(P(ae))return He(oe,ne,ae,xe);Fo(oe,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,ne!==null&&ne.tag===6?(o(oe,ne.sibling),ne=A(ne,ae),ne.return=oe,oe=ne):(o(oe,ne),ne=hc(ae,oe.mode,xe),ne.return=oe,oe=ne),z(oe)):o(oe,ne)}return At}var Ar=gh(!0),_h=gh(!1),Ho=vs(null),$o=null,Nr=null,bl=null;function Sl(){bl=Nr=$o=null}function Cl(e){var t=Ho.current;bt(Ho),e._currentValue=t}function xl(e,t,o){for(;e!==null;){var w=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,w!==null&&(w.childLanes|=t)):w!==null&&(w.childLanes&t)!==t&&(w.childLanes|=t),e===o)break;e=e.return}}function Dr(e,t){$o=e,bl=Nr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(on=!0),e.firstContext=null)}function vn(e){var t=e._currentValue;if(bl!==e)if(e={context:e,memoizedValue:t,next:null},Nr===null){if($o===null)throw Error(i(308));Nr=e,$o.dependencies={lanes:0,firstContext:e}}else Nr=Nr.next=e;return t}var Ys=null;function kl(e){Ys===null?Ys=[e]:Ys.push(e)}function vh(e,t,o,w){var A=t.interleaved;return A===null?(o.next=o,kl(t)):(o.next=A.next,A.next=o),t.interleaved=o,is(e,w)}function is(e,t){e.lanes|=t;var o=e.alternate;for(o!==null&&(o.lanes|=t),o=e,e=e.return;e!==null;)e.childLanes|=t,o=e.alternate,o!==null&&(o.childLanes|=t),o=e,e=e.return;return o.tag===3?o.stateNode:null}var bs=!1;function El(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yh(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function os(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ss(e,t,o){var w=e.updateQueue;if(w===null)return null;if(w=w.shared,(at&2)!==0){var A=w.pending;return A===null?t.next=t:(t.next=A.next,A.next=t),w.pending=t,is(e,o)}return A=w.interleaved,A===null?(t.next=t,kl(w)):(t.next=A.next,A.next=t),w.interleaved=t,is(e,o)}function Uo(e,t,o){if(t=t.updateQueue,t!==null&&(t=t.shared,(o&4194240)!==0)){var w=t.lanes;w&=e.pendingLanes,o|=w,t.lanes=o,oi(e,o)}}function wh(e,t){var o=e.updateQueue,w=e.alternate;if(w!==null&&(w=w.updateQueue,o===w)){var A=null,j=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};j===null?A=j=z:j=j.next=z,o=o.next}while(o!==null);j===null?A=j=t:j=j.next=t}else A=j=t;o={baseState:w.baseState,firstBaseUpdate:A,lastBaseUpdate:j,shared:w.shared,effects:w.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=t:e.next=t,o.lastBaseUpdate=t}function Wo(e,t,o,w){var A=e.updateQueue;bs=!1;var j=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?j=ce:z.next=ce,z=ee;var _e=e.alternate;_e!==null&&(_e=_e.updateQueue,Q=_e.lastBaseUpdate,Q!==z&&(Q===null?_e.firstBaseUpdate=ce:Q.next=ce,_e.lastBaseUpdate=ee))}if(j!==null){var be=A.baseState;z=0,_e=ce=ee=null,Q=j;do{var ge=Q.lane,Ie=Q.eventTime;if((w&ge)===ge){_e!==null&&(_e=_e.next={eventTime:Ie,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Oe=e,He=Q;switch(ge=t,Ie=o,He.tag){case 1:if(Oe=He.payload,typeof Oe=="function"){be=Oe.call(Ie,be,ge);break e}be=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=He.payload,ge=typeof Oe=="function"?Oe.call(Ie,be,ge):Oe,ge==null)break e;be=$({},be,ge);break e;case 2:bs=!0}}Q.callback!==null&&Q.lane!==0&&(e.flags|=64,ge=A.effects,ge===null?A.effects=[Q]:ge.push(Q))}else Ie={eventTime:Ie,lane:ge,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},_e===null?(ce=_e=Ie,ee=be):_e=_e.next=Ie,z|=ge;if(Q=Q.next,Q===null){if(Q=A.shared.pending,Q===null)break;ge=Q,Q=ge.next,ge.next=null,A.lastBaseUpdate=ge,A.shared.pending=null}}while(!0);if(_e===null&&(ee=be),A.baseState=ee,A.firstBaseUpdate=ce,A.lastBaseUpdate=_e,t=A.shared.interleaved,t!==null){A=t;do z|=A.lane,A=A.next;while(A!==t)}else j===null&&(A.shared.lanes=0);Js|=z,e.lanes=z,e.memoizedState=be}}function bh(e,t,o){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var w=e[t],A=w.callback;if(A!==null){if(w.callback=null,w=o,typeof A!="function")throw Error(i(191,A));A.call(w)}}}var ki={},Hn=vs(ki),Ei=vs(ki),Li=vs(ki);function Xs(e){if(e===ki)throw Error(i(174));return e}function Ll(e,t){switch(_t(Li,t),_t(Ei,e),_t(Hn,ki),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Qe(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Qe(t,e)}bt(Hn),_t(Hn,t)}function Ir(){bt(Hn),bt(Ei),bt(Li)}function Sh(e){Xs(Li.current);var t=Xs(Hn.current),o=Qe(t,e.type);t!==o&&(_t(Ei,e),_t(Hn,o))}function Tl(e){Ei.current===e&&(bt(Hn),bt(Ei))}var kt=vs(0);function zo(e){for(var t=e;t!==null;){if(t.tag===13){var o=t.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Rl=[];function Ml(){for(var e=0;e<Rl.length;e++)Rl[e]._workInProgressVersionPrimary=null;Rl.length=0}var Vo=k.ReactCurrentDispatcher,Al=k.ReactCurrentBatchConfig,Qs=0,Et=null,jt=null,Ft=null,qo=!1,Ti=!1,Ri=0,s_=0;function Kt(){throw Error(i(321))}function Nl(e,t){if(t===null)return!1;for(var o=0;o<t.length&&o<e.length;o++)if(!Ln(e[o],t[o]))return!1;return!0}function Dl(e,t,o,w,A,j){if(Qs=j,Et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Vo.current=e===null||e.memoizedState===null?a_:l_,e=o(w,A),Ti){j=0;do{if(Ti=!1,Ri=0,25<=j)throw Error(i(301));j+=1,Ft=jt=null,t.updateQueue=null,Vo.current=c_,e=o(w,A)}while(Ti)}if(Vo.current=Yo,t=jt!==null&&jt.next!==null,Qs=0,Ft=jt=Et=null,qo=!1,t)throw Error(i(300));return e}function Il(){var e=Ri!==0;return Ri=0,e}function $n(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?Et.memoizedState=Ft=e:Ft=Ft.next=e,Ft}function yn(){if(jt===null){var e=Et.alternate;e=e!==null?e.memoizedState:null}else e=jt.next;var t=Ft===null?Et.memoizedState:Ft.next;if(t!==null)Ft=t,jt=e;else{if(e===null)throw Error(i(310));jt=e,e={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},Ft===null?Et.memoizedState=Ft=e:Ft=Ft.next=e}return Ft}function Mi(e,t){return typeof t=="function"?t(e):t}function jl(e){var t=yn(),o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var w=jt,A=w.baseQueue,j=o.pending;if(j!==null){if(A!==null){var z=A.next;A.next=j.next,j.next=z}w.baseQueue=A=j,o.pending=null}if(A!==null){j=A.next,w=w.baseState;var Q=z=null,ee=null,ce=j;do{var _e=ce.lane;if((Qs&_e)===_e)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),w=ce.hasEagerState?ce.eagerState:e(w,ce.action);else{var be={lane:_e,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(Q=ee=be,z=w):ee=ee.next=be,Et.lanes|=_e,Js|=_e}ce=ce.next}while(ce!==null&&ce!==j);ee===null?z=w:ee.next=Q,Ln(w,t.memoizedState)||(on=!0),t.memoizedState=w,t.baseState=z,t.baseQueue=ee,o.lastRenderedState=w}if(e=o.interleaved,e!==null){A=e;do j=A.lane,Et.lanes|=j,Js|=j,A=A.next;while(A!==e)}else A===null&&(o.lanes=0);return[t.memoizedState,o.dispatch]}function Pl(e){var t=yn(),o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var w=o.dispatch,A=o.pending,j=t.memoizedState;if(A!==null){o.pending=null;var z=A=A.next;do j=e(j,z.action),z=z.next;while(z!==A);Ln(j,t.memoizedState)||(on=!0),t.memoizedState=j,t.baseQueue===null&&(t.baseState=j),o.lastRenderedState=j}return[j,w]}function Ch(){}function xh(e,t){var o=Et,w=yn(),A=t(),j=!Ln(w.memoizedState,A);if(j&&(w.memoizedState=A,on=!0),w=w.queue,Ol(Lh.bind(null,o,w,e),[e]),w.getSnapshot!==t||j||Ft!==null&&Ft.memoizedState.tag&1){if(o.flags|=2048,Ai(9,Eh.bind(null,o,w,A,t),void 0,null),Ht===null)throw Error(i(349));(Qs&30)!==0||kh(o,t,A)}return A}function kh(e,t,o){e.flags|=16384,e={getSnapshot:t,value:o},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.stores=[e]):(o=t.stores,o===null?t.stores=[e]:o.push(e))}function Eh(e,t,o,w){t.value=o,t.getSnapshot=w,Th(t)&&Rh(e)}function Lh(e,t,o){return o(function(){Th(t)&&Rh(e)})}function Th(e){var t=e.getSnapshot;e=e.value;try{var o=t();return!Ln(e,o)}catch{return!0}}function Rh(e){var t=is(e,1);t!==null&&Nn(t,e,1,-1)}function Mh(e){var t=$n();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:e},t.queue=e,e=e.dispatch=o_.bind(null,Et,e),[t.memoizedState,e]}function Ai(e,t,o,w){return e={tag:e,create:t,destroy:o,deps:w,next:null},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.lastEffect=e.next=e):(o=t.lastEffect,o===null?t.lastEffect=e.next=e:(w=o.next,o.next=e,e.next=w,t.lastEffect=e)),e}function Ah(){return yn().memoizedState}function Ko(e,t,o,w){var A=$n();Et.flags|=e,A.memoizedState=Ai(1|t,o,void 0,w===void 0?null:w)}function Go(e,t,o,w){var A=yn();w=w===void 0?null:w;var j=void 0;if(jt!==null){var z=jt.memoizedState;if(j=z.destroy,w!==null&&Nl(w,z.deps)){A.memoizedState=Ai(t,o,j,w);return}}Et.flags|=e,A.memoizedState=Ai(1|t,o,j,w)}function Nh(e,t){return Ko(8390656,8,e,t)}function Ol(e,t){return Go(2048,8,e,t)}function Dh(e,t){return Go(4,2,e,t)}function Ih(e,t){return Go(4,4,e,t)}function jh(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ph(e,t,o){return o=o!=null?o.concat([e]):null,Go(4,4,jh.bind(null,t,e),o)}function Bl(){}function Oh(e,t){var o=yn();t=t===void 0?null:t;var w=o.memoizedState;return w!==null&&t!==null&&Nl(t,w[1])?w[0]:(o.memoizedState=[e,t],e)}function Bh(e,t){var o=yn();t=t===void 0?null:t;var w=o.memoizedState;return w!==null&&t!==null&&Nl(t,w[1])?w[0]:(e=e(),o.memoizedState=[e,t],e)}function Fh(e,t,o){return(Qs&21)===0?(e.baseState&&(e.baseState=!1,on=!0),e.memoizedState=o):(Ln(o,t)||(o=ao(),Et.lanes|=o,Js|=o,e.baseState=!0),t)}function r_(e,t){var o=ct;ct=o!==0&&4>o?o:4,e(!0);var w=Al.transition;Al.transition={};try{e(!1),t()}finally{ct=o,Al.transition=w}}function Hh(){return yn().memoizedState}function i_(e,t,o){var w=Es(e);if(o={lane:w,action:o,hasEagerState:!1,eagerState:null,next:null},$h(e))Uh(t,o);else if(o=vh(e,t,o,w),o!==null){var A=tn();Nn(o,e,w,A),Wh(o,t,w)}}function o_(e,t,o){var w=Es(e),A={lane:w,action:o,hasEagerState:!1,eagerState:null,next:null};if($h(e))Uh(t,A);else{var j=e.alternate;if(e.lanes===0&&(j===null||j.lanes===0)&&(j=t.lastRenderedReducer,j!==null))try{var z=t.lastRenderedState,Q=j(z,o);if(A.hasEagerState=!0,A.eagerState=Q,Ln(Q,z)){var ee=t.interleaved;ee===null?(A.next=A,kl(t)):(A.next=ee.next,ee.next=A),t.interleaved=A;return}}catch{}finally{}o=vh(e,t,A,w),o!==null&&(A=tn(),Nn(o,e,w,A),Wh(o,t,w))}}function $h(e){var t=e.alternate;return e===Et||t!==null&&t===Et}function Uh(e,t){Ti=qo=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function Wh(e,t,o){if((o&4194240)!==0){var w=t.lanes;w&=e.pendingLanes,o|=w,t.lanes=o,oi(e,o)}}var Yo={readContext:vn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},a_={readContext:vn,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:vn,useEffect:Nh,useImperativeHandle:function(e,t,o){return o=o!=null?o.concat([e]):null,Ko(4194308,4,jh.bind(null,t,e),o)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var o=$n();return t=t===void 0?null:t,e=e(),o.memoizedState=[e,t],e},useReducer:function(e,t,o){var w=$n();return t=o!==void 0?o(t):t,w.memoizedState=w.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},w.queue=e,e=e.dispatch=i_.bind(null,Et,e),[w.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:Mh,useDebugValue:Bl,useDeferredValue:function(e){return $n().memoizedState=e},useTransition:function(){var e=Mh(!1),t=e[0];return e=r_.bind(null,e[1]),$n().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,o){var w=Et,A=$n();if(Ct){if(o===void 0)throw Error(i(407));o=o()}else{if(o=t(),Ht===null)throw Error(i(349));(Qs&30)!==0||kh(w,t,o)}A.memoizedState=o;var j={value:o,getSnapshot:t};return A.queue=j,Nh(Lh.bind(null,w,j,e),[e]),w.flags|=2048,Ai(9,Eh.bind(null,w,j,o,t),void 0,null),o},useId:function(){var e=$n(),t=Ht.identifierPrefix;if(Ct){var o=rs,w=ss;o=(w&~(1<<32-Ot(w)-1)).toString(32)+o,t=":"+t+"R"+o,o=Ri++,0<o&&(t+="H"+o.toString(32)),t+=":"}else o=s_++,t=":"+t+"r"+o.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},l_={readContext:vn,useCallback:Oh,useContext:vn,useEffect:Ol,useImperativeHandle:Ph,useInsertionEffect:Dh,useLayoutEffect:Ih,useMemo:Bh,useReducer:jl,useRef:Ah,useState:function(){return jl(Mi)},useDebugValue:Bl,useDeferredValue:function(e){var t=yn();return Fh(t,jt.memoizedState,e)},useTransition:function(){var e=jl(Mi)[0],t=yn().memoizedState;return[e,t]},useMutableSource:Ch,useSyncExternalStore:xh,useId:Hh,unstable_isNewReconciler:!1},c_={readContext:vn,useCallback:Oh,useContext:vn,useEffect:Ol,useImperativeHandle:Ph,useInsertionEffect:Dh,useLayoutEffect:Ih,useMemo:Bh,useReducer:Pl,useRef:Ah,useState:function(){return Pl(Mi)},useDebugValue:Bl,useDeferredValue:function(e){var t=yn();return jt===null?t.memoizedState=e:Fh(t,jt.memoizedState,e)},useTransition:function(){var e=Pl(Mi)[0],t=yn().memoizedState;return[e,t]},useMutableSource:Ch,useSyncExternalStore:xh,useId:Hh,unstable_isNewReconciler:!1};function Rn(e,t){if(e&&e.defaultProps){t=$({},t),e=e.defaultProps;for(var o in e)t[o]===void 0&&(t[o]=e[o]);return t}return t}function Fl(e,t,o,w){t=e.memoizedState,o=o(w,t),o=o==null?t:$({},t,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var Xo={isMounted:function(e){return(e=e._reactInternals)?Kn(e)===e:!1},enqueueSetState:function(e,t,o){e=e._reactInternals;var w=tn(),A=Es(e),j=os(w,A);j.payload=t,o!=null&&(j.callback=o),t=Ss(e,j,A),t!==null&&(Nn(t,e,A,w),Uo(t,e,A))},enqueueReplaceState:function(e,t,o){e=e._reactInternals;var w=tn(),A=Es(e),j=os(w,A);j.tag=1,j.payload=t,o!=null&&(j.callback=o),t=Ss(e,j,A),t!==null&&(Nn(t,e,A,w),Uo(t,e,A))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var o=tn(),w=Es(e),A=os(o,w);A.tag=2,t!=null&&(A.callback=t),t=Ss(e,A,w),t!==null&&(Nn(t,e,w,o),Uo(t,e,w))}};function zh(e,t,o,w,A,j,z){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(w,j,z):t.prototype&&t.prototype.isPureReactComponent?!_i(o,w)||!_i(A,j):!0}function Vh(e,t,o){var w=!1,A=ys,j=t.contextType;return typeof j=="object"&&j!==null?j=vn(j):(A=rn(t)?qs:qt.current,w=t.contextTypes,j=(w=w!=null)?Lr(e,A):ys),t=new t(o,j),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xo,e.stateNode=t,t._reactInternals=e,w&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=A,e.__reactInternalMemoizedMaskedChildContext=j),t}function qh(e,t,o,w){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(o,w),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(o,w),t.state!==e&&Xo.enqueueReplaceState(t,t.state,null)}function Hl(e,t,o,w){var A=e.stateNode;A.props=o,A.state=e.memoizedState,A.refs={},El(e);var j=t.contextType;typeof j=="object"&&j!==null?A.context=vn(j):(j=rn(t)?qs:qt.current,A.context=Lr(e,j)),A.state=e.memoizedState,j=t.getDerivedStateFromProps,typeof j=="function"&&(Fl(e,t,j,o),A.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(t=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),t!==A.state&&Xo.enqueueReplaceState(A,A.state,null),Wo(e,o,A,w),A.state=e.memoizedState),typeof A.componentDidMount=="function"&&(e.flags|=4194308)}function jr(e,t){try{var o="",w=t;do o+=le(w),w=w.return;while(w);var A=o}catch(j){A=`
39
- Error generating stack: `+j.message+`
40
- `+j.stack}return{value:e,source:t,stack:A,digest:null}}function $l(e,t,o){return{value:e,source:null,stack:o??null,digest:t??null}}function Ul(e,t){try{console.error(t.value)}catch(o){setTimeout(function(){throw o})}}var u_=typeof WeakMap=="function"?WeakMap:Map;function Kh(e,t,o){o=os(-1,o),o.tag=3,o.payload={element:null};var w=t.value;return o.callback=function(){sa||(sa=!0,sc=w),Ul(e,t)},o}function Gh(e,t,o){o=os(-1,o),o.tag=3;var w=e.type.getDerivedStateFromError;if(typeof w=="function"){var A=t.value;o.payload=function(){return w(A)},o.callback=function(){Ul(e,t)}}var j=e.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(o.callback=function(){Ul(e,t),typeof w!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var z=t.stack;this.componentDidCatch(t.value,{componentStack:z!==null?z:""})}),o}function Yh(e,t,o){var w=e.pingCache;if(w===null){w=e.pingCache=new u_;var A=new Set;w.set(t,A)}else A=w.get(t),A===void 0&&(A=new Set,w.set(t,A));A.has(o)||(A.add(o),e=x_.bind(null,e,t,o),t.then(e,e))}function Xh(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Qh(e,t,o,w,A){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(t=os(-1,1),t.tag=2,Ss(o,t,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=A,e)}var h_=k.ReactCurrentOwner,on=!1;function en(e,t,o,w){t.child=e===null?_h(t,null,o,w):Ar(t,e.child,o,w)}function Jh(e,t,o,w,A){o=o.render;var j=t.ref;return Dr(t,A),w=Dl(e,t,o,w,j,A),o=Il(),e!==null&&!on?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~A,as(e,t,A)):(Ct&&o&&gl(t),t.flags|=1,en(e,t,w,A),t.child)}function Zh(e,t,o,w,A){if(e===null){var j=o.type;return typeof j=="function"&&!uc(j)&&j.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(t.tag=15,t.type=j,ed(e,t,j,w,A)):(e=ca(o.type,null,w,t,t.mode,A),e.ref=t.ref,e.return=t,t.child=e)}if(j=e.child,(e.lanes&A)===0){var z=j.memoizedProps;if(o=o.compare,o=o!==null?o:_i,o(z,w)&&e.ref===t.ref)return as(e,t,A)}return t.flags|=1,e=Ts(j,w),e.ref=t.ref,e.return=t,t.child=e}function ed(e,t,o,w,A){if(e!==null){var j=e.memoizedProps;if(_i(j,w)&&e.ref===t.ref)if(on=!1,t.pendingProps=w=j,(e.lanes&A)!==0)(e.flags&131072)!==0&&(on=!0);else return t.lanes=e.lanes,as(e,t,A)}return Wl(e,t,o,w,A)}function td(e,t,o){var w=t.pendingProps,A=w.children,j=e!==null?e.memoizedState:null;if(w.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_t(Or,pn),pn|=o;else{if((o&1073741824)===0)return e=j!==null?j.baseLanes|o:o,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,_t(Or,pn),pn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=j!==null?j.baseLanes:o,_t(Or,pn),pn|=w}else j!==null?(w=j.baseLanes|o,t.memoizedState=null):w=o,_t(Or,pn),pn|=w;return en(e,t,A,o),t.child}function nd(e,t){var o=t.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(t.flags|=512,t.flags|=2097152)}function Wl(e,t,o,w,A){var j=rn(o)?qs:qt.current;return j=Lr(t,j),Dr(t,A),o=Dl(e,t,o,w,j,A),w=Il(),e!==null&&!on?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~A,as(e,t,A)):(Ct&&w&&gl(t),t.flags|=1,en(e,t,o,A),t.child)}function sd(e,t,o,w,A){if(rn(o)){var j=!0;Io(t)}else j=!1;if(Dr(t,A),t.stateNode===null)Jo(e,t),Vh(t,o,w),Hl(t,o,w,A),w=!0;else if(e===null){var z=t.stateNode,Q=t.memoizedProps;z.props=Q;var ee=z.context,ce=o.contextType;typeof ce=="object"&&ce!==null?ce=vn(ce):(ce=rn(o)?qs:qt.current,ce=Lr(t,ce));var _e=o.getDerivedStateFromProps,be=typeof _e=="function"||typeof z.getSnapshotBeforeUpdate=="function";be||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==w||ee!==ce)&&qh(t,z,w,ce),bs=!1;var ge=t.memoizedState;z.state=ge,Wo(t,w,z,A),ee=t.memoizedState,Q!==w||ge!==ee||sn.current||bs?(typeof _e=="function"&&(Fl(t,o,_e,w),ee=t.memoizedState),(Q=bs||zh(t,o,Q,w,ge,ee,ce))?(be||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"&&(t.flags|=4194308)):(typeof z.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=w,t.memoizedState=ee),z.props=w,z.state=ee,z.context=ce,w=Q):(typeof z.componentDidMount=="function"&&(t.flags|=4194308),w=!1)}else{z=t.stateNode,yh(e,t),Q=t.memoizedProps,ce=t.type===t.elementType?Q:Rn(t.type,Q),z.props=ce,be=t.pendingProps,ge=z.context,ee=o.contextType,typeof ee=="object"&&ee!==null?ee=vn(ee):(ee=rn(o)?qs:qt.current,ee=Lr(t,ee));var Ie=o.getDerivedStateFromProps;(_e=typeof Ie=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==be||ge!==ee)&&qh(t,z,w,ee),bs=!1,ge=t.memoizedState,z.state=ge,Wo(t,w,z,A);var Oe=t.memoizedState;Q!==be||ge!==Oe||sn.current||bs?(typeof Ie=="function"&&(Fl(t,o,Ie,w),Oe=t.memoizedState),(ce=bs||zh(t,o,ce,w,ge,Oe,ee)||!1)?(_e||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(w,Oe,ee),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(w,Oe,ee)),typeof z.componentDidUpdate=="function"&&(t.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=1024),t.memoizedProps=w,t.memoizedState=Oe),z.props=w,z.state=Oe,z.context=ee,w=ce):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=1024),w=!1)}return zl(e,t,o,w,j,A)}function zl(e,t,o,w,A,j){nd(e,t);var z=(t.flags&128)!==0;if(!w&&!z)return A&&lh(t,o,!1),as(e,t,j);w=t.stateNode,h_.current=t;var Q=z&&typeof o.getDerivedStateFromError!="function"?null:w.render();return t.flags|=1,e!==null&&z?(t.child=Ar(t,e.child,null,j),t.child=Ar(t,null,Q,j)):en(e,t,Q,j),t.memoizedState=w.state,A&&lh(t,o,!0),t.child}function rd(e){var t=e.stateNode;t.pendingContext?oh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&oh(e,t.context,!1),Ll(e,t.containerInfo)}function id(e,t,o,w,A){return Mr(),wl(A),t.flags|=256,en(e,t,o,w),t.child}var Vl={dehydrated:null,treeContext:null,retryLane:0};function ql(e){return{baseLanes:e,cachePool:null,transitions:null}}function od(e,t,o){var w=t.pendingProps,A=kt.current,j=!1,z=(t.flags&128)!==0,Q;if((Q=z)||(Q=e!==null&&e.memoizedState===null?!1:(A&2)!==0),Q?(j=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(A|=1),_t(kt,A&1),e===null)return yl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(z=w.children,e=w.fallback,j?(w=t.mode,j=t.child,z={mode:"hidden",children:z},(w&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=z):j=ua(z,w,0,null),e=nr(e,w,o,null),j.return=t,e.return=t,j.sibling=e,t.child=j,t.child.memoizedState=ql(o),t.memoizedState=Vl,e):Kl(t,z));if(A=e.memoizedState,A!==null&&(Q=A.dehydrated,Q!==null))return d_(e,t,z,w,Q,A,o);if(j){j=w.fallback,z=t.mode,A=e.child,Q=A.sibling;var ee={mode:"hidden",children:w.children};return(z&1)===0&&t.child!==A?(w=t.child,w.childLanes=0,w.pendingProps=ee,t.deletions=null):(w=Ts(A,ee),w.subtreeFlags=A.subtreeFlags&14680064),Q!==null?j=Ts(Q,j):(j=nr(j,z,o,null),j.flags|=2),j.return=t,w.return=t,w.sibling=j,t.child=w,w=j,j=t.child,z=e.child.memoizedState,z=z===null?ql(o):{baseLanes:z.baseLanes|o,cachePool:null,transitions:z.transitions},j.memoizedState=z,j.childLanes=e.childLanes&~o,t.memoizedState=Vl,w}return j=e.child,e=j.sibling,w=Ts(j,{mode:"visible",children:w.children}),(t.mode&1)===0&&(w.lanes=o),w.return=t,w.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=w,t.memoizedState=null,w}function Kl(e,t){return t=ua({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Qo(e,t,o,w){return w!==null&&wl(w),Ar(t,e.child,null,o),e=Kl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function d_(e,t,o,w,A,j,z){if(o)return t.flags&256?(t.flags&=-257,w=$l(Error(i(422))),Qo(e,t,z,w)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(j=w.fallback,A=t.mode,w=ua({mode:"visible",children:w.children},A,0,null),j=nr(j,A,z,null),j.flags|=2,w.return=t,j.return=t,w.sibling=j,t.child=w,(t.mode&1)!==0&&Ar(t,e.child,null,z),t.child.memoizedState=ql(z),t.memoizedState=Vl,j);if((t.mode&1)===0)return Qo(e,t,z,null);if(A.data==="$!"){if(w=A.nextSibling&&A.nextSibling.dataset,w)var Q=w.dgst;return w=Q,j=Error(i(419)),w=$l(j,w,void 0),Qo(e,t,z,w)}if(Q=(z&e.childLanes)!==0,on||Q){if(w=Ht,w!==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&(w.suspendedLanes|z))!==0?0:A,A!==0&&A!==j.retryLane&&(j.retryLane=A,is(e,A),Nn(w,e,A,-1))}return cc(),w=$l(Error(i(421))),Qo(e,t,z,w)}return A.data==="$?"?(t.flags|=128,t.child=e.child,t=k_.bind(null,e),A._reactRetry=t,null):(e=j.treeContext,fn=_s(A.nextSibling),dn=t,Ct=!0,Tn=null,e!==null&&(gn[_n++]=ss,gn[_n++]=rs,gn[_n++]=Ks,ss=e.id,rs=e.overflow,Ks=t),t=Kl(t,w.children),t.flags|=4096,t)}function ad(e,t,o){e.lanes|=t;var w=e.alternate;w!==null&&(w.lanes|=t),xl(e.return,t,o)}function Gl(e,t,o,w,A){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:w,tail:o,tailMode:A}:(j.isBackwards=t,j.rendering=null,j.renderingStartTime=0,j.last=w,j.tail=o,j.tailMode=A)}function ld(e,t,o){var w=t.pendingProps,A=w.revealOrder,j=w.tail;if(en(e,t,w.children,o),w=kt.current,(w&2)!==0)w=w&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ad(e,o,t);else if(e.tag===19)ad(e,o,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}w&=1}if(_t(kt,w),(t.mode&1)===0)t.memoizedState=null;else switch(A){case"forwards":for(o=t.child,A=null;o!==null;)e=o.alternate,e!==null&&zo(e)===null&&(A=o),o=o.sibling;o=A,o===null?(A=t.child,t.child=null):(A=o.sibling,o.sibling=null),Gl(t,!1,A,o,j);break;case"backwards":for(o=null,A=t.child,t.child=null;A!==null;){if(e=A.alternate,e!==null&&zo(e)===null){t.child=A;break}e=A.sibling,A.sibling=o,o=A,A=e}Gl(t,!0,o,null,j);break;case"together":Gl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Jo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function as(e,t,o){if(e!==null&&(t.dependencies=e.dependencies),Js|=t.lanes,(o&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,o=Ts(e,e.pendingProps),t.child=o,o.return=t;e.sibling!==null;)e=e.sibling,o=o.sibling=Ts(e,e.pendingProps),o.return=t;o.sibling=null}return t.child}function f_(e,t,o){switch(t.tag){case 3:rd(t),Mr();break;case 5:Sh(t);break;case 1:rn(t.type)&&Io(t);break;case 4:Ll(t,t.stateNode.containerInfo);break;case 10:var w=t.type._context,A=t.memoizedProps.value;_t(Ho,w._currentValue),w._currentValue=A;break;case 13:if(w=t.memoizedState,w!==null)return w.dehydrated!==null?(_t(kt,kt.current&1),t.flags|=128,null):(o&t.child.childLanes)!==0?od(e,t,o):(_t(kt,kt.current&1),e=as(e,t,o),e!==null?e.sibling:null);_t(kt,kt.current&1);break;case 19:if(w=(o&t.childLanes)!==0,(e.flags&128)!==0){if(w)return ld(e,t,o);t.flags|=128}if(A=t.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),_t(kt,kt.current),w)break;return null;case 22:case 23:return t.lanes=0,td(e,t,o)}return as(e,t,o)}var cd,Yl,ud,hd;cd=function(e,t){for(var o=t.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===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},Yl=function(){},ud=function(e,t,o,w){var A=e.memoizedProps;if(A!==w){e=t.stateNode,Xs(Hn.current);var j=null;switch(o){case"input":A=ke(e,A),w=ke(e,w),j=[];break;case"select":A=$({},A,{value:void 0}),w=$({},w,{value:void 0}),j=[];break;case"textarea":A=Be(e,A),w=Be(e,w),j=[];break;default:typeof A.onClick!="function"&&typeof w.onClick=="function"&&(e.onclick=Ao)}Ve(o,w);var z;o=null;for(ce in A)if(!w.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"&&(v.hasOwnProperty(ce)?j||(j=[]):(j=j||[]).push(ce,null));for(ce in w){var ee=w[ce];if(Q=A!=null?A[ce]:void 0,w.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||(j||(j=[]),j.push(ce,o)),o=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,Q=Q?Q.__html:void 0,ee!=null&&Q!==ee&&(j=j||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(j=j||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(v.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&wt("scroll",e),j||Q===ee||(j=[])):(j=j||[]).push(ce,ee))}o&&(j=j||[]).push("style",o);var ce=j;(t.updateQueue=ce)&&(t.flags|=4)}},hd=function(e,t,o,w){o!==w&&(t.flags|=4)};function Ni(e,t){if(!Ct)switch(e.tailMode){case"hidden":t=e.tail;for(var o=null;t!==null;)t.alternate!==null&&(o=t),t=t.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var w=null;o!==null;)o.alternate!==null&&(w=o),o=o.sibling;w===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:w.sibling=null}}function Gt(e){var t=e.alternate!==null&&e.alternate.child===e.child,o=0,w=0;if(t)for(var A=e.child;A!==null;)o|=A.lanes|A.childLanes,w|=A.subtreeFlags&14680064,w|=A.flags&14680064,A.return=e,A=A.sibling;else for(A=e.child;A!==null;)o|=A.lanes|A.childLanes,w|=A.subtreeFlags,w|=A.flags,A.return=e,A=A.sibling;return e.subtreeFlags|=w,e.childLanes=o,t}function p_(e,t,o){var w=t.pendingProps;switch(_l(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(t),null;case 1:return rn(t.type)&&Do(),Gt(t),null;case 3:return w=t.stateNode,Ir(),bt(sn),bt(qt),Ml(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(e===null||e.child===null)&&(Bo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Tn!==null&&(oc(Tn),Tn=null))),Yl(e,t),Gt(t),null;case 5:Tl(t);var A=Xs(Li.current);if(o=t.type,e!==null&&t.stateNode!=null)ud(e,t,o,w,A),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!w){if(t.stateNode===null)throw Error(i(166));return Gt(t),null}if(e=Xs(Hn.current),Bo(t)){w=t.stateNode,o=t.type;var j=t.memoizedProps;switch(w[Fn]=t,w[Si]=j,e=(t.mode&1)!==0,o){case"dialog":wt("cancel",w),wt("close",w);break;case"iframe":case"object":case"embed":wt("load",w);break;case"video":case"audio":for(A=0;A<yi.length;A++)wt(yi[A],w);break;case"source":wt("error",w);break;case"img":case"image":case"link":wt("error",w),wt("load",w);break;case"details":wt("toggle",w);break;case"input":Me(w,j),wt("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!j.multiple},wt("invalid",w);break;case"textarea":ve(w,j),wt("invalid",w)}Ve(o,j),A=null;for(var z in j)if(j.hasOwnProperty(z)){var Q=j[z];z==="children"?typeof Q=="string"?w.textContent!==Q&&(j.suppressHydrationWarning!==!0&&Mo(w.textContent,Q,e),A=["children",Q]):typeof Q=="number"&&w.textContent!==""+Q&&(j.suppressHydrationWarning!==!0&&Mo(w.textContent,Q,e),A=["children",""+Q]):v.hasOwnProperty(z)&&Q!=null&&z==="onScroll"&&wt("scroll",w)}switch(o){case"input":de(w),fe(w,j,!0);break;case"textarea":de(w),st(w);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(w.onclick=Ao)}w=A,t.updateQueue=w,w!==null&&(t.flags|=4)}else{z=A.nodeType===9?A:A.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Xe(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=z.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof w.is=="string"?e=z.createElement(o,{is:w.is}):(e=z.createElement(o),o==="select"&&(z=e,w.multiple?z.multiple=!0:w.size&&(z.size=w.size))):e=z.createElementNS(e,o),e[Fn]=t,e[Si]=w,cd(e,t,!1,!1),t.stateNode=e;e:{switch(z=he(o,w),o){case"dialog":wt("cancel",e),wt("close",e),A=w;break;case"iframe":case"object":case"embed":wt("load",e),A=w;break;case"video":case"audio":for(A=0;A<yi.length;A++)wt(yi[A],e);A=w;break;case"source":wt("error",e),A=w;break;case"img":case"image":case"link":wt("error",e),wt("load",e),A=w;break;case"details":wt("toggle",e),A=w;break;case"input":Me(e,w),A=ke(e,w),wt("invalid",e);break;case"option":A=w;break;case"select":e._wrapperState={wasMultiple:!!w.multiple},A=$({},w,{value:void 0}),wt("invalid",e);break;case"textarea":ve(e,w),A=Be(e,w),wt("invalid",e);break;default:A=w}Ve(o,A),Q=A;for(j in Q)if(Q.hasOwnProperty(j)){var ee=Q[j];j==="style"?ft(e,ee):j==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&ht(e,ee)):j==="children"?typeof ee=="string"?(o!=="textarea"||ee!=="")&&$e(e,ee):typeof ee=="number"&&$e(e,""+ee):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(v.hasOwnProperty(j)?ee!=null&&j==="onScroll"&&wt("scroll",e):ee!=null&&d(e,j,ee,z))}switch(o){case"input":de(e),fe(e,w,!1);break;case"textarea":de(e),st(e);break;case"option":w.value!=null&&e.setAttribute("value",""+W(w.value));break;case"select":e.multiple=!!w.multiple,j=w.value,j!=null?Ee(e,!!w.multiple,j,!1):w.defaultValue!=null&&Ee(e,!!w.multiple,w.defaultValue,!0);break;default:typeof A.onClick=="function"&&(e.onclick=Ao)}switch(o){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Gt(t),null;case 6:if(e&&t.stateNode!=null)hd(e,t,e.memoizedProps,w);else{if(typeof w!="string"&&t.stateNode===null)throw Error(i(166));if(o=Xs(Li.current),Xs(Hn.current),Bo(t)){if(w=t.stateNode,o=t.memoizedProps,w[Fn]=t,(j=w.nodeValue!==o)&&(e=dn,e!==null))switch(e.tag){case 3:Mo(w.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Mo(w.nodeValue,o,(e.mode&1)!==0)}j&&(t.flags|=4)}else w=(o.nodeType===9?o:o.ownerDocument).createTextNode(w),w[Fn]=t,t.stateNode=w}return Gt(t),null;case 13:if(bt(kt),w=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ct&&fn!==null&&(t.mode&1)!==0&&(t.flags&128)===0)ph(),Mr(),t.flags|=98560,j=!1;else if(j=Bo(t),w!==null&&w.dehydrated!==null){if(e===null){if(!j)throw Error(i(318));if(j=t.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(i(317));j[Fn]=t}else Mr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Gt(t),j=!1}else Tn!==null&&(oc(Tn),Tn=null),j=!0;if(!j)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=o,t):(w=w!==null,w!==(e!==null&&e.memoizedState!==null)&&w&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(kt.current&1)!==0?Pt===0&&(Pt=3):cc())),t.updateQueue!==null&&(t.flags|=4),Gt(t),null);case 4:return Ir(),Yl(e,t),e===null&&wi(t.stateNode.containerInfo),Gt(t),null;case 10:return Cl(t.type._context),Gt(t),null;case 17:return rn(t.type)&&Do(),Gt(t),null;case 19:if(bt(kt),j=t.memoizedState,j===null)return Gt(t),null;if(w=(t.flags&128)!==0,z=j.rendering,z===null)if(w)Ni(j,!1);else{if(Pt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(z=zo(e),z!==null){for(t.flags|=128,Ni(j,!1),w=z.updateQueue,w!==null&&(t.updateQueue=w,t.flags|=4),t.subtreeFlags=0,w=o,o=t.child;o!==null;)j=o,e=w,j.flags&=14680066,z=j.alternate,z===null?(j.childLanes=0,j.lanes=e,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=z.childLanes,j.lanes=z.lanes,j.child=z.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=z.memoizedProps,j.memoizedState=z.memoizedState,j.updateQueue=z.updateQueue,j.type=z.type,e=z.dependencies,j.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return _t(kt,kt.current&1|2),t.child}e=e.sibling}j.tail!==null&&yt()>Br&&(t.flags|=128,w=!0,Ni(j,!1),t.lanes=4194304)}else{if(!w)if(e=zo(z),e!==null){if(t.flags|=128,w=!0,o=e.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),Ni(j,!0),j.tail===null&&j.tailMode==="hidden"&&!z.alternate&&!Ct)return Gt(t),null}else 2*yt()-j.renderingStartTime>Br&&o!==1073741824&&(t.flags|=128,w=!0,Ni(j,!1),t.lanes=4194304);j.isBackwards?(z.sibling=t.child,t.child=z):(o=j.last,o!==null?o.sibling=z:t.child=z,j.last=z)}return j.tail!==null?(t=j.tail,j.rendering=t,j.tail=t.sibling,j.renderingStartTime=yt(),t.sibling=null,o=kt.current,_t(kt,w?o&1|2:o&1),t):(Gt(t),null);case 22:case 23:return lc(),w=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==w&&(t.flags|=8192),w&&(t.mode&1)!==0?(pn&1073741824)!==0&&(Gt(t),t.subtreeFlags&6&&(t.flags|=8192)):Gt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function m_(e,t){switch(_l(t),t.tag){case 1:return rn(t.type)&&Do(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ir(),bt(sn),bt(qt),Ml(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Tl(t),null;case 13:if(bt(kt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return bt(kt),null;case 4:return Ir(),null;case 10:return Cl(t.type._context),null;case 22:case 23:return lc(),null;case 24:return null;default:return null}}var Zo=!1,Yt=!1,g_=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Pr(e,t){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(w){Lt(e,t,w)}else o.current=null}function Xl(e,t,o){try{o()}catch(w){Lt(e,t,w)}}var dd=!1;function __(e,t){if(ll=Hs,e=zu(),el(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var w=o.getSelection&&o.getSelection();if(w&&w.rangeCount!==0){o=w.anchorNode;var A=w.anchorOffset,j=w.focusNode;w=w.focusOffset;try{o.nodeType,j.nodeType}catch{o=null;break e}var z=0,Q=-1,ee=-1,ce=0,_e=0,be=e,ge=null;t:for(;;){for(var Ie;be!==o||A!==0&&be.nodeType!==3||(Q=z+A),be!==j||w!==0&&be.nodeType!==3||(ee=z+w),be.nodeType===3&&(z+=be.nodeValue.length),(Ie=be.firstChild)!==null;)ge=be,be=Ie;for(;;){if(be===e)break t;if(ge===o&&++ce===A&&(Q=z),ge===j&&++_e===w&&(ee=z),(Ie=be.nextSibling)!==null)break;be=ge,ge=be.parentNode}be=Ie}o=Q===-1||ee===-1?null:{start:Q,end:ee}}else o=null}o=o||{start:0,end:0}}else o=null;for(cl={focusedElem:e,selectionRange:o},Hs=!1,Pe=t;Pe!==null;)if(t=Pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pe=e;else for(;Pe!==null;){t=Pe;try{var Oe=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var He=Oe.memoizedProps,At=Oe.memoizedState,oe=t.stateNode,ne=oe.getSnapshotBeforeUpdate(t.elementType===t.type?He:Rn(t.type,He),At);oe.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ae=t.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(xe){Lt(t,t.return,xe)}if(e=t.sibling,e!==null){e.return=t.return,Pe=e;break}Pe=t.return}return Oe=dd,dd=!1,Oe}function Di(e,t,o){var w=t.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var A=w=w.next;do{if((A.tag&e)===e){var j=A.destroy;A.destroy=void 0,j!==void 0&&Xl(t,o,j)}A=A.next}while(A!==w)}}function ea(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var o=t=t.next;do{if((o.tag&e)===e){var w=o.create;o.destroy=w()}o=o.next}while(o!==t)}}function Ql(e){var t=e.ref;if(t!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof t=="function"?t(e):t.current=e}}function fd(e){var t=e.alternate;t!==null&&(e.alternate=null,fd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Fn],delete t[Si],delete t[fl],delete t[Zg],delete t[e_])),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 pd(e){return e.tag===5||e.tag===3||e.tag===4}function md(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pd(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 Jl(e,t,o){var w=e.tag;if(w===5||w===6)e=e.stateNode,t?o.nodeType===8?o.parentNode.insertBefore(e,t):o.insertBefore(e,t):(o.nodeType===8?(t=o.parentNode,t.insertBefore(e,o)):(t=o,t.appendChild(e)),o=o._reactRootContainer,o!=null||t.onclick!==null||(t.onclick=Ao));else if(w!==4&&(e=e.child,e!==null))for(Jl(e,t,o),e=e.sibling;e!==null;)Jl(e,t,o),e=e.sibling}function Zl(e,t,o){var w=e.tag;if(w===5||w===6)e=e.stateNode,t?o.insertBefore(e,t):o.appendChild(e);else if(w!==4&&(e=e.child,e!==null))for(Zl(e,t,o),e=e.sibling;e!==null;)Zl(e,t,o),e=e.sibling}var Ut=null,Mn=!1;function Cs(e,t,o){for(o=o.child;o!==null;)gd(e,t,o),o=o.sibling}function gd(e,t,o){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(or,o)}catch{}switch(o.tag){case 5:Yt||Pr(o,t);case 6:var w=Ut,A=Mn;Ut=null,Cs(e,t,o),Ut=w,Mn=A,Ut!==null&&(Mn?(e=Ut,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):Ut.removeChild(o.stateNode));break;case 18:Ut!==null&&(Mn?(e=Ut,o=o.stateNode,e.nodeType===8?dl(e.parentNode,o):e.nodeType===1&&dl(e,o),ps(e)):dl(Ut,o.stateNode));break;case 4:w=Ut,A=Mn,Ut=o.stateNode.containerInfo,Mn=!0,Cs(e,t,o),Ut=w,Mn=A;break;case 0:case 11:case 14:case 15:if(!Yt&&(w=o.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){A=w=w.next;do{var j=A,z=j.destroy;j=j.tag,z!==void 0&&((j&2)!==0||(j&4)!==0)&&Xl(o,t,z),A=A.next}while(A!==w)}Cs(e,t,o);break;case 1:if(!Yt&&(Pr(o,t),w=o.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=o.memoizedProps,w.state=o.memoizedState,w.componentWillUnmount()}catch(Q){Lt(o,t,Q)}Cs(e,t,o);break;case 21:Cs(e,t,o);break;case 22:o.mode&1?(Yt=(w=Yt)||o.memoizedState!==null,Cs(e,t,o),Yt=w):Cs(e,t,o);break;default:Cs(e,t,o)}}function _d(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new g_),t.forEach(function(w){var A=E_.bind(null,e,w);o.has(w)||(o.add(w),w.then(A,A))})}}function An(e,t){var o=t.deletions;if(o!==null)for(var w=0;w<o.length;w++){var A=o[w];try{var j=e,z=t,Q=z;e:for(;Q!==null;){switch(Q.tag){case 5:Ut=Q.stateNode,Mn=!1;break e;case 3:Ut=Q.stateNode.containerInfo,Mn=!0;break e;case 4:Ut=Q.stateNode.containerInfo,Mn=!0;break e}Q=Q.return}if(Ut===null)throw Error(i(160));gd(j,z,A),Ut=null,Mn=!1;var ee=A.alternate;ee!==null&&(ee.return=null),A.return=null}catch(ce){Lt(A,t,ce)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)vd(t,e),t=t.sibling}function vd(e,t){var o=e.alternate,w=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(An(t,e),Un(e),w&4){try{Di(3,e,e.return),ea(3,e)}catch(He){Lt(e,e.return,He)}try{Di(5,e,e.return)}catch(He){Lt(e,e.return,He)}}break;case 1:An(t,e),Un(e),w&512&&o!==null&&Pr(o,o.return);break;case 5:if(An(t,e),Un(e),w&512&&o!==null&&Pr(o,o.return),e.flags&32){var A=e.stateNode;try{$e(A,"")}catch(He){Lt(e,e.return,He)}}if(w&4&&(A=e.stateNode,A!=null)){var j=e.memoizedProps,z=o!==null?o.memoizedProps:j,Q=e.type,ee=e.updateQueue;if(e.updateQueue=null,ee!==null)try{Q==="input"&&j.type==="radio"&&j.name!=null&&et(A,j),he(Q,z);var ce=he(Q,j);for(z=0;z<ee.length;z+=2){var _e=ee[z],be=ee[z+1];_e==="style"?ft(A,be):_e==="dangerouslySetInnerHTML"?ht(A,be):_e==="children"?$e(A,be):d(A,_e,be,ce)}switch(Q){case"input":Le(A,j);break;case"textarea":Ae(A,j);break;case"select":var ge=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!j.multiple;var Ie=j.value;Ie!=null?Ee(A,!!j.multiple,Ie,!1):ge!==!!j.multiple&&(j.defaultValue!=null?Ee(A,!!j.multiple,j.defaultValue,!0):Ee(A,!!j.multiple,j.multiple?[]:"",!1))}A[Si]=j}catch(He){Lt(e,e.return,He)}}break;case 6:if(An(t,e),Un(e),w&4){if(e.stateNode===null)throw Error(i(162));A=e.stateNode,j=e.memoizedProps;try{A.nodeValue=j}catch(He){Lt(e,e.return,He)}}break;case 3:if(An(t,e),Un(e),w&4&&o!==null&&o.memoizedState.isDehydrated)try{ps(t.containerInfo)}catch(He){Lt(e,e.return,He)}break;case 4:An(t,e),Un(e);break;case 13:An(t,e),Un(e),A=e.child,A.flags&8192&&(j=A.memoizedState!==null,A.stateNode.isHidden=j,!j||A.alternate!==null&&A.alternate.memoizedState!==null||(nc=yt())),w&4&&_d(e);break;case 22:if(_e=o!==null&&o.memoizedState!==null,e.mode&1?(Yt=(ce=Yt)||_e,An(t,e),Yt=ce):An(t,e),Un(e),w&8192){if(ce=e.memoizedState!==null,(e.stateNode.isHidden=ce)&&!_e&&(e.mode&1)!==0)for(Pe=e,_e=e.child;_e!==null;){for(be=Pe=_e;Pe!==null;){switch(ge=Pe,Ie=ge.child,ge.tag){case 0:case 11:case 14:case 15:Di(4,ge,ge.return);break;case 1:Pr(ge,ge.return);var Oe=ge.stateNode;if(typeof Oe.componentWillUnmount=="function"){w=ge,o=ge.return;try{t=w,Oe.props=t.memoizedProps,Oe.state=t.memoizedState,Oe.componentWillUnmount()}catch(He){Lt(w,o,He)}}break;case 5:Pr(ge,ge.return);break;case 22:if(ge.memoizedState!==null){bd(be);continue}}Ie!==null?(Ie.return=ge,Pe=Ie):bd(be)}_e=_e.sibling}e:for(_e=null,be=e;;){if(be.tag===5){if(_e===null){_e=be;try{A=be.stateNode,ce?(j=A.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(Q=be.stateNode,ee=be.memoizedProps.style,z=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,Q.style.display=ot("display",z))}catch(He){Lt(e,e.return,He)}}}else if(be.tag===6){if(_e===null)try{be.stateNode.nodeValue=ce?"":be.memoizedProps}catch(He){Lt(e,e.return,He)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===e)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===e)break e;for(;be.sibling===null;){if(be.return===null||be.return===e)break e;_e===be&&(_e=null),be=be.return}_e===be&&(_e=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:An(t,e),Un(e),w&4&&_d(e);break;case 21:break;default:An(t,e),Un(e)}}function Un(e){var t=e.flags;if(t&2){try{e:{for(var o=e.return;o!==null;){if(pd(o)){var w=o;break e}o=o.return}throw Error(i(160))}switch(w.tag){case 5:var A=w.stateNode;w.flags&32&&($e(A,""),w.flags&=-33);var j=md(e);Zl(e,j,A);break;case 3:case 4:var z=w.stateNode.containerInfo,Q=md(e);Jl(e,Q,z);break;default:throw Error(i(161))}}catch(ee){Lt(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function v_(e,t,o){Pe=e,yd(e)}function yd(e,t,o){for(var w=(e.mode&1)!==0;Pe!==null;){var A=Pe,j=A.child;if(A.tag===22&&w){var z=A.memoizedState!==null||Zo;if(!z){var Q=A.alternate,ee=Q!==null&&Q.memoizedState!==null||Yt;Q=Zo;var ce=Yt;if(Zo=z,(Yt=ee)&&!ce)for(Pe=A;Pe!==null;)z=Pe,ee=z.child,z.tag===22&&z.memoizedState!==null?Sd(A):ee!==null?(ee.return=z,Pe=ee):Sd(A);for(;j!==null;)Pe=j,yd(j),j=j.sibling;Pe=A,Zo=Q,Yt=ce}wd(e)}else(A.subtreeFlags&8772)!==0&&j!==null?(j.return=A,Pe=j):wd(e)}}function wd(e){for(;Pe!==null;){var t=Pe;if((t.flags&8772)!==0){var o=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:Yt||ea(5,t);break;case 1:var w=t.stateNode;if(t.flags&4&&!Yt)if(o===null)w.componentDidMount();else{var A=t.elementType===t.type?o.memoizedProps:Rn(t.type,o.memoizedProps);w.componentDidUpdate(A,o.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var j=t.updateQueue;j!==null&&bh(t,j,w);break;case 3:var z=t.updateQueue;if(z!==null){if(o=null,t.child!==null)switch(t.child.tag){case 5:o=t.child.stateNode;break;case 1:o=t.child.stateNode}bh(t,z,o)}break;case 5:var Q=t.stateNode;if(o===null&&t.flags&4){o=Q;var ee=t.memoizedProps;switch(t.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(t.memoizedState===null){var ce=t.alternate;if(ce!==null){var _e=ce.memoizedState;if(_e!==null){var be=_e.dehydrated;be!==null&&ps(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}Yt||t.flags&512&&Ql(t)}catch(ge){Lt(t,t.return,ge)}}if(t===e){Pe=null;break}if(o=t.sibling,o!==null){o.return=t.return,Pe=o;break}Pe=t.return}}function bd(e){for(;Pe!==null;){var t=Pe;if(t===e){Pe=null;break}var o=t.sibling;if(o!==null){o.return=t.return,Pe=o;break}Pe=t.return}}function Sd(e){for(;Pe!==null;){var t=Pe;try{switch(t.tag){case 0:case 11:case 15:var o=t.return;try{ea(4,t)}catch(ee){Lt(t,o,ee)}break;case 1:var w=t.stateNode;if(typeof w.componentDidMount=="function"){var A=t.return;try{w.componentDidMount()}catch(ee){Lt(t,A,ee)}}var j=t.return;try{Ql(t)}catch(ee){Lt(t,j,ee)}break;case 5:var z=t.return;try{Ql(t)}catch(ee){Lt(t,z,ee)}}}catch(ee){Lt(t,t.return,ee)}if(t===e){Pe=null;break}var Q=t.sibling;if(Q!==null){Q.return=t.return,Pe=Q;break}Pe=t.return}}var y_=Math.ceil,ta=k.ReactCurrentDispatcher,ec=k.ReactCurrentOwner,wn=k.ReactCurrentBatchConfig,at=0,Ht=null,It=null,Wt=0,pn=0,Or=vs(0),Pt=0,Ii=null,Js=0,na=0,tc=0,ji=null,an=null,nc=0,Br=1/0,ls=null,sa=!1,sc=null,xs=null,ra=!1,ks=null,ia=0,Pi=0,rc=null,oa=-1,aa=0;function tn(){return(at&6)!==0?yt():oa!==-1?oa:oa=yt()}function Es(e){return(e.mode&1)===0?1:(at&2)!==0&&Wt!==0?Wt&-Wt:n_.transition!==null?(aa===0&&(aa=ao()),aa):(e=ct,e!==0||(e=window.event,e=e===void 0?16:fo(e.type)),e)}function Nn(e,t,o,w){if(50<Pi)throw Pi=0,rc=null,Error(i(185));Yn(e,o,w),((at&2)===0||e!==Ht)&&(e===Ht&&((at&2)===0&&(na|=o),Pt===4&&Ls(e,Wt)),ln(e,w),o===1&&at===0&&(t.mode&1)===0&&(Br=yt()+500,jo&&ws()))}function ln(e,t){var o=e.callbackNode;hs(e,t);var w=ur(e,e===Ht?Wt:0);if(w===0)o!==null&&ro(o),e.callbackNode=null,e.callbackPriority=0;else if(t=w&-w,e.callbackPriority!==t){if(o!=null&&ro(o),t===1)e.tag===0?t_(xd.bind(null,e)):ch(xd.bind(null,e)),Qg(function(){(at&6)===0&&ws()}),o=null;else{switch(co(w)){case 1:o=si;break;case 4:o=cs;break;case 16:o=Gn;break;case 536870912:o=ri;break;default:o=Gn}o=Nd(o,Cd.bind(null,e))}e.callbackPriority=t,e.callbackNode=o}}function Cd(e,t){if(oa=-1,aa=0,(at&6)!==0)throw Error(i(327));var o=e.callbackNode;if(Fr()&&e.callbackNode!==o)return null;var w=ur(e,e===Ht?Wt:0);if(w===0)return null;if((w&30)!==0||(w&e.expiredLanes)!==0||t)t=la(e,w);else{t=w;var A=at;at|=2;var j=Ed();(Ht!==e||Wt!==t)&&(ls=null,Br=yt()+500,er(e,t));do try{S_();break}catch(Q){kd(e,Q)}while(!0);Sl(),ta.current=j,at=A,It!==null?t=0:(Ht=null,Wt=0,t=Pt)}if(t!==0){if(t===2&&(A=ds(e),A!==0&&(w=A,t=ic(e,A))),t===1)throw o=Ii,er(e,0),Ls(e,w),ln(e,yt()),o;if(t===6)Ls(e,w);else{if(A=e.current.alternate,(w&30)===0&&!w_(A)&&(t=la(e,w),t===2&&(j=ds(e),j!==0&&(w=j,t=ic(e,j))),t===1))throw o=Ii,er(e,0),Ls(e,w),ln(e,yt()),o;switch(e.finishedWork=A,e.finishedLanes=w,t){case 0:case 1:throw Error(i(345));case 2:tr(e,an,ls);break;case 3:if(Ls(e,w),(w&130023424)===w&&(t=nc+500-yt(),10<t)){if(ur(e,0)!==0)break;if(A=e.suspendedLanes,(A&w)!==w){tn(),e.pingedLanes|=e.suspendedLanes&A;break}e.timeoutHandle=hl(tr.bind(null,e,an,ls),t);break}tr(e,an,ls);break;case 4:if(Ls(e,w),(w&4194240)===w)break;for(t=e.eventTimes,A=-1;0<w;){var z=31-Ot(w);j=1<<z,z=t[z],z>A&&(A=z),w&=~j}if(w=A,w=yt()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*y_(w/1960))-w,10<w){e.timeoutHandle=hl(tr.bind(null,e,an,ls),w);break}tr(e,an,ls);break;case 5:tr(e,an,ls);break;default:throw Error(i(329))}}}return ln(e,yt()),e.callbackNode===o?Cd.bind(null,e):null}function ic(e,t){var o=ji;return e.current.memoizedState.isDehydrated&&(er(e,t).flags|=256),e=la(e,t),e!==2&&(t=an,an=o,t!==null&&oc(t)),e}function oc(e){an===null?an=e:an.push.apply(an,e)}function w_(e){for(var t=e;;){if(t.flags&16384){var o=t.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var w=0;w<o.length;w++){var A=o[w],j=A.getSnapshot;A=A.value;try{if(!Ln(j(),A))return!1}catch{return!1}}}if(o=t.child,t.subtreeFlags&16384&&o!==null)o.return=t,t=o;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ls(e,t){for(t&=~tc,t&=~na,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var o=31-Ot(t),w=1<<o;e[o]=-1,t&=~w}}function xd(e){if((at&6)!==0)throw Error(i(327));Fr();var t=ur(e,0);if((t&1)===0)return ln(e,yt()),null;var o=la(e,t);if(e.tag!==0&&o===2){var w=ds(e);w!==0&&(t=w,o=ic(e,w))}if(o===1)throw o=Ii,er(e,0),Ls(e,t),ln(e,yt()),o;if(o===6)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,tr(e,an,ls),ln(e,yt()),null}function ac(e,t){var o=at;at|=1;try{return e(t)}finally{at=o,at===0&&(Br=yt()+500,jo&&ws())}}function Zs(e){ks!==null&&ks.tag===0&&(at&6)===0&&Fr();var t=at;at|=1;var o=wn.transition,w=ct;try{if(wn.transition=null,ct=1,e)return e()}finally{ct=w,wn.transition=o,at=t,(at&6)===0&&ws()}}function lc(){pn=Or.current,bt(Or)}function er(e,t){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,Xg(o)),It!==null)for(o=It.return;o!==null;){var w=o;switch(_l(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Do();break;case 3:Ir(),bt(sn),bt(qt),Ml();break;case 5:Tl(w);break;case 4:Ir();break;case 13:bt(kt);break;case 19:bt(kt);break;case 10:Cl(w.type._context);break;case 22:case 23:lc()}o=o.return}if(Ht=e,It=e=Ts(e.current,null),Wt=pn=t,Pt=0,Ii=null,tc=na=Js=0,an=ji=null,Ys!==null){for(t=0;t<Ys.length;t++)if(o=Ys[t],w=o.interleaved,w!==null){o.interleaved=null;var A=w.next,j=o.pending;if(j!==null){var z=j.next;j.next=A,w.next=z}o.pending=w}Ys=null}return e}function kd(e,t){do{var o=It;try{if(Sl(),Vo.current=Yo,qo){for(var w=Et.memoizedState;w!==null;){var A=w.queue;A!==null&&(A.pending=null),w=w.next}qo=!1}if(Qs=0,Ft=jt=Et=null,Ti=!1,Ri=0,ec.current=null,o===null||o.return===null){Pt=1,Ii=t,It=null;break}e:{var j=e,z=o.return,Q=o,ee=t;if(t=Wt,Q.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,_e=Q,be=_e.tag;if((_e.mode&1)===0&&(be===0||be===11||be===15)){var ge=_e.alternate;ge?(_e.updateQueue=ge.updateQueue,_e.memoizedState=ge.memoizedState,_e.lanes=ge.lanes):(_e.updateQueue=null,_e.memoizedState=null)}var Ie=Xh(z);if(Ie!==null){Ie.flags&=-257,Qh(Ie,z,Q,j,t),Ie.mode&1&&Yh(j,ce,t),t=Ie,ee=ce;var Oe=t.updateQueue;if(Oe===null){var He=new Set;He.add(ee),t.updateQueue=He}else Oe.add(ee);break e}else{if((t&1)===0){Yh(j,ce,t),cc();break e}ee=Error(i(426))}}else if(Ct&&Q.mode&1){var At=Xh(z);if(At!==null){(At.flags&65536)===0&&(At.flags|=256),Qh(At,z,Q,j,t),wl(jr(ee,Q));break e}}j=ee=jr(ee,Q),Pt!==4&&(Pt=2),ji===null?ji=[j]:ji.push(j),j=z;do{switch(j.tag){case 3:j.flags|=65536,t&=-t,j.lanes|=t;var oe=Kh(j,ee,t);wh(j,oe);break e;case 1:Q=ee;var ne=j.type,ae=j.stateNode;if((j.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(xs===null||!xs.has(ae)))){j.flags|=65536,t&=-t,j.lanes|=t;var xe=Gh(j,Q,t);wh(j,xe);break e}}j=j.return}while(j!==null)}Td(o)}catch(Ue){t=Ue,It===o&&o!==null&&(It=o=o.return);continue}break}while(!0)}function Ed(){var e=ta.current;return ta.current=Yo,e===null?Yo:e}function cc(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Ht===null||(Js&268435455)===0&&(na&268435455)===0||Ls(Ht,Wt)}function la(e,t){var o=at;at|=2;var w=Ed();(Ht!==e||Wt!==t)&&(ls=null,er(e,t));do try{b_();break}catch(A){kd(e,A)}while(!0);if(Sl(),at=o,ta.current=w,It!==null)throw Error(i(261));return Ht=null,Wt=0,Pt}function b_(){for(;It!==null;)Ld(It)}function S_(){for(;It!==null&&!Wa();)Ld(It)}function Ld(e){var t=Ad(e.alternate,e,pn);e.memoizedProps=e.pendingProps,t===null?Td(e):It=t,ec.current=null}function Td(e){var t=e;do{var o=t.alternate;if(e=t.return,(t.flags&32768)===0){if(o=p_(o,t,pn),o!==null){It=o;return}}else{if(o=m_(o,t),o!==null){o.flags&=32767,It=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Pt=6,It=null;return}}if(t=t.sibling,t!==null){It=t;return}It=t=e}while(t!==null);Pt===0&&(Pt=5)}function tr(e,t,o){var w=ct,A=wn.transition;try{wn.transition=null,ct=1,C_(e,t,o,w)}finally{wn.transition=A,ct=w}return null}function C_(e,t,o,w){do Fr();while(ks!==null);if((at&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 j=o.lanes|o.childLanes;if(lo(e,j),e===Ht&&(It=Ht=null,Wt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||ra||(ra=!0,Nd(Gn,function(){return Fr(),null})),j=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||j){j=wn.transition,wn.transition=null;var z=ct;ct=1;var Q=at;at|=4,ec.current=null,__(e,o),vd(o,e),Wg(cl),Hs=!!ll,cl=ll=null,e.current=o,v_(o),za(),at=Q,ct=z,wn.transition=j}else e.current=o;if(ra&&(ra=!1,ks=e,ia=A),j=e.pendingLanes,j===0&&(xs=null),ii(o.stateNode),ln(e,yt()),t!==null)for(w=e.onRecoverableError,o=0;o<t.length;o++)A=t[o],w(A.value,{componentStack:A.stack,digest:A.digest});if(sa)throw sa=!1,e=sc,sc=null,e;return(ia&1)!==0&&e.tag!==0&&Fr(),j=e.pendingLanes,(j&1)!==0?e===rc?Pi++:(Pi=0,rc=e):Pi=0,ws(),null}function Fr(){if(ks!==null){var e=co(ia),t=wn.transition,o=ct;try{if(wn.transition=null,ct=16>e?16:e,ks===null)var w=!1;else{if(e=ks,ks=null,ia=0,(at&6)!==0)throw Error(i(331));var A=at;for(at|=4,Pe=e.current;Pe!==null;){var j=Pe,z=j.child;if((Pe.flags&16)!==0){var Q=j.deletions;if(Q!==null){for(var ee=0;ee<Q.length;ee++){var ce=Q[ee];for(Pe=ce;Pe!==null;){var _e=Pe;switch(_e.tag){case 0:case 11:case 15:Di(8,_e,j)}var be=_e.child;if(be!==null)be.return=_e,Pe=be;else for(;Pe!==null;){_e=Pe;var ge=_e.sibling,Ie=_e.return;if(fd(_e),_e===ce){Pe=null;break}if(ge!==null){ge.return=Ie,Pe=ge;break}Pe=Ie}}}var Oe=j.alternate;if(Oe!==null){var He=Oe.child;if(He!==null){Oe.child=null;do{var At=He.sibling;He.sibling=null,He=At}while(He!==null)}}Pe=j}}if((j.subtreeFlags&2064)!==0&&z!==null)z.return=j,Pe=z;else e:for(;Pe!==null;){if(j=Pe,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:Di(9,j,j.return)}var oe=j.sibling;if(oe!==null){oe.return=j.return,Pe=oe;break e}Pe=j.return}}var ne=e.current;for(Pe=ne;Pe!==null;){z=Pe;var ae=z.child;if((z.subtreeFlags&2064)!==0&&ae!==null)ae.return=z,Pe=ae;else e:for(z=ne;Pe!==null;){if(Q=Pe,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:ea(9,Q)}}catch(Ue){Lt(Q,Q.return,Ue)}if(Q===z){Pe=null;break e}var xe=Q.sibling;if(xe!==null){xe.return=Q.return,Pe=xe;break e}Pe=Q.return}}if(at=A,ws(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(or,e)}catch{}w=!0}return w}finally{ct=o,wn.transition=t}}return!1}function Rd(e,t,o){t=jr(o,t),t=Kh(e,t,1),e=Ss(e,t,1),t=tn(),e!==null&&(Yn(e,1,t),ln(e,t))}function Lt(e,t,o){if(e.tag===3)Rd(e,e,o);else for(;t!==null;){if(t.tag===3){Rd(t,e,o);break}else if(t.tag===1){var w=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(xs===null||!xs.has(w))){e=jr(o,e),e=Gh(t,e,1),t=Ss(t,e,1),e=tn(),t!==null&&(Yn(t,1,e),ln(t,e));break}}t=t.return}}function x_(e,t,o){var w=e.pingCache;w!==null&&w.delete(t),t=tn(),e.pingedLanes|=e.suspendedLanes&o,Ht===e&&(Wt&o)===o&&(Pt===4||Pt===3&&(Wt&130023424)===Wt&&500>yt()-nc?er(e,0):tc|=o),ln(e,t)}function Md(e,t){t===0&&((e.mode&1)===0?t=1:(t=us,us<<=1,(us&130023424)===0&&(us=4194304)));var o=tn();e=is(e,t),e!==null&&(Yn(e,t,o),ln(e,o))}function k_(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),Md(e,o)}function E_(e,t){var o=0;switch(e.tag){case 13:var w=e.stateNode,A=e.memoizedState;A!==null&&(o=A.retryLane);break;case 19:w=e.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(t),Md(e,o)}var Ad;Ad=function(e,t,o){if(e!==null)if(e.memoizedProps!==t.pendingProps||sn.current)on=!0;else{if((e.lanes&o)===0&&(t.flags&128)===0)return on=!1,f_(e,t,o);on=(e.flags&131072)!==0}else on=!1,Ct&&(t.flags&1048576)!==0&&uh(t,Oo,t.index);switch(t.lanes=0,t.tag){case 2:var w=t.type;Jo(e,t),e=t.pendingProps;var A=Lr(t,qt.current);Dr(t,o),A=Dl(null,t,w,e,A,o);var j=Il();return t.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,rn(w)?(j=!0,Io(t)):j=!1,t.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,El(t),A.updater=Xo,t.stateNode=A,A._reactInternals=t,Hl(t,w,e,o),t=zl(null,t,w,!0,j,o)):(t.tag=0,Ct&&j&&gl(t),en(null,t,A,o),t=t.child),t;case 16:w=t.elementType;e:{switch(Jo(e,t),e=t.pendingProps,A=w._init,w=A(w._payload),t.type=w,A=t.tag=T_(w),e=Rn(w,e),A){case 0:t=Wl(null,t,w,e,o);break e;case 1:t=sd(null,t,w,e,o);break e;case 11:t=Jh(null,t,w,e,o);break e;case 14:t=Zh(null,t,w,Rn(w.type,e),o);break e}throw Error(i(306,w,""))}return t;case 0:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:Rn(w,A),Wl(e,t,w,A,o);case 1:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:Rn(w,A),sd(e,t,w,A,o);case 3:e:{if(rd(t),e===null)throw Error(i(387));w=t.pendingProps,j=t.memoizedState,A=j.element,yh(e,t),Wo(t,w,null,o);var z=t.memoizedState;if(w=z.element,j.isDehydrated)if(j={element:w,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},t.updateQueue.baseState=j,t.memoizedState=j,t.flags&256){A=jr(Error(i(423)),t),t=id(e,t,w,o,A);break e}else if(w!==A){A=jr(Error(i(424)),t),t=id(e,t,w,o,A);break e}else for(fn=_s(t.stateNode.containerInfo.firstChild),dn=t,Ct=!0,Tn=null,o=_h(t,null,w,o),t.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Mr(),w===A){t=as(e,t,o);break e}en(e,t,w,o)}t=t.child}return t;case 5:return Sh(t),e===null&&yl(t),w=t.type,A=t.pendingProps,j=e!==null?e.memoizedProps:null,z=A.children,ul(w,A)?z=null:j!==null&&ul(w,j)&&(t.flags|=32),nd(e,t),en(e,t,z,o),t.child;case 6:return e===null&&yl(t),null;case 13:return od(e,t,o);case 4:return Ll(t,t.stateNode.containerInfo),w=t.pendingProps,e===null?t.child=Ar(t,null,w,o):en(e,t,w,o),t.child;case 11:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:Rn(w,A),Jh(e,t,w,A,o);case 7:return en(e,t,t.pendingProps,o),t.child;case 8:return en(e,t,t.pendingProps.children,o),t.child;case 12:return en(e,t,t.pendingProps.children,o),t.child;case 10:e:{if(w=t.type._context,A=t.pendingProps,j=t.memoizedProps,z=A.value,_t(Ho,w._currentValue),w._currentValue=z,j!==null)if(Ln(j.value,z)){if(j.children===A.children&&!sn.current){t=as(e,t,o);break e}}else for(j=t.child,j!==null&&(j.return=t);j!==null;){var Q=j.dependencies;if(Q!==null){z=j.child;for(var ee=Q.firstContext;ee!==null;){if(ee.context===w){if(j.tag===1){ee=os(-1,o&-o),ee.tag=2;var ce=j.updateQueue;if(ce!==null){ce=ce.shared;var _e=ce.pending;_e===null?ee.next=ee:(ee.next=_e.next,_e.next=ee),ce.pending=ee}}j.lanes|=o,ee=j.alternate,ee!==null&&(ee.lanes|=o),xl(j.return,o,t),Q.lanes|=o;break}ee=ee.next}}else if(j.tag===10)z=j.type===t.type?null:j.child;else if(j.tag===18){if(z=j.return,z===null)throw Error(i(341));z.lanes|=o,Q=z.alternate,Q!==null&&(Q.lanes|=o),xl(z,o,t),z=j.sibling}else z=j.child;if(z!==null)z.return=j;else for(z=j;z!==null;){if(z===t){z=null;break}if(j=z.sibling,j!==null){j.return=z.return,z=j;break}z=z.return}j=z}en(e,t,A.children,o),t=t.child}return t;case 9:return A=t.type,w=t.pendingProps.children,Dr(t,o),A=vn(A),w=w(A),t.flags|=1,en(e,t,w,o),t.child;case 14:return w=t.type,A=Rn(w,t.pendingProps),A=Rn(w.type,A),Zh(e,t,w,A,o);case 15:return ed(e,t,t.type,t.pendingProps,o);case 17:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:Rn(w,A),Jo(e,t),t.tag=1,rn(w)?(e=!0,Io(t)):e=!1,Dr(t,o),Vh(t,w,A),Hl(t,w,A,o),zl(null,t,w,!0,e,o);case 19:return ld(e,t,o);case 22:return td(e,t,o)}throw Error(i(156,t.tag))};function Nd(e,t){return so(e,t)}function L_(e,t,o,w){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=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(e,t,o,w){return new L_(e,t,o,w)}function uc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function T_(e){if(typeof e=="function")return uc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===F)return 11;if(e===V)return 14}return 2}function Ts(e,t){var o=e.alternate;return o===null?(o=bn(e.tag,t,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=t,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,t=e.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function ca(e,t,o,w,A,j){var z=2;if(w=e,typeof e=="function")uc(e)&&(z=1);else if(typeof e=="string")z=5;else e:switch(e){case M:return nr(o.children,A,j,t);case b:z=8,A|=8;break;case T:return e=bn(12,o,t,A|2),e.elementType=T,e.lanes=j,e;case O:return e=bn(13,o,t,A),e.elementType=O,e.lanes=j,e;case U:return e=bn(19,o,t,A),e.elementType=U,e.lanes=j,e;case X:return ua(o,A,j,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:z=10;break e;case B:z=9;break e;case F:z=11;break e;case V:z=14;break e;case Y:z=16,w=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=bn(z,o,t,A),t.elementType=e,t.type=w,t.lanes=j,t}function nr(e,t,o,w){return e=bn(7,e,w,t),e.lanes=o,e}function ua(e,t,o,w){return e=bn(22,e,w,t),e.elementType=X,e.lanes=o,e.stateNode={isHidden:!1},e}function hc(e,t,o){return e=bn(6,e,null,t),e.lanes=o,e}function dc(e,t,o){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=o,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function R_(e,t,o,w,A){this.tag=t,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=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.identifierPrefix=w,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function fc(e,t,o,w,A,j,z,Q,ee){return e=new R_(e,t,o,Q,ee),t===1?(t=1,j===!0&&(t|=8)):t=0,j=bn(3,null,null,t),e.current=j,j.stateNode=e,j.memoizedState={element:w,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},El(j),e}function M_(e,t,o){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:w==null?null:""+w,children:e,containerInfo:t,implementation:o}}function Dd(e){if(!e)return ys;e=e._reactInternals;e:{if(Kn(e)!==e||e.tag!==1)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(rn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(i(171))}if(e.tag===1){var o=e.type;if(rn(o))return ah(e,o,t)}return t}function Id(e,t,o,w,A,j,z,Q,ee){return e=fc(o,w,!0,e,A,j,z,Q,ee),e.context=Dd(null),o=e.current,w=tn(),A=Es(o),j=os(w,A),j.callback=t??null,Ss(o,j,A),e.current.lanes=A,Yn(e,A,w),ln(e,w),e}function ha(e,t,o,w){var A=t.current,j=tn(),z=Es(A);return o=Dd(o),t.context===null?t.context=o:t.pendingContext=o,t=os(j,z),t.payload={element:e},w=w===void 0?null:w,w!==null&&(t.callback=w),e=Ss(A,t,z),e!==null&&(Nn(e,A,z,j),Uo(e,A,z)),z}function da(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 jd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<t?o:t}}function pc(e,t){jd(e,t),(e=e.alternate)&&jd(e,t)}function A_(){return null}var Pd=typeof reportError=="function"?reportError:function(e){console.error(e)};function mc(e){this._internalRoot=e}fa.prototype.render=mc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));ha(e,t,null,null)},fa.prototype.unmount=mc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zs(function(){ha(null,e,null,null)}),t[ts]=null}};function fa(e){this._internalRoot=e}fa.prototype.unstable_scheduleHydration=function(e){if(e){var t=uo();e={blockedOn:null,target:e,priority:t};for(var o=0;o<xn.length&&t!==0&&t<xn[o].priority;o++);xn.splice(o,0,e),o===0&&ho(e)}};function gc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Od(){}function N_(e,t,o,w,A){if(A){if(typeof w=="function"){var j=w;w=function(){var ce=da(z);j.call(ce)}}var z=Id(t,w,e,0,null,!1,!1,"",Od);return e._reactRootContainer=z,e[ts]=z.current,wi(e.nodeType===8?e.parentNode:e),Zs(),z}for(;A=e.lastChild;)e.removeChild(A);if(typeof w=="function"){var Q=w;w=function(){var ce=da(ee);Q.call(ce)}}var ee=fc(e,0,!1,null,null,!1,!1,"",Od);return e._reactRootContainer=ee,e[ts]=ee.current,wi(e.nodeType===8?e.parentNode:e),Zs(function(){ha(t,ee,o,w)}),ee}function ma(e,t,o,w,A){var j=o._reactRootContainer;if(j){var z=j;if(typeof A=="function"){var Q=A;A=function(){var ee=da(z);Q.call(ee)}}ha(t,z,e,A)}else z=N_(o,t,e,A,w);return da(z)}ai=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var o=Vt(t.pendingLanes);o!==0&&(oi(t,o|1),ln(t,yt()),(at&6)===0&&(Br=yt()+500,ws()))}break;case 13:Zs(function(){var w=is(e,1);if(w!==null){var A=tn();Nn(w,e,1,A)}}),pc(e,1)}},li=function(e){if(e.tag===13){var t=is(e,134217728);if(t!==null){var o=tn();Nn(t,e,134217728,o)}pc(e,134217728)}},hr=function(e){if(e.tag===13){var t=Es(e),o=is(e,t);if(o!==null){var w=tn();Nn(o,e,t,w)}pc(e,t)}},uo=function(){return ct},ci=function(e,t){var o=ct;try{return ct=e,t()}finally{ct=o}},mt=function(e,t,o){switch(t){case"input":if(Le(e,o),t=o.name,o.type==="radio"&&t!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<o.length;t++){var w=o[t];if(w!==e&&w.form===e.form){var A=No(w);if(!A)throw Error(i(90));pe(w),Le(w,A)}}}break;case"textarea":Ae(e,o);break;case"select":t=o.value,t!=null&&Ee(e,!!o.multiple,t,!1)}},Se=ac,Ke=Zs;var D_={usingClientEntryPoint:!1,Events:[Ci,kr,No,Rt,Mt,ac]},Oi={findFiberByHostInstance:Vs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},I_={bundleType:Oi.bundleType,version:Oi.version,rendererPackageName:Oi.rendererPackageName,rendererConfig:Oi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=no(e),e===null?null:e.stateNode},findFiberByHostInstance:Oi.findFiberByHostInstance||A_,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 ga=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ga.isDisabled&&ga.supportsFiber)try{or=ga.inject(I_),nn=ga}catch{}}return cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D_,cn.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gc(t))throw Error(i(200));return M_(e,t,null,o)},cn.createRoot=function(e,t){if(!gc(e))throw Error(i(299));var o=!1,w="",A=Pd;return t!=null&&(t.unstable_strictMode===!0&&(o=!0),t.identifierPrefix!==void 0&&(w=t.identifierPrefix),t.onRecoverableError!==void 0&&(A=t.onRecoverableError)),t=fc(e,1,!1,null,null,o,!1,w,A),e[ts]=t.current,wi(e.nodeType===8?e.parentNode:e),new mc(t)},cn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=no(t),e=e===null?null:e.stateNode,e},cn.flushSync=function(e){return Zs(e)},cn.hydrate=function(e,t,o){if(!pa(t))throw Error(i(200));return ma(null,e,t,!0,o)},cn.hydrateRoot=function(e,t,o){if(!gc(e))throw Error(i(405));var w=o!=null&&o.hydratedSources||null,A=!1,j="",z=Pd;if(o!=null&&(o.unstable_strictMode===!0&&(A=!0),o.identifierPrefix!==void 0&&(j=o.identifierPrefix),o.onRecoverableError!==void 0&&(z=o.onRecoverableError)),t=Id(t,null,e,1,o??null,A,!1,j,z),e[ts]=t.current,wi(e),w)for(e=0;e<w.length;e++)o=w[e],A=o._getVersion,A=A(o._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[o,A]:t.mutableSourceEagerHydrationData.push(o,A);return new fa(t)},cn.render=function(e,t,o){if(!pa(t))throw Error(i(200));return ma(null,e,t,!1,o)},cn.unmountComponentAtNode=function(e){if(!pa(e))throw Error(i(40));return e._reactRootContainer?(Zs(function(){ma(null,null,e,!1,function(){e._reactRootContainer=null,e[ts]=null})}),!0):!1},cn.unstable_batchedUpdates=ac,cn.unstable_renderSubtreeIntoContainer=function(e,t,o,w){if(!pa(o))throw Error(i(200));if(e==null||e._reactInternals===void 0)throw Error(i(38));return ma(e,t,o,!1,w)},cn.version="18.3.1-next-f1338f8080-20240426",cn}var Vd;function Op(){if(Vd)return yc.exports;Vd=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(s){console.error(s)}}return n(),yc.exports=z_(),yc.exports}var qd;function V_(){if(qd)return _a;qd=1;var n=Op();return _a.createRoot=n.createRoot,_a.hydrateRoot=n.hydrateRoot,_a}var q_=V_(),I=mu();const K_=B_(I);function Fe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function je(n){return typeof n=="string"?n:null}function we(n){return typeof n=="string"&&n.length>0?n:null}function gt(n){return typeof n=="boolean"?n:null}function ze(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function Ca(n){if(!Array.isArray(n))return null;const s=[];for(const i of n){if(typeof i!="string")return null;s.push(i)}return s}function St(n,s){if(!Array.isArray(n))return null;const i=[];for(const h of n){const v=s(h);if(v===null)return null;i.push(v)}return i}function un(n,s){if(!Array.isArray(n))return null;const i=[];for(const h of n){const v=s(h);v!==null&&i.push(v)}return i}function Ze(n,s){return typeof n=="string"&&s.includes(n)?n:null}function G_(n){try{return JSON.parse(n)}catch{return}}const Y_=["auto","default","acceptEdits","plan"];function zr(n){return typeof n=="string"&&Y_.includes(n)}const X_={agentUnknown:[],answerInterrupted:[],answerInvalid:[],answerNoFreeText:[],answerNotPending:[],answerSendFailed:[],answersUnsupported:[],archiveOpenTab:[],attachmentEmpty:["name"],attachmentExecutable:["name"],attachmentSaveFailed:[],attachmentTooLarge:["max","name","size"],badMessage:[],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:[],filesPerMessage:["max"],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"],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 Q_(n){return Object.prototype.hasOwnProperty.call(X_,n)}function qn(n,s=0){const i=Fe(n);if(i===null)return null;const h=je(i.key);if(h===null||h.length===0)return null;const v=i.params;if(v===void 0)return{key:h};const R=Fe(v);if(R===null)return null;const x={};for(const[r,c]of Object.entries(R)){if(typeof c=="string"||typeof c=="number"&&Number.isFinite(c)){x[r]=c;continue}const g=s===0?qn(c,s+1):null;if(g===null)return null;x[r]=g}return{key:h,params:x}}function J_(n){if(!Array.isArray(n))return null;const s=[];for(const i of n){const h=qn(i);if(h===null)return null;s.push(h)}return s}const qr=["claude-code","codex","opencode","antigravity"],Z_=["gemini-cli","antigravity-ide"],Oa=[...qr,...Z_],ev={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Xr(n){return qr.includes(n)}const tv=["at-quoted","bare-path-paste"],nv=["at"],sv=["usage-with-variants","token-count","usage-with-catalog","status-line"],rv=["child-session-marker"],iv=["active","missing","other-command","disabled","unreadable"];function Bp(n,s=null){return!n.statusSource||s==="unknown"}const Fp={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};function gu(n){return n.filter(s=>s.available).length>1}function ov(n){const s=Fe(n);if(s===null)return null;const i=s.modes;if(!Array.isArray(i)||i.length===0)return null;const h=[];for(const x of i){if(!zr(x))return null;h.push(x)}const v=s.launchMode;if(!zr(v)||!h.includes(v))return null;const R=we(s.keyLabel);return R===null?null:{modes:h,launchMode:v,keyLabel:R,approvesPendingOnCycle:s.approvesPendingOnCycle===!0}}function av(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.state,iv),h=we(s.settingsPath),v=we(s.scriptPath),R=s.fragment,x=R===null?null:we(R);return i===null||h===null||v===null||R!==null&&x===null?null:{state:i,settingsPath:h,scriptPath:v,fragment:x}}function lv(n){const s=Fe(n);if(s===null)return null;const i=we(s.value),h=je(s.label),v=je(s.family),R=gt(s.long),x=s.window,r=x===null?null:ze(x);return i===null||h===null||v===null||R===null||x!==null&&r===null?null:{value:i,label:h,family:v,long:R,window:r}}function cv(n){const s=Fe(n);if(s===null)return null;const i=we(s.value),h=je(s.label);return i===null||h===null?null:{value:i,label:h}}function Kd(n,s){const i=St(n,s);return i===null||i.length===0?null:i}function uv(n){const s=Fe(n);return s===null?{...Fp}:{sessionIdAtLaunch:s.sessionIdAtLaunch===!0,resume:s.resume===!0,statusSource:s.statusSource===!0,readySignal:s.readySignal===!0,permissionCycle:ov(s.permissionCycle),models:Kd(s.models,lv),efforts:Kd(s.efforts,cv),questionCards:s.questionCards===!0,imagesByPath:Ze(s.imagesByPath,tv),fileMentions:Ze(s.fileMentions,nv),rewind:s.rewind===!0,contextWindowSource:Ze(s.contextWindowSource,sv),plans:s.plans===!0,waitingBlocksSubmit:s.waitingBlocksSubmit===!0}}function Gd(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.id,qr),h=je(s.label),v=je(s.command),R=je(s.installUrl);return i===null||h===null||v===null||R===null?null:{id:i,label:h,command:v,available:s.available===!0,version:je(s.version),installUrl:R,missingMessage:qn(s.missingMessage),capabilities:uv(s.capabilities),environmentNotice:Ze(s.environmentNotice,rv),statusLine:av(s.statusLine)}}const hv=["custom","ai","first-message","none"],dv=["native","vault"],fv=["idle","scanning","ready"],pv=["agent","shell"],mv=["busy","idle","waiting","offline","unknown"],gv=["server-closed"];function _v(n){const s=Fe(n);if(s===null)return null;const i=we(s.sessionId),h=je(s.title),v=Ze(s.titleSource,hv),R=ze(s.updatedAt),x=ze(s.sizeBytes);if(i===null||h===null||v===null||R===null||x===null)return null;const r=s.agent===void 0?"claude-code":Ze(s.agent,Oa);if(r===null)return null;const c=je(s.cwd)??"";return{agent:r,sessionId:i,cwd:c,title:h,titleSource:v,updatedAt:R,sizeBytes:x,archived:s.archived===!0,storage:Ze(s.storage,dv)??"native",partial:s.partial===!0}}function vv(n){const s=Fe(n);if(s===null)return null;const i=je(s.cwd),h=gt(s.cwdExists),v=un(s.sessions,_v),R=ze(s.lastActivityAt);if(i===null||h===null||v===null||R===null)return null;const x=we(s.key);if(x!==null)return{key:x,fallbackName:je(s.fallbackName)??"",cwd:i,cwdExists:h,sessions:v,lastActivityAt:R};const r=we(s.slug);return r===null?null:{key:r,fallbackName:i.length===0?r:"",cwd:i,cwdExists:h,sessions:v,lastActivityAt:R}}function yv(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.state,fv),h=ze(s.scannedFiles),v=ze(s.totalFiles);return i===null||h===null||v===null?null:{state:i,scannedFiles:h,totalFiles:v}}function Yd(n){const s=Fe(n);if(s===null)return null;const i=we(s.terminalId),h=Ze(s.kind,pv)??"agent";let v=null;if(h==="agent"&&(v=s.agent===void 0?"claude-code":Ze(s.agent,qr),v===null))return null;const R=je(s.cwd),x=je(s.sessionId),r=je(s.label),c=gt(s.resumed),g=ze(s.createdAt),_=gt(s.alive);if(i===null||R===null||x===null||r===null||c===null||g===null||_===null)return null;const u=s.exitCode;return{terminalId:i,kind:h,agent:v,cwd:R,sessionId:x,label:r,resumed:c,createdAt:g,alive:_,exitCode:typeof u=="number"?u:null,sleeping:s.sleeping===!0}}const Hp=["user","assistant"],$p=["content","attachment","pasted"],wv=["compacted","interrupted","error"],bv=["cli-plans","project","scratch"],Sv=120,Cv=20,Sc={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},Xd=["waiting","live","unavailable","no-transcript"];function xv(n){const s=Fe(n);if(s===null)return null;const i=ze(s.inputTokens),h=ze(s.outputTokens),v=ze(s.cacheCreationInputTokens),R=ze(s.cacheReadInputTokens);return i===null||h===null||v===null||R===null?null:{inputTokens:i,outputTokens:h,cacheCreationInputTokens:v,cacheReadInputTokens:R}}function kv(n){const s=Fe(n);if(s===null)return null;const i=we(s.label);return i===null?null:{label:i,description:je(s.description)??""}}function Ev(n){const s=Fe(n);if(s===null)return null;const i=we(s.question),h=St(s.options,kv);return i===null||h===null||h.length===0?null:{question:i,header:je(s.header)??"",multiSelect:s.multiSelect===!0,options:h}}function Up(n){const s=Fe(n);if(s===null)return null;switch(s.kind){case"text":{const i=je(s.text),h=gt(s.truncated);return i===null||h===null?null:{kind:"text",text:i,truncated:h}}case"tool-call":{const i=je(s.toolUseId),h=je(s.name),v=je(s.input),R=gt(s.truncated);return i===null||h===null||v===null||R===null?null:{kind:"tool-call",toolUseId:i,name:h,input:v,truncated:R}}case"tool-result":{const i=je(s.toolUseId),h=je(s.text),v=gt(s.isError),R=gt(s.truncated),x=ze(s.imageCount);return i===null||h===null||v===null||R===null||x===null?null:{kind:"tool-result",toolUseId:i,text:h,isError:v,truncated:R,imageCount:x}}case"thinking":return{kind:"thinking"};case"question":{const i=we(s.toolUseId),h=St(s.questions,Ev);return i===null||h===null||h.length===0?null:{kind:"question",toolUseId:i,questions:h}}case"image":{const i=ze(s.index),h=je(s.mediaType);if(i===null||h===null)return null;const v=Ze(s.source,$p)??"content";return{kind:"image",index:i,mediaType:h,source:v}}case"notice":{const i=Ze(s.notice,wv);return i===null?null:{kind:"notice",notice:i,detail:je(s.detail)??""}}default:return null}}function Cc(n){const s=Fe(n);if(s===null)return null;const i=we(s.eventId),h=Ze(s.role,Hp),v=ze(s.at),R=St(s.parts,Up);return i===null||h===null||v===null||R===null?null:{eventId:i,role:h,at:v,parts:R,model:je(s.model),usage:xv(s.usage),effort:je(s.effort),durationMs:ze(s.durationMs),queued:s.queued===!0}}function Lv(n){const s=Fe(n);if(s===null)return null;const i=we(s.toolUseId),h=je(s.description),v=ze(s.startedAt);return i===null||h===null||v===null?null:{toolUseId:i,description:h.slice(0,Sv),background:s.background===!0,startedAt:v}}function Qd(n){const s=Fe(n);if(s===null)return null;const i=ze(s.lastRequestTokens),h=ze(s.lastOutputTokens),v=ze(s.totalInputTokens),R=ze(s.totalOutputTokens),x=ze(s.totalCacheReadTokens),r=ze(s.assistantMessages);if(i===null||h===null||v===null||R===null||x===null||r===null)return null;const c=je(s.lastEffort);return{lastRequestTokens:i,lastOutputTokens:h,lastModel:je(s.lastModel),contextWindow:ze(s.contextWindow),contextWindowEstimated:s.contextWindowEstimated===!0,totalInputTokens:v,totalOutputTokens:R,totalCacheReadTokens:x,assistantMessages:r,...c!==null?{lastEffort:c}:{}}}function Tv(n){const s=Fe(n);if(s===null)return null;const i=we(s.fileName),h=we(s.title),v=ze(s.modifiedAt),R=ze(s.sizeBytes);if(i===null||h===null||v===null||R===null)return null;const x=s.origin,r=bv.find(g=>g===x)??"cli-plans",c=je(s.path)??"";return{fileName:i,title:h,origin:r,path:c,exists:s.exists===!0,modifiedAt:v,sizeBytes:R}}function Rv(n){const s=Fe(n);if(s===null)return null;const i=we(s.fileName),h=je(s.text);return i===null||h===null?null:{fileName:i,text:h,truncated:s.truncated===!0}}const Wp=[{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 Mv(n){if(n.window===null)return n.label;const s=n.window>=1e6?`${Math.round(n.window/1e6)}M`:`${Math.round(n.window/1e3)}k`;return`${n.label} · ${s}`}function Av(n,s=Wp){const i=Nv(n,s);if(i===null||n===null)return null;const h=n.includes("[1m]");return s.find(v=>v.family===i&&v.long===h)??null}function Nv(n,s=Wp){var h;return n===null||n.length===0?null:((h=s.filter(v=>v.family.length>0).sort((v,R)=>R.family.length-v.family.length).find(v=>n.includes(v.family)))==null?void 0:h.family)??null}function Dv(n){return`/model ${n}`}function Iv(n){return`/effort ${n}`}const jv=["staged","unstaged","untracked","conflict"],Pv=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Ov=["ready","not-a-repo","git-missing","error"],xc={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Bv=["meta","hunk","context","added","removed"];function Fv(n){const s=Fe(n);if(s===null)return null;const i=we(s.path),h=Ze(s.kind,Pv),v=Ze(s.stage,jv);return i===null||h===null||v===null?null:{path:i,kind:h,stage:v,oldPath:je(s.oldPath)}}function Hv(n){const s=Fe(n);if(s===null)return null;const i=we(s.path);return i===null?null:{path:i,branch:je(s.branch),isCurrent:s.isCurrent===!0}}function $v(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.state,Ov),h=je(s.repoRoot),v=ze(s.ahead),R=ze(s.behind),x=St(s.changes,Fv),r=St(s.worktrees,Hv),c=ze(s.updatedAt);return i===null||h===null||v===null||R===null||x===null||r===null||c===null?null:{state:i,message:qn(s.message),repoRoot:h,branch:je(s.branch),head:je(s.head),upstream:je(s.upstream),ahead:v,behind:R,changes:x,worktrees:r,truncated:s.truncated===!0,updatedAt:c}}function Uv(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.kind,Bv),h=je(s.text);return i===null||h===null?null:{kind:i,text:h,oldLine:ze(s.oldLine),newLine:ze(s.newLine)}}function Wv(n){const s=Fe(n);if(s===null)return null;const i=we(s.path),h=gt(s.staged),v=St(s.lines,Uv);return i===null||h===null||v===null?null:{path:i,staged:h,lines:v,truncated:s.truncated===!0,binary:s.binary===!0,message:qn(s.message)}}const zv=["dir","file"],Vv=["ignored","always"];function zp(n){const s=Fe(n);if(s===null)return null;const i=we(s.name),h=we(s.path),v=Ze(s.kind,zv),R=ze(s.sizeBytes),x=ze(s.modifiedAt);if(i===null||h===null||v===null||R===null||x===null)return null;const r=Ze(s.hidden,Vv),c={name:i,path:h,kind:v,sizeBytes:R,modifiedAt:x};return r===null?c:{...c,hidden:r}}function qv(n){const s=Fe(n);if(s===null)return null;const i=je(s.query),h=St(s.entries,zp);return i===null||h===null?null:{query:i,entries:h,truncated:s.truncated===!0}}function Kv(n){const s=Fe(n);if(s===null)return null;const i=je(s.path),h=St(s.entries,zp),v=ze(s.hiddenCount);return i===null||h===null||v===null?null:{path:i,entries:h,truncated:s.truncated===!0,hiddenCount:v}}function Gv(n){const s=Fe(n);if(s===null)return null;const i=we(s.path),h=je(s.text),v=ze(s.sizeBytes),R=gt(s.binary);return i===null||h===null||v===null||R===null?null:{path:i,language:je(s.language),text:h,sizeBytes:v,truncated:s.truncated===!0,binary:R}}function Yv(n){const s=Fe(n);if(s===null)return null;const i=we(s.pickerId),h=we(s.path),v=St(s.entries,x=>we(x)),R=St(s.roots,x=>we(x));return i===null||h===null||v===null||R===null?null:{pickerId:i,path:h,entries:v,roots:R,canGoUp:s.canGoUp===!0,truncated:s.truncated===!0}}const Vp=1e6,Xv=100,Qv=999999;function qp(n){return n.pasted.reduce((s,i)=>s+i.text.length,n.text.length)}function La(n){return n.text.trim().length===0&&n.pasted.every(s=>s.text.trim().length===0)}function Kp(n,s){return n.text!==s.text||n.pasted.length!==s.pasted.length?!1:n.pasted.every((i,h)=>{const v=s.pasted[h];return v!==void 0&&v.number===i.number&&v.text===i.text})}function Jv(n){const s=Fe(n);if(s===null)return null;const i=s.number,h=je(s.text);return typeof i!="number"||!Number.isInteger(i)||i<1||i>Qv||h===null?null:{number:i,text:h}}function Zv(n){const s=Fe(n);if(s===null)return null;const i=je(s.text),h=St(s.pasted,Jv);return i===null||h===null||h.length>Xv||new Set(h.map(v=>v.number)).size!==h.length?null:{text:i,pasted:h}}const Ta="MEMORY.md",_u=["AGENTS.md","CLAUDE.md"],Gp=["claude-code","codex","antigravity","opencode"],e0=["outside","encoding"],t0=["create","append-block","replace-block","append-lines","copy"];function n0(n){return{instructionFiles:[..._u],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 s0(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.name,_u),h=gt(s.exists),v=gt(s.hasBlock),R=gt(s.blockCurrent),x=gt(s.brokenBlock),r=s.problem,c=r===null?null:Ze(r,e0);return i===null||h===null||v===null||R===null||x===null||r!==null&&c===null?null:{name:i,exists:h,hasBlock:v,blockCurrent:R,brokenBlock:x,problem:c}}function r0(n){const s=Fe(n);if(s===null)return null;switch(s.kind){case"not-repo":return{kind:"not-repo"};case"error":{const i=qn(s.message);return i===null?null:{kind:"error",message:i}}case"repo":{const i=gt(s.ignored);if(i===null)return null;if(s.worktree===null)return{kind:"repo",ignored:i,worktree:null};const h=Fe(s.worktree);if(h===null)return null;const v=we(h.mainPath),R=gt(h.mainHasMemory);return v===null||R===null?null:{kind:"repo",ignored:i,worktree:{mainPath:v,mainHasMemory:R}}}default:return null}}function i0(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.agent,Gp),h=we(s.label),v=gt(s.reaches),R=qn(s.via);return i===null||h===null||v===null||R===null?null:{agent:i,label:h,reaches:v,via:R}}function o0(n){const s=Fe(n);if(s===null)return null;const i=we(s.name),h=je(s.title),v=je(s.description),R=ze(s.sizeBytes),x=ze(s.modifiedAt);return i===null||h===null||v===null||R===null||x===null?null:{name:i,title:h,description:v,sizeBytes:R,modifiedAt:x}}const a0=["line","command","json"];function l0(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.agent,Gp),h=we(s.label),v=we(s.target),R=Ze(s.kind,a0),x=we(s.text),r=qn(s.note);return i===null||h===null||v===null||R===null||x===null||r===null?null:{agent:i,label:h,target:v,kind:R,text:x,note:r}}function c0(n){const s=Fe(n);if(s===null)return null;const i=we(s.cwd),h=gt(s.folderExists),v=gt(s.indexExists),R=gt(s.installed),x=St(s.notes,o0),r=St(s.files,s0),c=r0(s.git),g=St(s.reach,i0),_=Fe(s.native),u=_===null?null:ze(_.available),y=_===null?null:ze(_.pending),S=St(s.globalFragments,l0);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||u===null||y===null||S===null?null:{cwd:i,folderExists:h,indexExists:v,installed:R,notes:x,files:r,git:c,reach:g,native:{available:u,pending:y},globalFragments:S}}function Jd(n){const s=Fe(n);if(s===null)return null;const i=we(s.file),h=Ze(s.action,t0),v=je(s.preview),R=je(s.copiedFrom);return i===null||h===null||v===null?null:{file:i,action:h,preview:v,copiedFrom:R}}function u0(n){const s=Fe(n);if(s===null)return null;const i=we(s.name),h=je(s.text),v=gt(s.truncated);return i===null||h===null||v===null?null:{name:i,text:h,truncated:v}}const Zd=20;function h0(n,s="Nota"){const i=n.text.split(`
41
- `).map(h=>h.trim()).find(h=>h.length>0);return i===void 0?n.images.length>0?"Imagen":s:i.length>40?`${i.slice(0,40)}…`:i}function d0(n){const s=Fe(n);if(s===null)return null;const i=we(s.imageId),h=we(s.mediaType),v=ze(s.bytes);return i===null||h===null||v===null?null:{imageId:i,mediaType:h,bytes:v}}function f0(n){const s=Fe(n);if(s===null)return null;const i=we(s.noteId),h=je(s.text),v=St(s.images,d0),R=ze(s.createdAt),x=ze(s.updatedAt);return i===null||h===null||v===null?null:{noteId:i,text:h,images:v,createdAt:R??0,updatedAt:x??0}}const Yp=3,p0=3e4,m0=["results","time"];function Kr(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Ui(n,s){if(n==null)return null;const i=s(n);return i===null?void 0:i}function Xp(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.agent,Oa),h=we(s.sessionId),v=Ui(s.cwd,je),R=je(s.title),x=Ui(s.eventId,we),r=Ui(s.role,y=>Ze(y,Hp)),c=Ui(s.at,ze),g=je(s.snippet),_=Kr(s.matchStart),u=Kr(s.matchLength);return i===null||h===null||v===void 0||R===null||x===void 0||r===void 0||c===void 0||g===null||_===null||u===null||_+u>g.length?null:{agent:i,sessionId:h,cwd:v,title:R,eventId:x,role:r,at:c,snippet:g,matchStart:_,matchLength:u}}function g0(n){const s=Fe(n);if(s===null)return null;const i=je(s.query),h=un(s.hits,Xp),v=Kr(s.sessionsScanned),R=Kr(s.sessionsTotal),x=Ui(s.truncated,r=>Ze(r,m0));return i===null||h===null||v===null||R===null||v>R||x===void 0?null:{query:i,hits:h,sessionsScanned:v,sessionsTotal:R,truncated:x}}function _0(n){const s=Fe(n);if(s===null)return null;const i=je(s.query),h=un(s.hits,Xp),v=Kr(s.sessionsScanned),R=Kr(s.sessionsTotal);return i===null||h===null||v===null||R===null||v>R?null:{query:i,hits:h,sessionsScanned:v,sessionsTotal:R}}const v0=["off","idle","measuring","writing","moving"];function Qt(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Fi(n,s){if(n==null)return null;const i=s(n);return i===null?void 0:i}function y0(n){const s=Fe(n);if(s===null)return null;const i=Ze(s.agent,Oa),h=Qt(s.sessions),v=Qt(s.eventBytes),R=Qt(s.images),x=Qt(s.imageBytes),r=Qt(s.skippedArchived),c=Qt(s.skippedEmpty),g=Qt(s.unsupported),_=Qt(s.failed),u=J_(s.failureReasons);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||_===null||u===null?null:{agent:i,sessions:h,eventBytes:v,images:R,imageBytes:x,skippedArchived:r,skippedEmpty:c,unsupported:g,failed:_,failureReasons:u}}function w0(n){const s=Fe(n);if(s===null)return null;const i=ze(s.measuredAt),h=ze(s.durationMs),v=un(s.byAgent,y0),R=Qt(s.memoryProjects),x=Qt(s.memoryBytes);return i===null||h===null||v===null||R===null||x===null?null:{measuredAt:i,durationMs:h,byAgent:v,memoryProjects:R,memoryBytes:x}}function b0(n){const s=Fe(n);if(s===null)return null;const i=Qt(s.done),h=Qt(s.total);return i===null||h===null?null:{done:i,total:h}}function S0(n){const s=Fe(n);if(s===null)return null;const i=gt(s.enabled),h=je(s.dir),v=gt(s.isDefaultDir),R=Ze(s.state,v0),x=Qt(s.sessions),r=Qt(s.passSessions),c=Qt(s.bytes),g=Qt(s.pending),_=Fi(s.progress,b0),u=Fi(s.lastPassAt,ze),y=Fi(s.measurement,w0),S=Fi(s.previousDir,je),L=Fi(s.lastError,qn);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||_===void 0||u===void 0||y===void 0||S===void 0||L===void 0?null:{enabled:i,dir:h,isDefaultDir:v,state:R,progress:_,sessions:x,passSessions:r,bytes:c,lastPassAt:u,pending:g,measurement:y,previousDir:S,lastError:L}}const Qp=1024,Jp=65535,C0="pair",x0=4001;function k0(n){return typeof n=="number"&&Number.isInteger(n)&&n>=Qp&&n<=Jp}const E0=["off","active","restart-needed","port-busy"];function L0(n){const s=Fe(n);if(s===null)return null;const i=we(s.id),h=je(s.label),v=ze(s.createdAt),R=gt(s.connected);if(i===null||h===null||v===null||R===null)return null;const x=s.lastSeenAt,r=x==null?null:ze(x);return x!=null&&r===null?null:{id:i,label:h,createdAt:v,lastSeenAt:r,connected:R}}function T0(n){const s=Fe(n);if(s===null)return null;const i=gt(s.enabled),h=ze(s.port),v=Ze(s.state,E0),R=ze(s.listeningPort),x=je(s.sshUser),r=Ca(s.hostNames),c=gt(s.pairingActive),g=St(s.devices,L0);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null?null:{enabled:i,port:h,state:v,listeningPort:R,sshUser:x,hostNames:r,pairingActive:c,devices:g}}function R0(n){const s=Fe(n);if(s===null)return null;const i=we(s.code),h=ze(s.expiresAt);return i===null||h===null?null:{code:i,expiresAt:h}}const M0=["powershell-admin","powershell","terminal"];function A0(n){const s=Fe(n);if(s===null)return null;const i=we(s.payload),h=we(s.authorizeCommand),v=Ze(s.shell,M0),R=we(s.code),x=ze(s.expiresAt);return i===null||h===null||v===null||R===null||x===null?null:{payload:i,authorizeCommand:h,shell:v,code:R,expiresAt:x}}const N0=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function Zp(n){return Ze(n,N0)}function D0(n){const s=Fe(n);if(s===null)return null;const i=Zp(s.id),h=we(s.label);return i===null||i==="auto"||h===null?null:{id:i,label:h}}function ef(n){return Array.isArray(n)?[...new Set(n.filter(s=>typeof s=="string"&&Xr(s)))]:null}function I0(n){const s=Fe(n);if(s===null)return null;const i=Zp(s.consoleShell),h=un(s.consoleShells,D0),v=s.shellName,R=v===null?null:we(v),x=ef(s.disabledAgents),r=ef(s.disabledAtStart);return i===null||h===null||x===null||r===null||v!==null&&R===null?null:{consoleShell:i,consoleShells:h,shellName:R,disabledAgents:x,disabledAtStart:r}}const Ur=8,j0="/ws",Yc="token",Ra=12*1024*1024,kc=8,tf=10*1024*1024,Ec=4,P0=["sending","prefilled"],O0=["no-delivery","not-ready","send-failed"],B0=["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","remote-refused","agent-unsupported","internal"];function F0(n){const s={model:null,effort:null,contextWindow:null};if(typeof n!="object"||n===null)return s;const i=n;return{model:we(i.model),effort:we(i.effort),contextWindow:ze(i.contextWindow)}}function H0(n){const s=Fe(n);if(s===null)return null;const i=we(s.terminalId),h=Zv(s.draft);return i===null||h===null?null:{terminalId:i,draft:h}}function nf(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function va(n,s){const i=we(s.requestId);return i!==null&&(n.requestId=i),n}function sf(n){var s;return((s=un(n,Lv))==null?void 0:s.slice(0,Cv))??null}function $0(n){const s=Fe(G_(n));if(s===null)return null;switch(s.type){case"hello":{const i=ze(s.protocolVersion),h=je(s.platform),v=je(s.defaultCwd);return i===null||h===null||v===null?null:{type:"hello",protocolVersion:i,agents:un(s.agents,Gd)??[],defaultAgent:Ze(s.defaultAgent,qr),platform:h,defaultCwd:v,shellName:we(s.shellName),remoteClient:s.remoteClient===!0}}case"agents":{const i=un(s.agents,Gd);return i===null?null:{type:"agents",agents:i,defaultAgent:Ze(s.defaultAgent,qr)}}case"terminal.list":{const i=un(s.terminals,Yd),h=Ca(s.order);return i===null||h===null?null:{type:"terminal.list",terminals:i,order:h}}case"terminal.opened":{const i=we(s.requestId),h=Yd(s.terminal);return i===null||h===null?null:{type:"terminal.opened",requestId:i,terminal:h}}case"terminal.output":{const i=we(s.terminalId),h=je(s.data);return i===null||h===null?null:{type:"terminal.output",terminalId:i,data:h}}case"terminal.replay":{const i=we(s.terminalId),h=je(s.data);return i===null||h===null?null:{type:"terminal.replay",terminalId:i,data:h,truncated:s.truncated===!0}}case"terminal.exit":{const i=we(s.terminalId),h=ze(s.exitCode);if(i===null||h===null)return null;const v=s.signal;return{type:"terminal.exit",terminalId:i,exitCode:h,signal:typeof v=="number"?v:null}}case"terminal.closed":{const i=we(s.terminalId);return i===null?null:{type:"terminal.closed",terminalId:i}}case"terminal.activity":{const i=we(s.terminalId),h=Ze(s.activity,mv);if(i===null||h===null)return null;const v=h==="offline"?Ze(s.offlineReason,gv):null;return v===null?{type:"terminal.activity",terminalId:i,activity:h}:{type:"terminal.activity",terminalId:i,activity:h,offlineReason:v}}case"index.status":{const i=yv(s.status);return i===null?null:{type:"index.status",status:i}}case"index.projects":{const i=un(s.projects,vv);return i===null?null:{type:"index.projects",projects:i,replace:s.replace===!0}}case"conversation.reset":{const i=we(s.terminalId),h=je(s.sessionId),v=Ze(s.state,Xd),R=un(s.events,Cc),x=Qd(s.usage);return i===null||h===null||v===null||R===null||x===null?null:{type:"conversation.reset",terminalId:i,sessionId:h,state:v,events:R,hasMore:s.hasMore===!0,usage:x,permissionMode:zr(s.permissionMode)?s.permissionMode:null,defaults:F0(s.defaults),waitingFor:we(s.waitingFor),openToolCall:s.openToolCall===!0,subagents:sf(s.subagents)??[]}}case"conversation.subagents":{const i=we(s.terminalId),h=sf(s.subagents);return i===null||h===null?null:{type:"conversation.subagents",terminalId:i,subagents:h}}case"agent.submitted":{const i=we(s.terminalId),h=we(s.requestId),v=gt(s.delivered);return i===null||h===null||v===null?null:{type:"agent.submitted",terminalId:i,requestId:h,delivered:v}}case"conversation.append":{const i=we(s.terminalId),h=un(s.events,Cc),v=Qd(s.usage);return i===null||h===null||v===null?null:{type:"conversation.append",terminalId:i,events:h,usage:v,permissionMode:zr(s.permissionMode)?s.permissionMode:null}}case"conversation.mode":{const i=we(s.terminalId),h=s.mode;return i===null||!zr(h)?null:{type:"conversation.mode",terminalId:i,mode:h}}case"conversation.waiting":{const i=we(s.terminalId);return i===null?null:{type:"conversation.waiting",terminalId:i,waitingFor:we(s.waitingFor)}}case"conversation.toolCall":{const i=we(s.terminalId),h=gt(s.open);return i===null||h===null?null:{type:"conversation.toolCall",terminalId:i,open:h}}case"conversation.page":{const i=we(s.terminalId),h=un(s.events,Cc);return i===null||h===null?null:{type:"conversation.page",terminalId:i,events:h,hasMore:s.hasMore===!0}}case"conversation.turns":{const i=we(s.terminalId),h=St(s.turns,v=>{const R=Fe(v);if(R===null)return null;const x=we(R.eventId),r=ze(R.durationMs);return x===null||r===null?null:{eventId:x,durationMs:r}});return i===null||h===null?null:{type:"conversation.turns",terminalId:i,turns:h}}case"conversation.parts":{const i=we(s.terminalId),h=St(s.updates,v=>{const R=Fe(v);if(R===null)return null;const x=we(R.eventId),r=St(R.parts,Up);return x===null||r===null?null:{eventId:x,parts:r}});return i===null||h===null?null:{type:"conversation.parts",terminalId:i,updates:h}}case"conversation.imageData":{const i=we(s.terminalId),h=we(s.eventId),v=ze(s.index),R=je(s.mediaType);if(i===null||h===null||v===null||R===null)return null;const x=s.data;return{type:"conversation.imageData",terminalId:i,eventId:h,index:v,source:Ze(s.source,$p)??"content",mediaType:R,data:typeof x=="string"?x:null}}case"conversation.state":{const i=we(s.terminalId),h=Ze(s.state,Xd);return i===null||h===null?null:{type:"conversation.state",terminalId:i,state:h}}case"git.status":{const i=we(s.terminalId),h=$v(s.status);return i===null||h===null?null:{type:"git.status",terminalId:i,status:h}}case"git.diff":{const i=we(s.terminalId),h=Wv(s.diff);return i===null||h===null?null:{type:"git.diff",terminalId:i,diff:h}}case"files.listing":{const i=we(s.terminalId),h=Kv(s.listing);return i===null||h===null?null:{type:"files.listing",terminalId:i,listing:h}}case"picker.listing":{const i=Yv(s.listing);return i===null?null:{type:"picker.listing",listing:i}}case"files.preview":{const i=we(s.terminalId),h=Gv(s.preview);return i===null||h===null?null:{type:"files.preview",terminalId:i,preview:h}}case"conversation.plans":{const i=we(s.terminalId),h=St(s.plans,Tv);return i===null||h===null?null:{type:"conversation.plans",terminalId:i,plans:h}}case"plans.content":{const i=we(s.terminalId),h=Rv(s.plan);return i===null||h===null?null:{type:"plans.content",terminalId:i,plan:h}}case"files.results":{const i=we(s.terminalId),h=qv(s.result);return i===null||h===null?null:{type:"files.results",terminalId:i,result:h}}case"notes.list":{const i=St(s.notes,f0);return i===null?null:{type:"notes.list",notes:i}}case"notes.imageData":{const i=we(s.imageId),h=je(s.mediaType);if(i===null||h===null)return null;const v=s.data;return{type:"notes.imageData",imageId:i,mediaType:h,data:typeof v=="string"?v:null}}case"memory.status":{const i=we(s.terminalId),h=c0(s.status);return i===null||h===null?null:{type:"memory.status",terminalId:i,status:h}}case"memory.planned":{const i=we(s.terminalId),h=St(s.changes,Jd);return i===null||h===null?null:va({type:"memory.planned",terminalId:i,changes:h},s)}case"memory.installed":{const i=we(s.terminalId),h=St(s.applied,Jd);return i===null||h===null?null:va({type:"memory.installed",terminalId:i,applied:h},s)}case"memory.imported":{const i=we(s.terminalId),h=Ca(s.copied),v=Ca(s.skipped);return i===null||h===null||v===null?null:va({type:"memory.imported",terminalId:i,copied:h,skipped:v},s)}case"memory.content":{const i=we(s.terminalId),h=u0(s.note);return i===null||h===null?null:va({type:"memory.content",terminalId:i,note:h},s)}case"vault.status":{const i=S0(s.status);return i===null?null:{type:"vault.status",status:i}}case"vault.exported":{const i=we(s.projectKey),h=ze(s.sessions);return i===null||h===null?null:{type:"vault.exported",projectKey:i,sessions:h}}case"session.continued":{const i=we(s.requestId),h=we(s.terminalId),v=Fe(s.source),R=Ze(v==null?void 0:v.agent,Oa),x=we(v==null?void 0:v.sessionId),r=je(v==null?void 0:v.title),c=nf(s.includedTurns),g=nf(s.totalTurns),_=Ze(s.delivery,P0);return i===null||h===null||R===null||x===null||r===null||c===null||g===null||c>g||_===null?null:{type:"session.continued",requestId:i,terminalId:h,source:{agent:R,sessionId:x,title:r},includedTurns:c,totalTurns:g,totalTurnsIsMinimum:s.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const i=we(s.terminalId),h=we(s.text),v=Ze(s.reason,O0);return i===null||h===null||v===null?null:{type:"composer.prefill",terminalId:i,text:h,reason:v}}case"composer.drafts":{const i=un(s.drafts,H0);return i===null?null:{type:"composer.drafts",drafts:i}}case"search.progress":{const i=we(s.searchId),h=_0(s.progress);return i===null||h===null?null:{type:"search.progress",searchId:i,progress:h}}case"remote.status":{const i=T0(s.status);return i===null?null:{type:"remote.status",status:i}}case"settings.status":{const i=I0(s.settings);return i===null?null:{type:"settings.status",settings:i}}case"remote.pairing.code":{const i=R0(s.pairing);return i===null?null:{type:"remote.pairing.code",pairing:i}}case"remote.phone.pairing":{const i=A0(s.pairing);return i===null?null:{type:"remote.phone.pairing",pairing:i}}case"search.results":{const i=we(s.searchId),h=g0(s.result);return i===null||h===null?null:{type:"search.results",searchId:i,result:h}}case"error":{const i=qn(s.text);if(i===null)return null;const v={type:"error",code:Ze(s.code,B0)??"internal",text:i},R=je(s.detail);R!==null&&(v.detail=R);const x=we(s.requestId);return x!==null&&(v.requestId=x),v}default:return null}}function rf(n){return JSON.stringify(n)}const U0=/^[A-Za-z]:\\$/;function Gr(n,s){return n.length===0?"":s==="win32"?W0(n):z0(n)}function W0(n){let s=n.replace(/\//g,"\\");for(s.startsWith("\\\\?\\UNC\\")?s=`\\\\${s.slice(8)}`:s.startsWith("\\\\?\\")&&(s=s.slice(4)),s=s.startsWith("\\\\")?`\\\\${s.slice(2).replace(/\\+/g,"\\")}`:s.replace(/\\+/g,"\\");s.endsWith("\\")&&!U0.test(s);)s=s.slice(0,-1);return s.toLowerCase()}function em(n,s,i){return n.length===0||i==="win32"&&n!==s&&n.toLowerCase()===s.toLowerCase()?s:n}function z0(n){let s=n.replace(/\/+/g,"/");for(;s.length>1&&s.endsWith("/");)s=s.slice(0,-1);return s}function V0(n,s,i,h){const v=Gr(i.cwd,h);let R=-1;for(const[x,r]of n.entries()){const c=s(r);c===void 0||c.kind!=="agent"||Gr(c.cwd,h)===v&&(R=x)}return R===-1?n.length:R+1}function tm(n){return`[Pasted text #${n}]`}function q0(n){return`[Start of pasted text #${n}]`}function K0(n){return`[End of pasted text #${n}]`}function G0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function Y0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function X0(){return/\[Pasted text #(\d{1,6})\]/g}const nm="https://buymeacoffee.com/cvelasquez",Q0="modulepreload",J0=function(n){return"/"+n},of={},Wn=function(s,i,h){let v=Promise.resolve();if(i&&i.length>0){let x=function(g){return Promise.all(g.map(_=>Promise.resolve(_).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),c=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));v=x(i.map(g=>{if(g=J0(g),g in of)return;of[g]=!0;const _=g.endsWith(".css"),u=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${u}`))return;const y=document.createElement("link");if(y.rel=_?"stylesheet":Q0,_||(y.as="script"),y.crossOrigin="",y.href=g,c&&y.setAttribute("nonce",c),document.head.appendChild(y),_)return new Promise((S,L)=>{y.addEventListener("load",S),y.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${g}`)))})}))}function R(x){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=x,window.dispatchEvent(r),!r.defaultPrevented)throw x}return v.then(x=>{for(const r of x||[])r.status==="rejected"&&R(r.reason);return s().catch(R)})},Z0={"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.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.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.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 /effort to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends /effort 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.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","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.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.","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.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.filesPerMessage":"You can attach up to {{max}} files per message.","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.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.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.rewind":"Go back here — opens the CLI's rewind menu in the CLI tab (Esc Esc)","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."},vu=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],sm="en",Lc={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},ey={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},yu={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"},ty={es:()=>Wn(()=>import("./es-ssi17uPF.js"),[]),de:()=>Wn(()=>import("./de-Dn90shDf.js"),[]),fr:()=>Wn(()=>import("./fr-CqnouzuH.js"),[]),"pt-BR":()=>Wn(()=>import("./pt-BR-BC8Km40N.js"),[]),ru:()=>Wn(()=>import("./ru-DFCLMfWY.js"),[]),ja:()=>Wn(()=>import("./ja-1U-Ks_ON.js"),[]),ko:()=>Wn(()=>import("./ko-Ce2gOy44.js"),[]),"zh-CN":()=>Wn(()=>import("./zh-CN-VwZ7SeiK.js"),[])},rm=Z0,Xc=new Map([["en",rm]]),af=new Map,Qc=new Set;let Vi=sm,Jc=yu[sm],lf=0;function im(n){return vu.includes(n)}function Zc(){return Vi}function Ba(){return Jc}function ny(n){return yu[n]}function om(n){return Qc.add(n),()=>Qc.delete(n)}async function am(n,s=yu[n]){const i=++lf;if(!Xc.has(n)&&n!=="en"){const h=await ty[n]();Xc.set(n,h.default)}if(i===lf&&!(Vi===n&&Jc===s)){Vi=n,Jc=s;for(const h of Qc)h()}}function sy(n,s){let i=af.get(n);return i===void 0&&(i=new Intl.PluralRules(n),af.set(n,i)),i.select(s)}function cf(n,s,i,h){if(h!==void 0){const v=n[`${i}_${sy(s,h)}`]??n[`${i}_other`];if(v!==void 0)return v}return n[i]}function ry(n,s,i,h){const v=h==null?void 0:h.count,R=typeof v=="number"?v:void 0;return(n===void 0?void 0:cf(n,s,i,R))??cf(rm,"en",i,R)??i}function xa(n,s){return s===void 0?n:n.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(i,h)=>{const v=s[h];return v===void 0?i:String(v)})}function lm(n,s){return ry(Xc.get(Vi),Vi,n,s)}function C(n,s){return xa(lm(n,s),s)}function iy(){return[{keys:"Esc",description:C("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:C("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:C("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:C("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:C("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:C("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:C("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:C("agent.shortcuts.codex.searchHistory")},{keys:"@",description:C("agent.shortcuts.codex.mention")},{keys:"/",description:C("agent.shortcuts.commands")},{keys:"Ctrl + G",description:C("agent.shortcuts.codex.externalEditor")}]}function oy(){return[{keys:"Esc Esc",description:C("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:C("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:C("agent.shortcuts.opencode.commandList")},{keys:C("agent.shortcuts.leaderThen",{key:"M"}),description:C("agent.shortcuts.opencode.model")},{keys:C("agent.shortcuts.leaderThen",{key:"N"}),description:C("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:C("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:C("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:C("agent.shortcuts.opencode.paste")}]}function ay(){return[{keys:"Esc",description:C("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:C("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:C("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:C("agent.shortcuts.commands")},{keys:"?",description:C("agent.shortcuts.antigravity.help")}]}function ly(){return[{keys:"Esc",description:C("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:C("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:C("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:C("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:C("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:C("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:C("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:C("agent.shortcuts.claudeCode.pasteText")}]}const Vr={"claude-code":{shortLabel:"CC",get shortcuts(){return ly()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1},codex:{shortLabel:"CX",get shortcuts(){return iy()},get shortcutsNote(){return C("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},opencode:{shortLabel:"OC",get shortcuts(){return oy()},get shortcutsNote(){return C("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},antigravity:{shortLabel:"AG",get shortcuts(){return ay()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0}},cy={"gemini-cli":"GC","antigravity-ide":"AI"};function uy(n){return Xr(n)?Vr[n].shortLabel:cy[n]}function Xi(n,s){var i;return Xr(n)?((i=s.find(h=>h.id===n))==null?void 0:i.label)??n:ev[n]}const cm="Sesion sin titulo";function zn(n,s){return s==="none"||n===cm?C("session.untitled"):n}function hy(n,s){const i=new Map;for(const v of s)v.titleSource==="none"||v.title===cm||i.set(`${v.agent}\0${v.sessionId}`,v.title);const h=new Map;for(const v of n){if(v.agent===null||v.sessionId.length===0)continue;const R=i.get(`${v.agent}\0${v.sessionId}`);R!==void 0&&h.set(v.terminalId,R)}return h}function eu(n){return n.storage==="native"&&Xr(n.agent)}function dy(n){return n!==null&&Vr[n].savesModelChoice}function fy(n){return n===null?null:Vr[n].instructionsFile}function py(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}}function my(n,s){const i=Av(s,n);return i===null?null:n.find(h=>h.value===i.value)??null}function gy(n,s){return n??s.launchMode}const _y={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},vy={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function um(n){return C(_y[n])}function yy(n){return C(vy[n])}function wy(n,s){return C("agent.mode.title",{mode:um(n),hint:yy(n),key:s.keyLabel})}function hm(n,s){return n.approvesPendingOnCycle&&s!==null}function by(n,s,i,h){if(hm(s,h))return C("agent.mode.blocked");const v=wy(n,s);return!s.approvesPendingOnCycle||i?v:C("agent.mode.titleBlind",{title:v})}const Sy={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 Cy(n){return C(Sy[n])}function xy(){return C("agent.statusLine.noFragment")}function ky(n,s,i=new Set){return n.filter(h=>(s||h.id!=="plans")&&(h.id==="cli"||!i.has(h.id)))}function Ey(n,s,i=new Set){return n==="plans"&&!s||n!=="cli"&&i.has(n)?"cli":n}function Ly(n,s,i){const h=v=>v===null?void 0:s.find(R=>R.id===v);return h(n)??h(i)??s[0]??null}function Ty(n){return[{keys:"Enter",description:C("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:C("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:C(n?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:C("agent.shortcuts.interruptCli")}]}function Ry(){return C("agent.composer.imagesRefused")}function My(n,s,i){return i??(n==="token-count"||n==="status-line"?s.contextWindow:null)}function Ay(n,s){return n==="status-line"?s.lastRequestTokens>0:s.assistantMessages>0}function Ny(n,s){return n===null&&s!==null&&s.state!=="active"}function Dy(n){return C(n==="other-command"?"agent.meter.setup.otherCommand":n==="disabled"?"agent.meter.setup.disabled":n==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function Iy(n,s){return s.contextWindowEstimated?C("agent.meter.origin.estimated"):n==="usage-with-catalog"&&s.contextWindow!==null?C("agent.meter.origin.catalog"):null}function jy(n,s=null){return s==="status-line"?C("agent.meter.idle.statusLine"):n===null?C("agent.meter.idle.noFile"):C("agent.meter.idle.withFile",{file:n})}function Py(n,s=null){return n==="idle"?C("agent.dot.idle"):n==="unknown"?s===null?C("agent.dot.noStatus"):s.state==="active"?C("agent.dot.statusLinePending"):C("agent.dot.statusLineOnly"):C("agent.dot.open")}function uf(n,s){return n.length===0?!0:n.some(i=>i.id===s&&i.available&&i.capabilities.resume)}function Oy(n,s,i){return n?i?C("agent.note.empty"):C("agent.note.send",{cwd:s??""}):C(s===null?"agent.note.needsTab":"agent.note.noReadySignal")}function dm(n,s,i){const h=Gr(s,i);let v=null;for(const R of n)R.kind!=="agent"||R.agent===null||Gr(R.cwd,i)===h&&(v=R.agent);return v}function fm(n,s){var h;const i=s.filter(v=>v.available);for(const v of n)if(v!==null&&i.some(R=>R.id===v))return v;return((h=i[0])==null?void 0:h.id)??null}function By(n){let s=null;for(const i of n){const h=i.agent;Xr(h)&&(s===null||i.updatedAt>s.updatedAt)&&(s={agent:h,updatedAt:i.updatedAt})}return(s==null?void 0:s.agent)??null}function Fy(n,s,i,h,v){return fm([dm(n,s,i),v],h)}function Hy(n,s,i,h,v){return fm([dm(n,s.cwd,i),By(s.sessions),v],h)}function pm(n){return n.filter(s=>s.available)}function $y(n,s){const i=n.findIndex(h=>h.id===s);return i===-1?0:i}function Uy(n,s,i){return i<=0?0:((n+s)%i+i)%i}function Wy(n,s,i,h=4){const v=n.bottom+2,R=n.top-2-s.height,x=v+s.height+h<=i.height||R<h?Math.max(h,Math.min(v,i.height-s.height-h)):R;return{left:Math.max(h,Math.min(n.left,i.width-s.width-h)),top:x}}function zy(n,s,i){const h=n;return h===null||typeof h!="object"||typeof h.contains!="function"?!0:i!==null&&i.contains(n)?!1:h.contains(s)}function mm(n,s,i=!1){return s===null||i||!gu(n)?[]:pm(n).filter(h=>h.id!==s)}function Vy(){return C("agent.continue.title")}function qy(n,s,i){return s?C("agent.continue.discovering"):n.length===0?C("agent.continue.noConversation"):i?null:C("agent.continue.noMessages")}function Ky(n,s,i,h){const v=s>=i&&!h?i===1?C("agent.handoff.turns.single"):C("agent.handoff.turns.all",{count:i}):s===1?h?C("agent.handoff.turns.lastOneOfMore",{total:i}):C("agent.handoff.turns.lastOne",{total:i}):h?C("agent.handoff.turns.lastManyOfMore",{count:i,included:s}):C("agent.handoff.turns.lastMany",{count:i,included:s});return C("agent.handoff.notice",{label:n,turns:v})}const hf=40;function df(n){const s=n.replace(/\s+/g," ").trim(),i=[...s],h=i.length>hf?`${i.slice(0,hf).join("").trimEnd()}…`:s;return h.length>0?C("agent.handoff.tabLabel",{title:h}):C("agent.handoff.tabLabelNoTitle")}function Gy(){return C("agent.handoff.sending")}function Yy(n){switch(n){case"no-delivery":return C("agent.handoff.prefill.noDelivery");case"not-ready":return C("agent.handoff.prefill.notReady");case"send-failed":return C("agent.handoff.prefill.sendFailed")}}function ff(n,s){return n.trim().length===0?s:`${s}
42
-
43
- ${n}`}function Xy(n,s){return n&&s!==null}function Qy(n,s,i){if(!Xr(n))return{badge:!0,unavailableTitle:null};const h=s.find(x=>x.id===n),v=s.some(x=>x.available),R=h!==void 0&&!h.available&&v;return{badge:i||R,unavailableTitle:R?C("agent.session.cliMissing",{label:h.label}):null}}function Jy(n,s,i){return n!==null&&s===""&&!i.sessionIdAtLaunch}function Zy(){return C("agent.thread.noTranscript")}function ew(){return C("agent.thread.discovering")}function tw(n,s,i,h,v=null){return!h||!Bp(n,v)||!s?null:i===null?C("agent.openTool.noLabel"):C("agent.openTool.withLabel",{label:i})}function gm(n,s=!1){return C(n==="permission prompt"?"agent.waiting.permission":n==="question"&&s?"agent.waiting.question":"agent.waiting.answer")}function nw(n){return n.relaunching?"relaunching":n.offlineReason==="server-closed"&&n.alive?"offer":null}function sw(n){return n===null?C("agent.serverClosed.noLabel"):C("agent.serverClosed.withLabel",{label:n})}function rw(){return C("agent.serverClosed.relaunch")}function iw(){return C("agent.serverClosed.relaunching")}function ow(n,s){const i=new Map,h=[];for(const[v,R]of n){const x=s.find(r=>r.terminalId===v);x===void 0||x.alive&&R==="exited"?h.push(v):i.set(v,x.alive?R:"exited")}return{phases:i,finished:h}}function aw(n,s,i){var h;return!i||s===null||((h=n.permissionCycle)==null?void 0:h.approvesPendingOnCycle)!==!0&&!n.waitingBlocksSubmit?null:gm(s,n.questionCards)}const lw=2e4;function cw(n){if(n.label.length>0)return n.label;const s=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return s[s.length-1]??n.cwd}function uw(n,s,i){const h=n.map(R=>({terminalId:R.terminalId,kind:R.kind,cwd:R.cwd})),v=[];for(const R of s){const x=V0(h.map(r=>r.terminalId),r=>h.find(c=>c.terminalId===r),{cwd:R.cwd},i);v.push({pending:R,index:x,label:cw(R)}),h.splice(x,0,{terminalId:`pending:${R.requestId}`,kind:"agent",cwd:R.cwd})}return v}function pf(n,s,i){const h=Gr(s,i);return n.some(v=>Gr(v.cwd,i)===h)}function _m(){return C("agent.openBlocked")}const hw={low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function dw(n){const s=hw[n.value];return s===void 0?n.label:C(s)}function fw(n){return n.value==="default"?C("controls.model.default"):Mv(n)}function pw({models:n,efforts:s,model:i,effort:h,modelProvisional:v=!1,effortProvisional:R=!1,savesChoice:x=!1,disabled:r,onCommand:c}){const g=n===null?null:my(n,i),_=g===null&&i!==null;return a.jsxs(a.Fragment,{children:[n!==null&&a.jsxs("select",{className:"agent-select",value:(g==null?void 0:g.value)??"",disabled:r,onChange:u=>{u.target.value.length>0&&c(Dv(u.target.value))},title:i===null?C("controls.model.noData"):v?C("controls.model.provisional",{model:i}):x?C("controls.model.inUseSaved",{model:i}):C("controls.model.inUse",{model:i}),children:[g===null&&a.jsx("option",{value:"",children:_?i??"":C("controls.model.placeholder")}),n.map(u=>a.jsx("option",{value:u.value,children:fw(u)},u.value))]}),s!==null&&a.jsxs("select",{className:"agent-select",value:h??"",disabled:r,onChange:u=>{u.target.value.length>0&&c(Iv(u.target.value))},title:h===null?C("controls.effort.noData"):R?C("controls.effort.provisional",{effort:h}):x?C("controls.effort.inUseSaved",{effort:h}):C("controls.effort.inUse",{effort:h}),children:[h===null&&a.jsx("option",{value:"",children:C("controls.effort.placeholder")}),s.map(u=>a.jsx("option",{value:u.value,children:dw(u)},u.value))]})]})}function mw({mode:n,cycle:s,disabled:i,waitingFor:h=null,statusKnown:v=!0,onChange:R}){const x=gy(n,s);return a.jsx("select",{className:"agent-select agent-select-mode",value:x,disabled:i||hm(s,h),onChange:r=>{zr(r.target.value)&&R(r.target.value)},title:by(x,s,v,h),children:s.modes.map(r=>a.jsx("option",{value:r,children:um(r)},r))})}function Ma(n){const s=n.replace(/(\r?\n)+$/,"");return s.length===0?0:s.split(`
44
- `).length}function gw(n,s){return s===0?C("composer.chip.pastedTextEmpty",{number:n}):C("composer.chip.pastedText",{number:n,count:s})}function _w(n){return n.length===0?1:Math.max(...n)+1}function vw(n){const s=new Set;for(const i of n.matchAll(X0()))s.add(Number(i[1]));return[...s].sort((i,h)=>i-h)}const yw=/[^\s([{"'¿¡«]/u,ww=/[\p{L}\p{N}]/u;function bw(n,s,i,h){const{start:v,end:R,before:x,after:r}=vm(n,s,i),c=`${x!==""&&yw.test(x)?" ":""}${tm(h)}${r!==""&&ww.test(r)?" ":""}`;return ym(n,v,R,c)}const Sw=/[^\s([{¿¡«]/u,Cw=/[\p{L}\p{N}"'«]/u;function mf(n,s,i,h){const{start:v,end:R,before:x,after:r}=vm(n,s,i),c=x!==""&&Sw.test(x),g=r===""||Cw.test(r),_=`${c?" ":""}${h}${g?" ":""}`;return ym(n,v,R,_)}function vm(n,s,i){const h=Math.max(0,Math.min(s,n.length)),v=Math.max(h,Math.min(i,n.length));return{start:h,end:v,before:h>0?n.charAt(h-1):"",after:v<n.length?n.charAt(v):""}}function ym(n,s,i,h){return{text:`${n.slice(0,s)}${h}${n.slice(i)}`,inserted:h,caret:s+h.length}}function wm(n,s){const i=new RegExp(`( ?)${Ew(tm(s))}( ?)`,"g");return n.replace(i,(h,v,R)=>v!==""&&R!==""?" ":"")}function xw(n,s){let i=s;const h=[];for(const v of n){const R=v.text.replace(/\r\n?/g,`
45
- `).replace(/\n+$/,"");if(R.trim().length===0){i=wm(i,v.number);continue}h.push(`${q0(v.number)}
46
- ${R}
47
- ${K0(v.number)}`)}return i.trim().length>0&&h.push(i),h.join(`
48
-
49
- `)}function kw(n,s=!1){const i=n.replace(/\r\n?/g,`
50
- `),h=[],v=c=>{const g=c.replace(/^\n+|\n+$/g,"");g.trim().length>0&&h.push({kind:"text",text:g})};let R=0;for(const c of i.matchAll(G0())){const g=c[1]??"",_=(c.index??0)+g.length;v(i.slice(R,_)),h.push({kind:"pasted",number:Number(c[2]),text:c[3]??"",complete:!0}),R=(c.index??0)+c[0].length}const x=i.slice(R),r=s?Y0().exec(x):null;if(r!==null){const c=r.index+(r[1]??"").length;v(x.slice(0,c)),h.push({kind:"pasted",number:Number(r[2]),text:x.slice(r.index+r[0].length),complete:!1})}else v(x);return h.some(c=>c.kind==="pasted")?h:[{kind:"text",text:n}]}function Ew(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Lw=800;function ka(n){return{text:n.text,pasted:n.items.flatMap(s=>s.kind==="text"?[{number:s.number,text:s.text}]:[])}}function Tw(n,s){return{text:n.text,items:n.pasted.map(i=>({id:s(),kind:"text",number:i.number,text:i.text,lines:Ma(i.text)}))}}function Rw(n,s){if(s===void 0)return{start:n,end:n,direction:"forward",scrollTop:"end"};const i=R=>Math.min(Math.max(0,R),n),h=i(s.selectionStart),v=Math.max(h,i(s.selectionEnd));return{start:h,end:v,direction:s.backward?"backward":"forward",scrollTop:Math.max(0,s.scrollTop)}}function Mw(n){return qp(ka(n))>Vp}function Hr(n,s){return n===void 0||La(n)?La(s):Kp(n,s)}const gf={text:"",pasted:[]};function Aw(n,s,i){const h=Tw(n,i),v=((s==null?void 0:s.items)??[]).filter(R=>R.kind!=="text");return{text:h.text,items:[...h.items,...v]}}class Nw{constructor(s){Tt(this,"local",new Map);Tt(this,"views",new Map);Tt(this,"saved",new Map);Tt(this,"heard",new Map);Tt(this,"unconfirmed",new Map);Tt(this,"submitting",new Map);Tt(this,"pending",new Map);Tt(this,"listeners",new Set);Tt(this,"serverKeeps",!1);this.deps=s}get(s){return this.local.get(s)}put(s,i){this.local.set(s,i),this.schedule(s,ka(i))}rememberView(s,i){this.views.set(s,i)}viewOf(s){return this.views.get(s)}submitted(s,i){this.cancel(s),this.local.delete(s),this.views.delete(s),this.saved.delete(s),this.unconfirmed.delete(s),this.submitting.set(s,i?"sent":"queued")}restore(s){const i=!this.serverKeeps;this.serverKeeps=!0;const h=[];for(const{terminalId:v,draft:R}of s)this.receive(v,R,i)&&h.push(v);for(const v of h)for(const R of this.listeners)R(v);for(const[v,R]of[...this.pending])R.handle===null&&this.sendNow(v)}reconnected(){this.serverKeeps=!1;for(const[s,i]of[...this.submitting])i==="sent"?this.submitting.delete(s):this.submitting.set(s,"sent")}retain(s){const i=new Set(s);for(const h 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(h)||(this.cancel(h),this.local.delete(h),this.views.delete(h),this.saved.delete(h),this.heard.delete(h),this.unconfirmed.delete(h),this.submitting.delete(h))}flushAll(){for(const s of[...this.pending.keys()])this.sendNow(s)}onRestored(s){return this.listeners.add(s),()=>this.listeners.delete(s)}receive(s,i,h){const v=this.heard.get(s);if(this.heard.set(s,i),this.submitting.has(s)){if(!La(i))return!1;this.submitting.delete(s)}const R=this.unconfirmed.get(s);if(R!==void 0)if(Hr(R,i))this.unconfirmed.delete(s);else if(h)if(Hr(v,i)){this.unconfirmed.delete(s),this.setSaved(s,i);const g=this.local.get(s);return g!==void 0&&this.schedule(s,ka(g)),!1}else this.unconfirmed.delete(s);else return!1;const x=this.local.get(s),r=x===void 0?gf:ka(x),c=Hr(this.saved.get(s),r);return this.setSaved(s,i),this.pending.has(s)||!c||Hr(i,r)?!1:(this.local.set(s,Aw(i,x,this.deps.newId)),this.views.delete(s),!0)}setSaved(s,i){La(i)?this.saved.delete(s):this.saved.set(s,i)}schedule(s,i){const h=this.pending.get(s);if(h!==void 0&&Kp(h.draft,i)||(this.cancel(s),Hr(this.saved.get(s),i)))return;const v=this.deps.setTimer(()=>this.sendNow(s),this.deps.delayMs??Lw);this.pending.set(s,{handle:v,draft:i})}cancel(s){const i=this.pending.get(s);i!==void 0&&(i.handle!==null&&this.deps.clearTimer(i.handle),this.pending.delete(s))}sendNow(s){const i=this.pending.get(s);if(i===void 0)return;if(i.handle!==null&&this.deps.clearTimer(i.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(s,{handle:null,draft:i.draft});return}this.pending.delete(s);const h=qp(i.draft)>Vp?gf:i.draft;Hr(this.saved.get(s),h)||(this.deps.send(s,h),this.unconfirmed.set(s,h),this.setSaved(s,h))}}const tu=1024,nu=tu*1024,_f=nu*1024;function Wr(n,s=0){return new Intl.NumberFormat(Ba(),{minimumFractionDigits:s,maximumFractionDigits:s,useGrouping:!1}).format(n)}function hn(n){return!Number.isFinite(n)||n<tu?C("format.bytes.b",{value:Wr(Math.max(0,Math.round(n)||0))}):n<nu?C("format.bytes.kb",{value:Wr(Math.round(n/tu))}):n<_f?C("format.bytes.mb",{value:Wr(n/nu,1)}):C("format.bytes.gb",{value:Wr(n/_f,2)})}function bm(n){const s=Math.floor(n/60),i=n%60;return i===0?C("format.duration.minutes",{value:s}):C("format.duration.minutesSeconds",{minutes:s,seconds:i})}function Dw(n){if(n<1e3)return C("format.duration.ms",{value:n});const s=Math.round(n/1e3);return s<60?C("format.duration.seconds",{value:s}):bm(s)}function qi(n){if(!Number.isFinite(n)||n<1e3)return C("format.duration.underSecond");const s=Math.round(n/1e3);return s<60?C("format.duration.seconds",{value:s}):bm(s)}function Vn(n,s=Date.now()){if(n<=0)return"";const i=Math.floor((s-n)/6e4);if(i<1)return C("time.justNow");if(i<60)return C("time.minutesAgo",{count:i});const h=Math.floor(i/60);if(h<24)return C("time.hoursAgo",{count:h});const v=Math.floor(h/24);return v<30?C("time.daysAgo",{count:v}):Iw(n)}function Iw(n){return new Date(n).toLocaleDateString(Ba())}function Sm(n){return new Date(n).toLocaleTimeString(Ba(),{hour:"2-digit",minute:"2-digit"})}function wu(n){return new Intl.ListFormat(Ba(),{type:"conjunction"}).format(n)}var Cm=Op();function xm({src:n,caption:s,onClose:i}){return I.useEffect(()=>{const h=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[i]),Cm.createPortal(a.jsxs("div",{className:"viewer",onClick:i,role:"presentation",children:[a.jsx("div",{className:"viewer-frame",onClick:h=>h.stopPropagation(),children:a.jsx("img",{className:"viewer-image",src:n,alt:s})}),a.jsxs("div",{className:"viewer-bar",children:[a.jsx("span",{className:"viewer-caption",children:s}),a.jsx("button",{className:"viewer-close",onClick:i,title:C("common.closeEsc"),children:"×"})]})]}),document.body)}const jw=768,Pw=`(max-width: ${jw}px)`,Ow="(hover: none)",vf="agent-workbench.narrow-view",km="tab",Em=["chat","cli","git","files","plans","memory","notes","console"];function Bw(n){return typeof n=="string"&&Em.includes(n)}function Fw(n){return Bw(n)?n:null}function Hw(n){const s=n.hidden??new Set,i=h=>h==="chat"||h==="cli"||!s.has(h);return n.hasTab?Em.filter(h=>(h!=="plans"||n.plansAvailable)&&i(h)):["chat","notes"].filter(i)}function $w(n,s){return s.includes(n)?n:"chat"}function yf(n){switch(n){case"cli":case"git":case"files":case"plans":case"memory":return n;default:return null}}const Uw={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 Ww(n){return Uw[n]}const zw=/^[A-Za-z0-9_-]{1,80}$/;function Vw(n){const s=new URLSearchParams(n).get(km);return s!==null&&zw.test(s)?s:null}function qw(n,s){const i=new URLSearchParams(n);for(const v of s)i.delete(v);const h=i.toString();return h.length>0?`?${h}`:""}const Kw=[{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 Gw(n,s){return n.shiftKey||n.altKey?!1:!s||n.ctrlKey||n.metaKey}const Yw="AgentWorkbenchAndroid/",Xw="agentworkbench://settings",Qw="agentworkbench://disconnect",wf="agentWorkbenchBack";function Lm(n){return n.includes(Yw)}function Jw(n){return n.dialogOpen?"close-dialog":n.sheetOpen?"close-sheet":n.drawerOpen?"close-drawer":n.view!=="chat"?"show-chat":null}const Zw=6e4,e1=10*6e4,t1=15e3,n1=4e3,s1=3,Tm={runStartedAt:null,busySeenAt:null};function r1(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function i1(n,s){var h;let i=0;if(n!==null){const v=s.findIndex(R=>R.eventId===n);if(v===-1)return!0;i=v+1}for(let v=i;v<s.length;v+=1)if(((h=s[v])==null?void 0:h.role)==="assistant")return!0;return!1}function o1(n,s,i,h){const v=s==="busy"||n==="busy"?h:i.busySeenAt;let R=null;return s==="busy"?n==="idle"?R=h:(n==="busy"||n==="waiting")&&(R=i.runStartedAt):s==="waiting"&&(R=i.runStartedAt),{runStartedAt:R,busySeenAt:v}}function a1(n,s,i,h){const v=new Map;for(const[R,x]of s){const r=n.get(R),c=i.get(R);v.set(R,c!==void 0&&r===x?c:o1(r,x,c??Tm,h))}return v}function l1(n,s){const i=new Map;for(const[h,v]of n)v.phase!=="sending"?i.set(h,v):v.queued&&i.set(h,{...v,queued:!1,sentAt:s});return i}function c1(n,s,i){const h=n.get(s.terminalId);if(h===void 0||h.requestId!==s.requestId)return n;const v=new Map(n);return s.delivered?v.set(s.terminalId,{...h,phase:"delivered",queued:!1,deliveredAt:i}):v.delete(s.terminalId),v}function u1(n){if(!n.live||n.waitingFor!==null)return null;const{receipt:s,activity:i,now:h}=n,v=n.clock??Tm;if((s==null?void 0:s.phase)==="sending"&&(s.queued||h-s.sentAt<Zw))return{kind:"sending"};const R=(s==null?void 0:s.phase)==="delivered"?s.deliveredAt:null;return i==="busy"?{kind:"working",since:v.runStartedAt,justDelivered:R!==null&&h-R<n1}:s===null||R===null||i1(s.afterEventId,n.events)?null:i==="unknown"?h-R<e1?{kind:"awaiting-reply",since:R}:null:i!=="idle"&&i!==null||v.busySeenAt!==null&&v.busySeenAt>=s.sentAt?null:h-R<t1?{kind:"delivered"}:null}function h1(n,s){switch(n.kind){case"sending":return C("thread.status.sending");case"delivered":return C("thread.status.delivered");case"working":{const i=n.since===null?0:s-n.since;if(i<1e3)return n.justDelivered?C("thread.status.workingDelivered"):C("thread.status.working");const h={elapsed:qi(i)};return n.justDelivered?C("thread.status.workingForDelivered",h):C("thread.status.workingFor",h)}case"awaiting-reply":{const i=s-n.since;return i<1e3?C("thread.status.delivered"):C("thread.status.awaitingReply",{elapsed:qi(i)})}}}function d1(n,s){const i=n.slice(0,s1).map(v=>C("thread.status.subagent",{name:v.description.length>0?v.description:C("thread.status.subagentUnnamed"),elapsed:qi(Math.max(0,s-v.startedAt))})),h=n.length-i.length;return h>0&&i.push(C("thread.status.subagentsMore",{count:h})),C("thread.status.subagents",{count:n.length,list:wu(i)})}const f1=5,p1=1200;function Tc(){return crypto.randomUUID()}function m1(n=!0){const[s,i]=I.useState([]),[h,v]=I.useState(null),R=I.useCallback(L=>{if(s.filter(l=>l.kind==="image").length>=kc){v(C("composer.problem.tooManyImages",{count:kc}));return}if(L.size>Ra){const l=Math.round(L.size/1024/1024),m=Ra/1024/1024;v(L.name.length>0?C("composer.problem.tooBig",{name:L.name,size:l,max:m}):C("composer.problem.imageTooBig",{size:l,max:m}));return}const f=new FileReader;f.onload=()=>{const l=f.result;if(typeof l!="string")return;const m=l.indexOf(",");m!==-1&&i(p=>p.filter(d=>d.kind==="image").length>=kc?p:[...p,{id:Tc(),kind:"image",mediaType:L.type,base64:l.slice(m+1),dataUrl:l,bytes:L.size,name:L.name.length>0?L.name:C("composer.pastedImage")}])},f.onerror=()=>v(C("composer.problem.imageUnreadable")),f.readAsDataURL(L)},[s]),x=I.useCallback(L=>{if(s.filter(l=>l.kind==="file").length>=Ec){v(C("composer.problem.tooManyFiles",{count:Ec}));return}if(L.size===0){v(C("composer.problem.empty",{name:L.name}));return}if(L.size>tf){v(C("composer.problem.tooBig",{name:L.name,size:Math.round(L.size/1024/1024),max:tf/1024/1024}));return}const f=new FileReader;f.onload=()=>{const l=f.result;if(typeof l!="string")return;const m=l.indexOf(",");m!==-1&&i(p=>p.filter(d=>d.kind==="file").length>=Ec?p:[...p,{id:Tc(),kind:"file",name:L.name.length>0?L.name:"archivo",base64:l.slice(m+1),bytes:L.size}])},f.onerror=()=>v(C("composer.problem.unreadable",{name:L.name})),f.readAsDataURL(L)},[s]),r=I.useCallback(L=>{const f=Array.from(L),l=f.filter(p=>p.type.startsWith("image/")),m=f.filter(p=>!p.type.startsWith("image/"));if(l.length>0&&!n)v(Ry());else for(const p of l)R(p);for(const p of m)x(p)},[R,x,n]),c=I.useCallback((L,f=[])=>{if(L.files.length>0)return r(L.files),{consumed:!0,pastedNumber:null};const l=L.getData("text/plain");if(l.length===0)return{consumed:!1,pastedNumber:null};if(l.split(`
51
- `).length<f1&&l.length<p1)return{consumed:!1,pastedNumber:null};const m=_w([...s.flatMap(p=>p.kind==="text"?[p.number]:[]),...f]);return i(p=>[...p,{id:Tc(),kind:"text",number:m,text:l,lines:Ma(l)}]),{consumed:!0,pastedNumber:m}},[r,s]),g=I.useCallback(L=>{i(f=>f.filter(l=>l.id!==L))},[]),_=I.useCallback((L,f)=>{i(l=>l.map(m=>m.id===L&&m.kind==="text"?{...m,text:f,lines:Ma(f)}:m))},[]),u=I.useCallback(L=>{i(L),v(null)},[]),y=I.useCallback(()=>u([]),[u]),S=I.useCallback(()=>v(null),[]);return{items:s,problem:h,acceptPaste:c,acceptFiles:r,remove:g,updateText:_,replace:u,clear:y,dismissProblem:S}}function Ea({min:n,max:s,value:i,measure:h,onChange:v,onCommit:R,onStart:x}){const r=I.useRef(!1),c=I.useRef(i),g=I.useCallback(y=>{r.current=!0,c.current=i,x==null||x(y),y.currentTarget.setPointerCapture(y.pointerId),y.preventDefault()},[x,i]),_=I.useCallback(y=>{if(!r.current)return;const S=Math.min(s,Math.max(n,h(y)));c.current=S,v(S)},[s,n,h,v]),u=I.useCallback(y=>{r.current&&(r.current=!1,y.currentTarget.releasePointerCapture(y.pointerId),R(c.current))},[R]);return{onPointerDown:g,onPointerMove:_,onPointerUp:u,onPointerCancel:u}}function Rm(n){const[s,i]=I.useState(()=>typeof window<"u"&&window.matchMedia(n).matches);return I.useEffect(()=>{const h=window.matchMedia(n),v=()=>i(h.matches);return v(),h.addEventListener("change",v),()=>h.removeEventListener("change",v)},[n]),s}function g1(){return Rm(Pw)}function _1(){return Rm(Ow)}const Mm="agent_workbench_prefs",su="agent-workbench.",Am=/^[a-z0-9][a-z0-9.-]{0,59}$/,Nm=200,v1=400*24*60*60,y1=3500;function w1(n){const s=new Map;for(const i of n.split(";")){const h=i.indexOf("=");if(h===-1||i.slice(0,h).trim()!==Mm)continue;let v;try{v=JSON.parse(decodeURIComponent(i.slice(h+1).trim()))}catch{return s}if(v===null||typeof v!="object"||Array.isArray(v))return s;for(const[R,x]of Object.entries(v))!Am.test(R)||typeof x!="string"||x.length>Nm||s.set(`${su}${R}`,x);return s}return s}function b1(n){const s={};for(const[h,v]of n){if(!h.startsWith(su))continue;const R=h.slice(su.length);!Am.test(R)||v.length>Nm||(s[R]=v)}const i=encodeURIComponent(JSON.stringify(s));return i.length>y1?null:i}function S1(n){return`${Mm}=${n}; Path=/; Max-Age=${v1}; SameSite=Strict`}function Dm(){try{return w1(document.cookie)}catch{return new Map}}function Im(n,s){const i=Dm();if(i.get(n)===s)return;i.set(n,s);const h=b1(i);if(h!==null)try{document.cookie=S1(h)}catch{}}function vt(n,s,i){const h=Dm().get(n);if(h!==void 0){const v=i(h);if(v!==null)return v}try{const v=window.localStorage.getItem(n);if(v===null)return s;const R=i(v);return R===null?s:(h===void 0&&Im(n,v),R)}catch{return s}}function pt(n,s){Im(n,s);try{window.localStorage.setItem(n,s)}catch{}}function C1(n,s,i){const h=Number.parseInt(n,10);return Number.isFinite(h)&&h>=s&&h<=i?h:null}const bf=90,x1=260,Sf=720,Cf="agent-workbench.composer-height";function xf(n){return{selectionStart:n.selectionStart,selectionEnd:n.selectionEnd,backward:n.selectionDirection==="backward",scrollTop:n.scrollTop}}function k1({connection:n,drafts:s,terminalId:i,alive:h,sleeping:v=!1,projectColor:R,activity:x,controls:r,leading:c,imagesAllowed:g=!0,blockedReason:_=null,prefills:u,onPrefillApplied:y,notice:S=null,onDismissNotice:L,onSubmitted:f,fontSize:l,insertRef:m}){const[p,d]=I.useState(""),[k,D]=I.useState(!1),E=m1(g),M=I.useRef(null),b=_1(),[T,N]=I.useState(()=>vt(Cf,x1,fe=>C1(fe,bf,Sf))),[B,F]=I.useState(!1),O=I.useCallback(()=>{const fe=M.current;if(fe===null)return;fe.style.height="auto";const Te=fe.offsetHeight-fe.clientHeight,Ce=fe.scrollHeight+Te,Ee=B?T:Math.min(Ce,T);fe.style.height=`${Ee}px`,fe.style.overflowY=Ce>Ee?"auto":"hidden"},[T,B]);I.useEffect(O,[p,O,l]);const U=I.useRef(0),V=I.useRef(0),Y=Ea({min:bf,max:Sf,value:T,measure:I.useCallback(fe=>U.current-fe.clientY-V.current,[]),onChange:N,onCommit:I.useCallback(fe=>{F(!1),pt(Cf,String(fe))},[]),onStart:I.useCallback(fe=>{const Te=M.current,Ce=Te==null?void 0:Te.getBoundingClientRect();U.current=(Ce==null?void 0:Ce.bottom)??fe.clientY,V.current=((Ce==null?void 0:Ce.bottom)??fe.clientY)-fe.clientY-((Ce==null?void 0:Ce.height)??0),F(!0)},[])}),X=I.useRef(null),[G,P]=I.useState(0),$=I.useCallback(()=>P(fe=>fe+1),[]),H=I.useRef(p);H.current=p;const q=I.useRef(E.items);q.current=E.items;const{replace:te}=E;I.useEffect(()=>{const fe=X.current;fe!==null&&s.put(fe,{text:p,items:E.items})},[p,E.items,s]),I.useEffect(()=>{var Ce;const fe=X.current;if(fe===i)return;if(X.current=i,fe!==null){s.put(fe,{text:H.current,items:q.current});const Ee=M.current;Ee!==null&&s.rememberView(fe,xf(Ee))}const Te=i===null?void 0:s.get(i);d((Te==null?void 0:Te.text)??""),te((Te==null?void 0:Te.items)??[]),$(),i!==null&&((Ce=M.current)==null||Ce.focus())},[i,te,s,$]),I.useEffect(()=>()=>{const fe=X.current;fe!==null&&s.put(fe,{text:H.current,items:q.current})},[s]),I.useLayoutEffect(()=>()=>{const fe=X.current,Te=M.current;fe!==null&&Te!==null&&s.rememberView(fe,xf(Te))},[s]),I.useEffect(()=>{if(G===0)return;const fe=X.current,Te=M.current;if(fe===null||Te===null)return;const Ce=Rw(Te.value.length,s.viewOf(fe));Te.setSelectionRange(Ce.start,Ce.end,Ce.direction),Te.scrollTop=Ce.scrollTop==="end"?Te.scrollHeight:Ce.scrollTop},[G,s]),I.useEffect(()=>s.onRestored(fe=>{if(fe!==X.current)return;const Te=s.get(fe);Te!==void 0&&(d(Te.text),te(Te.items),$())}),[s,te,$]);const se=I.useRef(new Set);I.useEffect(()=>{if(!(u===void 0||u.length===0)){for(const fe of u)if(!se.current.has(fe.id)){if(se.current.add(fe.id),fe.terminalId===X.current)d(Te=>ff(Te,fe.text));else{const Te=s.get(fe.terminalId);s.put(fe.terminalId,{text:ff((Te==null?void 0:Te.text)??"",fe.text),items:(Te==null?void 0:Te.items)??[]})}y==null||y(fe.id)}}},[u,y,s]);const le=I.useCallback(()=>{if(i===null||_!==null)return;const fe=E.items.filter(Ae=>Ae.kind==="text").map(Ae=>({number:Ae.number,text:Ae.text})),Te=E.items.filter(Ae=>Ae.kind==="image").map(Ae=>({mediaType:Ae.mediaType,data:Ae.base64})),Ce=E.items.filter(Ae=>Ae.kind==="file").map(Ae=>({name:Ae.name,data:Ae.base64})),Ee=xw(fe,p);if(Ee.length===0&&Te.length===0&&Ce.length===0)return;const Be=r1(),ve=n.send({type:"agent.submit",terminalId:i,text:Ee,images:Te,...Ce.length>0?{files:Ce}:{},requestId:Be});s.submitted(i,ve),d(""),E.clear(),f==null||f(i,Be,!ve)},[n,s,i,p,E,_,f]),ue=I.useCallback(()=>{i!==null&&n.send({type:"agent.interrupt",terminalId:i})},[n,i]),K=I.useCallback(fe=>{if(fe.key==="Enter"&&Gw(fe,b)){fe.preventDefault(),le();return}fe.key==="Escape"&&(fe.preventDefault(),ue())},[le,ue,b]),W=I.useCallback((fe,Te)=>{const{inserted:Ce}=bw(fe.value,fe.selectionStart,fe.selectionEnd,Te);let Ee=!1;try{Ee=document.execCommand("insertText",!1,Ce)}catch{Ee=!1}Ee||(fe.setRangeText(Ce,fe.selectionStart,fe.selectionEnd,"end"),d(fe.value))},[]),J=I.useCallback((fe,Te)=>{const Ce=M.current;if(Ce===null||Ce.disabled){d(ve=>mf(ve,ve.length,ve.length,fe).text);return}const{inserted:Ee}=mf(Ce.value,Ce.selectionStart,Ce.selectionEnd,fe);let Be=!1;if(Te){Ce.focus();try{Be=document.execCommand("insertText",!1,Ee)}catch{Be=!1}}Be||(Ce.setRangeText(Ee,Ce.selectionStart,Ce.selectionEnd,"end"),d(Ce.value))},[]);I.useEffect(()=>{if(m!==void 0)return m.current=J,()=>{m.current===J&&(m.current=null)}},[m,J]);const Z=I.useCallback(fe=>{if(fe.clipboardData===null)return;const Te=E.acceptPaste(fe.clipboardData,vw(fe.currentTarget.value));Te.consumed&&(fe.preventDefault(),Te.pastedNumber!==null&&W(fe.currentTarget,Te.pastedNumber))},[E,W]),de=I.useCallback(fe=>{E.remove(fe.id),fe.kind==="text"&&d(Te=>wm(Te,fe.number))},[E]),pe=I.useRef(null),re=i===null||!h,ke=p.trim().length>0||E.items.some(fe=>fe.kind!=="text"||fe.text.trim().length>0),Me=h&&x!=="idle",et=ke||!Me,Le=Mw({text:p,items:E.items});return a.jsxs("div",{className:`composer${k?" composer-dragging":""}`,style:R===void 0?void 0:{"--composer-accent":R},onDragOver:fe=>{Array.from(fe.dataTransfer.types).includes("Files")&&(fe.preventDefault(),D(!0))},onDragLeave:()=>D(!1),onDrop:fe=>{fe.preventDefault(),D(!1),E.acceptFiles(fe.dataTransfer.files)},children:[a.jsx("div",{className:"hdivider composer-divider",...Y,title:C("composer.resizeTitle")}),S!==null&&a.jsxs("div",{className:"handoff-notice",role:"status",children:[a.jsxs("span",{className:"handoff-notice-text",children:[S.text,S.status!==null&&a.jsx("span",{className:"handoff-notice-status",children:S.status})]}),L!==void 0&&a.jsx("button",{className:"icon-button",onClick:L,title:C("common.dismissNotice"),children:"×"})]}),E.problem!==null&&a.jsxs("div",{className:"composer-problem",children:[a.jsx("span",{children:E.problem}),a.jsx("button",{className:"icon-button",onClick:E.dismissProblem,title:C("common.close"),children:"×"})]}),Le&&a.jsx("div",{className:"composer-problem",role:"status",children:a.jsx("span",{children:C("composer.problem.draftTooLong")})}),E.items.length>0&&a.jsx("div",{className:"composer-chips",children:E.items.map(fe=>a.jsx(E1,{item:fe,onRemove:()=>de(fe),onEdit:Te=>E.updateText(fe.id,Te),onDoneEditing:()=>{var Te;return(Te=M.current)==null?void 0:Te.focus()}},fe.id))}),a.jsxs("div",{className:`composer-field${Me&&et?" composer-field-two":""}`,children:[a.jsx("textarea",{ref:M,className:"composer-input",value:p,rows:1,placeholder:C(re?v?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:re,onChange:fe=>d(fe.target.value),onKeyDown:K,onPaste:Z,spellCheck:!1}),a.jsxs("div",{className:"composer-field-actions",children:[Me&&a.jsx("button",{className:"composer-icon composer-stop",onClick:ue,disabled:re,title:C("composer.stopTitle"),"aria-label":C("composer.stop"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),et&&a.jsx("button",{className:"composer-icon composer-send",onClick:le,disabled:re||!ke||_!==null,title:_??C("composer.sendTitle"),"aria-label":C("composer.send"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:a.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),a.jsxs("div",{className:"composer-bar",children:[a.jsx("input",{ref:pe,type:"file",multiple:!0,hidden:!0,onChange:fe=>{fe.target.files!==null&&E.acceptFiles(fe.target.files),fe.target.value=""}}),a.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var fe;return(fe=pe.current)==null?void 0:fe.click()},disabled:re,title:C("composer.attachTitle"),"aria-label":C("composer.attach"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:a.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"})})}),c,a.jsx("span",{className:"composer-spacer"}),r]})]})}function E1({item:n,onRemove:s,onEdit:i,onDoneEditing:h}){const[v,R]=I.useState(!1);if(n.kind==="image"){const x=`${n.name} · ${hn(n.bytes)}`;return a.jsxs("figure",{className:"chip chip-image",title:x,children:[a.jsx("img",{src:n.dataUrl,alt:n.name,onClick:()=>R(!0)}),a.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"}),v&&a.jsx(xm,{src:n.dataUrl,caption:x,onClose:()=>R(!1)})]})}return n.kind==="file"?a.jsxs("div",{className:"chip chip-text chip-file",title:`${n.name} · ${hn(n.bytes)}`,children:[a.jsxs("span",{className:"chip-toggle chip-file-label",children:[a.jsx("span",{className:"chip-icon",children:"▤"}),a.jsx("span",{className:"chip-file-name",children:n.name}),a.jsx("span",{className:"chip-file-size",children:hn(n.bytes)})]}),a.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"})]}):a.jsxs("div",{className:`chip chip-text${v?" chip-open":""}`,children:[a.jsxs("button",{className:"chip-toggle",onClick:()=>R(x=>!x),title:C("composer.chip.editHint"),"aria-expanded":v,children:[a.jsx("span",{className:"chip-icon",children:"¶"}),gw(n.number,n.lines),a.jsx("span",{className:"chip-chevron",children:v?"▾":"▸"})]}),a.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"}),v&&a.jsx("textarea",{className:"chip-editor",value:n.text,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),R(!1),h())},"aria-label":C("composer.chip.editorLabel",{number:n.number}),spellCheck:!1,autoFocus:!0})]})}var Rc={exports:{}},kf;function L1(){return kf||(kf=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={};return(()=>{var h=i;Object.defineProperty(h,"__esModule",{value:!0}),h.FitAddon=void 0,h.FitAddon=class{activate(v){this._terminal=v}dispose(){}fit(){const v=this.proposeDimensions();if(!v||!this._terminal||isNaN(v.cols)||isNaN(v.rows))return;const R=this._terminal._core;this._terminal.rows===v.rows&&this._terminal.cols===v.cols||(R._renderService.clear(),this._terminal.resize(v.cols,v.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const v=this._terminal._core,R=v._renderService.dimensions;if(R.css.cell.width===0||R.css.cell.height===0)return;const x=this._terminal.options.scrollback===0?0:v.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(r.getPropertyValue("height")),g=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),u=c-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),y=g-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-x;return{cols:Math.max(2,Math.floor(y/R.css.cell.width)),rows:Math.max(1,Math.floor(u/R.css.cell.height))}}}})(),i})()))})(Rc)),Rc.exports}var T1=L1(),Mc={exports:{}},Ef;function R1(){return Ef||(Ef=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={6:(x,r)=>{function c(_){try{const u=new URL(_),y=u.password&&u.username?`${u.protocol}//${u.username}:${u.password}@${u.host}`:u.username?`${u.protocol}//${u.username}@${u.host}`:`${u.protocol}//${u.host}`;return _.toLocaleLowerCase().startsWith(y.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(r,"__esModule",{value:!0}),r.LinkComputer=r.WebLinkProvider=void 0,r.WebLinkProvider=class{constructor(_,u,y,S={}){this._terminal=_,this._regex=u,this._handler=y,this._options=S}provideLinks(_,u){const y=g.computeLink(_,this._regex,this._terminal,this._handler);u(this._addCallbacks(y))}_addCallbacks(_){return _.map((u=>(u.leave=this._options.leave,u.hover=(y,S)=>{if(this._options.hover){const{range:L}=u;this._options.hover(y,S,L)}},u)))}};class g{static computeLink(u,y,S,L){const f=new RegExp(y.source,(y.flags||"")+"g"),[l,m]=g._getWindowedLineStrings(u-1,S),p=l.join("");let d;const k=[];for(;d=f.exec(p);){const D=d[0];if(!c(D))continue;const[E,M]=g._mapStrIdx(S,m,0,d.index),[b,T]=g._mapStrIdx(S,E,M,D.length);if(E===-1||M===-1||b===-1||T===-1)continue;const N={start:{x:M+1,y:E+1},end:{x:T,y:b+1}};k.push({range:N,text:D,activate:L})}return k}static _getWindowedLineStrings(u,y){let S,L=u,f=u,l=0,m="";const p=[];if(S=y.buffer.active.getLine(u)){const d=S.translateToString(!0);if(S.isWrapped&&d[0]!==" "){for(l=0;(S=y.buffer.active.getLine(--L))&&l<2048&&(m=S.translateToString(!0),l+=m.length,p.push(m),S.isWrapped&&m.indexOf(" ")===-1););p.reverse()}for(p.push(d),l=0;(S=y.buffer.active.getLine(++f))&&S.isWrapped&&l<2048&&(m=S.translateToString(!0),l+=m.length,p.push(m),m.indexOf(" ")===-1););}return[p,L]}static _mapStrIdx(u,y,S,L){const f=u.buffer.active,l=f.getNullCell();let m=S;for(;L;){const p=f.getLine(y);if(!p)return[-1,-1];for(let d=m;d<p.length;++d){p.getCell(d,l);const k=l.getChars();if(l.getWidth()&&(L-=k.length||1,d===p.length-1&&k==="")){const D=f.getLine(y+1);D&&D.isWrapped&&(D.getCell(0,l),l.getWidth()===2&&(L+=1))}if(L<0)return[y,d]}y++,m=0}return[y,m]}}r.LinkComputer=g}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x](c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.WebLinksAddon=void 0;const r=v(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(_,u){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=u}else console.warn("Opening link blocked as opener could not be cleared")}x.WebLinksAddon=class{constructor(_=g,u={}){this._handler=_,this._options=u}activate(_){this._terminal=_;const u=this._options,y=u.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new r.WebLinkProvider(this._terminal,y,this._handler,u))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),R})()))})(Mc)),Mc.exports}var M1=R1(),Ac={exports:{}},Lf;function A1(){return Lf||(Lf=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={965:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GlyphRenderer=void 0;const g=c(374),_=c(509),u=c(855),y=c(859),S=c(381),L=11,f=L*Float32Array.BYTES_PER_ELEMENT;let l,m=0,p=0,d=0;class k extends y.Disposable{constructor(E,M,b,T){super(),this._terminal=E,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 N=this._gl;_.TextureAtlas.maxAtlasPages===void 0&&(_.TextureAtlas.maxAtlasPages=Math.min(32,(0,g.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,g.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_SIZE))),this._program=(0,g.throwIfFalsy)((0,S.createProgram)(N,`#version 300 es
52
- layout (location = 0) in vec2 a_unitquad;
53
- layout (location = 1) in vec2 a_cellpos;
54
- layout (location = 2) in vec2 a_offset;
55
- layout (location = 3) in vec2 a_size;
56
- layout (location = 4) in float a_texpage;
57
- layout (location = 5) in vec2 a_texcoord;
58
- layout (location = 6) in vec2 a_texsize;
59
-
60
- uniform mat4 u_projection;
61
- uniform vec2 u_resolution;
62
-
63
- out vec2 v_texcoord;
64
- flat out int v_texpage;
65
-
66
- void main() {
67
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
68
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
69
- v_texpage = int(a_texpage);
70
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
71
- }`,(function(Y){let X="";for(let G=1;G<Y;G++)X+=` else if (v_texpage == ${G}) { outColor = texture(u_texture[${G}], v_texcoord); }`;return`#version 300 es
72
- precision lowp float;
73
-
74
- in vec2 v_texcoord;
75
- flat in int v_texpage;
76
-
77
- uniform sampler2D u_texture[${Y}];
78
-
79
- out vec4 outColor;
80
-
81
- void main() {
82
- if (v_texpage == 0) {
83
- outColor = texture(u_texture[0], v_texcoord);
84
- } ${X}
85
- }`})(_.TextureAtlas.maxAtlasPages))),this.register((0,y.toDisposable)((()=>N.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=N.createVertexArray(),N.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),F=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(F)))),N.bindBuffer(N.ARRAY_BUFFER,F),N.bufferData(N.ARRAY_BUFFER,B,N.STATIC_DRAW),N.enableVertexAttribArray(0),N.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const O=new Uint8Array([0,1,2,3]),U=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(U)))),N.bindBuffer(N.ELEMENT_ARRAY_BUFFER,U),N.bufferData(N.ELEMENT_ARRAY_BUFFER,O,N.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(N.createBuffer()),this.register((0,y.toDisposable)((()=>N.deleteBuffer(this._attributesBuffer)))),N.bindBuffer(N.ARRAY_BUFFER,this._attributesBuffer),N.enableVertexAttribArray(2),N.vertexAttribPointer(2,2,N.FLOAT,!1,f,0),N.vertexAttribDivisor(2,1),N.enableVertexAttribArray(3),N.vertexAttribPointer(3,2,N.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(3,1),N.enableVertexAttribArray(4),N.vertexAttribPointer(4,1,N.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(4,1),N.enableVertexAttribArray(5),N.vertexAttribPointer(5,2,N.FLOAT,!1,f,5*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(5,1),N.enableVertexAttribArray(6),N.vertexAttribPointer(6,2,N.FLOAT,!1,f,7*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(6,1),N.enableVertexAttribArray(1),N.vertexAttribPointer(1,2,N.FLOAT,!1,f,9*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(1,1),N.useProgram(this._program);const V=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++)V[Y]=Y;N.uniform1iv(this._textureLocation,V),N.uniformMatrix4fv(this._projectionLocation,!1,S.PROJECTION_MATRIX),this._atlasTextures=[];for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++){const X=new S.GLTexture((0,g.throwIfFalsy)(N.createTexture()));this.register((0,y.toDisposable)((()=>N.deleteTexture(X.texture)))),N.activeTexture(N.TEXTURE0+Y),N.bindTexture(N.TEXTURE_2D,X.texture),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_S,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_T,N.CLAMP_TO_EDGE),N.texImage2D(N.TEXTURE_2D,0,N.RGBA,1,1,0,N.RGBA,N.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[Y]=X}N.enable(N.BLEND),N.blendFunc(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(E,M,b,T,N,B,F,O,U){this._updateCell(this._vertices.attributes,E,M,b,T,N,B,F,O,U)}_updateCell(E,M,b,T,N,B,F,O,U,V){m=(b*this._terminal.cols+M)*L,T!==u.NULL_CELL_CODE&&T!==void 0?this._atlas&&(l=O&&O.length>1?this._atlas.getRasterizedGlyphCombinedChar(O,N,B,F,!1):this._atlas.getRasterizedGlyph(T,N,B,F,!1),p=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),N!==V&&l.offset.x>p?(d=l.offset.x-p,E[m]=-(l.offset.x-d)+this._dimensions.device.char.left,E[m+1]=-l.offset.y+this._dimensions.device.char.top,E[m+2]=(l.size.x-d)/this._dimensions.device.canvas.width,E[m+3]=l.size.y/this._dimensions.device.canvas.height,E[m+4]=l.texturePage,E[m+5]=l.texturePositionClipSpace.x+d/this._atlas.pages[l.texturePage].canvas.width,E[m+6]=l.texturePositionClipSpace.y,E[m+7]=l.sizeClipSpace.x-d/this._atlas.pages[l.texturePage].canvas.width,E[m+8]=l.sizeClipSpace.y):(E[m]=-l.offset.x+this._dimensions.device.char.left,E[m+1]=-l.offset.y+this._dimensions.device.char.top,E[m+2]=l.size.x/this._dimensions.device.canvas.width,E[m+3]=l.size.y/this._dimensions.device.canvas.height,E[m+4]=l.texturePage,E[m+5]=l.texturePositionClipSpace.x,E[m+6]=l.texturePositionClipSpace.y,E[m+7]=l.sizeClipSpace.x,E[m+8]=l.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,g.allowRescaling)(T,U,l.size.x,this._dimensions.device.cell.width)&&(E[m+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):E.fill(0,m,m+L-1-2)}clear(){const E=this._terminal,M=E.cols*E.rows*L;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<E.rows;T++)for(let N=0;N<E.cols;N++)this._vertices.attributes[b+9]=N/E.cols,this._vertices.attributes[b+10]=T/E.rows,b+=L}handleResize(){const E=this._gl;E.useProgram(this._program),E.viewport(0,0,E.canvas.width,E.canvas.height),E.uniform2f(this._resolutionLocation,E.canvas.width,E.canvas.height),this.clear()}render(E){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 N=0;N<E.lineLengths.length;N++){const B=N*this._terminal.cols*L,F=this._vertices.attributes.subarray(B,B+E.lineLengths[N]*L);b.set(F,T),T+=F.length}M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.bufferData(M.ARRAY_BUFFER,b.subarray(0,T),M.STREAM_DRAW);for(let N=0;N<this._atlas.pages.length;N++)this._atlas.pages[N].version!==this._atlasTextures[N].version&&this._bindAtlasPageTexture(M,this._atlas,N);M.drawElementsInstanced(M.TRIANGLE_STRIP,4,M.UNSIGNED_BYTE,0,T/L)}setAtlas(E){this._atlas=E;for(const M of this._atlasTextures)M.version=-1}_bindAtlasPageTexture(E,M,b){E.activeTexture(E.TEXTURE0+b),E.bindTexture(E.TEXTURE_2D,this._atlasTextures[b].texture),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,M.pages[b].canvas),E.generateMipmap(E.TEXTURE_2D),this._atlasTextures[b].version=M.pages[b].version}setDimensions(E){this._dimensions=E}}r.GlyphRenderer=k},742:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RectangleRenderer=void 0;const g=c(374),_=c(859),u=c(310),y=c(381),S=8*Float32Array.BYTES_PER_ELEMENT;class L{constructor(){this.attributes=new Float32Array(160),this.count=0}}let f=0,l=0,m=0,p=0,d=0,k=0,D=0;class E extends _.Disposable{constructor(b,T,N,B){super(),this._terminal=b,this._gl=T,this._dimensions=N,this._themeService=B,this._vertices=new L,this._verticesCursor=new L;const F=this._gl;this._program=(0,g.throwIfFalsy)((0,y.createProgram)(F,`#version 300 es
86
- layout (location = 0) in vec2 a_position;
87
- layout (location = 1) in vec2 a_size;
88
- layout (location = 2) in vec4 a_color;
89
- layout (location = 3) in vec2 a_unitquad;
90
-
91
- uniform mat4 u_projection;
92
-
93
- out vec4 v_color;
94
-
95
- void main() {
96
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
97
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
98
- v_color = a_color;
99
- }`,`#version 300 es
100
- precision lowp float;
101
-
102
- in vec4 v_color;
103
-
104
- out vec4 outColor;
105
-
106
- void main() {
107
- outColor = v_color;
108
- }`)),this.register((0,_.toDisposable)((()=>F.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(F.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=F.createVertexArray(),F.bindVertexArray(this._vertexArrayObject);const O=new Float32Array([0,0,1,0,0,1,1,1]),U=F.createBuffer();this.register((0,_.toDisposable)((()=>F.deleteBuffer(U)))),F.bindBuffer(F.ARRAY_BUFFER,U),F.bufferData(F.ARRAY_BUFFER,O,F.STATIC_DRAW),F.enableVertexAttribArray(3),F.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const V=new Uint8Array([0,1,2,3]),Y=F.createBuffer();this.register((0,_.toDisposable)((()=>F.deleteBuffer(Y)))),F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,Y),F.bufferData(F.ELEMENT_ARRAY_BUFFER,V,F.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(F.createBuffer()),this.register((0,_.toDisposable)((()=>F.deleteBuffer(this._attributesBuffer)))),F.bindBuffer(F.ARRAY_BUFFER,this._attributesBuffer),F.enableVertexAttribArray(0),F.vertexAttribPointer(0,2,F.FLOAT,!1,S,0),F.vertexAttribDivisor(0,1),F.enableVertexAttribArray(1),F.vertexAttribPointer(1,2,F.FLOAT,!1,S,2*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(1,1),F.enableVertexAttribArray(2),F.vertexAttribPointer(2,4,F.FLOAT,!1,S,4*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(2,1),this._updateCachedColors(B.colors),this.register(this._themeService.onChangeColors((X=>{this._updateCachedColors(X),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,y.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,N=this._vertices;let B,F,O,U,V,Y,X,G,P,$,H,q=1;for(B=0;B<T.rows;B++){for(O=-1,U=0,V=0,Y=!1,F=0;F<T.cols;F++)X=(B*T.cols+F)*u.RENDER_MODEL_INDICIES_PER_CELL,G=b.cells[X+u.RENDER_MODEL_BG_OFFSET],P=b.cells[X+u.RENDER_MODEL_FG_OFFSET],$=!!(67108864&P),(G!==U||P!==V&&(Y||$))&&((U!==0||Y&&V!==0)&&(H=8*q++,this._updateRectangle(N,H,V,U,O,F,B)),O=F,U=G,V=P,Y=$);(U!==0||Y&&V!==0)&&(H=8*q++,this._updateRectangle(N,H,V,U,O,T.cols,B))}N.count=q}updateCursor(b){const T=this._verticesCursor,N=b.cursor;if(!N||N.style==="block")return void(T.count=0);let B,F=0;N.style!=="bar"&&N.style!=="outline"||(B=8*F++,this._addRectangleFloat(T.attributes,B,N.x*this._dimensions.device.cell.width,N.y*this._dimensions.device.cell.height,N.style==="bar"?N.dpr*N.cursorWidth:N.dpr,this._dimensions.device.cell.height,this._cursorFloat)),N.style!=="underline"&&N.style!=="outline"||(B=8*F++,this._addRectangleFloat(T.attributes,B,N.x*this._dimensions.device.cell.width,(N.y+1)*this._dimensions.device.cell.height-N.dpr,N.width*this._dimensions.device.cell.width,N.dpr,this._cursorFloat)),N.style==="outline"&&(B=8*F++,this._addRectangleFloat(T.attributes,B,N.x*this._dimensions.device.cell.width,N.y*this._dimensions.device.cell.height,N.width*this._dimensions.device.cell.width,N.dpr,this._cursorFloat),B=8*F++,this._addRectangleFloat(T.attributes,B,(N.x+N.width)*this._dimensions.device.cell.width-N.dpr,N.y*this._dimensions.device.cell.height,N.dpr,this._dimensions.device.cell.height,this._cursorFloat)),T.count=F}_updateRectangle(b,T,N,B,F,O,U){if(67108864&N)switch(50331648&N){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&N].rgba;break;case 50331648:f=(16777215&N)<<8;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&B){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&B].rgba;break;case 50331648:f=(16777215&B)<<8;break;default:f=this._themeService.colors.background.rgba}b.attributes.length<T+4&&(b.attributes=(0,y.expandFloat32Array)(b.attributes,this._terminal.rows*this._terminal.cols*8)),l=F*this._dimensions.device.cell.width,m=U*this._dimensions.device.cell.height,p=(f>>24&255)/255,d=(f>>16&255)/255,k=(f>>8&255)/255,D=1,this._addRectangle(b.attributes,T,l,m,(O-F)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p,d,k,D)}_addRectangle(b,T,N,B,F,O,U,V,Y,X){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=F/this._dimensions.device.canvas.width,b[T+3]=O/this._dimensions.device.canvas.height,b[T+4]=U,b[T+5]=V,b[T+6]=Y,b[T+7]=X}_addRectangleFloat(b,T,N,B,F,O,U){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=F/this._dimensions.device.canvas.width,b[T+3]=O/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=E},310:(x,r,c)=>{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 g=c(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,g.createSelectionRenderModel)()}resize(_,u){const y=_*u*r.RENDER_MODEL_INDICIES_PER_CELL;y!==this.cells.length&&(this.cells=new Uint32Array(y),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JoinedCellData=r.WebglRenderer=void 0;const g=c(820),_=c(274),u=c(627),y=c(457),S=c(56),L=c(374),f=c(345),l=c(859),m=c(147),p=c(782),d=c(855),k=c(965),D=c(742),E=c(310),M=c(733);class b extends l.Disposable{constructor(F,O,U,V,Y,X,G,P,$){super(),this._terminal=F,this._characterJoinerService=O,this._charSizeService=U,this._coreBrowserService=V,this._coreService=Y,this._decorationService=X,this._optionsService=G,this._themeService=P,this._cursorBlinkStateManager=new l.MutableDisposable,this._charAtlasDisposable=this.register(new l.MutableDisposable),this._observerDisposable=this.register(new l.MutableDisposable),this._model=new E.RenderModel,this._workCell=new p.CellData,this._workCell2=new p.CellData,this._rectangleRenderer=this.register(new l.MutableDisposable),this._glyphRenderer=this.register(new l.MutableDisposable),this._onChangeTextureAtlas=this.register(new f.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new f.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new f.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new f.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,G,this._themeService)],this.dimensions=(0,L.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(G.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,g.addDisposableDomListener)(this._canvas,"webglcontextlost",(q=>{console.log("webglcontextlost event received"),q.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(q)}),3e3)}))),this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextrestored",(q=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,S.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((q,te)=>this._setCanvasDevicePixelDimensions(q,te))),this.register(this._coreBrowserService.onWindowChange((q=>{this._observerDisposable.value=(0,S.observeDevicePixelDimensions)(this._canvas,q,((te,se)=>this._setCanvasDevicePixelDimensions(te,se)))}))),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,l.toDisposable)((()=>{var q;for(const te of this._renderLayers)te.dispose();(q=this._canvas.parentElement)==null||q.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var F;return(F=this._charAtlas)==null?void 0:F.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(F,O){var U,V,Y,X;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const G of this._renderLayers)G.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),(V=this._rectangleRenderer.value)==null||V.handleResize(),(Y=this._glyphRenderer.value)==null||Y.setDimensions(this.dimensions),(X=this._glyphRenderer.value)==null||X.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var F;for(const O of this._renderLayers)O.handleBlur(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.pause(),this._requestRedrawViewport()}handleFocus(){var F;for(const O of this._renderLayers)O.handleFocus(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.resume(),this._requestRedrawViewport()}handleSelectionChanged(F,O,U){for(const V of this._renderLayers)V.handleSelectionChanged(this._terminal,F,O,U);this._model.selection.update(this._core,F,O,U),this._requestRedrawViewport()}handleCursorMove(){var F;for(const O of this._renderLayers)O.handleCursorMove(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new D.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new k.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var O;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const F=(0,u.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!==F&&(this._onChangeTextureAtlas.fire(F.pages[0].canvas),this._charAtlasDisposable.value=(0,l.getDisposeArrayDisposable)([(0,f.forwardEvent)(F.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,f.forwardEvent)(F.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=F,this._charAtlas.warmUp(),(O=this._glyphRenderer.value)==null||O.setAtlas(this._charAtlas)}_clearModel(F){var O;this._model.clear(),F&&((O=this._glyphRenderer.value)==null||O.clear())}clearTextureAtlas(){var F;(F=this._charAtlas)==null||F.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var F;this._clearModel(!0);for(const O of this._renderLayers)O.reset(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(F){return-1}deregisterCharacterJoiner(F){return!1}renderRows(F,O){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,F,O);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(F,O),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 y.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(F,O){const U=this._core;let V,Y,X,G,P,$,H,q,te,se,le,ue,K,W,J=this._workCell;F=N(F,U.rows-1,0),O=N(O,U.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,de=Z-U.buffer.ydisp,pe=Math.min(this._terminal.buffer.active.cursorX,U.cols-1);let re=-1;const ke=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Me=!1;for(Y=F;Y<=O;Y++)for(X=Y+U.buffer.ydisp,G=U.buffer.lines.get(X),this._model.lineLengths[Y]=0,P=this._characterJoinerService.getJoinedCharacters(X),K=0;K<U.cols;K++)if(V=this._cellColorResolver.result.bg,G.loadCell(K,J),K===0&&(V=this._cellColorResolver.result.bg),$=!1,H=K,P.length>0&&K===P[0][0]&&($=!0,q=P.shift(),J=new T(J,G.translateToString(!0,q[0],q[1]),q[1]-q[0]),H=q[1]-1),te=J.getChars(),se=J.getCode(),ue=(Y*U.cols+K)*E.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(J,K,X,this.dimensions.device.cell.width),ke&&X===Z&&(K===pe&&(this._model.cursor={x:pe,y:de,width:J.getWidth(),style:this._coreBrowserService.isFocused?U.options.cursorStyle||"block":U.options.cursorInactiveStyle,cursorWidth:U.options.cursorWidth,dpr:this._devicePixelRatio},re=pe+J.getWidth()-1),K>=pe&&K<=re&&(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)),se!==d.NULL_CELL_CODE&&(this._model.lineLengths[Y]=K+1),(this._model.cells[ue]!==se||this._model.cells[ue+E.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[ue+E.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[ue+E.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Me=!0,te.length>1&&(se|=E.COMBINED_CHAR_BIT_MASK),this._model.cells[ue]=se,this._model.cells[ue+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ue+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ue+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,le=J.getWidth(),this._glyphRenderer.value.updateCell(K,Y,se,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,te,le,V),$))for(J=this._workCell,K++;K<H;K++)W=(Y*U.cols+K)*E.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(K,Y,d.NULL_CELL_CODE,0,0,0,d.NULL_CELL_CHAR,0,0),this._model.cells[W]=d.NULL_CELL_CODE,this._model.cells[W+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[W+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[W+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Me&&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(F,O){this._canvas.width===F&&this._canvas.height===O||(this._canvas.width=F,this._canvas.height=O,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const F=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:F,end:F})}}r.WebglRenderer=b;class T extends m.AttributeData{constructor(F,O,U){super(),this.content=0,this.combinedData="",this.fg=F.fg,this.bg=F.bg,this.combinedData=O,this._width=U}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(F){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function N(B,F,O=0){return Math.max(Math.min(B,F),O)}r.JoinedCellData=T},381:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GLTexture=r.expandFloat32Array=r.createShader=r.createProgram=r.PROJECTION_MATRIX=void 0;const g=c(374);function _(u,y,S){const L=(0,g.throwIfFalsy)(u.createShader(y));if(u.shaderSource(L,S),u.compileShader(L),u.getShaderParameter(L,u.COMPILE_STATUS))return L;console.error(u.getShaderInfoLog(L)),u.deleteShader(L)}r.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),r.createProgram=function(u,y,S){const L=(0,g.throwIfFalsy)(u.createProgram());if(u.attachShader(L,(0,g.throwIfFalsy)(_(u,u.VERTEX_SHADER,y))),u.attachShader(L,(0,g.throwIfFalsy)(_(u,u.FRAGMENT_SHADER,S))),u.linkProgram(L),u.getProgramParameter(L,u.LINK_STATUS))return L;console.error(u.getProgramInfoLog(L)),u.deleteProgram(L)},r.createShader=_,r.expandFloat32Array=function(u,y){const S=Math.min(2*u.length,y),L=new Float32Array(S);for(let f=0;f<u.length;f++)L[f]=u[f];return L},r.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseRenderLayer=void 0;const g=c(627),_=c(237),u=c(374),y=c(859);class S extends y.Disposable{constructor(f,l,m,p,d,k,D,E){super(),this._container=l,this._alpha=d,this._coreBrowserService=k,this._optionsService=D,this._themeService=E,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-${m}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((M=>{this._refreshCharAtlas(f,M),this.reset(f)}))),this.register((0,y.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(f){}handleFocus(f){}handleCursorMove(f){}handleGridChanged(f,l,m){}handleSelectionChanged(f,l,m,p=!1){}_setTransparency(f,l){if(l===this._alpha)return;const m=this._canvas;this._alpha=l,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(f,this._themeService.colors),this.handleGridChanged(f,0,f.rows-1)}_refreshCharAtlas(f,l){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,g.acquireTextureAtlas)(f,this._optionsService.rawOptions,l,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(f,l){this._deviceCellWidth=l.device.cell.width,this._deviceCellHeight=l.device.cell.height,this._deviceCharWidth=l.device.char.width,this._deviceCharHeight=l.device.char.height,this._deviceCharLeft=l.device.char.left,this._deviceCharTop=l.device.char.top,this._canvas.width=l.device.canvas.width,this._canvas.height=l.device.canvas.height,this._canvas.style.width=`${l.css.canvas.width}px`,this._canvas.style.height=`${l.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(f,this._themeService.colors)}_fillBottomLineAtCells(f,l,m=1){this._ctx.fillRect(f*this._deviceCellWidth,(l+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,m*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(f,l,m,p){this._alpha?this._ctx.clearRect(f*this._deviceCellWidth,l*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(f*this._deviceCellWidth,l*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight))}_fillCharTrueColor(f,l,m,p){this._ctx.font=this._getFont(f,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(m,p,l.getWidth()),this._ctx.fillText(l.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,p*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(f,l,m){this._ctx.beginPath(),this._ctx.rect(f*this._deviceCellWidth,l*this._deviceCellHeight,m*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(f,l,m){return`${m?"italic":""} ${l?f.options.fontWeightBold:f.options.fontWeight} ${f.options.fontSize*this._coreBrowserService.dpr}px ${f.options.fontFamily}`}}r.BaseRenderLayer=S},733:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkRenderLayer=void 0;const g=c(197),_=c(237),u=c(592);class y extends u.BaseRenderLayer{constructor(L,f,l,m,p,d,k){super(l,L,"link",f,!0,p,d,k),this.register(m.onShowLinkUnderline((D=>this._handleShowLinkUnderline(D)))),this.register(m.onHideLinkUnderline((D=>this._handleHideLinkUnderline(D))))}resize(L,f){super.resize(L,f),this._state=void 0}reset(L){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const L=this._state.y2-this._state.y1-1;L>0&&this._clearCells(0,this._state.y1+1,this._state.cols,L),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(L){if(L.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:L.fg!==void 0&&(0,g.is256Color)(L.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[L.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,L.y1===L.y2)this._fillBottomLineAtCells(L.x1,L.y1,L.x2-L.x1);else{this._fillBottomLineAtCells(L.x1,L.y1,L.cols-L.x1);for(let f=L.y1+1;f<L.y2;f++)this._fillBottomLineAtCells(0,f,L.cols);this._fillBottomLineAtCells(0,L.y2,L.x2)}this._state=L}_handleHideLinkUnderline(L){this._clearCurrentLink()}}r.LinkRenderLayer=y},820:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(c,g,_,u){c.addEventListener(g,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(g,_,u))}}}},274:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellColorResolver=void 0;const g=c(855),_=c(160),u=c(374);let y,S=0,L=0,f=!1,l=!1,m=!1,p=0;r.CellColorResolver=class{constructor(d,k,D,E,M,b){this._terminal=d,this._optionService=k,this._selectionRenderModel=D,this._decorationService=E,this._coreBrowserService=M,this._themeService=b,this.result={fg:0,bg:0,ext:0}}resolve(d,k,D,E){if(this.result.bg=d.bg,this.result.fg=d.fg,this.result.ext=268435456&d.bg?d.extended.ext:0,L=0,S=0,l=!1,f=!1,m=!1,y=this._themeService.colors,p=0,d.getCode()!==g.NULL_CELL_CODE&&d.extended.underlineStyle===4){const M=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));p=k*E%(2*Math.round(M))}if(this._decorationService.forEachDecorationAtCell(k,D,"bottom",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,l=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),m=this._selectionRenderModel.isCellSelected(this._terminal,k,D),m){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:L=(16777215&this.result.fg)<<8|255;break;default:L=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:L=(16777215&this.result.bg)<<8|255}L=_.rgba.blend(L,4294967040&(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else L=(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(l=!0,y.selectionForeground&&(S=y.selectionForeground.rgba>>8&16777215,f=!0),(0,u.treatGlyphAsBackgroundColor)(d.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)S=(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:S=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:S=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:S=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:S=(16777215&this.result.fg)<<8|255;break;default:S=this._themeService.colors.foreground.rgba}S=_.rgba.blend(S,4294967040&(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}f=!0}}this._decorationService.forEachDecorationAtCell(k,D,"top",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,l=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),l&&(L=m?-16777216&d.bg&-134217729|L|50331648:-16777216&d.bg|L|50331648),f&&(S=-16777216&d.fg&-67108865|S|50331648),67108864&this.result.fg&&(l&&!f&&(S=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&y.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,f=!0),!l&&f&&(L=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&y.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,l=!0)),y=void 0,this.result.bg=l?L:this.result.bg,this.result.fg=f?S:this.result.fg,this.result.ext&=536870911,this.result.ext|=p<<29&3758096384}}},627:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeTerminalFromCache=r.acquireTextureAtlas=void 0;const g=c(509),_=c(197),u=[];r.acquireTextureAtlas=function(y,S,L,f,l,m,p,d){const k=(0,_.generateConfig)(f,l,m,p,S,L,d);for(let M=0;M<u.length;M++){const b=u[M],T=b.ownedBy.indexOf(y);if(T>=0){if((0,_.configEquals)(b.config,k))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),u.splice(M,1)):b.ownedBy.splice(T,1);break}}for(let M=0;M<u.length;M++){const b=u[M];if((0,_.configEquals)(b.config,k))return b.ownedBy.push(y),b.atlas}const D=y._core,E={atlas:new g.TextureAtlas(document,k,D.unicodeService),config:k,ownedBy:[y]};return u.push(E),E.atlas},r.removeTerminalFromCache=function(y){for(let S=0;S<u.length;S++){const L=u[S].ownedBy.indexOf(y);if(L!==-1){u[S].ownedBy.length===1?(u[S].atlas.dispose(),u.splice(S,1)):u[S].ownedBy.splice(L,1);break}}}},197:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.is256Color=r.configEquals=r.generateConfig=void 0;const g=c(160);r.generateConfig=function(_,u,y,S,L,f,l){const m={foreground:f.foreground,background:f.background,cursor:g.NULL_COLOR,cursorAccent:g.NULL_COLOR,selectionForeground:g.NULL_COLOR,selectionBackgroundTransparent:g.NULL_COLOR,selectionBackgroundOpaque:g.NULL_COLOR,selectionInactiveBackgroundTransparent:g.NULL_COLOR,selectionInactiveBackgroundOpaque:g.NULL_COLOR,ansi:f.ansi.slice(),contrastCache:f.contrastCache,halfContrastCache:f.halfContrastCache};return{customGlyphs:L.customGlyphs,devicePixelRatio:l,letterSpacing:L.letterSpacing,lineHeight:L.lineHeight,deviceCellWidth:_,deviceCellHeight:u,deviceCharWidth:y,deviceCharHeight:S,fontFamily:L.fontFamily,fontSize:L.fontSize,fontWeight:L.fontWeight,fontWeightBold:L.fontWeightBold,allowTransparency:L.allowTransparency,drawBoldTextInBrightColors:L.drawBoldTextInBrightColors,minimumContrastRatio:L.minimumContrastRatio,colors:m}},r.configEquals=function(_,u){for(let y=0;y<_.colors.ansi.length;y++)if(_.colors.ansi[y].rgba!==u.colors.ansi[y].rgba)return!1;return _.devicePixelRatio===u.devicePixelRatio&&_.customGlyphs===u.customGlyphs&&_.lineHeight===u.lineHeight&&_.letterSpacing===u.letterSpacing&&_.fontFamily===u.fontFamily&&_.fontSize===u.fontSize&&_.fontWeight===u.fontWeight&&_.fontWeightBold===u.fontWeightBold&&_.allowTransparency===u.allowTransparency&&_.deviceCharWidth===u.deviceCharWidth&&_.deviceCharHeight===u.deviceCharHeight&&_.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&_.minimumContrastRatio===u.minimumContrastRatio&&_.colors.foreground.rgba===u.colors.foreground.rgba&&_.colors.background.rgba===u.colors.background.rgba},r.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const g=c(399);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},457:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CursorBlinkStateManager=void 0,r.CursorBlinkStateManager=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,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(c=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const g=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,g>0)return void this._restartInterval(g)}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 g=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(g)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),c)}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:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryDrawCustomChar=r.powerlineDefinitions=r.boxDrawingDefinitions=r.blockElementDefinitions=void 0;const g=c(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:(f,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"║":{1:(f,l)=>`M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╒":{1:(f,l)=>`M.5,1 L.5,${.5-l} L1,${.5-l} M.5,${.5+l} L1,${.5+l}`},"╓":{1:(f,l)=>`M${.5-f},1 L${.5-f},.5 L1,.5 M${.5+f},.5 L${.5+f},1`},"╔":{1:(f,l)=>`M1,${.5-l} L${.5-f},${.5-l} L${.5-f},1 M1,${.5+l} L${.5+f},${.5+l} L${.5+f},1`},"╕":{1:(f,l)=>`M0,${.5-l} L.5,${.5-l} L.5,1 M0,${.5+l} L.5,${.5+l}`},"╖":{1:(f,l)=>`M${.5+f},1 L${.5+f},.5 L0,.5 M${.5-f},.5 L${.5-f},1`},"╗":{1:(f,l)=>`M0,${.5+l} L${.5-f},${.5+l} L${.5-f},1 M0,${.5-l} L${.5+f},${.5-l} L${.5+f},1`},"╘":{1:(f,l)=>`M.5,0 L.5,${.5+l} L1,${.5+l} M.5,${.5-l} L1,${.5-l}`},"╙":{1:(f,l)=>`M1,.5 L${.5-f},.5 L${.5-f},0 M${.5+f},.5 L${.5+f},0`},"╚":{1:(f,l)=>`M1,${.5-l} L${.5+f},${.5-l} L${.5+f},0 M1,${.5+l} L${.5-f},${.5+l} L${.5-f},0`},"╛":{1:(f,l)=>`M0,${.5+l} L.5,${.5+l} L.5,0 M0,${.5-l} L.5,${.5-l}`},"╜":{1:(f,l)=>`M0,.5 L${.5+f},.5 L${.5+f},0 M${.5-f},.5 L${.5-f},0`},"╝":{1:(f,l)=>`M0,${.5-l} L${.5-f},${.5-l} L${.5-f},0 M0,${.5+l} L${.5+f},${.5+l} L${.5+f},0`},"╞":{1:(f,l)=>`M.5,0 L.5,1 M.5,${.5-l} L1,${.5-l} M.5,${.5+l} L1,${.5+l}`},"╟":{1:(f,l)=>`M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1 M${.5+f},.5 L1,.5`},"╠":{1:(f,l)=>`M${.5-f},0 L${.5-f},1 M1,${.5+l} L${.5+f},${.5+l} L${.5+f},1 M1,${.5-l} L${.5+f},${.5-l} L${.5+f},0`},"╡":{1:(f,l)=>`M.5,0 L.5,1 M0,${.5-l} L.5,${.5-l} M0,${.5+l} L.5,${.5+l}`},"╢":{1:(f,l)=>`M0,.5 L${.5-f},.5 M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╣":{1:(f,l)=>`M${.5+f},0 L${.5+f},1 M0,${.5+l} L${.5-f},${.5+l} L${.5-f},1 M0,${.5-l} L${.5-f},${.5-l} L${.5-f},0`},"╤":{1:(f,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l} M.5,${.5+l} L.5,1`},"╥":{1:(f,l)=>`M0,.5 L1,.5 M${.5-f},.5 L${.5-f},1 M${.5+f},.5 L${.5+f},1`},"╦":{1:(f,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L${.5-f},${.5+l} L${.5-f},1 M1,${.5+l} L${.5+f},${.5+l} L${.5+f},1`},"╧":{1:(f,l)=>`M.5,0 L.5,${.5-l} M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"╨":{1:(f,l)=>`M0,.5 L1,.5 M${.5-f},.5 L${.5-f},0 M${.5+f},.5 L${.5+f},0`},"╩":{1:(f,l)=>`M0,${.5+l} L1,${.5+l} M0,${.5-l} L${.5-f},${.5-l} L${.5-f},0 M1,${.5-l} L${.5+f},${.5-l} L${.5+f},0`},"╪":{1:(f,l)=>`M.5,0 L.5,1 M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"╫":{1:(f,l)=>`M0,.5 L1,.5 M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╬":{1:(f,l)=>`M0,${.5+l} L${.5-f},${.5+l} L${.5-f},1 M1,${.5+l} L${.5+f},${.5+l} L${.5+f},1 M0,${.5-l} L${.5-f},${.5-l} L${.5-f},0 M1,${.5-l} L${.5+f},${.5-l} L${.5+f},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:(f,l)=>`M.5,1 L.5,${.5+l/.15*.5} C.5,${.5+l/.15*.5},.5,.5,1,.5`},"╮":{1:(f,l)=>`M.5,1 L.5,${.5+l/.15*.5} C.5,${.5+l/.15*.5},.5,.5,0,.5`},"╯":{1:(f,l)=>`M.5,0 L.5,${.5-l/.15*.5} C.5,${.5-l/.15*.5},.5,.5,0,.5`},"╰":{1:(f,l)=>`M.5,0 L.5,${.5-l/.15*.5} C.5,${.5-l/.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(f,l,m,p,d,k,D,E){const M=r.blockElementDefinitions[l];if(M)return(function(B,F,O,U,V,Y){for(let X=0;X<F.length;X++){const G=F[X],P=V/8,$=Y/8;B.fillRect(O+G.x*P,U+G.y*$,G.w*P,G.h*$)}})(f,M,m,p,d,k),!0;const b=_[l];if(b)return(function(B,F,O,U,V,Y){let X=u.get(F);X||(X=new Map,u.set(F,X));const G=B.fillStyle;if(typeof G!="string")throw new Error(`Unexpected fillStyle type "${G}"`);let P=X.get(G);if(!P){const $=F[0].length,H=F.length,q=B.canvas.ownerDocument.createElement("canvas");q.width=$,q.height=H;const te=(0,g.throwIfFalsy)(q.getContext("2d")),se=new ImageData($,H);let le,ue,K,W;if(G.startsWith("#"))le=parseInt(G.slice(1,3),16),ue=parseInt(G.slice(3,5),16),K=parseInt(G.slice(5,7),16),W=G.length>7&&parseInt(G.slice(7,9),16)||1;else{if(!G.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${G}" when drawing pattern glyph`);[le,ue,K,W]=G.substring(5,G.length-1).split(",").map((J=>parseFloat(J)))}for(let J=0;J<H;J++)for(let Z=0;Z<$;Z++)se.data[4*(J*$+Z)]=le,se.data[4*(J*$+Z)+1]=ue,se.data[4*(J*$+Z)+2]=K,se.data[4*(J*$+Z)+3]=F[J][Z]*(255*W);te.putImageData(se,0,0),P=(0,g.throwIfFalsy)(B.createPattern(q,null)),X.set(G,P)}B.fillStyle=P,B.fillRect(O,U,V,Y)})(f,b,m,p,d,k),!0;const T=r.boxDrawingDefinitions[l];if(T)return(function(B,F,O,U,V,Y,X){B.strokeStyle=B.fillStyle;for(const[G,P]of Object.entries(F)){let $;B.beginPath(),B.lineWidth=X*Number.parseInt(G),$=typeof P=="function"?P(.15,.15/Y*V):P;for(const H of $.split(" ")){const q=H[0],te=S[q];if(!te){console.error(`Could not find drawing instructions for "${q}"`);continue}const se=H.substring(1).split(",");se[0]&&se[1]&&te(B,L(se,V,Y,O,U,!0,X))}B.stroke(),B.closePath()}})(f,T,m,p,d,k,E),!0;const N=r.powerlineDefinitions[l];return!!N&&((function(B,F,O,U,V,Y,X,G){const P=new Path2D;P.rect(O,U,V,Y),B.clip(P),B.beginPath();const $=X/12;B.lineWidth=G*$;for(const H of F.d.split(" ")){const q=H[0],te=S[q];if(!te){console.error(`Could not find drawing instructions for "${q}"`);continue}const se=H.substring(1).split(",");se[0]&&se[1]&&te(B,L(se,V,Y,O,U,!1,G,(F.leftPadding??0)*($/2),(F.rightPadding??0)*($/2)))}F.type===1?(B.strokeStyle=B.fillStyle,B.stroke()):B.fill(),B.closePath()})(f,N,m,p,d,k,D,E),!0)};const u=new Map;function y(f,l,m=0){return Math.max(Math.min(f,l),m)}const S={C:(f,l)=>f.bezierCurveTo(l[0],l[1],l[2],l[3],l[4],l[5]),L:(f,l)=>f.lineTo(l[0],l[1]),M:(f,l)=>f.moveTo(l[0],l[1])};function L(f,l,m,p,d,k,D,E=0,M=0){const b=f.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]*=l-E*D-M*D,k&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,l,0)),b[T]+=p+E*D;for(let T=1;T<b.length;T+=2)b[T]*=m,k&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,m,0)),b[T]+=d;return b}},56:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.observeDevicePixelDimensions=void 0;const g=c(859);r.observeDevicePixelDimensions=function(_,u,y){let S=new u.ResizeObserver((L=>{const f=L.find((p=>p.target===_));if(!f)return;if(!("devicePixelContentBoxSize"in f))return S==null||S.disconnect(),void(S=void 0);const l=f.devicePixelContentBoxSize[0].inlineSize,m=f.devicePixelContentBoxSize[0].blockSize;l>0&&m>0&&y(l,m)}));try{S.observe(_,{box:["device-pixel-content-box"]})}catch{S.disconnect(),S=void 0}return(0,g.toDisposable)((()=>S==null?void 0:S.disconnect()))}},374:(x,r)=>{function c(_){return 57508<=_&&_<=57558}function g(_){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=c,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=g,r.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!g(_)&&!c(_)&&!(function(L){return 57344<=L&&L<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=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(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},296:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class c{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(_,u,y,S=!1){if(this.selectionStart=u,this.selectionEnd=y,!u||!y||u[0]===y[0]&&u[1]===y[1])return void this.clear();const L=_.buffers.active.ydisp,f=u[1]-L,l=y[1]-L,m=Math.max(f,0),p=Math.min(l,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=f,this.viewportEndRow=l,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,this.startCol=u[0],this.endCol=y[0])}isCellSelected(_,u,y){return!!this.hasSelection&&(y-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&y>=this.viewportCappedStartRow&&u<this.endCol&&y<=this.viewportCappedEndRow:u<this.startCol&&y>=this.viewportCappedStartRow&&u>=this.endCol&&y<=this.viewportCappedEndRow:y>this.viewportStartRow&&y<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol)}}r.createSelectionRenderModel=function(){return new c}},509:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TextureAtlas=void 0;const g=c(237),_=c(860),u=c(374),y=c(160),S=c(345),L=c(485),f=c(385),l=c(147),m=c(855),p={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 k{get pages(){return this._pages}constructor(T,N,B){this._document=T,this._config=N,this._unicodeService=B,this._didWarmUp=!1,this._cacheMap=new L.FourKeyMap,this._cacheMapCombined=new L.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new l.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new S.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new S.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,u.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 f.IdleTaskQueue;for(let N=33;N<126;N++)T.enqueue((()=>{if(!this._cacheMap.get(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT)){const B=this._drawToCache(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT);this._cacheMap.set(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.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(k.maxAtlasPages&&this._pages.length>=Math.max(4,k.maxAtlasPages)){const N=this._pages.filter((X=>2*X.canvas.width<=(k.maxTextureSize||4096))).sort(((X,G)=>G.canvas.width!==X.canvas.width?G.canvas.width-X.canvas.width:G.percentageUsed-X.percentageUsed));let B=-1,F=0;for(let X=0;X<N.length;X++)if(N[X].canvas.width!==F)B=X,F=N[X].canvas.width;else if(X-B==3)break;const O=N.slice(B,B+4),U=O.map((X=>X.glyphs[0].texturePage)).sort(((X,G)=>X>G?1:-1)),V=this.pages.length-O.length,Y=this._mergePages(O,V);Y.version++;for(let X=U.length-1;X>=0;X--)this._deletePage(U[X]);this.pages.push(Y),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(Y.canvas)}const T=new D(this._document,this._textureSize);return this._pages.push(T),this._activePages.push(T),this._onAddTextureAtlasCanvas.fire(T.canvas),T}_mergePages(T,N){const B=2*T[0].canvas.width,F=new D(this._document,B,T);for(const[O,U]of T.entries()){const V=O*U.canvas.width%B,Y=Math.floor(O/2)*U.canvas.height;F.ctx.drawImage(U.canvas,V,Y);for(const G of U.glyphs)G.texturePage=N,G.sizeClipSpace.x=G.size.x/B,G.sizeClipSpace.y=G.size.y/B,G.texturePosition.x+=V,G.texturePosition.y+=Y,G.texturePositionClipSpace.x=G.texturePosition.x/B,G.texturePositionClipSpace.y=G.texturePosition.y/B;this._onRemoveTextureAtlasCanvas.fire(U.canvas);const X=this._activePages.indexOf(U);X!==-1&&this._activePages.splice(X,1)}return F}_deletePage(T){this._pages.splice(T,1);for(let N=T;N<this._pages.length;N++){const B=this._pages[N];for(const F of B.glyphs)F.texturePage--;B.version++}}getRasterizedGlyphCombinedChar(T,N,B,F,O){return this._getFromCacheMap(this._cacheMapCombined,T,N,B,F,O)}getRasterizedGlyph(T,N,B,F,O){return this._getFromCacheMap(this._cacheMap,T,N,B,F,O)}_getFromCacheMap(T,N,B,F,O,U=!1){return d=T.get(N,B,F,O),d||(d=this._drawToCache(N,B,F,O,U),T.set(N,B,F,O,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,N,B,F){if(this._config.allowTransparency)return y.NULL_COLOR;let O;switch(T){case 16777216:case 33554432:O=this._getColorFromAnsiIndex(N);break;case 50331648:const U=l.AttributeData.toColorRGB(N);O=y.channels.toColor(U[0],U[1],U[2]);break;default:O=B?y.color.opaque(this._config.colors.foreground):this._config.colors.background}return O}_getForegroundColor(T,N,B,F,O,U,V,Y,X,G){const P=this._getMinimumContrastColor(T,N,B,F,O,U,V,X,Y,G);if(P)return P;let $;switch(O){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&X&&U<8&&(U+=8),$=this._getColorFromAnsiIndex(U);break;case 50331648:const H=l.AttributeData.toColorRGB(U);$=y.channels.toColor(H[0],H[1],H[2]);break;default:$=V?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&($=y.color.opaque($)),Y&&($=y.color.multiplyOpacity($,g.DIM_OPACITY)),$}_resolveBackgroundRgba(T,N,B){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return B?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,N,B,F){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&F&&N<8&&(N+=8),this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return B?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,N,B,F,O,U,V,Y,X,G){if(this._config.minimumContrastRatio===1||G)return;const P=this._getContrastCache(X),$=P.getColor(T,F);if($!==void 0)return $||void 0;const H=this._resolveBackgroundRgba(N,B,V),q=this._resolveForegroundRgba(O,U,V,Y),te=y.rgba.ensureContrastRatio(H,q,this._config.minimumContrastRatio/(X?2:1));if(!te)return void P.setColor(T,F,null);const se=y.channels.toColor(te>>24&255,te>>16&255,te>>8&255);return P.setColor(T,F,se),se}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,N,B,F,O=!1){const U=typeof T=="number"?String.fromCharCode(T):T,V=Math.min(this._config.deviceCellWidth*Math.max(U.length,2)+4,this._textureSize);this._tmpCanvas.width<V&&(this._tmpCanvas.width=V);const Y=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<Y&&(this._tmpCanvas.height=Y),this._tmpCtx.save(),this._workAttributeData.fg=B,this._workAttributeData.bg=N,this._workAttributeData.extended.ext=F,this._workAttributeData.isInvisible())return p;const X=!!this._workAttributeData.isBold(),G=!!this._workAttributeData.isInverse(),P=!!this._workAttributeData.isDim(),$=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),q=!!this._workAttributeData.isStrikethrough(),te=!!this._workAttributeData.isOverline();let se=this._workAttributeData.getFgColor(),le=this._workAttributeData.getFgColorMode(),ue=this._workAttributeData.getBgColor(),K=this._workAttributeData.getBgColorMode();if(G){const ve=se;se=ue,ue=ve;const Ae=le;le=K,K=Ae}const W=this._getBackgroundColor(K,ue,G,P);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const J=X?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=g.TEXT_BASELINE;const de=U.length===1&&(0,u.isPowerlineGlyph)(U.charCodeAt(0)),pe=U.length===1&&(0,u.isRestrictedPowerlineGlyph)(U.charCodeAt(0)),re=this._getForegroundColor(N,K,ue,B,le,se,G,P,X,(0,u.treatGlyphAsBackgroundColor)(U.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const ke=pe?0:4;let Me=!1;this._config.customGlyphs!==!1&&(Me=(0,_.tryDrawCustomChar)(this._tmpCtx,U,ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let et,Le=!de;if(et=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),H){this._tmpCtx.save();const ve=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ae=ve%2==1?.5:0;if(this._tmpCtx.lineWidth=ve,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Le=!1,this._tmpCtx.strokeStyle=`rgb(${l.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Le=!1;let $e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&$e<8&&($e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex($e).css}this._tmpCtx.beginPath();const st=ke,Xe=Math.ceil(ke+this._config.deviceCharHeight)-Ae-(O?2*ve:0),Qe=Xe+ve,dt=Xe+2*ve;let ht=this._workAttributeData.getUnderlineVariantOffset();for(let $e=0;$e<et;$e++){this._tmpCtx.save();const tt=st+$e*this._config.deviceCellWidth,We=st+($e+1)*this._config.deviceCellWidth,ot=tt+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(tt,Xe),this._tmpCtx.lineTo(We,Xe),this._tmpCtx.moveTo(tt,dt),this._tmpCtx.lineTo(We,dt);break;case 3:const ft=ve<=1?dt:Math.ceil(ke+this._config.deviceCharHeight-ve/2)-Ae,Re=ve<=1?Xe:Math.ceil(ke+this._config.deviceCharHeight+ve/2)-Ae,Ve=new Path2D;Ve.rect(tt,Xe,this._config.deviceCellWidth,dt-Xe),this._tmpCtx.clip(Ve),this._tmpCtx.moveTo(tt-this._config.deviceCellWidth/2,Qe),this._tmpCtx.bezierCurveTo(tt-this._config.deviceCellWidth/2,Re,tt,Re,tt,Qe),this._tmpCtx.bezierCurveTo(tt,ft,ot,ft,ot,Qe),this._tmpCtx.bezierCurveTo(ot,Re,We,Re,We,Qe),this._tmpCtx.bezierCurveTo(We,ft,We+this._config.deviceCellWidth/2,ft,We+this._config.deviceCellWidth/2,Qe);break;case 4:const he=ht===0?0:ht>=ve?2*ve-ht:ve-ht;ht>=ve||he===0?(this._tmpCtx.setLineDash([Math.round(ve),Math.round(ve)]),this._tmpCtx.moveTo(tt+he,Xe),this._tmpCtx.lineTo(We,Xe)):(this._tmpCtx.setLineDash([Math.round(ve),Math.round(ve)]),this._tmpCtx.moveTo(tt,Xe),this._tmpCtx.lineTo(tt+he,Xe),this._tmpCtx.moveTo(tt+he+ve,Xe),this._tmpCtx.lineTo(We,Xe)),ht=(0,u.computeNextVariantOffset)(We-tt,ve,ht);break;case 5:const me=.6,Ne=.3,mt=We-tt,De=Math.floor(me*mt),qe=Math.floor(Ne*mt),lt=mt-De-qe;this._tmpCtx.setLineDash([De,qe,lt]),this._tmpCtx.moveTo(tt,Xe),this._tmpCtx.lineTo(We,Xe);break;default:this._tmpCtx.moveTo(tt,Xe),this._tmpCtx.lineTo(We,Xe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Me&&this._config.fontSize>=12&&!this._config.allowTransparency&&U!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const $e=this._tmpCtx.measureText(U);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in $e&&$e.actualBoundingBoxDescent>0){this._tmpCtx.save();const tt=new Path2D;tt.rect(st,Xe-Math.ceil(ve/2),this._config.deviceCellWidth*et,dt-Xe+Math.ceil(ve/2)),this._tmpCtx.clip(tt),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=W.css,this._tmpCtx.strokeText(U,ke,ke+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(te){const ve=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ae=ve%2==1?.5:0;this._tmpCtx.lineWidth=ve,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ke,ke+Ae),this._tmpCtx.lineTo(ke+this._config.deviceCharWidth*et,ke+Ae),this._tmpCtx.stroke()}if(Me||this._tmpCtx.fillText(U,ke,ke+this._config.deviceCharHeight),U==="_"&&!this._config.allowTransparency){let ve=E(this._tmpCtx.getImageData(ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight),W,re,Le);if(ve)for(let Ae=1;Ae<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(U,ke,ke+this._config.deviceCharHeight-Ae),ve=E(this._tmpCtx.getImageData(ke,ke,this._config.deviceCellWidth,this._config.deviceCellHeight),W,re,Le),ve);Ae++);}if(q){const ve=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ae=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=ve,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ke,ke+Math.floor(this._config.deviceCharHeight/2)-Ae),this._tmpCtx.lineTo(ke+this._config.deviceCharWidth*et,ke+Math.floor(this._config.deviceCharHeight/2)-Ae),this._tmpCtx.stroke()}this._tmpCtx.restore();const fe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Te;if(Te=this._config.allowTransparency?(function(ve){for(let Ae=0;Ae<ve.data.length;Ae+=4)if(ve.data[Ae+3]>0)return!1;return!0})(fe):E(fe,W,re,Le),Te)return p;const Ce=this._findGlyphBoundingBox(fe,this._workBoundingBox,V,pe,Me,ke);let Ee,Be;for(;;){if(this._activePages.length===0){const ve=this._createNewPage();Ee=ve,Be=ve.currentRow,Be.height=Ce.size.y;break}Ee=this._activePages[this._activePages.length-1],Be=Ee.currentRow;for(const ve of this._activePages)Ce.size.y<=ve.currentRow.height&&(Ee=ve,Be=ve.currentRow);for(let ve=this._activePages.length-1;ve>=0;ve--)for(const Ae of this._activePages[ve].fixedRows)Ae.height<=Be.height&&Ce.size.y<=Ae.height&&(Ee=this._activePages[ve],Be=Ae);if(Be.y+Ce.size.y>=Ee.canvas.height||Be.height>Ce.size.y+2){let ve=!1;if(Ee.currentRow.y+Ee.currentRow.height+Ce.size.y>=Ee.canvas.height){let Ae;for(const st of this._activePages)if(st.currentRow.y+st.currentRow.height+Ce.size.y<st.canvas.height){Ae=st;break}if(Ae)Ee=Ae;else if(k.maxAtlasPages&&this._pages.length>=k.maxAtlasPages&&Be.y+Ce.size.y<=Ee.canvas.height&&Be.height>=Ce.size.y&&Be.x+Ce.size.x<=Ee.canvas.width)ve=!0;else{const st=this._createNewPage();Ee=st,Be=st.currentRow,Be.height=Ce.size.y,ve=!0}}ve||(Ee.currentRow.height>0&&Ee.fixedRows.push(Ee.currentRow),Be={x:0,y:Ee.currentRow.y+Ee.currentRow.height,height:Ce.size.y},Ee.fixedRows.push(Be),Ee.currentRow={x:0,y:Be.y+Be.height,height:0})}if(Be.x+Ce.size.x<=Ee.canvas.width)break;Be===Ee.currentRow?(Be.x=0,Be.y+=Be.height,Be.height=0):Ee.fixedRows.splice(Ee.fixedRows.indexOf(Be),1)}return Ce.texturePage=this._pages.indexOf(Ee),Ce.texturePosition.x=Be.x,Ce.texturePosition.y=Be.y,Ce.texturePositionClipSpace.x=Be.x/Ee.canvas.width,Ce.texturePositionClipSpace.y=Be.y/Ee.canvas.height,Ce.sizeClipSpace.x/=Ee.canvas.width,Ce.sizeClipSpace.y/=Ee.canvas.height,Be.height=Math.max(Be.height,Ce.size.y),Be.x+=Ce.size.x,Ee.ctx.putImageData(fe,Ce.texturePosition.x-this._workBoundingBox.left,Ce.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Ce.size.x,Ce.size.y),Ee.addGlyph(Ce),Ee.version++,Ce}_findGlyphBoundingBox(T,N,B,F,O,U){N.top=0;const V=F?this._config.deviceCellHeight:this._tmpCanvas.height,Y=F?this._config.deviceCellWidth:B;let X=!1;for(let G=0;G<V;G++){for(let P=0;P<Y;P++){const $=G*this._tmpCanvas.width*4+4*P+3;if(T.data[$]!==0){N.top=G,X=!0;break}}if(X)break}N.left=0,X=!1;for(let G=0;G<U+Y;G++){for(let P=0;P<V;P++){const $=P*this._tmpCanvas.width*4+4*G+3;if(T.data[$]!==0){N.left=G,X=!0;break}}if(X)break}N.right=Y,X=!1;for(let G=U+Y-1;G>=U;G--){for(let P=0;P<V;P++){const $=P*this._tmpCanvas.width*4+4*G+3;if(T.data[$]!==0){N.right=G,X=!0;break}}if(X)break}N.bottom=V,X=!1;for(let G=V-1;G>=0;G--){for(let P=0;P<Y;P++){const $=G*this._tmpCanvas.width*4+4*P+3;if(T.data[$]!==0){N.bottom=G,X=!0;break}}if(X)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:N.right-N.left+1,y:N.bottom-N.top+1},sizeClipSpace:{x:N.right-N.left+1,y:N.bottom-N.top+1},offset:{x:-N.left+U+(F||O?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-N.top+U+(F||O?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}r.TextureAtlas=k;class D{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,N,B){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],B)for(const F of B)this._glyphs.push(...F.glyphs),this._usedPixels+=F._usedPixels;this.canvas=M(T,N,N),this.ctx=(0,u.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 E(b,T,N,B){const F=T.rgba>>>24,O=T.rgba>>>16&255,U=T.rgba>>>8&255,V=N.rgba>>>24,Y=N.rgba>>>16&255,X=N.rgba>>>8&255,G=Math.floor((Math.abs(F-V)+Math.abs(O-Y)+Math.abs(U-X))/12);let P=!0;for(let $=0;$<b.data.length;$+=4)b.data[$]===F&&b.data[$+1]===O&&b.data[$+2]===U||B&&Math.abs(b.data[$]-F)+Math.abs(b.data[$+1]-O)+Math.abs(b.data[$+2]-U)<G?b.data[$+3]=0:P=!1;return P}function M(b,T,N){const B=b.createElement("canvas");return B.width=T,B.height=N,B}},160:(x,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 c=0,g=0,_=0,u=0;var y,S,L,f,l;function m(d){const k=d.toString(16);return k.length<2?"0"+k:k}function p(d,k){return d<k?(k+.05)/(d+.05):(d+.05)/(k+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(k,D,E,M){return M!==void 0?`#${m(k)}${m(D)}${m(E)}${m(M)}`:`#${m(k)}${m(D)}${m(E)}`},d.toRgba=function(k,D,E,M=255){return(k<<24|D<<16|E<<8|M)>>>0},d.toColor=function(k,D,E,M){return{css:d.toCss(k,D,E,M),rgba:d.toRgba(k,D,E,M)}}})(y||(r.channels=y={})),(function(d){function k(D,E){return u=Math.round(255*E),[c,g,_]=l.toChannels(D.rgba),{css:y.toCss(c,g,_,u),rgba:y.toRgba(c,g,_,u)}}d.blend=function(D,E){if(u=(255&E.rgba)/255,u===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,T=E.rgba>>8&255,N=D.rgba>>24&255,B=D.rgba>>16&255,F=D.rgba>>8&255;return c=N+Math.round((M-N)*u),g=B+Math.round((b-B)*u),_=F+Math.round((T-F)*u),{css:y.toCss(c,g,_),rgba:y.toRgba(c,g,_)}},d.isOpaque=function(D){return(255&D.rgba)==255},d.ensureContrastRatio=function(D,E,M){const b=l.ensureContrastRatio(D.rgba,E.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(D){const E=(255|D.rgba)>>>0;return[c,g,_]=l.toChannels(E),{css:y.toCss(c,g,_),rgba:E}},d.opacity=k,d.multiplyOpacity=function(D,E){return u=255&D.rgba,k(D,u*E/255)},d.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(r.color=S={})),(function(d){let k,D;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(k=M,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),y.toColor(c,g,_);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),u=parseInt(E.slice(4,5).repeat(2),16),y.toColor(c,g,_,u);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const M=E.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 c=parseInt(M[1]),g=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,g,_,u);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=E,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,g,_,u]=k.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,g,_,u),css:E}}})(L||(r.css=L={})),(function(d){function k(D,E,M){const b=D/255,T=E/255,N=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*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))}d.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},d.relativeLuminance2=k})(f||(r.rgb=f={})),(function(d){function k(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F>0||O>0||U>0);)F-=Math.max(0,Math.ceil(.1*F)),O-=Math.max(0,Math.ceil(.1*O)),U-=Math.max(0,Math.ceil(.1*U)),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}function D(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F<255||O<255||U<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),O=Math.min(255,O+Math.ceil(.1*(255-O))),U=Math.min(255,U+Math.ceil(.1*(255-U))),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}d.blend=function(E,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,B=E>>24&255,F=E>>16&255,O=E>>8&255;return c=B+Math.round((b-B)*u),g=F+Math.round((T-F)*u),_=O+Math.round((N-O)*u),y.toRgba(c,g,_)},d.ensureContrastRatio=function(E,M,b){const T=f.relativeLuminance(E>>8),N=f.relativeLuminance(M>>8);if(p(T,N)<b){if(N<T){const O=k(E,M,b),U=p(T,f.relativeLuminance(O>>8));if(U<b){const V=D(E,M,b);return U>p(T,f.relativeLuminance(V>>8))?O:V}return O}const B=D(E,M,b),F=p(T,f.relativeLuminance(B>>8));if(F<b){const O=k(E,M,b);return F>p(T,f.relativeLuminance(O>>8))?B:O}return B}},d.reduceLuminance=k,d.increaseLuminance=D,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(l||(r.rgba=l={})),r.toPaddedHex=m,r.contrastRatio=p},345:(x,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=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){const _=[];for(let u=0;u<this._listeners.length;u++)_.push(this._listeners[u]);for(let u=0;u<_.length;u++)_[u].call(void 0,c,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(c,g){return c((_=>g.fire(_)))},r.runAndSubscribe=function(c,g){return g(void 0),c((_=>g(_)))}},859:(x,r)=>{function c(g){for(const _ of g)_.dispose();g.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 g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},r.toDisposable=function(g){return{dispose:g}},r.disposeArray=c,r.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},485:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(_,u,y){this._data[_]||(this._data[_]={}),this._data[_][u]=y}get(_,u){return this._data[_]?this._data[_][u]:void 0}clear(){this._data={}}}r.TwoKeyMap=c,r.FourKeyMap=class{constructor(){this._data=new c}set(g,_,u,y,S){this._data.get(g,_)||this._data.set(g,_,new c),this._data.get(g,_).set(u,y,S)}get(g,_,u,y){var S;return(S=this._data.get(g,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},399:(x,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 c=r.isNode?"node":navigator.userAgent,g=r.isNode?"node":navigator.platform;r.isFirefox=c.includes("Firefox"),r.isLegacyEdge=c.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(c),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),r.isIpad=g==="iPad",r.isIphone=g==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),r.isLinux=g.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(c)},385:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const g=c(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let L=0,f=0,l=S.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(L=Date.now(),this._tasks[this._i]()||this._i++,L=Math.max(1,Date.now()-L),f=Math.max(L,f),m=S.timeRemaining(),1.5*f>m)return l-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-L))}ms`),void this._start();l=m}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const L=Date.now()+S;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=u,r.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},147:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new g}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new c;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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=c;class g{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,y=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=y}clone(){return new g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=g},782:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const g=c(133),_=c(855),u=c(147);class y extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(L){const f=new y;return f.setFromCharData(L),f}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[_.CHAR_DATA_CHAR_INDEX].length===2){const l=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=l&&l<=56319){const m=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(l-55296)+m-56320+65536|L[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=y},855:(x,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:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},r.utf32ToString=function(c,g=0,_=c.length){let u="";for(let y=g;y<_;++y){let S=c[y];S>65535?(S-=65536,u+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):u+=String.fromCharCode(S)}return u},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?g[u++]=1024*(this._interim-55296)+S-56320+65536:(g[u++]=this._interim,g[u++]=S),this._interim=0}for(let S=y;S<_;++S){const L=c.charCodeAt(S);if(55296<=L&&L<=56319){if(++S>=_)return this._interim=L,u;const f=c.charCodeAt(S);56320<=f&&f<=57343?g[u++]=1024*(L-55296)+f-56320+65536:(g[u++]=L,g[u++]=f)}else L!==65279&&(g[u++]=L)}return u}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const _=c.length;if(!_)return 0;let u,y,S,L,f=0,l=0,m=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)D<<=6,D|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;m<T;){if(m>=_)return 0;if(E=c[m++],(192&E)!=128){m--,k=!0;break}this.interim[M++]=E,D<<=6,D|=63&E}k||(b===2?D<128?m--:g[f++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(g[f++]=D):D<65536||D>1114111||(g[f++]=D)),this.interim.fill(0)}const p=_-4;let d=m;for(;d<_;){for(;!(!(d<p)||128&(u=c[d])||128&(y=c[d+1])||128&(S=c[d+2])||128&(L=c[d+3]));)g[f++]=u,g[f++]=y,g[f++]=S,g[f++]=L,d+=4;if(u=c[d++],u<128)g[f++]=u;else if((224&u)==192){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(l=(31&u)<<6|63&y,l<128){d--;continue}g[f++]=l}else if((240&u)==224){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(l=(15&u)<<12|(63&y)<<6|63&S,l<2048||l>=55296&&l<=57343||l===65279)continue;g[f++]=l}else if((248&u)==240){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,f;if(L=c[d++],(192&L)!=128){d--;continue}if(l=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&L,l<65536||l>1114111)continue;g[f++]=l}}return f}}},776:function(x,r,c){var g=this&&this.__decorate||function(l,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,m,p,d);else for(var M=l.length-1;M>=0;M--)(k=l[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(l,m){return function(p,d){m(p,d,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const u=c(859),y=c(97),S={trace:y.LogLevelEnum.TRACE,debug:y.LogLevelEnum.DEBUG,info:y.LogLevelEnum.INFO,warn:y.LogLevelEnum.WARN,error:y.LogLevelEnum.ERROR,off:y.LogLevelEnum.OFF};let L,f=r.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(l){super(),this._optionsService=l,this._logLevel=y.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),L=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(l){for(let m=0;m<l.length;m++)typeof l[m]=="function"&&(l[m]=l[m]())}_log(l,m,p){this._evalLazyOptionalParams(p),l.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(l,...m){var p;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,l,m)}debug(l,...m){var p;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,l,m)}info(l,...m){var p;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,l,m)}warn(l,...m){var p;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,l,m)}error(l,...m){var p;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,l,m)}};r.LogService=f=g([_(0,y.IOptionsService)],f),r.setTraceLogger=function(l){L=l},r.traceCall=function(l,m,p){if(typeof p.value!="function")throw new Error("not supported");const d=p.value;p.value=function(...k){if(L.logLevel!==y.LogLevelEnum.TRACE)return d.apply(this,k);L.trace(`GlyphRenderer#${d.name}(${k.map((E=>JSON.stringify(E))).join(", ")})`);const D=d.apply(this,k);return L.trace(`GlyphRenderer#${d.name} return`,D),D}}},726:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const c="di$target",g="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[g]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const u=function(y,S,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,l,m){l[c]===l?l[g].push({id:f,index:m}):(l[g]=[{id:f,index:m}],l[c]=l)})(u,y,L)};return u.toString=()=>_,r.serviceRegistry.set(_,u),u}},97:(x,r,c)=>{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 g=c(726);var _;r.IBufferService=(0,g.createDecorator)("BufferService"),r.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),r.ICoreService=(0,g.createDecorator)("CoreService"),r.ICharsetService=(0,g.createDecorator)("CharsetService"),r.IInstantiationService=(0,g.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,g.createDecorator)("LogService"),r.IOptionsService=(0,g.createDecorator)("OptionsService"),r.IOscLinkService=(0,g.createDecorator)("OscLinkService"),r.IUnicodeService=(0,g.createDecorator)("UnicodeService"),r.IDecorationService=(0,g.createDecorator)("DecorationService")}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x].call(c.exports,c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.WebglAddon=void 0;const r=v(345),c=v(859),g=v(399),_=v(666),u=v(776);class y extends c.Disposable{constructor(L){if(g.isSafari&&(0,g.getSafariVersion)()<16){const f={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",f))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=L,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(L){const f=L._core;if(!L.element)return void this.register(f.onWillOpen((()=>this.activate(L))));this._terminal=L;const l=f.coreService,m=f.optionsService,p=f,d=p._renderService,k=p._characterJoinerService,D=p._charSizeService,E=p._coreBrowserService,M=p._decorationService,b=p._logService,T=p._themeService;(0,u.setTraceLogger)(b),this._renderer=this.register(new _.WebglRenderer(L,k,D,E,l,M,m,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,c.toDisposable)((()=>{const N=this._terminal._core._renderService;N.setRenderer(this._terminal._core._createRenderer()),N.handleResize(L.cols,L.rows)})))}get textureAtlas(){var L;return(L=this._renderer)==null?void 0:L.textureAtlas}clearTextureAtlas(){var L;(L=this._renderer)==null||L.clearTextureAtlas()}}x.WebglAddon=y})(),R})()))})(Ac)),Ac.exports}var N1=A1(),Nc={exports:{}},Tf;function D1(){return Tf||(Tf=1,(function(n,s){(function(i,h){n.exports=h()})(globalThis,(()=>(()=>{var i={4567:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const u=c(9042),y=c(9924),S=c(844),L=c(4725),f=c(2585),l=c(3656);let m=r.AccessibilityManager=class extends S.Disposable{constructor(p,d,k,D){super(),this._terminal=p,this._coreBrowserService=k,this._renderService=D,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 E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,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 y.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((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
109
- `)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,l.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(p){for(let d=0;d<p;d++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
110
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,d){this._liveRegionDebouncer.refresh(p,d,this._terminal.rows)}_renderRows(p,d){const k=this._terminal.buffer,D=k.lines.length.toString();for(let E=p;E<=d;E++){const M=k.lines.get(k.ydisp+E),b=[],T=(M==null?void 0:M.translateToString(!0,void 0,void 0,b))||"",N=(k.ydisp+E+1).toString(),B=this._rowElements[E];B&&(T.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=T,this._rowColumns.set(B,b)),B.setAttribute("aria-posinset",N),B.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,d){const k=p.target,D=this._rowElements[d===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(d===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==D)return;let E,M;if(d===0?(E=k,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(E=this._rowElements.shift(),M=k,this._rowContainer.removeChild(E)),E.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(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let d={node:p.anchorNode,offset:p.anchorOffset},k={node:p.focusNode,offset:p.focusOffset};if((d.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||d.node===k.node&&d.offset>k.offset)&&([d,k]=[k,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 D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((T=D.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(k.node))return;const E=({node:N,offset:B})=>{const F=N instanceof Text?N.parentNode:N;let O=parseInt(F==null?void 0:F.getAttribute("aria-posinset"),10)-1;if(isNaN(O))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(F);if(!U)return console.warn("columns is null. Race condition?"),null;let V=B<U.length?U[B]:U.slice(-1)[0]+1;return V>=this._terminal.cols&&(++O,V=0),{row:O,column:V}},M=E(d),b=E(k);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(p){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>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_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 p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=m=g([_(1,f.IInstantiationService),_(2,L.ICoreBrowserService),_(3,L.IRenderService)],m)},3614:(x,r)=>{function c(y){return y.replace(/\r?\n/g,"\r")}function g(y,S){return S?"\x1B[200~"+y+"\x1B[201~":y}function _(y,S,L,f){y=g(y=c(y),L.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),L.triggerDataEvent(y,!0),S.value=""}function u(y,S,L){const f=L.getBoundingClientRect(),l=y.clientX-f.left-10,m=y.clientY-f.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${l}px`,S.style.top=`${m}px`,S.style.zIndex="1000",S.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=c,r.bracketTextForPaste=g,r.copyHandler=function(y,S){y.clipboardData&&y.clipboardData.setData("text/plain",S.selectionText),y.preventDefault()},r.handlePasteEvent=function(y,S,L,f){y.stopPropagation(),y.clipboardData&&_(y.clipboardData.getData("text/plain"),S,L,f)},r.paste=_,r.moveTextAreaUnderMouseCursor=u,r.rightClickHandler=function(y,S,L,f,l){u(y,S,L),l&&f.rightClickSelect(y),S.value=f.selectionText,S.select()}},7239:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const g=c(1505);r.ColorContrastCache=class{constructor(){this._color=new g.TwoKeyMap,this._css=new g.TwoKeyMap}setCss(_,u,y){this._css.set(_,u,y)}getCss(_,u){return this._css.get(_,u)}setColor(_,u,y){this._color.set(_,u,y)}getColor(_,u){return this._color.get(_,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(c,g,_,u){c.addEventListener(g,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(g,_,u))}}}},3551:function(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const u=c(3656),y=c(8460),S=c(844),L=c(2585),f=c(4725);let l=r.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(m,p,d,k,D){super(),this._element=m,this._mouseService=p,this._renderService=d,this._bufferService=k,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{var E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const d=m.composedPath();for(let k=0;k<d.length;k++){const D=d[k];if(D.classList.contains("xterm"))break;if(D.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,p){var k,D;this._activeProviderReplies&&p||((k=this._activeProviderReplies)==null||k.forEach((E=>{E==null||E.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let d=!1;for(const[E,M]of this._linkProviderService.linkProviders.entries())p?(D=this._activeProviderReplies)!=null&&D.get(E)&&(d=this._checkLinkProviderResult(E,m,d)):M.provideLinks(m.y,(b=>{var N,B;if(this._isMouseOut)return;const T=b==null?void 0:b.map((F=>({link:F})));(N=this._activeProviderReplies)==null||N.set(E,T),d=this._checkLinkProviderResult(E,m,d),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,p){const d=new Set;for(let k=0;k<p.size;k++){const D=p.get(k);if(D)for(let E=0;E<D.length;E++){const M=D[E],b=M.link.range.start.y<m?0:M.link.range.start.x,T=M.link.range.end.y>m?this._bufferService.cols:M.link.range.end.x;for(let N=b;N<=T;N++){if(d.has(N)){D.splice(E--,1);break}d.add(N)}}}}_checkLinkProviderResult(m,p,d){var E;if(!this._activeProviderReplies)return d;const k=this._activeProviderReplies.get(m);let D=!1;for(let M=0;M<m;M++)this._activeProviderReplies.has(M)&&!this._activeProviderReplies.get(M)||(D=!0);if(!D&&k){const M=k.find((b=>this._linkAtPosition(b.link,p)));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=(E=this._activeProviderReplies.get(M))==null?void 0:E.find((T=>this._linkAtPosition(T.link,p)));if(b){d=!0,this._handleNewLink(b);break}}return d}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,p){this._currentLink&&this._lastMouseEvent&&(!m||!p||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(m.link,p)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var d,k;return(k=(d=this._currentLink)==null?void 0:d.state)==null?void 0:k.decorations.pointerCursor},set:d=>{var k;(k=this._currentLink)!=null&&k.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,k;return(k=(d=this._currentLink)==null?void 0:d.state)==null?void 0:k.decorations.underline},set:d=>{var k,D,E;(k=this._currentLink)!=null&&k.state&&((E=(D=this._currentLink)==null?void 0:D.state)==null?void 0:E.decorations.underline)!==d&&(this._currentLink.state.decorations.underline=d,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,d))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((d=>{if(!this._currentLink)return;const k=d.start===0?0:d.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+d.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(m,p,d){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(d,p.text)}_fireUnderlineEvent(m,p){const d=m.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-k-1,d.end.x,d.end.y-k-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(m,p,d){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(d,p.text)}_linkAtPosition(m,p){const d=m.range.start.y*this._bufferService.cols+m.range.start.x,k=m.range.end.y*this._bufferService.cols+m.range.end.x,D=p.y*this._bufferService.cols+p.x;return d<=D&&D<=k}_positionFromMouseEvent(m,p,d){const k=d.getCoords(m,p,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,p,d,k,D){return{x1:m,y1:p,x2:d,y2:k,cols:this._bufferService.cols,fg:D}}};r.Linkifier=l=g([_(1,f.IMouseService),_(2,f.IRenderService),_(3,L.IBufferService),_(4,f.ILinkProviderService)],l)},9042:(x,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(x,r,c){var g=this&&this.__decorate||function(f,l,m,p){var d,k=arguments.length,D=k<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,l,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(l,m,D):d(l,m))||D);return k>3&&D&&Object.defineProperty(l,m,D),D},_=this&&this.__param||function(f,l){return function(m,p){l(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const u=c(511),y=c(2585);let S=r.OscLinkProvider=class{constructor(f,l,m){this._bufferService=f,this._optionsService=l,this._oscLinkService=m}provideLinks(f,l){var T;const m=this._bufferService.buffer.lines.get(f-1);if(!m)return void l(void 0);const p=[],d=this._optionsService.rawOptions.linkHandler,k=new u.CellData,D=m.getTrimmedLength();let E=-1,M=-1,b=!1;for(let N=0;N<D;N++)if(M!==-1||m.hasContent(N)){if(m.loadCell(N,k),k.hasExtendedAttrs()&&k.extended.urlId){if(M===-1){M=N,E=k.extended.urlId;continue}b=k.extended.urlId!==E}else M!==-1&&(b=!0);if(b||M!==-1&&N===D-1){const B=(T=this._oscLinkService.getLinkData(E))==null?void 0:T.uri;if(B){const F={start:{x:M+1,y:f},end:{x:N+(b||N!==D-1?0:1),y:f}};let O=!1;if(!(d!=null&&d.allowNonHttpProtocols))try{const U=new URL(B);["http:","https:"].includes(U.protocol)||(O=!0)}catch{O=!0}O||p.push({text:B,range:F,activate:(U,V)=>d?d.activate(U,V,F):L(0,V),hover:(U,V)=>{var Y;return(Y=d==null?void 0:d.hover)==null?void 0:Y.call(d,U,V,F)},leave:(U,V)=>{var Y;return(Y=d==null?void 0:d.leave)==null?void 0:Y.call(d,U,V,F)}})}b=!1,k.hasExtendedAttrs()&&k.extended.urlId?(M=N,E=k.extended.urlId):(M=-1,E=-1)}}l(p)}};function L(f,l){if(confirm(`Do you want to navigate to ${l}?
111
-
112
- WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=S=g([_(0,y.IBufferService),_(1,y.IOptionsService),_(2,y.IOscLinkService)],S)},6193:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,g,_){this._rowCount=_,c=c!==void 0?c:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g,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 c=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const g=c(3614),_=c(3656),u=c(3551),y=c(9042),S=c(3730),L=c(1680),f=c(3107),l=c(5744),m=c(2950),p=c(1296),d=c(428),k=c(4269),D=c(5114),E=c(8934),M=c(3230),b=c(9312),T=c(4725),N=c(6731),B=c(8055),F=c(8969),O=c(8460),U=c(844),V=c(6114),Y=c(8437),X=c(2584),G=c(7399),P=c(5941),$=c(9074),H=c(2585),q=c(5435),te=c(4567),se=c(779);class le extends F.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(K={}){super(K),this.browser=V,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new O.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new O.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new O.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new O.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new O.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new O.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new O.EventEmitter),this._onBlur=this.register(new O.EventEmitter),this._onA11yCharEmitter=this.register(new O.EventEmitter),this._onA11yTabEmitter=this.register(new O.EventEmitter),this._onWillOpen=this.register(new O.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(se.LinkProviderService),this._instantiationService.setService(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,J)=>this.refresh(W,J)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,O.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,O.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,U.toDisposable)((()=>{var W,J;this._customKeyEventHandler=void 0,(J=(W=this.element)==null?void 0:W.parentNode)==null||J.removeChild(this.element)})))}_handleColorEvent(K){if(this._themeService)for(const W of K){let J,Z="";switch(W.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;"+W.index}switch(W.type){case 0:const de=B.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${Z};${(0,P.toRgbString)(de)}${X.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors((pe=>pe.ansi[W.index]=B.channels.toColor(...W.color)));else{const pe=J;this._themeService.modifyColors((re=>re[pe]=B.channels.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(K){K?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(K){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var K;return(K=this.textarea)==null?void 0:K.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.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 K=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(K);if(!W)return;const J=Math.min(this.buffer.x,this.cols-1),Z=this._renderService.dimensions.css.cell.height,de=W.getWidth(J),pe=this._renderService.dimensions.css.cell.width*de,re=this.buffer.y*this._renderService.dimensions.css.cell.height,ke=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ke+"px",this.textarea.style.top=re+"px",this.textarea.style.width=pe+"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",(W=>{this.hasSelection()&&(0,g.copyHandler)(W,this._selectionService)})));const K=W=>(0,g.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,_.addDisposableDomListener)(this.element,"paste",K)),V.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,g.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,g.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),V.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,g.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(K=>this._keyUp(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(K=>this._keyDown(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(K=>this._keyPress(K)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(K=>this._compositionHelper.compositionupdate(K)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(K=>this._inputEvent(K)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(K){var J;if(!K)throw new Error("Terminal requires a parent element.");if(K.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=K.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"),K.appendChild(this.element);const W=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.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),W.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",y.promptLabel),V.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(D.CoreBrowserService,this.textarea,K.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(N.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.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(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(L.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(f.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(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Z=>{!this._overviewRulerRenderer&&Z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,W=this.element;function J(pe){const re=K._mouseService.getMouseReportCoords(pe,K.screenElement);if(!re)return!1;let ke,Me;switch(pe.overrideType||pe.type){case"mousemove":Me=32,pe.buttons===void 0?(ke=3,pe.button!==void 0&&(ke=pe.button<3?pe.button:3)):ke=1&pe.buttons?0:4&pe.buttons?1:2&pe.buttons?2:3;break;case"mouseup":Me=0,ke=pe.button<3?pe.button:3;break;case"mousedown":Me=1,ke=pe.button<3?pe.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(pe)===!1||K.viewport.getLinesScrolled(pe)===0)return!1;Me=pe.deltaY<0?0:1,ke=4;break;default:return!1}return!(Me===void 0||ke===void 0||ke>4)&&K.coreMouseService.triggerMouseEvent({col:re.col,row:re.row,x:re.x,y:re.y,button:ke,action:Me,ctrl:pe.ctrlKey,alt:pe.altKey,shift:pe.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},de={mouseup:pe=>(J(pe),pe.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(pe)),wheel:pe=>(J(pe),this.cancel(pe,!0)),mousedrag:pe=>{pe.buttons&&J(pe)},mousemove:pe=>{pe.buttons||J(pe)}};this.register(this.coreMouseService.onProtocolChange((pe=>{pe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(pe)),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&pe?Z.mousemove||(W.addEventListener("mousemove",de.mousemove),Z.mousemove=de.mousemove):(W.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&pe?Z.wheel||(W.addEventListener("wheel",de.wheel,{passive:!1}),Z.wheel=de.wheel):(W.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&pe?Z.mouseup||(Z.mouseup=de.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&pe?Z.mousedrag||(Z.mousedrag=de.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(W,"mousedown",(pe=>{if(pe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(pe))return J(pe),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(pe)}))),this.register((0,_.addDisposableDomListener)(W,"wheel",(pe=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(pe)===!1)return!1;if(!this.buffer.hasScrollback){const re=this.viewport.getLinesScrolled(pe);if(re===0)return;const ke=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(pe.deltaY<0?"A":"B");let Me="";for(let et=0;et<Math.abs(re);et++)Me+=ke;return this.coreService.triggerDataEvent(Me,!0),this.cancel(pe,!0)}return this.viewport.handleWheel(pe)?this.cancel(pe):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(W,"touchstart",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(pe),this.cancel(pe)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(W,"touchmove",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(pe)?void 0:this.cancel(pe)}),{passive:!1}))}refresh(K,W){var J;(J=this._renderService)==null||J.refreshRows(K,W)}updateCursorStyle(K){var W;(W=this._selectionService)!=null&&W.shouldColumnSelect(K)?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(K,W,J=0){var Z;J===1?(super.scrollLines(K,W,J),this.refresh(0,this.rows-1)):(Z=this.viewport)==null||Z.scrollLines(K)}paste(K){(0,g.paste)(K,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(K){this._customKeyEventHandler=K}attachCustomWheelEventHandler(K){this._customWheelEventHandler=K}registerLinkProvider(K){return this._linkProviderService.registerLinkProvider(K)}registerCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(K);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(K)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(K){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)}registerDecoration(K){return this._decorationService.registerDecoration(K)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(K,W,J){this._selectionService.setSelection(K,W,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 K;(K=this._selectionService)==null||K.clearSelection()}selectAll(){var K;(K=this._selectionService)==null||K.selectAll()}selectLines(K,W){var J;(J=this._selectionService)==null||J.selectLines(K,W)}_keyDown(K){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&K.altKey;if(!W&&!this._compositionHelper.keydown(K))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||K.key!=="Dead"&&K.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const J=(0,G.evaluateKeyboardEvent)(K,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),J.type===3||J.type===2){const Z=this.rows-1;return this.scrollLines(J.type===2?-Z:Z),this.cancel(K,!0)}return J.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(J.cancel&&this.cancel(K,!0),!J.key||!!(K.key&&!K.ctrlKey&&!K.altKey&&!K.metaKey&&K.key.length===1&&K.key.charCodeAt(0)>=65&&K.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(J.key!==X.C0.ETX&&J.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:J.key,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(J.key,!0),!this.optionsService.rawOptions.screenReaderMode||K.altKey||K.ctrlKey?this.cancel(K,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(K,W){const J=K.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||K.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||K.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?J:J&&(!W.keyCode||W.keyCode>47)}_keyUp(K){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(K)||this.focus(),this.updateCursorStyle(K),this._keyPressHandled=!1)}_keyPress(K){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)W=K.charCode;else if(K.which===null||K.which===void 0)W=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;W=K.which}return!(!W||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(K){if(K.data&&K.inputType==="insertText"&&(!K.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=K.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(K),!0}return!1}resize(K,W){K!==this.cols||W!==this.rows?super.resize(K,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(K,W){var J,Z;(J=this._charSizeService)==null||J.measure(),(Z=this.viewport)==null||Z.syncScrollArea(!0)}clear(){var K;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 W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(Y.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(K=this.viewport)==null||K.reset(),this.refresh(0,this.rows-1)}}reset(){var W,J;this.options.rows=this.rows,this.options.cols=this.cols;const K=this._customKeyEventHandler;this._setup(),super.reset(),(W=this._selectionService)==null||W.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1)}clearTextureAtlas(){var K;(K=this._renderService)==null||K.clearTextureAtlas()}_reportFocus(){var K;(K=this.element)!=null&&K.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case q.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const W=this._renderService.dimensions.css.canvas.width.toFixed(0),J=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${J};${W}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),de=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${de};${Z}t`)}}cancel(K,W){if(this.options.cancelEvents||W)return K.preventDefault(),K.stopPropagation(),!1}}r.Terminal=le},9924:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(c,g=1e3){this._renderCallback=c,this._debounceThresholdMS=g,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,g,_){this._rowCount=_,c=c!==void 0?c:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const y=u-this._lastRefreshMs,S=this._debounceThresholdMS-y;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g)}}},1680:function(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const u=c(3656),y=c(4725),S=c(8460),L=c(844),f=c(2585);let l=r.Viewport=class extends L.Disposable{constructor(m,p,d,k,D,E,M,b){super(),this._viewportElement=m,this._scrollArea=p,this._bufferService=d,this._optionsService=k,this._charSizeService=D,this._renderService=E,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 S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.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(m){this._viewportElement.style.backgroundColor=m.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(m){if(m)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 p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){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 p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<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(m,p){const d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&d<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const p=this._getPixelsScrolled(m);return p!==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+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(m,p){var b;let d,k="";const D=[],E=p??this._bufferService.buffer.lines.length,M=this._bufferService.buffer.lines;for(let T=m;T<E;T++){const N=M.get(T);if(!N)continue;const B=(b=M.get(T+1))==null?void 0:b.isWrapped;if(k+=N.translateToString(!B),!B||T===M.length-1){const F=document.createElement("div");F.textContent=k,D.push(F),k.length>0&&(d=F),k=""}}return{bufferElements:D,cursorElement:d}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(m,p){const d=this._optionsService.rawOptions.fastScrollModifier;return d==="alt"&&p.altKey||d==="ctrl"&&p.ctrlKey||d==="shift"&&p.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const p=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}};r.Viewport=l=g([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,y.ICharSizeService),_(5,y.IRenderService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],l)},3107:function(x,r,c){var g=this&&this.__decorate||function(f,l,m,p){var d,k=arguments.length,D=k<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,l,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(l,m,D):d(l,m))||D);return k>3&&D&&Object.defineProperty(l,m,D),D},_=this&&this.__param||function(f,l){return function(m,p){l(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const u=c(4725),y=c(844),S=c(2585);let L=r.BufferDecorationRenderer=class extends y.Disposable{constructor(f,l,m,p,d){super(),this._screenElement=f,this._bufferService=l,this._coreBrowserService=m,this._decorationService=p,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((k=>this._removeDecoration(k)))),this.register((0,y.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 f of this._decorationService.decorations)this._renderDecoration(f);this._dimensionsChanged=!1}_renderDecoration(f){this._refreshStyle(f),this._dimensionsChanged&&this._refreshXPosition(f)}_createElement(f){var p;const l=this._coreBrowserService.mainDocument.createElement("div");l.classList.add("xterm-decoration"),l.classList.toggle("xterm-decoration-top-layer",((p=f==null?void 0:f.options)==null?void 0:p.layer)==="top"),l.style.width=`${Math.round((f.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,l.style.height=(f.options.height||1)*this._renderService.dimensions.css.cell.height+"px",l.style.top=(f.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",l.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=f.options.x??0;return m&&m>this._bufferService.cols&&(l.style.display="none"),this._refreshXPosition(f,l),l}_refreshStyle(f){const l=f.marker.line-this._bufferService.buffers.active.ydisp;if(l<0||l>=this._bufferService.rows)f.element&&(f.element.style.display="none",f.onRenderEmitter.fire(f.element));else{let m=this._decorationElements.get(f);m||(m=this._createElement(f),f.element=m,this._decorationElements.set(f,m),this._container.appendChild(m),f.onDispose((()=>{this._decorationElements.delete(f),m.remove()}))),m.style.top=l*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(m)}}_refreshXPosition(f,l=f.element){if(!l)return;const m=f.options.x??0;(f.options.anchor||"left")==="right"?l.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":l.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(f){var l;(l=this._decorationElements.get(f))==null||l.remove(),this._decorationElements.delete(f),f.dispose()}};r.BufferDecorationRenderer=L=g([_(1,S.IBufferService),_(2,u.ICoreBrowserService),_(3,S.IDecorationService),_(4,u.IRenderService)],L)},5871:(x,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(c){if(c.options.overviewRulerOptions){for(const g of this._zones)if(g.color===c.options.overviewRulerOptions.color&&g.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(g,c.marker.line))return;if(this._lineAdjacentToZone(g,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(g,c.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=c.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=c.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=c.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=c.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:c.options.overviewRulerOptions.color,position:c.options.overviewRulerOptions.position,startBufferLine:c.marker.line,endBufferLine:c.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(c){this._linePadding=c}_lineIntersectsZone(c,g){return g>=c.startBufferLine&&g<=c.endBufferLine}_lineAdjacentToZone(c,g,_){return g>=c.startBufferLine-this._linePadding[_||"full"]&&g<=c.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(c,g){c.startBufferLine=Math.min(c.startBufferLine,g),c.endBufferLine=Math.max(c.endBufferLine,g)}}},5744:function(x,r,c){var g=this&&this.__decorate||function(d,k,D,E){var M,b=arguments.length,T=b<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,D):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,k,D,E);else for(var N=d.length-1;N>=0;N--)(M=d[N])&&(T=(b<3?M(T):b>3?M(k,D,T):M(k,D))||T);return b>3&&T&&Object.defineProperty(k,D,T),T},_=this&&this.__param||function(d,k){return function(D,E){k(D,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const u=c(5871),y=c(4725),S=c(844),L=c(2585),f={full:0,left:0,center:0,right:0},l={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let p=r.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(d,k,D,E,M,b,T){var B;super(),this._viewportElement=d,this._screenElement=k,this._bufferService=D,this._decorationService=E,this._renderService=M,this._optionsService=b,this._coreBrowserService=T,this._colorZoneStore=new u.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 N=this._canvas.getContext("2d");if(!N)throw new Error("Ctx cannot be null");this._ctx=N,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.toDisposable)((()=>{var F;(F=this._canvas)==null||F.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),k=Math.ceil(this._canvas.width/3);l.full=this._canvas.width,l.left=d,l.center=k,l.right=d,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=l.left,m.right=l.left+l.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const d=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(d,12),6)*this._coreBrowserService.dpr);f.left=k,f.center=k,f.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const d=this._colorZoneStore.zones;for(const k of d)k.position!=="full"&&this._renderColorZone(k);for(const k of d)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(d){this._ctx.fillStyle=d.color,this._ctx.fillRect(m[d.position||"full"],Math.round((this._canvas.height-1)*(d.startBufferLine/this._bufferService.buffers.active.lines.length)-f[d.position||"full"]/2),l[d.position||"full"],Math.round((this._canvas.height-1)*((d.endBufferLine-d.startBufferLine)/this._bufferService.buffers.active.lines.length)+f[d.position||"full"]))}_queueRefresh(d,k){this._shouldUpdateDimensions=d||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=p=g([_(2,L.IBufferService),_(3,L.IDecorationService),_(4,y.IRenderService),_(5,L.IOptionsService),_(6,y.ICoreBrowserService)],p)},2950:function(x,r,c){var g=this&&this.__decorate||function(f,l,m,p){var d,k=arguments.length,D=k<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,l,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(l,m,D):d(l,m))||D);return k>3&&D&&Object.defineProperty(l,m,D),D},_=this&&this.__param||function(f,l){return function(m,p){l(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const u=c(4725),y=c(2585),S=c(2584);let L=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,l,m,p,d,k){this._textarea=f,this._compositionView=l,this._bufferService=m,this._optionsService=p,this._coreService=d,this._renderService=k,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(f){this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(f){if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){const l={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,l.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(l.start,l.end):this._textarea.value.substring(l.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const l=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(l,!0)}}_handleAnyTextareaChanges(){const f=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const l=this._textarea.value,m=l.replace(f,"");this._dataAlreadySent=m,l.length>f.length?this._coreService.triggerDataEvent(m,!0):l.length<f.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):l.length===f.length&&l!==f&&this._coreService.triggerDataEvent(l,!0)}}),0)}updateCompositionElements(f){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const l=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,d=l*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=d+"px",this._compositionView.style.top=p+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=d+"px",this._textarea.style.top=p+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}f||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=L=g([_(2,y.IBufferService),_(3,y.IOptionsService),_(4,y.ICoreService),_(5,u.IRenderService)],L)},9806:(x,r)=>{function c(g,_,u){const y=u.getBoundingClientRect(),S=g.getComputedStyle(u),L=parseInt(S.getPropertyValue("padding-left")),f=parseInt(S.getPropertyValue("padding-top"));return[_.clientX-y.left-L,_.clientY-y.top-f]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=c,r.getCoords=function(g,_,u,y,S,L,f,l,m){if(!L)return;const p=c(g,_,u);return p?(p[0]=Math.ceil((p[0]+(m?f/2:0))/f),p[1]=Math.ceil(p[1]/l),p[0]=Math.min(Math.max(p[0],1),y+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),S),p):void 0}},9504:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const g=c(2584);function _(l,m,p,d){const k=l-u(l,p),D=m-u(m,p),E=Math.abs(k-D)-(function(M,b,T){let N=0;const B=M-u(M,T),F=b-u(b,T);for(let O=0;O<Math.abs(B-F);O++){const U=y(M,b)==="A"?-1:1,V=T.buffer.lines.get(B+U*O);V!=null&&V.isWrapped&&N++}return N})(l,m,p);return f(E,L(y(l,m),d))}function u(l,m){let p=0,d=m.buffer.lines.get(l),k=d==null?void 0:d.isWrapped;for(;k&&l>=0&&l<m.rows;)p++,d=m.buffer.lines.get(--l),k=d==null?void 0:d.isWrapped;return p}function y(l,m){return l>m?"A":"B"}function S(l,m,p,d,k,D){let E=l,M=m,b="";for(;E!==p||M!==d;)E+=k?1:-1,k&&E>D.cols-1?(b+=D.buffer.translateBufferLineToString(M,!1,l,E),E=0,l=0,M++):!k&&E<0&&(b+=D.buffer.translateBufferLineToString(M,!1,0,l+1),E=D.cols-1,l=E,M--);return b+D.buffer.translateBufferLineToString(M,!1,l,E)}function L(l,m){const p=m?"O":"[";return g.C0.ESC+p+l}function f(l,m){l=Math.floor(l);let p="";for(let d=0;d<l;d++)p+=m;return p}r.moveToCellSequence=function(l,m,p,d){const k=p.buffer.x,D=p.buffer.y;if(!p.buffer.hasScrollback)return(function(b,T,N,B,F,O){return _(T,B,F,O).length===0?"":f(S(b,T,b,T-u(T,F),!1,F).length,L("D",O))})(k,D,0,m,p,d)+_(D,m,p,d)+(function(b,T,N,B,F,O){let U;U=_(T,B,F,O).length>0?B-u(B,F):T;const V=B,Y=(function(X,G,P,$,H,q){let te;return te=_(P,$,H,q).length>0?$-u($,H):G,X<P&&te<=$||X>=P&&te<$?"C":"D"})(b,T,N,B,F,O);return f(S(b,U,N,V,Y==="C",F).length,L(Y,O))})(k,D,l,m,p,d);let E;if(D===m)return E=k>l?"D":"C",f(Math.abs(k-l),L(E,d));E=D>m?"D":"C";const M=Math.abs(D-m);return f((function(b,T){return T.cols-b})(D>m?l:k,p)+(M-1)*p.cols+1+((D>m?k:l)-1),L(E,d))}},1296:function(x,r,c){var g=this&&this.__decorate||function(O,U,V,Y){var X,G=arguments.length,P=G<3?U:Y===null?Y=Object.getOwnPropertyDescriptor(U,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(O,U,V,Y);else for(var $=O.length-1;$>=0;$--)(X=O[$])&&(P=(G<3?X(P):G>3?X(U,V,P):X(U,V))||P);return G>3&&P&&Object.defineProperty(U,V,P),P},_=this&&this.__param||function(O,U){return function(V,Y){U(V,Y,O)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const u=c(3787),y=c(2550),S=c(2223),L=c(6171),f=c(6052),l=c(4725),m=c(8055),p=c(8460),d=c(844),k=c(2585),D="xterm-dom-renderer-owner-",E="xterm-rows",M="xterm-fg-",b="xterm-bg-",T="xterm-focus",N="xterm-selection";let B=1,F=r.DomRenderer=class extends d.Disposable{constructor(O,U,V,Y,X,G,P,$,H,q,te,se,le){super(),this._terminal=O,this._document=U,this._element=V,this._screenElement=Y,this._viewportElement=X,this._helperContainer=G,this._linkifier2=P,this._charSizeService=H,this._optionsService=q,this._bufferService=te,this._coreBrowserService=se,this._themeService=le,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),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(N),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,L.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ue=>this._injectCss(ue)))),this._injectCss(this._themeService.colors),this._rowFactory=$.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ue=>this._handleLinkHover(ue)))),this.register(this._linkifier2.onHideLinkUnderline((ue=>this._handleLinkLeave(ue)))),this.register((0,d.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new y.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 O=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*O,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*O),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/O),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/O),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 V of this._rowElements)V.style.width=`${this.dimensions.css.canvas.width}px`,V.style.height=`${this.dimensions.css.cell.height}px`,V.style.lineHeight=`${this.dimensions.css.cell.height}px`,V.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const U=`${this._terminalSelector} .${E} 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(O){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${E} { color: ${O.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${E} .xterm-dim { color: ${m.color.multiplyOpacity(O.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 V=`blink_underline_${this._terminalClass}`,Y=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;U+=`@keyframes ${V} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${Y} { 50% { box-shadow: none; }}`,U+=`@keyframes ${X} { 0% { background-color: ${O.cursor.css}; color: ${O.cursorAccent.css}; } 50% { background-color: inherit; color: ${O.cursor.css}; }}`,U+=`${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${O.cursor.css}; color: ${O.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${O.cursor.css} !important; color: ${O.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${O.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${O.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${O.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${N} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${N} div { position: absolute; background-color: ${O.selectionBackgroundOpaque.css};}${this._terminalSelector} .${N} div { position: absolute; background-color: ${O.selectionInactiveBackgroundOpaque.css};}`;for(const[G,P]of O.ansi.entries())U+=`${this._terminalSelector} .${M}${G} { color: ${P.css}; }${this._terminalSelector} .${M}${G}.xterm-dim { color: ${m.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${b}${G} { background-color: ${P.css}; }`;U+=`${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(O.background).css}; }${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(O.background),.5).css}; }${this._terminalSelector} .${b}${S.INVERTED_DEFAULT_COLOR} { background-color: ${O.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const O=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${O}px`,this._rowFactory.defaultSpacing=O}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(O,U){for(let V=this._rowElements.length;V<=U;V++){const Y=this._document.createElement("div");this._rowContainer.appendChild(Y),this._rowElements.push(Y)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(O,U){this._refreshRowElements(O,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(O,U,V){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(O,U,V),this.renderRows(0,this._bufferService.rows-1),!O||!U)return;this._selectionRenderModel.update(this._terminal,O,U,V);const Y=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,G=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(G>=this._bufferService.rows||P<0)return;const $=this._document.createDocumentFragment();if(V){const H=O[0]>U[0];$.appendChild(this._createSelectionElement(G,H?U[0]:O[0],H?O[0]:U[0],P-G+1))}else{const H=Y===G?O[0]:0,q=G===X?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(G,H,q));const te=P-G-1;if($.appendChild(this._createSelectionElement(G+1,0,this._bufferService.cols,te)),G!==P){const se=X===P?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(P,0,se))}}this._selectionContainer.appendChild($)}_createSelectionElement(O,U,V,Y=1){const X=this._document.createElement("div"),G=U*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(V-U);return G+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-G),X.style.height=Y*this.dimensions.css.cell.height+"px",X.style.top=O*this.dimensions.css.cell.height+"px",X.style.left=`${G}px`,X.style.width=`${P}px`,X}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 O of this._rowElements)O.replaceChildren()}renderRows(O,U){const V=this._bufferService.buffer,Y=V.ybase+V.y,X=Math.min(V.x,this._bufferService.cols-1),G=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=O;H<=U;H++){const q=H+V.ydisp,te=this._rowElements[H],se=V.lines.get(q);if(!te||!se)break;te.replaceChildren(...this._rowFactory.createRow(se,q,q===Y,P,$,X,G,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(O){this._setCellUnderline(O.x1,O.x2,O.y1,O.y2,O.cols,!0)}_handleLinkLeave(O){this._setCellUnderline(O.x1,O.x2,O.y1,O.y2,O.cols,!1)}_setCellUnderline(O,U,V,Y,X,G){V<0&&(O=0),Y<0&&(U=0);const P=this._bufferService.rows-1;V=Math.max(Math.min(V,P),0),Y=Math.max(Math.min(Y,P),0),X=Math.min(X,this._bufferService.cols);const $=this._bufferService.buffer,H=$.ybase+$.y,q=Math.min($.x,X-1),te=this._optionsService.rawOptions.cursorBlink,se=this._optionsService.rawOptions.cursorStyle,le=this._optionsService.rawOptions.cursorInactiveStyle;for(let ue=V;ue<=Y;++ue){const K=ue+$.ydisp,W=this._rowElements[ue],J=$.lines.get(K);if(!W||!J)break;W.replaceChildren(...this._rowFactory.createRow(J,K,K===H,se,le,q,te,this.dimensions.css.cell.width,this._widthCache,G?ue===V?O:0:-1,G?(ue===Y?U:X)-1:-1))}}};r.DomRenderer=F=g([_(7,k.IInstantiationService),_(8,l.ICharSizeService),_(9,k.IOptionsService),_(10,k.IBufferService),_(11,l.ICoreBrowserService),_(12,l.IThemeService)],F)},3787:function(x,r,c){var g=this&&this.__decorate||function(E,M,b,T){var N,B=arguments.length,F=B<3?M:T===null?T=Object.getOwnPropertyDescriptor(M,b):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(E,M,b,T);else for(var O=E.length-1;O>=0;O--)(N=E[O])&&(F=(B<3?N(F):B>3?N(M,b,F):N(M,b))||F);return B>3&&F&&Object.defineProperty(M,b,F),F},_=this&&this.__param||function(E,M){return function(b,T){M(b,T,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const u=c(2223),y=c(643),S=c(511),L=c(2585),f=c(8055),l=c(4725),m=c(4269),p=c(6171),d=c(3734);let k=r.DomRendererRowFactory=class{constructor(E,M,b,T,N,B,F){this._document=E,this._characterJoinerService=M,this._optionsService=b,this._coreBrowserService=T,this._coreService=N,this._decorationService=B,this._themeService=F,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,M,b){this._selectionStart=E,this._selectionEnd=M,this._columnSelectMode=b}createRow(E,M,b,T,N,B,F,O,U,V,Y){const X=[],G=this._characterJoinerService.getJoinedCharacters(M),P=this._themeService.colors;let $,H=E.getNoBgTrimmedLength();b&&H<B+1&&(H=B+1);let q=0,te="",se=0,le=0,ue=0,K=!1,W=0,J=!1,Z=0;const de=[],pe=V!==-1&&Y!==-1;for(let re=0;re<H;re++){E.loadCell(re,this._workCell);let ke=this._workCell.getWidth();if(ke===0)continue;let Me=!1,et=re,Le=this._workCell;if(G.length>0&&re===G[0][0]){Me=!0;const We=G.shift();Le=new m.JoinedCellData(this._workCell,E.translateToString(!0,We[0],We[1]),We[1]-We[0]),et=We[1]-1,ke=Le.getWidth()}const fe=this._isCellInSelection(re,M),Te=b&&re===B,Ce=pe&&re>=V&&re<=Y;let Ee=!1;this._decorationService.forEachDecorationAtCell(re,M,void 0,(We=>{Ee=!0}));let Be=Le.getChars()||y.WHITESPACE_CELL_CHAR;if(Be===" "&&(Le.isUnderline()||Le.isOverline())&&(Be=" "),Z=ke*O-U.get(Be,Le.isBold(),Le.isItalic()),$){if(q&&(fe&&J||!fe&&!J&&Le.bg===se)&&(fe&&J&&P.selectionForeground||Le.fg===le)&&Le.extended.ext===ue&&Ce===K&&Z===W&&!Te&&!Me&&!Ee){Le.isInvisible()?te+=y.WHITESPACE_CELL_CHAR:te+=Be,q++;continue}q&&($.textContent=te),$=this._document.createElement("span"),q=0,te=""}else $=this._document.createElement("span");if(se=Le.bg,le=Le.fg,ue=Le.extended.ext,K=Ce,W=Z,J=fe,Me&&B>=re&&B<=et&&(B=re),!this._coreService.isCursorHidden&&Te&&this._coreService.isCursorInitialized){if(de.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&de.push("xterm-cursor-blink"),de.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(N)switch(N){case"outline":de.push("xterm-cursor-outline");break;case"block":de.push("xterm-cursor-block");break;case"bar":de.push("xterm-cursor-bar");break;case"underline":de.push("xterm-cursor-underline")}}if(Le.isBold()&&de.push("xterm-bold"),Le.isItalic()&&de.push("xterm-italic"),Le.isDim()&&de.push("xterm-dim"),te=Le.isInvisible()?y.WHITESPACE_CELL_CHAR:Le.getChars()||y.WHITESPACE_CELL_CHAR,Le.isUnderline()&&(de.push(`xterm-underline-${Le.extended.underlineStyle}`),te===" "&&(te=" "),!Le.isUnderlineColorDefault()))if(Le.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${d.AttributeData.toColorRGB(Le.getUnderlineColor()).join(",")})`;else{let We=Le.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Le.isBold()&&We<8&&(We+=8),$.style.textDecorationColor=P.ansi[We].css}Le.isOverline()&&(de.push("xterm-overline"),te===" "&&(te=" ")),Le.isStrikethrough()&&de.push("xterm-strikethrough"),Ce&&($.style.textDecoration="underline");let ve=Le.getFgColor(),Ae=Le.getFgColorMode(),st=Le.getBgColor(),Xe=Le.getBgColorMode();const Qe=!!Le.isInverse();if(Qe){const We=ve;ve=st,st=We;const ot=Ae;Ae=Xe,Xe=ot}let dt,ht,$e,tt=!1;switch(this._decorationService.forEachDecorationAtCell(re,M,void 0,(We=>{We.options.layer!=="top"&&tt||(We.backgroundColorRGB&&(Xe=50331648,st=We.backgroundColorRGB.rgba>>8&16777215,dt=We.backgroundColorRGB),We.foregroundColorRGB&&(Ae=50331648,ve=We.foregroundColorRGB.rgba>>8&16777215,ht=We.foregroundColorRGB),tt=We.options.layer==="top")})),!tt&&fe&&(dt=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,st=dt.rgba>>8&16777215,Xe=50331648,tt=!0,P.selectionForeground&&(Ae=50331648,ve=P.selectionForeground.rgba>>8&16777215,ht=P.selectionForeground)),tt&&de.push("xterm-decoration-top"),Xe){case 16777216:case 33554432:$e=P.ansi[st],de.push(`xterm-bg-${st}`);break;case 50331648:$e=f.channels.toColor(st>>16,st>>8&255,255&st),this._addStyle($,`background-color:#${D((st>>>0).toString(16),"0",6)}`);break;default:Qe?($e=P.foreground,de.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):$e=P.background}switch(dt||Le.isDim()&&(dt=f.color.multiplyOpacity($e,.5)),Ae){case 16777216:case 33554432:Le.isBold()&&ve<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ve+=8),this._applyMinimumContrast($,$e,P.ansi[ve],Le,dt,void 0)||de.push(`xterm-fg-${ve}`);break;case 50331648:const We=f.channels.toColor(ve>>16&255,ve>>8&255,255&ve);this._applyMinimumContrast($,$e,We,Le,dt,ht)||this._addStyle($,`color:#${D(ve.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,$e,P.foreground,Le,dt,ht)||Qe&&de.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}de.length&&($.className=de.join(" "),de.length=0),Te||Me||Ee?$.textContent=te:q++,Z!==this.defaultSpacing&&($.style.letterSpacing=`${Z}px`),X.push($),re=et}return $&&q&&($.textContent=te),X}_applyMinimumContrast(E,M,b,T,N,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const F=this._getContrastCache(T);let O;if(N||B||(O=F.getColor(M.rgba,b.rgba)),O===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);O=f.color.ensureContrastRatio(N||M,B||b,U),F.setColor((N||M).rgba,(B||b).rgba,O??null)}return!!O&&(this._addStyle(E,`color:${O.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,M){E.setAttribute("style",`${E.getAttribute("style")||""}${M};`)}_isCellInSelection(E,M){const b=this._selectionStart,T=this._selectionEnd;return!(!b||!T)&&(this._columnSelectMode?b[0]<=T[0]?E>=b[0]&&M>=b[1]&&E<T[0]&&M<=T[1]:E<b[0]&&M>=b[1]&&E>=T[0]&&M<=T[1]:M>b[1]&&M<T[1]||b[1]===T[1]&&M===b[1]&&E>=b[0]&&E<T[0]||b[1]<T[1]&&M===T[1]&&E<T[0]||b[1]<T[1]&&M===b[1]&&E>=b[0])}};function D(E,M,b){for(;E.length<b;)E=M+E;return E}r.DomRendererRowFactory=k=g([_(1,l.ICharacterJoinerService),_(2,L.IOptionsService),_(3,l.ICoreBrowserService),_(4,L.ICoreService),_(5,L.IDecorationService),_(6,l.IThemeService)],k)},2550:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(c,g){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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 _=c.createElement("span");_.classList.add("xterm-char-measure-element");const u=c.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const y=c.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontStyle="italic";const S=c.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[_,u,y,S],this._container.appendChild(_),this._container.appendChild(u),this._container.appendChild(y),this._container.appendChild(S),g.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(c,g,_,u){c===this._font&&g===this._fontSize&&_===this._weight&&u===this._weightBold||(this._font=c,this._fontSize=g,this._weight=_,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(c,g,_){let u=0;if(!g&&!_&&c.length===1&&(u=c.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const L=this._measure(c,0);return L>0&&(this._flat[u]=L),L}let y=c;g&&(y+="B"),_&&(y+="I");let S=this._holey.get(y);if(S===void 0){let L=0;g&&(L|=1),_&&(L|=2),S=this._measure(c,L),S>0&&this._holey.set(y,S)}return S}_measure(c,g){const _=this._measureElements[g];return _.textContent=c.repeat(32),_.offsetWidth/32}}},2223:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const g=c(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},6171:(x,r)=>{function c(_){return 57508<=_&&_<=57558}function g(_){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=c,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=g,r.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!g(_)&&!c(_)&&!(function(L){return 57344<=L&&L<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=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(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},6052:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class c{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(_,u,y,S=!1){if(this.selectionStart=u,this.selectionEnd=y,!u||!y||u[0]===y[0]&&u[1]===y[1])return void this.clear();const L=_.buffers.active.ydisp,f=u[1]-L,l=y[1]-L,m=Math.max(f,0),p=Math.min(l,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=f,this.viewportEndRow=l,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,this.startCol=u[0],this.endCol=y[0])}isCellSelected(_,u,y){return!!this.hasSelection&&(y-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&y>=this.viewportCappedStartRow&&u<this.endCol&&y<=this.viewportCappedEndRow:u<this.startCol&&y>=this.viewportCappedStartRow&&u>=this.endCol&&y<=this.viewportCappedEndRow:y>this.viewportStartRow&&y<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportStartRow&&u>=this.startCol)}}r.createSelectionRenderModel=function(){return new c}},456:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(c){this._bufferService=c,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 c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,g=this.selectionEnd;return!(!c||!g)&&(c[1]>g[1]||c[1]===g[1]&&c[0]>g[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const u=c(2585),y=c(8460),S=c(844);let L=r.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,d,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new y.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new l(p,d,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};r.CharSizeService=L=g([_(2,u.IOptionsService)],L);class f extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(d,k){d!==void 0&&d>0&&k!==void 0&&k>0&&(this._result.width=d,this._result.height=k)}}class l extends f{constructor(d,k,D){super(),this._document=d,this._parentElement=k,this._optionsService=D,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 m extends f{constructor(d){super(),this._optionsService=d,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))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(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const u=c(3734),y=c(643),S=c(511),L=c(2585);class f extends u.AttributeData{constructor(p,d,k){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=d,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(p){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=f;let l=r.CharacterJoinerService=class jm{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(p){const d={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(d),d.id}deregister(p){for(let d=0;d<this._characterJoiners.length;d++)if(this._characterJoiners[d].id===p)return this._characterJoiners.splice(d,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const d=this._bufferService.buffer.lines.get(p);if(!d||d.length===0)return[];const k=[],D=d.translateToString(!0);let E=0,M=0,b=0,T=d.getFg(0),N=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!==N){if(B-E>1){const F=this._getJoinedRanges(D,b,M,d,E);for(let O=0;O<F.length;O++)k.push(F[O])}E=B,b=M,T=this._workCell.fg,N=this._workCell.bg}M+=this._workCell.getChars().length||y.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const B=this._getJoinedRanges(D,b,M,d,E);for(let F=0;F<B.length;F++)k.push(B[F])}return k}_getJoinedRanges(p,d,k,D,E){const M=p.substring(d,k);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 N=this._characterJoiners[T].handler(M);for(let B=0;B<N.length;B++)jm._mergeRanges(b,N[B])}catch(N){console.error(N)}return this._stringRangesToCellRanges(b,D,E),b}_stringRangesToCellRanges(p,d,k){let D=0,E=!1,M=0,b=p[D];if(b){for(let T=k;T<this._bufferService.cols;T++){const N=d.getWidth(T),B=d.getString(T).length||y.WHITESPACE_CELL_CHAR.length;if(N!==0){if(!E&&b[0]<=M&&(b[0]=T,E=!0),b[1]<=M){if(b[1]=T,b=p[++D],!b)break;b[0]<=M?(b[0]=T,E=!0):E=!1}M+=B}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(p,d){let k=!1;for(let D=0;D<p.length;D++){const E=p[D];if(k){if(d[1]<=E[0])return p[D-1][1]=d[1],p;if(d[1]<=E[1])return p[D-1][1]=Math.max(d[1],E[1]),p.splice(D,1),p;p.splice(D,1),D--}else{if(d[1]<=E[0])return p.splice(D,0,d),p;if(d[1]<=E[1])return E[0]=Math.min(d[0],E[0]),p;d[0]<E[1]&&(E[0]=Math.min(d[0],E[0]),k=!0)}}return k?p[p.length-1][1]=d[1]:p.push(d),p}};r.CharacterJoinerService=l=g([_(0,L.IBufferService)],l)},5114:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const g=c(844),_=c(8460),u=c(3656);class y extends g.Disposable{constructor(f,l,m){super(),this._textarea=f,this._window=l,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(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((p=>this._screenDprMonitor.setWindow(p)))),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(f){this._window!==f&&(this._window=f,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=y;class S extends g.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new g.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,g.toDisposable)((()=>this.clearListener())))}setWindow(f){this._parentWindow=f,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var f;this._outerListener&&((f=this._resolutionMediaMatchList)==null||f.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:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const g=c(844);class _ extends g.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,g.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(y){return this.linkProviders.push(y),{dispose:()=>{const S=this.linkProviders.indexOf(y);S!==-1&&this.linkProviders.splice(S,1)}}}}r.LinkProviderService=_},8934:function(x,r,c){var g=this&&this.__decorate||function(L,f,l,m){var p,d=arguments.length,k=d<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,l):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(L,f,l,m);else for(var D=L.length-1;D>=0;D--)(p=L[D])&&(k=(d<3?p(k):d>3?p(f,l,k):p(f,l))||k);return d>3&&k&&Object.defineProperty(f,l,k),k},_=this&&this.__param||function(L,f){return function(l,m){f(l,m,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const u=c(4725),y=c(9806);let S=r.MouseService=class{constructor(L,f){this._renderService=L,this._charSizeService=f}getCoords(L,f,l,m,p){return(0,y.getCoords)(window,L,f,l,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(L,f){const l=(0,y.getCoordsRelativeToElement)(window,L,f);if(this._charSizeService.hasValidSize)return l[0]=Math.min(Math.max(l[0],0),this._renderService.dimensions.css.canvas.width-1),l[1]=Math.min(Math.max(l[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(l[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(l[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(l[0]),y:Math.floor(l[1])}}};r.MouseService=S=g([_(0,u.IRenderService),_(1,u.ICharSizeService)],S)},3230:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const u=c(6193),y=c(4725),S=c(8460),L=c(844),f=c(7226),l=c(2585);let m=r.RenderService=class extends L.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,d,k,D,E,M,b,T){super(),this._rowCount=p,this._charSizeService=D,this._renderer=this.register(new L.MutableDisposable),this._pausedResizeTask=new f.DebouncedIdleTask,this._observerDisposable=this.register(new L.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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer(((N,B)=>this._renderRows(N,B)),b),this.register(this._renderDebouncer),this.register(b.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(M.onResize((()=>this._fullRefresh()))),this.register(M.buffers.onBufferActivate((()=>{var N;return(N=this._renderer.value)==null?void 0:N.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(M.cols,M.rows),this._fullRefresh()}))),this.register(k.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((N=>this._registerIntersectionObserver(N,d))))}_registerIntersectionObserver(p,d){if("IntersectionObserver"in p){const k=new p.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(d),this._observerDisposable.value=(0,L.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,d,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,d,this._rowCount))}_renderRows(p,d){this._renderer.value&&(p=Math.min(p,this._rowCount-1),d=Math.min(d,this._rowCount-1),this._renderer.value.renderRows(p,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:p,end:d}),this._onRender.fire({start:p,end:d}),this._isNextRenderRedrawOnly=!0)}resize(p,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(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw((d=>this.refreshRows(d.start,d.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,d;this._renderer.value&&((d=(p=this._renderer.value).clearTextureAtlas)==null||d.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,d){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(p,d)})):this._renderer.value.handleResize(p,d),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,d,k){var D;this._selectionState.start=p,this._selectionState.end=d,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(p,d,k)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};r.RenderService=m=g([_(2,l.IOptionsService),_(3,y.ICharSizeService),_(4,l.IDecorationService),_(5,l.IBufferService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],m)},9312:function(x,r,c){var g=this&&this.__decorate||function(b,T,N,B){var F,O=arguments.length,U=O<3?T:B===null?B=Object.getOwnPropertyDescriptor(T,N):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(b,T,N,B);else for(var V=b.length-1;V>=0;V--)(F=b[V])&&(U=(O<3?F(U):O>3?F(T,N,U):F(T,N))||U);return O>3&&U&&Object.defineProperty(T,N,U),U},_=this&&this.__param||function(b,T){return function(N,B){T(N,B,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const u=c(9806),y=c(9504),S=c(456),L=c(4725),f=c(8460),l=c(844),m=c(6114),p=c(4841),d=c(511),k=c(2585),D=" ",E=new RegExp(D,"g");let M=r.SelectionService=class extends l.Disposable{constructor(b,T,N,B,F,O,U,V,Y){super(),this._element=b,this._screenElement=T,this._linkifier=N,this._bufferService=B,this._coreService=F,this._mouseService=O,this._optionsService=U,this._renderService=V,this._coreBrowserService=Y,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 f.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new f.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,l.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 N=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(b[0]===T[0])return"";const F=b[0]<T[0]?b[0]:T[0],O=b[0]<T[0]?T[0]:b[0];for(let U=b[1];U<=T[1];U++){const V=N.translateBufferLineToString(U,!0,F,O);B.push(V)}}else{const F=b[1]===T[1]?T[0]:void 0;B.push(N.translateBufferLineToString(b[1],!0,b[0],F));for(let O=b[1]+1;O<=T[1]-1;O++){const U=N.lines.get(O),V=N.translateBufferLineToString(O,!0);U!=null&&U.isWrapped?B[B.length-1]+=V:B.push(V)}if(b[1]!==T[1]){const O=N.lines.get(T[1]),U=N.translateBufferLineToString(T[1],!0,0,T[0]);O&&O.isWrapped?B[B.length-1]+=U:B.push(U)}}return B.map((F=>F.replace(E," "))).join(m.isWindows?`\r
113
- `:`
114
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(b){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),m.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),N=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(N&&B&&T)&&this._areCoordsInSelection(T,N,B)}isCellInSelection(b,T){const N=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!N||!B)&&this._areCoordsInSelection([b,T],N,B)}_areCoordsInSelection(b,T,N){return b[1]>T[1]&&b[1]<N[1]||T[1]===N[1]&&b[1]===T[1]&&b[0]>=T[0]&&b[0]<N[0]||T[1]<N[1]&&b[1]===N[1]&&b[0]<N[0]||T[1]<N[1]&&b[1]===T[1]&&b[0]>=T[0]}_selectWordAtCursor(b,T){var F,O;const N=(O=(F=this._linkifier.currentLink)==null?void 0:F.link)==null?void 0:O.range;if(N)return this._model.selectionStart=[N.start.x-1,N.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(N,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,u.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const N=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=N?0:(T>N&&(T-=N),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(b){return m.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&&!(m.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 N=this._bufferService.buffer;if(this._model.selectionEnd[1]<N.lines.length){const B=N.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 N=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(N&&N[0]!==void 0&&N[1]!==void 0){const B=(0,y.moveToCellSequence)(N[0]-1,N[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,N=!(!b||!T||b[0]===T[0]&&b[1]===T[1]);N?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,N)):this._oldHasSelection&&this._fireOnSelectionChange(b,T,N)}_fireOnSelectionChange(b,T,N){this._oldSelectionStart=b,this._oldSelectionEnd=T,this._oldHasSelection=N,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(b,T){let N=T;for(let B=0;T>=B;B++){const F=b.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?N--:F>1&&T!==B&&(N+=F-1)}return N}setSelection(b,T,N){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,T],this._model.selectionStartLength=N,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,T,N=!0,B=!0){if(b[0]>=this._bufferService.cols)return;const F=this._bufferService.buffer,O=F.lines.get(b[1]);if(!O)return;const U=F.translateBufferLineToString(b[1],!1);let V=this._convertViewportColToCharacterIndex(O,b[0]),Y=V;const X=b[0]-V;let G=0,P=0,$=0,H=0;if(U.charAt(V)===" "){for(;V>0&&U.charAt(V-1)===" ";)V--;for(;Y<U.length&&U.charAt(Y+1)===" ";)Y++}else{let se=b[0],le=b[0];O.getWidth(se)===0&&(G++,se--),O.getWidth(le)===2&&(P++,le++);const ue=O.getString(le).length;for(ue>1&&(H+=ue-1,Y+=ue-1);se>0&&V>0&&!this._isCharWordSeparator(O.loadCell(se-1,this._workCell));){O.loadCell(se-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(G++,se--):K>1&&($+=K-1,V-=K-1),V--,se--}for(;le<O.length&&Y+1<U.length&&!this._isCharWordSeparator(O.loadCell(le+1,this._workCell));){O.loadCell(le+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,le++):K>1&&(H+=K-1,Y+=K-1),Y++,le++}}Y++;let q=V+X-G+$,te=Math.min(this._bufferService.cols,Y-V+G+P-$-H);if(T||U.slice(V,Y).trim()!==""){if(N&&q===0&&O.getCodePoint(0)!==32){const se=F.lines.get(b[1]-1);if(se&&O.isWrapped&&se.getCodePoint(this._bufferService.cols-1)!==32){const le=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(le){const ue=this._bufferService.cols-le.start;q-=ue,te+=ue}}}if(B&&q+te===this._bufferService.cols&&O.getCodePoint(this._bufferService.cols-1)!==32){const se=F.lines.get(b[1]+1);if(se!=null&&se.isWrapped&&se.getCodePoint(0)!==32){const le=this._getWordAt([0,b[1]+1],!1,!1,!0);le&&(te+=le.length)}}return{start:q,length:te}}}_selectWordAt(b,T){const N=this._getWordAt(b,T);if(N){for(;N.start<0;)N.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[N.start,b[1]],this._model.selectionStartLength=N.length}}_selectToWordAt(b){const T=this._getWordAt(b,!0);if(T){let N=b[1];for(;T.start<0;)T.start+=this._bufferService.cols,N--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,N++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,N]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const T=this._bufferService.buffer.getWrappedRangeForLine(b),N={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,p.getRangeLength)(N,this._bufferService.cols)}};r.SelectionService=M=g([_(3,k.IBufferService),_(4,k.ICoreService),_(5,L.IMouseService),_(6,k.IOptionsService),_(7,L.IRenderService),_(8,L.ICoreBrowserService)],M)},4725:(x,r,c)=>{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 g=c(8343);r.ICharSizeService=(0,g.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,g.createDecorator)("CoreBrowserService"),r.IMouseService=(0,g.createDecorator)("MouseService"),r.IRenderService=(0,g.createDecorator)("RenderService"),r.ISelectionService=(0,g.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,g.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,g.createDecorator)("ThemeService"),r.ILinkProviderService=(0,g.createDecorator)("LinkProviderService")},6731:function(x,r,c){var g=this&&this.__decorate||function(M,b,T,N){var B,F=arguments.length,O=F<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(M,b,T,N);else for(var U=M.length-1;U>=0;U--)(B=M[U])&&(O=(F<3?B(O):F>3?B(b,T,O):B(b,T))||O);return F>3&&O&&Object.defineProperty(b,T,O),O},_=this&&this.__param||function(M,b){return function(T,N){b(T,N,M)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const u=c(7239),y=c(8055),S=c(8460),L=c(844),f=c(2585),l=y.css.toColor("#ffffff"),m=y.css.toColor("#000000"),p=y.css.toColor("#ffffff"),d=y.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const M=[y.css.toColor("#2e3436"),y.css.toColor("#cc0000"),y.css.toColor("#4e9a06"),y.css.toColor("#c4a000"),y.css.toColor("#3465a4"),y.css.toColor("#75507b"),y.css.toColor("#06989a"),y.css.toColor("#d3d7cf"),y.css.toColor("#555753"),y.css.toColor("#ef2929"),y.css.toColor("#8ae234"),y.css.toColor("#fce94f"),y.css.toColor("#729fcf"),y.css.toColor("#ad7fa8"),y.css.toColor("#34e2e2"),y.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let T=0;T<216;T++){const N=b[T/36%6|0],B=b[T/6%6|0],F=b[T%6];M.push({css:y.channels.toCss(N,B,F),rgba:y.channels.toRgba(N,B,F)})}for(let T=0;T<24;T++){const N=8+10*T;M.push({css:y.channels.toCss(N,N,N),rgba:y.channels.toRgba(N,N,N)})}return M})());let D=r.ThemeService=class extends L.Disposable{get colors(){return this._colors}constructor(M){super(),this._optionsService=M,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:l,background:m,cursor:p,cursorAccent:d,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:y.color.blend(m,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:y.color.blend(m,k),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=E(M.foreground,l),b.background=E(M.background,m),b.cursor=E(M.cursor,p),b.cursorAccent=E(M.cursorAccent,d),b.selectionBackgroundTransparent=E(M.selectionBackground,k),b.selectionBackgroundOpaque=y.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=E(M.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=y.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=M.selectionForeground?E(M.selectionForeground,y.NULL_COLOR):void 0,b.selectionForeground===y.NULL_COLOR&&(b.selectionForeground=void 0),y.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=y.color.opacity(b.selectionBackgroundTransparent,.3)),y.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=y.color.opacity(b.selectionInactiveBackgroundTransparent,.3)),b.ansi=r.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=E(M.black,r.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=E(M.red,r.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=E(M.green,r.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=E(M.yellow,r.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=E(M.blue,r.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=E(M.magenta,r.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=E(M.cyan,r.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=E(M.white,r.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=E(M.brightBlack,r.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=E(M.brightRed,r.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=E(M.brightGreen,r.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=E(M.brightYellow,r.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=E(M.brightBlue,r.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=E(M.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=E(M.brightCyan,r.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=E(M.brightWhite,r.DEFAULT_ANSI_COLORS[15]),M.extendedAnsi){const T=Math.min(b.ansi.length-16,M.extendedAnsi.length);for(let N=0;N<T;N++)b.ansi[N+16]=E(M.extendedAnsi[N],r.DEFAULT_ANSI_COLORS[N+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 E(M,b){if(M!==void 0)try{return y.css.toColor(M)}catch{}return b}r.ThemeService=D=g([_(0,f.IOptionsService)],D)},6349:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const g=c(8460),_=c(844);class u extends _.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new g.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new g.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new g.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(S){if(this._maxLength===S)return;const L=new Array(S);for(let f=0;f<Math.min(S,this.length);f++)L[f]=this._array[this._getCyclicIndex(f)];this._array=L,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let L=this._length;L<S;L++)this._array[L]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,L){this._array[this._getCyclicIndex(S)]=L}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,L,...f){if(L){for(let l=S;l<this._length-L;l++)this._array[this._getCyclicIndex(l)]=this._array[this._getCyclicIndex(l+L)];this._length-=L,this.onDeleteEmitter.fire({index:S,amount:L})}for(let l=this._length-1;l>=S;l--)this._array[this._getCyclicIndex(l+f.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<f.length;l++)this._array[this._getCyclicIndex(S+l)]=f[l];if(f.length&&this.onInsertEmitter.fire({index:S,amount:f.length}),this._length+f.length>this._maxLength){const l=this._length+f.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}else this._length+=f.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,L,f){if(!(L<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let m=L-1;m>=0;m--)this.set(S+m+f,this.get(S+m));const l=S+L+f-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l<L;l++)this.set(S+l+f,this.get(S+l))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}r.CircularList=u},1439:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function c(g,_=5){if(typeof g!="object")return g;const u=Array.isArray(g)?[]:{};for(const y in g)u[y]=_<=1?g[y]:g[y]&&c(g[y],_-1);return u}},8055:(x,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 c=0,g=0,_=0,u=0;var y,S,L,f,l;function m(d){const k=d.toString(16);return k.length<2?"0"+k:k}function p(d,k){return d<k?(k+.05)/(d+.05):(d+.05)/(k+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(k,D,E,M){return M!==void 0?`#${m(k)}${m(D)}${m(E)}${m(M)}`:`#${m(k)}${m(D)}${m(E)}`},d.toRgba=function(k,D,E,M=255){return(k<<24|D<<16|E<<8|M)>>>0},d.toColor=function(k,D,E,M){return{css:d.toCss(k,D,E,M),rgba:d.toRgba(k,D,E,M)}}})(y||(r.channels=y={})),(function(d){function k(D,E){return u=Math.round(255*E),[c,g,_]=l.toChannels(D.rgba),{css:y.toCss(c,g,_,u),rgba:y.toRgba(c,g,_,u)}}d.blend=function(D,E){if(u=(255&E.rgba)/255,u===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,T=E.rgba>>8&255,N=D.rgba>>24&255,B=D.rgba>>16&255,F=D.rgba>>8&255;return c=N+Math.round((M-N)*u),g=B+Math.round((b-B)*u),_=F+Math.round((T-F)*u),{css:y.toCss(c,g,_),rgba:y.toRgba(c,g,_)}},d.isOpaque=function(D){return(255&D.rgba)==255},d.ensureContrastRatio=function(D,E,M){const b=l.ensureContrastRatio(D.rgba,E.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(D){const E=(255|D.rgba)>>>0;return[c,g,_]=l.toChannels(E),{css:y.toCss(c,g,_),rgba:E}},d.opacity=k,d.multiplyOpacity=function(D,E){return u=255&D.rgba,k(D,u*E/255)},d.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(r.color=S={})),(function(d){let k,D;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(k=M,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),y.toColor(c,g,_);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),u=parseInt(E.slice(4,5).repeat(2),16),y.toColor(c,g,_,u);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const M=E.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 c=parseInt(M[1]),g=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,g,_,u);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=E,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,g,_,u]=k.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,g,_,u),css:E}}})(L||(r.css=L={})),(function(d){function k(D,E,M){const b=D/255,T=E/255,N=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*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))}d.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},d.relativeLuminance2=k})(f||(r.rgb=f={})),(function(d){function k(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F>0||O>0||U>0);)F-=Math.max(0,Math.ceil(.1*F)),O-=Math.max(0,Math.ceil(.1*O)),U-=Math.max(0,Math.ceil(.1*U)),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}function D(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F<255||O<255||U<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),O=Math.min(255,O+Math.ceil(.1*(255-O))),U=Math.min(255,U+Math.ceil(.1*(255-U))),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}d.blend=function(E,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,B=E>>24&255,F=E>>16&255,O=E>>8&255;return c=B+Math.round((b-B)*u),g=F+Math.round((T-F)*u),_=O+Math.round((N-O)*u),y.toRgba(c,g,_)},d.ensureContrastRatio=function(E,M,b){const T=f.relativeLuminance(E>>8),N=f.relativeLuminance(M>>8);if(p(T,N)<b){if(N<T){const O=k(E,M,b),U=p(T,f.relativeLuminance(O>>8));if(U<b){const V=D(E,M,b);return U>p(T,f.relativeLuminance(V>>8))?O:V}return O}const B=D(E,M,b),F=p(T,f.relativeLuminance(B>>8));if(F<b){const O=k(E,M,b);return F>p(T,f.relativeLuminance(O>>8))?B:O}return B}},d.reduceLuminance=k,d.increaseLuminance=D,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(l||(r.rgba=l={})),r.toPaddedHex=m,r.contrastRatio=p},8969:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const g=c(844),_=c(2585),u=c(4348),y=c(7866),S=c(744),L=c(7302),f=c(6975),l=c(8460),m=c(1753),p=c(1480),d=c(7994),k=c(9282),D=c(5435),E=c(5981),M=c(2660);let b=!1;class T extends g.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new l.EventEmitter),this._onScroll.event((B=>{var F;(F=this._onScrollApi)==null||F.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 F in B)this.optionsService.options[F]=B[F]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new g.MutableDisposable),this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new l.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new l.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new L.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(y.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.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 D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,l.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,l.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,l.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,l.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((F=>{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((F=>{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 E.WriteBuffer(((F,O)=>this._inputHandler.parse(F,O)))),this.register((0,l.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,F){this._writeBuffer.write(B,F)}writeSync(B,F){this._logService.logLevel<=_.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(B,F)}input(B,F=!0){this.coreService.triggerDataEvent(B,F)}resize(B,F){isNaN(B)||isNaN(F)||(B=Math.max(B,S.MINIMUM_COLS),F=Math.max(F,S.MINIMUM_ROWS),this._bufferService.resize(B,F))}scroll(B,F=!1){this._bufferService.scroll(B,F)}scrollLines(B,F,O){this._bufferService.scrollLines(B,F,O)}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 F=B-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(B,F){return this._inputHandler.registerEscHandler(B,F)}registerDcsHandler(B,F){return this._inputHandler.registerDcsHandler(B,F)}registerCsiHandler(B,F){return this._inputHandler.registerCsiHandler(B,F)}registerOscHandler(B,F){return this._inputHandler.registerOscHandler(B,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?B=F.backend==="conpty"&&F.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(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,g.toDisposable)((()=>{for(const F of B)F.dispose()}))}}}r.CoreTerminal=T},8460:(x,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=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){const _=[];for(let u=0;u<this._listeners.length;u++)_.push(this._listeners[u]);for(let u=0;u<_.length;u++)_[u].call(void 0,c,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(c,g){return c((_=>g.fire(_)))},r.runAndSubscribe=function(c,g){return g(void 0),c((_=>g(_)))}},5435:function(x,r,c){var g=this&&this.__decorate||function(G,P,$,H){var q,te=arguments.length,se=te<3?P:H===null?H=Object.getOwnPropertyDescriptor(P,$):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(G,P,$,H);else for(var le=G.length-1;le>=0;le--)(q=G[le])&&(se=(te<3?q(se):te>3?q(P,$,se):q(P,$))||se);return te>3&&se&&Object.defineProperty(P,$,se),se},_=this&&this.__param||function(G,P){return function($,H){P($,H,G)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const u=c(2584),y=c(7116),S=c(2015),L=c(844),f=c(482),l=c(8437),m=c(8460),p=c(643),d=c(511),k=c(3734),D=c(2585),E=c(1480),M=c(6242),b=c(6351),T=c(5941),N={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function F(G,P){if(G>24)return P.setWinLines||!1;switch(G){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var O;(function(G){G[G.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",G[G.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(O||(r.WindowsOptionsReportType=O={}));let U=0;class V extends L.Disposable{getAttrData(){return this._curAttrData}constructor(P,$,H,q,te,se,le,ue,K=new S.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=$,this._coreService=H,this._logService=q,this._optionsService=te,this._oscLinkService=se,this._coreMouseService=le,this._unicodeService=ue,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new d.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.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 Y(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((W=>this._activeBuffer=W.activeBuffer))),this._parser.setCsiHandlerFallback(((W,J)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(W),params:J.toArray()})})),this._parser.setEscHandlerFallback((W=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(W)})})),this._parser.setExecuteHandlerFallback((W=>{this._logService.debug("Unknown EXECUTE code: ",{code:W})})),this._parser.setOscHandlerFallback(((W,J,Z)=>{this._logService.debug("Unknown OSC code: ",{identifier:W,action:J,data:Z})})),this._parser.setDcsHandlerFallback(((W,J,Z)=>{J==="HOOK"&&(Z=Z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(W),action:J,payload:Z})})),this._parser.setPrintHandler(((W,J,Z)=>this.print(W,J,Z))),this._parser.registerCsiHandler({final:"@"},(W=>this.insertChars(W))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(W=>this.scrollLeft(W))),this._parser.registerCsiHandler({final:"A"},(W=>this.cursorUp(W))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(W=>this.scrollRight(W))),this._parser.registerCsiHandler({final:"B"},(W=>this.cursorDown(W))),this._parser.registerCsiHandler({final:"C"},(W=>this.cursorForward(W))),this._parser.registerCsiHandler({final:"D"},(W=>this.cursorBackward(W))),this._parser.registerCsiHandler({final:"E"},(W=>this.cursorNextLine(W))),this._parser.registerCsiHandler({final:"F"},(W=>this.cursorPrecedingLine(W))),this._parser.registerCsiHandler({final:"G"},(W=>this.cursorCharAbsolute(W))),this._parser.registerCsiHandler({final:"H"},(W=>this.cursorPosition(W))),this._parser.registerCsiHandler({final:"I"},(W=>this.cursorForwardTab(W))),this._parser.registerCsiHandler({final:"J"},(W=>this.eraseInDisplay(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(W=>this.eraseInDisplay(W,!0))),this._parser.registerCsiHandler({final:"K"},(W=>this.eraseInLine(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(W=>this.eraseInLine(W,!0))),this._parser.registerCsiHandler({final:"L"},(W=>this.insertLines(W))),this._parser.registerCsiHandler({final:"M"},(W=>this.deleteLines(W))),this._parser.registerCsiHandler({final:"P"},(W=>this.deleteChars(W))),this._parser.registerCsiHandler({final:"S"},(W=>this.scrollUp(W))),this._parser.registerCsiHandler({final:"T"},(W=>this.scrollDown(W))),this._parser.registerCsiHandler({final:"X"},(W=>this.eraseChars(W))),this._parser.registerCsiHandler({final:"Z"},(W=>this.cursorBackwardTab(W))),this._parser.registerCsiHandler({final:"`"},(W=>this.charPosAbsolute(W))),this._parser.registerCsiHandler({final:"a"},(W=>this.hPositionRelative(W))),this._parser.registerCsiHandler({final:"b"},(W=>this.repeatPrecedingCharacter(W))),this._parser.registerCsiHandler({final:"c"},(W=>this.sendDeviceAttributesPrimary(W))),this._parser.registerCsiHandler({prefix:">",final:"c"},(W=>this.sendDeviceAttributesSecondary(W))),this._parser.registerCsiHandler({final:"d"},(W=>this.linePosAbsolute(W))),this._parser.registerCsiHandler({final:"e"},(W=>this.vPositionRelative(W))),this._parser.registerCsiHandler({final:"f"},(W=>this.hVPosition(W))),this._parser.registerCsiHandler({final:"g"},(W=>this.tabClear(W))),this._parser.registerCsiHandler({final:"h"},(W=>this.setMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(W=>this.setModePrivate(W))),this._parser.registerCsiHandler({final:"l"},(W=>this.resetMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(W=>this.resetModePrivate(W))),this._parser.registerCsiHandler({final:"m"},(W=>this.charAttributes(W))),this._parser.registerCsiHandler({final:"n"},(W=>this.deviceStatus(W))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(W=>this.deviceStatusPrivate(W))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(W=>this.softReset(W))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(W=>this.setCursorStyle(W))),this._parser.registerCsiHandler({final:"r"},(W=>this.setScrollRegion(W))),this._parser.registerCsiHandler({final:"s"},(W=>this.saveCursor(W))),this._parser.registerCsiHandler({final:"t"},(W=>this.windowOptions(W))),this._parser.registerCsiHandler({final:"u"},(W=>this.restoreCursor(W))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(W=>this.insertColumns(W))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(W=>this.deleteColumns(W))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(W=>this.selectProtected(W))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(W=>this.requestMode(W,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(W=>this.requestMode(W,!1))),this._parser.setExecuteHandler(u.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(u.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(u.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(u.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(u.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(u.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(u.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(u.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(u.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new M.OscHandler((W=>(this.setTitle(W),this.setIconName(W),!0)))),this._parser.registerOscHandler(1,new M.OscHandler((W=>this.setIconName(W)))),this._parser.registerOscHandler(2,new M.OscHandler((W=>this.setTitle(W)))),this._parser.registerOscHandler(4,new M.OscHandler((W=>this.setOrReportIndexedColor(W)))),this._parser.registerOscHandler(8,new M.OscHandler((W=>this.setHyperlink(W)))),this._parser.registerOscHandler(10,new M.OscHandler((W=>this.setOrReportFgColor(W)))),this._parser.registerOscHandler(11,new M.OscHandler((W=>this.setOrReportBgColor(W)))),this._parser.registerOscHandler(12,new M.OscHandler((W=>this.setOrReportCursorColor(W)))),this._parser.registerOscHandler(104,new M.OscHandler((W=>this.restoreIndexedColor(W)))),this._parser.registerOscHandler(110,new M.OscHandler((W=>this.restoreFgColor(W)))),this._parser.registerOscHandler(111,new M.OscHandler((W=>this.restoreBgColor(W)))),this._parser.registerOscHandler(112,new M.OscHandler((W=>this.restoreCursorColor(W)))),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 W in y.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:W},(()=>this.selectCharset("("+W))),this._parser.registerEscHandler({intermediates:")",final:W},(()=>this.selectCharset(")"+W))),this._parser.registerEscHandler({intermediates:"*",final:W},(()=>this.selectCharset("*"+W))),this._parser.registerEscHandler({intermediates:"+",final:W},(()=>this.selectCharset("+"+W))),this._parser.registerEscHandler({intermediates:"-",final:W},(()=>this.selectCharset("-"+W))),this._parser.registerEscHandler({intermediates:".",final:W},(()=>this.selectCharset("."+W))),this._parser.registerEscHandler({intermediates:"/",final:W},(()=>this.selectCharset("/"+W)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((W=>(this._logService.error("Parsing error: ",W),W))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler(((W,J)=>this.requestStatusString(W,J))))}_preserveStack(P,$,H,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=H,this._parseStack.position=q}_logSlowResolvingAsync(P){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([P,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(P,$){let H,q=this._activeBuffer.x,te=this._activeBuffer.y,se=0;const le=this._parseStack.paused;if(le){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(H),H;q=this._parseStack.cursorStartX,te=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>B&&(se=this._parseStack.position+B)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(W=>String.fromCharCode(W))).join("")}"`),typeof P=="string"?P.split("").map((W=>W.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(P.length,B))),le||this._dirtyRowTracker.clearRange(),P.length>B)for(let W=se;W<P.length;W+=B){const J=W+B<P.length?W+B:P.length,Z=typeof P=="string"?this._stringDecoder.decode(P.substring(W,J),this._parseBuffer):this._utf8Decoder.decode(P.subarray(W,J),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(q,te,Z,W),this._logSlowResolvingAsync(H),H}else if(!le){const W=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,W))return this._preserveStack(q,te,W,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===q&&this._activeBuffer.y===te||this._onCursorMove.fire();const ue=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),K=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);K<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(K,this._bufferService.rows-1),Math.min(ue,this._bufferService.rows-1))}print(P,$,H){let q,te;const se=this._charsetService.charset,le=this._optionsService.rawOptions.screenReaderMode,ue=this._bufferService.cols,K=this._coreService.decPrivateModes.wraparound,W=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 de=this._parser.precedingJoinState;for(let pe=$;pe<H;++pe){if(q=P[pe],q<127&&se){const et=se[String.fromCharCode(q)];et&&(q=et.charCodeAt(0))}const re=this._unicodeService.charProperties(q,de);te=E.UnicodeService.extractWidth(re);const ke=E.UnicodeService.extractShouldJoin(re),Me=ke?E.UnicodeService.extractWidth(de):0;if(de=re,le&&this._onA11yChar.fire((0,f.stringFromCodePoint)(q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+te-Me>ue){if(K){const et=Z;let Le=this._activeBuffer.x-Me;for(this._activeBuffer.x=Me,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),Me>0&&Z instanceof l.BufferLine&&Z.copyCellsFrom(et,Le,0,Me,!1);Le<ue;)et.setCellFromCodepoint(Le++,0,1,J)}else if(this._activeBuffer.x=ue-1,te===2)continue}if(ke&&this._activeBuffer.x){const et=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-et,q,te);for(let Le=te-Me;--Le>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}else if(W&&(Z.insertCells(this._activeBuffer.x,te-Me,this._activeBuffer.getNullCell(J)),Z.getWidth(ue-1)===2&&Z.setCellFromCodepoint(ue-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,J)),Z.setCellFromCodepoint(this._activeBuffer.x++,q,te,J),te>0)for(;--te;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}this._parser.precedingJoinState=de,this._activeBuffer.x<ue&&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(P,$){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,$):this._parser.registerCsiHandler(P,(H=>!F(H.params[0],this._optionsService.rawOptions.windowOptions)||$(H)))}registerDcsHandler(P,$){return this._parser.registerDcsHandler(P,new b.DcsHandler($))}registerEscHandler(P,$){return this._parser.registerEscHandler(P,$)}registerOscHandler(P,$){return this._parser.registerOscHandler(P,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 P;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&&((P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.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 P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,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(P,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=P,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+$)}cursorUp(P){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const $=P.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=P.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=P.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const $=P.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,$,H,q=!1,te=!1){const se=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);se.replaceCells($,H,this._activeBuffer.getNullCell(this._eraseAttrData()),te),q&&(se.isWrapped=!1)}_resetBufferLine(P,$=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),H.isWrapped=!1)}eraseInDisplay(P,$=!1){let H;switch(this._restrictCursor(this._bufferService.cols),P.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 q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(P,$=!1){switch(this._restrictCursor(this._bufferService.cols),P.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(P){this._restrictCursor();let $=P.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,q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,te=this._bufferService.rows-1+this._activeBuffer.ybase-q+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(P){this._restrictCursor();let $=P.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 q;for(q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-q;$--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let $=P.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(P){let $=P.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(l.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const $=this._parser.precedingJoinState;if(!$)return!0;const H=P.params[0]||1,q=E.UnicodeService.extractWidth($),te=this._activeBuffer.x-q,se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(te),le=new Uint32Array(se.length*H);let ue=0;for(let W=0;W<se.length;){const J=se.codePointAt(W)||0;le[ue++]=J,W+=J>65535?2:1}let K=ue;for(let W=1;W<H;++W)le.copyWithin(K,0,ue),K+=ue;return this.print(le,0,K),!0}sendDeviceAttributesPrimary(P){return P.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(P){return P.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,y.DEFAULT_CHARSET),this._charsetService.setgCharset(1,y.DEFAULT_CHARSET),this._charsetService.setgCharset(2,y.DEFAULT_CHARSET),this._charsetService.setgCharset(3,y.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(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let $=0;$<P.length;$++)switch(P.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(),P.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(P,$){const H=this._coreService.decPrivateModes,{activeProtocol:q,activeEncoding:te}=this._coreMouseService,se=this._coreService,{buffers:le,cols:ue}=this._bufferService,{active:K,alt:W}=le,J=this._optionsService.rawOptions,Z=ke=>ke?1:2,de=P.params[0];return pe=de,re=$?de===2?4:de===4?Z(se.modes.insertMode):de===12?3:de===20?Z(J.convertEol):0:de===1?Z(H.applicationCursorKeys):de===3?J.windowOptions.setWinLines?ue===80?2:ue===132?1:0:0:de===6?Z(H.origin):de===7?Z(H.wraparound):de===8?3:de===9?Z(q==="X10"):de===12?Z(J.cursorBlink):de===25?Z(!se.isCursorHidden):de===45?Z(H.reverseWraparound):de===66?Z(H.applicationKeypad):de===67?4:de===1e3?Z(q==="VT200"):de===1002?Z(q==="DRAG"):de===1003?Z(q==="ANY"):de===1004?Z(H.sendFocus):de===1005?4:de===1006?Z(te==="SGR"):de===1015?4:de===1016?Z(te==="SGR_PIXELS"):de===1048?1:de===47||de===1047||de===1049?Z(K===W):de===2004?Z(H.bracketedPasteMode):0,se.triggerDataEvent(`${u.C0.ESC}[${$?"":"?"}${pe};${re}$y`),!0;var pe,re}_updateAttrColor(P,$,H,q,te){return $===2?(P|=50331648,P&=-16777216,P|=k.AttributeData.fromColorRGB([H,q,te])):$===5&&(P&=-50331904,P|=33554432|255&H),P}_extractColor(P,$,H){const q=[0,0,-1,0,0,0];let te=0,se=0;do{if(q[se+te]=P.params[$+se],P.hasSubParams($+se)){const le=P.getSubParams($+se);let ue=0;do q[1]===5&&(te=1),q[se+ue+1+te]=le[ue];while(++ue<le.length&&ue+se+1+te<q.length);break}if(q[1]===5&&se+te>=2||q[1]===2&&se+te>=5)break;q[1]&&(te=1)}while(++se+$<P.length&&se+te<q.length);for(let le=2;le<q.length;++le)q[le]===-1&&(q[le]=0);switch(q[0]){case 38:H.fg=this._updateAttrColor(H.fg,q[1],q[3],q[4],q[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,q[1],q[3],q[4],q[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,q[1],q[3],q[4],q[5])}return se}_processUnderline(P,$){$.extended=$.extended.clone(),(!~P||P>5)&&(P=1),$.extended.underlineStyle=P,$.fg|=268435456,P===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(P){P.fg=l.DEFAULT_ATTR_DATA.fg,P.bg=l.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=P.length;let H;const q=this._curAttrData;for(let te=0;te<$;te++)H=P.params[te],H>=30&&H<=37?(q.fg&=-50331904,q.fg|=16777216|H-30):H>=40&&H<=47?(q.bg&=-50331904,q.bg|=16777216|H-40):H>=90&&H<=97?(q.fg&=-50331904,q.fg|=16777224|H-90):H>=100&&H<=107?(q.bg&=-50331904,q.bg|=16777224|H-100):H===0?this._processSGR0(q):H===1?q.fg|=134217728:H===3?q.bg|=67108864:H===4?(q.fg|=268435456,this._processUnderline(P.hasSubParams(te)?P.getSubParams(te)[0]:1,q)):H===5?q.fg|=536870912:H===7?q.fg|=67108864:H===8?q.fg|=1073741824:H===9?q.fg|=2147483648:H===2?q.bg|=134217728:H===21?this._processUnderline(2,q):H===22?(q.fg&=-134217729,q.bg&=-134217729):H===23?q.bg&=-67108865:H===24?(q.fg&=-268435457,this._processUnderline(0,q)):H===25?q.fg&=-536870913:H===27?q.fg&=-67108865:H===28?q.fg&=-1073741825:H===29?q.fg&=2147483647:H===39?(q.fg&=-67108864,q.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):H===49?(q.bg&=-67108864,q.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?te+=this._extractColor(P,te,q):H===53?q.bg|=1073741824:H===55?q.bg&=-1073741825:H===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):H===100?(q.fg&=-67108864,q.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${$};${H}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${$};${H}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.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(P){const $=P.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(P){const $=P.params[0]||1;let H;return(P.length<2||(H=P.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(P){if(!F(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(O.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(O.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.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(P){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(P){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(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const $=[],H=P.split(";");for(;H.length>1;){const q=H.shift(),te=H.shift();if(/^\d+$/.exec(q)){const se=parseInt(q);if(X(se))if(te==="?")$.push({type:0,index:se});else{const le=(0,T.parseColor)(te);le&&$.push({type:1,index:se,color:le})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(P){const $=P.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(P,$){this._getCurrentLinkId()&&this._finishHyperlink();const H=P.split(":");let q;const te=H.findIndex((se=>se.startsWith("id=")));return te!==-1&&(q=H[te].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,$){const H=P.split(";");for(let q=0;q<H.length&&!($>=this._specialColors.length);++q,++$)if(H[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const te=(0,T.parseColor)(H[q]);te&&this._onColor.fire([{type:1,index:this._specialColors[$],color:te}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const $=[],H=P.split(";");for(let q=0;q<H.length;++q)if(/^\d+$/.exec(H[q])){const te=parseInt(H[q]);X(te)&&$.push({type:2,index:te})}return $.length&&this._onColor.fire($),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){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,y.DEFAULT_CHARSET),!0}selectCharset(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(N[P[0]],y.CHARSETS[P[1]]||y.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 P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,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=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new d.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const H=this._activeBuffer.ybase+this._activeBuffer.y+$,q=this._activeBuffer.lines.get(H);q&&(q.fill(P),q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,$){const H=this._bufferService.buffer,q=this._optionsService.rawOptions;return(te=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${te}${u.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,$){this._dirtyRowTracker.markRangeDirty(P,$)}}r.InputHandler=V;let Y=class{constructor(G){this._bufferService=G,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(G){G<this.start?this.start=G:G>this.end&&(this.end=G)}markRangeDirty(G,P){G>P&&(U=G,G=P,P=U),G<this.start&&(this.start=G),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(G){return 0<=G&&G<256}Y=g([_(0,D.IBufferService)],Y)},844:(x,r)=>{function c(g){for(const _ of g)_.dispose();g.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 g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},r.toDisposable=function(g){return{dispose:g}},r.disposeArray=c,r.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},1505:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(_,u,y){this._data[_]||(this._data[_]={}),this._data[_][u]=y}get(_,u){return this._data[_]?this._data[_][u]:void 0}clear(){this._data={}}}r.TwoKeyMap=c,r.FourKeyMap=class{constructor(){this._data=new c}set(g,_,u,y,S){this._data.get(g,_)||this._data.set(g,_,new c),this._data.get(g,_).set(u,y,S)}get(g,_,u,y){var S;return(S=this._data.get(g,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},6114:(x,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 c=r.isNode?"node":navigator.userAgent,g=r.isNode?"node":navigator.platform;r.isFirefox=c.includes("Firefox"),r.isLegacyEdge=c.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(c),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),r.isIpad=g==="iPad",r.isIphone=g==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),r.isLinux=g.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(c)},6106:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let c=0;r.SortedList=class{constructor(g){this._getKey=g,this._array=[]}clear(){this._array.length=0}insert(g){this._array.length!==0?(c=this._search(this._getKey(g)),this._array.splice(c,0,g)):this._array.push(g)}delete(g){if(this._array.length===0)return!1;const _=this._getKey(g);if(_===void 0||(c=this._search(_),c===-1)||this._getKey(this._array[c])!==_)return!1;do if(this._array[c]===g)return this._array.splice(c,1),!0;while(++c<this._array.length&&this._getKey(this._array[c])===_);return!1}*getKeyIterator(g){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do yield this._array[c];while(++c<this._array.length&&this._getKey(this._array[c])===g)}forEachByKey(g,_){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do _(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===g)}values(){return[...this._array].values()}_search(g){let _=0,u=this._array.length-1;for(;u>=_;){let y=_+u>>1;const S=this._getKey(this._array[y]);if(S>g)u=y-1;else{if(!(S<g)){for(;y>0&&this._getKey(this._array[y-1])===g;)y--;return y}_=y+1}}return _}}},7226:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const g=c(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let L=0,f=0,l=S.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(L=Date.now(),this._tasks[this._i]()||this._i++,L=Math.max(1,Date.now()-L),f=Math.max(L,f),m=S.timeRemaining(),1.5*f>m)return l-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-L))}ms`),void this._start();l=m}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const L=Date.now()+S;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=u,r.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},9282:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const g=c(643);r.updateWindowsModeWrappedState=function(_){const u=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),y=u==null?void 0:u.get(_.cols-1),S=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);S&&y&&(S.isWrapped=y[g.CHAR_DATA_CODE_INDEX]!==g.NULL_CELL_CODE&&y[g.CHAR_DATA_CODE_INDEX]!==g.WHITESPACE_CELL_CODE)}},3734:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new g}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new c;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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=c;class g{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,y=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=y}clone(){return new g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=g},9092:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const g=c(6349),_=c(7226),u=c(3734),y=c(8437),S=c(4634),L=c(511),f=c(643),l=c(4863),m=c(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(p,d,k){this._hasScrollback=p,this._optionsService=d,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=y.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=L.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=L.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.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 g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,d){return new y.BufferLine(this._bufferService.cols,this.getNullCell(p),d)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const d=p+this._optionsService.rawOptions.scrollback;return d>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:d}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=y.DEFAULT_ATTR_DATA);let d=this._rows;for(;d--;)this.lines.push(this.getBlankLine(p))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(p,d){const k=this.getNullCell(y.DEFAULT_ATTR_DATA);let D=0;const E=this._getCorrectBufferLength(d);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<p)for(let b=0;b<this.lines.length;b++)D+=+this.lines.get(b).resize(p,k);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 y.BufferLine(p,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+M+1?(this.ybase--,M++,this.ydisp>0&&this.ydisp--):this.lines.push(new y.BufferLine(p,k)));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(E<this.lines.maxLength){const b=this.lines.length-E;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=E}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,d-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=d-1,this._isReflowEnabled&&(this._reflow(p,d),this._cols>p))for(let M=0;M<this.lines.length;M++)D+=+this.lines.get(M).resize(p,k);this._cols=p,this._rows=d,this._memoryCleanupQueue.clear(),D>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let d=0;for(;this._memoryCleanupPosition<this.lines.length;)if(d+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),d>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,d){this._cols!==p&&(p>this._cols?this._reflowLarger(p,d):this._reflowSmaller(p,d))}_reflowLarger(p,d){const k=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(y.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,S.reflowLargerCreateNewLayout)(this.lines,k);(0,S.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(p,d,D.countRemoved)}}_reflowLargerAdjustViewport(p,d,k){const D=this.getNullCell(y.DEFAULT_ATTR_DATA);let E=k;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<d&&this.lines.push(new y.BufferLine(p,D))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(p,d){const k=this.getNullCell(y.DEFAULT_ATTR_DATA),D=[];let E=0;for(let M=this.lines.length-1;M>=0;M--){let b=this.lines.get(M);if(!b||!b.isWrapped&&b.getTrimmedLength()<=p)continue;const T=[b];for(;b.isWrapped&&M>0;)b=this.lines.get(--M),T.unshift(b);const N=this.ybase+this.y;if(N>=M&&N<M+T.length)continue;const B=T[T.length-1].getTrimmedLength(),F=(0,S.reflowSmallerGetNewLineLengths)(T,this._cols,p),O=F.length-T.length;let U;U=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+O):Math.max(0,this.lines.length-this.lines.maxLength+O);const V=[];for(let H=0;H<O;H++){const q=this.getBlankLine(y.DEFAULT_ATTR_DATA,!0);V.push(q)}V.length>0&&(D.push({start:M+T.length+E,newLines:V}),E+=V.length),T.push(...V);let Y=F.length-1,X=F[Y];X===0&&(Y--,X=F[Y]);let G=T.length-O-1,P=B;for(;G>=0;){const H=Math.min(P,X);if(T[Y]===void 0)break;if(T[Y].copyCellsFrom(T[G],P-H,X-H,H,!0),X-=H,X===0&&(Y--,X=F[Y]),P-=H,P===0){G--;const q=Math.max(G,0);P=(0,S.getWrappedLineTrimmedLength)(T,q,this._cols)}}for(let H=0;H<T.length;H++)F[H]<p&&T[H].setCell(F[H],k);let $=O-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+E)-d&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+O,this.ybase+d-1)}if(D.length>0){const M=[],b=[];for(let Y=0;Y<this.lines.length;Y++)b.push(this.lines.get(Y));const T=this.lines.length;let N=T-1,B=0,F=D[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let O=0;for(let Y=Math.min(this.lines.maxLength-1,T+E-1);Y>=0;Y--)if(F&&F.start>N+O){for(let X=F.newLines.length-1;X>=0;X--)this.lines.set(Y--,F.newLines[X]);Y++,M.push({index:N+1,amount:F.newLines.length}),O+=F.newLines.length,F=D[++B]}else this.lines.set(Y,b[N--]);let U=0;for(let Y=M.length-1;Y>=0;Y--)M[Y].index+=U,this.lines.onInsertEmitter.fire(M[Y]),U+=M[Y].amount;const V=Math.max(0,T+E-this.lines.maxLength);V>0&&this.lines.onTrimEmitter.fire(V)}}translateBufferLineToString(p,d,k=0,D){const E=this.lines.get(p);return E?E.translateToString(d,k,D):""}getWrappedRangeForLine(p){let d=p,k=p;for(;d>0&&this.lines.get(d).isWrapped;)d--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:d,last:k}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].line===p&&(this.markers[d].dispose(),this.markers.splice(d--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const d=new l.Marker(p);return this.markers.push(d),d.register(this.lines.onTrim((k=>{d.line-=k,d.line<0&&d.dispose()}))),d.register(this.lines.onInsert((k=>{d.line>=k.index&&(d.line+=k.amount)}))),d.register(this.lines.onDelete((k=>{d.line>=k.index&&d.line<k.index+k.amount&&d.dispose(),d.line>k.index&&(d.line-=k.amount)}))),d.register(d.onDispose((()=>this._removeMarker(d)))),d}_removeMarker(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const g=c(3734),_=c(511),u=c(643),y=c(482);r.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);let S=0;class L{constructor(l,m,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*l);const d=m||_.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let k=0;k<l;++k)this.setCell(k,d);this.length=l}get(l){const m=this._data[3*l+0],p=2097151&m;return[this._data[3*l+1],2097152&m?this._combined[l]:p?(0,y.stringFromCodePoint)(p):"",m>>22,2097152&m?this._combined[l].charCodeAt(this._combined[l].length-1):p]}set(l,m){this._data[3*l+1]=m[u.CHAR_DATA_ATTR_INDEX],m[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[l]=m[1],this._data[3*l+0]=2097152|l|m[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*l+0]=m[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(l){return this._data[3*l+0]>>22}hasWidth(l){return 12582912&this._data[3*l+0]}getFg(l){return this._data[3*l+1]}getBg(l){return this._data[3*l+2]}hasContent(l){return 4194303&this._data[3*l+0]}getCodePoint(l){const m=this._data[3*l+0];return 2097152&m?this._combined[l].charCodeAt(this._combined[l].length-1):2097151&m}isCombined(l){return 2097152&this._data[3*l+0]}getString(l){const m=this._data[3*l+0];return 2097152&m?this._combined[l]:2097151&m?(0,y.stringFromCodePoint)(2097151&m):""}isProtected(l){return 536870912&this._data[3*l+2]}loadCell(l,m){return S=3*l,m.content=this._data[S+0],m.fg=this._data[S+1],m.bg=this._data[S+2],2097152&m.content&&(m.combinedData=this._combined[l]),268435456&m.bg&&(m.extended=this._extendedAttrs[l]),m}setCell(l,m){2097152&m.content&&(this._combined[l]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[l]=m.extended),this._data[3*l+0]=m.content,this._data[3*l+1]=m.fg,this._data[3*l+2]=m.bg}setCellFromCodepoint(l,m,p,d){268435456&d.bg&&(this._extendedAttrs[l]=d.extended),this._data[3*l+0]=m|p<<22,this._data[3*l+1]=d.fg,this._data[3*l+2]=d.bg}addCodepointToCell(l,m,p){let d=this._data[3*l+0];2097152&d?this._combined[l]+=(0,y.stringFromCodePoint)(m):2097151&d?(this._combined[l]=(0,y.stringFromCodePoint)(2097151&d)+(0,y.stringFromCodePoint)(m),d&=-2097152,d|=2097152):d=m|4194304,p&&(d&=-12582913,d|=p<<22),this._data[3*l+0]=d}insertCells(l,m,p){if((l%=this.length)&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,p),m<this.length-l){const d=new _.CellData;for(let k=this.length-l-m-1;k>=0;--k)this.setCell(l+m+k,this.loadCell(l+k,d));for(let k=0;k<m;++k)this.setCell(l+k,p)}else for(let d=l;d<this.length;++d)this.setCell(d,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(l,m,p){if(l%=this.length,m<this.length-l){const d=new _.CellData;for(let k=0;k<this.length-l-m;++k)this.setCell(l+k,this.loadCell(l+m+k,d));for(let k=this.length-m;k<this.length;++k)this.setCell(k,p)}else for(let d=l;d<this.length;++d)this.setCell(d,p);l&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,p),this.getWidth(l)!==0||this.hasContent(l)||this.setCellFromCodepoint(l,0,1,p)}replaceCells(l,m,p,d=!1){if(d)for(l&&this.getWidth(l-1)===2&&!this.isProtected(l-1)&&this.setCellFromCodepoint(l-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,p);l<m&&l<this.length;)this.isProtected(l)||this.setCell(l,p),l++;else for(l&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,p);l<m&&l<this.length;)this.setCell(l++,p)}resize(l,m){if(l===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*l;if(l>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const d=new Uint32Array(p);d.set(this._data),this._data=d}for(let d=this.length;d<l;++d)this.setCell(d,m)}else{this._data=this._data.subarray(0,p);const d=Object.keys(this._combined);for(let D=0;D<d.length;D++){const E=parseInt(d[D],10);E>=l&&delete this._combined[E]}const k=Object.keys(this._extendedAttrs);for(let D=0;D<k.length;D++){const E=parseInt(k[D],10);E>=l&&delete this._extendedAttrs[E]}}return this.length=l,4*p*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const l=new Uint32Array(this._data.length);return l.set(this._data),this._data=l,1}return 0}fill(l,m=!1){if(m)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,l);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,l)}}copyFrom(l){this.length!==l.length?this._data=new Uint32Array(l._data):this._data.set(l._data),this.length=l.length,this._combined={};for(const m in l._combined)this._combined[m]=l._combined[m];this._extendedAttrs={};for(const m in l._extendedAttrs)this._extendedAttrs[m]=l._extendedAttrs[m];this.isWrapped=l.isWrapped}clone(){const l=new L(0);l._data=new Uint32Array(this._data),l.length=this.length;for(const m in this._combined)l._combined[m]=this._combined[m];for(const m in this._extendedAttrs)l._extendedAttrs[m]=this._extendedAttrs[m];return l.isWrapped=this.isWrapped,l}getTrimmedLength(){for(let l=this.length-1;l>=0;--l)if(4194303&this._data[3*l+0])return l+(this._data[3*l+0]>>22);return 0}getNoBgTrimmedLength(){for(let l=this.length-1;l>=0;--l)if(4194303&this._data[3*l+0]||50331648&this._data[3*l+2])return l+(this._data[3*l+0]>>22);return 0}copyCellsFrom(l,m,p,d,k){const D=l._data;if(k)for(let M=d-1;M>=0;M--){for(let b=0;b<3;b++)this._data[3*(p+M)+b]=D[3*(m+M)+b];268435456&D[3*(m+M)+2]&&(this._extendedAttrs[p+M]=l._extendedAttrs[m+M])}else for(let M=0;M<d;M++){for(let b=0;b<3;b++)this._data[3*(p+M)+b]=D[3*(m+M)+b];268435456&D[3*(m+M)+2]&&(this._extendedAttrs[p+M]=l._extendedAttrs[m+M])}const E=Object.keys(l._combined);for(let M=0;M<E.length;M++){const b=parseInt(E[M],10);b>=m&&(this._combined[b-m+p]=l._combined[b])}}translateToString(l,m,p,d){m=m??0,p=p??this.length,l&&(p=Math.min(p,this.getTrimmedLength())),d&&(d.length=0);let k="";for(;m<p;){const D=this._data[3*m+0],E=2097151&D,M=2097152&D?this._combined[m]:E?(0,y.stringFromCodePoint)(E):u.WHITESPACE_CELL_CHAR;if(k+=M,d)for(let b=0;b<M.length;++b)d.push(m);m+=D>>22||1}return d&&d.push(m),k}}r.BufferLine=L},4841:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(c,g){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return g*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(x,r)=>{function c(g,_,u){if(_===g.length-1)return g[_].getTrimmedLength();const y=!g[_].hasContent(u-1)&&g[_].getWidth(u-1)===1,S=g[_+1].getWidth(0)===2;return y&&S?u-1:u}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(g,_,u,y,S){const L=[];for(let f=0;f<g.length-1;f++){let l=f,m=g.get(++l);if(!m.isWrapped)continue;const p=[g.get(f)];for(;l<g.length&&m.isWrapped;)p.push(m),m=g.get(++l);if(y>=f&&y<l){f+=p.length-1;continue}let d=0,k=c(p,d,_),D=1,E=0;for(;D<p.length;){const b=c(p,D,_),T=b-E,N=u-k,B=Math.min(T,N);p[d].copyCellsFrom(p[D],E,k,B,!1),k+=B,k===u&&(d++,k=0),E+=B,E===b&&(D++,E=0),k===0&&d!==0&&p[d-1].getWidth(u-1)===2&&(p[d].copyCellsFrom(p[d-1],u-1,k++,1,!1),p[d-1].setCell(u-1,S))}p[d].replaceCells(k,u,S);let M=0;for(let b=p.length-1;b>0&&(b>d||p[b].getTrimmedLength()===0);b--)M++;M>0&&(L.push(f+p.length-M),L.push(M)),f+=p.length-1}return L},r.reflowLargerCreateNewLayout=function(g,_){const u=[];let y=0,S=_[y],L=0;for(let f=0;f<g.length;f++)if(S===f){const l=_[++y];g.onDeleteEmitter.fire({index:f-L,amount:l}),f+=l-1,L+=l,S=_[++y]}else u.push(f);return{layout:u,countRemoved:L}},r.reflowLargerApplyNewLayout=function(g,_){const u=[];for(let y=0;y<_.length;y++)u.push(g.get(_[y]));for(let y=0;y<u.length;y++)g.set(y,u[y]);g.length=_.length},r.reflowSmallerGetNewLineLengths=function(g,_,u){const y=[],S=g.map(((m,p)=>c(g,p,_))).reduce(((m,p)=>m+p));let L=0,f=0,l=0;for(;l<S;){if(S-l<u){y.push(S-l);break}L+=u;const m=c(g,f,_);L>m&&(L-=m,f++);const p=g[f].getWidth(L-1)===2;p&&L--;const d=p?u-1:u;y.push(d),l+=d}return y},r.getWrappedLineTrimmedLength=c},5295:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const g=c(8460),_=c(844),u=c(9092);class y extends _.Disposable{constructor(L,f){super(),this._optionsService=L,this._bufferService=f,this._onBufferActivate=this.register(new g.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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.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(L){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(L),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(L,f){this._normal.resize(L,f),this._alt.resize(L,f),this.setupTabStops(L)}setupTabStops(L){this._normal.setupTabStops(L),this._alt.setupTabStops(L)}}r.BufferSet=y},511:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const g=c(482),_=c(643),u=c(3734);class y extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(L){const f=new y;return f.setFromCharData(L),f}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[_.CHAR_DATA_CHAR_INDEX].length===2){const l=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=l&&l<=56319){const m=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(l-55296)+m-56320+65536|L[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=y},643:(x,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:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const g=c(8460),_=c(844);class u{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new g.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(S){return this._disposables.push(S),S}}r.Marker=u,u._nextId=1},7116:(x,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:(x,r)=>{var c,g,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
115
- `,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL=""})(c||(r.C0=c={})),(function(u){u.PAD="€",u.HOP="",u.BPH="‚",u.NBH="ƒ",u.IND="„",u.NEL="…",u.SSA="†",u.ESA="‡",u.HTS="ˆ",u.HTJ="‰",u.VTS="Š",u.PLD="‹",u.PLU="Œ",u.RI="",u.SS2="Ž",u.SS3="",u.DCS="",u.PU1="‘",u.PU2="’",u.STS="“",u.CCH="”",u.MW="•",u.SPA="–",u.EPA="—",u.SOS="˜",u.SGCI="™",u.SCI="š",u.CSI="›",u.ST="œ",u.OSC="",u.PM="ž",u.APC="Ÿ"})(g||(r.C1=g={})),(function(u){u.ST=`${c.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const g=c(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(u,y,S,L){const f={type:0,cancel:!1,key:void 0},l=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?f.key=y?g.C0.ESC+"OA":g.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?f.key=y?g.C0.ESC+"OD":g.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?f.key=y?g.C0.ESC+"OC":g.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(f.key=y?g.C0.ESC+"OB":g.C0.ESC+"[B");break;case 8:f.key=u.ctrlKey?"\b":g.C0.DEL,u.altKey&&(f.key=g.C0.ESC+f.key);break;case 9:if(u.shiftKey){f.key=g.C0.ESC+"[Z";break}f.key=g.C0.HT,f.cancel=!0;break;case 13:f.key=u.altKey?g.C0.ESC+g.C0.CR:g.C0.CR,f.cancel=!0;break;case 27:f.key=g.C0.ESC,u.altKey&&(f.key=g.C0.ESC+g.C0.ESC),f.cancel=!0;break;case 37:if(u.metaKey)break;l?(f.key=g.C0.ESC+"[1;"+(l+1)+"D",f.key===g.C0.ESC+"[1;3D"&&(f.key=g.C0.ESC+(S?"b":"[1;5D"))):f.key=y?g.C0.ESC+"OD":g.C0.ESC+"[D";break;case 39:if(u.metaKey)break;l?(f.key=g.C0.ESC+"[1;"+(l+1)+"C",f.key===g.C0.ESC+"[1;3C"&&(f.key=g.C0.ESC+(S?"f":"[1;5C"))):f.key=y?g.C0.ESC+"OC":g.C0.ESC+"[C";break;case 38:if(u.metaKey)break;l?(f.key=g.C0.ESC+"[1;"+(l+1)+"A",S||f.key!==g.C0.ESC+"[1;3A"||(f.key=g.C0.ESC+"[1;5A")):f.key=y?g.C0.ESC+"OA":g.C0.ESC+"[A";break;case 40:if(u.metaKey)break;l?(f.key=g.C0.ESC+"[1;"+(l+1)+"B",S||f.key!==g.C0.ESC+"[1;3B"||(f.key=g.C0.ESC+"[1;5B")):f.key=y?g.C0.ESC+"OB":g.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(f.key=g.C0.ESC+"[2~");break;case 46:f.key=l?g.C0.ESC+"[3;"+(l+1)+"~":g.C0.ESC+"[3~";break;case 36:f.key=l?g.C0.ESC+"[1;"+(l+1)+"H":y?g.C0.ESC+"OH":g.C0.ESC+"[H";break;case 35:f.key=l?g.C0.ESC+"[1;"+(l+1)+"F":y?g.C0.ESC+"OF":g.C0.ESC+"[F";break;case 33:u.shiftKey?f.type=2:u.ctrlKey?f.key=g.C0.ESC+"[5;"+(l+1)+"~":f.key=g.C0.ESC+"[5~";break;case 34:u.shiftKey?f.type=3:u.ctrlKey?f.key=g.C0.ESC+"[6;"+(l+1)+"~":f.key=g.C0.ESC+"[6~";break;case 112:f.key=l?g.C0.ESC+"[1;"+(l+1)+"P":g.C0.ESC+"OP";break;case 113:f.key=l?g.C0.ESC+"[1;"+(l+1)+"Q":g.C0.ESC+"OQ";break;case 114:f.key=l?g.C0.ESC+"[1;"+(l+1)+"R":g.C0.ESC+"OR";break;case 115:f.key=l?g.C0.ESC+"[1;"+(l+1)+"S":g.C0.ESC+"OS";break;case 116:f.key=l?g.C0.ESC+"[15;"+(l+1)+"~":g.C0.ESC+"[15~";break;case 117:f.key=l?g.C0.ESC+"[17;"+(l+1)+"~":g.C0.ESC+"[17~";break;case 118:f.key=l?g.C0.ESC+"[18;"+(l+1)+"~":g.C0.ESC+"[18~";break;case 119:f.key=l?g.C0.ESC+"[19;"+(l+1)+"~":g.C0.ESC+"[19~";break;case 120:f.key=l?g.C0.ESC+"[20;"+(l+1)+"~":g.C0.ESC+"[20~";break;case 121:f.key=l?g.C0.ESC+"[21;"+(l+1)+"~":g.C0.ESC+"[21~";break;case 122:f.key=l?g.C0.ESC+"[23;"+(l+1)+"~":g.C0.ESC+"[23~";break;case 123:f.key=l?g.C0.ESC+"[24;"+(l+1)+"~":g.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(S&&!L||!u.altKey||u.metaKey)!S||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?f.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(f.key=g.C0.US),u.key==="@"&&(f.key=g.C0.NUL)):u.keyCode===65&&(f.type=1);else{const m=_[u.keyCode],p=m==null?void 0:m[u.shiftKey?1:0];if(p)f.key=g.C0.ESC+p;else if(u.keyCode>=65&&u.keyCode<=90){const d=u.ctrlKey?u.keyCode-64:u.keyCode+32;let k=String.fromCharCode(d);u.shiftKey&&(k=k.toUpperCase()),f.key=g.C0.ESC+k}else if(u.keyCode===32)f.key=g.C0.ESC+(u.ctrlKey?g.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let d=u.code.slice(3,4);u.shiftKey||(d=d.toLowerCase()),f.key=g.C0.ESC+d,f.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?f.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?f.key=g.C0.NUL:u.keyCode>=51&&u.keyCode<=55?f.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?f.key=g.C0.DEL:u.keyCode===219?f.key=g.C0.ESC:u.keyCode===220?f.key=g.C0.FS:u.keyCode===221&&(f.key=g.C0.GS)}return f}},482:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},r.utf32ToString=function(c,g=0,_=c.length){let u="";for(let y=g;y<_;++y){let S=c[y];S>65535?(S-=65536,u+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):u+=String.fromCharCode(S)}return u},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?g[u++]=1024*(this._interim-55296)+S-56320+65536:(g[u++]=this._interim,g[u++]=S),this._interim=0}for(let S=y;S<_;++S){const L=c.charCodeAt(S);if(55296<=L&&L<=56319){if(++S>=_)return this._interim=L,u;const f=c.charCodeAt(S);56320<=f&&f<=57343?g[u++]=1024*(L-55296)+f-56320+65536:(g[u++]=L,g[u++]=f)}else L!==65279&&(g[u++]=L)}return u}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const _=c.length;if(!_)return 0;let u,y,S,L,f=0,l=0,m=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)D<<=6,D|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;m<T;){if(m>=_)return 0;if(E=c[m++],(192&E)!=128){m--,k=!0;break}this.interim[M++]=E,D<<=6,D|=63&E}k||(b===2?D<128?m--:g[f++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(g[f++]=D):D<65536||D>1114111||(g[f++]=D)),this.interim.fill(0)}const p=_-4;let d=m;for(;d<_;){for(;!(!(d<p)||128&(u=c[d])||128&(y=c[d+1])||128&(S=c[d+2])||128&(L=c[d+3]));)g[f++]=u,g[f++]=y,g[f++]=S,g[f++]=L,d+=4;if(u=c[d++],u<128)g[f++]=u;else if((224&u)==192){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(l=(31&u)<<6|63&y,l<128){d--;continue}g[f++]=l}else if((240&u)==224){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(l=(15&u)<<12|(63&y)<<6|63&S,l<2048||l>=55296&&l<=57343||l===65279)continue;g[f++]=l}else if((248&u)==240){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,f;if(L=c[d++],(192&L)!=128){d--;continue}if(l=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&L,l<65536||l>1114111)continue;g[f++]=l}}return f}}},225:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const g=c(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]],u=[[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 y;r.UnicodeV6=class{constructor(){if(this.version="6",!y){y=new Uint8Array(65536),y.fill(1),y[0]=0,y.fill(0,1,32),y.fill(0,127,160),y.fill(2,4352,4448),y[9001]=2,y[9002]=2,y.fill(2,11904,42192),y[12351]=1,y.fill(2,44032,55204),y.fill(2,63744,64256),y.fill(2,65040,65050),y.fill(2,65072,65136),y.fill(2,65280,65377),y.fill(2,65504,65511);for(let S=0;S<_.length;++S)y.fill(0,_[S][0],_[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?y[S]:(function(L,f){let l,m=0,p=f.length-1;if(L<f[0][0]||L>f[p][1])return!1;for(;p>=m;)if(l=m+p>>1,L>f[l][1])m=l+1;else{if(!(L<f[l][0]))return!0;p=l-1}return!1})(S,u)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,L){let f=this.wcwidth(S),l=f===0&&L!==0;if(l){const m=g.UnicodeService.extractWidth(L);m===0?l=!1:m>f&&(f=m)}return g.UnicodeService.createPropertyValue(0,f,l)}}},5981:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const g=c(8460),_=c(844);class u extends _.Disposable{constructor(S){super(),this._action=S,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,L){if(L!==void 0&&this._syncCalls>L)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,L){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+=S.length,this._writeBuffer.push(S),this._callbacks.push(L),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(L)}_innerWrite(S=0,L=!0){const f=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const l=this._writeBuffer[this._bufferOffset],m=this._action(l,L);if(m){const d=k=>Date.now()-f>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(f,k);return void m.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(d)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=l.length,Date.now()-f>=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=u},5941:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const c=/^([\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})$/,g=/^[\da-f]+$/;function _(u,y){const S=u.toString(16),L=S.length<2?"0"+S:S;switch(y){case 4:return S[0];case 8:return L;case 12:return(L+L).slice(0,3);default:return L+L}}r.parseColor=function(u){if(!u)return;let y=u.toLowerCase();if(y.indexOf("rgb:")===0){y=y.slice(4);const S=c.exec(y);if(S){const L=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/L*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/L*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/L*255)]}}else if(y.indexOf("#")===0&&(y=y.slice(1),g.exec(y)&&[3,6,9,12].includes(y.length))){const S=y.length/3,L=[0,0,0];for(let f=0;f<3;++f){const l=parseInt(y.slice(S*f,S*f+S),16);L[f]=S===1?l<<4:S===2?l:S===3?l>>4:l>>8}return L}},r.toRgbString=function(u,y=16){const[S,L,f]=u;return`rgb:${_(S,y)}/${_(L,y)}/${_(f,y)}`}},5770:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const g=c(482),_=c(8742),u=c(5770),y=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=y,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=y}registerHandler(L,f){this._handlers[L]===void 0&&(this._handlers[L]=[]);const l=this._handlers[L];return l.push(f),{dispose:()=>{const m=l.indexOf(f);m!==-1&&l.splice(m,1)}}}clearHandler(L){this._handlers[L]&&delete this._handlers[L]}setHandlerFallback(L){this._handlerFb=L}reset(){if(this._active.length)for(let L=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;L>=0;--L)this._active[L].unhook(!1);this._stack.paused=!1,this._active=y,this._ident=0}hook(L,f){if(this.reset(),this._ident=L,this._active=this._handlers[L]||y,this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(L,f,l){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(L,f,l);else this._handlerFb(this._ident,"PUT",(0,g.utf32ToString)(L,f,l))}unhook(L,f=!0){if(this._active.length){let l=!1,m=this._active.length-1,p=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,l=f,p=this._stack.fallThrough,this._stack.paused=!1),!p&&l===!1){for(;m>=0&&(l=this._active[m].unhook(L),l!==!0);m--)if(l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,l;m--}for(;m>=0;m--)if(l=this._active[m].unhook(!1),l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,l}else this._handlerFb(this._ident,"UNHOOK",L);this._active=y,this._ident=0}};const S=new _.Params;S.addParam(0),r.DcsHandler=class{constructor(L){this._handler=L,this._data="",this._params=S,this._hitLimit=!1}hook(L){this._params=L.length>1||L.params[0]?L.clone():S,this._data="",this._hitLimit=!1}put(L,f,l){this._hitLimit||(this._data+=(0,g.utf32ToString)(L,f,l),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(L){let f=!1;if(this._hitLimit)f=!1;else if(L&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then((l=>(this._params=S,this._data="",this._hitLimit=!1,l)));return this._params=S,this._data="",this._hitLimit=!1,f}}},2015:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const g=c(844),_=c(8742),u=c(6242),y=c(6351);class S{constructor(m){this.table=new Uint8Array(m)}setDefault(m,p){this.table.fill(m<<4|p)}add(m,p,d,k){this.table[p<<8|m]=d<<4|k}addMany(m,p,d,k){for(let D=0;D<m.length;D++)this.table[p<<8|m[D]]=d<<4|k}}r.TransitionTable=S;const L=160;r.VT500_TRANSITION_TABLE=(function(){const l=new S(4095),m=Array.apply(null,Array(256)).map(((M,b)=>b)),p=(M,b)=>m.slice(M,b),d=p(32,127),k=p(0,24);k.push(25),k.push.apply(k,p(28,32));const D=p(0,14);let E;for(E in l.setDefault(1,0),l.addMany(d,0,2,0),D)l.addMany([24,26,153,154],E,3,0),l.addMany(p(128,144),E,3,0),l.addMany(p(144,152),E,3,0),l.add(156,E,0,0),l.add(27,E,11,1),l.add(157,E,4,8),l.addMany([152,158,159],E,0,7),l.add(155,E,11,3),l.add(144,E,11,9);return l.addMany(k,0,3,0),l.addMany(k,1,3,1),l.add(127,1,0,1),l.addMany(k,8,0,8),l.addMany(k,3,3,3),l.add(127,3,0,3),l.addMany(k,4,3,4),l.add(127,4,0,4),l.addMany(k,6,3,6),l.addMany(k,5,3,5),l.add(127,5,0,5),l.addMany(k,2,3,2),l.add(127,2,0,2),l.add(93,1,4,8),l.addMany(d,8,5,8),l.add(127,8,5,8),l.addMany([156,27,24,26,7],8,6,0),l.addMany(p(28,32),8,0,8),l.addMany([88,94,95],1,0,7),l.addMany(d,7,0,7),l.addMany(k,7,0,7),l.add(156,7,0,0),l.add(127,7,0,7),l.add(91,1,11,3),l.addMany(p(64,127),3,7,0),l.addMany(p(48,60),3,8,4),l.addMany([60,61,62,63],3,9,4),l.addMany(p(48,60),4,8,4),l.addMany(p(64,127),4,7,0),l.addMany([60,61,62,63],4,0,6),l.addMany(p(32,64),6,0,6),l.add(127,6,0,6),l.addMany(p(64,127),6,0,0),l.addMany(p(32,48),3,9,5),l.addMany(p(32,48),5,9,5),l.addMany(p(48,64),5,0,6),l.addMany(p(64,127),5,7,0),l.addMany(p(32,48),4,9,5),l.addMany(p(32,48),1,9,2),l.addMany(p(32,48),2,9,2),l.addMany(p(48,127),2,10,0),l.addMany(p(48,80),1,10,0),l.addMany(p(81,88),1,10,0),l.addMany([89,90,92],1,10,0),l.addMany(p(96,127),1,10,0),l.add(80,1,11,9),l.addMany(k,9,0,9),l.add(127,9,0,9),l.addMany(p(28,32),9,0,9),l.addMany(p(32,48),9,9,12),l.addMany(p(48,60),9,8,10),l.addMany([60,61,62,63],9,9,10),l.addMany(k,11,0,11),l.addMany(p(32,128),11,0,11),l.addMany(p(28,32),11,0,11),l.addMany(k,10,0,10),l.add(127,10,0,10),l.addMany(p(28,32),10,0,10),l.addMany(p(48,60),10,8,10),l.addMany([60,61,62,63],10,0,11),l.addMany(p(32,48),10,9,12),l.addMany(k,12,0,12),l.add(127,12,0,12),l.addMany(p(28,32),12,0,12),l.addMany(p(32,48),12,9,12),l.addMany(p(48,64),12,0,11),l.addMany(p(64,127),12,12,13),l.addMany(p(64,127),10,12,13),l.addMany(p(64,127),9,12,13),l.addMany(k,13,13,13),l.addMany(d,13,13,13),l.add(127,13,0,13),l.addMany([27,156,24,26],13,14,0),l.add(L,0,2,0),l.add(L,8,5,8),l.add(L,6,0,6),l.add(L,11,0,11),l.add(L,13,13,13),l})();class f extends g.Disposable{constructor(m=r.VT500_TRANSITION_TABLE){super(),this._transitions=m,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=(p,d,k)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,d)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,g.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new u.OscParser),this._dcsParser=this.register(new y.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,p=[64,126]){let d=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(d=m.prefix.charCodeAt(0),d&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;D<m.intermediates.length;++D){const E=m.intermediates.charCodeAt(D);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=E}}if(m.final.length!==1)throw new Error("final must be a single byte");const k=m.final.charCodeAt(0);if(p[0]>k||k>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return d<<=8,d|=k,d}identToString(m){const p=[];for(;m;)p.push(String.fromCharCode(255&m)),m>>=8;return p.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,p){const d=this._identifier(m,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);const k=this._escHandlers[d];return k.push(p),{dispose:()=>{const D=k.indexOf(p);D!==-1&&k.splice(D,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,p){this._executeHandlers[m.charCodeAt(0)]=p}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,p){const d=this._identifier(m);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);const k=this._csiHandlers[d];return k.push(p),{dispose:()=>{const D=k.indexOf(p);D!==-1&&k.splice(D,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,p){return this._dcsParser.registerHandler(this._identifier(m),p)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,p){return this._oscParser.registerHandler(m,p)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}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(m,p,d,k,D){this._parseStack.state=m,this._parseStack.handlers=p,this._parseStack.handlerPos=d,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(m,p,d){let k,D=0,E=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&&(k=b[T](this._params),k!==!0);T--)if(k instanceof Promise)return this._parseStack.handlerPos=T,k}this._parseStack.handlers=[];break;case 4:if(d===!1&&T>-1){for(;T>=0&&(k=b[T](),k!==!0);T--)if(k instanceof Promise)return this._parseStack.handlerPos=T,k}this._parseStack.handlers=[];break;case 6:if(D=m[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,d),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=m[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,d),k)return k;D===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<p;++b){switch(D=m[b],E=this._transitions.table[this.currentState<<8|(D<160?D:L)],E>>4){case 2:for(let O=b+1;;++O){if(O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}}break;case 3:this._executeHandlers[D]?this._executeHandlers[D]():this._executeHandlerFb(D),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:b,code:D,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|D];let N=T?T.length-1:-1;for(;N>=0&&(k=T[N](this._params),k!==!0);N--)if(k instanceof Promise)return this._preserveStack(3,T,N,E,b),k;N<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++b<p&&(D=m[b])>47&&D<60);b--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const B=this._escHandlers[this._collect<<8|D];let F=B?B.length-1:-1;for(;F>=0&&(k=B[F](),k!==!0);F--)if(k instanceof Promise)return this._preserveStack(4,B,F,E,b),k;F<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let O=b+1;;++O)if(O>=p||(D=m[O])===24||D===26||D===27||D>127&&D<L){this._dcsParser.put(m,b,O),b=O-1;break}break;case 14:if(k=this._dcsParser.unhook(D!==24&&D!==26),k)return this._preserveStack(6,[],0,E,b),k;D===27&&(E|=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 O=b+1;;O++)if(O>=p||(D=m[O])<32||D>127&&D<L){this._oscParser.put(m,b,O),b=O-1;break}break;case 6:if(k=this._oscParser.end(D!==24&&D!==26),k)return this._preserveStack(5,[],0,E,b),k;D===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}r.EscapeSequenceParser=f},6242:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const g=c(5770),_=c(482),u=[];r.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(y,S){this._handlers[y]===void 0&&(this._handlers[y]=[]);const L=this._handlers[y];return L.push(S),{dispose:()=>{const f=L.indexOf(S);f!==-1&&L.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].start();else this._handlerFb(this._id,"START")}_put(y,S,L){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,S,L);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(y,S,L))}start(){this.reset(),this._state=1}put(y,S,L){if(this._state!==3){if(this._state===1)for(;S<L;){const f=y[S++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&L-S>0&&this._put(y,S,L)}}end(y,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let L=!1,f=this._active.length-1,l=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,L=S,l=this._stack.fallThrough,this._stack.paused=!1),!l&&L===!1){for(;f>=0&&(L=this._active[f].end(y),L!==!0);f--)if(L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,L;f--}for(;f>=0;f--)if(L=this._active[f].end(!1),L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,L}else this._handlerFb(this._id,"END",y);this._active=u,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(y){this._handler=y,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(y,S,L){this._hitLimit||(this._data+=(0,_.utf32ToString)(y,S,L),this._data.length>g.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(y){let S=!1;if(this._hitLimit)S=!1;else if(y&&(S=this._handler(this._data),S instanceof Promise))return S.then((L=>(this._data="",this._hitLimit=!1,L)));return this._data="",this._hitLimit=!1,S}}},8742:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const c=2147483647;class g{static fromArray(u){const y=new g;if(!u.length)return y;for(let S=Array.isArray(u[0])?1:0;S<u.length;++S){const L=u[S];if(Array.isArray(L))for(let f=0;f<L.length;++f)y.addSubParam(L[f]);else y.addParam(L)}return y}constructor(u=32,y=32){if(this.maxLength=u,this.maxSubParamsLength=y,y>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(y),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const u=new g(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){const u=[];for(let y=0;y<this.length;++y){u.push(this.params[y]);const S=this._subParamsIdx[y]>>8,L=255&this._subParamsIdx[y];L-S>0&&u.push(Array.prototype.slice.call(this._subParams,S,L))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>c?c:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>c?c:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){const y=this._subParamsIdx[u]>>8,S=255&this._subParamsIdx[u];return S-y>0?this._subParams.subarray(y,S):null}getSubParamsAll(){const u={};for(let y=0;y<this.length;++y){const S=this._subParamsIdx[y]>>8,L=255&this._subParamsIdx[y];L-S>0&&(u[y]=this._subParams.slice(S,L))}return u}addDigit(u){let y;if(this._rejectDigits||!(y=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,L=S[y-1];S[y-1]=~L?Math.min(10*L+u,c):u}}r.Params=g},5741:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,g){const _={instance:g,dispose:g.dispose,isDisposed:!1};this._addons.push(_),g.dispose=()=>this._wrappedAddonDispose(_),g.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let g=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===c){g=_;break}if(g===-1)throw new Error("Could not dispose an addon that has not been loaded");c.isDisposed=!0,c.dispose.apply(c.instance),this._addons.splice(g,1)}}},8771:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const g=c(3785),_=c(511);r.BufferApiView=class{constructor(u,y){this._buffer=u,this.type=y}init(u){return this._buffer=u,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(u){const y=this._buffer.lines.get(u);if(y)return new g.BufferLineApiView(y)}getNullCell(){return new _.CellData}}},3785:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const g=c(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,u){if(!(_<0||_>=this._line.length))return u?(this._line.loadCell(_,u),u):this._line.loadCell(_,new g.CellData)}translateToString(_,u,y){return this._line.translateToString(_,u,y)}}},8285:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const g=c(8771),_=c(8460),u=c(844);class y extends u.Disposable{constructor(L){super(),this._core=L,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new g.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new g.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=y},7975:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,g){return this._core.registerCsiHandler(c,(_=>g(_.toArray())))}addCsiHandler(c,g){return this.registerCsiHandler(c,g)}registerDcsHandler(c,g){return this._core.registerDcsHandler(c,((_,u)=>g(_,u.toArray())))}addDcsHandler(c,g){return this.registerDcsHandler(c,g)}registerEscHandler(c,g){return this._core.registerEscHandler(c,g)}addEscHandler(c,g){return this.registerEscHandler(c,g)}registerOscHandler(c,g){return this._core.registerOscHandler(c,g)}addOscHandler(c,g){return this.registerOscHandler(c,g)}}},7090:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(x,r,c){var g=this&&this.__decorate||function(l,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,m,p,d);else for(var M=l.length-1;M>=0;M--)(k=l[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(l,m){return function(p,d){m(p,d,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const u=c(8460),y=c(844),S=c(5295),L=c(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let f=r.BufferService=class extends y.Disposable{get buffer(){return this.buffers.active}constructor(l){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(l.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(l.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(l,this))}resize(l,m){this.cols=l,this.rows=m,this.buffers.resize(l,m),this._onResize.fire({cols:l,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(l,m=!1){const p=this.buffer;let d;d=this._cachedBlankLine,d&&d.length===this.cols&&d.getFg(0)===l.fg&&d.getBg(0)===l.bg||(d=p.getBlankLine(l,m),this._cachedBlankLine=d),d.isWrapped=m;const k=p.ybase+p.scrollTop,D=p.ybase+p.scrollBottom;if(p.scrollTop===0){const E=p.lines.isFull;D===p.lines.length-1?E?p.lines.recycle().copyFrom(d):p.lines.push(d.clone()):p.lines.splice(D+1,0,d.clone()),E?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const E=D-k+1;p.lines.shiftElements(k+1,E-1,-1),p.lines.set(D,d.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(l,m,p){const d=this.buffer;if(l<0){if(d.ydisp===0)return;this.isUserScrolling=!0}else l+d.ydisp>=d.ybase&&(this.isUserScrolling=!1);const k=d.ydisp;d.ydisp=Math.max(Math.min(d.ydisp+l,d.ybase),0),k!==d.ydisp&&(m||this._onScroll.fire(d.ydisp))}};r.BufferService=f=g([_(0,L.IOptionsService)],f)},7994:(x,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(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,g){this._charsets[c]=g,this.glevel===c&&(this.charset=g)}}},1753:function(x,r,c){var g=this&&this.__decorate||function(d,k,D,E){var M,b=arguments.length,T=b<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,D):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,k,D,E);else for(var N=d.length-1;N>=0;N--)(M=d[N])&&(T=(b<3?M(T):b>3?M(k,D,T):M(k,D))||T);return b>3&&T&&Object.defineProperty(k,D,T),T},_=this&&this.__param||function(d,k){return function(D,E){k(D,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const u=c(2585),y=c(8460),S=c(844),L={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 f(d,k){let D=(d.ctrl?16:0)|(d.shift?4:0)|(d.alt?8:0);return d.button===4?(D|=64,D|=d.action):(D|=3&d.button,4&d.button&&(D|=64),8&d.button&&(D|=128),d.action===32?D|=32:d.action!==0||k||(D|=3)),D}const l=String.fromCharCode,m={DEFAULT:d=>{const k=[f(d,!1)+32,d.col+32,d.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${l(k[0])}${l(k[1])}${l(k[2])}`},SGR:d=>{const k=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.col};${d.row}${k}`},SGR_PIXELS:d=>{const k=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.x};${d.y}${k}`}};let p=r.CoreMouseService=class extends S.Disposable{constructor(d,k){super(),this._bufferService=d,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new y.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(L))this.addProtocol(D,L[D]);for(const D of Object.keys(m))this.addEncoding(D,m[D]);this.reset()}addProtocol(d,k){this._protocols[d]=k}addEncoding(d,k){this._encodings[d]=k}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 k=this._encodings[this._activeEncoding](d);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!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,k,D){if(D){if(d.x!==k.x||d.y!==k.y)return!1}else if(d.col!==k.col||d.row!==k.row)return!1;return d.button===k.button&&d.action===k.action&&d.ctrl===k.ctrl&&d.alt===k.alt&&d.shift===k.shift}};r.CoreMouseService=p=g([_(0,u.IBufferService),_(1,u.ICoreService)],p)},6975:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const u=c(1439),y=c(8460),S=c(844),L=c(2585),f=Object.freeze({insertMode:!1}),l=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=r.CoreService=class extends S.Disposable{constructor(p,d,k){super(),this._bufferService=p,this._logService=d,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new y.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new y.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(f),this.decPrivateModes=(0,u.clone)(l)}reset(){this.modes=(0,u.clone)(f),this.decPrivateModes=(0,u.clone)(l)}triggerDataEvent(p,d=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;d&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),d&&this._onUserInput.fire(),this._logService.debug(`sending data "${p}"`,(()=>p.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,(()=>p.split("").map((d=>d.charCodeAt(0))))),this._onBinary.fire(p))}};r.CoreService=m=g([_(0,L.IBufferService),_(1,L.ILogService),_(2,L.IOptionsService)],m)},9074:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const g=c(8055),_=c(8460),u=c(844),y=c(6106);let S=0,L=0;class f extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new y.SortedList((p=>p==null?void 0:p.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,u.toDisposable)((()=>this.reset())))}registerDecoration(p){if(p.marker.isDisposed)return;const d=new l(p);if(d){const k=d.marker.onDispose((()=>d.dispose()));d.onDispose((()=>{d&&(this._decorations.delete(d)&&this._onDecorationRemoved.fire(d),k.dispose())})),this._decorations.insert(d),this._onDecorationRegistered.fire(d)}return d}reset(){for(const p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,d,k){let D=0,E=0;for(const M of this._decorations.getKeyIterator(d))D=M.options.x??0,E=D+(M.options.width??1),p>=D&&p<E&&(!k||(M.options.layer??"bottom")===k)&&(yield M)}forEachDecorationAtCell(p,d,k,D){this._decorations.forEachByKey(d,(E=>{S=E.options.x??0,L=S+(E.options.width??1),p>=S&&p<L&&(!k||(E.options.layer??"bottom")===k)&&D(E)}))}}r.DecorationService=f;class l extends u.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=g.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=g.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(p){super(),this.options=p,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=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const g=c(2585),_=c(8343);class u{constructor(...S){this._entries=new Map;for(const[L,f]of S)this.set(L,f)}set(S,L){const f=this._entries.get(S);return this._entries.set(S,L),f}forEach(S){for(const[L,f]of this._entries.entries())S(L,f)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}r.ServiceCollection=u,r.InstantiationService=class{constructor(){this._services=new u,this._services.set(g.IInstantiationService,this)}setService(y,S){this._services.set(y,S)}getService(y){return this._services.get(y)}createInstance(y,...S){const L=(0,_.getServiceDependencies)(y).sort(((m,p)=>m.index-p.index)),f=[];for(const m of L){const p=this._services.get(m.id);if(!p)throw new Error(`[createInstance] ${y.name} depends on UNKNOWN service ${m.id}.`);f.push(p)}const l=L.length>0?L[0].index:S.length;if(S.length!==l)throw new Error(`[createInstance] First service dependency of ${y.name} at position ${l+1} conflicts with ${S.length} static arguments`);return new y(...S,...f)}}},7866:function(x,r,c){var g=this&&this.__decorate||function(l,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,m,p,d);else for(var M=l.length-1;M>=0;M--)(k=l[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(l,m){return function(p,d){m(p,d,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const u=c(844),y=c(2585),S={trace:y.LogLevelEnum.TRACE,debug:y.LogLevelEnum.DEBUG,info:y.LogLevelEnum.INFO,warn:y.LogLevelEnum.WARN,error:y.LogLevelEnum.ERROR,off:y.LogLevelEnum.OFF};let L,f=r.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(l){super(),this._optionsService=l,this._logLevel=y.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),L=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(l){for(let m=0;m<l.length;m++)typeof l[m]=="function"&&(l[m]=l[m]())}_log(l,m,p){this._evalLazyOptionalParams(p),l.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(l,...m){var p;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,l,m)}debug(l,...m){var p;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,l,m)}info(l,...m){var p;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,l,m)}warn(l,...m){var p;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,l,m)}error(l,...m){var p;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,l,m)}};r.LogService=f=g([_(0,y.IOptionsService)],f),r.setTraceLogger=function(l){L=l},r.traceCall=function(l,m,p){if(typeof p.value!="function")throw new Error("not supported");const d=p.value;p.value=function(...k){if(L.logLevel!==y.LogLevelEnum.TRACE)return d.apply(this,k);L.trace(`GlyphRenderer#${d.name}(${k.map((E=>JSON.stringify(E))).join(", ")})`);const D=d.apply(this,k);return L.trace(`GlyphRenderer#${d.name} return`,D),D}}},7302:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const g=c(8460),_=c(844),u=c(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:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const y=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends _.Disposable{constructor(f){super(),this._onOptionChange=this.register(new g.EventEmitter),this.onOptionChange=this._onOptionChange.event;const l={...r.DEFAULT_OPTIONS};for(const m in f)if(m in l)try{const p=f[m];l[m]=this._sanitizeAndValidateOption(m,p)}catch(p){console.error(p)}this.rawOptions=l,this.options={...l},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(f,l){return this.onOptionChange((m=>{m===f&&l(this.rawOptions[f])}))}onMultipleOptionChange(f,l){return this.onOptionChange((m=>{f.indexOf(m)!==-1&&l()}))}_setupOptions(){const f=m=>{if(!(m in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},l=(m,p)=>{if(!(m in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);p=this._sanitizeAndValidateOption(m,p),this.rawOptions[m]!==p&&(this.rawOptions[m]=p,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const p={get:f.bind(this,m),set:l.bind(this,m)};Object.defineProperty(this.options,m,p)}}_sanitizeAndValidateOption(f,l){switch(f){case"cursorStyle":if(l||(l=r.DEFAULT_OPTIONS[f]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(l))throw new Error(`"${l}" is not a valid value for ${f}`);break;case"wordSeparator":l||(l=r.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof l=="number"&&1<=l&&l<=1e3)break;l=y.includes(l)?l:r.DEFAULT_OPTIONS[f];break;case"cursorWidth":l=Math.floor(l);case"lineHeight":case"tabStopWidth":if(l<1)throw new Error(`${f} cannot be less than 1, value: ${l}`);break;case"minimumContrastRatio":l=Math.max(1,Math.min(21,Math.round(10*l)/10));break;case"scrollback":if((l=Math.min(l,4294967295))<0)throw new Error(`${f} cannot be less than 0, value: ${l}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(l<=0)throw new Error(`${f} cannot be less than or equal to 0, value: ${l}`);break;case"rows":case"cols":if(!l&&l!==0)throw new Error(`${f} must be numeric, value: ${l}`);break;case"windowsPty":l=l??{}}return l}}r.OptionsService=S},2660:function(x,r,c){var g=this&&this.__decorate||function(S,L,f,l){var m,p=arguments.length,d=p<3?L:l===null?l=Object.getOwnPropertyDescriptor(L,f):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(S,L,f,l);else for(var k=S.length-1;k>=0;k--)(m=S[k])&&(d=(p<3?m(d):p>3?m(L,f,d):m(L,f))||d);return p>3&&d&&Object.defineProperty(L,f,d),d},_=this&&this.__param||function(S,L){return function(f,l){L(f,l,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const u=c(2585);let y=r.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const L=this._bufferService.buffer;if(S.id===void 0){const k=L.addMarker(L.ybase+L.y),D={data:S,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const f=S,l=this._getEntryIdKey(f),m=this._entriesWithId.get(l);if(m)return this.addLineToLink(m.id,L.ybase+L.y),m.id;const p=L.addMarker(L.ybase+L.y),d={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(d,p))),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(S,L){const f=this._dataByLinkId.get(S);if(f&&f.lines.every((l=>l.line!==L))){const l=this._bufferService.buffer.addMarker(L);f.lines.push(l),l.onDispose((()=>this._removeMarkerFromLink(f,l)))}}getLinkData(S){var L;return(L=this._dataByLinkId.get(S))==null?void 0:L.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,L){const f=S.lines.indexOf(L);f!==-1&&(S.lines.splice(f,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};r.OscLinkService=y=g([_(0,u.IBufferService)],y)},8343:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const c="di$target",g="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[g]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const u=function(y,S,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,l,m){l[c]===l?l[g].push({id:f,index:m}):(l[g]=[{id:f,index:m}],l[c]=l)})(u,y,L)};return u.toString=()=>_,r.serviceRegistry.set(_,u),u}},2585:(x,r,c)=>{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 g=c(8343);var _;r.IBufferService=(0,g.createDecorator)("BufferService"),r.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),r.ICoreService=(0,g.createDecorator)("CoreService"),r.ICharsetService=(0,g.createDecorator)("CharsetService"),r.IInstantiationService=(0,g.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,g.createDecorator)("LogService"),r.IOptionsService=(0,g.createDecorator)("OptionsService"),r.IOscLinkService=(0,g.createDecorator)("OscLinkService"),r.IUnicodeService=(0,g.createDecorator)("UnicodeService"),r.IDecorationService=(0,g.createDecorator)("DecorationService")},1480:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const g=c(8460),_=c(225);class u{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,L,f=!1){return(16777215&S)<<3|(3&L)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new g.EventEmitter,this.onChange=this._onChange.event;const S=new _.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let L=0,f=0;const l=S.length;for(let m=0;m<l;++m){let p=S.charCodeAt(m);if(55296<=p&&p<=56319){if(++m>=l)return L+this.wcwidth(p);const D=S.charCodeAt(m);56320<=D&&D<=57343?p=1024*(p-55296)+D-56320+65536:L+=this.wcwidth(D)}const d=this.charProperties(p,f);let k=u.extractWidth(d);u.extractShouldJoin(d)&&(k-=u.extractWidth(f)),L+=k,f=d}return L}charProperties(S,L){return this._activeProvider.charProperties(S,L)}}r.UnicodeService=u}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x].call(c.exports,c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.Terminal=void 0;const r=v(9042),c=v(3236),g=v(844),_=v(5741),u=v(8285),y=v(7975),S=v(7090),L=["cols","rows"];class f extends g.Disposable{constructor(m){super(),this._core=this.register(new c.Terminal(m)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const p=k=>this._core.options[k],d=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:p.bind(this,k),set:d.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(m){if(L.includes(m))throw new Error(`Option "${m}" 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 y.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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 u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const p in m)this._publicOptions[p]=m[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,p=!0){this._core.input(m,p)}resize(m,p){this._verifyIntegers(m,p),this._core.resize(m,p)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,p,d){this._verifyIntegers(m,p,d),this._core.select(m,p,d)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,p){this._verifyIntegers(m,p),this._core.selectLines(m,p)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,p){this._core.write(m,p)}writeln(m,p){this._core.write(m),this._core.write(`\r
116
- `,p)}paste(m){this._core.paste(m)}refresh(m,p){this._verifyIntegers(m,p),this._core.refresh(m,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return r}_verifyIntegers(...m){for(const p of m)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const p of m)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}x.Terminal=f})(),R})()))})(Nc)),Nc.exports}var I1=D1();function j1(n){return n.toLowerCase().startsWith("win")}function P1(n){return n.keyCode===86&&n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey}const O1=8,B1=100,F1=80,Rf=6,Mf=.02,H1=.95,$1=50;function U1(n,s){return Math.hypot(n,s)>O1}function W1(n,s){const i=n[n.length-1];if(i===void 0||s-i.t>F1)return 0;const h=n.filter(x=>i.t-x.t<=B1),v=h[0];if(v===void 0||h.length<2||i.t===v.t)return 0;const R=(v.y-i.y)/(i.t-v.t);return Math.max(-Rf,Math.min(Rf,R))}function z1(n,s){if(Math.abs(n)<Mf)return{delta:0,velocity:0};const i=Math.max(0,Math.min($1,s)),h=n*H1**(i/16);return{delta:n*i,velocity:Math.abs(h)<Mf?0:h}}function V1(n){const s=Math.trunc(n);return{pixels:s,rest:n-s}}const q1=60;function K1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const Af={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},Nf={dark:1,light:4.5};function Pm({terminalId:n,connection:s,active:i,theme:h,autoFocus:v=!0,pasteOnCtrlV:R=!1}){const x=I.useRef(null),r=I.useRef(null),c=I.useRef(null),g=I.useRef(h);return g.current=h,I.useEffect(()=>{const _=x.current;if(_===null)return;const u=new I1.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:Af[g.current],minimumContrastRatio:Nf[g.current]});r.current=u;const y=new T1.FitAddon;c.current=y,u.loadAddon(y),u.loadAddon(new M1.WebLinksAddon),u.open(_);let S=!1;const L=()=>{if(!(S||K1()!=="webgl")){S=!0;try{const J=new N1.WebglAddon;J.onContextLoss(()=>J.dispose()),u.loadAddon(J)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let f={cols:0,rows:0},l;const m=()=>_.clientWidth>0&&_.clientHeight>0,p=J=>{const{cols:Z,rows:de}=u;Z<=0||de<=0||!J&&Z===f.cols&&de===f.rows||(f={cols:Z,rows:de},s.send({type:"resize",terminalId:n,cols:Z,rows:de}))};let d={atBottom:!0,line:0},k=!1;const D=()=>{if(k||!m())return;const J=u.buffer.active;d={atBottom:J.viewportY>=J.baseY,line:J.viewportY}},E=()=>{const J=u.buffer.active;if(J.baseY===0)return;const Z=d.atBottom?J.baseY:Math.min(d.line,J.baseY);u.scrollToLine(Z>0?Z-1:Z+1),u.scrollToLine(Z)},M=u.onRender(D),b=u.onScroll(D);let T=m();const N=()=>{if(m()){try{y.fit()}catch{return}k&&(E(),k=!1),u.cols>0&&u.rows>0&&L(),p(!1)}},B=()=>{window.clearTimeout(l),l=window.setTimeout(N,q1)},F=new ResizeObserver(()=>{const J=m();k=!0,J&&!T&&E(),T=J,B()});F.observe(_),window.addEventListener("resize",B);let O=null,U=0,V=0;const Y=(J,Z,de)=>{const pe=u.element;if(pe===void 0)return;const re=V1(V+J);V=re.rest,re.pixels!==0&&pe.dispatchEvent(new WheelEvent("wheel",{deltaY:re.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:de,bubbles:!0,cancelable:!0}))},X=()=>{window.cancelAnimationFrame(U),U=0},G=(J,Z,de)=>{let pe=J,re=performance.now();const ke=Me=>{if(!m()){U=0;return}const et=z1(pe,Me-re);re=Me,Y(et.delta,Z,de),pe=et.velocity,U=pe===0?0:window.requestAnimationFrame(ke)};U=window.requestAnimationFrame(ke)},P=(J,Z)=>{for(let de=0;de<J.length;de++){const pe=J.item(de);if(pe!==null&&pe.identifier===Z)return pe}return null},$=J=>{X(),V=0;const Z=J.touches.length===1?J.touches.item(0):null;O=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(),O===null)return;const Z=P(J.touches,O.id);if(Z===null)return;if(!O.moving){if(!U1(Z.clientX-O.startX,Z.clientY-O.startY))return;O.moving=!0}J.cancelable&&J.preventDefault();const de=O.lastY-Z.clientY;O.lastX=Z.clientX,O.lastY=Z.clientY,O.samples.push({t:J.timeStamp,y:Z.clientY}),O.samples.length>32&&O.samples.shift(),Y(de,Z.clientX,Z.clientY)},q=J=>{if(O===null||P(J.changedTouches,O.id)===null)return;const Z=O;if(O=null,!Z.moving)return;const de=W1(Z.samples,J.timeStamp);de!==0&&G(de,Z.lastX,Z.lastY)},te=()=>{O=null};_.addEventListener("touchstart",$,{capture:!0,passive:!0}),_.addEventListener("touchmove",H,{capture:!0,passive:!1}),_.addEventListener("touchend",q,{capture:!0,passive:!0}),_.addEventListener("touchcancel",te,{capture:!0,passive:!0});const se=()=>{if(!(document.visibilityState!=="visible"||!m())){try{y.fit()}catch{return}p(!0)}};window.addEventListener("focus",se),document.addEventListener("visibilitychange",se),R&&u.attachCustomKeyEventHandler(J=>!P1(J));const le=u.onData(J=>{s.send({type:"input",terminalId:n,data:J})}),ue=s.onMessage(J=>{switch(J.type){case"terminal.output":J.terminalId===n&&u.write(J.data);break;case"terminal.replay":if(J.terminalId!==n)break;u.reset(),J.truncated&&u.write(`\x1B[90m-- ${C("terminal.replayTruncated")} --\x1B[0m\r
117
- `),u.write(J.data);break;case"terminal.exit":if(J.terminalId!==n)break;u.write(`\r
118
- \x1B[90m-- ${C("terminal.exited",{code:J.exitCode})} --\x1B[0m\r
119
- `);break}}),K=()=>{if(m())try{y.fit()}catch{}const J=u.cols>0?u.cols:80,Z=u.rows>0?u.rows:24;f={cols:J,rows:Z},s.send({type:"terminal.attach",terminalId:n,cols:J,rows:Z})};K();const W=s.onReopen(K);return()=>{window.clearTimeout(l),window.removeEventListener("resize",B),window.removeEventListener("focus",se),document.removeEventListener("visibilitychange",se),F.disconnect(),X(),_.removeEventListener("touchstart",$,{capture:!0}),_.removeEventListener("touchmove",H,{capture:!0}),_.removeEventListener("touchend",q,{capture:!0}),_.removeEventListener("touchcancel",te,{capture:!0}),M.dispose(),b.dispose(),le.dispose(),ue(),W(),s.send({type:"terminal.detach",terminalId:n}),u.dispose(),r.current=null,c.current=null}},[n,s,R]),I.useEffect(()=>{const _=r.current;_!==null&&(_.options.theme=Af[h],_.options.minimumContrastRatio=Nf[h])},[h]),I.useEffect(()=>{if(!i)return;const _=r.current,u=c.current;if(_===null||u===null)return;const y=window.setTimeout(()=>{const S=x.current;if(!(S===null||S.clientWidth===0||S.clientHeight===0)){try{u.fit()}catch{return}v&&_.focus(),_.cols>0&&_.rows>0&&s.send({type:"resize",terminalId:n,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(y)},[i,v,n,s]),a.jsx("div",{className:`terminal-surface${i?"":" terminal-surface-hidden"}`,ref:x})}function G1(){return a.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[a.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"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),a.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Aa({title:n,onHide:s,confirmText:i}){const[h,v]=I.useState(!1);return a.jsxs("span",{className:"section-hide",children:[a.jsx("button",{className:"icon-button",onClick:R=>{R.stopPropagation(),i===null?s():v(!0)},title:n,"aria-label":n,children:a.jsx(G1,{})}),h&&i!==null&&a.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[a.jsx("span",{children:i}),a.jsx("button",{className:"link-button",onClick:()=>{v(!1),s()},children:C("settings.panels.consoleConfirmYes")}),a.jsx("button",{className:"link-button",onClick:()=>v(!1),children:C("common.cancel")})]})]})}const Y1=typeof navigator<"u"&&j1(navigator.platform);function X1({connection:n,shells:s,activeShellId:i,cwd:h,shellName:v,theme:R,onSelect:x,onOpen:r,onCloseShell:c,onCollapse:g,onHide:_,hideCount:u=0}){const y=v??C("console.name"),S=s.find(L=>L.terminalId===i)??s[0]??null;return a.jsxs("section",{className:"console-pane",children:[a.jsxs("header",{className:"console-header",children:[a.jsxs("div",{className:"strip-tabs",children:[s.map((L,f)=>a.jsxs("div",{className:`strip-tab${L.terminalId===(S==null?void 0:S.terminalId)?" is-active":""}${L.alive?"":" is-dead"}`,children:[a.jsx("button",{className:"strip-tab-label",onClick:()=>x(L.terminalId),title:L.alive?C("console.tab.title",{shell:L.label.length>0?L.label:y,number:f+1,cwd:h}):C("console.tab.exited",{code:L.exitCode??"?"}),children:C("console.tab.label",{number:f+1})}),a.jsx("button",{className:"strip-tab-close",onClick:()=>c(L.terminalId),title:C("console.tab.close"),children:"×"})]},L.terminalId)),v!==null&&a.jsx("button",{className:"strip-tab-new",onClick:r,title:C("console.openAnother",{shell:y,cwd:h}),children:"+"})]}),a.jsx("span",{className:"strip-spacer"}),a.jsx("button",{className:"icon-button",onClick:g,title:C("console.collapse"),children:"▾"}),_!==void 0&&a.jsx(Aa,{title:C("settings.hide.console"),onHide:_,confirmText:u===0?null:C("settings.panels.consoleConfirm",{count:u})})]}),a.jsx("div",{className:"console-body",children:s.length===0?a.jsx("div",{className:"console-empty",children:v===null?a.jsx("p",{className:"panel-note",children:C("console.noShell")}):a.jsx("button",{className:"link-button",onClick:r,children:C("console.openIn",{shell:y,cwd:h})})}):a.jsx("div",{className:"terminal-stack",children:s.map(L=>a.jsx(Pm,{terminalId:L.terminalId,connection:n,active:L.terminalId===(S==null?void 0:S.terminalId),theme:R,pasteOnCtrlV:Y1},L.terminalId))})})]})}const Q1=.75,J1=.9;function Dn(n){if(n<1e3)return String(n);if(n<1e6){const s=n/1e3;return`${s<100?Wr(s,1):Math.round(s)}k`}return`${Wr(n/1e6,2)}M`}function Z1({usage:n,source:s,instructionsFile:i,fallbackWindow:h=null,compact:v=!1,statusLineState:R=null,onConfigure:x}){const{lastRequestTokens:r,contextWindow:c}=n;if(x!==void 0&&R!==null&&Ny(s,{state:R}))return a.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:Dy(R),children:[a.jsx("span",{className:"meter-label",children:C("meter.label")}),a.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),a.jsx("span",{className:"meter-value",children:C("meter.unmeasured")}),a.jsx("button",{className:"link-button",onClick:x,children:C("meter.configure")})]});if(s===null)return a.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:C("meter.noTokensTitle"),children:[a.jsx("span",{className:"meter-label",children:C("meter.label")}),a.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),a.jsx("span",{className:"meter-value",children:C("meter.noTokens")})]});if(!Ay(s,n)){const S=jy(i,s),L=My(s,n,h);return a.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:S,children:[a.jsx("span",{className:"meter-label",children:C("meter.label")}),a.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),a.jsxs("span",{className:"meter-value",children:[C("meter.unmeasured"),L!==null&&a.jsxs("span",{className:"meter-dim",children:[" / ",Dn(L)]})]})]})}const g=c!==null&&c>0?Math.min(r/c,1):null,_=g===null?"unknown":g>=J1?"danger":g>=Q1?"warn":"ok",u=c===null?"":` / ${Dn(c)}${n.contextWindowEstimated?"+":""}`,y=Iy(s,n);if(v){const S=[n.lastModel===null?null:n.lastModel,y,g===null?C("meter.unknownModelShort"):C("meter.windowPercent",{percent:Math.round(g*100)}),C("meter.output",{tokens:Dn(n.lastOutputTokens)}),s==="status-line"?C("meter.responses",{count:n.assistantMessages}):C("meter.sessionTotals",{output:Dn(n.totalOutputTokens),cache:Dn(n.totalCacheReadTokens),count:n.assistantMessages})].filter(L=>L!==null).join(" · ");return a.jsxs("div",{className:"meter meter-compact",title:S,children:[a.jsx("span",{className:"meter-label",children:C("meter.label")}),g!==null&&a.jsx("span",{className:"meter-bar meter-bar-inline",children:a.jsx("span",{className:`meter-fill meter-fill-${_}`,style:{width:`${g*100}%`}})}),a.jsxs("span",{className:"meter-value",children:[Dn(r),u.length>0&&a.jsx("span",{className:"meter-dim",children:u})]})]})}return a.jsxs("div",{className:"meter",children:[a.jsxs("div",{className:"meter-row",children:[a.jsx("span",{className:"meter-label",children:C("meter.label")}),a.jsxs("span",{className:"meter-value",children:[Dn(r),c!==null&&a.jsxs("span",{className:"meter-dim",title:n.lastModel===null?void 0:y!==null?C("meter.modelWithOrigin",{model:n.lastModel,origin:y}):n.lastModel,children:[" ","/ ",Dn(c),n.contextWindowEstimated&&"+"]})]})]}),g!==null?a.jsx("div",{className:"meter-bar",title:C("meter.windowPercent",{percent:Math.round(g*100)}),children:a.jsx("div",{className:`meter-fill meter-fill-${_}`,style:{width:`${g*100}%`}})}):a.jsx("div",{className:"meter-note",title:n.lastModel??void 0,children:C("meter.unknownModel")}),a.jsxs("div",{className:"meter-row meter-row-dim",children:[a.jsx("span",{title:C("meter.lastResponseTitle"),children:C("meter.output",{tokens:Dn(n.lastOutputTokens)})}),a.jsx("span",{title:C("meter.sessionTitle"),children:C("meter.sessionTotals",{output:Dn(n.totalOutputTokens),cache:Dn(n.totalCacheReadTokens),count:n.assistantMessages})})]})]})}const Dc=["s","m","l"],Om="m",eb="agent-workbench.thread-font",tb="agent-workbench.notes-font",nb="s",sb={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function Df(n){return C(sb[n])}function Bm(n){const s=Dc.indexOf(n);return Dc[(s+1)%Dc.length]??Om}function rb(n){return n==="s"||n==="m"||n==="l"?n:null}function Na(n){return C("threadFont.title",{current:Df(n),next:Df(Bm(n))})}const ib=200;function Fm(n){return Math.max(ib,n)}function ob(n){return n.hasMore&&!n.loading&&n.searching!==!0&&n.scrollTop<n.previousScrollTop&&n.scrollTop<=Fm(n.clientHeight)}function ab(n,s,i){return n<0&&s<=Fm(i)}function lb(n,s){return Math.max(0,s-n)}function cb(n,s){return n===null||s.length===0||s[0]===n?!1:s.includes(n)}const ub=52,hb=10;function db(n){return n.filter(s=>s.role==="user"&&s.parts.some(i=>i.kind==="text"||i.kind==="image")).map(s=>s.eventId)}function fb(n,s){for(let i=n-1;i>=0;i-=1){const h=s(i);if(h!==null&&h<-8)return i}return null}function pb(n){return n.awayFromEnd&&(n.ownAbove||n.hasMore)}function If(n,s){return Math.max(0,n+s-ub)}function mb(n){return n.found?"jump":n.loading?"wait":!n.hasMore||n.pagesRequested>=hb?"give-up":"load"}function Hm({agents:n,preselected:s,anchor:i,label:h=C("agentMenu.openWith"),onPick:v,onClose:R}){const x=I.useMemo(()=>pm(n),[n]),[r,c]=I.useState(()=>$y(x,s)),[g,_]=I.useState(null),u=I.useRef(null),y=I.useRef([]);return I.useLayoutEffect(()=>{const S=u.current;if(S===null)return;const L=i.getBoundingClientRect(),f=S.getBoundingClientRect();_(Wy({left:L.left,top:L.top,bottom:L.bottom},{width:f.width,height:f.height},{width:window.innerWidth,height:window.innerHeight}))},[i]),I.useEffect(()=>{var S;(S=y.current[r])==null||S.focus()},[r,g]),I.useEffect(()=>{const S=l=>{if(!(l.altKey||l.ctrlKey||l.metaKey)){if(l.key==="Escape"){l.preventDefault(),l.stopPropagation(),R(),i.focus();return}if(l.key==="ArrowDown"||l.key==="ArrowUp"){l.preventDefault(),l.stopPropagation(),c(m=>Uy(m,l.key==="ArrowDown"?1:-1,x.length));return}if(l.key==="Enter"){l.preventDefault(),l.stopPropagation();const m=x[r];m!==void 0&&v(m.id);return}l.key==="Tab"&&R()}},L=l=>{var p;const m=l.target;m instanceof Node&&((p=u.current)!=null&&p.contains(m)||i.contains(m))||R()},f=l=>{zy(l.target,i,u.current)&&R()};return window.addEventListener("keydown",S,!0),document.addEventListener("pointerdown",L,!0),window.addEventListener("scroll",f,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("keydown",S,!0),document.removeEventListener("pointerdown",L,!0),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",R)}},[r,i,x,R,v]),Cm.createPortal(a.jsx("div",{ref:u,className:"agent-menu",role:"menu","aria-label":h,style:g===null?{left:0,top:0,visibility:"hidden"}:{left:`${g.left}px`,top:`${g.top}px`},children:x.map((S,L)=>a.jsxs("button",{ref:f=>{y.current[L]=f},className:`agent-menu-item${L===r?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:L===r?0:-1,onMouseEnter:()=>c(L),onClick:()=>v(S.id),children:[a.jsx("span",{className:"agent-menu-label",children:S.label}),S.version!==null&&a.jsx("span",{className:"agent-menu-version",children:S.version})]},S.id))}),document.body)}function $m({targets:n,className:s,text:i,blockedReason:h=null,onPick:v}){const[R,x]=I.useState(!1),r=I.useRef(null),c=I.useCallback(()=>x(!1),[]),g=I.useCallback(_=>{x(!1),v(_)},[v]);return n.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("button",{ref:r,className:s,onClick:()=>x(_=>!_),disabled:h!==null,"aria-haspopup":"menu","aria-expanded":R,title:h??Vy(),children:i}),R&&r.current!==null&&a.jsx(Hm,{agents:n,preselected:null,anchor:r.current,label:C("continue.menuLabel"),onPick:g,onClose:c})]})}function Um(n){switch(n.notice){case"compacted":return n.detail==="auto"?C("thread.notice.compactedAuto"):C("thread.notice.compacted");case"interrupted":return C("thread.notice.interrupted");case"error":return n.detail.length>0?C("thread.notice.error",{detail:n.detail}):C("thread.notice.errorNoDetail")}}const Wm="agent-workbench.locale",zm="auto";function gb(n){return n==="auto"||im(n)?n:null}function Vm(n){const s=n.trim().replace(/_/g,"-").toLowerCase();if(s.length===0)return null;const i=vu.find(R=>R.toLowerCase()===s);if(i!==void 0)return i;const[h="",...v]=s.split("-");return h==="zh"?v.includes("hant")||v.some(x=>x==="tw"||x==="hk"||x==="mo")?null:Ic("zh-CN"):Ic(h==="pt"?"pt-BR":h)}function Ic(n){return im(n)?n:null}function qm(n,s){if(n!=="auto")return n;for(const i of s){const h=Vm(i);if(h!==null)return h}return"en"}function Km(n,s){for(const i of s)if(Vm(i)===n)try{if(Intl.DateTimeFormat.supportedLocalesOf([i]).length>0)return i}catch{}return ny(n)}let Da=zm;const ru=new Set;function bu(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function _b(){return qm("auto",bu())}async function Gm(n){const s=bu(),i=qm(n,s);await am(i,Km(i,s))}async function vb(){Da=vt(Wm,zm,gb);try{await Gm(Da)}catch{await am("en",Km("en",bu()))}document.documentElement.lang=Zc(),om(()=>{document.documentElement.lang=Zc()})}async function yb(n){await Gm(n),Da=n,pt(Wm,n);for(const s of ru)s()}function wb(n){return ru.add(n),()=>ru.delete(n)}function bb(){return Da}function Qi(){return I.useSyncExternalStore(om,Zc)}function Sb(){return I.useSyncExternalStore(wb,bb)}const Ym=String.raw`https?:\/\/[^\s<>"'\`]+`,Cb=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${Ym})`].join("|")),xb=/^(https?:|mailto:)/i,kb=new RegExp(Ym);function Eb(n){const s=kb.exec(n);if(s===null||s.index===void 0)return null;const i=Xm(s[0]);return{index:s.index,length:i.length,href:i}}function ya(n,s){let i=0;for(const h of n)h===s&&(i+=1);return i}function Xm(n){let s=n;for(;;){const i=s.slice(-1);if(i.length===0)return s;if(".,;:!?".includes(i)){s=s.slice(0,-1);continue}if(i===")"&&ya(s,"(")<ya(s,")")){s=s.slice(0,-1);continue}if(i==="]"&&ya(s,"[")<ya(s,"]")){s=s.slice(0,-1);continue}return s}}function Lb(n){const s=Cb.exec(n);if(s===null||s.index===void 0)return null;const i=s[0],h=s.index,v=(x,r=i.length)=>({index:h,length:r,token:x});if(i.startsWith("`"))return v({kind:"code",text:i.slice(1,-1)});if(i.startsWith("**")||i.startsWith("__"))return v({kind:"strong",text:i.slice(2,-2)});if(i.startsWith("~~"))return v({kind:"del",text:i.slice(2,-2)});if(i.startsWith("*"))return v({kind:"em",text:i.slice(1,-1)});if(i.startsWith("[")){const x=i.indexOf("]("),r=i.slice(1,x),c=i.slice(x+2,-1);return xb.test(c)?v({kind:"link",label:r,href:c}):v({kind:"plain",text:i})}const R=Xm(i);return v({kind:"link",label:R,href:R},R.length)}function Ms(n,s,i){if(s.length===0)return[n];const h=n.toLowerCase(),v=s.toLowerCase(),R=[];let x=0,r=h.indexOf(v),c=0;for(;r!==-1;)r>x&&R.push(n.slice(x,r)),R.push(a.jsx("mark",{children:n.slice(r,r+s.length)},`${i}-m${c++}`)),x=r+s.length,r=h.indexOf(v,x);return x<n.length&&R.push(n.slice(x)),R}const Tb=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function Rb(n,s){const i=Tb.exec(n);if(i===null)return null;const h=i[2]??"",v=s(h);return v===null?null:{label:i[1]??"",href:h,open:v}}function $r(n,s,i,h){const v=[];let R=n,x=0;for(;R.length>0;){const r=Lb(R);if(r===null){v.push(...Ms(R,s,`${i}-${x++}`));break}r.index>0&&v.push(...Ms(R.slice(0,r.index),s,`${i}-${x++}`));const c=`${i}-i${x++}`,{token:g}=r;switch(g.kind){case"code":v.push(a.jsx("code",{children:g.text},c));break;case"strong":v.push(a.jsx("strong",{children:Ms(g.text,s,c)},c));break;case"del":v.push(a.jsx("del",{children:Ms(g.text,s,c)},c));break;case"em":v.push(a.jsx("em",{children:Ms(g.text,s,c)},c));break;case"link":v.push(a.jsx("a",{href:g.href,target:"_blank",rel:"noreferrer noopener",children:Ms(g.label,s,c)},c));break;default:{const _=h===void 0?null:Rb(g.text,h);if(_!==null){v.push(a.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:Ms(_.label,s,c)},c));break}v.push(a.jsx("span",{children:Ms(g.text,s,c)},c));break}}R=R.slice(r.index+r.length)}return v}function Mb({code:n,language:s}){const[i,h]=I.useState(null),[v,R]=I.useState(!1),x=I.useRef(null);I.useEffect(()=>()=>{x.current!==null&&window.clearTimeout(x.current)},[]);const r=()=>{navigator.clipboard.writeText(n).then(()=>{R(!0),x.current!==null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>R(!1),1200)}).catch(()=>R(!1))};return I.useEffect(()=>{let c=!0;return Wn(async()=>{const{highlightCode:g}=await import("./highlight-CVfWpF4K.js");return{highlightCode:g}},[]).then(({highlightCode:g})=>{c&&h(g(n,s))}).catch(()=>{c&&h(null)}),()=>{c=!1}},[n,s]),a.jsxs("div",{className:"md-code-wrap",children:[a.jsx("pre",{className:"md-code hljs",children:i===null?a.jsx("code",{children:n}):a.jsx("code",{dangerouslySetInnerHTML:{__html:i}})}),a.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[s!==null&&a.jsx("span",{className:"md-code-lang",children:s}),a.jsx("button",{className:"md-code-copy",onClick:r,title:C(v?"common.copied":"common.copyCode"),"aria-label":C("common.copyCode"),children:v?"✓":"⧉"})]})]})}const jf=/^(#{1,6})\s+(.*)$/,jc=/^\s{0,3}[-*+]\s+(.*)$/,Hi=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,wa=/^>\s?(.*)$/,Pc=/^\s*```(\S*)\s*$/,Pf=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Oc=/^\s*\|.*\|\s*$/,Ab=/^\s*\|[\s:|-]+\|\s*$/;function Of(n){return n.trim().replace(/^\||\|$/g,"").split("|").map(s=>s.trim())}function Su({text:n,needle:s="",localLink:i}){var x,r;const h=n.split(`
120
- `),v=[];let R=0;for(;R<h.length;){const c=h[R]??"",g=`b${R}`,_=Pc.exec(c);if(_!==null){const S=(_[1]??"").length>0?_[1]:null,L=[];for(R+=1;R<h.length&&!Pc.test(h[R]??"");)L.push(h[R]??""),R+=1;R+=1,v.push({key:g,node:a.jsx(Mb,{code:L.join(`
121
- `),language:S},g)});continue}if(c.trim().length===0){R+=1;continue}if(Pf.test(c)){v.push({key:g,node:a.jsx("hr",{className:"md-rule"},g)}),R+=1;continue}const u=jf.exec(c);if(u!==null){const S=Math.min((u[1]??"#").length,6);v.push({key:g,node:a.jsx("p",{className:`md-heading md-h${S}`,children:$r(u[2]??"",s,g,i)},g)}),R+=1;continue}if(Oc.test(c)&&Ab.test(h[R+1]??"")){const S=Of(c);R+=2;const L=[];for(;R<h.length&&Oc.test(h[R]??"");)L.push(Of(h[R]??"")),R+=1;v.push({key:g,node:a.jsx("div",{className:"md-table-wrap",children:a.jsxs("table",{className:"md-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:S.map((f,l)=>a.jsx("th",{children:$r(f,s,`${g}-h${l}`,i)},l))})}),a.jsx("tbody",{children:L.map((f,l)=>a.jsx("tr",{children:f.map((m,p)=>a.jsx("td",{children:$r(m,s,`${g}-${l}-${p}`,i)},p))},l))})]})},g)});continue}if(wa.test(c)){const S=[];for(;R<h.length&&wa.test(h[R]??"");)S.push(((x=wa.exec(h[R]??""))==null?void 0:x[1])??""),R+=1;v.push({key:g,node:a.jsx("blockquote",{className:"md-quote",children:$r(S.join(`
122
- `),s,g,i)},g)});continue}if(jc.test(c)||Hi.test(c)){const S=Hi.test(c),L=S?Number(((r=Hi.exec(c))==null?void 0:r[1])??"1"):1,f=[];for(;R<h.length;){const m=h[R]??"",p=jc.exec(m),d=Hi.exec(m);if(S&&d!==null)f.push(d[2]??"");else if(!S&&p!==null)f.push(p[1]??"");else if(f.length>0&&/^\s{2,}\S/.test(m)&&p===null&&d===null)f[f.length-1]=`${f[f.length-1]??""} ${m.trim()}`;else break;R+=1}const l=f.map((m,p)=>a.jsx("li",{children:$r(m,s,`${g}-l${p}`,i)},p));v.push({key:g,node:S?a.jsx("ol",{className:"md-list",start:L===1?void 0:L,children:l},g):a.jsx("ul",{className:"md-list",children:l},g)});continue}const y=[];for(;R<h.length;){const S=h[R]??"";if(S.trim().length===0||Pc.test(S)||jf.test(S)||jc.test(S)||Hi.test(S)||wa.test(S)||Pf.test(S)||Oc.test(S))break;y.push(S),R+=1}v.push({key:g,node:a.jsx("p",{className:"md-paragraph",children:$r(y.join(`
123
- `),s,g,i)},g)})}return a.jsx("div",{className:"md",children:v.map(c=>c.node)})}const Qm=[{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 Bc(n){const s=Qm.find(i=>i.names.includes(n));return s===void 0?{key:`name:${n}`,known:!1}:{key:s.key,known:!0}}function Nb(n,s,i){const h=Qm.find(v=>v.key===n);return h===void 0?C("tools.run.callsTo",{count:s,name:i}):C(h.run,{count:s})}function Nt(n){if(!Q_(n.key))return n.key;let s;if(n.params!==void 0){const i={};for(const[h,v]of Object.entries(n.params))i[h]=typeof v=="object"?Nt(v):v;s=i}return C(`server.${n.key}`,s)}const Fc={model:null,effort:null,contextWindow:null},Db=200,Ib=2e4,jb={},Pb={},Bf=[];function iu(n,s,i){return`${n}:${i}:${s}`}function Ob(n,s){const[i,h]=I.useState([]),[v,R]=I.useState(Sc),[x,r]=I.useState(Fc),[c,g]=I.useState("waiting"),[_,u]=I.useState(!1),[y,S]=I.useState(!1),[L,f]=I.useState({}),[l,m]=I.useState(null),[p,d]=I.useState(null),[k,D]=I.useState(!1),[E,M]=I.useState(Bf),[b,T]=I.useState({}),[N,B]=I.useState({}),F=(s===null?void 0:b[s])??jb,O=(s===null?void 0:N[s])??Pb,U=I.useRef(new Set),V=I.useRef(new Map),Y=I.useRef(new Set),X=I.useCallback((le,ue,K)=>{B(W=>({...W,[le]:{...W[le]??{},[ue]:K}}))},[]),G=I.useCallback(le=>{B(ue=>{let K=!1;const W={};for(const[J,Z]of Object.entries(ue))if(le in Z){const de={...Z};delete de[le],W[J]=de,K=!0}else W[J]=Z;return K?W:ue})},[]),P=I.useCallback((le,ue)=>{B(K=>{const W=K[le];if(W===void 0||!(ue in W))return K;const J={...W};return delete J[ue],{...K,[le]:J}})},[]);I.useEffect(()=>{for(const le of i)for(const ue of le.parts){if(ue.kind!=="tool-result")continue;Y.current.add(ue.toolUseId);const K=V.current.get(ue.toolUseId);K!==void 0&&(window.clearTimeout(K),V.current.delete(ue.toolUseId)),G(ue.toolUseId)}},[i,G]),I.useEffect(()=>{const le=V.current;return()=>{for(const ue of le.values())window.clearTimeout(ue);le.clear()}},[]);const $=I.useRef(null);I.useEffect(()=>{if(s===null){h([]),R(Sc),r(Fc),g("waiting"),u(!1),$.current=null;return}h([]),R(Sc),r(Fc),g("waiting"),u(!1),S(!1),f({}),m(null),d(null),D(!1),M(Bf),U.current.clear(),$.current=null;const le=n.onMessage(K=>{var W;switch(K.type){case"conversation.reset":if(K.terminalId!==s)break;h(K.events),R(K.usage),r(K.defaults),m(K.permissionMode),d(K.waitingFor),D(K.openToolCall),M(K.subagents),g(K.state),u(K.hasMore),S(!1),$.current=((W=K.events[0])==null?void 0:W.eventId)??null;break;case"conversation.append":{if(K.terminalId!==s)break;h(J=>{var pe;const Z=new Set(J.map(re=>re.eventId)),de=K.events.filter(re=>!Z.has(re.eventId));return de.length===0?J:($.current===null&&($.current=((pe=de[0])==null?void 0:pe.eventId)??null),[...J,...de])}),R(K.usage),K.permissionMode!==null&&m(K.permissionMode),g("live");break}case"conversation.page":{if(K.terminalId!==s)break;h(J=>{var pe;const Z=new Set(J.map(re=>re.eventId)),de=K.events.filter(re=>!Z.has(re.eventId));return de.length===0?J:($.current=((pe=de[0])==null?void 0:pe.eventId)??$.current,[...de,...J])}),u(K.hasMore),S(!1);break}case"conversation.turns":{if(K.terminalId!==s)break;const J=new Map(K.turns.map(Z=>[Z.eventId,Z.durationMs]));h(Z=>Z.map(de=>{const pe=J.get(de.eventId);return pe===void 0?de:{...de,durationMs:pe}}));break}case"conversation.parts":{if(K.terminalId!==s)break;const J=new Map(K.updates.map(Z=>[Z.eventId,Z.parts]));h(Z=>Z.map(de=>{const pe=J.get(de.eventId);return pe===void 0?de:{...de,parts:pe}}));break}case"conversation.imageData":{if(K.terminalId!==s)break;const J=iu(K.eventId,K.index,K.source);f(Z=>({...Z,[J]:K.data===null?null:`data:${K.mediaType};base64,${K.data}`}));break}case"conversation.state":if(K.terminalId!==s)break;g(K.state);break;case"conversation.mode":if(K.terminalId!==s)break;m(K.mode);break;case"conversation.waiting":if(K.terminalId!==s)break;d(K.waitingFor);break;case"conversation.toolCall":if(K.terminalId!==s)break;D(K.open);break;case"conversation.subagents":if(K.terminalId!==s)break;M(K.subagents);break;case"error":{if(K.code!=="answer-failed"||s===null)break;for(const[J,Z]of V.current)window.clearTimeout(Z),V.current.delete(J),T(de=>{const pe=de[s];if(pe===void 0||!(J in pe))return de;const re={...pe};return delete re[J],{...de,[s]:re}}),X(s,J,Nt(K.text));break}}});n.send({type:"conversation.subscribe",terminalId:s});const ue=n.onReopen(()=>{n.send({type:"conversation.subscribe",terminalId:s})});return()=>{le(),ue(),n.send({type:"conversation.unsubscribe",terminalId:s})}},[n,s,X]);const H=I.useCallback(()=>{const le=$.current;s===null||le===null||y||(S(!0),n.send({type:"conversation.loadMore",terminalId:s,beforeEventId:le,limit:Db}))},[n,s,y]),q=I.useCallback((le,ue,K)=>{if(s===null)return;const W=iu(le,ue,K);U.current.has(W)||(U.current.add(W),n.send({type:"conversation.image",terminalId:s,eventId:le,index:ue,source:K}))},[n,s]),te=I.useCallback((le,ue)=>{if(s===null)return;T(W=>{const J=W[s]??{};return le in J?W:{...W,[s]:{...J,[le]:ue}}}),P(s,le),n.send({type:"agent.answer",terminalId:s,toolUseId:le,selections:ue});const K=window.setTimeout(()=>{Y.current.has(le)||(T(W=>{const J=W[s];if(J===void 0||!(le in J))return W;const Z={...J};return delete Z[le],{...W,[s]:Z}}),X(s,le,C("conversation.answerUnconfirmed")))},Ib);V.current.set(le,K)},[n,s,X,P]),se=I.useCallback(le=>{s!==null&&n.send({type:"agent.mode",terminalId:s,mode:le})},[n,s]);return{events:i,usage:v,defaults:x,state:c,permissionMode:l,waitingFor:p,openToolCall:k,subagents:E,hasMore:_,loadingMore:y,loadMore:H,images:L,requestImage:q,answer:te,answered:F,answerFailed:O,setPermissionMode:se}}const Jm=80;function Ff(n){return n.scrollHeight-n.scrollTop-n.clientHeight>Jm}const Hf=5;function ba(n){return!Array.isArray(n)}function $f(n){const s=[];for(const i of n.parts){if(i.kind!=="tool-call")return null;s.push(i.name)}return s.length>0?s:null}function Bb(n){const s=[];let i=0;for(;i<n.length;){const h=n[i];if(h===void 0)break;const v=$f(h),R=v===null?null:Bc(v[0]??"");if(!(v!==null&&R!==null&&v.every(_=>Bc(_).key===R.key))||v===null||R===null){s.push({kind:"card",card:h}),i+=1;continue}const r=[h];let c=v.length,g=i+1;for(;g<n.length;){const _=n[g];if(_===void 0)break;const u=$f(_);if(u===null||!u.every(y=>Bc(y).key===R.key))break;r.push(_),c+=u.length,g+=1}if(c<2){s.push({kind:"card",card:h}),i+=1;continue}s.push({kind:"tools",id:`tools-${h.event.eventId}`,summary:Nb(R.key,c,v[0]??""),at:h.event.at,cards:r}),i=g}return s}function Fb(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(s=>`${s.question} ${s.options.map(i=>i.label).join(" ")}`).join(`
124
- `);case"notice":return Um(n);case"thinking":case"image":return""}}function Uf(n,s){const i=[];for(const h of n.parts)if(i.push(Fb(h)),h.kind==="tool-call"){const v=s.get(h.toolUseId);v!==void 0&&i.push(v.text)}return i.join(`
125
- `)}function Is(n,s){if(s.length===0)return a.jsx(a.Fragment,{children:n});const i=n.toLowerCase(),h=s.toLowerCase(),v=[];let R=0,x=i.indexOf(h),r=0;for(;x!==-1;)x>R&&v.push(a.jsx("span",{children:n.slice(R,x)},r++)),v.push(a.jsx("mark",{children:n.slice(x,x+s.length)},r++)),R=x+s.length,x=i.indexOf(h,R);return R<n.length&&v.push(a.jsx("span",{children:n.slice(R)},r++)),a.jsx(a.Fragment,{children:v})}function Zm(n,s){const i=[];let h=n,v=0;for(;h.length>0;){const R=Eb(h);if(R===null){i.push(a.jsx("span",{children:Is(h,s)},v++));break}R.index>0&&i.push(a.jsx("span",{children:Is(h.slice(0,R.index),s)},v++)),i.push(a.jsx("a",{href:R.href,target:"_blank",rel:"noreferrer noopener",children:Is(R.href,s)},v++)),h=h.slice(R.index+R.length)}return a.jsx(a.Fragment,{children:i})}function Hb({view:n,terminalId:s,onRewind:i,questionsAnswerable:h,contextWindowSource:v,instructionsFile:R,onGoToCli:x,cliPresence:r,exitCode:c,onWakeCli:g,waking:_,discovering:u=!1,toolCallNotice:y=null,serverClosed:S=null,statusLineState:L=null,onConfigureStatusLine:f,threadFont:l,continueTargets:m=[],continueBlockedReason:p=null,onContinue:d,searchRequest:k=null,onSearchRequestApplied:D,activity:E=null,receipt:M=null,clock:b=null}){const{events:T,usage:N,defaults:B,state:F,waitingFor:O,subagents:U,hasMore:V,loadingMore:Y,loadMore:X,images:G,requestImage:P,answer:$,answered:H,answerFailed:q}=n,te=Qi(),[se,le]=I.useState(""),[ue,K]=I.useState(0),[W,J]=I.useState(null);I.useEffect(()=>{k!==null&&(le(k.query),D==null||D(k.seq))},[k,D]);const Z=I.useRef(null),de=I.useRef(new Map),pe=I.useRef(!0),[re,ke]=I.useState(!1),[Me,et]=I.useState(0),[Le,fe]=I.useState(!1),[Te,Ce]=I.useState(!1),Ee=I.useRef(null),Be=I.useMemo(()=>db(T),[T]),{cards:ve,results:Ae}=I.useMemo(()=>{const Se=new Map,Ke=new Set;for(const Dt of T)for(const xt of Dt.parts)xt.kind==="tool-result"?Se.set(xt.toolUseId,xt):(xt.kind==="tool-call"||xt.kind==="question")&&Ke.add(xt.toolUseId);const rt=[];for(const Dt of T){const xt=Dt.parts.filter(mn=>mn.kind!=="thinking"&&!(mn.kind==="tool-result"&&Ke.has(mn.toolUseId)));xt.length!==0&&rt.push({event:Dt,parts:xt})}return{cards:rt,results:Se}},[T]),st=I.useMemo(()=>Bb(ve),[ve,te]),Xe=se.trim(),Qe=I.useMemo(()=>{if(Xe.length===0)return[];const Se=Xe.toLowerCase();return ve.filter(Ke=>Uf(Ke,Ae).toLowerCase().includes(Se)).map(Ke=>Ke.event.eventId)},[ve,Ae,Xe,te]);I.useEffect(()=>{K(0)},[Xe]);const dt=I.useMemo(()=>new Set(Qe),[Qe]),ht=Qe[ue]??null;I.useEffect(()=>{var Se;ht!==null&&((Se=de.current.get(ht))==null||Se.scrollIntoView({block:"center"}))},[ht]),I.useLayoutEffect(()=>{pe.current=!0,ke(!1),et(0),Ee.current=null,Ce(!1),fe(!1)},[s]);const $e=I.useCallback(()=>{const Se=Z.current;if(Se===null)return;const Ke=Ff(Se);ke(Ke),Ke||et(0)},[]),tt=I.useCallback(Se=>{const Ke=Se.getBoundingClientRect().top,rt=xt=>{const mn=Be[xt],Jt=mn===void 0?void 0:de.current.get(mn);return Jt===void 0?null:Jt.getBoundingClientRect().top-Ke},Dt=fb(Be.length,rt);return Dt===null?null:rt(Dt)},[Be]),We=I.useCallback(()=>{const Se=Z.current;Se!==null&&fe(pb({awayFromEnd:Ff(Se),ownAbove:tt(Se)!==null,hasMore:V}))},[tt,V]),ot=I.useRef(null),ft=I.useRef(0),Re=I.useRef(0);I.useLayoutEffect(()=>{const Se=ot.current,Ke=T.map(Dt=>Dt.eventId);ot.current=Ke[0]??null;const rt=Z.current;rt===null||!cb(Se,Ke)||(rt.scrollTop=lb(ft.current,rt.scrollHeight))},[T]),I.useLayoutEffect(()=>{const Se=Z.current;Se!==null&&pe.current&&Xe.length===0&&(Se.scrollTop=Se.scrollHeight),$e()},[ve.length,Xe,$e]),I.useLayoutEffect(()=>{const Se=Ee.current,Ke=Z.current;if(Se===null||Ke===null)return;const rt=tt(Ke),Dt=mb({found:rt!==null,hasMore:V,loading:Y,pagesRequested:Se.pages});if(Dt!=="wait"){if(Dt==="load"){Se.pages+=1,X();return}Ee.current=null,Ce(!1),rt!==null&&(pe.current=!1,Ke.scrollTop=If(Ke.scrollTop,rt))}},[ve,V,Y,Te,tt,X]),I.useLayoutEffect(()=>{We()},[ve,We]),I.useLayoutEffect(()=>{const Se=Z.current;Se!==null&&(ft.current=Se.scrollHeight-Se.scrollTop,Re.current=Se.scrollTop)});const Ve=I.useRef(null),he=I.useCallback(()=>{var Ke;const Se=((Ke=T[0])==null?void 0:Ke.eventId)??null;Se===null||Ve.current===Se||(Ve.current=Se,X())},[T,X]),me=I.useRef(null);I.useEffect(()=>{var Dt;const Se=((Dt=ve[ve.length-1])==null?void 0:Dt.event.eventId)??null,Ke=me.current;if(me.current=Se,Ke===null||Se===Ke||pe.current&&Xe.length===0)return;const rt=ve.findIndex(xt=>xt.event.eventId===Ke);rt!==-1&&et(xt=>xt+(ve.length-1-rt))},[ve,Xe]);const Ne=I.useCallback(()=>{const Se=Z.current;if(Se===null)return;const Ke=Se.scrollHeight-Se.scrollTop-Se.clientHeight;pe.current=Ke<=Jm,$e(),We();const rt=ob({scrollTop:Se.scrollTop,previousScrollTop:Re.current,clientHeight:Se.clientHeight,hasMore:V,loading:Y,searching:Xe.length>0});Re.current=Se.scrollTop,ft.current=Se.scrollHeight-Se.scrollTop,rt&&he()},[$e,We,V,Y,he,Xe]),mt=I.useCallback(Se=>{const Ke=Z.current;Ke===null||!V||Y||Xe.length>0||ab(Se.deltaY,Ke.scrollTop,Ke.clientHeight)&&he()},[V,Y,he,Xe]),De=I.useCallback(()=>{const Se=Z.current;Se!==null&&(Se.scrollTop=Se.scrollHeight,pe.current=!0,ke(!1),et(0),Ee.current=null,Ce(!1),fe(!1))},[]),qe=I.useCallback(()=>{const Se=Z.current;if(Se===null)return;const Ke=tt(Se);if(Ke!==null){pe.current=!1,Se.scrollTop=If(Se.scrollTop,Ke);return}Ee.current===null&&(Ee.current={pages:0},Ce(!0))},[tt]),lt=I.useCallback((Se,Ke)=>{Ke===null?de.current.delete(Se):de.current.set(Se,Ke)},[]),Rt=I.useCallback(Se=>{const Ke=Uf(Se,Ae);navigator.clipboard.writeText(Ke).then(()=>{J(Se.event.eventId),window.setTimeout(()=>J(null),1200)}).catch(()=>J(null))},[Ae,te]),Mt=Se=>{Qe.length!==0&&K(Ke=>(Ke+Se+Qe.length)%Qe.length)};return a.jsxs("div",{className:"conversation-pane",children:[a.jsxs("div",{className:"conversation-search",children:[a.jsx("input",{className:"conversation-search-input",type:"search",placeholder:C("thread.search.placeholder"),value:se,onChange:Se=>le(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&Mt(Se.shiftKey?-1:1),Se.stopPropagation()},spellCheck:!1}),Xe.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"conversation-matches",children:Qe.length===0?C("thread.search.none"):`${ue+1}/${Qe.length}`}),a.jsx("button",{className:"icon-button",onClick:()=>Mt(-1),disabled:Qe.length===0,title:C("thread.search.previous"),children:"↑"}),a.jsx("button",{className:"icon-button",onClick:()=>Mt(1),disabled:Qe.length===0,title:C("thread.search.next"),children:"↓"})]}),a.jsx("span",{className:"conversation-spacer"}),d!==void 0&&a.jsx($m,{targets:m,className:"icon-button conversation-continue",text:C("thread.continueWith"),blockedReason:p,onPick:d}),l!==void 0&&a.jsx("button",{className:"icon-button thread-font-button",onClick:l.cycle,title:Na(l.size),"aria-label":Na(l.size),children:a.jsxs("span",{"aria-hidden":"true",children:["a",a.jsx("span",{className:"thread-font-big",children:"A"})]})}),a.jsx(Z1,{usage:N,source:v,instructionsFile:R,fallbackWindow:B.contextWindow,compact:!0,statusLineState:L,onConfigure:f})]}),a.jsxs("div",{className:"conversation-scroll-frame",children:[a.jsxs("div",{className:"conversation-scroll",ref:Z,onScroll:Ne,onWheel:mt,children:[V&&a.jsxs("button",{className:`conversation-more${Y?" conversation-more-loading":""}`,onClick:X,disabled:Y,"aria-busy":Y,children:[Y&&a.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),C(Y?"thread.loadingMore":"thread.loadEarlier")]}),ve.length===0&&a.jsxs("p",{className:"conversation-empty",children:[F==="unavailable"?C("thread.empty.unavailable"):F==="no-transcript"?Zy():C(F==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),F==="waiting"&&u&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),ew()]})]}),st.map(Se=>{if(Se.kind==="card")return a.jsx(Wf,{card:Se.card,results:Ae,needle:Xe,isMatch:Se.card.event.eventId===ht,copied:W===Se.card.event.eventId,images:G,onRequestImage:P,onCopy:()=>Rt(Se.card),onRewind:i,register:lt,answered:H,answerFailed:q,answerable:h,onAnswer:$},Se.card.event.eventId);const Ke=Se.cards.some(rt=>dt.has(rt.event.eventId));return a.jsx(Gb,{summary:Se.summary,at:Se.at,open:Ke,children:Se.cards.map(rt=>a.jsx(Wf,{card:rt,results:Ae,needle:Xe,isMatch:rt.event.eventId===ht,copied:W===rt.event.eventId,images:G,onRequestImage:P,onCopy:()=>Rt(rt),onRewind:i,register:lt,answered:H,answerFailed:q,answerable:h,onAnswer:$},rt.event.eventId))},Se.id)})]}),re&&(Le||Te)&&a.jsx("button",{className:`conversation-jump conversation-jump-own${Te?" is-seeking":""}`,onClick:qe,disabled:Te,"aria-busy":Te,title:C("thread.jumpToOwn"),"aria-label":C("thread.jumpToOwn"),children:a.jsx("span",{"aria-hidden":"true",children:"↑"})}),re&&a.jsxs("button",{className:`conversation-jump${Me>0?" has-unseen":""}`,onClick:De,title:Me>0?C("thread.jumpToEndNew",{count:Me}):C("thread.jumpToEnd"),"aria-label":Me>0?C("thread.jumpToEndNew",{count:Me}):C("thread.jumpToEnd"),children:[a.jsx("span",{"aria-hidden":"true",children:"↓"}),Me>0&&a.jsx("span",{className:"conversation-jump-count",children:Me>99?"99+":Me})]})]}),a.jsx(Ub,{live:r==="live"&&S===null,activity:E,waitingFor:O,receipt:M,events:T,clock:b,subagents:U}),S!==null&&(S.state==="relaunching"||r==="live")?a.jsx(Vb,{text:S.text,relaunching:S.state==="relaunching",onRelaunch:g}):r==="live"?O===null&&y!==null?a.jsx(Kb,{notice:y,onGoToCli:x}):a.jsx(qb,{waitingFor:O,questionsAnswerable:h,onGoToCli:x}):a.jsx(zb,{presence:r,exitCode:c,waking:_,onWake:g})]})}const $b=1e3;function Ub({live:n,activity:s,waitingFor:i,receipt:h,events:v,clock:R,subagents:x}){const[,r]=I.useState(0),c=Date.now(),g=u1({live:n,activity:s,waitingFor:i,receipt:h,events:v,clock:R,now:c}),_=n?x:[],u=g!==null||_.length>0;return I.useEffect(()=>{if(!u)return;const y=window.setInterval(()=>r(S=>S+1),$b);return()=>window.clearInterval(y)},[u]),u?a.jsxs("div",{className:"thread-status",children:[g!==null&&a.jsxs("div",{className:`thread-status-row thread-status-${g.kind}`,children:[a.jsx(Wb,{kind:g.kind}),a.jsx("span",{className:"thread-status-text",children:h1(g,c)})]}),_.length>0&&a.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[a.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]}),a.jsx("span",{className:"thread-status-text",children:d1(_,c)})]})]}):null}function Wb({kind:n}){return n==="working"?a.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]}):n==="sending"?a.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):a.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function zb({presence:n,exitCode:s,waking:i,onWake:h}){const v=n==="sleeping"?C("thread.wake.sleeping"):s===null?C("thread.wake.exited"):C("thread.wake.exitedWithCode",{code:s});return a.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[a.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),a.jsx("span",{children:v}),a.jsx("button",{className:"primary-button primary-button-small",onClick:h,disabled:i,children:C(i?"thread.wake.opening":"thread.wake.open")})]})}function Vb({text:n,relaunching:s,onRelaunch:i}){return a.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[a.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),a.jsx("span",{children:n}),a.jsx("button",{className:"primary-button primary-button-small",onClick:i,disabled:s,children:s?iw():rw()})]})}function qb({waitingFor:n,questionsAnswerable:s,onGoToCli:i}){if(n===null)return null;const h=gm(n,s);return a.jsxs("div",{className:"conversation-waiting",role:"status",children:[a.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),a.jsx("span",{children:h}),a.jsx("button",{className:"link-button",onClick:i,children:C("thread.goToCli")})]})}function Kb({notice:n,onGoToCli:s}){return a.jsxs("div",{className:"conversation-waiting",role:"status",children:[a.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),a.jsx("span",{children:n}),a.jsx("button",{className:"link-button",onClick:s,children:C("thread.goToCli")})]})}function Wf({card:n,results:s,needle:i,isMatch:h,copied:v,images:R,onRequestImage:x,onCopy:r,onRewind:c,register:g,answered:_,answerFailed:u,answerable:y,onAnswer:S}){const{event:L}=n,f=L.role==="user",l=m=>{const p=_[m.toolUseId];return p!==void 0?p:s.has(m.toolUseId)?[]:null};return a.jsxs("article",{ref:m=>g(L.eventId,m),className:`turn turn-${L.role}${h?" turn-match":""}`,children:[a.jsxs("div",{className:"turn-actions",children:[a.jsx("button",{className:"icon-button",onClick:r,title:C("thread.copyMessage"),children:v?"✓":"⧉"}),f&&c!==void 0&&a.jsx("button",{className:"icon-button",onClick:c,title:C("thread.rewind"),children:"↩"})]}),n.parts.map((m,p)=>a.jsx(Xb,{part:m,eventId:L.eventId,mine:f,result:m.kind==="tool-call"?s.get(m.toolUseId)??null:null,needle:i,images:R,onRequestImage:x,answeredAt:m.kind==="question"?l(m):null,failure:m.kind==="question"?u[m.toolUseId]??null:null,answerable:y,onAnswer:S},p)),a.jsx(Yb,{event:L,mine:f})]})}function Gb({summary:n,at:s,open:i,children:h}){const v=s>0?Sm(s):"";return a.jsxs("details",{className:"tool-group",open:i,children:[a.jsxs("summary",{className:"tool-group-summary",children:[a.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),a.jsx("span",{className:"tool-group-count",children:n}),v.length>0&&a.jsx("span",{className:"tool-group-time",children:v})]}),a.jsx("div",{className:"tool-group-body",children:h})]})}function Yb({event:n,mine:s}){const i=n.at>0?Sm(n.at):"",h=[];return n.durationMs!==null&&h.push(Dw(n.durationMs)),n.effort!==null&&h.push(C("thread.turn.effort",{effort:n.effort})),a.jsxs("div",{className:"turn-meta",children:[s&&a.jsx("span",{className:"turn-who",children:C("thread.turn.you")}),i.length>0&&a.jsx("span",{children:i}),n.queued&&a.jsx("span",{className:"turn-queued",title:C("thread.turn.queuedTitle"),children:C("thread.turn.queued")}),h.map(v=>a.jsx("span",{className:"turn-meta-bit",children:v},v))]})}function Xb({part:n,eventId:s,mine:i,result:h,needle:v,images:R,onRequestImage:x,answeredAt:r,failure:c,answerable:g,onAnswer:_}){switch(n.kind){case"text":return i?a.jsx(Jb,{text:n.text,truncated:n.truncated,needle:v}):a.jsxs("div",{className:"part-text",children:[a.jsx(Su,{text:n.text,needle:v}),n.truncated&&a.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]});case"image":return a.jsx(eS,{eventId:s,index:n.index,source:n.source,src:R[iu(s,n.index,n.source)],onRequest:x});case"thinking":return null;case"notice":return a.jsx("div",{className:`turn-notice turn-notice-${n.notice}`,children:Is(Um(n),v)});case"question":return a.jsx(Qb,{part:n,answeredAt:r,failure:c,answerable:g,onAnswer:_,needle:v});case"tool-call":{const u=v.length>0&&`${n.name} ${n.input} ${(h==null?void 0:h.text)??""}`.toLowerCase().includes(v.toLowerCase());return a.jsxs("details",{className:"tool",open:u,children:[a.jsxs("summary",{className:"tool-summary",children:[a.jsx("span",{className:"tool-name",children:n.name}),h!==null&&h.isError&&a.jsx("span",{className:"tool-error",children:C("thread.tool.error")}),h!==null&&h.imageCount>0&&a.jsx("span",{className:"tool-images",children:C("thread.tool.images",{count:h.imageCount})})]}),a.jsxs("div",{className:"tool-block",children:[a.jsx("span",{className:"tool-label",children:C("thread.tool.input")}),a.jsxs("pre",{className:"tool-pre",children:[Is(n.input,v),n.truncated&&a.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]})]}),h!==null&&a.jsxs("div",{className:"tool-block",children:[a.jsx("span",{className:"tool-label",children:C("thread.tool.result")}),a.jsxs("pre",{className:`tool-pre${h.isError?" tool-pre-error":""}`,children:[h.text.length>0?Is(h.text,v):h.imageCount>0?C("thread.tool.imagesNotSent",{count:h.imageCount}):C("thread.tool.noOutput"),h.truncated&&a.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]})]})]})}case"tool-result":return a.jsxs("div",{className:"tool-block",children:[a.jsx("span",{className:"tool-label",children:C("thread.tool.orphanResult")}),a.jsx("pre",{className:`tool-pre${n.isError?" tool-pre-error":""}`,children:Is(n.text,v)})]})}}function Qb({part:n,answeredAt:s,failure:i,answerable:h,onAnswer:v,needle:R}){var D;const[x,r]=I.useState(()=>n.questions.map(()=>[])),[c,g]=I.useState(null),[_,u]=I.useState(""),y=s!==null,S=y||!h,L=s??x,f=n.questions.length===1&&((D=n.questions[0])==null?void 0:D.multiSelect)===!1,l=L.every(E=>ba(E)?E.text.trim().length>0:E.length>0),m=E=>E===void 0||ba(E)?[]:E,p=(E,M)=>{if(S)return;const b=n.questions[E];if(b!==void 0){if(f){v(n.toolUseId,[[M]]);return}g(T=>T===E?null:T),r(T=>T.map((N,B)=>{if(B!==E)return N;const F=m(N);return b.multiSelect?F.includes(M)?F.filter(O=>O!==M):[...F,M]:[M]}))}},d=E=>{const M=_.trim();if(M.length===0||S)return;const b={kind:"free",text:M};if(f){v(n.toolUseId,[b]);return}r(T=>T.map((N,B)=>B===E?b:N)),g(null),u("")},k=E=>{if(S)return;const M=L[E];u(M!==void 0&&ba(M)?M.text:""),g(E)};return a.jsxs("div",{className:`question${y?" question-done":""}`,children:[n.questions.map((E,M)=>{const b=L[M],T=b!==void 0&&ba(b)?b.text:null;return a.jsxs("div",{className:"question-item",children:[a.jsxs("div",{className:"question-head",children:[E.header.length>0&&a.jsx("span",{className:"question-header",children:E.header}),a.jsx("span",{className:"question-text",children:Is(E.question,R)}),E.multiSelect&&a.jsx("span",{className:"question-hint",children:C("thread.question.multi")})]}),a.jsxs("div",{className:"question-options",children:[E.options.map((N,B)=>{const F=m(b).includes(B);return a.jsxs("button",{type:"button",className:`question-option${F?" question-option-picked":""}`,disabled:S,onClick:()=>p(M,B),children:[a.jsx("span",{className:"question-option-label",children:N.label}),N.description.length>0&&a.jsx("span",{className:"question-option-desc",children:N.description})]},B)}),c===M&&!S?a.jsxs("div",{className:"question-write",children:[a.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:C("thread.question.placeholder"),onChange:N=>u(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),d(M)),N.key==="Escape"&&g(null),N.stopPropagation()}}),a.jsxs("div",{className:"question-write-actions",children:[a.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>d(M),children:C(f?"thread.question.send":"thread.question.useText")}),a.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>g(null),children:C("common.cancel")})]})]}):a.jsxs("button",{type:"button",className:`question-option question-option-write${T!==null?" question-option-picked":""}`,disabled:S,onClick:()=>k(M),children:[a.jsx("span",{className:"question-option-label",children:T!==null?T:C("thread.question.writeOther")}),T===null&&a.jsx("span",{className:"question-option-desc",children:C("thread.question.writeOtherHint")})]})]})]},M)}),a.jsxs("div",{className:"question-foot",children:[i!==null&&a.jsx("span",{className:"question-failed",children:i}),y?a.jsx("span",{className:"question-sent",children:C("thread.question.answered")}):h?a.jsxs(a.Fragment,{children:[!f&&a.jsx("button",{type:"button",className:"question-send",disabled:!l,onClick:()=>v(n.toolUseId,x),children:C("thread.question.sendAnswers")}),a.jsx("span",{className:"question-note",children:C(f?"thread.question.pickOne":"thread.question.pickEach")})]}):a.jsx("span",{className:"question-note",children:C("thread.question.answerInCli")})]})]})}function Jb({text:n,truncated:s,needle:i}){const h=kw(n,s),v=h.length===1?h[0]:void 0;if(v!==void 0&&v.kind==="text")return a.jsx(zf,{text:n,truncated:s,needle:i});const R=h.length-1;return a.jsx("div",{className:"part-own",children:h.map((x,r)=>x.kind==="text"?a.jsx(zf,{text:x.text,truncated:s&&r===R,needle:i},r):a.jsx(Zb,{number:x.number,text:x.text,complete:x.complete,needle:i},r))})}function Zb({number:n,text:s,complete:i,needle:h}){const[v,R]=I.useState(!1),x=h.length>0&&s.toLowerCase().includes(h.toLowerCase()),r=v||x;return a.jsxs("div",{className:`thread-pasted${r?" thread-pasted-open":""}`,children:[a.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>R(c=>!c),"aria-expanded":r,children:[a.jsx("span",{className:"chip-icon",children:"¶"}),C("thread.pasted",{number:n,count:Ma(s)}),!i&&a.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]}),a.jsx("span",{className:"chip-chevron",children:r?"▾":"▸"})]}),r&&a.jsx("div",{className:"thread-pasted-text part-mine",children:Zm(s,h)})]})}function zf({text:n,truncated:s,needle:i}){const[h,v]=I.useState(!1),R=n.split(`
126
- `),x=i.length>0&&n.toLowerCase().includes(i.toLowerCase()),r=R.length>=Hf&&!x,c=r&&!h?R.slice(0,Hf-1).join(`
127
- `):n;return a.jsxs("div",{className:"part-text part-mine",children:[Zm(c,i),s&&a.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]}),r&&a.jsx("button",{className:"fold-toggle",onClick:()=>v(g=>!g),children:h?C("thread.fold.less"):C("thread.fold.more",{count:R.length})})]})}function eS({eventId:n,index:s,source:i,src:h,onRequest:v}){const[R,x]=I.useState(!1);return I.useEffect(()=>{h===void 0&&v(n,s,i)},[h,n,s,i,v]),h===void 0?a.jsx("div",{className:"conversation-image-placeholder",children:C("thread.image.loading")}):h===null?a.jsx("div",{className:"conversation-image-placeholder",children:C("thread.image.gone")}):a.jsxs(a.Fragment,{children:[a.jsx("img",{className:"conversation-image",src:h,alt:C("thread.image.alt"),onClick:()=>x(!0),title:C("thread.image.openTitle")}),R&&a.jsx(xm,{src:h,caption:C("thread.image.alt"),onClose:()=>x(!1)})]})}function Vf({connection:n,title:s,confirmLabel:i,confirmTitle:h,onChoose:v,onClose:R}){const[x,r]=I.useState(null),[c,g]=I.useState(null),[_,u]=I.useState(!1),[y,S]=I.useState(""),L=I.useRef(null),f=I.useRef(null);I.useEffect(()=>{const d=n.onMessage(k=>{if(k.type==="picker.listing"){L.current=k.listing.pickerId,r(k.listing),g(null),u(!1),S("");return}k.type==="error"&&k.code==="picker-failed"&&g(Nt(k.text))});return n.send({type:"picker.open"}),()=>{d();const k=L.current;k!==null&&n.send({type:"picker.close",pickerId:k})}},[n]),I.useEffect(()=>{const d=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),R())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[R]),I.useEffect(()=>{var d;_&&((d=f.current)==null||d.focus())},[_]);const l=I.useCallback(d=>{const k=L.current;k!==null&&n.send({type:"picker.enter",pickerId:k,name:d})},[n]),m=I.useCallback(d=>{const k=L.current;k!==null&&n.send({type:"picker.root",pickerId:k,rootIndex:d})},[n]),p=I.useCallback(()=>{const d=L.current,k=y.trim();d===null||k.length===0||n.send({type:"picker.create",pickerId:d,name:k})},[n,y]);return a.jsx("div",{className:"modal-backdrop",onClick:R,children:a.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":s,onClick:d=>d.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:s}),a.jsx("button",{className:"icon-button",onClick:R,title:C("common.close"),children:"×"})]}),x===null?a.jsx("p",{className:"panel-note",children:C("picker.loading")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"picker-roots",children:x.roots.map((d,k)=>a.jsx("button",{className:"picker-root",onClick:()=>m(k),title:C("picker.goTo",{root:d}),children:d},d))}),a.jsx("p",{className:"picker-path",title:x.path,children:x.path}),a.jsxs("div",{className:"picker-list",children:[x.canGoUp&&a.jsxs("button",{className:"picker-entry picker-up",onClick:()=>l(".."),children:["‹ ",C("picker.up")]}),x.entries.length===0&&!x.canGoUp&&a.jsx("p",{className:"panel-note",children:C("picker.empty")}),x.entries.map(d=>a.jsx("button",{className:"picker-entry",onClick:()=>l(d),children:d},d)),x.truncated&&a.jsx("p",{className:"panel-note",children:C("picker.truncated")})]}),c!==null&&a.jsx("p",{className:"picker-problem",children:c}),a.jsxs("footer",{className:"picker-footer",children:[_?a.jsxs("div",{className:"picker-create",children:[a.jsx("input",{ref:f,className:"picker-create-input",value:y,placeholder:C("picker.newFolderName"),onChange:d=>S(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p(),d.key==="Escape"&&(d.stopPropagation(),u(!1)),d.stopPropagation()},spellCheck:!1}),a.jsx("button",{className:"primary-button primary-button-small",onClick:p,children:C("picker.create")}),a.jsx("button",{className:"link-button",onClick:()=>u(!1),children:C("common.cancel")})]}):a.jsx("button",{className:"primary-button primary-button-small",onClick:()=>u(!0),children:C("picker.createHere")}),a.jsx("span",{className:"composer-spacer"}),a.jsx("button",{className:"picker-open",onClick:()=>v(x.pickerId,x.path),title:h(x.path),children:i})]})]})]})})}function tS(n,s){return gu(n)&&s!==null&&s.sessions>0}function nS(){return C("search.mode.titles")}function sS(){return C("search.mode.conversations")}function rS(){return C("search.mode.conversationsTitle")}function iS(n){return C(n==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function oS(){return C("search.tooShort",{min:Yp})}function aS(n){return[...n.trim()].length<Yp}function lS(){return C("search.off")}function cS(n){const s=new Map;for(const i of n){const h=`${i.agent}:${i.sessionId}`;let v=s.get(h);v===void 0&&(v={key:h,agent:i.agent,sessionId:i.sessionId,title:i.title,titleHit:null,hits:[],lastAt:null},s.set(h,v)),i.eventId===null?v.titleHit=i:v.hits.push(i),i.at!==null&&(v.lastAt=Math.max(v.lastAt??0,i.at))}return[...s.values()]}const uS=40;function eg(n,s=uS){const i=n.matchStart+n.matchLength;let h=n.snippet.slice(0,n.matchStart);if(h.length>s){let v=h.length-s;const R=h.charCodeAt(v);R>=56320&&R<=57343&&(v+=1),h=`…${h.slice(v)}`}return{before:h,match:n.snippet.slice(n.matchStart,i),after:n.snippet.slice(i)}}function hS(n){return n.role==="user"?C("search.role.user"):n.role==="assistant"?C("search.role.assistant"):C("search.role.title")}function tg(n){return eg(n).match.trim()}function dS(n){const s=n.hits[0]??n.titleHit;return s===null?"":tg(s)}const ou=n=>C("search.sessions",{count:n});function fS(n,s){return{query:s.query,hits:n===null?[...s.hits]:[...n.hits,...s.hits],sessionsScanned:s.sessionsScanned,sessionsTotal:s.sessionsTotal,truncated:null}}function pS(n){const{result:s}=n;if(n.searching&&n.error===null){if(s===null)return C("search.status.searching");const h={count:s.sessionsTotal,scanned:s.sessionsScanned};return s.hits.length===0?C("search.status.progress",h):C("search.status.progressFound",{...h,found:qf(s)})}if(n.error!==null)return n.error;if(s===null)return null;const i=s.hits.length===0?C("search.status.none"):qf(s);if(s.truncated===null&&s.hits.length===0&&s.sessionsScanned>0)return C("search.status.noneIn",{sessions:ou(s.sessionsScanned)});if(s.truncated==="results")return C("search.status.truncatedResults",{found:i});if(s.truncated==="time"){const h=Math.max(0,s.sessionsTotal-s.sessionsScanned);return C("search.status.truncatedTime",{found:i,seconds:Math.round(p0/1e3),left:ou(h)})}return C("search.status.done",{found:i})}function qf(n){const s=new Set(n.hits.map(i=>`${i.agent}:${i.sessionId}`)).size;return C("search.found",{hits:C("search.hits",{count:n.hits.length}),sessions:ou(s)})}function mS(n,s){const i=s.terminals.find(h=>h.kind==="agent"&&h.agent===n.agent&&h.sessionId===n.sessionId);if(i!==void 0)return{kind:"activate",terminalId:i.terminalId};for(const h of s.projects){const v=h.sessions.find(R=>R.agent===n.agent&&R.sessionId===n.sessionId);if(v!==void 0)return eu(v)&&h.cwdExists&&s.canResume(v.agent)?{kind:"resume",cwd:em(v.cwd,h.cwd,s.platform),session:v}:{kind:"copy"}}return{kind:"copy"}}const gS=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function zt(n,s,i){const h=lm(n,s),v=[];let R=0;for(const x of h.matchAll(gS)){const r=x.index??0;r>R&&v.push(xa(h.slice(R,r),s));const c=x[1];if(c===void 0)v.push(I.createElement("br",{key:v.length}));else{const g=xa(x[2]??"",s);v.push(I.createElement(c,{key:v.length},g))}R=r+x[0].length}return R<h.length&&v.push(xa(h.slice(R),s)),v.length===1?v[0]:v}const Kf="0.5.3",Gf="agent-workbench.support-notice",_S=3e4;function vS(n){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(n)?n:null}function yS(n,s){return n!==s}function wS(){return[{keys:"Alt + T",description:C("shortcuts.app.newTab")},{keys:"Alt + W",description:C("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:C("shortcuts.app.switchTab")},{keys:"Alt + P",description:C("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:C("shortcuts.app.previousTab")}]}function bS({agent:n,onClose:s}){return I.useEffect(()=>{const i=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),s())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[s]),a.jsx("div",{className:"modal-backdrop",onClick:s,children:a.jsxs("div",{className:"modal",role:"dialog","aria-label":C("shortcuts.ariaLabel"),onClick:i=>i.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:C("shortcuts.title")}),a.jsx("button",{className:"icon-button",onClick:s,title:C("common.close"),children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsx("h3",{className:"modal-section",children:C("shortcuts.section.app")}),a.jsx(Hc,{shortcuts:wS()}),a.jsx("h3",{className:"modal-section",children:C("shortcuts.section.composer")}),a.jsx(Hc,{shortcuts:Ty(n!==null&&n.capabilities.imagesByPath!==null)}),n!==null&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"modal-section",children:C("shortcuts.section.cli")}),a.jsx("p",{className:"modal-hint",children:zt("shortcuts.cliHint")}),a.jsx(Hc,{shortcuts:Vr[n.id].shortcuts}),Vr[n.id].shortcutsNote!==null&&a.jsx("p",{className:"modal-hint",children:Vr[n.id].shortcutsNote})]}),a.jsx("p",{className:"modal-hint",children:zt("shortcuts.browserReserved")}),a.jsx("p",{className:"modal-hint",children:zt("shortcuts.altNumber")}),a.jsxs("p",{className:"modal-hint support-hint",children:[a.jsx("span",{"aria-hidden":"true",children:"☕"})," ",C("support.notice")," ",a.jsx("a",{href:nm,target:"_blank",rel:"noreferrer noopener",children:C("support.link")})]})]})]})})}function Hc({shortcuts:n}){return a.jsx("dl",{className:"shortcut-list",children:n.map(s=>a.jsxs("div",{className:"shortcut-row",children:[a.jsx("dt",{children:a.jsx("kbd",{children:s.keys})}),a.jsx("dd",{children:s.description})]},s.keys))})}const SS=1e3,CS=5e3;function xS({info:n,agentLabel:s,onRefresh:i,onClose:h}){const[v,R]=I.useState(!1),[x,r]=I.useState(!1),c=I.useRef(null),g=I.useRef(null);I.useEffect(()=>{const L=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),h())};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[h]),I.useEffect(()=>{r(!1)},[n]),I.useEffect(()=>()=>{c.current!==null&&window.clearTimeout(c.current),g.current!==null&&window.clearTimeout(g.current)},[]);const _=L=>{navigator.clipboard.writeText(L).then(()=>{R(!0),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>R(!1),SS)}).catch(()=>R(!1))},u=()=>{r(!0),i(),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>r(!1),CS)},y=n.state==="active",S=C("statusLine.title",{agent:s});return a.jsx("div",{className:"modal-backdrop",onClick:h,children:a.jsxs("div",{className:"modal",role:"dialog","aria-label":S,onClick:L=>L.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:S}),a.jsx("button",{className:"icon-button",onClick:h,title:C("common.close"),children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsx("p",{className:`status-line-state${y?" status-line-state-active":""}`,children:Cy(n.state)}),a.jsx("p",{className:"modal-hint",children:C("statusLine.benefit")}),a.jsx("h3",{className:"modal-section",children:C("statusLine.lineSection")}),n.fragment===null?a.jsx("p",{className:"modal-hint",children:xy()}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal-hint",children:zt("statusLine.mergeHint")}),a.jsxs("div",{className:"status-line-fragment",children:[a.jsx("pre",{className:"tool-pre",children:n.fragment}),a.jsx("button",{className:"link-button",onClick:()=>_(n.fragment??""),title:C("statusLine.copyTitle"),children:v?a.jsxs(a.Fragment,{children:["✓ ",C("statusLine.copied")]}):C("statusLine.copy")})]})]}),a.jsx("h3",{className:"modal-section",children:C("statusLine.whereSection")}),a.jsx("p",{className:"status-line-path",children:n.settingsPath}),a.jsx("p",{className:"modal-hint",children:C("statusLine.whereHint")}),a.jsx("h3",{className:"modal-section",children:C("statusLine.scriptSection")}),a.jsx("p",{className:"modal-hint",children:C("statusLine.scriptHint")}),a.jsx("p",{className:"status-line-path",children:n.scriptPath}),a.jsx("p",{className:"modal-hint",children:zt("statusLine.runsEverywhere")}),a.jsxs("div",{className:"status-line-actions",children:[a.jsx("button",{className:"primary-button",onClick:u,disabled:x,children:C(x?"statusLine.checking":"statusLine.check")}),a.jsx("span",{className:"modal-hint",children:C("statusLine.checkHint")})]})]})]})})}function kS(){const[n,s]=I.useState(()=>yS(vt(Gf,null,vS),Kf));return I.useEffect(()=>{if(!n)return;pt(Gf,Kf);const i=window.setTimeout(()=>s(!1),_S);return()=>window.clearTimeout(i)},[n]),n?a.jsxs("div",{className:"banner banner-support",role:"status",children:[a.jsx("span",{children:C("support.notice")}),a.jsx("a",{className:"banner-support-link",href:nm,target:"_blank",rel:"noreferrer noopener",onClick:()=>s(!1),children:C("support.link")}),a.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>s(!1),children:C("support.dismiss")})]}):null}function au({agent:n,agents:s}){return a.jsx("span",{className:"agent-badge",title:Xi(n,s),children:uy(n)})}const ES=500,Yf=10;function LS(n){const s=I.useRef(null),i=I.useRef(null),h=I.useRef(!1),v=I.useRef(n);v.current=n;const R=I.useCallback(()=>{s.current!==null&&window.clearTimeout(s.current),s.current=null,i.current=null},[]),x=I.useCallback(_=>{_.pointerType==="mouse"||_.button!==0||(R(),h.current=!1,i.current={x:_.clientX,y:_.clientY},s.current=window.setTimeout(()=>{s.current=null,h.current=!0,v.current()},ES))},[R]),r=I.useCallback(_=>{const u=i.current;u!==null&&(Math.abs(_.clientX-u.x)>Yf||Math.abs(_.clientY-u.y)>Yf)&&R()},[R]),c=I.useCallback(_=>{(h.current||s.current!==null)&&_.preventDefault()},[]),g=I.useCallback(_=>{h.current&&(h.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:x,onPointerMove:r,onPointerUp:R,onPointerCancel:R,onContextMenu:c,onClickCapture:g}}function TS({onLongPress:n,...s}){const i=LS(n);return a.jsx("button",{...s,...i})}function Cu({className:n,text:s,title:i,disabled:h,offerAgentChoice:v,agents:R,agent:x,onOpen:r}){var L;const[c,g]=I.useState(!1),_=I.useRef(null),u=I.useCallback(()=>g(!1),[]),y=I.useCallback(f=>{g(!1),r(f)},[r]);if(!v)return a.jsx("button",{className:n,onClick:()=>r(),disabled:h,title:i,children:s});const S=((L=R.find(f=>f.id===x))==null?void 0:L.label)??null;return a.jsxs("span",{className:"split-button",children:[a.jsx("button",{className:`${n} split-button-main`,onClick:()=>r(x??void 0),disabled:h,title:S===null?i:C("agentMenu.titleWithAgent",{title:i,label:S}),children:s}),a.jsx("button",{ref:_,className:`${n} split-button-arrow`,onClick:()=>g(f=>!f),disabled:h,"aria-haspopup":"menu","aria-expanded":c,title:C("agentMenu.chooseTitle"),children:"▾"}),c&&_.current!==null&&a.jsx(Hm,{agents:R,preselected:x,anchor:_.current,onPick:y,onClose:u})]})}function RS(n){const s=new Date(n);return s.setHours(0,0,0,0),s.getTime()}function ng(n,s,i,h){const v=new Set;for(const R of n)for(const x of R.sessions)x.agent===s&&(x.archived||x.updatedAt<i&&(h.has(x.sessionId)||v.add(x.sessionId)));return[...v]}function MS(n,s,i,h){const v=[];for(const r of n)for(const c of r.sessions)v.includes(c.agent)||v.push(c.agent);const R=h,x=r=>{const c=R.indexOf(r);return c===-1?h.length:c};return v.sort((r,c)=>x(r)-x(c)).map(r=>({agent:r,count:ng(n,r,s,i).length})).filter(r=>r.count>0)}function sg(n,s){const i=new Set;let h=0;for(const v of n.sessions)if(!v.archived){if(s.has(v.sessionId)){h+=1;continue}i.add(v.sessionId)}return{sessionIds:[...i],blocked:h}}function AS(n){const{sessionIds:s,blocked:i}=n;if(s.length===0)return C("archive.allBlocked",{count:i});const h=C("archive.confirm",{count:s.length});return i===0?h:C("archive.withBlocked",{confirm:h,blocked:C("archive.blockedStays",{count:i})})}const Xf=12;function NS(n){let s=2166136261;for(let i=0;i<n.length;i+=1)s^=n.charCodeAt(i),s=Math.imul(s,16777619);return s>>>0}function rr(n){const s=n.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${NS(s)%Xf*(360/Xf)} var(--project-color-s) var(--project-color-l))`}function Yr(){return C("vault.name")}function DS(){return C("vault.privacy")}function IS(){return C("vault.archived")}function jS(){return C("vault.mark.copy")}function Qf(){return C("vault.mark.copyTitle")}function PS(){return C("vault.mark.partial")}function OS(){return C("vault.mark.partialTitle")}function rg(n){return C("vault.sessions",{count:n})}function xu(n){return n==="measuring"||n==="writing"||n==="moving"}function BS(n){const s=n.progress;switch(n.state){case"measuring":return s===null?C("vault.state.measuring"):C("vault.state.measuringProgress",{done:s.done,total:s.total});case"writing":return s===null?C("vault.state.writing"):C("vault.state.writingProgress",{done:s.done,total:s.total});case"moving":return C("vault.state.moving");default:return n.enabled?C("vault.state.on"):C("vault.state.off")}}function FS(n){if(n===null||!n.enabled)return null;const s=[Yr(),rg(n.sessions)];return n.state==="writing"?s.push(n.progress===null?C("vault.line.copying"):C("vault.line.copyingProgress",{done:n.progress.done,total:n.progress.total})):n.state==="moving"?s.push(C("vault.line.moving")):n.state==="measuring"?s.push(C("vault.line.measuring")):s.push(n.lastPassAt===null?C("vault.line.neverCopied"):Vn(n.lastPassAt)),n.pending>0&&s.push(C("vault.line.pending",{count:n.pending})),s.join(" · ")}function HS(n){return n===null?Yr():n.enabled?C("vault.button.on"):C("vault.button.off")}function $S(n){return n.enabled?"enabled":xu(n.state)?"busy":n.measurement!==null?"measured":n.passSessions>0?"existing":"needs-measure"}function US(n,s){return xu(n.state)?C("vault.busy"):s?null:C("vault.indexNotReady")}function WS(n){return xu(n.state)?C("vault.busy"):null}function zS(n){return C("vault.previousDir",{dir:n})}function VS(n){const s=[];return n.skippedEmpty>0&&s.push(C("vault.note.empty",{count:n.skippedEmpty})),n.unsupported>0&&s.push(C("vault.note.unsupported",{count:n.unsupported})),n.failed>0&&s.push(n.failureReasons.length>0?C("vault.note.failedWithReasons",{count:n.failed,reasons:n.failureReasons.map(Nt).join("; ")}):C("vault.note.failed",{count:n.failed})),s.length===0?null:C("vault.note.notCopied",{parts:s.join(" · ")})}function qS(n,s){const i=n.byAgent.map(R=>({agent:R.agent,label:Xi(R.agent,s),sessions:R.sessions,bytes:R.eventBytes+R.imageBytes,images:R.images,imageBytes:R.imageBytes,skippedArchived:R.skippedArchived,note:VS(R)})),h=i.reduce((R,x)=>({sessions:R.sessions+x.sessions,bytes:R.bytes+x.bytes,images:R.images+x.images,skippedArchived:R.skippedArchived+x.skippedArchived}),{sessions:0,bytes:n.memoryBytes,images:0,skippedArchived:0}),v=Vn(n.measuredAt);return{rows:i,memoryProjects:n.memoryProjects,memoryBytes:n.memoryBytes,total:h,summary:v.length>0?C("vault.measure.summary",{when:v,duration:qi(n.durationMs)}):C("vault.measure.summaryNoWhen",{duration:qi(n.durationMs)})}}function KS(n){const s=n.storage==="vault";return{copy:s,partial:s&&n.partial}}function GS(n){switch(n){case"exporting":return C("vault.export.exporting");case"done":return C("vault.export.done");default:return C("vault.export.idle")}}const YS=1e3;function Jf({hit:n}){const{before:s,match:i,after:h}=eg(n);return a.jsxs(a.Fragment,{children:[s,a.jsx("mark",{children:i}),h]})}function XS({project:n,openSessionIds:s,onConfirm:i,onCancel:h}){const v=sg(n,s);return a.jsxs("div",{className:"project-archive-confirm",role:"group",children:[a.jsx("span",{className:"archive-history-text",children:AS(v)}),v.sessionIds.length>0&&a.jsx("button",{className:"link-button",onClick:i,children:C("sidebar.action.archive")}),a.jsx("button",{className:"link-button",onClick:h,children:v.sessionIds.length>0?C("common.cancel"):C("common.close")})]})}function $c(n){if(n.cwd.length===0)return n.fallbackName;const s=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return s[s.length-1]??n.cwd}function Zf({out:n}){return a.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:[a.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),a.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),n?a.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):a.jsx("path",{d:"M10 12.5h4"})]})}function QS(){return a.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:[a.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"}),a.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),a.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function JS({done:n}){return a.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?a.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):a.jsxs(a.Fragment,{children:[a.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"}),a.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function ZS({candidates:n,agents:s,onArchiveAgent:i,onClose:h,anchorRef:v}){const[R,x]=I.useState(null),r=I.useRef(null);return I.useEffect(()=>{const c=u=>{var y,S;return u instanceof Node&&(((y=r.current)==null?void 0:y.contains(u))===!0||((S=v.current)==null?void 0:S.contains(u))===!0)},g=u=>{u.key!=="Escape"||!c(document.activeElement)||(u.preventDefault(),u.stopPropagation(),h())},_=u=>{c(u.target)||h()};return window.addEventListener("keydown",g,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",g,!0),document.removeEventListener("pointerdown",_,!0)}},[v,h]),a.jsxs("div",{ref:r,className:"archive-history",role:"region","aria-label":C("sidebar.history.region"),children:[a.jsxs("div",{className:"archive-history-header",children:[a.jsx("span",{children:C("sidebar.history.heading")}),a.jsx("button",{className:"icon-button",onClick:h,title:C("common.closeEsc"),children:"×"})]}),n.map(({agent:c,count:g})=>{const _=Xi(c,s);return R===c?a.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[a.jsx("span",{className:"archive-history-text",children:C("sidebar.history.confirm",{count:g,label:_})}),a.jsx("button",{className:"link-button",onClick:()=>i(c),children:C("sidebar.action.archive")}),a.jsx("button",{className:"link-button",onClick:()=>x(null),children:C("common.cancel")})]},c):a.jsxs("div",{className:"archive-history-row",children:[a.jsxs("span",{className:"archive-history-text",children:[a.jsx("span",{className:"archive-history-agent",children:_}),a.jsx("span",{className:"archive-history-count",children:C("sidebar.history.count",{count:g})})]}),a.jsx("button",{className:"link-button",onClick:()=>x(c),children:C("sidebar.action.archive")})]},c)})]})}function eC({projects:n,indexStatus:s,disabled:i,openSessionIds:h,openBlocked:v,onOpenProject:R,agents:x,offerAgentChoice:r,agentForProject:c,onOpenSession:g,canResume:_,platform:u,onRefresh:y,onArchive:S,onHide:L,width:f,onNewProject:l,vault:m,onOpenVault:p,onOpenVaultSession:d,onExportProject:k,exporting:D,lastExported:E,onContinueSession:M,globalSearch:b,onOpenSearchHit:T}){const[N,B]=I.useState(new Set),[F,O]=I.useState(null);I.useEffect(()=>{const he=E===null?0:E.at+YS-Date.now();if(E===null||he<=0)return;O(E.projectKey);const me=window.setTimeout(()=>O(null),he);return()=>window.clearTimeout(me)},[E]);const U=he=>D.has(he)?"exporting":F===he?"done":"idle",V=FS(m),[Y,X]=I.useState(""),[G,P]=I.useState(!1),[$,H]=I.useState(new Set),[q,te]=I.useState("titles"),se=b===null?"titles":q,[le,ue]=I.useState(!1),K=b!==null&&se==="conversations"&&Y.trim().length>0&&(le||b.submitted!==null),W=(b==null?void 0:b.result)??null,J=I.useMemo(()=>K&&W!==null?cS(W.hits):[],[K,W]),Z=he=>{te(he),ue(!1),b==null||b.clear()},de=()=>{if(b!==null){if(aS(Y)){ue(!0),b.clear();return}ue(!1),b.search(Y.trim(),G)}},pe=(b==null?void 0:b.submitted)??null,re=b==null?void 0:b.search;I.useEffect(()=>{se!=="conversations"||pe===null||re===void 0||pe.includeArchived!==G&&re(pe.query,G)},[se,pe,re,G]);const ke=I.useMemo(()=>n.reduce((he,me)=>he+me.sessions.filter(Ne=>Ne.archived).length,0),[n]),Me=I.useMemo(()=>{const he=se==="titles"?Y.trim().toLowerCase():"";return n.map(me=>{const Ne=G?me.sessions:me.sessions.filter(qe=>!qe.archived);if(Ne.length===0)return null;if(he.length===0)return{...me,sessions:Ne};if($c(me).toLowerCase().includes(he)||me.cwd.toLowerCase().includes(he))return{...me,sessions:Ne};const De=Ne.filter(qe=>zn(qe.title,qe.titleSource).toLowerCase().includes(he));return De.length>0?{...me,sessions:De}:null}).filter(me=>me!==null)},[n,Y,G,se]),et=se==="titles"&&Y.trim().length>0,Le=he=>he.archived||!h.has(he.sessionId),[fe,Te]=I.useState(!1),Ce=I.useRef(null),Ee=RS(Date.now()),Be=I.useMemo(()=>x.map(he=>he.id),[x]),ve=I.useMemo(()=>MS(n,Ee,h,Be),[n,Ee,h,Be]),[Ae,st]=I.useState(null);I.useEffect(()=>{ve.length===0&&Te(!1)},[ve.length]);const Xe=I.useCallback(()=>Te(!1),[]),Qe=he=>{const me=ng(n,he,Ee,h);me.length>0&&(S(me,!0),st({what:Xi(he,x),sessionIds:me})),Te(!1)},[dt,ht]=I.useState(null),$e=he=>{const me=sg(he,h);me.sessionIds.length>0&&(S(me.sessionIds,!0),st({what:$c(he),sessionIds:me.sessionIds})),ht(null)},tt=()=>{Ae!==null&&S(Ae.sessionIds,!1),st(null)},We=he=>{H(me=>{const Ne=new Set(me);return Ne.has(he)?Ne.delete(he):Ne.add(he),Ne})},ot=I.useMemo(()=>{const he=[];for(const me of Me)for(const Ne of me.sessions)$.has(Ne.sessionId)&&he.push(Ne);return he},[Me,$]),ft=he=>{const me=ot.filter(Ne=>he?Le(Ne):!0).map(Ne=>Ne.sessionId);me.length>0&&S(me,he),H(new Set)},Re=he=>{B(me=>{const Ne=new Set(me);return Ne.has(he)?Ne.delete(he):Ne.add(he),Ne})},Ve=s.state==="scanning";return a.jsxs("aside",{className:"sidebar",style:{width:`${f}px`},children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("input",{className:"sidebar-filter",type:"search",placeholder:iS(se),value:Y,onChange:he=>{X(he.target.value),se==="conversations"&&(ue(!1),he.target.value.trim().length===0&&(b==null||b.clear()))},onKeyDown:he=>{se!=="conversations"||he.key!=="Enter"||(he.preventDefault(),de())},spellCheck:!1}),a.jsx("button",{className:"icon-button",onClick:l,title:C("sidebar.newProject"),disabled:i,children:"+"}),a.jsx("button",{className:"icon-button",onClick:y,title:C("sidebar.reindex"),disabled:Ve,children:"⟳"}),a.jsx("button",{className:`icon-button${(m==null?void 0:m.enabled)===!0?" icon-button-on":""}`,onClick:p,title:HS(m),"aria-label":Yr(),children:a.jsx(QS,{})}),a.jsx("button",{className:"icon-button",onClick:L,title:C("sidebar.hide"),children:"«"})]}),b!==null&&a.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":C("sidebar.searchMode.label"),children:[a.jsx("button",{className:`sidebar-search-mode-option${se==="titles"?" is-on":""}`,"aria-pressed":se==="titles",onClick:()=>Z("titles"),title:C("sidebar.searchMode.titlesTitle"),children:nS()}),a.jsx("button",{className:`sidebar-search-mode-option${se==="conversations"?" is-on":""}`,"aria-pressed":se==="conversations",onClick:()=>Z("conversations"),title:rS(),children:sS()})]}),Ve&&a.jsx("div",{className:"sidebar-progress",children:C("sidebar.indexing",{scanned:s.scannedFiles,total:s.totalFiles})}),(ke>0||ve.length>0)&&a.jsxs("div",{className:"sidebar-archive-bar",children:[ke>0&&a.jsx("button",{className:`sidebar-archived-toggle${G?" is-on":""}`,onClick:()=>P(he=>!he),title:C("sidebar.archived.toggleTitle"),children:G?C("sidebar.archived.hide",{count:ke}):C("sidebar.archived.show",{count:ke})}),ve.length>0&&a.jsx("button",{ref:Ce,className:`link-button sidebar-archive-history${fe?" is-on":""}`,onClick:()=>Te(he=>!he),"aria-expanded":fe,title:C("sidebar.history.buttonTitle"),children:C("sidebar.history.button")})]}),fe&&ve.length>0&&a.jsx(ZS,{candidates:ve,agents:x,onArchiveAgent:Qe,onClose:Xe,anchorRef:Ce}),Ae!==null&&!fe&&a.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[a.jsx("span",{className:"archive-history-text",children:C("sidebar.undo.text",{count:Ae.sessionIds.length,what:Ae.what})}),a.jsx("button",{className:"link-button",onClick:tt,children:C("sidebar.action.undo")}),a.jsx("button",{className:"icon-button",onClick:()=>st(null),title:C("sidebar.undo.dismissTitle"),children:"×"})]}),V!==null&&a.jsx("button",{className:`sidebar-vault-line${(m==null?void 0:m.lastError)!=null?" is-problem":""}`,onClick:p,title:(m==null?void 0:m.lastError)!=null?C("sidebar.vaultLine.lastError",{error:Nt(m.lastError)}):C("sidebar.vaultLine.title"),children:V}),a.jsxs("div",{className:"sidebar-scroll",children:[K&&b!==null&&a.jsxs("div",{className:"search-results",children:[!b.vaultEnabled&&a.jsx("p",{className:"search-note",children:lS()}),a.jsx("p",{className:`search-status${b.error!==null?" is-problem":""}`,role:"status",children:le?oS():pS(b)}),!le&&J.map(he=>{const me=he.hits[0]??he.titleHit;return me===null?null:a.jsxs("div",{className:"search-group",children:[a.jsxs("button",{className:"search-group-title",onClick:()=>T(me,dS(he)),title:zn(he.title),children:[a.jsx(au,{agent:he.agent,agents:x}),he.titleHit!==null?a.jsx(Jf,{hit:he.titleHit}):zn(he.title)]}),he.hits.map(Ne=>a.jsxs("button",{className:"search-hit",onClick:()=>T(Ne,tg(Ne)),children:[a.jsx("span",{className:"search-hit-snippet",children:a.jsx(Jf,{hit:Ne})}),a.jsxs("span",{className:"search-hit-meta",children:[hS(Ne),Ne.at!==null?` · ${Vn(Ne.at)}`:""]})]},Ne.eventId??"titulo"))]},he.key)})]}),!K&&Me.length===0&&!Ve&&a.jsx("p",{className:"sidebar-empty",children:n.length===0?C("sidebar.empty.noProjects"):C("sidebar.empty.noMatch")}),!K&&Me.map(he=>{const me=N.has(he.key)||et,Ne=!i&&he.cwdExists,mt=v(he.cwd);return a.jsxs("div",{className:"project",children:[a.jsxs("div",{className:"project-row",children:[a.jsxs("button",{className:"project-toggle",onClick:()=>Re(he.key),title:he.cwd.length>0?he.cwd:he.fallbackName,children:[a.jsx("span",{className:`chevron${me?" chevron-open":""}`,children:"›"}),a.jsx("span",{className:"project-swatch",style:{background:rr(he.cwd)},"aria-hidden":"true"}),a.jsx("span",{className:"project-name",children:$c(he)}),a.jsx("span",{className:"project-count",children:he.sessions.length})]}),a.jsxs("span",{className:"project-actions",children:[k!==null&&a.jsx("button",{className:`icon-button project-action${U(he.key)!=="idle"?" project-action-busy":""}`,onClick:()=>k(he.key),disabled:U(he.key)==="exporting",title:GS(U(he.key)),"aria-label":C("sidebar.project.export"),children:a.jsx(JS,{done:U(he.key)==="done"})}),a.jsx("button",{className:`icon-button project-action${dt===he.key?" project-action-busy":""}`,onClick:()=>ht(De=>De===he.key?null:he.key),title:C("sidebar.project.archiveTitle"),"aria-label":C("sidebar.project.archive"),"aria-expanded":dt===he.key,children:a.jsx(Zf,{out:!1})})]}),a.jsx(Cu,{className:"icon-button",text:"+",title:mt?_m():he.cwdExists?C("sidebar.project.newSession"):C("sidebar.project.folderGone"),disabled:!Ne||mt,offerAgentChoice:r,agents:x,agent:r?c(he):null,onOpen:De=>R(he.cwd,De)})]}),!he.cwdExists&&a.jsx("div",{className:"project-missing",title:he.cwd,children:C("sidebar.project.missing")}),dt===he.key&&a.jsx(XS,{project:he,openSessionIds:h,onConfirm:()=>$e(he),onCancel:()=>ht(null)}),me&&a.jsx("ul",{className:"session-list",children:he.sessions.map(De=>{const qe=$.has(De.sessionId),lt=!Le(De),Rt=Qy(De.agent,x,r),Mt=KS(De),Se=eu(De)&&_(De.agent),Ke=Mt.copy?d!==null:Ne&&Se;return a.jsxs("li",{className:`session-row${De.archived?" session-archived":""}${qe?" session-selected":""}`,children:[a.jsxs(TS,{className:"session-item",onLongPress:()=>We(De.sessionId),onClick:rt=>{if(rt.ctrlKey||rt.metaKey){We(De.sessionId);return}if(Mt.copy){d==null||d(De);return}eu(De)&&(De.archived&&S([De.sessionId],!1),g(em(De.cwd,he.cwd,u),De))},disabled:!Ke,title:Mt.copy?`${zn(De.title,De.titleSource)}
128
- ${d===null?C("remote.onlyOnHost"):Qf()}`:Rt.unavailableTitle??zn(De.title,De.titleSource),children:[a.jsxs("span",{className:"session-title",children:[Rt.badge&&a.jsx(au,{agent:De.agent,agents:x}),Mt.copy&&a.jsx("span",{className:"session-vault-mark",title:Qf(),children:jS()}),Mt.partial&&a.jsx("span",{className:"session-partial-mark",title:OS(),children:PS()}),zn(De.title,De.titleSource)]}),a.jsx("span",{className:"session-meta",children:Vn(De.updatedAt)})]}),a.jsx($m,{targets:mm(x,De.agent,De.partial),className:"icon-button session-continue",text:"↪",onPick:rt=>M(De,rt)}),a.jsx("button",{className:"icon-button session-action",onClick:()=>S([De.sessionId],!De.archived),disabled:lt,title:De.archived?C("sidebar.session.restore"):C(lt?"sidebar.session.blocked":"sidebar.session.archive"),children:a.jsx(Zf,{out:De.archived})})]},`${De.agent}:${De.sessionId}`)})})]},he.key)})]}),ot.length>0&&a.jsxs("div",{className:"sidebar-selection",children:[a.jsx("span",{children:C("sidebar.selection.count",{count:ot.length})}),ot.some(he=>!he.archived)&&a.jsx("button",{className:"link-button",onClick:()=>ft(!0),children:C("sidebar.action.archive")}),ot.some(he=>he.archived)&&a.jsx("button",{className:"link-button",onClick:()=>ft(!1),children:C("sidebar.action.restore")}),a.jsx("button",{className:"link-button",onClick:()=>H(new Set),children:C("common.cancel")})]})]})}function lu({x:n,y:s,items:i,onClose:h,anchor:v=null}){const R=I.useRef(null),[x,r]=I.useState({left:n,top:s});return I.useLayoutEffect(()=>{const c=R.current;if(c===null)return;const{width:g,height:_}=c.getBoundingClientRect();r({left:Math.max(4,Math.min(n,window.innerWidth-g-4)),top:Math.max(4,Math.min(s,window.innerHeight-_-4))})},[n,s]),I.useEffect(()=>{const c=_=>{_.key==="Escape"&&(_.stopPropagation(),h())},g=_=>{var y;const u=_.target;u instanceof Node&&((y=R.current)!=null&&y.contains(u)||v!=null&&v.contains(u))||h()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[v,h]),a.jsx("div",{ref:R,className:"context-menu",style:{left:`${x.left}px`,top:`${x.top}px`},onPointerDown:c=>c.stopPropagation(),children:i.map(c=>a.jsxs("button",{className:"context-menu-item",lang:c.lang,role:c.checked===void 0?void 0:"menuitemradio","aria-checked":c.checked,onClick:()=>{c.onSelect(),h()},children:[c.checked!==void 0&&a.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function ig({listLabel:n,docs:s,active:i,tooltipOf:h,labelOf:v=c=>c.title,onShowList:R,onSelect:x,onClose:r}){return a.jsxs("div",{className:"panel-subhead doc-strip",children:[a.jsx("button",{className:`doc-strip-list${i===null?" is-active":""}`,onClick:R,title:C("docs.backToList"),children:i===null?n:`← ${n}`}),a.jsx("div",{className:"strip-tabs doc-tabs",children:s.map(c=>a.jsxs("div",{className:`strip-tab${c.key===i?" is-active":""}`,children:[a.jsx("button",{className:"strip-tab-label",onClick:()=>x(c.key),title:h(c),children:v(c)}),a.jsx("button",{className:"strip-tab-close",onClick:()=>r(c.key),title:C("docs.tab.close"),children:"×"})]},c.key))})]})}function ep(n){let s="";for(let i=0;i<n.length;i++){const h=n[i]??"",v=h.toLowerCase();s+=v.length===h.length?v:h}return s}function tC(n,s){if(s.length===0)return[];const i=ep(n),h=ep(s),v=[];let R=i.indexOf(h);for(;R!==-1;)v.push(R),R=i.indexOf(h,R+h.length);return v}function tp(n,s,i){for(let R=0;R<n.length;R++){const x=n[R]??0;if(i==="start"?s<x:s<=x){const r=R===0?0:n[R-1]??0;return{node:R,offset:s-r}}}const h=Math.max(0,n.length-1),v=h===0?0:n[h-1]??0;return{node:h,offset:(n[h]??0)-v}}function nC(n,s,i){return s===0?0:(n+i+s)%s}function sC(n){return/\.(md|markdown)$/i.test(n)}function rC(n,s){var R;const i=((R=s.split("#")[0])==null?void 0:R.split("?")[0])??"";if(i.length===0)return null;let h;try{h=decodeURIComponent(i)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(h)||h.startsWith("/")||h.startsWith("\\"))return null;const v=n.split("/").slice(0,-1);for(const x of h.replace(/\\/g,"/").split("/")){if(x.includes(":"))return null;if(!(x===""||x===".")){if(x===".."){if(v.length===0)return null;v.pop();continue}v.push(x)}}return v.length===0?null:v.join("/")}function iC({text:n,language:s}){const[i,h]=I.useState(null);I.useEffect(()=>{if(s===null){h(null);return}let R=!1;return Wn(async()=>{const{highlightCode:x}=await import("./highlight-CVfWpF4K.js");return{highlightCode:x}},[]).then(({highlightCode:x})=>{R||h(x(n,s))}).catch(()=>{R||h(null)}),()=>{R=!0,h(null)}},[n,s]);const v=I.useMemo(()=>n.split(`
129
- `).length,[n]);return a.jsxs("div",{className:"preview",children:[a.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:v},(R,x)=>a.jsx("span",{children:x+1},x))}),i!==null?a.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:"preview-code",children:n})]})}function np({onInsert:n,onOpenWithSystem:s}){const[i,h]=I.useState(!1),v=I.useRef(null);I.useEffect(()=>()=>{v.current!==null&&window.clearTimeout(v.current)},[]);const R=()=>{n==null||n(),h(!0),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>h(!1),1200)};return a.jsxs("div",{className:"preview-actions",children:[n!==void 0&&a.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:R,children:C(i?"files.pathInserted":"files.preview.insertPath")}),s!==null&&a.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:s,children:C("files.menu.openWithSystem")})]})}const cu="doc-search",uu="doc-search-current";function hu(){const n=CSS.highlights,s=window.Highlight;return n===void 0||typeof s!="function"?null:n}function sp(n){const s=window.Highlight;return new s(...n)}function rp(){const n=hu();n==null||n.delete(cu),n==null||n.delete(uu)}function oC(n,s){if(s===null)return;const i=n.getBoundingClientRect(),h=s.getBoundingClientRect();(i.top<h.top+16||i.bottom>h.bottom-16)&&(s.scrollTop+=i.top-h.top-h.height/3),(i.left<h.left||i.right>h.right)&&(s.scrollLeft+=i.left-h.left-48)}function aC(n,s,i,h){const[v,R]=I.useState(0),[x,r]=I.useState(0),[c,g]=I.useState(0),_=I.useRef([]);I.useEffect(()=>{const y=n.current;if(y===null||i.length===0)return;let S=0;const L=new MutationObserver(()=>{S===0&&(S=window.requestAnimationFrame(()=>{S=0,g(f=>f+1)}))});return L.observe(y,{childList:!0,subtree:!0,characterData:!0}),()=>{L.disconnect(),S!==0&&window.cancelAnimationFrame(S)}},[n,i,h]),I.useEffect(()=>{const y=n.current;if(_.current=[],y===null||i.length===0){rp(),R(0),r(0);return}const S=[],L=[];let f="";const l=document.createTreeWalker(y,NodeFilter.SHOW_TEXT,{acceptNode:p=>{var d;return(d=p.parentElement)!=null&&d.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let p=l.nextNode();p!==null;p=l.nextNode()){const d=p;S.push(d),f+=d.data,L.push(f.length)}_.current=tC(f,i).map(p=>{const d=tp(L,p,"start"),k=tp(L,p+i.length,"end"),D=document.createRange();return D.setStart(S[d.node],d.offset),D.setEnd(S[k.node],k.offset),D}),R(_.current.length),r(p=>p<_.current.length?p:0);const m=hu();return m!==null&&_.current.length>0?m.set(cu,sp(_.current)):m==null||m.delete(cu),rp},[n,i,c,h]),I.useEffect(()=>{r(0)},[i]),I.useEffect(()=>{const y=_.current[x],S=hu();if(y===void 0){S==null||S.delete(uu);return}S==null||S.set(uu,sp([y])),oC(y,s.current)},[x,v,c,h,i,s]);const u=I.useCallback(y=>r(S=>nC(S,v,y)),[v]);return{count:v,index:x,step:u}}function og({doc:n,content:s,readingText:i,truncatedText:h,onReload:v,onModeChange:R,onOpenWithSystem:x,onInsert:r,onOpenLink:c,initialScroll:g,onScrollChange:_}){const[u,y]=I.useState(""),S=I.useRef(null),L=I.useRef(null),f=(s==null?void 0:s.loaded)??null,l=f===null?"":f.kind==="file"?f.preview.text:f.plan.text,m=f!==null&&f.kind==="file"&&f.preview.binary,p=f!==null&&(f.kind==="file"?f.preview.truncated:f.plan.truncated),d=f!==null&&(f.kind==="plan"||f.preview.language==="markdown"||sC(f.preview.path)),k=d&&(n.mode??"formatted")==="formatted",D=f!==null&&f.kind==="file"?f.preview.language:"markdown",E=u.trim(),M=aC(L,S,E,`${k?"f":"s"}:${l.length}:${l.slice(0,64)}`),b=I.useRef(!1);I.useLayoutEffect(()=>{b.current||f===null||(b.current=!0,g!==void 0&&S.current!==null&&(S.current.scrollTop=g))},[f,g]);const T=c===void 0||f===null||f.kind!=="file"?void 0:B=>{const F=rC(n.key,B);return F===null?null:()=>c(F)},N=f!==null&&!m;return a.jsxs("div",{className:"panel-body doc-viewer",children:[a.jsxs("div",{className:"doc-toolbar",children:[a.jsx("input",{className:"conversation-search-input",type:"search",placeholder:C("docs.search.placeholder"),value:u,disabled:!N,onChange:B=>y(B.target.value),onKeyDown:B=>{B.key==="Enter"&&M.step(B.shiftKey?-1:1),B.key==="Escape"&&y(""),B.stopPropagation()},spellCheck:!1}),E.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"conversation-matches",children:M.count===0?C("thread.search.none"):`${M.index+1}/${M.count}`}),a.jsx("button",{className:"icon-button",onClick:()=>M.step(-1),disabled:M.count===0,title:C("thread.search.previous"),children:"↑"}),a.jsx("button",{className:"icon-button",onClick:()=>M.step(1),disabled:M.count===0,title:C("thread.search.next"),children:"↓"})]}),d&&a.jsxs("div",{className:"doc-mode",role:"group","aria-label":C("docs.mode.label"),children:[a.jsx("button",{className:k?"is-active":"","aria-pressed":k,onClick:()=>R("formatted"),children:C("docs.mode.formatted")}),a.jsx("button",{className:k?"":"is-active","aria-pressed":!k,onClick:()=>R("source"),children:C("docs.mode.source")})]}),a.jsx("button",{className:"icon-button",onClick:v,disabled:(s==null?void 0:s.loading)===!0,title:C("docs.reload"),children:"⟳"})]}),(s==null?void 0:s.failed)===!0&&f!==null&&a.jsx("p",{className:"panel-note doc-note",children:C("docs.reloadFailed")}),f===null?a.jsx("p",{className:"panel-note",children:(s==null?void 0:s.failed)===!0?C("docs.failed"):i}):m?a.jsxs("div",{className:"preview-fallback",children:[a.jsx("p",{className:"panel-note",children:C("files.preview.binary")}),a.jsx(np,{onInsert:r,onOpenWithSystem:x})]}):a.jsxs("div",{className:"panel-scroll",ref:S,onScroll:B=>_(B.currentTarget.scrollTop),children:[a.jsx("div",{ref:L,className:k?"plan-body":"doc-source",children:k?a.jsx(Su,{text:l,localLink:T}):a.jsx(iC,{text:l,language:D})}),p&&a.jsxs("div",{className:"preview-fallback",children:[a.jsx("p",{className:"panel-note",children:h}),f.kind==="file"&&a.jsx(np,{onInsert:r,onOpenWithSystem:x})]})]})]})}function ku(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:a.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 lC(){return a.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[a.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),a.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 cC({open:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[a.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"}),a.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!n&&a.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function uC(){return a.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[a.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),a.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 hC(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:a.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ag({className:n,title:s,doneTitle:i,icon:h,onAction:v}){const[R,x]=I.useState(!1),r=I.useRef(null);I.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const c=g=>{g.stopPropagation(),v(),x(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>x(!1),1200)};return a.jsx("button",{className:R?`${n} tree-action-done`:n,onClick:c,title:R?i:s,children:R?a.jsx(hC,{}):h})}function dC({className:n,title:s,onCopy:i}){return a.jsx(ag,{className:n,title:s,doneTitle:C("common.copied"),icon:a.jsx(lC,{}),onAction:i})}function Eu({className:n,title:s,onInsert:i}){return a.jsx(ag,{className:n,title:s,doneTitle:C("files.pathInserted"),icon:a.jsx(uC,{}),onAction:i})}function fC({view:n,cwd:s,platform:i,onInsert:h,onInsertPath:v,onReveal:R,docs:x}){const{listings:r,loading:c,refresh:g,query:_,setQuery:u,showHidden:y,toggleHidden:S}=n,L=Qi(),[f,l]=I.useState(null),m=i==="win32"?"\\":"/",p=I.useCallback(V=>{const Y=V.split("/").join(m);return s.length===0?Y:s.endsWith(m)?`${s}${Y}`:`${s}${m}${Y}`},[s,m]),d=I.useCallback(V=>{navigator.clipboard.writeText(V).catch(()=>{})},[]),k=I.useCallback(V=>v(`"${p(V)}"`),[p,v]),D=I.useCallback((V,Y)=>{V.preventDefault(),V.stopPropagation(),l({x:V.clientX,y:V.clientY,items:[{label:C("files.menu.copyAbsolute"),onSelect:()=>d(p(Y))},{label:C("files.menu.copyRelative"),onSelect:()=>d(Y)},...h===void 0?[]:[{label:C("files.menu.insertMention"),onSelect:()=>h(`@${Y}`)}],...R===null?[]:[{label:C("files.menu.openWithSystem"),onSelect:()=>R(Y)}]]})},[p,d,h,R,L]),E=x.active===null?null:x.docs.find(V=>V.key===x.active)??null,M=E===null?void 0:x.content(E.key),b=E!==null&&M===void 0;I.useEffect(()=>{b&&E!==null&&x.reload(E.key)},[b,E==null?void 0:E.key]);const T=I.useCallback(V=>x.open({key:V,title:V.split("/").pop()??V}),[x]),N=I.useMemo(()=>({...n,openFile:T}),[n,T]),B=V=>{var X;const Y=(X=x.content(V.key))==null?void 0:X.loaded;return(Y==null?void 0:Y.kind)==="file"?`${V.key} · ${hn(Y.preview.sizeBytes)}`:V.key},F=x.docs.length>0?a.jsx(ig,{listLabel:C("panel.tab.files"),docs:x.docs,active:x.active,tooltipOf:B,onShowList:x.showList,onSelect:x.select,onClose:x.close}):null;if(E!==null)return a.jsxs("div",{className:"panel-body",children:[F,a.jsx(og,{doc:E,content:M,readingText:C("files.readingFile"),truncatedText:C("files.preview.truncated"),onReload:()=>x.reload(E.key),onModeChange:V=>x.setMode(E.key,V),onOpenWithSystem:R===null?null:()=>R(E.key),onInsert:()=>k(E.key),onOpenLink:T,initialScroll:x.scrollOf(E.key),onScrollChange:V=>x.rememberScroll(E.key,V)},E.key),f!==null&&a.jsx(lu,{x:f.x,y:f.y,items:f.items,onClose:()=>l(null)})]});const O=r.get(""),U=_.trim();return a.jsxs("div",{className:"panel-body",children:[F,a.jsxs("div",{className:"panel-subhead",children:[a.jsx("span",{className:"panel-subhead-title",title:s,children:s.split(/[\\/]/).filter(V=>V.length>0).pop()??s}),a.jsx(Eu,{className:"icon-button",title:C("files.insertFolderPath"),onInsert:()=>k("")}),a.jsx("button",{className:y?"icon-button icon-button-on":"icon-button",onClick:S,title:C(y?"files.hidden.hide":"files.hidden.show"),children:a.jsx(cC,{open:y})}),R!==null&&a.jsx("button",{className:"icon-button",onClick:()=>R(""),title:C("files.revealFolder"),children:a.jsx(ku,{})}),a.jsx("button",{className:"icon-button",onClick:g,title:C("files.refresh"),children:"⟳"})]}),a.jsxs("div",{className:"tree-search",children:[a.jsx("input",{className:"tree-search-input",value:_,placeholder:C("files.search.placeholder"),onChange:V=>u(V.target.value),onKeyDown:V=>{V.key==="Escape"&&_.length>0&&(V.stopPropagation(),u(""))}}),_.length>0&&a.jsx("button",{className:"tree-search-clear",onClick:()=>u(""),title:C("files.search.clear"),children:"×"})]}),a.jsx("div",{className:"panel-scroll",children:U.length>0?a.jsx(pC,{view:N,onContextMenu:D,onReveal:R,onInsertPath:k}):O===void 0?a.jsx("p",{className:"panel-note",children:c.has("")?C("files.readingDir"):C("files.readDirFailed")}):a.jsx(lg,{path:"",depth:0,view:N,onContextMenu:D,onReveal:R,onInsertPath:k})}),f!==null&&a.jsx(lu,{x:f.x,y:f.y,items:f.items,onClose:()=>l(null)})]})}function pC({view:n,onContextMenu:s,onReveal:i,onInsertPath:h}){const{results:v,searching:R,openFile:x,toggleDirectory:r}=n;return v===null?a.jsx("p",{className:"panel-note",children:C(R?"files.search.searching":"files.search.prompt")}):v.entries.length===0?a.jsx("p",{className:"panel-note",children:C("files.search.none")}):a.jsxs("ul",{className:"tree tree-results",children:[v.entries.map(c=>a.jsx("li",{children:a.jsxs("div",{className:"tree-item",children:[a.jsxs("button",{className:`tree-row tree-row-${c.kind}${c.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>c.kind==="dir"?r(c.path):x(c.path),onContextMenu:g=>s(g,c.path,c.kind),title:c.path,children:[a.jsx("span",{className:"tree-chevron",children:c.kind==="dir"?"›":""}),a.jsxs("span",{className:"tree-result",children:[a.jsx("span",{className:"tree-name",children:c.name}),a.jsx("span",{className:"tree-result-path",children:c.path})]}),c.kind==="file"&&a.jsx("span",{className:"tree-size",children:hn(c.sizeBytes)})]}),a.jsx(Eu,{className:"tree-action",title:C("files.insertPath",{name:c.name}),onInsert:()=>h(c.path)}),c.kind==="dir"&&i!==null&&a.jsx("button",{className:"tree-action",onClick:()=>i(c.path),title:C("files.reveal",{name:c.name}),children:a.jsx(ku,{})})]})},c.path)),v.truncated&&a.jsx("li",{className:"tree-hidden",title:C("files.search.moreTitle"),children:C("files.search.more")})]})}function lg({path:n,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R}){const{listings:x,loading:r}=i,c=x.get(n);return c===void 0?r.has(n)?a.jsx("div",{className:"tree-loading",children:C("files.loading")}):null:a.jsxs("ul",{className:"tree",children:[c.entries.map(g=>a.jsx(mC,{entry:g,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R},g.path)),c.entries.length===0&&a.jsx("li",{className:"tree-empty",style:{paddingLeft:`${s*12+8}px`},children:c.hiddenCount>0?C("files.allHidden"):C("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&a.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${s*12+8}px`},title:C("files.hiddenTitle"),children:c.truncated?C("files.moreEntries"):C("files.hiddenCount",{count:c.hiddenCount})})]})}function mC({entry:n,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R}){const{expanded:x,toggleDirectory:r,openFile:c}=i,g=n.kind==="dir"&&x.has(n.path);return a.jsxs("li",{children:[a.jsxs("div",{className:"tree-item",children:[a.jsxs("button",{className:`tree-row tree-row-${n.kind}${n.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${s*12+6}px`},onClick:()=>n.kind==="dir"?r(n.path):c(n.path),onContextMenu:_=>h(_,n.path,n.kind),title:n.hidden===void 0?n.path:`${n.path}
130
- ${n.hidden==="ignored"?C("files.row.ignored"):C("files.row.alwaysHidden")}`,children:[a.jsx("span",{className:`tree-chevron${g?" tree-chevron-open":""}`,children:n.kind==="dir"?"›":""}),a.jsx("span",{className:"tree-name",children:n.name}),n.kind==="file"&&a.jsx("span",{className:"tree-size",children:hn(n.sizeBytes)})]}),a.jsx(Eu,{className:"tree-action",title:C("files.insertPath",{name:n.name}),onInsert:()=>R(n.path)}),n.kind==="dir"&&v!==null&&a.jsx("button",{className:"tree-action",onClick:()=>v(n.path),title:C("files.reveal",{name:n.name}),children:a.jsx(ku,{})})]}),g&&a.jsx(lg,{path:n.path,depth:s+1,view:i,onContextMenu:h,onReveal:v,onInsertPath:R})]})}const gC={added:"+",removed:"-",context:" ",hunk:"",meta:""};function _C({diff:n}){return n.binary?a.jsx("p",{className:"panel-note",children:C("diff.binary")}):n.lines.length===0?a.jsx("p",{className:"panel-note",children:n.message===null?C("diff.noChanges"):Nt(n.message)}):a.jsxs("div",{className:"panel-scroll",children:[a.jsx("div",{className:"diff",children:n.lines.map((s,i)=>a.jsxs("div",{className:`diff-line diff-line-${s.kind}`,children:[a.jsx("span",{className:"diff-num","aria-hidden":"true",children:s.oldLine??""}),a.jsx("span",{className:"diff-num","aria-hidden":"true",children:s.newLine??""}),a.jsx("span",{className:"diff-marker","aria-hidden":"true",children:gC[s.kind]}),a.jsx("span",{className:"diff-text",children:s.text})]},i))}),n.truncated&&a.jsx("p",{className:"panel-note",children:C("diff.truncated")})]})}const vC={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},yC={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"},wC=[{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 ip(n){const s=n.endsWith("/"),i=s?n.slice(0,-1):n,h=i.lastIndexOf("/"),v=h===-1?i:i.slice(h+1);return{dir:h===-1?"":i.slice(0,h+1),name:s?`${v}/`:v,isDirectory:s}}function bC({status:n}){return a.jsxs("div",{className:"git-headline",children:[a.jsx("span",{className:"git-branch",title:n.repoRoot,children:n.branch??(n.head!==null?C("git.detachedAt",{head:n.head}):C("git.detached"))}),n.upstream!==null&&a.jsx("span",{className:"git-upstream",title:C("git.upstreamTitle",{upstream:n.upstream}),children:n.upstream}),(n.ahead>0||n.behind>0)&&a.jsxs("span",{className:"git-ab",title:C("git.aheadBehindTitle"),children:[n.ahead>0&&a.jsxs("span",{className:"git-ahead",children:["↑",n.ahead]}),n.behind>0&&a.jsxs("span",{className:"git-behind",children:["↓",n.behind]})]})]})}function SC({view:n}){const{status:s,diff:i,loadingDiff:h,openDiff:v,closeDiff:R,refresh:x}=n;if(i!==null||h)return a.jsxs("div",{className:"panel-body",children:[a.jsxs("div",{className:"panel-subhead",children:[a.jsxs("button",{className:"link-button",onClick:R,children:["← ",C("git.backToChanges")]}),i!==null&&a.jsxs("span",{className:"panel-subhead-title",title:i.path,children:[ip(i.path).name,i.staged&&a.jsxs("span",{className:"panel-tagline",children:[" ",C("git.stagedTag")]})]})]}),h?a.jsx("p",{className:"panel-note",children:C("git.readingDiff")}):i!==null&&a.jsx(_C,{diff:i})]});if(s.state!=="ready")return a.jsx("div",{className:"panel-body",children:a.jsx("p",{className:"panel-note",children:s.message===null?C("git.unknownState"):Nt(s.message)})});const r=s.worktrees.filter(c=>!c.isCurrent);return a.jsxs("div",{className:"panel-body",children:[a.jsxs("div",{className:"panel-subhead",children:[a.jsx(bC,{status:s}),a.jsx("button",{className:"icon-button",onClick:x,title:C("git.refresh"),children:"⟳"})]}),a.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&a.jsx("p",{className:"panel-note",children:C("git.clean")}),wC.map(c=>{const g=s.changes.filter(_=>_.stage===c.stage);return g.length===0?null:a.jsxs("section",{className:"git-group",children:[a.jsxs("h3",{className:"git-group-title",title:C(c.hint),children:[C(c.title),a.jsx("span",{className:"git-group-count",children:g.length})]}),a.jsx("ul",{className:"git-list",children:g.map(_=>{const{dir:u,name:y,isDirectory:S}=ip(_.path),L=_.oldPath!==null?`${_.oldPath} → ${_.path}`:S?C("git.newFolderTitle",{path:_.path}):_.path,f=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`git-badge git-badge-${_.kind}`,title:C(yC[_.kind]),children:vC[_.kind]}),a.jsxs("span",{className:"git-path",children:[a.jsx("span",{className:"git-path-name",children:y}),u.length>0&&a.jsx("span",{className:"git-path-dir",children:u})]})]});return a.jsx("li",{children:S?a.jsx("div",{className:"git-item git-item-static",title:L,children:f}):a.jsx("button",{className:"git-item",onClick:()=>v(_.path,_.stage==="staged"),title:L,children:f})},`${c.stage}:${_.path}`)})})]},c.stage)}),s.truncated&&a.jsx("p",{className:"panel-note",children:zt("git.truncated")}),r.length>0&&a.jsxs("section",{className:"git-group",children:[a.jsxs("h3",{className:"git-group-title",title:C("git.worktrees.headingTitle"),children:[C("git.worktrees.heading"),a.jsx("span",{className:"git-group-count",children:r.length})]}),a.jsx("ul",{className:"git-list",children:r.map(c=>a.jsx("li",{children:a.jsxs("div",{className:"git-worktree",title:c.path,children:[a.jsx("span",{className:"git-worktree-branch",children:c.branch??C("git.worktrees.detached")}),a.jsx("span",{className:"git-worktree-path",children:c.path})]})},c.path))})]})]})]})}const CC={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},xC={"AGENTS.md":["Codex","Antigravity","OpenCode"],"CLAUDE.md":["Claude Code"]};function Fa(n){return n.brokenBlock||n.problem!==null}function kC(n){return n.problem==="outside"?C("memory.problem.outside"):n.problem==="encoding"?C("memory.problem.encoding"):n.brokenBlock?C("memory.problem.brokenBlock"):null}function EC(n){const s=n.files.filter(i=>!Fa(i));return n.installed?{instructionFiles:s.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}:{...n0(n),instructionFiles:s.map(i=>i.name)}}function LC(n){const s=n.files.filter(v=>v.hasBlock&&!v.blockCurrent),i=n.files.filter(v=>v.exists&&!v.hasBlock&&!Fa(v)),h=v=>wu(v.map(R=>R.name));return s.length===0?i.length===0?null:C("memory.update.missing",{files:h(i)}):i.length===0?C("memory.update.outdated",{count:s.length,files:h(s)}):C("memory.update.outdatedAndMissing",{count:s.length,outdated:h(s),missing:h(i)})}function TC(n){const s=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
131
- `),i=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(s);return i===null?s:s.slice(i[0].length)}function RC(n){return n.split(/`([^`]+)`/).map((s,i)=>i%2===1?a.jsx("code",{children:s},i):s)}function MC({view:n}){var l;const{status:s,open:i,loading:h,error:v,closeNote:R,openNote:x}=n,[r,c]=I.useState(null),[g,_]=I.useState(!1),u=(s==null?void 0:s.cwd)??null;I.useEffect(()=>{c(null),_(!1)},[u]),I.useEffect(()=>{n.lastResult!==null&&(c(null),_(!1))},[n.lastResult]);const y=I.useCallback(m=>{if(s===null)return null;let p=m.replace(/^\.\//,"");try{p=decodeURIComponent(p)}catch{return null}return p===Ta||s.notes.some(k=>k.name===p)?()=>x(p):null},[s,x]);if(s===null)return a.jsx("div",{className:"panel-body",children:a.jsx("p",{className:"panel-note",children:v??C("memory.loading")})});if(i!==null||h!==null){const m=(i==null?void 0:i.name)??h??"",p=m===Ta?C("memory.index"):((l=s.notes.find(d=>d.name===m))==null?void 0:l.title)??m;return a.jsxs("div",{className:"panel-body",children:[a.jsxs("div",{className:"panel-subhead",children:[a.jsx("button",{className:"link-button",onClick:R,children:C("memory.back")}),a.jsx("span",{className:"panel-subhead-title",title:m,children:p})]}),i===null?a.jsx("p",{className:"panel-note",children:C("memory.note.loading")}):a.jsxs("div",{className:"panel-scroll",children:[a.jsx("div",{className:"plan-body",children:a.jsx(Su,{text:TC(i.text),localLink:y})}),i.truncated&&a.jsx("p",{className:"panel-note",children:C("memory.note.truncated")})]})]})}const S=r??EC(s),L=s.installed?LC(s):null,f=!s.installed||g||n.planned!==null;return a.jsxs("div",{className:"panel-body",children:[a.jsx(AC,{reach:s.reach,onAdjust:s.installed&&!f&&L===null&&s.reach.some(m=>!m.reaches)?()=>_(!0):null}),a.jsxs("div",{className:"panel-scroll",children:[(v??n.lastResult)!==null&&a.jsxs("div",{className:`memory-message${v!==null?" memory-message-error":""}`,children:[a.jsx("span",{children:v??n.lastResult}),a.jsx("button",{className:"link-button",onClick:n.dismissMessage,title:C("common.dismissNotice"),children:"×"})]}),s.git.kind==="error"&&a.jsxs("div",{className:"memory-warning",children:[a.jsx("p",{className:"memory-warning-line",children:zt("memory.git.errorWarning")}),a.jsx("pre",{className:"memory-git-message",children:Nt(s.git.message)})]}),s.files.filter(Fa).map(m=>a.jsx("p",{className:"memory-warning",children:m.problem==="outside"?zt("memory.problem.outsideWarning",{file:m.name}):m.problem==="encoding"?zt("memory.problem.encodingWarning",{file:m.name}):zt("memory.problem.brokenBlockWarning",{file:m.name})},m.name)),!s.installed&&a.jsxs("div",{className:"memory-intro",children:[a.jsx("p",{children:C("memory.intro.what")}),a.jsx("p",{children:zt("memory.intro.where")})]}),s.installed&&L!==null&&!f&&a.jsxs("div",{className:"memory-callout",children:[a.jsx("span",{children:L}),a.jsx("button",{className:"primary-button primary-button-small",onClick:()=>_(!0),children:C("memory.update.button")})]}),f&&(n.planned===null?a.jsx(NC,{status:s,options:S,busy:n.busy,onChange:c,onPlan:()=>{c(S),n.requestPlan(S)},onCancel:s.installed?()=>{_(!1),c(null)}:null}):a.jsx(DC,{changes:n.planned,busy:n.busy,confirmLabel:s.installed?C("memory.plan.update"):C("memory.plan.install"),onConfirm:n.install,onCancel:n.cancelPlan})),s.installed&&s.native.pending>0&&!f&&a.jsxs("div",{className:"memory-callout",children:[a.jsx("span",{children:C("memory.native.pending",{count:s.native.pending})}),a.jsx("button",{className:"primary-button primary-button-small",disabled:n.busy!==null,onClick:n.importNative,children:n.busy==="import"?C("memory.native.importing"):C("memory.native.import",{count:s.native.pending})})]}),s.installed&&a.jsx(IC,{notes:s.notes,indexExists:s.indexExists,onOpen:x}),s.globalFragments.length>0&&a.jsx(jC,{fragments:s.globalFragments})]})]})}function AC({reach:n,onAdjust:s}){return a.jsxs("div",{className:"memory-reach",children:[n.map(i=>a.jsxs("span",{className:`memory-reach-item${i.reaches?" memory-reach-on":""}`,title:C("memory.reach.title",{label:i.label,via:Nt(i.via)}),children:[a.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:i.reaches?"✓":"—"}),i.label,a.jsx("span",{className:"visually-hidden",children:i.reaches?C("memory.reach.reaches",{via:Nt(i.via)}):C("memory.reach.doesNotReach",{via:Nt(i.via)})})]},i.agent)),s!==null&&a.jsx("button",{className:"link-button memory-reach-adjust",onClick:s,title:C("memory.reach.adjustTitle"),children:C("memory.reach.adjust")})]})}function NC({status:n,options:s,busy:i,onChange:h,onPlan:v,onCancel:R}){const{git:x}=n,r=x.kind==="repo"?x.worktree:null,c=x.kind==="error"&&s.gitMode==="ignore",g=(_,u)=>{const y=new Set(s.instructionFiles);u?y.add(_):y.delete(_),h({...s,instructionFiles:_u.filter(S=>y.has(S))})};return a.jsxs("div",{className:"memory-form",children:[a.jsx("p",{className:"memory-section-label",children:C("memory.form.files")}),n.files.map(_=>a.jsxs("label",{className:"memory-option",title:kC(_)??void 0,children:[a.jsx("input",{type:"checkbox",checked:s.instructionFiles.includes(_.name),disabled:Fa(_),onChange:u=>g(_.name,u.target.checked)}),a.jsx("code",{children:_.name}),a.jsx("span",{className:"memory-option-hint",children:wu(xC[_.name])})]},_.name)),x.kind==="repo"&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"memory-section-label",children:"Git"}),a.jsxs("label",{className:"memory-option",children:[a.jsx("input",{type:"radio",name:"memory-git-mode",checked:s.gitMode==="ignore",onChange:()=>h({...s,gitMode:"ignore"})}),C("memory.git.ignore"),a.jsx("span",{className:"memory-option-hint",children:C("memory.git.ignoreHint")})]}),a.jsxs("label",{className:"memory-option",children:[a.jsx("input",{type:"radio",name:"memory-git-mode",checked:s.gitMode==="version",onChange:()=>h({...s,gitMode:"version"})}),C("memory.git.version"),a.jsx("span",{className:"memory-option-hint",children:C("memory.git.versionHint")})]}),x.ignored&&s.gitMode==="version"&&a.jsx("p",{className:"memory-warning",children:zt("memory.git.alreadyIgnored")})]}),x.kind==="error"&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"memory-section-label",children:"Git"}),a.jsxs("label",{className:"memory-option",children:[a.jsx("input",{type:"radio",name:"memory-git-mode",checked:s.gitMode==="version",onChange:()=>h({...s,gitMode:"version"})}),zt("memory.git.dontTouch"),a.jsx("span",{className:"memory-option-hint",children:C("memory.git.errorHint")})]})]}),(n.native.pending>0||(r==null?void 0:r.mainHasMemory)===!0)&&a.jsx("p",{className:"memory-section-label",children:C("memory.form.existingNotes")}),n.native.pending>0&&a.jsxs("label",{className:"memory-option",children:[a.jsx("input",{type:"checkbox",checked:s.importNative,onChange:_=>h({...s,importNative:_.target.checked})}),C("memory.form.importNative",{count:n.native.pending})]}),(r==null?void 0:r.mainHasMemory)===!0&&a.jsxs("label",{className:"memory-option",title:r.mainPath,children:[a.jsx("input",{type:"checkbox",checked:s.copyFromMainWorktree,onChange:_=>h({...s,copyFromMainWorktree:_.target.checked})}),C("memory.form.copyFromMain")]}),a.jsxs("div",{className:"memory-actions",children:[a.jsx("button",{className:"primary-button primary-button-small",disabled:i!==null||s.instructionFiles.length===0||c,onClick:v,title:s.instructionFiles.length===0?C("memory.form.noFiles"):c?C("memory.git.blocked"):void 0,children:C(i==="plan"?"memory.form.planning":"memory.form.preview")}),R!==null&&a.jsx("button",{className:"link-button",onClick:R,disabled:i!==null,children:C("common.cancel")})]})]})}function DC({changes:n,busy:s,confirmLabel:i,onConfirm:h,onCancel:v}){const R=s==="install";return a.jsxs("div",{className:"memory-form",children:[a.jsx("p",{className:"memory-section-label",children:C("memory.plan.changes")}),n.length===0?a.jsx("p",{className:"memory-empty",children:C("memory.plan.nothing")}):a.jsx("ul",{className:"memory-change-list",children:n.map((x,r)=>a.jsxs("li",{className:"memory-change",children:[a.jsxs("div",{className:"memory-change-head",children:[a.jsx("code",{className:"memory-change-file",children:x.file}),a.jsx("span",{className:"memory-option-hint",children:C(CC[x.action])})]}),x.copiedFrom!==null&&a.jsx("p",{className:"memory-option-hint",children:C("memory.plan.copiedFrom",{path:x.copiedFrom})}),x.preview.length>0&&a.jsx("pre",{className:"memory-preview",children:x.preview})]},`${x.file}-${r}`))}),a.jsxs("div",{className:"memory-actions",children:[n.length>0&&a.jsx("button",{className:"primary-button primary-button-small",disabled:s!==null,onClick:h,children:R?C("memory.plan.writing"):i}),a.jsx("button",{className:"link-button",onClick:v,disabled:R,children:n.length===0?C("memory.plan.back"):C("common.cancel")})]})]})}function IC({notes:n,indexExists:s,onOpen:i}){return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"memory-section-label",children:C("memory.list.notes")}),a.jsxs("ul",{className:"plan-list",children:[s&&a.jsx("li",{children:a.jsxs("button",{className:"plan-row",onClick:()=>i(Ta),children:[a.jsx("span",{className:"plan-name",children:C("memory.index")}),a.jsx("span",{className:"plan-meta",children:Ta})]})}),n.map(h=>a.jsx("li",{children:a.jsxs("button",{className:"plan-row",onClick:()=>i(h.name),title:h.name,children:[a.jsx("span",{className:"plan-name",children:h.title}),h.description.length>0&&a.jsx("span",{className:"memory-note-description",children:h.description}),a.jsxs("span",{className:"plan-meta",children:[Vn(h.modifiedAt)," · ",hn(h.sizeBytes)]})]})},h.name))]}),n.length===0&&a.jsx("p",{className:"memory-empty",children:C("memory.list.empty")})]})}function jC({fragments:n}){const s=I.useCallback(i=>{navigator.clipboard.writeText(i).catch(()=>{})},[]);return a.jsxs("details",{className:"memory-global",children:[a.jsx("summary",{className:"memory-global-summary",children:C("memory.global.title")}),a.jsx("p",{className:"memory-empty",children:zt("memory.global.intro")}),n.map(i=>a.jsxs("div",{className:"memory-fragment",children:[a.jsxs("div",{className:"memory-change-head",children:[a.jsx("span",{className:"memory-fragment-label",children:i.label}),a.jsx("code",{className:"memory-fragment-target",title:i.target,children:i.target})]}),a.jsxs("div",{className:"memory-fragment-body",children:[a.jsx("pre",{className:"memory-preview",children:i.text}),a.jsx(dC,{className:"icon-button",title:C("memory.global.copy"),onCopy:()=>s(i.text)})]}),a.jsx("p",{className:"memory-fragment-note",children:RC(Nt(i.note))})]},i.agent))]})}function PC(n){for(const s of n.split(`
132
- `,40)){const i=/^#{1,3}\s+(.+)$/.exec(s.trim());if(i!==null)return(i[1]??"").trim()}return null}function OC({view:n,docs:s}){const{plans:i}=n,h=s.active===null?null:s.docs.find(c=>c.key===s.active)??null,v=h===null?void 0:s.content(h.key),R=h!==null&&v===void 0&&n.listFor!==null&&n.listFor===s.terminalId;I.useEffect(()=>{R&&h!==null&&s.reload(h.key)},[R,h==null?void 0:h.key]);const x=c=>{var _;const g=(_=s.content(c.key))==null?void 0:_.loaded;return(g==null?void 0:g.kind)==="plan"?PC(g.plan.text)??c.title:c.title},r=c=>{var _;const g=((_=i.find(u=>u.fileName===c.key))==null?void 0:_.path)??"";return g.length>0?g:x(c)};return a.jsxs("div",{className:"panel-body",children:[s.docs.length>0&&a.jsx(ig,{listLabel:C("panel.tab.plans"),docs:s.docs,active:s.active,tooltipOf:r,labelOf:x,onShowList:s.showList,onSelect:s.select,onClose:s.close}),h!==null?a.jsx(og,{doc:h,content:v,readingText:C("plans.loading"),truncatedText:C("plans.truncated"),onReload:()=>s.reload(h.key),onModeChange:c=>s.setMode(h.key,c),onOpenWithSystem:null,initialScroll:s.scrollOf(h.key),onScrollChange:c=>s.rememberScroll(h.key,c)},h.key):a.jsx("div",{className:"panel-scroll",children:i.length===0?a.jsx("p",{className:"panel-note",children:zt("plans.empty")}):a.jsx("ul",{className:"plan-list",children:[...i].reverse().map(c=>a.jsx(BC,{plan:c,onOpen:()=>s.open({key:c.fileName,title:c.title})},c.fileName))})})]})}function BC({plan:n,onOpen:s}){const i=n.path.length>0?n.path:null;return n.exists?a.jsx("li",{children:a.jsxs("button",{className:"plan-row",onClick:s,title:i??void 0,children:[a.jsx("span",{className:"plan-name",children:n.title}),i!==null&&a.jsx("span",{className:"plan-path",children:i}),a.jsxs("span",{className:"plan-meta",children:[Vn(n.modifiedAt)," · ",hn(n.sizeBytes)]})]})}):a.jsxs("li",{className:"plan-row plan-row-missing",title:i??C("plans.missingTitle"),children:[a.jsx("span",{className:"plan-name",children:n.title}),i!==null&&a.jsx("span",{className:"plan-path",children:i}),a.jsx("span",{className:"plan-meta",children:C("plans.missing")})]})}const FC=[{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 cg(n){return n.state!=="ready"?0:new Set(n.changes.map(s=>s.path)).size}function HC({tab:n,plansAvailable:s,hiddenTabs:i,hidden:h,onTabChange:v,title:R,cwd:x,platform:r,cli:c,cliUnseen:g,expanded:_,onToggleExpanded:u,git:y,files:S,plans:L,documents:f,memory:l,onInsert:m,onInsertPath:p,onReveal:d,onHide:k}){var M;const D=cg(y.status),E=((M=l.status)==null?void 0:M.installed)===!0?l.status.notes.length:0;return a.jsxs("section",{className:`side-panel${h?" side-panel-hidden":""}`,"aria-hidden":h,children:[a.jsxs("header",{className:"side-panel-header",children:[a.jsx("button",{className:"icon-button",onClick:k,title:C("panel.hide"),children:"»"}),x.length>0&&a.jsx("span",{className:"project-swatch",style:{background:rr(x)}}),a.jsx("span",{className:"side-panel-title",title:x,children:R}),a.jsx("button",{className:"icon-button",onClick:u,title:C(_?"panel.restoreWidth":"panel.widen"),children:_?"⇥":"⇤"})]}),a.jsx("nav",{className:"side-panel-tabs",children:ky(FC,s,i).map(b=>a.jsxs("button",{className:`side-panel-tab${b.id===n?" side-panel-tab-active":""}`,onClick:()=>v(b.id),title:C(b.labelKey),children:[a.jsx("span",{className:"side-panel-tab-label",children:C(b.labelKey)}),b.id==="git"&&D>0&&a.jsx("span",{className:"side-panel-badge",children:D}),b.id==="plans"&&L.plans.length>0&&a.jsx("span",{className:"side-panel-badge",children:L.plans.length}),b.id==="memory"&&E>0&&a.jsx("span",{className:"side-panel-badge",children:E}),b.id==="cli"&&g&&n!=="cli"&&a.jsx("span",{className:"side-panel-dot",title:C("panel.cliUnseen")})]},b.id))}),a.jsxs("div",{className:"side-panel-body",children:[a.jsx("div",{className:`cli-slot${n==="cli"?"":" cli-slot-hidden"}`,children:c}),n==="git"&&a.jsx(SC,{view:y}),n==="plans"&&a.jsx(OC,{view:L,docs:f.plans}),n==="memory"&&a.jsx(MC,{view:l}),n==="files"&&a.jsx(fC,{view:S,cwd:x,platform:r,onInsert:m,onInsertPath:p,onReveal:d,docs:f.files})]})]})}function $C(n,s,i){return`${s===void 0||s.length===0?n:`${n} — ${s}`}
133
- ${i}`}function UC({placement:n}){return a.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${n.pending.cwd}
134
- ${C("tabs.state.opening")}`,style:{"--tab-project-color":rr(n.pending.cwd)},children:[a.jsx("span",{className:"tab-opening","aria-label":C("tabs.aria.opening"),children:a.jsx("i",{})}),a.jsx("span",{className:"tab-label",children:n.label})]})}function Lu({terminal:n,activity:s,statusLine:i}){if(!n.alive){const h=n.sleeping;return a.jsx("span",{className:`tab-dot${h?" tab-dot-sleeping":" tab-dot-dead"}`,title:C(h?"tabs.dot.sleeping":"tabs.dot.exited")})}return s==="waiting"?a.jsx("span",{className:"tab-bang",title:C("tabs.dot.waiting"),children:"!"}):s==="busy"?a.jsxs("span",{className:"tab-working",title:C("tabs.dot.busy"),"aria-label":C("tabs.aria.working"),children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]}):a.jsx("span",{className:"tab-dot",title:Py(s,i)})}function Ki(n){if(n.label.length>0)return n.label;const s=n.cwd.split(/[\\/]/).filter(h=>h.length>0),i=s[s.length-1]??n.cwd;return n.resumed?`${i} ↩`:i}function WC(n){return n.alive?C("tabs.state.alive"):n.sleeping?C("tabs.state.sleeping"):C("tabs.state.exited",{code:n.exitCode??"?"})}function zC({terminals:n,activeTerminalId:s,activity:i,canOpen:h,onSelect:v,onClose:R,onRename:x,onReorder:r,onNew:c,agents:g,offerAgentChoice:_,newTabAgent:u,pendingOpens:y,platform:S,newTabBlockedTitle:L,sessionTitles:f}){const[l,m]=I.useState(null),[p,d]=I.useState(""),[k,D]=I.useState(null),E=I.useRef(null);I.useEffect(()=>{var O;l!==null&&((O=E.current)==null||O.select())},[l]);const M=O=>{m(O.terminalId),d(O.label.length>0?O.label:Ki(O))},b=()=>{l!==null&&x(l,p.trim()),m(null)},T=O=>{if(k===null||k===O)return;const U=n.map(X=>X.terminalId),V=U.indexOf(k),Y=U.indexOf(O);V===-1||Y===-1||(U.splice(Y,0,...U.splice(V,1)),r(U),D(null))},N=uw(n,y,S),B=new Map;for(const O of N){const U=B.get(O.index);U===void 0?B.set(O.index,[O]):U.push(O)}const F=O=>(B.get(O)??[]).map(U=>a.jsx(UC,{placement:U},`pending:${U.pending.requestId}`));return a.jsxs("div",{className:"tab-bar",children:[n.map((O,U)=>{var X;const V=O.terminalId===s,Y=O.terminalId===l;return a.jsxs(K_.Fragment,{children:[F(U),a.jsx("div",{className:`tab${V?" tab-active":""}${O.alive||O.sleeping?"":" tab-dead"}`,draggable:!Y,onDragStart:()=>D(O.terminalId),onDragOver:G=>G.preventDefault(),onDrop:()=>T(O.terminalId),onDragEnd:()=>D(null),onClick:()=>v(O.terminalId),onDoubleClick:()=>M(O),title:$C(O.cwd,f.get(O.terminalId),WC(O)),style:{"--tab-project-color":rr(O.cwd)},children:Y?a.jsx("input",{ref:E,className:"tab-input",value:p,onChange:G=>d(G.target.value),onBlur:b,onKeyDown:G=>{G.key==="Enter"&&b(),G.key==="Escape"&&m(null),G.stopPropagation()},onClick:G=>G.stopPropagation()}):a.jsxs(a.Fragment,{children:[a.jsx(Lu,{terminal:O,activity:i.get(O.terminalId),statusLine:((X=g.find(G=>G.id===O.agent))==null?void 0:X.statusLine)??null}),a.jsxs("span",{className:"tab-label",children:[O.agent!==null&&Xy(_,O.agent)&&a.jsx(au,{agent:O.agent,agents:g}),Ki(O)]}),a.jsx("button",{className:"tab-close",onClick:G=>{G.stopPropagation(),R(O.terminalId)},title:C("tabs.close"),children:"×"})]})})]},O.terminalId)}),F(n.length),a.jsx(Cu,{className:"tab-new",text:"+",title:L??C("tabs.new"),disabled:!h||L!==null,offerAgentChoice:_,agents:g,agent:u,onOpen:c})]})}function VC(n,s,i){const[h,v]=I.useState(!1);return I.useEffect(()=>{if(v(!1),!(s===null||i))return n.onMessage(R=>{R.type==="terminal.output"&&R.terminalId===s&&v(!0)})},[n,s,i]),h&&!i}const qC=200,op="agent-workbench.files.hidden";function KC(n,s){const[i,h]=I.useState(new Map),[v,R]=I.useState(new Set),[x,r]=I.useState(new Set),[c,g]=I.useState(""),[_,u]=I.useState(null),[y,S]=I.useState(!1),[L,f]=I.useState(()=>vt(op,!1,E=>E==="true"?!0:E==="false"?!1:null)),l=I.useRef(new Set),m=I.useRef(L);m.current=L;const p=I.useCallback(E=>{s===null||l.current.has(E)||(l.current.add(E),r(M=>new Set(M).add(E)),n.send({type:"files.list",terminalId:s,path:E,includeHidden:m.current}))},[n,s]);I.useEffect(()=>{if(h(new Map),R(new Set),r(new Set),g(""),u(null),S(!1),l.current=new Set,s===null)return;const E=n.onMessage(b=>{switch(b.type){case"files.listing":{if(b.terminalId!==s)break;const{listing:T}=b;l.current.delete(T.path),h(N=>new Map(N).set(T.path,T)),r(N=>{const B=new Set(N);return B.delete(T.path),B});break}case"files.results":if(b.terminalId!==s)break;u(b.result),S(!1);break;case"error":l.current=new Set,r(new Set),S(!1);break}});n.send({type:"files.list",terminalId:s,path:"",includeHidden:m.current}),l.current.add(""),r(new Set([""]));const M=n.onReopen(()=>{l.current=new Set,n.send({type:"files.list",terminalId:s,path:"",includeHidden:m.current})});return()=>{E(),M()}},[n,s]),I.useEffect(()=>{const E=c.trim();if(s===null||E.length===0){u(null),S(!1);return}S(!0);const M=window.setTimeout(()=>{n.send({type:"files.search",terminalId:s,query:E,includeHidden:m.current})},qC);return()=>window.clearTimeout(M)},[n,s,c,L]);const d=I.useCallback(E=>{R(M=>{const b=new Set(M);return b.has(E)?b.delete(E):(b.add(E),p(E)),b})},[p]),k=I.useCallback(()=>{if(s===null)return;l.current=new Set;const E=["",...v];for(const M of E)l.current.add(M),n.send({type:"files.list",terminalId:s,path:M,includeHidden:m.current});r(new Set(E))},[n,s,v]),D=I.useCallback(()=>{f(E=>{const M=!E;if(m.current=M,pt(op,String(M)),s!==null){l.current=new Set;const b=["",...v];for(const T of b)l.current.add(T),n.send({type:"files.list",terminalId:s,path:T,includeHidden:M});r(new Set(b))}return M})},[n,s,v]);return{listings:i,expanded:v,loading:x,query:c,setQuery:g,results:_,searching:y,showHidden:L,toggleHidden:D,toggleDirectory:d,refresh:k}}function GC(n){const[s,i]=I.useState(!1),[h,v]=I.useState(null),[R,x]=I.useState(null),[r,c]=I.useState(null),g=I.useRef(null);I.useEffect(()=>{const y=n.onMessage(L=>{switch(L.type){case"search.progress":if(g.current===null||L.searchId!==g.current)break;v(f=>fS(f,L.progress));break;case"search.results":if(g.current===null||L.searchId!==g.current)break;g.current=null,v(L.result),x(null),i(!1);break;case"error":if(L.code!=="search-failed"||g.current===null||L.requestId!==g.current)break;g.current=null,L.detail!==void 0&&console.error("[servidor]",L.detail),v(null),x(Nt(L.text)),i(!1);break}}),S=n.onReopen(()=>{g.current!==null&&(g.current=null,i(!1),x(C("searchHook.connectionLost")))});return()=>{y(),S()}},[n]);const _=I.useCallback((y,S)=>{const L=crypto.randomUUID();g.current=L,c({query:y,includeArchived:S}),i(!0),x(null),v(null),n.send({type:"search.global",searchId:L,query:y,includeArchived:S})},[n]),u=I.useCallback(()=>{const y=g.current;g.current=null,y!==null&&n.send({type:"search.cancel",searchId:y}),c(null),i(!1),v(null),x(null)},[n]);return{searching:s,result:h,error:R,submitted:r,search:_,clear:u}}function YC(n,s){const[i,h]=I.useState([]),[v,R]=I.useState(null);return I.useEffect(()=>{if(h([]),R(null),s!==null)return n.onMessage(x=>{switch(x.type){case"conversation.plans":if(x.terminalId!==s)break;h(x.plans),R(s);break}})},[n,s]),{plans:i,listFor:v}}const ug=8,hg=1024,XC=300,QC=["file","plan"],Ia={docs:[],active:null,recent:[]},Gi={};function ja(n,s){return[...n.filter(i=>i!==s),s]}function JC(n,s){const i=n.docs.find(R=>R.key===s.key);if(i!==void 0)return{docs:i.title===s.title?n.docs:n.docs.map(x=>x.key===s.key?{...x,title:s.title}:x),active:s.key,recent:ja(n.recent,s.key)};let h=[...n.docs,{key:s.key,title:s.title}],v=ja(n.recent,s.key);for(;h.length>ug;){const R=v.find(x=>x!==s.key);if(R===void 0)break;h=h.filter(x=>x.key!==R),v=v.filter(x=>x!==R)}return{docs:h,active:s.key,recent:v}}function ZC(n,s){return n.docs.some(i=>i.key===s)?{...n,active:s,recent:ja(n.recent,s)}:n}function ex(n){return n.active===null?n:{...n,active:null}}function tx(n,s){const i=n.docs.findIndex(x=>x.key===s);if(i===-1)return n;const h=n.docs.filter(x=>x.key!==s),v=n.recent.filter(x=>x!==s);if(n.active!==s)return{docs:h,active:n.active,recent:v};const R=h[i]??h[i-1]??null;return{docs:h,active:R===null?null:R.key,recent:R===null?v:ja(v,R.key)}}function nx(n,s,i){return{...n,docs:n.docs.map(h=>h.key===s?{...h,mode:i}:h)}}function Uc(n,s,i){var h;return((h=n[s])==null?void 0:h[i])??Ia}function sx(n,s,i,h){const v=n[s]??{file:Ia,plan:Ia};return{...n,[s]:{...v,[i]:h}}}function rx(n,s){if(s.length===0)return n;const i=new Set(s),h=Object.keys(n).filter(R=>!i.has(R));if(h.length===0)return n;const v={...n};for(const R of h)delete v[R];return v}function sr(n,s,i){return`${n}\0${s}\0${i}`}function ix(n){const s=new Set;for(const[i,h]of Object.entries(n))for(const v of QC)for(const R of h[v].docs)s.add(sr(i,v,R.key));return s}function ox(n){return JSON.stringify(n)}function Pa(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function ax(n){const s=Pa(n);if(s===null)return null;const{key:i,title:h,mode:v}=s;if(typeof i!="string"||i.length===0||i.length>hg||typeof h!="string"||h.length>XC)return null;const R={key:i,title:h};return v==="formatted"||v==="source"?{...R,mode:v}:R}function ap(n){const s=Pa(n);if(s===null||!Array.isArray(s.docs))return Ia;const i=[];for(const r of s.docs){const c=ax(r);if(c!==null&&!i.some(g=>g.key===c.key)&&i.push(c),i.length===ug)break}const h=i.map(r=>r.key),v=typeof s.active=="string"&&h.includes(s.active)?s.active:null,R=Array.isArray(s.recent)?s.recent.filter(r=>typeof r=="string"&&h.includes(r)):[],x=[...h.filter(r=>!R.includes(r)),...new Set(R)];return{docs:i,active:v,recent:x}}function lx(n){let s;try{s=JSON.parse(n)}catch{return Gi}const i=Pa(s);if(i===null)return Gi;const h={};for(const[v,R]of Object.entries(i)){const x=Pa(R);if(x===null||v.length===0||v.length>hg)continue;const r=ap(x.file),c=ap(x.plan);r.docs.length===0&&c.docs.length===0||(h[v]={file:r,plan:c})}return h}const dg="agent-workbench.docTabs";function cx(){try{const n=window.sessionStorage.getItem(dg);return n===null?Gi:lx(n)}catch{return Gi}}function ux(n,s,i){const[h,v]=I.useState(cx),[R,x]=I.useState(new Map),r=I.useRef(R);r.current=R;const c=I.useRef(new Map);I.useEffect(()=>{v(u=>rx(u,s.map(y=>y.terminalId)))},[s]),I.useEffect(()=>{const u=ix(h);for(const y of[...c.current.keys()])u.has(y)||c.current.delete(y);x(y=>{const S=[...y.keys()].filter(f=>!u.has(f));if(S.length===0)return y;const L=new Map(y);for(const f of S)L.delete(f);return L})},[h]),I.useEffect(()=>{try{window.sessionStorage.setItem(dg,ox(h))}catch{}},[h]);const g=I.useCallback((u,y,S)=>{const L=sr(u,y,S);x(f=>{var l;return new Map(f).set(L,{loaded:((l=f.get(L))==null?void 0:l.loaded)??null,loading:!0,failed:!1})}),y==="file"?n.send({type:"files.read",terminalId:u,path:S}):n.send({type:"plans.read",terminalId:u,fileName:S})},[n]);I.useEffect(()=>{const u=(L,f)=>x(l=>l.has(L)?new Map(l).set(L,{loaded:f,loading:!1,failed:!1}):l),y=n.onMessage(L=>{switch(L.type){case"files.preview":u(sr(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":u(sr(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"error":x(f=>{if(![...f.values()].some(m=>m.loading))return f;const l=new Map;for(const[m,p]of f)l.set(m,p.loading?{...p,loading:!1,failed:!0}:p);return l});break}}),S=n.onReopen(()=>{for(const[L,f]of r.current){if(!f.loading)continue;const[l,m,p]=L.split("\0");l===void 0||p===void 0||(m==="file"&&n.send({type:"files.read",terminalId:l,path:p}),m==="plan"&&n.send({type:"plans.read",terminalId:l,fileName:p}))}});return()=>{y(),S()}},[n]);const _=I.useCallback(u=>{const y=i,S=y===null?Uc(Gi,"",u):Uc(h,y,u),L=f=>{y!==null&&v(l=>sx(l,y,u,f(Uc(l,y,u))))};return{terminalId:y,docs:S.docs,active:S.active,open:f=>{y!==null&&(L(l=>JC(l,f)),g(y,u,f.key))},select:f=>L(l=>ZC(l,f)),showList:()=>L(ex),close:f=>L(l=>tx(l,f)),setMode:(f,l)=>L(m=>nx(m,f,l)),content:f=>y===null?void 0:R.get(sr(y,u,f)),reload:f=>{y!==null&&g(y,u,f)},rememberScroll:(f,l)=>{y!==null&&c.current.set(sr(y,u,f),l)},scrollOf:f=>y===null?void 0:c.current.get(sr(y,u,f))}},[i,h,R,g]);return I.useMemo(()=>({files:_("file"),plans:_("plan")}),[_])}function hx(n,s){const[i,h]=I.useState(xc),[v,R]=I.useState(null),[x,r]=I.useState(!1);I.useEffect(()=>{if(s===null){h(xc),R(null);return}h(xc),R(null),r(!1);const u=n.onMessage(S=>{switch(S.type){case"git.status":S.terminalId===s&&h(S.status);break;case"git.diff":if(S.terminalId!==s)break;R(S.diff),r(!1);break;case"error":r(!1);break}});n.send({type:"git.subscribe",terminalId:s});const y=n.onReopen(()=>{n.send({type:"git.subscribe",terminalId:s})});return()=>{u(),y(),n.send({type:"git.unsubscribe",terminalId:s})}},[n,s]);const c=I.useCallback((u,y)=>{s!==null&&(r(!0),R(null),n.send({type:"git.diff",terminalId:s,path:u,staged:y}))},[n,s]),g=I.useCallback(()=>{R(null),r(!1)},[]),_=I.useCallback(()=>{s!==null&&n.send({type:"git.refresh",terminalId:s})},[n,s]);return{status:i,diff:v,loadingDiff:x,openDiff:c,closeDiff:g,refresh:_}}const du=new Set;function dx(n){return n!==void 0&&du.has(n)}function fx(n){return n.length===0?C("memory.result.nothingChanged"):C("memory.result.installed",{count:n.length})}function px(n,s){const i=n.length===0?C("memory.result.nothingImported"):C("memory.result.imported",{count:n.length});return s.length===0?i:C("memory.result.withSkipped",{result:i,skipped:C("memory.result.skipped",{count:s.length,files:s.join(", ")})})}function mx(n,s){const[i,h]=I.useState(null),[v,R]=I.useState(null),[x,r]=I.useState(null),[c,g]=I.useState(null),[_,u]=I.useState(null),[y,S]=I.useState(null),[L,f]=I.useState(null),l=I.useRef(new Map),m=I.useRef(new Set),p=I.useRef(null),d=I.useRef(!1),k=I.useCallback(U=>{const V=`memory-${crypto.randomUUID()}`;return l.current.set(V,U),m.current.add(V),du.add(V),V},[]),D=I.useCallback(U=>{for(const[V,Y]of l.current)Y===U&&l.current.delete(V)},[]);I.useEffect(()=>{h(null),R(null),r(null),g(null),u(null),S(null),f(null),l.current.clear();for(const P of m.current)du.delete(P);if(m.current.clear(),p.current=null,d.current=!1,s===null)return;const U=(P,$)=>P===void 0||l.current.get(P)!==$?!1:(l.current.delete(P),!0),V=n.onMessage(P=>{switch(P.type){case"memory.status":if(P.terminalId!==s)break;h(P.status),d.current&&(d.current=!1,f(null));break;case"memory.planned":if(P.terminalId!==s||!U(P.requestId,"plan"))break;g(P.changes),u(null);break;case"memory.installed":if(P.terminalId!==s||!U(P.requestId,"install"))break;p.current=null,g(null),u(null),S(fx(P.applied));break;case"memory.imported":if(P.terminalId!==s||!U(P.requestId,"import"))break;u(null),S(px(P.copied,P.skipped));break;case"memory.content":if(P.terminalId!==s||!U(P.requestId,"read"))break;R(P.note),r(null);break;case"error":{const $=P.requestId,H=$===void 0?void 0:l.current.get($);if($===void 0||H===void 0)break;l.current.delete($),H==="read"?r(null):H!=="subscribe"&&u(null),f(Nt(P.text)),d.current=H==="subscribe";break}}}),Y=n.onStatus(P=>{if(P!=="reconnecting"&&P!=="failed")return;const $=new Set(l.current.values());l.current.clear(),u(null),r(null),($.has("install")||$.has("import"))&&(p.current=null,g(null),f(C("memory.error.connectionLost")))}),X=()=>{n.send({type:"memory.subscribe",terminalId:s,requestId:k("subscribe")})};X();const G=n.onReopen(X);return()=>{V(),Y(),G(),n.send({type:"memory.unsubscribe",terminalId:s})}},[n,s,k]);const E=I.useCallback(()=>{d.current=!1,f(null),S(null)},[]),M=I.useCallback(U=>{s!==null&&(D("read"),E(),r(U),R(null),n.send({type:"memory.read",terminalId:s,name:U,requestId:k("read")}))},[n,s,E,D,k]),b=I.useCallback(()=>{D("read"),R(null),r(null)},[D]),T=I.useCallback(U=>{s!==null&&(E(),p.current=U,g(null),u("plan"),n.send({type:"memory.plan",terminalId:s,options:U,requestId:k("plan")}))},[n,s,E,k]),N=I.useCallback(()=>{const U=p.current;s===null||U===null||(E(),u("install"),n.send({type:"memory.install",terminalId:s,options:U,requestId:k("install")}))},[n,s,E,k]),B=I.useCallback(()=>{s!==null&&(E(),u("import"),n.send({type:"memory.import",terminalId:s,requestId:k("import")}))},[n,s,E,k]),F=I.useCallback(()=>{D("plan"),p.current=null,g(null)},[D]),O=I.useCallback(()=>{d.current=!1,f(null),S(null)},[]);return{status:i,open:v,loading:x,planned:c,busy:_,lastResult:y,error:L,openNote:M,closeNote:b,requestPlan:T,install:N,importNative:B,cancelPlan:F,dismissMessage:O}}function gx(n){const[s,i]=I.useState([]),[h,v]=I.useState({}),[R,x]=I.useState(null),r=I.useRef(new Set);I.useEffect(()=>{const l=n.onMessage(p=>{switch(p.type){case"notes.list":i(p.notes);break;case"notes.imageData":r.current.add(p.imageId),v(d=>({...d,[p.imageId]:p.data===null?null:`data:${p.mediaType};base64,${p.data}`}));break;case"error":p.code==="notes-failed"&&x(Nt(p.text));break}}),m=n.onReopen(()=>{r.current.clear()});return()=>{l(),m()}},[n]);const c=I.useCallback(l=>{r.current.has(l)||(r.current.add(l),n.send({type:"notes.image",imageId:l}))},[n]),g=I.useCallback(()=>{const l=crypto.randomUUID(),m=Date.now();return i(p=>[...p,{noteId:l,text:"",images:[],createdAt:m,updatedAt:m}]),n.send({type:"notes.create",noteId:l}),l},[n]),_=I.useCallback((l,m)=>{i(p=>p.map(d=>d.noteId===l?{...d,text:m,updatedAt:Date.now()}:d)),n.send({type:"notes.update",noteId:l,text:m})},[n]),u=I.useCallback(l=>{i(m=>m.filter(p=>p.noteId!==l)),n.send({type:"notes.delete",noteId:l})},[n]),y=I.useCallback((l,m)=>{const p=s.find(k=>k.noteId===l);if(p!==void 0&&p.images.length>=Zd){x(C("notes.tooManyImages",{count:Zd}));return}if(m.size>Ra){x(C("notes.imageTooBig",{name:m.name||C("notes.imageFallbackName"),size:Math.round(m.size/1024/1024),max:Ra/1024/1024}));return}const d=new FileReader;d.onload=()=>{const k=d.result;if(typeof k!="string")return;const D=k.indexOf(",");D!==-1&&n.send({type:"notes.addImage",noteId:l,image:{mediaType:m.type,data:k.slice(D+1)}})},d.onerror=()=>x(C("notes.readFailed")),d.readAsDataURL(m)},[n,s]),S=I.useCallback((l,m)=>{i(p=>p.map(d=>d.noteId===l?{...d,images:d.images.filter(k=>k.imageId!==m)}:d)),n.send({type:"notes.removeImage",noteId:l,imageId:m})},[n]),L=I.useCallback((l,m)=>{n.send({type:"notes.send",noteId:l,terminalId:m})},[n]),f=I.useCallback(()=>x(null),[]);return{notes:s,images:h,problem:R,requestImage:c,create:g,updateText:_,remove:u,addImage:y,removeImage:S,sendToAgent:L,dismissProblem:f}}const fg="agent-workbench.theme",Wc=["system","light","dark"],_x={system:"theme.system",light:"theme.light",dark:"theme.dark"};function lp(n){return C("theme.title",{theme:C(_x[n])})}const cp={system:"◐",light:"☀",dark:"☾"};function vx(){return vt(fg,"system",n=>n==="light"||n==="dark"||n==="system"?n:null)}function yx(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function wx(){const[n,s]=I.useState(vx),[i,h]=I.useState(yx);I.useEffect(()=>{const x=window.matchMedia("(prefers-color-scheme: dark)"),r=c=>h(c.matches);return x.addEventListener("change",r),()=>x.removeEventListener("change",r)},[]);const v=n==="system"?i?"dark":"light":n;I.useEffect(()=>{document.documentElement.dataset.theme=v,document.documentElement.style.colorScheme=v},[v]);const R=I.useCallback(()=>{s(x=>{const r=Wc[(Wc.indexOf(x)+1)%Wc.length]??"system";return pt(fg,r),r})},[]);return{preference:n,resolved:v,cycle:R}}const up="agent-workbench.terminalTheme";function bx(n){return n==="dark"||n==="follow"?n:null}function Sx(n,s){return n==="follow"?s:"dark"}function Cx(n){const[s,i]=I.useState(()=>vt(up,"dark",bx)),h=Sx(s,n);I.useEffect(()=>{document.documentElement.dataset.terminalTheme=h},[h]);const v=I.useCallback(R=>{pt(up,R),i(R)},[]);return{preference:s,resolved:h,setPreference:v}}const xx=1500;function kx(n,s){return n===void 0||n===s?null:s==="waiting"?"attention":s==="idle"&&n==="busy"?"done":null}function Ex(n,s){const i={now:[],later:[],cancel:[]};for(const[h,v]of s){const R=n.get(h);if(R===v)continue;i.cancel.push(h);const x=kx(R,v);x==="attention"?i.now.push(h):x==="done"&&i.later.push(h)}for(const h of n.keys())s.has(h)||i.cancel.push(h);return i}const hp="agent-workbench.phone-chime";function Lx(n){return n==="system"||n==="page"?n:null}function Tx(n){return`agentworkbench://chime?source=${n}`}function Rx(n,s,i,h){return n?s==="page"?Ha:null:i?Ji(h):null}const dp="agent-workbench.sound";function Mx(n){return n==="on"?!0:n==="off"?!1:null}function Ax(n){return C(n?"sound.on":"sound.off")}function Nx(n,s){return n&&s>0}const Dx={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}]},pg=.02,Ha=.8,mg=.2,fp="agent-workbench.sound-volume";function Ji(n){return Math.min(Ha,Math.max(pg,n))}function Ix(n){if(n.trim().length===0)return null;const s=Number(n);return Number.isFinite(s)?Ji(s):null}function jx(n){return Math.round(Ji(n)/Ha*100)}class Px{constructor(){Tt(this,"context",null);Tt(this,"volume",mg)}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 s;return((s=this.context)==null?void 0:s.state)==="running"}play(s){const i=this.context;if(i===null||i.state!=="running")return;const h=i.currentTime+.01;for(const v of Dx[s]){const R=i.createOscillator(),x=i.createGain();R.type="sine",R.frequency.value=v.frequency;const r=h+v.at;x.gain.setValueAtTime(1e-4,r),x.gain.exponentialRampToValueAtTime(Ji(this.volume),r+.012),x.gain.exponentialRampToValueAtTime(1e-4,r+v.duration),R.connect(x),x.connect(i.destination),R.start(r),R.stop(r+v.duration+.02)}}}const zc="agent-workbench.notify";function Ox(n){return n==="on"?!0:n==="off"?!1:null}function Bx(n,s,i){return n&&s==="granted"&&!i}function Fx(n,s){return C(s==="denied"?"sound.notify.blocked":n?"sound.notify.on":"sound.notify.off")}function Hx(n,s){return n==="attention"?C("notify.attention",{tab:s}):C("notify.done",{tab:s})}function $x(n){return n===void 0?"":n.label.length>0?n.label:n.cwd.split(/[\\/]/).filter(s=>s.length>0).pop()??n.cwd}function zi(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function Ux(){if(zi()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return zi()}}function Wx(){return document.visibilityState==="visible"&&document.hasFocus()}function zx(n){try{const s=new Notification("Agent Workbench",{body:Hx(n.chime,n.tabName),tag:`agent-workbench:${n.terminalId}`});s.onclick=()=>{window.focus(),n.onClick(),s.close()}}catch{}}function Vx(n,s){const[i,h]=I.useState(()=>vt(dp,!0,Mx)),v=I.useRef(i);v.current=i;const[R,x]=I.useState(()=>vt(fp,mg,Ix)),r=I.useRef(R);r.current=R;const[c]=I.useState(()=>typeof navigator<"u"&&Lm(navigator.userAgent)),[g,_]=I.useState(()=>vt(hp,"system",Lx)),u=I.useRef(g);u.current=g;const[y,S]=I.useState(()=>zi()),[L,f]=I.useState(()=>vt(zc,!1,Ox)),l=I.useRef(L);l.current=L;const m=I.useRef(s);m.current=s;const p=I.useCallback((U,V)=>{Bx(l.current,zi(),Wx())&&zx({chime:U,terminalId:V,tabName:m.current.nameOf(V),onClick:()=>m.current.activate(V)})},[]),d=I.useRef(null),k=I.useRef(new Map),D=I.useRef(new Map),E=I.useCallback(U=>{const V=d.current,Y=Rx(c,u.current,v.current,r.current);V===null||Y===null||(V.volume=Y,V.play(U))},[c]);I.useEffect(()=>{const U=new Px;U.volume=r.current,d.current=U;const V=()=>{U.unlock(),U.ready&&(window.removeEventListener("pointerdown",V),window.removeEventListener("keydown",V))};return window.addEventListener("pointerdown",V),window.addEventListener("keydown",V),()=>{window.removeEventListener("pointerdown",V),window.removeEventListener("keydown",V),d.current=null}},[]),I.useEffect(()=>{const U=Ex(k.current,n);k.current=new Map(n);const V=D.current;for(const Y of U.cancel){const X=V.get(Y);X!==void 0&&(window.clearTimeout(X),V.delete(Y))}U.now.length>0&&E("attention");for(const Y of U.now)p("attention",Y);for(const Y of U.later)V.set(Y,window.setTimeout(()=>{V.delete(Y),E("done"),p("done",Y)},xx))},[n,p,E]),I.useEffect(()=>{const U=D.current;return()=>{for(const V of U.values())window.clearTimeout(V);U.clear()}},[]);const M=I.useCallback(()=>{var U,V;h(Y=>{const X=!Y;return pt(dp,X?"on":"off"),X}),v.current||((U=d.current)==null||U.unlock(),(V=d.current)==null||V.play("done"))},[]),b=I.useCallback(U=>{const V=Ji(U);x(V),pt(fp,String(V)),d.current!==null&&(d.current.volume=V)},[]),T=I.useCallback(()=>{var U,V;v.current&&((U=d.current)==null||U.unlock(),(V=d.current)==null||V.play("done"))},[]),N=I.useCallback(()=>{if(l.current&&zi()==="granted"){f(!1),pt(zc,"off");return}Ux().then(U=>{S(U),U==="granted"&&(f(!0),pt(zc,"on"))})},[]),B={supported:y!=="unsupported",enabled:L&&y==="granted",permission:y,toggle:N},F=I.useCallback(U=>{var V;_(U),u.current=U,pt(hp,U),window.location.href=Tx(U),U==="page"&&((V=d.current)==null||V.unlock(),E("done"))},[E]);return{enabled:i,toggle:M,volume:R,setVolume:b,previewVolume:T,notify:B,phoneChime:c?{source:g,setSource:F}:null}}function gg(n,s,i){const[h,v]=I.useState(()=>vt(n,s,rb));I.useLayoutEffect(()=>{document.documentElement.dataset[i]=h},[i,h]);const R=I.useCallback(()=>{v(x=>{const r=Bm(x);return pt(n,r),r})},[n]);return{size:h,cycle:R}}function qx(){return gg(eb,Om,"threadFont")}function Kx(){return gg(tb,nb,"notesFont")}function Gx(n,s){const[i,h]=I.useState(()=>new Map),[v,R]=I.useState(()=>new Map),x=I.useCallback((c,g,_,u)=>{h(y=>new Map(y).set(c,{requestId:g,terminalId:c,afterEventId:_,phase:"sending",queued:u,sentAt:Date.now(),deliveredAt:null}))},[]);I.useEffect(()=>{const c=n.onMessage(_=>{_.type==="agent.submitted"&&h(u=>c1(u,_,Date.now()))}),g=n.onReopen(()=>h(_=>l1(_,Date.now())));return()=>{c(),g()}},[n]);const r=I.useRef(new Map);return I.useLayoutEffect(()=>{const c=r.current;if(c===s)return;r.current=s;const g=Date.now();R(_=>a1(c,s,_,g))},[s]),{track:x,receipts:i,clocks:v}}const Yx=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function _g({sound:n}){return a.jsxs("span",{className:"sound-control",children:[a.jsx("button",{className:`icon-button${Nx(n.enabled,n.volume)?" icon-button-on":""}`,onClick:n.toggle,title:Ax(n.enabled),"aria-pressed":n.enabled,children:"♪"}),n.enabled&&a.jsx("div",{className:"sound-volume",children:a.jsxs("div",{className:"sound-volume-box",children:[a.jsx("input",{className:"sound-volume-slider",type:"range",min:pg,max:Ha,step:.01,value:n.volume,onChange:s=>n.setVolume(Number(s.target.value)),onPointerUp:n.previewVolume,onKeyUp:s=>{Yx.has(s.key)&&n.previewVolume()},title:C("sound.volume"),"aria-label":C("sound.volume")}),a.jsxs("span",{className:"sound-volume-value",children:[jx(n.volume),"%"]})]})})]})}function vg({notify:n}){return n.supported?a.jsx("button",{className:`icon-button${n.enabled?" icon-button-on":""}`,onClick:n.toggle,title:Fx(n.enabled,n.permission),"aria-pressed":n.enabled,children:a.jsx(Xx,{})}):null}function Xx(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:a.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 Qx(n){const[s,i]=I.useState(null),[h,v]=I.useState(null),[R,x]=I.useState(null),[r,c]=I.useState(!1),[g,_]=I.useState(null);I.useEffect(()=>{const k=n.onMessage(E=>{switch(E.type){case"remote.status":i(E.status),E.status.pairingActive||(v(null),x(null));break;case"remote.pairing.code":v(E.pairing),x(null);break;case"remote.phone.pairing":x(E.pairing),v(null);break;case"error":if(E.code!=="remote-failed")break;_(Nt(E.text)),E.detail!==void 0&&console.error("[servidor]",E.detail);break}}),D=n.onReopen(()=>{v(null),x(null),c(!1)});return()=>{k(),D()}},[n]);const u=I.useCallback(k=>{_(null),n.send({type:"remote.configure",enabled:k})},[n]),y=I.useCallback(k=>{_(null),n.send({type:"remote.configure",port:k})},[n]),S=I.useCallback(()=>{_(null),n.send({type:"remote.pairing.start"})},[n]),L=I.useCallback(()=>{v(null),n.send({type:"remote.pairing.cancel"})},[n]),f=I.useCallback(()=>{_(null),c(!0),n.send({type:"remote.phone.start"})},[n]),l=I.useCallback(()=>{x(null),c(!1),n.send({type:"remote.phone.cancel"})},[n]),m=I.useCallback((k,D)=>{_(null),n.send({type:"remote.device.rename",deviceId:k,label:D})},[n]),p=I.useCallback(k=>{_(null),n.send({type:"remote.device.revoke",deviceId:k})},[n]),d=I.useCallback(()=>_(null),[]);return{status:s,pairing:h,phonePairing:R,phoneStarted:r,problem:g,setEnabled:u,setPort:y,startPairing:S,cancelPairing:L,startPhonePairing:f,cancelPhonePairing:l,renameDevice:m,revokeDevice:p,dismissProblem:d}}const Jx="USER";function Zx(n,s){const i=n.sshUser.length>0?n.sshUser:Jx,h=/\s/.test(i)?`"${i}@${s}"`:`${i}@${s}`;return`ssh -N -L ${n.port}:127.0.0.1:${n.port} ${h}`}function yg(n){return`http://localhost:${n}`}function ek(n,s){return`${yg(n)}/?${C0}=${s}`}function pp(n){return n[0]??"localhost"}function fu(n,s){switch(n){case"off":return C("remote.state.off");case"active":return C("remote.state.active",{port:s});case"restart-needed":return C("remote.state.restartNeeded");case"port-busy":return C("remote.state.portBusy",{port:s})}}function tk(n){const s=n.trim();if(!/^\d{1,5}$/.test(s))return null;const i=Number(s);return k0(i)?i:null}function nk(){return C("remote.portInvalid",{min:Qp,max:Jp})}function mp(n,s){return Math.max(0,Math.ceil((n-s)/1e3))}function gp(n){return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function sk(n,s=Date.now()){return n.connected?C("remote.device.connected"):n.lastSeenAt===null?C("remote.device.never"):C("remote.device.lastSeen",{when:Vn(n.lastSeenAt,s)})}function rk(n,s=Date.now()){return C("remote.device.paired",{when:Vn(n.createdAt,s)})}function ik(n){switch(n){case"powershell-admin":return C("remote.phone.authorize.admin");case"powershell":return C("remote.phone.authorize.powershell");case"terminal":return C("remote.phone.authorize.terminal")}}function ok(){return[{platform:"win32",label:"Windows",hint:C("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
135
- `)},{platform:"darwin",label:"macOS",hint:C("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:C("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
136
- `)}]}function ak(n){return n==="win32"||n==="darwin"?n:"linux"}function Sa(n){return n!==null&&n.state==="active"}function _p(n){return n!==null&&n.state==="active"&&n.devices.length>0}const Qr=function(n,s){let v=n;const R=Wi[s];let x=null,r=0,c=null;const g=[],_={},u=function(M,b){r=v*4+17,x=(function(T){const N=new Array(T);for(let B=0;B<T;B+=1){N[B]=new Array(T);for(let F=0;F<T;F+=1)N[B][F]=null}return N})(r),y(0,0),y(r-7,0),y(0,r-7),f(),L(),m(M,b),v>=7&&l(M),c==null&&(c=k(v,R,g)),p(c,b)},y=function(M,b){for(let T=-1;T<=7;T+=1)if(!(M+T<=-1||r<=M+T))for(let N=-1;N<=7;N+=1)b+N<=-1||r<=b+N||(0<=T&&T<=6&&(N==0||N==6)||0<=N&&N<=6&&(T==0||T==6)||2<=T&&T<=4&&2<=N&&N<=4?x[M+T][b+N]=!0:x[M+T][b+N]=!1)},S=function(){let M=0,b=0;for(let T=0;T<8;T+=1){u(!0,T);const N=Ns.getLostPoint(_);(T==0||M>N)&&(M=N,b=T)}return b},L=function(){for(let M=8;M<r-8;M+=1)x[M][6]==null&&(x[M][6]=M%2==0);for(let M=8;M<r-8;M+=1)x[6][M]==null&&(x[6][M]=M%2==0)},f=function(){const M=Ns.getPatternPosition(v);for(let b=0;b<M.length;b+=1)for(let T=0;T<M.length;T+=1){const N=M[b],B=M[T];if(x[N][B]==null)for(let F=-2;F<=2;F+=1)for(let O=-2;O<=2;O+=1)F==-2||F==2||O==-2||O==2||F==0&&O==0?x[N+F][B+O]=!0:x[N+F][B+O]=!1}},l=function(M){const b=Ns.getBCHTypeNumber(v);for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;x[Math.floor(T/3)][T%3+r-8-3]=N}for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;x[T%3+r-8-3][Math.floor(T/3)]=N}},m=function(M,b){const T=R<<3|b,N=Ns.getBCHTypeInfo(T);for(let B=0;B<15;B+=1){const F=!M&&(N>>B&1)==1;B<6?x[B][8]=F:B<8?x[B+1][8]=F:x[r-15+B][8]=F}for(let B=0;B<15;B+=1){const F=!M&&(N>>B&1)==1;B<8?x[8][r-B-1]=F:B<9?x[8][15-B-1+1]=F:x[8][15-B-1]=F}x[r-8][8]=!M},p=function(M,b){let T=-1,N=r-1,B=7,F=0;const O=Ns.getMaskFunction(b);for(let U=r-1;U>0;U-=2)for(U==6&&(U-=1);;){for(let V=0;V<2;V+=1)if(x[N][U-V]==null){let Y=!1;F<M.length&&(Y=(M[F]>>>B&1)==1),O(N,U-V)&&(Y=!Y),x[N][U-V]=Y,B-=1,B==-1&&(F+=1,B=7)}if(N+=T,N<0||r<=N){N-=T,T=-T;break}}},d=function(M,b){let T=0,N=0,B=0;const F=new Array(b.length),O=new Array(b.length);for(let X=0;X<b.length;X+=1){const G=b[X].dataCount,P=b[X].totalCount-G;N=Math.max(N,G),B=Math.max(B,P),F[X]=new Array(G);for(let te=0;te<F[X].length;te+=1)F[X][te]=255&M.getBuffer()[te+T];T+=G;const $=Ns.getErrorCorrectPolynomial(P),q=Yi(F[X],$.getLength()-1).mod($);O[X]=new Array($.getLength()-1);for(let te=0;te<O[X].length;te+=1){const se=te+q.getLength()-O[X].length;O[X][te]=se>=0?q.getAt(se):0}}let U=0;for(let X=0;X<b.length;X+=1)U+=b[X].totalCount;const V=new Array(U);let Y=0;for(let X=0;X<N;X+=1)for(let G=0;G<b.length;G+=1)X<F[G].length&&(V[Y]=F[G][X],Y+=1);for(let X=0;X<B;X+=1)for(let G=0;G<b.length;G+=1)X<O[G].length&&(V[Y]=O[G][X],Y+=1);return V},k=function(M,b,T){const N=vp.getRSBlocks(M,b),B=yp();for(let O=0;O<T.length;O+=1){const U=T[O];B.put(U.getMode(),4),B.put(U.getLength(),Ns.getLengthInBits(U.getMode(),M)),U.write(B)}let F=0;for(let O=0;O<N.length;O+=1)F+=N[O].dataCount;if(B.getLengthInBits()>F*8)throw"code length overflow. ("+B.getLengthInBits()+">"+F*8+")";for(B.getLengthInBits()+4<=F*8&&B.put(0,4);B.getLengthInBits()%8!=0;)B.putBit(!1);for(;!(B.getLengthInBits()>=F*8||(B.put(236,8),B.getLengthInBits()>=F*8));)B.put(17,8);return d(B,N)};_.addData=function(M,b){b=b||"Byte";let T=null;switch(b){case"Numeric":T=lk(M);break;case"Alphanumeric":T=ck(M);break;case"Byte":T=uk(M);break;case"Kanji":T=hk(M);break;default:throw"mode:"+b}g.push(T),c=null},_.isDark=function(M,b){if(M<0||r<=M||b<0||r<=b)throw M+","+b;return x[M][b]},_.getModuleCount=function(){return r},_.make=function(){if(v<1){let M=1;for(;M<40;M++){const b=vp.getRSBlocks(M,R),T=yp();for(let B=0;B<g.length;B++){const F=g[B];T.put(F.getMode(),4),T.put(F.getLength(),Ns.getLengthInBits(F.getMode(),M)),F.write(T)}let N=0;for(let B=0;B<b.length;B++)N+=b[B].dataCount;if(T.getLengthInBits()<=N*8)break}v=M}u(!1,S())},_.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 N=0;N<_.getModuleCount();N+=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(N,B)?"#000000":"#ffffff",T+=";",T+='"/>';T+="</tr>"}return T+="</tbody>",T+="</table>",T},_.createSvgTag=function(M,b,T,N){let B={};typeof arguments[0]=="object"&&(B=arguments[0],M=B.cellSize,b=B.margin,T=B.alt,N=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,N=typeof N=="string"?{text:N}:N||{},N.text=N.text||null,N.id=N.text?N.id||"qrcode-title":null;const F=_.getModuleCount()*M+b*2;let O,U,V,Y,X="",G;for(G="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",X+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',X+=B.scalable?"":' width="'+F+'px" height="'+F+'px"',X+=' viewBox="0 0 '+F+" "+F+'" ',X+=' preserveAspectRatio="xMinYMin meet"',X+=N.text||T.text?' role="img" aria-labelledby="'+D([N.id,T.id].join(" ").trim())+'"':"",X+=">",X+=N.text?'<title id="'+D(N.id)+'">'+D(N.text)+"</title>":"",X+=T.text?'<description id="'+D(T.id)+'">'+D(T.text)+"</description>":"",X+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',X+='<path d="',V=0;V<_.getModuleCount();V+=1)for(Y=V*M+b,O=0;O<_.getModuleCount();O+=1)_.isDark(V,O)&&(U=O*M+b,X+="M"+U+","+Y+G);return X+='" stroke="transparent" fill="black"/>',X+="</svg>",X},_.createDataURL=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;const T=_.getModuleCount()*M+b*2,N=b,B=T-b;return mk(T,T,function(F,O){if(N<=F&&F<B&&N<=O&&O<B){const U=Math.floor((F-N)/M),V=Math.floor((O-N)/M);return _.isDark(V,U)?0:1}else return 1})},_.createImgTag=function(M,b,T){M=M||2,b=typeof b>"u"?M*4:b;const N=_.getModuleCount()*M+b*2;let B="";return B+="<img",B+=' src="',B+=_.createDataURL(M,b),B+='"',B+=' width="',B+=N,B+='"',B+=' height="',B+=N,B+='"',T&&(B+=' alt="',B+=D(T),B+='"'),B+="/>",B};const D=function(M){let b="";for(let T=0;T<M.length;T+=1){const N=M.charAt(T);switch(N){case"<":b+="&lt;";break;case">":b+="&gt;";break;case"&":b+="&amp;";break;case'"':b+="&quot;";break;default:b+=N;break}}return b},E=function(M){M=typeof M>"u"?2:M;const T=_.getModuleCount()*1+M*2,N=M,B=T-M;let F,O,U,V,Y;const X={"██":"█","█ ":"▀"," █":"▄"," ":" "},G={"██":"▀","█ ":"▀"," █":" "," ":" "};let P="";for(F=0;F<T;F+=2){for(U=Math.floor((F-N)/1),V=Math.floor((F+1-N)/1),O=0;O<T;O+=1)Y="█",N<=O&&O<B&&N<=F&&F<B&&_.isDark(U,Math.floor((O-N)/1))&&(Y=" "),N<=O&&O<B&&N<=F+1&&F+1<B&&_.isDark(V,Math.floor((O-N)/1))?Y+=" ":Y+="█",P+=M<1&&F+1>=B?G[Y]:X[Y];P+=`
137
- `}return T%2&&M>0?P.substring(0,P.length-T-1)+Array(T+1).join("▀"):P.substring(0,P.length-1)};return _.createASCII=function(M,b){if(M=M||1,M<2)return E(b);M-=1,b=typeof b>"u"?M*2:b;const T=_.getModuleCount()*M+b*2,N=b,B=T-b;let F,O,U,V;const Y=Array(M+1).join("██"),X=Array(M+1).join(" ");let G="",P="";for(F=0;F<T;F+=1){for(U=Math.floor((F-N)/M),P="",O=0;O<T;O+=1)V=1,N<=O&&O<B&&N<=F&&F<B&&_.isDark(U,Math.floor((O-N)/M))&&(V=0),P+=V?Y:X;for(U=0;U<M;U+=1)G+=P+`
138
- `}return G.substring(0,G.length-1)},_.renderTo2dContext=function(M,b){b=b||2;const T=_.getModuleCount();for(let N=0;N<T;N++)for(let B=0;B<T;B++)M.fillStyle=_.isDark(N,B)?"black":"white",M.fillRect(B*b,N*b,b,b)},_};Qr.stringToBytes=function(n){const s=[];for(let i=0;i<n.length;i+=1){const h=n.charCodeAt(i);s.push(h&255)}return s};Qr.createStringToBytes=function(n,s){const i=(function(){const v=fk(n),R=function(){const c=v.read();if(c==-1)throw"eof";return c};let x=0;const r={};for(;;){const c=v.read();if(c==-1)break;const g=R(),_=R(),u=R(),y=String.fromCharCode(c<<8|g),S=_<<8|u;r[y]=S,x+=1}if(x!=s)throw x+" != "+s;return r})(),h=63;return function(v){const R=[];for(let x=0;x<v.length;x+=1){const r=v.charCodeAt(x);if(r<128)R.push(r);else{const c=i[v.charAt(x)];typeof c=="number"?(c&255)==c?R.push(c):(R.push(c>>>8),R.push(c&255)):R.push(h)}}return R}};const Xt={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Wi={L:1,M:0,Q:3,H:2},As={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Ns=(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]],s=1335,i=7973,h=21522,v={},R=function(x){let r=0;for(;x!=0;)r+=1,x>>>=1;return r};return v.getBCHTypeInfo=function(x){let r=x<<10;for(;R(r)-R(s)>=0;)r^=s<<R(r)-R(s);return(x<<10|r)^h},v.getBCHTypeNumber=function(x){let r=x<<12;for(;R(r)-R(i)>=0;)r^=i<<R(r)-R(i);return x<<12|r},v.getPatternPosition=function(x){return n[x-1]},v.getMaskFunction=function(x){switch(x){case As.PATTERN000:return function(r,c){return(r+c)%2==0};case As.PATTERN001:return function(r,c){return r%2==0};case As.PATTERN010:return function(r,c){return c%3==0};case As.PATTERN011:return function(r,c){return(r+c)%3==0};case As.PATTERN100:return function(r,c){return(Math.floor(r/2)+Math.floor(c/3))%2==0};case As.PATTERN101:return function(r,c){return r*c%2+r*c%3==0};case As.PATTERN110:return function(r,c){return(r*c%2+r*c%3)%2==0};case As.PATTERN111:return function(r,c){return(r*c%3+(r+c)%2)%2==0};default:throw"bad maskPattern:"+x}},v.getErrorCorrectPolynomial=function(x){let r=Yi([1],0);for(let c=0;c<x;c+=1)r=r.multiply(Yi([1,Ds.gexp(c)],0));return r},v.getLengthInBits=function(x,r){if(1<=r&&r<10)switch(x){case Xt.MODE_NUMBER:return 10;case Xt.MODE_ALPHA_NUM:return 9;case Xt.MODE_8BIT_BYTE:return 8;case Xt.MODE_KANJI:return 8;default:throw"mode:"+x}else if(r<27)switch(x){case Xt.MODE_NUMBER:return 12;case Xt.MODE_ALPHA_NUM:return 11;case Xt.MODE_8BIT_BYTE:return 16;case Xt.MODE_KANJI:return 10;default:throw"mode:"+x}else if(r<41)switch(x){case Xt.MODE_NUMBER:return 14;case Xt.MODE_ALPHA_NUM:return 13;case Xt.MODE_8BIT_BYTE:return 16;case Xt.MODE_KANJI:return 12;default:throw"mode:"+x}else throw"type:"+r},v.getLostPoint=function(x){const r=x.getModuleCount();let c=0;for(let u=0;u<r;u+=1)for(let y=0;y<r;y+=1){let S=0;const L=x.isDark(u,y);for(let f=-1;f<=1;f+=1)if(!(u+f<0||r<=u+f))for(let l=-1;l<=1;l+=1)y+l<0||r<=y+l||f==0&&l==0||L==x.isDark(u+f,y+l)&&(S+=1);S>5&&(c+=3+S-5)}for(let u=0;u<r-1;u+=1)for(let y=0;y<r-1;y+=1){let S=0;x.isDark(u,y)&&(S+=1),x.isDark(u+1,y)&&(S+=1),x.isDark(u,y+1)&&(S+=1),x.isDark(u+1,y+1)&&(S+=1),(S==0||S==4)&&(c+=3)}for(let u=0;u<r;u+=1)for(let y=0;y<r-6;y+=1)x.isDark(u,y)&&!x.isDark(u,y+1)&&x.isDark(u,y+2)&&x.isDark(u,y+3)&&x.isDark(u,y+4)&&!x.isDark(u,y+5)&&x.isDark(u,y+6)&&(c+=40);for(let u=0;u<r;u+=1)for(let y=0;y<r-6;y+=1)x.isDark(y,u)&&!x.isDark(y+1,u)&&x.isDark(y+2,u)&&x.isDark(y+3,u)&&x.isDark(y+4,u)&&!x.isDark(y+5,u)&&x.isDark(y+6,u)&&(c+=40);let g=0;for(let u=0;u<r;u+=1)for(let y=0;y<r;y+=1)x.isDark(y,u)&&(g+=1);const _=Math.abs(100*g/r/r-50)/5;return c+=_*10,c},v})(),Ds=(function(){const n=new Array(256),s=new Array(256);for(let h=0;h<8;h+=1)n[h]=1<<h;for(let h=8;h<256;h+=1)n[h]=n[h-4]^n[h-5]^n[h-6]^n[h-8];for(let h=0;h<255;h+=1)s[n[h]]=h;const i={};return i.glog=function(h){if(h<1)throw"glog("+h+")";return s[h]},i.gexp=function(h){for(;h<0;)h+=255;for(;h>=256;)h-=255;return n[h]},i})(),Yi=function(n,s){if(typeof n.length>"u")throw n.length+"/"+s;const i=(function(){let v=0;for(;v<n.length&&n[v]==0;)v+=1;const R=new Array(n.length-v+s);for(let x=0;x<n.length-v;x+=1)R[x]=n[x+v];return R})(),h={};return h.getAt=function(v){return i[v]},h.getLength=function(){return i.length},h.multiply=function(v){const R=new Array(h.getLength()+v.getLength()-1);for(let x=0;x<h.getLength();x+=1)for(let r=0;r<v.getLength();r+=1)R[x+r]^=Ds.gexp(Ds.glog(h.getAt(x))+Ds.glog(v.getAt(r)));return Yi(R,0)},h.mod=function(v){if(h.getLength()-v.getLength()<0)return h;const R=Ds.glog(h.getAt(0))-Ds.glog(v.getAt(0)),x=new Array(h.getLength());for(let r=0;r<h.getLength();r+=1)x[r]=h.getAt(r);for(let r=0;r<v.getLength();r+=1)x[r]^=Ds.gexp(Ds.glog(v.getAt(r))+R);return Yi(x,0).mod(v)},h},vp=(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]],s=function(v,R){const x={};return x.totalCount=v,x.dataCount=R,x},i={},h=function(v,R){switch(R){case Wi.L:return n[(v-1)*4+0];case Wi.M:return n[(v-1)*4+1];case Wi.Q:return n[(v-1)*4+2];case Wi.H:return n[(v-1)*4+3];default:return}};return i.getRSBlocks=function(v,R){const x=h(v,R);if(typeof x>"u")throw"bad rs block @ typeNumber:"+v+"/errorCorrectionLevel:"+R;const r=x.length/3,c=[];for(let g=0;g<r;g+=1){const _=x[g*3+0],u=x[g*3+1],y=x[g*3+2];for(let S=0;S<_;S+=1)c.push(s(u,y))}return c},i})(),yp=function(){const n=[];let s=0;const i={};return i.getBuffer=function(){return n},i.getAt=function(h){const v=Math.floor(h/8);return(n[v]>>>7-h%8&1)==1},i.put=function(h,v){for(let R=0;R<v;R+=1)i.putBit((h>>>v-R-1&1)==1)},i.getLengthInBits=function(){return s},i.putBit=function(h){const v=Math.floor(s/8);n.length<=v&&n.push(0),h&&(n[v]|=128>>>s%8),s+=1},i},lk=function(n){const s=Xt.MODE_NUMBER,i=n,h={};h.getMode=function(){return s},h.getLength=function(x){return i.length},h.write=function(x){const r=i;let c=0;for(;c+2<r.length;)x.put(v(r.substring(c,c+3)),10),c+=3;c<r.length&&(r.length-c==1?x.put(v(r.substring(c,c+1)),4):r.length-c==2&&x.put(v(r.substring(c,c+2)),7))};const v=function(x){let r=0;for(let c=0;c<x.length;c+=1)r=r*10+R(x.charAt(c));return r},R=function(x){if("0"<=x&&x<="9")return x.charCodeAt(0)-48;throw"illegal char :"+x};return h},ck=function(n){const s=Xt.MODE_ALPHA_NUM,i=n,h={};h.getMode=function(){return s},h.getLength=function(R){return i.length},h.write=function(R){const x=i;let r=0;for(;r+1<x.length;)R.put(v(x.charAt(r))*45+v(x.charAt(r+1)),11),r+=2;r<x.length&&R.put(v(x.charAt(r)),6)};const v=function(R){if("0"<=R&&R<="9")return R.charCodeAt(0)-48;if("A"<=R&&R<="Z")return R.charCodeAt(0)-65+10;switch(R){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 :"+R}};return h},uk=function(n){const s=Xt.MODE_8BIT_BYTE,i=Qr.stringToBytes(n),h={};return h.getMode=function(){return s},h.getLength=function(v){return i.length},h.write=function(v){for(let R=0;R<i.length;R+=1)v.put(i[R],8)},h},hk=function(n){const s=Xt.MODE_KANJI,i=Qr.stringToBytes;(function(R,x){const r=i(R);if(r.length!=2||(r[0]<<8|r[1])!=x)throw"sjis not supported."})("友",38726);const h=i(n),v={};return v.getMode=function(){return s},v.getLength=function(R){return~~(h.length/2)},v.write=function(R){const x=h;let r=0;for(;r+1<x.length;){let c=(255&x[r])<<8|255&x[r+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(r+1)+"/"+c;c=(c>>>8&255)*192+(c&255),R.put(c,13),r+=2}if(r<x.length)throw"illegal char at "+(r+1)},v},wg=function(){const n=[],s={};return s.writeByte=function(i){n.push(i&255)},s.writeShort=function(i){s.writeByte(i),s.writeByte(i>>>8)},s.writeBytes=function(i,h,v){h=h||0,v=v||i.length;for(let R=0;R<v;R+=1)s.writeByte(i[R+h])},s.writeString=function(i){for(let h=0;h<i.length;h+=1)s.writeByte(i.charCodeAt(h))},s.toByteArray=function(){return n},s.toString=function(){let i="";i+="[";for(let h=0;h<n.length;h+=1)h>0&&(i+=","),i+=n[h];return i+="]",i},s},dk=function(){let n=0,s=0,i=0,h="";const v={},R=function(r){h+=String.fromCharCode(x(r&63))},x=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 v.writeByte=function(r){for(n=n<<8|r&255,s+=8,i+=1;s>=6;)R(n>>>s-6),s-=6},v.flush=function(){if(s>0&&(R(n<<6-s),n=0,s=0),i%3!=0){const r=3-i%3;for(let c=0;c<r;c+=1)h+="="}},v.toString=function(){return h},v},fk=function(n){const s=n;let i=0,h=0,v=0;const R={};R.read=function(){for(;v<8;){if(i>=s.length){if(v==0)return-1;throw"unexpected end of file./"+v}const c=s.charAt(i);if(i+=1,c=="=")return v=0,-1;if(c.match(/^\s$/))continue;h=h<<6|x(c.charCodeAt(0)),v+=6}const r=h>>>v-8&255;return v-=8,r};const x=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 R},pk=function(n,s){const i=n,h=s,v=new Array(n*s),R={};R.setPixel=function(g,_,u){v[_*i+g]=u},R.write=function(g){g.writeString("GIF87a"),g.writeShort(i),g.writeShort(h),g.writeByte(128),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(255),g.writeByte(255),g.writeByte(255),g.writeString(","),g.writeShort(0),g.writeShort(0),g.writeShort(i),g.writeShort(h),g.writeByte(0);const _=2,u=r(_);g.writeByte(_);let y=0;for(;u.length-y>255;)g.writeByte(255),g.writeBytes(u,y,255),y+=255;g.writeByte(u.length-y),g.writeBytes(u,y,u.length-y),g.writeByte(0),g.writeString(";")};const x=function(g){const _=g;let u=0,y=0;const S={};return S.write=function(L,f){if(L>>>f)throw"length over";for(;u+f>=8;)_.writeByte(255&(L<<u|y)),f-=8-u,L>>>=8-u,y=0,u=0;y=L<<u|y,u=u+f},S.flush=function(){u>0&&_.writeByte(y)},S},r=function(g){const _=1<<g,u=(1<<g)+1;let y=g+1;const S=c();for(let p=0;p<_;p+=1)S.add(String.fromCharCode(p));S.add(String.fromCharCode(_)),S.add(String.fromCharCode(u));const L=wg(),f=x(L);f.write(_,y);let l=0,m=String.fromCharCode(v[l]);for(l+=1;l<v.length;){const p=String.fromCharCode(v[l]);l+=1,S.contains(m+p)?m=m+p:(f.write(S.indexOf(m),y),S.size()<4095&&(S.size()==1<<y&&(y+=1),S.add(m+p)),m=p)}return f.write(S.indexOf(m),y),f.write(u,y),f.flush(),L.toByteArray()},c=function(){const g={};let _=0;const u={};return u.add=function(y){if(u.contains(y))throw"dup key:"+y;g[y]=_,_+=1},u.size=function(){return _},u.indexOf=function(y){return g[y]},u.contains=function(y){return typeof g[y]<"u"},u};return R},mk=function(n,s,i){const h=pk(n,s);for(let r=0;r<s;r+=1)for(let c=0;c<n;c+=1)h.setPixel(c,r,i(c,r));const v=wg();h.write(v);const R=dk(),x=v.toByteArray();for(let r=0;r<x.length;r+=1)R.writeByte(x[r]);return R.flush(),"data:image/gif;base64,"+R};Qr.stringToBytes;const $i=4;function gk(n){const s=Qr(0,"M");s.addData(n,"Byte"),s.make();const i=s.getModuleCount();let h="";for(let v=0;v<i;v++){let R=0;for(;R<i;){if(!s.isDark(v,R)){R++;continue}const x=R;for(;R<i&&s.isDark(v,R);)R++;h+=`M${x} ${v}h${R-x}v1h-${R-x}z`}}return{size:i,path:h}}const _k=1e3,vk=4e3;function yk({status:n,pairing:s,phonePairing:i,phoneStarted:h,problem:v,platform:R,onSetEnabled:x,onSetPort:r,onStartPairing:c,onCancelPairing:g,onStartPhonePairing:_,onCancelPhonePairing:u,onRenameDevice:y,onRevokeDevice:S,onDismissProblem:L,onClose:f}){const[l,m]=I.useState(()=>pp(n.hostNames)),[p,d]=I.useState(String(n.port)),[k,D]=I.useState(null),E=I.useRef(null),[M,b]=I.useState(()=>Date.now()),T=()=>{s!==null&&g(),h&&u(),f()},N=I.useRef(T);N.current=T,I.useEffect(()=>{const P=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),N.current())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[]),I.useEffect(()=>{if(s===null&&i===null)return;b(Date.now());const P=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(P)},[s,i]),I.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]);const B=I.useRef(null),F=i!==null;I.useEffect(()=>{var $;if(!F)return;const P=window.matchMedia("(prefers-reduced-motion: reduce)").matches;($=B.current)==null||$.scrollIntoView({block:"center",behavior:P?"auto":"smooth"})},[F]),I.useEffect(()=>{d(String(n.port))},[n.port]),I.useEffect(()=>{n.hostNames.includes(l)||m(pp(n.hostNames))},[n.hostNames,l]);const O=(P,$)=>{navigator.clipboard.writeText($).then(()=>{D(P),E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>D(null),_k)}).catch(()=>D(null))},U=tk(p),V=U!==null&&U!==n.port,Y=Zx(n,l),X=C("remote.title"),G=s===null?null:ek(n.port,s.code);return a.jsx("div",{className:"modal-backdrop",onClick:T,children:a.jsxs("div",{className:"modal",role:"dialog","aria-label":X,onClick:P=>P.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:X}),a.jsx("button",{className:"icon-button",onClick:T,title:C("common.close"),children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsx("p",{className:`status-line-state${n.state==="active"?" status-line-state-active":""}`,children:fu(n.state,n.port)}),a.jsx("p",{className:"modal-hint",children:C("remote.intro")}),a.jsx("div",{className:"vault-actions",children:n.enabled?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"link-button",onClick:()=>x(!1),children:C("remote.turnOff")}),a.jsx("span",{className:"modal-hint",children:C("remote.turnOffHint")})]}):a.jsx("button",{className:"primary-button",onClick:()=>x(!0),children:C("remote.turnOn")})}),a.jsxs("div",{className:"remote-port",children:[a.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:C("remote.port")}),a.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:p,onChange:P=>d(P.target.value),onKeyDown:P=>{P.key==="Enter"&&V&&U!==null&&r(U)}}),a.jsx("button",{className:"link-button",onClick:()=>U!==null&&r(U),disabled:!V,children:C("remote.portSave")}),U===null&&a.jsx("span",{className:"modal-hint remote-port-invalid",children:nk()})]}),a.jsx("p",{className:"modal-hint",children:C("remote.restartHint")}),v!==null&&a.jsxs("div",{className:"vault-problem",role:"alert",children:[a.jsx("span",{children:v}),a.jsx("button",{className:"icon-button",onClick:L,title:C("common.close"),children:"×"})]}),a.jsx("h3",{className:"modal-section",children:C("remote.step.host")}),a.jsx("p",{className:"modal-hint",children:C("remote.step.hostHint")}),ok().map(P=>a.jsxs("details",{className:"remote-os",open:P.platform===ak(R),children:[a.jsx("summary",{className:"remote-os-summary",children:P.label}),a.jsx("p",{className:"modal-hint",children:P.hint}),P.command!==null&&a.jsxs("div",{className:"status-line-fragment",children:[a.jsx("pre",{className:"tool-pre",children:P.command}),a.jsx("button",{className:"link-button",onClick:()=>O("ssh",P.command??""),children:k==="ssh"?a.jsxs(a.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]})]},P.platform)),a.jsx("h3",{className:"modal-section",children:C("remote.step.tunnel")}),a.jsx("p",{className:"modal-hint",children:C("remote.step.tunnelHint")}),n.hostNames.length>1&&a.jsxs("div",{className:"remote-port",children:[a.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:C("remote.address")}),a.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:l,onChange:P=>m(P.target.value),children:n.hostNames.map(P=>a.jsx("option",{value:P,children:P},P))})]}),a.jsxs("div",{className:"status-line-fragment",children:[a.jsx("pre",{className:"tool-pre",children:Y}),a.jsx("button",{className:"link-button",onClick:()=>O("command",Y),children:k==="command"?a.jsxs(a.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),a.jsxs("details",{className:"remote-os",children:[a.jsx("summary",{className:"remote-os-summary",children:C("remote.trouble")}),a.jsxs("ul",{className:"remote-trouble",children:[a.jsx("li",{className:"modal-hint",children:C("remote.trouble.network")}),a.jsx("li",{className:"modal-hint",children:C("remote.vpnHint")}),n.sshUser.length>0&&a.jsx("li",{className:"modal-hint",children:C("remote.userHint",{user:n.sshUser})})]})]}),a.jsx("h3",{className:"modal-section",children:C("remote.step.pair")}),s===null||G===null?a.jsxs("div",{className:"vault-actions",children:[a.jsx("button",{className:"primary-button",onClick:c,disabled:!Sa(n),children:C("remote.pair.start")}),!Sa(n)&&a.jsx("span",{className:"modal-hint",children:C("remote.pair.needsActive")})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal-hint",children:C("remote.pair.open")}),a.jsxs("div",{className:"status-line-fragment",children:[a.jsx("pre",{className:"tool-pre",children:G}),a.jsx("button",{className:"link-button",onClick:()=>O("pairing",G),children:k==="pairing"?a.jsxs(a.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),a.jsxs("p",{className:"modal-hint",children:[C("remote.pair.expires",{time:gp(mp(s.expiresAt,M))})," ",C("remote.pair.after",{url:yg(n.port)})]}),a.jsx("div",{className:"vault-actions",children:a.jsx("button",{className:"link-button",onClick:g,children:C("remote.pair.cancel")})})]}),a.jsx("h3",{className:"modal-section",children:C("remote.phone.title")}),i===null?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal-hint",children:C("remote.phone.hint")}),a.jsxs("div",{className:"vault-actions",children:[a.jsx("button",{className:"primary-button",onClick:_,disabled:!Sa(n),children:C("remote.phone.start")}),!Sa(n)&&a.jsx("span",{className:"modal-hint",children:C("remote.pair.needsActive")})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal-hint",children:ik(i.shell)}),a.jsxs("div",{className:"status-line-fragment",children:[a.jsx("pre",{className:"tool-pre remote-phone-command",children:i.authorizeCommand}),a.jsx("button",{className:"link-button",onClick:()=>O("phone",i.authorizeCommand),children:k==="phone"?a.jsxs(a.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),a.jsx("p",{className:"modal-hint",children:C("remote.phone.authorizeOnce")}),a.jsx("p",{className:"modal-hint",children:C("remote.phone.scan")}),a.jsx("div",{ref:B,children:a.jsx(wk,{payload:i.payload})}),a.jsx("p",{className:"modal-hint",children:C("remote.phone.secret")}),a.jsx("p",{className:"modal-hint",children:C("remote.pair.expires",{time:gp(mp(i.expiresAt,M))})}),a.jsx("div",{className:"vault-actions",children:a.jsx("button",{className:"link-button",onClick:u,children:C("remote.pair.cancel")})})]}),a.jsx("h3",{className:"modal-section",children:C("remote.devices")}),n.devices.length===0?a.jsx("p",{className:"modal-hint",children:C("remote.devices.empty")}):a.jsx("ul",{className:"remote-devices",children:n.devices.map(P=>a.jsx(bk,{device:P,onRename:$=>y(P.id,$),onRevoke:()=>S(P.id)},P.id))})]})]})})}function wk({payload:n}){const s=gk(n),i=s.size+$i*2;return a.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-$i} ${-$i} ${i} ${i}`,role:"img","aria-label":C("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[a.jsx("rect",{x:-$i,y:-$i,width:i,height:i,fill:"#fff"}),a.jsx("path",{d:s.path,fill:"#000"})]})}function bk({device:n,onRename:s,onRevoke:i}){const[h,v]=I.useState(!1),[R,x]=I.useState(n.label),[r,c]=I.useState(!1),g=I.useRef(null);I.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);const _=()=>{v(!1);const y=R.trim();y.length>0&&y!==n.label&&s(y)},u=()=>{if(r){i();return}c(!0),g.current=window.setTimeout(()=>c(!1),vk)};return a.jsxs("li",{className:"remote-device",children:[a.jsxs("div",{className:"remote-device-main",children:[h?a.jsx("input",{className:"remote-device-input",value:R,autoFocus:!0,onChange:y=>x(y.target.value),onBlur:_,onKeyDown:y=>{y.key==="Enter"&&_()}}):a.jsx("button",{className:"remote-device-label",onClick:()=>{x(n.label),v(!0)},title:C("remote.device.rename"),children:n.label}),a.jsx("span",{className:`remote-device-seen${n.connected?" remote-device-connected":""}`,children:sk(n)}),a.jsx("span",{className:"remote-device-paired",children:rk(n)})]}),a.jsx("button",{className:`link-button${r?" remote-device-confirm":""}`,onClick:u,children:C(r?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Vc="agent-workbench.notes-open",wp="agent-workbench.notes-active",bp="agent-workbench.notes-height",qc=160,Sk=300;function Ck(n){return n.text.trim().length===0?n.images.length>0?C("notes.imageOnly"):C("notes.untitled"):h0(n)}function xk({notes:n,onSendNote:s,sendTargetCwd:i,fill:h,onHide:v}){const[R,x]=I.useState(()=>vt(Vc,!1,V=>V==="true")),r=R||h,[c,g]=I.useState(()=>vt(bp,Sk,V=>{const Y=Number.parseInt(V,10);return Number.isFinite(Y)?Math.max(Y,qc):null})),[_,u]=I.useState(()=>vt(wp,null,V=>V)),[y,S]=I.useState(null),[L,f]=I.useState(null),[l,m]=I.useState(0),p=Kx(),d=I.useMemo(()=>n.notes.length===0?null:n.notes.find(V=>V.noteId===_)??n.notes[n.notes.length-1]??null,[n.notes,_]),k=I.useCallback(V=>{u(V),pt(wp,V),S(null)},[]),D=I.useCallback(()=>{x(V=>{const Y=!V;return pt(Vc,String(Y)),Y})},[]),E=I.useCallback(()=>{const V=n.create();k(V),r||(x(!0),pt(Vc,"true")),m(Y=>Y+1)},[n,r,k]),M=I.useCallback(V=>{if(V.text.trim().length===0&&V.images.length===0){n.remove(V.noteId);return}k(V.noteId),S(V.noteId)},[n,k]),b=I.useCallback(()=>{y!==null&&n.remove(y),S(null)},[y,n]),T=I.useRef(null),N=I.useCallback(V=>{const Y=V.currentTarget.parentElement,X=Y===null?c:Math.round(Y.getBoundingClientRect().height);T.current={startY:V.clientY,startHeight:X},V.currentTarget.setPointerCapture(V.pointerId),V.preventDefault()},[c]),B=I.useCallback(V=>{const Y=T.current;if(Y===null)return;const X=Math.max(qc,Math.floor(window.innerHeight*.8));g(Math.min(X,Math.max(qc,Y.startHeight+Y.startY-V.clientY)))},[]),F=I.useCallback(V=>{T.current!==null&&(T.current=null,V.currentTarget.releasePointerCapture(V.pointerId),pt(bp,String(c)))},[c]);I.useEffect(()=>{if(L===null)return;const V=Y=>{Y.key==="Escape"&&(Y.stopPropagation(),f(null))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[L]);const O=L===null?void 0:n.images[L],U=n.notes.length;return a.jsxs("section",{className:`notes${r?" notes-open":""}${h?" notes-fill":""}`,style:r&&!h?{height:`${c}px`}:void 0,children:[r&&!h&&a.jsx("div",{className:"notes-resize",onPointerDown:N,onPointerMove:B,onPointerUp:F,onPointerCancel:F,title:C("notes.resize")}),r?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"notes-header",children:[a.jsxs("div",{className:"strip-tabs",role:"tablist",children:[n.notes.map(V=>{const Y=V.noteId===(d==null?void 0:d.noteId),X=Ck(V);return a.jsxs("div",{className:`strip-tab${Y?" is-active":""}`,role:"tab","aria-selected":Y,children:[a.jsx("button",{className:"strip-tab-label",onClick:()=>k(V.noteId),title:X,children:X}),a.jsx("button",{className:"strip-tab-close",onClick:()=>M(V),title:C("notes.closeNote"),children:"×"})]},V.noteId)}),a.jsx("button",{className:"strip-tab-new",onClick:E,title:C("notes.new"),children:"+"})]}),a.jsx("span",{className:"strip-spacer"}),a.jsx("button",{className:"icon-button thread-font-button",onClick:p.cycle,title:Na(p.size),"aria-label":Na(p.size),children:a.jsxs("span",{"aria-hidden":"true",children:["a",a.jsx("span",{className:"thread-font-big",children:"A"})]})}),!h&&a.jsx("button",{className:"icon-button",onClick:D,title:C("notes.collapse"),children:"▾"}),v!==void 0&&a.jsx(Aa,{title:C("settings.hide.notes"),onHide:v,confirmText:null})]}),a.jsx("div",{className:"notes-body",children:U===0||d===null?a.jsx("p",{className:"notes-empty",children:zt("notes.empty")}):a.jsx(Lk,{note:d,notes:n,closing:y===d.noteId,focusRequest:l,onConfirmClose:b,onCancelClose:()=>S(null),onOpenImage:f,onSend:s===null?null:()=>s(d.noteId),sendTargetCwd:i},d.noteId)})]}):a.jsxs("div",{className:"strip-collapsed-row",children:[a.jsxs("button",{className:"strip-collapsed",onClick:D,title:C("notes.expand"),children:[a.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),a.jsx("span",{children:C("notes.name")}),U>0&&a.jsx("span",{className:"strip-collapsed-count",children:U})]}),v!==void 0&&a.jsx(Aa,{title:C("settings.hide.notes"),onHide:v,confirmText:null})]}),L!==null&&a.jsx("div",{className:"notes-lightbox",onClick:()=>f(null),title:C("notes.lightboxClose"),children:typeof O=="string"?a.jsx("img",{src:O,alt:C("notes.imageAlt")}):a.jsx("span",{className:"notes-lightbox-missing",children:C("notes.imageUnavailable")})})]})}function kk(){return a.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:a.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 Ek(){return a.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:[a.jsx("path",{d:"M21.5 2.5 11 13"}),a.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function Lk({note:n,notes:s,closing:i,focusRequest:h,onConfirmClose:v,onCancelClose:R,onOpenImage:x,onSend:r,sendTargetCwd:c}){const g=I.useRef(null),[_,u]=I.useState(!1),y=n.text.trim().length===0&&n.images.length===0;I.useEffect(()=>{var f;h>0&&((f=g.current)==null||f.focus())},[h]);const S=I.useCallback(f=>{const l=Array.from(f).filter(m=>m.type.startsWith("image/"));for(const m of l)s.addImage(n.noteId,m);return l.length>0},[s,n.noteId]),L=I.useCallback(f=>{f.clipboardData!==null&&S(f.clipboardData.files)&&f.preventDefault()},[S]);return a.jsxs("div",{className:`note-editor${_?" note-editor-dragging":""}`,onDragOver:f=>{Array.from(f.dataTransfer.types).includes("Files")&&(f.preventDefault(),u(!0))},onDragLeave:()=>u(!1),onDrop:f=>{f.preventDefault(),u(!1),S(f.dataTransfer.files)},children:[i&&a.jsxs("div",{className:"note-closing",children:[a.jsx("span",{children:C("notes.closeConfirm")}),a.jsx("button",{className:"link-button link-danger",onClick:v,children:C("common.close")}),a.jsx("button",{className:"link-button",onClick:R,children:C("common.cancel")})]}),s.problem!==null&&a.jsxs("div",{className:"composer-problem",children:[a.jsx("span",{children:s.problem}),a.jsx("button",{className:"icon-button",onClick:s.dismissProblem,title:C("common.close"),children:"×"})]}),a.jsx("textarea",{ref:g,className:"note-input",value:n.text,placeholder:C("notes.placeholder"),onChange:f=>s.updateText(n.noteId,f.target.value),onPaste:L,spellCheck:!1}),n.images.length>0&&a.jsx("div",{className:"note-images",children:n.images.map(f=>a.jsx(Tk,{image:f,src:s.images[f.imageId],onRequest:s.requestImage,onOpen:()=>x(f.imageId),onRemove:()=>s.removeImage(n.noteId,f.imageId)},f.imageId))}),a.jsxs("div",{className:"note-footer",children:[a.jsx("span",{className:"note-meta",children:Vn(n.updatedAt)}),a.jsx("span",{className:"composer-spacer"}),a.jsx("button",{className:"icon-button",onClick:()=>r==null?void 0:r(),disabled:r===null||y,title:Oy(r!==null,c,y),children:a.jsx(Ek,{})}),a.jsxs("label",{className:"icon-button note-attach",title:C("notes.attach"),children:[a.jsx(kk,{}),a.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:f=>{f.target.files!==null&&S(f.target.files),f.target.value=""}})]})]})]})}function Tk({image:n,src:s,onRequest:i,onOpen:h,onRemove:v}){return I.useEffect(()=>{s===void 0&&i(n.imageId)},[s,n.imageId,i]),a.jsxs("figure",{className:"chip chip-image note-thumb",title:hn(n.bytes),children:[typeof s=="string"?a.jsx("img",{src:s,alt:C("notes.imageAlt"),onClick:h}):a.jsx("span",{className:"note-thumb-placeholder",children:s===null?C("notes.thumbMissing"):"…"}),a.jsx("button",{className:"chip-remove",onClick:v,title:C("notes.removeImage"),children:"×"})]})}function bg(){const n=Qi(),s=Sb(),[i,h]=I.useState(null),v=I.useCallback(()=>h(null),[]),R=I.useRef(null),x=g=>{yb(g).catch(()=>{})},r=[{label:C("header.locale.auto",{name:Lc[_b()]}),checked:s==="auto",onSelect:()=>x("auto")},...vu.map(g=>({label:Lc[g],lang:g,checked:s===g,onSelect:()=>x(g)}))],c=Lc[n];return a.jsxs(a.Fragment,{children:[a.jsx("button",{ref:R,className:"icon-button locale-button",onClick:g=>{const _=g.currentTarget.getBoundingClientRect();h(u=>u===null?{x:_.left,y:_.bottom+4}:null)},title:s==="auto"?C("header.locale.titleAuto",{name:c}):C("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":i!==null,children:ey[n]}),i!==null&&a.jsx(lu,{x:i.x,y:i.y,items:r,onClose:v,anchor:R.current})]})}function Rk({onKey:n}){return a.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":C("narrow.keys.label"),children:Kw.map(s=>a.jsx("button",{className:"narrow-key",onPointerDown:i=>i.preventDefault(),onClick:()=>n(s.data),title:C(s.titleKey),children:s.label},s.id))})}function Mk({banners:n,status:s,statusLabel:i,terminals:h,activeTerminalId:v,activity:R,agents:x,offerAgentChoice:r,newTabAgent:c,canOpen:g,newTabBlockedTitle:_,onSelectTab:u,onCloseTab:y,onRenameTab:S,onNewTab:L,drawer:f,drawerOpen:l,onDrawerChange:m,menu:p,view:d,views:k,onViewChange:D,badges:E,chat:M,panel:b,notes:T,console:N,onTerminalKey:B}){const[F,O]=I.useState(null),U=h.find(P=>P.terminalId===v)??null,V=P=>{var $;return(($=x.find(H=>H.id===P.agent))==null?void 0:$.statusLine)??null};I.useEffect(()=>{if(!l&&F===null)return;const P=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),F!==null?O(null):m(!1))};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[l,F,m]);const Y=I.useRef({sheet:F,drawerOpen:l,view:d,onDrawerChange:m,onViewChange:D});Y.current={sheet:F,drawerOpen:l,view:d,onDrawerChange:m,onViewChange:D},I.useEffect(()=>{const P=window;return P[wf]=()=>{const $=Y.current;switch(Jw({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 O(null),!0;case"close-drawer":return $.onDrawerChange(!1),!0;case"show-chat":return $.onViewChange("chat"),!0;case null:return!1}},()=>{delete P[wf]}},[]);const X=I.useRef(null);I.useEffect(()=>{var P;(P=X.current)==null||P.scrollIntoView({block:"nearest",inline:"nearest"})},[d]);const G=P=>{const $=P==="git"?E.changes:P==="plans"?E.plans:P==="memory"?E.memory:0;return $>0?a.jsx("span",{className:"side-panel-badge",children:$}):P==="cli"&&E.cliUnseen&&d!=="cli"?a.jsx("span",{className:"narrow-view-dot",title:C("panel.cliUnseen")}):null};return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"app-header narrow-header",children:[a.jsx("button",{className:"icon-button narrow-icon",onClick:()=>m(!0),title:C("narrow.projects"),"aria-label":C("narrow.projects"),children:"☰"}),a.jsxs("button",{className:"narrow-current",onClick:()=>O("tabs"),title:C("narrow.tabs.open"),children:[U===null?a.jsx("span",{className:"app-name",children:"Agent Workbench"}):a.jsxs(a.Fragment,{children:[a.jsx(Lu,{terminal:U,activity:R.get(U.terminalId),statusLine:V(U)}),a.jsx("span",{className:"project-swatch",style:{background:rr(U.cwd)}}),a.jsx("span",{className:"narrow-current-label",children:Ki(U)})]}),a.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),s!=="open"&&a.jsx("span",{className:`status status-${s}`,children:i}),a.jsx("button",{className:"icon-button narrow-icon",onClick:()=>O("menu"),title:C("narrow.more"),"aria-label":C("narrow.more"),children:"⋮"})]}),n,a.jsxs("div",{className:"narrow-body",children:[a.jsx("nav",{className:"narrow-views",role:"tablist",children:k.map(P=>a.jsxs("button",{ref:P===d?X:null,role:"tab","aria-selected":P===d,className:`narrow-view-tab${P===d?" narrow-view-active":""}`,onClick:()=>D(P),children:[a.jsx("span",{children:C(Ww(P))}),G(P)]},P))}),a.jsxs("div",{className:"narrow-stack",children:[a.jsx("main",{className:`workspace narrow-pane${d==="chat"?"":" narrow-pane-veiled"}`,children:M}),b,a.jsx("div",{className:`narrow-pane${d==="notes"?"":" narrow-pane-hidden"}`,children:T}),a.jsx("div",{className:`narrow-pane${d==="console"?"":" narrow-pane-hidden"}`,children:N})]}),B!==null&&a.jsx(Rk,{onKey:B})]}),l&&a.jsx("div",{className:"narrow-backdrop",onClick:()=>m(!1),children:a.jsx("div",{className:"narrow-drawer",onClick:P=>P.stopPropagation(),children:f})}),F==="tabs"&&a.jsx("div",{className:"narrow-backdrop",onClick:()=>O(null),children:a.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":C("narrow.tabs.open"),onClick:P=>P.stopPropagation(),children:[a.jsx(Ak,{terminals:h,activeTerminalId:v,activity:R,statusLineOf:V,onSelect:P=>{u(P),O(null)},onClose:y,onRename:S}),a.jsx(Cu,{className:"narrow-sheet-new",text:C("narrow.tabs.new"),title:_??C("narrow.tabs.new"),disabled:!g||_!==null,offerAgentChoice:r,agents:x,agent:c,onOpen:P=>{L(P),O(null)}})]})}),F==="menu"&&a.jsx("div",{className:"narrow-backdrop",onClick:()=>O(null),children:a.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":C("narrow.more"),onClick:P=>P.stopPropagation(),children:a.jsx(Dk,{menu:p,status:s,statusLabel:i,onClose:()=>O(null)})})})]})}function Ak({terminals:n,activeTerminalId:s,activity:i,statusLineOf:h,onSelect:v,onClose:R,onRename:x}){const[r,c]=I.useState(null),[g,_]=I.useState(""),u=I.useRef(null);I.useEffect(()=>{var S;r!==null&&((S=u.current)==null||S.select())},[r]);const y=()=>{r!==null&&x(r,g.trim()),c(null)};return n.length===0?a.jsx("p",{className:"narrow-sheet-empty",children:C("narrow.tabs.none")}):a.jsx("ul",{className:"narrow-tabs",children:n.map(S=>{const L=r===S.terminalId;return a.jsxs("li",{className:`narrow-tab-row${S.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":rr(S.cwd)},children:[L?a.jsx("input",{ref:u,className:"narrow-tab-input",value:g,onChange:f=>_(f.target.value),onBlur:y,onKeyDown:f=>{f.key==="Enter"&&y(),f.key==="Escape"&&(f.stopPropagation(),c(null))}}):a.jsxs("button",{className:"narrow-tab-select",onClick:()=>v(S.terminalId),children:[a.jsx(Lu,{terminal:S,activity:i.get(S.terminalId),statusLine:h(S)}),a.jsx("span",{className:"narrow-tab-label",children:Ki(S)})]}),a.jsx("button",{className:"icon-button",onClick:()=>{c(S.terminalId),_(S.label.length>0?S.label:Ki(S))},title:C("narrow.tabs.rename"),children:"✎"}),a.jsx("button",{className:"icon-button",onClick:()=>R(S.terminalId),title:C("narrow.tabs.close"),children:"×"})]},S.terminalId)})})}function Nk({choice:n}){const s=[{source:"system",label:C("narrow.menu.chimeSystem")},{source:"page",label:C("narrow.menu.chimePage")}];return a.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":C("narrow.menu.sound"),children:s.map(({source:i,label:h})=>a.jsx("button",{className:`narrow-chime-option${n.source===i?" is-on":""}`,"aria-pressed":n.source===i,onClick:()=>n.setSource(i),children:h},i))})}function Dk({menu:n,status:s,statusLabel:i,onClose:h}){return a.jsxs("div",{className:"narrow-menu",children:[a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.connection")}),a.jsx("span",{className:`status status-${s}`,children:i}),Lm(navigator.userAgent)&&a.jsxs(a.Fragment,{children:[a.jsx("a",{className:"link-button",href:Qw,onClick:h,children:C("narrow.menu.phoneAppDisconnect")}),a.jsx("a",{className:"link-button",href:Xw,onClick:h,children:C("narrow.menu.phoneAppSettings")})]})]}),n.cwd!==null&&a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.folder")}),a.jsx("span",{className:"narrow-menu-value",title:n.cwd,children:n.cwd})]}),n.cliVersion!==null&&a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.cli")}),a.jsx("span",{className:"narrow-menu-value",title:n.cliVersion,children:n.cliVersion})]}),n.remoteClient&&a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("app.header.remoteBadge")}),a.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:C("app.header.remoteBadgeTitle")})]}),a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.theme")}),a.jsx("button",{className:"icon-button",onClick:n.onCycleTheme,title:n.themeTitle,children:n.themeIcon})]}),a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.language")}),a.jsx(bg,{})]}),a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.sound")}),n.sound.phoneChime===null?a.jsx(_g,{sound:n.sound}):a.jsx(Nk,{choice:n.sound.phoneChime})]}),n.sound.notify.supported&&a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.notifications")}),a.jsx(vg,{notify:n.sound.notify})]}),n.remote!==null&&a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("app.header.remoteAccess")}),a.jsx("button",{className:`icon-button${n.remote.active?" icon-button-on":""}`,onClick:()=>{var v;h(),(v=n.remote)==null||v.onOpen()},title:n.remote.title,children:"⇄"})]}),a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.shortcuts")}),a.jsx("button",{className:"icon-button",onClick:()=>{h(),n.onShortcuts()},title:C("app.header.shortcuts"),children:"?"})]}),a.jsxs("div",{className:"narrow-menu-row",children:[a.jsx("span",{className:"narrow-menu-label",children:C("settings.title")}),a.jsx("button",{className:"icon-button",onClick:()=>{h(),n.onSettings()},title:C("settings.open"),"aria-label":C("settings.open"),children:"⚙"})]})]})}function Ik(){const n=window.location.search,s=new URLSearchParams(n).get(Yc),i=s!==null&&s.length>0?s:null,h=Vw(n);return i===null&&h===null?{token:i,tab:h}:(window.history.replaceState(null,"",`${window.location.pathname}${qw(n,[Yc,km])}`),{token:i,tab:h})}const Sg=Ik(),Sp=Sg.token,jk=Sg.tab,Kc=new Set;function Pk(n){const[s,i]=I.useState(null),[h,v]=I.useState(null),[R,x]=I.useState(Kc),[r,c]=I.useState(null);I.useEffect(()=>{const l=n.onMessage(p=>{switch(p.type){case"vault.status":i(p.status);break;case"vault.exported":x(d=>{if(!d.has(p.projectKey))return d;const k=new Set(d);return k.delete(p.projectKey),k}),c({projectKey:p.projectKey,sessions:p.sessions,at:Date.now()});break;case"error":if(p.code!=="vault-failed")break;v(Nt(p.text)),p.detail!==void 0&&console.error("[servidor]",p.detail),x(Kc);break}}),m=n.onReopen(()=>x(Kc));return()=>{l(),m()}},[n]);const g=I.useCallback(()=>{v(null),n.send({type:"vault.measure"})},[n]),_=I.useCallback(l=>{v(null),n.send({type:"vault.enable",enabled:l})},[n]),u=I.useCallback(l=>{v(null),n.send({type:"vault.setDir",pickerId:l})},[n]),y=I.useCallback(l=>{v(null),x(m=>new Set(m).add(l)),n.send({type:"vault.exportProject",projectKey:l})},[n]),S=I.useCallback((l,m)=>{v(null),n.send({type:"vault.openSession",agent:l,sessionId:m})},[n]),L=I.useCallback(()=>{v(null),n.send({type:"vault.reveal"})},[n]),f=I.useCallback(()=>v(null),[]);return{status:s,problem:h,exporting:R,lastExported:r,measure:g,setEnabled:_,chooseDir:u,exportProject:y,openSession:S,reveal:L,dismissProblem:f}}function Ok(n){return C("summary.outdatedServer",{server:n,page:Ur})}function Bk(n){const[s,...i]=n;if(s===void 0||s.missingMessage===null)return null;const h=Nt(s.missingMessage);return i.length===0?h:`${h}
139
- ${C("summary.alsoWorksWith",{names:i.map(v=>v.label).join(", ")})}`}function Fk(n){const s=n.version??"?";return s.toLowerCase().includes(n.label.toLowerCase())?s:`${n.label} ${s}`}function Hk(n,s,i=Ur){var x,r;if(s&&i<Ur)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:Ok(i),environmentNotice:null};if(s&&i>Ur)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:C("summary.newerServer",{server:i,page:Ur}),environmentNotice:null};const h=n.filter(c=>c.available);let v=null;h.length===1?v=((x=h[0])==null?void 0:x.version)??null:h.length>1&&(v=h.map(Fk).join(" · "));const R=s&&h.length===0;return{cliAvailable:!s||h.length>0,cliVersion:v,cliMissingMessage:R?Bk(n):null,environmentNotice:((r=n.find(c=>c.environmentNotice!==null))==null?void 0:r.environmentNotice)??null}}const $k=500,Uk=8e3;class Wk{constructor(){Tt(this,"socket",null);Tt(this,"status","connecting");Tt(this,"attempt",0);Tt(this,"closedByUs",!1);Tt(this,"hasConnectedOnce",!1);Tt(this,"reconnectTimer");Tt(this,"messageHandlers",new Set);Tt(this,"statusHandlers",new Set);Tt(this,"reopenHandlers",new Set);Tt(this,"outbox",[])}getStatus(){return this.status}onMessage(s){return this.messageHandlers.add(s),()=>this.messageHandlers.delete(s)}onStatus(s){return this.statusHandlers.add(s),()=>this.statusHandlers.delete(s)}onReopen(s){return this.reopenHandlers.add(s),()=>this.reopenHandlers.delete(s)}connect(){if(this.socket!==null)return;const s=new URL(j0,window.location.href);s.protocol=window.location.protocol==="https:"?"wss:":"ws:",Sp!==null&&s.searchParams.set(Yc,Sp);const i=new WebSocket(s);this.socket=i,i.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const h=this.outbox.shift();h!==void 0&&i.send(rf(h))}if(this.hasConnectedOnce)for(const h of this.reopenHandlers)h();this.hasConnectedOnce=!0},i.onmessage=h=>{const v=$0(h.data);if(v===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const R of this.messageHandlers)R(v)},i.onclose=h=>{if(this.socket=null,!this.closedByUs){if(h.code===x0){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},i.onerror=()=>{}}send(s){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(rf(s)),!0):(s.type!=="input"&&s.type!=="resize"&&this.outbox.push(s),!1)}close(){var s;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(s=this.socket)==null||s.close(),this.socket=null}setStatus(s){if(this.status!==s){this.status=s;for(const i of this.statusHandlers)i(s)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const s=Math.min($k*2**(this.attempt-1),Uk);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),s)}}const pu="agent-workbench.activeTab";function zk(){try{return window.sessionStorage.getItem(pu)}catch{return null}}const Vk={state:"idle",scannedFiles:0,totalFiles:0};function qk(n,s,i){const h=new Map(i?[]:n.map(v=>[v.key,v]));for(const v of s)h.set(v.key,v);return[...h.values()].sort((v,R)=>R.lastActivityAt-v.lastActivityAt)}function Kk(){const n=I.useMemo(()=>new Wk,[]),s=I.useMemo(()=>new Nw({send:(Re,Ve)=>n.send({type:"composer.draft",terminalId:Re,draft:Ve}),connected:()=>n.getStatus()==="open",setTimer:(Re,Ve)=>window.setTimeout(Re,Ve),clearTimer:Re=>window.clearTimeout(Re),newId:()=>crypto.randomUUID()}),[n]),[i,h]=I.useState("connecting"),[v,R]=I.useState([]),[x,r]=I.useState(null),[c,g]=I.useState(!1),[_,u]=I.useState(Ur),[y,S]=I.useState(""),[L,f]=I.useState(""),[l,m]=I.useState(null),[p,d]=I.useState(!1),[k,D]=I.useState([]),[E,M]=I.useState([]),[b,T]=I.useState(Vk),[N,B]=I.useState(zk);I.useEffect(()=>{try{N===null?window.sessionStorage.removeItem(pu):window.sessionStorage.setItem(pu,N)}catch{}},[N]);const[F,O]=I.useState(new Set),[U,V]=I.useState(new Map),[Y,X]=I.useState(new Map),G=I.useRef(new Map),P=I.useRef(new Map),[$,H]=I.useState(new Set),[q,te]=I.useState(null),[se,le]=I.useState([]),[ue,K]=I.useState(new Map),[W,J]=I.useState([]),Z=I.useRef(1),de=I.useRef(new Set),pe=I.useRef(new Map),re=I.useRef(new Map),ke=I.useCallback(Re=>{const Ve=re.current.get(Re);Ve!==void 0&&(clearTimeout(Ve),re.current.delete(Re)),le(he=>he.some(me=>me.requestId===Re)?he.filter(me=>me.requestId!==Re):he)},[]),Me=I.useCallback(()=>{for(const Re of re.current.values())clearTimeout(Re);re.current.clear(),le(Re=>Re.length===0?Re:[])},[]);I.useEffect(()=>{const Re=n.onStatus(me=>{h(me),me==="failed"&&te({message:C("workspace.connectFailed"),at:Date.now()})}),Ve=n.onMessage(me=>{switch(me.type){case"agents":R(me.agents),r(me.defaultAgent);break;case"hello":R(me.agents),r(me.defaultAgent),g(!0),u(me.protocolVersion),S(me.platform),f(me.defaultCwd),m(me.shellName),d(me.remoteClient);break;case"terminal.list":{D(me.terminals),s.retain(me.terminals.map(qe=>qe.terminalId));const Ne=ow(P.current,me.terminals),mt=Ne.finished.length>0||[...Ne.phases].some(([qe,lt])=>P.current.get(qe)!==lt);P.current=Ne.phases,mt&&H(new Set(Ne.phases.keys())),O(qe=>{if(qe.size===0)return qe;const lt=new Set(qe);for(const Rt of qe){if(Ne.phases.has(Rt))continue;const Mt=me.terminals.find(Se=>Se.terminalId===Rt);(Mt===void 0||Mt.alive)&&lt.delete(Rt)}return lt.size===qe.size?qe:lt}),X(qe=>{if(qe.size===0)return qe;const lt=new Map([...qe].filter(([Rt])=>me.terminals.some(Mt=>Mt.terminalId===Rt)));return lt.size===qe.size?qe:(G.current=lt,lt)});const De=me.terminals.filter(qe=>qe.kind==="agent");B(qe=>{var lt;return qe!==null&&De.some(Rt=>Rt.terminalId===qe)?qe:((lt=De[0])==null?void 0:lt.terminalId)??null}),K(qe=>{if(qe.size===0)return qe;const lt=new Map(qe);for(const Rt of qe.keys())me.terminals.some(Mt=>Mt.terminalId===Rt)||lt.delete(Rt);return lt.size===qe.size?qe:lt});break}case"session.continued":K(Ne=>new Map(Ne).set(me.terminalId,{sourceAgent:me.source.agent,includedTurns:me.includedTurns,totalTurns:me.totalTurns,totalTurnsIsMinimum:me.totalTurnsIsMinimum,delivery:me.delivery,prefillReason:null}));break;case"composer.prefill":{const Ne=Z.current;Z.current+=1,J(mt=>[...mt,{id:Ne,terminalId:me.terminalId,text:me.text}]),K(mt=>{const De=mt.get(me.terminalId);return De===void 0?mt:new Map(mt).set(me.terminalId,{...De,delivery:"prefilled",prefillReason:me.reason})});break}case"composer.drafts":s.restore(me.drafts);break;case"terminal.opened":{ke(me.requestId),de.current.delete(me.requestId)&&me.terminal.kind==="agent"&&B(me.terminal.terminalId);const Ne=pe.current.get(me.requestId);Ne!==void 0&&(pe.current.delete(me.requestId),Ne(me.terminal));break}case"terminal.activity":V(Ne=>Ne.get(me.terminalId)===me.activity?Ne:new Map(Ne).set(me.terminalId,me.activity)),X(Ne=>{const mt=me.offlineReason??null;if((Ne.get(me.terminalId)??null)===mt)return Ne;const De=new Map(Ne);return mt===null?De.delete(me.terminalId):De.set(me.terminalId,mt),G.current=De,De});break;case"index.status":T(me.status);break;case"index.projects":M(Ne=>qk(Ne,me.projects,me.replace));break;case"error":if(dx(me.requestId)){me.detail!==void 0&&console.error("[servidor]",me.detail);break}if(me.code==="vault-failed"||me.code==="search-failed"||me.code==="remote-failed"||me.code==="settings-failed")break;te({message:Nt(me.text),at:Date.now()}),O(Ne=>Ne.size===0?Ne:new Set),P.current.size>0&&(P.current=new Map,H(new Set)),me.detail!==void 0&&console.error("[servidor]",me.detail),me.requestId!==void 0&&(de.current.delete(me.requestId),pe.current.delete(me.requestId),ke(me.requestId));break}}),he=n.onReopen(()=>{Me(),O(me=>me.size===0?me:new Set),P.current.size>0&&(P.current=new Map,H(new Set))});return n.connect(),()=>{Re(),Ve(),he(),n.close()}},[n,s,ke,Me]),I.useEffect(()=>{const Re=n.onReopen(()=>s.reconnected()),Ve=()=>s.flushAll(),he=()=>{document.visibilityState==="hidden"&&s.flushAll()};return window.addEventListener("pagehide",Ve),document.addEventListener("visibilitychange",he),()=>{Re(),window.removeEventListener("pagehide",Ve),document.removeEventListener("visibilitychange",he)}},[n,s]),I.useEffect(()=>Me,[Me]);const et=I.useCallback(Re=>{const Ve=crypto.randomUUID();de.current.add(Ve),Re.onOpened!==void 0&&pe.current.set(Ve,Re.onOpened),le(me=>[...me,{requestId:Ve,cwd:Re.cwd,agent:Re.agent??null,label:Re.label??"",at:Date.now()}]);const he=setTimeout(()=>ke(Ve),lw);re.current.set(Ve,he),n.send({type:"terminal.open",requestId:Ve,cwd:Re.cwd,...Re.resumeSessionId!==void 0?{resumeSessionId:Re.resumeSessionId}:{},...Re.label!==void 0?{label:Re.label}:{},...Re.agent!==void 0?{agent:Re.agent}:{}})},[n,ke]),Le=I.useCallback(Re=>{n.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:Re,kind:"shell"})},[n]),fe=I.useCallback(Re=>n.send({type:"terminal.close",terminalId:Re}),[n]),Te=I.useCallback(Re=>{O(Ve=>new Set(Ve).add(Re)),G.current.get(Re)==="server-closed"&&(P.current=new Map(P.current).set(Re,"waiting-exit"),H(new Set(P.current.keys()))),n.send({type:"terminal.wake",terminalId:Re})},[n]),Ce=I.useCallback((Re,Ve)=>n.send({type:"terminal.rename",terminalId:Re,label:Ve}),[n]),Ee=I.useCallback(Re=>n.send({type:"tabs.reorder",terminalIds:Re}),[n]),Be=I.useCallback((Re,Ve)=>n.send({type:"session.archive",sessionIds:Re,archived:Ve}),[n]),ve=I.useCallback((Re,Ve,he)=>{const me=crypto.randomUUID();de.current.add(me),n.send({type:"session.continue",requestId:me,agent:Re.agent,sessionId:Re.sessionId,target:Ve,label:he})},[n]),Ae=I.useCallback(Re=>{K(Ve=>{if(!Ve.has(Re))return Ve;const he=new Map(Ve);return he.delete(Re),he})},[]),st=I.useCallback(Re=>{J(Ve=>Ve.some(he=>he.id===Re)?Ve.filter(he=>he.id!==Re):Ve)},[]),Xe=I.useCallback(()=>n.send({type:"index.refresh"}),[n]),Qe=I.useCallback(()=>n.send({type:"agents.refresh"}),[n]),dt=I.useCallback(()=>te(null),[]),ht=I.useMemo(()=>k.filter(Re=>Re.kind==="agent"),[k]),$e=I.useMemo(()=>k.filter(Re=>Re.kind==="shell"),[k]),tt=Qi(),We=I.useMemo(()=>Hk(v,c,_),[v,c,_,tt]),ot=I.useCallback(Re=>{var Ve;return(Re===null||(Ve=v.find(he=>he.id===Re))==null?void 0:Ve.capabilities)??Fp},[v]),ft=I.useMemo(()=>gu(v),[v]);return{connection:n,status:i,agents:v,defaultAgent:x,capabilitiesFor:ot,offerAgentChoice:ft,cliAvailable:We.cliAvailable,cliVersion:We.cliVersion,cliMissingMessage:We.cliMissingMessage,platform:y,defaultCwd:L,environmentNotice:We.environmentNotice,shellName:l,remoteClient:p,terminals:ht,shells:$e,pendingOpens:se,activeTerminalId:N,projects:E,indexStatus:b,error:q,dismissError:dt,setActiveTerminal:B,openTerminal:et,openShell:Le,closeTerminal:fe,wakeTerminal:Te,waking:F,activity:U,offlineReasons:Y,relaunching:$,renameTerminal:Ce,reorderTabs:Ee,refreshIndex:Xe,refreshAgents:Qe,archiveSessions:Be,continueSession:ve,handoffs:ue,dismissHandoff:Ae,prefills:W,prefillApplied:st,drafts:s}}const Tu=["git","files","plans","memory","console","notes"],Cp="agent-workbench.hiddenPanels";function Gk(n){return Tu.includes(n)}const Yk=new Set(["memory"]),Xk="none";function Qk(n){return new Set(n.split(",").map(s=>s.trim()).filter(Gk))}function Jk(n){const s=Tu.filter(i=>n.has(i));return s.length===0?Xk:s.join(",")}function Zk(n,s,i){const h=new Set(n);return i?h.delete(s):h.add(s),h}function eE(){const[n,s]=I.useState(()=>vt(Cp,Yk,Qk)),i=I.useCallback((v,R)=>{s(x=>{const r=Zk(x,v,R);return pt(Cp,Jk(r)),r})},[]),h=I.useCallback(v=>!n.has(v),[n]);return{hidden:n,isVisible:h,setVisible:i}}const tE={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},nE={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function sE(n,s,i){const h=n.filter(v=>v!==s);return i?[...h,s]:h}function rE(n,s){return n.length===s.length&&n.every(i=>s.includes(i))}function iE({onClose:n,terminalTheme:s,panels:i,consoleCount:h,onHideConsole:v,appSettings:R,agents:x,remoteClient:r,onOpenVault:c,onOpenRemote:g}){const[_,u]=I.useState(!1),y=R.status,S=y!==null&&!r,[L,f]=I.useState(null),[l,m]=I.useState(null);I.useEffect(()=>{f(null),m(null)},[y,R.problem]);const p=L??(y==null?void 0:y.consoleShell)??"auto",d=l??(y==null?void 0:y.disabledAgents)??[];I.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 k=(b,T)=>{if(b==="console"&&!T&&h>0){u(!0);return}i.setVisible(b,T)},D=(y==null?void 0:y.consoleShells.find(b=>b.id!=="git-bash"&&b.id!=="zsh"))??null,E=y!==null&&!rE(y.disabledAgents,y.disabledAtStart),M=y===null?[]:[{id:"auto",label:D===null?C("settings.console.auto"):C("settings.console.autoWith",{shell:D.label})},...y.consoleShells];return a.jsx("div",{className:"modal-backdrop",onClick:n,children:a.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":C("settings.title"),onClick:b=>b.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:C("settings.title")}),a.jsx("button",{className:"icon-button",onClick:n,title:C("common.closeEsc"),children:"×"})]}),a.jsxs("div",{className:"modal-body settings-body",children:[a.jsx("h3",{className:"modal-section",children:C("settings.section.appearance")}),a.jsxs("div",{className:"settings-row",children:[a.jsx("span",{className:"settings-label",children:C("settings.language")}),a.jsx(bg,{})]}),a.jsxs("div",{className:"settings-row settings-row-top",children:[a.jsx("span",{className:"settings-label",children:C("settings.terminalTheme")}),a.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":C("settings.terminalTheme"),children:[["dark","follow"].map(b=>a.jsxs("label",{className:"settings-choice",children:[a.jsx("input",{type:"radio",name:"terminal-theme",checked:s.preference===b,onChange:()=>s.setPreference(b)}),C(nE[b])]},b)),a.jsx("p",{className:"modal-hint",children:C("settings.terminalTheme.hint")})]})]}),a.jsx("h3",{className:"modal-section",children:C("settings.section.panels")}),a.jsx("div",{className:"settings-panels",children:Tu.map(b=>a.jsxs("label",{className:"settings-choice",children:[a.jsx("input",{type:"checkbox",checked:i.isVisible(b),onChange:T=>k(b,T.target.checked)}),C(tE[b])]},b))}),_&&a.jsxs("div",{className:"settings-confirm",role:"alert",children:[a.jsx("span",{children:C("settings.panels.consoleConfirm",{count:h})}),a.jsx("button",{className:"link-button",onClick:()=>{u(!1),v()},children:C("settings.panels.consoleConfirmYes")}),a.jsx("button",{className:"link-button",onClick:()=>u(!1),children:C("common.cancel")})]}),a.jsx("p",{className:"modal-hint",children:C("settings.panels.cliAlways")}),y===null?a.jsx("p",{className:"modal-hint",children:C("settings.oldServer")}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"modal-section",children:C("settings.section.console")}),y.consoleShells.length===0?a.jsx("p",{className:"modal-hint",children:C("console.noShell")}):a.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":C("settings.section.console"),children:[M.map(b=>a.jsxs("label",{className:"settings-choice",children:[a.jsx("input",{type:"radio",name:"console-shell",checked:p===b.id,disabled:!S,onChange:()=>{f(b.id),R.setConsoleShell(b.id)}}),b.label]},b.id)),a.jsx("p",{className:"modal-hint",children:C("settings.console.hint")})]}),a.jsx("h3",{className:"modal-section",children:C("settings.section.clis")}),a.jsx("ul",{className:"settings-clis",children:x.map(b=>{const T=d.includes(b.id),N=y.disabledAtStart.includes(b.id),B=b.available||N;return a.jsxs("li",{className:"settings-cli",children:[B?a.jsxs("label",{className:"settings-choice",children:[a.jsx("input",{type:"checkbox",checked:!T,disabled:!S,onChange:F=>{const O=sE(d,b.id,!F.target.checked);m(O),R.setDisabledAgents(O)}}),a.jsx("span",{className:"settings-cli-name",children:b.label})]}):a.jsx("span",{className:"settings-cli-name settings-cli-missing",children:b.label}),a.jsx("span",{className:"settings-cli-detail",children:b.available?b.version??"":C(N?"settings.cli.disabled":"settings.cli.notInstalled")}),!B&&a.jsx("a",{className:"link-button",href:b.installUrl,target:"_blank",rel:"noreferrer noopener",children:C("settings.cli.install")})]},b.id)})}),a.jsx("p",{className:"modal-hint",children:C("settings.cli.hint")}),E&&a.jsx("p",{className:"settings-restart",children:C("settings.cli.restart")}),r&&a.jsx("p",{className:"modal-hint",children:C("settings.hostOnly")}),R.problem!==null&&a.jsxs("p",{className:"settings-problem",role:"alert",children:[R.problem,a.jsx("button",{className:"link-button",onClick:R.dismissProblem,children:C("common.close")})]})]}),(c!==null||g!==null)&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"modal-section",children:C("settings.section.more")}),a.jsxs("div",{className:"settings-row settings-more",children:[c!==null&&a.jsx("button",{className:"primary-button primary-button-small",onClick:c,children:C("settings.more.open",{name:Yr()})}),g!==null&&a.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:C("settings.more.open",{name:C("app.header.remoteAccess")})})]})]})]})]})})}function oE(n){const[s,i]=I.useState(null),[h,v]=I.useState(null);I.useEffect(()=>n.onMessage(c=>{switch(c.type){case"settings.status":i(c.settings),v(null);break;case"error":if(c.code!=="settings-failed")break;v(Nt(c.text)),c.detail!==void 0&&console.error("[servidor]",c.detail);break}}),[n]);const R=I.useCallback(c=>n.send({type:"settings.update",consoleShell:c}),[n]),x=I.useCallback(c=>n.send({type:"settings.update",disabledAgents:c}),[n]),r=I.useCallback(()=>v(null),[]);return{status:s,problem:h,setConsoleShell:R,setDisabledAgents:x,dismissProblem:r}}function aE({status:n,agents:s,indexReady:i,problem:h,covered:v,onMeasure:R,onSetEnabled:x,onChangeDir:r,onReveal:c,onDismissProblem:g,onClose:_}){return I.useEffect(()=>{if(v)return;const u=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),_())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[v,_]),a.jsx("div",{className:"modal-backdrop",onClick:_,children:a.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Yr(),onClick:u=>u.stopPropagation(),children:[a.jsxs("header",{className:"modal-header",children:[a.jsx("span",{className:"modal-title",children:Yr()}),n!==null&&a.jsx("span",{className:`vault-state${n.enabled?" vault-state-on":""}`,children:BS(n)}),a.jsx("button",{className:"icon-button",onClick:_,title:C("common.closeEsc"),children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsx("p",{className:"vault-lead",children:DS()}),a.jsx("p",{className:"modal-hint",children:IS()}),n===null?a.jsx("p",{className:"modal-hint",children:C("vault.dialog.waiting")}):a.jsx(lE,{status:n,agents:s,indexReady:i,onMeasure:R,onSetEnabled:x,onChangeDir:r,onReveal:c}),h!==null&&a.jsxs("div",{className:"vault-problem",role:"alert",children:[a.jsx("span",{children:h}),a.jsx("button",{className:"icon-button",onClick:g,title:C("common.dismissNotice"),children:"×"})]})]})]})})}function lE({status:n,agents:s,indexReady:i,onMeasure:h,onSetEnabled:v,onChangeDir:R,onReveal:x}){const r=US(n,i),c=WS(n),g=$S(n),_=n.measurement===null?null:qS(n.measurement,s),u=n.progress;return a.jsxs(a.Fragment,{children:[n.enabled&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"modal-section",children:C("vault.dialog.inFolder")}),a.jsxs("p",{className:"vault-summary",children:[rg(n.sessions)," · ",hn(n.bytes),n.lastPassAt!==null&&a.jsxs(a.Fragment,{children:[" · ",C("vault.dialog.lastPass",{when:Vn(n.lastPassAt)})]}),n.pending>0&&a.jsxs(a.Fragment,{children:[" · ",C("vault.dialog.pendingCalm",{count:n.pending})]})]})]}),u!==null&&u.total>0&&a.jsx("progress",{className:"vault-progress",value:u.done,max:u.total}),a.jsx("h3",{className:"modal-section",children:C("vault.dialog.sizeSection")}),a.jsxs("div",{className:"vault-actions",children:[a.jsx("button",{className:"link-button vault-measure",onClick:h,disabled:r!==null,title:r??C("vault.dialog.measureTitle"),children:n.state==="measuring"?C("vault.state.measuring"):C(_===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),_!==null&&a.jsx("span",{className:"modal-hint",children:_.summary})]}),_!==null&&a.jsx("div",{className:"vault-table-wrap",children:a.jsxs("table",{className:"vault-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"CLI"}),a.jsx("th",{children:C("vault.dialog.table.sessions")}),a.jsx("th",{children:C("vault.dialog.table.size")}),a.jsx("th",{children:C("vault.dialog.table.images")}),a.jsx("th",{title:C("vault.dialog.table.archivedTitle"),children:C("vault.dialog.table.archived")})]})}),a.jsxs("tbody",{children:[_.rows.map(y=>a.jsxs("tr",{children:[a.jsxs("td",{children:[y.label,y.note!==null&&a.jsx("span",{className:"vault-table-note",children:y.note})]}),a.jsx("td",{children:y.sessions}),a.jsx("td",{children:hn(y.bytes)}),a.jsx("td",{title:y.images>0?hn(y.imageBytes):void 0,children:y.images}),a.jsx("td",{children:y.skippedArchived})]},y.agent)),a.jsxs("tr",{children:[a.jsx("td",{children:C("vault.dialog.table.memory",{count:_.memoryProjects})}),a.jsx("td",{}),a.jsx("td",{children:hn(_.memoryBytes)}),a.jsx("td",{}),a.jsx("td",{})]})]}),a.jsx("tfoot",{children:a.jsxs("tr",{children:[a.jsx("td",{children:C("vault.dialog.table.total")}),a.jsx("td",{children:_.total.sessions}),a.jsx("td",{children:hn(_.total.bytes)}),a.jsx("td",{children:_.total.images}),a.jsx("td",{children:_.total.skippedArchived})]})})]})}),a.jsxs("div",{className:"vault-actions vault-switch",children:[g==="enabled"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"link-button",onClick:()=>v(!1),children:C("vault.dialog.turnOff")}),a.jsx("span",{className:"modal-hint",children:C("vault.dialog.turnOffHint")})]}),(g==="measured"||g==="existing")&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"primary-button",onClick:()=>v(!0),title:C(g==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:C("vault.dialog.activate")}),a.jsx("span",{className:"modal-hint",children:C(g==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),g==="needs-measure"&&a.jsx("span",{className:"modal-hint",children:C("vault.dialog.needsMeasure",{activate:C("vault.dialog.activate")})})]}),a.jsx("h3",{className:"modal-section",children:C("vault.dialog.folderSection")}),a.jsx("p",{className:"vault-dir",title:n.dir,children:n.dir}),n.isDefaultDir&&a.jsx("p",{className:"modal-hint",children:C("vault.dialog.defaultDir")}),a.jsxs("div",{className:"vault-actions",children:[a.jsx("button",{className:"link-button",onClick:R,disabled:c!==null,title:c??C("vault.dialog.changeDirTitle"),children:C("vault.dialog.changeDir")}),x!==null&&a.jsx("button",{className:"link-button",onClick:x,title:C("vault.dialog.openFolderTitle"),children:C("vault.dialog.openFolder")})]}),n.previousDir!==null&&a.jsx("p",{className:"modal-hint",children:zS(n.previousDir)}),n.lastError!==null&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"modal-section",children:C("vault.dialog.lastError")}),a.jsx("p",{className:"vault-error",children:Nt(n.lastError)})]})]})}const xp={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},kp=320,cE=1400,uE=640,Ep=200,Lp=560,hE=270,dE=120,fE=720,pE=260,Tp="agent-workbench.panel-width",Rp="agent-workbench.panel-visible",Mp="agent-workbench.panel-tab",Gc="agent-workbench.panel-expanded",Ap="agent-workbench.sidebar-visible",Np="agent-workbench.sidebar-width",Dp="agent-workbench.console-visible",Ip="agent-workbench.console-height",jp="agent-workbench.marker-notice-dismissed",Pp="agent-workbench.hidden-hint-shown";function mE(){var fi,Co,xo;const n=Qi(),s=Kk(),{connection:i,status:h,agents:v,defaultAgent:R,capabilitiesFor:x,offerAgentChoice:r,cliAvailable:c,cliVersion:g,cliMissingMessage:_,platform:u,defaultCwd:y,environmentNotice:S,shellName:L,terminals:f,archiveSessions:l,shells:m,pendingOpens:p,activeTerminalId:d,projects:k,indexStatus:D,error:E,dismissError:M,setActiveTerminal:b,openTerminal:T,openShell:N,closeTerminal:B,wakeTerminal:F,waking:O,activity:U,offlineReasons:V,relaunching:Y,renameTerminal:X,reorderTabs:G,refreshIndex:P,refreshAgents:$,continueSession:H,handoffs:q,dismissHandoff:te,prefills:se,prefillApplied:le,drafts:ue,remoteClient:K}=s,W=wx(),J=Cx(W.resolved),Z=I.useMemo(()=>({nameOf:ie=>$x(f.find(ye=>ye.terminalId===ie)),activate:b}),[f,b]),de=Vx(U,Z),pe=qx(),re=f.find(ie=>ie.terminalId===d)??null,ke=I.useCallback(ie=>{ie!==d&&M(),b(ie)},[d,M,b]),Me=(re==null?void 0:re.agent)??null,et=x(Me),Le=I.useMemo(()=>py(et),[et]),fe=v.find(ie=>ie.id===Me)??null,Te=I.useMemo(()=>{if(re===null||Me===null)return null;for(const ie of k){const ye=ie.sessions.find(nt=>nt.agent===Me&&nt.sessionId===re.sessionId);if(ye!==void 0)return zn(ye.title,ye.titleSource)}return null},[re,Me,k,n]),Ce=I.useMemo(()=>hy(f,k.flatMap(ie=>ie.sessions)),[f,k]),Ee=(fe==null?void 0:fe.statusLine)??null,Be=(re==null?void 0:re.cwd)??y,ve=I.useMemo(()=>r?Fy(f,Be,u,v,R):null,[r,f,Be,u,v,R]),Ae=I.useMemo(()=>pf(p,Be,u),[p,Be,u]),st=Ae?_m():null,Xe=gx(i),Qe=Pk(i),[dt,ht]=I.useState(!1),$e=Qx(i),[tt,We]=I.useState(!1),ot=g1(),ft=eE(),[Re,Ve]=I.useState(!1),he=I.useCallback(()=>Ve(!1),[]),[me,Ne]=I.useState(()=>vt(vf,"chat",Fw)),mt=I.useMemo(()=>Hw({hasTab:re!==null,plansAvailable:Le.plansAvailable,hidden:ft.hidden}),[re,Le.plansAvailable,ft.hidden]),De=$w(me,mt),qe=I.useCallback(ie=>{Ne(ie),pt(vf,ie)},[]),lt=I.useRef(jk);I.useEffect(()=>{if(lt.current!==null)return i.onMessage(ie=>{if(ie.type!=="terminal.list"||lt.current===null)return;const ye=lt.current;lt.current=null,ie.terminals.some(nt=>nt.terminalId===ye&&nt.kind==="agent")&&b(ye)})},[i,b]);const Rt=GC(i),Mt=tS(v,Qe.status),[Se,Ke]=I.useState(null),rt=I.useRef(0),Dt=I.useCallback(ie=>{Ke(ye=>ye!==null&&ye.seq===ie?null:ye)},[]),xt=(ie,ye)=>{const nt=mS(ie,{projects:k,terminals:f,platform:u,canResume:es=>uf(v,es)}),Bn=()=>{ye.length!==0&&(rt.current+=1,Ke({query:ye,seq:rt.current}))};switch(nt.kind){case"activate":ke(nt.terminalId),Bn();break;case"resume":nt.session.archived&&l([nt.session.sessionId],!1),T({cwd:nt.cwd,resumeSessionId:nt.session.sessionId,agent:nt.session.agent,label:zn(nt.session.title,nt.session.titleSource)}),Bn();break;case"copy":Qe.openSession(ie.agent,ie.sessionId);break}},mn=I.useMemo(()=>new Set(f.map(ie=>ie.sessionId).filter(ie=>ie.length>0)),[f]),[Jt,$a]=I.useState(()=>vt(Rp,!0,ie=>ie==="true")),[js,ir]=I.useState(()=>vt(Mp,"cli",ie=>ie==="git"||ie==="files"||ie==="cli"||ie==="plans"||ie==="memory"?ie:ie==="conversation"?"cli":null)),[Ps,Jr]=I.useState(()=>vt(Tp,uE,ie=>{const ye=Number.parseInt(ie,10);return Number.isFinite(ye)?Math.max(ye,kp):null})),[Zi,eo]=I.useState(()=>vt(Gc,!1,ie=>ie==="true")),[Zr,Kn]=I.useState(()=>vt(Ap,!0,ie=>ie==="true")),[ei,to]=I.useState(()=>vt(Np,hE,ie=>{const ye=Number.parseInt(ie,10);return Number.isFinite(ye)?Math.min(Lp,Math.max(Ep,ye)):null})),[Ua,no]=I.useState(()=>vt(Dp,!1,ie=>ie==="true")),[ti,so]=I.useState(()=>vt(Ip,pE,ie=>{const ye=Number.parseInt(ie,10);return Number.isFinite(ye)?ye:null})),[ro,Wa]=I.useState(()=>vt(jp,!0,ie=>ie!=="true")),[za,yt]=I.useState(!1),ni=oE(i),[si,cs]=I.useState(!1),Gn=ni.status!==null?ni.status.shellName:L,[io,ri]=I.useState(null),[or,nn]=I.useState(!1);I.useEffect(()=>{Ee===null&&nn(!1)},[Ee]);const[ii,Ot]=I.useState(null),ar=Jt&&re!==null,lr=Ey(js,Le.plansAvailable,ft.hidden),cr=Ua&&ft.isVisible("console"),Sn=re!==null?Jt||cr:Jt,us=Zi&&re!==null,Vt=I.useMemo(()=>re===null?[]:m.filter(ie=>ie.cwd===re.cwd),[m,re]),[ur,oo]=I.useState(null),hs=Vt.find(ie=>ie.terminalId===ur)??Vt[0]??null,ds=De==="cli"?d:De==="console"?(hs==null?void 0:hs.terminalId)??null:null,ao=I.useCallback(ie=>{ds!==null&&i.send({type:"input",terminalId:ds,data:ie})},[i,ds]),Bt=Ob(i,d),Yn=Gx(i,U),lo=ot?re!==null:ar,oi=ot?De==="files":ar&&lr==="files",ct=hx(i,lo?d:null),co=KC(i,oi?d:null),ai=YC(i,d),li=ux(i,f,d),hr=mx(i,lo?d:null),uo=ot?De==="cli":ar&&lr==="cli",ci=Bt.usage.lastModel,dr=Bt.usage.lastEffort??((fi=[...Bt.events].reverse().find(ie=>ie.effort!==null))==null?void 0:fi.effort)??null,Os=ci??Bt.defaults.model,Cn=dr??Bt.defaults.effort,In=ci===null&&Os!==null,jn=dr===null&&Cn!==null,fs=VC(i,d,uo),Xn=d===null?null:U.get(d)??null,xn=tw(et,Bt.openToolCall,(fe==null?void 0:fe.label)??null,(re==null?void 0:re.alive)??!1,Xn),ui=nw({offlineReason:d===null?null:V.get(d)??null,alive:(re==null?void 0:re.alive)??!1,relaunching:d!==null&&Y.has(d)}),fr=ui===null?null:sw((fe==null?void 0:fe.label)??null),Bs=fr??xn??aw(et,Bt.waitingFor,(re==null?void 0:re.alive)??!1),Va=!Bp(et,Xn),ho=I.useMemo(()=>mm(v,Me),[v,Me]),Fs=re!==null&&Jy(Me,re.sessionId,et),kn=d===null?null:q.get(d)??null,qa=kn===null?null:{text:Ky(Xi(kn.sourceAgent,v),kn.includedTurns,kn.totalTurns,kn.totalTurnsIsMinimum),status:kn.prefillReason!==null?Yy(kn.prefillReason):kn.delivery==="sending"&&Bt.events.length===0?Gy():null},En=I.useCallback(()=>{$a(ie=>{const ye=!ie;return pt(Rp,String(ye)),ye})},[]),ps=I.useCallback(()=>{Kn(ie=>{const ye=!ie;return pt(Ap,String(ye)),ye})},[]),Qn=I.useCallback(()=>{no(ie=>{const ye=!ie;return pt(Dp,String(ye)),ye})},[]),Hs=I.useCallback(ie=>{ir(ie),pt(Mp,ie)},[]),Ka=I.useCallback(()=>{eo(ie=>{const ye=!ie;return pt(Gc,String(ye)),ye})},[]),Ga=I.useCallback(()=>{d!==null&&i.send({type:"input",terminalId:d,data:"\x1B\x1B"})},[i,d]),hi=I.useCallback(ie=>{d!==null&&i.send({type:"input",terminalId:d,data:`${ie} `})},[i,d]),Jn=I.useRef(null),di=I.useCallback(ie=>{var ye;return(ye=Jn.current)==null?void 0:ye.call(Jn,ie,!ot)},[ot]),fo=I.useCallback(ie=>{d!==null&&i.send({type:"agent.submit",terminalId:d,text:ie,images:[]})},[i,d]),Pn=I.useCallback(ie=>{d!==null&&i.send({type:"files.reveal",terminalId:d,path:ie})},[i,d]),On=I.useRef(new Set);I.useEffect(()=>{if(!cr){On.current.clear();return}if(re===null)return;const{cwd:ie}=re;if(m.some(ye=>ye.cwd===ie)){On.current.delete(ie);return}On.current.has(ie)||(On.current.add(ie),N(ie))},[cr,re,m,N]);const pr=I.useCallback(ie=>{const ye=Vt.find(nt=>nt.terminalId===ie);ye!==void 0&&On.current.delete(ye.cwd),B(ie)},[Vt,B]),mr=I.useCallback(ie=>{if(ie==="console")for(const ye of m)B(ye.terminalId);ft.setVisible(ie,!1),!vt(Pp,!1,ye=>ye==="true")&&(pt(Pp,"true"),ri(ie))},[m,B,ft]),gr=I.useCallback(()=>{for(const ie of m)B(ie.terminalId);ft.setVisible("console",!1)},[m,B,ft]),$s=I.useRef(new Set);I.useEffect(()=>{const ie=Vt.filter(nt=>!$s.current.has(nt.terminalId));for(const nt of Vt)$s.current.add(nt.terminalId);const ye=ie[ie.length-1];ye!==void 0&&oo(ye.terminalId)},[Vt]);const po=I.useCallback(()=>{re!==null&&(On.current.add(re.cwd),N(re.cwd))},[re,N]),Zt=Ea({min:kp,max:cE,value:Ps,measure:I.useCallback(ie=>window.innerWidth-ie.clientX,[]),onChange:Jr,onCommit:I.useCallback(ie=>pt(Tp,String(ie)),[]),onStart:I.useCallback(()=>{eo(!1),pt(Gc,"false")},[])}),ms=Ea({min:Ep,max:Lp,value:ei,measure:I.useCallback(ie=>ie.clientX,[]),onChange:to,onCommit:I.useCallback(ie=>pt(Np,String(ie)),[])}),_r=I.useRef(0),Us=Ea({min:dE,max:fE,value:ti,measure:I.useCallback(ie=>Math.round(_r.current-ie.clientY),[]),onChange:so,onCommit:I.useCallback(ie=>pt(Ip,String(ie)),[]),onStart:I.useCallback(ie=>{const ye=ie.currentTarget.nextElementSibling;_r.current=ye===null?window.innerHeight:ie.clientY+ye.getBoundingClientRect().height},[])}),Ya=I.useCallback(()=>{Wa(!1),pt(jp,"true")},[]),Ws=I.useCallback(ie=>{if(f.length===0)return;const nt=(f.findIndex(es=>es.terminalId===d)+ie+f.length)%f.length,Bn=f[nt];Bn!==void 0&&ke(Bn.terminalId)},[f,d,ke]),vr=I.useRef(null),Zn=I.useRef(null);I.useEffect(()=>{d!==Zn.current&&(vr.current=Zn.current,Zn.current=d)},[d]);const zs=I.useCallback(()=>{const ie=vr.current;ie===null||ie===d||f.some(ye=>ye.terminalId===ie)&&ke(ie)},[d,f,ke]);I.useEffect(()=>{const ie=ye=>{if(ye.key!=="Tab"||!ye.shiftKey||ye.altKey||ye.ctrlKey||ye.metaKey)return;const nt=document.activeElement;nt instanceof Element&&nt.closest(".xterm")!==null||(ye.preventDefault(),ye.stopPropagation(),zs())};return window.addEventListener("keydown",ie,!0),()=>window.removeEventListener("keydown",ie,!0)},[zs]),I.useEffect(()=>{const ie=ye=>{if(!ye.altKey||ye.ctrlKey||ye.metaKey)return;const nt=ye.key.toLowerCase();if(nt==="t"){c&&y.length>0&&!Ae&&(ye.preventDefault(),ye.stopPropagation(),T({cwd:(re==null?void 0:re.cwd)??y}));return}if(nt==="w"){d!==null&&(ye.preventDefault(),ye.stopPropagation(),B(d));return}if(nt==="p"){ye.preventDefault(),ye.stopPropagation(),En();return}if(nt==="arrowright"||nt==="pagedown"){ye.preventDefault(),ye.stopPropagation(),Ws(1);return}(nt==="arrowleft"||nt==="pageup")&&(ye.preventDefault(),ye.stopPropagation(),Ws(-1))};return window.addEventListener("keydown",ie,!0),()=>window.removeEventListener("keydown",ie,!0)},[re,d,c,B,Ws,y,Ae,T,En]);const mo=re===null?C("app.panel.name"):re.label.length>0?re.label:re.cwd.split(/[\\/]/).filter(ie=>ie.length>0).pop()??re.cwd,go=a.jsx(eC,{projects:k,indexStatus:D,disabled:!c,onOpenProject:(ie,ye)=>{he(),T({cwd:ie,...ye!==void 0?{agent:ye}:{}})},agents:v,offerAgentChoice:r,agentForProject:ie=>Hy(f,ie,u,v,R),onOpenSession:(ie,ye)=>{he(),T({cwd:ie,resumeSessionId:ye.sessionId,agent:ye.agent,label:zn(ye.title,ye.titleSource)})},canResume:ie=>uf(v,ie),platform:u,onRefresh:P,openSessionIds:mn,openBlocked:ie=>pf(p,ie,u),onArchive:l,onHide:ot?he:ps,width:ei,onNewProject:()=>{he(),Ot("project")},vault:Qe.status,onOpenVault:()=>{he(),ht(!0)},onOpenVaultSession:K?null:ie=>Qe.openSession(ie.agent,ie.sessionId),onExportProject:K?null:Qe.exportProject,exporting:Qe.exporting,lastExported:Qe.lastExported,onContinueSession:(ie,ye)=>{he(),H({agent:ie.agent,sessionId:ie.sessionId},ye,df(zn(ie.title,ie.titleSource)))},globalSearch:Mt?{...Rt,vaultEnabled:((Co=Qe.status)==null?void 0:Co.enabled)===!0}:null,onOpenSearchHit:(ie,ye)=>{he(),xt(ie,ye)}}),_o=a.jsx("div",{className:"chat-stack",children:f.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("p",{children:C("app.empty.noTabs")}),a.jsx("p",{className:"empty-hint",children:C("app.empty.hint")}),c&&y.length>0&&a.jsx("button",{className:"primary-button",onClick:()=>T({cwd:y}),disabled:Ae,title:st??void 0,children:Ae?C("app.empty.opening"):C("app.empty.newSession",{cwd:y})})]}):a.jsx(Hb,{view:Bt,terminalId:d,threadFont:pe,onRewind:Le.rewind&&(re==null?void 0:re.alive)===!0?Ga:void 0,questionsAnswerable:Le.questionsAnswerable,contextWindowSource:Le.contextWindowSource,instructionsFile:fy(Me),onGoToCli:()=>{if(ot){qe("cli");return}ar||En(),Hs("cli")},cliPresence:re===null||re.alive?"live":re.sleeping?"sleeping":"exited",exitCode:(re==null?void 0:re.exitCode)??null,waking:d!==null&&O.has(d),onWakeCli:()=>{d!==null&&F(d)},discovering:Fs,continueTargets:ho,continueBlockedReason:qy((re==null?void 0:re.sessionId)??"",Fs,Bt.events.length>0),onContinue:re===null||Me===null?void 0:ie=>H({agent:Me,sessionId:re.sessionId},ie,df(Te??re.label)),searchRequest:Se,onSearchRequestApplied:Dt,toolCallNotice:xn,serverClosed:ui===null||fr===null?null:{state:ui,text:fr},statusLineState:(Ee==null?void 0:Ee.state)??null,onConfigureStatusLine:Ee===null?void 0:()=>nn(!0),activity:Xn,receipt:d===null?null:Yn.receipts.get(d)??null,clock:d===null?null:Yn.clocks.get(d)??null})}),vo=a.jsx(a.Fragment,{children:re!==null&&a.jsx(k1,{connection:i,drafts:ue,terminalId:d,alive:re.alive,sleeping:re.sleeping,projectColor:rr(re.cwd),activity:U.get(re.terminalId),imagesAllowed:Le.imagesAllowed,blockedReason:Bs,prefills:se,onPrefillApplied:le,notice:qa,onDismissNotice:d===null?void 0:()=>te(d),onSubmitted:(ie,ye,nt)=>{te(ie);const{events:Bn}=Bt,es=ie===d?Bn[Bn.length-1]:void 0;Yn.track(ie,ye,(es==null?void 0:es.eventId)??null,nt)},fontSize:pe.size,insertRef:Jn,leading:Le.modeCycle===null?void 0:a.jsx(mw,{mode:Bt.permissionMode,cycle:Le.modeCycle,disabled:!re.alive,waitingFor:Bt.waitingFor,statusKnown:Va,onChange:Bt.setPermissionMode}),controls:Le.models===null&&Le.efforts===null?void 0:a.jsx(pw,{models:Le.models,efforts:Le.efforts,model:Os,effort:Cn,modelProvisional:In,effortProvisional:jn,savesChoice:dy(Me),disabled:!re.alive,onCommand:fo})})}),yr=re===null?null:a.jsx(HC,{tab:ot?yf(De)??lr:lr,plansAvailable:Le.plansAvailable,hiddenTabs:ft.hidden,hidden:ot?yf(De)===null:!Jt,onTabChange:ot?qe:Hs,title:mo,cwd:re.cwd,platform:u,cli:a.jsx("div",{className:"terminal-stack",children:f.map(ie=>a.jsx(Pm,{terminalId:ie.terminalId,connection:i,active:ie.terminalId===d,theme:J.resolved,autoFocus:!1},ie.terminalId))}),cliUnseen:fs,expanded:Zi,onToggleExpanded:Ka,git:ct,files:co,plans:ai,documents:li,memory:hr,onInsert:Le.fileMentions&&re.alive?hi:void 0,onInsertPath:di,onReveal:K?null:Pn,onHide:En}),yo=re===null?null:a.jsx(X1,{connection:i,shells:Vt,activeShellId:(hs==null?void 0:hs.terminalId)??null,cwd:re.cwd,shellName:Gn,theme:J.resolved,onSelect:oo,onOpen:po,onCloseShell:pr,onCollapse:ot?()=>qe("chat"):Qn,onHide:ot?void 0:()=>mr("console"),hideCount:m.length}),wo=ft.isVisible("notes")?a.jsx(xk,{notes:Xe,fill:ot||re===null,onHide:ot?void 0:()=>mr("notes"),onSendNote:re===null||!Le.noteSendable?null:ie=>{const ye=re.cwd;T({cwd:ye,...re.agent!==null?{agent:re.agent}:{},onOpened:nt=>{i.send({type:"notes.send",noteId:ie,terminalId:nt.terminalId}),ot&&qe("chat")}})},sendTargetCwd:(re==null?void 0:re.cwd)??null}):null,Xa=re===null||!ft.isVisible("console")?null:a.jsx(a.Fragment,{children:cr?a.jsxs(a.Fragment,{children:[Jt&&a.jsx("div",{className:"hdivider",...Us,title:C("app.divider.consoleHeight")}),a.jsx("div",{className:"console-slot",style:Jt?{height:`${ti}px`}:{flex:"1 1 auto"},children:yo})]}):a.jsxs("div",{className:"strip-collapsed-row",children:[a.jsxs("button",{className:"strip-collapsed",onClick:Qn,title:Gn===null?C("console.openAnyIn",{cwd:re.cwd}):C("console.openIn",{shell:Gn,cwd:re.cwd}),children:[a.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),a.jsx("span",{children:Gn??C("console.name")}),Vt.length>0&&a.jsx("span",{className:"strip-collapsed-count",children:Vt.length})]}),a.jsx(Aa,{title:C("settings.hide.console"),onHide:()=>mr("console"),confirmText:m.length===0?null:C("settings.panels.consoleConfirm",{count:m.length})})]})}),bo=a.jsxs(a.Fragment,{children:[h==="revoked"&&a.jsx("div",{className:"banner banner-error",children:C("app.banner.revoked")}),io!==null&&a.jsxs("div",{className:"banner banner-notice",children:[a.jsx("span",{children:C("settings.hiddenHint",{name:C(io==="console"?"console.name":"notes.name")})}),a.jsx("button",{className:"banner-close",onClick:()=>ri(null),title:C("common.gotIt"),children:"×"})]}),!c&&_!==null&&a.jsx("div",{className:"banner banner-error banner-lines",children:_}),S==="child-session-marker"&&ro&&a.jsxs("div",{className:"banner banner-notice",children:[a.jsx("span",{children:zt("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),a.jsx("button",{className:"banner-close",onClick:Ya,title:C("common.gotIt"),children:"×"})]}),E!==null&&a.jsxs("div",{className:"banner banner-error",children:[a.jsx("span",{children:E.message}),a.jsx("button",{className:"banner-close",onClick:M,title:C("common.close"),children:"×"})]}),Qe.problem!==null&&!dt&&a.jsxs("div",{className:"banner banner-error",children:[a.jsx("span",{children:Qe.problem}),a.jsx("button",{className:"banner-close",onClick:Qe.dismissProblem,title:C("common.close"),children:"×"})]}),a.jsx(kS,{})]}),So=a.jsxs(a.Fragment,{children:[or&&Ee!==null&&fe!==null&&a.jsx(xS,{info:Ee,agentLabel:fe.label,onRefresh:$,onClose:()=>nn(!1)}),si&&a.jsx(iE,{onClose:()=>cs(!1),terminalTheme:J,panels:ft,consoleCount:ot?0:m.length,onHideConsole:gr,appSettings:ni,agents:v,remoteClient:K,onOpenVault:()=>{cs(!1),ht(!0)},onOpenRemote:$e.status!==null&&!K?()=>{cs(!1),We(!0)}:null}),za&&a.jsx(bS,{agent:Ly(Me,v,R),onClose:()=>yt(!1)}),ii==="project"&&a.jsx(Vf,{connection:i,title:C("app.picker.project.title"),confirmLabel:C("app.picker.project.confirm"),confirmTitle:ie=>C("app.picker.project.confirmTitle",{path:ie}),onChoose:(ie,ye)=>{Ot(null),T({cwd:ye})},onClose:()=>Ot(null)}),dt&&a.jsx(aE,{status:Qe.status,agents:v,indexReady:D.state==="ready",problem:Qe.problem,covered:ii==="vault",onMeasure:Qe.measure,onSetEnabled:Qe.setEnabled,onChangeDir:()=>Ot("vault"),onReveal:K?null:Qe.reveal,onDismissProblem:Qe.dismissProblem,onClose:()=>ht(!1)}),tt&&$e.status!==null&&!K&&a.jsx(yk,{status:$e.status,pairing:$e.pairing,phonePairing:$e.phonePairing,phoneStarted:$e.phoneStarted,problem:$e.problem,platform:u,onSetEnabled:$e.setEnabled,onSetPort:$e.setPort,onStartPairing:$e.startPairing,onCancelPairing:$e.cancelPairing,onStartPhonePairing:$e.startPhonePairing,onCancelPhonePairing:$e.cancelPhonePairing,onRenameDevice:$e.renameDevice,onRevokeDevice:$e.revokeDevice,onDismissProblem:$e.dismissProblem,onClose:()=>We(!1)}),ii==="vault"&&a.jsx(Vf,{connection:i,title:C("app.picker.vault.title"),confirmLabel:C("app.picker.vault.confirm"),confirmTitle:ie=>C("app.picker.vault.confirmTitle",{path:ie}),onChoose:ie=>{Qe.chooseDir(ie),Ot(null)},onClose:()=>Ot(null)})]});return ot?a.jsxs("div",{className:"app app-narrow",children:[a.jsx(Mk,{banners:bo,status:h,statusLabel:C(xp[h]),terminals:f,activeTerminalId:d,activity:U,agents:v,offerAgentChoice:r,newTabAgent:ve,canOpen:c&&y.length>0,newTabBlockedTitle:st,onSelectTab:ke,onCloseTab:B,onRenameTab:X,onNewTab:ie=>T({cwd:Be,...ie!==void 0?{agent:ie}:{}}),drawer:go,drawerOpen:Re,onDrawerChange:Ve,menu:{cwd:(re==null?void 0:re.cwd)??null,cliVersion:g,themeIcon:cp[W.preference],themeTitle:lp(W.preference),onCycleTheme:W.cycle,sound:de,remote:$e.status!==null&&!K?{title:`${C("app.header.remoteAccess")} — ${fu($e.status.state,$e.status.port)}`,active:_p($e.status),onOpen:()=>We(!0)}:null,remoteClient:K,onShortcuts:()=>yt(!0),onSettings:()=>cs(!0)},view:De,views:mt,onViewChange:qe,badges:{changes:cg(ct.status),plans:ai.plans.length,memory:((xo=hr.status)==null?void 0:xo.installed)===!0?hr.status.notes.length:0,cliUnseen:fs},chat:a.jsxs(a.Fragment,{children:[_o,vo]}),panel:yr,notes:wo,console:yo,onTerminalKey:ds===null?null:ao}),So]}):a.jsxs("div",{className:"app",children:[a.jsxs("header",{className:"app-header",children:[a.jsx("span",{className:"app-name",children:"Agent Workbench"}),a.jsx("span",{className:`status status-${h}`,children:C(xp[h])}),re!==null&&a.jsx("span",{className:"meta",title:re.cwd,children:re.cwd}),a.jsx("span",{className:"header-spacer"}),g!==null&&a.jsx("span",{className:"meta meta-dim",children:C("app.header.cliVersion",{version:g})}),a.jsx("button",{className:"icon-button",onClick:W.cycle,title:lp(W.preference),children:cp[W.preference]}),a.jsx(_g,{sound:de}),a.jsx(vg,{notify:de.notify}),$e.status!==null&&!K&&a.jsx("button",{className:`icon-button${_p($e.status)?" icon-button-on":""}`,onClick:()=>We(!0),title:`${C("app.header.remoteAccess")} — ${fu($e.status.state,$e.status.port)}`,children:"⇄"}),K&&a.jsx("span",{className:"remote-badge",title:C("app.header.remoteBadgeTitle"),children:C("app.header.remoteBadge")}),a.jsx("button",{className:"icon-button",onClick:()=>cs(!0),title:C("settings.open"),"aria-label":C("settings.open"),children:"⚙"}),a.jsx("button",{className:"icon-button",onClick:()=>yt(!0),title:C("app.header.shortcuts"),children:"?"})]}),bo,a.jsxs("div",{className:"app-body",children:[!Zr&&a.jsxs("button",{className:"panel-peek panel-peek-left",onClick:ps,title:C("app.sidebar.show"),children:[a.jsx("span",{className:"panel-peek-arrow",children:"»"}),a.jsx("span",{className:"panel-peek-label",children:C("app.sidebar.name")})]}),Zr&&go,Zr&&a.jsx("div",{className:"divider",...ms,title:C("app.divider.width")}),a.jsxs("main",{className:`workspace${us&&Sn?" workspace-narrow":""}`,children:[a.jsx(zC,{terminals:f,activeTerminalId:d,activity:U,canOpen:c&&y.length>0,onSelect:ke,onClose:B,onRename:X,onReorder:G,onNew:ie=>T({cwd:Be,...ie!==void 0?{agent:ie}:{}}),agents:v,offerAgentChoice:r,newTabAgent:ve,pendingOpens:p,platform:u,newTabBlockedTitle:st,sessionTitles:Ce}),_o,vo]}),a.jsxs(a.Fragment,{children:[!Sn&&a.jsxs("button",{className:"panel-peek",onClick:En,title:C("app.panel.show"),children:[a.jsx("span",{className:"panel-peek-arrow",children:"«"}),a.jsx("span",{className:"panel-peek-label",children:C("app.panel.name")})]}),Sn&&a.jsx("div",{className:"divider",...Zt,title:C("app.divider.width")}),a.jsxs("div",{className:`panel-slot${Sn?"":" panel-slot-collapsed"}${Sn&&us?" panel-slot-expanded":""}`,style:Sn&&!us?{width:`${Ps}px`}:void 0,children:[re!==null&&a.jsxs(a.Fragment,{children:[yr,Xa]}),wo]})]})]}),So]})}const Cg=document.getElementById("root");if(Cg===null)throw new Error("Falta el contenedor #root.");const gE=q_.createRoot(Cg);vb().then(()=>gE.render(a.jsx(mE,{})));export{B_ as g};