@xterm/addon-webgl 0.19.0-beta.5 → 0.19.0-beta.50

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.
@@ -0,0 +1,101 @@
1
+ /**
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
+ */
13
+ /*---------------------------------------------------------------------------------------------
14
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15
+ * Licensed under the MIT License. See License.txt in the project root for license information.
16
+ *--------------------------------------------------------------------------------------------*/
17
+ var Tr=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var di=(i,e,t,r)=>{for(var s=r>1?void 0:r?gr(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&Tr(e,t,s),s},pi=(i,e)=>(t,r)=>e(t,r,i);var Y=class{constructor(){this._disposables=[];this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},be=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}};function G(i){return{dispose:i}}function xr(i){for(let e of i)e.dispose();i.length=0}function fi(i){return{dispose:()=>xr(i)}}var Qe=typeof process<"u"&&"title"in process,ke=Qe?"node":navigator.userAgent,At=Qe?"node":navigator.platform,_i=ke.includes("Firefox"),mi=ke.includes("Edge"),Ft=/^((?!chrome|android).)*safari/i.test(ke);function vi(){if(!Ft)return 0;let i=ke.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var cn=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(At);var un=["Windows","Win16","Win32","WinCE"].includes(At),hn=At.indexOf("Linux")>=0,dn=/\bCrOS\b/.test(ke);function Bt(i,e,t,r){i.addEventListener(e,t,r);let s=!1;return{dispose:()=>{s||(s=!0,i.removeEventListener(e,t,r))}}}var bi="";var H=0,W=0,V=0,N=0,Z={css:"#00000000",rgba:0},j;(r=>{function i(s,o,n,c){return c!==void 0?`#${ge(s)}${ge(o)}${ge(n)}${ge(c)}`:`#${ge(s)}${ge(o)}${ge(n)}`}r.toCss=i;function e(s,o,n,c=255){return(s<<24|o<<16|n<<8|c)>>>0}r.toRgba=e;function t(s,o,n,c){return{css:r.toCss(s,o,n,c),rgba:r.toRgba(s,o,n,c)}}r.toColor=t})(j||={});var Pe;(c=>{function i(l,a){if(N=(a.rgba&255)/255,N===1)return{css:a.css,rgba:a.rgba};let u=a.rgba>>24&255,h=a.rgba>>16&255,d=a.rgba>>8&255,v=l.rgba>>24&255,C=l.rgba>>16&255,y=l.rgba>>8&255;H=v+Math.round((u-v)*N),W=C+Math.round((h-C)*N),V=y+Math.round((d-y)*N);let R=j.toCss(H,W,V),A=j.toRgba(H,W,V);return{css:R,rgba:A}}c.blend=i;function e(l){return(l.rgba&255)===255}c.isOpaque=e;function t(l,a,u){let h=de.ensureContrastRatio(l.rgba,a.rgba,u);if(h)return j.toColor(h>>24&255,h>>16&255,h>>8&255)}c.ensureContrastRatio=t;function r(l){let a=(l.rgba|255)>>>0;return[H,W,V]=de.toChannels(a),{css:j.toCss(H,W,V),rgba:a}}c.opaque=r;function s(l,a){return N=Math.round(a*255),[H,W,V]=de.toChannels(l.rgba),{css:j.toCss(H,W,V,N),rgba:j.toRgba(H,W,V,N)}}c.opacity=s;function o(l,a){return N=l.rgba&255,s(l,N*a/255)}c.multiplyOpacity=o;function n(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}c.toColorRGB=n})(Pe||={});var Cr;(r=>{let i,e;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(i=o,i.globalCompositeOperation="copy",e=i.createLinearGradient(0,0,1,1))}catch{}function t(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return H=parseInt(s.slice(1,2).repeat(2),16),W=parseInt(s.slice(2,3).repeat(2),16),V=parseInt(s.slice(3,4).repeat(2),16),j.toColor(H,W,V);case 5:return H=parseInt(s.slice(1,2).repeat(2),16),W=parseInt(s.slice(2,3).repeat(2),16),V=parseInt(s.slice(3,4).repeat(2),16),N=parseInt(s.slice(4,5).repeat(2),16),j.toColor(H,W,V,N);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}}let o=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(o)return H=parseInt(o[1]),W=parseInt(o[2]),V=parseInt(o[3]),N=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),j.toColor(H,W,V,N);if(!i||!e)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=e,i.fillStyle=s,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[H,W,V,N]=i.getImageData(0,0,1,1).data,N!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:j.toRgba(H,W,V,N),css:s}}r.toColor=t})(Cr||={});var Q;(t=>{function i(r){return e(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=i;function e(r,s,o){let n=r/255,c=s/255,l=o/255,a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),u=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return a*.2126+u*.7152+h*.0722}t.relativeLuminance2=e})(Q||={});var de;(o=>{function i(n,c){if(N=(c&255)/255,N===1)return c;let l=c>>24&255,a=c>>16&255,u=c>>8&255,h=n>>24&255,d=n>>16&255,v=n>>8&255;return H=h+Math.round((l-h)*N),W=d+Math.round((a-d)*N),V=v+Math.round((u-v)*N),j.toRgba(H,W,V)}o.blend=i;function e(n,c,l){let a=Q.relativeLuminance(n>>8),u=Q.relativeLuminance(c>>8);if(he(a,u)<l){if(u<a){let C=t(n,c,l),y=he(a,Q.relativeLuminance(C>>8));if(y<l){let R=r(n,c,l),A=he(a,Q.relativeLuminance(R>>8));return y>A?C:R}return C}let d=r(n,c,l),v=he(a,Q.relativeLuminance(d>>8));if(v<l){let C=t(n,c,l),y=he(a,Q.relativeLuminance(C>>8));return v>y?d:C}return d}}o.ensureContrastRatio=e;function t(n,c,l){let a=n>>24&255,u=n>>16&255,h=n>>8&255,d=c>>24&255,v=c>>16&255,C=c>>8&255,y=he(Q.relativeLuminance2(d,v,C),Q.relativeLuminance2(a,u,h));for(;y<l&&(d>0||v>0||C>0);)d-=Math.max(0,Math.ceil(d*.1)),v-=Math.max(0,Math.ceil(v*.1)),C-=Math.max(0,Math.ceil(C*.1)),y=he(Q.relativeLuminance2(d,v,C),Q.relativeLuminance2(a,u,h));return(d<<24|v<<16|C<<8|255)>>>0}o.reduceLuminance=t;function r(n,c,l){let a=n>>24&255,u=n>>16&255,h=n>>8&255,d=c>>24&255,v=c>>16&255,C=c>>8&255,y=he(Q.relativeLuminance2(d,v,C),Q.relativeLuminance2(a,u,h));for(;y<l&&(d<255||v<255||C<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),y=he(Q.relativeLuminance2(d,v,C),Q.relativeLuminance2(a,u,h));return(d<<24|v<<16|C<<8|255)>>>0}o.increaseLuminance=r;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}o.toChannels=s})(de||={});function ge(i){let e=i.toString(16);return e.length<2?"0"+e:e}function he(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function w(i){if(!i)throw new Error("value must not be falsy");return i}function Ze(i){return 57508<=i&&i<=57558}function Ti(i){return 57520<=i&&i<=57527}function Sr(i){return 57344<=i&&i<=63743}function yr(i){return 9472<=i&&i<=9631}function Ir(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function gi(i,e,t,r){return e===1&&t>Math.ceil(r*1.5)&&i!==void 0&&i>255&&!Ir(i)&&!Ze(i)&&!Sr(i)}function Je(i){return Ze(i)||yr(i)}function xi(){return{css:{canvas:Ye(),cell:Ye()},device:{canvas:Ye(),cell:Ye(),char:{width:0,height:0,left:0,top:0}}}}function Ye(){return{width:0,height:0}}function Ci(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var K=0,z=0,le=!1,pe=!1,et=!1,J,kt=0,tt=class{constructor(e,t,r,s,o,n){this._terminal=e;this._optionService=t;this._selectionRenderModel=r;this._decorationService=s;this._coreBrowserService=o;this._themeService=n;this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,z=0,K=0,pe=!1,le=!1,et=!1,J=this._themeService.colors,kt=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));kt=t*s%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(z=n.backgroundColorRGB.rgba>>8&16777215,pe=!0),n.foregroundColorRGB&&(K=n.foregroundColorRGB.rgba>>8&16777215,le=!0)}),et=this._selectionRenderModel.isCellSelected(this._terminal,t,r),et){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:z=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:z=(this.result.fg&16777215)<<8|255;break;case 0:default:z=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:z=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:z=(this.result.bg&16777215)<<8|255;break}z=de.blend(z,(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else z=(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(pe=!0,J.selectionForeground&&(K=J.selectionForeground.rgba>>8&16777215,le=!0),Je(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)K=(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:K=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:K=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:K=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:K=(this.result.fg&16777215)<<8|255;break;case 0:default:K=this._themeService.colors.foreground.rgba}K=de.blend(K,(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}le=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(z=n.backgroundColorRGB.rgba>>8&16777215,pe=!0),n.foregroundColorRGB&&(K=n.foregroundColorRGB.rgba>>8&16777215,le=!0)}),pe&&(et?z=e.bg&-16777216&-134217729|z|50331648:z=e.bg&-16777216|z|50331648),le&&(K=e.fg&-16777216&-67108865|K|50331648),this.result.fg&67108864&&(pe&&!le&&((this.result.bg&50331648)===0?K=this.result.fg&-134217728|J.background.rgba>>8&16777215&16777215|50331648:K=this.result.fg&-134217728|this.result.bg&67108863,le=!0),!pe&&le&&((this.result.fg&50331648)===0?z=this.result.bg&-67108864|J.foreground.rgba>>8&16777215&16777215|50331648:z=this.result.bg&-67108864|this.result.fg&67108863,pe=!0)),J=void 0,this.result.bg=pe?z:this.result.bg,this.result.fg=le?K:this.result.fg,this.result.ext&=536870911,this.result.ext|=kt<<29&3758096384}};var Ii=257,Li=.5,it=_i||mi?"bottom":"ideographic";var Rr={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{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}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{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}],"\u{1FB96}":[{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}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Dr={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};var Or={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2551":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2552":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u2553":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"\u2554":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2555":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"\u2556":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"\u2557":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"\u2558":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"\u2559":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u255A":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"\u255B":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"\u255C":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"\u255D":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"\u255E":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u255F":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"\u2560":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2561":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"\u2562":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2563":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"\u2564":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"\u2565":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"\u2566":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2567":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2568":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u2569":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u256A":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u256B":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u256C":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{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"},"\u2509":{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"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"\u256E":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"\u256F":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"\u2570":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}};var $e={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{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},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{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},"\uE0B7":{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},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};$e["\uE0BB"]=$e["\uE0BD"];$e["\uE0BF"]=$e["\uE0B9"];function Di(i,e,t,r,s,o,n,c){let l=Rr[e];if(l)return Mr(i,l,t,r,s,o),!0;let a=Dr[e];if(a)return wr(i,a,t,r,s,o),!0;let u=Or[e];if(u)return Ar(i,u,t,r,s,o,c),!0;let h=$e[e];return h?(Fr(i,h,t,r,s,o,n,c),!0):!1}function Mr(i,e,t,r,s,o){for(let n=0;n<e.length;n++){let c=e[n],l=s/8,a=o/8;i.fillRect(t+c.x*l,r+c.y*a,c.w*l,c.h*a)}}var Ei=new Map;function wr(i,e,t,r,s,o){let n=Ei.get(e);n||(n=new Map,Ei.set(e,n));let c=i.fillStyle;if(typeof c!="string")throw new Error(`Unexpected fillStyle type "${c}"`);let l=n.get(c);if(!l){let a=e[0].length,u=e.length,h=i.canvas.ownerDocument.createElement("canvas");h.width=a,h.height=u;let d=w(h.getContext("2d")),v=new ImageData(a,u),C,y,R,A;if(c.startsWith("#"))C=parseInt(c.slice(1,3),16),y=parseInt(c.slice(3,5),16),R=parseInt(c.slice(5,7),16),A=c.length>7&&parseInt(c.slice(7,9),16)||1;else if(c.startsWith("rgba"))[C,y,R,A]=c.substring(5,c.length-1).split(",").map(I=>parseFloat(I));else throw new Error(`Unexpected fillStyle color format "${c}" when drawing pattern glyph`);for(let I=0;I<u;I++)for(let k=0;k<a;k++)v.data[(I*a+k)*4]=C,v.data[(I*a+k)*4+1]=y,v.data[(I*a+k)*4+2]=R,v.data[(I*a+k)*4+3]=e[I][k]*(A*255);d.putImageData(v,0,0),l=w(i.createPattern(h,null)),n.set(c,l)}i.fillStyle=l,i.fillRect(t,r,s,o)}function Ar(i,e,t,r,s,o,n){i.strokeStyle=i.fillStyle;for(let[c,l]of Object.entries(e)){i.beginPath(),i.lineWidth=n*Number.parseInt(c);let a;if(typeof l=="function"){let h=.15/o*s;a=l(.15,h)}else a=l;for(let u of a.split(" ")){let h=u[0],d=Oi[h];if(!d){console.error(`Could not find drawing instructions for "${h}"`);continue}let v=u.substring(1).split(",");!v[0]||!v[1]||d(i,Mi(v,s,o,t,r,!0,n))}i.stroke(),i.closePath()}}function Fr(i,e,t,r,s,o,n,c){let l=new Path2D;l.rect(t,r,s,o),i.clip(l),i.beginPath();let a=n/12;i.lineWidth=c*a;for(let u of e.d.split(" ")){let h=u[0],d=Oi[h];if(!d){console.error(`Could not find drawing instructions for "${h}"`);continue}let v=u.substring(1).split(",");!v[0]||!v[1]||d(i,Mi(v,s,o,t,r,!1,c,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function Ri(i,e,t=0){return Math.max(Math.min(i,e),t)}var Oi={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function Mi(i,e,t,r,s,o,n,c=0,l=0){let a=i.map(u=>parseFloat(u)||parseInt(u));if(a.length<2)throw new Error("Too few arguments for instruction");for(let u=0;u<a.length;u+=2)a[u]*=e-c*n-l*n,o&&a[u]!==0&&(a[u]=Ri(Math.round(a[u]+.5)-.5,e,0)),a[u]+=r+c*n;for(let u=1;u<a.length;u+=2)a[u]*=t,o&&a[u]!==0&&(a[u]=Ri(Math.round(a[u]+.5)-.5,t,0)),a[u]+=s;return a}var rt=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ge=class{constructor(){this._data=new rt}set(e,t,r,s,o){this._data.get(e,t)||this._data.set(e,t,new rt),this._data.get(e,t).set(r,s,o)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}};var nt=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,r=0,s=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},Pt=class extends nt{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}},Nt=class extends nt{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},wi=!Qe&&"requestIdleCallback"in window?Nt:Pt;var re=class i{constructor(){this.fg=0;this.bg=0;this.extended=new Ue}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Ue=class i{constructor(e=0,t=0){this._ext=0;this._urlId=0;this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new i(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var $t=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ot.isErrorNoTelemetry(e)?new ot(e.message+`
18
+
19
+ `+e.stack):new Error(e.message+`
20
+
21
+ `+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)}},Br=new $t;function at(i){kr(i)||Br.onUnexpectedError(i)}var Gt="Canceled";function kr(i){return i instanceof st?!0:i instanceof Error&&i.name===Gt&&i.message===Gt}var st=class extends Error{constructor(){super(Gt),this.name=this.message}};var ot=class i extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof i)return e;let t=new i;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function Ut(i,e){let t=this,r=!1,s;return function(){if(r)return s;if(r=!0,e)try{s=i.apply(t,arguments)}finally{e()}else s=i.apply(t,arguments);return s}}function Pr(i,e,t=0,r=i.length){let s=t,o=r;for(;s<o;){let n=Math.floor((s+o)/2);e(i[n])?s=n+1:o=n}return s-1}var lt=class lt{constructor(e){this._array=e;this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(lt.assertInvariants){if(this._prevFindLastPredicate){for(let r of this._array)if(this._prevFindLastPredicate(r)&&!e(r))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}let t=Pr(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};lt.assertInvariants=!1;var Ai=lt;var Bi;(c=>{function i(l){return l<0}c.isLessThan=i;function e(l){return l<=0}c.isLessThanOrEqual=e;function t(l){return l>0}c.isGreaterThan=t;function r(l){return l===0}c.isNeitherLessOrGreaterThan=r,c.greaterThan=1,c.lessThan=-1,c.neitherLessOrGreaterThan=0})(Bi||={});function ki(i,e){return(t,r)=>e(i(t),i(r))}var Pi=(i,e)=>i-e;var Se=class Se{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new Se(t=>this.iterate(r=>e(r)?t(r):!0))}map(e){return new Se(t=>this.iterate(r=>t(e(r))))}some(e){let t=!1;return this.iterate(r=>(t=e(r),!t)),t}findFirst(e){let t;return this.iterate(r=>e(r)?(t=r,!1):!0),t}findLast(e){let t;return this.iterate(r=>(e(r)&&(t=r),!0)),t}findLastMaxBy(e){let t,r=!0;return this.iterate(s=>((r||Bi.isGreaterThan(e(s,t)))&&(r=!1,t=s),!0)),t}};Se.empty=new Se(e=>{});var Fi=Se;function Ui(i,e){let t=Object.create(null);for(let r of i){let s=e(r),o=t[s];o||(o=t[s]=[]),o.push(r)}return t}var $i,Gi,Ni=class{constructor(e,t){this.toKey=t;this._map=new Map;this[$i]="SetWithKey";for(let r of e)this.add(r)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(r=>e.call(t,r,r,this))}[(Gi=Symbol.iterator,$i=Symbol.toStringTag,Gi)](){return this.values()}};var ct=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){let t=this.map.get(e);return t||new Set}};var Ht;(k=>{function i(x){return x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}k.is=i;let e=Object.freeze([]);function t(){return e}k.empty=t;function*r(x){yield x}k.single=r;function s(x){return i(x)?x:r(x)}k.wrap=s;function o(x){return x||e}k.from=o;function*n(x){for(let L=x.length-1;L>=0;L--)yield x[L]}k.reverse=n;function c(x){return!x||x[Symbol.iterator]().next().done===!0}k.isEmpty=c;function l(x){return x[Symbol.iterator]().next().value}k.first=l;function a(x,L){let E=0;for(let U of x)if(L(U,E++))return!0;return!1}k.some=a;function u(x,L){for(let E of x)if(L(E))return E}k.find=u;function*h(x,L){for(let E of x)L(E)&&(yield E)}k.filter=h;function*d(x,L){let E=0;for(let U of x)yield L(U,E++)}k.map=d;function*v(x,L){let E=0;for(let U of x)yield*L(U,E++)}k.flatMap=v;function*C(...x){for(let L of x)yield*L}k.concat=C;function y(x,L,E){let U=E;for(let ce of x)U=L(U,ce);return U}k.reduce=y;function*R(x,L,E=x.length){for(L<0&&(L+=x.length),E<0?E+=x.length:E>x.length&&(E=x.length);L<E;L++)yield x[L]}k.slice=R;function A(x,L=Number.POSITIVE_INFINITY){let E=[];if(L===0)return[E,x];let U=x[Symbol.iterator]();for(let ce=0;ce<L;ce++){let ue=U.next();if(ue.done)return[E,k.empty()];E.push(ue.value)}return[E,{[Symbol.iterator](){return U}}]}k.consume=A;async function I(x){let L=[];for await(let E of x)L.push(E);return Promise.resolve(L)}k.asyncToArray=I})(Ht||={});var Nr=!1,ye=null,ut=class ut{constructor(){this.livingDisposables=new Map}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:ut.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){let t=this.getDisposableData(e);t.source||(t.source=new Error().stack)}setParent(e,t){let r=this.getDisposableData(e);r.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let r=t.get(e);if(r)return r;let s=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,s),s}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,e).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(e=10,t){let r;if(t)r=t;else{let l=new Map,a=[...this.livingDisposables.values()].filter(h=>h.source!==null&&!this.getRootParent(h,l).isSingleton);if(a.length===0)return;let u=new Set(a.map(h=>h.value));if(r=a.filter(h=>!(h.parent&&u.has(h.parent))),r.length===0)throw new Error("There are cyclic diposable chains!")}if(!r)return;function s(l){function a(h,d){for(;h.length>0&&d.some(v=>typeof v=="string"?v===h[0]:h[0].match(v));)h.shift()}let u=l.source.split(`
22
+ `).map(h=>h.trim().replace("at ","")).filter(h=>h!=="");return a(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let o=new ct;for(let l of r){let a=s(l);for(let u=0;u<=a.length;u++)o.add(a.slice(0,u).join(`
23
+ `),l)}r.sort(ki(l=>l.idx,Pi));let n="",c=0;for(let l of r.slice(0,e)){c++;let a=s(l),u=[];for(let h=0;h<a.length;h++){let d=a[h];d=`(shared with ${o.get(a.slice(0,h+1).join(`
24
+ `)).size}/${r.length} leaks) at ${d}`;let C=o.get(a.slice(0,h).join(`
25
+ `)),y=Ui([...C].map(R=>s(R)[h]),R=>R);delete y[a[h]];for(let[R,A]of Object.entries(y))u.unshift(` - stacktraces of ${A.length} other leaks continue with ${R}`);u.unshift(d)}n+=`
26
+
27
+
28
+ ==================== Leaking disposable ${c}/${r.length}: ${l.value.constructor.name} ====================
29
+ ${u.join(`
30
+ `)}
31
+ ============================================================
32
+
33
+ `}return r.length>e&&(n+=`
34
+
35
+
36
+ ... and ${r.length-e} more leaking disposables
37
+
38
+ `),{leaks:r,details:n}}};ut.idx=0;var Hi=ut;function $r(i){ye=i}if(Nr){let i="__is_disposable_tracked__";$r(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[i]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==fe.None)try{e[i]=!0}catch{}}markAsDisposed(e){if(e&&e!==fe.None)try{e[i]=!0}catch{}}markAsSingleton(e){}})}function Vt(i){return ye?.trackDisposable(i),i}function zt(i){ye?.markAsDisposed(i)}function Wt(i,e){ye?.setParent(i,e)}function Gr(i,e){if(ye)for(let t of i)ye.setParent(t,e)}function Wi(i){if(Ht.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Vi(...i){let e=Kt(()=>Wi(i));return Gr(i,e),e}function Kt(i){let e=Vt({dispose:Ut(()=>{zt(e),i()})});return e}var ht=class ht{constructor(){this._toDispose=new Set;this._isDisposed=!1;Vt(this)}dispose(){this._isDisposed||(zt(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Wi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return Wt(e,this),this._isDisposed?ht.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Wt(e,null))}};ht.DISABLE_DISPOSED_WARNING=!1;var Ie=ht,fe=class{constructor(){this._store=new Ie;Vt(this),Wt(this._store,this)}dispose(){zt(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};fe.None=Object.freeze({dispose(){}});var Le=class Le{constructor(e){this.element=e,this.next=Le.Undefined,this.prev=Le.Undefined}};Le.Undefined=new Le(void 0);var zi=Le;var Ur=globalThis.performance&&typeof globalThis.performance.now=="function",dt=class i{static create(e){return new i(e)}constructor(e){this._now=Ur&&e===!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}};var Hr=!1,Ki=!1,Wr=!1,_e;(se=>{se.None=()=>fe.None;function e(T){if(Wr){let{onDidAddListener:f}=T,g=He.create(),p=0;T.onDidAddListener=()=>{++p===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),g.print()),f?.()}}}function t(T,f){return d(T,()=>{},0,void 0,!0,void 0,f)}se.defer=t;function r(T){return(f,g=null,p)=>{let _=!1,b;return b=T(m=>{if(!_)return b?b.dispose():_=!0,f.call(g,m)},null,p),_&&b.dispose(),b}}se.once=r;function s(T,f,g){return u((p,_=null,b)=>T(m=>p.call(_,f(m)),null,b),g)}se.map=s;function o(T,f,g){return u((p,_=null,b)=>T(m=>{f(m),p.call(_,m)},null,b),g)}se.forEach=o;function n(T,f,g){return u((p,_=null,b)=>T(m=>f(m)&&p.call(_,m),null,b),g)}se.filter=n;function c(T){return T}se.signal=c;function l(...T){return(f,g=null,p)=>{let _=Vi(...T.map(b=>b(m=>f.call(g,m))));return h(_,p)}}se.any=l;function a(T,f,g,p){let _=g;return s(T,b=>(_=f(_,b),_),p)}se.reduce=a;function u(T,f){let g,p={onWillAddFirstListener(){g=T(_.fire,_)},onDidRemoveLastListener(){g?.dispose()}};f||e(p);let _=new B(p);return f?.add(_),_.event}function h(T,f){return f instanceof Array?f.push(T):f&&f.add(T),T}function d(T,f,g=100,p=!1,_=!1,b,m){let S,D,M,oe=0,ie,ae={leakWarningThreshold:b,onWillAddFirstListener(){S=T(P=>{oe++,D=f(D,P),p&&!M&&(q.fire(D),D=void 0),ie=()=>{let X=D;D=void 0,M=void 0,(!p||oe>1)&&q.fire(X),oe=0},typeof g=="number"?(clearTimeout(M),M=setTimeout(ie,g)):M===void 0&&(M=0,queueMicrotask(ie))})},onWillRemoveListener(){_&&oe>0&&ie?.()},onDidRemoveLastListener(){ie=void 0,S.dispose()}};m||e(ae);let q=new B(ae);return m?.add(q),q.event}se.debounce=d;function v(T,f=0,g){return se.debounce(T,(p,_)=>p?(p.push(_),p):[_],f,void 0,!0,void 0,g)}se.accumulate=v;function C(T,f=(p,_)=>p===_,g){let p=!0,_;return n(T,b=>{let m=p||!f(b,_);return p=!1,_=b,m},g)}se.latch=C;function y(T,f,g){return[se.filter(T,f,g),se.filter(T,p=>!f(p),g)]}se.split=y;function R(T,f=!1,g=[],p){let _=g.slice(),b=T(D=>{_?_.push(D):S.fire(D)});p&&p.add(b);let m=()=>{_?.forEach(D=>S.fire(D)),_=null},S=new B({onWillAddFirstListener(){b||(b=T(D=>S.fire(D)),p&&p.add(b))},onDidAddFirstListener(){_&&(f?setTimeout(m):m())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return p&&p.add(S),S.event}se.buffer=R;function A(T,f){return(p,_,b)=>{let m=f(new k);return T(function(S){let D=m.evaluate(S);D!==I&&p.call(_,D)},void 0,b)}}se.chain=A;let I=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(f){return this.steps.push(f),this}forEach(f){return this.steps.push(g=>(f(g),g)),this}filter(f){return this.steps.push(g=>f(g)?g:I),this}reduce(f,g){let p=g;return this.steps.push(_=>(p=f(p,_),p)),this}latch(f=(g,p)=>g===p){let g=!0,p;return this.steps.push(_=>{let b=g||!f(_,p);return g=!1,p=_,b?_:I}),this}evaluate(f){for(let g of this.steps)if(f=g(f),f===I)break;return f}}function x(T,f,g=p=>p){let p=(...S)=>m.fire(g(...S)),_=()=>T.on(f,p),b=()=>T.removeListener(f,p),m=new B({onWillAddFirstListener:_,onDidRemoveLastListener:b});return m.event}se.fromNodeEventEmitter=x;function L(T,f,g=p=>p){let p=(...S)=>m.fire(g(...S)),_=()=>T.addEventListener(f,p),b=()=>T.removeEventListener(f,p),m=new B({onWillAddFirstListener:_,onDidRemoveLastListener:b});return m.event}se.fromDOMEventEmitter=L;function E(T){return new Promise(f=>r(T)(f))}se.toPromise=E;function U(T){let f=new B;return T.then(g=>{f.fire(g)},()=>{f.fire(void 0)}).finally(()=>{f.dispose()}),f.event}se.fromPromise=U;function ce(T,f){return T(g=>f.fire(g))}se.forward=ce;function ue(T,f,g){return f(g),T(p=>f(p))}se.runAndSubscribe=ue;class Ce{constructor(f,g){this._observable=f;this._counter=0;this._hasChanged=!1;let p={onWillAddFirstListener:()=>{f.addObserver(this)},onDidRemoveLastListener:()=>{f.removeObserver(this)}};g||e(p),this.emitter=new B(p),g&&g.add(this.emitter)}beginUpdate(f){this._counter++}handlePossibleChange(f){}handleChange(f,g){this._hasChanged=!0}endUpdate(f){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function O(T,f){return new Ce(T,f).emitter.event}se.fromObservable=O;function Be(T){return(f,g,p)=>{let _=0,b=!1,m={beginUpdate(){_++},endUpdate(){_--,_===0&&(T.reportChanges(),b&&(b=!1,f.call(g)))},handlePossibleChange(){},handleChange(){b=!0}};T.addObserver(m),T.reportChanges();let S={dispose(){T.removeObserver(m)}};return p instanceof Ie?p.add(S):Array.isArray(p)&&p.push(S),S}}se.fromObservableLight=Be})(_e||={});var Ee=class Ee{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${e}_${Ee._idPool++}`,Ee.all.add(this)}start(e){this._stopWatch=new dt,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ee.all=new Set,Ee._idPool=0;var qt=Ee,qi=-1;var ft=class ft{constructor(e,t,r=(ft._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=r;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let r=this.threshold;if(r<=0||t<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[o,n]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${n}):`;console.warn(c),console.warn(o);let l=new Xt(c,o);this._errorHandler(l)}return()=>{let o=this._stacks.get(e.value)||0;this._stacks.set(e.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[r,s]of this._stacks)(!e||t<s)&&(e=[r,s],t=s);return e}};ft._idPool=1;var jt=ft,He=class i{constructor(e){this.value=e}static create(){let e=new Error;return new i(e.stack??"")}print(){console.warn(this.value.split(`
39
+ `).slice(2).join(`
40
+ `))}},Xt=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Qt=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Vr=0,Re=class{constructor(e){this.value=e;this.id=Vr++}},zr=2,Kr=(i,e)=>{if(i instanceof Re)e(i);else for(let t=0;t<i.length;t++){let r=i[t];r&&e(r)}},pt;if(Hr){let i=[];setInterval(()=>{i.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(i.join(`
41
+ `)),i.length=0)},3e3),pt=new FinalizationRegistry(e=>{typeof e=="string"&&i.push(e)})}var B=class{constructor(e){this._size=0;this._options=e,this._leakageMon=qi>0||this._options?.leakWarningThreshold?new jt(e?.onListenerError??at,this._options?.leakWarningThreshold??qi):void 0,this._perfMon=this._options?._profName?new qt(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ki){let e=this._listeners;queueMicrotask(()=>{Kr(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],u=new Qt(`${l}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||at)(u),fe.None}if(this._disposed)return fe.None;t&&(e=e.bind(t));let s=new Re(e),o,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=He.create(),o=this._leakageMon.check(s.stack,this._size+1)),Ki&&(s.stack=n??He.create()),this._listeners?this._listeners instanceof Re?(this._deliveryQueue??=new Yt,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Kt(()=>{pt?.unregister(c),o?.(),this._removeListener(s)});if(r instanceof Ie?r.add(c):Array.isArray(r)&&r.push(c),pt){let l=new Error().stack.split(`
42
+ `).slice(2,3).join(`
43
+ `).trim(),a=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);pt.register(c,a?.[2]??l,c)}return c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-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[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*zr<=t.length){let o=0;for(let n=0;n<t.length;n++)t[n]?t[o++]=t[n]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||at;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Re)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var Yt=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var ji={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}},We=2;var Ve,ee=class i{constructor(e,t,r){this._document=e;this._config=t;this._unicodeService=r;this._didWarmUp=!1;this._cacheMap=new Ge;this._cacheMapCombined=new Ge;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new re;this._textureSize=512;this._onAddTextureAtlasCanvas=new B;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new B;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=!1;this._createNewPage(),this._tmpCanvas=Xi(e,this._config.deviceCellWidth*4+We*2,this._config.deviceCellHeight+We*2),this._tmpCtx=w(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new wi;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let r=this._drawToCache(t,0,0,0);this._cacheMap.set(t,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(i.maxAtlasPages&&this._pages.length>=Math.max(4,i.maxAtlasPages)){let t=this._pages.filter(a=>a.canvas.width*2<=(i.maxTextureSize||4096)).sort((a,u)=>u.canvas.width!==a.canvas.width?u.canvas.width-a.canvas.width:u.percentageUsed-a.percentageUsed),r=-1,s=0;for(let a=0;a<t.length;a++)if(t[a].canvas.width!==s)r=a,s=t[a].canvas.width;else if(a-r===3)break;let o=t.slice(r,r+4),n=o.map(a=>a.glyphs[0].texturePage).sort((a,u)=>a>u?1:-1),c=this.pages.length-o.length,l=this._mergePages(o,c);l.version++;for(let a=n.length-1;a>=0;a--)this._deletePage(n[a]);this.pages.push(l),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(l.canvas)}let e=new _t(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let r=e[0].canvas.width*2,s=new _t(this._document,r,e);for(let[o,n]of e.entries()){let c=o*n.canvas.width%r,l=Math.floor(o/2)*n.canvas.height;s.ctx.drawImage(n.canvas,c,l);for(let u of n.glyphs)u.texturePage=t,u.sizeClipSpace.x=u.size.x/r,u.sizeClipSpace.y=u.size.y/r,u.texturePosition.x+=c,u.texturePosition.y+=l,u.texturePositionClipSpace.x=u.texturePosition.x/r,u.texturePositionClipSpace.y=u.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);a!==-1&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let r=this._pages[t];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,t,r,s,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,r,s,o)}getRasterizedGlyph(e,t,r,s,o){return this._getFromCacheMap(this._cacheMap,e,t,r,s,o)}_getFromCacheMap(e,t,r,s,o,n=!1){return Ve=e.get(t,r,s,o),Ve||(Ve=this._drawToCache(t,r,s,o,n),e.set(t,r,s,o,Ve)),Ve}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,r,s){if(this._config.allowTransparency)return Z;let o;switch(e){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(t);break;case 50331648:let n=re.toColorRGB(t);o=j.toColor(n[0],n[1],n[2]);break;case 0:default:r?o=Pe.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return o}_getForegroundColor(e,t,r,s,o,n,c,l,a,u){let h=this._getMinimumContrastColor(e,t,r,s,o,n,c,a,l,u);if(h)return h;let d;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&n<8&&(n+=8),d=this._getColorFromAnsiIndex(n);break;case 50331648:let v=re.toColorRGB(n);d=j.toColor(v[0],v[1],v[2]);break;case 0:default:c?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=Pe.opaque(d)),l&&(d=Pe.multiplyOpacity(d,Li)),d}_resolveBackgroundRgba(e,t,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,r,s,o,n,c,l,a,u){if(this._config.minimumContrastRatio===1||u)return;let h=this._getContrastCache(a),d=h.getColor(e,s);if(d!==void 0)return d||void 0;let v=this._resolveBackgroundRgba(t,r,c),C=this._resolveForegroundRgba(o,n,c,l),y=de.ensureContrastRatio(v,C,this._config.minimumContrastRatio/(a?2:1));if(!y){h.setColor(e,s,null);return}let R=j.toColor(y>>24&255,y>>16&255,y>>8&255);return h.setColor(e,s,R),R}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,r,s,o=!1){let n=typeof e=="number"?String.fromCharCode(e):e,c=Math.min(this._config.deviceCellWidth*Math.max(n.length,2)+We*2,this._textureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let l=Math.min(this._config.deviceCellHeight+We*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return ji;let u=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),C=!!this._workAttributeData.isUnderline(),y=!!this._workAttributeData.isStrikethrough(),R=!!this._workAttributeData.isOverline(),A=this._workAttributeData.getFgColor(),I=this._workAttributeData.getFgColorMode(),k=this._workAttributeData.getBgColor(),x=this._workAttributeData.getBgColorMode();if(h){let m=A;A=k,k=m;let S=I;I=x,x=S}let L=this._getBackgroundColor(x,k,h,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let E=u?this._config.fontWeightBold:this._config.fontWeight,U=v?"italic":"";this._tmpCtx.font=`${U} ${E} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=it;let ce=n.length===1&&Ze(n.charCodeAt(0)),ue=n.length===1&&Ti(n.charCodeAt(0)),Ce=this._getForegroundColor(t,x,k,r,I,A,h,d,u,Je(n.charCodeAt(0)));this._tmpCtx.fillStyle=Ce.css;let O=ue?0:We*2,Be=!1;this._config.customGlyphs!==!1&&(Be=Di(this._tmpCtx,n,O,O,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let se=!ce,T;if(typeof e=="number"?T=this._unicodeService.wcwidth(e):T=this._unicodeService.getStringCellWidth(e),C){this._tmpCtx.save();let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),S=m%2===1?.5:0;if(this._tmpCtx.lineWidth=m,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())se=!1,this._tmpCtx.strokeStyle=`rgb(${re.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{se=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();let D=O,M=Math.ceil(O+this._config.deviceCharHeight)-S-(o?m*2:0),oe=M+m,ie=M+m*2,ae=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<T;q++){this._tmpCtx.save();let P=D+q*this._config.deviceCellWidth,X=D+(q+1)*this._config.deviceCellWidth,Mt=P+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(P,M),this._tmpCtx.lineTo(X,M),this._tmpCtx.moveTo(P,ie),this._tmpCtx.lineTo(X,ie);break;case 3:let qe=m<=1?ie:Math.ceil(O+this._config.deviceCharHeight-m/2)-S,je=m<=1?M:Math.ceil(O+this._config.deviceCharHeight+m/2)-S,ci=new Path2D;ci.rect(P,M,this._config.deviceCellWidth,ie-M),this._tmpCtx.clip(ci),this._tmpCtx.moveTo(P-this._config.deviceCellWidth/2,oe),this._tmpCtx.bezierCurveTo(P-this._config.deviceCellWidth/2,je,P,je,P,oe),this._tmpCtx.bezierCurveTo(P,qe,Mt,qe,Mt,oe),this._tmpCtx.bezierCurveTo(Mt,je,X,je,X,oe),this._tmpCtx.bezierCurveTo(X,qe,X+this._config.deviceCellWidth/2,qe,X+this._config.deviceCellWidth/2,oe);break;case 4:let Xe=ae===0?0:ae>=m?m*2-ae:m-ae;!(ae>=m)===!1||Xe===0?(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(P+Xe,M),this._tmpCtx.lineTo(X,M)):(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(P,M),this._tmpCtx.lineTo(P+Xe,M),this._tmpCtx.moveTo(P+Xe+m,M),this._tmpCtx.lineTo(X,M)),ae=Ci(X-P,m,ae);break;case 5:let mr=.6,vr=.3,wt=X-P,ui=Math.floor(mr*wt),hi=Math.floor(vr*wt),br=wt-ui-hi;this._tmpCtx.setLineDash([ui,hi,br]),this._tmpCtx.moveTo(P,M),this._tmpCtx.lineTo(X,M);break;case 1:default:this._tmpCtx.moveTo(P,M),this._tmpCtx.lineTo(X,M);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Be&&this._config.fontSize>=12&&!this._config.allowTransparency&&n!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let q=this._tmpCtx.measureText(n);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();let P=new Path2D;P.rect(D,M-Math.ceil(m/2),this._config.deviceCellWidth*T,ie-M+Math.ceil(m/2)),this._tmpCtx.clip(P),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(n,O,O+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(R){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),S=m%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+S),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*T,O+S),this._tmpCtx.stroke()}if(Be||this._tmpCtx.fillText(n,O,O+this._config.deviceCharHeight),n==="_"&&!this._config.allowTransparency){let m=Jt(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Ce,se);if(m)for(let S=1;S<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(n,O,O+this._config.deviceCharHeight-S),m=Jt(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Ce,se),!!m);S++);}if(y){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),S=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+Math.floor(this._config.deviceCharHeight/2)-S),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*T,O+Math.floor(this._config.deviceCharHeight/2)-S),this._tmpCtx.stroke()}this._tmpCtx.restore();let f=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),g;if(this._config.allowTransparency?g=qr(f):g=Jt(f,L,Ce,se),g)return ji;let p=this._findGlyphBoundingBox(f,this._workBoundingBox,c,ue,Be,O),_,b;for(;;){if(this._activePages.length===0){let m=this._createNewPage();_=m,b=m.currentRow,b.height=p.size.y;break}_=this._activePages[this._activePages.length-1],b=_.currentRow;for(let m of this._activePages)p.size.y<=m.currentRow.height&&(_=m,b=m.currentRow);for(let m=this._activePages.length-1;m>=0;m--)for(let S of this._activePages[m].fixedRows)S.height<=b.height&&p.size.y<=S.height&&(_=this._activePages[m],b=S);if(b.y+p.size.y>=_.canvas.height||b.height>p.size.y+2){let m=!1;if(_.currentRow.y+_.currentRow.height+p.size.y>=_.canvas.height){let S;for(let D of this._activePages)if(D.currentRow.y+D.currentRow.height+p.size.y<D.canvas.height){S=D;break}if(S)_=S;else if(i.maxAtlasPages&&this._pages.length>=i.maxAtlasPages&&b.y+p.size.y<=_.canvas.height&&b.height>=p.size.y&&b.x+p.size.x<=_.canvas.width)m=!0;else{let D=this._createNewPage();_=D,b=D.currentRow,b.height=p.size.y,m=!0}}m||(_.currentRow.height>0&&_.fixedRows.push(_.currentRow),b={x:0,y:_.currentRow.y+_.currentRow.height,height:p.size.y},_.fixedRows.push(b),_.currentRow={x:0,y:b.y+b.height,height:0})}if(b.x+p.size.x<=_.canvas.width)break;b===_.currentRow?(b.x=0,b.y+=b.height,b.height=0):_.fixedRows.splice(_.fixedRows.indexOf(b),1)}return p.texturePage=this._pages.indexOf(_),p.texturePosition.x=b.x,p.texturePosition.y=b.y,p.texturePositionClipSpace.x=b.x/_.canvas.width,p.texturePositionClipSpace.y=b.y/_.canvas.height,p.sizeClipSpace.x/=_.canvas.width,p.sizeClipSpace.y/=_.canvas.height,b.height=Math.max(b.height,p.size.y),b.x+=p.size.x,_.ctx.putImageData(f,p.texturePosition.x-this._workBoundingBox.left,p.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,p.size.x,p.size.y),_.addGlyph(p),_.version++,p}_findGlyphBoundingBox(e,t,r,s,o,n){t.top=0;let c=s?this._config.deviceCellHeight:this._tmpCanvas.height,l=s?this._config.deviceCellWidth:r,a=!1;for(let u=0;u<c;u++){for(let h=0;h<l;h++){let d=u*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){t.top=u,a=!0;break}}if(a)break}t.left=0,a=!1;for(let u=0;u<n+l;u++){for(let h=0;h<c;h++){let d=h*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){t.left=u,a=!0;break}}if(a)break}t.right=l,a=!1;for(let u=n+l-1;u>=n;u--){for(let h=0;h<c;h++){let d=h*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){t.right=u,a=!0;break}}if(a)break}t.bottom=c,a=!1;for(let u=c-1;u>=0;u--){for(let h=0;h<l;h++){let d=u*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){t.bottom=u,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},_t=class{constructor(e,t,r){this._usedPixels=0;this._glyphs=[];this.version=0;this.currentRow={x:0,y:0,height:0};this.fixedRows=[];if(r)for(let s of r)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=Xi(e,t,t),this.ctx=w(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}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 Jt(i,e,t,r){let s=e.rgba>>>24,o=e.rgba>>>16&255,n=e.rgba>>>8&255,c=t.rgba>>>24,l=t.rgba>>>16&255,a=t.rgba>>>8&255,u=Math.floor((Math.abs(s-c)+Math.abs(o-l)+Math.abs(n-a))/12),h=!0;for(let d=0;d<i.data.length;d+=4)i.data[d]===s&&i.data[d+1]===o&&i.data[d+2]===n||r&&Math.abs(i.data[d]-s)+Math.abs(i.data[d+1]-o)+Math.abs(i.data[d+2]-n)<u?i.data[d+3]=0:h=!1;return h}function qr(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function Xi(i,e,t){let r=i.createElement("canvas");return r.width=e,r.height=t,r}function Qi(i,e,t,r,s,o,n){let c={foreground:o.foreground,background:o.background,cursor:Z,cursorAccent:Z,selectionForeground:Z,selectionBackgroundTransparent:Z,selectionBackgroundOpaque:Z,selectionInactiveBackgroundTransparent:Z,selectionInactiveBackgroundOpaque:Z,overviewRulerBorder:Z,scrollbarSliderBackground:Z,scrollbarSliderHoverBackground:Z,scrollbarSliderActiveBackground:Z,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:n,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:c}}function ei(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function Yi(i){return(i&50331648)===16777216||(i&50331648)===33554432}var te=[];function mt(i,e,t,r,s,o,n,c){let l=Qi(r,s,o,n,e,t,c);for(let h=0;h<te.length;h++){let d=te[h],v=d.ownedBy.indexOf(i);if(v>=0){if(ei(d.config,l))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),te.splice(h,1)):d.ownedBy.splice(v,1);break}}for(let h=0;h<te.length;h++){let d=te[h];if(ei(d.config,l))return d.ownedBy.push(i),d.atlas}let a=i._core,u={atlas:new ee(document,l,a.unicodeService),config:l,ownedBy:[i]};return te.push(u),u.atlas}function ti(i){for(let e=0;e<te.length;e++){let t=te[e].ownedBy.indexOf(i);if(t!==-1){te[e].ownedBy.length===1?(te[e].atlas.dispose(),te.splice(e,1)):te[e].ownedBy.splice(t,1);break}}}var vt=600,bt=class{constructor(e,t){this._renderCallback=e;this._coreBrowserService=t;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(e=vt){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=vt-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=vt-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},vt)},e)}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()}};function ii(i,e,t){let r=new e.ResizeObserver(s=>{let o=s.find(l=>l.target===i);if(!o)return;if(!("devicePixelContentBoxSize"in o)){r?.disconnect(),r=void 0;return}let n=o.devicePixelContentBoxSize[0].inlineSize,c=o.devicePixelContentBoxSize[0].blockSize;n>0&&c>0&&t(n,c)});try{r.observe(i,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return G(()=>r?.disconnect())}function Zi(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var ze=class i extends re{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new Ue;this.combinedData=""}static fromCharData(t){let r=new i;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Zi(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var gt=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function xt(i,e,t){let r=w(i.createProgram());if(i.attachShader(r,w(Ji(i,i.VERTEX_SHADER,e))),i.attachShader(r,w(Ji(i,i.FRAGMENT_SHADER,t))),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS))return r;console.error(i.getProgramInfoLog(r)),i.deleteProgram(r)}function Ji(i,e,t){let r=w(i.createShader(e));if(i.shaderSource(r,t),i.compileShader(r),i.getShaderParameter(r,i.COMPILE_STATUS))return r;console.error(i.getShaderInfoLog(r)),i.deleteShader(r)}function er(i,e){let t=Math.min(i.length*2,e),r=new Float32Array(t);for(let s=0;s<i.length;s++)r[s]=i[s];return r}var Tt=class{constructor(e){this.texture=e,this.version=-1}};var Qr=`#version 300 es
44
+ layout (location = 0) in vec2 a_unitquad;
45
+ layout (location = 1) in vec2 a_cellpos;
46
+ layout (location = 2) in vec2 a_offset;
47
+ layout (location = 3) in vec2 a_size;
48
+ layout (location = 4) in float a_texpage;
49
+ layout (location = 5) in vec2 a_texcoord;
50
+ layout (location = 6) in vec2 a_texsize;
51
+
52
+ uniform mat4 u_projection;
53
+ uniform vec2 u_resolution;
54
+
55
+ out vec2 v_texcoord;
56
+ flat out int v_texpage;
57
+
58
+ void main() {
59
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
60
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
61
+ v_texpage = int(a_texpage);
62
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
63
+ }`;function Yr(i){let e="";for(let t=1;t<i;t++)e+=` else if (v_texpage == ${t}) { outColor = texture(u_texture[${t}], v_texcoord); }`;return`#version 300 es
64
+ precision lowp float;
65
+
66
+ in vec2 v_texcoord;
67
+ flat in int v_texpage;
68
+
69
+ uniform sampler2D u_texture[${i}];
70
+
71
+ out vec4 outColor;
72
+
73
+ void main() {
74
+ if (v_texpage == 0) {
75
+ outColor = texture(u_texture[0], v_texcoord);
76
+ } ${e}
77
+ }`}var Te=11,Me=Te*Float32Array.BYTES_PER_ELEMENT,Zr=2,$=0,F,ni=0,Ke=0,Ct=class extends Y{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._optionsService=o;this._activeBuffer=0;this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let n=this._gl;ee.maxAtlasPages===void 0&&(ee.maxAtlasPages=Math.min(32,w(n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS))),ee.maxTextureSize=w(n.getParameter(n.MAX_TEXTURE_SIZE))),this._program=w(xt(n,Qr,Yr(ee.maxAtlasPages))),this.register(G(()=>n.deleteProgram(this._program))),this._projectionLocation=w(n.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=w(n.getUniformLocation(this._program,"u_resolution")),this._textureLocation=w(n.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),l=n.createBuffer();this.register(G(()=>n.deleteBuffer(l))),n.bindBuffer(n.ARRAY_BUFFER,l),n.bufferData(n.ARRAY_BUFFER,c,n.STATIC_DRAW),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=n.createBuffer();this.register(G(()=>n.deleteBuffer(u))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=w(n.createBuffer()),this.register(G(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,Me,0),n.vertexAttribDivisor(2,1),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,Me,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(3,1),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,1,n.FLOAT,!1,Me,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(4,1),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,2,n.FLOAT,!1,Me,5*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(5,1),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,2,n.FLOAT,!1,Me,7*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(6,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Me,9*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.useProgram(this._program);let h=new Int32Array(ee.maxAtlasPages);for(let d=0;d<ee.maxAtlasPages;d++)h[d]=d;n.uniform1iv(this._textureLocation,h),n.uniformMatrix4fv(this._projectionLocation,!1,gt),this._atlasTextures=[];for(let d=0;d<ee.maxAtlasPages;d++){let v=new Tt(w(n.createTexture()));this.register(G(()=>n.deleteTexture(v.texture))),n.activeTexture(n.TEXTURE0+d),n.bindTexture(n.TEXTURE_2D,v.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=v}n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,o,n,c,l,a,u){this._updateCell(this._vertices.attributes,t,r,s,o,n,c,l,a,u)}_updateCell(t,r,s,o,n,c,l,a,u,h){if($=(s*this._terminal.cols+r)*Te,o===0||o===void 0){t.fill(0,$,$+Te-1-Zr);return}this._atlas&&(a&&a.length>1?F=this._atlas.getRasterizedGlyphCombinedChar(a,n,c,l,!1):F=this._atlas.getRasterizedGlyph(o,n,c,l,!1),ni=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),n!==h&&F.offset.x>ni?(Ke=F.offset.x-ni,t[$]=-(F.offset.x-Ke)+this._dimensions.device.char.left,t[$+1]=-F.offset.y+this._dimensions.device.char.top,t[$+2]=(F.size.x-Ke)/this._dimensions.device.canvas.width,t[$+3]=F.size.y/this._dimensions.device.canvas.height,t[$+4]=F.texturePage,t[$+5]=F.texturePositionClipSpace.x+Ke/this._atlas.pages[F.texturePage].canvas.width,t[$+6]=F.texturePositionClipSpace.y,t[$+7]=F.sizeClipSpace.x-Ke/this._atlas.pages[F.texturePage].canvas.width,t[$+8]=F.sizeClipSpace.y):(t[$]=-F.offset.x+this._dimensions.device.char.left,t[$+1]=-F.offset.y+this._dimensions.device.char.top,t[$+2]=F.size.x/this._dimensions.device.canvas.width,t[$+3]=F.size.y/this._dimensions.device.canvas.height,t[$+4]=F.texturePage,t[$+5]=F.texturePositionClipSpace.x,t[$+6]=F.texturePositionClipSpace.y,t[$+7]=F.sizeClipSpace.x,t[$+8]=F.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&gi(o,u,F.size.x,this._dimensions.device.cell.width)&&(t[$+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*Te;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let o=0;o<t.rows;o++)for(let n=0;n<t.cols;n++)this._vertices.attributes[s+9]=n/t.cols,this._vertices.attributes[s+10]=o/t.rows,s+=Te}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],o=0;for(let n=0;n<t.lineLengths.length;n++){let c=n*this._terminal.cols*Te,l=this._vertices.attributes.subarray(c,c+t.lineLengths[n]*Te);s.set(l,o),o+=l.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,o),r.STREAM_DRAW);for(let n=0;n<this._atlas.pages.length;n++)this._atlas.pages[n].version!==this._atlasTextures[n].version&&this._bindAtlasPageTexture(r,this._atlas,n);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,o/Te)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}};var si=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,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,n=t[1]-o,c=r[1]-o,l=Math.max(n,0),a=Math.min(c,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=c,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function tr(){return new si}var we=4,Ae=1,Fe=2,yt=3,ir=2147483648,St=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=tr()}resize(e,t){let r=e*t*we;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}};var Jr=`#version 300 es
78
+ layout (location = 0) in vec2 a_position;
79
+ layout (location = 1) in vec2 a_size;
80
+ layout (location = 2) in vec4 a_color;
81
+ layout (location = 3) in vec2 a_unitquad;
82
+
83
+ uniform mat4 u_projection;
84
+
85
+ out vec4 v_color;
86
+
87
+ void main() {
88
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
89
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
90
+ v_color = a_color;
91
+ }`,en=`#version 300 es
92
+ precision lowp float;
93
+
94
+ in vec4 v_color;
95
+
96
+ out vec4 outColor;
97
+
98
+ void main() {
99
+ outColor = v_color;
100
+ }`,ve=8,oi=ve*Float32Array.BYTES_PER_ELEMENT,tn=20*ve,It=class{constructor(){this.attributes=new Float32Array(tn),this.count=0}},me=0,rr=0,nr=0,sr=0,or=0,ar=0,lr=0,Lt=class extends Y{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._themeService=o;this._vertices=new It;this._verticesCursor=new It;let n=this._gl;this._program=w(xt(n,Jr,en)),this.register(G(()=>n.deleteProgram(this._program))),this._projectionLocation=w(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),l=n.createBuffer();this.register(G(()=>n.deleteBuffer(l))),n.bindBuffer(n.ARRAY_BUFFER,l),n.bufferData(n.ARRAY_BUFFER,c,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=n.createBuffer();this.register(G(()=>n.deleteBuffer(u))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=w(n.createBuffer()),this.register(G(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,oi,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,oi,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,oi,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this.register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,gt),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.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(t){let r=this._terminal,s=this._vertices,o=1,n,c,l,a,u,h,d,v,C,y,R;for(n=0;n<r.rows;n++){for(l=-1,a=0,u=0,h=!1,c=0;c<r.cols;c++)d=(n*r.cols+c)*we,v=t.cells[d+Ae],C=t.cells[d+Fe],y=!!(C&67108864),(v!==a||C!==u&&(h||y))&&((a!==0||h&&u!==0)&&(R=o++*ve,this._updateRectangle(s,R,u,a,l,c,n)),l=c,a=v,u=C,h=y);(a!==0||h&&u!==0)&&(R=o++*ve,this._updateRectangle(s,R,u,a,l,r.cols,n))}s.count=o}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let o,n=0;(s.style==="bar"||s.style==="outline")&&(o=n++*ve,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(o=n++*ve,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(o=n++*ve,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),o=n++*ve,this._addRectangleFloat(r.attributes,o,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=n}_updateRectangle(t,r,s,o,n,c,l){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:me=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:me=(s&16777215)<<8;break;case 0:default:me=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:me=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:me=(o&16777215)<<8;break;case 0:default:me=this._themeService.colors.background.rgba}t.attributes.length<r+4&&(t.attributes=er(t.attributes,this._terminal.rows*this._terminal.cols*ve)),rr=n*this._dimensions.device.cell.width,nr=l*this._dimensions.device.cell.height,sr=(me>>24&255)/255,or=(me>>16&255)/255,ar=(me>>8&255)/255,lr=1,this._addRectangle(t.attributes,r,rr,nr,(c-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,sr,or,ar,lr)}_addRectangle(t,r,s,o,n,c,l,a,u,h){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=l,t[r+5]=a,t[r+6]=u,t[r+7]=h}_addRectangleFloat(t,r,s,o,n,c,l){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=l[0],t[r+5]=l[1],t[r+6]=l[2],t[r+7]=l[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}};var Et=class extends Y{constructor(t,r,s,o,n,c,l,a){super();this._container=r;this._alpha=n;this._coreBrowserService=c;this._optionsService=l;this._themeService=a;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-${s}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(u=>{this._refreshCharAtlas(t,u),this.reset(t)})),this.register(G(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=w(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,s){}handleSelectionChanged(t,r,s,o=!1){}_setTransparency(t,r){if(r===this._alpha)return;let s=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=mt(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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(t,r,s,o){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(t,r,s,o){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=it,this._clipCell(s,o,r.getWidth()),this._ctx.fillText(r.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,s){let o=r?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${o} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}};var Rt=class extends Et{constructor(e,t,r,s,o,n,c){super(r,e,"link",t,!0,o,n,c),this.register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this.register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===Ii?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Yi(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}};var Dt=class extends Y{constructor(t,r,s,o,n,c,l,a,u){super();this._terminal=t;this._characterJoinerService=r;this._charSizeService=s;this._coreBrowserService=o;this._coreService=n;this._decorationService=c;this._optionsService=l;this._themeService=a;this._cursorBlinkStateManager=new be;this._charAtlasDisposable=this.register(new be);this._observerDisposable=this.register(new be);this._model=new St;this._workCell=new ze;this._workCell2=new ze;this._rectangleRenderer=this.register(new be);this._glyphRenderer=this.register(new be);this._onChangeTextureAtlas=this.register(new B);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new B);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new B);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onRequestRedraw=this.register(new B);this.onRequestRedraw=this._onRequestRedraw.event;this._onContextLoss=this.register(new B);this.onContextLoss=this._onContextLoss.event;this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new tt(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Rt(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,l,this._themeService)],this.dimensions=xi(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(l.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:u};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register(Bt(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this.register(Bt(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ti(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=ii(this._canvas,this._coreBrowserService.window,(d,v)=>this._setCanvasDevicePixelDimensions(d,v)),this.register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=ii(this._canvas,d,(v,C)=>this._setCanvasDevicePixelDimensions(v,C))})),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(G(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),ti(this._terminal)}))}get textureAtlas(){return this._charAtlas?.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(t,r){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let s of this._renderLayers)s.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`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,s){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,t,r,s);this._model.selection.update(this._core,t,r,s),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Lt(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ct(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=mt(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!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=fi([_e.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),_e.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(t){return-1}deregisterCharacterJoiner(t){return!1}renderRows(t,r){if(!this._isAttached)if(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),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 bt(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let s=this._core,o=this._workCell,n,c,l,a,u,h,d,v,C,y,R,A,I,k;t=cr(t,s.rows-1,0),r=cr(r,s.rows-1,0);let x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,L=x-s.buffer.ydisp,E=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),U=-1,ce=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ue=!1;for(c=t;c<=r;c++)for(l=c+s.buffer.ydisp,a=s.buffer.lines.get(l),this._model.lineLengths[c]=0,u=this._characterJoinerService.getJoinedCharacters(l),I=0;I<s.cols;I++)if(n=this._cellColorResolver.result.bg,a.loadCell(I,o),I===0&&(n=this._cellColorResolver.result.bg),h=!1,d=I,u.length>0&&I===u[0][0]&&(h=!0,v=u.shift(),o=new ai(o,a.translateToString(!0,v[0],v[1]),v[1]-v[0]),d=v[1]-1),C=o.getChars(),y=o.getCode(),A=(c*s.cols+I)*we,this._cellColorResolver.resolve(o,I,l,this.dimensions.device.cell.width),ce&&l===x&&(I===E&&(this._model.cursor={x:E,y:L,width:o.getWidth(),style:this._coreBrowserService.isFocused?s.options.cursorStyle||"block":s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},U=E+o.getWidth()-1),I>=E&&I<=U&&(this._coreBrowserService.isFocused&&(s.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&s.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)),y!==0&&(this._model.lineLengths[c]=I+1),!(this._model.cells[A]===y&&this._model.cells[A+Ae]===this._cellColorResolver.result.bg&&this._model.cells[A+Fe]===this._cellColorResolver.result.fg&&this._model.cells[A+yt]===this._cellColorResolver.result.ext)&&(ue=!0,C.length>1&&(y|=ir),this._model.cells[A]=y,this._model.cells[A+Ae]=this._cellColorResolver.result.bg,this._model.cells[A+Fe]=this._cellColorResolver.result.fg,this._model.cells[A+yt]=this._cellColorResolver.result.ext,R=o.getWidth(),this._glyphRenderer.value.updateCell(I,c,y,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,C,R,n),h))for(o=this._workCell,I++;I<d;I++)k=(c*s.cols+I)*we,this._glyphRenderer.value.updateCell(I,c,0,0,0,0,bi,0,0),this._model.cells[k]=0,this._model.cells[k+Ae]=this._cellColorResolver.result.bg,this._model.cells[k+Fe]=this._cellColorResolver.result.fg,this._model.cells[k+yt]=this._cellColorResolver.result.ext;ue&&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(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},ai=class extends re{constructor(t,r,s){super();this.content=0;this.combinedData="";this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function cr(i,e,t=0){return Math.max(Math.min(i,e),t)}var ur="di$target",hr="di$dependencies",li=new Map;function ne(i){if(li.has(i))return li.get(i);let e=function(t,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rn(e,t,s)};return e.toString=()=>i,li.set(i,e),e}function rn(i,e,t){e[ur]===e?e[hr].push({id:i,index:t}):(e[hr]=[{id:i,index:t}],e[ur]=e)}var go=ne("BufferService"),xo=ne("CoreMouseService"),Co=ne("CoreService"),So=ne("CharsetService"),yo=ne("InstantiationService");var Io=ne("LogService"),dr=ne("OptionsService"),Lo=ne("OscLinkService"),Eo=ne("UnicodeService"),Ro=ne("DecorationService");var nn={trace:0,debug:1,info:2,warn:3,error:4,off:5},sn="xterm.js: ",Ot=class extends Y{constructor(t){super();this._optionsService=t;this._logLevel=5;this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),pr=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=nn[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":sn)+r,...s)}trace(t,...r){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,r)}debug(t,...r){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,r)}info(t,...r){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,r)}warn(t,...r){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,r)}error(t,...r){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,r)}};Ot=di([pi(0,dr)],Ot);var pr;function fr(i){pr=i}var _r=class extends Y{constructor(t){if(Ft&&vi()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=t;this._onChangeTextureAtlas=this.register(new B);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new B);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new B);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onContextLoss=this.register(new B);this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this.register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=r.coreService,o=r.optionsService,n=r,c=n._renderService,l=n._characterJoinerService,a=n._charSizeService,u=n._coreBrowserService,h=n._decorationService,d=n._logService,v=n._themeService;fr(d),this._renderer=this.register(new Dt(t,l,a,u,s,h,o,v,this._preserveDrawingBuffer)),this.register(_e.forward(this._renderer.onContextLoss,this._onContextLoss)),this.register(_e.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register(_e.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register(_e.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this.register(G(()=>{let C=this._terminal._core._renderService;C.setRenderer(this._terminal._core._createRenderer()),C.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{_r as WebglAddon};
101
+ //# sourceMappingURL=xterm-addon-webgl.mjs.map