@jsenv/terminal-recorder 1.1.11 → 1.2.1

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.
@@ -2,6 +2,754 @@
2
2
 
3
3
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WebglAddon=t():e.WebglAddon=t();}(self,(()=>(()=>{var e={965:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const r=i(374),o=i(509),n=i(855),a=i(859),h=i(776),l=i(381),c=11,d=c*Float32Array.BYTES_PER_ELEMENT;let _,u=0,g=0,v=0;class f extends a.Disposable{constructor(e,t,i){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const s=this._gl;void 0===o.TextureAtlas.maxAtlasPages&&(o.TextureAtlas.maxAtlasPages=Math.min(32,(0, r.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),o.TextureAtlas.maxTextureSize=(0, r.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=(0, r.throwIfFalsy)((0, l.createProgram)(s,"#version 300 es\nlayout (location = 0) in vec2 a_unitquad;\nlayout (location = 1) in vec2 a_cellpos;\nlayout (location = 2) in vec2 a_offset;\nlayout (location = 3) in vec2 a_size;\nlayout (location = 4) in float a_texpage;\nlayout (location = 5) in vec2 a_texcoord;\nlayout (location = 6) in vec2 a_texsize;\n\nuniform mat4 u_projection;\nuniform vec2 u_resolution;\n\nout vec2 v_texcoord;\nflat out int v_texpage;\n\nvoid main() {\n vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_texpage = int(a_texpage);\n v_texcoord = a_texcoord + a_unitquad * a_texsize;\n}",function(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\nprecision lowp float;\n\nin vec2 v_texcoord;\nflat in int v_texpage;\n\nuniform sampler2D u_texture[${e}];\n\nout vec4 outColor;\n\nvoid main() {\n if (v_texpage == 0) {\n outColor = texture(u_texture[0], v_texcoord);\n } ${t}\n}`}(o.TextureAtlas.maxAtlasPages))),this.register((0, a.toDisposable)((()=>s.deleteProgram(this._program)))),this._projectionLocation=(0, r.throwIfFalsy)(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0, r.throwIfFalsy)(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0, r.throwIfFalsy)(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);const n=new Float32Array([0,0,1,0,0,1,1,1]),h=s.createBuffer();this.register((0, a.toDisposable)((()=>s.deleteBuffer(h)))),s.bindBuffer(s.ARRAY_BUFFER,h),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const c=new Uint8Array([0,1,2,3]),_=s.createBuffer();this.register((0, a.toDisposable)((()=>s.deleteBuffer(_)))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,_),s.bufferData(s.ELEMENT_ARRAY_BUFFER,c,s.STATIC_DRAW),this._attributesBuffer=(0, r.throwIfFalsy)(s.createBuffer()),this.register((0, a.toDisposable)((()=>s.deleteBuffer(this._attributesBuffer)))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,d,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,d,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,d,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,d,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,d,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,d,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);const u=new Int32Array(o.TextureAtlas.maxAtlasPages);for(let e=0;e<o.TextureAtlas.maxAtlasPages;e++)u[e]=e;s.uniform1iv(this._textureLocation,u),s.uniformMatrix4fv(this._projectionLocation,!1,l.PROJECTION_MATRIX),this._atlasTextures=[];for(let e=0;e<o.TextureAtlas.maxAtlasPages;e++){const t=new l.GLTexture((0, r.throwIfFalsy)(s.createTexture()));this.register((0, a.toDisposable)((()=>s.deleteTexture(t.texture)))),s.activeTexture(s.TEXTURE0+e),s.bindTexture(s.TEXTURE_2D,t.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[e]=t;}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize();}beginFrame(){return !this._atlas||this._atlas.beginFrame()}updateCell(e,t,i,s,r,o,n,a){this._updateCell(this._vertices.attributes,e,t,i,s,r,o,n,a);}_updateCell(e,t,i,s,r,o,a,h,l){u=(i*this._terminal.cols+t)*c,s!==n.NULL_CELL_CODE&&void 0!==s?this._atlas&&(_=h&&h.length>1?this._atlas.getRasterizedGlyphCombinedChar(h,r,o,a,!1):this._atlas.getRasterizedGlyph(s,r,o,a,!1),g=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==l&&_.offset.x>g?(v=_.offset.x-g,e[u]=-(_.offset.x-v)+this._dimensions.device.char.left,e[u+1]=-_.offset.y+this._dimensions.device.char.top,e[u+2]=(_.size.x-v)/this._dimensions.device.canvas.width,e[u+3]=_.size.y/this._dimensions.device.canvas.height,e[u+4]=_.texturePage,e[u+5]=_.texturePositionClipSpace.x+v/this._atlas.pages[_.texturePage].canvas.width,e[u+6]=_.texturePositionClipSpace.y,e[u+7]=_.sizeClipSpace.x-v/this._atlas.pages[_.texturePage].canvas.width,e[u+8]=_.sizeClipSpace.y):(e[u]=-_.offset.x+this._dimensions.device.char.left,e[u+1]=-_.offset.y+this._dimensions.device.char.top,e[u+2]=_.size.x/this._dimensions.device.canvas.width,e[u+3]=_.size.y/this._dimensions.device.canvas.height,e[u+4]=_.texturePage,e[u+5]=_.texturePositionClipSpace.x,e[u+6]=_.texturePositionClipSpace.y,e[u+7]=_.sizeClipSpace.x,e[u+8]=_.sizeClipSpace.y)):e.fill(0,u,u+c-1-2);}clear(){const e=this._terminal,t=e.cols*e.rows*c;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 t=0;t<e.rows;t++)for(let s=0;s<e.cols;s++)this._vertices.attributes[i+9]=s/e.cols,this._vertices.attributes[i+10]=t/e.rows,i+=c;}handleResize(){const e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear();}render(e){if(!this._atlas)return;const t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const i=this._vertices.attributesBuffers[this._activeBuffer];let s=0;for(let t=0;t<e.lineLengths.length;t++){const r=t*this._terminal.cols*c,o=this._vertices.attributes.subarray(r,r+e.lineLengths[t]*c);i.set(o,s),s+=o.length;}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/c);}setAtlas(e){this._atlas=e;for(const e of this._atlasTextures)e.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;}}t.GlyphRenderer=f,s([h.traceCall],f.prototype,"updateCell",null);},742:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const s=i(374),r=i(859),o=i(310),n=i(381),a=8*Float32Array.BYTES_PER_ELEMENT;class h{constructor(){this.attributes=new Float32Array(160),this.count=0;}}let l=0,c=0,d=0,_=0,u=0,g=0,v=0;class f extends r.Disposable{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=o,this._vertices=new h,this._verticesCursor=new h;const l=this._gl;this._program=(0, s.throwIfFalsy)((0, n.createProgram)(l,"#version 300 es\nlayout (location = 0) in vec2 a_position;\nlayout (location = 1) in vec2 a_size;\nlayout (location = 2) in vec4 a_color;\nlayout (location = 3) in vec2 a_unitquad;\n\nuniform mat4 u_projection;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 zeroToOne = a_position + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_color = a_color;\n}","#version 300 es\nprecision lowp float;\n\nin vec4 v_color;\n\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n}")),this.register((0, r.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0, s.throwIfFalsy)(l.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);const c=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0, r.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,c,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const _=new Uint8Array([0,1,2,3]),u=l.createBuffer();this.register((0, r.toDisposable)((()=>l.deleteBuffer(u)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,u),l.bufferData(l.ELEMENT_ARRAY_BUFFER,_,l.STATIC_DRAW),this._attributesBuffer=(0, s.throwIfFalsy)(l.createBuffer()),this.register((0, r.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,a,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,a,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,a,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle();})));}renderBackgrounds(){this._renderVertices(this._vertices);}renderCursor(){this._renderVertices(this._verticesCursor);}_renderVertices(e){const t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,n.PROJECTION_MATRIX),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){const t=this._terminal,i=this._vertices;let s,r,n,a,h,l,c,d,_,u,g,v=1;for(s=0;s<t.rows;s++){for(n=-1,a=0,h=0,l=!1,r=0;r<t.cols;r++)c=(s*t.cols+r)*o.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[c+o.RENDER_MODEL_BG_OFFSET],_=e.cells[c+o.RENDER_MODEL_FG_OFFSET],u=!!(67108864&_),(d!==a||_!==h&&(l||u))&&((0!==a||l&&0!==h)&&(g=8*v++,this._updateRectangle(i,g,h,a,n,r,s)),n=r,a=d,h=_,l=u);(0!==a||l&&0!==h)&&(g=8*v++,this._updateRectangle(i,g,h,a,n,t.cols,s));}i.count=v;}updateCursor(e){const t=this._verticesCursor,i=e.cursor;if(!i||"block"===i.style)return void(t.count=0);let s,r=0;"bar"!==i.style&&"outline"!==i.style||(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,"bar"===i.style?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),"underline"!==i.style&&"outline"!==i.style||(s=8*r++,this._addRectangleFloat(t.attributes,s,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)),"outline"===i.style&&(s=8*r++,this._addRectangleFloat(t.attributes,s,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),s=8*r++,this._addRectangleFloat(t.attributes,s,(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=r;}_updateRectangle(e,t,i,s,r,o,a){if(67108864&i)switch(50331648&i){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&i].rgba;break;case 50331648:l=(16777215&i)<<8;break;default:l=this._themeService.colors.foreground.rgba;}else switch(50331648&s){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&s].rgba;break;case 50331648:l=(16777215&s)<<8;break;default:l=this._themeService.colors.background.rgba;}e.attributes.length<t+4&&(e.attributes=(0, n.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),c=r*this._dimensions.device.cell.width,d=a*this._dimensions.device.cell.height,_=(l>>24&255)/255,u=(l>>16&255)/255,g=(l>>8&255)/255,v=1,this._addRectangle(e.attributes,t,c,d,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,_,u,g,v);}_addRectangle(e,t,i,s,r,o,n,a,h,l){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/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]=h,e[t+7]=l;}_addRectangleFloat(e,t,i,s,r,o,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/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,(255&e.rgba)/255])}}t.RectangleRenderer=f;},310:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const s=i(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0, s.createSelectionRenderModel)();}resize(e,i){const s=e*i*t.RENDER_MODEL_INDICIES_PER_CELL;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(i));}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0);}};},666:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const r=i(820),o=i(274),n=i(627),a=i(457),h=i(56),l=i(374),c=i(345),d=i(859),_=i(147),u=i(782),g=i(855),v=i(776),f=i(965),p=i(742),C=i(310),m=i(733);class L extends d.Disposable{constructor(e,t,i,s,a,_,g,v,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=a,this._decorationService=_,this._optionsService=g,this._themeService=v,this._cursorBlinkStateManager=new d.MutableDisposable,this._charAtlasDisposable=this.register(new d.MutableDisposable),this._model=new C.RenderModel,this._workCell=new u.CellData,this._rectangleRenderer=this.register(new d.MutableDisposable),this._glyphRenderer=this.register(new d.MutableDisposable),this._onChangeTextureAtlas=this.register(new c.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new c.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new c.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new c.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new o.CellColorResolver(this._terminal,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier2,this._coreBrowserService,g,this._themeService)],this.dimensions=(0, l.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(g.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=document.createElement("canvas");const p={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",p),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0, r.addDisposableDomListener)(this._canvas,"webglcontextlost",(e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e);}),3e3);}))),this.register((0, r.addDisposableDomListener)(this._canvas,"webglcontextrestored",(e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0, n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport();}))),this.register((0, h.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0, d.toDisposable)((()=>{var e;for(const e of this._renderLayers)e.dispose();null===(e=this._canvas.parentElement)||void 0===e||e.removeChild(this._canvas),(0, n.removeTerminalFromCache)(this._terminal);})));}get textureAtlas(){var e;return null===(e=this._charAtlas)||void 0===e?void 0:e.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){var i,s,r,o;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const e of this._renderLayers)e.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`,null===(i=this._rectangleRenderer.value)||void 0===i||i.setDimensions(this.dimensions),null===(s=this._rectangleRenderer.value)||void 0===s||s.handleResize(),null===(r=this._glyphRenderer.value)||void 0===r||r.setDimensions(this.dimensions),null===(o=this._glyphRenderer.value)||void 0===o||o.handleResize(),this._refreshCharAtlas(),this._clearModel(!1);}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows);}handleBlur(){var e;for(const e of this._renderLayers)e.handleBlur(this._terminal);null===(e=this._cursorBlinkStateManager.value)||void 0===e||e.pause(),this._requestRedrawViewport();}handleFocus(){var e;for(const e of this._renderLayers)e.handleFocus(this._terminal);null===(e=this._cursorBlinkStateManager.value)||void 0===e||e.resume(),this._requestRedrawViewport();}handleSelectionChanged(e,t,i){for(const s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._terminal,e,t,i),this._requestRedrawViewport();}handleCursorMove(){var e;for(const e of this._renderLayers)e.handleCursorMove(this._terminal);null===(e=this._cursorBlinkStateManager.value)||void 0===e||e.restartBlinkAnimation();}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink();}_initializeWebGLState(){return this._rectangleRenderer.value=new p.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new f.GlyphRenderer(this._terminal,this._gl,this.dimensions),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const t=(0, n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=(0, d.getDisposeArrayDisposable)([(0, c.forwardEvent)(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0, c.forwardEvent)(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=t,this._charAtlas.warmUp(),null===(e=this._glyphRenderer.value)||void 0===e||e.setAtlas(this._charAtlas);}_clearModel(e){var t;this._model.clear(),e&&(null===(t=this._glyphRenderer.value)||void 0===t||t.clear());}clearTextureAtlas(){var e;null===(e=this._charAtlas)||void 0===e||e.clearTexture(),this._clearModel(!0),this._requestRedrawViewport();}clear(){var e;this._clearModel(!0);for(const e of this._renderLayers)e.reset(this._terminal);null===(e=this._cursorBlinkStateManager.value)||void 0===e||e.restartBlinkAnimation(),this._updateCursorBlink();}registerCharacterJoiner(e){return -1}deregisterCharacterJoiner(e){return !1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;}for(const 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._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new a.CursorBlinkStateManager((()=>{this._requestRedrawCursor();}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor();}_updateModel(e,t){const i=this._core;let s,r,o,n,a,h,l,c,d,_,u,v,f,p=this._workCell;e=w(e,i.rows-1,0),t=w(t,i.rows-1,0);const m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,L=Math.min(this._terminal.buffer.active.cursorX,i.cols-1);let b=-1;const R=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let M=!1;for(r=e;r<=t;r++)for(o=r+i.buffer.ydisp,n=i.buffer.lines.get(o),this._model.lineLengths[r]=0,a=this._characterJoinerService.getJoinedCharacters(o),v=0;v<i.cols;v++)if(s=this._cellColorResolver.result.bg,n.loadCell(v,p),0===v&&(s=this._cellColorResolver.result.bg),h=!1,l=v,a.length>0&&v===a[0][0]&&(h=!0,c=a.shift(),p=new x(p,n.translateToString(!0,c[0],c[1]),c[1]-c[0]),l=c[1]-1),d=p.getChars(),_=p.getCode(),u=(r*i.cols+v)*C.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(p,v,o),R&&o===m&&(v===L&&(this._model.cursor={x:L,y:this._terminal.buffer.active.cursorY,width:p.getWidth(),style:this._coreBrowserService.isFocused?i.options.cursorStyle||"block":i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},b=L+p.getWidth()-1),v>=L&&v<=b&&(this._coreBrowserService.isFocused&&"block"===(i.options.cursorStyle||"block")||!1===this._coreBrowserService.isFocused&&"block"===i.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),_!==g.NULL_CELL_CODE&&(this._model.lineLengths[r]=v+1),(this._model.cells[u]!==_||this._model.cells[u+C.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[u+C.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[u+C.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(M=!0,d.length>1&&(_|=C.COMBINED_CHAR_BIT_MASK),this._model.cells[u]=_,this._model.cells[u+C.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[u+C.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[u+C.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,this._glyphRenderer.value.updateCell(v,r,_,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,s),h))for(p=this._workCell,v++;v<l;v++)f=(r*i.cols+v)*C.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(v,r,g.NULL_CELL_CODE,0,0,0,g.NULL_CELL_CHAR,0),this._model.cells[f]=g.NULL_CELL_CODE,this._model.cells[f+C.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[f+C.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[f+C.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;M&&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=1===this._optionsService.rawOptions.lineHeight?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(){const e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e});}}t.WebglRenderer=L,s([v.traceCall],L.prototype,"renderRows",null);class x extends _.AttributeData{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 w(e,t,i=0){return Math.max(Math.min(e,t),i)}t.JoinedCellData=x;},381:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const s=i(374);function r(e,t,i){const r=(0, s.throwIfFalsy)(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);}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,i){const o=(0, s.throwIfFalsy)(e.createProgram());if(e.attachShader(o,(0, s.throwIfFalsy)(r(e,e.VERTEX_SHADER,t))),e.attachShader(o,(0, s.throwIfFalsy)(r(e,e.FRAGMENT_SHADER,i))),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;console.error(e.getProgramInfoLog(o)),e.deleteProgram(o);},t.createShader=r,t.expandFloat32Array=function(e,t){const i=Math.min(2*e.length,t),s=new Float32Array(i);for(let t=0;t<e.length;t++)s[t]=e[t];return s},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1;}};},592:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const s=i(627),r=i(237),o=i(374),n=i(859);class a extends n.Disposable{constructor(e,t,i,s,r,o,a,h){super(),this._container=t,this._alpha=r,this._coreBrowserService=o,this._optionsService=a,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e);}))),this.register((0, n.toDisposable)((()=>{this._canvas.remove();})));}_initCanvas(){this._ctx=(0, o.throwIfFalsy)(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,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;const 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=(0, s.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),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,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight));}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=r.TEXT_BASELINE,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*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){return `${i?"italic":""} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=a;},733:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const s=i(197),r=i(237),o=i(592);class n extends o.BaseRenderLayer{constructor(e,t,i,s,r,o,n){super(i,e,"link",t,!0,r,o,n),this.register(s.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(s.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))));}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);const 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===r.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&(0, s.is256Color)(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();}}t.LinkRenderLayer=n;},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,s){e.addEventListener(t,i,s);let r=!1;return {dispose:()=>{r||(r=!0,e.removeEventListener(t,i,s));}}};},274:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let i,s=0,r=0,o=!1,n=!1,a=!1;t.CellColorResolver=class{constructor(e,t,i,s,r){this._terminal=e,this._selectionRenderModel=t,this._decorationService=i,this._coreBrowserService=s,this._themeService=r,this.result={fg:0,bg:0,ext:0};}resolve(e,t,h){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,r=0,s=0,n=!1,o=!1,a=!1,i=this._themeService.colors,this._decorationService.forEachDecorationAtCell(t,h,"bottom",(e=>{e.backgroundColorRGB&&(r=e.backgroundColorRGB.rgba>>8&16777215,n=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,o=!0);})),a=this._selectionRenderModel.isCellSelected(this._terminal,t,h),a&&(r=(this._coreBrowserService.isFocused?i.selectionBackgroundOpaque:i.selectionInactiveBackgroundOpaque).rgba>>8&16777215,n=!0,i.selectionForeground&&(s=i.selectionForeground.rgba>>8&16777215,o=!0)),this._decorationService.forEachDecorationAtCell(t,h,"top",(e=>{e.backgroundColorRGB&&(r=e.backgroundColorRGB.rgba>>8&16777215,n=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,o=!0);})),n&&(r=a?-16777216&e.bg&-134217729|r|50331648:-16777216&e.bg|r|50331648),o&&(s=-16777216&e.fg&-67108865|s|50331648),67108864&this.result.fg&&(n&&!o&&(s=0==(50331648&this.result.bg)?-134217728&this.result.fg|16777215&i.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,o=!0),!n&&o&&(r=0==(50331648&this.result.fg)?-67108864&this.result.bg|16777215&i.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,n=!0)),i=void 0,this.result.bg=n?r:this.result.bg,this.result.fg=o?s:this.result.fg;}};},627:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const s=i(509),r=i(197),o=[];t.acquireTextureAtlas=function(e,t,i,n,a,h,l,c){const d=(0, r.generateConfig)(n,a,h,l,t,i,c);for(let t=0;t<o.length;t++){const i=o[t],s=i.ownedBy.indexOf(e);if(s>=0){if((0, r.configEquals)(i.config,d))return i.atlas;1===i.ownedBy.length?(i.atlas.dispose(),o.splice(t,1)):i.ownedBy.splice(s,1);break}}for(let t=0;t<o.length;t++){const i=o[t];if((0, r.configEquals)(i.config,d))return i.ownedBy.push(e),i.atlas}const _=e._core,u={atlas:new s.TextureAtlas(document,d,_.unicodeService),config:d,ownedBy:[e]};return o.push(u),u.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<o.length;t++){const i=o[t].ownedBy.indexOf(e);if(-1!==i){1===o[t].ownedBy.length?(o[t].atlas.dispose(),o.splice(t,1)):o[t].ownedBy.splice(i,1);break}}};},197:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const s=i(160);t.generateConfig=function(e,t,i,r,o,n,a){const h={foreground:n.foreground,background:n.background,cursor:s.NULL_COLOR,cursorAccent:s.NULL_COLOR,selectionForeground:s.NULL_COLOR,selectionBackgroundTransparent:s.NULL_COLOR,selectionBackgroundOpaque:s.NULL_COLOR,selectionInactiveBackgroundTransparent:s.NULL_COLOR,selectionInactiveBackgroundOpaque:s.NULL_COLOR,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return {customGlyphs:o.customGlyphs,devicePixelRatio:a,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:r,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:h}},t.configEquals=function(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},t.is256Color=function(e){return 16777216==(50331648&e)||33554432==(50331648&e)};},237:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const s=i(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=s.isFirefox||s.isLegacyEdge?"bottom":"ideographic";},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0;t.CursorBlinkStateManager=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=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0;})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const e=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(e)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0;}));}),600);}),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();}};},860:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const s=i(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const r={"░":[[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]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(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`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(e,i,n,l,c,d,_,u){const g=t.blockElementDefinitions[i];if(g)return function(e,t,i,s,r,o){for(let n=0;n<t.length;n++){const a=t[n],h=r/8,l=o/8;e.fillRect(i+a.x*h,s+a.y*l,a.w*h,a.h*l);}}(e,g,n,l,c,d),!0;const v=r[i];if(v)return function(e,t,i,r,n,a){let h=o.get(t);h||(h=new Map,o.set(t,h));const l=e.fillStyle;if("string"!=typeof l)throw new Error(`Unexpected fillStyle type "${l}"`);let c=h.get(l);if(!c){const i=t[0].length,r=t.length,o=document.createElement("canvas");o.width=i,o.height=r;const n=(0, s.throwIfFalsy)(o.getContext("2d")),a=new ImageData(i,r);let d,_,u,g;if(l.startsWith("#"))d=parseInt(l.slice(1,3),16),_=parseInt(l.slice(3,5),16),u=parseInt(l.slice(5,7),16),g=l.length>7&&parseInt(l.slice(7,9),16)||1;else {if(!l.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,_,u,g]=l.substring(5,l.length-1).split(",").map((e=>parseFloat(e)));}for(let e=0;e<r;e++)for(let s=0;s<i;s++)a.data[4*(e*i+s)]=d,a.data[4*(e*i+s)+1]=_,a.data[4*(e*i+s)+2]=u,a.data[4*(e*i+s)+3]=t[e][s]*(255*g);n.putImageData(a,0,0),c=(0, s.throwIfFalsy)(e.createPattern(o,null)),h.set(l,c);}e.fillStyle=c,e.fillRect(i,r,n,a);}(e,v,n,l,c,d),!0;const f=t.boxDrawingDefinitions[i];if(f)return function(e,t,i,s,r,o,n){e.strokeStyle=e.fillStyle;for(const[l,c]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=n*Number.parseInt(l),t="function"==typeof c?c(.15,.15/o*r):c;for(const l of t.split(" ")){const t=l[0],c=a[t];if(!c){console.error(`Could not find drawing instructions for "${t}"`);continue}const d=l.substring(1).split(",");d[0]&&d[1]&&c(e,h(d,r,o,i,s,!0,n));}e.stroke(),e.closePath();}}(e,f,n,l,c,d,u),!0;const p=t.powerlineDefinitions[i];return !!p&&(function(e,t,i,s,r,o,n,l){var c,d;const _=new Path2D;_.rect(i,s,r,o),e.clip(_),e.beginPath();const u=n/12;e.lineWidth=l*u;for(const n of t.d.split(" ")){const _=n[0],g=a[_];if(!g){console.error(`Could not find drawing instructions for "${_}"`);continue}const v=n.substring(1).split(",");v[0]&&v[1]&&g(e,h(v,r,o,i,s,!1,l,(null!==(c=t.leftPadding)&&void 0!==c?c:0)*(u/2),(null!==(d=t.rightPadding)&&void 0!==d?d:0)*(u/2)));}1===t.type?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath();}(e,p,n,l,c,d,_,u),!0)};const o=new Map;function n(e,t,i=0){return Math.max(Math.min(e,t),i)}const a={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 h(e,t,i,s,r,o,a,h=0,l=0){const c=e.map((e=>parseFloat(e)||parseInt(e)));if(c.length<2)throw new Error("Too few arguments for instruction");for(let e=0;e<c.length;e+=2)c[e]*=t-h*a-l*a,o&&0!==c[e]&&(c[e]=n(Math.round(c[e]+.5)-.5,t,0)),c[e]+=s+h*a;for(let e=1;e<c.length;e+=2)c[e]*=i,o&&0!==c[e]&&(c[e]=n(Math.round(c[e]+.5)-.5,i,0)),c[e]+=r;return c}},56:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const s=i(859);t.observeDevicePixelDimensions=function(e,t,i){let r=new t.ResizeObserver((t=>{const s=t.find((t=>t.target===e));if(!s)return;if(!("devicePixelContentBoxSize"in s))return null==r||r.disconnect(),void(r=void 0);const o=s.devicePixelContentBoxSize[0].inlineSize,n=s.devicePixelContentBoxSize[0].blockSize;o>0&&n>0&&i(o,n);}));try{r.observe(e,{box:["device-pixel-content-box"]});}catch(e){r.disconnect(),r=void 0;}return (0, s.toDisposable)((()=>null==r?void 0:r.disconnect()))};},374:(e,t)=>{function i(e){return 57508<=e&&e<=57558}Object.defineProperty(t,"__esModule",{value:!0}),t.createRenderDimensions=t.excludeFromContrastRatioDemands=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.excludeFromContrastRatioDemands=function(e){return i(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return {css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}};},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class i{constructor(){this.clear();}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0;}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=t[1]-e.buffer.active.viewportY,o=i[1]-e.buffer.active.viewportY,n=Math.max(r,0),a=Math.min(o,e.rows-1);n>=e.rows||a<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=r,this.viewportEndRow=o,this.viewportCappedStartRow=n,this.viewportCappedEndRow=a,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)}}t.createSelectionRenderModel=function(){return new i};},509:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const r=i(237),o=i(860),n=i(374),a=i(160),h=i(345),l=i(485),c=i(385),d=i(147),_=i(855),u=i(776),g={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let v;class f{get pages(){return this._pages}constructor(e,t,i){this._document=e,this._config=t,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new l.FourKeyMap,this._cacheMapCombined=new l.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new d.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new h.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new h.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0, n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}));}dispose(){for(const e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose();}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0);}_doWarmUp(){const e=new c.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT)){const e=this._drawToCache(t,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT);this._cacheMap.set(t,_.DEFAULT_COLOR,_.DEFAULT_COLOR,_.DEFAULT_EXT,e);}}));}beginFrame(){return this._requestClearModel}clearTexture(){if(0!==this._pages[0].currentRow.x||0!==this._pages[0].currentRow.y){for(const e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1;}}_createNewPage(){if(f.maxAtlasPages&&this._pages.length>=Math.max(4,f.maxAtlasPages)){const e=this._pages.filter((e=>2*e.canvas.width<=(f.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width!==e.canvas.width?t.canvas.width-e.canvas.width:t.percentageUsed-e.percentageUsed));let t=-1,i=0;for(let s=0;s<e.length;s++)if(e[s].canvas.width!==i)t=s,i=e[s].canvas.width;else if(s-t==3)break;const s=e.slice(t,t+4),r=s.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),o=this.pages.length-s.length,n=this._mergePages(s,o);n.version++;for(let e=r.length-1;e>=0;e--)this._deletePage(r[e]);this.pages.push(n),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(n.canvas);}const e=new p(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){const i=2*e[0].canvas.width,s=new p(this._document,i,e);for(const[r,o]of e.entries()){const e=r*o.canvas.width%i,n=Math.floor(r/2)*o.canvas.height;s.ctx.drawImage(o.canvas,e,n);for(const s of o.glyphs)s.texturePage=t,s.sizeClipSpace.x=s.size.x/i,s.sizeClipSpace.y=s.size.y/i,s.texturePosition.x+=e,s.texturePosition.y+=n,s.texturePositionClipSpace.x=s.texturePosition.x/i,s.texturePositionClipSpace.y=s.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(o.canvas);const a=this._activePages.indexOf(o);-1!==a&&this._activePages.splice(a,1);}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){const e=this._pages[t];for(const t of e.glyphs)t.texturePage--;e.version++;}}getRasterizedGlyphCombinedChar(e,t,i,s,r){return this._getFromCacheMap(this._cacheMapCombined,e,t,i,s,r)}getRasterizedGlyph(e,t,i,s,r){return this._getFromCacheMap(this._cacheMap,e,t,i,s,r)}_getFromCacheMap(e,t,i,s,r,o=!1){return v=e.get(t,i,s,r),v||(v=this._drawToCache(t,i,s,r,o),e.set(t,i,s,r,v)),v}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,i,s){if(this._config.allowTransparency)return a.NULL_COLOR;let r;switch(e){case 16777216:case 33554432:r=this._getColorFromAnsiIndex(t);break;case 50331648:const e=d.AttributeData.toColorRGB(t);r=a.rgba.toColor(e[0],e[1],e[2]);break;default:r=i?a.color.opaque(this._config.colors.foreground):this._config.colors.background;}return r}_getForegroundColor(e,t,i,s,o,n,h,l,c,_){const u=this._getMinimumContrastColor(e,t,i,s,o,n,!1,c,l,_);if(u)return u;let g;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&n<8&&(n+=8),g=this._getColorFromAnsiIndex(n);break;case 50331648:const e=d.AttributeData.toColorRGB(n);g=a.rgba.toColor(e[0],e[1],e[2]);break;default:g=h?this._config.colors.background:this._config.colors.foreground;}return this._config.allowTransparency&&(g=a.color.opaque(g)),l&&(g=a.color.multiplyOpacity(g,r.DIM_OPACITY)),g}_resolveBackgroundRgba(e,t,i){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,i,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,i,s,r,o,n,h,l,c){if(1===this._config.minimumContrastRatio||c)return;const d=this._getContrastCache(l),_=d.getColor(e,s);if(void 0!==_)return _||void 0;const u=this._resolveBackgroundRgba(t,i,n),g=this._resolveForegroundRgba(r,o,n,h),v=a.rgba.ensureContrastRatio(u,g,this._config.minimumContrastRatio/(l?2:1));if(!v)return void d.setColor(e,s,null);const f=a.rgba.toColor(v>>24&255,v>>16&255,v>>8&255);return d.setColor(e,s,f),f}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,i,s,a=!1){const h="number"==typeof e?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);const c=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=s,this._workAttributeData.isInvisible())return g;const _=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),v=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),m=!!this._workAttributeData.isUnderline(),L=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline();let w=this._workAttributeData.getFgColor(),b=this._workAttributeData.getFgColorMode(),R=this._workAttributeData.getBgColor(),M=this._workAttributeData.getBgColorMode();if(u){const e=w;w=R,R=e;const t=b;b=M,M=t;}const y=this._getBackgroundColor(M,R,u,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const A=_?this._config.fontWeightBold:this._config.fontWeight,E=p?"italic":"";this._tmpCtx.font=`${E} ${A} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;const S=1===h.length&&(0, n.isPowerlineGlyph)(h.charCodeAt(0)),T=1===h.length&&(0, n.isRestrictedPowerlineGlyph)(h.charCodeAt(0)),D=this._getForegroundColor(t,M,R,i,b,w,u,v,_,(0, n.excludeFromContrastRatioDemands)(h.charCodeAt(0)));this._tmpCtx.fillStyle=D.css;const P=T?0:4;let F=!1;!1!==this._config.customGlyphs&&(F=(0, o.tryDrawCustomChar)(this._tmpCtx,h,P,P,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B,I=!S;if(B="number"==typeof e?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),m){this._tmpCtx.save();const e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())I=!1,this._tmpCtx.strokeStyle=`rgb(${d.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else {I=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css;}this._tmpCtx.beginPath();const i=P,s=Math.ceil(P+this._config.deviceCharHeight)-t-(a?2*e:0),r=s+e,o=s+2*e;for(let n=0;n<B;n++){this._tmpCtx.save();const a=i+n*this._config.deviceCellWidth,h=i+(n+1)*this._config.deviceCellWidth,l=a+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(h,s),this._tmpCtx.moveTo(a,o),this._tmpCtx.lineTo(h,o);break;case 3:const i=e<=1?o:Math.ceil(P+this._config.deviceCharHeight-e/2)-t,n=e<=1?s:Math.ceil(P+this._config.deviceCharHeight+e/2)-t,c=new Path2D;c.rect(a,s,this._config.deviceCellWidth,o-s),this._tmpCtx.clip(c),this._tmpCtx.moveTo(a-this._config.deviceCellWidth/2,r),this._tmpCtx.bezierCurveTo(a-this._config.deviceCellWidth/2,n,a,n,a,r),this._tmpCtx.bezierCurveTo(a,i,l,i,l,r),this._tmpCtx.bezierCurveTo(l,n,h,n,h,r),this._tmpCtx.bezierCurveTo(h,i,h+this._config.deviceCellWidth/2,i,h+this._config.deviceCellWidth/2,r);break;case 4:this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(h,s);break;case 5:this._tmpCtx.setLineDash([4*this._config.devicePixelRatio,3*this._config.devicePixelRatio]),this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(h,s);break;default:this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(h,s);}this._tmpCtx.stroke(),this._tmpCtx.restore();}if(this._tmpCtx.restore(),!F&&this._config.fontSize>=12&&!this._config.allowTransparency&&" "!==h){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const t=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();const t=new Path2D;t.rect(i,s-Math.ceil(e/2),this._config.deviceCellWidth*B,o-s+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(h,P,P+this._config.deviceCharHeight),this._tmpCtx.restore();}}}if(x){const e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(P,P+t),this._tmpCtx.lineTo(P+this._config.deviceCharWidth*B,P+t),this._tmpCtx.stroke();}if(F||this._tmpCtx.fillText(h,P,P+this._config.deviceCharHeight),"_"===h&&!this._config.allowTransparency){let e=C(this._tmpCtx.getImageData(P,P,this._config.deviceCellWidth,this._config.deviceCellHeight),y,D,I);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,P,P+this._config.deviceCharHeight-t),e=C(this._tmpCtx.getImageData(P,P,this._config.deviceCellWidth,this._config.deviceCellHeight),y,D,I),e);t++);}if(L){const e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(P,P+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(P+this._config.deviceCharWidth*B,P+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke();}this._tmpCtx.restore();const O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let $;if($=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return !1;return !0}(O):C(O,y,D,I),$)return g;const k=this._findGlyphBoundingBox(O,this._workBoundingBox,l,T,F,P);let U,N;for(;;){if(0===this._activePages.length){const e=this._createNewPage();U=e,N=e.currentRow,N.height=k.size.y;break}U=this._activePages[this._activePages.length-1],N=U.currentRow;for(const e of this._activePages)k.size.y<=e.currentRow.height&&(U=e,N=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(const t of this._activePages[e].fixedRows)t.height<=N.height&&k.size.y<=t.height&&(U=this._activePages[e],N=t);if(N.y+k.size.y>=U.canvas.height||N.height>k.size.y+2){let e=!1;if(U.currentRow.y+U.currentRow.height+k.size.y>=U.canvas.height){let t;for(const e of this._activePages)if(e.currentRow.y+e.currentRow.height+k.size.y<e.canvas.height){t=e;break}if(t)U=t;else if(f.maxAtlasPages&&this._pages.length>=f.maxAtlasPages&&N.y+k.size.y<=U.canvas.height&&N.height>=k.size.y&&N.x+k.size.x<=U.canvas.width)e=!0;else {const t=this._createNewPage();U=t,N=t.currentRow,N.height=k.size.y,e=!0;}}e||(U.currentRow.height>0&&U.fixedRows.push(U.currentRow),N={x:0,y:U.currentRow.y+U.currentRow.height,height:k.size.y},U.fixedRows.push(N),U.currentRow={x:0,y:N.y+N.height,height:0});}if(N.x+k.size.x<=U.canvas.width)break;N===U.currentRow?(N.x=0,N.y+=N.height,N.height=0):U.fixedRows.splice(U.fixedRows.indexOf(N),1);}return k.texturePage=this._pages.indexOf(U),k.texturePosition.x=N.x,k.texturePosition.y=N.y,k.texturePositionClipSpace.x=N.x/U.canvas.width,k.texturePositionClipSpace.y=N.y/U.canvas.height,k.sizeClipSpace.x/=U.canvas.width,k.sizeClipSpace.y/=U.canvas.height,N.height=Math.max(N.height,k.size.y),N.x+=k.size.x,U.ctx.putImageData(O,k.texturePosition.x-this._workBoundingBox.left,k.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,k.size.x,k.size.y),U.addGlyph(k),U.version++,k}_findGlyphBoundingBox(e,t,i,s,r,o){t.top=0;const n=s?this._config.deviceCellHeight:this._tmpCanvas.height,a=s?this._config.deviceCellWidth:i;let h=!1;for(let i=0;i<n;i++){for(let s=0;s<a;s++){const r=i*this._tmpCanvas.width*4+4*s+3;if(0!==e.data[r]){t.top=i,h=!0;break}}if(h)break}t.left=0,h=!1;for(let i=0;i<o+a;i++){for(let s=0;s<n;s++){const r=s*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.left=i,h=!0;break}}if(h)break}t.right=a,h=!1;for(let i=o+a-1;i>=o;i--){for(let s=0;s<n;s++){const r=s*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.right=i,h=!0;break}}if(h)break}t.bottom=n,h=!1;for(let i=n-1;i>=0;i--){for(let s=0;s<a;s++){const r=i*this._tmpCanvas.width*4+4*s+3;if(0!==e.data[r]){t.bottom=i,h=!0;break}}if(h)break}return {texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+o+(s||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+o+(s||r?1===this._config.lineHeight?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=f,s([u.traceCall],f.prototype,"_drawToCache",null);class p{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;}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(const e of i)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=m(e,t,t),this.ctx=(0, n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}));}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++;}}function C(e,t,i,s){const r=t.rgba>>>24,o=t.rgba>>>16&255,n=t.rgba>>>8&255,a=i.rgba>>>24,h=i.rgba>>>16&255,l=i.rgba>>>8&255,c=Math.floor((Math.abs(r-a)+Math.abs(o-h)+Math.abs(n-l))/12);let d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===r&&e.data[t+1]===o&&e.data[t+2]===n||s&&Math.abs(e.data[t]-r)+Math.abs(e.data[t+1]-o)+Math.abs(e.data[t+2]-n)<c?e.data[t+3]=0:d=!1;return d}function m(e,t,i){const s=e.createElement("canvas");return s.width=t,s.height=i,s}},160:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;const s=i(399);let r=0,o=0,n=0,a=0;var h,l,c,d,_;function u(e){const t=e.toString(16);return t.length<2?"0"+t:t}function g(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(e){e.toCss=function(e,t,i,s){return void 0!==s?`#${u(e)}${u(t)}${u(i)}${u(s)}`:`#${u(e)}${u(t)}${u(i)}`},e.toRgba=function(e,t,i,s=255){return (e<<24|t<<16|i<<8|s)>>>0};}(h||(t.channels=h={})),function(e){function t(e,t){return a=Math.round(255*t),[r,o,n]=_.toChannels(e.rgba),{css:h.toCss(r,o,n,a),rgba:h.toRgba(r,o,n,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,1===a)return {css:t.css,rgba:t.rgba};const i=t.rgba>>24&255,s=t.rgba>>16&255,l=t.rgba>>8&255,c=e.rgba>>24&255,d=e.rgba>>16&255,_=e.rgba>>8&255;return r=c+Math.round((i-c)*a),o=d+Math.round((s-d)*a),n=_+Math.round((l-_)*a),{css:h.toCss(r,o,n),rgba:h.toRgba(r,o,n)}},e.isOpaque=function(e){return 255==(255&e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=_.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return _.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return [r,o,n]=_.toChannels(t),{css:h.toCss(r,o,n),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return a=255&e.rgba,t(e,a*i/255)},e.toColorRGB=function(e){return [e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]};}(l||(t.color=l={})),function(e){let t,i;if(!s.isNode){const e=document.createElement("canvas");e.width=1,e.height=1;const s=e.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1));}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return r=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),n=parseInt(e.slice(3,4).repeat(2),16),_.toColor(r,o,n);case 5:return r=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),n=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),_.toColor(r,o,n,a);case 7:return {css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return {css:e,rgba:parseInt(e.slice(1),16)>>>0}}const s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return r=parseInt(s[1]),o=parseInt(s[2]),n=parseInt(s[3]),a=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),_.toColor(r,o,n,a);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[r,o,n,a]=t.getImageData(0,0,1,1).data,255!==a)throw new Error("css.toColor: Unsupported css format");return {rgba:h.toRgba(r,o,n,a),css:e}};}(c||(t.css=c={})),function(e){function t(e,t,i){const s=e/255,r=t/255,o=i/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t;}(d||(t.rgb=d={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,o=e>>8&255;let n=t>>24&255,a=t>>16&255,h=t>>8&255,l=g(d.relativeLuminance2(n,a,h),d.relativeLuminance2(s,r,o));for(;l<i&&(n>0||a>0||h>0);)n-=Math.max(0,Math.ceil(.1*n)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),l=g(d.relativeLuminance2(n,a,h),d.relativeLuminance2(s,r,o));return (n<<24|a<<16|h<<8|255)>>>0}function i(e,t,i){const s=e>>24&255,r=e>>16&255,o=e>>8&255;let n=t>>24&255,a=t>>16&255,h=t>>8&255,l=g(d.relativeLuminance2(n,a,h),d.relativeLuminance2(s,r,o));for(;l<i&&(n<255||a<255||h<255);)n=Math.min(255,n+Math.ceil(.1*(255-n))),a=Math.min(255,a+Math.ceil(.1*(255-a))),h=Math.min(255,h+Math.ceil(.1*(255-h))),l=g(d.relativeLuminance2(n,a,h),d.relativeLuminance2(s,r,o));return (n<<24|a<<16|h<<8|255)>>>0}e.ensureContrastRatio=function(e,s,r){const o=d.relativeLuminance(e>>8),n=d.relativeLuminance(s>>8);if(g(o,n)<r){if(n<o){const n=t(e,s,r),a=g(o,d.relativeLuminance(n>>8));if(a<r){const t=i(e,s,r);return a>g(o,d.relativeLuminance(t>>8))?n:t}return n}const a=i(e,s,r),h=g(o,d.relativeLuminance(a>>8));if(h<r){const i=t(e,s,r);return h>g(o,d.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return [e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i,s){return {css:h.toCss(e,t,i,s),rgba:h.toRgba(e,t,i,s)}};}(_||(t.rgba=_={})),t.toPaddedHex=u,t.contrastRatio=g;},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1;}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let e=0;e<this._listeners.length;e++)i.push(this._listeners[e]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t);}dispose(){this.clearListeners(),this._disposed=!0;}clearListeners(){this._listeners&&(this._listeners.length=0);}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))};},859:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0;}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1;}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0;}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1);}},t.MutableDisposable=class{constructor(){this._isDisposed=!1;}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),this._value=e);}clear(){this.value=void 0;}dispose(){var e;this._isDisposed=!0,null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0;}},t.toDisposable=function(e){return {dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return {dispose:()=>i(e)}};},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class i{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={};}}t.TwoKeyMap=i,t.FourKeyMap=class{constructor(){this._data=new i;}set(e,t,s,r,o){this._data.get(e,t)||this._data.set(e,t,new i),this._data.get(e,t).set(s,r,o);}get(e,t,i,s){var r;return null===(r=this._data.get(e,t))||void 0===r?void 0:r.get(i,s)}clear(){this._data.clear();}};},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"==typeof navigator;const i=t.isNode?"node":navigator.userAgent,s=t.isNode?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isLegacyEdge=i.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(s),t.isLinux=s.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(i);},385:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(399);class r{constructor(){this._tasks=[],this._i=0;}enqueue(e){this._tasks.push(e),this._start();}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear();}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0;}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)));}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),r=e.timeRemaining(),1.5*i>r)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r;}this.clear();}}class o extends r{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e);}_createDeadline(e){const t=Date.now()+e;return {timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=o,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e);}}:o,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue;}set(e){this._queue.clear(),this._queue.enqueue(e);}flush(){this._queue.flush();}};},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new s;}static toColorRGB(e){return [e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return (255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return 50331648==(50331648&this.fg)}isBgRGB(){return 50331648==(50331648&this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return 0==(50331648&this.fg)}isBgDefault(){return 0==(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return -1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return -1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456;}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e;}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048;}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e;}get urlId(){return this._urlId}set urlId(e){this._urlId=e;}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t;}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s;},782:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const s=i(133),r=i(855),o=i(147);class n extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData="";}static fromCharData(e){const t=new n;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0, s.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0;}else t=!0;}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22);}getAsCharData(){return [this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=n;},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32;},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t);}return s},t.StringToUtf32=class{constructor(){this._interim=0;}clear(){this._interim=0;}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0;}for(let o=r;o<i;++o){const r=e.charCodeAt(o);if(55296<=r&&r<=56319){if(++o>=i)return this._interim=r,s;const n=e.charCodeAt(o);56320<=n&&n<=57343?t[s++]=1024*(r-55296)+n-56320+65536:(t[s++]=r,t[s++]=n);}else 65279!==r&&(t[s++]=r);}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3);}clear(){this.interim.fill(0);}decode(e,t){const i=e.length;if(!i)return 0;let s,r,o,n,a=0,h=0,l=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let o,n=0;for(;(o=63&this.interim[++n])&&n<4;)r<<=6,r|=o;const h=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,c=h-n;for(;l<c;){if(l>=i)return 0;if(o=e[l++],128!=(192&o)){l--,s=!0;break}this.interim[n++]=o,r<<=6,r|=63&o;}s||(2===h?r<128?l--:t[a++]=r:3===h?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0);}const c=i-4;let d=l;for(;d<i;){for(;!(!(d<c)||128&(s=e[d])||128&(r=e[d+1])||128&(o=e[d+2])||128&(n=e[d+3]));)t[a++]=s,t[a++]=r,t[a++]=o,t[a++]=n,d+=4;if(s=e[d++],s<128)t[a++]=s;else if(192==(224&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(h=(31&s)<<6|63&r,h<128){d--;continue}t[a++]=h;}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(o=e[d++],128!=(192&o)){d--;continue}if(h=(15&s)<<12|(63&r)<<6|63&o,h<2048||h>=55296&&h<=57343||65279===h)continue;t[a++]=h;}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(o=e[d++],128!=(192&o)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=o,a;if(n=e[d++],128!=(192&n)){d--;continue}if(h=(7&s)<<18|(63&r)<<12|(63&o)<<6|63&n,h<65536||h>1114111)continue;t[a++]=h;}}return a}};},776:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e);}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const o=i(859),n=i(97),a={trace:n.LogLevelEnum.TRACE,debug:n.LogLevelEnum.DEBUG,info:n.LogLevelEnum.INFO,warn:n.LogLevelEnum.WARN,error:n.LogLevelEnum.ERROR,off:n.LogLevelEnum.OFF};let h,l=t.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=n.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),h=this;}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel];}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]());}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i);}trace(e,...t){var i,s;this._logLevel<=n.LogLevelEnum.TRACE&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.trace.bind(this._optionsService.options.logger))&&void 0!==s?s:console.log,e,t);}debug(e,...t){var i,s;this._logLevel<=n.LogLevelEnum.DEBUG&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.debug.bind(this._optionsService.options.logger))&&void 0!==s?s:console.log,e,t);}info(e,...t){var i,s;this._logLevel<=n.LogLevelEnum.INFO&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.info.bind(this._optionsService.options.logger))&&void 0!==s?s:console.info,e,t);}warn(e,...t){var i,s;this._logLevel<=n.LogLevelEnum.WARN&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.warn.bind(this._optionsService.options.logger))&&void 0!==s?s:console.warn,e,t);}error(e,...t){var i,s;this._logLevel<=n.LogLevelEnum.ERROR&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.error.bind(this._optionsService.options.logger))&&void 0!==s?s:console.error,e,t);}};t.LogService=l=s([r(0,n.IOptionsService)],l),t.setTraceLogger=function(e){h=e;},t.traceCall=function(e,t,i){if("function"!=typeof i.value)throw new Error("not supported");const s=i.value;i.value=function(...e){if(h.logLevel!==n.LogLevelEnum.TRACE)return s.apply(this,e);h.trace(`GlyphRenderer#${s.name}(${e.map((e=>JSON.stringify(e))).join(", ")})`);const t=s.apply(this,e);return h.trace(`GlyphRenderer#${s.name} return`,t),t};};},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const i="di$target",s="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,o){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,r){t[i]===t?t[s].push({id:e,index:r}):(t[s]=[{id:e,index:r}],t[i]=t);}(r,e,o);};return r.toString=()=>e,t.serviceRegistry.set(e,r),r};},97:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(726);var r;t.IBufferService=(0, s.createDecorator)("BufferService"),t.ICoreMouseService=(0, s.createDecorator)("CoreMouseService"),t.ICoreService=(0, s.createDecorator)("CoreService"),t.ICharsetService=(0, s.createDecorator)("CharsetService"),t.IInstantiationService=(0, s.createDecorator)("InstantiationService"),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.OFF=5]="OFF";}(r||(t.LogLevelEnum=r={})),t.ILogService=(0, s.createDecorator)("LogService"),t.IOptionsService=(0, s.createDecorator)("OptionsService"),t.IOscLinkService=(0, s.createDecorator)("OscLinkService"),t.IUnicodeService=(0, s.createDecorator)("UnicodeService"),t.IDecorationService=(0, s.createDecorator)("DecorationService");}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,i),o.exports}var s={};return (()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;const t=i(345),r=i(859),o=i(399),n=i(666),a=i(776);class h extends r.Disposable{constructor(e){if(o.isSafari&&(0, o.getSafariVersion)()<16)throw new Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event;}activate(e){const i=e._core;if(!e.element)return void this.register(i.onWillOpen((()=>this.activate(e))));this._terminal=e;const s=i.coreService,o=i.optionsService,h=i,l=h._renderService,c=h._characterJoinerService,d=h._charSizeService,_=h._coreBrowserService,u=h._decorationService,g=h._logService,v=h._themeService;(0, a.setTraceLogger)(g),this._renderer=this.register(new n.WebglRenderer(e,c,d,_,s,u,o,v,this._preserveDrawingBuffer)),this.register((0, t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0, t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0, t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0, t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0, r.toDisposable)((()=>{const t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows);})));}get textureAtlas(){var e;return null===(e=this._renderer)||void 0===e?void 0:e.textureAtlas}clearTextureAtlas(){var e;null===(e=this._renderer)||void 0===e||e.clearTextureAtlas();}}e.WebglAddon=h;})(),s})()));
4
4
 
