@xterm/addon-webgl 0.19.0-beta.69 → 0.19.0-beta.70

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.
@@ -97,5 +97,5 @@ out vec4 outColor;
97
97
 
98
98
  void main() {
99
99
  outColor = v_color;
100
- }`,Ee=8,ki=Ee*Float32Array.BYTES_PER_ELEMENT,as=20*Ee,Ct=class{constructor(){this.attributes=new Float32Array(as),this.count=0}},xe=0,Hn=0,Wn=0,Gn=0,$n=0,Kn=0,Vn=0,zt=class extends N{constructor(t,n,s,o){super();this._terminal=t;this._gl=n;this._dimensions=s;this._themeService=o;this._vertices=new Ct;this._verticesCursor=new Ct;let r=this._gl;this._program=k(Gt(r,ss,os)),this._register(F(()=>r.deleteProgram(this._program))),this._projectionLocation=k(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),l=r.createBuffer();this._register(F(()=>r.deleteBuffer(l))),r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let u=new Uint8Array([0,1,2,3]),c=r.createBuffer();this._register(F(()=>r.deleteBuffer(c))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,c),r.bufferData(r.ELEMENT_ARRAY_BUFFER,u,r.STATIC_DRAW),this._attributesBuffer=k(r.createBuffer()),this._register(F(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,ki,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,ki,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,ki,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this._register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),n.uniformMatrix4fv(this._projectionLocation,!1,Wt),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,t.attributes,n.DYNAMIC_DRAW),n.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let n=this._terminal,s=this._vertices,o=1,r,a,l,u,c,d,h,b,E,I,A;for(r=0;r<n.rows;r++){for(l=-1,u=0,c=0,d=!1,a=0;a<n.cols;a++)h=(r*n.cols+a)*$e,b=t.cells[h+Ke],E=t.cells[h+Ve],I=!!(E&67108864),(b!==u||E!==c&&(d||I))&&((u!==0||d&&c!==0)&&(A=o++*Ee,this._updateRectangle(s,A,c,u,l,a,r)),l=a,u=b,c=E,d=I);(u!==0||d&&c!==0)&&(A=o++*Ee,this._updateRectangle(s,A,c,u,l,n.cols,r))}s.count=o}updateCursor(t){let n=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){n.count=0;return}let o,r=0;(s.style==="bar"||s.style==="outline")&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),o=r++*Ee,this._addRectangleFloat(n.attributes,o,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.count=r}_updateRectangle(t,n,s,o,r,a,l){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:xe=(s&16777215)<<8;break;case 0:default:xe=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:xe=(o&16777215)<<8;break;case 0:default:xe=this._themeService.colors.background.rgba}t.attributes.length<n+4&&(t.attributes=Bn(t.attributes,this._terminal.rows*this._terminal.cols*Ee)),Hn=r*this._dimensions.device.cell.width,Wn=l*this._dimensions.device.cell.height,Gn=(xe>>24&255)/255,$n=(xe>>16&255)/255,Kn=(xe>>8&255)/255,Vn=1,this._addRectangle(t.attributes,n,Hn,Wn,(a-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Gn,$n,Kn,Vn)}_addRectangle(t,n,s,o,r,a,l,u,c,d){t[n]=s/this._dimensions.device.canvas.width,t[n+1]=o/this._dimensions.device.canvas.height,t[n+2]=r/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=l,t[n+5]=u,t[n+6]=c,t[n+7]=d}_addRectangleFloat(t,n,s,o,r,a,l){t[n]=s/this._dimensions.device.canvas.width,t[n+1]=o/this._dimensions.device.canvas.height,t[n+2]=r/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=l[0],t[n+5]=l[1],t[n+6]=l[2],t[n+7]=l[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}};var qt=class extends N{constructor(t,n,s,o,r,a,l,u){super();this._container=n;this._alpha=r;this._coreBrowserService=a;this._optionsService=l;this._themeService=u;this._deviceCharWidth=0;this._deviceCharHeight=0;this._deviceCellWidth=0;this._deviceCellHeight=0;this._deviceCharLeft=0;this._deviceCharTop=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(c=>{this._refreshCharAtlas(t,c),this.reset(t)})),this._register(F(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=k(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,s){}handleSelectionChanged(t,n,s,o=!1){}_setTransparency(t,n){if(n===this._alpha)return;let s=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Bt(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,s,o){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(t,n,s,o){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=At,this._clipCell(s,o,n.getWidth()),this._ctx.fillText(n.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,s){let o=n?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${o} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}};var jt=class extends qt{constructor(e,t,n,s,o,r,a){super(n,e,"link",t,!0,o,r,a),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===vn?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Fn(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}};var ie=typeof window=="object"?window:globalThis;var Qt=class Qt{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new R;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new R;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Qt.INSTANCE=new Qt;var Yt=Qt;function ls(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}var Ua=Yt.INSTANCE.onDidChangeZoomLevel;var Ha=Yt.INSTANCE.onDidChangeFullscreen,Ce=typeof navigator=="object"?navigator.userAgent:"",Cn=Ce.indexOf("Firefox")>=0,at=Ce.indexOf("AppleWebKit")>=0,zn=Ce.indexOf("Chrome")>=0,Pi=!zn&&Ce.indexOf("Safari")>=0;var Wa=Ce.indexOf("Electron/")>=0,Ga=Ce.indexOf("Android")>=0,Xt=!1;if(typeof ie.matchMedia=="function"){let i=ie.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ie.matchMedia("(display-mode: fullscreen)");Xt=i.matches,ls(ie,i,({matches:t})=>{Xt&&e.matches||(Xt=t)})}function qn(){return Xt}var ze="en",Ni=!1,ii=!1,ei=!1,us=!1,Xn=!1,Yn=!1,cs=!1,ds=!1,hs=!1,ps=!1,Jt,ti=ze,jn=ze,fs,ye,Ie=globalThis,ne;typeof Ie.vscode<"u"&&typeof Ie.vscode.process<"u"?ne=Ie.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ne=process);var Qn=typeof ne?.versions?.electron=="string",ms=Qn&&ne?.type==="renderer";if(typeof ne=="object"){Ni=ne.platform==="win32",ii=ne.platform==="darwin",ei=ne.platform==="linux",us=ei&&!!ne.env.SNAP&&!!ne.env.SNAP_REVISION,cs=Qn,hs=!!ne.env.CI||!!ne.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jt=ze,ti=ze;let i=ne.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);Jt=e.userLocale,jn=e.osLocale,ti=e.resolvedLanguage||ze,fs=e.languagePack?.translationsConfigFile}catch{}Xn=!0}else typeof navigator=="object"&&!ms?(ye=navigator.userAgent,Ni=ye.indexOf("Windows")>=0,ii=ye.indexOf("Macintosh")>=0,ds=(ye.indexOf("Macintosh")>=0||ye.indexOf("iPad")>=0||ye.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ei=ye.indexOf("Linux")>=0,ps=ye?.indexOf("Mobi")>=0,Yn=!0,ti=globalThis._VSCODE_NLS_LANGUAGE||ze,Jt=navigator.language.toLowerCase(),jn=Jt):console.error("Unable to resolve platform.");var Bi=0;ii?Bi=1:Ni?Bi=3:ei&&(Bi=2);var lt=ii;var ni=Xn;var _s=Yn&&typeof Ie.importScripts=="function",$a=_s?Ie.origin:void 0;var fe=ye,Re=ti,bs;(n=>{function i(){return Re}n.value=i;function e(){return Re.length===2?Re==="en":Re.length>=3?Re[0]==="e"&&Re[1]==="n"&&Re[2]==="-":!1}n.isDefaultVariant=e;function t(){return Re==="en"}n.isDefault=t})(bs||={});var Ts=typeof Ie.postMessage=="function"&&!Ie.importScripts,Zn=(()=>{if(Ts){let i=[];Ie.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,s=i.length;n<s;n++){let o=i[n];if(o.id===t.data.vscodeScheduleAsyncWork){i.splice(n,1),o.callback();return}}});let e=0;return t=>{let n=++e;i.push({id:n,callback:t}),Ie.postMessage({vscodeScheduleAsyncWork:n},"*")}}return i=>setTimeout(i)})();var vs=!!(fe&&fe.indexOf("Chrome")>=0),Ka=!!(fe&&fe.indexOf("Firefox")>=0),Va=!!(!vs&&fe&&fe.indexOf("Safari")>=0),Ca=!!(fe&&fe.indexOf("Edg/")>=0),za=!!(fe&&fe.indexOf("Android")>=0);var De=typeof navigator=="object"?navigator:{},gs={clipboard:{writeText:ni||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(De&&De.clipboard&&De.clipboard.writeText),readText:ni||!!(De&&De.clipboard&&De.clipboard.readText)},keyboard:ni||qn()?0:De.keyboard||Pi?1:2,touch:"ontouchstart"in ie||De.maxTouchPoints>0,pointerEvents:ie.PointerEvent&&("ontouchstart"in ie||navigator.maxTouchPoints>0)};var ut=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ui=new ut,Jn=new ut,er=new ut,xs=new Array(230);var tr;(r=>{function i(a){return Ui.keyCodeToStr(a)}r.toString=i;function e(a){return Ui.strToKeyCode(a)}r.fromString=e;function t(a){return Jn.keyCodeToStr(a)}r.toUserSettingsUS=t;function n(a){return er.keyCodeToStr(a)}r.toUserSettingsGeneral=n;function s(a){return Jn.strToKeyCode(a)||er.strToKeyCode(a)}r.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ui.keyCodeToStr(a)}r.toElectronAccelerator=o})(tr||={});var al=lt?256:2048,ll=512,ul=1024,cl=lt?2048:256;var nr=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),ys;(n=>{function i(s){return s===n.None||s===n.Cancelled||s instanceof Hi?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}n.isCancellationToken=i,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:te.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:nr})})(ys||={});var Hi=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?nr:(this._emitter||(this._emitter=new R),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Is=Symbol("MicrotaskDelay");var Ls,si;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?si=(i,e)=>{Zn(()=>{if(t)return;let n=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let t=!1;return{dispose(){t||(t=!0)}}}:si=(i,e,t)=>{let n=i.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),s=!1;return{dispose(){s||(s=!0,i.cancelIdleCallback(n))}}},Ls=i=>si(globalThis,i)})();var ws;(t=>{async function i(n){let s,o=await Promise.all(n.map(r=>r.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return o}t.settled=i;function e(n){return new Promise(async(s,o)=>{try{await n(s,o)}catch(r){o(r)}})}t.withAsyncBody=e})(ws||={});var Z=class Z{static fromArray(e){return new Z(t=>{t.emitMany(e)})}static fromPromise(e){return new Z(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Z(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new Z(async t=>{await Promise.all(e.map(async n=>{for await(let s of n)t.emitOne(s)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new R,queueMicrotask(async()=>{let n={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(n)),this.resolve()}catch(s){this.reject(s)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await te.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new Z(async n=>{for await(let s of e)n.emitOne(t(s))})}map(e){return Z.map(this,e)}static filter(e,t){return new Z(async n=>{for await(let s of e)t(s)&&n.emitOne(s)})}filter(e){return Z.filter(this,e)}static coalesce(e){return Z.filter(e,t=>!!t)}coalesce(){return Z.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return Z.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Z.EMPTY=Z.fromArray([]);var rr=Z;function sr(i){return 55296<=i&&i<=56319}function Wi(i){return 56320<=i&&i<=57343}function or(i,e){return(i-55296<<10)+(e-56320)+65536}function ur(i){return $i(i,0)}function $i(i,e){switch(typeof i){case"object":return i===null?Le(349,e):Array.isArray(i)?As(i,e):Ms(i,e);case"string":return cr(i,e);case"boolean":return Ds(i,e);case"number":return Le(i,e);case"undefined":return Le(937,e);default:return Le(617,e)}}function Le(i,e){return(e<<5)-e+i|0}function Ds(i,e){return Le(i?433:863,e)}function cr(i,e){e=Le(149417,e);for(let t=0,n=i.length;t<n;t++)e=Le(i.charCodeAt(t),e);return e}function As(i,e){return e=Le(104579,e),i.reduce((t,n)=>$i(n,t),e)}function Ms(i,e){return e=Le(181387,e),Object.keys(i).sort().reduce((t,n)=>(t=cr(n,t),$i(i[n],t)),e)}function Gi(i,e,t=32){let n=t-e,s=~((1<<n)-1);return(i<<e|(s&i)>>>n)>>>0}function ar(i,e=0,t=i.byteLength,n=0){for(let s=0;s<t;s++)i[e+s]=n}function Ss(i,e,t="0"){for(;i.length<e;)i=t+i;return i}function ct(i,e=32){return i instanceof ArrayBuffer?Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join(""):Ss((i>>>0).toString(16),e/4)}var oi=class oi{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,s=this._buffLen,o=this._leftoverHighSurrogate,r,a;for(o!==0?(r=o,a=-1,o=0):(r=e.charCodeAt(0),a=0);;){let l=r;if(sr(r))if(a+1<t){let u=e.charCodeAt(a+1);Wi(u)?(a++,l=or(r,u)):l=65533}else{o=r;break}else Wi(r)&&(l=65533);if(s=this._push(n,s,l),a++,a<t)r=e.charCodeAt(a);else break}this._buffLen=s,this._leftoverHighSurrogate=o}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ct(this._h0)+ct(this._h1)+ct(this._h2)+ct(this._h3)+ct(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,ar(this._buff,this._buffLen),this._buffLen>56&&(this._step(),ar(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=oi._bigBlock32,t=this._buffDV;for(let d=0;d<64;d+=4)e.setUint32(d,t.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)e.setUint32(d,Gi(e.getUint32(d-12,!1)^e.getUint32(d-32,!1)^e.getUint32(d-56,!1)^e.getUint32(d-64,!1),1),!1);let n=this._h0,s=this._h1,o=this._h2,r=this._h3,a=this._h4,l,u,c;for(let d=0;d<80;d++)d<20?(l=s&o|~s&r,u=1518500249):d<40?(l=s^o^r,u=1859775393):d<60?(l=s&o|s&r|o&r,u=2400959708):(l=s^o^r,u=3395469782),c=Gi(n,5)+l+a+u+e.getUint32(d*4,!1)&4294967295,a=r,r=o,o=Gi(s,30),s=n,n=c;this._h0=this._h0+n&4294967295,this._h1=this._h1+s&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};oi._bigBlock32=new DataView(new ArrayBuffer(320));var lr=oi;var{registerWindow:hu,getWindow:Os,getDocument:pu,getWindows:fu,getWindowsCount:mu,getWindowId:dr,getWindowById:_u,hasWindow:bu,onDidRegisterWindow:Tu,onWillUnregisterWindow:vu,onDidUnregisterWindow:gu}=function(){let i=new Map;ie;let e={window:ie,disposables:new he};i.set(ie.vscodeWindowId,e);let t=new R,n=new R,s=new R;function o(r,a){return(typeof r=="number"?i.get(r):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:n.event,registerWindow(r){if(i.has(r.vscodeWindowId))return N.None;let a=new he,l={window:r,disposables:a.add(new he)};return i.set(r.vscodeWindowId,l),a.add(F(()=>{i.delete(r.vscodeWindowId),n.fire(r)})),a.add(ai(r,ks.BEFORE_UNLOAD,()=>{s.fire(r)})),t.fire(l),a},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return i.has(r)},getWindowById:o,getWindow(r){let a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=r;return l?.view?l.view.window:ie},getDocument(r){return Os(r).document}}}();var Ki=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ai(i,e,t,n){return new Ki(i,e,t,n)}var Fs,hr;var dt=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Fe(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,n=new Map,s=o=>{t.set(o,!1);let r=i.get(o)??[];for(e.set(o,r),i.set(o,[]),n.set(o,!0);r.length>0;)r.sort(dt.sort),r.shift().execute();n.set(o,!1)};hr=(o,r,a=0)=>{let l=dr(o),u=new dt(r,a),c=i.get(l);return c||(c=[],i.set(l,c)),c.push(u),t.get(l)||(t.set(l,!0),o.requestAnimationFrame(()=>s(l))),u},Fs=(o,r,a)=>{let l=dr(o);if(n.get(l)){let u=new dt(r,a),c=e.get(l);return c||(c=[],e.set(l,c)),c.push(u),u}else return hr(o,r,a)}})();var Se=class Se{constructor(e,t){this.width=e;this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new Se(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof Se?e:new Se(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Se.None=new Se(0,0);var pr=Se;var xu=new class{constructor(){this.mutationObservers=new Map}observe(i,e,t){let n=this.mutationObservers.get(i);n||(n=new Map,this.mutationObservers.set(i,n));let s=ur(t),o=n.get(s);if(o)o.users+=1;else{let r=new R,a=new MutationObserver(u=>r.fire(u));a.observe(i,t);let l=o={users:1,observer:a,onDidMutate:r.event};e.add(F(()=>{l.users-=1,l.users===0&&(r.dispose(),a.disconnect(),n?.delete(s),n?.size===0&&this.mutationObservers.delete(i))})),n.set(s,o)}return o.onDidMutate}};var ks={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:at?"webkitAnimationStart":"animationstart",ANIMATION_END:at?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:at?"webkitAnimationIteration":"animationiteration"};var Ps=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function fr(i,e,t,...n){let s=Ps.exec(e);if(!s)throw new Error("Bad use of emmet");let o=s[1]||"div",r;return i!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(i,o):r=document.createElement(o),s[3]&&(r.id=s[3]),s[4]&&(r.className=s[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?r[a]=l:a==="selected"?l&&r.setAttribute(a,"true"):r.setAttribute(a,l))}),r.append(...n),r}function Bs(i,e,...t){return fr("http://www.w3.org/1999/xhtml",i,e,...t)}Bs.SVG=function(i,e,...t){return fr("http://www.w3.org/2000/svg",i,e,...t)};var li=class extends N{constructor(t,n,s,o,r,a,l,u,c){super();this._terminal=t;this._characterJoinerService=n;this._charSizeService=s;this._coreBrowserService=o;this._coreService=r;this._decorationService=a;this._optionsService=l;this._themeService=u;this._cursorBlinkStateManager=new be;this._charAtlasDisposable=this._register(new be);this._observerDisposable=this._register(new be);this._model=new Kt;this._workCell=new st;this._workCell2=new st;this._rectangleRenderer=this._register(new be);this._glyphRenderer=this._register(new be);this._onChangeTextureAtlas=this._register(new R);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this._register(new R);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this._register(new R);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onRequestRedraw=this._register(new R);this.onRequestRedraw=this._onRequestRedraw.event;this._onContextLoss=this._register(new R);this.onContextLoss=this._onContextLoss.event;this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Dt(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new jt(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,l,this._themeService)],this.dimensions=mn(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(l.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(ai(this._canvas,"webglcontextlost",h=>{console.log("webglcontextlost event received"),h.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(h)},3e3)})),this._register(ai(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ai(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Mi(this._canvas,this._coreBrowserService.window,(h,b)=>this._setCanvasDevicePixelDimensions(h,b)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=Mi(this._canvas,h,(b,E)=>this._setCanvasDevicePixelDimensions(b,E))})),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(F(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),Ai(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let s of this._renderLayers)s.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,s){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,t,n,s);this._model.selection.update(this._core,t,n,s),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new zt(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new $t(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=Bt(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=Et(te.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),te.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(t){return-1}deregisterCharacterJoiner(t){return!1}renderRows(t,n){if(!this._isAttached)if(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),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 Ut(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let s=this._core,o=this._workCell,r,a,l,u,c,d,h,b,E,I,A,P,L,U;t=mr(t,s.rows-1,0),n=mr(n,s.rows-1,0);let x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,w=x-s.buffer.ydisp,D=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),$=-1,me=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let _e=!1;for(a=t;a<=n;a++)for(l=a+s.buffer.ydisp,u=s.buffer.lines.get(l),this._model.lineLengths[a]=0,c=this._characterJoinerService.getJoinedCharacters(l),L=0;L<s.cols;L++)if(r=this._cellColorResolver.result.bg,u.loadCell(L,o),L===0&&(r=this._cellColorResolver.result.bg),d=!1,h=L,c.length>0&&L===c[0][0]&&(d=!0,b=c.shift(),o=new Vi(o,u.translateToString(!0,b[0],b[1]),b[1]-b[0]),h=b[1]-1),E=o.getChars(),I=o.getCode(),P=(a*s.cols+L)*$e,this._cellColorResolver.resolve(o,L,l,this.dimensions.device.cell.width),me&&l===x&&(L===D&&(this._model.cursor={x:D,y:w,width:o.getWidth(),style:this._coreBrowserService.isFocused?s.options.cursorStyle||"block":s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},$=D+o.getWidth()-1),L>=D&&L<=$&&(this._coreBrowserService.isFocused&&(s.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&s.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),I!==0&&(this._model.lineLengths[a]=L+1),!(this._model.cells[P]===I&&this._model.cells[P+Ke]===this._cellColorResolver.result.bg&&this._model.cells[P+Ve]===this._cellColorResolver.result.fg&&this._model.cells[P+Vt]===this._cellColorResolver.result.ext)&&(_e=!0,E.length>1&&(I|=Un),this._model.cells[P]=I,this._model.cells[P+Ke]=this._cellColorResolver.result.bg,this._model.cells[P+Ve]=this._cellColorResolver.result.fg,this._model.cells[P+Vt]=this._cellColorResolver.result.ext,A=o.getWidth(),this._glyphRenderer.value.updateCell(L,a,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,A,r),d))for(o=this._workCell,L++;L<h;L++)U=(a*s.cols+L)*$e,this._glyphRenderer.value.updateCell(L,a,0,0,0,0,hn,0,0),this._model.cells[U]=0,this._model.cells[U+Ke]=this._cellColorResolver.result.bg,this._model.cells[U+Ve]=this._cellColorResolver.result.fg,this._model.cells[U+Vt]=this._cellColorResolver.result.ext;_e&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},Vi=class extends ae{constructor(t,n,s){super();this.content=0;this.combinedData="";this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function mr(i,e,t=0){return Math.max(Math.min(i,e),t)}var _r="di$target",br="di$dependencies",Ci=new Map;function le(i){if(Ci.has(i))return Ci.get(i);let e=function(t,n,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ns(e,t,s)};return e.toString=()=>i,Ci.set(i,e),e}function Ns(i,e,t){e[_r]===e?e[br].push({id:i,index:t}):(e[br]=[{id:i,index:t}],e[_r]=e)}var $u=le("BufferService"),Ku=le("CoreMouseService"),Vu=le("CoreService"),Cu=le("CharsetService"),zu=le("InstantiationService");var qu=le("LogService"),Tr=le("OptionsService"),ju=le("OscLinkService"),Xu=le("UnicodeService"),Yu=le("DecorationService");var Us={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hs="xterm.js: ",ui=class extends N{constructor(t){super();this._optionsService=t;this._logLevel=5;this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),vr=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Us[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":Hs)+n,...s)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};ui=Xi([Yi(0,Tr)],ui);var vr;function gr(i){vr=i}var xr=class extends N{constructor(t){if(bi&&dn()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=t;this._onChangeTextureAtlas=this._register(new R);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this._register(new R);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this._register(new R);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onContextLoss=this._register(new R);this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=n.coreService,o=n.optionsService,r=n,a=r._renderService,l=r._characterJoinerService,u=r._charSizeService,c=r._coreBrowserService,d=r._decorationService,h=r._logService,b=r._themeService;gr(h),this._renderer=this._register(new li(t,l,u,c,s,d,o,b,this._preserveDrawingBuffer)),this._register(te.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(te.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(te.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(te.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(F(()=>{if(this._terminal._core._store._isDisposed)return;let E=this._terminal._core._renderService;E.setRenderer(this._terminal._core._createRenderer()),E.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{xr as WebglAddon};
100
+ }`,Ee=8,ki=Ee*Float32Array.BYTES_PER_ELEMENT,as=20*Ee,Ct=class{constructor(){this.attributes=new Float32Array(as),this.count=0}},xe=0,Hn=0,Wn=0,Gn=0,$n=0,Kn=0,Vn=0,zt=class extends N{constructor(t,n,s,o){super();this._terminal=t;this._gl=n;this._dimensions=s;this._themeService=o;this._vertices=new Ct;this._verticesCursor=new Ct;let r=this._gl;this._program=k(Gt(r,ss,os)),this._register(F(()=>r.deleteProgram(this._program))),this._projectionLocation=k(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),l=r.createBuffer();this._register(F(()=>r.deleteBuffer(l))),r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let u=new Uint8Array([0,1,2,3]),c=r.createBuffer();this._register(F(()=>r.deleteBuffer(c))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,c),r.bufferData(r.ELEMENT_ARRAY_BUFFER,u,r.STATIC_DRAW),this._attributesBuffer=k(r.createBuffer()),this._register(F(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,ki,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,ki,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,ki,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this._register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),n.uniformMatrix4fv(this._projectionLocation,!1,Wt),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,t.attributes,n.DYNAMIC_DRAW),n.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let n=this._terminal,s=this._vertices,o=1,r,a,l,u,c,d,h,b,E,I,A;for(r=0;r<n.rows;r++){for(l=-1,u=0,c=0,d=!1,a=0;a<n.cols;a++)h=(r*n.cols+a)*$e,b=t.cells[h+Ke],E=t.cells[h+Ve],I=!!(E&67108864),(b!==u||E!==c&&(d||I))&&((u!==0||d&&c!==0)&&(A=o++*Ee,this._updateRectangle(s,A,c,u,l,a,r)),l=a,u=b,c=E,d=I);(u!==0||d&&c!==0)&&(A=o++*Ee,this._updateRectangle(s,A,c,u,l,n.cols,r))}s.count=o}updateCursor(t){let n=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){n.count=0;return}let o,r=0;(s.style==="bar"||s.style==="outline")&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(o=r++*Ee,this._addRectangleFloat(n.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),o=r++*Ee,this._addRectangleFloat(n.attributes,o,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.count=r}_updateRectangle(t,n,s,o,r,a,l){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:xe=(s&16777215)<<8;break;case 0:default:xe=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:xe=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:xe=(o&16777215)<<8;break;case 0:default:xe=this._themeService.colors.background.rgba}t.attributes.length<n+4&&(t.attributes=Bn(t.attributes,this._terminal.rows*this._terminal.cols*Ee)),Hn=r*this._dimensions.device.cell.width,Wn=l*this._dimensions.device.cell.height,Gn=(xe>>24&255)/255,$n=(xe>>16&255)/255,Kn=(xe>>8&255)/255,Vn=1,this._addRectangle(t.attributes,n,Hn,Wn,(a-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Gn,$n,Kn,Vn)}_addRectangle(t,n,s,o,r,a,l,u,c,d){t[n]=s/this._dimensions.device.canvas.width,t[n+1]=o/this._dimensions.device.canvas.height,t[n+2]=r/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=l,t[n+5]=u,t[n+6]=c,t[n+7]=d}_addRectangleFloat(t,n,s,o,r,a,l){t[n]=s/this._dimensions.device.canvas.width,t[n+1]=o/this._dimensions.device.canvas.height,t[n+2]=r/this._dimensions.device.canvas.width,t[n+3]=a/this._dimensions.device.canvas.height,t[n+4]=l[0],t[n+5]=l[1],t[n+6]=l[2],t[n+7]=l[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}};var qt=class extends N{constructor(t,n,s,o,r,a,l,u){super();this._container=n;this._alpha=r;this._coreBrowserService=a;this._optionsService=l;this._themeService=u;this._deviceCharWidth=0;this._deviceCharHeight=0;this._deviceCellWidth=0;this._deviceCellHeight=0;this._deviceCharLeft=0;this._deviceCharTop=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(c=>{this._refreshCharAtlas(t,c),this.reset(t)})),this._register(F(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=k(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,s){}handleSelectionChanged(t,n,s,o=!1){}_setTransparency(t,n){if(n===this._alpha)return;let s=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Bt(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,s,o){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(t,n,s,o){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=At,this._clipCell(s,o,n.getWidth()),this._ctx.fillText(n.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,s){let o=n?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${o} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}};var jt=class extends qt{constructor(e,t,n,s,o,r,a){super(n,e,"link",t,!0,o,r,a),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===vn?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Fn(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}};var ie=typeof window=="object"?window:globalThis;var Qt=class Qt{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new R;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new R;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Qt.INSTANCE=new Qt;var Yt=Qt;function ls(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}var Ua=Yt.INSTANCE.onDidChangeZoomLevel;var Ha=Yt.INSTANCE.onDidChangeFullscreen,Ce=typeof navigator=="object"?navigator.userAgent:"",Cn=Ce.indexOf("Firefox")>=0,at=Ce.indexOf("AppleWebKit")>=0,zn=Ce.indexOf("Chrome")>=0,Pi=!zn&&Ce.indexOf("Safari")>=0;var Wa=Ce.indexOf("Electron/")>=0,Ga=Ce.indexOf("Android")>=0,Xt=!1;if(typeof ie.matchMedia=="function"){let i=ie.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ie.matchMedia("(display-mode: fullscreen)");Xt=i.matches,ls(ie,i,({matches:t})=>{Xt&&e.matches||(Xt=t)})}function qn(){return Xt}var ze="en",Ni=!1,ii=!1,ei=!1,us=!1,Xn=!1,Yn=!1,cs=!1,ds=!1,hs=!1,ps=!1,Jt,ti=ze,jn=ze,fs,ye,Ie=globalThis,ne;typeof Ie.vscode<"u"&&typeof Ie.vscode.process<"u"?ne=Ie.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ne=process);var Qn=typeof ne?.versions?.electron=="string",ms=Qn&&ne?.type==="renderer";if(typeof ne=="object"){Ni=ne.platform==="win32",ii=ne.platform==="darwin",ei=ne.platform==="linux",us=ei&&!!ne.env.SNAP&&!!ne.env.SNAP_REVISION,cs=Qn,hs=!!ne.env.CI||!!ne.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jt=ze,ti=ze;let i=ne.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);Jt=e.userLocale,jn=e.osLocale,ti=e.resolvedLanguage||ze,fs=e.languagePack?.translationsConfigFile}catch{}Xn=!0}else typeof navigator=="object"&&!ms?(ye=navigator.userAgent,Ni=ye.indexOf("Windows")>=0,ii=ye.indexOf("Macintosh")>=0,ds=(ye.indexOf("Macintosh")>=0||ye.indexOf("iPad")>=0||ye.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ei=ye.indexOf("Linux")>=0,ps=ye?.indexOf("Mobi")>=0,Yn=!0,ti=globalThis._VSCODE_NLS_LANGUAGE||ze,Jt=navigator.language.toLowerCase(),jn=Jt):console.error("Unable to resolve platform.");var Bi=0;ii?Bi=1:Ni?Bi=3:ei&&(Bi=2);var lt=ii;var ni=Xn;var _s=Yn&&typeof Ie.importScripts=="function",$a=_s?Ie.origin:void 0;var fe=ye,Re=ti,bs;(n=>{function i(){return Re}n.value=i;function e(){return Re.length===2?Re==="en":Re.length>=3?Re[0]==="e"&&Re[1]==="n"&&Re[2]==="-":!1}n.isDefaultVariant=e;function t(){return Re==="en"}n.isDefault=t})(bs||={});var Ts=typeof Ie.postMessage=="function"&&!Ie.importScripts,Zn=(()=>{if(Ts){let i=[];Ie.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,s=i.length;n<s;n++){let o=i[n];if(o.id===t.data.vscodeScheduleAsyncWork){i.splice(n,1),o.callback();return}}});let e=0;return t=>{let n=++e;i.push({id:n,callback:t}),Ie.postMessage({vscodeScheduleAsyncWork:n},"*")}}return i=>setTimeout(i)})();var vs=!!(fe&&fe.indexOf("Chrome")>=0),Ka=!!(fe&&fe.indexOf("Firefox")>=0),Va=!!(!vs&&fe&&fe.indexOf("Safari")>=0),Ca=!!(fe&&fe.indexOf("Edg/")>=0),za=!!(fe&&fe.indexOf("Android")>=0);var De=typeof navigator=="object"?navigator:{},gs={clipboard:{writeText:ni||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(De&&De.clipboard&&De.clipboard.writeText),readText:ni||!!(De&&De.clipboard&&De.clipboard.readText)},keyboard:ni||qn()?0:De.keyboard||Pi?1:2,touch:"ontouchstart"in ie||De.maxTouchPoints>0,pointerEvents:ie.PointerEvent&&("ontouchstart"in ie||navigator.maxTouchPoints>0)};var ut=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ui=new ut,Jn=new ut,er=new ut,xs=new Array(230);var tr;(r=>{function i(a){return Ui.keyCodeToStr(a)}r.toString=i;function e(a){return Ui.strToKeyCode(a)}r.fromString=e;function t(a){return Jn.keyCodeToStr(a)}r.toUserSettingsUS=t;function n(a){return er.keyCodeToStr(a)}r.toUserSettingsGeneral=n;function s(a){return Jn.strToKeyCode(a)||er.strToKeyCode(a)}r.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ui.keyCodeToStr(a)}r.toElectronAccelerator=o})(tr||={});var al=lt?256:2048,ll=512,ul=1024,cl=lt?2048:256;var nr=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),ys;(n=>{function i(s){return s===n.None||s===n.Cancelled||s instanceof Hi?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}n.isCancellationToken=i,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:te.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:nr})})(ys||={});var Hi=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?nr:(this._emitter||(this._emitter=new R),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Is=Symbol("MicrotaskDelay");var Ls,si;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?si=(i,e)=>{Zn(()=>{if(t)return;let n=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let t=!1;return{dispose(){t||(t=!0)}}}:si=(i,e,t)=>{let n=i.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),s=!1;return{dispose(){s||(s=!0,i.cancelIdleCallback(n))}}},Ls=i=>si(globalThis,i)})();var ws;(t=>{async function i(n){let s,o=await Promise.all(n.map(r=>r.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return o}t.settled=i;function e(n){return new Promise(async(s,o)=>{try{await n(s,o)}catch(r){o(r)}})}t.withAsyncBody=e})(ws||={});var Z=class Z{static fromArray(e){return new Z(t=>{t.emitMany(e)})}static fromPromise(e){return new Z(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Z(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new Z(async t=>{await Promise.all(e.map(async n=>{for await(let s of n)t.emitOne(s)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new R,queueMicrotask(async()=>{let n={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(n)),this.resolve()}catch(s){this.reject(s)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await te.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new Z(async n=>{for await(let s of e)n.emitOne(t(s))})}map(e){return Z.map(this,e)}static filter(e,t){return new Z(async n=>{for await(let s of e)t(s)&&n.emitOne(s)})}filter(e){return Z.filter(this,e)}static coalesce(e){return Z.filter(e,t=>!!t)}coalesce(){return Z.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return Z.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Z.EMPTY=Z.fromArray([]);var rr=Z;function sr(i){return 55296<=i&&i<=56319}function Wi(i){return 56320<=i&&i<=57343}function or(i,e){return(i-55296<<10)+(e-56320)+65536}function ur(i){return $i(i,0)}function $i(i,e){switch(typeof i){case"object":return i===null?Le(349,e):Array.isArray(i)?As(i,e):Ms(i,e);case"string":return cr(i,e);case"boolean":return Ds(i,e);case"number":return Le(i,e);case"undefined":return Le(937,e);default:return Le(617,e)}}function Le(i,e){return(e<<5)-e+i|0}function Ds(i,e){return Le(i?433:863,e)}function cr(i,e){e=Le(149417,e);for(let t=0,n=i.length;t<n;t++)e=Le(i.charCodeAt(t),e);return e}function As(i,e){return e=Le(104579,e),i.reduce((t,n)=>$i(n,t),e)}function Ms(i,e){return e=Le(181387,e),Object.keys(i).sort().reduce((t,n)=>(t=cr(n,t),$i(i[n],t)),e)}function Gi(i,e,t=32){let n=t-e,s=~((1<<n)-1);return(i<<e|(s&i)>>>n)>>>0}function ar(i,e=0,t=i.byteLength,n=0){for(let s=0;s<t;s++)i[e+s]=n}function Ss(i,e,t="0"){for(;i.length<e;)i=t+i;return i}function ct(i,e=32){return i instanceof ArrayBuffer?Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join(""):Ss((i>>>0).toString(16),e/4)}var oi=class oi{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,s=this._buffLen,o=this._leftoverHighSurrogate,r,a;for(o!==0?(r=o,a=-1,o=0):(r=e.charCodeAt(0),a=0);;){let l=r;if(sr(r))if(a+1<t){let u=e.charCodeAt(a+1);Wi(u)?(a++,l=or(r,u)):l=65533}else{o=r;break}else Wi(r)&&(l=65533);if(s=this._push(n,s,l),a++,a<t)r=e.charCodeAt(a);else break}this._buffLen=s,this._leftoverHighSurrogate=o}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ct(this._h0)+ct(this._h1)+ct(this._h2)+ct(this._h3)+ct(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,ar(this._buff,this._buffLen),this._buffLen>56&&(this._step(),ar(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=oi._bigBlock32,t=this._buffDV;for(let d=0;d<64;d+=4)e.setUint32(d,t.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)e.setUint32(d,Gi(e.getUint32(d-12,!1)^e.getUint32(d-32,!1)^e.getUint32(d-56,!1)^e.getUint32(d-64,!1),1),!1);let n=this._h0,s=this._h1,o=this._h2,r=this._h3,a=this._h4,l,u,c;for(let d=0;d<80;d++)d<20?(l=s&o|~s&r,u=1518500249):d<40?(l=s^o^r,u=1859775393):d<60?(l=s&o|s&r|o&r,u=2400959708):(l=s^o^r,u=3395469782),c=Gi(n,5)+l+a+u+e.getUint32(d*4,!1)&4294967295,a=r,r=o,o=Gi(s,30),s=n,n=c;this._h0=this._h0+n&4294967295,this._h1=this._h1+s&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};oi._bigBlock32=new DataView(new ArrayBuffer(320));var lr=oi;var{registerWindow:hu,getWindow:Os,getDocument:pu,getWindows:fu,getWindowsCount:mu,getWindowId:dr,getWindowById:_u,hasWindow:bu,onDidRegisterWindow:Tu,onWillUnregisterWindow:vu,onDidUnregisterWindow:gu}=function(){let i=new Map;ie;let e={window:ie,disposables:new he};i.set(ie.vscodeWindowId,e);let t=new R,n=new R,s=new R;function o(r,a){return(typeof r=="number"?i.get(r):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:n.event,registerWindow(r){if(i.has(r.vscodeWindowId))return N.None;let a=new he,l={window:r,disposables:a.add(new he)};return i.set(r.vscodeWindowId,l),a.add(F(()=>{i.delete(r.vscodeWindowId),n.fire(r)})),a.add(ai(r,ks.BEFORE_UNLOAD,()=>{s.fire(r)})),t.fire(l),a},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return i.has(r)},getWindowById:o,getWindow(r){let a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=r;return l?.view?l.view.window:ie},getDocument(r){return Os(r).document}}}();var Ki=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ai(i,e,t,n){return new Ki(i,e,t,n)}var Fs,hr;var dt=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Fe(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,n=new Map,s=o=>{t.set(o,!1);let r=i.get(o)??[];for(e.set(o,r),i.set(o,[]),n.set(o,!0);r.length>0;)r.sort(dt.sort),r.shift().execute();n.set(o,!1)};hr=(o,r,a=0)=>{let l=dr(o),u=new dt(r,a),c=i.get(l);return c||(c=[],i.set(l,c)),c.push(u),t.get(l)||(t.set(l,!0),o.requestAnimationFrame(()=>s(l))),u},Fs=(o,r,a)=>{let l=dr(o);if(n.get(l)){let u=new dt(r,a),c=e.get(l);return c||(c=[],e.set(l,c)),c.push(u),u}else return hr(o,r,a)}})();var Se=class Se{constructor(e,t){this.width=e;this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new Se(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof Se?e:new Se(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Se.None=new Se(0,0);var pr=Se;var xu=new class{constructor(){this.mutationObservers=new Map}observe(i,e,t){let n=this.mutationObservers.get(i);n||(n=new Map,this.mutationObservers.set(i,n));let s=ur(t),o=n.get(s);if(o)o.users+=1;else{let r=new R,a=new MutationObserver(u=>r.fire(u));a.observe(i,t);let l=o={users:1,observer:a,onDidMutate:r.event};e.add(F(()=>{l.users-=1,l.users===0&&(r.dispose(),a.disconnect(),n?.delete(s),n?.size===0&&this.mutationObservers.delete(i))})),n.set(s,o)}return o.onDidMutate}};var ks={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:at?"webkitAnimationStart":"animationstart",ANIMATION_END:at?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:at?"webkitAnimationIteration":"animationiteration"};var Ps=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function fr(i,e,t,...n){let s=Ps.exec(e);if(!s)throw new Error("Bad use of emmet");let o=s[1]||"div",r;return i!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(i,o):r=document.createElement(o),s[3]&&(r.id=s[3]),s[4]&&(r.className=s[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?r[a]=l:a==="selected"?l&&r.setAttribute(a,"true"):r.setAttribute(a,l))}),r.append(...n),r}function Bs(i,e,...t){return fr("http://www.w3.org/1999/xhtml",i,e,...t)}Bs.SVG=function(i,e,...t){return fr("http://www.w3.org/2000/svg",i,e,...t)};var li=class extends N{constructor(t,n,s,o,r,a,l,u,c){super();this._terminal=t;this._characterJoinerService=n;this._charSizeService=s;this._coreBrowserService=o;this._coreService=r;this._decorationService=a;this._optionsService=l;this._themeService=u;this._cursorBlinkStateManager=new be;this._charAtlasDisposable=this._register(new be);this._observerDisposable=this._register(new be);this._model=new Kt;this._workCell=new st;this._workCell2=new st;this._rectangleRenderer=this._register(new be);this._glyphRenderer=this._register(new be);this._onChangeTextureAtlas=this._register(new R);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this._register(new R);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this._register(new R);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onRequestRedraw=this._register(new R);this.onRequestRedraw=this._onRequestRedraw.event;this._onContextLoss=this._register(new R);this.onContextLoss=this._onContextLoss.event;this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Dt(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new jt(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,l,this._themeService)],this.dimensions=mn(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(l.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(ai(this._canvas,"webglcontextlost",h=>{console.log("webglcontextlost event received"),h.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(h)},3e3)})),this._register(ai(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ai(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Mi(this._canvas,this._coreBrowserService.window,(h,b)=>this._setCanvasDevicePixelDimensions(h,b)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=Mi(this._canvas,h,(b,E)=>this._setCanvasDevicePixelDimensions(b,E))})),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(F(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),Ai(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let s of this._renderLayers)s.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,s){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,t,n,s);this._model.selection.update(this._core,t,n,s),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new zt(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new $t(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=Bt(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=Et(te.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),te.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),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 Ut(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let s=this._core,o=this._workCell,r,a,l,u,c,d,h,b,E,I,A,P,L,U;t=mr(t,s.rows-1,0),n=mr(n,s.rows-1,0);let x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,w=x-s.buffer.ydisp,D=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),$=-1,me=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let _e=!1;for(a=t;a<=n;a++)for(l=a+s.buffer.ydisp,u=s.buffer.lines.get(l),this._model.lineLengths[a]=0,c=this._characterJoinerService.getJoinedCharacters(l),L=0;L<s.cols;L++)if(r=this._cellColorResolver.result.bg,u.loadCell(L,o),L===0&&(r=this._cellColorResolver.result.bg),d=!1,h=L,c.length>0&&L===c[0][0]&&(d=!0,b=c.shift(),o=new Vi(o,u.translateToString(!0,b[0],b[1]),b[1]-b[0]),h=b[1]-1),E=o.getChars(),I=o.getCode(),P=(a*s.cols+L)*$e,this._cellColorResolver.resolve(o,L,l,this.dimensions.device.cell.width),me&&l===x&&(L===D&&(this._model.cursor={x:D,y:w,width:o.getWidth(),style:this._coreBrowserService.isFocused?s.options.cursorStyle||"block":s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},$=D+o.getWidth()-1),L>=D&&L<=$&&(this._coreBrowserService.isFocused&&(s.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&s.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),I!==0&&(this._model.lineLengths[a]=L+1),!(this._model.cells[P]===I&&this._model.cells[P+Ke]===this._cellColorResolver.result.bg&&this._model.cells[P+Ve]===this._cellColorResolver.result.fg&&this._model.cells[P+Vt]===this._cellColorResolver.result.ext)&&(_e=!0,E.length>1&&(I|=Un),this._model.cells[P]=I,this._model.cells[P+Ke]=this._cellColorResolver.result.bg,this._model.cells[P+Ve]=this._cellColorResolver.result.fg,this._model.cells[P+Vt]=this._cellColorResolver.result.ext,A=o.getWidth(),this._glyphRenderer.value.updateCell(L,a,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,A,r),d)){for(o=this._workCell,L++;L<=h;L++)U=(a*s.cols+L)*$e,this._glyphRenderer.value.updateCell(L,a,0,0,0,0,hn,0,0),this._model.cells[U]=0,this._model.cells[U+Ke]=this._cellColorResolver.result.bg,this._model.cells[U+Ve]=this._cellColorResolver.result.fg,this._model.cells[U+Vt]=this._cellColorResolver.result.ext;L--}_e&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},Vi=class extends ae{constructor(t,n,s){super();this.content=0;this.combinedData="";this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function mr(i,e,t=0){return Math.max(Math.min(i,e),t)}var _r="di$target",br="di$dependencies",Ci=new Map;function le(i){if(Ci.has(i))return Ci.get(i);let e=function(t,n,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ns(e,t,s)};return e.toString=()=>i,Ci.set(i,e),e}function Ns(i,e,t){e[_r]===e?e[br].push({id:i,index:t}):(e[br]=[{id:i,index:t}],e[_r]=e)}var $u=le("BufferService"),Ku=le("CoreMouseService"),Vu=le("CoreService"),Cu=le("CharsetService"),zu=le("InstantiationService");var qu=le("LogService"),Tr=le("OptionsService"),ju=le("OscLinkService"),Xu=le("UnicodeService"),Yu=le("DecorationService");var Us={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hs="xterm.js: ",ui=class extends N{constructor(t){super();this._optionsService=t;this._logLevel=5;this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),vr=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Us[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":Hs)+n,...s)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};ui=Xi([Yi(0,Tr)],ui);var vr;function gr(i){vr=i}var xr=class extends N{constructor(t){if(bi&&dn()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=t;this._onChangeTextureAtlas=this._register(new R);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this._register(new R);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this._register(new R);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onContextLoss=this._register(new R);this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=n.coreService,o=n.optionsService,r=n,a=r._renderService,l=r._characterJoinerService,u=r._charSizeService,c=r._coreBrowserService,d=r._decorationService,h=r._logService,b=r._themeService;gr(h),this._renderer=this._register(new li(t,l,u,c,s,d,o,b,this._preserveDrawingBuffer)),this._register(te.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(te.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(te.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(te.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(F(()=>{if(this._terminal._core._store._isDisposed)return;let E=this._terminal._core._renderService;E.setRenderer(this._terminal._core._createRenderer()),E.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{xr as WebglAddon};
101
101
  //# sourceMappingURL=addon-webgl.mjs.map