krnell 0.0.0-stage → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/Iniciar_Linux.sh +129 -0
  2. package/Instalar_Atalho_Windows.cmd +40 -0
  3. package/Instalar_Ubuntu.sh +95 -0
  4. package/Painel.cmd +138 -0
  5. package/README.md +82 -2
  6. package/atualizador.py +148 -0
  7. package/bin/krnell.mjs +159 -0
  8. package/bridge.py +5280 -0
  9. package/config.example.json +57 -0
  10. package/contexto.py +204 -0
  11. package/dashboard_web.py +308 -0
  12. package/dns_duck.py +227 -0
  13. package/ferramentas/Liberar_Firewall.ps1 +96 -0
  14. package/ferramentas/firewall_linux.sh +67 -0
  15. package/ferramentas/install_windows.py +482 -0
  16. package/ferramentas/selecionar_provedor.py +76 -0
  17. package/iniciar.sh +255 -0
  18. package/keys.example.env +3 -0
  19. package/kimi.py +567 -0
  20. package/opencode_sync.py +265 -0
  21. package/package.json +68 -4
  22. package/painel.py +5612 -0
  23. package/painel_web.py +367 -0
  24. package/plugins/system-prompt/index.ts +409 -0
  25. package/provedores/kimi/bridge.mjs +4349 -0
  26. package/provedores/kimi/package.json +10 -0
  27. package/provedores_catalogo.py +27 -0
  28. package/tls_proxy.py +205 -0
  29. package/tui_core.py +604 -0
  30. package/web/dist/.vite/manifest.json +84 -0
  31. package/web/dist/assets/LogsPage-DkXN-I7o.js +2 -0
  32. package/web/dist/assets/LogsPage-OsSvuqxQ.js +2 -0
  33. package/web/dist/assets/TerminalPage-CZTPxVyx.js +1 -0
  34. package/web/dist/assets/TerminalPage-D208X99P.js +1 -0
  35. package/web/dist/assets/TerminalPage-DYGPu4ux.css +1 -0
  36. package/web/dist/assets/index-B5rIwous.js +1 -0
  37. package/web/dist/assets/index-CJE_a_Tn.js +27 -0
  38. package/web/dist/assets/index-COlDAcsY.js +1 -0
  39. package/web/dist/assets/index-Dzc8Obwp.css +1 -0
  40. package/web/dist/assets/index-LZadV7rx.js +27 -0
  41. package/web/dist/assets/index-o8xT03ZV.css +1 -0
  42. package/web/dist/assets/press-start-2p-2BZhbCiP.ttf +0 -0
  43. package/web/dist/assets/react-vendor-C475ILlI.js +49 -0
  44. package/web/dist/assets/terminal-vendor-DOrYoP_4.css +32 -0
  45. package/web/dist/assets/terminal-vendor-Dp03d74L.js +38 -0
  46. package/web/dist/assets/terminal-webgl-BRBWwLY7.js +75 -0
  47. package/web/dist/favicon.svg +1 -0
  48. package/web/dist/fonts/OFL.txt +93 -0
  49. package/web/dist/fonts/press-start-2p.ttf +0 -0
  50. package/web/dist/index.html +18 -0
  51. package/workbuddy.py +1965 -0
