itwillsync 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/web-client/assets/{index-C_FteUer.css → index-BfDx-XdF.css} +1 -1
- package/dist/web-client/assets/index-BvGj1B-6.js +66 -0
- package/dist/web-client/index.html +21 -2
- package/package.json +1 -1
- package/dist/web-client/assets/index-D5whIj_8.js +0 -84
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const h of n.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&s(h)}).observe(document,{childList:!0,subtree:!0});function i(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=i(r);fetch(r.href,n)}})();/**
|
|
2
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
6
|
-
* @license MIT
|
|
7
|
-
*
|
|
8
|
-
* Originally forked from (with the author's permission):
|
|
9
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
10
|
-
* http://bellard.org/jslinux/
|
|
11
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
12
|
-
*/var Vr=Object.defineProperty,Gn=Object.getOwnPropertyDescriptor,Xn=(e,t)=>{for(var i in t)Vr(e,i,{get:t[i],enumerable:!0})},le=(e,t,i,s)=>{for(var r=s>1?void 0:s?Gn(t,i):t,n=e.length-1,h;n>=0;n--)(h=e[n])&&(r=(s?h(t,i,r):h(r))||r);return s&&r&&Vr(t,i,r),r},H=(e,t)=>(i,s)=>t(i,s,e),Vs="Terminal input",Gi={get:()=>Vs,set:e=>Vs=e},Gs="Too much output to announce, navigate to rows manually to read",Xi={get:()=>Gs,set:e=>Gs=e};function Yn(e){return e.replace(/\r?\n/g,"\r")}function jn(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Jn(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Zn(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Gr(r,t,i,s)}}function Gr(e,t,i,s){e=Yn(e),e=jn(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Xr(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Xs(e,t,i,s,r){Xr(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function lt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ei(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var Qn=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let h=e.charCodeAt(n);if(55296<=h&&h<=56319){if(++n>=i)return this._interim=h,s;let o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=(h-55296)*1024+o-56320+65536:(t[s++]=h,t[s++]=o);continue}h!==65279&&(t[s++]=h)}return s}},eo=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,h,o,l=0,a=0;if(this.interim[0]){let g=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let f=0,d;for(;(d=this.interim[++f]&63)&&f<4;)v<<=6,v|=d;let u=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=u-f;for(;a<b;){if(a>=i)return 0;if(d=e[a++],(d&192)!==128){a--,g=!0;break}else this.interim[f++]=d,v<<=6,v|=d&63}g||(u===2?v<128?a--:t[s++]=v:u===3?v<2048||v>=55296&&v<=57343||v===65279||(t[s++]=v):v<65536||v>1114111||(t[s++]=v)),this.interim.fill(0)}let _=i-4,c=a;for(;c<i;){for(;c<_&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((h=e[c+2])&128)&&!((o=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=h,t[s++]=o,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(l=(r&31)<<6|n&63,l<128){c--;continue}t[s++]=l}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(h=e[c++],(h&192)!==128){c--;continue}if(l=(r&15)<<12|(n&63)<<6|h&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(h=e[c++],(h&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=h,s;if(o=e[c++],(o&192)!==128){c--;continue}if(l=(r&7)<<18|(n&63)<<12|(h&63)<<6|o&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},Yr="",ct=" ",Jt=class jr{constructor(){this.fg=0,this.bg=0,this.extended=new mi}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new jr;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},mi=class Jr{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Jr(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ue=class Zr extends Jt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mi,this.combinedData=""}static fromCharData(t){let i=new Zr;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?lt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ys="di$target",Yi="di$dependencies",Bi=new Map;function to(e){return e[Yi]||[]}function xe(e){if(Bi.has(e))return Bi.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");io(t,i,r)};return t._id=e,Bi.set(e,t),t}function io(e,t,i){t[Ys]===t?t[Yi].push({id:e,index:i}):(t[Yi]=[{id:e,index:i}],t[Ys]=t)}var Be=xe("BufferService"),Qr=xe("CoreMouseService"),yt=xe("CoreService"),so=xe("CharsetService"),Bs=xe("InstantiationService"),en=xe("LogService"),Ae=xe("OptionsService"),tn=xe("OscLinkService"),ro=xe("UnicodeService"),Zt=xe("DecorationService"),ji=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var _;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Ue,h=i.getTrimmedLength(),o=-1,l=-1,a=!1;for(let c=0;c<h;c++)if(!(l===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=c,o=n.extended.urlId;continue}else a=n.extended.urlId!==o;else l!==-1&&(a=!0);if(a||l!==-1&&c===h-1){let g=(_=this._oscLinkService.getLinkData(o))==null?void 0:_.uri;if(g){let v={start:{x:l+1,y:e},end:{x:c+(!a&&c===h-1?1:0),y:e}},f=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{let d=new URL(g);["http:","https:"].includes(d.protocol)||(f=!0)}catch{f=!0}f||s.push({text:g,range:v,activate:(d,u)=>r?r.activate(d,u,v):no(d,u),hover:(d,u)=>{var b;return(b=r==null?void 0:r.hover)==null?void 0:b.call(r,d,u,v)},leave:(d,u)=>{var b;return(b=r==null?void 0:r.leave)==null?void 0:b.call(r,d,u,v)}})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=c,o=n.extended.urlId):(l=-1,o=-1)}}t(s)}};ji=le([H(0,Be),H(1,Ae),H(2,tn)],ji);function no(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
13
|
-
|
|
14
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Li=xe("CharSizeService"),rt=xe("CoreBrowserService"),As=xe("MouseService"),nt=xe("RenderService"),oo=xe("SelectionService"),sn=xe("CharacterJoinerService"),Mt=xe("ThemeService"),rn=xe("LinkProviderService"),ao=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?js.isErrorNoTelemetry(e)?new js(e.message+`
|
|
15
|
-
|
|
16
|
-
`+e.stack):new Error(e.message+`
|
|
17
|
-
|
|
18
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},ho=new ao;function di(e){lo(e)||ho.onUnexpectedError(e)}var Ji="Canceled";function lo(e){return e instanceof co?!0:e instanceof Error&&e.name===Ji&&e.message===Ji}var co=class extends Error{constructor(){super(Ji),this.name=this.message}};function uo(e){return new Error(`Illegal argument: ${e}`)}var js=class Zi extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Zi)return t;let i=new Zi;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Qi=class nn extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,nn.prototype)}};function Oe(e,t=0){return e[e.length-(1+t)]}var _o;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(_o||(_o={}));function fo(e,t){let i=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(i,arguments))),r}}var on;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(R){yield R}e.single=r;function n(R){return t(R)?R:r(R)}e.wrap=n;function h(R){return R||i}e.from=h;function*o(R){for(let A=R.length-1;A>=0;A--)yield R[A]}e.reverse=o;function l(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=l;function a(R){return R[Symbol.iterator]().next().value}e.first=a;function _(R,A){let S=0;for(let D of R)if(A(D,S++))return!0;return!1}e.some=_;function c(R,A){for(let S of R)if(A(S))return S}e.find=c;function*g(R,A){for(let S of R)A(S)&&(yield S)}e.filter=g;function*v(R,A){let S=0;for(let D of R)yield A(D,S++)}e.map=v;function*f(R,A){let S=0;for(let D of R)yield*A(D,S++)}e.flatMap=f;function*d(...R){for(let A of R)yield*A}e.concat=d;function u(R,A,S){let D=S;for(let k of R)D=A(D,k);return D}e.reduce=u;function*b(R,A,S=R.length){for(A<0&&(A+=R.length),S<0?S+=R.length:S>R.length&&(S=R.length);A<S;A++)yield R[A]}e.slice=b;function P(R,A=Number.POSITIVE_INFINITY){let S=[];if(A===0)return[S,R];let D=R[Symbol.iterator]();for(let k=0;k<A;k++){let C=D.next();if(C.done)return[S,e.empty()];S.push(C.value)}return[S,{[Symbol.iterator](){return D}}]}e.consume=P;async function L(R){let A=[];for await(let S of R)A.push(S);return Promise.resolve(A)}e.asyncToArray=L})(on||(on={}));function bt(e){if(on.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function go(...e){return ne(()=>bt(e))}function ne(e){return{dispose:fo(()=>{e()})}}var an=class hn{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bt(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?hn.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};an.DISABLE_DISPOSED_WARNING=!1;var dt=an,V=class{constructor(){this._store=new dt,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};V.None=Object.freeze({dispose(){}});var Rt=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},it=typeof window=="object"?window:globalThis,es=class ts{constructor(t){this.element=t,this.next=ts.Undefined,this.prev=ts.Undefined}};es.Undefined=new es(void 0);var oe=es,Js=class{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let e=this._first;for(;e!==oe.Undefined;){let t=e.next;e.prev=oe.Undefined,e.next=oe.Undefined,e=t}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new oe(e);if(this._first===oe.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oe.Undefined&&e.next!==oe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===oe.Undefined&&e.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):e.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):e.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oe.Undefined;)yield e.element,e=e.next}},po=globalThis.performance&&typeof globalThis.performance.now=="function",vo=class ln{static create(t){return new ln(t)}constructor(t){this._now=po&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ke;(e=>{e.None=()=>V.None;function t(p,w){return c(p,()=>{},0,void 0,!0,void 0,w)}e.defer=t;function i(p){return(w,y=null,M)=>{let B=!1,T;return T=p(x=>{if(!B)return T?T.dispose():B=!0,w.call(y,x)},null,M),B&&T.dispose(),T}}e.once=i;function s(p,w,y){return a((M,B=null,T)=>p(x=>M.call(B,w(x)),null,T),y)}e.map=s;function r(p,w,y){return a((M,B=null,T)=>p(x=>{w(x),M.call(B,x)},null,T),y)}e.forEach=r;function n(p,w,y){return a((M,B=null,T)=>p(x=>w(x)&&M.call(B,x),null,T),y)}e.filter=n;function h(p){return p}e.signal=h;function o(...p){return(w,y=null,M)=>{let B=go(...p.map(T=>T(x=>w.call(y,x))));return _(B,M)}}e.any=o;function l(p,w,y,M){let B=y;return s(p,T=>(B=w(B,T),B),M)}e.reduce=l;function a(p,w){let y,M={onWillAddFirstListener(){y=p(B.fire,B)},onDidRemoveLastListener(){y==null||y.dispose()}},B=new I(M);return w==null||w.add(B),B.event}function _(p,w){return w instanceof Array?w.push(p):w&&w.add(p),p}function c(p,w,y=100,M=!1,B=!1,T,x){let F,N,q,$=0,G,U={leakWarningThreshold:T,onWillAddFirstListener(){F=p(J=>{$++,N=w(N,J),M&&!q&&(ce.fire(N),N=void 0),G=()=>{let Y=N;N=void 0,q=void 0,(!M||$>1)&&ce.fire(Y),$=0},typeof y=="number"?(clearTimeout(q),q=setTimeout(G,y)):q===void 0&&(q=0,queueMicrotask(G))})},onWillRemoveListener(){B&&$>0&&(G==null||G())},onDidRemoveLastListener(){G=void 0,F.dispose()}},ce=new I(U);return x==null||x.add(ce),ce.event}e.debounce=c;function g(p,w=0,y){return e.debounce(p,(M,B)=>M?(M.push(B),M):[B],w,void 0,!0,void 0,y)}e.accumulate=g;function v(p,w=(M,B)=>M===B,y){let M=!0,B;return n(p,T=>{let x=M||!w(T,B);return M=!1,B=T,x},y)}e.latch=v;function f(p,w,y){return[e.filter(p,w,y),e.filter(p,M=>!w(M),y)]}e.split=f;function d(p,w=!1,y=[],M){let B=y.slice(),T=p(N=>{B?B.push(N):F.fire(N)});M&&M.add(T);let x=()=>{B==null||B.forEach(N=>F.fire(N)),B=null},F=new I({onWillAddFirstListener(){T||(T=p(N=>F.fire(N)),M&&M.add(T))},onDidAddFirstListener(){B&&(w?setTimeout(x):x())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return M&&M.add(F),F.event}e.buffer=d;function u(p,w){return(y,M,B)=>{let T=w(new P);return p(function(x){let F=T.evaluate(x);F!==b&&y.call(M,F)},void 0,B)}}e.chain=u;let b=Symbol("HaltChainable");class P{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(y=>(w(y),y)),this}filter(w){return this.steps.push(y=>w(y)?y:b),this}reduce(w,y){let M=y;return this.steps.push(B=>(M=w(M,B),M)),this}latch(w=(y,M)=>y===M){let y=!0,M;return this.steps.push(B=>{let T=y||!w(B,M);return y=!1,M=B,T?B:b}),this}evaluate(w){for(let y of this.steps)if(w=y(w),w===b)break;return w}}function L(p,w,y=M=>M){let M=(...F)=>x.fire(y(...F)),B=()=>p.on(w,M),T=()=>p.removeListener(w,M),x=new I({onWillAddFirstListener:B,onDidRemoveLastListener:T});return x.event}e.fromNodeEventEmitter=L;function R(p,w,y=M=>M){let M=(...F)=>x.fire(y(...F)),B=()=>p.addEventListener(w,M),T=()=>p.removeEventListener(w,M),x=new I({onWillAddFirstListener:B,onDidRemoveLastListener:T});return x.event}e.fromDOMEventEmitter=R;function A(p){return new Promise(w=>i(p)(w))}e.toPromise=A;function S(p){let w=new I;return p.then(y=>{w.fire(y)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}e.fromPromise=S;function D(p,w){return p(y=>w.fire(y))}e.forward=D;function k(p,w,y){return w(y),p(M=>w(M))}e.runAndSubscribe=k;class C{constructor(w,y){this._observable=w,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new I(M),y&&y.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,y){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function m(p,w){return new C(p,w).emitter.event}e.fromObservable=m;function E(p){return(w,y,M)=>{let B=0,T=!1,x={beginUpdate(){B++},endUpdate(){B--,B===0&&(p.reportChanges(),T&&(T=!1,w.call(y)))},handlePossibleChange(){},handleChange(){T=!0}};p.addObserver(x),p.reportChanges();let F={dispose(){p.removeObserver(x)}};return M instanceof dt?M.add(F):Array.isArray(M)&&M.push(F),F}}e.fromObservableLight=E})(ke||(ke={}));var is=class ss{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ss._idPool++}`,ss.all.add(this)}start(t){this._stopWatch=new vo,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};is.all=new Set,is._idPool=0;var mo=is,So=-1,cn=class dn{constructor(t,i,s=(dn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,h]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${h}):`;console.warn(o),console.warn(n);let l=new Co(o,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};cn._idPool=1;var wo=cn,bo=class un{constructor(t){this.value=t}static create(){let t=new Error;return new un(t.stack??"")}print(){console.warn(this.value.split(`
|
|
19
|
-
`).slice(2).join(`
|
|
20
|
-
`))}},Co=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},yo=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},xo=0,Ai=class{constructor(e){this.value=e,this.id=xo++}},Eo=2,Lo,I=class{constructor(e){var t,i,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new wo((e==null?void 0:e.onListenerError)??di,((i=this._options)==null?void 0:i.leakWarningThreshold)??So):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new mo(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var h,o,l,a,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let g=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new yo(`${c}. HINT: Stack shows most frequent listener (${g[1]}-times)`,g[0]);return(((h=this._options)==null?void 0:h.onListenerError)||di)(v),V.None}if(this._disposed)return V.None;t&&(e=e.bind(t));let s=new Ai(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=bo.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Ai?(this._deliveryQueue??(this._deliveryQueue=new ko),this._listeners=[this._listeners,s]):this._listeners.push(s):((l=(o=this._options)==null?void 0:o.onWillAddFirstListener)==null||l.call(o,this),this._listeners=s,(_=(a=this._options)==null?void 0:a.onDidAddFirstListener)==null||_.call(a,this)),this._size++;let n=ne(()=>{r==null||r(),this._removeListener(s)});return i instanceof dt?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var r,n,h,o;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(o=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||o.call(h,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Eo<=t.length){let l=0;for(let a=0;a<t.length;a++)t[a]?t[l++]=t[a]:s&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){var s;if(!e)return;let i=((s=this._options)==null?void 0:s.onListenerError)||di;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Ai)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},ko=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rs=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new I,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new I,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};rs.INSTANCE=new rs;var Ts=rs;function Ro(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Ts.INSTANCE.onDidChangeZoomLevel;function Mo(e){return Ts.INSTANCE.getZoomFactor(e)}Ts.INSTANCE.onDidChangeFullscreen;var Dt=typeof navigator=="object"?navigator.userAgent:"",ns=Dt.indexOf("Firefox")>=0,Do=Dt.indexOf("AppleWebKit")>=0,Ps=Dt.indexOf("Chrome")>=0,Bo=!Ps&&Dt.indexOf("Safari")>=0;Dt.indexOf("Electron/")>=0;Dt.indexOf("Android")>=0;var Ti=!1;if(typeof it.matchMedia=="function"){let e=it.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=it.matchMedia("(display-mode: fullscreen)");Ti=e.matches,Ro(it,e,({matches:i})=>{Ti&&t.matches||(Ti=i)})}var kt="en",os=!1,as=!1,ui=!1,_n=!1,ni,_i=kt,Zs=kt,Ao,Ve,wt=globalThis,Le,Ur;typeof wt.vscode<"u"&&typeof wt.vscode.process<"u"?Le=wt.vscode.process:typeof process<"u"&&typeof((Ur=process==null?void 0:process.versions)==null?void 0:Ur.node)=="string"&&(Le=process);var qr,To=typeof((qr=Le==null?void 0:Le.versions)==null?void 0:qr.electron)=="string",Po=To&&(Le==null?void 0:Le.type)==="renderer",Kr;if(typeof Le=="object"){os=Le.platform==="win32",as=Le.platform==="darwin",ui=Le.platform==="linux",ui&&Le.env.SNAP&&Le.env.SNAP_REVISION,Le.env.CI||Le.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ni=kt,_i=kt;let e=Le.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ni=t.userLocale,Zs=t.osLocale,_i=t.resolvedLanguage||kt,Ao=(Kr=t.languagePack)==null?void 0:Kr.translationsConfigFile}catch{}_n=!0}else typeof navigator=="object"&&!Po?(Ve=navigator.userAgent,os=Ve.indexOf("Windows")>=0,as=Ve.indexOf("Macintosh")>=0,(Ve.indexOf("Macintosh")>=0||Ve.indexOf("iPad")>=0||Ve.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ui=Ve.indexOf("Linux")>=0,(Ve==null?void 0:Ve.indexOf("Mobi"))>=0,_i=globalThis._VSCODE_NLS_LANGUAGE||kt,ni=navigator.language.toLowerCase(),Zs=ni):console.error("Unable to resolve platform.");var fn=os,Je=as,Oo=ui,Qs=_n,Ze=Ve,ot=_i,Io;(e=>{function t(){return ot}e.value=t;function i(){return ot.length===2?ot==="en":ot.length>=3?ot[0]==="e"&&ot[1]==="n"&&ot[2]==="-":!1}e.isDefaultVariant=i;function s(){return ot==="en"}e.isDefault=s})(Io||(Io={}));var Fo=typeof wt.postMessage=="function"&&!wt.importScripts;(()=>{if(Fo){let e=[];wt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),wt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var No=!!(Ze&&Ze.indexOf("Chrome")>=0);Ze&&Ze.indexOf("Firefox")>=0;!No&&Ze&&Ze.indexOf("Safari")>=0;Ze&&Ze.indexOf("Edg/")>=0;Ze&&Ze.indexOf("Android")>=0;var xt=typeof navigator=="object"?navigator:{};Qs||document.queryCommandSupported&&document.queryCommandSupported("copy")||xt&&xt.clipboard&&xt.clipboard.writeText,Qs||xt&&xt.clipboard&&xt.clipboard.readText;var Os=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Pi=new Os,er=new Os,tr=new Os,Ho=new Array(230),gn;(e=>{function t(o){return Pi.keyCodeToStr(o)}e.toString=t;function i(o){return Pi.strToKeyCode(o)}e.fromString=i;function s(o){return er.keyCodeToStr(o)}e.toUserSettingsUS=s;function r(o){return tr.keyCodeToStr(o)}e.toUserSettingsGeneral=r;function n(o){return er.strToKeyCode(o)||tr.strToKeyCode(o)}e.fromUserSettings=n;function h(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Pi.keyCodeToStr(o)}e.toElectronAccelerator=h})(gn||(gn={}));var Wo=class pn{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof pn&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new zo([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},zo=class{constructor(e){if(e.length===0)throw uo("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function $o(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return gn.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(ns)switch(t){case 59:return 85;case 60:if(Oo)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Je)return 57;break}else if(Do&&(Je&&t===93||!Je&&t===92))return 57;return Ho[t]||0}var Uo=Je?256:2048,qo=512,Ko=1024,Vo=Je?2048:256,ir=class{constructor(e){var i;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=$o(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Uo),this.altKey&&(t|=qo),this.shiftKey&&(t|=Ko),this.metaKey&&(t|=Vo),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Wo(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},sr=new WeakMap;function Go(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Xo=class{static getSameOriginWindowChain(e){let t=sr.get(e);if(!t){t=[],sr.set(e,t);let i=e,s;do s=Go(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let h=n.window.deref();if(i+=(h==null?void 0:h.scrollY)??0,s+=(h==null?void 0:h.scrollX)??0,h===t||!n.iframeElement)break;let o=n.iframeElement.getBoundingClientRect();i+=o.top,s+=o.left}return{top:i,left:s}}},oi=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=Xo.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},rr=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(Ps){let n=navigator.userAgent.match(/Chrome\/(\d+)/);s=(n?parseInt(n[1]):123)<=122}if(e){let n=e,h=e,o=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")s?this.deltaY=n.wheelDeltaY/(120*o):this.deltaY=n.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?ns&&!Je?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")Bo&&fn?this.deltaX=-(n.wheelDeltaX/120):s?this.deltaX=n.wheelDeltaX/(120*o):this.deltaX=n.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?ns&&!Je?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*o):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},vn=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Yo;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof jo?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ke.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:vn})})(Yo||(Yo={}));var jo=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?vn:(this._emitter||(this._emitter=new I),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Is=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Qi("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Qi("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Jo=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Qi("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=ne(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Zo;(e=>{async function t(s){let r,n=await Promise.all(s.map(h=>h.then(o=>o,o=>{r||(r=o)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(h){n(h)}})}e.withAsyncBody=i})(Zo||(Zo={}));var nr=class We{static fromArray(t){return new We(i=>{i.emitMany(t)})}static fromPromise(t){return new We(async i=>{i.emitMany(await t)})}static fromPromises(t){return new We(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new We(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new I,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ke.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new We(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return We.map(this,t)}static filter(t,i){return new We(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return We.filter(this,t)}static coalesce(t){return We.filter(t,i=>!!i)}coalesce(){return We.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return We.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};nr.EMPTY=nr.fromArray([]);var{getWindow:je,getWindowId:Qo,onDidRegisterWindow:ea}=(function(){let e=new Map,t={window:it,disposables:new dt};e.set(it.vscodeWindowId,t);let i=new I,s=new I,r=new I;function n(h,o){return(typeof h=="number"?e.get(h):void 0)??(o?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(h){if(e.has(h.vscodeWindowId))return V.None;let o=new dt,l={window:h,disposables:o.add(new dt)};return e.set(h.vscodeWindowId,l),o.add(ne(()=>{e.delete(h.vscodeWindowId),s.fire(h)})),o.add(z(h,we.BEFORE_UNLOAD,()=>{r.fire(h)})),i.fire(l),o},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:n,getWindow(h){var a;let o=h;if((a=o==null?void 0:o.ownerDocument)!=null&&a.defaultView)return o.ownerDocument.defaultView.window;let l=h;return l!=null&&l.view?l.view.window:it},getDocument(h){return je(h).document}}})(),ta=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function z(e,t,i,s){return new ta(e,t,i,s)}var or=function(e,t,i,s){return z(e,t,i,s)},Fs,ia=class extends Jo{constructor(e){super(),this.defaultTarget=e&&je(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},ar=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){di(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let h=e.get(n)??[];for(t.set(n,h),e.set(n,[]),s.set(n,!0);h.length>0;)h.sort(ar.sort),h.shift().execute();s.set(n,!1)};Fs=(n,h,o=0)=>{let l=Qo(n),a=new ar(h,o),_=e.get(l);return _||(_=[],e.set(l,_)),_.push(a),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>r(l))),a}})();function sa(e){let t=e.getBoundingClientRect(),i=je(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var we={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},ra=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Te(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Te(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Te(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Te(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Te(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Te(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Te(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Te(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Te(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Te(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Te(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Te(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Te(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Te(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Te(e){return typeof e=="number"?`${e}px`:e}function Vt(e){return new ra(e)}var mn=class{constructor(){this._hooks=new dt,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(ne(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=je(e)}this._hooks.add(z(n,we.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(z(n,we.POINTER_UP,h=>this.stopMonitoring(!0)))}};function na(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...h){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,h)}),this[n]}}var Ye;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ye||(Ye={}));var zt=class Me extends V{constructor(){super(),this.dispatched=!1,this.targets=new Js,this.ignoreTargets=new Js,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ke.runAndSubscribe(ea,({window:t,disposables:i})=>{i.add(z(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(z(t.document,"touchend",s=>this.onTouchEnd(t,s))),i.add(z(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:it,disposables:this._store}))}static addTarget(t){if(!Me.isTouchDevice())return V.None;Me.INSTANCE||(Me.INSTANCE=new Me);let i=Me.INSTANCE.targets.push(t);return ne(i)}static ignoreTarget(t){if(!Me.isTouchDevice())return V.None;Me.INSTANCE||(Me.INSTANCE=new Me);let i=Me.INSTANCE.ignoreTargets.push(t);return ne(i)}static isTouchDevice(){return"ontouchstart"in it||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let h=this.newGestureEvent(Ye.Start,n.target);h.pageX=n.pageX,h.pageY=n.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,h=i.changedTouches.length;n<h;n++){let o=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let l=this.activeTouches[o.identifier],a=Date.now()-l.initialTimeStamp;if(a<Me.HOLD_DELAY&&Math.abs(l.initialPageX-Oe(l.rollingPageX))<30&&Math.abs(l.initialPageY-Oe(l.rollingPageY))<30){let _=this.newGestureEvent(Ye.Tap,l.initialTarget);_.pageX=Oe(l.rollingPageX),_.pageY=Oe(l.rollingPageY),this.dispatchEvent(_)}else if(a>=Me.HOLD_DELAY&&Math.abs(l.initialPageX-Oe(l.rollingPageX))<30&&Math.abs(l.initialPageY-Oe(l.rollingPageY))<30){let _=this.newGestureEvent(Ye.Contextmenu,l.initialTarget);_.pageX=Oe(l.rollingPageX),_.pageY=Oe(l.rollingPageY),this.dispatchEvent(_)}else if(r===1){let _=Oe(l.rollingPageX),c=Oe(l.rollingPageY),g=Oe(l.rollingTimestamps)-l.rollingTimestamps[0],v=_-l.rollingPageX[0],f=c-l.rollingPageY[0],d=[...this.targets].filter(u=>l.initialTarget instanceof Node&&u.contains(l.initialTarget));this.inertia(t,d,s,Math.abs(v)/g,v>0?1:-1,_,Math.abs(f)/g,f>0?1:-1,c)}this.dispatchEvent(this.newGestureEvent(Ye.End,l.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===Ye.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>Me.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===Ye.Change||t.type===Ye.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,h,o,l,a){this.handle=Fs(t,()=>{let _=Date.now(),c=_-s,g=0,v=0,f=!0;r+=Me.SCROLL_FRICTION*c,o+=Me.SCROLL_FRICTION*c,r>0&&(f=!1,g=n*r*c),o>0&&(f=!1,v=l*o*c);let d=this.newGestureEvent(Ye.Change);d.translationX=g,d.translationY=v,i.forEach(u=>u.dispatchEvent(d)),f||this.inertia(t,i,_,r,n,h+g,o,l,a+v)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let h=this.activeTouches[n.identifier],o=this.newGestureEvent(Ye.Change,h.initialTarget);o.translationX=n.pageX-Oe(h.rollingPageX),o.translationY=n.pageY-Oe(h.rollingPageY),o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(n.pageX),h.rollingPageY.push(n.pageY),h.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};zt.SCROLL_FRICTION=-.005,zt.HOLD_DELAY=700,zt.CLEAR_TAP_COUNT_TIME=400,le([na],zt,"isTouchDevice",1);var oa=zt,Ns=class extends V{onclick(e,t){this._register(z(e,we.CLICK,i=>t(new oi(je(e),i))))}onmousedown(e,t){this._register(z(e,we.MOUSE_DOWN,i=>t(new oi(je(e),i))))}onmouseover(e,t){this._register(z(e,we.MOUSE_OVER,i=>t(new oi(je(e),i))))}onmouseleave(e,t){this._register(z(e,we.MOUSE_LEAVE,i=>t(new oi(je(e),i))))}onkeydown(e,t){this._register(z(e,we.KEY_DOWN,i=>t(new ir(i))))}onkeyup(e,t){this._register(z(e,we.KEY_UP,i=>t(new ir(i))))}oninput(e,t){this._register(z(e,we.INPUT,t))}onblur(e,t){this._register(z(e,we.BLUR,t))}onfocus(e,t){this._register(z(e,we.FOCUS,t))}onchange(e,t){this._register(z(e,we.CHANGE,t))}ignoreGesture(e){return oa.ignoreTarget(e)}},hr=11,aa=class extends Ns{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=hr+"px",this.domNode.style.height=hr+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new mn),this._register(or(this.bgDomNode,we.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(or(this.domNode,we.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new ia),this._pointerdownScheduleRepeatTimer=this._register(new Is)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,je(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ha=class hs{constructor(t,i,s,r,n,h,o){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,h=h|0,o=o|0),this.rawScrollLeft=r,this.rawScrollTop=o,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),o+n>h&&(o=h-n),o<0&&(o=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=h,this.scrollTop=o}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new hs(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new hs(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,o=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:h,scrollHeightChanged:o,scrollTopChanged:l}}},la=class extends V{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ha(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new cr(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=cr.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},lr=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Oi(e,t){let i=t-e;return function(s){return e+i*ua(s)}}function ca(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var cr=class ls{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+.75*s,n=i-.75*s):(r=t-.75*s,n=i+.75*s),ca(Oi(t,r),Oi(n,i),.33)}return Oi(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new lr(s,r,!1)}return new lr(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return ls.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new ls(t,i,r,s)}};function da(e){return Math.pow(e,3)}function ua(e){return 1-da(1-e)}var _a=class extends V{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Is)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},fa=140,Sn=class extends Ns{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new _a(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new mn),this._shouldRender=!0,this.domNode=Vt(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(z(this.domNode.domNode,we.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new aa(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=Vt(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(z(this.slider.domNode,we.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=sa(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let n=this._sliderOrthogonalPointerPosition(r),h=Math.abs(n-i);if(fn&&h>fa){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let o=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},wn=class cs{constructor(t,i,s,r,n,h){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new cs(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let h=Math.max(0,s-t),o=Math.max(0,h-2*i),l=r>0&&r>s;if(!l)return{computedAvailableSize:Math.round(h),computedIsNeeded:l,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*o/r))),_=(o-a)/(r-s),c=n*_;return{computedAvailableSize:Math.round(h),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:_,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=cs._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},ga=class extends Sn{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new wn(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},pa=class extends Sn{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new wn(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},va=500,dr=50,ma=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},ds=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(Ps){let i=je(t.browserEvent),s=Mo(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new ma(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),h=Math.abs(i.deltaX),o=Math.abs(i.deltaY),l=Math.max(Math.min(r,h),1),a=Math.max(Math.min(n,o),1),_=Math.max(r,h),c=Math.max(n,o);_%l===0&&c%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ds.INSTANCE=new ds;var Sa=ds,wa=class extends Ns{constructor(e,t,i){super(),this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new I),this.onWillScroll=this._onWillScroll.event,this._options=Ca(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new pa(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new ga(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Vt(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vt(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vt(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new Is),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=bt(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Je&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new rr(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=bt(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new rr(i))};this._mouseWheelToDispose.push(z(this._listenOnDomNode,we.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=Sa.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+n===0?h=n=0:Math.abs(n)>=Math.abs(h)?h=0:n=0),this._options.flipAxes&&([n,h]=[h,n]);let o=!Je&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!h&&(h=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),a={};if(n){let _=dr*n,c=l.scrollTop-(_<0?Math.floor(_):Math.ceil(_));this._verticalScrollbar.writeScrollPosition(a,c)}if(h){let _=dr*h,c=l.scrollLeft-(_<0?Math.floor(_):Math.ceil(_));this._horizontalScrollbar.writeScrollPosition(a,c)}a=this._scrollable.validateScrollPosition(a),(l.scrollLeft!==a.scrollLeft||l.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),va)}},ba=class extends wa{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Ca(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Je&&(t.className+=" mac"),t}var us=class extends V{constructor(e,t,i,s,r,n,h,o){super(),this._bufferService=i,this._optionsService=h,this._renderService=o,this._onRequestScrollLines=this._register(new I),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new la({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:a=>Fs(s.window,a)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ba(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(a=>{this._scrollableElement.updateOptions({handleMouseWheel:!(a&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ke.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ne(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ne(()=>this._styleElement.remove())),this._register(ke.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
21
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(a=>this._handleScroll(a)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};us=le([H(2,Be),H(3,rt),H(4,Qr),H(5,Mt),H(6,Ae),H(7,nt)],us);var _s=class extends V{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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(n=>this._removeDecoration(n))),this._register(ne(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};_s=le([H(1,Be),H(2,rt),H(3,Zt),H(4,nt)],_s);var ya=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ge={full:0,left:0,center:0,right:0},at={full:0,left:0,center:0,right:0},Ot={full:0,left:0,center:0,right:0},Si=class extends V{constructor(e,t,i,s,r,n,h,o){var a;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=h,this._coreBrowserService=o,this._colorZoneStore=new ya,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(),(a=this._viewportElement.parentElement)==null||a.insertBefore(this._canvas,this._viewportElement),this._register(ne(()=>{var _;return(_=this._canvas)==null?void 0:_.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);at.full=this._canvas.width,at.left=e,at.center=t,at.right=e,this._refreshDrawHeightConstants(),Ot.full=1,Ot.left=1,Ot.center=1+at.left,Ot.right=1+at.left+at.center}_refreshDrawHeightConstants(){Ge.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ge.left=t,Ge.center=t,Ge.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ot[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ge[e.position||"full"]/2),at[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ge[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Si=le([H(2,Be),H(3,Zt),H(4,nt),H(5,Ae),H(6,Mt),H(7,rt)],Si);var O;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
22
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(O||(O={}));var fi;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(fi||(fi={}));var bn;(e=>e.ST=`${O.ESC}\\`)(bn||(bn={}));var fs=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${O.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};fs=le([H(2,Be),H(3,Ae),H(4,yt),H(5,nt)],fs);var be=0,Ce=0,ye=0,he=0,ur={css:"#00000000",rgba:0},ge;(e=>{function t(r,n,h,o){return o!==void 0?`#${ft(r)}${ft(n)}${ft(h)}${ft(o)}`:`#${ft(r)}${ft(n)}${ft(h)}`}e.toCss=t;function i(r,n,h,o=255){return(r<<24|n<<16|h<<8|o)>>>0}e.toRgba=i;function s(r,n,h,o){return{css:e.toCss(r,n,h,o),rgba:e.toRgba(r,n,h,o)}}e.toColor=s})(ge||(ge={}));var re;(e=>{function t(l,a){if(he=(a.rgba&255)/255,he===1)return{css:a.css,rgba:a.rgba};let _=a.rgba>>24&255,c=a.rgba>>16&255,g=a.rgba>>8&255,v=l.rgba>>24&255,f=l.rgba>>16&255,d=l.rgba>>8&255;be=v+Math.round((_-v)*he),Ce=f+Math.round((c-f)*he),ye=d+Math.round((g-d)*he);let u=ge.toCss(be,Ce,ye),b=ge.toRgba(be,Ce,ye);return{css:u,rgba:b}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function s(l,a,_){let c=gi.ensureContrastRatio(l.rgba,a.rgba,_);if(c)return ge.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=s;function r(l){let a=(l.rgba|255)>>>0;return[be,Ce,ye]=gi.toChannels(a),{css:ge.toCss(be,Ce,ye),rgba:a}}e.opaque=r;function n(l,a){return he=Math.round(a*255),[be,Ce,ye]=gi.toChannels(l.rgba),{css:ge.toCss(be,Ce,ye,he),rgba:ge.toRgba(be,Ce,ye,he)}}e.opacity=n;function h(l,a){return he=l.rgba&255,n(l,he*a/255)}e.multiplyOpacity=h;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=o})(re||(re={}));var ae;(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return be=parseInt(r.slice(1,2).repeat(2),16),Ce=parseInt(r.slice(2,3).repeat(2),16),ye=parseInt(r.slice(3,4).repeat(2),16),ge.toColor(be,Ce,ye);case 5:return be=parseInt(r.slice(1,2).repeat(2),16),Ce=parseInt(r.slice(2,3).repeat(2),16),ye=parseInt(r.slice(3,4).repeat(2),16),he=parseInt(r.slice(4,5).repeat(2),16),ge.toColor(be,Ce,ye,he);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return be=parseInt(n[1]),Ce=parseInt(n[2]),ye=parseInt(n[3]),he=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),ge.toColor(be,Ce,ye,he);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[be,Ce,ye,he]=t.getImageData(0,0,1,1).data,he!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ge.toRgba(be,Ce,ye,he),css:r}}e.toColor=s})(ae||(ae={}));var De;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let h=s/255,o=r/255,l=n/255,a=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),_=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return a*.2126+_*.7152+c*.0722}e.relativeLuminance2=i})(De||(De={}));var gi;(e=>{function t(h,o){if(he=(o&255)/255,he===1)return o;let l=o>>24&255,a=o>>16&255,_=o>>8&255,c=h>>24&255,g=h>>16&255,v=h>>8&255;return be=c+Math.round((l-c)*he),Ce=g+Math.round((a-g)*he),ye=v+Math.round((_-v)*he),ge.toRgba(be,Ce,ye)}e.blend=t;function i(h,o,l){let a=De.relativeLuminance(h>>8),_=De.relativeLuminance(o>>8);if(et(a,_)<l){if(_<a){let v=s(h,o,l),f=et(a,De.relativeLuminance(v>>8));if(f<l){let d=r(h,o,l),u=et(a,De.relativeLuminance(d>>8));return f>u?v:d}return v}let c=r(h,o,l),g=et(a,De.relativeLuminance(c>>8));if(g<l){let v=s(h,o,l),f=et(a,De.relativeLuminance(v>>8));return g>f?c:v}return c}}e.ensureContrastRatio=i;function s(h,o,l){let a=h>>24&255,_=h>>16&255,c=h>>8&255,g=o>>24&255,v=o>>16&255,f=o>>8&255,d=et(De.relativeLuminance2(g,v,f),De.relativeLuminance2(a,_,c));for(;d<l&&(g>0||v>0||f>0);)g-=Math.max(0,Math.ceil(g*.1)),v-=Math.max(0,Math.ceil(v*.1)),f-=Math.max(0,Math.ceil(f*.1)),d=et(De.relativeLuminance2(g,v,f),De.relativeLuminance2(a,_,c));return(g<<24|v<<16|f<<8|255)>>>0}e.reduceLuminance=s;function r(h,o,l){let a=h>>24&255,_=h>>16&255,c=h>>8&255,g=o>>24&255,v=o>>16&255,f=o>>8&255,d=et(De.relativeLuminance2(g,v,f),De.relativeLuminance2(a,_,c));for(;d<l&&(g<255||v<255||f<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),d=et(De.relativeLuminance2(g,v,f),De.relativeLuminance2(a,_,c));return(g<<24|v<<16|f<<8|255)>>>0}e.increaseLuminance=r;function n(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=n})(gi||(gi={}));function ft(e){let t=e.toString(16);return t.length<2?"0"+t:t}function et(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var xa=class extends Jt{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},wi=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ue}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],s=t.translateToString(!0),r=0,n=0,h=0,o=t.getFg(0),l=t.getBg(0);for(let a=0;a<t.getTrimmedLength();a++)if(t.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==o||this._workCell.bg!==l){if(a-r>1){let _=this._getJoinedRanges(s,h,n,t,r);for(let c=0;c<_.length;c++)i.push(_[c])}r=a,h=n,o=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||ct.length}if(this._bufferService.cols-r>1){let a=this._getJoinedRanges(s,h,n,t,r);for(let _=0;_<a.length;_++)i.push(a[_])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),h=[];try{h=this._characterJoiners[0].handler(n)}catch(o){console.error(o)}for(let o=1;o<this._characterJoiners.length;o++)try{let l=this._characterJoiners[o].handler(n);for(let a=0;a<l.length;a++)wi._mergeRanges(h,l[a])}catch(l){console.error(l)}return this._stringRangesToCellRanges(h,s,r),h}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,h=e[s];if(h){for(let o=i;o<this._bufferService.cols;o++){let l=t.getWidth(o),a=t.getString(o).length||ct.length;if(l!==0){if(!r&&h[0]<=n&&(h[0]=o,r=!0),h[1]<=n){if(h[1]=o,h=e[++s],!h)break;h[0]<=n?(h[0]=o,r=!0):r=!1}n+=a}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};wi=le([H(0,Be)],wi);function Ea(e){return 57508<=e&&e<=57558}function La(e){return 9472<=e&&e<=9631}function ka(e){return Ea(e)||La(e)}function Ra(){return{css:{canvas:ai(),cell:ai()},device:{canvas:ai(),cell:ai(),char:{width:0,height:0,left:0,top:0}}}}function ai(){return{width:0,height:0}}var gs=class{constructor(e,t,i,s,r,n,h){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=h,this._workCell=new Ue,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,h,o,l,a,_){let c=[],g=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,f=e.getNoBgTrimmedLength();i&&f<n+1&&(f=n+1);let d,u=0,b="",P=0,L=0,R=0,A=0,S=!1,D=0,k=!1,C=0,m=0,E=[],p=a!==-1&&_!==-1;for(let w=0;w<f;w++){e.loadCell(w,this._workCell);let y=this._workCell.getWidth();if(y===0)continue;let M=!1,B=w>=m,T=w,x=this._workCell;if(g.length>0&&w===g[0][0]&&B){let X=g.shift(),Q=this._isCellInSelection(X[0],t);for(P=X[0]+1;P<X[1];P++)B&&(B=Q===this._isCellInSelection(P,t));B&&(B=!i||n<X[0]||n>=X[1]),B?(M=!0,x=new xa(this._workCell,e.translateToString(!0,X[0],X[1]),X[1]-X[0]),T=X[1]-1,y=x.getWidth()):m=X[1]}let F=this._isCellInSelection(w,t),N=i&&w===n,q=p&&w>=a&&w<=_,$=!1;this._decorationService.forEachDecorationAtCell(w,t,void 0,X=>{$=!0});let G=x.getChars()||ct;if(G===" "&&(x.isUnderline()||x.isOverline())&&(G=" "),C=y*o-l.get(G,x.isBold(),x.isItalic()),!d)d=this._document.createElement("span");else if(u&&(F&&k||!F&&!k&&x.bg===L)&&(F&&k&&v.selectionForeground||x.fg===R)&&x.extended.ext===A&&q===S&&C===D&&!N&&!M&&!$&&B){x.isInvisible()?b+=ct:b+=G,u++;continue}else u&&(d.textContent=b),d=this._document.createElement("span"),u=0,b="";if(L=x.bg,R=x.fg,A=x.extended.ext,S=q,D=C,k=F,M&&n>=w&&n<=T&&(n=w),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized){if(E.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&E.push("xterm-cursor-blink"),E.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":E.push("xterm-cursor-outline");break;case"block":E.push("xterm-cursor-block");break;case"bar":E.push("xterm-cursor-bar");break;case"underline":E.push("xterm-cursor-underline");break}}if(x.isBold()&&E.push("xterm-bold"),x.isItalic()&&E.push("xterm-italic"),x.isDim()&&E.push("xterm-dim"),x.isInvisible()?b=ct:b=x.getChars()||ct,x.isUnderline()&&(E.push(`xterm-underline-${x.extended.underlineStyle}`),b===" "&&(b=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())d.style.textDecorationColor=`rgb(${Jt.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let X=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&X<8&&(X+=8),d.style.textDecorationColor=v.ansi[X].css}x.isOverline()&&(E.push("xterm-overline"),b===" "&&(b=" ")),x.isStrikethrough()&&E.push("xterm-strikethrough"),q&&(d.style.textDecoration="underline");let U=x.getFgColor(),ce=x.getFgColorMode(),J=x.getBgColor(),Y=x.getBgColorMode(),ue=!!x.isInverse();if(ue){let X=U;U=J,J=X;let Q=ce;ce=Y,Y=Q}let Z,Ee,Qe=!1;this._decorationService.forEachDecorationAtCell(w,t,void 0,X=>{X.options.layer!=="top"&&Qe||(X.backgroundColorRGB&&(Y=50331648,J=X.backgroundColorRGB.rgba>>8&16777215,Z=X.backgroundColorRGB),X.foregroundColorRGB&&(ce=50331648,U=X.foregroundColorRGB.rgba>>8&16777215,Ee=X.foregroundColorRGB),Qe=X.options.layer==="top")}),!Qe&&F&&(Z=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,J=Z.rgba>>8&16777215,Y=50331648,Qe=!0,v.selectionForeground&&(ce=50331648,U=v.selectionForeground.rgba>>8&16777215,Ee=v.selectionForeground)),Qe&&E.push("xterm-decoration-top");let Re;switch(Y){case 16777216:case 33554432:Re=v.ansi[J],E.push(`xterm-bg-${J}`);break;case 50331648:Re=ge.toColor(J>>16,J>>8&255,J&255),this._addStyle(d,`background-color:#${_r((J>>>0).toString(16),"0",6)}`);break;case 0:default:ue?(Re=v.foreground,E.push("xterm-bg-257")):Re=v.background}switch(Z||x.isDim()&&(Z=re.multiplyOpacity(Re,.5)),ce){case 16777216:case 33554432:x.isBold()&&U<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(U+=8),this._applyMinimumContrast(d,Re,v.ansi[U],x,Z,void 0)||E.push(`xterm-fg-${U}`);break;case 50331648:let X=ge.toColor(U>>16&255,U>>8&255,U&255);this._applyMinimumContrast(d,Re,X,x,Z,Ee)||this._addStyle(d,`color:#${_r(U.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(d,Re,v.foreground,x,Z,Ee)||ue&&E.push("xterm-fg-257")}E.length&&(d.className=E.join(" "),E.length=0),!N&&!M&&!$&&B?u++:d.textContent=b,C!==this.defaultSpacing&&(d.style.letterSpacing=`${C}px`),c.push(d),w=T}return d&&u&&(d.textContent=b),c}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||ka(s.getCode()))return!1;let h=this._getContrastCache(s),o;if(!r&&!n&&(o=h.getColor(t.rgba,i.rgba)),o===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);o=re.ensureContrastRatio(r||t,n||i,l),h.setColor((r||t).rgba,(n||i).rgba,o??null)}return o?(this._addStyle(e,`color:${o.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};gs=le([H(1,sn),H(2,Ae),H(3,rt),H(4,yt),H(5,Zt),H(6,Mt)],gs);function _r(e,t,i){for(;e.length<i;)e=t+e;return e}var Ma=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.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(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let h=this._measure(e,0);return h>0&&(this._flat[s]=h),h}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let h=0;t&&(h|=1),i&&(h|=2),n=this._measure(e,h),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},Da=class{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(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,h=i[1]-r,o=Math.max(n,0),l=Math.min(h,e.rows-1);if(o>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=h,this.viewportCappedStartRow=o,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Ba(){return new Da}var Ii="xterm-dom-renderer-owner-",He="xterm-rows",hi="xterm-fg-",fr="xterm-bg-",It="xterm-focus",li="xterm-selection",Aa=1,ps=class extends V{constructor(e,t,i,s,r,n,h,o,l,a,_,c,g,v){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=h,this._charSizeService=l,this._optionsService=a,this._bufferService=_,this._coreService=c,this._coreBrowserService=g,this._themeService=v,this._terminalClass=Aa++,this._rowElements=[],this._selectionRenderModel=Ba(),this.onRequestRedraw=this._register(new I).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(He),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(li),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Ra(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=o.createInstance(gs,document),this._element.classList.add(Ii+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(ne(()=>{this._element.classList.remove(Ii+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Ma(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${He} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${He} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${He} .xterm-dim { color: ${re.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${He}.${It} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${He}.${It} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${He}.${It} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${He} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${He} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${He} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${He} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${He} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${li} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${li} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${li} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,h]of e.ansi.entries())t+=`${this._terminalSelector} .${hi}${n} { color: ${h.css}; }${this._terminalSelector} .${hi}${n}.xterm-dim { color: ${re.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${fr}${n} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${hi}257 { color: ${re.opaque(e.background).css}; }${this._terminalSelector} .${hi}257.xterm-dim { color: ${re.multiplyOpacity(re.opaque(e.background),.5).css}; }${this._terminalSelector} .${fr}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(It),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(It),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,o=this._document.createDocumentFragment();if(i){let l=e[0]>t[0];o.appendChild(this._createSelectionElement(n,l?t[0]:e[0],l?e[0]:t[0],h-n+1))}else{let l=s===n?e[0]:0,a=n===r?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(n,l,a));let _=h-n-1;if(o.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,_)),n!==h){let c=r===h?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(h,0,c))}}this._selectionContainer.appendChild(o)}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(i-t);return n+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-n),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${h}px`,r}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,o=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let a=l+i.ydisp,_=this._rowElements[l],c=i.lines.get(a);if(!_||!c)break;_.replaceChildren(...this._rowFactory.createRow(c,a,a===s,h,o,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Ii}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let h=this._bufferService.rows-1;i=Math.max(Math.min(i,h),0),s=Math.max(Math.min(s,h),0),r=Math.min(r,this._bufferService.cols);let o=this._bufferService.buffer,l=o.ybase+o.y,a=Math.min(o.x,r-1),_=this._optionsService.rawOptions.cursorBlink,c=this._optionsService.rawOptions.cursorStyle,g=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=i;v<=s;++v){let f=v+o.ydisp,d=this._rowElements[v],u=o.lines.get(f);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,f,f===l,c,g,a,_,this.dimensions.css.cell.width,this._widthCache,n?v===i?e:0:-1,n?(v===s?t:r)-1:-1))}}};ps=le([H(7,Bs),H(8,Li),H(9,Ae),H(10,Be),H(11,yt),H(12,rt),H(13,Mt)],ps);var vs=class extends V{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new I),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Pa(this._optionsService))}catch{this._measureStrategy=this._register(new Ta(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};vs=le([H(2,Ae)],vs);var Cn=class extends V{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Ta=class extends Cn{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Pa=class extends Cn{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Oa=class extends V{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Ia(this._window)),this._onDprChange=this._register(new I),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new I),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ke.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(z(this._textarea,"focus",()=>this._isFocused=!0)),this._register(z(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},Ia=class extends V{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Rt),this._onDprChange=this._register(new I),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ne(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=z(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},Fa=class extends V{constructor(){super(),this.linkProviders=[],this._register(ne(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Hs(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),h=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-h]}function Na(e,t,i,s,r,n,h,o,l){if(!n)return;let a=Hs(e,t,i);if(a)return a[0]=Math.ceil((a[0]+(l?h/2:0))/h),a[1]=Math.ceil(a[1]/o),a[0]=Math.min(Math.max(a[0],1),s+(l?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var ms=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return Na(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=Hs(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};ms=le([H(0,nt),H(1,Li)],ms);var Ha=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},yn={};Xn(yn,{getSafariVersion:()=>za,isChromeOS:()=>kn,isFirefox:()=>xn,isIpad:()=>$a,isIphone:()=>Ua,isLegacyEdge:()=>Wa,isLinux:()=>Ws,isMac:()=>bi,isNode:()=>ki,isSafari:()=>En,isWindows:()=>Ln});var ki=typeof process<"u"&&"title"in process,Qt=ki?"node":navigator.userAgent,ei=ki?"node":navigator.platform,xn=Qt.includes("Firefox"),Wa=Qt.includes("Edge"),En=/^((?!chrome|android).)*safari/i.test(Qt);function za(){if(!En)return 0;let e=Qt.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var bi=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ei),$a=ei==="iPad",Ua=ei==="iPhone",Ln=["Windows","Win16","Win32","WinCE"].includes(ei),Ws=ei.indexOf("Linux")>=0,kn=/\bCrOS\b/.test(Qt),Rn=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},qa=class extends Rn{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Ka=class extends Rn{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ci=!ki&&"requestIdleCallback"in window?Ka:qa,Va=class{constructor(){this._queue=new Ci}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ss=class extends V{constructor(e,t,i,s,r,n,h,o,l){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=o,this._renderer=this._register(new Rt),this._pausedResizeTask=new Va,this._observerDisposable=this._register(new Rt),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 I),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new I),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new I),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new I),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ha((a,_)=>this._renderRows(a,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ga(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ne(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var a;return(a=this._renderer.value)==null?void 0:a.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(a=>this._registerIntersectionObserver(a,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ne(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ss=le([H(2,Ae),H(3,Li),H(4,yt),H(5,Zt),H(6,Be),H(7,rt),H(8,Mt)],Ss);var Ga=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Xa(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Ja(r,n,e,t,i,s)+Ri(n,t,i,s)+Za(r,n,e,t,i,s);let h;if(n===t)return h=r>e?"D":"C",Xt(Math.abs(r-e),Gt(h,s));h=n>t?"D":"C";let o=Math.abs(n-t),l=ja(n>t?e:r,i)+(o-1)*i.cols+1+Ya(n>t?r:e);return Xt(l,Gt(h,s))}function Ya(e,t){return e-1}function ja(e,t){return t.cols-e}function Ja(e,t,i,s,r,n){return Ri(t,s,r,n).length===0?"":Xt(Dn(e,t,e,t-Ct(t,r),!1,r).length,Gt("D",n))}function Ri(e,t,i,s){let r=e-Ct(e,i),n=t-Ct(t,i),h=Math.abs(r-n)-Qa(e,t,i);return Xt(h,Gt(Mn(e,t),s))}function Za(e,t,i,s,r,n){let h;Ri(t,s,r,n).length>0?h=s-Ct(s,r):h=t;let o=s,l=eh(e,t,i,s,r,n);return Xt(Dn(e,h,i,o,l==="C",r).length,Gt(l,n))}function Qa(e,t,i){var h;let s=0,r=e-Ct(e,i),n=t-Ct(t,i);for(let o=0;o<Math.abs(r-n);o++){let l=Mn(e,t)==="A"?-1:1;(h=i.buffer.lines.get(r+l*o))!=null&&h.isWrapped&&s++}return s}function Ct(e,t){let i=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return i}function eh(e,t,i,s,r,n){let h;return Ri(i,s,r,n).length>0?h=s-Ct(s,r):h=t,e<i&&h<=s||e>=i&&h<s?"C":"D"}function Mn(e,t){return e>t?"A":"B"}function Dn(e,t,i,s,r,n){let h=e,o=t,l="";for(;(h!==i||o!==s)&&o>=0&&o<n.buffer.lines.length;)h+=r?1:-1,r&&h>n.cols-1?(l+=n.buffer.translateBufferLineToString(o,!1,e,h),h=0,e=0,o++):!r&&h<0&&(l+=n.buffer.translateBufferLineToString(o,!1,0,e+1),h=n.cols-1,e=h,o--);return l+n.buffer.translateBufferLineToString(o,!1,e,h)}function Gt(e,t){let i=t?"O":"[";return O.ESC+i+e}function Xt(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var th=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function gr(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Fi=50,ih=15,sh=50,rh=500,nh=" ",oh=new RegExp(nh,"g"),ws=class extends V{constructor(e,t,i,s,r,n,h,o,l){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=h,this._renderService=o,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ue,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new I),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new I),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new I),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new I),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=a=>this._handleMouseMove(a),this._mouseUpListener=a=>this._handleMouseUp(a),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(a=>this._handleTrim(a)),this._register(this._bufferService.buffers.onBufferActivate(a=>this._handleBufferActivate(a))),this.enable(),this._model=new th(this._bufferService),this._activeSelectionMode=0,this._register(ne(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(a=>{a.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let o=i.translateBufferLineToString(h,!0,r,n);s.push(o)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let h=i.lines.get(n),o=i.translateBufferLineToString(n,!0);h!=null&&h.isWrapped?s[s.length-1]+=o:s.push(o)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),h=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?s[s.length-1]+=h:s.push(h)}}return s.map(r=>r.replace(oh," ")).join(Ln?`\r
|
|
23
|
-
`:`
|
|
24
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ws&&e&&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(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;let i=(n=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=gr(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Hs(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Fi),Fi),t/=Fi,t/Math.abs(t)+Math.round(t*(ih-1)))}shouldForceSelection(e){return bi?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),sh)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let 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(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(bi&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<rh&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=Xa(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let h=r.translateBufferLineToString(e[1],!1),o=this._convertViewportColToCharacterIndex(n,e[0]),l=o,a=e[0]-o,_=0,c=0,g=0,v=0;if(h.charAt(o)===" "){for(;o>0&&h.charAt(o-1)===" ";)o--;for(;l<h.length&&h.charAt(l+1)===" ";)l++}else{let u=e[0],b=e[0];n.getWidth(u)===0&&(_++,u--),n.getWidth(b)===2&&(c++,b++);let P=n.getString(b).length;for(P>1&&(v+=P-1,l+=P-1);u>0&&o>0&&!this._isCharWordSeparator(n.loadCell(u-1,this._workCell));){n.loadCell(u-1,this._workCell);let L=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,u--):L>1&&(g+=L-1,o-=L-1),o--,u--}for(;b<n.length&&l+1<h.length&&!this._isCharWordSeparator(n.loadCell(b+1,this._workCell));){n.loadCell(b+1,this._workCell);let L=this._workCell.getChars().length;this._workCell.getWidth()===2?(c++,b++):L>1&&(v+=L-1,l+=L-1),l++,b++}}l++;let f=o+a-_+g,d=Math.min(this._bufferService.cols,l-o+_+c-g-v);if(!(!t&&h.slice(o,l).trim()==="")){if(i&&f===0&&n.getCodePoint(0)!==32){let u=r.lines.get(e[1]-1);if(u&&n.isWrapped&&u.getCodePoint(this._bufferService.cols-1)!==32){let b=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(b){let P=this._bufferService.cols-b.start;f-=P,d+=P}}}if(s&&f+d===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let u=r.lines.get(e[1]+1);if(u!=null&&u.isWrapped&&u.getCodePoint(0)!==32){let b=this._getWordAt([0,e[1]+1],!1,!1,!0);b&&(d+=b.length)}}return{start:f,length:d}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=gr(i,this._bufferService.cols)}};ws=le([H(3,Be),H(4,yt),H(5,As),H(6,Ae),H(7,nt),H(8,rt)],ws);var pr=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},vr=class{constructor(){this._color=new pr,this._css=new pr}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ve=Object.freeze((()=>{let e=[ae.toColor("#2e3436"),ae.toColor("#cc0000"),ae.toColor("#4e9a06"),ae.toColor("#c4a000"),ae.toColor("#3465a4"),ae.toColor("#75507b"),ae.toColor("#06989a"),ae.toColor("#d3d7cf"),ae.toColor("#555753"),ae.toColor("#ef2929"),ae.toColor("#8ae234"),ae.toColor("#fce94f"),ae.toColor("#729fcf"),ae.toColor("#ad7fa8"),ae.toColor("#34e2e2"),ae.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:ge.toCss(s,r,n),rgba:ge.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:ge.toCss(s,s,s),rgba:ge.toRgba(s,s,s)})}return e})()),gt=ae.toColor("#ffffff"),$t=ae.toColor("#000000"),mr=ae.toColor("#ffffff"),Sr=$t,Ft={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ah=gt,bs=class extends V{constructor(e){super(),this._optionsService=e,this._contrastCache=new vr,this._halfContrastCache=new vr,this._onChangeColors=this._register(new I),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:gt,background:$t,cursor:mr,cursorAccent:Sr,selectionForeground:void 0,selectionBackgroundTransparent:Ft,selectionBackgroundOpaque:re.blend($t,Ft),selectionInactiveBackgroundTransparent:Ft,selectionInactiveBackgroundOpaque:re.blend($t,Ft),scrollbarSliderBackground:re.opacity(gt,.2),scrollbarSliderHoverBackground:re.opacity(gt,.4),scrollbarSliderActiveBackground:re.opacity(gt,.5),overviewRulerBorder:gt,ansi:ve.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ie(e.foreground,gt),t.background=ie(e.background,$t),t.cursor=re.blend(t.background,ie(e.cursor,mr)),t.cursorAccent=re.blend(t.background,ie(e.cursorAccent,Sr)),t.selectionBackgroundTransparent=ie(e.selectionBackground,Ft),t.selectionBackgroundOpaque=re.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=re.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ie(e.selectionForeground,ur):void 0,t.selectionForeground===ur&&(t.selectionForeground=void 0),re.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=re.opacity(t.selectionBackgroundTransparent,.3)),re.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=re.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ie(e.scrollbarSliderBackground,re.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ie(e.scrollbarSliderHoverBackground,re.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ie(e.scrollbarSliderActiveBackground,re.opacity(t.foreground,.5)),t.overviewRulerBorder=ie(e.overviewRulerBorder,ah),t.ansi=ve.slice(),t.ansi[0]=ie(e.black,ve[0]),t.ansi[1]=ie(e.red,ve[1]),t.ansi[2]=ie(e.green,ve[2]),t.ansi[3]=ie(e.yellow,ve[3]),t.ansi[4]=ie(e.blue,ve[4]),t.ansi[5]=ie(e.magenta,ve[5]),t.ansi[6]=ie(e.cyan,ve[6]),t.ansi[7]=ie(e.white,ve[7]),t.ansi[8]=ie(e.brightBlack,ve[8]),t.ansi[9]=ie(e.brightRed,ve[9]),t.ansi[10]=ie(e.brightGreen,ve[10]),t.ansi[11]=ie(e.brightYellow,ve[11]),t.ansi[12]=ie(e.brightBlue,ve[12]),t.ansi[13]=ie(e.brightMagenta,ve[13]),t.ansi[14]=ie(e.brightCyan,ve[14]),t.ansi[15]=ie(e.brightWhite,ve[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=ie(e.extendedAnsi[s],ve[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};bs=le([H(0,Ae)],bs);function ie(e,t){if(e!==void 0)try{return ae.toColor(e)}catch{}return t}var hh=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},lh=class{constructor(){this._services=new hh,this._services.set(Bs,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=to(e).sort((n,h)=>n.index-h.index),s=[];for(let n of i){let h=this._services.get(n.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(h)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},ch={trace:0,debug:1,info:2,warn:3,error:4,off:5},dh="xterm.js: ",Cs=class extends V{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ch[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":dh)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Cs=le([H(0,Ae)],Cs);var wr=class extends V{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new I),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new I),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new I),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},K=3,fe=Object.freeze(new Jt),ci=0,Ni=2,Ut=class Bn{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*K);let r=i||Ue.fromCharData([0,Yr,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*K+0],s=i&2097151;return[this._data[t*K+1],i&2097152?this._combined[t]:s?lt(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*K+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*K+0]=t|2097152|i[2]<<22):this._data[t*K+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*K+0]>>22}hasWidth(t){return this._data[t*K+0]&12582912}getFg(t){return this._data[t*K+1]}getBg(t){return this._data[t*K+2]}hasContent(t){return this._data[t*K+0]&4194303}getCodePoint(t){let i=this._data[t*K+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*K+0]&2097152}getString(t){let i=this._data[t*K+0];return i&2097152?this._combined[t]:i&2097151?lt(i&2097151):""}isProtected(t){return this._data[t*K+2]&536870912}loadCell(t,i){return ci=t*K,i.content=this._data[ci+0],i.fg=this._data[ci+1],i.bg=this._data[ci+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*K+0]=i.content,this._data[t*K+1]=i.fg,this._data[t*K+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*K+0]=i|s<<22,this._data[t*K+1]=r.fg,this._data[t*K+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*K+0];r&2097152?this._combined[t]+=lt(i):r&2097151?(this._combined[t]=lt(r&2097151)+lt(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*K+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new Ue;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new Ue;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*Ni<this._data.buffer.byteLength;let s=t*K;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let h=0;h<r.length;h++){let o=parseInt(r[h],10);o>=t&&delete this._combined[o]}let n=Object.keys(this._extendedAttrs);for(let h=0;h<n.length;h++){let o=parseInt(n[h],10);o>=t&&delete this._extendedAttrs[o]}}return this.length=t,s*4*Ni<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ni<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Bn(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*K+0]&4194303)return t+(this._data[t*K+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*K+0]&4194303||this._data[t*K+2]&50331648)return t+(this._data[t*K+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let h=t._data;if(n)for(let l=r-1;l>=0;l--){for(let a=0;a<K;a++)this._data[(s+l)*K+a]=h[(i+l)*K+a];h[(i+l)*K+2]&268435456&&(this._extendedAttrs[s+l]=t._extendedAttrs[i+l])}else for(let l=0;l<r;l++){for(let a=0;a<K;a++)this._data[(s+l)*K+a]=h[(i+l)*K+a];h[(i+l)*K+2]&268435456&&(this._extendedAttrs[s+l]=t._extendedAttrs[i+l])}let o=Object.keys(t._combined);for(let l=0;l<o.length;l++){let a=parseInt(o[l],10);a>=i&&(this._combined[a-i+s]=t._combined[a])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let h=this._data[i*K+0],o=h&2097151,l=h&2097152?this._combined[i]:o?lt(o):ct;if(n+=l,r)for(let a=0;a<l.length;++a)r.push(i);i+=h>>22||1}return r&&r.push(i),n}};function uh(e,t,i,s,r,n){let h=[];for(let o=0;o<e.length-1;o++){let l=o,a=e.get(++l);if(!a.isWrapped)continue;let _=[e.get(o)];for(;l<e.length&&a.isWrapped;)_.push(a),a=e.get(++l);if(!n&&s>=o&&s<l){o+=_.length-1;continue}let c=0,g=Yt(_,c,t),v=1,f=0;for(;v<_.length;){let u=Yt(_,v,t),b=u-f,P=i-g,L=Math.min(b,P);_[c].copyCellsFrom(_[v],f,g,L,!1),g+=L,g===i&&(c++,g=0),f+=L,f===u&&(v++,f=0),g===0&&c!==0&&_[c-1].getWidth(i-1)===2&&(_[c].copyCellsFrom(_[c-1],i-1,g++,1,!1),_[c-1].setCell(i-1,r))}_[c].replaceCells(g,i,r);let d=0;for(let u=_.length-1;u>0&&(u>c||_[u].getTrimmedLength()===0);u--)d++;d>0&&(h.push(o+_.length-d),h.push(d)),o+=_.length-1}return h}function _h(e,t){let i=[],s=0,r=t[s],n=0;for(let h=0;h<e.length;h++)if(r===h){let o=t[++s];e.onDeleteEmitter.fire({index:h-n,amount:o}),h+=o-1,n+=o,r=t[++s]}else i.push(h);return{layout:i,countRemoved:n}}function fh(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function gh(e,t,i){let s=[],r=e.map((l,a)=>Yt(e,a,t)).reduce((l,a)=>l+a),n=0,h=0,o=0;for(;o<r;){if(r-o<i){s.push(r-o);break}n+=i;let l=Yt(e,h,t);n>l&&(n-=l,h++);let a=e[h].getWidth(n-1)===2;a&&n--;let _=a?i-1:i;s.push(_),o+=_}return s}function Yt(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var An=class Tn{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Tn._nextId++,this._onDispose=this.register(new I),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),bt(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};An._nextId=1;var ph=An,Se={},pt=Se.B;Se[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Se.A={"#":"£"};Se.B=void 0;Se[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Se.C=Se[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Se.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Se.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Se.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Se.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Se.E=Se[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Se.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Se.H=Se[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Se["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var br=4294967295,Cr=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=fe.clone(),this.savedCharset=pt,this.markers=[],this._nullCell=Ue.fromCharData([0,Yr,1,0]),this._whitespaceCell=Ue.fromCharData([0,ct,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ci,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new wr(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new mi),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new mi),this._whitespaceCell}getBlankLine(e,t){return new Ut(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>br?br:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=fe);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new wr(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(fe),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)s+=+this.lines.get(h).resize(e,i);let n=0;if(this._rows<t)for(let h=this._rows;h<t;h++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ut(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ut(e,i)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let h=this.lines.length-r;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=uh(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(fe),i);if(s.length>0){let r=_h(this.lines,s);fh(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(fe),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ut(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(fe),r=[],n=0;for(let h=this.lines.length-1;h>=0;h--){let o=this.lines.get(h);if(!o||!o.isWrapped&&o.getTrimmedLength()<=e)continue;let l=[o];for(;o.isWrapped&&h>0;)o=this.lines.get(--h),l.unshift(o);if(!i){let L=this.ybase+this.y;if(L>=h&&L<h+l.length)continue}let a=l[l.length-1].getTrimmedLength(),_=gh(l,this._cols,e),c=_.length-l.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+c):g=Math.max(0,this.lines.length-this.lines.maxLength+c);let v=[];for(let L=0;L<c;L++){let R=this.getBlankLine(fe,!0);v.push(R)}v.length>0&&(r.push({start:h+l.length+n,newLines:v}),n+=v.length),l.push(...v);let f=_.length-1,d=_[f];d===0&&(f--,d=_[f]);let u=l.length-c-1,b=a;for(;u>=0;){let L=Math.min(b,d);if(l[f]===void 0)break;if(l[f].copyCellsFrom(l[u],b-L,d-L,L,!0),d-=L,d===0&&(f--,d=_[f]),b-=L,b===0){u--;let R=Math.max(u,0);b=Yt(l,R,this._cols)}}for(let L=0;L<l.length;L++)_[L]<e&&l[L].setCell(_[L],s);let P=c-g;for(;P-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+c,this.ybase+t-1)}if(r.length>0){let h=[],o=[];for(let d=0;d<this.lines.length;d++)o.push(this.lines.get(d));let l=this.lines.length,a=l-1,_=0,c=r[_];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let g=0;for(let d=Math.min(this.lines.maxLength-1,l+n-1);d>=0;d--)if(c&&c.start>a+g){for(let u=c.newLines.length-1;u>=0;u--)this.lines.set(d--,c.newLines[u]);d++,h.push({index:a+1,amount:c.newLines.length}),g+=c.newLines.length,c=r[++_]}else this.lines.set(d,o[a--]);let v=0;for(let d=h.length-1;d>=0;d--)h[d].index+=v,this.lines.onInsertEmitter.fire(h[d]),v+=h[d].amount;let f=Math.max(0,l+n-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new ph(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},vh=class extends V{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new I),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 Cr(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Cr(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Pn=2,On=1,ys=class extends V{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new I),this.onResize=this._onResize.event,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Pn),this.rows=Math.max(e.rawOptions.rows||0,On),this.buffers=this._register(new vh(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let h=i.lines.isFull;n===i.lines.length-1?h?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),h?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let h=n-r+1;i.lines.shiftElements(r+1,h-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};ys=le([H(0,Ae)],ys);var Et={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:bi,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},mh=["normal","bold","100","200","300","400","500","600","700","800","900"],Sh=class extends V{constructor(e){super(),this._onOptionChange=this._register(new I),this.onOptionChange=this._onOptionChange.event;let t={...Et};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ne(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in Et))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in Et))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Et[e]),!wh(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Et[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=mh.includes(t)?t:Et[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function wh(e){return e==="block"||e==="underline"||e==="bar"}function qt(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&qt(e[s],t-1);return i}var yr=Object.freeze({insertMode:!1}),xr=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),xs=class extends V{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new I),this.onData=this._onData.event,this._onUserInput=this._register(new I),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new I),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new I),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=qt(yr),this.decPrivateModes=qt(xr)}reset(){this.modes=qt(yr),this.decPrivateModes=qt(xr)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};xs=le([H(0,Be),H(1,en),H(2,Ae)],xs);var Er={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Hi(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var Wi=String.fromCharCode,Lr={DEFAULT:e=>{let t=[Hi(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Wi(t[0])}${Wi(t[1])}${Wi(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Hi(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Hi(e,!0)};${e.x};${e.y}${t}`}},Es=class extends V{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new I),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Er))this.addProtocol(s,Er[s]);for(let s of Object.keys(Lr))this.addEncoding(s,Lr[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Es=le([H(0,Be),H(1,yt),H(2,Ae)],Es);var zi=[[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]],bh=[[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]],me;function Ch(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var yh=class{constructor(){if(this.version="6",!me){me=new Uint8Array(65536),me.fill(1),me[0]=0,me.fill(0,1,32),me.fill(0,127,160),me.fill(2,4352,4448),me[9001]=2,me[9002]=2,me.fill(2,11904,42192),me[12351]=1,me.fill(2,44032,55204),me.fill(2,63744,64256),me.fill(2,65040,65050),me.fill(2,65072,65136),me.fill(2,65280,65377),me.fill(2,65504,65511);for(let e=0;e<zi.length;++e)me.fill(0,zi[e][0],zi[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?me[e]:Ch(e,bh)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=vt.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return vt.createPropertyValue(0,i,s)}},vt=class pi{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new I,this.onChange=this._onChange.event;let t=new yh;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let h=t.charCodeAt(n);if(55296<=h&&h<=56319){if(++n>=r)return i+this.wcwidth(h);let a=t.charCodeAt(n);56320<=a&&a<=57343?h=(h-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let o=this.charProperties(h,s),l=pi.extractWidth(o);pi.extractShouldJoin(o)&&(l-=pi.extractWidth(s)),i+=l,s=o}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},xh=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function kr(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Nt=2147483647,Eh=256,In=class Ls{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>Eh)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new Ls;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new Ls(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Nt?Nt:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Nt?Nt:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,Nt):t}},Ht=[],Lh=class{constructor(){this._state=0,this._active=Ht,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ht}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Ht,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ht,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Ei(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Ht,this._id=-1,this._state=0}}},Ie=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Ei(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Wt=[],kh=class{constructor(){this._handlers=Object.create(null),this._active=Wt,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Wt}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Wt,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Wt,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ei(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Wt,this._ident=0}},Kt=new In;Kt.addParam(0);var Rr=class{constructor(e){this._handler=e,this._data="",this._params=Kt,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Kt,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Ei(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=Kt,this._data="",this._hitLimit=!1,i));return this._params=Kt,this._data="",this._hitLimit=!1,t}},Rh=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},ze=160,Mh=(function(){let e=new Rh(4095),t=Array.apply(null,Array(256)).map((o,l)=>l),i=(o,l)=>t.slice(o,l),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),h;e.setDefault(1,0),e.addMany(s,0,2,0);for(h in n)e.addMany([24,26,153,154],h,3,0),e.addMany(i(128,144),h,3,0),e.addMany(i(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ze,0,2,0),e.add(ze,8,5,8),e.add(ze,6,0,6),e.add(ze,11,0,11),e.add(ze,13,13,13),e})(),Dh=class extends V{constructor(e=Mh){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new In,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ne(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Lh),this._dcsParser=this._register(new kh),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let o=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(h=o[l](this._params),h!==!0);l--)if(h instanceof Promise)return this._parseStack.handlerPos=l,h}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(h=o[l](),h!==!0);l--)if(h instanceof Promise)return this._parseStack.handlerPos=l,h}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(s!==24&&s!==26,i),h)return h;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],h=this._oscParser.end(s!==24&&s!==26,i),h)return h;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let o=n;o<t;++o){switch(s=e[o],r=this._transitions.table[this.currentState<<8|(s<160?s:ze)],r>>4){case 2:for(let g=o+1;;++g){if(g>=t||(s=e[g])<32||s>126&&s<ze){this._printHandler(e,o,g),o=g-1;break}if(++g>=t||(s=e[g])<32||s>126&&s<ze){this._printHandler(e,o,g),o=g-1;break}if(++g>=t||(s=e[g])<32||s>126&&s<ze){this._printHandler(e,o,g),o=g-1;break}if(++g>=t||(s=e[g])<32||s>126&&s<ze){this._printHandler(e,o,g),o=g-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:o,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],a=l?l.length-1:-1;for(;a>=0&&(h=l[a](this._params),h!==!0);a--)if(h instanceof Promise)return this._preserveStack(3,l,a,r,o),h;a<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++o<t&&(s=e[o])>47&&s<60);o--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let _=this._escHandlers[this._collect<<8|s],c=_?_.length-1:-1;for(;c>=0&&(h=_[c](),h!==!0);c--)if(h instanceof Promise)return this._preserveStack(4,_,c,r,o),h;c<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let g=o+1;;++g)if(g>=t||(s=e[g])===24||s===26||s===27||s>127&&s<ze){this._dcsParser.put(e,o,g),o=g-1;break}break;case 14:if(h=this._dcsParser.unhook(s!==24&&s!==26),h)return this._preserveStack(6,[],0,r,o),h;s===27&&(r|=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 g=o+1;;g++)if(g>=t||(s=e[g])<32||s>127&&s<ze){this._oscParser.put(e,o,g),o=g-1;break}break;case 6:if(h=this._oscParser.end(s!==24&&s!==26),h)return this._preserveStack(5,[],0,r,o),h;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},Bh=/^([\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})$/,Ah=/^[\da-f]+$/;function Mr(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=Bh.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Ah.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function $i(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Th(e,t=16){let[i,s,r]=e;return`rgb:${$i(i,t)}/${$i(s,t)}/${$i(r,t)}`}var Ph={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ht=131072,Dr=10;function Br(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Ar=5e3,Tr=0,Oh=class extends V{constructor(e,t,i,s,r,n,h,o,l=new Dh){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=h,this._unicodeService=o,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Qn,this._utf8Decoder=new eo,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=fe.clone(),this._eraseAttrDataInternal=fe.clone(),this._onRequestBell=this._register(new I),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new I),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new I),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new I),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new I),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new I),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new I),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new I),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new I),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new I),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new I),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new I),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 ks(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,_)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:_.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,_,c)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:_,data:c})}),this._parser.setDcsHandlerFallback((a,_,c)=>{_==="HOOK"&&(c=c.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:_,payload:c})}),this._parser.setPrintHandler((a,_,c)=>this.print(a,_,c)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(O.BEL,()=>this.bell()),this._parser.setExecuteHandler(O.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(O.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(O.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(O.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(O.BS,()=>this.backspace()),this._parser.setExecuteHandler(O.HT,()=>this.tab()),this._parser.setExecuteHandler(O.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(O.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(fi.IND,()=>this.index()),this._parser.setExecuteHandler(fi.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(fi.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ie(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Ie(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Ie(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Ie(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Ie(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Ie(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Ie(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Ie(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Ie(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Ie(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Ie(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Ie(a=>this.restoreCursorColor(a))),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(let a in Se)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Rr((a,_)=>this.requestStatusString(a,_)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Ar))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Ar} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,h=this._parseStack.paused;if(h){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ht&&(n=this._parseStack.position+ht)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(a=>a.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ht&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ht))),h||this._dirtyRowTracker.clearRange(),e.length>ht)for(let a=n;a<e.length;a+=ht){let _=a+ht<e.length?a+ht:e.length,c=typeof e=="string"?this._stringDecoder.decode(e.substring(a,_),this._parseBuffer):this._utf8Decoder.decode(e.subarray(a,_),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(s,r,c,a),this._logSlowResolvingAsync(i),i}else if(!h){let a=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(s,r,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let o=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(o,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,o=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,_=this._curAttrData,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&c.getWidth(this._activeBuffer.x-1)===2&&c.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let g=this._parser.precedingJoinState;for(let v=t;v<i;++v){if(s=e[v],s<127&&n){let b=n[String.fromCharCode(s)];b&&(s=b.charCodeAt(0))}let f=this._unicodeService.charProperties(s,g);r=vt.extractWidth(f);let d=vt.extractShouldJoin(f),u=d?vt.extractWidth(g):0;if(g=f,h&&this._onA11yChar.fire(lt(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-u>o){if(l){let b=c,P=this._activeBuffer.x-u;for(this._activeBuffer.x=u,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),c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),u>0&&c instanceof Ut&&c.copyCellsFrom(b,P,0,u,!1);P<o;)b.setCellFromCodepoint(P++,0,1,_)}else if(this._activeBuffer.x=o-1,r===2)continue}if(d&&this._activeBuffer.x){let b=c.getWidth(this._activeBuffer.x-1)?1:2;c.addCodepointToCell(this._activeBuffer.x-b,s,r);for(let P=r-u;--P>=0;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(a&&(c.insertCells(this._activeBuffer.x,r-u,this._activeBuffer.getNullCell(_)),c.getWidth(o-1)===2&&c.setCellFromCodepoint(o-1,0,1,_)),c.setCellFromCodepoint(this._activeBuffer.x++,s,r,_),r>0)for(;--r;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=g,this._activeBuffer.x<o&&i-t>0&&c.getWidth(this._activeBuffer.x)===0&&!c.hasContent(this._activeBuffer.x)&&c.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>Br(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Rr(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ie(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(fe));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,s=vt.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),h=new Uint32Array(n.length*i),o=0;for(let a=0;a<n.length;){let _=n.codePointAt(a)||0;h[o++]=_,a+=_>65535?2:1}let l=o;for(let a=1;a<i;++a)h.copyWithin(l,0,o),l+=o;return this.print(h,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(O.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(O.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(O.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(O.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(O.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,pt),this._charsetService.setgCharset(1,pt),this._charsetService.setgCharset(2,pt),this._charsetService.setgCharset(3,pt);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(d=>(d[d.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",d[d.SET=1]="SET",d[d.RESET=2]="RESET",d[d.PERMANENTLY_SET=3]="PERMANENTLY_SET",d[d.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,h=this._coreService,{buffers:o,cols:l}=this._bufferService,{active:a,alt:_}=o,c=this._optionsService.rawOptions,g=(d,u)=>(h.triggerDataEvent(`${O.ESC}[${t?"":"?"}${d};${u}$y`),!0),v=d=>d?1:2,f=e.params[0];return t?f===2?g(f,4):f===4?g(f,v(h.modes.insertMode)):f===12?g(f,3):f===20?g(f,v(c.convertEol)):g(f,0):f===1?g(f,v(s.applicationCursorKeys)):f===3?g(f,c.windowOptions.setWinLines?l===80?2:l===132?1:0:0):f===6?g(f,v(s.origin)):f===7?g(f,v(s.wraparound)):f===8?g(f,3):f===9?g(f,v(r==="X10")):f===12?g(f,v(c.cursorBlink)):f===25?g(f,v(!h.isCursorHidden)):f===45?g(f,v(s.reverseWraparound)):f===66?g(f,v(s.applicationKeypad)):f===67?g(f,4):f===1e3?g(f,v(r==="VT200")):f===1002?g(f,v(r==="DRAG")):f===1003?g(f,v(r==="ANY")):f===1004?g(f,v(s.sendFocus)):f===1005?g(f,4):f===1006?g(f,v(n==="SGR")):f===1015?g(f,4):f===1016?g(f,v(n==="SGR_PIXELS")):f===1048?g(f,1):f===47||f===1047||f===1049?g(f,v(a===_)):f===2004?g(f,v(s.bracketedPasteMode)):f===2026?g(f,v(s.synchronizedOutput)):g(f,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=Jt.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let h=e.getSubParams(t+n),o=0;do s[1]===5&&(r=1),s[n+o+1+r]=h[o];while(++o<h.length&&o+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let h=2;h<s.length;++h)s[h]===-1&&(s[h]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=fe.fg,e.bg=fe.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=fe.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=fe.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=fe.fg&16777215,s.bg&=-67108864,s.bg|=fe.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${O.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${O.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${O.ESC}[?${t};${i}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=fe.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Br(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${O.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Dr&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Dr&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(Pr(n))if(r==="?")t.push({type:0,index:n});else{let h=Mr(r);h&&t.push({type:1,index:n,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Mr(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);Pr(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,pt),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Ph[e[0]],Se[e[1]]||pt),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=fe.clone(),this._eraseAttrDataInternal=fe.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ue;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=h=>(this._coreService.triggerDataEvent(`${O.ESC}${h}${O.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ks=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Tr=e,e=t,t=Tr),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ks=le([H(0,Be)],ks);function Pr(e){return 0<=e&&e<256}var Ih=5e7,Or=12,Fh=50,Nh=class extends V{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new I),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Ih)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let h=o=>performance.now()-i>=Or?setTimeout(()=>this._innerWrite(0,o)):this._innerWrite(i,o);r.catch(o=>(queueMicrotask(()=>{throw o}),Promise.resolve(!1))).then(h);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=Or)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Fh&&(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()}},Rs=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let o=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._dataByLinkId.set(l.id,l),l.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(h,n)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Rs=le([H(0,Be)],Rs);var Ir=!1,Hh=class extends V{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Rt),this._onBinary=this._register(new I),this.onBinary=this._onBinary.event,this._onData=this._register(new I),this.onData=this._onData.event,this._onLineFeed=this._register(new I),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new I),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new I),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new I),this._instantiationService=new lh,this.optionsService=this._register(new Sh(e)),this._instantiationService.setService(Ae,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ys)),this._instantiationService.setService(Be,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Cs)),this._instantiationService.setService(en,this._logService),this.coreService=this._register(this._instantiationService.createInstance(xs)),this._instantiationService.setService(yt,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Es)),this._instantiationService.setService(Qr,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(vt)),this._instantiationService.setService(ro,this.unicodeService),this._charsetService=this._instantiationService.createInstance(xh),this._instantiationService.setService(so,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Rs),this._instantiationService.setService(tn,this._oscLinkService),this._inputHandler=this._register(new Oh(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ke.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ke.forward(this._bufferService.onResize,this._onResize)),this._register(ke.forward(this.coreService.onData,this._onData)),this._register(ke.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Nh((t,i)=>this._inputHandler.parse(t,i))),this._register(ke.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new I),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Ir&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Ir=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Pn),t=Math.max(t,On),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(kr.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(kr(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ne(()=>{for(let t of e)t.dispose()})}}},Wh={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:["'",'"']};function zh(e,t,i,s){var h;let r={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=O.ESC+"OA":r.key=O.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=O.ESC+"OD":r.key=O.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=O.ESC+"OC":r.key=O.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=O.ESC+"OB":r.key=O.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":O.DEL,e.altKey&&(r.key=O.ESC+r.key);break;case 9:if(e.shiftKey){r.key=O.ESC+"[Z";break}r.key=O.HT,r.cancel=!0;break;case 13:r.key=e.altKey?O.ESC+O.CR:O.CR,r.cancel=!0;break;case 27:r.key=O.ESC,e.altKey&&(r.key=O.ESC+O.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"D":t?r.key=O.ESC+"OD":r.key=O.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"C":t?r.key=O.ESC+"OC":r.key=O.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"A":t?r.key=O.ESC+"OA":r.key=O.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"B":t?r.key=O.ESC+"OB":r.key=O.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=O.ESC+"[2~");break;case 46:n?r.key=O.ESC+"[3;"+(n+1)+"~":r.key=O.ESC+"[3~";break;case 36:n?r.key=O.ESC+"[1;"+(n+1)+"H":t?r.key=O.ESC+"OH":r.key=O.ESC+"[H";break;case 35:n?r.key=O.ESC+"[1;"+(n+1)+"F":t?r.key=O.ESC+"OF":r.key=O.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=O.ESC+"[5;"+(n+1)+"~":r.key=O.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=O.ESC+"[6;"+(n+1)+"~":r.key=O.ESC+"[6~";break;case 112:n?r.key=O.ESC+"[1;"+(n+1)+"P":r.key=O.ESC+"OP";break;case 113:n?r.key=O.ESC+"[1;"+(n+1)+"Q":r.key=O.ESC+"OQ";break;case 114:n?r.key=O.ESC+"[1;"+(n+1)+"R":r.key=O.ESC+"OR";break;case 115:n?r.key=O.ESC+"[1;"+(n+1)+"S":r.key=O.ESC+"OS";break;case 116:n?r.key=O.ESC+"[15;"+(n+1)+"~":r.key=O.ESC+"[15~";break;case 117:n?r.key=O.ESC+"[17;"+(n+1)+"~":r.key=O.ESC+"[17~";break;case 118:n?r.key=O.ESC+"[18;"+(n+1)+"~":r.key=O.ESC+"[18~";break;case 119:n?r.key=O.ESC+"[19;"+(n+1)+"~":r.key=O.ESC+"[19~";break;case 120:n?r.key=O.ESC+"[20;"+(n+1)+"~":r.key=O.ESC+"[20~";break;case 121:n?r.key=O.ESC+"[21;"+(n+1)+"~":r.key=O.ESC+"[21~";break;case 122:n?r.key=O.ESC+"[23;"+(n+1)+"~":r.key=O.ESC+"[23~";break;case 123:n?r.key=O.ESC+"[24;"+(n+1)+"~":r.key=O.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=O.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=O.DEL:e.keyCode===219?r.key=O.ESC:e.keyCode===220?r.key=O.FS:e.keyCode===221&&(r.key=O.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let o=(h=Wh[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(o)r.key=O.ESC+o;else if(e.keyCode>=65&&e.keyCode<=90){let l=e.ctrlKey?e.keyCode-64:e.keyCode+32,a=String.fromCharCode(l);e.shiftKey&&(a=a.toUpperCase()),r.key=O.ESC+a}else if(e.keyCode===32)r.key=O.ESC+(e.ctrlKey?O.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let l=e.code.slice(3,4);e.shiftKey||(l=l.toLowerCase()),r.key=O.ESC+l,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=O.US),e.key==="@"&&(r.key=O.NUL));break}return r}var de=0,$h=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ci,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ci,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(de=this._search(t),de===-1)||this._getKey(this._array[de])!==t)return!1;do if(this._array[de]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(de),!0;while(++de<this._array.length&&this._getKey(this._array[de])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(de=this._search(e),!(de<0||de>=this._array.length)&&this._getKey(this._array[de])===e))do yield this._array[de];while(++de<this._array.length&&this._getKey(this._array[de])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(de=this._search(e),!(de<0||de>=this._array.length)&&this._getKey(this._array[de])===e))do t(this._array[de]);while(++de<this._array.length&&this._getKey(this._array[de])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Ui=0,Fr=0,Uh=class extends V{constructor(){super(),this._decorations=new $h(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new I),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new I),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ne(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new qh(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,r=>{Ui=r.options.x??0,Fr=Ui+(r.options.width??1),e>=Ui&&e<Fr&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},qh=class extends dt{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new I),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new I),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ae.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ae.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Kh=1e3,Vh=class{constructor(e,t=Kh){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Nr=20,yi=class extends V{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Vh(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
25
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(z(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ne(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Nr+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
26
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Nr+1&&(this._liveRegion.textContent+=Xi.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),h=[],o=(n==null?void 0:n.translateToString(!0,void 0,void 0,h))||"",l=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(o.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=o,this._rowColumns.set(a,h)),a.setAttribute("aria-posinset",l),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let h,o;if(t===0?(h=i,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(h=this._rowElements.shift(),o=i,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var o;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((o=s.textContent)==null?void 0:o.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:l,offset:a})=>{let _=l instanceof Text?l.parentNode:l,c=parseInt(_==null?void 0:_.getAttribute("aria-posinset"),10)-1;if(isNaN(c))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(_);if(!g)return console.warn("columns is null. Race condition?"),null;let v=a<g.length?g[a]:g.slice(-1)[0]+1;return v>=this._terminal.cols&&(++c,v=0),{row:c,column:v}},n=r(t),h=r(i);if(!(!n||!h)){if(n.row>h.row||n.row===h.row&&n.column>=h.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(h.row-n.row)*this._terminal.cols-n.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var r,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};yi=le([H(1,Bs),H(2,rt),H(3,nt)],yi);var Ms=class extends V{constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new I),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new I),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ne(()=>{var n;bt(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(z(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(z(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(z(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(z(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,h]of this._linkProviderService.linkProviders.entries())t?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):h.provideLinks(e.y,o=>{var a,_;if(this._isMouseOut)return;let l=o==null?void 0:o.map(c=>({link:c}));(a=this._activeProviderReplies)==null||a.set(n,l),i=this._checkLinkProviderResult(n,e,i),((_=this._activeProviderReplies)==null?void 0:_.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let h=r[n],o=h.link.range.start.y<e?0:h.link.range.start.x,l=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let a=o;a<=l;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(r=!0);if(!r&&s){let h=s.find(o=>this._linkAtPosition(o.link,t));h&&(i=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let h=0;h<this._activeProviderReplies.size;h++){let o=(n=this._activeProviderReplies.get(h))==null?void 0:n.find(l=>this._linkAtPosition(l.link,t));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Gh(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,bt(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Ms=le([H(1,As),H(2,nt),H(3,Be),H(4,rn)],Ms);function Gh(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Xh=class extends Hh{constructor(e={}){super(e),this._linkifier=this._register(new Rt),this.browser=yn,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Rt),this._onCursorMove=this._register(new I),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new I),this.onKey=this._onKey.event,this._onRender=this._register(new I),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new I),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new I),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new I),this.onBell=this._onBell.event,this._onFocus=this._register(new I),this._onBlur=this._register(new I),this._onA11yCharEmitter=this._register(new I),this._onA11yTabEmitter=this._register(new I),this._onWillOpen=this._register(new I),this._setup(),this._decorationService=this._instantiationService.createInstance(Uh),this._instantiationService.setService(Zt,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Fa),this._instantiationService.setService(rn,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ji)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ke.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ke.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ke.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ke.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ne(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=re.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${O.ESC}]${s};${Th(r)}${bn.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=ge.toColor(...t.color));else{let n=i;this._themeService.modifyColors(h=>h[n]=ge.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(yi,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,h=this.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=o+"px",this.textarea.style.top=h+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(z(this.element,"copy",t=>{this.hasSelection()&&Jn(t,this._selectionService)}));let e=t=>Zn(t,this.textarea,this.coreService,this.optionsService);this._register(z(this.textarea,"paste",e)),this._register(z(this.element,"paste",e)),xn?this._register(z(this.element,"mousedown",t=>{t.button===2&&Xs(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(z(this.element,"contextmenu",t=>{Xs(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ws&&this._register(z(this.element,"auxclick",t=>{t.button===1&&Xr(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(z(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(z(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(z(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(z(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(z(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(z(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(z(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((r=this.element)==null?void 0:r.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(z(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Gi.get()),kn||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Oa,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(rt,this._coreBrowserService),this._register(z(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(z(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(vs,this._document,this._helperContainer),this._instantiationService.setService(Li,this._charSizeService),this._themeService=this._instantiationService.createInstance(bs),this._instantiationService.setService(Mt,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(wi),this._instantiationService.setService(sn,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ss,this.rows,this.screenElement)),this._instantiationService.setService(nt,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(fs,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ms),this._instantiationService.setService(As,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Ms,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(us,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ws,this.element,this.screenElement,s)),this._instantiationService.setService(oo,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(ke.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(_s,this.screenElement)),this._register(z(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(yi,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Si,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Si,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ps,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var a,_,c,g,v;let h=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!h)return!1;let o,l;switch(n.overrideType||n.type){case"mousemove":l=32,n.buttons===void 0?(o=3,n.button!==void 0&&(o=n.button<3?n.button:3)):o=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":l=0,o=n.button<3?n.button:3;break;case"mousedown":l=1,o=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let f=n.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(n,(g=(c=(_=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:_.device)==null?void 0:c.cell)==null?void 0:g.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;l=f<0?0:1,o=4;break;default:return!1}return l===void 0||o===void 0||o>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:o,action:l,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(z(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(z(t,"wheel",n=>{var h,o,l,a,_;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(a=(l=(o=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:o.device)==null?void 0:l.cell)==null?void 0:a.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return this.cancel(n,!0);let c=O.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Gr(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=zh(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===O.ETX||i.key===O.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Yh(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var i;(i=this._charSizeService)==null||i.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(fe));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(O.ESC+"[I"):this.coreService.triggerDataEvent(O.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${O.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Yh(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var jh=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Jh=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ue)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Hr=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new Jh(t)}getNullCell(){return new Ue}},Zh=class extends V{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new I),this.onBufferChange=this._onBufferChange.event,this._normal=new Hr(this._core.buffers.normal,"normal"),this._alternate=new Hr(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)}},Qh=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},el=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},tl=["cols","rows"],Xe=0,il=class extends V{constructor(e){super(),this._core=this._register(new Xh(e)),this._addonManager=this._register(new jh),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(tl.includes(e))throw new Error(`Option "${e}" 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 Qh(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new el(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 Zh(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
27
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Gi.get()},set promptLabel(e){Gi.set(e)},get tooMuchOutput(){return Xi.get()},set tooMuchOutput(e){Xi.set(e)}}}_verifyIntegers(...e){for(Xe of e)if(Xe===1/0||isNaN(Xe)||Xe%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Xe of e)if(Xe&&(Xe===1/0||isNaN(Xe)||Xe%1!==0||Xe<0))throw new Error("This API only accepts positive integers")}},qi={exports:{}},Wr;function sl(){return Wr||(Wr=1,(function(e,t){(function(i,s){e.exports=s()})(self,(()=>(()=>{var i={};return(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.FitAddon=void 0,s.FitAddon=class{activate(r){this._terminal=r}dispose(){}fit(){const r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;const n=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(n._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const r=this._terminal._core,n=r._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;const h=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),a=Math.max(0,parseInt(o.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),c=l-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),g=a-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(g/n.css.cell.width)),rows:Math.max(1,Math.floor(c/n.css.cell.height))}}}})(),i})()))})(qi)),qi.exports}var rl=sl(),Ki={exports:{}},zr;function nl(){return zr||(zr=1,(function(e,t){(function(i,s){e.exports=s()})(self,(()=>(()=>{var i={965:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GlyphRenderer=void 0;const a=l(374),_=l(509),c=l(855),g=l(859),v=l(381),f=11,d=f*Float32Array.BYTES_PER_ELEMENT;let u,b=0,P=0,L=0;class R extends g.Disposable{constructor(S,D,k,C){super(),this._terminal=S,this._gl=D,this._dimensions=k,this._optionsService=C,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const m=this._gl;_.TextureAtlas.maxAtlasPages===void 0&&(_.TextureAtlas.maxAtlasPages=Math.min(32,(0,a.throwIfFalsy)(m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,a.throwIfFalsy)(m.getParameter(m.MAX_TEXTURE_SIZE))),this._program=(0,a.throwIfFalsy)((0,v.createProgram)(m,`#version 300 es
|
|
28
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
29
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
30
|
-
layout (location = 2) in vec2 a_offset;
|
|
31
|
-
layout (location = 3) in vec2 a_size;
|
|
32
|
-
layout (location = 4) in float a_texpage;
|
|
33
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
34
|
-
layout (location = 6) in vec2 a_texsize;
|
|
35
|
-
|
|
36
|
-
uniform mat4 u_projection;
|
|
37
|
-
uniform vec2 u_resolution;
|
|
38
|
-
|
|
39
|
-
out vec2 v_texcoord;
|
|
40
|
-
flat out int v_texpage;
|
|
41
|
-
|
|
42
|
-
void main() {
|
|
43
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
44
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
45
|
-
v_texpage = int(a_texpage);
|
|
46
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
47
|
-
}`,(function(B){let T="";for(let x=1;x<B;x++)T+=` else if (v_texpage == ${x}) { outColor = texture(u_texture[${x}], v_texcoord); }`;return`#version 300 es
|
|
48
|
-
precision lowp float;
|
|
49
|
-
|
|
50
|
-
in vec2 v_texcoord;
|
|
51
|
-
flat in int v_texpage;
|
|
52
|
-
|
|
53
|
-
uniform sampler2D u_texture[${B}];
|
|
54
|
-
|
|
55
|
-
out vec4 outColor;
|
|
56
|
-
|
|
57
|
-
void main() {
|
|
58
|
-
if (v_texpage == 0) {
|
|
59
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
60
|
-
} ${T}
|
|
61
|
-
}`})(_.TextureAtlas.maxAtlasPages))),this.register((0,g.toDisposable)((()=>m.deleteProgram(this._program)))),this._projectionLocation=(0,a.throwIfFalsy)(m.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,a.throwIfFalsy)(m.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,a.throwIfFalsy)(m.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=m.createVertexArray(),m.bindVertexArray(this._vertexArrayObject);const E=new Float32Array([0,0,1,0,0,1,1,1]),p=m.createBuffer();this.register((0,g.toDisposable)((()=>m.deleteBuffer(p)))),m.bindBuffer(m.ARRAY_BUFFER,p),m.bufferData(m.ARRAY_BUFFER,E,m.STATIC_DRAW),m.enableVertexAttribArray(0),m.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const w=new Uint8Array([0,1,2,3]),y=m.createBuffer();this.register((0,g.toDisposable)((()=>m.deleteBuffer(y)))),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y),m.bufferData(m.ELEMENT_ARRAY_BUFFER,w,m.STATIC_DRAW),this._attributesBuffer=(0,a.throwIfFalsy)(m.createBuffer()),this.register((0,g.toDisposable)((()=>m.deleteBuffer(this._attributesBuffer)))),m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.enableVertexAttribArray(2),m.vertexAttribPointer(2,2,m.FLOAT,!1,d,0),m.vertexAttribDivisor(2,1),m.enableVertexAttribArray(3),m.vertexAttribPointer(3,2,m.FLOAT,!1,d,2*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(3,1),m.enableVertexAttribArray(4),m.vertexAttribPointer(4,1,m.FLOAT,!1,d,4*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(4,1),m.enableVertexAttribArray(5),m.vertexAttribPointer(5,2,m.FLOAT,!1,d,5*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(5,1),m.enableVertexAttribArray(6),m.vertexAttribPointer(6,2,m.FLOAT,!1,d,7*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(6,1),m.enableVertexAttribArray(1),m.vertexAttribPointer(1,2,m.FLOAT,!1,d,9*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(1,1),m.useProgram(this._program);const M=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let B=0;B<_.TextureAtlas.maxAtlasPages;B++)M[B]=B;m.uniform1iv(this._textureLocation,M),m.uniformMatrix4fv(this._projectionLocation,!1,v.PROJECTION_MATRIX),this._atlasTextures=[];for(let B=0;B<_.TextureAtlas.maxAtlasPages;B++){const T=new v.GLTexture((0,a.throwIfFalsy)(m.createTexture()));this.register((0,g.toDisposable)((()=>m.deleteTexture(T.texture)))),m.activeTexture(m.TEXTURE0+B),m.bindTexture(m.TEXTURE_2D,T.texture),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,1,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[B]=T}m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(S,D,k,C,m,E,p,w,y){this._updateCell(this._vertices.attributes,S,D,k,C,m,E,p,w,y)}_updateCell(S,D,k,C,m,E,p,w,y,M){b=(k*this._terminal.cols+D)*f,C!==c.NULL_CELL_CODE&&C!==void 0?this._atlas&&(u=w&&w.length>1?this._atlas.getRasterizedGlyphCombinedChar(w,m,E,p,!1):this._atlas.getRasterizedGlyph(C,m,E,p,!1),P=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),m!==M&&u.offset.x>P?(L=u.offset.x-P,S[b]=-(u.offset.x-L)+this._dimensions.device.char.left,S[b+1]=-u.offset.y+this._dimensions.device.char.top,S[b+2]=(u.size.x-L)/this._dimensions.device.canvas.width,S[b+3]=u.size.y/this._dimensions.device.canvas.height,S[b+4]=u.texturePage,S[b+5]=u.texturePositionClipSpace.x+L/this._atlas.pages[u.texturePage].canvas.width,S[b+6]=u.texturePositionClipSpace.y,S[b+7]=u.sizeClipSpace.x-L/this._atlas.pages[u.texturePage].canvas.width,S[b+8]=u.sizeClipSpace.y):(S[b]=-u.offset.x+this._dimensions.device.char.left,S[b+1]=-u.offset.y+this._dimensions.device.char.top,S[b+2]=u.size.x/this._dimensions.device.canvas.width,S[b+3]=u.size.y/this._dimensions.device.canvas.height,S[b+4]=u.texturePage,S[b+5]=u.texturePositionClipSpace.x,S[b+6]=u.texturePositionClipSpace.y,S[b+7]=u.sizeClipSpace.x,S[b+8]=u.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,a.allowRescaling)(C,y,u.size.x,this._dimensions.device.cell.width)&&(S[b+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):S.fill(0,b,b+f-1-2)}clear(){const S=this._terminal,D=S.cols*S.rows*f;this._vertices.count!==D?this._vertices.attributes=new Float32Array(D):this._vertices.attributes.fill(0);let k=0;for(;k<this._vertices.attributesBuffers.length;k++)this._vertices.count!==D?this._vertices.attributesBuffers[k]=new Float32Array(D):this._vertices.attributesBuffers[k].fill(0);this._vertices.count=D,k=0;for(let C=0;C<S.rows;C++)for(let m=0;m<S.cols;m++)this._vertices.attributes[k+9]=m/S.cols,this._vertices.attributes[k+10]=C/S.rows,k+=f}handleResize(){const S=this._gl;S.useProgram(this._program),S.viewport(0,0,S.canvas.width,S.canvas.height),S.uniform2f(this._resolutionLocation,S.canvas.width,S.canvas.height),this.clear()}render(S){if(!this._atlas)return;const D=this._gl;D.useProgram(this._program),D.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const k=this._vertices.attributesBuffers[this._activeBuffer];let C=0;for(let m=0;m<S.lineLengths.length;m++){const E=m*this._terminal.cols*f,p=this._vertices.attributes.subarray(E,E+S.lineLengths[m]*f);k.set(p,C),C+=p.length}D.bindBuffer(D.ARRAY_BUFFER,this._attributesBuffer),D.bufferData(D.ARRAY_BUFFER,k.subarray(0,C),D.STREAM_DRAW);for(let m=0;m<this._atlas.pages.length;m++)this._atlas.pages[m].version!==this._atlasTextures[m].version&&this._bindAtlasPageTexture(D,this._atlas,m);D.drawElementsInstanced(D.TRIANGLE_STRIP,4,D.UNSIGNED_BYTE,0,C/f)}setAtlas(S){this._atlas=S;for(const D of this._atlasTextures)D.version=-1}_bindAtlasPageTexture(S,D,k){S.activeTexture(S.TEXTURE0+k),S.bindTexture(S.TEXTURE_2D,this._atlasTextures[k].texture),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,S.RGBA,S.UNSIGNED_BYTE,D.pages[k].canvas),S.generateMipmap(S.TEXTURE_2D),this._atlasTextures[k].version=D.pages[k].version}setDimensions(S){this._dimensions=S}}o.GlyphRenderer=R},742:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RectangleRenderer=void 0;const a=l(374),_=l(859),c=l(310),g=l(381),v=8*Float32Array.BYTES_PER_ELEMENT;class f{constructor(){this.attributes=new Float32Array(160),this.count=0}}let d=0,u=0,b=0,P=0,L=0,R=0,A=0;class S extends _.Disposable{constructor(k,C,m,E){super(),this._terminal=k,this._gl=C,this._dimensions=m,this._themeService=E,this._vertices=new f,this._verticesCursor=new f;const p=this._gl;this._program=(0,a.throwIfFalsy)((0,g.createProgram)(p,`#version 300 es
|
|
62
|
-
layout (location = 0) in vec2 a_position;
|
|
63
|
-
layout (location = 1) in vec2 a_size;
|
|
64
|
-
layout (location = 2) in vec4 a_color;
|
|
65
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
66
|
-
|
|
67
|
-
uniform mat4 u_projection;
|
|
68
|
-
|
|
69
|
-
out vec4 v_color;
|
|
70
|
-
|
|
71
|
-
void main() {
|
|
72
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
73
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
74
|
-
v_color = a_color;
|
|
75
|
-
}`,`#version 300 es
|
|
76
|
-
precision lowp float;
|
|
77
|
-
|
|
78
|
-
in vec4 v_color;
|
|
79
|
-
|
|
80
|
-
out vec4 outColor;
|
|
81
|
-
|
|
82
|
-
void main() {
|
|
83
|
-
outColor = v_color;
|
|
84
|
-
}`)),this.register((0,_.toDisposable)((()=>p.deleteProgram(this._program)))),this._projectionLocation=(0,a.throwIfFalsy)(p.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=p.createVertexArray(),p.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),y=p.createBuffer();this.register((0,_.toDisposable)((()=>p.deleteBuffer(y)))),p.bindBuffer(p.ARRAY_BUFFER,y),p.bufferData(p.ARRAY_BUFFER,w,p.STATIC_DRAW),p.enableVertexAttribArray(3),p.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const M=new Uint8Array([0,1,2,3]),B=p.createBuffer();this.register((0,_.toDisposable)((()=>p.deleteBuffer(B)))),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,B),p.bufferData(p.ELEMENT_ARRAY_BUFFER,M,p.STATIC_DRAW),this._attributesBuffer=(0,a.throwIfFalsy)(p.createBuffer()),this.register((0,_.toDisposable)((()=>p.deleteBuffer(this._attributesBuffer)))),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,p.FLOAT,!1,v,0),p.vertexAttribDivisor(0,1),p.enableVertexAttribArray(1),p.vertexAttribPointer(1,2,p.FLOAT,!1,v,2*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(1,1),p.enableVertexAttribArray(2),p.vertexAttribPointer(2,4,p.FLOAT,!1,v,4*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(2,1),this._updateCachedColors(E.colors),this.register(this._themeService.onChangeColors((T=>{this._updateCachedColors(T),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(k){const C=this._gl;C.useProgram(this._program),C.bindVertexArray(this._vertexArrayObject),C.uniformMatrix4fv(this._projectionLocation,!1,g.PROJECTION_MATRIX),C.bindBuffer(C.ARRAY_BUFFER,this._attributesBuffer),C.bufferData(C.ARRAY_BUFFER,k.attributes,C.DYNAMIC_DRAW),C.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,C.UNSIGNED_BYTE,0,k.count)}handleResize(){this._updateViewportRectangle()}setDimensions(k){this._dimensions=k}_updateCachedColors(k){this._bgFloat=this._colorToFloat32Array(k.background),this._cursorFloat=this._colorToFloat32Array(k.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(k){const C=this._terminal,m=this._vertices;let E,p,w,y,M,B,T,x,F,N,q,$=1;for(E=0;E<C.rows;E++){for(w=-1,y=0,M=0,B=!1,p=0;p<C.cols;p++)T=(E*C.cols+p)*c.RENDER_MODEL_INDICIES_PER_CELL,x=k.cells[T+c.RENDER_MODEL_BG_OFFSET],F=k.cells[T+c.RENDER_MODEL_FG_OFFSET],N=!!(67108864&F),(x!==y||F!==M&&(B||N))&&((y!==0||B&&M!==0)&&(q=8*$++,this._updateRectangle(m,q,M,y,w,p,E)),w=p,y=x,M=F,B=N);(y!==0||B&&M!==0)&&(q=8*$++,this._updateRectangle(m,q,M,y,w,C.cols,E))}m.count=$}updateCursor(k){const C=this._verticesCursor,m=k.cursor;if(!m||m.style==="block")return void(C.count=0);let E,p=0;m.style!=="bar"&&m.style!=="outline"||(E=8*p++,this._addRectangleFloat(C.attributes,E,m.x*this._dimensions.device.cell.width,m.y*this._dimensions.device.cell.height,m.style==="bar"?m.dpr*m.cursorWidth:m.dpr,this._dimensions.device.cell.height,this._cursorFloat)),m.style!=="underline"&&m.style!=="outline"||(E=8*p++,this._addRectangleFloat(C.attributes,E,m.x*this._dimensions.device.cell.width,(m.y+1)*this._dimensions.device.cell.height-m.dpr,m.width*this._dimensions.device.cell.width,m.dpr,this._cursorFloat)),m.style==="outline"&&(E=8*p++,this._addRectangleFloat(C.attributes,E,m.x*this._dimensions.device.cell.width,m.y*this._dimensions.device.cell.height,m.width*this._dimensions.device.cell.width,m.dpr,this._cursorFloat),E=8*p++,this._addRectangleFloat(C.attributes,E,(m.x+m.width)*this._dimensions.device.cell.width-m.dpr,m.y*this._dimensions.device.cell.height,m.dpr,this._dimensions.device.cell.height,this._cursorFloat)),C.count=p}_updateRectangle(k,C,m,E,p,w,y){if(67108864&m)switch(50331648&m){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&m].rgba;break;case 50331648:d=(16777215&m)<<8;break;default:d=this._themeService.colors.foreground.rgba}else switch(50331648&E){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&E].rgba;break;case 50331648:d=(16777215&E)<<8;break;default:d=this._themeService.colors.background.rgba}k.attributes.length<C+4&&(k.attributes=(0,g.expandFloat32Array)(k.attributes,this._terminal.rows*this._terminal.cols*8)),u=p*this._dimensions.device.cell.width,b=y*this._dimensions.device.cell.height,P=(d>>24&255)/255,L=(d>>16&255)/255,R=(d>>8&255)/255,A=1,this._addRectangle(k.attributes,C,u,b,(w-p)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,P,L,R,A)}_addRectangle(k,C,m,E,p,w,y,M,B,T){k[C]=m/this._dimensions.device.canvas.width,k[C+1]=E/this._dimensions.device.canvas.height,k[C+2]=p/this._dimensions.device.canvas.width,k[C+3]=w/this._dimensions.device.canvas.height,k[C+4]=y,k[C+5]=M,k[C+6]=B,k[C+7]=T}_addRectangleFloat(k,C,m,E,p,w,y){k[C]=m/this._dimensions.device.canvas.width,k[C+1]=E/this._dimensions.device.canvas.height,k[C+2]=p/this._dimensions.device.canvas.width,k[C+3]=w/this._dimensions.device.canvas.height,k[C+4]=y[0],k[C+5]=y[1],k[C+6]=y[2],k[C+7]=y[3]}_colorToFloat32Array(k){return new Float32Array([(k.rgba>>24&255)/255,(k.rgba>>16&255)/255,(k.rgba>>8&255)/255,(255&k.rgba)/255])}}o.RectangleRenderer=S},310:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderModel=o.COMBINED_CHAR_BIT_MASK=o.RENDER_MODEL_EXT_OFFSET=o.RENDER_MODEL_FG_OFFSET=o.RENDER_MODEL_BG_OFFSET=o.RENDER_MODEL_INDICIES_PER_CELL=void 0;const a=l(296);o.RENDER_MODEL_INDICIES_PER_CELL=4,o.RENDER_MODEL_BG_OFFSET=1,o.RENDER_MODEL_FG_OFFSET=2,o.RENDER_MODEL_EXT_OFFSET=3,o.COMBINED_CHAR_BIT_MASK=2147483648,o.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,a.createSelectionRenderModel)()}resize(_,c){const g=_*c*o.RENDER_MODEL_INDICIES_PER_CELL;g!==this.cells.length&&(this.cells=new Uint32Array(g),this.lineLengths=new Uint32Array(c))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.JoinedCellData=o.WebglRenderer=void 0;const a=l(820),_=l(274),c=l(627),g=l(457),v=l(56),f=l(374),d=l(345),u=l(859),b=l(147),P=l(782),L=l(855),R=l(965),A=l(742),S=l(310),D=l(733);class k extends u.Disposable{constructor(p,w,y,M,B,T,x,F,N){super(),this._terminal=p,this._characterJoinerService=w,this._charSizeService=y,this._coreBrowserService=M,this._coreService=B,this._decorationService=T,this._optionsService=x,this._themeService=F,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new S.RenderModel,this._workCell=new P.CellData,this._workCell2=new P.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new d.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new d.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new d.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new d.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new d.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 D.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,x,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(x.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const q={antialias:!1,depth:!1,preserveDrawingBuffer:N};if(this._gl=this._canvas.getContext("webgl2",q),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,a.addDisposableDomListener)(this._canvas,"webglcontextlost",($=>{console.log("webglcontextlost event received"),$.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire($)}),3e3)}))),this.register((0,a.addDisposableDomListener)(this._canvas,"webglcontextrestored",($=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,c.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(($,G)=>this._setCanvasDevicePixelDimensions($,G))),this.register(this._coreBrowserService.onWindowChange(($=>{this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,$,((G,U)=>this._setCanvasDevicePixelDimensions(G,U)))}))),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,u.toDisposable)((()=>{var $;for(const G of this._renderLayers)G.dispose();($=this._canvas.parentElement)==null||$.removeChild(this._canvas),(0,c.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var p;return(p=this._charAtlas)==null?void 0:p.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(p,w){var y,M,B,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const x of this._renderLayers)x.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`,(y=this._rectangleRenderer.value)==null||y.setDimensions(this.dimensions),(M=this._rectangleRenderer.value)==null||M.handleResize(),(B=this._glyphRenderer.value)==null||B.setDimensions(this.dimensions),(T=this._glyphRenderer.value)==null||T.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var p;for(const w of this._renderLayers)w.handleBlur(this._terminal);(p=this._cursorBlinkStateManager.value)==null||p.pause(),this._requestRedrawViewport()}handleFocus(){var p;for(const w of this._renderLayers)w.handleFocus(this._terminal);(p=this._cursorBlinkStateManager.value)==null||p.resume(),this._requestRedrawViewport()}handleSelectionChanged(p,w,y){for(const M of this._renderLayers)M.handleSelectionChanged(this._terminal,p,w,y);this._model.selection.update(this._core,p,w,y),this._requestRedrawViewport()}handleCursorMove(){var p;for(const w of this._renderLayers)w.handleCursorMove(this._terminal);(p=this._cursorBlinkStateManager.value)==null||p.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new A.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new R.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const p=(0,c.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!==p&&(this._onChangeTextureAtlas.fire(p.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,d.forwardEvent)(p.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,d.forwardEvent)(p.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=p,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(p){var w;this._model.clear(),p&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var p;(p=this._charAtlas)==null||p.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var p;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(p=this._cursorBlinkStateManager.value)==null||p.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(p){return-1}deregisterCharacterJoiner(p){return!1}renderRows(p,w){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 y of this._renderLayers)y.handleGridChanged(this._terminal,p,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(p,w),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 g.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(p,w){const y=this._core;let M,B,T,x,F,N,q,$,G,U,ce,J,Y,ue,Z=this._workCell;p=m(p,y.rows-1,0),w=m(w,y.rows-1,0);const Ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,Qe=Ee-y.buffer.ydisp,Re=Math.min(this._terminal.buffer.active.cursorX,y.cols-1);let X=-1;const Q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ut=!1;for(B=p;B<=w;B++)for(T=B+y.buffer.ydisp,x=y.buffer.lines.get(T),this._model.lineLengths[B]=0,F=this._characterJoinerService.getJoinedCharacters(T),Y=0;Y<y.cols;Y++)if(M=this._cellColorResolver.result.bg,x.loadCell(Y,Z),Y===0&&(M=this._cellColorResolver.result.bg),N=!1,q=Y,F.length>0&&Y===F[0][0]&&(N=!0,$=F.shift(),Z=new C(Z,x.translateToString(!0,$[0],$[1]),$[1]-$[0]),q=$[1]-1),G=Z.getChars(),U=Z.getCode(),J=(B*y.cols+Y)*S.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(Z,Y,T,this.dimensions.device.cell.width),Q&&T===Ee&&(Y===Re&&(this._model.cursor={x:Re,y:Qe,width:Z.getWidth(),style:this._coreBrowserService.isFocused?y.options.cursorStyle||"block":y.options.cursorInactiveStyle,cursorWidth:y.options.cursorWidth,dpr:this._devicePixelRatio},X=Re+Z.getWidth()-1),Y>=Re&&Y<=X&&(this._coreBrowserService.isFocused&&(y.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&y.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)),U!==L.NULL_CELL_CODE&&(this._model.lineLengths[B]=Y+1),(this._model.cells[J]!==U||this._model.cells[J+S.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[J+S.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[J+S.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ut=!0,G.length>1&&(U|=S.COMBINED_CHAR_BIT_MASK),this._model.cells[J]=U,this._model.cells[J+S.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[J+S.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[J+S.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ce=Z.getWidth(),this._glyphRenderer.value.updateCell(Y,B,U,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,G,ce,M),N))for(Z=this._workCell,Y++;Y<q;Y++)ue=(B*y.cols+Y)*S.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(Y,B,L.NULL_CELL_CODE,0,0,0,L.NULL_CELL_CHAR,0,0),this._model.cells[ue]=L.NULL_CELL_CODE,this._model.cells[ue+S.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ue+S.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ue+S.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ut&&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(p,w){this._canvas.width===p&&this._canvas.height===w||(this._canvas.width=p,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const p=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:p,end:p})}}o.WebglRenderer=k;class C extends b.AttributeData{constructor(p,w,y){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=w,this._width=y}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()]}}function m(E,p,w=0){return Math.max(Math.min(E,p),w)}o.JoinedCellData=C},381:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GLTexture=o.expandFloat32Array=o.createShader=o.createProgram=o.PROJECTION_MATRIX=void 0;const a=l(374);function _(c,g,v){const f=(0,a.throwIfFalsy)(c.createShader(g));if(c.shaderSource(f,v),c.compileShader(f),c.getShaderParameter(f,c.COMPILE_STATUS))return f;console.error(c.getShaderInfoLog(f)),c.deleteShader(f)}o.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),o.createProgram=function(c,g,v){const f=(0,a.throwIfFalsy)(c.createProgram());if(c.attachShader(f,(0,a.throwIfFalsy)(_(c,c.VERTEX_SHADER,g))),c.attachShader(f,(0,a.throwIfFalsy)(_(c,c.FRAGMENT_SHADER,v))),c.linkProgram(f),c.getProgramParameter(f,c.LINK_STATUS))return f;console.error(c.getProgramInfoLog(f)),c.deleteProgram(f)},o.createShader=_,o.expandFloat32Array=function(c,g){const v=Math.min(2*c.length,g),f=new Float32Array(v);for(let d=0;d<c.length;d++)f[d]=c[d];return f},o.GLTexture=class{constructor(c){this.texture=c,this.version=-1}}},592:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BaseRenderLayer=void 0;const a=l(627),_=l(237),c=l(374),g=l(859);class v extends g.Disposable{constructor(d,u,b,P,L,R,A,S){super(),this._container=u,this._alpha=L,this._coreBrowserService=R,this._optionsService=A,this._themeService=S,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-${b}-layer`),this._canvas.style.zIndex=P.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((D=>{this._refreshCharAtlas(d,D),this.reset(d)}))),this.register((0,g.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,c.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(d){}handleFocus(d){}handleCursorMove(d){}handleGridChanged(d,u,b){}handleSelectionChanged(d,u,b,P=!1){}_setTransparency(d,u){if(u===this._alpha)return;const b=this._canvas;this._alpha=u,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,b),this._refreshCharAtlas(d,this._themeService.colors),this.handleGridChanged(d,0,d.rows-1)}_refreshCharAtlas(d,u){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,a.acquireTextureAtlas)(d,this._optionsService.rawOptions,u,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(d,u){this._deviceCellWidth=u.device.cell.width,this._deviceCellHeight=u.device.cell.height,this._deviceCharWidth=u.device.char.width,this._deviceCharHeight=u.device.char.height,this._deviceCharLeft=u.device.char.left,this._deviceCharTop=u.device.char.top,this._canvas.width=u.device.canvas.width,this._canvas.height=u.device.canvas.height,this._canvas.style.width=`${u.css.canvas.width}px`,this._canvas.style.height=`${u.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(d,this._themeService.colors)}_fillBottomLineAtCells(d,u,b=1){this._ctx.fillRect(d*this._deviceCellWidth,(u+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,b*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(d,u,b,P){this._alpha?this._ctx.clearRect(d*this._deviceCellWidth,u*this._deviceCellHeight,b*this._deviceCellWidth,P*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(d*this._deviceCellWidth,u*this._deviceCellHeight,b*this._deviceCellWidth,P*this._deviceCellHeight))}_fillCharTrueColor(d,u,b,P){this._ctx.font=this._getFont(d,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(b,P,u.getWidth()),this._ctx.fillText(u.getChars(),b*this._deviceCellWidth+this._deviceCharLeft,P*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(d,u,b){this._ctx.beginPath(),this._ctx.rect(d*this._deviceCellWidth,u*this._deviceCellHeight,b*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(d,u,b){return`${b?"italic":""} ${u?d.options.fontWeightBold:d.options.fontWeight} ${d.options.fontSize*this._coreBrowserService.dpr}px ${d.options.fontFamily}`}}o.BaseRenderLayer=v},733:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkRenderLayer=void 0;const a=l(197),_=l(237),c=l(592);class g extends c.BaseRenderLayer{constructor(f,d,u,b,P,L,R){super(u,f,"link",d,!0,P,L,R),this.register(b.onShowLinkUnderline((A=>this._handleShowLinkUnderline(A)))),this.register(b.onHideLinkUnderline((A=>this._handleHideLinkUnderline(A))))}resize(f,d){super.resize(f,d),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,a.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let d=f.y1+1;d<f.y2;d++)this._fillBottomLineAtCells(0,d,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}o.LinkRenderLayer=g},820:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,a,_,c){l.addEventListener(a,_,c);let g=!1;return{dispose:()=>{g||(g=!0,l.removeEventListener(a,_,c))}}}},274:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellColorResolver=void 0;const a=l(855),_=l(160),c=l(374);let g,v=0,f=0,d=!1,u=!1,b=!1,P=0;o.CellColorResolver=class{constructor(L,R,A,S,D,k){this._terminal=L,this._optionService=R,this._selectionRenderModel=A,this._decorationService=S,this._coreBrowserService=D,this._themeService=k,this.result={fg:0,bg:0,ext:0}}resolve(L,R,A,S){if(this.result.bg=L.bg,this.result.fg=L.fg,this.result.ext=268435456&L.bg?L.extended.ext:0,f=0,v=0,u=!1,d=!1,b=!1,g=this._themeService.colors,P=0,L.getCode()!==a.NULL_CELL_CODE&&L.extended.underlineStyle===4){const D=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));P=R*S%(2*Math.round(D))}if(this._decorationService.forEachDecorationAtCell(R,A,"bottom",(D=>{D.backgroundColorRGB&&(f=D.backgroundColorRGB.rgba>>8&16777215,u=!0),D.foregroundColorRGB&&(v=D.foregroundColorRGB.rgba>>8&16777215,d=!0)})),b=this._selectionRenderModel.isCellSelected(this._terminal,R,A),b){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=_.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,g.selectionForeground&&(v=g.selectionForeground.rgba>>8&16777215,d=!0),(0,c.treatGlyphAsBackgroundColor)(L.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)v=(this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}v=_.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}d=!0}}this._decorationService.forEachDecorationAtCell(R,A,"top",(D=>{D.backgroundColorRGB&&(f=D.backgroundColorRGB.rgba>>8&16777215,u=!0),D.foregroundColorRGB&&(v=D.foregroundColorRGB.rgba>>8&16777215,d=!0)})),u&&(f=b?-16777216&L.bg&-134217729|f|50331648:-16777216&L.bg|f|50331648),d&&(v=-16777216&L.fg&-67108865|v|50331648),67108864&this.result.fg&&(u&&!d&&(v=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&g.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,d=!0),!u&&d&&(f=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&g.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,u=!0)),g=void 0,this.result.bg=u?f:this.result.bg,this.result.fg=d?v:this.result.fg,this.result.ext&=536870911,this.result.ext|=P<<29&3758096384}}},627:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.removeTerminalFromCache=o.acquireTextureAtlas=void 0;const a=l(509),_=l(197),c=[];o.acquireTextureAtlas=function(g,v,f,d,u,b,P,L){const R=(0,_.generateConfig)(d,u,b,P,v,f,L);for(let D=0;D<c.length;D++){const k=c[D],C=k.ownedBy.indexOf(g);if(C>=0){if((0,_.configEquals)(k.config,R))return k.atlas;k.ownedBy.length===1?(k.atlas.dispose(),c.splice(D,1)):k.ownedBy.splice(C,1);break}}for(let D=0;D<c.length;D++){const k=c[D];if((0,_.configEquals)(k.config,R))return k.ownedBy.push(g),k.atlas}const A=g._core,S={atlas:new a.TextureAtlas(document,R,A.unicodeService),config:R,ownedBy:[g]};return c.push(S),S.atlas},o.removeTerminalFromCache=function(g){for(let v=0;v<c.length;v++){const f=c[v].ownedBy.indexOf(g);if(f!==-1){c[v].ownedBy.length===1?(c[v].atlas.dispose(),c.splice(v,1)):c[v].ownedBy.splice(f,1);break}}}},197:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.is256Color=o.configEquals=o.generateConfig=void 0;const a=l(160);o.generateConfig=function(_,c,g,v,f,d,u){const b={foreground:d.foreground,background:d.background,cursor:a.NULL_COLOR,cursorAccent:a.NULL_COLOR,selectionForeground:a.NULL_COLOR,selectionBackgroundTransparent:a.NULL_COLOR,selectionBackgroundOpaque:a.NULL_COLOR,selectionInactiveBackgroundTransparent:a.NULL_COLOR,selectionInactiveBackgroundOpaque:a.NULL_COLOR,ansi:d.ansi.slice(),contrastCache:d.contrastCache,halfContrastCache:d.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:u,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:_,deviceCellHeight:c,deviceCharWidth:g,deviceCharHeight:v,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:b}},o.configEquals=function(_,c){for(let g=0;g<_.colors.ansi.length;g++)if(_.colors.ansi[g].rgba!==c.colors.ansi[g].rgba)return!1;return _.devicePixelRatio===c.devicePixelRatio&&_.customGlyphs===c.customGlyphs&&_.lineHeight===c.lineHeight&&_.letterSpacing===c.letterSpacing&&_.fontFamily===c.fontFamily&&_.fontSize===c.fontSize&&_.fontWeight===c.fontWeight&&_.fontWeightBold===c.fontWeightBold&&_.allowTransparency===c.allowTransparency&&_.deviceCharWidth===c.deviceCharWidth&&_.deviceCharHeight===c.deviceCharHeight&&_.drawBoldTextInBrightColors===c.drawBoldTextInBrightColors&&_.minimumContrastRatio===c.minimumContrastRatio&&_.colors.foreground.rgba===c.colors.foreground.rgba&&_.colors.background.rgba===c.colors.background.rgba},o.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const a=l(399);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},457:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CursorBlinkStateManager=void 0,o.CursorBlinkStateManager=class{constructor(l,a){this._renderCallback=l,this._coreBrowserService=a,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(l=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const a=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,a>0)return void this._restartInterval(a)}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 a=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(a)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),l)}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:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tryDrawCustomChar=o.powerlineDefinitions=o.boxDrawingDefinitions=o.blockElementDefinitions=void 0;const a=l(374);o.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]]};o.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:(d,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"║":{1:(d,u)=>`M${.5-d},0 L${.5-d},1 M${.5+d},0 L${.5+d},1`},"╒":{1:(d,u)=>`M.5,1 L.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╓":{1:(d,u)=>`M${.5-d},1 L${.5-d},.5 L1,.5 M${.5+d},.5 L${.5+d},1`},"╔":{1:(d,u)=>`M1,${.5-u} L${.5-d},${.5-u} L${.5-d},1 M1,${.5+u} L${.5+d},${.5+u} L${.5+d},1`},"╕":{1:(d,u)=>`M0,${.5-u} L.5,${.5-u} L.5,1 M0,${.5+u} L.5,${.5+u}`},"╖":{1:(d,u)=>`M${.5+d},1 L${.5+d},.5 L0,.5 M${.5-d},.5 L${.5-d},1`},"╗":{1:(d,u)=>`M0,${.5+u} L${.5-d},${.5+u} L${.5-d},1 M0,${.5-u} L${.5+d},${.5-u} L${.5+d},1`},"╘":{1:(d,u)=>`M.5,0 L.5,${.5+u} L1,${.5+u} M.5,${.5-u} L1,${.5-u}`},"╙":{1:(d,u)=>`M1,.5 L${.5-d},.5 L${.5-d},0 M${.5+d},.5 L${.5+d},0`},"╚":{1:(d,u)=>`M1,${.5-u} L${.5+d},${.5-u} L${.5+d},0 M1,${.5+u} L${.5-d},${.5+u} L${.5-d},0`},"╛":{1:(d,u)=>`M0,${.5+u} L.5,${.5+u} L.5,0 M0,${.5-u} L.5,${.5-u}`},"╜":{1:(d,u)=>`M0,.5 L${.5+d},.5 L${.5+d},0 M${.5-d},.5 L${.5-d},0`},"╝":{1:(d,u)=>`M0,${.5-u} L${.5-d},${.5-u} L${.5-d},0 M0,${.5+u} L${.5+d},${.5+u} L${.5+d},0`},"╞":{1:(d,u)=>`M.5,0 L.5,1 M.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╟":{1:(d,u)=>`M${.5-d},0 L${.5-d},1 M${.5+d},0 L${.5+d},1 M${.5+d},.5 L1,.5`},"╠":{1:(d,u)=>`M${.5-d},0 L${.5-d},1 M1,${.5+u} L${.5+d},${.5+u} L${.5+d},1 M1,${.5-u} L${.5+d},${.5-u} L${.5+d},0`},"╡":{1:(d,u)=>`M.5,0 L.5,1 M0,${.5-u} L.5,${.5-u} M0,${.5+u} L.5,${.5+u}`},"╢":{1:(d,u)=>`M0,.5 L${.5-d},.5 M${.5-d},0 L${.5-d},1 M${.5+d},0 L${.5+d},1`},"╣":{1:(d,u)=>`M${.5+d},0 L${.5+d},1 M0,${.5+u} L${.5-d},${.5+u} L${.5-d},1 M0,${.5-u} L${.5-d},${.5-u} L${.5-d},0`},"╤":{1:(d,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u} M.5,${.5+u} L.5,1`},"╥":{1:(d,u)=>`M0,.5 L1,.5 M${.5-d},.5 L${.5-d},1 M${.5+d},.5 L${.5+d},1`},"╦":{1:(d,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L${.5-d},${.5+u} L${.5-d},1 M1,${.5+u} L${.5+d},${.5+u} L${.5+d},1`},"╧":{1:(d,u)=>`M.5,0 L.5,${.5-u} M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╨":{1:(d,u)=>`M0,.5 L1,.5 M${.5-d},.5 L${.5-d},0 M${.5+d},.5 L${.5+d},0`},"╩":{1:(d,u)=>`M0,${.5+u} L1,${.5+u} M0,${.5-u} L${.5-d},${.5-u} L${.5-d},0 M1,${.5-u} L${.5+d},${.5-u} L${.5+d},0`},"╪":{1:(d,u)=>`M.5,0 L.5,1 M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╫":{1:(d,u)=>`M0,.5 L1,.5 M${.5-d},0 L${.5-d},1 M${.5+d},0 L${.5+d},1`},"╬":{1:(d,u)=>`M0,${.5+u} L${.5-d},${.5+u} L${.5-d},1 M1,${.5+u} L${.5+d},${.5+u} L${.5+d},1 M0,${.5-u} L${.5-d},${.5-u} L${.5-d},0 M1,${.5-u} L${.5+d},${.5-u} L${.5+d},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:(d,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,1,.5`},"╮":{1:(d,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,0,.5`},"╯":{1:(d,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.15*.5},.5,.5,0,.5`},"╰":{1:(d,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.15*.5},.5,.5,1,.5`}},o.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}},o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.tryDrawCustomChar=function(d,u,b,P,L,R,A,S){const D=o.blockElementDefinitions[u];if(D)return(function(E,p,w,y,M,B){for(let T=0;T<p.length;T++){const x=p[T],F=M/8,N=B/8;E.fillRect(w+x.x*F,y+x.y*N,x.w*F,x.h*N)}})(d,D,b,P,L,R),!0;const k=_[u];if(k)return(function(E,p,w,y,M,B){let T=c.get(p);T||(T=new Map,c.set(p,T));const x=E.fillStyle;if(typeof x!="string")throw new Error(`Unexpected fillStyle type "${x}"`);let F=T.get(x);if(!F){const N=p[0].length,q=p.length,$=E.canvas.ownerDocument.createElement("canvas");$.width=N,$.height=q;const G=(0,a.throwIfFalsy)($.getContext("2d")),U=new ImageData(N,q);let ce,J,Y,ue;if(x.startsWith("#"))ce=parseInt(x.slice(1,3),16),J=parseInt(x.slice(3,5),16),Y=parseInt(x.slice(5,7),16),ue=x.length>7&&parseInt(x.slice(7,9),16)||1;else{if(!x.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${x}" when drawing pattern glyph`);[ce,J,Y,ue]=x.substring(5,x.length-1).split(",").map((Z=>parseFloat(Z)))}for(let Z=0;Z<q;Z++)for(let Ee=0;Ee<N;Ee++)U.data[4*(Z*N+Ee)]=ce,U.data[4*(Z*N+Ee)+1]=J,U.data[4*(Z*N+Ee)+2]=Y,U.data[4*(Z*N+Ee)+3]=p[Z][Ee]*(255*ue);G.putImageData(U,0,0),F=(0,a.throwIfFalsy)(E.createPattern($,null)),T.set(x,F)}E.fillStyle=F,E.fillRect(w,y,M,B)})(d,k,b,P,L,R),!0;const C=o.boxDrawingDefinitions[u];if(C)return(function(E,p,w,y,M,B,T){E.strokeStyle=E.fillStyle;for(const[x,F]of Object.entries(p)){let N;E.beginPath(),E.lineWidth=T*Number.parseInt(x),N=typeof F=="function"?F(.15,.15/B*M):F;for(const q of N.split(" ")){const $=q[0],G=v[$];if(!G){console.error(`Could not find drawing instructions for "${$}"`);continue}const U=q.substring(1).split(",");U[0]&&U[1]&&G(E,f(U,M,B,w,y,!0,T))}E.stroke(),E.closePath()}})(d,C,b,P,L,R,S),!0;const m=o.powerlineDefinitions[u];return!!m&&((function(E,p,w,y,M,B,T,x){const F=new Path2D;F.rect(w,y,M,B),E.clip(F),E.beginPath();const N=T/12;E.lineWidth=x*N;for(const q of p.d.split(" ")){const $=q[0],G=v[$];if(!G){console.error(`Could not find drawing instructions for "${$}"`);continue}const U=q.substring(1).split(",");U[0]&&U[1]&&G(E,f(U,M,B,w,y,!1,x,(p.leftPadding??0)*(N/2),(p.rightPadding??0)*(N/2)))}p.type===1?(E.strokeStyle=E.fillStyle,E.stroke()):E.fill(),E.closePath()})(d,m,b,P,L,R,A,S),!0)};const c=new Map;function g(d,u,b=0){return Math.max(Math.min(d,u),b)}const v={C:(d,u)=>d.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5]),L:(d,u)=>d.lineTo(u[0],u[1]),M:(d,u)=>d.moveTo(u[0],u[1])};function f(d,u,b,P,L,R,A,S=0,D=0){const k=d.map((C=>parseFloat(C)||parseInt(C)));if(k.length<2)throw new Error("Too few arguments for instruction");for(let C=0;C<k.length;C+=2)k[C]*=u-S*A-D*A,R&&k[C]!==0&&(k[C]=g(Math.round(k[C]+.5)-.5,u,0)),k[C]+=P+S*A;for(let C=1;C<k.length;C+=2)k[C]*=b,R&&k[C]!==0&&(k[C]=g(Math.round(k[C]+.5)-.5,b,0)),k[C]+=L;return k}},56:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.observeDevicePixelDimensions=void 0;const a=l(859);o.observeDevicePixelDimensions=function(_,c,g){let v=new c.ResizeObserver((f=>{const d=f.find((P=>P.target===_));if(!d)return;if(!("devicePixelContentBoxSize"in d))return v==null||v.disconnect(),void(v=void 0);const u=d.devicePixelContentBoxSize[0].inlineSize,b=d.devicePixelContentBoxSize[0].blockSize;u>0&&b>0&&g(u,b)}));try{v.observe(_,{box:["device-pixel-content-box"]})}catch{v.disconnect(),v=void 0}return(0,a.toDisposable)((()=>v==null?void 0:v.disconnect()))}},374:(h,o)=>{function l(_){return 57508<=_&&_<=57558}function a(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},o.isPowerlineGlyph=l,o.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},o.isEmoji=a,o.allowRescaling=function(_,c,g,v){return c===1&&g>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!a(_)&&!l(_)&&!(function(f){return 57344<=f&&f<=63743})(_)},o.treatGlyphAsBackgroundColor=function(_){return l(_)||(function(c){return 9472<=c&&c<=9631})(_)},o.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}}}},o.computeNextVariantOffset=function(_,c,g=0){return(_-(2*Math.round(c)-g))%(2*Math.round(c))}},296:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class l{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(_,c,g,v=!1){if(this.selectionStart=c,this.selectionEnd=g,!c||!g||c[0]===g[0]&&c[1]===g[1])return void this.clear();const f=_.buffers.active.ydisp,d=c[1]-f,u=g[1]-f,b=Math.max(d,0),P=Math.min(u,_.rows-1);b>=_.rows||P<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=d,this.viewportEndRow=u,this.viewportCappedStartRow=b,this.viewportCappedEndRow=P,this.startCol=c[0],this.endCol=g[0])}isCellSelected(_,c,g){return!!this.hasSelection&&(g-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&g>=this.viewportCappedStartRow&&c<this.endCol&&g<=this.viewportCappedEndRow:c<this.startCol&&g>=this.viewportCappedStartRow&&c>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&c>=this.startCol)}}o.createSelectionRenderModel=function(){return new l}},509:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextureAtlas=void 0;const a=l(237),_=l(860),c=l(374),g=l(160),v=l(345),f=l(485),d=l(385),u=l(147),b=l(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 L;class R{get pages(){return this._pages}constructor(C,m,E){this._document=C,this._config=m,this._unicodeService=E,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new v.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new v.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=D(C,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,c.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const C of this.pages)C.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const C=new d.IdleTaskQueue;for(let m=33;m<126;m++)C.enqueue((()=>{if(!this._cacheMap.get(m,b.DEFAULT_COLOR,b.DEFAULT_COLOR,b.DEFAULT_EXT)){const E=this._drawToCache(m,b.DEFAULT_COLOR,b.DEFAULT_COLOR,b.DEFAULT_EXT);this._cacheMap.set(m,b.DEFAULT_COLOR,b.DEFAULT_COLOR,b.DEFAULT_EXT,E)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const C of this._pages)C.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(R.maxAtlasPages&&this._pages.length>=Math.max(4,R.maxAtlasPages)){const m=this._pages.filter((T=>2*T.canvas.width<=(R.maxTextureSize||4096))).sort(((T,x)=>x.canvas.width!==T.canvas.width?x.canvas.width-T.canvas.width:x.percentageUsed-T.percentageUsed));let E=-1,p=0;for(let T=0;T<m.length;T++)if(m[T].canvas.width!==p)E=T,p=m[T].canvas.width;else if(T-E==3)break;const w=m.slice(E,E+4),y=w.map((T=>T.glyphs[0].texturePage)).sort(((T,x)=>T>x?1:-1)),M=this.pages.length-w.length,B=this._mergePages(w,M);B.version++;for(let T=y.length-1;T>=0;T--)this._deletePage(y[T]);this.pages.push(B),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(B.canvas)}const C=new A(this._document,this._textureSize);return this._pages.push(C),this._activePages.push(C),this._onAddTextureAtlasCanvas.fire(C.canvas),C}_mergePages(C,m){const E=2*C[0].canvas.width,p=new A(this._document,E,C);for(const[w,y]of C.entries()){const M=w*y.canvas.width%E,B=Math.floor(w/2)*y.canvas.height;p.ctx.drawImage(y.canvas,M,B);for(const x of y.glyphs)x.texturePage=m,x.sizeClipSpace.x=x.size.x/E,x.sizeClipSpace.y=x.size.y/E,x.texturePosition.x+=M,x.texturePosition.y+=B,x.texturePositionClipSpace.x=x.texturePosition.x/E,x.texturePositionClipSpace.y=x.texturePosition.y/E;this._onRemoveTextureAtlasCanvas.fire(y.canvas);const T=this._activePages.indexOf(y);T!==-1&&this._activePages.splice(T,1)}return p}_deletePage(C){this._pages.splice(C,1);for(let m=C;m<this._pages.length;m++){const E=this._pages[m];for(const p of E.glyphs)p.texturePage--;E.version++}}getRasterizedGlyphCombinedChar(C,m,E,p,w){return this._getFromCacheMap(this._cacheMapCombined,C,m,E,p,w)}getRasterizedGlyph(C,m,E,p,w){return this._getFromCacheMap(this._cacheMap,C,m,E,p,w)}_getFromCacheMap(C,m,E,p,w,y=!1){return L=C.get(m,E,p,w),L||(L=this._drawToCache(m,E,p,w,y),C.set(m,E,p,w,L)),L}_getColorFromAnsiIndex(C){if(C>=this._config.colors.ansi.length)throw new Error("No color found for idx "+C);return this._config.colors.ansi[C]}_getBackgroundColor(C,m,E,p){if(this._config.allowTransparency)return g.NULL_COLOR;let w;switch(C){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(m);break;case 50331648:const y=u.AttributeData.toColorRGB(m);w=g.channels.toColor(y[0],y[1],y[2]);break;default:w=E?g.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(C,m,E,p,w,y,M,B,T,x){const F=this._getMinimumContrastColor(C,m,E,p,w,y,M,T,B,x);if(F)return F;let N;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&y<8&&(y+=8),N=this._getColorFromAnsiIndex(y);break;case 50331648:const q=u.AttributeData.toColorRGB(y);N=g.channels.toColor(q[0],q[1],q[2]);break;default:N=M?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(N=g.color.opaque(N)),B&&(N=g.color.multiplyOpacity(N,a.DIM_OPACITY)),N}_resolveBackgroundRgba(C,m,E){switch(C){case 16777216:case 33554432:return this._getColorFromAnsiIndex(m).rgba;case 50331648:return m<<8;default:return E?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(C,m,E,p){switch(C){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&p&&m<8&&(m+=8),this._getColorFromAnsiIndex(m).rgba;case 50331648:return m<<8;default:return E?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(C,m,E,p,w,y,M,B,T,x){if(this._config.minimumContrastRatio===1||x)return;const F=this._getContrastCache(T),N=F.getColor(C,p);if(N!==void 0)return N||void 0;const q=this._resolveBackgroundRgba(m,E,M),$=this._resolveForegroundRgba(w,y,M,B),G=g.rgba.ensureContrastRatio(q,$,this._config.minimumContrastRatio/(T?2:1));if(!G)return void F.setColor(C,p,null);const U=g.channels.toColor(G>>24&255,G>>16&255,G>>8&255);return F.setColor(C,p,U),U}_getContrastCache(C){return C?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(C,m,E,p,w=!1){const y=typeof C=="number"?String.fromCharCode(C):C,M=Math.min(this._config.deviceCellWidth*Math.max(y.length,2)+4,this._textureSize);this._tmpCanvas.width<M&&(this._tmpCanvas.width=M);const B=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<B&&(this._tmpCanvas.height=B),this._tmpCtx.save(),this._workAttributeData.fg=E,this._workAttributeData.bg=m,this._workAttributeData.extended.ext=p,this._workAttributeData.isInvisible())return P;const T=!!this._workAttributeData.isBold(),x=!!this._workAttributeData.isInverse(),F=!!this._workAttributeData.isDim(),N=!!this._workAttributeData.isItalic(),q=!!this._workAttributeData.isUnderline(),$=!!this._workAttributeData.isStrikethrough(),G=!!this._workAttributeData.isOverline();let U=this._workAttributeData.getFgColor(),ce=this._workAttributeData.getFgColorMode(),J=this._workAttributeData.getBgColor(),Y=this._workAttributeData.getBgColorMode();if(x){const W=U;U=J,J=W;const se=ce;ce=Y,Y=se}const ue=this._getBackgroundColor(Y,J,x,F);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=ue.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const Z=T?this._config.fontWeightBold:this._config.fontWeight,Ee=N?"italic":"";this._tmpCtx.font=`${Ee} ${Z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=a.TEXT_BASELINE;const Qe=y.length===1&&(0,c.isPowerlineGlyph)(y.charCodeAt(0)),Re=y.length===1&&(0,c.isRestrictedPowerlineGlyph)(y.charCodeAt(0)),X=this._getForegroundColor(m,Y,J,E,ce,U,x,F,T,(0,c.treatGlyphAsBackgroundColor)(y.charCodeAt(0)));this._tmpCtx.fillStyle=X.css;const Q=Re?0:4;let ut=!1;this._config.customGlyphs!==!1&&(ut=(0,_.tryDrawCustomChar)(this._tmpCtx,y,Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Bt,At=!Qe;if(Bt=typeof C=="number"?this._unicodeService.wcwidth(C):this._unicodeService.getStringCellWidth(C),q){this._tmpCtx.save();const W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=W%2==1?.5:0;if(this._tmpCtx.lineWidth=W,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())At=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{At=!1;let Ke=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ke<8&&(Ke+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ke).css}this._tmpCtx.beginPath();const qe=Q,pe=Math.ceil(Q+this._config.deviceCharHeight)-se-(w?2*W:0),Tt=pe+W,Pt=pe+2*W;let _t=this._workAttributeData.getUnderlineVariantOffset();for(let Ke=0;Ke<Bt;Ke++){this._tmpCtx.save();const _e=qe+Ke*this._config.deviceCellWidth,Pe=qe+(Ke+1)*this._config.deviceCellWidth,Mi=_e+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(_e,pe),this._tmpCtx.lineTo(Pe,pe),this._tmpCtx.moveTo(_e,Pt),this._tmpCtx.lineTo(Pe,Pt);break;case 3:const ii=W<=1?Pt:Math.ceil(Q+this._config.deviceCharHeight-W/2)-se,si=W<=1?pe:Math.ceil(Q+this._config.deviceCharHeight+W/2)-se,Us=new Path2D;Us.rect(_e,pe,this._config.deviceCellWidth,Pt-pe),this._tmpCtx.clip(Us),this._tmpCtx.moveTo(_e-this._config.deviceCellWidth/2,Tt),this._tmpCtx.bezierCurveTo(_e-this._config.deviceCellWidth/2,si,_e,si,_e,Tt),this._tmpCtx.bezierCurveTo(_e,ii,Mi,ii,Mi,Tt),this._tmpCtx.bezierCurveTo(Mi,si,Pe,si,Pe,Tt),this._tmpCtx.bezierCurveTo(Pe,ii,Pe+this._config.deviceCellWidth/2,ii,Pe+this._config.deviceCellWidth/2,Tt);break;case 4:const ri=_t===0?0:_t>=W?2*W-_t:W-_t;_t>=W||ri===0?(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(_e+ri,pe),this._tmpCtx.lineTo(Pe,pe)):(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(_e,pe),this._tmpCtx.lineTo(_e+ri,pe),this._tmpCtx.moveTo(_e+ri+W,pe),this._tmpCtx.lineTo(Pe,pe)),_t=(0,c.computeNextVariantOffset)(Pe-_e,W,_t);break;case 5:const qn=.6,Kn=.3,Di=Pe-_e,qs=Math.floor(qn*Di),Ks=Math.floor(Kn*Di),Vn=Di-qs-Ks;this._tmpCtx.setLineDash([qs,Ks,Vn]),this._tmpCtx.moveTo(_e,pe),this._tmpCtx.lineTo(Pe,pe);break;default:this._tmpCtx.moveTo(_e,pe),this._tmpCtx.lineTo(Pe,pe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ut&&this._config.fontSize>=12&&!this._config.allowTransparency&&y!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Ke=this._tmpCtx.measureText(y);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ke&&Ke.actualBoundingBoxDescent>0){this._tmpCtx.save();const _e=new Path2D;_e.rect(qe,pe-Math.ceil(W/2),this._config.deviceCellWidth*Bt,Pt-pe+Math.ceil(W/2)),this._tmpCtx.clip(_e),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=ue.css,this._tmpCtx.strokeText(y,Q,Q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(G){const W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=W%2==1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Q,Q+se),this._tmpCtx.lineTo(Q+this._config.deviceCharWidth*Bt,Q+se),this._tmpCtx.stroke()}if(ut||this._tmpCtx.fillText(y,Q,Q+this._config.deviceCharHeight),y==="_"&&!this._config.allowTransparency){let W=S(this._tmpCtx.getImageData(Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight),ue,X,At);if(W)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=ue.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(y,Q,Q+this._config.deviceCharHeight-se),W=S(this._tmpCtx.getImageData(Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight),ue,X,At),W);se++);}if($){const W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),se=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Q,Q+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(Q+this._config.deviceCharWidth*Bt,Q+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const ti=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let $s;if($s=this._config.allowTransparency?(function(W){for(let se=0;se<W.data.length;se+=4)if(W.data[se+3]>0)return!1;return!0})(ti):S(ti,ue,X,At),$s)return P;const te=this._findGlyphBoundingBox(ti,this._workBoundingBox,M,Re,ut,Q);let j,ee;for(;;){if(this._activePages.length===0){const W=this._createNewPage();j=W,ee=W.currentRow,ee.height=te.size.y;break}j=this._activePages[this._activePages.length-1],ee=j.currentRow;for(const W of this._activePages)te.size.y<=W.currentRow.height&&(j=W,ee=W.currentRow);for(let W=this._activePages.length-1;W>=0;W--)for(const se of this._activePages[W].fixedRows)se.height<=ee.height&&te.size.y<=se.height&&(j=this._activePages[W],ee=se);if(ee.y+te.size.y>=j.canvas.height||ee.height>te.size.y+2){let W=!1;if(j.currentRow.y+j.currentRow.height+te.size.y>=j.canvas.height){let se;for(const qe of this._activePages)if(qe.currentRow.y+qe.currentRow.height+te.size.y<qe.canvas.height){se=qe;break}if(se)j=se;else if(R.maxAtlasPages&&this._pages.length>=R.maxAtlasPages&&ee.y+te.size.y<=j.canvas.height&&ee.height>=te.size.y&&ee.x+te.size.x<=j.canvas.width)W=!0;else{const qe=this._createNewPage();j=qe,ee=qe.currentRow,ee.height=te.size.y,W=!0}}W||(j.currentRow.height>0&&j.fixedRows.push(j.currentRow),ee={x:0,y:j.currentRow.y+j.currentRow.height,height:te.size.y},j.fixedRows.push(ee),j.currentRow={x:0,y:ee.y+ee.height,height:0})}if(ee.x+te.size.x<=j.canvas.width)break;ee===j.currentRow?(ee.x=0,ee.y+=ee.height,ee.height=0):j.fixedRows.splice(j.fixedRows.indexOf(ee),1)}return te.texturePage=this._pages.indexOf(j),te.texturePosition.x=ee.x,te.texturePosition.y=ee.y,te.texturePositionClipSpace.x=ee.x/j.canvas.width,te.texturePositionClipSpace.y=ee.y/j.canvas.height,te.sizeClipSpace.x/=j.canvas.width,te.sizeClipSpace.y/=j.canvas.height,ee.height=Math.max(ee.height,te.size.y),ee.x+=te.size.x,j.ctx.putImageData(ti,te.texturePosition.x-this._workBoundingBox.left,te.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,te.size.x,te.size.y),j.addGlyph(te),j.version++,te}_findGlyphBoundingBox(C,m,E,p,w,y){m.top=0;const M=p?this._config.deviceCellHeight:this._tmpCanvas.height,B=p?this._config.deviceCellWidth:E;let T=!1;for(let x=0;x<M;x++){for(let F=0;F<B;F++){const N=x*this._tmpCanvas.width*4+4*F+3;if(C.data[N]!==0){m.top=x,T=!0;break}}if(T)break}m.left=0,T=!1;for(let x=0;x<y+B;x++){for(let F=0;F<M;F++){const N=F*this._tmpCanvas.width*4+4*x+3;if(C.data[N]!==0){m.left=x,T=!0;break}}if(T)break}m.right=B,T=!1;for(let x=y+B-1;x>=y;x--){for(let F=0;F<M;F++){const N=F*this._tmpCanvas.width*4+4*x+3;if(C.data[N]!==0){m.right=x,T=!0;break}}if(T)break}m.bottom=M,T=!1;for(let x=M-1;x>=0;x--){for(let F=0;F<B;F++){const N=x*this._tmpCanvas.width*4+4*F+3;if(C.data[N]!==0){m.bottom=x,T=!0;break}}if(T)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:m.right-m.left+1,y:m.bottom-m.top+1},sizeClipSpace:{x:m.right-m.left+1,y:m.bottom-m.top+1},offset:{x:-m.left+y+(p||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-m.top+y+(p||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}o.TextureAtlas=R;class A{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(C){this._glyphs.push(C),this._usedPixels+=C.size.x*C.size.y}constructor(C,m,E){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],E)for(const p of E)this._glyphs.push(...p.glyphs),this._usedPixels+=p._usedPixels;this.canvas=D(C,m,m),this.ctx=(0,c.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 S(k,C,m,E){const p=C.rgba>>>24,w=C.rgba>>>16&255,y=C.rgba>>>8&255,M=m.rgba>>>24,B=m.rgba>>>16&255,T=m.rgba>>>8&255,x=Math.floor((Math.abs(p-M)+Math.abs(w-B)+Math.abs(y-T))/12);let F=!0;for(let N=0;N<k.data.length;N+=4)k.data[N]===p&&k.data[N+1]===w&&k.data[N+2]===y||E&&Math.abs(k.data[N]-p)+Math.abs(k.data[N+1]-w)+Math.abs(k.data[N+2]-y)<x?k.data[N+3]=0:F=!1;return F}function D(k,C,m){const E=k.createElement("canvas");return E.width=C,E.height=m,E}},160:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,a=0,_=0,c=0;var g,v,f,d,u;function b(L){const R=L.toString(16);return R.length<2?"0"+R:R}function P(L,R){return L<R?(R+.05)/(L+.05):(L+.05)/(R+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(L){L.toCss=function(R,A,S,D){return D!==void 0?`#${b(R)}${b(A)}${b(S)}${b(D)}`:`#${b(R)}${b(A)}${b(S)}`},L.toRgba=function(R,A,S,D=255){return(R<<24|A<<16|S<<8|D)>>>0},L.toColor=function(R,A,S,D){return{css:L.toCss(R,A,S,D),rgba:L.toRgba(R,A,S,D)}}})(g||(o.channels=g={})),(function(L){function R(A,S){return c=Math.round(255*S),[l,a,_]=u.toChannels(A.rgba),{css:g.toCss(l,a,_,c),rgba:g.toRgba(l,a,_,c)}}L.blend=function(A,S){if(c=(255&S.rgba)/255,c===1)return{css:S.css,rgba:S.rgba};const D=S.rgba>>24&255,k=S.rgba>>16&255,C=S.rgba>>8&255,m=A.rgba>>24&255,E=A.rgba>>16&255,p=A.rgba>>8&255;return l=m+Math.round((D-m)*c),a=E+Math.round((k-E)*c),_=p+Math.round((C-p)*c),{css:g.toCss(l,a,_),rgba:g.toRgba(l,a,_)}},L.isOpaque=function(A){return(255&A.rgba)==255},L.ensureContrastRatio=function(A,S,D){const k=u.ensureContrastRatio(A.rgba,S.rgba,D);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},L.opaque=function(A){const S=(255|A.rgba)>>>0;return[l,a,_]=u.toChannels(S),{css:g.toCss(l,a,_),rgba:S}},L.opacity=R,L.multiplyOpacity=function(A,S){return c=255&A.rgba,R(A,c*S/255)},L.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(v||(o.color=v={})),(function(L){let R,A;try{const S=document.createElement("canvas");S.width=1,S.height=1;const D=S.getContext("2d",{willReadFrequently:!0});D&&(R=D,R.globalCompositeOperation="copy",A=R.createLinearGradient(0,0,1,1))}catch{}L.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return l=parseInt(S.slice(1,2).repeat(2),16),a=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),g.toColor(l,a,_);case 5:return l=parseInt(S.slice(1,2).repeat(2),16),a=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),c=parseInt(S.slice(4,5).repeat(2),16),g.toColor(l,a,_,c);case 7:return{css:S,rgba:(parseInt(S.slice(1),16)<<8|255)>>>0};case 9:return{css:S,rgba:parseInt(S.slice(1),16)>>>0}}const D=S.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return l=parseInt(D[1]),a=parseInt(D[2]),_=parseInt(D[3]),c=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),g.toColor(l,a,_,c);if(!R||!A)throw new Error("css.toColor: Unsupported css format");if(R.fillStyle=A,R.fillStyle=S,typeof R.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(R.fillRect(0,0,1,1),[l,a,_,c]=R.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(l,a,_,c),css:S}}})(f||(o.css=f={})),(function(L){function R(A,S,D){const k=A/255,C=S/255,m=D/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))+.0722*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))}L.relativeLuminance=function(A){return R(A>>16&255,A>>8&255,255&A)},L.relativeLuminance2=R})(d||(o.rgb=d={})),(function(L){function R(S,D,k){const C=S>>24&255,m=S>>16&255,E=S>>8&255;let p=D>>24&255,w=D>>16&255,y=D>>8&255,M=P(d.relativeLuminance2(p,w,y),d.relativeLuminance2(C,m,E));for(;M<k&&(p>0||w>0||y>0);)p-=Math.max(0,Math.ceil(.1*p)),w-=Math.max(0,Math.ceil(.1*w)),y-=Math.max(0,Math.ceil(.1*y)),M=P(d.relativeLuminance2(p,w,y),d.relativeLuminance2(C,m,E));return(p<<24|w<<16|y<<8|255)>>>0}function A(S,D,k){const C=S>>24&255,m=S>>16&255,E=S>>8&255;let p=D>>24&255,w=D>>16&255,y=D>>8&255,M=P(d.relativeLuminance2(p,w,y),d.relativeLuminance2(C,m,E));for(;M<k&&(p<255||w<255||y<255);)p=Math.min(255,p+Math.ceil(.1*(255-p))),w=Math.min(255,w+Math.ceil(.1*(255-w))),y=Math.min(255,y+Math.ceil(.1*(255-y))),M=P(d.relativeLuminance2(p,w,y),d.relativeLuminance2(C,m,E));return(p<<24|w<<16|y<<8|255)>>>0}L.blend=function(S,D){if(c=(255&D)/255,c===1)return D;const k=D>>24&255,C=D>>16&255,m=D>>8&255,E=S>>24&255,p=S>>16&255,w=S>>8&255;return l=E+Math.round((k-E)*c),a=p+Math.round((C-p)*c),_=w+Math.round((m-w)*c),g.toRgba(l,a,_)},L.ensureContrastRatio=function(S,D,k){const C=d.relativeLuminance(S>>8),m=d.relativeLuminance(D>>8);if(P(C,m)<k){if(m<C){const w=R(S,D,k),y=P(C,d.relativeLuminance(w>>8));if(y<k){const M=A(S,D,k);return y>P(C,d.relativeLuminance(M>>8))?w:M}return w}const E=A(S,D,k),p=P(C,d.relativeLuminance(E>>8));if(p<k){const w=R(S,D,k);return p>P(C,d.relativeLuminance(w>>8))?E:w}return E}},L.reduceLuminance=R,L.increaseLuminance=A,L.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}})(u||(o.rgba=u={})),o.toPaddedHex=b,o.contrastRatio=P},345:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===l)return void this._listeners.splice(a,1)}}})),this._event}fire(l,a){const _=[];for(let c=0;c<this._listeners.length;c++)_.push(this._listeners[c]);for(let c=0;c<_.length;c++)_[c].call(void 0,l,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(l,a){return l((_=>a.fire(_)))},o.runAndSubscribe=function(l,a){return a(void 0),l((_=>a(_)))}},859:(h,o)=>{function l(a){for(const _ of a)_.dispose();a.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){const _=this._disposables.indexOf(a);_!==-1&&this._disposables.splice(_,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){var _;this._isDisposed||a===this._value||((_=this._value)==null||_.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){var a;this._isDisposed=!0,(a=this._value)==null||a.dispose(),this._value=void 0}},o.toDisposable=function(a){return{dispose:a}},o.disposeArray=l,o.getDisposeArrayDisposable=function(a){return{dispose:()=>l(a)}}},485:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(_,c,g){this._data[_]||(this._data[_]={}),this._data[_][c]=g}get(_,c){return this._data[_]?this._data[_][c]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(a,_,c,g,v){this._data.get(a,_)||this._data.set(a,_,new l),this._data.get(a,_).set(c,g,v)}get(a,_,c,g){var v;return(v=this._data.get(a,_))==null?void 0:v.get(c,g)}clear(){this._data.clear()}}},399:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,a=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const _=l.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),o.isIpad=a==="iPad",o.isIphone=a==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),o.isLinux=a.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},385:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const a=l(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let f=0,d=0,u=v.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),d=Math.max(f,d),b=v.timeRemaining(),1.5*d>b)return u-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(u-f))}ms`),void this._start();u=b}this.clear()}}class c extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const f=Date.now()+v;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}o.PriorityTaskQueue=c,o.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:c,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},147:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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}}o.AttributeData=l;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,g=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=g}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=a},782:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const a=l(133),_=l(855),c=l(147);class g extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const d=new g;return d.setFromCharData(f),d}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let d=!1;if(f[_.CHAR_DATA_CHAR_INDEX].length>2)d=!0;else if(f[_.CHAR_DATA_CHAR_INDEX].length===2){const u=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=u&&u<=56319){const b=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(u-55296)+b-56320+65536|f[_.CHAR_DATA_WIDTH_INDEX]<<22:d=!0}else d=!0}else this.content=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[_.CHAR_DATA_WIDTH_INDEX]<<22;d&&(this.combinedData=f[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=g},855:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},133:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,a=0,_=l.length){let c="";for(let g=a;g<_;++g){let v=l[g];v>65535?(v-=65536,c+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):c+=String.fromCharCode(v)}return c},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,a){const _=l.length;if(!_)return 0;let c=0,g=0;if(this._interim){const v=l.charCodeAt(g++);56320<=v&&v<=57343?a[c++]=1024*(this._interim-55296)+v-56320+65536:(a[c++]=this._interim,a[c++]=v),this._interim=0}for(let v=g;v<_;++v){const f=l.charCodeAt(v);if(55296<=f&&f<=56319){if(++v>=_)return this._interim=f,c;const d=l.charCodeAt(v);56320<=d&&d<=57343?a[c++]=1024*(f-55296)+d-56320+65536:(a[c++]=f,a[c++]=d)}else f!==65279&&(a[c++]=f)}return c}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,a){const _=l.length;if(!_)return 0;let c,g,v,f,d=0,u=0,b=0;if(this.interim[0]){let R=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let S,D=0;for(;(S=63&this.interim[++D])&&D<4;)A<<=6,A|=S;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,C=k-D;for(;b<C;){if(b>=_)return 0;if(S=l[b++],(192&S)!=128){b--,R=!0;break}this.interim[D++]=S,A<<=6,A|=63&S}R||(k===2?A<128?b--:a[d++]=A:k===3?A<2048||A>=55296&&A<=57343||A===65279||(a[d++]=A):A<65536||A>1114111||(a[d++]=A)),this.interim.fill(0)}const P=_-4;let L=b;for(;L<_;){for(;!(!(L<P)||128&(c=l[L])||128&(g=l[L+1])||128&(v=l[L+2])||128&(f=l[L+3]));)a[d++]=c,a[d++]=g,a[d++]=v,a[d++]=f,L+=4;if(c=l[L++],c<128)a[d++]=c;else if((224&c)==192){if(L>=_)return this.interim[0]=c,d;if(g=l[L++],(192&g)!=128){L--;continue}if(u=(31&c)<<6|63&g,u<128){L--;continue}a[d++]=u}else if((240&c)==224){if(L>=_)return this.interim[0]=c,d;if(g=l[L++],(192&g)!=128){L--;continue}if(L>=_)return this.interim[0]=c,this.interim[1]=g,d;if(v=l[L++],(192&v)!=128){L--;continue}if(u=(15&c)<<12|(63&g)<<6|63&v,u<2048||u>=55296&&u<=57343||u===65279)continue;a[d++]=u}else if((248&c)==240){if(L>=_)return this.interim[0]=c,d;if(g=l[L++],(192&g)!=128){L--;continue}if(L>=_)return this.interim[0]=c,this.interim[1]=g,d;if(v=l[L++],(192&v)!=128){L--;continue}if(L>=_)return this.interim[0]=c,this.interim[1]=g,this.interim[2]=v,d;if(f=l[L++],(192&f)!=128){L--;continue}if(u=(7&c)<<18|(63&g)<<12|(63&v)<<6|63&f,u<65536||u>1114111)continue;a[d++]=u}}return d}}},776:function(h,o,l){var a=this&&this.__decorate||function(u,b,P,L){var R,A=arguments.length,S=A<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,P):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(u,b,P,L);else for(var D=u.length-1;D>=0;D--)(R=u[D])&&(S=(A<3?R(S):A>3?R(b,P,S):R(b,P))||S);return A>3&&S&&Object.defineProperty(b,P,S),S},_=this&&this.__param||function(u,b){return function(P,L){b(P,L,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const c=l(859),g=l(97),v={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let f,d=o.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(u){super(),this._optionsService=u,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),f=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(u){for(let b=0;b<u.length;b++)typeof u[b]=="function"&&(u[b]=u[b]())}_log(u,b,P){this._evalLazyOptionalParams(P),u.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...P)}trace(u,...b){var P;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((P=this._optionsService.options.logger)==null?void 0:P.trace.bind(this._optionsService.options.logger))??console.log,u,b)}debug(u,...b){var P;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((P=this._optionsService.options.logger)==null?void 0:P.debug.bind(this._optionsService.options.logger))??console.log,u,b)}info(u,...b){var P;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((P=this._optionsService.options.logger)==null?void 0:P.info.bind(this._optionsService.options.logger))??console.info,u,b)}warn(u,...b){var P;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((P=this._optionsService.options.logger)==null?void 0:P.warn.bind(this._optionsService.options.logger))??console.warn,u,b)}error(u,...b){var P;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((P=this._optionsService.options.logger)==null?void 0:P.error.bind(this._optionsService.options.logger))??console.error,u,b)}};o.LogService=d=a([_(0,g.IOptionsService)],d),o.setTraceLogger=function(u){f=u},o.traceCall=function(u,b,P){if(typeof P.value!="function")throw new Error("not supported");const L=P.value;P.value=function(...R){if(f.logLevel!==g.LogLevelEnum.TRACE)return L.apply(this,R);f.trace(`GlyphRenderer#${L.name}(${R.map((S=>JSON.stringify(S))).join(", ")})`);const A=L.apply(this,R);return f.trace(`GlyphRenderer#${L.name} return`,A),A}}},726:(h,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",a="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(_){return _[a]||[]},o.createDecorator=function(_){if(o.serviceRegistry.has(_))return o.serviceRegistry.get(_);const c=function(g,v,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(d,u,b){u[l]===u?u[a].push({id:d,index:b}):(u[a]=[{id:d,index:b}],u[l]=u)})(c,g,f)};return c.toString=()=>_,o.serviceRegistry.set(_,c),c}},97:(h,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const a=l(726);var _;o.IBufferService=(0,a.createDecorator)("BufferService"),o.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),o.ICoreService=(0,a.createDecorator)("CoreService"),o.ICharsetService=(0,a.createDecorator)("CharsetService"),o.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(_||(o.LogLevelEnum=_={})),o.ILogService=(0,a.createDecorator)("LogService"),o.IOptionsService=(0,a.createDecorator)("OptionsService"),o.IOscLinkService=(0,a.createDecorator)("OscLinkService"),o.IUnicodeService=(0,a.createDecorator)("UnicodeService"),o.IDecorationService=(0,a.createDecorator)("DecorationService")}},s={};function r(h){var o=s[h];if(o!==void 0)return o.exports;var l=s[h]={exports:{}};return i[h].call(l.exports,l,l.exports,r),l.exports}var n={};return(()=>{var h=n;Object.defineProperty(h,"__esModule",{value:!0}),h.WebglAddon=void 0;const o=r(345),l=r(859),a=r(399),_=r(666),c=r(776);class g extends l.Disposable{constructor(f){if(a.isSafari&&(0,a.getSafariVersion)()<16){const d={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",d))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const d=f._core;if(!f.element)return void this.register(d.onWillOpen((()=>this.activate(f))));this._terminal=f;const u=d.coreService,b=d.optionsService,P=d,L=P._renderService,R=P._characterJoinerService,A=P._charSizeService,S=P._coreBrowserService,D=P._decorationService,k=P._logService,C=P._themeService;(0,c.setTraceLogger)(k),this._renderer=this.register(new _.WebglRenderer(f,R,A,S,u,D,b,C,this._preserveDrawingBuffer)),this.register((0,o.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,o.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,o.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,o.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),L.setRenderer(this._renderer),this.register((0,l.toDisposable)((()=>{const m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(f.cols,f.rows)})))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}h.WebglAddon=g})(),n})()))})(Ki)),Ki.exports}var ol=nl();const al=[{label:"ESC",sequence:"\x1B"},{label:"/",sequence:"/"},{label:"—",sequence:"-"},{label:"HOME",sequence:"\x1B[H"},{label:"↑",sequence:"\x1B[A"},{label:"END",sequence:"\x1B[F"},{label:"PGUP",sequence:"\x1B[5~"}],hl=[{label:"TAB",sequence:" "},{label:"CTRL",sequence:null,isModifier:!0},{label:"ALT",sequence:null,isModifier:!0},{label:"SHIFT",sequence:null,isModifier:!0},{label:"←",sequence:"\x1B[D"},{label:"↓",sequence:"\x1B[B"},{label:"→",sequence:"\x1B[C"},{label:"PGDN",sequence:"\x1B[6~"}];let $e=!1,Fe=!1,tt=!1,mt=null,St=null,vi=null;function Fn(e){if(!$e&&!Fe&&!tt)return e;let t=e;const i=1+((tt?1:0)|(Fe?2:0)|($e?4:0)),s=t.match(/^\x1b\[([A-Z])$/),r=t.match(/^\x1b\[(\d+)~$/);if(t===" "&&tt&&!$e&&!Fe)t="\x1B[Z";else if(s)t=`\x1B[1;${i}${s[1]}`;else if(r)t=`\x1B[${r[1]};${i}~`;else if(t.length===1){if(tt&&!$e&&!Fe&&(t=t.toUpperCase()),$e){const n=t.toUpperCase().charCodeAt(0);n>=64&&n<=95&&(t=String.fromCharCode(n-64))}Fe&&(t="\x1B"+t)}else Fe&&(t="\x1B"+t);return $e=!1,mt==null||mt.classList.remove("active"),Fe=!1,St==null||St.classList.remove("active"),tt=!1,vi==null||vi.classList.remove("active"),t}function ll(){return $e||Fe||tt}function cl(e,t){function i(s){const r=document.createElement("div");r.className="extra-keys-row";for(const n of s){const h=document.createElement("button");h.className="extra-key",h.textContent=n.label,h.setAttribute("tabindex","-1"),n.isModifier&&(h.classList.add("modifier"),n.label==="CTRL"&&(mt=h),n.label==="ALT"&&(St=h),n.label==="SHIFT"&&(vi=h));const o=l=>{if(l.preventDefault(),l.stopPropagation(),n.isModifier)n.label==="CTRL"?($e=!$e,h.classList.toggle("active",$e),$e&&(Fe=!1,St==null||St.classList.remove("active"))):n.label==="ALT"?(Fe=!Fe,h.classList.toggle("active",Fe),Fe&&($e=!1,mt==null||mt.classList.remove("active"))):n.label==="SHIFT"&&(tt=!tt,h.classList.toggle("active",tt));else if(n.sequence!==null){const a=Fn(n.sequence);t(a)}};h.addEventListener("touchstart",o,{passive:!1}),h.addEventListener("click",o),r.appendChild(h)}return r}e.appendChild(i(al)),e.appendChild(i(hl))}const Nn=document.getElementById("terminal-container"),Ds=document.getElementById("extra-keys"),dl=document.getElementById("status-dot"),Hn=document.getElementById("status-text"),ul=new URLSearchParams(window.location.search),Wn=ul.get("token");if(!Wn)throw Hn.textContent="Error: No auth token in URL",new Error("Missing token parameter");const st=new il({cursorBlink:!0,fontSize:14,fontFamily:'"Cascadia Code", "Fira Code", "JetBrains Mono", Menlo, Monaco, monospace',theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#e94560",selectionBackground:"#0f346080",black:"#1a1a2e",red:"#e94560",green:"#2ecc71",yellow:"#f39c12",blue:"#3498db",magenta:"#9b59b6",cyan:"#1abc9c",white:"#e0e0e0",brightBlack:"#555577",brightRed:"#ff6b81",brightGreen:"#55efc4",brightYellow:"#ffeaa7",brightBlue:"#74b9ff",brightMagenta:"#a29bfe",brightCyan:"#81ecec",brightWhite:"#ffffff"},allowProposedApi:!0}),zs=new rl.FitAddon;st.loadAddon(zs);st.open(Nn);try{const e=new ol.WebglAddon;e.onContextLoss(()=>{e.dispose()}),st.loadAddon(e)}catch{}zs.fit();let Ne=null,jt=0,Lt=null;const _l=1e4;function fl(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}?token=${Wn}`}function gl(){const e=document.createElement("div");e.id="reconnect-overlay";const t=document.createElement("div");t.className="spinner",e.appendChild(t);const i=document.createElement("div");return i.textContent="Reconnecting...",e.appendChild(i),e}function $r(e){dl.className=e==="connected"?"connected":e==="reconnecting"?"reconnecting":"",Hn.textContent=e==="connected"?"Connected":e==="reconnecting"?jt>5?"Waiting for laptop to wake up...":`Reconnecting (attempt ${jt})...`:"Disconnected",e==="reconnecting"&&!Lt?(Lt=gl(),document.body.appendChild(Lt)):e==="connected"&&Lt&&(Lt.remove(),Lt=null)}function zn(){Ne=new WebSocket(fl()),Ne.onopen=()=>{jt=0,$r("connected"),$n()},Ne.onmessage=e=>{st.write(typeof e.data=="string"?e.data:new Uint8Array(e.data))},Ne.onclose=()=>{$r("reconnecting"),pl()},Ne.onerror=()=>{}}function pl(){jt++;const e=Math.min(1e3*Math.pow(1.5,jt-1),_l);setTimeout(zn,e)}function $n(){(Ne==null?void 0:Ne.readyState)===WebSocket.OPEN&&Ne.send(JSON.stringify({type:"resize",cols:st.cols,rows:st.rows}))}function Un(e){(Ne==null?void 0:Ne.readyState)===WebSocket.OPEN&&Ne.send(JSON.stringify({type:"input",data:e}))}st.onData(e=>{const t=ll()?Fn(e):e;Un(t)});cl(Ds,Un);let Vi=0;function xi(){const e=window.visualViewport,t=Ds.offsetHeight;if(e){const s=window.innerHeight-e.height-e.offsetTop;Vi=Math.max(0,s),Ds.style.bottom=`${Vi}px`}const i=t+Vi;document.documentElement.style.setProperty("--extra-keys-height",`${i}px`),zs.fit(),$n()}window.addEventListener("resize",xi);window.visualViewport&&(window.visualViewport.addEventListener("resize",xi),window.visualViewport.addEventListener("scroll",xi));requestAnimationFrame(xi);Nn.addEventListener("touchstart",()=>{st.focus()});st.focus();zn();
|