5
+ !function (e, t) {
6
+ "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.SerializeAddon = t() : e.SerializeAddon = t();
7
+ }(window, () => (() => {
8
+
9
+ var e = {
10
+ 930: (e, t, s) => {
11
+ Object.defineProperty(t, "__esModule", {
12
+ value: !0
13
+ }), t.ColorContrastCache = void 0;
14
+ const r = s(485);
15
+ t.ColorContrastCache = class {
16
+ constructor() {
17
+ this._color = new r.TwoKeyMap(), this._css = new r.TwoKeyMap();
18
+ }
19
+ setCss(e, t, s) {
20
+ this._css.set(e, t, s);
21
+ }
22
+ getCss(e, t) {
23
+ return this._css.get(e, t);
24
+ }
25
+ setColor(e, t, s) {
26
+ this._color.set(e, t, s);
27
+ }
28
+ getColor(e, t) {
29
+ return this._color.get(e, t);
30
+ }
31
+ clear() {
32
+ this._color.clear(), this._css.clear();
33
+ }
34
+ };
35
+ },
36
+ 997: function (e, t, s) {
37
+ var r = this && this.__decorate || function (e, t, s, r) {
38
+ var o,
39
+ i = arguments.length,
40
+ n = i < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, s) : r;
41
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, s, r);else for (var l = e.length - 1; l >= 0; l--) (o = e[l]) && (n = (i < 3 ? o(n) : i > 3 ? o(t, s, n) : o(t, s)) || n);
42
+ return i > 3 && n && Object.defineProperty(t, s, n), n;
43
+ },
44
+ o = this && this.__param || function (e, t) {
45
+ return function (s, r) {
46
+ t(s, r, e);
47
+ };
48
+ };
49
+ Object.defineProperty(t, "__esModule", {
50
+ value: !0
51
+ }), t.ThemeService = t.DEFAULT_ANSI_COLORS = void 0;
52
+ const i = s(930),
53
+ n = s(160),
54
+ l = s(345),
55
+ a = s(859),
56
+ c = s(97),
57
+ h = n.css.toColor("#ffffff"),
58
+ u = n.css.toColor("#000000"),
59
+ _ = n.css.toColor("#ffffff"),
60
+ d = n.css.toColor("#000000"),
61
+ C = {
62
+ css: "rgba(255, 255, 255, 0.3)",
63
+ rgba: 4294967117
64
+ };
65
+ t.DEFAULT_ANSI_COLORS = Object.freeze((() => {
66
+ const e = [n.css.toColor("#2e3436"), n.css.toColor("#cc0000"), n.css.toColor("#4e9a06"), n.css.toColor("#c4a000"), n.css.toColor("#3465a4"), n.css.toColor("#75507b"), n.css.toColor("#06989a"), n.css.toColor("#d3d7cf"), n.css.toColor("#555753"), n.css.toColor("#ef2929"), n.css.toColor("#8ae234"), n.css.toColor("#fce94f"), n.css.toColor("#729fcf"), n.css.toColor("#ad7fa8"), n.css.toColor("#34e2e2"), n.css.toColor("#eeeeec")],
67
+ t = [0, 95, 135, 175, 215, 255];
68
+ for (let s = 0; s < 216; s++) {
69
+ const r = t[s / 36 % 6 | 0],
70
+ o = t[s / 6 % 6 | 0],
71
+ i = t[s % 6];
72
+ e.push({
73
+ css: n.channels.toCss(r, o, i),
74
+ rgba: n.channels.toRgba(r, o, i)
75
+ });
76
+ }
77
+ for (let t = 0; t < 24; t++) {
78
+ const s = 8 + 10 * t;
79
+ e.push({
80
+ css: n.channels.toCss(s, s, s),
81
+ rgba: n.channels.toRgba(s, s, s)
82
+ });
83
+ }
84
+ return e;
85
+ })());
86
+ let f = t.ThemeService = class extends a.Disposable {
87
+ get colors() {
88
+ return this._colors;
89
+ }
90
+ constructor(e) {
91
+ super(), this._optionsService = e, this._contrastCache = new i.ColorContrastCache(), this._halfContrastCache = new i.ColorContrastCache(), this._onChangeColors = this.register(new l.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = {
92
+ foreground: h,
93
+ background: u,
94
+ cursor: _,
95
+ cursorAccent: d,
96
+ selectionForeground: void 0,
97
+ selectionBackgroundTransparent: C,
98
+ selectionBackgroundOpaque: n.color.blend(u, C),
99
+ selectionInactiveBackgroundTransparent: C,
100
+ selectionInactiveBackgroundOpaque: n.color.blend(u, C),
101
+ ansi: t.DEFAULT_ANSI_COLORS.slice(),
102
+ contrastCache: this._contrastCache,
103
+ halfContrastCache: this._halfContrastCache
104
+ }, this._updateRestoreColors(), this._setTheme(this._optionsService.rawOptions.theme), this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio", () => this._contrastCache.clear())), this.register(this._optionsService.onSpecificOptionChange("theme", () => this._setTheme(this._optionsService.rawOptions.theme)));
105
+ }
106
+ _setTheme(e = {}) {
107
+ const s = this._colors;
108
+ if (s.foreground = g(e.foreground, h), s.background = g(e.background, u), s.cursor = g(e.cursor, _), s.cursorAccent = g(e.cursorAccent, d), s.selectionBackgroundTransparent = g(e.selectionBackground, C), s.selectionBackgroundOpaque = n.color.blend(s.background, s.selectionBackgroundTransparent), s.selectionInactiveBackgroundTransparent = g(e.selectionInactiveBackground, s.selectionBackgroundTransparent), s.selectionInactiveBackgroundOpaque = n.color.blend(s.background, s.selectionInactiveBackgroundTransparent), s.selectionForeground = e.selectionForeground ? g(e.selectionForeground, n.NULL_COLOR) : void 0, s.selectionForeground === n.NULL_COLOR && (s.selectionForeground = void 0), n.color.isOpaque(s.selectionBackgroundTransparent)) {
109
+ const e = .3;
110
+ s.selectionBackgroundTransparent = n.color.opacity(s.selectionBackgroundTransparent, e);
111
+ }
112
+ if (n.color.isOpaque(s.selectionInactiveBackgroundTransparent)) {
113
+ const e = .3;
114
+ s.selectionInactiveBackgroundTransparent = n.color.opacity(s.selectionInactiveBackgroundTransparent, e);
115
+ }
116
+ if (s.ansi = t.DEFAULT_ANSI_COLORS.slice(), s.ansi[0] = g(e.black, t.DEFAULT_ANSI_COLORS[0]), s.ansi[1] = g(e.red, t.DEFAULT_ANSI_COLORS[1]), s.ansi[2] = g(e.green, t.DEFAULT_ANSI_COLORS[2]), s.ansi[3] = g(e.yellow, t.DEFAULT_ANSI_COLORS[3]), s.ansi[4] = g(e.blue, t.DEFAULT_ANSI_COLORS[4]), s.ansi[5] = g(e.magenta, t.DEFAULT_ANSI_COLORS[5]), s.ansi[6] = g(e.cyan, t.DEFAULT_ANSI_COLORS[6]), s.ansi[7] = g(e.white, t.DEFAULT_ANSI_COLORS[7]), s.ansi[8] = g(e.brightBlack, t.DEFAULT_ANSI_COLORS[8]), s.ansi[9] = g(e.brightRed, t.DEFAULT_ANSI_COLORS[9]), s.ansi[10] = g(e.brightGreen, t.DEFAULT_ANSI_COLORS[10]), s.ansi[11] = g(e.brightYellow, t.DEFAULT_ANSI_COLORS[11]), s.ansi[12] = g(e.brightBlue, t.DEFAULT_ANSI_COLORS[12]), s.ansi[13] = g(e.brightMagenta, t.DEFAULT_ANSI_COLORS[13]), s.ansi[14] = g(e.brightCyan, t.DEFAULT_ANSI_COLORS[14]), s.ansi[15] = g(e.brightWhite, t.DEFAULT_ANSI_COLORS[15]), e.extendedAnsi) {
117
+ const r = Math.min(s.ansi.length - 16, e.extendedAnsi.length);
118
+ for (let o = 0; o < r; o++) s.ansi[o + 16] = g(e.extendedAnsi[o], t.DEFAULT_ANSI_COLORS[o + 16]);
119
+ }
120
+ this._contrastCache.clear(), this._halfContrastCache.clear(), this._updateRestoreColors(), this._onChangeColors.fire(this.colors);
121
+ }
122
+ restoreColor(e) {
123
+ this._restoreColor(e), this._onChangeColors.fire(this.colors);
124
+ }
125
+ _restoreColor(e) {
126
+ if (void 0 !== e) switch (e) {
127
+ case 256:
128
+ this._colors.foreground = this._restoreColors.foreground;
129
+ break;
130
+ case 257:
131
+ this._colors.background = this._restoreColors.background;
132
+ break;
133
+ case 258:
134
+ this._colors.cursor = this._restoreColors.cursor;
135
+ break;
136
+ default:
137
+ this._colors.ansi[e] = this._restoreColors.ansi[e];
138
+ } else for (let e = 0; e < this._restoreColors.ansi.length; ++e) this._colors.ansi[e] = this._restoreColors.ansi[e];
139
+ }
140
+ modifyColors(e) {
141
+ e(this._colors), this._onChangeColors.fire(this.colors);
142
+ }
143
+ _updateRestoreColors() {
144
+ this._restoreColors = {
145
+ foreground: this._colors.foreground,
146
+ background: this._colors.background,
147
+ cursor: this._colors.cursor,
148
+ ansi: this._colors.ansi.slice()
149
+ };
150
+ }
151
+ };
152
+ function g(e, t) {
153
+ if (void 0 !== e) try {
154
+ return n.css.toColor(e);
155
+ } catch {}
156
+ return t;
157
+ }
158
+ t.ThemeService = f = r([o(0, c.IOptionsService)], f);
159
+ },
160
+ 160: (e, t) => {
161
+ Object.defineProperty(t, "__esModule", {
162
+ value: !0
163
+ }), t.contrastRatio = t.toPaddedHex = t.rgba = t.rgb = t.css = t.color = t.channels = t.NULL_COLOR = void 0;
164
+ let s = 0,
165
+ r = 0,
166
+ o = 0,
167
+ i = 0;
168
+ var n, l, a, c, h;
169
+ function u(e) {
170
+ const t = e.toString(16);
171
+ return t.length < 2 ? "0" + t : t;
172
+ }
173
+ function _(e, t) {
174
+ return e < t ? (t + .05) / (e + .05) : (e + .05) / (t + .05);
175
+ }
176
+ t.NULL_COLOR = {
177
+ css: "#00000000",
178
+ rgba: 0
179
+ }, function (e) {
180
+ e.toCss = function (e, t, s, r) {
181
+ return void 0 !== r ? `#${u(e)}${u(t)}${u(s)}${u(r)}` : `#${u(e)}${u(t)}${u(s)}`;
182
+ }, e.toRgba = function (e, t, s, r = 255) {
183
+ return (e << 24 | t << 16 | s << 8 | r) >>> 0;
184
+ }, e.toColor = function (t, s, r, o) {
185
+ return {
186
+ css: e.toCss(t, s, r, o),
187
+ rgba: e.toRgba(t, s, r, o)
188
+ };
189
+ };
190
+ }(n || (t.channels = n = {})), function (e) {
191
+ function t(e, t) {
192
+ return i = Math.round(255 * t), [s, r, o] = h.toChannels(e.rgba), {
193
+ css: n.toCss(s, r, o, i),
194
+ rgba: n.toRgba(s, r, o, i)
195
+ };
196
+ }
197
+ e.blend = function (e, t) {
198
+ if (i = (255 & t.rgba) / 255, 1 === i) return {
199
+ css: t.css,
200
+ rgba: t.rgba
201
+ };
202
+ const l = t.rgba >> 24 & 255,
203
+ a = t.rgba >> 16 & 255,
204
+ c = t.rgba >> 8 & 255,
205
+ h = e.rgba >> 24 & 255,
206
+ u = e.rgba >> 16 & 255,
207
+ _ = e.rgba >> 8 & 255;
208
+ return s = h + Math.round((l - h) * i), r = u + Math.round((a - u) * i), o = _ + Math.round((c - _) * i), {
209
+ css: n.toCss(s, r, o),
210
+ rgba: n.toRgba(s, r, o)
211
+ };
212
+ }, e.isOpaque = function (e) {
213
+ return 255 == (255 & e.rgba);
214
+ }, e.ensureContrastRatio = function (e, t, s) {
215
+ const r = h.ensureContrastRatio(e.rgba, t.rgba, s);
216
+ if (r) return n.toColor(r >> 24 & 255, r >> 16 & 255, r >> 8 & 255);
217
+ }, e.opaque = function (e) {
218
+ const t = (255 | e.rgba) >>> 0;
219
+ return [s, r, o] = h.toChannels(t), {
220
+ css: n.toCss(s, r, o),
221
+ rgba: t
222
+ };
223
+ }, e.opacity = t, e.multiplyOpacity = function (e, s) {
224
+ return i = 255 & e.rgba, t(e, i * s / 255);
225
+ }, e.toColorRGB = function (e) {
226
+ return [e.rgba >> 24 & 255, e.rgba >> 16 & 255, e.rgba >> 8 & 255];
227
+ };
228
+ }(l || (t.color = l = {})), function (e) {
229
+ let t, l;
230
+ try {
231
+ const e = document.createElement("canvas");
232
+ e.width = 1, e.height = 1;
233
+ const s = e.getContext("2d", {
234
+ willReadFrequently: !0
235
+ });
236
+ s && (t = s, t.globalCompositeOperation = "copy", l = t.createLinearGradient(0, 0, 1, 1));
237
+ } catch {}
238
+ e.toColor = function (e) {
239
+ if (e.match(/#[\da-f]{3,8}/i)) switch (e.length) {
240
+ case 4:
241
+ return s = parseInt(e.slice(1, 2).repeat(2), 16), r = parseInt(e.slice(2, 3).repeat(2), 16), o = parseInt(e.slice(3, 4).repeat(2), 16), n.toColor(s, r, o);
242
+ case 5:
243
+ return s = parseInt(e.slice(1, 2).repeat(2), 16), r = parseInt(e.slice(2, 3).repeat(2), 16), o = parseInt(e.slice(3, 4).repeat(2), 16), i = parseInt(e.slice(4, 5).repeat(2), 16), n.toColor(s, r, o, i);
244
+ case 7:
245
+ return {
246
+ css: e,
247
+ rgba: (parseInt(e.slice(1), 16) << 8 | 255) >>> 0
248
+ };
249
+ case 9:
250
+ return {
251
+ css: e,
252
+ rgba: parseInt(e.slice(1), 16) >>> 0
253
+ };
254
+ }
255
+ const a = e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
256
+ if (a) return s = parseInt(a[1]), r = parseInt(a[2]), o = parseInt(a[3]), i = Math.round(255 * (void 0 === a[5] ? 1 : parseFloat(a[5]))), n.toColor(s, r, o, i);
257
+ if (!t || !l) throw new Error("css.toColor: Unsupported css format");
258
+ if (t.fillStyle = l, t.fillStyle = e, "string" != typeof t.fillStyle) throw new Error("css.toColor: Unsupported css format");
259
+ if (t.fillRect(0, 0, 1, 1), [s, r, o, i] = t.getImageData(0, 0, 1, 1).data, 255 !== i) throw new Error("css.toColor: Unsupported css format");
260
+ return {
261
+ rgba: n.toRgba(s, r, o, i),
262
+ css: e
263
+ };
264
+ };
265
+ }(a || (t.css = a = {})), function (e) {
266
+ function t(e, t, s) {
267
+ const r = e / 255,
268
+ o = t / 255,
269
+ i = s / 255;
270
+ return .2126 * (r <= .03928 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4)) + .7152 * (o <= .03928 ? o / 12.92 : Math.pow((o + .055) / 1.055, 2.4)) + .0722 * (i <= .03928 ? i / 12.92 : Math.pow((i + .055) / 1.055, 2.4));
271
+ }
272
+ e.relativeLuminance = function (e) {
273
+ return t(e >> 16 & 255, e >> 8 & 255, 255 & e);
274
+ }, e.relativeLuminance2 = t;
275
+ }(c || (t.rgb = c = {})), function (e) {
276
+ function t(e, t, s) {
277
+ const r = e >> 24 & 255,
278
+ o = e >> 16 & 255,
279
+ i = e >> 8 & 255;
280
+ let n = t >> 24 & 255,
281
+ l = t >> 16 & 255,
282
+ a = t >> 8 & 255,
283
+ h = _(c.relativeLuminance2(n, l, a), c.relativeLuminance2(r, o, i));
284
+ for (; h < s && (n > 0 || l > 0 || a > 0);) n -= Math.max(0, Math.ceil(.1 * n)), l -= Math.max(0, Math.ceil(.1 * l)), a -= Math.max(0, Math.ceil(.1 * a)), h = _(c.relativeLuminance2(n, l, a), c.relativeLuminance2(r, o, i));
285
+ return (n << 24 | l << 16 | a << 8 | 255) >>> 0;
286
+ }
287
+ function l(e, t, s) {
288
+ const r = e >> 24 & 255,
289
+ o = e >> 16 & 255,
290
+ i = e >> 8 & 255;
291
+ let n = t >> 24 & 255,
292
+ l = t >> 16 & 255,
293
+ a = t >> 8 & 255,
294
+ h = _(c.relativeLuminance2(n, l, a), c.relativeLuminance2(r, o, i));
295
+ for (; h < s && (n < 255 || l < 255 || a < 255);) n = Math.min(255, n + Math.ceil(.1 * (255 - n))), l = Math.min(255, l + Math.ceil(.1 * (255 - l))), a = Math.min(255, a + Math.ceil(.1 * (255 - a))), h = _(c.relativeLuminance2(n, l, a), c.relativeLuminance2(r, o, i));
296
+ return (n << 24 | l << 16 | a << 8 | 255) >>> 0;
297
+ }
298
+ e.blend = function (e, t) {
299
+ if (i = (255 & t) / 255, 1 === i) return t;
300
+ const l = t >> 24 & 255,
301
+ a = t >> 16 & 255,
302
+ c = t >> 8 & 255,
303
+ h = e >> 24 & 255,
304
+ u = e >> 16 & 255,
305
+ _ = e >> 8 & 255;
306
+ return s = h + Math.round((l - h) * i), r = u + Math.round((a - u) * i), o = _ + Math.round((c - _) * i), n.toRgba(s, r, o);
307
+ }, e.ensureContrastRatio = function (e, s, r) {
308
+ const o = c.relativeLuminance(e >> 8),
309
+ i = c.relativeLuminance(s >> 8);
310
+ if (_(o, i) < r) {
311
+ if (i < o) {
312
+ const i = t(e, s, r),
313
+ n = _(o, c.relativeLuminance(i >> 8));
314
+ if (n < r) {
315
+ const t = l(e, s, r);
316
+ return n > _(o, c.relativeLuminance(t >> 8)) ? i : t;
317
+ }
318
+ return i;
319
+ }
320
+ const n = l(e, s, r),
321
+ a = _(o, c.relativeLuminance(n >> 8));
322
+ if (a < r) {
323
+ const i = t(e, s, r);
324
+ return a > _(o, c.relativeLuminance(i >> 8)) ? n : i;
325
+ }
326
+ return n;
327
+ }
328
+ }, e.reduceLuminance = t, e.increaseLuminance = l, e.toChannels = function (e) {
329
+ return [e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e];
330
+ };
331
+ }(h || (t.rgba = h = {})), t.toPaddedHex = u, t.contrastRatio = _;
332
+ },
333
+ 345: (e, t) => {
334
+ Object.defineProperty(t, "__esModule", {
335
+ value: !0
336
+ }), t.runAndSubscribe = t.forwardEvent = t.EventEmitter = void 0, t.EventEmitter = class {
337
+ constructor() {
338
+ this._listeners = [], this._disposed = !1;
339
+ }
340
+ get event() {
341
+ return this._event || (this._event = e => (this._listeners.push(e), {
342
+ dispose: () => {
343
+ if (!this._disposed) for (let t = 0; t < this._listeners.length; t++) if (this._listeners[t] === e) return void this._listeners.splice(t, 1);
344
+ }
345
+ })), this._event;
346
+ }
347
+ fire(e, t) {
348
+ const s = [];
349
+ for (let e = 0; e < this._listeners.length; e++) s.push(this._listeners[e]);
350
+ for (let r = 0; r < s.length; r++) s[r].call(void 0, e, t);
351
+ }
352
+ dispose() {
353
+ this.clearListeners(), this._disposed = !0;
354
+ }
355
+ clearListeners() {
356
+ this._listeners && (this._listeners.length = 0);
357
+ }
358
+ }, t.forwardEvent = function (e, t) {
359
+ return e(e => t.fire(e));
360
+ }, t.runAndSubscribe = function (e, t) {
361
+ return t(void 0), e(e => t(e));
362
+ };
363
+ },
364
+ 859: (e, t) => {
365
+ function s(e) {
366
+ for (const t of e) t.dispose();
367
+ e.length = 0;
368
+ }
369
+ Object.defineProperty(t, "__esModule", {
370
+ value: !0
371
+ }), t.getDisposeArrayDisposable = t.disposeArray = t.toDisposable = t.MutableDisposable = t.Disposable = void 0, t.Disposable = class {
372
+ constructor() {
373
+ this._disposables = [], this._isDisposed = !1;
374
+ }
375
+ dispose() {
376
+ this._isDisposed = !0;
377
+ for (const e of this._disposables) e.dispose();
378
+ this._disposables.length = 0;
379
+ }
380
+ register(e) {
381
+ return this._disposables.push(e), e;
382
+ }
383
+ unregister(e) {
384
+ const t = this._disposables.indexOf(e);
385
+ -1 !== t && this._disposables.splice(t, 1);
386
+ }
387
+ }, t.MutableDisposable = class {
388
+ constructor() {
389
+ this._isDisposed = !1;
390
+ }
391
+ get value() {
392
+ return this._isDisposed ? void 0 : this._value;
393
+ }
394
+ set value(e) {
395
+ this._isDisposed || e === this._value || (this._value?.dispose(), this._value = e);
396
+ }
397
+ clear() {
398
+ this.value = void 0;
399
+ }
400
+ dispose() {
401
+ this._isDisposed = !0, this._value?.dispose(), this._value = void 0;
402
+ }
403
+ }, t.toDisposable = function (e) {
404
+ return {
405
+ dispose: e
406
+ };
407
+ }, t.disposeArray = s, t.getDisposeArrayDisposable = function (e) {
408
+ return {
409
+ dispose: () => s(e)
410
+ };
411
+ };
412
+ },
413
+ 485: (e, t) => {
414
+ Object.defineProperty(t, "__esModule", {
415
+ value: !0
416
+ }), t.FourKeyMap = t.TwoKeyMap = void 0;
417
+ class s {
418
+ constructor() {
419
+ this._data = {};
420
+ }
421
+ set(e, t, s) {
422
+ this._data[e] || (this._data[e] = {}), this._data[e][t] = s;
423
+ }
424
+ get(e, t) {
425
+ return this._data[e] ? this._data[e][t] : void 0;
426
+ }
427
+ clear() {
428
+ this._data = {};
429
+ }
430
+ }
431
+ t.TwoKeyMap = s, t.FourKeyMap = class {
432
+ constructor() {
433
+ this._data = new s();
434
+ }
435
+ set(e, t, r, o, i) {
436
+ this._data.get(e, t) || this._data.set(e, t, new s()), this._data.get(e, t).set(r, o, i);
437
+ }
438
+ get(e, t, s, r) {
439
+ return this._data.get(e, t)?.get(s, r);
440
+ }
441
+ clear() {
442
+ this._data.clear();
443
+ }
444
+ };
445
+ },
446
+ 726: (e, t) => {
447
+ Object.defineProperty(t, "__esModule", {
448
+ value: !0
449
+ }), t.createDecorator = t.getServiceDependencies = t.serviceRegistry = void 0;
450
+ const s = "di$target",
451
+ r = "di$dependencies";
452
+ t.serviceRegistry = new Map(), t.getServiceDependencies = function (e) {
453
+ return e[r] || [];
454
+ }, t.createDecorator = function (e) {
455
+ if (t.serviceRegistry.has(e)) return t.serviceRegistry.get(e);
456
+ const o = function (e, t, i) {
457
+ if (3 !== arguments.length) throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
458
+ !function (e, t, o) {
459
+ t[s] === t ? t[r].push({
460
+ id: e,
461
+ index: o
462
+ }) : (t[r] = [{
463
+ id: e,
464
+ index: o
465
+ }], t[s] = t);
466
+ }(o, e, i);
467
+ };
468
+ return o.toString = () => e, t.serviceRegistry.set(e, o), o;
469
+ };
470
+ },
471
+ 97: (e, t, s) => {
472
+ Object.defineProperty(t, "__esModule", {
473
+ value: !0
474
+ }), t.IDecorationService = t.IUnicodeService = t.IOscLinkService = t.IOptionsService = t.ILogService = t.LogLevelEnum = t.IInstantiationService = t.ICharsetService = t.ICoreService = t.ICoreMouseService = t.IBufferService = void 0;
475
+ const r = s(726);
476
+ var o;
477
+ t.IBufferService = (0, r.createDecorator)("BufferService"), t.ICoreMouseService = (0, r.createDecorator)("CoreMouseService"), t.ICoreService = (0, r.createDecorator)("CoreService"), t.ICharsetService = (0, r.createDecorator)("CharsetService"), t.IInstantiationService = (0, r.createDecorator)("InstantiationService"), function (e) {
478
+ e[e.TRACE = 0] = "TRACE", e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.OFF = 5] = "OFF";
479
+ }(o || (t.LogLevelEnum = o = {})), t.ILogService = (0, r.createDecorator)("LogService"), t.IOptionsService = (0, r.createDecorator)("OptionsService"), t.IOscLinkService = (0, r.createDecorator)("OscLinkService"), t.IUnicodeService = (0, r.createDecorator)("UnicodeService"), t.IDecorationService = (0, r.createDecorator)("DecorationService");
480
+ }
481
+ },
482
+ t = {};
483
+ function s(r) {
484
+ var o = t[r];
485
+ if (void 0 !== o) return o.exports;
486
+ var i = t[r] = {
487
+ exports: {}
488
+ };
489
+ return e[r].call(i.exports, i, i.exports, s), i.exports;
490
+ }
491
+ var r = {};
492
+ return (() => {
493
+ var e = r;
494
+ Object.defineProperty(e, "__esModule", {
495
+ value: !0
496
+ }), e.HTMLSerializeHandler = e.SerializeAddon = void 0;
497
+ const t = s(997);
498
+ function o(e, t, s) {
499
+ return Math.max(t, Math.min(e, s));
500
+ }
501
+ class i {
502
+ constructor(e) {
503
+ this._buffer = e;
504
+ }
505
+ serialize(e, t) {
506
+ const s = this._buffer.getNullCell(),
507
+ r = this._buffer.getNullCell();
508
+ let o = s;
509
+ const i = e.start.y,
510
+ n = e.end.y,
511
+ l = e.start.x,
512
+ a = e.end.x;
513
+ this._beforeSerialize(n - i, i, n);
514
+ for (let t = i; t <= n; t++) {
515
+ const i = this._buffer.getLine(t);
516
+ if (i) {
517
+ const n = t === e.start.y ? l : 0,
518
+ c = t === e.end.y ? a : i.length;
519
+ for (let e = n; e < c; e++) {
520
+ const n = i.getCell(e, o === s ? r : s);
521
+ n ? (this._nextCell(n, o, t, e), o = n) : console.warn(`Can't get cell at row=${t}, col=${e}`);
522
+ }
523
+ }
524
+ this._rowEnd(t, t === n);
525
+ }
526
+ return this._afterSerialize(), this._serializeString(t);
527
+ }
528
+ _nextCell(e, t, s, r) {}
529
+ _rowEnd(e, t) {}
530
+ _beforeSerialize(e, t, s) {}
531
+ _afterSerialize() {}
532
+ _serializeString(e) {
533
+ return "";
534
+ }
535
+ }
536
+ function n(e, t) {
537
+ return e.getFgColorMode() === t.getFgColorMode() && e.getFgColor() === t.getFgColor();
538
+ }
539
+ function l(e, t) {
540
+ return e.getBgColorMode() === t.getBgColorMode() && e.getBgColor() === t.getBgColor();
541
+ }
542
+ function a(e, t) {
543
+ return e.isInverse() === t.isInverse() && e.isBold() === t.isBold() && e.isUnderline() === t.isUnderline() && e.isOverline() === t.isOverline() && e.isBlink() === t.isBlink() && e.isInvisible() === t.isInvisible() && e.isItalic() === t.isItalic() && e.isDim() === t.isDim() && e.isStrikethrough() === t.isStrikethrough();
544
+ }
545
+ class c extends i {
546
+ constructor(e, t) {
547
+ super(e), this._terminal = t, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell();
548
+ }
549
+ _beforeSerialize(e, t, s) {
550
+ this._allRows = new Array(e), this._lastContentCursorRow = t, this._lastCursorRow = t, this._firstRow = t;
551
+ }
552
+ _rowEnd(e, t) {
553
+ this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `[${this._nullCellCount}X`);
554
+ let s = "";
555
+ if (!t) {
556
+ e - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
557
+ const t = this._buffer.getLine(e),
558
+ r = this._buffer.getLine(e + 1);
559
+ if (r.isWrapped) {
560
+ s = "";
561
+ const o = t.getCell(t.length - 1, this._thisRowLastChar),
562
+ i = t.getCell(t.length - 2, this._thisRowLastSecondChar),
563
+ n = r.getCell(0, this._nextRowFirstChar),
564
+ a = n.getWidth() > 1;
565
+ let c = !1;
566
+ (n.getChars() && a ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((o.getChars() || 0 === o.getWidth()) && l(o, n) && (c = !0), a && (i.getChars() || 0 === i.getWidth()) && l(o, n) && l(i, n) && (c = !0)), c || (s = "-".repeat(this._nullCellCount + 1), s += "", this._nullCellCount > 0 && (s += "", s += `[${t.length - this._nullCellCount}C`, s += `[${this._nullCellCount}X`, s += `[${t.length - this._nullCellCount}D`, s += ""), this._lastContentCursorRow = e + 1, this._lastContentCursorCol = 0, this._lastCursorRow = e + 1, this._lastCursorCol = 0);
567
+ } else s = "\r\n", this._lastCursorRow = e + 1, this._lastCursorCol = 0;
568
+ }
569
+ this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = s, this._currentRow = "", this._nullCellCount = 0;
570
+ }
571
+ _diffStyle(e, t) {
572
+ const s = [],
573
+ r = !n(e, t),
574
+ o = !l(e, t),
575
+ i = !a(e, t);
576
+ if (r || o || i) if (e.isAttributeDefault()) t.isAttributeDefault() || s.push(0);else {
577
+ if (r) {
578
+ const t = e.getFgColor();
579
+ e.isFgRGB() ? s.push(38, 2, t >>> 16 & 255, t >>> 8 & 255, 255 & t) : e.isFgPalette() ? t >= 16 ? s.push(38, 5, t) : s.push(8 & t ? 90 + (7 & t) : 30 + (7 & t)) : s.push(39);
580
+ }
581
+ if (o) {
582
+ const t = e.getBgColor();
583
+ e.isBgRGB() ? s.push(48, 2, t >>> 16 & 255, t >>> 8 & 255, 255 & t) : e.isBgPalette() ? t >= 16 ? s.push(48, 5, t) : s.push(8 & t ? 100 + (7 & t) : 40 + (7 & t)) : s.push(49);
584
+ }
585
+ i && (e.isInverse() !== t.isInverse() && s.push(e.isInverse() ? 7 : 27), e.isBold() !== t.isBold() && s.push(e.isBold() ? 1 : 22), e.isUnderline() !== t.isUnderline() && s.push(e.isUnderline() ? 4 : 24), e.isOverline() !== t.isOverline() && s.push(e.isOverline() ? 53 : 55), e.isBlink() !== t.isBlink() && s.push(e.isBlink() ? 5 : 25), e.isInvisible() !== t.isInvisible() && s.push(e.isInvisible() ? 8 : 28), e.isItalic() !== t.isItalic() && s.push(e.isItalic() ? 3 : 23), e.isDim() !== t.isDim() && s.push(e.isDim() ? 2 : 22), e.isStrikethrough() !== t.isStrikethrough() && s.push(e.isStrikethrough() ? 9 : 29));
586
+ }
587
+ return s;
588
+ }
589
+ _nextCell(e, t, s, r) {
590
+ if (0 === e.getWidth()) return;
591
+ const o = "" === e.getChars(),
592
+ i = this._diffStyle(e, this._cursorStyle);
593
+ if (o ? !l(this._cursorStyle, e) : i.length > 0) {
594
+ this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `[${this._nullCellCount}X`), this._currentRow += `[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = s, this._lastContentCursorCol = this._lastCursorCol = r, this._currentRow += `[${i.join(";")}m`;
595
+ const e = this._buffer.getLine(s);
596
+ void 0 !== e && (e.getCell(r, this._cursorStyle), this._cursorStyleRow = s, this._cursorStyleCol = r);
597
+ }
598
+ o ? this._nullCellCount += e.getWidth() : (this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `[${this._nullCellCount}X`), this._currentRow += `[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += e.getChars(), this._lastContentCursorRow = this._lastCursorRow = s, this._lastContentCursorCol = this._lastCursorCol = r + e.getWidth());
599
+ }
600
+ _serializeString(e) {
601
+ let t = this._allRows.length;
602
+ this._buffer.length - this._firstRow <= this._terminal.rows && (t = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
603
+ let s = "";
604
+ for (let e = 0; e < t; e++) s += this._allRows[e], e + 1 < t && (s += this._allRowSeparators[e]);
605
+ if (!e) {
606
+ const e = this._buffer.baseY + this._buffer.cursorY,
607
+ t = this._buffer.cursorX,
608
+ o = e => {
609
+ e > 0 ? s += `[${e}C` : e < 0 && (s += `[${-e}D`);
610
+ };
611
+ (e !== this._lastCursorRow || t !== this._lastCursorCol) && ((r = e - this._lastCursorRow) > 0 ? s += `[${r}B` : r < 0 && (s += `[${-r}A`), o(t - this._lastCursorCol));
612
+ }
613
+ var r;
614
+ const o = this._terminal._core._inputHandler._curAttrData,
615
+ i = this._diffStyle(o, this._cursorStyle);
616
+ return i.length > 0 && (s += `[${i.join(";")}m`), s;
617
+ }
618
+ }
619
+ e.SerializeAddon = class {
620
+ activate(e) {
621
+ this._terminal = e;
622
+ }
623
+ _serializeBufferByScrollback(e, t, s) {
624
+ const r = t.length,
625
+ i = void 0 === s ? r : o(s + e.rows, 0, r);
626
+ return this._serializeBufferByRange(e, t, {
627
+ start: r - i,
628
+ end: r - 1
629
+ }, !1);
630
+ }
631
+ _serializeBufferByRange(e, t, s, r) {
632
+ return new c(t, e).serialize({
633
+ start: {
634
+ x: 0,
635
+ y: "number" == typeof s.start ? s.start : s.start.line
636
+ },
637
+ end: {
638
+ x: e.cols,
639
+ y: "number" == typeof s.end ? s.end : s.end.line
640
+ }
641
+ }, r);
642
+ }
643
+ _serializeBufferAsHTML(e, t) {
644
+ const s = e.buffer.active,
645
+ r = new h(s, e, t);
646
+ if (!t.onlySelection) {
647
+ const i = s.length,
648
+ n = t.scrollback,
649
+ l = void 0 === n ? i : o(n + e.rows, 0, i);
650
+ return r.serialize({
651
+ start: {
652
+ x: 0,
653
+ y: i - l
654
+ },
655
+ end: {
656
+ x: e.cols,
657
+ y: i - 1
658
+ }
659
+ });
660
+ }
661
+ const i = this._terminal?.getSelectionPosition();
662
+ return void 0 !== i ? r.serialize({
663
+ start: {
664
+ x: i.start.x,
665
+ y: i.start.y
666
+ },
667
+ end: {
668
+ x: i.end.x,
669
+ y: i.end.y
670
+ }
671
+ }) : "";
672
+ }
673
+ _serializeModes(e) {
674
+ let t = "";
675
+ const s = e.modes;
676
+ if (s.applicationCursorKeysMode && (t += "[?1h"), s.applicationKeypadMode && (t += "[?66h"), s.bracketedPasteMode && (t += "[?2004h"), s.insertMode && (t += ""), s.originMode && (t += "[?6h"), s.reverseWraparoundMode && (t += "[?45h"), s.sendFocusMode && (t += "[?1004h"), !1 === s.wraparoundMode && (t += "[?7l"), "none" !== s.mouseTrackingMode) switch (s.mouseTrackingMode) {
677
+ case "x10":
678
+ t += "[?9h";
679
+ break;
680
+ case "vt200":
681
+ t += "[?1000h";
682
+ break;
683
+ case "drag":
684
+ t += "[?1002h";
685
+ break;
686
+ case "any":
687
+ t += "[?1003h";
688
+ }
689
+ return t;
690
+ }
691
+ serialize(e) {
692
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
693
+ let t = e?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, e.range, !0) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, e?.scrollback);
694
+ return e?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (t += `[?1049h${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), e?.excludeModes || (t += this._serializeModes(this._terminal)), t;
695
+ }
696
+ serializeAsHTML(e) {
697
+ if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
698
+ return this._serializeBufferAsHTML(this._terminal, e || {});
699
+ }
700
+ dispose() {}
701
+ };
702
+ class h extends i {
703
+ constructor(e, s, r) {
704
+ super(e), this._terminal = s, this._options = r, this._currentRow = "", this._htmlContent = "", s._core._themeService ? this._ansiColors = s._core._themeService.colors.ansi : this._ansiColors = t.DEFAULT_ANSI_COLORS;
705
+ }
706
+ _padStart(e, t, s) {
707
+ return t >>= 0, s = s ?? " ", e.length > t ? e : ((t -= e.length) > s.length && (s += s.repeat(t / s.length)), s.slice(0, t) + e);
708
+ }
709
+ _beforeSerialize(e, t, s) {
710
+ this._htmlContent += "<html><body>\x3c!--StartFragment--\x3e<pre>";
711
+ let r = "#000000",
712
+ o = "#ffffff";
713
+ this._options.includeGlobalBackground && (r = this._terminal.options.theme?.foreground ?? "#ffffff", o = this._terminal.options.theme?.background ?? "#000000");
714
+ const i = [];
715
+ i.push("color: " + r + ";"), i.push("background-color: " + o + ";"), i.push("font-family: " + this._terminal.options.fontFamily + ";"), i.push("font-size: " + this._terminal.options.fontSize + "px;"), this._htmlContent += "<div style='" + i.join(" ") + "'>";
716
+ }
717
+ _afterSerialize() {
718
+ this._htmlContent += "</div>", this._htmlContent += "</pre>\x3c!--EndFragment--\x3e</body></html>";
719
+ }
720
+ _rowEnd(e, t) {
721
+ this._htmlContent += "<div><span>" + this._currentRow + "</span></div>", this._currentRow = "";
722
+ }
723
+ _getHexColor(e, t) {
724
+ const s = t ? e.getFgColor() : e.getBgColor();
725
+ return (t ? e.isFgRGB() : e.isBgRGB()) ? "#" + [s >> 16 & 255, s >> 8 & 255, 255 & s].map(e => this._padStart(e.toString(16), 2, "0")).join("") : (t ? e.isFgPalette() : e.isBgPalette()) ? this._ansiColors[s].css : void 0;
726
+ }
727
+ _diffStyle(e, t) {
728
+ const s = [],
729
+ r = !n(e, t),
730
+ o = !l(e, t),
731
+ i = !a(e, t);
732
+ if (r || o || i) {
733
+ const t = this._getHexColor(e, !0);
734
+ t && s.push("color: " + t + ";");
735
+ const r = this._getHexColor(e, !1);
736
+ return r && s.push("background-color: " + r + ";"), e.isInverse() && s.push("color: #000000; background-color: #BFBFBF;"), e.isBold() && s.push("font-weight: bold;"), e.isUnderline() && e.isOverline() ? s.push("text-decoration: overline underline;") : e.isUnderline() ? s.push("text-decoration: underline;") : e.isOverline() && s.push("text-decoration: overline;"), e.isBlink() && s.push("text-decoration: blink;"), e.isInvisible() && s.push("visibility: hidden;"), e.isItalic() && s.push("font-style: italic;"), e.isDim() && s.push("opacity: 0.5;"), e.isStrikethrough() && s.push("text-decoration: line-through;"), s;
737
+ }
738
+ }
739
+ _nextCell(e, t, s, r) {
740
+ if (0 === e.getWidth()) return;
741
+ const o = "" === e.getChars(),
742
+ i = this._diffStyle(e, t);
743
+ i && (this._currentRow += 0 === i.length ? "</span><span>" : "</span><span style='" + i.join(" ") + "'>"), this._currentRow += o ? " " : e.getChars();
744
+ }
745
+ _serializeString() {
746
+ return this._htmlContent;
747
+ }
748
+ }
749
+ e.HTMLSerializeHandler = h;
750
+ })(), r;
751
+ })());
752
+
5
753
  /*
6
754
  * NeuQuant Neural-Net Quantization Algorithm
7
755
  * ------------------------------------------
@@ -1169,6 +1917,7 @@ https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts
1169
1917
 
1170
1918
  const { Terminal } = window;
1171
1919
  const { WebglAddon } = window.WebglAddon;
1920
+ const { SerializeAddon } = window.SerializeAddon;
1172
1921
 
1173
1922
  const initTerminal = ({
1174
1923
  cols = 80,
@@ -1178,14 +1927,16 @@ const initTerminal = ({
1178
1927
  fontFamily = "SauceCodePro Nerd Font, Source Code Pro, Courier",
1179
1928
  fontSize = 12,
1180
1929
  convertEol = true,
1930
+ textInViewport,
1181
1931
  gif,
1182
1932
  video,
1183
1933
  logs,
1184
1934
  }) => {
1185
- if (video === true) video = {};
1935
+ if (textInViewport === true) textInViewport = {};
1186
1936
  if (gif === true) gif = {};
1187
- if (!video && !gif) {
1188
- throw new Error("video or gif must be enabled");
1937
+ if (video === true) video = {};
1938
+ if (!textInViewport && !video && !gif) {
1939
+ throw new Error("ansi, video or gif must be enabled");
1189
1940
  }
1190
1941
 
1191
1942
  const log = (...args) => {
@@ -1230,6 +1981,9 @@ const initTerminal = ({
1230
1981
  true,
1231
1982
  ),
1232
1983
  );
1984
+ const serializeAddon = new SerializeAddon();
1985
+ term.loadAddon(serializeAddon);
1986
+
1233
1987
  const terminalElement = document.getElementById("terminal");
1234
1988
  term.open(terminalElement);
1235
1989
 
@@ -1284,10 +2038,36 @@ const initTerminal = ({
1284
2038
  }
1285
2039
 
1286
2040
  return {
2041
+ term,
1287
2042
  startRecording: async () => {
1288
2043
  const records = {};
2044
+ let writePromise = Promise.resolve();
1289
2045
  const frameCallbackSet = new Set();
1290
2046
  const stopCallbackSet = new Set();
2047
+ if (textInViewport) {
2048
+ log("start recording text in viewport");
2049
+ // https://github.com/xtermjs/xterm.js/issues/3681
2050
+ // https://github.com/xtermjs/xterm.js/issues/3681
2051
+ // get the first line
2052
+ // term.buffer.active.getLine(term.buffer.active.viewportY).translateToString()
2053
+ // get the last line
2054
+ // term.buffer.active.getLine(term.buffer.active.length -1).translateToString()
2055
+ // https://github.com/xtermjs/xterm.js/blob/a7952ff36c60ee6dce9141744b1355a5d582ee39/addons/addon-serialize/src/SerializeAddon.ts
2056
+ stopCallbackSet.add(() => {
2057
+ const startY = term.buffer.active.viewportY;
2058
+ const endY = term.buffer.active.length - 1;
2059
+ const range = {
2060
+ start: startY,
2061
+ end: endY,
2062
+ };
2063
+ log(`lines in viewport: ${startY}:${endY}`);
2064
+ const output = serializeAddon.serialize({
2065
+ range,
2066
+ });
2067
+ log(`text in viewport: ${output}`);
2068
+ records.textInViewport = output;
2069
+ });
2070
+ }
1291
2071
  if (video) {
1292
2072
  log("start recording video");
1293
2073
  const { mimeType = "video/webm;codecs=h264", msAddedAtTheEnd } = video;
@@ -1428,8 +2208,8 @@ const initTerminal = ({
1428
2208
 
1429
2209
  return {
1430
2210
  writeIntoTerminal: async (data) => {
1431
- await new Promise((resolve) => {
1432
- log(`write data: "${data}"`);
2211
+ writePromise = new Promise((resolve) => {
2212
+ log(`write data:`, data);
1433
2213
  term.write(data, () => {
1434
2214
  term._core._renderService._renderDebouncer._innerRefresh();
1435
2215
  replicateXterm();
@@ -1437,8 +2217,10 @@ const initTerminal = ({
1437
2217
  resolve();
1438
2218
  });
1439
2219
  });
2220
+ await writePromise;
1440
2221
  },
1441
2222
  stopRecording: async () => {
2223
+ await writePromise;
1442
2224
  const promises = [];
1443
2225
  for (const stopCallback of stopCallbackSet) {
1444
2226
  promises.push(stopCallback());