@@ -0,0 +1,75 @@
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
+ */var Si=(e,t,i,r)=>{for(var s=t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=n(s)||s);return s},Ai=(e,t)=>(i,r)=>t(i,r,e),Ri=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yt.isErrorNoTelemetry(e)?new yt(e.message+`
13
+
14
+ `+e.stack):new Error(e.message+`
15
+
16
+ `+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)}},Ti=new Ri;function et(e){Bi(e)||Ti.onUnexpectedError(e)}var ut="Canceled";function Bi(e){return e instanceof Ei?!0:e instanceof Error&&e.name===ut&&e.message===ut}var Ei=class extends Error{constructor(){super(ut),this.name=this.message}},yt=class _t extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof _t)return t;let i=new _t;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ki;(e=>{function t(o){return o<0}e.isLessThan=t;function i(o){return o<=0}e.isLessThanOrEqual=i;function r(o){return o>0}e.isGreaterThan=r;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ki||={});function Fi(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var Qt;(e=>{function t(x){return x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(x){yield x}e.single=s;function o(x){return t(x)?x:s(x)}e.wrap=o;function n(x){return x||i}e.from=n;function*a(x){for(let M=x.length-1;M>=0;M--)yield x[M]}e.reverse=a;function l(x){return!x||x[Symbol.iterator]().next().done===!0}e.isEmpty=l;function h(x){return x[Symbol.iterator]().next().value}e.first=h;function c(x,M){let A=0;for(let U of x)if(M(U,A++))return!0;return!1}e.some=c;function d(x,M){for(let A of x)if(M(A))return A}e.find=d;function*u(x,M){for(let A of x)M(A)&&(yield A)}e.filter=u;function*g(x,M){let A=0;for(let U of x)yield M(U,A++)}e.map=g;function*y(x,M){let A=0;for(let U of x)yield*M(U,A++)}e.flatMap=y;function*T(...x){for(let M of x)yield*M}e.concat=T;function $(x,M,A){let U=A;for(let X of x)U=M(U,X);return U}e.reduce=$;function*O(x,M,A=x.length){for(M<0&&(M+=x.length),A<0?A+=x.length:A>x.length&&(A=x.length);M<A;M++)yield x[M]}e.slice=O;function R(x,M=Number.POSITIVE_INFINITY){let A=[];if(M===0)return[A,x];let U=x[Symbol.iterator]();for(let X=0;X<M;X++){let oe=U.next();if(oe.done)return[A,e.empty()];A.push(oe.value)}return[A,{[Symbol.iterator](){return U}}]}e.consume=R;async function S(x){let M=[];for await(let A of x)M.push(A);return Promise.resolve(M)}e.asyncToArray=S})(Qt||={});function Kt(e){if(Qt.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Jt(...e){return Y(()=>Kt(e))}function Y(e){return{dispose:Fi(()=>{e()})}}var ei=class ti{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Kt(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ti.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};ei.DISABLE_DISPOSED_WARNING=!1;var ke=ei,ne=class{constructor(){this._store=new ke,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ne.None=Object.freeze({dispose(){}});var Pe=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}clearAndLeak(){let e=this._value;return this._value=void 0,e}},mt=typeof process<"u"&&"title"in process,Qe=mt?"node":navigator.userAgent,Pi=mt?"node":navigator.platform,$i=Qe.includes("Firefox"),Di=Qe.includes("Edge"),ii=/^((?!chrome|android).)*safari/i.test(Qe);function Ii(){if(!ii)return 0;let e=Qe.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}Pi.indexOf("Linux")>=0;var zi="",q=0,G=0,H=0,I=0,ie={css:"#00000000",rgba:0},Q;(e=>{function t(s,o,n,a){return a!==void 0?`#${be(s)}${be(o)}${be(n)}${be(a)}`:`#${be(s)}${be(o)}${be(n)}`}e.toCss=t;function i(s,o,n,a=255){return(s<<24|o<<16|n<<8|a)>>>0}e.toRgba=i;function r(s,o,n,a){return{css:e.toCss(s,o,n,a),rgba:e.toRgba(s,o,n,a)}}e.toColor=r})(Q||={});var ze;(e=>{function t(l,h){if(I=(h.rgba&255)/255,I===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,g=l.rgba>>24&255,y=l.rgba>>16&255,T=l.rgba>>8&255;q=g+Math.round((c-g)*I),G=y+Math.round((d-y)*I),H=T+Math.round((u-T)*I);let $=Q.toCss(q,G,H),O=Q.toRgba(q,G,H);return{css:$,rgba:O}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function r(l,h,c){let d=Me.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return Q.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(l){let h=(l.rgba|255)>>>0;return[q,G,H]=Me.toChannels(h),{css:Q.toCss(q,G,H),rgba:h}}e.opaque=s;function o(l,h){return I=Math.round(h*255),[q,G,H]=Me.toChannels(l.rgba),{css:Q.toCss(q,G,H,I),rgba:Q.toRgba(q,G,H,I)}}e.opacity=o;function n(l,h){return I=l.rgba&255,o(l,I*h/255)}e.multiplyOpacity=n;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(ze||={});var Wi;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return q=parseInt(s.slice(1,2).repeat(2),16),G=parseInt(s.slice(2,3).repeat(2),16),H=parseInt(s.slice(3,4).repeat(2),16),Q.toColor(q,G,H);case 5:return q=parseInt(s.slice(1,2).repeat(2),16),G=parseInt(s.slice(2,3).repeat(2),16),H=parseInt(s.slice(3,4).repeat(2),16),I=parseInt(s.slice(4,5).repeat(2),16),Q.toColor(q,G,H,I);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 q=parseInt(o[1]),G=parseInt(o[2]),H=parseInt(o[3]),I=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Q.toColor(q,G,H,I);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[q,G,H,I]=t.getImageData(0,0,1,1).data,I!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Q.toRgba(q,G,H,I),css:s}}e.toColor=r})(Wi||={});var Z;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,o){let n=r/255,a=s/255,l=o/255,h=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}e.relativeLuminance2=i})(Z||={});var Me;(e=>{function t(n,a){if(I=(a&255)/255,I===1)return a;let l=a>>24&255,h=a>>16&255,c=a>>8&255,d=n>>24&255,u=n>>16&255,g=n>>8&255;return q=d+Math.round((l-d)*I),G=u+Math.round((h-u)*I),H=g+Math.round((c-g)*I),Q.toRgba(q,G,H)}e.blend=t;function i(n,a,l){let h=Z.relativeLuminance(n>>8),c=Z.relativeLuminance(a>>8);if(ue(h,c)<l){if(c<h){let g=r(n,a,l),y=ue(h,Z.relativeLuminance(g>>8));if(y<l){let T=s(n,a,l),$=ue(h,Z.relativeLuminance(T>>8));return y>$?g:T}return g}let d=s(n,a,l),u=ue(h,Z.relativeLuminance(d>>8));if(u<l){let g=r(n,a,l),y=ue(h,Z.relativeLuminance(g>>8));return u>y?d:g}return d}}e.ensureContrastRatio=i;function r(n,a,l){let h=n>>24&255,c=n>>16&255,d=n>>8&255,u=a>>24&255,g=a>>16&255,y=a>>8&255,T=ue(Z.relativeLuminance2(u,g,y),Z.relativeLuminance2(h,c,d));for(;T<l&&(u>0||g>0||y>0);)u-=Math.max(0,Math.ceil(u*.1)),g-=Math.max(0,Math.ceil(g*.1)),y-=Math.max(0,Math.ceil(y*.1)),T=ue(Z.relativeLuminance2(u,g,y),Z.relativeLuminance2(h,c,d));return(u<<24|g<<16|y<<8|255)>>>0}e.reduceLuminance=r;function s(n,a,l){let h=n>>24&255,c=n>>16&255,d=n>>8&255,u=a>>24&255,g=a>>16&255,y=a>>8&255,T=ue(Z.relativeLuminance2(u,g,y),Z.relativeLuminance2(h,c,d));for(;T<l&&(u<255||g<255||y<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),T=ue(Z.relativeLuminance2(u,g,y),Z.relativeLuminance2(h,c,d));return(u<<24|g<<16|y<<8|255)>>>0}e.increaseLuminance=s;function o(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=o})(Me||={});function be(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ue(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function W(e){if(!e)throw new Error("value must not be falsy");return e}function wt(e){return 57508<=e&&e<=57558}function Oi(e){return 57520<=e&&e<=57527}function Ui(e){return 57344<=e&&e<=63743}function Ni(e){return 9472<=e&&e<=9631}function qi(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Gi(e,t,i,r){return t===1&&i>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!qi(e)&&!wt(e)&&!Ui(e)}function si(e){return wt(e)||Ni(e)}function Hi(){return{css:{canvas:qe(),cell:qe()},device:{canvas:qe(),cell:qe(),char:{width:0,height:0,left:0,top:0}}}}function qe(){return{width:0,height:0}}function Vi(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var V=0,N=0,he=!1,_e=!1,Ge=!1,K,tt=0,ji=class{constructor(e,t,i,r,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,N=0,V=0,_e=!1,he=!1,Ge=!1,K=this._themeService.colors,tt=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));tt=t*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",s=>{s.backgroundColorRGB&&(N=s.backgroundColorRGB.rgba>>8&16777215,_e=!0),s.foregroundColorRGB&&(V=s.foregroundColorRGB.rgba>>8&16777215,he=!0)}),Ge=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Ge){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:N=(this.result.fg&16777215)<<8|255;break;case 0:default:N=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:N=(this.result.bg&16777215)<<8|255;break}N=Me.blend(N,(this._coreBrowserService.isFocused?K.selectionBackgroundOpaque:K.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else N=(this._coreBrowserService.isFocused?K.selectionBackgroundOpaque:K.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(_e=!0,K.selectionForeground&&(V=K.selectionForeground.rgba>>8&16777215,he=!0),si(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)V=(this._coreBrowserService.isFocused?K.selectionBackgroundOpaque:K.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:V=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:V=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:V=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:V=(this.result.fg&16777215)<<8|255;break;case 0:default:V=this._themeService.colors.foreground.rgba}V=Me.blend(V,(this._coreBrowserService.isFocused?K.selectionBackgroundOpaque:K.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}he=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",s=>{s.backgroundColorRGB&&(N=s.backgroundColorRGB.rgba>>8&16777215,_e=!0),s.foregroundColorRGB&&(V=s.foregroundColorRGB.rgba>>8&16777215,he=!0)}),_e&&(Ge?N=e.bg&-16777216&-134217729|N|50331648:N=e.bg&-16777216|N|50331648),he&&(V=e.fg&-16777216&-67108865|V|50331648),this.result.fg&67108864&&(_e&&!he&&((this.result.bg&50331648)===0?V=this.result.fg&-134217728|K.background.rgba>>8&16777215&16777215|50331648:V=this.result.fg&-134217728|this.result.bg&67108863,he=!0),!_e&&he&&((this.result.fg&50331648)===0?N=this.result.bg&-67108864|K.foreground.rgba>>8&16777215&16777215|50331648:N=this.result.bg&-67108864|this.result.fg&67108863,_e=!0)),K=void 0,this.result.bg=_e?N:this.result.bg,this.result.fg=he?V:this.result.fg,this.result.ext&=536870911,this.result.ext|=tt<<29&3758096384}},Yi=.5,ri=$i||Di?"bottom":"ideographic",Xi={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Zi={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Qi={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},We={"":{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},"":{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},"":{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},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};We[""]=We[""];We[""]=We[""];function Ki(e,t,i,r,s,o,n,a){let l=Xi[t];if(l)return Ji(e,l,i,r,s,o),!0;let h=Zi[t];if(h)return es(e,h,i,r,s,o),!0;let c=Qi[t];if(c)return ts(e,c,i,r,s,o,a),!0;let d=We[t];return d?(is(e,d,i,r,s,o,n,a),!0):!1}function Ji(e,t,i,r,s,o){for(let n=0;n<t.length;n++){let a=t[n],l=s/8,h=o/8;e.fillRect(i+a.x*l,r+a.y*h,a.w*l,a.h*h)}}var Mt=new Map;function es(e,t,i,r,s,o){let n=Mt.get(t);n||(n=new Map,Mt.set(t,n));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let l=n.get(a);if(!l){let h=t[0].length,c=t.length,d=e.canvas.ownerDocument.createElement("canvas");d.width=h,d.height=c;let u=W(d.getContext("2d")),g=new ImageData(h,c),y,T,$,O;if(a.startsWith("#"))y=parseInt(a.slice(1,3),16),T=parseInt(a.slice(3,5),16),$=parseInt(a.slice(5,7),16),O=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[y,T,$,O]=a.substring(5,a.length-1).split(",").map(R=>parseFloat(R));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let R=0;R<c;R++)for(let S=0;S<h;S++)g.data[(R*h+S)*4]=y,g.data[(R*h+S)*4+1]=T,g.data[(R*h+S)*4+2]=$,g.data[(R*h+S)*4+3]=t[R][S]*(O*255);u.putImageData(g,0,0),l=W(e.createPattern(d,null)),n.set(a,l)}e.fillStyle=l,e.fillRect(i,r,s,o)}function ts(e,t,i,r,s,o,n){e.strokeStyle=e.fillStyle;for(let[a,l]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(a);let h;if(typeof l=="function"){let c=.15/o*s;h=l(.15,c)}else h=l;for(let c of h.split(" ")){let d=c[0],u=ni[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let g=c.substring(1).split(",");!g[0]||!g[1]||u(e,oi(g,s,o,i,r,!0,n))}e.stroke(),e.closePath()}}function is(e,t,i,r,s,o,n,a){let l=new Path2D;l.rect(i,r,s,o),e.clip(l),e.beginPath();let h=n/12;e.lineWidth=a*h;for(let c of t.d.split(" ")){let d=c[0],u=ni[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let g=c.substring(1).split(",");!g[0]||!g[1]||u(e,oi(g,s,o,i,r,!1,a,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function St(e,t,i=0){return Math.max(Math.min(e,t),i)}var ni={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function oi(e,t,i,r,s,o,n,a=0,l=0){let h=e.map(c=>parseFloat(c)||parseInt(c));if(h.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<h.length;c+=2)h[c]*=t-a*n-l*n,o&&h[c]!==0&&(h[c]=St(Math.round(h[c]+.5)-.5,t,0)),h[c]+=r+a*n;for(let c=1;c<h.length;c+=2)h[c]*=i,o&&h[c]!==0&&(h[c]=St(Math.round(h[c]+.5)-.5,i,0)),h[c]+=s;return h}var At=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Rt=class{constructor(){this._data=new At}set(e,t,i,r,s){this._data.get(e,t)||this._data.set(e,t,new At),this._data.get(e,t).set(i,r,s)}get(e,t,i,r){return this._data.get(e,t)?.get(i,r)}clear(){this._data.clear()}},ai=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},ss=class extends ai{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},rs=class extends ai{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ns=!mt&&"requestIdleCallback"in window?rs:ss,Be=class hi{constructor(){this.fg=0,this.bg=0,this.extended=new li}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new hi;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},li=class ci{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new ci(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},os=globalThis.performance&&typeof globalThis.performance.now=="function",as=class di{static create(t){return new di(t)}constructor(t){this._now=os&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},pe;(e=>{e.None=()=>ne.None;function t(m,_){return d(m,()=>{},0,void 0,!0,void 0,_)}e.defer=t;function i(m){return(_,p=null,v)=>{let b=!1,f;return f=m(w=>{if(!b)return f?f.dispose():b=!0,_.call(p,w)},null,v),b&&f.dispose(),f}}e.once=i;function r(m,_,p){return h((v,b=null,f)=>m(w=>v.call(b,_(w)),null,f),p)}e.map=r;function s(m,_,p){return h((v,b=null,f)=>m(w=>{_(w),v.call(b,w)},null,f),p)}e.forEach=s;function o(m,_,p){return h((v,b=null,f)=>m(w=>_(w)&&v.call(b,w),null,f),p)}e.filter=o;function n(m){return m}e.signal=n;function a(...m){return(_,p=null,v)=>{let b=Jt(...m.map(f=>f(w=>_.call(p,w))));return c(b,v)}}e.any=a;function l(m,_,p,v){let b=p;return r(m,f=>(b=_(b,f),b),v)}e.reduce=l;function h(m,_){let p,v={onWillAddFirstListener(){p=m(b.fire,b)},onDidRemoveLastListener(){p?.dispose()}},b=new P(v);return _?.add(b),b.event}function c(m,_){return _ instanceof Array?_.push(m):_&&_.add(m),m}function d(m,_,p=100,v=!1,b=!1,f,w){let L,C,E,j=0,k,Le={leakWarningThreshold:f,onWillAddFirstListener(){L=m(de=>{j++,C=_(C,de),v&&!E&&(ae.fire(C),C=void 0),k=()=>{let J=C;C=void 0,E=void 0,(!v||j>1)&&ae.fire(J),j=0},typeof p=="number"?(clearTimeout(E),E=setTimeout(k,p)):E===void 0&&(E=0,queueMicrotask(k))})},onWillRemoveListener(){b&&j>0&&k?.()},onDidRemoveLastListener(){k=void 0,L.dispose()}},ae=new P(Le);return w?.add(ae),ae.event}e.debounce=d;function u(m,_=0,p){return e.debounce(m,(v,b)=>v?(v.push(b),v):[b],_,void 0,!0,void 0,p)}e.accumulate=u;function g(m,_=(v,b)=>v===b,p){let v=!0,b;return o(m,f=>{let w=v||!_(f,b);return v=!1,b=f,w},p)}e.latch=g;function y(m,_,p){return[e.filter(m,_,p),e.filter(m,v=>!_(v),p)]}e.split=y;function T(m,_=!1,p=[],v){let b=p.slice(),f=m(C=>{b?b.push(C):L.fire(C)});v&&v.add(f);let w=()=>{b?.forEach(C=>L.fire(C)),b=null},L=new P({onWillAddFirstListener(){f||(f=m(C=>L.fire(C)),v&&v.add(f))},onDidAddFirstListener(){b&&(_?setTimeout(w):w())},onDidRemoveLastListener(){f&&f.dispose(),f=null}});return v&&v.add(L),L.event}e.buffer=T;function $(m,_){return(p,v,b)=>{let f=_(new R);return m(function(w){let L=f.evaluate(w);L!==O&&p.call(v,L)},void 0,b)}}e.chain=$;let O=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(_){return this.steps.push(_),this}forEach(_){return this.steps.push(p=>(_(p),p)),this}filter(_){return this.steps.push(p=>_(p)?p:O),this}reduce(_,p){let v=p;return this.steps.push(b=>(v=_(v,b),v)),this}latch(_=(p,v)=>p===v){let p=!0,v;return this.steps.push(b=>{let f=p||!_(b,v);return p=!1,v=b,f?b:O}),this}evaluate(_){for(let p of this.steps)if(_=p(_),_===O)break;return _}}function S(m,_,p=v=>v){let v=(...L)=>w.fire(p(...L)),b=()=>m.on(_,v),f=()=>m.removeListener(_,v),w=new P({onWillAddFirstListener:b,onDidRemoveLastListener:f});return w.event}e.fromNodeEventEmitter=S;function x(m,_,p=v=>v){let v=(...L)=>w.fire(p(...L)),b=()=>m.addEventListener(_,v),f=()=>m.removeEventListener(_,v),w=new P({onWillAddFirstListener:b,onDidRemoveLastListener:f});return w.event}e.fromDOMEventEmitter=x;function M(m){return new Promise(_=>i(m)(_))}e.toPromise=M;function A(m){let _=new P;return m.then(p=>{_.fire(p)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=A;function U(m,_){return m(p=>_.fire(p))}e.forward=U;function X(m,_,p){return _(p),m(v=>_(v))}e.runAndSubscribe=X;class oe{constructor(_,p){this._observable=_,this._counter=0,this._hasChanged=!1;let v={onWillAddFirstListener:()=>{_.addObserver(this)},onDidRemoveLastListener:()=>{_.removeObserver(this)}};this.emitter=new P(v),p&&p.add(this.emitter)}beginUpdate(_){this._counter++}handlePossibleChange(_){}handleChange(_,p){this._hasChanged=!0}endUpdate(_){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function me(m,_){return new oe(m,_).emitter.event}e.fromObservable=me;function B(m){return(_,p,v)=>{let b=0,f=!1,w={beginUpdate(){b++},endUpdate(){b--,b===0&&(m.reportChanges(),f&&(f=!1,_.call(p)))},handlePossibleChange(){},handleChange(){f=!0}};m.addObserver(w),m.reportChanges();let L={dispose(){m.removeObserver(w)}};return v instanceof ke?v.add(L):Array.isArray(v)&&v.push(L),L}}e.fromObservableLight=B})(pe||={});var gt=class ft{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ft._idPool++}`,ft.all.add(this)}start(t){this._stopWatch=new as,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};gt.all=new Set,gt._idPool=0;var hs=gt,ls=-1,ui=class _i{constructor(t,i,r=(_i._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[o,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(o);let l=new us(a,o);this._errorHandler(l)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};ui._idPool=1;var cs=ui,ds=class gi{constructor(t){this.value=t}static create(){let t=new Error;return new gi(t.stack??"")}print(){console.warn(this.value.split(`
17
+ `).slice(2).join(`
18
+ `))}},us=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},_s=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},gs=0,it=class{constructor(e){this.value=e,this.id=gs++}},fs=2,vs,P=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new cs(e?.onListenerError??et,this._options?.leakWarningThreshold??ls):void 0,this._perfMon=this._options?._profName?new hs(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let n=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(n);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new _s(`${n}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||et)(l),ne.None}if(this._disposed)return ne.None;t&&(e=e.bind(t));let r=new it(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=ds.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof it?(this._deliveryQueue??=new ps,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Y(()=>{s?.(),this._removeListener(r)});return i instanceof ke?i.add(o):Array.isArray(i)&&i.push(o),o},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,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*fs<=t.length){let s=0;for(let o=0;o<t.length;o++)t[o]?t[s++]=t[o]:r&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=s}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||et;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof it)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}},ps=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Tt={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}},$e=2,De,Ce=class Te{constructor(t,i,r){this._document=t,this._config=i,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new Rt,this._cacheMapCombined=new Rt,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Be,this._textureSize=512,this._onAddTextureAtlasCanvas=new P,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new P,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fi(t,this._config.deviceCellWidth*4+$e*2,this._config.deviceCellHeight+$e*2),this._tmpCtx=W(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new ns;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let r=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Te.maxAtlasPages&&this._pages.length>=Math.max(4,Te.maxAtlasPages)){let i=this._pages.filter(h=>h.canvas.width*2<=(Te.maxTextureSize||4096)).sort((h,c)=>c.canvas.width!==h.canvas.width?c.canvas.width-h.canvas.width:c.percentageUsed-h.percentageUsed),r=-1,s=0;for(let h=0;h<i.length;h++)if(i[h].canvas.width!==s)r=h,s=i[h].canvas.width;else if(h-r===3)break;let o=i.slice(r,r+4),n=o.map(h=>h.glyphs[0].texturePage).sort((h,c)=>h>c?1:-1),a=this.pages.length-o.length,l=this._mergePages(o,a);l.version++;for(let h=n.length-1;h>=0;h--)this._deletePage(n[h]);this.pages.push(l),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(l.canvas)}let t=new st(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let r=t[0].canvas.width*2,s=new st(this._document,r,t);for(let[o,n]of t.entries()){let a=o*n.canvas.width%r,l=Math.floor(o/2)*n.canvas.height;s.ctx.drawImage(n.canvas,a,l);for(let c of n.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/r,c.sizeClipSpace.y=c.size.y/r,c.texturePosition.x+=a,c.texturePosition.y+=l,c.texturePositionClipSpace.x=c.texturePosition.x/r,c.texturePositionClipSpace.y=c.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let h=this._activePages.indexOf(n);h!==-1&&this._activePages.splice(h,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let r=this._pages[i];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(t,i,r,s,o,n){return this._getFromCacheMap(this._cacheMapCombined,t,i,r,s,o,n)}getRasterizedGlyph(t,i,r,s,o,n){return this._getFromCacheMap(this._cacheMap,t,i,r,s,o,n)}_getFromCacheMap(t,i,r,s,o,n,a){return De=t.get(i,r,s,o),De||(De=this._drawToCache(i,r,s,o,n,a),t.set(i,r,s,o,De)),De}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,r,s){if(this._config.allowTransparency)return ie;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(i);break;case 50331648:let n=Be.toColorRGB(i);o=Q.toColor(n[0],n[1],n[2]);break;case 0:default:r?o=ze.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=ze.opaque(o)),o}_getForegroundColor(t,i,r,s,o,n,a,l,h,c){let d=this._getMinimumContrastColor(t,i,r,s,o,n,a,h,l,c);if(d)return d;let u;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&n<8&&(n+=8),u=this._getColorFromAnsiIndex(n);break;case 50331648:let g=Be.toColorRGB(n);u=Q.toColor(g[0],g[1],g[2]);break;case 0:default:a?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=ze.opaque(u)),l&&(u=ze.multiplyOpacity(u,Yi)),u}_resolveBackgroundRgba(t,i,r){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,r,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,r,s,o,n,a,l,h,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(h),u=d.getColor(t,s);if(u!==void 0)return u||void 0;let g=this._resolveBackgroundRgba(i,r,a),y=this._resolveForegroundRgba(o,n,a,l),T=Me.ensureContrastRatio(g,y,this._config.minimumContrastRatio/(h?2:1));if(!T){d.setColor(t,s,null);return}let $=Q.toColor(T>>24&255,T>>16&255,T>>8&255);return d.setColor(t,s,$),$}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,r,s,o,n){let a=typeof t=="number"?String.fromCharCode(t):t;n&&this._tmpCanvas.parentElement!==n&&(this._tmpCanvas.style.display="none",n.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+$e*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let h=Math.min(this._config.deviceCellHeight+$e*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return Tt;let c=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),g=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),T=!!this._workAttributeData.isStrikethrough(),$=!!this._workAttributeData.isOverline(),O=this._workAttributeData.getFgColor(),R=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),x=this._workAttributeData.getBgColorMode();if(d){let C=O;O=S,S=C;let E=R;R=x,x=E}let M=this._getBackgroundColor(x,S,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let A=c?this._config.fontWeightBold:this._config.fontWeight,U=g?"italic":"";this._tmpCtx.font=`${U} ${A} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ri;let X=a.length===1&&wt(a.charCodeAt(0)),oe=a.length===1&&Oi(a.charCodeAt(0)),me=this._getForegroundColor(i,x,S,r,R,O,d,u,c,si(a.charCodeAt(0)));this._tmpCtx.fillStyle=me.css;let B=oe?0:$e*2,m=!1;this._config.customGlyphs!==!1&&(m=Ki(this._tmpCtx,a,B,B,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let _=!X,p;if(typeof t=="number"?p=this._unicodeService.wcwidth(t):p=this._unicodeService.getStringCellWidth(t),y){this._tmpCtx.save();let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=C%2===1?.5:0;if(this._tmpCtx.lineWidth=C,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())_=!1,this._tmpCtx.strokeStyle=`rgb(${Be.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{_=!1;let J=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&J<8&&(J+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(J).css}this._tmpCtx.beginPath();let j=B,k=Math.ceil(B+this._config.deviceCharHeight)-E-(o?C*2:0),Le=k+C,ae=k+C*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let J=0;J<p;J++){this._tmpCtx.save();let z=j+J*this._config.deviceCellWidth,ee=j+(J+1)*this._config.deviceCellWidth,Ke=z+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(ee,k),this._tmpCtx.moveTo(z,ae),this._tmpCtx.lineTo(ee,ae);break;case 3:let Oe=C<=1?ae:Math.ceil(B+this._config.deviceCharHeight-C/2)-E,Ue=C<=1?k:Math.ceil(B+this._config.deviceCharHeight+C/2)-E,xt=new Path2D;xt.rect(z,k,this._config.deviceCellWidth,ae-k),this._tmpCtx.clip(xt),this._tmpCtx.moveTo(z-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(z-this._config.deviceCellWidth/2,Ue,z,Ue,z,Le),this._tmpCtx.bezierCurveTo(z,Oe,Ke,Oe,Ke,Le),this._tmpCtx.bezierCurveTo(Ke,Ue,ee,Ue,ee,Le),this._tmpCtx.bezierCurveTo(ee,Oe,ee+this._config.deviceCellWidth/2,Oe,ee+this._config.deviceCellWidth/2,Le);break;case 4:let Ne=de===0?0:de>=C?C*2-de:C-de;de>=C||Ne===0?(this._tmpCtx.setLineDash([Math.round(C),Math.round(C)]),this._tmpCtx.moveTo(z+Ne,k),this._tmpCtx.lineTo(ee,k)):(this._tmpCtx.setLineDash([Math.round(C),Math.round(C)]),this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(z+Ne,k),this._tmpCtx.moveTo(z+Ne+C,k),this._tmpCtx.lineTo(ee,k)),de=Vi(ee-z,C,de);break;case 5:let bi=.6,yi=.3,Je=ee-z,Lt=Math.floor(bi*Je),bt=Math.floor(yi*Je),Mi=Je-Lt-bt;this._tmpCtx.setLineDash([Lt,bt,Mi]),this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(ee,k);break;case 1:default:this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(ee,k);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!m&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let J=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in J&&J.actualBoundingBoxDescent>0){this._tmpCtx.save();let z=new Path2D;z.rect(j,k-Math.ceil(C/2),this._config.deviceCellWidth*p,ae-k+Math.ceil(C/2)),this._tmpCtx.clip(z),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(a,B,B+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if($){let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=C%2===1?.5:0;this._tmpCtx.lineWidth=C,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(B,B+E),this._tmpCtx.lineTo(B+this._config.deviceCharWidth*p,B+E),this._tmpCtx.stroke()}if(m||this._tmpCtx.fillText(a,B,B+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let C=rt(this._tmpCtx.getImageData(B,B,this._config.deviceCellWidth,this._config.deviceCellHeight),M,me,_);if(C)for(let E=1;E<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,B,B+this._config.deviceCharHeight-E),C=rt(this._tmpCtx.getImageData(B,B,this._config.deviceCellWidth,this._config.deviceCellHeight),M,me,_),!!C);E++);}if(T){let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),E=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=C,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(B,B+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.lineTo(B+this._config.deviceCharWidth*p,B+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.stroke()}this._tmpCtx.restore();let v=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),b;if(this._config.allowTransparency?b=ms(v):b=rt(v,M,me,_),b)return Tt;let f=this._findGlyphBoundingBox(v,this._workBoundingBox,l,oe,m,B),w,L;for(;;){if(this._activePages.length===0){let C=this._createNewPage();w=C,L=C.currentRow,L.height=f.size.y;break}w=this._activePages[this._activePages.length-1],L=w.currentRow;for(let C of this._activePages)f.size.y<=C.currentRow.height&&(w=C,L=C.currentRow);for(let C=this._activePages.length-1;C>=0;C--)for(let E of this._activePages[C].fixedRows)E.height<=L.height&&f.size.y<=E.height&&(w=this._activePages[C],L=E);if(f.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new st(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),w=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+f.size.x>=w.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+f.size.y>=w.canvas.height||L.height>f.size.y+2){let C=!1;if(w.currentRow.y+w.currentRow.height+f.size.y>=w.canvas.height){let E;for(let j of this._activePages)if(j.currentRow.y+j.currentRow.height+f.size.y<j.canvas.height){E=j;break}if(E)w=E;else if(Te.maxAtlasPages&&this._pages.length>=Te.maxAtlasPages&&L.y+f.size.y<=w.canvas.height&&L.height>=f.size.y&&L.x+f.size.x<=w.canvas.width)C=!0;else{let j=this._createNewPage();w=j,L=j.currentRow,L.height=f.size.y,C=!0}}C||(w.currentRow.height>0&&w.fixedRows.push(w.currentRow),L={x:0,y:w.currentRow.y+w.currentRow.height,height:f.size.y},w.fixedRows.push(L),w.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+f.size.x<=w.canvas.width)break;L===w.currentRow?(L.x=0,L.y+=L.height,L.height=0):w.fixedRows.splice(w.fixedRows.indexOf(L),1)}return f.texturePage=this._pages.indexOf(w),f.texturePosition.x=L.x,f.texturePosition.y=L.y,f.texturePositionClipSpace.x=L.x/w.canvas.width,f.texturePositionClipSpace.y=L.y/w.canvas.height,f.sizeClipSpace.x/=w.canvas.width,f.sizeClipSpace.y/=w.canvas.height,L.height=Math.max(L.height,f.size.y),L.x+=f.size.x,w.ctx.putImageData(v,f.texturePosition.x-this._workBoundingBox.left,f.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,f.size.x,f.size.y),w.addGlyph(f),w.version++,f}_findGlyphBoundingBox(t,i,r,s,o,n){i.top=0;let a=s?this._config.deviceCellHeight:this._tmpCanvas.height,l=s?this._config.deviceCellWidth:r,h=!1;for(let c=0;c<a;c++){for(let d=0;d<l;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(t.data[u]!==0){i.top=c,h=!0;break}}if(h)break}i.left=0,h=!1;for(let c=0;c<n+l;c++){for(let d=0;d<a;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(t.data[u]!==0){i.left=c,h=!0;break}}if(h)break}i.right=l,h=!1;for(let c=n+l-1;c>=n;c--){for(let d=0;d<a;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(t.data[u]!==0){i.right=c,h=!0;break}}if(h)break}i.bottom=a,h=!1;for(let c=a-1;c>=0;c--){for(let d=0;d<l;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(t.data[u]!==0){i.bottom=c,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+n+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+n+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},st=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=fi(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 rt(e,t,i,r){let s=t.rgba>>>24,o=t.rgba>>>16&255,n=t.rgba>>>8&255,a=i.rgba>>>24,l=i.rgba>>>16&255,h=i.rgba>>>8&255,c=Math.floor((Math.abs(s-a)+Math.abs(o-l)+Math.abs(n-h))/12),d=!0;for(let u=0;u<e.data.length;u+=4)e.data[u]===s&&e.data[u+1]===o&&e.data[u+2]===n||r&&Math.abs(e.data[u]-s)+Math.abs(e.data[u+1]-o)+Math.abs(e.data[u+2]-n)<c?e.data[u+3]=0:d=!1;return d}function ms(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fi(e,t,i){let r=e.createElement("canvas");return r.width=t,r.height=i,r}function ws(e,t,i,r,s,o,n,a){let l={foreground:o.foreground,background:o.background,cursor:ie,cursorAccent:ie,selectionForeground:ie,selectionBackgroundTransparent:ie,selectionBackgroundOpaque:ie,selectionInactiveBackgroundTransparent:ie,selectionInactiveBackgroundOpaque:ie,overviewRulerBorder:ie,scrollbarSliderBackground:ie,scrollbarSliderHoverBackground:ie,scrollbarSliderActiveBackground:ie,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}function Bt(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function Cs(e){return(e&50331648)===16777216||(e&50331648)===33554432}var re=[];function vi(e,t,i,r,s,o,n,a,l){let h=ws(r,s,o,n,t,i,a,l);for(let u=0;u<re.length;u++){let g=re[u],y=g.ownedBy.indexOf(e);if(y>=0){if(Bt(g.config,h))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),re.splice(u,1)):g.ownedBy.splice(y,1);break}}for(let u=0;u<re.length;u++){let g=re[u];if(Bt(g.config,h))return g.ownedBy.push(e),g.atlas}let c=e._core,d={atlas:new Ce(document,h,c.unicodeService),config:h,ownedBy:[e]};return re.push(d),d.atlas}function Et(e){for(let t=0;t<re.length;t++){let i=re[t].ownedBy.indexOf(e);if(i!==-1){re[t].ownedBy.length===1?(re[t].atlas.dispose(),re.splice(t,1)):re[t].ownedBy.splice(i,1);break}}}var He=600,xs=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=He){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=He-(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=He-(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})},He)},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 kt(e,t,i){let r=new t.ResizeObserver(s=>{let o=s.find(l=>l.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){r?.disconnect(),r=void 0;return}let n=o.devicePixelContentBoxSize[0].inlineSize,a=o.devicePixelContentBoxSize[0].blockSize;n>0&&a>0&&i(n,a)});try{r.observe(e,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return Y(()=>r?.disconnect())}function Ls(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Ft=class pi extends Be{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new li,this.combinedData=""}static fromCharData(t){let i=new pi;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ls(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mi=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function wi(e,t,i){let r=W(e.createProgram());if(e.attachShader(r,W(Pt(e,e.VERTEX_SHADER,t))),e.attachShader(r,W(Pt(e,e.FRAGMENT_SHADER,i))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function Pt(e,t,i){let r=W(e.createShader(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function bs(e,t){let i=Math.min(e.length*2,t),r=new Float32Array(i);for(let s=0;s<e.length;s++)r[s]=e[s];return r}var ys=class{constructor(e){this.texture=e,this.version=-1}},Ms=`#version 300 es
19
+ layout (location = 0) in vec2 a_unitquad;
20
+ layout (location = 1) in vec2 a_cellpos;
21
+ layout (location = 2) in vec2 a_offset;
22
+ layout (location = 3) in vec2 a_size;
23
+ layout (location = 4) in float a_texpage;
24
+ layout (location = 5) in vec2 a_texcoord;
25
+ layout (location = 6) in vec2 a_texsize;
26
+
27
+ uniform mat4 u_projection;
28
+ uniform vec2 u_resolution;
29
+
30
+ out vec2 v_texcoord;
31
+ flat out int v_texpage;
32
+
33
+ void main() {
34
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
35
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
36
+ v_texpage = int(a_texpage);
37
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
38
+ }`;function Ss(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
39
+ precision lowp float;
40
+
41
+ in vec2 v_texcoord;
42
+ flat in int v_texpage;
43
+
44
+ uniform sampler2D u_texture[${e}];
45
+
46
+ out vec4 outColor;
47
+
48
+ void main() {
49
+ if (v_texpage == 0) {
50
+ outColor = texture(u_texture[0], v_texcoord);
51
+ } ${t}
52
+ }`}var xe=11,Ae=xe*Float32Array.BYTES_PER_ELEMENT,As=2,D=0,F,nt=0,Ie=0,Rs=class extends ne{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;Ce.maxAtlasPages===void 0&&(Ce.maxAtlasPages=Math.min(32,W(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),Ce.maxTextureSize=W(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=W(wi(s,Ms,Ss(Ce.maxAtlasPages))),this._register(Y(()=>s.deleteProgram(this._program))),this._projectionLocation=W(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=W(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=W(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),n=s.createBuffer();this._register(Y(()=>s.deleteBuffer(n))),s.bindBuffer(s.ARRAY_BUFFER,n),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(Y(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=W(s.createBuffer()),this._register(Y(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,Ae,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,Ae,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,Ae,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,Ae,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,Ae,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,Ae,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let h=new Int32Array(Ce.maxAtlasPages);for(let c=0;c<Ce.maxAtlasPages;c++)h[c]=c;s.uniform1iv(this._textureLocation,h),s.uniformMatrix4fv(this._projectionLocation,!1,mi),this._atlasTextures=[];for(let c=0;c<Ce.maxAtlasPages;c++){let d=new ys(W(s.createTexture()));this._register(Y(()=>s.deleteTexture(d.texture))),s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,d.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=d}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,r,s,o,n,a,l){this._updateCell(this._vertices.attributes,e,t,i,r,s,o,n,a,l)}_updateCell(e,t,i,r,s,o,n,a,l,h){if(D=(i*this._terminal.cols+t)*xe,r===0||r===void 0){e.fill(0,D,D+xe-1-As);return}this._atlas&&(a&&a.length>1?F=this._atlas.getRasterizedGlyphCombinedChar(a,s,o,n,!1,this._terminal.element):F=this._atlas.getRasterizedGlyph(r,s,o,n,!1,this._terminal.element),nt=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==h&&F.offset.x>nt?(Ie=F.offset.x-nt,e[D]=-(F.offset.x-Ie)+this._dimensions.device.char.left,e[D+1]=-F.offset.y+this._dimensions.device.char.top,e[D+2]=(F.size.x-Ie)/this._dimensions.device.canvas.width,e[D+3]=F.size.y/this._dimensions.device.canvas.height,e[D+4]=F.texturePage,e[D+5]=F.texturePositionClipSpace.x+Ie/this._atlas.pages[F.texturePage].canvas.width,e[D+6]=F.texturePositionClipSpace.y,e[D+7]=F.sizeClipSpace.x-Ie/this._atlas.pages[F.texturePage].canvas.width,e[D+8]=F.sizeClipSpace.y):(e[D]=-F.offset.x+this._dimensions.device.char.left,e[D+1]=-F.offset.y+this._dimensions.device.char.top,e[D+2]=F.size.x/this._dimensions.device.canvas.width,e[D+3]=F.size.y/this._dimensions.device.canvas.height,e[D+4]=F.texturePage,e[D+5]=F.texturePositionClipSpace.x,e[D+6]=F.texturePositionClipSpace.y,e[D+7]=F.sizeClipSpace.x,e[D+8]=F.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Gi(r,l,F.size.x,this._dimensions.device.cell.width)&&(e[D+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*xe;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let r=0;r<e.rows;r++)for(let s=0;s<e.cols;s++)this._vertices.attributes[i+9]=s/e.cols,this._vertices.attributes[i+10]=r/e.rows,i+=xe}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<e.lineLengths.length;s++){let o=s*this._terminal.cols*xe,n=this._vertices.attributes.subarray(o,o+e.lineLengths[s]*xe);i.set(n,r),r+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,r),t.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(t,this._atlas,s);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/xe)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},Ts=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,o=t[1]-s,n=i[1]-s,a=Math.max(o,0),l=Math.min(n,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Bs(){return new Ts}var Ze=4,je=1,Ye=2,ot=3,Es=2147483648,ks=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Bs()}resize(e,t){let i=e*t*Ze;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Fs=`#version 300 es
53
+ layout (location = 0) in vec2 a_position;
54
+ layout (location = 1) in vec2 a_size;
55
+ layout (location = 2) in vec4 a_color;
56
+ layout (location = 3) in vec2 a_unitquad;
57
+
58
+ uniform mat4 u_projection;
59
+
60
+ out vec4 v_color;
61
+
62
+ void main() {
63
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
64
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
65
+ v_color = a_color;
66
+ }`,Ps=`#version 300 es
67
+ precision lowp float;
68
+
69
+ in vec4 v_color;
70
+
71
+ out vec4 outColor;
72
+
73
+ void main() {
74
+ outColor = v_color;
75
+ }`,ve=8,at=ve*Float32Array.BYTES_PER_ELEMENT,$s=20*ve,$t=class{constructor(){this.attributes=new Float32Array($s),this.count=0}},ge=0,Dt=0,It=0,zt=0,Wt=0,Ot=0,Ut=0,Ds=class extends ne{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=r,this._vertices=new $t,this._verticesCursor=new $t;let s=this._gl;this._program=W(wi(s,Fs,Ps)),this._register(Y(()=>s.deleteProgram(this._program))),this._projectionLocation=W(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),n=s.createBuffer();this._register(Y(()=>s.deleteBuffer(n))),s.bindBuffer(s.ARRAY_BUFFER,n),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(Y(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=W(s.createBuffer()),this._register(Y(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,at,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,at,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,at,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,mi),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.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(e){let t=this._terminal,i=this._vertices,r=1,s,o,n,a,l,h,c,d,u,g,y;for(s=0;s<t.rows;s++){for(n=-1,a=0,l=0,h=!1,o=0;o<t.cols;o++)c=(s*t.cols+o)*Ze,d=e.cells[c+je],u=e.cells[c+Ye],g=!!(u&67108864),(d!==a||u!==l&&(h||g))&&((a!==0||h&&l!==0)&&(y=r++*ve,this._updateRectangle(i,y,l,a,n,o,s)),n=o,a=d,l=u,h=g);(a!==0||h&&l!==0)&&(y=r++*ve,this._updateRectangle(i,y,l,a,n,t.cols,s))}i.count=r}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let r,s=0;(i.style==="bar"||i.style==="outline")&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=s++*ve,this._addRectangleFloat(t.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,i,r,s,o,n){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:ge=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ge=(i&16777215)<<8;break;case 0:default:ge=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:ge=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:ge=(r&16777215)<<8;break;case 0:default:ge=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=bs(e.attributes,this._terminal.rows*this._terminal.cols*ve)),Dt=s*this._dimensions.device.cell.width,It=n*this._dimensions.device.cell.height,zt=(ge>>24&255)/255,Wt=(ge>>16&255)/255,Ot=(ge>>8&255)/255,Ut=1,this._addRectangle(e.attributes,t,Dt,It,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,zt,Wt,Ot,Ut)}_addRectangle(e,t,i,r,s,o,n,a,l,h){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=a,e[t+6]=l,e[t+7]=h}_addRectangleFloat(e,t,i,r,s,o,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=n[0],e[t+5]=n[1],e[t+6]=n[2],e[t+7]=n[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Is=class extends ne{constructor(e,t,i,r,s,o,n,a){super(),this._container=t,this._alpha=s,this._coreBrowserService=o,this._optionsService=n,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-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(l=>{this._refreshCharAtlas(e,l),this.reset(e)})),this._register(Y(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=W(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=vi(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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(e,t,i,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ri,this._clipCell(i,r,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},zs=class extends Is{constructor(e,t,i,r,s,o,n){super(i,e,"link",t,!0,s,o,n),this._register(r.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(r.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}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===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Cs(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()}},ye=typeof window=="object"?window:globalThis,vt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new P,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};vt.INSTANCE=new vt;var Ci=vt;function Ws(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Ci.INSTANCE.onDidChangeZoomLevel;Ci.INSTANCE.onDidChangeFullscreen;var Fe=typeof navigator=="object"?navigator.userAgent:"";Fe.indexOf("Firefox")>=0;Fe.indexOf("AppleWebKit")>=0;var Os=Fe.indexOf("Chrome")>=0;!Os&&Fe.indexOf("Safari")>=0;Fe.indexOf("Electron/")>=0;Fe.indexOf("Android")>=0;var ht=!1;if(typeof ye.matchMedia=="function"){let e=ye.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ye.matchMedia("(display-mode: fullscreen)");ht=e.matches,Ws(ye,e,({matches:i})=>{ht&&t.matches||(ht=i)})}var Ee="en",lt=!1,xi=!1,Ve,Xe=Ee,Nt=Ee,Us,fe,Se=globalThis,te;typeof Se.vscode<"u"&&typeof Se.vscode.process<"u"?te=Se.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(te=process);var Ns=typeof te?.versions?.electron=="string",qs=Ns&&te?.type==="renderer";if(typeof te=="object"){te.platform,te.platform,lt=te.platform==="linux",lt&&te.env.SNAP&&te.env.SNAP_REVISION,te.env.CI||te.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ve=Ee,Xe=Ee;let e=te.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ve=t.userLocale,Nt=t.osLocale,Xe=t.resolvedLanguage||Ee,Us=t.languagePack?.translationsConfigFile}catch{}xi=!0}else typeof navigator=="object"&&!qs?(fe=navigator.userAgent,fe.indexOf("Windows")>=0,fe.indexOf("Macintosh")>=0,(fe.indexOf("Macintosh")>=0||fe.indexOf("iPad")>=0||fe.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,lt=fe.indexOf("Linux")>=0,fe?.indexOf("Mobi")>=0,Xe=globalThis._VSCODE_NLS_LANGUAGE||Ee,Ve=navigator.language.toLowerCase(),Nt=Ve):console.error("Unable to resolve platform.");var qt=xi,le=fe,we=Xe,Gs;(e=>{function t(){return we}e.value=t;function i(){return we.length===2?we==="en":we.length>=3?we[0]==="e"&&we[1]==="n"&&we[2]==="-":!1}e.isDefaultVariant=i;function r(){return we==="en"}e.isDefault=r})(Gs||={});var Hs=typeof Se.postMessage=="function"&&!Se.importScripts;(()=>{if(Hs){let e=[];Se.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let o=e[r];if(o.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),o.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Se.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var Vs=!!(le&&le.indexOf("Chrome")>=0);le&&le.indexOf("Firefox")>=0;!Vs&&le&&le.indexOf("Safari")>=0;le&&le.indexOf("Edg/")>=0;le&&le.indexOf("Android")>=0;var Re=typeof navigator=="object"?navigator:{};qt||document.queryCommandSupported&&document.queryCommandSupported("copy")||Re&&Re.clipboard&&Re.clipboard.writeText,qt||Re&&Re.clipboard&&Re.clipboard.readText;var Ct=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ct=new Ct,Gt=new Ct,Ht=new Ct;new Array(230);var js;(e=>{function t(a){return ct.keyCodeToStr(a)}e.toString=t;function i(a){return ct.strToKeyCode(a)}e.fromString=i;function r(a){return Gt.keyCodeToStr(a)}e.toUserSettingsUS=r;function s(a){return Ht.keyCodeToStr(a)}e.toUserSettingsGeneral=s;function o(a){return Gt.strToKeyCode(a)||Ht.strToKeyCode(a)}e.fromUserSettings=o;function n(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ct.keyCodeToStr(a)}e.toElectronAccelerator=n})(js||={});var Li=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Ys;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Xs?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:pe.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Li})})(Ys||={});var Xs=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Li:(this._emitter||(this._emitter=new P),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Zs;(e=>{async function t(r){let s,o=await Promise.all(r.map(n=>n.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return o}e.settled=t;function i(r){return new Promise(async(s,o)=>{try{await r(s,o)}catch(n){o(n)}})}e.withAsyncBody=i})(Zs||={});var Vt=class se{static fromArray(t){return new se(i=>{i.emitMany(t)})}static fromPromise(t){return new se(async i=>{i.emitMany(await t)})}static fromPromises(t){return new se(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new se(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new P,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await pe.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new se(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return se.map(this,t)}static filter(t,i){return new se(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return se.filter(this,t)}static coalesce(t){return se.filter(t,i=>!!i)}coalesce(){return se.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return se.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Vt.EMPTY=Vt.fromArray([]);var{getWindow:Qs}=(function(){let e=new Map,t={window:ye,disposables:new ke};e.set(ye.vscodeWindowId,t);let i=new P,r=new P,s=new P;function o(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(n){if(e.has(n.vscodeWindowId))return ne.None;let a=new ke,l={window:n,disposables:a.add(new ke)};return e.set(n.vscodeWindowId,l),a.add(Y(()=>{e.delete(n.vscodeWindowId),r.fire(n)})),a.add(pt(n,Js.BEFORE_UNLOAD,()=>{s.fire(n)})),i.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:o,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=n;return l?.view?l.view.window:ye},getDocument(n){return Qs(n).document}}})(),Ks=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function pt(e,t,i,r){return new Ks(e,t,i,r)}var Js={BEFORE_UNLOAD:"beforeunload"},er=class extends ne{constructor(e,t,i,r,s,o,n,a,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=o,this._optionsService=n,this._themeService=a,this._cursorBlinkStateManager=new Pe,this._charAtlasDisposable=this._register(new Pe),this._observerDisposable=this._register(new Pe),this._model=new ks,this._workCell=new Ft,this._workCell2=new Ft,this._rectangleRenderer=this._register(new Pe),this._glyphRenderer=this._register(new Pe),this._onChangeTextureAtlas=this._register(new P),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new P),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new P),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new P),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new P),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ji(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new zs(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=Hi(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(n.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(pt(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(pt(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Et(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=kt(this._canvas,this._coreBrowserService.window,(c,d)=>this._setCanvasDevicePixelDimensions(c,d)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=kt(this._canvas,c,(d,u)=>this._setCanvasDevicePixelDimensions(d,u))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Y(()=>{for(let c of this._renderLayers)c.dispose();this._canvas.parentElement?.removeChild(this._canvas),Et(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(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.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 e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Ds(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Rs(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 e=vi(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._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Jt(pe.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),pe.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new xs(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,r=this._workCell,s,o,n,a,l,h,c=0,d=!0,u,g,y,T,$,O,R,S,x;e=jt(e,i.rows-1,0),t=jt(t,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,U=A-i.buffer.ydisp,X=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),oe=-1,me=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(o=e;o<=t;o++)for(n=o+i.buffer.ydisp,a=i.buffer.lines.get(n),this._model.lineLengths[o]=0,y=A===n,c=0,l=this._characterJoinerService.getJoinedCharacters(n),S=0;S<i.cols;S++){if(s=this._cellColorResolver.result.bg,a.loadCell(S,r),S===0&&(s=this._cellColorResolver.result.bg),h=!1,d=S>=c,u=S,l.length>0&&S===l[0][0]&&d){g=l.shift();let m=this._model.selection.isCellSelected(this._terminal,g[0],n);for(R=g[0]+1;R<g[1];R++)d&&=m===this._model.selection.isCellSelected(this._terminal,R,n);d&&=!y||X<g[0]||X>=g[1],d?(h=!0,r=new tr(r,a.translateToString(!0,g[0],g[1]),g[1]-g[0]),u=g[1]-1):c=g[1]}if(T=r.getChars(),$=r.getCode(),R=(o*i.cols+S)*Ze,this._cellColorResolver.resolve(r,S,n,this.dimensions.device.cell.width),me&&n===A&&(S===X&&(this._model.cursor={x:X,y:U,width:r.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},oe=X+r.getWidth()-1),S>=X&&S<=oe&&(this._coreBrowserService.isFocused&&M==="block"||this._coreBrowserService.isFocused===!1&&i.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)),$!==0&&(this._model.lineLengths[o]=S+1),!(this._model.cells[R]===$&&this._model.cells[R+je]===this._cellColorResolver.result.bg&&this._model.cells[R+Ye]===this._cellColorResolver.result.fg&&this._model.cells[R+ot]===this._cellColorResolver.result.ext)&&(B=!0,T.length>1&&($|=Es),this._model.cells[R]=$,this._model.cells[R+je]=this._cellColorResolver.result.bg,this._model.cells[R+Ye]=this._cellColorResolver.result.fg,this._model.cells[R+ot]=this._cellColorResolver.result.ext,O=r.getWidth(),this._glyphRenderer.value.updateCell(S,o,$,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,T,O,s),h)){for(r=this._workCell,S++;S<=u;S++)x=(o*i.cols+S)*Ze,this._glyphRenderer.value.updateCell(S,o,0,0,0,0,zi,0,0),this._model.cells[x]=0,this._model.cells[x+je]=this._cellColorResolver.result.bg,this._model.cells[x+Ye]=this._cellColorResolver.result.fg,this._model.cells[x+ot]=this._cellColorResolver.result.ext;S--}}B&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},tr=class extends Be{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function jt(e,t,i=0){return Math.max(Math.min(e,t),i)}var Yt="di$target",Xt="di$dependencies",dt=new Map;function ce(e){if(dt.has(e))return dt.get(e);let t=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ir(t,i,s)};return t._id=e,dt.set(e,t),t}function ir(e,t,i){t[Yt]===t?t[Xt].push({id:e,index:i}):(t[Xt]=[{id:e,index:i}],t[Yt]=t)}ce("BufferService");ce("CoreMouseService");ce("CoreService");ce("CharsetService");ce("InstantiationService");ce("LogService");var sr=ce("OptionsService");ce("OscLinkService");ce("UnicodeService");ce("DecorationService");var rr={trace:0,debug:1,info:2,warn:3,error:4,off:5},nr="xterm.js: ",Zt=class extends ne{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=rr[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":nr)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Zt=Si([Ai(0,sr)],Zt);var ar=class extends ne{constructor(e){if(ii&&Ii()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new P),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new P),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new P),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new P),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,r=t.optionsService,s=t,o=s._renderService,n=s._characterJoinerService,a=s._charSizeService,l=s._coreBrowserService,h=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new er(e,n,a,l,i,h,r,c,this._preserveDrawingBuffer)),this._register(pe.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(pe.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(pe.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(pe.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),o.setRenderer(this._renderer),this._register(Y(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{ar as WebglAddon};
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="7" fill="#fffdf6"/><path fill="#182844" d="M10 4h12v3h4v3h3v14h-7v5H10v-5H3V10h3V7h4Z"/><path fill="#ce302e" d="M10 7h12v3h4v11H6V10h4Z"/><path fill="#fffdf6" d="M12 8h7v7h-7ZM6 16h5v5H6Zm16 0h4v5h-4Zm-9 7h7v4h-7Z"/></svg>
@@ -0,0 +1,93 @@
1
+ Copyright 2012 The Press Start 2P Project Authors (cody@zone38.net), with Reserved Font Name "Press Start 2P".
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="theme-color" content="#fffdf6">
7
+ <meta name="description" content="Super Bridge: modelos, requisições, logs, painel e terminal local. Uma sala de controle inspirada no universo Mario.">
8
+ <title>Nyxo Bridge</title>
9
+ <link rel="icon" href="/dashboard/favicon.svg" type="image/svg+xml">
10
+ <script type="module" crossorigin src="/dashboard/assets/index-CJE_a_Tn.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/dashboard/assets/react-vendor-C475ILlI.js">
12
+ <link rel="stylesheet" crossorigin href="/dashboard/assets/index-o8xT03ZV.css">
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ <noscript>Ative JavaScript para abrir o Super Bridge. O bridge Python e sua API continuam independentes.</noscript>
17
+ </body>
18
+ </html>